From 3b134f4f66c11f3eca0e1148a78ca7e9cfccd3ff Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 14 Jul 2026 15:33:24 +0900 Subject: [PATCH 01/28] feat(onboarding): add natural-language initialization --- README.html | 51 +- README.ja.md | 74 +- README.ko.html | 54 +- README.ko.md | 74 +- README.md | 74 +- README.zh.md | 74 +- docs/glossary.md | 2 + docs/setup.md | 14 +- plugins/claude-code/commands/init.md | 2 +- plugins/claude-code/dist/clad.js | 681 +++++++++--------- plugins/codex/skills/init/SKILL.md | 2 +- plugins/gemini-cli/commands/init.toml | 2 +- skills/init/SKILL.md | 2 +- spec.yaml | 4 +- spec/capabilities.yaml | 2 +- .../natural-language-init-0f4dd6.yaml | 76 ++ spec/index.yaml | 1 + src/cli/clad.ts | 7 + src/cli/clarify.ts | 4 + src/cli/hook.ts | 5 +- src/cli/init.ts | 2 +- src/init/host-setup.ts | 2 +- src/serve/server.ts | 150 +++- src/ui/softShell.ts | 4 +- tests/cli/setup.test.ts | 23 +- tests/serve/init-tools.test.ts | 178 +++++ 26 files changed, 1077 insertions(+), 487 deletions(-) create mode 100644 spec/features/natural-language-init-0f4dd6.yaml create mode 100644 tests/serve/init-tools.test.ts diff --git a/README.html b/README.html index 7dc6b71a..db8e0350 100644 --- a/README.html +++ b/README.html @@ -481,40 +481,47 @@

Ecosystem

Install

+

1. Install and connect your AI tools

npm install -g cladding   # the cladding CLI
-cd <project>              # your project
 clad setup                # auto-wire your AI tools (Claude · Codex · Gemini · Cursor)
-

Each host wires cladding as an MCP server the AI calls on its own — there's no /mcp command and no manual connect step; you just chat.

+

Run these once on your machine, from any directory. clad setup connects supported AI tools globally; it does not create or modify project files.

-

Then, once per project, call init inside your AI tool:

-
[inside your AI tool] /cladding:init "B2B payment SaaS"
+

2. Start your AI tool from the project

+
cd <project>
+

Next step: Start your AI tool with this project as its workspace. Run Codex, Claude Code, or Gemini CLI from this directory, or open this folder in Cursor. The connection created by clad setup takes effect in the new session.

-

It creates the project's spec.yaml and supporting docs. After that, just develop as usual — cladding runs the before/after loop in the background, with nothing to memorize. Raise enforcement with clad init --with-hook (pre-commit + pre-push git hooks) or clad init --with-ci (scaffold the CI gate, where true enforcement lives).

+

3. Apply Cladding once

+

Choose the starting point that fits and say it naturally in your AI tool.

- - - - - - - - - -
Starting pointCommandWhat happens
An idea, nothing else/cladding:init "I'm going to build a B2B payment SaaS"the LLM analyzes the domain → spec · docs · policies + 2–3 follow-up questions
A planning doc/cladding:init docs/plan.mdloads the file and uses its contents as intent
An existing project/cladding:init "apply cladding to this project"scans the existing code → observed patterns merged with your intent
+

An idea, nothing else

+
Start this B2B payment SaaS with Cladding.
+

The LLM analyzes the domain, creates the spec, docs, and policies, then asks 2–3 follow-up questions.

+ +

A planning document

+
Apply Cladding using docs/plan.md.
+

Cladding loads the file and uses its contents as the project intent.

+ +

An existing project

+
Analyze this project and apply Cladding.
+

Cladding scans the existing code and combines the observed patterns with your intent.

-

Host support (honest): Claude Code is fully verified through real-usage campaigns (incl. real-time intervention). Codex · Gemini CLI wire automatically; their behavior isn't verified yet. Cursor wires automatically, but real-usage verification is still pending. → setup details · host wiring · MCP · upgrading

+

Once initialization is complete, keep developing in the same conversation. Ask for the next feature in plain language; the AI uses the generated spec and docs while cladding runs its verification loop in the background.

+
Implement email sign-in, including tests.
+

There is nothing new to memorize. For host-specific invocation, stricter Git/CI enforcement, and verified host status, see setup details.

Update

-

Staying current is two commands — or one line to your AI tool.

+

Ask your AI tool (recommended)

+

From your project, say:

+
Update cladding to the latest version.
+

If your host allows terminal and global-install access, the AI runs both update steps and explains any new drift. Otherwise, it shows you the commands to approve or run yourself.

+

Or update from the terminal

npm update -g cladding   # 1. get the new version
 cd <project>             # 2. your project
-clad update              # 3. bring it in line
-

Your code · spec.yaml · docs are left untouched — a stricter version only points things out, it never blocks or fixes on its own. If those two commands flag fresh drift, hand it to your AI tool:

-
[inside your AI tool] reconcile the drift the update flagged
-

…or skip the commands and just ask, the same way you ran init — it runs the update for you:

-
[inside your AI tool] update cladding to the latest version
+clad update # 3. align this project with the installed version +

The update preserves your code, spec.yaml, and docs. If the new version reports drift, hand that result to your AI tool:

+
Reconcile the drift the update flagged.

Status

diff --git a/README.ja.md b/README.ja.md index f82cceac..d4b16dec 100644 --- a/README.ja.md +++ b/README.ja.md @@ -241,53 +241,87 @@ cladding の差別化点は *組み合わせ* にある — 上のカテゴリ ## Install +### 1. インストールして AI ツールを接続する + ```bash npm install -g cladding # cladding CLI をインストール -cd # プロジェクトへ移動 clad setup # AI ツールを自動配線(Claude · Codex · Gemini · Cursor) ``` -各ホストは cladding を MCP サーバーとして接続し、AI が自分で呼び出す — `/mcp` コマンドも手動での接続手順もなく、ただ普通に会話するだけでいい。 +上のコマンドはどのディレクトリからでも実行でき、マシンごとに一度だけでよい。`clad setup` は対応する AI ツールをグローバルに接続するだけで、プロジェクトファイルは作成・変更しない。 + +### 2. プロジェクトから AI ツールを起動する + +```bash +cd +``` + +> **次のステップ:** このプロジェクトをワークスペースとして AI ツールを新しく起動する。Codex・Claude Code・Gemini CLI はこのディレクトリから実行し、Cursor ではこのフォルダを開く。`clad setup` の接続は新しいセッションから有効になる。 + +### 3. Cladding を一度適用する + +自分の出発点に合う依頼を AI ツールへ自然な言葉で伝える。 + +#### アイデアだけがある場合 + +``` +B2B 決済 SaaS を cladding で始めて。 +``` + +LLM がドメインを分析し、spec・ドキュメント・ポリシーを作成してから、2〜3 個の追加質問を行う。 + +#### 企画ドキュメントがある場合 + +``` +docs/plan.md を基に cladding を適用して。 +``` + +ファイルを読み込み、その内容をプロジェクトの intent として使用する。 -続いて、プロジェクトにつき一度だけ、AI ツールの中から init を呼び出す: +#### 既存プロジェクトへ導入する場合 ``` -[AI ツールの中で] /cladding:init "B2B 決済 SaaS" +現在のコードを分析して cladding を適用して。 ``` -プロジェクトの `spec.yaml` と関連ドキュメントが作られる。あとはいつも通り開発するだけ — cladding が前 / 後のループを裏で回すので、覚えるコマンドはない。強制力を上げたいときは `clad init --with-hook`(pre-commit + pre-push の git hook)または `clad init --with-ci`(CI ゲートの雛形を生成 — 本当の強制は CI にある)。 +既存コードをスキャンし、観察したパターンとユーザーの intent を組み合わせる。 + +> **初期化が完了したら、同じ会話でそのまま開発を続ければよい。** 次の機能を自然な言葉で依頼すると、AI は生成された spec とドキュメントを基準に開発し、cladding はバックグラウンドで検証ループを実行する。 -| 出発点 | コマンド | 何が起きるか | -|---|---|---| -| **アイデアだけがある** | `/cladding:init "B2B 決済 SaaS を作る"` | LLM がドメインを分析 → spec · ドキュメント · ポリシーを自動生成 + 2〜3 個の追加質問 | -| **企画ドキュメントがある** | `/cladding:init docs/plan.md` | ファイルを読み込み、その内容を intent として使う | -| **既存プロジェクトへ導入する** | `/cladding:init "このプロジェクトに cladding を適用して"` | 既存コードをスキャン → 観察したパターンと intent を結合 | +``` +メールログイン機能をテスト込みで実装して。 +``` -**host サポート(正直な注記):** Claude Code は実利用キャンペーン(リアルタイム介入を含む)で全機能を検証済み。Codex · Gemini CLI は配線は自動だが、動作はまだ未検証だ。Cursor は配線は自動だが、実利用での検証はまだこれから。→ [セットアップ詳細 · host 配線 · MCP · アップグレード](docs/setup.md) +新しく覚えるコマンドはない。ホスト別の明示的な呼び出し方、より強い Git/CI 適用、検証済みホストの状況は [セットアップ詳細](docs/setup.md) を参照。 ## Update -最新に保つのはコマンド二つ — あるいは AI ツールに一言頼むだけでいい。 +### AI ツールに依頼する(推奨) + +プロジェクトで次のように伝える: + +``` +cladding を最新版に更新して。 +``` + +ホストにターミナルとグローバルインストールの権限があれば、AI が両方の更新手順を実行し、新たな乖離を説明する。権限がなければ、承認または手動実行するコマンドを案内する。 + +### またはターミナルで直接更新する ```bash npm update -g cladding # 1. 新しいバージョンを入れる cd # 2. プロジェクトへ移動 -clad update # 3. 足並みをそろえる +clad update # 3. プロジェクトをインストール済みバージョンに合わせる ``` -あなたのコード · `spec.yaml` · ドキュメントには手を触れない — より厳しいバージョンは、指摘すべきことがあっても **指摘するだけ** で、自分でブロックも修正もしない。上の二つのコマンドが新たな乖離を指摘したら、それは AI ツールに渡せばいい: +更新はコード・`spec.yaml`・ドキュメントを保持する。新しいバージョンが乖離を報告したら、その結果を AI ツールに渡せばよい: ``` -[AI ツールの中で] 更新で指摘された乖離を解消して +更新で指摘された乖離を解消して。 ``` -…あるいは二つのコマンドを飛ばして、init のときと同じように頼むだけでもいい — 更新まで代わりにやってくれる: - -``` -[AI ツールの中で] cladding を最新版に更新して -``` diff --git a/README.ko.html b/README.ko.html index 88bc9f2a..480a10e4 100644 --- a/README.ko.html +++ b/README.ko.html @@ -517,41 +517,47 @@

인접 도구와의 차이

Install

+

1. 설치하고 AI 도구 연결하기

npm install -g cladding   # cladding CLI 설치
-cd <project>              # 프로젝트로 이동
 clad setup                # AI 도구 자동 연결 (Claude · Codex · Gemini · Cursor)
-

각 호스트는 cladding을 AI가 알아서 호출하는 MCP 서버로 연결한다 — /mcp 명령도 수동 연결 단계도 없이, 그냥 대화하면 된다.

+

위 명령은 어느 디렉터리에서든 실행할 수 있으며, 컴퓨터마다 한 번이면 된다. clad setup은 지원하는 AI 도구를 전역으로 연결할 뿐 프로젝트 파일을 만들거나 수정하지 않는다.

-

그다음, 프로젝트당 한 번, AI 도구 안에서 init을 호출한다:

-
[AI 도구 안] /cladding:init "B2B 결제 SaaS"
-

프로젝트의 spec.yaml 과 관련 문서가 만들어진다. 그 뒤론 평소처럼 개발하면 된다 — cladding이 배경에서 전·후 루프를 돌리니 따로 외울 것은 없다. 강제력을 높이려면 clad init --with-hook(pre-commit + pre-push git hook) 이나 clad init --with-ci(CI 게이트 스캐폴드 — 진짜 강제는 CI에서 산다).

+

2. 프로젝트에서 AI 도구 실행하기

+
cd <project>
+

다음 단계: 이 프로젝트 폴더에서 사용하는 AI 도구를 새로 시작한다. Codex · Claude Code · Gemini CLI는 이 디렉터리에서 실행하고, Cursor는 이 폴더를 연다. clad setup의 연결은 새 세션부터 적용된다.

- - - - - - - - - -
시작 상황명령무엇이 일어나는가
아이디어만 있을 때/cladding:init "B2B 결제 SaaS 만들거야"LLM이 도메인 분석 → spec · 문서 · 정책 자동 생성 + 후속 질문 2–3개
기획 문서가 있을 때/cladding:init docs/plan.md파일을 로드해 내용을 intent로 사용
기존 프로젝트 도입/cladding:init "이 프로젝트에 cladding 적용해줘"기존 코드 스캔 → 관찰한 패턴을 intent와 결합
+

3. 프로젝트에 Cladding 한 번 적용하기

+

자신의 시작 상황에 맞는 요청을 AI 도구에 자연스럽게 말한다.

-

- 호스트 지원 현황(정직 고지): Claude Code는 실사용 캠페인으로 전 기능 검증됨(실시간 개입 포함). Codex · Gemini CLI는 연결은 자동이지만, 동작은 아직 검증 전이다. Cursor는 연결은 자동이지만 실사용 검증이 아직이다. → 설치 상세 · 호스트 배선 · MCP · 업그레이드 -

+

아이디어만 있을 때

+
B2B 결제 SaaS를 cladding으로 시작해줘.
+

LLM이 도메인을 분석해 spec · 문서 · 정책을 만들고, 후속 질문 2–3개를 이어간다.

+ +

기획 문서가 있을 때

+
docs/plan.md를 기준으로 cladding을 적용해줘.
+

파일을 읽고 그 내용을 프로젝트 intent로 사용한다.

+ +

기존 프로젝트에 도입할 때

+
현재 코드를 분석해서 cladding을 적용해줘.
+

기존 코드를 스캔하고, 관찰한 패턴을 사용자의 intent와 결합한다.

+ +

초기화가 끝나면 같은 대화에서 바로 개발을 이어가면 된다. 다음 기능을 자연어로 요청하면 AI가 생성된 spec과 문서를 기준으로 개발하고, cladding은 배경에서 검증 루프를 실행한다.

+
이메일 로그인 기능을 테스트까지 포함해서 구현해줘.
+

새로 외울 명령은 없다. 호스트별 명시 호출법, 더 강한 Git/CI 적용, 검증된 호스트 현황은 설치 상세에서 확인할 수 있다.

Update

-

최신 상태 유지는 두 명령 — 아니면 AI 도구에게 한 줄이면 된다.

+

AI 도구에 요청하기 (추천)

+

프로젝트에서 다음과 같이 말한다:

+
cladding을 최신 버전으로 업데이트해줘.
+

호스트에 터미널 및 전역 설치 권한이 있으면 AI가 두 업데이트 단계를 실행하고 새로 발견한 어긋남을 설명한다. 권한이 없으면 승인하거나 직접 실행할 명령을 안내한다.

+

또는 터미널에서 직접 업데이트하기

npm update -g cladding   # 1. 새 버전 받기
 cd <project>             # 2. 프로젝트로 이동
-clad update              # 3. 맞춰 정렬
-

코드 · spec.yaml · 문서는 그대로 둔다 — 더 엄격해진 버전은 짚어만 준다, 스스로 막거나 고치지 않는다. 위 두 명령이 새 어긋남을 짚으면, 그건 AI 도구에 넘기면 된다:

-
[AI 도구 안] 업데이트가 짚은 어긋남을 정리해줘
-

…아니면 두 명령을 건너뛰고 init 때처럼 그냥 말해도 된다 — 업데이트까지 알아서 해준다:

-
[AI 도구 안] cladding 최신 버전으로 업데이트해줘
+clad update # 3. 설치된 버전에 프로젝트 맞추기 +

업데이트는 코드 · spec.yaml · 문서를 보존한다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다:

+
업데이트가 짚은 어긋남을 정리해줘.

Status

diff --git a/README.ko.md b/README.ko.md index 452c6bf3..b8379432 100644 --- a/README.ko.md +++ b/README.ko.md @@ -240,53 +240,87 @@ cladding의 차별점은 *결합* — 위 카테고리의 핵심을 *하나의 ## Install +### 1. 설치하고 AI 도구 연결하기 + ```bash npm install -g cladding # cladding CLI 설치 -cd # 프로젝트로 이동 clad setup # AI 도구 자동 연결 (Claude · Codex · Gemini · Cursor) ``` -각 호스트는 cladding을 AI가 알아서 호출하는 MCP 서버로 연결한다 — `/mcp` 명령도 수동 연결 단계도 없이, 그냥 대화하면 된다. +위 명령은 어느 디렉터리에서든 실행할 수 있으며, 컴퓨터마다 한 번이면 된다. `clad setup`은 지원하는 AI 도구를 전역으로 연결할 뿐 프로젝트 파일을 만들거나 수정하지 않는다. + +### 2. 프로젝트에서 AI 도구 실행하기 + +```bash +cd +``` + +> **다음 단계:** 이 프로젝트 폴더에서 사용하는 AI 도구를 새로 시작한다. Codex · Claude Code · Gemini CLI는 이 디렉터리에서 실행하고, Cursor는 이 폴더를 연다. `clad setup`의 연결은 새 세션부터 적용된다. + +### 3. 프로젝트에 Cladding 한 번 적용하기 + +자신의 시작 상황에 맞는 요청을 AI 도구에 자연스럽게 말한다. + +#### 아이디어만 있을 때 + +``` +B2B 결제 SaaS를 cladding으로 시작해줘. +``` + +LLM이 도메인을 분석해 spec · 문서 · 정책을 만들고, 후속 질문 2–3개를 이어간다. + +#### 기획 문서가 있을 때 + +``` +docs/plan.md를 기준으로 cladding을 적용해줘. +``` + +파일을 읽고 그 내용을 프로젝트 intent로 사용한다. -그다음, 프로젝트당 한 번, AI 도구 안에서 init을 호출한다: +#### 기존 프로젝트에 도입할 때 ``` -[AI 도구 안] /cladding:init "B2B 결제 SaaS" +현재 코드를 분석해서 cladding을 적용해줘. ``` -프로젝트의 `spec.yaml` 과 관련 문서가 만들어진다. 그 뒤론 평소처럼 개발하면 된다 — cladding이 배경에서 전 · 후 루프를 돌리니 따로 외울 것은 없다. 강제력을 높이려면 `clad init --with-hook`(pre-commit + pre-push git hook) 이나 `clad init --with-ci`(CI 게이트 스캐폴드 — 진짜 강제는 CI에서 산다). +기존 코드를 스캔하고, 관찰한 패턴을 사용자의 intent와 결합한다. + +> **초기화가 끝나면 같은 대화에서 바로 개발을 이어가면 된다.** 다음 기능을 자연어로 요청하면 AI가 생성된 spec과 문서를 기준으로 개발하고, cladding은 배경에서 검증 루프를 실행한다. -| 시작 상황 | 명령 | 무엇이 일어나는가 | -|---|---|---| -| **아이디어만 있을 때** | `/cladding:init "B2B 결제 SaaS 만들거야"` | LLM이 도메인 분석 → spec · 문서 · 정책 자동 생성 + 후속 질문 2–3개 | -| **기획 문서가 있을 때** | `/cladding:init docs/plan.md` | 파일을 로드해 내용을 intent로 사용 | -| **기존 프로젝트 도입** | `/cladding:init "이 프로젝트에 cladding 적용해줘"` | 기존 코드 스캔 → 관찰한 패턴을 intent와 결합 | +``` +이메일 로그인 기능을 테스트까지 포함해서 구현해줘. +``` -**호스트 지원 현황(정직 고지):** Claude Code는 실사용 캠페인으로 전 기능 검증됨(실시간 개입 포함). Codex · Gemini CLI는 연결은 자동이지만, 동작은 아직 검증 전이다. Cursor는 연결은 자동이지만 실사용 검증이 아직이다. → [설치 상세 · 호스트 배선 · MCP · 업그레이드](docs/setup.md) +새로 외울 명령은 없다. 호스트별 명시 호출법, 더 강한 Git/CI 적용, 검증된 호스트 현황은 [설치 상세](docs/setup.md)에서 확인할 수 있다. ## Update -최신 상태 유지는 두 명령 — 아니면 AI 도구에게 한 줄이면 된다. +### AI 도구에 요청하기 (추천) + +프로젝트에서 다음과 같이 말한다: + +``` +cladding을 최신 버전으로 업데이트해줘. +``` + +호스트에 터미널 및 전역 설치 권한이 있으면 AI가 두 업데이트 단계를 실행하고 새로 발견한 어긋남을 설명한다. 권한이 없으면 승인하거나 직접 실행할 명령을 안내한다. + +### 또는 터미널에서 직접 업데이트하기 ```bash npm update -g cladding # 1. 새 버전 받기 cd # 2. 프로젝트로 이동 -clad update # 3. 맞춰 정렬 +clad update # 3. 설치된 버전에 프로젝트 맞추기 ``` -코드 · `spec.yaml` · 문서는 그대로 둔다 — 더 엄격해진 버전은 **짚어만 준다**, 스스로 막거나 고치지 않는다. 위 두 명령이 새 어긋남을 짚으면, 그건 AI 도구에 넘기면 된다: +업데이트는 코드 · `spec.yaml` · 문서를 보존한다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다: ``` -[AI 도구 안] 업데이트가 짚은 어긋남을 정리해줘 +업데이트가 짚은 어긋남을 정리해줘. ``` -…아니면 두 명령을 건너뛰고 init 때처럼 그냥 말해도 된다 — 업데이트까지 알아서 해준다: - -``` -[AI 도구 안] cladding 최신 버전으로 업데이트해줘 -``` diff --git a/README.md b/README.md index ee2d2a8a..19589ca5 100644 --- a/README.md +++ b/README.md @@ -237,29 +237,58 @@ The distinction is the *combination* — binding those cores into *one verificat ## Install +### 1. Install and connect your AI tools + ```bash npm install -g cladding # the cladding CLI -cd # your project clad setup # auto-wire your AI tools (Claude · Codex · Gemini · Cursor) ``` -Each host wires cladding as an MCP server the AI calls on its own — there's no `/mcp` command and no manual connect step; you just chat. +Run these once on your machine, from any directory. `clad setup` connects supported AI tools globally; it does not create or modify project files. + +### 2. Start your AI tool from the project + +```bash +cd +``` + +> **Next step:** Start your AI tool with this project as its workspace. Run Codex, Claude Code, or Gemini CLI from this directory, or open this folder in Cursor. The connection created by `clad setup` takes effect in the new session. + +### 3. Apply Cladding once + +Choose the starting point that fits and say it naturally in your AI tool. + +#### An idea, nothing else + +``` +Start this B2B payment SaaS with Cladding. +``` + +The LLM analyzes the domain, creates the spec, docs, and policies, then asks 2–3 follow-up questions. + +#### A planning document + +``` +Apply Cladding using docs/plan.md. +``` + +Cladding loads the file and uses its contents as the project intent. -Then, once per project, call init inside your AI tool: +#### An existing project ``` -[inside your AI tool] /cladding:init "B2B payment SaaS" +Analyze this project and apply Cladding. ``` -It creates the project's `spec.yaml` and supporting docs. After that, just develop as usual — cladding runs the before/after loop in the background, with nothing to memorize. Raise enforcement with `clad init --with-hook` (pre-commit + pre-push git hooks) or `clad init --with-ci` (scaffold the CI gate, where true enforcement lives). +Cladding scans the existing code and combines the observed patterns with your intent. + +> **Once initialization is complete, keep developing in the same conversation.** Ask for the next feature in plain language; the AI uses the generated spec and docs while cladding runs its verification loop in the background. -| Starting point | Command | What happens | -|---|---|---| -| **An idea, nothing else** | `/cladding:init "I'm going to build a B2B payment SaaS"` | the LLM analyzes the domain → spec · docs · policies + 2–3 follow-up questions | -| **A planning doc** | `/cladding:init docs/plan.md` | loads the file and uses its contents as intent | -| **An existing project** | `/cladding:init "apply cladding to this project"` | scans the existing code → observed patterns merged with your intent | +``` +Implement email sign-in, including tests. +``` -**Host support (honest):** Claude Code is fully verified through real-usage campaigns (incl. real-time intervention). Codex · Gemini CLI wire automatically; their behavior isn't verified yet. Cursor wires automatically, but real-usage verification is still pending. → [setup details · host wiring · MCP · upgrading](docs/setup.md) +There is nothing new to memorize. For host-specific invocation, stricter Git/CI enforcement, and verified host status, see [setup details](docs/setup.md). @@ -267,25 +296,30 @@ It creates the project's `spec.yaml` and supporting docs. After that, just devel ## Update -Staying current is two commands — or one line to your AI tool. +### Ask your AI tool (recommended) + +From your project, say: + +``` +Update cladding to the latest version. +``` + +If your host allows terminal and global-install access, the AI runs both update steps and explains any new drift. Otherwise, it shows you the commands to approve or run yourself. + +### Or update from the terminal ```bash npm update -g cladding # 1. get the new version cd # 2. your project -clad update # 3. bring it in line +clad update # 3. align this project with the installed version ``` -Your code · `spec.yaml` · docs are left untouched — a stricter version only **points things out**, it never blocks or fixes on its own. If those two commands flag fresh drift, hand it to your AI tool: +The update preserves your code, `spec.yaml`, and docs. If the new version reports drift, hand that result to your AI tool: ``` -[inside your AI tool] reconcile the drift the update flagged +Reconcile the drift the update flagged. ``` -…or skip the commands and just ask, the same way you ran init — it runs the update for you: - -``` -[inside your AI tool] update cladding to the latest version -``` diff --git a/README.zh.md b/README.zh.md index ffdd6f36..4071bb91 100644 --- a/README.zh.md +++ b/README.zh.md @@ -237,53 +237,87 @@ cladding 的独到之处在于*组合* —— 把上述品类的内核,绑进* ## Install +### 1. 安装并连接 AI 工具 + ```bash npm install -g cladding # 安装 cladding CLI -cd # 进入项目目录 clad setup # 自动接通你的 AI 工具(Claude · Codex · Gemini · Cursor) ``` -每个宿主都把 cladding 接为一台 MCP 服务器,由 AI 自行调用 —— 没有 `/mcp` 命令,也无需手动连接,照常对话即可。 +以上命令可以在任何目录运行,每台电脑只需执行一次。`clad setup` 只会全局连接支持的 AI 工具,不会创建或修改项目文件。 + +### 2. 从项目中启动 AI 工具 + +```bash +cd +``` + +> **下一步:** 以此项目文件夹作为工作区,重新启动所使用的 AI 工具。在该目录中运行 Codex、Claude Code 或 Gemini CLI;如果使用 Cursor,则打开此文件夹。`clad setup` 创建的连接会从新会话开始生效。 + +### 3. 为项目应用一次 Cladding + +根据自己的起点,用自然语言告诉 AI 工具。 + +#### 只有一个想法时 + +``` +用 cladding 开始这个 B2B 支付 SaaS。 +``` + +LLM 会分析领域、创建 spec、文档和策略,然后提出 2–3 个后续问题。 + +#### 已有规划文档时 + +``` +根据 docs/plan.md 应用 cladding。 +``` + +Cladding 会加载该文件,并将其内容作为项目意图。 -随后,每个项目一次,在你的 AI 工具中调用 init: +#### 接入已有项目时 ``` -[在你的 AI 工具中] /cladding:init "B2B 支付 SaaS" +分析当前代码并应用 cladding。 ``` -它会创建项目的 `spec.yaml` 与配套文档。此后照常开发即可 —— cladding 会在后台跑那套「之前 / 之后」循环,没有需要记的命令。想提高强制力:`clad init --with-hook`(安装 pre-commit + pre-push git 钩子)或 `clad init --with-ci`(搭好 CI 门禁的脚手架 —— 真正的强制力在 CI 里)。 +Cladding 会扫描现有代码,并把观察到的模式与你的意图结合起来。 + +> **初始化完成后,直接在同一段对话中继续开发即可。** 用自然语言提出下一个功能,AI 会依据生成的 spec 和文档开发,cladding 则在后台运行验证循环。 -| 起点 | 命令 | 会发生什么 | -|---|---|---| -| **只有一个想法,别无其他** | `/cladding:init "我要做一个 B2B 支付 SaaS"` | LLM 分析领域 → 生成 spec · 文档 · 策略 + 2–3 个追问 | -| **已有一份规划文档** | `/cladding:init docs/plan.md` | 加载该文件,用其内容作为意图 | -| **接入已有项目** | `/cladding:init "把 cladding 应用到这个项目"` | 扫描现有代码 → 把观察到的模式与你的意图融合 | +``` +实现邮箱登录功能,并包含测试。 +``` -**宿主支持(诚实说明):** Claude Code 已通过真实使用的实测(含实时干预)全面验证。Codex · Gemini CLI 已自动接线,但行为尚未验证。Cursor 会自动接线,但真实使用的验证仍待补。→ [安装细节 · 宿主接线 · MCP · 升级](docs/setup.md) +无需再记新的命令。宿主专用调用方式、更严格的 Git/CI 执行方式以及已验证的宿主状态,请参阅[安装细节](docs/setup.md)。 ## Update -保持最新只需两条命令 —— 或者对你的 AI 工具说一句话。 +### 让 AI 工具更新(推荐) + +在项目中这样说: + +``` +把 cladding 更新到最新版本。 +``` + +如果宿主具有终端和全局安装权限,AI 会执行两个更新步骤并解释新发现的漂移;否则,它会给出需要批准或手动执行的命令。 + +### 或在终端中直接更新 ```bash npm update -g cladding # 1. 取得新版本 cd # 2. 进入项目目录 -clad update # 3. 与新版对齐 +clad update # 3. 让项目与已安装版本对齐 ``` -你的代码 · `spec.yaml` · 文档都原封不动 —— 更严格的版本只是把东西**指出来**,既不拦截,也不擅自修改。若上面这两条命令标出了新的漂移,把它交给你的 AI 工具即可: +更新会保留代码、`spec.yaml` 和文档。如果新版本报告了漂移,把结果交给 AI 工具即可: ``` -[在你的 AI 工具中] 修复这次更新标出的漂移 +修复这次更新标出的漂移。 ``` -…或者跳过这两条命令,像你当初跑 init 那样直接说一句 —— 它会连更新一起帮你做: - -``` -[在你的 AI 工具中] 把 cladding 更新到最新版本 -``` diff --git a/docs/glossary.md b/docs/glossary.md index bf15d3f7..3664af50 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -86,6 +86,8 @@ | Tool | Meaning | |---|---| +| `clad_init` | Initialize Cladding from an idea, a project-local planning document, or an existing codebase. | +| `clad_clarify` | Apply the user's answer to the next pending onboarding question. | | `clad_list_features` | Query features by status/slug. | | `clad_get_feature` | Fetch one feature + ACs by id or slug. | | `clad_run_check` | Run drift detection in-process (terse by default). | diff --git a/docs/setup.md b/docs/setup.md index b391201f..fe198c3c 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -2,7 +2,7 @@ # Setup details — host wiring, MCP, and upgrading -The README covers the two commands you need (`clad setup` → `/cladding:init`). This page is +The README covers the setup command and the natural-language request that follows it. This page is the detail behind them: where each host is wired, how the MCP server works, and how to upgrade. ## Where `clad setup` connects (4 hosts · 5 wire points) @@ -26,9 +26,15 @@ fence, which `HOST_CLAIM_DRIFT` polices against `docs/dogfood/matrix.md`.) ## About the MCP server All 4 hosts wire cladding as an MCP server — only the wire *location* differs. MCP is not -something you invoke directly: there is no `/mcp` slash and no manual connect step. The AI in -each host calls cladding's tools on its own in response to *natural-language requests*; you only -type `/cladding:init` once and then chat normally. +something you invoke directly and there is no manual connect step. A host may provide an `/mcp` +diagnostic view, but normal use starts by asking the AI to apply Cladding to the open project. + +| Host | Primary request | Optional explicit invocation | +|---|---|---| +| Claude Code | `Apply Cladding to this project` | `/cladding:init` | +| Codex | `Apply Cladding to this project` | Type `$cladding`, then choose `init (cladding)` | +| Gemini CLI | `Apply Cladding to this project` | `/cladding:init` | +| Cursor | `Apply Cladding to this project` | Natural language routes through the connected onboarding tool | ## Upgrading diff --git a/plugins/claude-code/commands/init.md b/plugins/claude-code/commands/init.md index 3b5bec99..8e7da77a 100644 --- a/plugins/claude-code/commands/init.md +++ b/plugins/claude-code/commands/init.md @@ -98,4 +98,4 @@ Behavior: - **Directory** ending in `.md` (rare) → stderr warning + free-text fallback. - **Non-text argument** (e.g. `결제 SaaS 만들거야`) → existing free-text behavior, zero regression. -Plugin invocations (`/cladding init docs/plan.md` from Claude Code · Codex CLI · Gemini CLI marketplace installs) inherit this behavior automatically — every plugin skill shells out to the same `clad init` CLI. +Host invocations inherit this behavior automatically because every skill, command, and MCP init tool delegates to the same `clad init` engine. Claude Code and Gemini CLI expose `/cladding:init`; in Codex, type `$cladding` and choose `init (cladding)`; MCP-only hosts can ask in natural language. diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index a3eb6b3c..656d33a0 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 $ue=Object.create;var HE=Object.defineProperty;var kue=Object.getOwnPropertyDescriptor;var Eue=Object.getOwnPropertyNames;var Aue=Object.getPrototypeOf,Tue=Object.prototype.hasOwnProperty;var He=(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ir=(t,e)=>{for(var r in e)HE(t,r,{get:e[r],enumerable:!0})},Oue=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Eue(e))!Tue.call(t,i)&&i!==r&&HE(t,i,{get:()=>e[i],enumerable:!(n=kue(e,i))||n.enumerable});return t};var Et=(t,e,r)=>(r=t!=null?$ue(Aue(t)):{},Oue(e||!t||!t.__esModule?HE(r,"default",{value:t,enumerable:!0}):r,t));var Ld=v(ZE=>{var qg=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}},GE=class extends qg{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};ZE.CommanderError=qg;ZE.InvalidArgumentError=GE});var Bg=v(WE=>{var{InvalidArgumentError:Rue}=Ld(),VE=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 Rue(`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 Iue(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}WE.Argument=VE;WE.humanReadableArgName=Iue});var YE=v(JE=>{var{humanReadableArgName:Pue}=Bg(),KE=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=>Pue(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 pq(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ir=(t,e)=>{for(var r in e)GE(t,r,{get:e[r],enumerable:!0})},Due=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Iue(e))!Cue.call(t,i)&&i!==r&&GE(t,i,{get:()=>e[i],enumerable:!(n=Rue(e,i))||n.enumerable});return t};var Et=(t,e,r)=>(r=t!=null?Oue(Pue(t)):{},Due(e||!t||!t.__esModule?GE(r,"default",{value:t,enumerable:!0}):r,t));var Ld=v(VE=>{var qg=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}},ZE=class extends qg{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};VE.CommanderError=qg;VE.InvalidArgumentError=ZE});var Bg=v(KE=>{var{InvalidArgumentError:Nue}=Ld(),WE=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 Nue(`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 jue(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}KE.Argument=WE;KE.humanReadableArgName=jue});var XE=v(YE=>{var{humanReadableArgName:Mue}=Bg(),JE=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=>Mue(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 hq(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 pq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}JE.Help=KE;JE.stripColor=pq});var tA=v(eA=>{var{InvalidArgumentError:Cue}=Ld(),XE=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=Due(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 Cue(`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?mq(this.name().replace(/^no-/,"")):mq(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}},QE=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 mq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Due(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 hq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}YE.Help=JE;YE.stripColor=hq});var rA=v(tA=>{var{InvalidArgumentError:Fue}=Ld(),QE=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=Lue(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 Fue(`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?gq(this.name().replace(/^no-/,"")):gq(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}},eA=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 gq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Lue(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}}eA.Option=XE;eA.DualOptions=QE});var gq=v(hq=>{function Nue(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 jue(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=Nue(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}}tA.Option=QE;tA.DualOptions=eA});var _q=v(yq=>{function zue(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 Uue(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=zue(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]}?)`:""}hq.suggestSimilar=jue});var vq=v(sA=>{var Mue=He("node:events").EventEmitter,rA=He("node:child_process"),no=He("node:path"),Hg=He("node:fs"),Ue=He("node:process"),{Argument:Fue,humanReadableArgName:Lue}=Bg(),{CommanderError:nA}=Ld(),{Help:zue,stripColor:Uue}=YE(),{Option:yq,DualOptions:que}=tA(),{suggestSimilar:_q}=gq(),iA=class t extends Mue{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>oA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>oA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Uue(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 zue,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 Fue(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 nA(e,r,n)),Ue.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 yq(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 yq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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]}?)`:""}yq.suggestSimilar=Uue});var wq=v(aA=>{var que=He("node:events").EventEmitter,nA=He("node:child_process"),no=He("node:path"),Hg=He("node:fs"),Ue=He("node:process"),{Argument:Bue,humanReadableArgName:Hue}=Bg(),{CommanderError:iA}=Ld(),{Help:Gue,stripColor:Zue}=XE(),{Option:bq,DualOptions:Vue}=rA(),{suggestSimilar:vq}=_q(),oA=class t extends que{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>sA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>sA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Zue(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 Gue,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 Bue(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 iA(e,r,n)),Ue.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 bq(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 bq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(Hg.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=no.resolve(u,d);if(Hg.existsSync(f))return f;if(i.includes(no.extname(d)))return;let p=i.find(m=>Hg.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=Hg.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=no.resolve(no.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=no.basename(this._scriptPath,no.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(no.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=bq(Ue.execArgv).concat(r),c=rA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=rA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=bq(Ue.execArgv).concat(r),c=rA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 nA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new nA(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=no.resolve(u,d);if(Hg.existsSync(f))return f;if(i.includes(no.extname(d)))return;let p=i.find(m=>Hg.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=Hg.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=no.resolve(no.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=no.basename(this._scriptPath,no.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(no.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Sq(Ue.execArgv).concat(r),c=nA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=nA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Sq(Ue.execArgv).concat(r),c=nA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 iA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new iA(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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new que(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=_q(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=_q(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=>Lue(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=no.basename(e,no.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(Ue.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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Vue(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=vq(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=vq(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=>Hue(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=no.basename(e,no.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(Ue.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 bq(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 oA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}sA.Command=iA;sA.useColor=oA});var $q=v(Sn=>{var{Argument:Sq}=Bg(),{Command:aA}=vq(),{CommanderError:Bue,InvalidArgumentError:wq}=Ld(),{Help:Hue}=YE(),{Option:xq}=tA();Sn.program=new aA;Sn.createCommand=t=>new aA(t);Sn.createOption=(t,e)=>new xq(t,e);Sn.createArgument=(t,e)=>new Sq(t,e);Sn.Command=aA;Sn.Option=xq;Sn.Argument=Sq;Sn.Help=Hue;Sn.CommanderError=Bue;Sn.InvalidArgumentError=wq;Sn.InvalidOptionArgumentError=wq});var Ce=v(Jt=>{"use strict";var lA=Symbol.for("yaml.alias"),Tq=Symbol.for("yaml.document"),Gg=Symbol.for("yaml.map"),Oq=Symbol.for("yaml.pair"),uA=Symbol.for("yaml.scalar"),Zg=Symbol.for("yaml.seq"),io=Symbol.for("yaml.node.type"),Jue=t=>!!t&&typeof t=="object"&&t[io]===lA,Yue=t=>!!t&&typeof t=="object"&&t[io]===Tq,Xue=t=>!!t&&typeof t=="object"&&t[io]===Gg,Que=t=>!!t&&typeof t=="object"&&t[io]===Oq,Rq=t=>!!t&&typeof t=="object"&&t[io]===uA,ede=t=>!!t&&typeof t=="object"&&t[io]===Zg;function Iq(t){if(t&&typeof t=="object")switch(t[io]){case Gg:case Zg:return!0}return!1}function tde(t){if(t&&typeof t=="object")switch(t[io]){case lA:case Gg:case uA:case Zg:return!0}return!1}var rde=t=>(Rq(t)||Iq(t))&&!!t.anchor;Jt.ALIAS=lA;Jt.DOC=Tq;Jt.MAP=Gg;Jt.NODE_TYPE=io;Jt.PAIR=Oq;Jt.SCALAR=uA;Jt.SEQ=Zg;Jt.hasAnchor=rde;Jt.isAlias=Jue;Jt.isCollection=Iq;Jt.isDocument=Yue;Jt.isMap=Xue;Jt.isNode=tde;Jt.isPair=Que;Jt.isScalar=Rq;Jt.isSeq=ede});var zd=v(dA=>{"use strict";var Mt=Ce(),Pr=Symbol("break visit"),Pq=Symbol("skip children"),vi=Symbol("remove node");function Vg(t,e){let r=Cq(e);Mt.isDocument(t)?Nc(null,t.contents,r,Object.freeze([t]))===vi&&(t.contents=null):Nc(null,t,r,Object.freeze([]))}Vg.BREAK=Pr;Vg.SKIP=Pq;Vg.REMOVE=vi;function Nc(t,e,r,n){let i=Dq(t,e,r,n);if(Mt.isNode(i)||Mt.isPair(i))return Nq(t,n,i),Nc(t,i,r,n);if(typeof i!="symbol"){if(Mt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var jq=Ce(),nde=zd(),ide={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ode=t=>t.replace(/[!,[\]{}]/g,e=>ide[e]),Ud=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+ode(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&&jq.isNode(e.contents)){let o={};nde.visit(e.contents,(s,a)=>{jq.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(` -`)}};Ud.defaultYaml={explicit:!1,version:"1.2"};Ud.defaultTags={"!!":"tag:yaml.org,2002:"};Mq.Directives=Ud});var Kg=v(qd=>{"use strict";var Fq=Ce(),sde=zd();function ade(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 Lq(t){let e=new Set;return sde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function zq(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function cde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=Lq(t));let s=zq(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(Fq.isScalar(s.node)||Fq.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}}qd.anchorIsValid=ade;qd.anchorNames=Lq;qd.createNodeAnchors=cde;qd.findNewAnchor=zq});var pA=v(Uq=>{"use strict";function Bd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var lde=Ce();function qq(t,e,r){if(Array.isArray(t))return t.map((n,i)=>qq(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!lde.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}Bq.toJS=qq});var Jg=v(Gq=>{"use strict";var ude=pA(),Hq=Ce(),dde=Fo(),mA=class{constructor(e){Object.defineProperty(this,Hq.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(!Hq.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=dde.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?ude.applyReviver(o,{"":a},"",a):a}};Gq.NodeBase=mA});var Hd=v(Zq=>{"use strict";var fde=Kg(),pde=zd(),Mc=Ce(),mde=Jg(),hde=Fo(),hA=class extends mde.NodeBase{constructor(e){super(Mc.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=[],pde.visit(e,{Node:(o,s)=>{(Mc.isAlias(s)||Mc.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||(hde.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=Yg(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(fde.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 Yg(t,e,r){if(Mc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Mc.isCollection(e)){let n=0;for(let i of e.items){let o=Yg(t,i,r);o>n&&(n=o)}return n}else if(Mc.isPair(e)){let n=Yg(t,e.key,r),i=Yg(t,e.value,r);return Math.max(n,i)}return 1}Zq.Alias=hA});var It=v(gA=>{"use strict";var gde=Ce(),yde=Jg(),_de=Fo(),bde=t=>!t||typeof t!="function"&&typeof t!="object",Lo=class extends yde.NodeBase{constructor(e){super(gde.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:_de.toJS(this.value,e,r)}toString(){return String(this.value)}};Lo.BLOCK_FOLDED="BLOCK_FOLDED";Lo.BLOCK_LITERAL="BLOCK_LITERAL";Lo.PLAIN="PLAIN";Lo.QUOTE_DOUBLE="QUOTE_DOUBLE";Lo.QUOTE_SINGLE="QUOTE_SINGLE";gA.Scalar=Lo;gA.isScalarValue=bde});var Gd=v(Wq=>{"use strict";var vde=Hd(),ta=Ce(),Vq=It(),Sde="tag:yaml.org,2002:";function wde(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 xde(t,e,r){if(ta.isDocument(t)&&(t=t.contents),ta.isNode(t))return t;if(ta.isPair(t)){let d=r.schema[ta.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 vde.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Sde+e.slice(2));let l=wde(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new Vq.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ta.MAP]:Symbol.iterator in Object(t)?s[ta.SEQ]:s[ta.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 Vq.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Wq.createNode=xde});var Qg=v(Xg=>{"use strict";var $de=Gd(),Si=Ce(),kde=Jg();function yA(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 $de.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 Kq=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,_A=class extends kde.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=>Si.isNode(n)||Si.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Kq(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Si.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,yA(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(Si.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&&Si.isScalar(o)?o.value:o:Si.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Si.isPair(r))return!1;let n=r.value;return n==null||e&&Si.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 Si.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(Si.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,yA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Xg.Collection=_A;Xg.collectionFromPath=yA;Xg.isEmptyPath=Kq});var Zd=v(ey=>{"use strict";var Ede=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function bA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Ade=(t,e,r)=>t.endsWith(` -`)?bA(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 Sq(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 sA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}aA.Command=oA;aA.useColor=sA});var Eq=v(Sn=>{var{Argument:xq}=Bg(),{Command:cA}=wq(),{CommanderError:Wue,InvalidArgumentError:$q}=Ld(),{Help:Kue}=XE(),{Option:kq}=rA();Sn.program=new cA;Sn.createCommand=t=>new cA(t);Sn.createOption=(t,e)=>new kq(t,e);Sn.createArgument=(t,e)=>new xq(t,e);Sn.Command=cA;Sn.Option=kq;Sn.Argument=xq;Sn.Help=Kue;Sn.CommanderError=Wue;Sn.InvalidArgumentError=$q;Sn.InvalidOptionArgumentError=$q});var Ce=v(Jt=>{"use strict";var uA=Symbol.for("yaml.alias"),Rq=Symbol.for("yaml.document"),Gg=Symbol.for("yaml.map"),Iq=Symbol.for("yaml.pair"),dA=Symbol.for("yaml.scalar"),Zg=Symbol.for("yaml.seq"),io=Symbol.for("yaml.node.type"),tde=t=>!!t&&typeof t=="object"&&t[io]===uA,rde=t=>!!t&&typeof t=="object"&&t[io]===Rq,nde=t=>!!t&&typeof t=="object"&&t[io]===Gg,ide=t=>!!t&&typeof t=="object"&&t[io]===Iq,Pq=t=>!!t&&typeof t=="object"&&t[io]===dA,ode=t=>!!t&&typeof t=="object"&&t[io]===Zg;function Cq(t){if(t&&typeof t=="object")switch(t[io]){case Gg:case Zg:return!0}return!1}function sde(t){if(t&&typeof t=="object")switch(t[io]){case uA:case Gg:case dA:case Zg:return!0}return!1}var ade=t=>(Pq(t)||Cq(t))&&!!t.anchor;Jt.ALIAS=uA;Jt.DOC=Rq;Jt.MAP=Gg;Jt.NODE_TYPE=io;Jt.PAIR=Iq;Jt.SCALAR=dA;Jt.SEQ=Zg;Jt.hasAnchor=ade;Jt.isAlias=tde;Jt.isCollection=Cq;Jt.isDocument=rde;Jt.isMap=nde;Jt.isNode=sde;Jt.isPair=ide;Jt.isScalar=Pq;Jt.isSeq=ode});var zd=v(fA=>{"use strict";var Mt=Ce(),Pr=Symbol("break visit"),Dq=Symbol("skip children"),vi=Symbol("remove node");function Vg(t,e){let r=Nq(e);Mt.isDocument(t)?jc(null,t.contents,r,Object.freeze([t]))===vi&&(t.contents=null):jc(null,t,r,Object.freeze([]))}Vg.BREAK=Pr;Vg.SKIP=Dq;Vg.REMOVE=vi;function jc(t,e,r,n){let i=jq(t,e,r,n);if(Mt.isNode(i)||Mt.isPair(i))return Mq(t,n,i),jc(t,i,r,n);if(typeof i!="symbol"){if(Mt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var Fq=Ce(),cde=zd(),lde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ude=t=>t.replace(/[!,[\]{}]/g,e=>lde[e]),Ud=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+ude(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&&Fq.isNode(e.contents)){let o={};cde.visit(e.contents,(s,a)=>{Fq.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(` +`)}};Ud.defaultYaml={explicit:!1,version:"1.2"};Ud.defaultTags={"!!":"tag:yaml.org,2002:"};Lq.Directives=Ud});var Kg=v(qd=>{"use strict";var zq=Ce(),dde=zd();function fde(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 Uq(t){let e=new Set;return dde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function qq(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function pde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=Uq(t));let s=qq(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(zq.isScalar(s.node)||zq.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}}qd.anchorIsValid=fde;qd.anchorNames=Uq;qd.createNodeAnchors=pde;qd.findNewAnchor=qq});var mA=v(Bq=>{"use strict";function Bd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var mde=Ce();function Hq(t,e,r){if(Array.isArray(t))return t.map((n,i)=>Hq(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!mde.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}Gq.toJS=Hq});var Jg=v(Vq=>{"use strict";var hde=mA(),Zq=Ce(),gde=zo(),hA=class{constructor(e){Object.defineProperty(this,Zq.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(!Zq.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=gde.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?hde.applyReviver(o,{"":a},"",a):a}};Vq.NodeBase=hA});var Hd=v(Wq=>{"use strict";var yde=Kg(),_de=zd(),Fc=Ce(),bde=Jg(),vde=zo(),gA=class extends bde.NodeBase{constructor(e){super(Fc.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=[],_de.visit(e,{Node:(o,s)=>{(Fc.isAlias(s)||Fc.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||(vde.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=Yg(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(yde.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 Yg(t,e,r){if(Fc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Fc.isCollection(e)){let n=0;for(let i of e.items){let o=Yg(t,i,r);o>n&&(n=o)}return n}else if(Fc.isPair(e)){let n=Yg(t,e.key,r),i=Yg(t,e.value,r);return Math.max(n,i)}return 1}Wq.Alias=gA});var It=v(yA=>{"use strict";var Sde=Ce(),wde=Jg(),xde=zo(),$de=t=>!t||typeof t!="function"&&typeof t!="object",Uo=class extends wde.NodeBase{constructor(e){super(Sde.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:xde.toJS(this.value,e,r)}toString(){return String(this.value)}};Uo.BLOCK_FOLDED="BLOCK_FOLDED";Uo.BLOCK_LITERAL="BLOCK_LITERAL";Uo.PLAIN="PLAIN";Uo.QUOTE_DOUBLE="QUOTE_DOUBLE";Uo.QUOTE_SINGLE="QUOTE_SINGLE";yA.Scalar=Uo;yA.isScalarValue=$de});var Gd=v(Jq=>{"use strict";var kde=Hd(),ra=Ce(),Kq=It(),Ede="tag:yaml.org,2002:";function Ade(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 Tde(t,e,r){if(ra.isDocument(t)&&(t=t.contents),ra.isNode(t))return t;if(ra.isPair(t)){let d=r.schema[ra.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 kde.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Ede+e.slice(2));let l=Ade(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new Kq.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ra.MAP]:Symbol.iterator in Object(t)?s[ra.SEQ]:s[ra.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 Kq.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Jq.createNode=Tde});var Qg=v(Xg=>{"use strict";var Ode=Gd(),Si=Ce(),Rde=Jg();function _A(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 Ode.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 Yq=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,bA=class extends Rde.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=>Si.isNode(n)||Si.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Yq(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Si.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,_A(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(Si.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&&Si.isScalar(o)?o.value:o:Si.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Si.isPair(r))return!1;let n=r.value;return n==null||e&&Si.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 Si.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(Si.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,_A(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Xg.Collection=bA;Xg.collectionFromPath=_A;Xg.isEmptyPath=Yq});var Zd=v(ey=>{"use strict";var Ide=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function vA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Pde=(t,e,r)=>t.endsWith(` +`)?vA(r,e):r.includes(` `)?` -`+bA(r,e):(t.endsWith(" ")?"":" ")+r;ey.indentComment=bA;ey.lineComment=Ade;ey.stringifyComment=Ede});var Yq=v(Vd=>{"use strict";var Tde="flow",vA="block",ty="quoted";function Ode(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===vA&&(h=Jq(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===ty&&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===vA&&(h=Jq(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+vA(r,e):(t.endsWith(" ")?"":" ")+r;ey.indentComment=vA;ey.lineComment=Pde;ey.stringifyComment=Ide});var Qq=v(Vd=>{"use strict";var Cde="flow",SA="block",ty="quoted";function Dde(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===SA&&(h=Xq(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===ty&&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===SA&&(h=Xq(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===ty){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 Hn=It(),zo=Yq(),ny=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),iy=t=>/^(%|---|\.\.\.)/m.test(t);function Rde(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 Hn=It(),qo=Qq(),ny=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),iy=t=>/^(%|---|\.\.\.)/m.test(t);function Nde(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 Wd(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(iy(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(wA,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{O=!0});let E=zo.foldFlowLines(`${_}${w}${p}`,l,zo.FOLD_BLOCK,A);if(!O)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,A=ny(n,!0);s!=="folded"&&e!==Hn.Scalar.BLOCK_FOLDED&&(A.onOverflow=()=>{O=!0});let E=qo.foldFlowLines(`${_}${w}${p}`,l,qo.FOLD_BLOCK,A);if(!O)return`>${x} ${l}${E}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function Ide(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 Fc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?Fc(o,e):ry(t,e,r,n);if(!a&&!u&&i!==Hn.Scalar.PLAIN&&o.includes(` -`))return ry(t,e,r,n);if(iy(o)){if(c==="")return e.forceBlockIndent=!0,ry(t,e,r,n);if(a&&c===l)return Fc(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 Fc(o,e)}return a?d:zo.foldFlowLines(d,c,zo.FOLD_FLOW,ny(e,!1))}function Pde(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!==Hn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Hn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Hn.Scalar.BLOCK_FOLDED:case Hn.Scalar.BLOCK_LITERAL:return i||o?Fc(s.value,e):ry(s,e,r,n);case Hn.Scalar.QUOTE_DOUBLE:return Wd(s.value,e);case Hn.Scalar.QUOTE_SINGLE:return SA(s.value,e);case Hn.Scalar.PLAIN:return Ide(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}Xq.stringifyString=Pde});var Jd=v(xA=>{"use strict";var Cde=Kg(),Uo=Ce(),Dde=Zd(),Nde=Kd();function jde(t,e){let r=Object.assign({blockQuote:!0,commentString:Dde.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 Mde(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(Uo.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 Fde(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Uo.isScalar(t)||Uo.isCollection(t))&&t.anchor;o&&Cde.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 Lde(t,e,r,n){if(Uo.isPair(t))return t.toString(e,r,n);if(Uo.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=Uo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Mde(e.doc.schema.tags,o));let s=Fde(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):Uo.isScalar(o)?Nde.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Uo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}xA.createStringifyContext=jde;xA.stringify=Lde});var r4=v(t4=>{"use strict";var oo=Ce(),Qq=It(),e4=Jd(),Yd=Zd();function zde({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=oo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(oo.isCollection(t)||!oo.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||oo.isCollection(t)||(oo.isScalar(t)?t.type===Qq.Scalar.BLOCK_FOLDED||t.type===Qq.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=e4.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+=Yd.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Yd.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=Yd.lineComment(g,r.indent,l(f))));let b,_,S;oo.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&&oo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&oo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=e4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +${l}${_}${r}${p}`}function jde(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 Lc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?Lc(o,e):ry(t,e,r,n);if(!a&&!u&&i!==Hn.Scalar.PLAIN&&o.includes(` +`))return ry(t,e,r,n);if(iy(o)){if(c==="")return e.forceBlockIndent=!0,ry(t,e,r,n);if(a&&c===l)return Lc(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 Lc(o,e)}return a?d:qo.foldFlowLines(d,c,qo.FOLD_FLOW,ny(e,!1))}function Mde(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!==Hn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Hn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Hn.Scalar.BLOCK_FOLDED:case Hn.Scalar.BLOCK_LITERAL:return i||o?Lc(s.value,e):ry(s,e,r,n);case Hn.Scalar.QUOTE_DOUBLE:return Wd(s.value,e);case Hn.Scalar.QUOTE_SINGLE:return wA(s.value,e);case Hn.Scalar.PLAIN:return jde(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}e4.stringifyString=Mde});var Jd=v($A=>{"use strict";var Fde=Kg(),Bo=Ce(),Lde=Zd(),zde=Kd();function Ude(t,e){let r=Object.assign({blockQuote:!0,commentString:Lde.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 qde(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(Bo.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 Bde(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Bo.isScalar(t)||Bo.isCollection(t))&&t.anchor;o&&Fde.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 Hde(t,e,r,n){if(Bo.isPair(t))return t.toString(e,r,n);if(Bo.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=Bo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=qde(e.doc.schema.tags,o));let s=Bde(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):Bo.isScalar(o)?zde.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Bo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}$A.createStringifyContext=Ude;$A.stringify=Hde});var i4=v(n4=>{"use strict";var oo=Ce(),t4=It(),r4=Jd(),Yd=Zd();function Gde({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=oo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(oo.isCollection(t)||!oo.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||oo.isCollection(t)||(oo.isScalar(t)?t.type===t4.Scalar.BLOCK_FOLDED||t.type===t4.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=r4.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+=Yd.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Yd.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=Yd.lineComment(g,r.indent,l(f))));let b,_,S;oo.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&&oo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&oo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=r4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let A=l(_);O+=` ${Yd.indentComment(A,r.indent)}`}w===""&&!r.inFlow?O===` `&&S&&(O=` `):O+=` ${r.indent}`}else if(!p&&oo.isCollection(e)){let A=w[0],E=w.indexOf(` -`),C=E!==-1,k=r.inFlow??e.flow??e.items.length===0;if(C||!k){let q=!1;if(C&&(A==="&"||A==="!")){let X=w.indexOf(" ");A==="&"&&X!==-1&&X{"use strict";var n4=He("process");function Ude(t,...e){t==="debug"&&console.log(...e)}function qde(t,e){(t==="debug"||t==="warn")&&(typeof n4.emitWarning=="function"?n4.emitWarning(e):console.warn(e))}$A.debug=Ude;$A.warn=qde});var ly=v(cy=>{"use strict";var ay=Ce(),i4=It(),oy="<<",sy={identify:t=>t===oy||typeof t=="symbol"&&t.description===oy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new i4.Scalar(Symbol(oy)),{addToJSMap:o4}),stringify:()=>oy},Bde=(t,e)=>(sy.identify(e)||ay.isScalar(e)&&(!e.type||e.type===i4.Scalar.PLAIN)&&sy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===sy.tag&&r.default);function o4(t,e,r){let n=s4(t,r);if(ay.isSeq(n))for(let i of n.items)EA(t,e,i);else if(Array.isArray(n))for(let i of n)EA(t,e,i);else EA(t,e,n)}function EA(t,e,r){let n=s4(t,r);if(!ay.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 s4(t,e){return t&&ay.isAlias(e)?e.resolve(t.doc,t):e}cy.addMergeToJSMap=o4;cy.isMergeKey=Bde;cy.merge=sy});var TA=v(l4=>{"use strict";var Hde=kA(),a4=ly(),Gde=Jd(),c4=Ce(),AA=Fo();function Zde(t,e,{key:r,value:n}){if(c4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(a4.isMergeKey(t,r))a4.addMergeToJSMap(t,e,n);else{let i=AA.toJS(r,"",t);if(e instanceof Map)e.set(i,AA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Vde(r,i,t),s=AA.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 Vde(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(c4.isNode(t)&&r?.doc){let n=Gde.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)+'..."'),Hde.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)}l4.addPairToJSMap=Zde});var qo=v(OA=>{"use strict";var u4=Gd(),Wde=r4(),Kde=TA(),uy=Ce();function Jde(t,e,r){let n=u4.createNode(t,void 0,r),i=u4.createNode(e,void 0,r);return new dy(n,i)}var dy=class t{constructor(e,r=null){Object.defineProperty(this,uy.NODE_TYPE,{value:uy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return uy.isNode(r)&&(r=r.clone(e)),uy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Kde.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Wde.stringifyPair(this,e,r,n):JSON.stringify(this)}};OA.Pair=dy;OA.createPair=Jde});var RA=v(f4=>{"use strict";var ra=Ce(),d4=Jd(),fy=Zd();function Yde(t,e,r){return(e.inFlow??t.flow?Qde:Xde)(t,e,r)}function Xde({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+=fy.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 o4=He("process");function Zde(t,...e){t==="debug"&&console.log(...e)}function Vde(t,e){(t==="debug"||t==="warn")&&(typeof o4.emitWarning=="function"?o4.emitWarning(e):console.warn(e))}kA.debug=Zde;kA.warn=Vde});var ly=v(cy=>{"use strict";var ay=Ce(),s4=It(),oy="<<",sy={identify:t=>t===oy||typeof t=="symbol"&&t.description===oy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new s4.Scalar(Symbol(oy)),{addToJSMap:a4}),stringify:()=>oy},Wde=(t,e)=>(sy.identify(e)||ay.isScalar(e)&&(!e.type||e.type===s4.Scalar.PLAIN)&&sy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===sy.tag&&r.default);function a4(t,e,r){let n=c4(t,r);if(ay.isSeq(n))for(let i of n.items)AA(t,e,i);else if(Array.isArray(n))for(let i of n)AA(t,e,i);else AA(t,e,n)}function AA(t,e,r){let n=c4(t,r);if(!ay.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 c4(t,e){return t&&ay.isAlias(e)?e.resolve(t.doc,t):e}cy.addMergeToJSMap=a4;cy.isMergeKey=Wde;cy.merge=sy});var OA=v(d4=>{"use strict";var Kde=EA(),l4=ly(),Jde=Jd(),u4=Ce(),TA=zo();function Yde(t,e,{key:r,value:n}){if(u4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(l4.isMergeKey(t,r))l4.addMergeToJSMap(t,e,n);else{let i=TA.toJS(r,"",t);if(e instanceof Map)e.set(i,TA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Xde(r,i,t),s=TA.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 Xde(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(u4.isNode(t)&&r?.doc){let n=Jde.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)+'..."'),Kde.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)}d4.addPairToJSMap=Yde});var Ho=v(RA=>{"use strict";var f4=Gd(),Qde=i4(),efe=OA(),uy=Ce();function tfe(t,e,r){let n=f4.createNode(t,void 0,r),i=f4.createNode(e,void 0,r);return new dy(n,i)}var dy=class t{constructor(e,r=null){Object.defineProperty(this,uy.NODE_TYPE,{value:uy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return uy.isNode(r)&&(r=r.clone(e)),uy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return efe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Qde.stringifyPair(this,e,r,n):JSON.stringify(this)}};RA.Pair=dy;RA.createPair=tfe});var IA=v(m4=>{"use strict";var na=Ce(),p4=Jd(),fy=Zd();function rfe(t,e,r){return(e.inFlow??t.flow?ife:nfe)(t,e,r)}function nfe({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+=fy.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(` +`+fy.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function ife({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+=fy.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 py({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=fy.indentComment(e(n),t);r.push(o.trimStart())}}f4.stringifyCollection=Yde});var Ho=v(PA=>{"use strict";var efe=RA(),tfe=TA(),rfe=Qg(),Bo=Ce(),my=qo(),nfe=It();function Xd(t,e){let r=Bo.isScalar(e)?e.value:e;for(let n of t)if(Bo.isPair(n)&&(n.key===e||n.key===r||Bo.isScalar(n.key)&&n.key.value===r))return n}var IA=class extends rfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Bo.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(my.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;Bo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new my.Pair(e,e?.value):n=new my.Pair(e.key,e.value);let i=Xd(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Bo.isScalar(i.value)&&nfe.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=Xd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Xd(this.items,e)?.value;return(!r&&Bo.isScalar(i)?i.value:i)??void 0}has(e){return!!Xd(this.items,e)}set(e,r){this.add(new my.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)tfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Bo.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})),efe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};PA.YAMLMap=IA;PA.findPair=Xd});var Lc=v(m4=>{"use strict";var ife=Ce(),p4=Ho(),ofe={collection:"map",default:!0,nodeClass:p4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return ife.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>p4.YAMLMap.from(t,e,r)};m4.map=ofe});var Go=v(h4=>{"use strict";var sfe=Gd(),afe=RA(),cfe=Qg(),gy=Ce(),lfe=It(),ufe=Fo(),CA=class extends cfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(gy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=hy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=hy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&gy.isScalar(i)?i.value:i}has(e){let r=hy(e);return typeof r=="number"&&r=0?e:null}h4.YAMLSeq=CA});var zc=v(y4=>{"use strict";var dfe=Ce(),g4=Go(),ffe={collection:"seq",default:!0,nodeClass:g4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return dfe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>g4.YAMLSeq.from(t,e,r)};y4.seq=ffe});var Qd=v(_4=>{"use strict";var pfe=Kd(),mfe={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),pfe.stringifyString(t,e,r,n)}};_4.string=mfe});var yy=v(S4=>{"use strict";var b4=It(),v4={identify:t=>t==null,createNode:()=>new b4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new b4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&v4.test.test(t)?t:e.options.nullStr};S4.nullTag=v4});var DA=v(x4=>{"use strict";var hfe=It(),w4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new hfe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&w4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};x4.boolTag=w4});var Uc=v($4=>{"use strict";function gfe({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}$4.stringifyNumber=gfe});var jA=v(_y=>{"use strict";var yfe=It(),NA=Uc(),_fe={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:NA.stringifyNumber},bfe={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():NA.stringifyNumber(t)}},vfe={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 yfe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:NA.stringifyNumber};_y.float=vfe;_y.floatExp=bfe;_y.floatNaN=_fe});var FA=v(vy=>{"use strict";var k4=Uc(),by=t=>typeof t=="bigint"||Number.isInteger(t),MA=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function E4(t,e,r){let{value:n}=t;return by(n)&&n>=0?r+n.toString(e):k4.stringifyNumber(t)}var Sfe={identify:t=>by(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>MA(t,2,8,r),stringify:t=>E4(t,8,"0o")},wfe={identify:by,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>MA(t,0,10,r),stringify:k4.stringifyNumber},xfe={identify:t=>by(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>MA(t,2,16,r),stringify:t=>E4(t,16,"0x")};vy.int=wfe;vy.intHex=xfe;vy.intOct=Sfe});var T4=v(A4=>{"use strict";var $fe=Lc(),kfe=yy(),Efe=zc(),Afe=Qd(),Tfe=DA(),LA=jA(),zA=FA(),Ofe=[$fe.map,Efe.seq,Afe.string,kfe.nullTag,Tfe.boolTag,zA.intOct,zA.int,zA.intHex,LA.floatNaN,LA.floatExp,LA.float];A4.schema=Ofe});var I4=v(R4=>{"use strict";var Rfe=It(),Ife=Lc(),Pfe=zc();function O4(t){return typeof t=="bigint"||Number.isInteger(t)}var Sy=({value:t})=>JSON.stringify(t),Cfe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Sy},{identify:t=>t==null,createNode:()=>new Rfe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Sy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Sy},{identify:O4,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})=>O4(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:Sy}],Dfe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Nfe=[Ife.map,Pfe.seq].concat(Cfe,Dfe);R4.schema=Nfe});var qA=v(P4=>{"use strict";var ef=He("buffer"),UA=It(),jfe=Kd(),Mfe={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 wy=Ce(),BA=qo(),Ffe=It(),Lfe=Go();function C4(t,e){if(wy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new BA.Pair(new Ffe.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function py({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=fy.indentComment(e(n),t);r.push(o.trimStart())}}m4.stringifyCollection=rfe});var Zo=v(CA=>{"use strict";var ofe=IA(),sfe=OA(),afe=Qg(),Go=Ce(),my=Ho(),cfe=It();function Xd(t,e){let r=Go.isScalar(e)?e.value:e;for(let n of t)if(Go.isPair(n)&&(n.key===e||n.key===r||Go.isScalar(n.key)&&n.key.value===r))return n}var PA=class extends afe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Go.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(my.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;Go.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new my.Pair(e,e?.value):n=new my.Pair(e.key,e.value);let i=Xd(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Go.isScalar(i.value)&&cfe.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=Xd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Xd(this.items,e)?.value;return(!r&&Go.isScalar(i)?i.value:i)??void 0}has(e){return!!Xd(this.items,e)}set(e,r){this.add(new my.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)sfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Go.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})),ofe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};CA.YAMLMap=PA;CA.findPair=Xd});var zc=v(g4=>{"use strict";var lfe=Ce(),h4=Zo(),ufe={collection:"map",default:!0,nodeClass:h4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return lfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>h4.YAMLMap.from(t,e,r)};g4.map=ufe});var Vo=v(y4=>{"use strict";var dfe=Gd(),ffe=IA(),pfe=Qg(),gy=Ce(),mfe=It(),hfe=zo(),DA=class extends pfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(gy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=hy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=hy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&gy.isScalar(i)?i.value:i}has(e){let r=hy(e);return typeof r=="number"&&r=0?e:null}y4.YAMLSeq=DA});var Uc=v(b4=>{"use strict";var gfe=Ce(),_4=Vo(),yfe={collection:"seq",default:!0,nodeClass:_4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return gfe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>_4.YAMLSeq.from(t,e,r)};b4.seq=yfe});var Qd=v(v4=>{"use strict";var _fe=Kd(),bfe={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),_fe.stringifyString(t,e,r,n)}};v4.string=bfe});var yy=v(x4=>{"use strict";var S4=It(),w4={identify:t=>t==null,createNode:()=>new S4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new S4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&w4.test.test(t)?t:e.options.nullStr};x4.nullTag=w4});var NA=v(k4=>{"use strict";var vfe=It(),$4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new vfe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&$4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};k4.boolTag=$4});var qc=v(E4=>{"use strict";function Sfe({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}E4.stringifyNumber=Sfe});var MA=v(_y=>{"use strict";var wfe=It(),jA=qc(),xfe={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:jA.stringifyNumber},$fe={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():jA.stringifyNumber(t)}},kfe={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 wfe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:jA.stringifyNumber};_y.float=kfe;_y.floatExp=$fe;_y.floatNaN=xfe});var LA=v(vy=>{"use strict";var A4=qc(),by=t=>typeof t=="bigint"||Number.isInteger(t),FA=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function T4(t,e,r){let{value:n}=t;return by(n)&&n>=0?r+n.toString(e):A4.stringifyNumber(t)}var Efe={identify:t=>by(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>FA(t,2,8,r),stringify:t=>T4(t,8,"0o")},Afe={identify:by,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>FA(t,0,10,r),stringify:A4.stringifyNumber},Tfe={identify:t=>by(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>FA(t,2,16,r),stringify:t=>T4(t,16,"0x")};vy.int=Afe;vy.intHex=Tfe;vy.intOct=Efe});var R4=v(O4=>{"use strict";var Ofe=zc(),Rfe=yy(),Ife=Uc(),Pfe=Qd(),Cfe=NA(),zA=MA(),UA=LA(),Dfe=[Ofe.map,Ife.seq,Pfe.string,Rfe.nullTag,Cfe.boolTag,UA.intOct,UA.int,UA.intHex,zA.floatNaN,zA.floatExp,zA.float];O4.schema=Dfe});var C4=v(P4=>{"use strict";var Nfe=It(),jfe=zc(),Mfe=Uc();function I4(t){return typeof t=="bigint"||Number.isInteger(t)}var Sy=({value:t})=>JSON.stringify(t),Ffe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Sy},{identify:t=>t==null,createNode:()=>new Nfe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Sy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Sy},{identify:I4,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})=>I4(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:Sy}],Lfe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},zfe=[jfe.map,Mfe.seq].concat(Ffe,Lfe);P4.schema=zfe});var BA=v(D4=>{"use strict";var ef=He("buffer"),qA=It(),Ufe=Kd(),qfe={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 wy=Ce(),HA=Ho(),Bfe=It(),Hfe=Vo();function N4(t,e){if(wy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new HA.Pair(new Bfe.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]=wy.isPair(n)?n:new BA.Pair(n)}}else e("Expected a sequence for this tag");return t}function D4(t,e,r){let{replacer:n}=r,i=new Lfe.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(BA.createPair(a,c,r))}return i}var zfe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:C4,createNode:D4};xy.createPairs=D4;xy.pairs=zfe;xy.resolvePairs=C4});var ZA=v(GA=>{"use strict";var N4=Ce(),HA=Fo(),tf=Ho(),Ufe=Go(),j4=$y(),na=class t extends Ufe.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(N4.isPair(i)?(o=HA.toJS(i.key,"",r),s=HA.toJS(i.value,o,r)):o=HA.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=j4.createPairs(e,r,n),o=new this;return o.items=i.items,o}};na.tag="tag:yaml.org,2002:omap";var qfe={collection:"seq",identify:t=>t instanceof Map,nodeClass:na,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=j4.resolvePairs(t,e),n=[];for(let{key:i}of r.items)N4.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new na,r)},createNode:(t,e,r)=>na.from(t,e,r)};GA.YAMLOMap=na;GA.omap=qfe});var U4=v(VA=>{"use strict";var M4=It();function F4({value:t,source:e},r){return e&&(t?L4:z4).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var L4={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 M4.Scalar(!0),stringify:F4},z4={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 M4.Scalar(!1),stringify:F4};VA.falseTag=z4;VA.trueTag=L4});var q4=v(ky=>{"use strict";var Bfe=It(),WA=Uc(),Hfe={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:WA.stringifyNumber},Gfe={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():WA.stringifyNumber(t)}},Zfe={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 Bfe.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:WA.stringifyNumber};ky.float=Zfe;ky.floatExp=Gfe;ky.floatNaN=Hfe});var H4=v(nf=>{"use strict";var B4=Uc(),rf=t=>typeof t=="bigint"||Number.isInteger(t);function Ey(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 KA(t,e,r){let{value:n}=t;if(rf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return B4.stringifyNumber(t)}var Vfe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Ey(t,2,2,r),stringify:t=>KA(t,2,"0b")},Wfe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Ey(t,1,8,r),stringify:t=>KA(t,8,"0")},Kfe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Ey(t,0,10,r),stringify:B4.stringifyNumber},Jfe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Ey(t,2,16,r),stringify:t=>KA(t,16,"0x")};nf.int=Kfe;nf.intBin=Vfe;nf.intHex=Jfe;nf.intOct=Wfe});var YA=v(JA=>{"use strict";var Oy=Ce(),Ay=qo(),Ty=Ho(),ia=class t extends Ty.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Oy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Ay.Pair(e.key,null):r=new Ay.Pair(e,null),Ty.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Ty.findPair(this.items,e);return!r&&Oy.isPair(n)?Oy.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=Ty.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Ay.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(Ay.createPair(s,null,n));return o}};ia.tag="tag:yaml.org,2002:set";var Yfe={collection:"map",identify:t=>t instanceof Set,nodeClass:ia,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ia.from(t,e,r),resolve(t,e){if(Oy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ia,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};JA.YAMLSet=ia;JA.set=Yfe});var QA=v(Ry=>{"use strict";var Xfe=Uc();function XA(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 G4(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Xfe.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 Qfe={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})=>XA(t,r),stringify:G4},epe={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=>XA(t,!1),stringify:G4},Z4={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(Z4.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=XA(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$/,"")??""};Ry.floatTime=epe;Ry.intTime=Qfe;Ry.timestamp=Z4});var K4=v(W4=>{"use strict";var tpe=Lc(),rpe=yy(),npe=zc(),ipe=Qd(),ope=qA(),V4=U4(),eT=q4(),Iy=H4(),spe=ly(),ape=ZA(),cpe=$y(),lpe=YA(),tT=QA(),upe=[tpe.map,npe.seq,ipe.string,rpe.nullTag,V4.trueTag,V4.falseTag,Iy.intBin,Iy.intOct,Iy.int,Iy.intHex,eT.floatNaN,eT.floatExp,eT.float,ope.binary,spe.merge,ape.omap,cpe.pairs,lpe.set,tT.intTime,tT.floatTime,tT.timestamp];W4.schema=upe});var o6=v(iT=>{"use strict";var Q4=Lc(),dpe=yy(),e6=zc(),fpe=Qd(),ppe=DA(),rT=jA(),nT=FA(),mpe=T4(),hpe=I4(),t6=qA(),of=ly(),r6=ZA(),n6=$y(),J4=K4(),i6=YA(),Py=QA(),Y4=new Map([["core",mpe.schema],["failsafe",[Q4.map,e6.seq,fpe.string]],["json",hpe.schema],["yaml11",J4.schema],["yaml-1.1",J4.schema]]),X4={binary:t6.binary,bool:ppe.boolTag,float:rT.float,floatExp:rT.floatExp,floatNaN:rT.floatNaN,floatTime:Py.floatTime,int:nT.int,intHex:nT.intHex,intOct:nT.intOct,intTime:Py.intTime,map:Q4.map,merge:of.merge,null:dpe.nullTag,omap:r6.omap,pairs:n6.pairs,seq:e6.seq,set:i6.set,timestamp:Py.timestamp},gpe={"tag:yaml.org,2002:binary":t6.binary,"tag:yaml.org,2002:merge":of.merge,"tag:yaml.org,2002:omap":r6.omap,"tag:yaml.org,2002:pairs":n6.pairs,"tag:yaml.org,2002:set":i6.set,"tag:yaml.org,2002:timestamp":Py.timestamp};function ype(t,e,r){let n=Y4.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(Y4.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"?X4[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(X4).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},[])}iT.coreKnownTags=gpe;iT.getTags=ype});var aT=v(s6=>{"use strict";var oT=Ce(),_pe=Lc(),bpe=zc(),vpe=Qd(),Cy=o6(),Spe=(t,e)=>t.keye.key?1:0,sT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Cy.getTags(e,"compat"):e?Cy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Cy.coreKnownTags:{},this.tags=Cy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,oT.MAP,{value:_pe.map}),Object.defineProperty(this,oT.SCALAR,{value:vpe.string}),Object.defineProperty(this,oT.SEQ,{value:bpe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Spe:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};s6.Schema=sT});var c6=v(a6=>{"use strict";var wpe=Ce(),cT=Jd(),sf=Zd();function xpe(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=cT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(sf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(wpe.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(sf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=cT.stringify(t.contents,i,()=>a=null,c);a&&(l+=sf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(cT.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]=wy.isPair(n)?n:new HA.Pair(n)}}else e("Expected a sequence for this tag");return t}function j4(t,e,r){let{replacer:n}=r,i=new Hfe.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(HA.createPair(a,c,r))}return i}var Gfe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:N4,createNode:j4};xy.createPairs=j4;xy.pairs=Gfe;xy.resolvePairs=N4});var VA=v(ZA=>{"use strict";var M4=Ce(),GA=zo(),tf=Zo(),Zfe=Vo(),F4=$y(),ia=class t extends Zfe.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(M4.isPair(i)?(o=GA.toJS(i.key,"",r),s=GA.toJS(i.value,o,r)):o=GA.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=F4.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ia.tag="tag:yaml.org,2002:omap";var Vfe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ia,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=F4.resolvePairs(t,e),n=[];for(let{key:i}of r.items)M4.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ia,r)},createNode:(t,e,r)=>ia.from(t,e,r)};ZA.YAMLOMap=ia;ZA.omap=Vfe});var B4=v(WA=>{"use strict";var L4=It();function z4({value:t,source:e},r){return e&&(t?U4:q4).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var U4={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 L4.Scalar(!0),stringify:z4},q4={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 L4.Scalar(!1),stringify:z4};WA.falseTag=q4;WA.trueTag=U4});var H4=v(ky=>{"use strict";var Wfe=It(),KA=qc(),Kfe={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:KA.stringifyNumber},Jfe={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():KA.stringifyNumber(t)}},Yfe={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 Wfe.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:KA.stringifyNumber};ky.float=Yfe;ky.floatExp=Jfe;ky.floatNaN=Kfe});var Z4=v(nf=>{"use strict";var G4=qc(),rf=t=>typeof t=="bigint"||Number.isInteger(t);function Ey(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 JA(t,e,r){let{value:n}=t;if(rf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return G4.stringifyNumber(t)}var Xfe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Ey(t,2,2,r),stringify:t=>JA(t,2,"0b")},Qfe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Ey(t,1,8,r),stringify:t=>JA(t,8,"0")},epe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Ey(t,0,10,r),stringify:G4.stringifyNumber},tpe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Ey(t,2,16,r),stringify:t=>JA(t,16,"0x")};nf.int=epe;nf.intBin=Xfe;nf.intHex=tpe;nf.intOct=Qfe});var XA=v(YA=>{"use strict";var Oy=Ce(),Ay=Ho(),Ty=Zo(),oa=class t extends Ty.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Oy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Ay.Pair(e.key,null):r=new Ay.Pair(e,null),Ty.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Ty.findPair(this.items,e);return!r&&Oy.isPair(n)?Oy.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=Ty.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Ay.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(Ay.createPair(s,null,n));return o}};oa.tag="tag:yaml.org,2002:set";var rpe={collection:"map",identify:t=>t instanceof Set,nodeClass:oa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>oa.from(t,e,r),resolve(t,e){if(Oy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new oa,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};YA.YAMLSet=oa;YA.set=rpe});var eT=v(Ry=>{"use strict";var npe=qc();function QA(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 V4(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return npe.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 ipe={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})=>QA(t,r),stringify:V4},ope={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=>QA(t,!1),stringify:V4},W4={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(W4.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=QA(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$/,"")??""};Ry.floatTime=ope;Ry.intTime=ipe;Ry.timestamp=W4});var Y4=v(J4=>{"use strict";var spe=zc(),ape=yy(),cpe=Uc(),lpe=Qd(),upe=BA(),K4=B4(),tT=H4(),Iy=Z4(),dpe=ly(),fpe=VA(),ppe=$y(),mpe=XA(),rT=eT(),hpe=[spe.map,cpe.seq,lpe.string,ape.nullTag,K4.trueTag,K4.falseTag,Iy.intBin,Iy.intOct,Iy.int,Iy.intHex,tT.floatNaN,tT.floatExp,tT.float,upe.binary,dpe.merge,fpe.omap,ppe.pairs,mpe.set,rT.intTime,rT.floatTime,rT.timestamp];J4.schema=hpe});var a6=v(oT=>{"use strict";var t6=zc(),gpe=yy(),r6=Uc(),ype=Qd(),_pe=NA(),nT=MA(),iT=LA(),bpe=R4(),vpe=C4(),n6=BA(),of=ly(),i6=VA(),o6=$y(),X4=Y4(),s6=XA(),Py=eT(),Q4=new Map([["core",bpe.schema],["failsafe",[t6.map,r6.seq,ype.string]],["json",vpe.schema],["yaml11",X4.schema],["yaml-1.1",X4.schema]]),e6={binary:n6.binary,bool:_pe.boolTag,float:nT.float,floatExp:nT.floatExp,floatNaN:nT.floatNaN,floatTime:Py.floatTime,int:iT.int,intHex:iT.intHex,intOct:iT.intOct,intTime:Py.intTime,map:t6.map,merge:of.merge,null:gpe.nullTag,omap:i6.omap,pairs:o6.pairs,seq:r6.seq,set:s6.set,timestamp:Py.timestamp},Spe={"tag:yaml.org,2002:binary":n6.binary,"tag:yaml.org,2002:merge":of.merge,"tag:yaml.org,2002:omap":i6.omap,"tag:yaml.org,2002:pairs":o6.pairs,"tag:yaml.org,2002:set":s6.set,"tag:yaml.org,2002:timestamp":Py.timestamp};function wpe(t,e,r){let n=Q4.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(Q4.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"?e6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(e6).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},[])}oT.coreKnownTags=Spe;oT.getTags=wpe});var cT=v(c6=>{"use strict";var sT=Ce(),xpe=zc(),$pe=Uc(),kpe=Qd(),Cy=a6(),Epe=(t,e)=>t.keye.key?1:0,aT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Cy.getTags(e,"compat"):e?Cy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Cy.coreKnownTags:{},this.tags=Cy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,sT.MAP,{value:xpe.map}),Object.defineProperty(this,sT.SCALAR,{value:kpe.string}),Object.defineProperty(this,sT.SEQ,{value:$pe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Epe:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};c6.Schema=aT});var u6=v(l6=>{"use strict";var Ape=Ce(),lT=Jd(),sf=Zd();function Tpe(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=lT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(sf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Ape.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(sf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=lT.stringify(t.contents,i,()=>a=null,c);a&&(l+=sf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(lT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` `)?(r.push("..."),r.push(sf.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(sf.indentComment(o(c),"")))}return r.join(` `)+` -`}a6.stringifyDocument=xpe});var af=v(l6=>{"use strict";var $pe=Hd(),qc=Qg(),wn=Ce(),kpe=qo(),Epe=Fo(),Ape=aT(),Tpe=c6(),lT=Kg(),Ope=pA(),Rpe=Gd(),uT=fA(),dT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,wn.NODE_TYPE,{value:wn.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 uT.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,{[wn.NODE_TYPE]:{value:wn.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=wn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Bc(this.contents)&&this.contents.add(e)}addIn(e,r){Bc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=lT.anchorNames(this);e.anchor=!r||n.has(r)?lT.findNewAnchor(r||"a",n):r}return new $pe.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}=lT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Rpe.createNode(e,u,m);return a&&wn.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 kpe.Pair(i,o)}delete(e){return Bc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return qc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Bc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return wn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return qc.isEmptyPath(e)?!r&&wn.isScalar(this.contents)?this.contents.value:this.contents:wn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return wn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return qc.isEmptyPath(e)?this.contents!==void 0:wn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=qc.collectionFromPath(this.schema,[e],r):Bc(this.contents)&&this.contents.set(e,r)}setIn(e,r){qc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=qc.collectionFromPath(this.schema,Array.from(e),r):Bc(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 uT.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 uT.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 Ape.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=Epe.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"?Ope.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 Tpe.stringifyDocument(this,e)}};function Bc(t){if(wn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}l6.Document=dT});var uf=v(lf=>{"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}},fT=class extends cf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},pT=class extends cf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Ipe=(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 +`}l6.stringifyDocument=Tpe});var af=v(d6=>{"use strict";var Ope=Hd(),Bc=Qg(),wn=Ce(),Rpe=Ho(),Ipe=zo(),Ppe=cT(),Cpe=u6(),uT=Kg(),Dpe=mA(),Npe=Gd(),dT=pA(),fT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,wn.NODE_TYPE,{value:wn.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 dT.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,{[wn.NODE_TYPE]:{value:wn.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=wn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Hc(this.contents)&&this.contents.add(e)}addIn(e,r){Hc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=uT.anchorNames(this);e.anchor=!r||n.has(r)?uT.findNewAnchor(r||"a",n):r}return new Ope.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}=uT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Npe.createNode(e,u,m);return a&&wn.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 Rpe.Pair(i,o)}delete(e){return Hc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Bc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Hc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return wn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Bc.isEmptyPath(e)?!r&&wn.isScalar(this.contents)?this.contents.value:this.contents:wn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return wn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Bc.isEmptyPath(e)?this.contents!==void 0:wn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Bc.collectionFromPath(this.schema,[e],r):Hc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Bc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Bc.collectionFromPath(this.schema,Array.from(e),r):Hc(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 dT.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 dT.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 Ppe.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=Ipe.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"?Dpe.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 Cpe.stringifyDocument(this,e)}};function Hc(t){if(wn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}d6.Document=fT});var uf=v(lf=>{"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}},pT=class extends cf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},mT=class extends cf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},jpe=(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} -`}};lf.YAMLError=cf;lf.YAMLParseError=fT;lf.YAMLWarning=pT;lf.prettifyError=Ipe});var df=v(u6=>{"use strict";function Ppe(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 E of t)switch(m&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&o(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&E.type!=="comment"&&E.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),E.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&E.source.includes(" ")&&(h=E),u=!0;break;case"comment":{u||o(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=E.source.substring(1)||" ";d?d+=f+C:d=C,f="",l=!1;break}case"newline":l?d?d+=E.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=E.source,l=!0,p=!0,(g||b)&&(_=E),u=!0;break;case"anchor":g&&o(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&o(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=E,w??(w=E.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(E,"MULTIPLE_TAGS","A node can have at most one tag"),b=E,w??(w=E.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),x&&o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),x=E,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=E,l=!1,u=!1;break}default:o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),l=!1,u=!1}let O=t[t.length-1],A=O?O.offset+O.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}}u6.resolveProps=Ppe});var Dy=v(d6=>{"use strict";function mT(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(mT(e.key)||mT(e.value))return!0}return!1;default:return!0}}d6.containsNewline=mT});var hT=v(f6=>{"use strict";var Cpe=Dy();function Dpe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Cpe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}f6.flowIndentCheck=Dpe});var gT=v(m6=>{"use strict";var p6=Ce();function Npe(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))}m6.mapIncludes=Npe});var v6=v(b6=>{"use strict";var h6=qo(),jpe=Ho(),g6=df(),Mpe=Dy(),y6=hT(),Fpe=gT(),_6="All mapping items must start at the same column";function Lpe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??jpe.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=g6.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",_6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Mpe.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",_6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&y6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Fpe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=g6.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 zpe=Go(),Upe=df(),qpe=hT();function Bpe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??zpe.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=Upe.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&&qpe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}S6.resolveBlockSeq=Bpe});var Hc=v(x6=>{"use strict";function Hpe(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}}x6.resolveEnd=Hpe});var A6=v(E6=>{"use strict";var Gpe=Ce(),Zpe=qo(),$6=Ho(),Vpe=Go(),Wpe=Hc(),k6=df(),Kpe=Dy(),Jpe=gT(),yT="Block collections are not allowed within flow collections",_T=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Ype({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?$6.YAMLMap:Vpe.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=Wpe.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}E6.resolveFlowCollection=Ype});var O6=v(T6=>{"use strict";var Xpe=Ce(),Qpe=It(),eme=Ho(),tme=Go(),rme=v6(),nme=w6(),ime=A6();function bT(t,e,r,n,i,o){let s=r.type==="block-map"?rme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?nme.resolveBlockSeq(t,e,r,n,o):ime.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 ome(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),bT(t,e,r,i,s)}let l=bT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Xpe.isNode(u)?u:new Qpe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}T6.composeCollection=ome});var ST=v(R6=>{"use strict";var vT=It();function sme(t,e,r){let n=e.offset,i=ame(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?vT.Scalar.BLOCK_FOLDED:vT.Scalar.BLOCK_LITERAL,s=e.source?cme(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?` +`}};lf.YAMLError=cf;lf.YAMLParseError=pT;lf.YAMLWarning=mT;lf.prettifyError=jpe});var df=v(f6=>{"use strict";function Mpe(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 E of t)switch(m&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&o(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&E.type!=="comment"&&E.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),E.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&E.source.includes(" ")&&(h=E),u=!0;break;case"comment":{u||o(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=E.source.substring(1)||" ";d?d+=f+C:d=C,f="",l=!1;break}case"newline":l?d?d+=E.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=E.source,l=!0,p=!0,(g||b)&&(_=E),u=!0;break;case"anchor":g&&o(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&o(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=E,w??(w=E.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(E,"MULTIPLE_TAGS","A node can have at most one tag"),b=E,w??(w=E.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),x&&o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),x=E,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=E,l=!1,u=!1;break}default:o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),l=!1,u=!1}let O=t[t.length-1],A=O?O.offset+O.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}}f6.resolveProps=Mpe});var Dy=v(p6=>{"use strict";function hT(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(hT(e.key)||hT(e.value))return!0}return!1;default:return!0}}p6.containsNewline=hT});var gT=v(m6=>{"use strict";var Fpe=Dy();function Lpe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Fpe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}m6.flowIndentCheck=Lpe});var yT=v(g6=>{"use strict";var h6=Ce();function zpe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||h6.isScalar(o)&&h6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}g6.mapIncludes=zpe});var w6=v(S6=>{"use strict";var y6=Ho(),Upe=Zo(),_6=df(),qpe=Dy(),b6=gT(),Bpe=yT(),v6="All mapping items must start at the same column";function Hpe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Upe.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=_6.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",v6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||qpe.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",v6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&b6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Bpe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=_6.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 Gpe=Vo(),Zpe=df(),Vpe=gT();function Wpe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Gpe.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=Zpe.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&&Vpe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}x6.resolveBlockSeq=Wpe});var Gc=v(k6=>{"use strict";function Kpe(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}}k6.resolveEnd=Kpe});var O6=v(T6=>{"use strict";var Jpe=Ce(),Ype=Ho(),E6=Zo(),Xpe=Vo(),Qpe=Gc(),A6=df(),eme=Dy(),tme=yT(),_T="Block collections are not allowed within flow collections",bT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function rme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?E6.YAMLMap:Xpe.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=Qpe.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}T6.resolveFlowCollection=rme});var I6=v(R6=>{"use strict";var nme=Ce(),ime=It(),ome=Zo(),sme=Vo(),ame=w6(),cme=$6(),lme=O6();function vT(t,e,r,n,i,o){let s=r.type==="block-map"?ame.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?cme.resolveBlockSeq(t,e,r,n,o):lme.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 ume(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),vT(t,e,r,i,s)}let l=vT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=nme.isNode(u)?u:new ime.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}R6.composeCollection=ume});var wT=v(P6=>{"use strict";var ST=It();function dme(t,e,r){let n=e.offset,i=fme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?ST.Scalar.BLOCK_FOLDED:ST.Scalar.BLOCK_LITERAL,s=e.source?pme(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 ame({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 wT=It(),lme=Hc();function ume(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=wT.Scalar.PLAIN,c=dme(o,l);break;case"single-quoted-scalar":a=wT.Scalar.QUOTE_SINGLE,c=fme(o,l);break;case"double-quoted-scalar":a=wT.Scalar.QUOTE_DOUBLE,c=pme(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=lme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function dme(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}`),I6(t)}function fme(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),I6(t.slice(1,-1)).replace(/''/g,"'")}function I6(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var xT=It(),mme=Gc();function hme(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=xT.Scalar.PLAIN,c=gme(o,l);break;case"single-quoted-scalar":a=xT.Scalar.QUOTE_SINGLE,c=yme(o,l);break;case"double-quoted-scalar":a=xT.Scalar.QUOTE_DOUBLE,c=_me(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=mme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function gme(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}`),C6(t)}function yme(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),C6(t.slice(1,-1)).replace(/''/g,"'")}function C6(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 mme(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 bme(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 hme={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function gme(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}}P6.resolveFlowScalar=ume});var N6=v(D6=>{"use strict";var oa=Ce(),C6=It(),yme=ST(),_me=xT();function bme(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?yme.resolveBlockScalar(t,e,n):_me.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[oa.SCALAR]:c?l=vme(t.schema,i,c,r,n):e.type==="scalar"?l=Sme(t,i,e,n):l=t.schema[oa.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=oa.isScalar(d)?d:new C6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new C6.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 vme(t,e,r,n,i){if(r==="!")return t[oa.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[oa.SCALAR])}function Sme({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[oa.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[oa.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}D6.composeScalar=bme});var M6=v(j6=>{"use strict";function wme(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}j6.emptyScalarPosition=wme});var z6=v(kT=>{"use strict";var xme=Hd(),$me=Ce(),kme=O6(),F6=N6(),Eme=Hc(),Ame=M6(),Tme={composeNode:L6,composeEmptyNode:$T};function L6(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=Ome(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=F6.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=kme.composeCollection(Tme,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=$T(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&&(!$me.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 $T(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Ame.emptyScalarPosition(e,r,n),indent:-1,source:""},d=F6.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 Ome({options:t},{offset:e,source:r,end:n},i){let o=new xme.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=Eme.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}kT.composeEmptyNode=$T;kT.composeNode=L6});var B6=v(q6=>{"use strict";var Rme=af(),U6=z6(),Ime=Hc(),Pme=df();function Cme(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Rme.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Pme.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?U6.composeNode(l,i,u,s):U6.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Ime.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}q6.composeDoc=Cme});var AT=v(Z6=>{"use strict";var Dme=He("process"),Nme=fA(),jme=af(),ff=uf(),H6=Ce(),Mme=B6(),Fme=Hc();function pf(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 G6(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var sa=Ce(),N6=It(),wme=wT(),xme=$T();function $me(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?wme.resolveBlockScalar(t,e,n):xme.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[sa.SCALAR]:c?l=kme(t.schema,i,c,r,n):e.type==="scalar"?l=Eme(t,i,e,n):l=t.schema[sa.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=sa.isScalar(d)?d:new N6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new N6.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 kme(t,e,r,n,i){if(r==="!")return t[sa.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[sa.SCALAR])}function Eme({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[sa.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[sa.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}j6.composeScalar=$me});var L6=v(F6=>{"use strict";function Ame(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}F6.emptyScalarPosition=Ame});var q6=v(ET=>{"use strict";var Tme=Hd(),Ome=Ce(),Rme=I6(),z6=M6(),Ime=Gc(),Pme=L6(),Cme={composeNode:U6,composeEmptyNode:kT};function U6(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=Dme(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=z6.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Rme.composeCollection(Cme,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=kT(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&&(!Ome.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 kT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Pme.emptyScalarPosition(e,r,n),indent:-1,source:""},d=z6.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 Dme({options:t},{offset:e,source:r,end:n},i){let o=new Tme.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=Ime.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ET.composeEmptyNode=kT;ET.composeNode=U6});var G6=v(H6=>{"use strict";var Nme=af(),B6=q6(),jme=Gc(),Mme=df();function Fme(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Nme.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Mme.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?B6.composeNode(l,i,u,s):B6.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=jme.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}H6.composeDoc=Fme});var TT=v(W6=>{"use strict";var Lme=He("process"),zme=pA(),Ume=af(),ff=uf(),Z6=Ce(),qme=G6(),Bme=Gc();function pf(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 V6(t){let e="",r=!1,n=!1;for(let i=0;i{let s=pf(r);o?this.warnings.push(new ff.YAMLWarning(s,n,i)):this.errors.push(new ff.YAMLParseError(s,n,i))},this.directives=new Nme.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=G6(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(H6.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];H6.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 AT=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=pf(r);o?this.warnings.push(new ff.YAMLWarning(s,n,i)):this.errors.push(new ff.YAMLParseError(s,n,i))},this.directives=new zme.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=V6(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(Z6.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];Z6.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=pf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Mme.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(pf(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(pf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Fme.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(pf(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 jme.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}}};Z6.Composer=ET});var K6=v(Ny=>{"use strict";var Lme=ST(),zme=xT(),Ume=uf(),V6=Kd();function qme(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 Ume.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return zme.resolveFlowScalar(t,e,n);case"block-scalar":return Lme.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Bme(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=V6.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=pf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=qme.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(pf(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(pf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Bme.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(pf(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 Ume.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}}};W6.Composer=AT});var Y6=v(Ny=>{"use strict";var Hme=wT(),Gme=$T(),Zme=uf(),K6=Kd();function Vme(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 Zme.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Gme.resolveFlowScalar(t,e,n);case"block-scalar":return Hme.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Wme(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=K6.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 W6(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 Hme(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=V6.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">":Gme(t,c);break;case'"':TT(t,c,"double-quoted-scalar");break;case"'":TT(t,c,"single-quoted-scalar");break;default:TT(t,c,"scalar")}}function Gme(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return J6(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 Kme(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=K6.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">":Jme(t,c);break;case'"':OT(t,c,"double-quoted-scalar");break;case"'":OT(t,c,"single-quoted-scalar");break;default:OT(t,c,"scalar")}}function Jme(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}];W6(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 W6(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 TT(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})}}}Ny.createScalarToken=Bme;Ny.resolveAsScalar=qme;Ny.setScalarValue=Hme});var Y6=v(J6=>{"use strict";var Zme=t=>"type"in t?My(t):jy(t);function My(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=My(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=jy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=jy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=jy(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 jy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=My(e)),r)for(let o of r)i+=o.source;return n&&(i+=My(n)),i}J6.stringify=Zme});var tB=v(eB=>{"use strict";var OT=Symbol("break visit"),Vme=Symbol("skip children"),X6=Symbol("remove item");function sa(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Q6(Object.freeze([]),t,e)}sa.BREAK=OT;sa.SKIP=Vme;sa.REMOVE=X6;sa.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};sa.parentCollection=(t,e)=>{let r=sa.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Q6(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 RT=K6(),Wme=Y6(),Kme=tB(),IT="\uFEFF",PT="",CT="",DT="",Jme=t=>!!t&&"items"in t,Yme=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Xme(t){switch(t){case IT:return"";case PT:return"";case CT:return"";case DT:return"";default:return JSON.stringify(t)}}function Qme(t){switch(t){case IT:return"byte-order-mark";case PT:return"doc-mode";case CT:return"flow-error-end";case DT: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}];J6(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 J6(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 OT(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})}}}Ny.createScalarToken=Wme;Ny.resolveAsScalar=Vme;Ny.setScalarValue=Kme});var Q6=v(X6=>{"use strict";var Yme=t=>"type"in t?My(t):jy(t);function My(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=My(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=jy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=jy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=jy(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 jy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=My(e)),r)for(let o of r)i+=o.source;return n&&(i+=My(n)),i}X6.stringify=Yme});var nB=v(rB=>{"use strict";var RT=Symbol("break visit"),Xme=Symbol("skip children"),eB=Symbol("remove item");function aa(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),tB(Object.freeze([]),t,e)}aa.BREAK=RT;aa.SKIP=Xme;aa.REMOVE=eB;aa.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};aa.parentCollection=(t,e)=>{let r=aa.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 tB(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 IT=Y6(),Qme=Q6(),ehe=nB(),PT="\uFEFF",CT="",DT="",NT="",the=t=>!!t&&"items"in t,rhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function nhe(t){switch(t){case PT:return"";case CT:return"";case DT:return"";case NT:return"";default:return JSON.stringify(t)}}function ihe(t){switch(t){case PT:return"byte-order-mark";case CT:return"doc-mode";case DT:return"flow-error-end";case NT: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}Cr.createScalarToken=RT.createScalarToken;Cr.resolveAsScalar=RT.resolveAsScalar;Cr.setScalarValue=RT.setScalarValue;Cr.stringify=Wme.stringify;Cr.visit=Kme.visit;Cr.BOM=IT;Cr.DOCUMENT=PT;Cr.FLOW_END=CT;Cr.SCALAR=DT;Cr.isCollection=Jme;Cr.isScalar=Yme;Cr.prettyToken=Xme;Cr.tokenType=Qme});var MT=v(nB=>{"use strict";var mf=Fy();function Gn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var rB=new Set("0123456789ABCDEFabcdef"),ehe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Ly=new Set(",[]{}"),the=new Set(` ,[]{} -\r `),NT=t=>!t||the.has(t),jT=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}Cr.createScalarToken=IT.createScalarToken;Cr.resolveAsScalar=IT.resolveAsScalar;Cr.setScalarValue=IT.setScalarValue;Cr.stringify=Qme.stringify;Cr.visit=ehe.visit;Cr.BOM=PT;Cr.DOCUMENT=CT;Cr.FLOW_END=DT;Cr.SCALAR=NT;Cr.isCollection=the;Cr.isScalar=rhe;Cr.prettyToken=nhe;Cr.tokenType=ihe});var FT=v(oB=>{"use strict";var mf=Fy();function Gn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var iB=new Set("0123456789ABCDEFabcdef"),ohe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Ly=new Set(",[]{}"),she=new Set(` ,[]{} +\r `),jT=t=>!t||she.has(t),MT=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==="...")&&Gn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Gn(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===":")&&Gn(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(NT),"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&&!Gn(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===":")&&Gn(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(jT),"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=>Gn(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,42 +161,42 @@ ${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 mf.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(Gn(o)||e&&Ly.has(o))break;r=n}else if(Gn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` `,o=this.buffer[n+1]):r=n),o==="#"||e&&Ly.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&Ly.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield mf.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(NT),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Gn(n)||r&&Ly.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(;!Gn(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(ehe.has(r))r=this.buffer[++e];else if(r==="%"&&rB.has(this.buffer[e+1])&&rB.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&&Ly.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield mf.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(jT),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Gn(n)||r&&Ly.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(;!Gn(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(ohe.has(r))r=this.buffer[++e];else if(r==="%"&&iB.has(this.buffer[e+1])&&iB.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)}};nB.Lexer=jT});var LT=v(iB=>{"use strict";var FT=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 rhe=He("process"),oB=Fy(),nhe=MT();function Zo(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 Uy(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&&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)}};oB.Lexer=MT});var zT=v(sB=>{"use strict";var LT=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 ahe=He("process"),aB=Fy(),che=FT();function Wo(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 Uy(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"&&lB(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&&cB(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(Zo(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(cB(r.key)&&!Zo(r.sep,"newline")){let s=Gc(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(Zo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Gc(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]}):Zo(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&&!Zo(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)){Uy(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||Zo(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=zy(n),o=Gc(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)){Uy(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(Wo(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(uB(r.key)&&!Wo(r.sep,"newline")){let s=Zc(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(Wo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Zc(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]}):Wo(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&&!Wo(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)){Uy(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||Wo(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=zy(n),o=Zc(i);lB(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=zy(e),n=Gc(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=zy(e),n=Gc(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())}}};lB.Parser=zT});var mB=v(gf=>{"use strict";var uB=AT(),ihe=af(),hf=uf(),ohe=kA(),she=Ce(),ahe=LT(),dB=UT();function fB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new ahe.LineCounter||null,prettyErrors:e}}function che(t,e={}){let{lineCounter:r,prettyErrors:n}=fB(e),i=new dB.Parser(r?.addNewLine),o=new uB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(hf.prettifyError(t,r)),a.warnings.forEach(hf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function pB(t,e={}){let{lineCounter:r,prettyErrors:n}=fB(e),i=new dB.Parser(r?.addNewLine),o=new uB.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 hf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(hf.prettifyError(t,r)),s.warnings.forEach(hf.prettifyError(t,r))),s}function lhe(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=>ohe.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 uhe(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 she.isDocument(t)&&!n?t.toString(r):new ihe.Document(t,n,r).toString(r)}gf.parse=lhe;gf.parseAllDocuments=che;gf.parseDocument=pB;gf.stringify=uhe});var cr=v(Ge=>{"use strict";var dhe=AT(),fhe=af(),phe=aT(),qT=uf(),mhe=Hd(),Vo=Ce(),hhe=qo(),ghe=It(),yhe=Ho(),_he=Go(),bhe=Fy(),vhe=MT(),She=LT(),whe=UT(),qy=mB(),hB=zd();Ge.Composer=dhe.Composer;Ge.Document=fhe.Document;Ge.Schema=phe.Schema;Ge.YAMLError=qT.YAMLError;Ge.YAMLParseError=qT.YAMLParseError;Ge.YAMLWarning=qT.YAMLWarning;Ge.Alias=mhe.Alias;Ge.isAlias=Vo.isAlias;Ge.isCollection=Vo.isCollection;Ge.isDocument=Vo.isDocument;Ge.isMap=Vo.isMap;Ge.isNode=Vo.isNode;Ge.isPair=Vo.isPair;Ge.isScalar=Vo.isScalar;Ge.isSeq=Vo.isSeq;Ge.Pair=hhe.Pair;Ge.Scalar=ghe.Scalar;Ge.YAMLMap=yhe.YAMLMap;Ge.YAMLSeq=_he.YAMLSeq;Ge.CST=bhe;Ge.Lexer=vhe.Lexer;Ge.LineCounter=She.LineCounter;Ge.Parser=whe.Parser;Ge.parse=qy.parse;Ge.parseAllDocuments=qy.parseAllDocuments;Ge.parseDocument=qy.parseDocument;Ge.stringify=qy.stringify;Ge.visit=hB.visit;Ge.visitAsync=hB.visitAsync});import{execFileSync as gB}from"node:child_process";import{existsSync as By}from"node:fs";import{join as Hy,resolve as xhe}from"node:path";function $he(t){try{let e=gB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?xhe(t,e):null}catch{return null}}function BT(t){let e=$he(t);if(!e)return null;try{if(By(Hy(e,"MERGE_HEAD")))return"merge";if(By(Hy(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(By(Hy(e,"rebase-merge"))||By(Hy(e,"rebase-apply")))return"rebase"}catch{return null}return null}function aa(t){return BT(t)!==null}function HT(t,e){try{let r=gB("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 Gy(t,e){return HT(t,e)!==null}var ca=y(()=>{"use strict"});import{execFileSync as khe}from"node:child_process";import{existsSync as Ehe,readFileSync as Ahe}from"node:fs";import{join as bB}from"node:path";function yf(t,e){return khe("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Wo(t){try{let e=yf(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 Ko(t,e){The(t,e);let r=yf(t,["rev-parse","HEAD"]).trim(),n=Ohe(t,e);return{groups:Rhe(t,n),head:r,inventory:{after:_B(Vy(t,"spec.yaml")),before:_B(GT(t,e,"spec.yaml"))},since:e,unsharded_commits:Dhe(t,e)}}function ZT(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 The(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!Gy(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 Ohe(t,e){let r=yf(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(!(!yB(c)&&!yB(a)))if(s.startsWith("A")){let l=Zy(Vy(t,c));if(!l)continue;l.status==="done"?n.push(Zc(l,"added-as-done")):l.status==="archived"&&n.push(Zc(l,"archived"))}else if(s.startsWith("D")){let l=Zy(GT(t,e,a));l&&n.push(Zc(l,"archived"))}else{let l=Zy(Vy(t,c));if(!l)continue;let d=Zy(GT(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(Zc(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(Zc(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(Zc(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function yB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function Zc(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>ZT(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function Zy(t){if(t===null)return null;let e;try{e=(0,Wy.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 Vy(t,e){let r=bB(t,e);if(!Ehe(r))return null;try{return Ahe(r,"utf8")}catch{return null}}function GT(t,e,r){try{return yf(t,["show",`${e}:${r}`])}catch{return null}}function Rhe(t,e){let r=Ihe(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 Ihe(t){let e=Vy(t,bB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,Wy.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function _B(t){let e={};if(t!==null)try{let n=(0,Wy.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 Dhe(t,e){let r=yf(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);Phe.test(a)&&(Che.test(a)||n.push({hash:s,subject:a}))}return n}var Wy,Phe,Che,Vc=y(()=>{"use strict";Wy=Et(cr(),1);ca();Phe=/^(feat|fix)(\([^)]*\))?!?:/,Che=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as vB}from"node:child_process";import{appendFileSync as Nhe,existsSync as VT,mkdirSync as jhe,readFileSync as Mhe,renameSync as Fhe,statSync as Lhe}from"node:fs";import{userInfo as zhe}from"node:os";import{dirname as Uhe,join as KT}from"node:path";function JT(t){return KT(t,SB,qhe)}function Yr(t,e){let r=JT(t),n=Uhe(r);VT(n)||jhe(n,{recursive:!0});try{VT(r)&&Lhe(r).size>Bhe&&Fhe(r,KT(n,wB))}catch{}Nhe(r,`${JSON.stringify(e)} -`,"utf8")}function WT(t){if(!VT(t))return[];let e=Mhe(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function la(t){return WT(JT(t))}function Ky(t){return[...WT(KT(t,SB,wB)),...WT(JT(t))]}function Xr(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 Hhe(t){let e;try{e=vB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=zhe().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Ghe(t){try{return vB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function _f(t,e){try{let r=la(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function lr(t,e,r){try{let n=Ghe(t),i=Hhe(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=_f(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Yr(t,Xr(e,o))}catch{}}var SB,qhe,wB,Bhe,Dr=y(()=>{"use strict";SB=".cladding",qhe="events.log.jsonl",wB="events.log.1.jsonl",Bhe=5*1024*1024});import{execFileSync as Zhe}from"node:child_process";import{existsSync as xB,readdirSync as Vhe,readFileSync as Whe,statSync as $B}from"node:fs";import{createHash as Khe}from"node:crypto";import{join as YT}from"node:path";function ua(t){try{return Zhe("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function XT(t){let e=[],r=YT(t,"spec.yaml");xB(r)&&$B(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=YT(t,"spec",i);if(!(!xB(o)||!$B(o).isDirectory()))for(let s of Vhe(o))s.endsWith(".yaml")&&e.push(YT(o,s))}e.sort();let n=Khe("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Whe(i)),n.update("\0")}return n.digest("hex")}function Jy(t,e){let r={featureId:e,gitHead:ua(t),specDigest:XT(t),timestamp:new Date().toISOString()};return Yr(t,Xr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function Yy(t,e){let r=la(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 Xy(t,e,r,n){let i=Xr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Yr(t,i),i}var bf=y(()=>{"use strict";Dr()});import{readFileSync as Jhe,statSync as Yhe}from"node:fs";import{extname as Xhe,resolve as QT,sep as Qhe}from"node:path";function Qr(t){return Math.ceil(t.length/4)}function rge(t,e){let r=QT(e),n=QT(r,t);return n===r||n.startsWith(r+Qhe)}function EB(t,e,r,n){if(!rge(t,e))return{path:t,omitted:"unsafe-path"};if(!ege.has(Xhe(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>kB)return{path:t,omitted:"too-large",bytes:o}}else{let l=QT(e,t);try{o=Yhe(l).size}catch{return{path:t,omitted:"missing"}}if(o>kB)return{path:t,omitted:"too-large",bytes:o};try{i=Jhe(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(tge))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=zy(e),n=Zc(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=zy(e),n=Zc(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())}}};dB.Parser=UT});var gB=v(gf=>{"use strict";var fB=TT(),lhe=af(),hf=uf(),uhe=EA(),dhe=Ce(),fhe=zT(),pB=qT();function mB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new fhe.LineCounter||null,prettyErrors:e}}function phe(t,e={}){let{lineCounter:r,prettyErrors:n}=mB(e),i=new pB.Parser(r?.addNewLine),o=new fB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(hf.prettifyError(t,r)),a.warnings.forEach(hf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function hB(t,e={}){let{lineCounter:r,prettyErrors:n}=mB(e),i=new pB.Parser(r?.addNewLine),o=new fB.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 hf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(hf.prettifyError(t,r)),s.warnings.forEach(hf.prettifyError(t,r))),s}function mhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=hB(t,r);if(!i)return null;if(i.warnings.forEach(o=>uhe.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 hhe(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 dhe.isDocument(t)&&!n?t.toString(r):new lhe.Document(t,n,r).toString(r)}gf.parse=mhe;gf.parseAllDocuments=phe;gf.parseDocument=hB;gf.stringify=hhe});var cr=v(Ge=>{"use strict";var ghe=TT(),yhe=af(),_he=cT(),BT=uf(),bhe=Hd(),Ko=Ce(),vhe=Ho(),She=It(),whe=Zo(),xhe=Vo(),$he=Fy(),khe=FT(),Ehe=zT(),Ahe=qT(),qy=gB(),yB=zd();Ge.Composer=ghe.Composer;Ge.Document=yhe.Document;Ge.Schema=_he.Schema;Ge.YAMLError=BT.YAMLError;Ge.YAMLParseError=BT.YAMLParseError;Ge.YAMLWarning=BT.YAMLWarning;Ge.Alias=bhe.Alias;Ge.isAlias=Ko.isAlias;Ge.isCollection=Ko.isCollection;Ge.isDocument=Ko.isDocument;Ge.isMap=Ko.isMap;Ge.isNode=Ko.isNode;Ge.isPair=Ko.isPair;Ge.isScalar=Ko.isScalar;Ge.isSeq=Ko.isSeq;Ge.Pair=vhe.Pair;Ge.Scalar=She.Scalar;Ge.YAMLMap=whe.YAMLMap;Ge.YAMLSeq=xhe.YAMLSeq;Ge.CST=$he;Ge.Lexer=khe.Lexer;Ge.LineCounter=Ehe.LineCounter;Ge.Parser=Ahe.Parser;Ge.parse=qy.parse;Ge.parseAllDocuments=qy.parseAllDocuments;Ge.parseDocument=qy.parseDocument;Ge.stringify=qy.stringify;Ge.visit=yB.visit;Ge.visitAsync=yB.visitAsync});import{execFileSync as _B}from"node:child_process";import{existsSync as By}from"node:fs";import{join as Hy,resolve as The}from"node:path";function Ohe(t){try{let e=_B("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?The(t,e):null}catch{return null}}function HT(t){let e=Ohe(t);if(!e)return null;try{if(By(Hy(e,"MERGE_HEAD")))return"merge";if(By(Hy(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(By(Hy(e,"rebase-merge"))||By(Hy(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ca(t){return HT(t)!==null}function GT(t,e){try{let r=_B("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 Gy(t,e){return GT(t,e)!==null}var la=y(()=>{"use strict"});import{execFileSync as Rhe}from"node:child_process";import{existsSync as Ihe,readFileSync as Phe}from"node:fs";import{join as SB}from"node:path";function yf(t,e){return Rhe("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Jo(t){try{let e=yf(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 Yo(t,e){Che(t,e);let r=yf(t,["rev-parse","HEAD"]).trim(),n=Dhe(t,e);return{groups:Nhe(t,n),head:r,inventory:{after:vB(Vy(t,"spec.yaml")),before:vB(ZT(t,e,"spec.yaml"))},since:e,unsharded_commits:Lhe(t,e)}}function VT(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 Che(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!Gy(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 Dhe(t,e){let r=yf(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(!(!bB(c)&&!bB(a)))if(s.startsWith("A")){let l=Zy(Vy(t,c));if(!l)continue;l.status==="done"?n.push(Vc(l,"added-as-done")):l.status==="archived"&&n.push(Vc(l,"archived"))}else if(s.startsWith("D")){let l=Zy(ZT(t,e,a));l&&n.push(Vc(l,"archived"))}else{let l=Zy(Vy(t,c));if(!l)continue;let d=Zy(ZT(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(Vc(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(Vc(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(Vc(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function bB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function Vc(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>VT(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function Zy(t){if(t===null)return null;let e;try{e=(0,Wy.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 Vy(t,e){let r=SB(t,e);if(!Ihe(r))return null;try{return Phe(r,"utf8")}catch{return null}}function ZT(t,e,r){try{return yf(t,["show",`${e}:${r}`])}catch{return null}}function Nhe(t,e){let r=jhe(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 jhe(t){let e=Vy(t,SB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,Wy.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function vB(t){let e={};if(t!==null)try{let n=(0,Wy.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 Lhe(t,e){let r=yf(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);Mhe.test(a)&&(Fhe.test(a)||n.push({hash:s,subject:a}))}return n}var Wy,Mhe,Fhe,Wc=y(()=>{"use strict";Wy=Et(cr(),1);la();Mhe=/^(feat|fix)(\([^)]*\))?!?:/,Fhe=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as wB}from"node:child_process";import{appendFileSync as zhe,existsSync as WT,mkdirSync as Uhe,readFileSync as qhe,renameSync as Bhe,statSync as Hhe}from"node:fs";import{userInfo as Ghe}from"node:os";import{dirname as Zhe,join as JT}from"node:path";function YT(t){return JT(t,xB,Vhe)}function Yr(t,e){let r=YT(t),n=Zhe(r);WT(n)||Uhe(n,{recursive:!0});try{WT(r)&&Hhe(r).size>Whe&&Bhe(r,JT(n,$B))}catch{}zhe(r,`${JSON.stringify(e)} +`,"utf8")}function KT(t){if(!WT(t))return[];let e=qhe(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ua(t){return KT(YT(t))}function Ky(t){return[...KT(JT(t,xB,$B)),...KT(YT(t))]}function Xr(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 Khe(t){let e;try{e=wB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Ghe().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Jhe(t){try{return wB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function _f(t,e){try{let r=ua(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function lr(t,e,r){try{let n=Jhe(t),i=Khe(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=_f(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Yr(t,Xr(e,o))}catch{}}var xB,Vhe,$B,Whe,Dr=y(()=>{"use strict";xB=".cladding",Vhe="events.log.jsonl",$B="events.log.1.jsonl",Whe=5*1024*1024});import{execFileSync as Yhe}from"node:child_process";import{existsSync as kB,readdirSync as Xhe,readFileSync as Qhe,statSync as EB}from"node:fs";import{createHash as ege}from"node:crypto";import{join as XT}from"node:path";function da(t){try{return Yhe("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function QT(t){let e=[],r=XT(t,"spec.yaml");kB(r)&&EB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=XT(t,"spec",i);if(!(!kB(o)||!EB(o).isDirectory()))for(let s of Xhe(o))s.endsWith(".yaml")&&e.push(XT(o,s))}e.sort();let n=ege("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Qhe(i)),n.update("\0")}return n.digest("hex")}function Jy(t,e){let r={featureId:e,gitHead:da(t),specDigest:QT(t),timestamp:new Date().toISOString()};return Yr(t,Xr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function Yy(t,e){let r=ua(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 Xy(t,e,r,n){let i=Xr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Yr(t,i),i}var bf=y(()=>{"use strict";Dr()});import{readFileSync as tge,statSync as rge}from"node:fs";import{extname as nge,resolve as eO,sep as ige}from"node:path";function Qr(t){return Math.ceil(t.length/4)}function age(t,e){let r=eO(e),n=eO(r,t);return n===r||n.startsWith(r+ige)}function TB(t,e,r,n){if(!age(t,e))return{path:t,omitted:"unsafe-path"};if(!oge.has(nge(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>AB)return{path:t,omitted:"too-large",bytes:o}}else{let l=eO(e,t);try{o=rge(l).size}catch{return{path:t,omitted:"missing"}}if(o>AB)return{path:t,omitted:"too-large",bytes:o};try{i=tge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(sge))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 ege,kB,tge,Qy=y(()=>{"use strict";ege=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"]),kB=2e6,tge="\0"});function ige(t){for(let i of nge)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 eO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function oge(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??[])eO(e,s,o);for(let s of i.modules??[])eO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=ige(a);c&&eO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function xn(t){let e=AB.get(t);return e||(e=oge(t),AB.set(t,e)),e}var nge,AB,da=y(()=>{"use strict";nge=["derived:","fixture:","script:","self-dogfood:"];AB=new WeakMap});function tO(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 yr(t,e,r={}){let n=r.depth??1/0,i=xn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=sge(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=tO(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:rO(i)}}var fa=y(()=>{"use strict";da()});function TB(t){return t.impacted.length}function t_(t,e,r={}){let n=r.initialDepth??e_.initialDepth,i=r.maxDepth??e_.maxDepth,o=r.coverageThreshold??e_.coverageThreshold,s=r.marginYieldThreshold??e_.marginYieldThreshold,a=xn(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=yr(t,e,{depth:1});return"not_found"in b,b}let d=tO(l,a.dependents,1/0).size;if(d===0){let b=yr(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 _=yr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=TB(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,A=x===0&&b>n,E={frontierExhausted:A,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(A)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:E};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:E};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var e_,nO=y(()=>{"use strict";fa();da();e_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function age(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 OB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=age(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 RB=y(()=>{"use strict"});function cge(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 Wc(t,e){let r=cge(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=OB(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 r_=y(()=>{"use strict";RB()});import{existsSync as PB,readdirSync as lge,readFileSync as uge}from"node:fs";import{join as oO}from"node:path";function sO(t,e=fge){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function pge(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:sO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:sO(`done reverted \u2014 pre-push strict gate red${r}`)}}function IB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function mge(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 sO(n)}function hge(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)=>IB(m)-IB(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(-dge).map(pge),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?mge(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 iO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function gge(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 yge(t,e,r){let n=iO(t,/_Rolled back at_\s*`([^`]+)`/),i=iO(t,/Last failed gate:\s*`([^`]+)`/),o=iO(t,/Retry attempts:\s*(\d+)/),s=gge(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function _ge(t,e){let r=oO(t,".cladding","post-mortems");if(!PB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of lge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(yge(uge(oO(r,o),"utf8"),e,o))}catch{}return i}function CB(t,e){try{let r=Ky(t),n=_ge(t,e),i=PB(oO(t,".cladding","events.log.1.jsonl"));return hge(r,n,e,{truncated:i})}catch{return}}var dge,fge,DB=y(()=>{"use strict";Dr();dge=5,fge=120});function n_(t,e,r){return Qr(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function pa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:bge,o=e,s,a=xn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=Wc(t,o);if("not_found"in c)return c;let l=c.focus,u=CB(n,l.id),d=a&&a.size>0?e:l.id,f=t_(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}},O=[...c.ancestors];for(;O.length>vge&&n_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}E.push(Vt),Vt.truncated&&x.push(`code: clipped ${se}`)}A>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let C=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),k=(se,Pe,Vt,ar)=>{let Kt=Vt+ar>0?[`breaks: omitted ${Vt} feature(s) / ${ar} test(s)`]:[],to={...w,needs:O,must_edit:{...w.must_edit,code:E},breaks_if_changed:C(se,Pe),budget:{...w.budget,truncated:[...x,...Kt]}};return Qr(JSON.stringify(to))>i},q=m,X=h;if(k(q,X,0,0)){let se=yr(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Vt=new Set("not_found"in se?[]:se.test_refs),Kt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],to=0;for(;Kt.length>Pe.size&&k(Kt,X,to,0);)Kt=Kt.slice(0,-1),to++;let yi=[...h],Jr=0;for(;k(Kt,yi,to,Jr);){let de=-1;for(let ro=yi.length-1;ro>=0;ro--)if(!Vt.has(yi[ro])){de=ro;break}if(de<0)break;yi.splice(de,1),Jr++}q=Kt,X=yi,to+Jr>0&&x.push(`breaks: omitted ${to} feature(s) / ${Jr} test(s)`),k(q,X,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Se=C(q,X),I={...w,needs:O,must_edit:{...w.must_edit,code:E},breaks_if_changed:Se},P=I;if(u){let se={...I,prior_attempts:u};Qr(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Rr=Qr(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Rr,truncated:x}}}var bge,vge,i_=y(()=>{"use strict";Qy();r_();nO();DB();fa();da();bge=3e3,vge=3});function Zn(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 Sge(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 NB(t,e,r="."){let n=xn(t),i=t.features??[],o=[];for(let f of i){let p=pa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=pa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=t_(t,f.id),g=!("not_found"in h),b=Qr(JSON.stringify(p)),_="not_found"in m?b:Qr(JSON.stringify(m)),S=Qr(JSON.stringify(f));for(let O of f.modules??[]){let A=e(O);A&&(S+=Qr(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(Zn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Zn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Zn(a(c))*10)/10,medianShrinkTruncated:Math.round(Zn(a(l))*10)/10,medianStructuralRatio:Math.round(Zn(u)*100)/100,medianSliceTokens:Math.round(Zn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Zn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Zn(o.map(f=>f.searchDepth)),p95Depth:Sge(o.map(f=>f.searchDepth),95),medianEdges:Zn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Zn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Zn(o.map(f=>f.regressionTests))},features:o}}var Kc,o_=y(()=>{"use strict";Qy();nO();i_();da();Kc="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as wge,existsSync as aO,mkdirSync as xge,readFileSync as jB}from"node:fs";import{dirname as $ge,join as kge}from"node:path";function cO(t){return kge(t,Ege,Age)}function Tge(t,e){return{timestamp:new Date().toISOString(),head:ua(t),spec_digest:XT(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function MB(t,e){try{let r=Tge(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=lO(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=cO(t),s=$ge(o);return aO(s)||xge(s,{recursive:!0}),wge(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function FB(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 lO(t,e){let r=cO(t);if(!aO(r))return[];let n;try{n=jB(r,"utf8")}catch{return[]}let i=FB(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function LB(t){let e=cO(t);if(!aO(e))return{snapshots:[],unreadable:!1};let r;try{r=jB(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=FB(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 zB(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(` ${Kc}`),i.join(` -`)}var Ege,Age,Sf=y(()=>{"use strict";bf();o_();Ege=".cladding",Age="measure.jsonl"});import{existsSync as Oge}from"node:fs";import{join as Rge}from"node:path";function Jc(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}** (${Ige[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 qB(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`,"",Kc),r.join(` -`)}function Yc(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"} | ${Cge(l,r)} |`)}return n.join(` -`)}function Cge(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 Pge)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Oge(Rge(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function Xc(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),UB(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)UB(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function UB(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=ZT(r);n&&t.push(`- ${n}`)}t.push("")}var Ige,Pge,s_=y(()=>{"use strict";Sf();o_();Vc();Ige={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Pge=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Dge}from"node:fs";function wi(t="./spec.yaml"){let e=Dge(t,"utf8");return(0,BB.parse)(e)}var BB,a_=y(()=>{"use strict";BB=Et(cr(),1)});var Jo=v((Nr,pO)=>{"use strict";var uO=Nr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+GB(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()};uO.prototype.toString=function(){return this.property+" "+this.message};var c_=Nr.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};c_.prototype.addError=function(e){var r;if(typeof e=="string")r=new uO(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 uO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new ma(this);if(this.throwError)throw r;return r};c_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Nge(t,e){return e+": "+t.toString()+` -`}c_.prototype.toString=function(e){return this.errors.map(Nge).join("")};Object.defineProperty(c_.prototype,"valid",{get:function(){return!this.errors.length}});pO.exports.ValidatorResultError=ma;function ma(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ma),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}ma.prototype=new Error;ma.prototype.constructor=ma;ma.prototype.name="Validation Error";var HB=Nr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};HB.prototype=Object.create(Error.prototype,{constructor:{value:HB,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var dO=Nr.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+GB(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};dO.prototype.resolve=function(e){return ZB(this.base,e)};dO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=ZB(this.base,i||"");var s=new dO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Vn=Nr.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]+$/};Vn.regexp=Vn.regex;Vn.pattern=Vn.regex;Vn.ipv4=Vn["ip-address"];Nr.isFormat=function(e,r,n){if(typeof e=="string"&&Vn[r]!==void 0){if(Vn[r]instanceof RegExp)return Vn[r].test(e);if(typeof Vn[r]=="function")return Vn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var GB=Nr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Nr.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 jge(t,e,r,n){typeof r=="object"?e[n]=fO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Mge(t,e,r){e[r]=t[r]}function Fge(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=fO(t[n],e[n]):r[n]=e[n]}function fO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(jge.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Mge.bind(null,t,n)),Object.keys(e).forEach(Fge.bind(null,t,e,n))),n}pO.exports.deepMerge=fO;Nr.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 Lge(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Nr.encodePath=function(e){return e.map(Lge).join("")};Nr.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};Nr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var ZB=Nr.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 JB=v((oYe,KB)=>{"use strict";var en=Jo(),Fe=en.ValidatorResult,Yo=en.SchemaError,mO={};mO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=mO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 hO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new Yo("anyOf must be an array");if(!r.anyOf.some(hO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new Yo("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new Yo("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(hO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!en.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=hO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!en.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(!en.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 gO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!en.isSchema(s))throw new Yo('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(gO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 Yo('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=gO(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 VB(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 Yo('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&&VB.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)VB.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!en.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 zge(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var yO=Jo();_O.exports.SchemaScanResult=YB;function YB(t,e){this.id=t,this.ref=e}_O.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=yO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=yO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!yO.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 XB=JB(),Xo=Jo(),QB=l_().scan,eH=Xo.ValidatorResult,Uge=Xo.ValidatorResultError,wf=Xo.SchemaError,tH=Xo.SchemaContext,qge="/",Wt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(xi),this.attributes=Object.create(XB.validators)};Wt.prototype.customFormats={};Wt.prototype.schemas=null;Wt.prototype.types=null;Wt.prototype.attributes=null;Wt.prototype.unresolvedRefs=null;Wt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=QB(r||qge,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]};Wt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=Xo.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}};Wt.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 xi=Wt.prototype.types={};xi.string=function(e){return typeof e=="string"};xi.number=function(e){return typeof e=="number"&&isFinite(e)};xi.integer=function(e){return typeof e=="number"&&e%1===0};xi.boolean=function(e){return typeof e=="boolean"};xi.array=function(e){return Array.isArray(e)};xi.null=function(e){return e===null};xi.date=function(e){return e instanceof Date};xi.any=function(e){return!0};xi.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};nH.exports=Wt});var oH=v((cYe,so)=>{"use strict";var Bge=so.exports.Validator=iH();so.exports.ValidatorResult=Jo().ValidatorResult;so.exports.ValidatorResultError=Jo().ValidatorResultError;so.exports.ValidationError=Jo().ValidationError;so.exports.SchemaError=Jo().SchemaError;so.exports.SchemaScanResult=l_().SchemaScanResult;so.exports.scan=l_().scan;so.exports.validate=function(t,e,r){var n=new Bge;return n.validate(t,e,r)}});import{readFileSync as Hge}from"node:fs";import{dirname as Gge,join as Zge}from"node:path";import{fileURLToPath as Vge}from"node:url";function Xge(t){let e=Yge.validate(t,Jge);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function aH(t){let e=Xge(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 oge,AB,sge,Qy=y(()=>{"use strict";oge=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"]),AB=2e6,sge="\0"});function lge(t){for(let i of cge)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 tO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function uge(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??[])tO(e,s,o);for(let s of i.modules??[])tO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=lge(a);c&&tO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function xn(t){let e=OB.get(t);return e||(e=uge(t),OB.set(t,e)),e}var cge,OB,fa=y(()=>{"use strict";cge=["derived:","fixture:","script:","self-dogfood:"];OB=new WeakMap});function rO(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 yr(t,e,r={}){let n=r.depth??1/0,i=xn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=dge(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=rO(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:nO(i)}}var pa=y(()=>{"use strict";fa()});function RB(t){return t.impacted.length}function t_(t,e,r={}){let n=r.initialDepth??e_.initialDepth,i=r.maxDepth??e_.maxDepth,o=r.coverageThreshold??e_.coverageThreshold,s=r.marginYieldThreshold??e_.marginYieldThreshold,a=xn(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=yr(t,e,{depth:1});return"not_found"in b,b}let d=rO(l,a.dependents,1/0).size;if(d===0){let b=yr(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 _=yr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=RB(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,A=x===0&&b>n,E={frontierExhausted:A,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(A)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:E};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:E};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var e_,iO=y(()=>{"use strict";pa();fa();e_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function fge(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 IB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=fge(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 PB=y(()=>{"use strict"});function pge(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 Kc(t,e){let r=pge(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=IB(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 r_=y(()=>{"use strict";PB()});import{existsSync as DB,readdirSync as mge,readFileSync as hge}from"node:fs";import{join as sO}from"node:path";function aO(t,e=yge){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function _ge(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:aO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:aO(`done reverted \u2014 pre-push strict gate red${r}`)}}function CB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function bge(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 aO(n)}function vge(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)=>CB(m)-CB(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(-gge).map(_ge),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?bge(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 oO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Sge(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 wge(t,e,r){let n=oO(t,/_Rolled back at_\s*`([^`]+)`/),i=oO(t,/Last failed gate:\s*`([^`]+)`/),o=oO(t,/Retry attempts:\s*(\d+)/),s=Sge(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function xge(t,e){let r=sO(t,".cladding","post-mortems");if(!DB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of mge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(wge(hge(sO(r,o),"utf8"),e,o))}catch{}return i}function NB(t,e){try{let r=Ky(t),n=xge(t,e),i=DB(sO(t,".cladding","events.log.1.jsonl"));return vge(r,n,e,{truncated:i})}catch{return}}var gge,yge,jB=y(()=>{"use strict";Dr();gge=5,yge=120});function n_(t,e,r){return Qr(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function ma(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:$ge,o=e,s,a=xn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=Kc(t,o);if("not_found"in c)return c;let l=c.focus,u=NB(n,l.id),d=a&&a.size>0?e:l.id,f=t_(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}},O=[...c.ancestors];for(;O.length>kge&&n_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}E.push(Vt),Vt.truncated&&x.push(`code: clipped ${se}`)}A>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let C=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),k=(se,Pe,Vt,ar)=>{let Kt=Vt+ar>0?[`breaks: omitted ${Vt} feature(s) / ${ar} test(s)`]:[],to={...w,needs:O,must_edit:{...w.must_edit,code:E},breaks_if_changed:C(se,Pe),budget:{...w.budget,truncated:[...x,...Kt]}};return Qr(JSON.stringify(to))>i},q=m,Q=h;if(k(q,Q,0,0)){let se=yr(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Vt=new Set("not_found"in se?[]:se.test_refs),Kt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],to=0;for(;Kt.length>Pe.size&&k(Kt,Q,to,0);)Kt=Kt.slice(0,-1),to++;let yi=[...h],Jr=0;for(;k(Kt,yi,to,Jr);){let de=-1;for(let ro=yi.length-1;ro>=0;ro--)if(!Vt.has(yi[ro])){de=ro;break}if(de<0)break;yi.splice(de,1),Jr++}q=Kt,Q=yi,to+Jr>0&&x.push(`breaks: omitted ${to} feature(s) / ${Jr} test(s)`),k(q,Q,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Se=C(q,Q),I={...w,needs:O,must_edit:{...w.must_edit,code:E},breaks_if_changed:Se},P=I;if(u){let se={...I,prior_attempts:u};Qr(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Rr=Qr(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Rr,truncated:x}}}var $ge,kge,i_=y(()=>{"use strict";Qy();r_();iO();jB();pa();fa();$ge=3e3,kge=3});function Zn(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 Ege(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 MB(t,e,r="."){let n=xn(t),i=t.features??[],o=[];for(let f of i){let p=ma(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=ma(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=t_(t,f.id),g=!("not_found"in h),b=Qr(JSON.stringify(p)),_="not_found"in m?b:Qr(JSON.stringify(m)),S=Qr(JSON.stringify(f));for(let O of f.modules??[]){let A=e(O);A&&(S+=Qr(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(Zn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Zn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Zn(a(c))*10)/10,medianShrinkTruncated:Math.round(Zn(a(l))*10)/10,medianStructuralRatio:Math.round(Zn(u)*100)/100,medianSliceTokens:Math.round(Zn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Zn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Zn(o.map(f=>f.searchDepth)),p95Depth:Ege(o.map(f=>f.searchDepth),95),medianEdges:Zn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Zn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Zn(o.map(f=>f.regressionTests))},features:o}}var Jc,o_=y(()=>{"use strict";Qy();iO();i_();fa();Jc="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Age,existsSync as cO,mkdirSync as Tge,readFileSync as FB}from"node:fs";import{dirname as Oge,join as Rge}from"node:path";function lO(t){return Rge(t,Ige,Pge)}function Cge(t,e){return{timestamp:new Date().toISOString(),head:da(t),spec_digest:QT(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function LB(t,e){try{let r=Cge(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=uO(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=lO(t),s=Oge(o);return cO(s)||Tge(s,{recursive:!0}),Age(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function zB(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 uO(t,e){let r=lO(t);if(!cO(r))return[];let n;try{n=FB(r,"utf8")}catch{return[]}let i=zB(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function UB(t){let e=lO(t);if(!cO(e))return{snapshots:[],unreadable:!1};let r;try{r=FB(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=zB(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 qB(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(` ${Jc}`),i.join(` +`)}var Ige,Pge,Sf=y(()=>{"use strict";bf();o_();Ige=".cladding",Pge="measure.jsonl"});import{existsSync as Dge}from"node:fs";import{join as Nge}from"node:path";function Yc(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}** (${jge[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 HB(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`,"",Jc),r.join(` +`)}function Xc(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"} | ${Fge(l,r)} |`)}return n.join(` +`)}function Fge(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 Mge)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Dge(Nge(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function Qc(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),BB(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)BB(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function BB(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=VT(r);n&&t.push(`- ${n}`)}t.push("")}var jge,Mge,s_=y(()=>{"use strict";Sf();o_();Wc();jge={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Mge=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Lge}from"node:fs";function wi(t="./spec.yaml"){let e=Lge(t,"utf8");return(0,GB.parse)(e)}var GB,a_=y(()=>{"use strict";GB=Et(cr(),1)});var Xo=v((Nr,mO)=>{"use strict";var dO=Nr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+VB(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()};dO.prototype.toString=function(){return this.property+" "+this.message};var c_=Nr.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};c_.prototype.addError=function(e){var r;if(typeof e=="string")r=new dO(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 dO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new ha(this);if(this.throwError)throw r;return r};c_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function zge(t,e){return e+": "+t.toString()+` +`}c_.prototype.toString=function(e){return this.errors.map(zge).join("")};Object.defineProperty(c_.prototype,"valid",{get:function(){return!this.errors.length}});mO.exports.ValidatorResultError=ha;function ha(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ha),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}ha.prototype=new Error;ha.prototype.constructor=ha;ha.prototype.name="Validation Error";var ZB=Nr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};ZB.prototype=Object.create(Error.prototype,{constructor:{value:ZB,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var fO=Nr.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+VB(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};fO.prototype.resolve=function(e){return WB(this.base,e)};fO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=WB(this.base,i||"");var s=new fO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Vn=Nr.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]+$/};Vn.regexp=Vn.regex;Vn.pattern=Vn.regex;Vn.ipv4=Vn["ip-address"];Nr.isFormat=function(e,r,n){if(typeof e=="string"&&Vn[r]!==void 0){if(Vn[r]instanceof RegExp)return Vn[r].test(e);if(typeof Vn[r]=="function")return Vn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var VB=Nr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Nr.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 Uge(t,e,r,n){typeof r=="object"?e[n]=pO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function qge(t,e,r){e[r]=t[r]}function Bge(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=pO(t[n],e[n]):r[n]=e[n]}function pO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Uge.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(qge.bind(null,t,n)),Object.keys(e).forEach(Bge.bind(null,t,e,n))),n}mO.exports.deepMerge=pO;Nr.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 Hge(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Nr.encodePath=function(e){return e.map(Hge).join("")};Nr.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};Nr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var WB=Nr.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 XB=v((hYe,YB)=>{"use strict";var en=Xo(),Fe=en.ValidatorResult,Qo=en.SchemaError,hO={};hO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=hO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 gO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new Qo("anyOf must be an array");if(!r.anyOf.some(gO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new Qo("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new Qo("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(gO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!en.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=gO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!en.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(!en.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 yO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!en.isSchema(s))throw new Qo('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(yO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 Qo('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=yO(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 KB(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 Qo('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&&KB.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)KB.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!en.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Gge(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var _O=Xo();bO.exports.SchemaScanResult=QB;function QB(t,e){this.id=t,this.ref=e}bO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=_O.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=_O.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!_O.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 eH=XB(),es=Xo(),tH=l_().scan,rH=es.ValidatorResult,Zge=es.ValidatorResultError,wf=es.SchemaError,nH=es.SchemaContext,Vge="/",Wt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(xi),this.attributes=Object.create(eH.validators)};Wt.prototype.customFormats={};Wt.prototype.schemas=null;Wt.prototype.types=null;Wt.prototype.attributes=null;Wt.prototype.unresolvedRefs=null;Wt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=tH(r||Vge,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]};Wt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=es.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}};Wt.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 xi=Wt.prototype.types={};xi.string=function(e){return typeof e=="string"};xi.number=function(e){return typeof e=="number"&&isFinite(e)};xi.integer=function(e){return typeof e=="number"&&e%1===0};xi.boolean=function(e){return typeof e=="boolean"};xi.array=function(e){return Array.isArray(e)};xi.null=function(e){return e===null};xi.date=function(e){return e instanceof Date};xi.any=function(e){return!0};xi.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};oH.exports=Wt});var aH=v((_Ye,so)=>{"use strict";var Wge=so.exports.Validator=sH();so.exports.ValidatorResult=Xo().ValidatorResult;so.exports.ValidatorResultError=Xo().ValidatorResultError;so.exports.ValidationError=Xo().ValidationError;so.exports.SchemaError=Xo().SchemaError;so.exports.SchemaScanResult=l_().SchemaScanResult;so.exports.scan=l_().scan;so.exports.validate=function(t,e,r){var n=new Wge;return n.validate(t,e,r)}});import{readFileSync as Kge}from"node:fs";import{dirname as Jge,join as Yge}from"node:path";import{fileURLToPath as Xge}from"node:url";function nye(t){let e=rye.validate(t,tye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function lH(t){let e=nye(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var sH,Wge,Kge,Jge,Yge,cH=y(()=>{"use strict";sH=Et(oH(),1),Wge=Gge(Vge(import.meta.url)),Kge=Zge(Wge,"schema.json"),Jge=JSON.parse(Hge(Kge,"utf8")),Yge=new sH.Validator});import{existsSync as bO,readdirSync as Qge}from"node:fs";import{dirname as eye,join as ha,resolve as uH}from"node:path";function lH(t){return bO(t)?Qge(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>wi(ha(t,r))):[]}function ga(t,e){u_=e?{cwd:uH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return u_&&e==="spec.yaml"&&uH(t)===u_.cwd?u_.spec:tye(t,e)}function tye(t,e){let r=ha(t,e),n=wi(r),i=ha(t,eye(e),"spec");if(!n.features||n.features.length===0){let o=lH(ha(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=lH(ha(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ha(i,"architecture.yaml");bO(o)&&(n.architecture=wi(o))}if(!n.capabilities||n.capabilities.length===0){let o=ha(i,"capabilities.yaml");if(bO(o)){let s=wi(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return aH(n),n}var u_,qe=y(()=>{"use strict";a_();cH();u_=null});import Qc from"node:process";function wO(){return!!Qc.stdout.isTTY}function M(t,e,r=""){let n=dH[t],i=r?` ${r}`:"";wO()?Qc.stdout.write(`${vO[t]}${n}${SO} ${e}${i} -`):Qc.stdout.write(`${n} ${e}${i} -`)}function xf(t,e,r=""){if(!wO())return;let n=r?` ${r}`:"";Qc.stdout.write(`${fH}${vO.start}\xB7${SO} ${t} \xB7 ${e}${n}`)}function ya(t,e,r=""){let n=dH[t],i=r?` ${r}`:"";wO()?Qc.stdout.write(`${fH}${vO[t]}${n}${SO} ${e}${i} -`):Qc.stdout.write(`${n} ${e}${i} -`)}var dH,vO,SO,fH,$i=y(()=>{"use strict";dH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},vO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},SO="\x1B[0m",fH="\r\x1B[K"});import{createHash as CH}from"node:crypto";import{existsSync as Cye,readFileSync as kO,writeFileSync as Dye}from"node:fs";import{join as d_}from"node:path";function Nye(t,e){let r=CH("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(kO(d_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function NH(t,e){let r=CH("sha256");try{r.update(kO(d_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function Qo(t){let e=d_(t,...DH);if(!Cye(e))return null;let r;try{r=kO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function f_(t){return t.features?.size??t.v1?.size??0}function p_(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)!==NH(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===Nye(e,n)?{state:"fresh"}:{state:"stale"}}function jH(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${NH(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=jye+`attested_modules: + `)}`)}var cH,Qge,eye,tye,rye,uH=y(()=>{"use strict";cH=Et(aH(),1),Qge=Jge(Xge(import.meta.url)),eye=Yge(Qge,"schema.json"),tye=JSON.parse(Kge(eye,"utf8")),rye=new cH.Validator});import{existsSync as vO,readdirSync as iye}from"node:fs";import{dirname as oye,join as ga,resolve as fH}from"node:path";function dH(t){return vO(t)?iye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>wi(ga(t,r))):[]}function ya(t,e){u_=e?{cwd:fH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return u_&&e==="spec.yaml"&&fH(t)===u_.cwd?u_.spec:sye(t,e)}function sye(t,e){let r=ga(t,e),n=wi(r),i=ga(t,oye(e),"spec");if(!n.features||n.features.length===0){let o=dH(ga(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=dH(ga(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ga(i,"architecture.yaml");vO(o)&&(n.architecture=wi(o))}if(!n.capabilities||n.capabilities.length===0){let o=ga(i,"capabilities.yaml");if(vO(o)){let s=wi(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return lH(n),n}var u_,qe=y(()=>{"use strict";a_();uH();u_=null});import el from"node:process";function xO(){return!!el.stdout.isTTY}function M(t,e,r=""){let n=pH[t],i=r?` ${r}`:"";xO()?el.stdout.write(`${SO[t]}${n}${wO} ${e}${i} +`):el.stdout.write(`${n} ${e}${i} +`)}function xf(t,e,r=""){if(!xO())return;let n=r?` ${r}`:"";el.stdout.write(`${mH}${SO.start}\xB7${wO} ${t} \xB7 ${e}${n}`)}function _a(t,e,r=""){let n=pH[t],i=r?` ${r}`:"";xO()?el.stdout.write(`${mH}${SO[t]}${n}${wO} ${e}${i} +`):el.stdout.write(`${n} ${e}${i} +`)}var pH,SO,wO,mH,$i=y(()=>{"use strict";pH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},SO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},wO="\x1B[0m",mH="\r\x1B[K"});import{createHash as NH}from"node:crypto";import{existsSync as Fye,readFileSync as EO,writeFileSync as Lye}from"node:fs";import{join as d_}from"node:path";function zye(t,e){let r=NH("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(EO(d_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function MH(t,e){let r=NH("sha256");try{r.update(EO(d_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ts(t){let e=d_(t,...jH);if(!Fye(e))return null;let r;try{r=EO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function f_(t){return t.features?.size??t.v1?.size??0}function p_(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)!==MH(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===zye(e,n)?{state:"fresh"}:{state:"stale"}}function FH(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${MH(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=Uye+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return Dye(d_(t,...DH),s,"utf8"),!0}var DH,jye,tl=y(()=>{"use strict";DH=["spec","attestation.yaml"];jye=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return Lye(d_(t,...jH),s,"utf8"),!0}var jH,Uye,rl=y(()=>{"use strict";jH=["spec","attestation.yaml"];Uye=`# 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. # @@ -211,52 +211,52 @@ 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 EO}from"node:path";function m_(t){es={cwd:EO(t),results:new Map}}function MH(t,e,r){!es||es.cwd!==EO(e)||es.results.set(t,r)}function h_(t,e){return!es||es.cwd!==EO(e)?null:es.results.get(t)??null}function g_(){es=null}var es,rl=y(()=>{"use strict";es=null});function At(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 co=y(()=>{});import{fileURLToPath as Mye}from"node:url";var nl,Fye,AO,TO,il=y(()=>{nl=(t,e)=>{let r=TO(Fye(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Fye=t=>AO(t)?t.toString():t,AO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,TO=t=>t instanceof URL?Mye(t):t});var y_,OO=y(()=>{co();il();y_=(t,e=[],r={})=>{let n=nl(t,"First argument"),[i,o]=At(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(!At(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as Lye}from"node:string_decoder";var FH,LH,Ft,lo,zye,zH,Uye,__,UH,qye,Ef,Bye,RO,Hye,tn=y(()=>{({toString:FH}=Object.prototype),LH=t=>FH.call(t)==="[object ArrayBuffer]",Ft=t=>FH.call(t)==="[object Uint8Array]",lo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),zye=new TextEncoder,zH=t=>zye.encode(t),Uye=new TextDecoder,__=t=>Uye.decode(t),UH=(t,e)=>qye(t,e).join(""),qye=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Lye(e),n=t.map(o=>typeof o=="string"?zH(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Ef=t=>t.length===1&&Ft(t[0])?t[0]:RO(Bye(t)),Bye=t=>t.map(e=>typeof e=="string"?zH(e):e),RO=t=>{let e=new Uint8Array(Hye(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Hye=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Gye}from"node:child_process";var GH,ZH,Zye,Vye,qH,Wye,BH,HH,Kye,VH=y(()=>{co();tn();GH=t=>Array.isArray(t)&&Array.isArray(t.raw),ZH=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Zye({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,{}]},Zye=({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}=Vye(i,t.raw[n]),c=BH(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>HH(d)):[HH(l)];return BH(c,u,a)},Vye=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=qH.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)],HH=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(At(t)&&("stdout"in t||"isMaxBuffer"in t))return Kye(t);throw t instanceof Gye||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`)},Kye=({stdout:t})=>{if(typeof t=="string")return t;if(Ft(t))return __(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 IO from"node:process";var Wn,b_,$n,v_,uo=y(()=>{Wn=t=>b_.includes(t),b_=[IO.stdin,IO.stdout,IO.stderr],$n=["stdin","stdout","stderr"],v_=t=>$n[t]??`stdio[${t}]`});import{debuglog as Jye}from"node:util";var KH,PO,Yye,Xye,Qye,e_e,WH,t_e,CO,r_e,n_e,i_e,o_e,DO,fo,po=y(()=>{co();uo();KH=t=>{let e={...t};for(let r of DO)e[r]=PO(t,r);return e},PO=(t,e)=>{let r=Array.from({length:Yye(t)+1}),n=Xye(t[e],r,e);return n_e(n,e)},Yye=({stdio:t})=>Array.isArray(t)?Math.max(t.length,$n.length):$n.length,Xye=(t,e,r)=>At(t)?Qye(t,e,r):e.fill(t),Qye=(t,e,r)=>{for(let n of Object.keys(t).sort(e_e))for(let i of t_e(n,r,e))e[i]=t[n];return e},e_e=(t,e)=>WH(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,t_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=CO(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as AO}from"node:path";function m_(t){rs={cwd:AO(t),results:new Map}}function LH(t,e,r){!rs||rs.cwd!==AO(e)||rs.results.set(t,r)}function h_(t,e){return!rs||rs.cwd!==AO(e)?null:rs.results.get(t)??null}function g_(){rs=null}var rs,nl=y(()=>{"use strict";rs=null});function At(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 co=y(()=>{});import{fileURLToPath as qye}from"node:url";var il,Bye,TO,OO,ol=y(()=>{il=(t,e)=>{let r=OO(Bye(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Bye=t=>TO(t)?t.toString():t,TO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,OO=t=>t instanceof URL?qye(t):t});var y_,RO=y(()=>{co();ol();y_=(t,e=[],r={})=>{let n=il(t,"First argument"),[i,o]=At(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(!At(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as Hye}from"node:string_decoder";var zH,UH,Ft,lo,Gye,qH,Zye,__,BH,Vye,Ef,Wye,IO,Kye,tn=y(()=>{({toString:zH}=Object.prototype),UH=t=>zH.call(t)==="[object ArrayBuffer]",Ft=t=>zH.call(t)==="[object Uint8Array]",lo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Gye=new TextEncoder,qH=t=>Gye.encode(t),Zye=new TextDecoder,__=t=>Zye.decode(t),BH=(t,e)=>Vye(t,e).join(""),Vye=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Hye(e),n=t.map(o=>typeof o=="string"?qH(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Ef=t=>t.length===1&&Ft(t[0])?t[0]:IO(Wye(t)),Wye=t=>t.map(e=>typeof e=="string"?qH(e):e),IO=t=>{let e=new Uint8Array(Kye(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Kye=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Jye}from"node:child_process";var VH,WH,Yye,Xye,HH,Qye,GH,ZH,e_e,KH=y(()=>{co();tn();VH=t=>Array.isArray(t)&&Array.isArray(t.raw),WH=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Yye({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,{}]},Yye=({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}=Xye(i,t.raw[n]),c=GH(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>ZH(d)):[ZH(l)];return GH(c,u,a)},Xye=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=HH.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)],ZH=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(At(t)&&("stdout"in t||"isMaxBuffer"in t))return e_e(t);throw t instanceof Jye||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`)},e_e=({stdout:t})=>{if(typeof t=="string")return t;if(Ft(t))return __(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 PO from"node:process";var Wn,b_,$n,v_,uo=y(()=>{Wn=t=>b_.includes(t),b_=[PO.stdin,PO.stdout,PO.stderr],$n=["stdin","stdout","stderr"],v_=t=>$n[t]??`stdio[${t}]`});import{debuglog as t_e}from"node:util";var YH,CO,r_e,n_e,i_e,o_e,JH,s_e,DO,a_e,c_e,l_e,u_e,NO,fo,po=y(()=>{co();uo();YH=t=>{let e={...t};for(let r of NO)e[r]=CO(t,r);return e},CO=(t,e)=>{let r=Array.from({length:r_e(t)+1}),n=n_e(t[e],r,e);return c_e(n,e)},r_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,$n.length):$n.length,n_e=(t,e,r)=>At(t)?i_e(t,e,r):e.fill(t),i_e=(t,e,r)=>{for(let n of Object.keys(t).sort(o_e))for(let i of s_e(n,r,e))e[i]=t[n];return e},o_e=(t,e)=>JH(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,s_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=DO(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]},CO=t=>{if(t==="all")return t;if($n.includes(t))return $n.indexOf(t);let e=r_e.exec(t);if(e!==null)return Number(e[1])},r_e=/^fd(\d+)$/,n_e=(t,e)=>t.map(r=>r===void 0?o_e[e]:r),i_e=Jye("execa").enabled?"full":"none",o_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:i_e,stripFinalNewline:!0},DO=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],fo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var ol,sl,JH,NO,s_e,S_,w_,ts=y(()=>{po();ol=({verbose:t},e)=>NO(t,e)!=="none",sl=({verbose:t},e)=>!["none","short"].includes(NO(t,e)),JH=({verbose:t},e)=>{let r=NO(t,e);return S_(r)?r:void 0},NO=(t,e)=>e===void 0?s_e(t):fo(t,e),s_e=t=>t.find(e=>S_(e))??w_.findLast(e=>t.includes(e)),S_=t=>typeof t=="function",w_=["none","short","full"]});import{platform as a_e}from"node:process";import{stripVTControlCharacters as c_e}from"node:util";var YH,Af,XH,l_e,u_e,d_e,f_e,p_e,m_e,h_e,x_=y(()=>{YH=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>m_e(XH(o))).join(" ");return{command:n,escapedCommand:i}},Af=t=>c_e(t).split(` -`).map(e=>XH(e)).join(` -`),XH=t=>t.replaceAll(d_e,e=>l_e(e)),l_e=t=>{let e=f_e[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=p_e?`\\u${n.padStart(4,"0")}`:`\\U${n}`},u_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},d_e=u_e(),f_e={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},p_e=65535,m_e=t=>h_e.test(t)?t:a_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,h_e=/^[\w./-]+$/});import QH from"node:process";function jO(){let{env:t}=QH,{TERM:e,TERM_PROGRAM:r}=t;return QH.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 eG=y(()=>{});var tG,rG,g_e,y_e,__e,b_e,v_e,$_,fXe,nG=y(()=>{eG();tG={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"},rG={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"},g_e={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"},y_e={...tG,...rG},__e={...tG,...g_e},b_e=jO(),v_e=b_e?y_e:__e,$_=v_e,fXe=Object.entries(rG)});import S_e from"node:tty";var w_e,_e,hXe,iG,gXe,yXe,_Xe,bXe,vXe,SXe,wXe,xXe,$Xe,kXe,EXe,AXe,TXe,OXe,RXe,k_,IXe,PXe,CXe,DXe,NXe,jXe,MXe,FXe,LXe,oG,zXe,sG,UXe,qXe,BXe,HXe,GXe,ZXe,VXe,WXe,KXe,JXe,YXe,MO=y(()=>{w_e=S_e?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!w_e)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}},hXe=_e(0,0),iG=_e(1,22),gXe=_e(2,22),yXe=_e(3,23),_Xe=_e(4,24),bXe=_e(53,55),vXe=_e(7,27),SXe=_e(8,28),wXe=_e(9,29),xXe=_e(30,39),$Xe=_e(31,39),kXe=_e(32,39),EXe=_e(33,39),AXe=_e(34,39),TXe=_e(35,39),OXe=_e(36,39),RXe=_e(37,39),k_=_e(90,39),IXe=_e(40,49),PXe=_e(41,49),CXe=_e(42,49),DXe=_e(43,49),NXe=_e(44,49),jXe=_e(45,49),MXe=_e(46,49),FXe=_e(47,49),LXe=_e(100,49),oG=_e(91,39),zXe=_e(92,39),sG=_e(93,39),UXe=_e(94,39),qXe=_e(95,39),BXe=_e(96,39),HXe=_e(97,39),GXe=_e(101,49),ZXe=_e(102,49),VXe=_e(103,49),WXe=_e(104,49),KXe=_e(105,49),JXe=_e(106,49),YXe=_e(107,49)});var aG=y(()=>{MO();MO()});var uG,$_e,E_,cG,k_e,lG,E_e,dG=y(()=>{nG();aG();uG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=$_e(r),c=k_e[t]({failed:o,reject:s,piped:n}),l=E_e[t]({reject:s});return`${k_(`[${a}]`)} ${k_(`[${i}]`)} ${l(c)} ${l(e)}`},$_e=t=>`${E_(t.getHours(),2)}:${E_(t.getMinutes(),2)}:${E_(t.getSeconds(),2)}.${E_(t.getMilliseconds(),3)}`,E_=(t,e)=>String(t).padStart(e,"0"),cG=({failed:t,reject:e})=>t?e?$_.cross:$_.warning:$_.tick,k_e={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:cG,duration:cG},lG=t=>t,E_e={command:()=>iG,output:()=>lG,ipc:()=>lG,error:({reject:t})=>t?oG:sG,duration:()=>k_}});var fG,A_e,T_e,pG=y(()=>{ts();fG=(t,e,r)=>{let n=JH(e,r);return t.map(({verboseLine:i,verboseObject:o})=>A_e(i,o,n)).filter(i=>i!==void 0).map(i=>T_e(i)).join("")},A_e=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},T_e=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},DO=t=>{if(t==="all")return t;if($n.includes(t))return $n.indexOf(t);let e=a_e.exec(t);if(e!==null)return Number(e[1])},a_e=/^fd(\d+)$/,c_e=(t,e)=>t.map(r=>r===void 0?u_e[e]:r),l_e=t_e("execa").enabled?"full":"none",u_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:l_e,stripFinalNewline:!0},NO=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],fo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var sl,al,XH,jO,d_e,S_,w_,ns=y(()=>{po();sl=({verbose:t},e)=>jO(t,e)!=="none",al=({verbose:t},e)=>!["none","short"].includes(jO(t,e)),XH=({verbose:t},e)=>{let r=jO(t,e);return S_(r)?r:void 0},jO=(t,e)=>e===void 0?d_e(t):fo(t,e),d_e=t=>t.find(e=>S_(e))??w_.findLast(e=>t.includes(e)),S_=t=>typeof t=="function",w_=["none","short","full"]});import{platform as f_e}from"node:process";import{stripVTControlCharacters as p_e}from"node:util";var QH,Af,eG,m_e,h_e,g_e,y_e,__e,b_e,v_e,x_=y(()=>{QH=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>b_e(eG(o))).join(" ");return{command:n,escapedCommand:i}},Af=t=>p_e(t).split(` +`).map(e=>eG(e)).join(` +`),eG=t=>t.replaceAll(g_e,e=>m_e(e)),m_e=t=>{let e=y_e[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=__e?`\\u${n.padStart(4,"0")}`:`\\U${n}`},h_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},g_e=h_e(),y_e={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},__e=65535,b_e=t=>v_e.test(t)?t:f_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,v_e=/^[\w./-]+$/});import tG from"node:process";function MO(){let{env:t}=tG,{TERM:e,TERM_PROGRAM:r}=t;return tG.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 rG=y(()=>{});var nG,iG,S_e,w_e,x_e,$_e,k_e,$_,wXe,oG=y(()=>{rG();nG={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"},iG={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"},S_e={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"},w_e={...nG,...iG},x_e={...nG,...S_e},$_e=MO(),k_e=$_e?w_e:x_e,$_=k_e,wXe=Object.entries(iG)});import E_e from"node:tty";var A_e,_e,kXe,sG,EXe,AXe,TXe,OXe,RXe,IXe,PXe,CXe,DXe,NXe,jXe,MXe,FXe,LXe,zXe,k_,UXe,qXe,BXe,HXe,GXe,ZXe,VXe,WXe,KXe,aG,JXe,cG,YXe,XXe,QXe,e7e,t7e,r7e,n7e,i7e,o7e,s7e,a7e,FO=y(()=>{A_e=E_e?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!A_e)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}},kXe=_e(0,0),sG=_e(1,22),EXe=_e(2,22),AXe=_e(3,23),TXe=_e(4,24),OXe=_e(53,55),RXe=_e(7,27),IXe=_e(8,28),PXe=_e(9,29),CXe=_e(30,39),DXe=_e(31,39),NXe=_e(32,39),jXe=_e(33,39),MXe=_e(34,39),FXe=_e(35,39),LXe=_e(36,39),zXe=_e(37,39),k_=_e(90,39),UXe=_e(40,49),qXe=_e(41,49),BXe=_e(42,49),HXe=_e(43,49),GXe=_e(44,49),ZXe=_e(45,49),VXe=_e(46,49),WXe=_e(47,49),KXe=_e(100,49),aG=_e(91,39),JXe=_e(92,39),cG=_e(93,39),YXe=_e(94,39),XXe=_e(95,39),QXe=_e(96,39),e7e=_e(97,39),t7e=_e(101,49),r7e=_e(102,49),n7e=_e(103,49),i7e=_e(104,49),o7e=_e(105,49),s7e=_e(106,49),a7e=_e(107,49)});var lG=y(()=>{FO();FO()});var fG,O_e,E_,uG,R_e,dG,I_e,pG=y(()=>{oG();lG();fG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=O_e(r),c=R_e[t]({failed:o,reject:s,piped:n}),l=I_e[t]({reject:s});return`${k_(`[${a}]`)} ${k_(`[${i}]`)} ${l(c)} ${l(e)}`},O_e=t=>`${E_(t.getHours(),2)}:${E_(t.getMinutes(),2)}:${E_(t.getSeconds(),2)}.${E_(t.getMilliseconds(),3)}`,E_=(t,e)=>String(t).padStart(e,"0"),uG=({failed:t,reject:e})=>t?e?$_.cross:$_.warning:$_.tick,R_e={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:uG,duration:uG},dG=t=>t,I_e={command:()=>sG,output:()=>dG,ipc:()=>dG,error:({reject:t})=>t?aG:cG,duration:()=>k_}});var mG,P_e,C_e,hG=y(()=>{ns();mG=(t,e,r)=>{let n=XH(e,r);return t.map(({verboseLine:i,verboseObject:o})=>P_e(i,o,n)).filter(i=>i!==void 0).map(i=>C_e(i)).join("")},P_e=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},C_e=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as O_e}from"node:util";var ki,R_e,I_e,P_e,A_,C_e,al=y(()=>{x_();dG();pG();ki=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=R_e({type:t,result:i,verboseInfo:n}),s=I_e(e,o),a=fG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},R_e=({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}),I_e=(t,e)=>t.split(` -`).map(r=>P_e({...e,message:r})),P_e=t=>({verboseLine:uG(t),verboseObject:t}),A_=t=>{let e=typeof t=="string"?t:O_e(t);return Af(e).replaceAll(" "," ".repeat(C_e))},C_e=2});var mG,hG=y(()=>{ts();al();mG=(t,e)=>{ol(e)&&ki({type:"command",verboseMessage:t,verboseInfo:e})}});var gG,D_e,N_e,j_e,yG=y(()=>{ts();gG=(t,e,r)=>{j_e(t);let n=D_e(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},D_e=t=>ol({verbose:t})?N_e++:void 0,N_e=0n,j_e=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(!w_.includes(e)&&!S_(e)){let r=w_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as _G}from"node:process";var T_,FO,O_=y(()=>{T_=()=>_G.bigint(),FO=t=>Number(_G.bigint()-t)/1e6});var R_,LO=y(()=>{hG();yG();O_();x_();po();R_=(t,e,r)=>{let n=T_(),{command:i,escapedCommand:o}=YH(t,e),s=PO(r,"verbose"),a=gG(s,o,{...r});return mG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var xG=v((x7e,wG)=>{wG.exports=SG;SG.sync=F_e;var bG=He("fs");function M_e(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{AG.exports=kG;kG.sync=L_e;var $G=He("fs");function kG(t,e,r){$G.stat(t,function(n,i){r(n,n?!1:EG(i,e))})}function L_e(t,e){return EG($G.statSync(t),e)}function EG(t,e){return t.isFile()&&z_e(t,e)}function z_e(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 RG=v((E7e,OG)=>{var k7e=He("fs"),I_;process.platform==="win32"||global.TESTING_WINDOWS?I_=xG():I_=TG();OG.exports=zO;zO.sync=U_e;function zO(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){zO(t,e||{},function(o,s){o?i(o):n(s)})})}I_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function U_e(t,e){try{return I_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var MG=v((A7e,jG)=>{var cl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",IG=He("path"),q_e=cl?";":":",PG=RG(),CG=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),DG=(t,e)=>{let r=e.colon||q_e,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}},NG=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=DG(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(CG(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=IG.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];PG(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)},B_e=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=DG(t,e),o=[];for(let s=0;s{"use strict";var FG=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};UO.exports=FG;UO.exports.default=FG});var BG=v((O7e,qG)=>{"use strict";var zG=He("path"),H_e=MG(),G_e=LG();function UG(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=H_e.sync(t.command,{path:r[G_e({env:r})],pathExt:e?zG.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=zG.resolve(i?t.options.cwd:"",s)),s}function Z_e(t){return UG(t)||UG(t,!0)}qG.exports=Z_e});var HG=v((R7e,BO)=>{"use strict";var qO=/([()\][%!^"`<>&|;, *?])/g;function V_e(t){return t=t.replace(qO,"^$1"),t}function W_e(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(qO,"^$1"),e&&(t=t.replace(qO,"^$1")),t}BO.exports.command=V_e;BO.exports.argument=W_e});var ZG=v((I7e,GG)=>{"use strict";GG.exports=/^#!(.*)/});var WG=v((P7e,VG)=>{"use strict";var K_e=ZG();VG.exports=(t="")=>{let e=t.match(K_e);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var JG=v((C7e,KG)=>{"use strict";var HO=He("fs"),J_e=WG();function Y_e(t){let r=Buffer.alloc(150),n;try{n=HO.openSync(t,"r"),HO.readSync(n,r,0,150,0),HO.closeSync(n)}catch{}return J_e(r.toString())}KG.exports=Y_e});var eZ=v((D7e,QG)=>{"use strict";var X_e=He("path"),YG=BG(),XG=HG(),Q_e=JG(),ebe=process.platform==="win32",tbe=/\.(?:com|exe)$/i,rbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function nbe(t){t.file=YG(t);let e=t.file&&Q_e(t.file);return e?(t.args.unshift(t.file),t.command=e,YG(t)):t.file}function ibe(t){if(!ebe)return t;let e=nbe(t),r=!tbe.test(e);if(t.options.forceShell||r){let n=rbe.test(e);t.command=X_e.normalize(t.command),t.command=XG.command(t.command),t.args=t.args.map(o=>XG.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 obe(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:ibe(n)}QG.exports=obe});var nZ=v((N7e,rZ)=>{"use strict";var GO=process.platform==="win32";function ZO(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 sbe(t,e){if(!GO)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=tZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function tZ(t,e){return GO&&t===1&&!e.file?ZO(e.original,"spawn"):null}function abe(t,e){return GO&&t===1&&!e.file?ZO(e.original,"spawnSync"):null}rZ.exports={hookChildProcess:sbe,verifyENOENT:tZ,verifyENOENTSync:abe,notFoundError:ZO}});var sZ=v((j7e,ll)=>{"use strict";var iZ=He("child_process"),VO=eZ(),WO=nZ();function oZ(t,e,r){let n=VO(t,e,r),i=iZ.spawn(n.command,n.args,n.options);return WO.hookChildProcess(i,n),i}function cbe(t,e,r){let n=VO(t,e,r),i=iZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||WO.verifyENOENTSync(i.status,n),i}ll.exports=oZ;ll.exports.spawn=oZ;ll.exports.sync=cbe;ll.exports._parse=VO;ll.exports._enoent=WO});function P_(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 aZ=y(()=>{});var cZ=y(()=>{});import{promisify as lbe}from"node:util";import{execFile as ube,execFileSync as U7e}from"node:child_process";import lZ from"node:path";import{fileURLToPath as dbe}from"node:url";function C_(t){return t instanceof URL?dbe(t):t}function uZ(t){return{*[Symbol.iterator](){let e=lZ.resolve(C_(t)),r;for(;r!==e;)yield e,r=e,e=lZ.resolve(e,"..")}}}var H7e,G7e,dZ=y(()=>{cZ();H7e=lbe(ube);G7e=10*1024*1024});import D_ from"node:process";import ba from"node:path";var fbe,pbe,mbe,fZ,pZ=y(()=>{aZ();dZ();fbe=({cwd:t=D_.cwd(),path:e=D_.env[P_()],preferLocal:r=!0,execPath:n=D_.execPath,addExecPath:i=!0}={})=>{let o=ba.resolve(C_(t)),s=[],a=e.split(ba.delimiter);return r&&pbe(s,a,o),i&&mbe(s,a,n,o),e===""||e===ba.delimiter?`${s.join(ba.delimiter)}${e}`:[...s,e].join(ba.delimiter)},pbe=(t,e,r)=>{for(let n of uZ(r)){let i=ba.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},mbe=(t,e,r,n)=>{let i=ba.resolve(n,C_(r),"..");e.includes(i)||t.push(i)},fZ=({env:t=D_.env,...e}={})=>{t={...t};let r=P_({env:t});return e.path=t[r],t[r]=fbe(e),t}});var mZ,Kn,hZ,gZ,yZ,N_,Tf,Of,va=y(()=>{mZ=(t,e,r)=>{let n=r?Of:Tf,i=t instanceof Kn?{}:{cause:t};return new n(e,i)},Kn=class extends Error{},hZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,yZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},gZ=t=>N_(t)&&yZ in t,yZ=Symbol("isExecaError"),N_=t=>Object.prototype.toString.call(t)==="[object Error]",Tf=class extends Error{};hZ(Tf,Tf.name);Of=class extends Error{};hZ(Of,Of.name)});var _Z,hbe,bZ,vZ,SZ=y(()=>{_Z=()=>{let t=vZ-bZ+1;return Array.from({length:t},hbe)},hbe=(t,e)=>({name:`SIGRT${e+1}`,number:bZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),bZ=34,vZ=64});var wZ,xZ=y(()=>{wZ=[{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 gbe}from"node:os";var KO,ybe,$Z=y(()=>{xZ();SZ();KO=()=>{let t=_Z();return[...wZ,...t].map(ybe)},ybe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=gbe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as _be}from"node:os";var bbe,vbe,kZ,Sbe,wbe,xbe,cQe,EZ=y(()=>{$Z();bbe=()=>{let t=KO();return Object.fromEntries(t.map(vbe))},vbe=({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}],kZ=bbe(),Sbe=()=>{let t=KO(),e=65,r=Array.from({length:e},(n,i)=>wbe(i,t));return Object.assign({},...r)},wbe=(t,e)=>{let r=xbe(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}}},xbe=(t,e)=>{let r=e.find(({name:n})=>_be.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},cQe=Sbe()});import{constants as Rf}from"node:os";var TZ,OZ,RZ,$be,kbe,AZ,Ebe,JO,Abe,Tbe,j_,If=y(()=>{EZ();TZ=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return RZ(t,e)},OZ=t=>t===0?t:RZ(t,"`subprocess.kill()`'s argument"),RZ=(t,e)=>{if(Number.isInteger(t))return $be(t,e);if(typeof t=="string")return Ebe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${JO()}`)},$be=(t,e)=>{if(AZ.has(t))return AZ.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${JO()}`)},kbe=()=>new Map(Object.entries(Rf.signals).reverse().map(([t,e])=>[e,t])),AZ=kbe(),Ebe=(t,e)=>{if(t in Rf.signals)return t;throw t.toUpperCase()in Rf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${JO()}`)},JO=()=>`Available signal names: ${Abe()}. -Available signal numbers: ${Tbe()}.`,Abe=()=>Object.keys(Rf.signals).sort().map(t=>`'${t}'`).join(", "),Tbe=()=>[...new Set(Object.values(Rf.signals).sort((t,e)=>t-e))].join(", "),j_=t=>kZ[t].description});import{setTimeout as Obe}from"node:timers/promises";var IZ,Rbe,PZ,Ibe,Pbe,Cbe,YO,M_=y(()=>{va();If();IZ=t=>{if(t===!1)return t;if(t===!0)return Rbe;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},Rbe=1e3*5,PZ=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Ibe(s,a,r);Pbe(l,n);let u=t(c);return Cbe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Ibe=(t,e,r)=>{let[n=r,i]=N_(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&&!N_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:OZ(n),error:i}},Pbe=(t,e)=>{t!==void 0&&e.reject(t)},Cbe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&YO({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},YO=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Obe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Dbe}from"node:events";var F_,XO=y(()=>{F_=async(t,e)=>{t.aborted||await Dbe(t,"abort",{signal:e})}});var CZ,DZ,Nbe,QO=y(()=>{XO();CZ=({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)}`)},DZ=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Nbe(t,e,n,i)],Nbe=async(t,e,r,{signal:n})=>{throw await F_(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var ul,jbe,eR,NZ,jZ,L_,MZ,FZ,LZ,zZ,UZ,qZ,Mbe,Fbe,Lbe,Jn,zbe,rs,dl,fl=y(()=>{ul=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{jbe(t,e,r),eR(t,e,n)},jbe=(t,e,r)=>{if(!r)throw new Error(`${Jn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},eR=(t,e,r)=>{if(!r)throw new Error(`${Jn(t,e)} cannot be used: the ${rs(e)} has already exited or disconnected.`)},NZ=t=>{throw new Error(`${Jn("getOneMessage",t)} could not complete: the ${rs(t)} exited or disconnected.`)},jZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${rs(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as D_e}from"node:util";var ki,N_e,j_e,M_e,A_,F_e,cl=y(()=>{x_();pG();hG();ki=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=N_e({type:t,result:i,verboseInfo:n}),s=j_e(e,o),a=mG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},N_e=({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}),j_e=(t,e)=>t.split(` +`).map(r=>M_e({...e,message:r})),M_e=t=>({verboseLine:fG(t),verboseObject:t}),A_=t=>{let e=typeof t=="string"?t:D_e(t);return Af(e).replaceAll(" "," ".repeat(F_e))},F_e=2});var gG,yG=y(()=>{ns();cl();gG=(t,e)=>{sl(e)&&ki({type:"command",verboseMessage:t,verboseInfo:e})}});var _G,L_e,z_e,U_e,bG=y(()=>{ns();_G=(t,e,r)=>{U_e(t);let n=L_e(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},L_e=t=>sl({verbose:t})?z_e++:void 0,z_e=0n,U_e=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(!w_.includes(e)&&!S_(e)){let r=w_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as vG}from"node:process";var T_,LO,O_=y(()=>{T_=()=>vG.bigint(),LO=t=>Number(vG.bigint()-t)/1e6});var R_,zO=y(()=>{yG();bG();O_();x_();po();R_=(t,e,r)=>{let n=T_(),{command:i,escapedCommand:o}=QH(t,e),s=CO(r,"verbose"),a=_G(s,o,{...r});return gG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var kG=v((C7e,$G)=>{$G.exports=xG;xG.sync=B_e;var SG=He("fs");function q_e(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{OG.exports=AG;AG.sync=H_e;var EG=He("fs");function AG(t,e,r){EG.stat(t,function(n,i){r(n,n?!1:TG(i,e))})}function H_e(t,e){return TG(EG.statSync(t),e)}function TG(t,e){return t.isFile()&&G_e(t,e)}function G_e(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 PG=v((j7e,IG)=>{var N7e=He("fs"),I_;process.platform==="win32"||global.TESTING_WINDOWS?I_=kG():I_=RG();IG.exports=UO;UO.sync=Z_e;function UO(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){UO(t,e||{},function(o,s){o?i(o):n(s)})})}I_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Z_e(t,e){try{return I_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var LG=v((M7e,FG)=>{var ll=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",CG=He("path"),V_e=ll?";":":",DG=PG(),NG=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),jG=(t,e)=>{let r=e.colon||V_e,n=t.match(/\//)||ll&&t.match(/\\/)?[""]:[...ll?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=ll?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=ll?i.split(r):[""];return ll&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},MG=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=jG(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(NG(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=CG.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];DG(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)},W_e=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=jG(t,e),o=[];for(let s=0;s{"use strict";var zG=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};qO.exports=zG;qO.exports.default=zG});var GG=v((L7e,HG)=>{"use strict";var qG=He("path"),K_e=LG(),J_e=UG();function BG(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=K_e.sync(t.command,{path:r[J_e({env:r})],pathExt:e?qG.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=qG.resolve(i?t.options.cwd:"",s)),s}function Y_e(t){return BG(t)||BG(t,!0)}HG.exports=Y_e});var ZG=v((z7e,HO)=>{"use strict";var BO=/([()\][%!^"`<>&|;, *?])/g;function X_e(t){return t=t.replace(BO,"^$1"),t}function Q_e(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(BO,"^$1"),e&&(t=t.replace(BO,"^$1")),t}HO.exports.command=X_e;HO.exports.argument=Q_e});var WG=v((U7e,VG)=>{"use strict";VG.exports=/^#!(.*)/});var JG=v((q7e,KG)=>{"use strict";var ebe=WG();KG.exports=(t="")=>{let e=t.match(ebe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var XG=v((B7e,YG)=>{"use strict";var GO=He("fs"),tbe=JG();function rbe(t){let r=Buffer.alloc(150),n;try{n=GO.openSync(t,"r"),GO.readSync(n,r,0,150,0),GO.closeSync(n)}catch{}return tbe(r.toString())}YG.exports=rbe});var rZ=v((H7e,tZ)=>{"use strict";var nbe=He("path"),QG=GG(),eZ=ZG(),ibe=XG(),obe=process.platform==="win32",sbe=/\.(?:com|exe)$/i,abe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function cbe(t){t.file=QG(t);let e=t.file&&ibe(t.file);return e?(t.args.unshift(t.file),t.command=e,QG(t)):t.file}function lbe(t){if(!obe)return t;let e=cbe(t),r=!sbe.test(e);if(t.options.forceShell||r){let n=abe.test(e);t.command=nbe.normalize(t.command),t.command=eZ.command(t.command),t.args=t.args.map(o=>eZ.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 ube(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:lbe(n)}tZ.exports=ube});var oZ=v((G7e,iZ)=>{"use strict";var ZO=process.platform==="win32";function VO(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 dbe(t,e){if(!ZO)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=nZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function nZ(t,e){return ZO&&t===1&&!e.file?VO(e.original,"spawn"):null}function fbe(t,e){return ZO&&t===1&&!e.file?VO(e.original,"spawnSync"):null}iZ.exports={hookChildProcess:dbe,verifyENOENT:nZ,verifyENOENTSync:fbe,notFoundError:VO}});var cZ=v((Z7e,ul)=>{"use strict";var sZ=He("child_process"),WO=rZ(),KO=oZ();function aZ(t,e,r){let n=WO(t,e,r),i=sZ.spawn(n.command,n.args,n.options);return KO.hookChildProcess(i,n),i}function pbe(t,e,r){let n=WO(t,e,r),i=sZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||KO.verifyENOENTSync(i.status,n),i}ul.exports=aZ;ul.exports.spawn=aZ;ul.exports.sync=pbe;ul.exports._parse=WO;ul.exports._enoent=KO});function P_(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 lZ=y(()=>{});var uZ=y(()=>{});import{promisify as mbe}from"node:util";import{execFile as hbe,execFileSync as Y7e}from"node:child_process";import dZ from"node:path";import{fileURLToPath as gbe}from"node:url";function C_(t){return t instanceof URL?gbe(t):t}function fZ(t){return{*[Symbol.iterator](){let e=dZ.resolve(C_(t)),r;for(;r!==e;)yield e,r=e,e=dZ.resolve(e,"..")}}}var eQe,tQe,pZ=y(()=>{uZ();eQe=mbe(hbe);tQe=10*1024*1024});import D_ from"node:process";import va from"node:path";var ybe,_be,bbe,mZ,hZ=y(()=>{lZ();pZ();ybe=({cwd:t=D_.cwd(),path:e=D_.env[P_()],preferLocal:r=!0,execPath:n=D_.execPath,addExecPath:i=!0}={})=>{let o=va.resolve(C_(t)),s=[],a=e.split(va.delimiter);return r&&_be(s,a,o),i&&bbe(s,a,n,o),e===""||e===va.delimiter?`${s.join(va.delimiter)}${e}`:[...s,e].join(va.delimiter)},_be=(t,e,r)=>{for(let n of fZ(r)){let i=va.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},bbe=(t,e,r,n)=>{let i=va.resolve(n,C_(r),"..");e.includes(i)||t.push(i)},mZ=({env:t=D_.env,...e}={})=>{t={...t};let r=P_({env:t});return e.path=t[r],t[r]=ybe(e),t}});var gZ,Kn,yZ,_Z,bZ,N_,Tf,Of,Sa=y(()=>{gZ=(t,e,r)=>{let n=r?Of:Tf,i=t instanceof Kn?{}:{cause:t};return new n(e,i)},Kn=class extends Error{},yZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,bZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},_Z=t=>N_(t)&&bZ in t,bZ=Symbol("isExecaError"),N_=t=>Object.prototype.toString.call(t)==="[object Error]",Tf=class extends Error{};yZ(Tf,Tf.name);Of=class extends Error{};yZ(Of,Of.name)});var vZ,vbe,SZ,wZ,xZ=y(()=>{vZ=()=>{let t=wZ-SZ+1;return Array.from({length:t},vbe)},vbe=(t,e)=>({name:`SIGRT${e+1}`,number:SZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),SZ=34,wZ=64});var $Z,kZ=y(()=>{$Z=[{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 Sbe}from"node:os";var JO,wbe,EZ=y(()=>{kZ();xZ();JO=()=>{let t=vZ();return[...$Z,...t].map(wbe)},wbe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Sbe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as xbe}from"node:os";var $be,kbe,AZ,Ebe,Abe,Tbe,_Qe,TZ=y(()=>{EZ();$be=()=>{let t=JO();return Object.fromEntries(t.map(kbe))},kbe=({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}],AZ=$be(),Ebe=()=>{let t=JO(),e=65,r=Array.from({length:e},(n,i)=>Abe(i,t));return Object.assign({},...r)},Abe=(t,e)=>{let r=Tbe(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}}},Tbe=(t,e)=>{let r=e.find(({name:n})=>xbe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},_Qe=Ebe()});import{constants as Rf}from"node:os";var RZ,IZ,PZ,Obe,Rbe,OZ,Ibe,YO,Pbe,Cbe,j_,If=y(()=>{TZ();RZ=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return PZ(t,e)},IZ=t=>t===0?t:PZ(t,"`subprocess.kill()`'s argument"),PZ=(t,e)=>{if(Number.isInteger(t))return Obe(t,e);if(typeof t=="string")return Ibe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${YO()}`)},Obe=(t,e)=>{if(OZ.has(t))return OZ.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${YO()}`)},Rbe=()=>new Map(Object.entries(Rf.signals).reverse().map(([t,e])=>[e,t])),OZ=Rbe(),Ibe=(t,e)=>{if(t in Rf.signals)return t;throw t.toUpperCase()in Rf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${YO()}`)},YO=()=>`Available signal names: ${Pbe()}. +Available signal numbers: ${Cbe()}.`,Pbe=()=>Object.keys(Rf.signals).sort().map(t=>`'${t}'`).join(", "),Cbe=()=>[...new Set(Object.values(Rf.signals).sort((t,e)=>t-e))].join(", "),j_=t=>AZ[t].description});import{setTimeout as Dbe}from"node:timers/promises";var CZ,Nbe,DZ,jbe,Mbe,Fbe,XO,M_=y(()=>{Sa();If();CZ=t=>{if(t===!1)return t;if(t===!0)return Nbe;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},Nbe=1e3*5,DZ=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=jbe(s,a,r);Mbe(l,n);let u=t(c);return Fbe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},jbe=(t,e,r)=>{let[n=r,i]=N_(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&&!N_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:IZ(n),error:i}},Mbe=(t,e)=>{t!==void 0&&e.reject(t)},Fbe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&XO({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},XO=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Dbe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Lbe}from"node:events";var F_,QO=y(()=>{F_=async(t,e)=>{t.aborted||await Lbe(t,"abort",{signal:e})}});var NZ,jZ,zbe,eR=y(()=>{QO();NZ=({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)}`)},jZ=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[zbe(t,e,n,i)],zbe=async(t,e,r,{signal:n})=>{throw await F_(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var dl,Ube,tR,MZ,FZ,L_,LZ,zZ,UZ,qZ,BZ,HZ,qbe,Bbe,Hbe,Jn,Gbe,is,fl,pl=y(()=>{dl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Ube(t,e,r),tR(t,e,n)},Ube=(t,e,r)=>{if(!r)throw new Error(`${Jn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},tR=(t,e,r)=>{if(!r)throw new Error(`${Jn(t,e)} cannot be used: the ${is(e)} has already exited or disconnected.`)},MZ=t=>{throw new Error(`${Jn("getOneMessage",t)} could not complete: the ${is(t)} exited or disconnected.`)},FZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${is(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([ ${Jn("getOneMessage",t)}, ${Jn("sendMessage",t,"message, {strict: true}")}, -]);`)},L_=(t,e)=>new Error(`${Jn("sendMessage",e)} failed when sending an acknowledgment response to the ${rs(e)}.`,{cause:t}),MZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${rs(t)} is not listening to incoming messages.`)},FZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${rs(t)} exited without listening to incoming messages.`)},LZ=()=>new Error(`\`cancelSignal\` aborted: the ${rs(!0)} disconnected.`),zZ=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},UZ=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Jn(e,r)} cannot be used: the ${rs(r)} is disconnecting.`,{cause:t})},qZ=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Mbe(t))throw new Error(`${Jn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Mbe=({code:t,message:e})=>Fbe.has(t)||Lbe.some(r=>e.includes(r)),Fbe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Lbe=["could not be cloned","circular structure","call stack size exceeded"],Jn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${zbe(e)}${t}(${r})`,zbe=t=>t?"":"subprocess.",rs=t=>t?"parent process":"subprocess",dl=t=>{t.connected&&t.disconnect()}});var Ei,pl=y(()=>{Ei=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var U_,ml,Ai,BZ,Ube,qbe,HZ,Bbe,GZ,Pf,z_,ns=y(()=>{po();U_=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ai.get(t),o=BZ(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(HZ(o,e,n,!0));return s},ml=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ai.get(t),o=BZ(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(HZ(o,e,n,!1));return s},Ai=new WeakMap,BZ=(t,e,r)=>{let n=Ube(e,r);return qbe(n,e,r,t),n},Ube=(t,e)=>{let r=CO(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(`"${Pf(e)}" must not be "${t}". +]);`)},L_=(t,e)=>new Error(`${Jn("sendMessage",e)} failed when sending an acknowledgment response to the ${is(e)}.`,{cause:t}),LZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${is(t)} is not listening to incoming messages.`)},zZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${is(t)} exited without listening to incoming messages.`)},UZ=()=>new Error(`\`cancelSignal\` aborted: the ${is(!0)} disconnected.`),qZ=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},BZ=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Jn(e,r)} cannot be used: the ${is(r)} is disconnecting.`,{cause:t})},HZ=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(qbe(t))throw new Error(`${Jn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},qbe=({code:t,message:e})=>Bbe.has(t)||Hbe.some(r=>e.includes(r)),Bbe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Hbe=["could not be cloned","circular structure","call stack size exceeded"],Jn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Gbe(e)}${t}(${r})`,Gbe=t=>t?"":"subprocess.",is=t=>t?"parent process":"subprocess",fl=t=>{t.connected&&t.disconnect()}});var Ei,ml=y(()=>{Ei=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var U_,hl,Ai,GZ,Zbe,Vbe,ZZ,Wbe,VZ,Pf,z_,os=y(()=>{po();U_=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ai.get(t),o=GZ(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(ZZ(o,e,n,!0));return s},hl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ai.get(t),o=GZ(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(ZZ(o,e,n,!1));return s},Ai=new WeakMap,GZ=(t,e,r)=>{let n=Zbe(e,r);return Vbe(n,e,r,t),n},Zbe=(t,e)=>{let r=DO(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(`"${Pf(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},qbe=(t,e,r,n)=>{let i=n[GZ(t)];if(i===void 0)throw new TypeError(`"${Pf(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(`"${Pf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Pf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},HZ=(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}=Bbe(t,r);return`The "${i}: ${z_(o)}" option is incompatible with using "${Pf(n)}: ${z_(e)}". -Please set this option with "pipe" instead.`},Bbe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=GZ(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]}},GZ=t=>t==="all"?1:t,Pf=t=>t?"to":"from",z_=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Hbe}from"node:events";var Sa,q_=y(()=>{Sa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Hbe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var B_,tR,H_,rR,ZZ,VZ,Cf=y(()=>{B_=(t,e)=>{e&&tR(t)},tR=t=>{t.refCounted()},H_=(t,e)=>{e&&rR(t)},rR=t=>{t.unrefCounted()},ZZ=(t,e)=>{e&&(rR(t),rR(t))},VZ=(t,e)=>{e&&(tR(t),tR(t))}});import{once as Gbe}from"node:events";import{scheduler as Zbe}from"node:timers/promises";var WZ,KZ,G_,JZ=y(()=>{V_();Cf();Z_();W_();WZ=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(XZ(i)||e9(i))return;G_.has(t)||G_.set(t,[]);let o=G_.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await QZ(t,n,i),await Zbe.yield();let s=await YZ({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},KZ=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{nR();let o=G_.get(t);for(;o?.length>0;)await Gbe(n,"message:done");t.removeListener("message",i),VZ(e,r),n.connected=!1,n.emit("disconnect")},G_=new WeakMap});import{EventEmitter as Vbe}from"node:events";var is,K_,Wbe,J_,Df=y(()=>{JZ();Cf();is=(t,e,r)=>{if(K_.has(t))return K_.get(t);let n=new Vbe;return n.connected=!0,K_.set(t,n),Wbe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},K_=new WeakMap,Wbe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=WZ.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",KZ.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),ZZ(r,n)},J_=t=>{let e=K_.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Kbe}from"node:events";var t9,Jbe,r9,YZ,XZ,n9,Y_,Ybe,X_,i9,Z_=y(()=>{pl();q_();tb();fl();Df();V_();t9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=is(t,e,r),s=Q_(t,o);return{id:Jbe++,type:X_,message:n,hasListeners:s}},Jbe=0n,r9=(t,e)=>{if(!(e?.type!==X_||e.hasListeners))for(let{id:r}of t)r!==void 0&&Y_[r].resolve({isDeadlock:!0,hasListeners:!1})},YZ=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==X_||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:i9,message:Q_(e,i)};try{await eb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},XZ=t=>{if(t?.type!==i9)return!1;let{id:e,message:r}=t;return Y_[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},n9=async(t,e,r)=>{if(t?.type!==X_)return;let n=Ei();Y_[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,Ybe(e,r,i)]);o&&jZ(r),s||MZ(r)}finally{i.abort(),delete Y_[t.id]}},Y_={},Ybe=async(t,e,{signal:r})=>{Sa(t,1,r),await Kbe(t,"disconnect",{signal:r}),FZ(e)},X_="execa:ipc:request",i9="execa:ipc:response"});var o9,s9,QZ,Nf,Q_,Xbe,V_=y(()=>{pl();po();ns();Z_();o9=(t,e,r)=>{Nf.has(t)||Nf.set(t,new Set);let n=Nf.get(t),i=Ei(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},s9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},QZ=async(t,e,r)=>{for(;!Q_(t,e)&&Nf.get(t)?.size>0;){let n=[...Nf.get(t)];r9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Nf=new WeakMap,Q_=(t,e)=>e.listenerCount("message")>Xbe(t),Xbe=t=>Ai.has(t)&&!fo(Ai.get(t).options.buffer,"ipc")?1:0});import{promisify as Qbe}from"node:util";var eb,eve,oR,tve,iR,tb=y(()=>{fl();V_();Z_();eb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return ul({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),eve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},eve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=t9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=o9(t,s,o);try{await oR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw dl(t),c}finally{s9(a)}},oR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=tve(t);try{await Promise.all([n9(n,t,r),o(n)])}catch(s){throw UZ({error:s,methodName:e,isSubprocess:r}),qZ({error:s,methodName:e,isSubprocess:r,message:i}),s}},tve=t=>{if(iR.has(t))return iR.get(t);let e=Qbe(t.send.bind(t));return iR.set(t,e),e},iR=new WeakMap});import{scheduler as rve}from"node:timers/promises";var c9,l9,nve,a9,e9,u9,nR,sR,W_=y(()=>{tb();Df();fl();c9=(t,e)=>{let r="cancelSignal";return eR(r,!1,t.connected),oR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:u9,message:e},message:e})},l9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await nve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),sR.signal),nve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!a9){if(a9=!0,!n){zZ();return}if(e===null){nR();return}is(t,e,r),await rve.yield()}},a9=!1,e9=t=>t?.type!==u9?!1:(sR.abort(t.message),!0),u9="execa:ipc:cancel",nR=()=>{sR.abort(LZ())},sR=new AbortController});var d9,f9,ive,ove,aR=y(()=>{XO();W_();M_();d9=({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.")}},f9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[ive({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],ive=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await F_(e,i);let o=ove(e);throw await c9(t,o),YO({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},ove=({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 sve}from"node:timers/promises";var p9,m9,ave,cR=y(()=>{va();p9=({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})`)},m9=(t,e,r,n)=>e===0||e===void 0?[]:[ave(t,e,r,n)],ave=async(t,e,r,{signal:n})=>{throw await sve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Kn}});import{execPath as cve,execArgv as lve}from"node:process";import h9 from"node:path";var g9,y9,lR=y(()=>{il();g9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},y9=(t,e,{node:r=!1,nodePath:n=cve,nodeOptions:i=lve.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=nl(n,'The "nodePath" option'),l=h9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(h9.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 uve}from"node:v8";var _9,dve,fve,pve,b9,uR=y(()=>{_9=({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`.");pve[r](t)}},dve=t=>{try{uve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},fve=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},pve={advanced:dve,json:fve},b9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var S9,mve,rn,dR,hve,v9,rb,wa=y(()=>{S9=({encoding:t})=>{if(dR.has(t))return;let e=hve(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${rb(t)}\`. -Please rename it to ${rb(e)}.`);let r=[...dR].map(n=>rb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${rb(t)}\`. -Please rename it to one of: ${r}.`)},mve=new Set(["utf8","utf16le"]),rn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),dR=new Set([...mve,...rn]),hve=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in v9)return v9[e];if(dR.has(e))return e},v9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},rb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as gve}from"node:fs";import yve from"node:path";import _ve from"node:process";var w9,x9,$9,fR=y(()=>{il();w9=(t=x9())=>{let e=nl(t,'The "cwd" option');return yve.resolve(e)},x9=()=>{try{return _ve.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},$9=(t,e)=>{if(e===x9())return t;let r;try{r=gve(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},Vbe=(t,e,r,n)=>{let i=n[VZ(t)];if(i===void 0)throw new TypeError(`"${Pf(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(`"${Pf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Pf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},ZZ=(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}=Wbe(t,r);return`The "${i}: ${z_(o)}" option is incompatible with using "${Pf(n)}: ${z_(e)}". +Please set this option with "pipe" instead.`},Wbe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=VZ(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]}},VZ=t=>t==="all"?1:t,Pf=t=>t?"to":"from",z_=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Kbe}from"node:events";var wa,q_=y(()=>{wa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Kbe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var B_,rR,H_,nR,WZ,KZ,Cf=y(()=>{B_=(t,e)=>{e&&rR(t)},rR=t=>{t.refCounted()},H_=(t,e)=>{e&&nR(t)},nR=t=>{t.unrefCounted()},WZ=(t,e)=>{e&&(nR(t),nR(t))},KZ=(t,e)=>{e&&(rR(t),rR(t))}});import{once as Jbe}from"node:events";import{scheduler as Ybe}from"node:timers/promises";var JZ,YZ,G_,XZ=y(()=>{V_();Cf();Z_();W_();JZ=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(e9(i)||r9(i))return;G_.has(t)||G_.set(t,[]);let o=G_.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await t9(t,n,i),await Ybe.yield();let s=await QZ({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},YZ=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{iR();let o=G_.get(t);for(;o?.length>0;)await Jbe(n,"message:done");t.removeListener("message",i),KZ(e,r),n.connected=!1,n.emit("disconnect")},G_=new WeakMap});import{EventEmitter as Xbe}from"node:events";var ss,K_,Qbe,J_,Df=y(()=>{XZ();Cf();ss=(t,e,r)=>{if(K_.has(t))return K_.get(t);let n=new Xbe;return n.connected=!0,K_.set(t,n),Qbe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},K_=new WeakMap,Qbe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=JZ.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",YZ.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),WZ(r,n)},J_=t=>{let e=K_.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as eve}from"node:events";var n9,tve,i9,QZ,e9,o9,Y_,rve,X_,s9,Z_=y(()=>{ml();q_();tb();pl();Df();V_();n9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ss(t,e,r),s=Q_(t,o);return{id:tve++,type:X_,message:n,hasListeners:s}},tve=0n,i9=(t,e)=>{if(!(e?.type!==X_||e.hasListeners))for(let{id:r}of t)r!==void 0&&Y_[r].resolve({isDeadlock:!0,hasListeners:!1})},QZ=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==X_||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:s9,message:Q_(e,i)};try{await eb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},e9=t=>{if(t?.type!==s9)return!1;let{id:e,message:r}=t;return Y_[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},o9=async(t,e,r)=>{if(t?.type!==X_)return;let n=Ei();Y_[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,rve(e,r,i)]);o&&FZ(r),s||LZ(r)}finally{i.abort(),delete Y_[t.id]}},Y_={},rve=async(t,e,{signal:r})=>{wa(t,1,r),await eve(t,"disconnect",{signal:r}),zZ(e)},X_="execa:ipc:request",s9="execa:ipc:response"});var a9,c9,t9,Nf,Q_,nve,V_=y(()=>{ml();po();os();Z_();a9=(t,e,r)=>{Nf.has(t)||Nf.set(t,new Set);let n=Nf.get(t),i=Ei(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},c9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},t9=async(t,e,r)=>{for(;!Q_(t,e)&&Nf.get(t)?.size>0;){let n=[...Nf.get(t)];i9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Nf=new WeakMap,Q_=(t,e)=>e.listenerCount("message")>nve(t),nve=t=>Ai.has(t)&&!fo(Ai.get(t).options.buffer,"ipc")?1:0});import{promisify as ive}from"node:util";var eb,ove,sR,sve,oR,tb=y(()=>{pl();V_();Z_();eb=({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}),ove({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},ove=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=n9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=a9(t,s,o);try{await sR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw fl(t),c}finally{c9(a)}},sR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=sve(t);try{await Promise.all([o9(n,t,r),o(n)])}catch(s){throw BZ({error:s,methodName:e,isSubprocess:r}),HZ({error:s,methodName:e,isSubprocess:r,message:i}),s}},sve=t=>{if(oR.has(t))return oR.get(t);let e=ive(t.send.bind(t));return oR.set(t,e),e},oR=new WeakMap});import{scheduler as ave}from"node:timers/promises";var u9,d9,cve,l9,r9,f9,iR,aR,W_=y(()=>{tb();Df();pl();u9=(t,e)=>{let r="cancelSignal";return tR(r,!1,t.connected),sR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:f9,message:e},message:e})},d9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await cve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),aR.signal),cve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!l9){if(l9=!0,!n){qZ();return}if(e===null){iR();return}ss(t,e,r),await ave.yield()}},l9=!1,r9=t=>t?.type!==f9?!1:(aR.abort(t.message),!0),f9="execa:ipc:cancel",iR=()=>{aR.abort(UZ())},aR=new AbortController});var p9,m9,lve,uve,cR=y(()=>{QO();W_();M_();p9=({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?[lve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],lve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await F_(e,i);let o=uve(e);throw await u9(t,o),XO({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},uve=({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 dve}from"node:timers/promises";var h9,g9,fve,lR=y(()=>{Sa();h9=({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})`)},g9=(t,e,r,n)=>e===0||e===void 0?[]:[fve(t,e,r,n)],fve=async(t,e,r,{signal:n})=>{throw await dve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Kn}});import{execPath as pve,execArgv as mve}from"node:process";import y9 from"node:path";var _9,b9,uR=y(()=>{ol();_9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},b9=(t,e,{node:r=!1,nodePath:n=pve,nodeOptions:i=mve.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=il(n,'The "nodePath" option'),l=y9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(y9.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 hve}from"node:v8";var v9,gve,yve,_ve,S9,dR=y(()=>{v9=({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`.");_ve[r](t)}},gve=t=>{try{hve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},yve=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},_ve={advanced:gve,json:yve},S9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var x9,bve,rn,fR,vve,w9,rb,xa=y(()=>{x9=({encoding:t})=>{if(fR.has(t))return;let e=vve(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${rb(t)}\`. +Please rename it to ${rb(e)}.`);let r=[...fR].map(n=>rb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${rb(t)}\`. +Please rename it to one of: ${r}.`)},bve=new Set(["utf8","utf16le"]),rn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),fR=new Set([...bve,...rn]),vve=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in w9)return w9[e];if(fR.has(e))return e},w9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},rb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as Sve}from"node:fs";import wve from"node:path";import xve from"node:process";var $9,k9,E9,pR=y(()=>{ol();$9=(t=k9())=>{let e=il(t,'The "cwd" option');return wve.resolve(e)},k9=()=>{try{return xve.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},E9=(t,e)=>{if(e===k9())return t;let r;try{r=Sve(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 bve from"node:path";import k9 from"node:process";var E9,nb,vve,Sve,pR=y(()=>{E9=Et(sZ(),1);pZ();M_();If();QO();aR();cR();lR();uR();wa();fR();il();po();nb=(t,e,r)=>{r.cwd=w9(r.cwd);let[n,i,o]=y9(t,e,r),{command:s,args:a,options:c}=E9.default._parse(n,i,o),l=KH(c),u=vve(l);return p9(u),S9(u),_9(u),CZ(u),d9(u),u.shell=TO(u.shell),u.env=Sve(u),u.killSignal=TZ(u.killSignal),u.forceKillAfterDelay=IZ(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!rn.has(u.encoding)&&u.buffer[f]),k9.platform==="win32"&&bve.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},vve=({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}),Sve=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...k9.env,...t}:t;return r||n?fZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var ib,mR=y(()=>{ib=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function hl(t){if(typeof t=="string")return wve(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return xve(t)}var wve,xve,A9,$ve,T9,kve,hR=y(()=>{wve=t=>t.at(-1)===A9?t.slice(0,t.at(-2)===T9?-2:-1):t,xve=t=>t.at(-1)===$ve?t.subarray(0,t.at(-2)===kve?-2:-1):t,A9=` -`,$ve=A9.codePointAt(0),T9="\r",kve=T9.codePointAt(0)});function Yn(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 gR(t,{checkOpen:e=!0}={}){return Yn(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 xa(t,{checkOpen:e=!0}={}){return Yn(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 yR(t,e){return gR(t,e)&&xa(t,e)}var $a=y(()=>{});function O9(){return this[bR].next()}function R9(t){return this[bR].return(t)}function vR({preventCancel:t=!1}={}){let e=this.getReader(),r=new _R(e,t),n=Object.create(Ave);return n[bR]=r,n}var Eve,_R,bR,Ave,I9=y(()=>{Eve=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),_R=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}}},bR=Symbol();Object.defineProperty(O9,"name",{value:"next"});Object.defineProperty(R9,"name",{value:"return"});Ave=Object.create(Eve,{next:{enumerable:!0,configurable:!0,writable:!0,value:O9},return:{enumerable:!0,configurable:!0,writable:!0,value:R9}})});var P9=y(()=>{});var C9=y(()=>{I9();P9()});var D9,Tve,Ove,Rve,jf,SR=y(()=>{$a();C9();D9=t=>{if(xa(t,{checkOpen:!1})&&jf.on!==void 0)return Ove(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Tve.call(t)==="[object ReadableStream]")return vR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Tve}=Object.prototype,Ove=async function*(t){let e=new AbortController,r={};Rve(t,e,r);try{for await(let[n]of jf.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()}},Rve=async(t,e,r)=>{try{await jf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},jf={}});var gl,Ive,M9,N9,Pve,j9,Ti,Mf=y(()=>{SR();gl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=D9(t),u=e();u.length=0;try{for await(let d of l){let f=Pve(d),p=r[f](d,u);M9({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Ive({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}},Ive=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&M9({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},M9=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){N9(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&N9(c,e,i,o),new Ti},N9=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Pve=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=j9.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&j9.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:j9}=Object.prototype,Ti=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var mo,Ff,ob,sb,ab,cb=y(()=>{mo=t=>t,Ff=()=>{},ob=({contents:t})=>t,sb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},ab=t=>t.length});async function lb(t,e){return gl(t,jve,e)}var Cve,Dve,Nve,jve,F9=y(()=>{Mf();cb();Cve=()=>({contents:[]}),Dve=()=>1,Nve=(t,{contents:e})=>(e.push(t),e),jve={init:Cve,convertChunk:{string:mo,buffer:mo,arrayBuffer:mo,dataView:mo,typedArray:mo,others:mo},getSize:Dve,truncateChunk:Ff,addChunk:Nve,getFinalChunk:Ff,finalize:ob}});async function ub(t,e){return gl(t,Gve,e)}var Mve,Fve,Lve,L9,z9,zve,Uve,qve,Bve,q9,U9,Hve,B9,Gve,H9=y(()=>{Mf();cb();Mve=()=>({contents:new ArrayBuffer(0)}),Fve=t=>Lve.encode(t),Lve=new TextEncoder,L9=t=>new Uint8Array(t),z9=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),zve=(t,e)=>t.slice(0,e),Uve=(t,{contents:e,length:r},n)=>{let i=B9()?Bve(e,n):qve(e,n);return new Uint8Array(i).set(t,r),i},qve=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(q9(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Bve=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:q9(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},q9=t=>U9**Math.ceil(Math.log(t)/Math.log(U9)),U9=2,Hve=({contents:t,length:e})=>B9()?t:t.slice(0,e),B9=()=>"resize"in ArrayBuffer.prototype,Gve={init:Mve,convertChunk:{string:Fve,buffer:L9,arrayBuffer:L9,dataView:z9,typedArray:z9,others:sb},getSize:ab,truncateChunk:zve,addChunk:Uve,getFinalChunk:Ff,finalize:Hve}});async function fb(t,e){return gl(t,Jve,e)}var Zve,db,Vve,Wve,Kve,Jve,G9=y(()=>{Mf();cb();Zve=()=>({contents:"",textDecoder:new TextDecoder}),db=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Vve=(t,{contents:e})=>e+t,Wve=(t,e)=>t.slice(0,e),Kve=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},Jve={init:Zve,convertChunk:{string:mo,buffer:db,arrayBuffer:db,dataView:db,typedArray:db,others:sb},getSize:ab,truncateChunk:Wve,addChunk:Vve,getFinalChunk:Kve,finalize:ob}});var Z9=y(()=>{F9();H9();G9();Mf()});import{on as Yve}from"node:events";import{finished as Xve}from"node:stream/promises";var pb=y(()=>{SR();Z9();Object.assign(jf,{on:Yve,finished:Xve})});var V9,Qve,W9,K9,eSe,J9,Y9,mb,ka=y(()=>{pb();uo();po();V9=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ti))throw t;if(o==="all")return t;let s=Qve(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},Qve=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",W9=(t,e,r)=>{if(e.length!==r)return;let n=new Ti;throw n.maxBufferInfo={fdNumber:"ipc"},n},K9=(t,e)=>{let{streamName:r,threshold:n,unit:i}=eSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},eSe=(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=fo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:v_(r),threshold:i,unit:n}},J9=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>mb(r)),Y9=(t,e,r)=>{if(!e)return t;let n=mb(r);return t.length>n?t.slice(0,n):t},mb=([,t])=>t});import{inspect as tSe}from"node:util";var Q9,rSe,nSe,iSe,oSe,sSe,X9,eV=y(()=>{hR();tn();fR();x_();ka();If();va();Q9=({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=rSe({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=iSe(n,b),w=x===void 0?"":` -${x}`,O=`${S}: ${a}${w}`,A=e===void 0?[t[2],t[1]]:[e],E=[O,...A,...t.slice(3),r.map(C=>oSe(C)).join(` -`)].map(C=>Af(hl(sSe(C)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:O,message:E}},rSe=({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=nSe(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?`${K9(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${j_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},nSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",iSe=(t,e)=>{if(t instanceof Kn)return;let r=gZ(t)?t.originalMessage:String(t?.message??t),n=Af($9(r,e));return n===""?void 0:n},oSe=t=>typeof t=="string"?t:tSe(t),sSe=t=>Array.isArray(t)?t.map(e=>hl(X9(e))).filter(Boolean).join(` -`):X9(t),X9=t=>typeof t=="string"?t:Ft(t)?__(t):""});var hb,yl,Lf,aSe,tV,cSe,zf=y(()=>{If();O_();va();eV();hb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>tV({command:t,escapedCommand:e,cwd:o,durationMs:FO(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:[]}),yl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Lf({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}),Lf=({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:O,signalDescription:A}=cSe(l,u),{originalMessage:E,shortMessage:C,message:k}=Q9({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,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:_}),q=mZ(t,k,x);return Object.assign(q,aSe({error:q,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:A,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:E,shortMessage:C})),q},aSe=({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})=>tV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:FO(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:[]}),tV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),cSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:j_(e);return{exitCode:r,signal:n,signalDescription:i}}});function lSe(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(rV(t*1e3)%1e3),nanoseconds:Math.trunc(rV(t*1e6)%1e3)}}function uSe(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 wR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return lSe(t);break}case"bigint":return uSe(t)}throw new TypeError("Expected a finite number or bigint")}var rV,nV=y(()=>{rV=t=>Number.isFinite(t)?t:0});function xR(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+pSe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&dSe(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?" "+fSe(d,u):f;i.push(p)}},a=wR(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%mSe):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 dSe,fSe,pSe,mSe,iV=y(()=>{nV();dSe=t=>t===0||t===0n,fSe=(t,e)=>e===1||e===1n?t:`${t}s`,pSe=1e-7,mSe=24n*60n*60n*1000n});var oV,sV=y(()=>{al();oV=(t,e)=>{t.failed&&ki({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var aV,hSe,cV=y(()=>{iV();ts();al();sV();aV=(t,e)=>{ol(e)&&(oV(t,e),hSe(t,e))},hSe=(t,e)=>{let r=`(done in ${xR(t.durationMs)})`;ki({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var _l,gb=y(()=>{cV();_l=(t,e,{reject:r})=>{if(aV(t,e),t.failed&&r)throw t;return t}});var dV,gSe,ySe,fV,pV,lV,_Se,$R,uV,Ea,mV,bSe,yb,hV,vSe,SSe,kR,gV,wSe,yV,_b,xSe,ER,$Se,kSe,_V,kn,bb,AR,bV,vV,os,_r=y(()=>{$a();co();tn();dV=(t,e)=>Ea(t)?"asyncGenerator":mV(t)?"generator":yb(t)?"fileUrl":vSe(t)?"filePath":xSe(t)?"webStream":Yn(t,{checkOpen:!1})?"native":Ft(t)?"uint8Array":$Se(t)?"asyncIterable":kSe(t)?"iterable":ER(t)?fV({transform:t},e):bSe(t)?gSe(t,e):"native",gSe=(t,e)=>yR(t.transform,{checkOpen:!1})?ySe(t,e):ER(t.transform)?fV(t,e):_Se(t,e),ySe=(t,e)=>(pV(t,e,"Duplex stream"),"duplex"),fV=(t,e)=>(pV(t,e,"web TransformStream"),"webTransform"),pV=({final:t,binary:e,objectMode:r},n,i)=>{lV(t,`${n}.final`,i),lV(e,`${n}.binary`,i),$R(r,`${n}.objectMode`)},lV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},_Se=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!uV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(yR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(ER(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!uV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return $R(r,`${i}.binary`),$R(n,`${i}.objectMode`),Ea(t)||Ea(e)?"asyncGenerator":"generator"},$R=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},uV=t=>Ea(t)||mV(t),Ea=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",mV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",bSe=t=>At(t)&&(t.transform!==void 0||t.final!==void 0),yb=t=>Object.prototype.toString.call(t)==="[object URL]",hV=t=>yb(t)&&t.protocol!=="file:",vSe=t=>At(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>SSe.has(e))&&kR(t.file),SSe=new Set(["file","append"]),kR=t=>typeof t=="string",gV=(t,e)=>t==="native"&&typeof e=="string"&&!wSe.has(e),wSe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),yV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",_b=t=>Object.prototype.toString.call(t)==="[object WritableStream]",xSe=t=>yV(t)||_b(t),ER=t=>yV(t?.readable)&&_b(t?.writable),$Se=t=>_V(t)&&typeof t[Symbol.asyncIterator]=="function",kSe=t=>_V(t)&&typeof t[Symbol.iterator]=="function",_V=t=>typeof t=="object"&&t!==null,kn=new Set(["generator","asyncGenerator","duplex","webTransform"]),bb=new Set(["fileUrl","filePath","fileNumber"]),AR=new Set(["fileUrl","filePath"]),bV=new Set([...AR,"webStream","nodeStream"]),vV=new Set(["webTransform","duplex"]),os={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 TR,ESe,ASe,SV,OR=y(()=>{_r();TR=(t,e,r,n)=>n==="output"?ESe(t,e,r):ASe(t,e,r),ESe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},ASe=(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}},SV=(t,e)=>{let r=t.findLast(({type:n})=>kn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var wV,TSe,OSe,RSe,ISe,PSe,CSe,xV=y(()=>{co();wa();_r();OR();wV=(t,e,r,n)=>[...t.filter(({type:i})=>!kn.has(i)),...TSe(t,e,r,n)],TSe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>kn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=OSe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return CSe(o,r)},OSe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?RSe({stdioItem:t,optionName:i}):e==="webTransform"?ISe({stdioItem:t,index:r,newTransforms:n,direction:o}):PSe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),RSe=({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}}},ISe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=At(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=TR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},PSe=({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}=At(e)?e:{transform:e},d=c||rn.has(o),{writableObjectMode:f,readableObjectMode:p}=TR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},CSe=(t,e)=>e==="input"?t.reverse():t});import RR from"node:process";var $V,DSe,NSe,bl,IR,kV,jSe,MSe,EV=y(()=>{$a();_r();$V=(t,e,r)=>{let n=t.map(i=>DSe(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)??MSe},DSe=({type:t,value:e},r)=>NSe[r]??kV[t](e),NSe=["input","output","output"],bl=()=>{},IR=()=>"input",kV={generator:bl,asyncGenerator:bl,fileUrl:bl,filePath:bl,iterable:IR,asyncIterable:IR,uint8Array:IR,webStream:t=>_b(t)?"output":"input",nodeStream(t){return xa(t,{checkOpen:!1})?gR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:bl,duplex:bl,native(t){let e=jSe(t);if(e!==void 0)return e;if(Yn(t,{checkOpen:!1}))return kV.nodeStream(t)}},jSe=t=>{if([0,RR.stdin].includes(t))return"input";if([1,2,RR.stdout,RR.stderr].includes(t))return"output"},MSe="output"});var AV,TV=y(()=>{AV=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var OV,FSe,LSe,RV,zSe,USe,IV=y(()=>{uo();TV();ts();OV=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=FSe(t,n).map((a,c)=>RV(a,c));return o?zSe(s,r,i):AV(s,e)},FSe=(t,e)=>{if(t===void 0)return $n.map(n=>e[n]);if(LSe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${$n.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,$n.length);return Array.from({length:r},(n,i)=>t[i])},LSe=t=>$n.some(e=>t[e]!==void 0),RV=(t,e)=>Array.isArray(t)?t.map(r=>RV(r,e)):t??(e>=$n.length?"ignore":"pipe"),zSe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!sl(r,i)&&USe(n)?"ignore":n),USe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as qSe}from"node:fs";import BSe from"node:tty";var CV,HSe,GSe,ZSe,VSe,PV,DV=y(()=>{$a();uo();tn();ns();CV=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?HSe({stdioItem:t,fdNumber:n,direction:i}):VSe({stdioItem:t,fdNumber:n}),HSe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=GSe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(Yn(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},GSe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=ZSe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(BSe.isatty(i))throw new TypeError(`The \`${e}: ${z_(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:lo(qSe(i)),optionName:e}}},ZSe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=b_.indexOf(t);if(r!==-1)return r},VSe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:PV(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:PV(e,e,r),optionName:r}:Yn(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,PV=(t,e,r)=>{let n=b_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var NV,WSe,KSe,JSe,YSe,jV=y(()=>{$a();tn();_r();NV=({input:t,inputFile:e},r)=>r===0?[...WSe(t),...JSe(e)]:[],WSe=t=>t===void 0?[]:[{type:KSe(t),value:t,optionName:"input"}],KSe=t=>{if(xa(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ft(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},JSe=t=>t===void 0?[]:[{...YSe(t),optionName:"inputFile"}],YSe=t=>{if(yb(t))return{type:"fileUrl",value:t};if(kR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var MV,FV,XSe,QSe,LV,ewe,twe,zV,UV=y(()=>{_r();MV=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),FV=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=XSe(i,t);if(s.length!==0){if(o){QSe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(bV.has(t))return LV({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});vV.has(t)&&twe({otherStdioItems:s,type:t,value:e,optionName:r})}},XSe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),QSe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{AR.has(e)&&LV({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},LV=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>ewe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return zV(s,n,e),i==="output"?o[0].stream:void 0},ewe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,twe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);zV(i,n,e)},zV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${os[r]} that is the same.`)}});var vb,rwe,nwe,iwe,owe,swe,awe,cwe,lwe,uwe,dwe,fwe,PR,pwe,Sb=y(()=>{uo();xV();OR();_r();EV();IV();DV();jV();UV();vb=(t,e,r,n)=>{let o=OV(e,r,n).map((a,c)=>rwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=uwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>pwe(a)),s},rwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=v_(e),{stdioItems:o,isStdioArray:s}=nwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=$V(o,e,i),c=o.map(d=>CV({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=wV(c,i,a,r),u=SV(l,a);return lwe(l,u),{direction:a,objectMode:u,stdioItems:l}},nwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>iwe(c,n)),...NV(r,e)],s=MV(o),a=s.length>1;return owe(s,a,n),awe(s),{stdioItems:s,isStdioArray:a}},iwe=(t,e)=>({type:dV(t,e),value:t,optionName:e}),owe=(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(swe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},swe=new Set(["ignore","ipc"]),awe=t=>{for(let e of t)cwe(e)},cwe=({type:t,value:e,optionName:r})=>{if(hV(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(gV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},lwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>bb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},uwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(dwe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw PR(i),o}},dwe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>fwe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},fwe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=FV({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},PR=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Wn(r)&&r.destroy()},pwe=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 qV}from"node:fs";var HV,Oi,mwe,GV,BV,hwe,ZV=y(()=>{tn();Sb();_r();HV=(t,e)=>vb(hwe,t,e,!0),Oi=({type:t,optionName:e})=>{GV(e,os[t])},mwe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&GV(t,`"${e}"`),{}),GV=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},BV={generator(){},asyncGenerator:Oi,webStream:Oi,nodeStream:Oi,webTransform:Oi,duplex:Oi,asyncIterable:Oi,native:mwe},hwe={input:{...BV,fileUrl:({value:t})=>({contents:[lo(qV(t))]}),filePath:({value:{file:t}})=>({contents:[lo(qV(t))]}),fileNumber:Oi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...BV,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Oi,string:Oi,uint8Array:Oi}}});var ho,CR,Uf=y(()=>{hR();ho=(t,{stripFinalNewline:e},r)=>CR(e,r)&&t!==void 0&&!Array.isArray(t)?hl(t):t,CR=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var wb,NR,VV,WV,gwe,ywe,_we,KV,bwe,DR,vwe,Swe,wwe,xb=y(()=>{wb=(t,e,r,n)=>t||r?void 0:WV(e,n),NR=(t,e,r)=>r?t.flatMap(n=>VV(n,e)):VV(t,e),VV=(t,e)=>{let{transform:r,final:n}=WV(e,{});return[...r(t),...n()]},WV=(t,e)=>(e.previousChunks="",{transform:gwe.bind(void 0,e,t),final:_we.bind(void 0,e)}),gwe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=DR(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=DR(n,r.slice(i+1))),t.previousChunks=n},ywe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),_we=function*({previousChunks:t}){t.length>0&&(yield t)},KV=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:bwe.bind(void 0,n)},bwe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?vwe:wwe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},DR=(t,e)=>`${t}${e}`,vwe={windowsNewline:`\r +${t}`}});import $ve from"node:path";import A9 from"node:process";var T9,nb,kve,Eve,mR=y(()=>{T9=Et(cZ(),1);hZ();M_();If();eR();cR();lR();uR();dR();xa();pR();ol();po();nb=(t,e,r)=>{r.cwd=$9(r.cwd);let[n,i,o]=b9(t,e,r),{command:s,args:a,options:c}=T9.default._parse(n,i,o),l=YH(c),u=kve(l);return h9(u),x9(u),v9(u),NZ(u),p9(u),u.shell=OO(u.shell),u.env=Eve(u),u.killSignal=RZ(u.killSignal),u.forceKillAfterDelay=CZ(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!rn.has(u.encoding)&&u.buffer[f]),A9.platform==="win32"&&$ve.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},kve=({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}),Eve=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...A9.env,...t}:t;return r||n?mZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var ib,hR=y(()=>{ib=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function gl(t){if(typeof t=="string")return Ave(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Tve(t)}var Ave,Tve,O9,Ove,R9,Rve,gR=y(()=>{Ave=t=>t.at(-1)===O9?t.slice(0,t.at(-2)===R9?-2:-1):t,Tve=t=>t.at(-1)===Ove?t.subarray(0,t.at(-2)===Rve?-2:-1):t,O9=` +`,Ove=O9.codePointAt(0),R9="\r",Rve=R9.codePointAt(0)});function Yn(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 yR(t,{checkOpen:e=!0}={}){return Yn(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 $a(t,{checkOpen:e=!0}={}){return Yn(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 _R(t,e){return yR(t,e)&&$a(t,e)}var ka=y(()=>{});function I9(){return this[vR].next()}function P9(t){return this[vR].return(t)}function SR({preventCancel:t=!1}={}){let e=this.getReader(),r=new bR(e,t),n=Object.create(Pve);return n[vR]=r,n}var Ive,bR,vR,Pve,C9=y(()=>{Ive=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),bR=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}}},vR=Symbol();Object.defineProperty(I9,"name",{value:"next"});Object.defineProperty(P9,"name",{value:"return"});Pve=Object.create(Ive,{next:{enumerable:!0,configurable:!0,writable:!0,value:I9},return:{enumerable:!0,configurable:!0,writable:!0,value:P9}})});var D9=y(()=>{});var N9=y(()=>{C9();D9()});var j9,Cve,Dve,Nve,jf,wR=y(()=>{ka();N9();j9=t=>{if($a(t,{checkOpen:!1})&&jf.on!==void 0)return Dve(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Cve.call(t)==="[object ReadableStream]")return SR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Cve}=Object.prototype,Dve=async function*(t){let e=new AbortController,r={};Nve(t,e,r);try{for await(let[n]of jf.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()}},Nve=async(t,e,r)=>{try{await jf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},jf={}});var yl,jve,L9,M9,Mve,F9,Ti,Mf=y(()=>{wR();yl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=j9(t),u=e();u.length=0;try{for await(let d of l){let f=Mve(d),p=r[f](d,u);L9({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return jve({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}},jve=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&L9({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},L9=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){M9(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&M9(c,e,i,o),new Ti},M9=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Mve=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=F9.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&F9.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:F9}=Object.prototype,Ti=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var mo,Ff,ob,sb,ab,cb=y(()=>{mo=t=>t,Ff=()=>{},ob=({contents:t})=>t,sb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},ab=t=>t.length});async function lb(t,e){return yl(t,Uve,e)}var Fve,Lve,zve,Uve,z9=y(()=>{Mf();cb();Fve=()=>({contents:[]}),Lve=()=>1,zve=(t,{contents:e})=>(e.push(t),e),Uve={init:Fve,convertChunk:{string:mo,buffer:mo,arrayBuffer:mo,dataView:mo,typedArray:mo,others:mo},getSize:Lve,truncateChunk:Ff,addChunk:zve,getFinalChunk:Ff,finalize:ob}});async function ub(t,e){return yl(t,Jve,e)}var qve,Bve,Hve,U9,q9,Gve,Zve,Vve,Wve,H9,B9,Kve,G9,Jve,Z9=y(()=>{Mf();cb();qve=()=>({contents:new ArrayBuffer(0)}),Bve=t=>Hve.encode(t),Hve=new TextEncoder,U9=t=>new Uint8Array(t),q9=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Gve=(t,e)=>t.slice(0,e),Zve=(t,{contents:e,length:r},n)=>{let i=G9()?Wve(e,n):Vve(e,n);return new Uint8Array(i).set(t,r),i},Vve=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(H9(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Wve=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:H9(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},H9=t=>B9**Math.ceil(Math.log(t)/Math.log(B9)),B9=2,Kve=({contents:t,length:e})=>G9()?t:t.slice(0,e),G9=()=>"resize"in ArrayBuffer.prototype,Jve={init:qve,convertChunk:{string:Bve,buffer:U9,arrayBuffer:U9,dataView:q9,typedArray:q9,others:sb},getSize:ab,truncateChunk:Gve,addChunk:Zve,getFinalChunk:Ff,finalize:Kve}});async function fb(t,e){return yl(t,tSe,e)}var Yve,db,Xve,Qve,eSe,tSe,V9=y(()=>{Mf();cb();Yve=()=>({contents:"",textDecoder:new TextDecoder}),db=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Xve=(t,{contents:e})=>e+t,Qve=(t,e)=>t.slice(0,e),eSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},tSe={init:Yve,convertChunk:{string:mo,buffer:db,arrayBuffer:db,dataView:db,typedArray:db,others:sb},getSize:ab,truncateChunk:Qve,addChunk:Xve,getFinalChunk:eSe,finalize:ob}});var W9=y(()=>{z9();Z9();V9();Mf()});import{on as rSe}from"node:events";import{finished as nSe}from"node:stream/promises";var pb=y(()=>{wR();W9();Object.assign(jf,{on:rSe,finished:nSe})});var K9,iSe,J9,Y9,oSe,X9,Q9,mb,Ea=y(()=>{pb();uo();po();K9=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ti))throw t;if(o==="all")return t;let s=iSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},iSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",J9=(t,e,r)=>{if(e.length!==r)return;let n=new Ti;throw n.maxBufferInfo={fdNumber:"ipc"},n},Y9=(t,e)=>{let{streamName:r,threshold:n,unit:i}=oSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},oSe=(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=fo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:v_(r),threshold:i,unit:n}},X9=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>mb(r)),Q9=(t,e,r)=>{if(!e)return t;let n=mb(r);return t.length>n?t.slice(0,n):t},mb=([,t])=>t});import{inspect as sSe}from"node:util";var tV,aSe,cSe,lSe,uSe,dSe,eV,rV=y(()=>{gR();tn();pR();x_();Ea();If();Sa();tV=({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=aSe({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=lSe(n,b),w=x===void 0?"":` +${x}`,O=`${S}: ${a}${w}`,A=e===void 0?[t[2],t[1]]:[e],E=[O,...A,...t.slice(3),r.map(C=>uSe(C)).join(` +`)].map(C=>Af(gl(dSe(C)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:O,message:E}},aSe=({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=cSe(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?`${Y9(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${j_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},cSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",lSe=(t,e)=>{if(t instanceof Kn)return;let r=_Z(t)?t.originalMessage:String(t?.message??t),n=Af(E9(r,e));return n===""?void 0:n},uSe=t=>typeof t=="string"?t:sSe(t),dSe=t=>Array.isArray(t)?t.map(e=>gl(eV(e))).filter(Boolean).join(` +`):eV(t),eV=t=>typeof t=="string"?t:Ft(t)?__(t):""});var hb,_l,Lf,fSe,nV,pSe,zf=y(()=>{If();O_();Sa();rV();hb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>nV({command:t,escapedCommand:e,cwd:o,durationMs:LO(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:[]}),_l=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Lf({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}),Lf=({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:O,signalDescription:A}=pSe(l,u),{originalMessage:E,shortMessage:C,message:k}=tV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,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:_}),q=gZ(t,k,x);return Object.assign(q,fSe({error:q,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:A,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:E,shortMessage:C})),q},fSe=({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})=>nV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:LO(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:[]}),nV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),pSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:j_(e);return{exitCode:r,signal:n,signalDescription:i}}});function mSe(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(iV(t*1e3)%1e3),nanoseconds:Math.trunc(iV(t*1e6)%1e3)}}function hSe(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 xR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return mSe(t);break}case"bigint":return hSe(t)}throw new TypeError("Expected a finite number or bigint")}var iV,oV=y(()=>{iV=t=>Number.isFinite(t)?t:0});function $R(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+_Se);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&gSe(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?" "+ySe(d,u):f;i.push(p)}},a=xR(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%bSe):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 gSe,ySe,_Se,bSe,sV=y(()=>{oV();gSe=t=>t===0||t===0n,ySe=(t,e)=>e===1||e===1n?t:`${t}s`,_Se=1e-7,bSe=24n*60n*60n*1000n});var aV,cV=y(()=>{cl();aV=(t,e)=>{t.failed&&ki({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var lV,vSe,uV=y(()=>{sV();ns();cl();cV();lV=(t,e)=>{sl(e)&&(aV(t,e),vSe(t,e))},vSe=(t,e)=>{let r=`(done in ${$R(t.durationMs)})`;ki({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var bl,gb=y(()=>{uV();bl=(t,e,{reject:r})=>{if(lV(t,e),t.failed&&r)throw t;return t}});var pV,SSe,wSe,mV,hV,dV,xSe,kR,fV,Aa,gV,$Se,yb,yV,kSe,ESe,ER,_V,ASe,bV,_b,TSe,AR,OSe,RSe,vV,kn,bb,TR,SV,wV,as,_r=y(()=>{ka();co();tn();pV=(t,e)=>Aa(t)?"asyncGenerator":gV(t)?"generator":yb(t)?"fileUrl":kSe(t)?"filePath":TSe(t)?"webStream":Yn(t,{checkOpen:!1})?"native":Ft(t)?"uint8Array":OSe(t)?"asyncIterable":RSe(t)?"iterable":AR(t)?mV({transform:t},e):$Se(t)?SSe(t,e):"native",SSe=(t,e)=>_R(t.transform,{checkOpen:!1})?wSe(t,e):AR(t.transform)?mV(t,e):xSe(t,e),wSe=(t,e)=>(hV(t,e,"Duplex stream"),"duplex"),mV=(t,e)=>(hV(t,e,"web TransformStream"),"webTransform"),hV=({final:t,binary:e,objectMode:r},n,i)=>{dV(t,`${n}.final`,i),dV(e,`${n}.binary`,i),kR(r,`${n}.objectMode`)},dV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},xSe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!fV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(_R(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(AR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!fV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return kR(r,`${i}.binary`),kR(n,`${i}.objectMode`),Aa(t)||Aa(e)?"asyncGenerator":"generator"},kR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},fV=t=>Aa(t)||gV(t),Aa=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",gV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",$Se=t=>At(t)&&(t.transform!==void 0||t.final!==void 0),yb=t=>Object.prototype.toString.call(t)==="[object URL]",yV=t=>yb(t)&&t.protocol!=="file:",kSe=t=>At(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>ESe.has(e))&&ER(t.file),ESe=new Set(["file","append"]),ER=t=>typeof t=="string",_V=(t,e)=>t==="native"&&typeof e=="string"&&!ASe.has(e),ASe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),bV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",_b=t=>Object.prototype.toString.call(t)==="[object WritableStream]",TSe=t=>bV(t)||_b(t),AR=t=>bV(t?.readable)&&_b(t?.writable),OSe=t=>vV(t)&&typeof t[Symbol.asyncIterator]=="function",RSe=t=>vV(t)&&typeof t[Symbol.iterator]=="function",vV=t=>typeof t=="object"&&t!==null,kn=new Set(["generator","asyncGenerator","duplex","webTransform"]),bb=new Set(["fileUrl","filePath","fileNumber"]),TR=new Set(["fileUrl","filePath"]),SV=new Set([...TR,"webStream","nodeStream"]),wV=new Set(["webTransform","duplex"]),as={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 OR,ISe,PSe,xV,RR=y(()=>{_r();OR=(t,e,r,n)=>n==="output"?ISe(t,e,r):PSe(t,e,r),ISe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},PSe=(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}},xV=(t,e)=>{let r=t.findLast(({type:n})=>kn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var $V,CSe,DSe,NSe,jSe,MSe,FSe,kV=y(()=>{co();xa();_r();RR();$V=(t,e,r,n)=>[...t.filter(({type:i})=>!kn.has(i)),...CSe(t,e,r,n)],CSe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>kn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=DSe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return FSe(o,r)},DSe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?NSe({stdioItem:t,optionName:i}):e==="webTransform"?jSe({stdioItem:t,index:r,newTransforms:n,direction:o}):MSe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),NSe=({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}}},jSe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=At(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=OR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},MSe=({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}=At(e)?e:{transform:e},d=c||rn.has(o),{writableObjectMode:f,readableObjectMode:p}=OR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},FSe=(t,e)=>e==="input"?t.reverse():t});import IR from"node:process";var EV,LSe,zSe,vl,PR,AV,USe,qSe,TV=y(()=>{ka();_r();EV=(t,e,r)=>{let n=t.map(i=>LSe(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)??qSe},LSe=({type:t,value:e},r)=>zSe[r]??AV[t](e),zSe=["input","output","output"],vl=()=>{},PR=()=>"input",AV={generator:vl,asyncGenerator:vl,fileUrl:vl,filePath:vl,iterable:PR,asyncIterable:PR,uint8Array:PR,webStream:t=>_b(t)?"output":"input",nodeStream(t){return $a(t,{checkOpen:!1})?yR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:vl,duplex:vl,native(t){let e=USe(t);if(e!==void 0)return e;if(Yn(t,{checkOpen:!1}))return AV.nodeStream(t)}},USe=t=>{if([0,IR.stdin].includes(t))return"input";if([1,2,IR.stdout,IR.stderr].includes(t))return"output"},qSe="output"});var OV,RV=y(()=>{OV=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var IV,BSe,HSe,PV,GSe,ZSe,CV=y(()=>{uo();RV();ns();IV=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=BSe(t,n).map((a,c)=>PV(a,c));return o?GSe(s,r,i):OV(s,e)},BSe=(t,e)=>{if(t===void 0)return $n.map(n=>e[n]);if(HSe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${$n.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,$n.length);return Array.from({length:r},(n,i)=>t[i])},HSe=t=>$n.some(e=>t[e]!==void 0),PV=(t,e)=>Array.isArray(t)?t.map(r=>PV(r,e)):t??(e>=$n.length?"ignore":"pipe"),GSe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!al(r,i)&&ZSe(n)?"ignore":n),ZSe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as VSe}from"node:fs";import WSe from"node:tty";var NV,KSe,JSe,YSe,XSe,DV,jV=y(()=>{ka();uo();tn();os();NV=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?KSe({stdioItem:t,fdNumber:n,direction:i}):XSe({stdioItem:t,fdNumber:n}),KSe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=JSe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(Yn(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},JSe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=YSe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(WSe.isatty(i))throw new TypeError(`The \`${e}: ${z_(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:lo(VSe(i)),optionName:e}}},YSe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=b_.indexOf(t);if(r!==-1)return r},XSe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:DV(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:DV(e,e,r),optionName:r}:Yn(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,DV=(t,e,r)=>{let n=b_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var MV,QSe,ewe,twe,rwe,FV=y(()=>{ka();tn();_r();MV=({input:t,inputFile:e},r)=>r===0?[...QSe(t),...twe(e)]:[],QSe=t=>t===void 0?[]:[{type:ewe(t),value:t,optionName:"input"}],ewe=t=>{if($a(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ft(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},twe=t=>t===void 0?[]:[{...rwe(t),optionName:"inputFile"}],rwe=t=>{if(yb(t))return{type:"fileUrl",value:t};if(ER(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var LV,zV,nwe,iwe,UV,owe,swe,qV,BV=y(()=>{_r();LV=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),zV=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=nwe(i,t);if(s.length!==0){if(o){iwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(SV.has(t))return UV({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});wV.has(t)&&swe({otherStdioItems:s,type:t,value:e,optionName:r})}},nwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),iwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{TR.has(e)&&UV({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},UV=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>owe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return qV(s,n,e),i==="output"?o[0].stream:void 0},owe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,swe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);qV(i,n,e)},qV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${as[r]} that is the same.`)}});var vb,awe,cwe,lwe,uwe,dwe,fwe,pwe,mwe,hwe,gwe,ywe,CR,_we,Sb=y(()=>{uo();kV();RR();_r();TV();CV();jV();FV();BV();vb=(t,e,r,n)=>{let o=IV(e,r,n).map((a,c)=>awe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=hwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>_we(a)),s},awe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=v_(e),{stdioItems:o,isStdioArray:s}=cwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=EV(o,e,i),c=o.map(d=>NV({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=$V(c,i,a,r),u=xV(l,a);return mwe(l,u),{direction:a,objectMode:u,stdioItems:l}},cwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>lwe(c,n)),...MV(r,e)],s=LV(o),a=s.length>1;return uwe(s,a,n),fwe(s),{stdioItems:s,isStdioArray:a}},lwe=(t,e)=>({type:pV(t,e),value:t,optionName:e}),uwe=(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(dwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},dwe=new Set(["ignore","ipc"]),fwe=t=>{for(let e of t)pwe(e)},pwe=({type:t,value:e,optionName:r})=>{if(yV(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(_V(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},mwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>bb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},hwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(gwe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw CR(i),o}},gwe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>ywe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},ywe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=zV({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},CR=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Wn(r)&&r.destroy()},_we=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 HV}from"node:fs";var ZV,Oi,bwe,VV,GV,vwe,WV=y(()=>{tn();Sb();_r();ZV=(t,e)=>vb(vwe,t,e,!0),Oi=({type:t,optionName:e})=>{VV(e,as[t])},bwe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&VV(t,`"${e}"`),{}),VV=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},GV={generator(){},asyncGenerator:Oi,webStream:Oi,nodeStream:Oi,webTransform:Oi,duplex:Oi,asyncIterable:Oi,native:bwe},vwe={input:{...GV,fileUrl:({value:t})=>({contents:[lo(HV(t))]}),filePath:({value:{file:t}})=>({contents:[lo(HV(t))]}),fileNumber:Oi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...GV,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Oi,string:Oi,uint8Array:Oi}}});var ho,DR,Uf=y(()=>{gR();ho=(t,{stripFinalNewline:e},r)=>DR(e,r)&&t!==void 0&&!Array.isArray(t)?gl(t):t,DR=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var wb,jR,KV,JV,Swe,wwe,xwe,YV,$we,NR,kwe,Ewe,Awe,xb=y(()=>{wb=(t,e,r,n)=>t||r?void 0:JV(e,n),jR=(t,e,r)=>r?t.flatMap(n=>KV(n,e)):KV(t,e),KV=(t,e)=>{let{transform:r,final:n}=JV(e,{});return[...r(t),...n()]},JV=(t,e)=>(e.previousChunks="",{transform:Swe.bind(void 0,e,t),final:xwe.bind(void 0,e)}),Swe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=NR(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=NR(n,r.slice(i+1))),t.previousChunks=n},wwe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),xwe=function*({previousChunks:t}){t.length>0&&(yield t)},YV=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:$we.bind(void 0,n)},$we=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?kwe:Awe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},NR=(t,e)=>`${t}${e}`,kwe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:DR},Swe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},wwe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Swe}});import{Buffer as xwe}from"node:buffer";var JV,$we,YV,kwe,Ewe,XV,QV=y(()=>{tn();JV=(t,e)=>t?void 0:$we.bind(void 0,e),$we=function*(t,e){if(typeof e!="string"&&!Ft(e)&&!xwe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},YV=(t,e)=>t?kwe.bind(void 0,e):Ewe.bind(void 0,e),kwe=function*(t,e){XV(t,e),yield e},Ewe=function*(t,e){if(XV(t,e),typeof e!="string"&&!Ft(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},XV=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:NR},Ewe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Awe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Ewe}});import{Buffer as Twe}from"node:buffer";var XV,Owe,QV,Rwe,Iwe,eW,tW=y(()=>{tn();XV=(t,e)=>t?void 0:Owe.bind(void 0,e),Owe=function*(t,e){if(typeof e!="string"&&!Ft(e)&&!Twe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},QV=(t,e)=>t?Rwe.bind(void 0,e):Iwe.bind(void 0,e),Rwe=function*(t,e){eW(t,e),yield e},Iwe=function*(t,e){if(eW(t,e),typeof e!="string"&&!Ft(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},eW=(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 Awe}from"node:buffer";import{StringDecoder as Twe}from"node:string_decoder";var $b,Owe,Rwe,Iwe,jR=y(()=>{tn();$b=(t,e,r)=>{if(r)return;if(t)return{transform:Owe.bind(void 0,new TextEncoder)};let n=new Twe(e);return{transform:Rwe.bind(void 0,n),final:Iwe.bind(void 0,n)}},Owe=function*(t,e){Awe.isBuffer(e)?yield lo(e):typeof e=="string"?yield t.encode(e):yield e},Rwe=function*(t,e){yield Ft(e)?t.write(e):e},Iwe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as eW}from"node:util";var MR,kb,tW,Pwe,rW,Cwe,nW=y(()=>{MR=eW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),kb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Cwe}=e[r];for await(let i of n(t))yield*kb(i,e,r+1)},tW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Pwe(r,Number(e),t)},Pwe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*kb(n,r,e+1)},rW=eW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Cwe=function*(t){yield t}});var FR,iW,Aa,qf,Dwe,Nwe,LR=y(()=>{FR=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},iW=(t,e)=>[...e.flatMap(r=>[...Aa(r,t,0)]),...qf(t)],Aa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Nwe}=e[r];for(let i of n(t))yield*Aa(i,e,r+1)},qf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Dwe(r,Number(e),t)},Dwe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Aa(n,r,e+1)},Nwe=function*(t){yield t}});import{Transform as jwe,getDefaultHighWaterMark as oW}from"node:stream";var zR,Eb,sW,Ab=y(()=>{_r();xb();QV();jR();nW();LR();zR=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=sW(t,s,o),l=Ea(e),u=Ea(r),d=l?MR.bind(void 0,kb,a):FR.bind(void 0,Aa),f=l||u?MR.bind(void 0,tW,a):FR.bind(void 0,qf),p=l||u?rW.bind(void 0,a):void 0;return{stream:new jwe({writableObjectMode:n,writableHighWaterMark:oW(n),readableObjectMode:i,readableHighWaterMark:oW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Eb=(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=sW(s,r,a);t=iW(c,t)}return t},sW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:JV(n,a)},$b(r,s,n),wb(r,o,n,c),{transform:t,final:e},{transform:YV(i,a)},KV({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var aW,Mwe,Fwe,Lwe,zwe,cW=y(()=>{Ab();tn();_r();aW=(t,e)=>{for(let r of Mwe(t))Fwe(t,r,e)},Mwe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Fwe=(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 ${os[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Lwe(a,n));r.input=Ef(s)},Lwe=(t,e)=>{let r=Eb(t,e,"utf8",!0);return zwe(r),Ef(r)},zwe=t=>{let e=t.find(r=>typeof r!="string"&&!Ft(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 Tb,Uwe,qwe,lW,uW,Bwe,dW,UR=y(()=>{wa();_r();al();ts();Tb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&sl(r,n)&&!rn.has(e)&&Uwe(n)&&(t.some(({type:i,value:o})=>i==="native"&&qwe.has(o))||t.every(({type:i})=>kn.has(i))),Uwe=t=>t===1||t===2,qwe=new Set(["pipe","overlapped"]),lW=async(t,e,r,n)=>{for await(let i of t)Bwe(e)||dW(i,r,n)},uW=(t,e,r)=>{for(let n of t)dW(n,e,r)},Bwe=t=>t._readableState.pipes.length>0,dW=(t,e,r)=>{let n=A_(t);ki({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Hwe,appendFileSync as Gwe}from"node:fs";var fW,Zwe,Vwe,Wwe,Kwe,Jwe,pW=y(()=>{UR();Ab();xb();tn();_r();ka();fW=({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)=>Zwe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Zwe=({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=Y9(t,o,d),p=lo(f),{stdioItems:m,objectMode:h}=e[r],g=Vwe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Wwe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Kwe({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&&Jwe(b,m,i),S}catch(x){return n.error=x,S}},Vwe=(t,e,r,n)=>{try{return Eb(t,e,r,!1)}catch(i){return n.error=i,t}},Wwe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Ef(t)};let s=UH(t,r);return n[o]?{serializedResult:s,finalResult:NR(s,!i[o],e)}:{serializedResult:s}},Kwe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Tb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=NR(t,!1,s);try{uW(a,e,n)}catch(c){r.error??=c}},Jwe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>bb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Gwe(n,t):(r.add(o),Hwe(n,t))}}});var mW,hW=y(()=>{tn();Uf();mW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ho(e,r,"all")]:Array.isArray(e)?[ho(t,r,"all"),...e]:Ft(t)&&Ft(e)?RO([t,e]):`${t}${e}`}});import{once as qR}from"node:events";var gW,Ywe,yW,_W,Xwe,BR,HR=y(()=>{va();gW=async(t,e)=>{let[r,n]=await Ywe(t);return e.isForcefullyTerminated??=!1,[r,n]},Ywe=async t=>{let[e,r]=await Promise.allSettled([qR(t,"spawn"),qR(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?yW(t):r.value},yW=async t=>{try{return await qR(t,"exit")}catch{return yW(t)}},_W=async t=>{let[e,r]=await t;if(!Xwe(e,r)&&BR(e,r))throw new Kn;return[e,r]},Xwe=(t,e)=>t===void 0&&e===void 0,BR=(t,e)=>t!==0||e!==null});var bW,Qwe,vW=y(()=>{va();ka();HR();bW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=Qwe(t,e,r),s=o?.code==="ETIMEDOUT",a=J9(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},Qwe=(t,e,r)=>t!==void 0?t:BR(e,r)?new Kn:void 0});import{spawnSync as exe}from"node:child_process";var SW,txe,rxe,nxe,Ob,ixe,oxe,sxe,axe,wW=y(()=>{LO();pR();mR();zf();gb();ZV();Uf();cW();pW();ka();hW();vW();SW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=txe(t,e,r),d=ixe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return _l(d,c,l)},txe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=R_(t,e,r),a=rxe(r),{file:c,commandArguments:l,options:u}=nb(t,e,a);nxe(u);let d=HV(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},rxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,nxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Ob("ipcInput"),t&&Ob("ipc: true"),r&&Ob("detached: true"),n&&Ob("cancelSignal")},Ob=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},ixe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=oxe({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}=bW(c,r),{output:m,error:h=l}=fW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ho(_,r,S)),b=ho(mW(m,r),r,"all");return axe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},oxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{aW(o,r);let a=sxe(r);return exe(...ib(t,e,a))}catch(a){return yl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},sxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:mb(e)}),axe=({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?hb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Lf({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 GR,on as cxe}from"node:events";var xW,lxe,uxe,dxe,fxe,$W=y(()=>{fl();Df();Cf();xW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(ul({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:J_(t)}),lxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),lxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{B_(e,i);let o=is(t,e,r),s=new AbortController;try{return await Promise.race([uxe(o,n,s),dxe(o,r,s),fxe(o,r,s)])}catch(a){throw dl(t),a}finally{s.abort(),H_(e,i)}},uxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await GR(t,"message",{signal:r});return n}for await(let[n]of cxe(t,"message",{signal:r}))if(e(n))return n},dxe=async(t,e,{signal:r})=>{await GR(t,"disconnect",{signal:r}),NZ(e)},fxe=async(t,e,{signal:r})=>{let[n]=await GR(t,"strict:error",{signal:r});throw L_(n,e)}});import{once as EW,on as pxe}from"node:events";var AW,ZR,mxe,hxe,gxe,kW,VR=y(()=>{fl();Df();Cf();AW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>ZR({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),ZR=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{ul({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:J_(t)}),B_(e,o);let s=is(t,e,r),a=new AbortController,c={};return mxe(t,s,a),hxe({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),gxe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},mxe=async(t,e,r)=>{try{await EW(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},hxe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await EW(t,"strict:error",{signal:r.signal});n.error=L_(i,e),r.abort()}catch{}},gxe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of pxe(r,"message",{signal:o.signal}))kW(s),yield c}catch{kW(s)}finally{o.abort(),H_(e,a),n||dl(t),i&&await t}},kW=({error:t})=>{if(t)throw t}});import TW from"node:process";var OW,RW,IW,WR=y(()=>{tb();$W();VR();W_();OW=(t,{ipc:e})=>{Object.assign(t,IW(t,!1,e))},RW=()=>{let t=TW,e=!0,r=TW.channel!==void 0;return{...IW(t,e,r),getCancelSignal:l9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},IW=(t,e,r)=>({sendMessage:eb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:xW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:AW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as yxe}from"node:child_process";import{PassThrough as _xe,Readable as bxe,Writable as vxe,Duplex as Sxe}from"node:stream";var PW,wxe,Bf,xxe,$xe,kxe,Exe,CW=y(()=>{Sb();zf();gb();PW=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{PR(n);let a=new yxe;wxe(a,n),Object.assign(a,{readable:xxe,writable:$xe,duplex:kxe});let c=yl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=Exe(c,s,i);return{subprocess:a,promise:l}},wxe=(t,e)=>{let r=Bf(),n=Bf(),i=Bf(),o=Array.from({length:e.length-3},Bf),s=Bf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Bf=()=>{let t=new _xe;return t.end(),t},xxe=()=>new bxe({read(){}}),$xe=()=>new vxe({write(){}}),kxe=()=>new Sxe({read(){},write(){}}),Exe=async(t,e,r)=>_l(t,e,r)});import{createReadStream as DW,createWriteStream as NW}from"node:fs";import{Buffer as Axe}from"node:buffer";import{Readable as Hf,Writable as Txe,Duplex as Oxe}from"node:stream";var MW,Gf,jW,Rxe,FW=y(()=>{Ab();Sb();_r();MW=(t,e)=>vb(Rxe,t,e,!1),Gf=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${os[t]}.`)},jW={fileNumber:Gf,generator:zR,asyncGenerator:zR,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Oxe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Rxe={input:{...jW,fileUrl:({value:t})=>({stream:DW(t)}),filePath:({value:{file:t}})=>({stream:DW(t)}),webStream:({value:t})=>({stream:Hf.fromWeb(t)}),iterable:({value:t})=>({stream:Hf.from(t)}),asyncIterable:({value:t})=>({stream:Hf.from(t)}),string:({value:t})=>({stream:Hf.from(t)}),uint8Array:({value:t})=>({stream:Hf.from(Axe.from(t))})},output:{...jW,fileUrl:({value:t})=>({stream:NW(t)}),filePath:({value:{file:t,append:e}})=>({stream:NW(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Txe.fromWeb(t)}),iterable:Gf,asyncIterable:Gf,string:Gf,uint8Array:Gf}}});import{on as Ixe,once as LW}from"node:events";import{PassThrough as Pxe,getDefaultHighWaterMark as Cxe}from"node:stream";import{finished as qW}from"node:stream/promises";function Ta(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)JR(i);let e=t.some(({readableObjectMode:i})=>i),r=Dxe(t,e),n=new KR({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Dxe,KR,Nxe,jxe,Mxe,JR,Fxe,Lxe,zxe,Uxe,qxe,BW,HW,YR,GW,Bxe,Rb,zW,UW,Ib=y(()=>{Dxe=(t,e)=>{if(t.length===0)return Cxe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},KR=class extends Pxe{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(JR(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Nxe(this,this.#t,this.#o);let r=Fxe({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(JR(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)}},Nxe=async(t,e,r)=>{Rb(t,zW);let n=new AbortController;try{await Promise.race([jxe(t,n),Mxe(t,e,r,n)])}finally{n.abort(),Rb(t,-zW)}},jxe=async(t,{signal:e})=>{try{await qW(t,{signal:e,cleanup:!0})}catch(r){throw BW(t,r),r}},Mxe=async(t,e,r,{signal:n})=>{for await(let[i]of Ixe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},JR=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Fxe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Rb(t,UW);let a=new AbortController;try{await Promise.race([Lxe(o,e,a),zxe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Uxe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Rb(t,-UW)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?YR(t):qxe(t))},Lxe=async(t,e,{signal:r})=>{try{await t,r.aborted||YR(e)}catch(n){r.aborted||BW(e,n)}},zxe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await qW(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;HW(s)?i.add(e):GW(t,s)}},Uxe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await LW(t,i,{signal:o}),!t.readable)return LW(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},qxe=t=>{t.writable&&t.end()},BW=(t,e)=>{HW(e)?YR(t):GW(t,e)},HW=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",YR=t=>{(t.readable||t.writable)&&t.destroy()},GW=(t,e)=>{t.destroyed||(t.once("error",Bxe),t.destroy(e))},Bxe=()=>{},Rb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},zW=2,UW=1});import{finished as ZW}from"node:stream/promises";var vl,Hxe,XR,Gxe,QR,Pb=y(()=>{uo();vl=(t,e)=>{t.pipe(e),Hxe(t,e),Gxe(t,e)},Hxe=async(t,e)=>{if(!(Wn(t)||Wn(e))){try{await ZW(t,{cleanup:!0,readable:!0,writable:!1})}catch{}XR(e)}},XR=t=>{t.writable&&t.end()},Gxe=async(t,e)=>{if(!(Wn(t)||Wn(e))){try{await ZW(e,{cleanup:!0,readable:!1,writable:!0})}catch{}QR(t)}},QR=t=>{t.readable&&t.destroy()}});var VW,Zxe,Vxe,Wxe,Kxe,Jxe,WW=y(()=>{Ib();uo();q_();_r();Pb();VW=(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})=>kn.has(c)))Zxe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!kn.has(c)))Wxe({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]:Ta(o);vl(s,i)}},Zxe=(t,e,r,n)=>{r==="output"?vl(t.stdio[n],e):vl(e,t.stdio[n]);let i=Vxe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Vxe=["stdin","stdout","stderr"],Wxe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Kxe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},Kxe=(t,{signal:e})=>{Wn(t)&&Sa(t,Jxe,e)},Jxe=2});var Oa,KW=y(()=>{Oa=[];Oa.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Oa.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Oa.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Cb,eI,tI,Yxe,rI,Db,Xxe,nI,iI,oI,JW,Vit,Wit,YW=y(()=>{KW();Cb=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",eI=Symbol.for("signal-exit emitter"),tI=globalThis,Yxe=Object.defineProperty.bind(Object),rI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(tI[eI])return tI[eI];Yxe(tI,eI,{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}},Db=class{},Xxe=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),nI=class extends Db{onExit(){return()=>{}}load(){}unload(){}},iI=class extends Db{#t=oI.platform==="win32"?"SIGINT":"SIGHUP";#r=new rI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Oa)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(!Cb(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 Oa)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,Oa.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 Cb(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"&&Cb(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)}},oI=globalThis.process,{onExit:JW,load:Vit,unload:Wit}=Xxe(Cb(oI)?new iI(oI):new nI)});import{addAbortListener as Qxe}from"node:events";var XW,QW=y(()=>{YW();XW=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=JW(()=>{t.kill()});Qxe(n,()=>{i()})}});var tK,e0e,t0e,eK,r0e,rK=y(()=>{OO();O_();ns();il();tK=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=T_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=e0e(r,n,i),{sourceStream:d,sourceError:f}=r0e(t,l),{options:p,fileDescriptors:m}=Ai.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},e0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=t0e(t,e,...r),a=U_(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},t0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(eK,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||AO(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]=y_(r,...n);return{destination:e(eK)(i,o,s),pipeOptions:s}}if(Ai.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}`)},eK=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),r0e=(t,e)=>{try{return{sourceStream:ml(t,e)}}catch(r){return{sourceError:r}}}});var iK,n0e,sI,nK,aI=y(()=>{zf();Pb();iK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=n0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw sI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},n0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return QR(t),n;if(e!==void 0)return XR(r),e},sI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>yl({error:t,command:nK,escapedCommand:nK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),nK="source.pipe(destination)"});var oK,sK=y(()=>{oK=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 i0e}from"node:stream/promises";var aK,o0e,s0e,a0e,Nb,c0e,l0e,cK=y(()=>{Ib();q_();Pb();aK=(t,e,r)=>{let n=Nb.has(e)?s0e(t,e):o0e(t,e);return Sa(t,c0e,r.signal),Sa(e,l0e,r.signal),a0e(e),n},o0e=(t,e)=>{let r=Ta([t]);return vl(r,e),Nb.set(e,r),r},s0e=(t,e)=>{let r=Nb.get(e);return r.add(t),r},a0e=async t=>{try{await i0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Nb.delete(t)},Nb=new WeakMap,c0e=2,l0e=1});import{aborted as u0e}from"node:util";var lK,d0e,uK=y(()=>{aI();lK=(t,e)=>t===void 0?[]:[d0e(t,e)],d0e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await u0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw sI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var jb,f0e,p0e,dK=y(()=>{co();rK();aI();sK();cK();uK();jb=(t,...e)=>{if(At(e[0]))return jb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=tK(t,...e),i=f0e({...n,destination:r});return i.pipe=jb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},f0e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=p0e(t,i);iK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=aK(e,o,d);return await Promise.race([oK(u),...lK(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},p0e=(t,e)=>Promise.allSettled([t,e])});import{on as m0e}from"node:events";import{getDefaultHighWaterMark as h0e}from"node:stream";var Mb,g0e,cI,y0e,pK,lI,fK,_0e,b0e,Fb=y(()=>{jR();xb();LR();Mb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return g0e(e,s),pK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},g0e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},cI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;y0e(e,s,t);let a=t.readableObjectMode&&!o;return pK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},y0e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},pK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=m0e(t,"data",{signal:e.signal,highWaterMark:fK,highWatermark:fK});return _0e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},lI=h0e(!0),fK=lI,_0e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=b0e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Aa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*qf(a)}},b0e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[$b(t,r,!e),wb(t,i,!n,{})].filter(Boolean)});import{setImmediate as v0e}from"node:timers/promises";var mK,S0e,w0e,x0e,uI,hK,dI=y(()=>{pb();tn();UR();Fb();ka();Uf();mK=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=S0e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([w0e(t),d]);return}let f=CR(c,r),p=cI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([x0e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},S0e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Tb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=cI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await lW(a,t,r,o)},w0e=async t=>{await v0e(),t.readableFlowing===null&&t.resume()},x0e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await lb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await ub(r,{maxBuffer:o})):await fb(r,{maxBuffer:o})}catch(a){return hK(V9({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},uI=async t=>{try{return await t}catch(e){return hK(e)}},hK=({bufferedData:t})=>LH(t)?new Uint8Array(t):t});import{finished as $0e}from"node:stream/promises";var Zf,k0e,E0e,A0e,T0e,O0e,fI,Lb,gK,zb=y(()=>{Zf=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=k0e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],$0e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||T0e(a,e,r,n)}finally{s.abort()}},k0e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&E0e(t,r,n),n},E0e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{A0e(e,r),n.call(t,...i)}},A0e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},T0e=(t,e,r,n)=>{if(!O0e(t,e,r,n))throw t},O0e=(t,e,r,n=!0)=>r.propagating?gK(t)||Lb(t):(r.propagating=!0,fI(r,e)===n?gK(t):Lb(t)),fI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Lb=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",gK=t=>t?.code==="EPIPE"});var yK,pI,mI=y(()=>{dI();zb();yK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>pI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),pI=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=Zf(t,e,l);if(fI(l,e)){await u;return}let[d]=await Promise.all([mK({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 _K,bK,R0e,I0e,hI=y(()=>{Ib();mI();_K=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ta([t,e].filter(Boolean)):void 0,bK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>pI({...R0e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:I0e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),R0e=({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}},I0e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var vK,SK,wK=y(()=>{al();ts();vK=t=>sl(t,"ipc"),SK=(t,e)=>{let r=A_(t);ki({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var xK,$K,kK=y(()=>{ka();wK();po();VR();xK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=vK(o),a=fo(e,"ipc"),c=fo(r,"ipc");for await(let l of ZR({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(W9(t,i,c),i.push(l)),s&&SK(l,o);return i},$K=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as P0e}from"node:events";var EK,C0e,D0e,N0e,AK=y(()=>{$a();cR();QO();aR();uo();_r();dI();kK();uR();hI();mI();HR();zb();EK=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 _=gW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=yK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=bK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],A=xK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),E=C0e(h,t,S),C=D0e(m,S);try{return await Promise.race([Promise.all([{},_W(_),Promise.all(x),w,A,b9(t,d),...E,...C]),g,N0e(t,b),...m9(t,o,f,b),...DZ({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...f9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all(x.map(q=>uI(q))),uI(w),$K(A,O),Promise.allSettled(E),Promise.allSettled(C)])}},C0e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Zf(n,i,r)),D0e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Yn(o,{checkOpen:!1})&&!Wn(o)).map(({type:i,value:o,stream:s=o})=>Zf(s,n,e,{isSameDirection:kn.has(i),stopOnExit:i==="native"}))),N0e=async(t,{signal:e})=>{let[r]=await P0e(t,"error",{signal:e});throw r}});var TK,Vf,Sl,Ub=y(()=>{pl();TK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Vf=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ei();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Sl=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 OK}from"node:stream/promises";var gI,RK,yI,_I,qb,Bb,bI=y(()=>{zb();gI=async t=>{if(t!==void 0)try{await yI(t)}catch{}},RK=async t=>{if(t!==void 0)try{await _I(t)}catch{}},yI=async t=>{await OK(t,{cleanup:!0,readable:!1,writable:!0})},_I=async t=>{await OK(t,{cleanup:!0,readable:!0,writable:!1})},qb=async(t,e)=>{if(await t,e)throw e},Bb=(t,e,r)=>{r&&!Lb(r)?t.destroy(r):e&&t.destroy()}});import{Readable as j0e}from"node:stream";import{callbackify as M0e}from"node:util";var IK,vI,SI,wI,F0e,xI,$I,PK,kI=y(()=>{wa();ns();Fb();pl();Ub();bI();IK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||rn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=vI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=SI(a,s),{read:f,onStdoutDataDone:p}=wI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new j0e({read:f,destroy:M0e($I.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return xI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},vI=(t,e,r)=>{let n=ml(t,e),i=Vf(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},SI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:lI},wI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ei(),s=Mb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){F0e(this,s,o)},onStdoutDataDone:o}},F0e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},xI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await _I(t),await n,await gI(i),await e,r.readable&&r.push(null)}catch(o){await gI(i),PK(r,o)}},$I=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Sl(r,e)&&(PK(t,n),await qb(e,n))},PK=(t,e)=>{Bb(t,t.readable,e)}});import{Writable as L0e}from"node:stream";import{callbackify as CK}from"node:util";var DK,EI,AI,z0e,U0e,TI,OI,NK,RI=y(()=>{ns();Ub();bI();DK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=EI(t,r,e),s=new L0e({...AI(n,t,i),destroy:CK(OI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return TI(n,s),s},EI=(t,e,r)=>{let n=U_(t,e),i=Vf(r,n,"writableFinal"),o=Vf(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},AI=(t,e,r)=>({write:z0e.bind(void 0,t),final:CK(U0e.bind(void 0,t,e,r))}),z0e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},U0e=async(t,e,r)=>{await Sl(r,e)&&(t.writable&&t.end(),await e)},TI=async(t,e,r)=>{try{await yI(t),e.writable&&e.end()}catch(n){await RK(r),NK(e,n)}},OI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Sl(r,e),await Sl(n,e)&&(NK(t,i),await qb(e,i))},NK=(t,e)=>{Bb(t,t.writable,e)}});import{Duplex as q0e}from"node:stream";import{callbackify as B0e}from"node:util";var jK,H0e,MK=y(()=>{wa();kI();RI();jK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||rn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=vI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=EI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=SI(c,a),{read:g,onStdoutDataDone:b}=wI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new q0e({read:g,...AI(u,t,d),destroy:B0e(H0e.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 xI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),TI(u,_,c),_},H0e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([$I({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),OI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var II,G0e,FK=y(()=>{wa();ns();Fb();II=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||rn.has(e),s=ml(t,r),a=Mb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return G0e(a,s,t)},G0e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var LK,zK=y(()=>{Ub();kI();RI();MK();FK();LK=(t,{encoding:e})=>{let r=TK();t.readable=IK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=DK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=jK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=II.bind(void 0,t,e),t[Symbol.asyncIterator]=II.bind(void 0,t,e,{})}});var UK,Z0e,V0e,qK=y(()=>{UK=(t,e)=>{for(let[r,n]of V0e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Z0e=(async()=>{})().constructor.prototype,V0e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Z0e,t)])});import{setMaxListeners as W0e}from"node:events";import{spawn as K0e}from"node:child_process";var BK,J0e,Y0e,X0e,Q0e,e$e,HK=y(()=>{pb();LO();pR();ns();mR();WR();zf();gb();CW();FW();Uf();WW();M_();QW();dK();hI();AK();zK();pl();qK();BK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=J0e(t,e,r),{subprocess:f,promise:p}=X0e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=jb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),UK(f,p),Ai.set(f,{options:u,fileDescriptors:d}),f},J0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=R_(t,e,r),{file:a,commandArguments:c,options:l}=nb(t,e,r),u=Y0e(l),d=MW(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Y0e=({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}},X0e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=K0e(...ib(t,e,r))}catch(m){return PW({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;W0e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];VW(c,a,l),XW(c,r,l);let d={},f=Ei();c.kill=PZ.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=_K(c,r),LK(c,r),OW(c,r);let p=Q0e({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}},Q0e=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 EK({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)=>ho(x,e,w)),_=ho(h,e,"all"),S=e$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return _l(S,n,e)},e$e=({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?Lf({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 Ti,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):hb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Hb,t$e,r$e,GK=y(()=>{co();po();Hb=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,t$e(n,t[n],i)]));return{...t,...r}},t$e=(t,e,r)=>r$e.has(t)&&At(e)&&At(r)?{...e,...r}:r,r$e=new Set(["env",...DO])});var ss,n$e,i$e,ZK=y(()=>{co();OO();VH();wW();HK();GK();ss=(t,e,r,n)=>{let i=(s,a,c)=>ss(s,a,r,c),o=(...s)=>n$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},n$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(At(o))return i(t,Hb(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=i$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?SW(a,c,l):BK(a,c,l,i)},i$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=GH(e)?ZH(e,r):[e,...r],[s,a,c]=y_(...o),l=Hb(Hb(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 VK,WK,KK,o$e,s$e,JK=y(()=>{VK=({file:t,commandArguments:e})=>KK(t,e),WK=({file:t,commandArguments:e})=>({...KK(t,e),isSync:!0}),KK=(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]=o$e(t);return{file:r,commandArguments:n}},o$e=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(s$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},s$e=/ +/g});var YK,XK,a$e,QK,c$e,e3,t3=y(()=>{YK=(t,e,r)=>{t.sync=e(a$e,r),t.s=t.sync},XK=({options:t})=>QK(t),a$e=({options:t})=>({...QK(t),isSync:!0}),QK=t=>({options:{...c$e(t),...t}}),c$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},e3={preferLocal:!0}});var Mat,Je,Fat,Lat,zat,Uat,qat,Bat,Hat,Gat,jr=y(()=>{ZK();JK();lR();t3();WR();Mat=ss(()=>({})),Je=ss(()=>({isSync:!0})),Fat=ss(VK),Lat=ss(WK),zat=ss(g9),Uat=ss(XK,{},e3,YK),{sendMessage:qat,getOneMessage:Bat,getEachMessage:Hat,getCancelSignal:Gat}=RW()});import{existsSync as Gb,statSync as l$e}from"node:fs";import{dirname as PI,extname as u$e,isAbsolute as r3,join as CI,relative as DI,resolve as Zb,sep as d$e}from"node:path";function Vb(t){return t==="./gradlew"||t==="gradle"}function f$e(t){return(Gb(CI(t,"build.gradle.kts"))||Gb(CI(t,"build.gradle")))&&Gb(CI(t,"gradle.properties"))}function p$e(t,e){let n=DI(t,e).split(d$e).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function as(t,e){return t===":"?`:${e}`:`${t}:${e}`}function m$e(t,e){let r=Zb(t,e),n=r;Gb(r)?l$e(r).isFile()&&(n=PI(r)):u$e(r)!==""&&(n=PI(r));let i=DI(t,n);if(i.startsWith("..")||r3(i))return null;let o=n;for(;;){if(f$e(o))return o;if(Zb(o)===Zb(t))return null;let s=PI(o);if(s===o)return null;let a=DI(t,s);if(a.startsWith("..")||r3(a))return null;o=s}}function Wb(t,e){let r=Zb(t),n=new Map,i=[];for(let o of e){let s=m$e(r,o);if(!s){i.push(o);continue}let a=p$e(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 Kb=y(()=>{"use strict"});import{existsSync as h$e,readFileSync as g$e}from"node:fs";import{join as y$e}from"node:path";function wl(t="."){let e=y$e(t,".cladding","config.yaml");if(!h$e(e))return NI;try{let n=(0,n3.parse)(g$e(e,"utf8"))?.gate;if(!n)return NI;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 _$e){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 NI}}function i3(t,e){let r=[],n=!1;for(let i of t){let o=b$e.exec(i);if(o){n=!0;for(let s of e)r.push(as(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 n3,_$e,NI,b$e,Jb=y(()=>{"use strict";n3=Et(cr(),1);Kb();_$e=["type","lint","test","coverage"],NI={scope:"feature"};b$e=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as MI,readFileSync as o3,readdirSync as v$e,statSync as S$e}from"node:fs";import{join as Yb}from"node:path";function zI(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Yb(t,e);if(MI(r))try{if(s3.test(o3(r,"utf8")))return!0}catch{}}return!1}function a3(t){try{return MI(t)&&s3.test(o3(t,"utf8"))}catch{return!1}}function c3(t,e=0){if(e>4||!MI(t))return!1;let r;try{r=v$e(t)}catch{return!1}for(let n of r){let i=Yb(t,n),o=!1;try{o=S$e(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(c3(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&a3(i))return!0}return!1}function $$e(t){if(zI(t))return!0;for(let e of w$e)if(a3(Yb(t,e)))return!0;for(let e of x$e)if(c3(Yb(t,e)))return!0;return!1}function l3(t="."){let e=wl(t).coverage;return e||($$e(t)?"kover":"jacoco")}function u3(t="."){return FI[l3(t)]}function d3(t="."){return jI[l3(t)]}var FI,jI,LI,s3,w$e,x$e,Xb=y(()=>{"use strict";Jb();FI={kover:"koverXmlReport",jacoco:"jacocoTestReport"},jI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},LI=[jI.kover,jI.jacoco],s3=/kover/i;w$e=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],x$e=["buildSrc","build-logic"]});import{existsSync as Qb,readFileSync as f3,readdirSync as p3}from"node:fs";import{join as Ra}from"node:path";function UI(t){return Qb(Ra(t,"gradlew"))?"./gradlew":"gradle"}function k$e(t){let e=UI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[u3(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function E$e(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(f3(Ra(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 T$e(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function I$e(t,e){for(let r of e)if(Qb(Ra(t,r)))return r}function P$e(t,e){try{return p3(t).find(n=>n.endsWith(e))}catch{return}}function D$e(t,e){for(let r of C$e)if(r.configs.some(n=>Qb(Ra(t,n))))return r.gate;return e}function j$e(t){if(N$e.some(e=>Qb(Ra(t,e))))return!0;try{return JSON.parse(f3(Ra(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function M$e(t,e){let r=e.lint?{...e,lint:D$e(t,e.lint)}:{...e};return e.test&&e.coverage&&j$e(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function ht(t="."){for(let e of O$e){let r;for(let o of e.manifests)if(o.startsWith(".")?r=P$e(t,o):r=I$e(t,[o]),r)break;if(!r||e.requiresSource&&!T$e(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?M$e(t,n):n;return{language:e.language,manifest:r,gates:i}}return R$e}var A$e,O$e,R$e,C$e,N$e,En=y(()=>{"use strict";Xb();A$e=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);O$e=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:k$e},{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:E$e}],R$e={language:"unknown",manifest:"",gates:{}};C$e=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];N$e=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as F$e,readFileSync as L$e}from"node:fs";import{join as z$e}from"node:path";function Ia(t){return t.code==="ENOENT"}function ev(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=(o||s||`exit ${i}`).slice(0,200);return m3.test(o)||m3.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Lt(t,e,r){return Ia(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function xl(t,e){let r=z$e(t,"package.json");if(!F$e(r))return!1;try{return!!JSON.parse(L$e(r,"utf8")).scripts?.[e]}catch{return!1}}var m3,An=y(()=>{"use strict";m3=/config (is |file )?not found|no such file|ENOENT|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 U$e(t){let{cwd:e="."}=t,r=ht(e),n=r.gates.arch;if(!n)return[{detector:tv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Ia(i)?[{detector:tv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:ev(i,tv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var tv,Pa,rv=y(()=>{"use strict";jr();En();An();tv="ARCHITECTURE_VIOLATION";Pa={name:tv,subprocess:!0,run:U$e}});function q$e(t){let{cwd:e="."}=t,r=ht(e),n=r.gates.secret;if(!n)return[{detector:nv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Ia(i)?[{detector:nv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:ev(i,nv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var nv,Ca,iv=y(()=>{"use strict";jr();En();An();nv="HARDCODED_SECRET";Ca={name:nv,subprocess:!0,run:q$e}});import{existsSync as qI,readdirSync as h3}from"node:fs";import{join as ov}from"node:path";function H$e(t,e){let r=ov(t,e.path);if(!qI(r))return!0;if(e.isDirectory)try{return h3(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function G$e(t){let{cwd:e="."}=t,r=[];for(let i of B$e)H$e(e,i)&&r.push({detector:Wf,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=ov(e,"spec.yaml");if(qI(n)){let i=W$e(n),o=i?null:Z$e(e);if(i)r.push({detector:Wf,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:Wf,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=V$e(e);s&&r.push({detector:Wf,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 Z$e(t){for(let e of["spec/features","spec/scenarios"]){let r=ov(t,e);if(!qI(r))continue;let n;try{n=h3(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{wi(ov(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function V$e(t){try{return H(t),null}catch(e){return e.message}}function W$e(t){let e;try{e=wi(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Wf,B$e,g3,y3=y(()=>{"use strict";qe();a_();Wf="ABSENCE_OF_GOVERNANCE",B$e=[{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}];g3={name:Wf,run:G$e}});function sv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function BI(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=sv(r)==="while",o=J$e.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 '${sv(r)}'`}let n=K$e[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:sv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${sv(r)}'`:null}function Y$e(t,e){let r=BI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function _3(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...Y$e(r,n));return e}var K$e,J$e,HI=y(()=>{"use strict";K$e={event:"when",state:"while",optional:"where",unwanted:"if"},J$e=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var bt=y(()=>{"use strict";qe()});function X$e(t){let{cwd:e="."}=t;return he(e,av,Q$e)}function Q$e(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:av,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 _3(t.features))e.push({detector:av,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var av,b3,v3=y(()=>{"use strict";HI();bt();av="AC_DRIFT";b3={name:av,run:X$e}});function Ri(t=".",e){let n=(e??"").trim().toLowerCase()||ht(t).language;return w3[n]??S3}var eke,tke,rke,S3,nke,ike,w3,oke,x3,Da=y(()=>{"use strict";En();eke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,tke=/^[ \t]*import\s+([\w.]+)/gm,rke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,S3={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:eke,importStyle:"relative"},nke={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:tke,importStyle:"dotted"},ike={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:rke,importStyle:"dotted"},w3={typescript:S3,kotlin:nke,python:ike},oke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],x3=new Set([...Object.values(w3).flatMap(t=>t?.extensions??[]),...oke].map(t=>t.toLowerCase()))});import{existsSync as ske,readFileSync as ake,readdirSync as cke,statSync as lke}from"node:fs";import{join as k3,relative as $3}from"node:path";function uke(t,e){if(!ske(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=cke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=k3(i,s),c;try{c=lke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function dke(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function pke(t){return fke.test(t)}function mke(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Ri(e,r.project?.language),o=i.sourceRoots.flatMap(a=>uke(k3(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=ake(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";qe();Da();E3="AI_HINTS_FORBIDDEN_PATTERN";fke=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;A3={name:E3,run:mke}});function hke(t){let{cwd:e="."}=t,r;try{r=H(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:O3,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var O3,R3,I3=y(()=>{"use strict";qe();O3="AC_DUPLICATE_WITHIN_FEATURE";R3={name:O3,run:hke}});import{createRequire as gke}from"module";import{basename as yke,dirname as ZI,normalize as _ke,relative as bke,resolve as vke,sep as D3}from"path";import*as Ske from"fs";function wke(t){let e=_ke(t);return e.length>1&&e[e.length-1]===D3&&(e=e.substring(0,e.length-1)),e}function N3(t,e){return t.replace(xke,e)}function kke(t){return t==="/"||$ke.test(t)}function GI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=vke(t)),(n||o)&&(t=wke(t)),t===".")return"";let s=t[t.length-1]!==i;return N3(s?t+i:t,i)}function j3(t,e){return e+t}function Eke(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:N3(bke(t,n),e.pathSeparator)+e.pathSeparator+r}}function Ake(t){return t}function Tke(t,e,r){return e+t+r}function Oke(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?Eke(t,e):n?j3:Ake}function Rke(t){return function(e,r){r.push(e.substring(t.length)||".")}}function Ike(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function Nke(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?Ike(t):Rke(t):n&&n.length?Cke:Pke:Dke}function Uke(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?zke:r&&r.length?n?jke:Mke:n?Fke:Lke}function Hke(t){return t.group?Bke:qke}function Vke(t){return t.group?Gke:Zke}function Jke(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?Kke:Wke}function M3(t,e,r){if(r.options.useRealPaths)return Yke(e,r);let n=ZI(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=ZI(n)}return r.symlinks.set(t,e),i>1}function Yke(t,e){return e.visited.includes(t+e.options.pathSeparator)}function cv(t,e,r,n){e(t&&!n?t:null,r)}function sEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?Xke:rEe:n?e?Qke:oEe:i?e?tEe:iEe:e?eEe:nEe}function lEe(t){return t?cEe:aEe}function pEe(t,e){return new Promise((r,n)=>{z3(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function z3(t,e,r){new L3(t,e,r).start()}function mEe(t,e){return new L3(t,e).start()}var P3,xke,$ke,Pke,Cke,Dke,jke,Mke,Fke,Lke,zke,qke,Bke,Gke,Zke,Wke,Kke,Xke,Qke,eEe,tEe,rEe,nEe,iEe,oEe,F3,aEe,cEe,uEe,dEe,fEe,L3,C3,U3,q3,B3=y(()=>{P3=gke(import.meta.url);xke=/[\\/]/g;$ke=/^[a-z]:[\\/]$/i;Pke=(t,e)=>{e.push(t||".")},Cke=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},Dke=()=>{};jke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},Mke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},Fke=(t,e,r,n)=>{r.files++},Lke=(t,e)=>{e.push(t)},zke=()=>{};qke=t=>t,Bke=()=>[""].slice(0,0);Gke=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},Zke=()=>{};Wke=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()&&M3(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},Kke=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()&&M3(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};Xke=t=>t.counts,Qke=t=>t.groups,eEe=t=>t.paths,tEe=t=>t.paths.slice(0,t.options.maxFiles),rEe=(t,e,r)=>(cv(e,r,t.counts,t.options.suppressErrors),null),nEe=(t,e,r)=>(cv(e,r,t.paths,t.options.suppressErrors),null),iEe=(t,e,r)=>(cv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),oEe=(t,e,r)=>(cv(e,r,t.groups,t.options.suppressErrors),null);F3={withFileTypes:!0},aEe=(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||".",F3,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},cEe=(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||".",F3)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};uEe=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))}},dEe=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}},fEe=class{aborted=!1;abort(){this.aborted=!0}},L3=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=sEe(e,this.isSynchronous),this.root=GI(t,e),this.state={root:kke(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new dEe,options:e,queue:new uEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new fEe,fs:e.fs||Ske},this.joinPath=Oke(this.root,e),this.pushDirectory=Nke(this.root,e),this.pushFile=Uke(e),this.getArray=Hke(e),this.groupFiles=Vke(e),this.resolveSymlink=Jke(e,this.isSynchronous),this.walkDirectory=lEe(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(_=GI(_,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=yke(_),x=GI(ZI(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};C3=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return pEe(this.root,this.options)}withCallback(t){z3(this.root,this.options,t)}sync(){return mEe(this.root,this.options)}},U3=null;try{P3.resolve("picomatch"),U3=P3("picomatch")}catch{}q3=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:D3,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 C3(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new C3(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||U3;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 Kf=v((Wct,W3)=>{"use strict";var H3="[^\\\\/]",hEe="(?=.)",G3="[^/]",VI="(?:\\/|$)",Z3="(?:^|\\/)",WI=`\\.{1,2}${VI}`,gEe="(?!\\.)",yEe=`(?!${Z3}${WI})`,_Ee=`(?!\\.{0,1}${VI})`,bEe=`(?!${WI})`,vEe="[^.\\/]",SEe=`${G3}*?`,wEe="/",V3={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:hEe,QMARK:G3,END_ANCHOR:VI,DOTS_SLASH:WI,NO_DOT:gEe,NO_DOTS:yEe,NO_DOT_SLASH:_Ee,NO_DOTS_SLASH:bEe,QMARK_NO_DOT:vEe,STAR:SEe,START_ANCHOR:Z3,SEP:wEe},xEe={...V3,SLASH_LITERAL:"[\\\\/]",QMARK:H3,STAR:`${H3}*?`,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:"\\"},$Ee={__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"};W3.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:$Ee,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?xEe:V3}}});var Jf=v(Mr=>{"use strict";var{REGEX_BACKSLASH:kEe,REGEX_REMOVE_BACKSLASH:EEe,REGEX_SPECIAL_CHARS:AEe,REGEX_SPECIAL_CHARS_GLOBAL:TEe}=Kf();Mr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Mr.hasRegexChars=t=>AEe.test(t);Mr.isRegexChar=t=>t.length===1&&Mr.hasRegexChars(t);Mr.escapeRegex=t=>t.replace(TEe,"\\$1");Mr.toPosixSlashes=t=>t.replace(kEe,"/");Mr.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};Mr.removeBackslashes=t=>t.replace(EEe,e=>e==="\\"?"":e);Mr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Mr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Mr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Mr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Mr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var rJ=v((Jct,tJ)=>{"use strict";var K3=Jf(),{CHAR_ASTERISK:KI,CHAR_AT:OEe,CHAR_BACKWARD_SLASH:Yf,CHAR_COMMA:REe,CHAR_DOT:JI,CHAR_EXCLAMATION_MARK:YI,CHAR_FORWARD_SLASH:eJ,CHAR_LEFT_CURLY_BRACE:XI,CHAR_LEFT_PARENTHESES:QI,CHAR_LEFT_SQUARE_BRACKET:IEe,CHAR_PLUS:PEe,CHAR_QUESTION_MARK:J3,CHAR_RIGHT_CURLY_BRACE:CEe,CHAR_RIGHT_PARENTHESES:Y3,CHAR_RIGHT_SQUARE_BRACKET:DEe}=Kf(),X3=t=>t===eJ||t===Yf,Q3=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},NEe=(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,O=0,A,E,C={value:"",depth:0,isGlob:!1},k=()=>l>=n,q=()=>c.charCodeAt(l+1),X=()=>(A=E,c.charCodeAt(++l));for(;l0&&(I=c.slice(0,u),c=c.slice(u),d-=u),Se&&m===!0&&d>0?(Se=c.slice(0,d),P=c.slice(d)):m===!0?(Se="",P=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&X3(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),r.unescape===!0&&(P&&(P=K3.removeBackslashes(P)),Se&&_===!0&&(Se=K3.removeBackslashes(Se)));let Rr={prefix:I,input:t,start:u,base:Se,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Rr.maxDepth=0,X3(E)||s.push(C),Rr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var Xf=Kf(),nn=Jf(),{MAX_LENGTH:lv,POSIX_REGEX_SOURCE:jEe,REGEX_NON_SPECIAL_CHARS:MEe,REGEX_SPECIAL_CHARS_BACKREF:FEe,REPLACEMENTS:nJ}=Xf,LEe=(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=>nn.escapeRegex(i)).join("..")}return r},$l=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,iJ=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},zEe=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},oJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(zEe(e))return e.replace(/\\(.)/g,"$1")},UEe=t=>{let e=t.map(oJ).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}}}}},qEe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=oJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?nn.escapeRegex(r[0]):`[${r.map(i=>nn.escapeRegex(i)).join("")}]`}*`},BEe=t=>{let e=0,r=t.trim(),n=eP(r);for(;n;)e++,r=n.body.trim(),n=eP(r);return e},HEe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Xf.DEFAULT_MAX_EXTGLOB_RECURSION,n=iJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||UEe(n)))return{risky:!0};for(let i of n){let o=qEe(i);if(o)return{risky:!0,safeOutput:o};if(BEe(i)>r)return{risky:!0}}return{risky:!1}},tP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=nJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(lv,r.maxLength):lv,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=Xf.globChars(r.windows),l=Xf.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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,A=r.dot?"":h,E=r.dot?_:S,C=r.bash===!0?O(r):x;r.capture&&(C=`(${C})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let k={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=nn.removePrefix(t,k),i=t.length;let q=[],X=[],Se=[],I=o,P,Rr=()=>k.index===i-1,se=k.peek=(B=1)=>t[k.index+B],Pe=k.advance=()=>t[++k.index]||"",Vt=()=>t.slice(k.index+1),ar=(B="",ft=0)=>{k.consumed+=B,k.index+=ft},Kt=B=>{k.output+=B.output!=null?B.output:B.value,ar(B.value)},to=()=>{let B=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),k.start++,B++;return B%2===0?!1:(k.negated=!0,k.start++,!0)},yi=B=>{k[B]++,Se.push(B)},Jr=B=>{k[B]--,Se.pop()},de=B=>{if(I.type==="globstar"){let ft=k.braces>0&&(B.type==="comma"||B.type==="brace"),U=B.extglob===!0||q.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ft&&!U&&(k.output=k.output.slice(0,-I.output.length),I.type="star",I.value="*",I.output=C,k.output+=I.output)}if(q.length&&B.type!=="paren"&&(q[q.length-1].inner+=B.value),(B.value||B.output)&&Kt(B),I&&I.type==="text"&&B.type==="text"){I.output=(I.output||I.value)+B.value,I.value+=B.value;return}B.prev=I,s.push(B),I=B},ro=(B,ft)=>{let U={...l[ft],conditions:1,inner:""};U.prev=I,U.parens=k.parens,U.output=k.output,U.startIndex=k.index,U.tokensIndex=s.length;let Te=(r.capture?"(":"")+U.open;yi("parens"),de({type:B,value:ft,output:k.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Te}),q.push(U)},xue=B=>{let ft=t.slice(B.startIndex,k.index+1),U=t.slice(B.startIndex+2,k.index),Te=HEe(U,r);if((B.type==="plus"||B.type==="star")&&Te.risky){let ct=Te.safeOutput?(B.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,_i=s[B.tokensIndex];_i.type="text",_i.value=ft,_i.output=ct||nn.escapeRegex(ft);for(let bi=B.tokensIndex+1;bi1&&B.inner.includes("/")&&(ct=O(r)),(ct!==C||Rr()||/^\)+$/.test(Vt()))&&(lt=B.close=`)$))${ct}`),B.inner.includes("*")&&(jt=Vt())&&/^\.[^\\/.]+$/.test(jt)){let _i=tP(jt,{...e,fastpaths:!1}).output;lt=B.close=`)${_i})${ct})`}B.prev.type==="bos"&&(k.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:lt}),Jr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ft=t.replace(FEe,(U,Te,lt,jt,ct,_i)=>jt==="\\"?(B=!0,U):jt==="?"?Te?Te+jt+(ct?_.repeat(ct.length):""):_i===0?E+(ct?_.repeat(ct.length):""):_.repeat(lt.length):jt==="."?u.repeat(lt.length):jt==="*"?Te?Te+jt+(ct?C:""):C:Te?U:`\\${U}`);return B===!0&&(r.unescape===!0?ft=ft.replace(/\\/g,""):ft=ft.replace(/\\+/g,U=>U.length%2===0?"\\\\":U?"\\":"")),ft===t&&r.contains===!0?(k.output=t,k):(k.output=nn.wrapOutput(ft,k,e),k)}for(;!Rr();){if(P=Pe(),P==="\0")continue;if(P==="\\"){let U=se();if(U==="/"&&r.bash!==!0||U==="."||U===";")continue;if(!U){P+="\\",de({type:"text",value:P});continue}let Te=/^\\+/.exec(Vt()),lt=0;if(Te&&Te[0].length>2&&(lt=Te[0].length,k.index+=lt,lt%2!==0&&(P+="\\")),r.unescape===!0?P=Pe():P+=Pe(),k.brackets===0){de({type:"text",value:P});continue}}if(k.brackets>0&&(P!=="]"||I.value==="["||I.value==="[^")){if(r.posix!==!1&&P===":"){let U=I.value.slice(1);if(U.includes("[")&&(I.posix=!0,U.includes(":"))){let Te=I.value.lastIndexOf("["),lt=I.value.slice(0,Te),jt=I.value.slice(Te+2),ct=jEe[jt];if(ct){I.value=lt+ct,k.backtrack=!0,Pe(),!o.output&&s.indexOf(I)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(I.value==="["||I.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&I.value==="["&&(P="^"),I.value+=P,Kt({value:P});continue}if(k.quotes===1&&P!=='"'){P=nn.escapeRegex(P),I.value+=P,Kt({value:P});continue}if(P==='"'){k.quotes=k.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){yi("parens"),de({type:"paren",value:P});continue}if(P===")"){if(k.parens===0&&r.strictBrackets===!0)throw new SyntaxError($l("opening","("));let U=q[q.length-1];if(U&&k.parens===U.parens+1){xue(q.pop());continue}de({type:"paren",value:P,output:k.parens?")":"\\)"}),Jr("parens");continue}if(P==="["){if(r.nobracket===!0||!Vt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError($l("closing","]"));P=`\\${P}`}else yi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||I&&I.type==="bracket"&&I.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if(k.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError($l("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Jr("brackets");let U=I.value.slice(1);if(I.posix!==!0&&U[0]==="^"&&!U.includes("/")&&(P=`/${P}`),I.value+=P,Kt({value:P}),r.literalBrackets===!1||nn.hasRegexChars(U))continue;let Te=nn.escapeRegex(I.value);if(k.output=k.output.slice(0,-I.value.length),r.literalBrackets===!0){k.output+=Te,I.value=Te;continue}I.value=`(${a}${Te}|${I.value})`,k.output+=I.value;continue}if(P==="{"&&r.nobrace!==!0){yi("braces");let U={type:"brace",value:P,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};X.push(U),de(U);continue}if(P==="}"){let U=X[X.length-1];if(r.nobrace===!0||!U){de({type:"text",value:P,output:P});continue}let Te=")";if(U.dots===!0){let lt=s.slice(),jt=[];for(let ct=lt.length-1;ct>=0&&(s.pop(),lt[ct].type!=="brace");ct--)lt[ct].type!=="dots"&&jt.unshift(lt[ct].value);Te=LEe(jt,r),k.backtrack=!0}if(U.comma!==!0&&U.dots!==!0){let lt=k.output.slice(0,U.outputIndex),jt=k.tokens.slice(U.tokensIndex);U.value=U.output="\\{",P=Te="\\}",k.output=lt;for(let ct of jt)k.output+=ct.output||ct.value}de({type:"brace",value:P,output:Te}),Jr("braces"),X.pop();continue}if(P==="|"){q.length>0&&q[q.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let U=P,Te=X[X.length-1];Te&&Se[Se.length-1]==="braces"&&(Te.comma=!0,U="|"),de({type:"comma",value:P,output:U});continue}if(P==="/"){if(I.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",s.pop(),I=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if(k.braces>0&&I.type==="dot"){I.value==="."&&(I.output=u);let U=X[X.length-1];I.type="dots",I.output+=P,I.value+=P,U.dots=!0;continue}if(k.braces+k.parens===0&&I.type!=="bos"&&I.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(I&&I.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){ro("qmark",P);continue}if(I&&I.type==="paren"){let Te=se(),lt=P;(I.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Vt()))&&(lt=`\\${P}`),de({type:"text",value:P,output:lt});continue}if(r.dot!==!0&&(I.type==="slash"||I.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){ro("negate",P);continue}if(r.nonegate!==!0&&k.index===0){to();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){ro("plus",P);continue}if(I&&I.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(I&&(I.type==="bracket"||I.type==="paren"||I.type==="brace")||k.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let U=MEe.exec(Vt());U&&(P+=U[0],k.index+=U[0].length),de({type:"text",value:P});continue}if(I&&(I.type==="globstar"||I.star===!0)){I.type="star",I.star=!0,I.value+=P,I.output=C,k.backtrack=!0,k.globstar=!0,ar(P);continue}let B=Vt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){ro("star",P);continue}if(I.type==="star"){if(r.noglobstar===!0){ar(P);continue}let U=I.prev,Te=U.prev,lt=U.type==="slash"||U.type==="bos",jt=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!lt||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let ct=k.braces>0&&(U.type==="comma"||U.type==="brace"),_i=q.length&&(U.type==="pipe"||U.type==="paren");if(!lt&&U.type!=="paren"&&!ct&&!_i){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let bi=t[k.index+4];if(bi&&bi!=="/")break;B=B.slice(3),ar("/**",3)}if(U.type==="bos"&&Rr()){I.type="globstar",I.value+=P,I.output=O(r),k.output=I.output,k.globstar=!0,ar(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&!jt&&Rr()){k.output=k.output.slice(0,-(U.output+I.output).length),U.output=`(?:${U.output}`,I.type="globstar",I.output=O(r)+(r.strictSlashes?")":"|$)"),I.value+=P,k.globstar=!0,k.output+=U.output+I.output,ar(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&B[0]==="/"){let bi=B[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(U.output+I.output).length),U.output=`(?:${U.output}`,I.type="globstar",I.output=`${O(r)}${f}|${f}${bi})`,I.value+=P,k.output+=U.output+I.output,k.globstar=!0,ar(P+Pe()),de({type:"slash",value:"/",output:""});continue}if(U.type==="bos"&&B[0]==="/"){I.type="globstar",I.value+=P,I.output=`(?:^|${f}|${O(r)}${f})`,k.output=I.output,k.globstar=!0,ar(P+Pe()),de({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-I.output.length),I.type="globstar",I.output=O(r),I.value+=P,k.output+=I.output,k.globstar=!0,ar(P);continue}let ft={type:"star",value:P,output:C};if(r.bash===!0){ft.output=".*?",(I.type==="bos"||I.type==="slash")&&(ft.output=A+ft.output),de(ft);continue}if(I&&(I.type==="bracket"||I.type==="paren")&&r.regex===!0){ft.output=P,de(ft);continue}(k.index===k.start||I.type==="slash"||I.type==="dot")&&(I.type==="dot"?(k.output+=g,I.output+=g):r.dot===!0?(k.output+=b,I.output+=b):(k.output+=A,I.output+=A),se()!=="*"&&(k.output+=p,I.output+=p)),de(ft)}for(;k.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError($l("closing","]"));k.output=nn.escapeLast(k.output,"["),Jr("brackets")}for(;k.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError($l("closing",")"));k.output=nn.escapeLast(k.output,"("),Jr("parens")}for(;k.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError($l("closing","}"));k.output=nn.escapeLast(k.output,"{"),Jr("braces")}if(r.strictSlashes!==!0&&(I.type==="star"||I.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),k.backtrack===!0){k.output="";for(let B of k.tokens)k.output+=B.output!=null?B.output:B.value,B.suffix&&(k.output+=B.suffix)}return k};tP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(lv,r.maxLength):lv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=nJ[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}=Xf.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 E=/^(.*?)\.(\w+)$/.exec(A);if(!E)return;let C=x(E[1]);return C?C+o+E[2]:void 0}}},w=nn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};sJ.exports=tP});var uJ=v((Xct,lJ)=>{"use strict";var GEe=rJ(),rP=aJ(),cJ=Jf(),ZEe=Kf(),VEe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=VEe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?cJ.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(cJ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):rP(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>GEe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=rP.fastpaths(t,e)),i.output||(i=rP(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=ZEe;lJ.exports=Tt});var mJ=v((Qct,pJ)=>{"use strict";var dJ=uJ(),WEe=Jf();function fJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:WEe.isWindows()}),dJ(t,e,r)}Object.assign(fJ,dJ);pJ.exports=fJ});import{readdir as KEe,readdirSync as JEe,realpath as YEe,realpathSync as XEe,stat as QEe,statSync as eAe}from"fs";import{isAbsolute as tAe,posix as Na,resolve as rAe}from"path";import{fileURLToPath as nAe}from"url";function sAe(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]===".."&&oAe.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=>Na.relative(t,n)||".":n=>Na.relative(t,`${e}/${n}`)||"."}function lAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Na.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function _J(t){var e;let r=kl.default.scan(t,uAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function gAe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=kl.default.scan(t);return r.isGlob||r.negated}function Qf(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function bJ(t){return typeof t=="string"?[t]:t??[]}function nP(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=hAe(o);s=tAe(s.replace(_Ae,""))?Na.relative(a,s):Na.normalize(s);let c=(i=yAe.exec(s))===null||i===void 0?void 0:i[0],l=_J(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?Na.join(o,...d):o}return s}function bAe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(nP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(nP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(nP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function vAe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=bAe(t,e,n);t.debug&&Qf("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(gJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,kl.default)(i.match,f),m=(0,kl.default)(i.ignore,f),h=sAe(i.match,f),g=hJ(r,d,o),b=o?g:hJ(r,d,!0),_=(w,O)=>{let A=b(O,!0);return A!=="."&&!h(A)||m(A)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new q3({filters:[a?(w,O)=>{let A=g(w,O),E=p(A)&&!m(A);return E&&Qf(`matched ${A}`),E}:(w,O)=>{let A=g(w,O);return p(A)&&!m(A)}],exclude:a?(w,O)=>{let A=_(w,O);return Qf(`${A?"skipped":"crawling"} ${O}`),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&&Qf("internal properties:",{...n,root:d}),[x,r!==d&&!o&&lAe(r,d)]}function SAe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function xAe(t){let e={...wAe,...t};return e.cwd=(e.cwd instanceof URL?nAe(e.cwd):rAe(e.cwd)).replace(gJ,"/"),e.ignore=bJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||KEe,readdirSync:e.fs.readdirSync||JEe,realpath:e.fs.realpath||YEe,realpathSync:e.fs.realpathSync||XEe,stat:e.fs.stat||QEe,statSync:e.fs.statSync||eAe}),e.debug&&Qf("globbing with options:",e),e}function $Ae(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=iAe(t)||typeof t=="string",i=bJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=xAe(n?e:t);return i.length>0?vAe(o,i):[]}function cs(t,e){let[r,n]=$Ae(t,e);return r?SAe(r.sync(),n):[]}var kl,iAe,gJ,yJ,oAe,aAe,cAe,uAe,dAe,fAe,pAe,mAe,hAe,yAe,_Ae,wAe,ep=y(()=>{B3();kl=Et(mJ(),1),iAe=Array.isArray,gJ=/\\/g,yJ=process.platform==="win32",oAe=/^(\/?\.\.)+$/;aAe=/^[A-Z]:\/$/i,cAe=yJ?t=>aAe.test(t):t=>t==="/";uAe={parts:!0};dAe=/(?t.replace(dAe,"\\$&"),mAe=t=>t.replace(fAe,"\\$&"),hAe=yJ?mAe:pAe;yAe=/^(\/?\.\.)+/,_Ae=/\\(?=[()[\]{}!*+?@|])/g;wAe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as tp,readFileSync as kAe,readdirSync as EAe,statSync as vJ}from"node:fs";import{join as ja}from"node:path";function AAe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Ri(e,n),o=[],{layers:s,forbiddenImports:a}=iP(r);return(s.size>0||a.length>0)&&!tp(ja(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&&(TAe(e,i,s,o),OAe(e,i,s,o)),a.length>0&&RAe(e,i,a,o),o)}function iP(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 TAe(t,e,r,n){let i=e.mainRoot,o=ja(t,i);if(tp(o))for(let s of EAe(o)){let a=ja(o,s);vJ(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 OAe(t,e,r,n){let i=e.mainRoot,o=ja(t,i);if(tp(o))for(let s of r){let a=ja(o,s);tp(a)&&vJ(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 RAe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=ja(t,i,s.from);if(!tp(a))continue;let c=cs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=ja(a,l),d;try{d=kAe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];IAe(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 IAe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var rp,SJ,oP=y(()=>{"use strict";ep();qe();Da();rp="ARCHITECTURE_FROM_SPEC";SJ={name:rp,run:AAe}});import{existsSync as PAe,readFileSync as CAe}from"node:fs";import{join as DAe}from"node:path";function NAe(t){let{cwd:e="."}=t,r=DAe(e,"spec/capabilities.yaml");if(!PAe(r))return[];let n;try{let c=CAe(r,"utf8"),l=wJ.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=H(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:uv,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:uv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:uv,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var wJ,uv,xJ,$J=y(()=>{"use strict";wJ=Et(cr(),1);qe();uv="CAPABILITIES_FEATURE_MAPPING";xJ={name:uv,run:NAe}});import{existsSync as jAe,readFileSync as MAe}from"node:fs";import{join as FAe}from"node:path";function LAe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function zAe(t){let{cwd:e="."}=t;return he(e,sP,r=>UAe(r,e))}function UAe(t,e){let r=Ri(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=FAe(e,o);if(!jAe(s))continue;let a=MAe(s,"utf8");LAe(a)||n.push({detector:sP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var sP,kJ,EJ=y(()=>{"use strict";Da();bt();sP="CONVENTION_DRIFT";kJ={name:sP,run:zAe}});import{existsSync as aP,readFileSync as AJ}from"node:fs";import{join as dv}from"node:path";function qAe(t){return JSON.parse(t).total?.lines?.pct??0}function TJ(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function GAe(t,e){if(!Vb(ht(t).gates.coverage?.cmd))return null;let r;try{r=Wb(t,e)}catch(c){return[{detector:go,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=LI.find(d=>aP(dv(c.dir,d)));if(!l){s.push(c.path);continue}let u=TJ(AJ(dv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:go,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=OJ(n,i);return a0?[{detector:go,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function ZAe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=GAe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Ri(e,r),i=ht(e).language==="kotlin"?LI.find(a=>aP(dv(e,a)))??d3(e):n.coverageSummary,o=dv(e,i);if(!aP(o))return[{detector:go,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=AJ(o,"utf8");s=n.coverageFormat==="jacoco-xml"?BAe(a):n.coverageFormat==="cobertura-xml"?HAe(a):qAe(a)}catch(a){return[{detector:go,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:go,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=fv?[]:[{detector:go,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${fv}%`}]}var go,fv,RJ,IJ=y(()=>{"use strict";qe();Xb();Da();Kb();En();go="COVERAGE_DROP",fv=70;RJ={name:go,run:ZAe}});import{existsSync as VAe}from"node:fs";import{join as WAe}from"node:path";function KAe(t){let{cwd:e="."}=t;return he(e,pv,r=>JAe(r,e))}function JAe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?VAe(WAe(e,r.path))?[]:[{detector:pv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:pv,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var pv,PJ,CJ=y(()=>{"use strict";bt();pv="DELIVERABLE_INTEGRITY";PJ={name:pv,run:KAe}});function YAe(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:mv,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 XAe(t){let e=YAe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:mv,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 QAe(t){let{cwd:e="."}=t;return he(e,mv,r=>XAe(r))}var mv,DJ,NJ=y(()=>{"use strict";bt();mv="SMOKE_PROBE_DEMAND";DJ={name:mv,run:QAe}});function eTe(t){let{cwd:e="."}=t;return he(e,hv,r=>tTe(r,e))}function tTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=Qo(e);if(n===null)return[{detector:hv,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=p_(n,e,o);s.state!=="fresh"&&i.push({detector:hv,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 hv,gv,cP=y(()=>{"use strict";tl();bt();hv="STALE_ATTESTATION";gv={name:hv,run:eTe}});function rTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return nTe(r)}function nTe(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:jJ,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 jJ,yv,lP=y(()=>{"use strict";qe();jJ="DEPENDENCY_CYCLE";yv={name:jJ,run:rTe}});import{appendFileSync as iTe,existsSync as MJ,mkdirSync as oTe,readFileSync as sTe}from"node:fs";import{dirname as aTe,join as cTe}from"node:path";function FJ(t){return cTe(t,lTe,uTe)}function LJ(t){return uP.add(t),()=>uP.delete(t)}function Ma(t,e){let r=FJ(t),n=aTe(r);MJ(n)||oTe(n,{recursive:!0}),iTe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of uP)try{i(t,e)}catch{}}function Tn(t){let e=FJ(t);if(!MJ(e))return[];let r=sTe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var lTe,uTe,uP,Xn=y(()=>{"use strict";lTe=".cladding",uTe="audit.log.jsonl";uP=new Set});import{existsSync as dTe}from"node:fs";import{join as fTe}from"node:path";function pTe(t){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return[{detector:dP,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&&(dTe(fTe(e,i.artifact))||n.push({detector:dP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var dP,zJ,UJ=y(()=>{"use strict";Xn();dP="EVIDENCE_MISMATCH";zJ={name:dP,run:pTe}});import{existsSync as mTe,readFileSync as hTe}from"node:fs";import{join as gTe}from"node:path";function yTe(t){let e=gTe(t,GJ);if(!mTe(e))return null;try{let n=((0,HJ.parse)(hTe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*BJ(t,e){for(let r of t??[])r.startsWith(qJ)&&(yield{ref:r,name:r.slice(qJ.length),field:e})}function _Te(t){let{cwd:e="."}=t,r=yTe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:fP,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=[...BJ(s.evidence_refs,"evidence_refs"),...BJ(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:fP,severity:"warn",path:GJ,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var HJ,fP,qJ,GJ,ZJ,VJ=y(()=>{"use strict";HJ=Et(cr(),1);qe();fP="FIXTURE_REFERENCE_INVALID",qJ="fixture:",GJ="conformance/fixtures.yaml";ZJ={name:fP,run:_Te}});import{existsSync as El,readFileSync as pP}from"node:fs";import{join as Fa}from"node:path";function bTe(t){return cs(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function np(t){if(!El(t))return null;try{return JSON.parse(pP(t,"utf8"))}catch{return null}}function vTe(t,e){let r=Fa(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(pP(r,"utf8"))}catch(c){e.push({detector:yo,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:yo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=bTe(t);s!==a&&e.push({detector:yo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function STe(t,e){for(let r of WJ){let n=Fa(t,r.path);if(!El(n))continue;let i=np(n);if(!i){e.push({detector:yo,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:yo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function wTe(t,e){let r=np(Fa(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of WJ){let s=Fa(t,o.path);if(!El(s))continue;let a=np(s);a?.version&&a.version!==n&&e.push({detector:yo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Fa(t,".claude-plugin","marketplace.json");if(El(i)){let o=np(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:yo,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 xTe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function $Te(t,e){let r=Fa(t,"src","cli","clad.ts"),n=Fa(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!El(r)||!El(n))return;let i=xTe(pP(r,"utf8"));if(i.length===0)return;let s=np(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:yo,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 kTe(t){let{cwd:e="."}=t,r=[];return vTe(e,r),$Te(e,r),STe(e,r),wTe(e,r),r}var yo,WJ,KJ,JJ=y(()=>{"use strict";ep();yo="HARNESS_INTEGRITY",WJ=[{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"]}];KJ={name:yo,run:kTe}});import{existsSync as ETe,readFileSync as ATe}from"node:fs";import{join as TTe}from"node:path";function RTe(t){let{cwd:e="."}=t;return he(e,_v,r=>PTe(r,e))}function ITe(t){let e=TTe(t,"spec/capabilities.yaml");if(!ETe(e))return!1;try{let r=YJ.default.parse(ATe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function PTe(t,e){let r=t.features.length;if(r{"use strict";YJ=Et(cr(),1);bt();_v="HOLLOW_GOVERNANCE",OTe=8;XJ={name:_v,run:RTe}});import{existsSync as e8,readFileSync as t8}from"node:fs";import{join as r8}from"node:path";function n8(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 NTe(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 jTe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function MTe(t){let e=r8(t,"README.md"),r=r8(t,"docs","dogfood","matrix.md");if(!e8(e)||!e8(r))return[];let n=n8(t8(e,"utf8"),CTe),i=n8(t8(r,"utf8"),DTe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=jTe(a);if(c===null)continue;let l=i[s]??"not-run",u=NTe(l);u!==null&&c>u&&o.push({detector:i8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function FTe(t){let{cwd:e="."}=t;return MTe(e)}var i8,CTe,DTe,o8,s8=y(()=>{"use strict";i8="HOST_CLAIM_DRIFT",CTe=//,DTe=//;o8={name:i8,run:FTe}});function LTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return a8(r.features.map(i=>i.id),"feature","spec/features/",n),a8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function a8(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:c8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var c8,l8,u8=y(()=>{"use strict";qe();c8="ID_COLLISION";l8={name:c8,run:LTe}});import{existsSync as ip,readFileSync as mP,readdirSync as hP,statSync as zTe,writeFileSync as f8}from"node:fs";import{join as _o}from"node:path";function d8(t){if(!ip(t))return 0;try{return hP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function UTe(t){if(!ip(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=hP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=_o(n,o),a;try{a=zTe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function qTe(t){let e=_o(t,"spec","capabilities.yaml");if(!ip(e))return 0;try{let r=bv.default.parse(mP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ls(t="."){let e=d8(_o(t,"spec","features")),r=d8(_o(t,"spec","scenarios")),n=qTe(t),i=UTe(_o(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Al(t,e){let r=_o(t,"spec.yaml");if(!ip(r))return;let n=mP(r,"utf8"),i=BTe(n,e);i!==n&&f8(r,i)}function BTe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as Pwe}from"node:buffer";import{StringDecoder as Cwe}from"node:string_decoder";var $b,Dwe,Nwe,jwe,MR=y(()=>{tn();$b=(t,e,r)=>{if(r)return;if(t)return{transform:Dwe.bind(void 0,new TextEncoder)};let n=new Cwe(e);return{transform:Nwe.bind(void 0,n),final:jwe.bind(void 0,n)}},Dwe=function*(t,e){Pwe.isBuffer(e)?yield lo(e):typeof e=="string"?yield t.encode(e):yield e},Nwe=function*(t,e){yield Ft(e)?t.write(e):e},jwe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as rW}from"node:util";var FR,kb,nW,Mwe,iW,Fwe,oW=y(()=>{FR=rW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),kb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Fwe}=e[r];for await(let i of n(t))yield*kb(i,e,r+1)},nW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Mwe(r,Number(e),t)},Mwe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*kb(n,r,e+1)},iW=rW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Fwe=function*(t){yield t}});var LR,sW,Ta,qf,Lwe,zwe,zR=y(()=>{LR=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},sW=(t,e)=>[...e.flatMap(r=>[...Ta(r,t,0)]),...qf(t)],Ta=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=zwe}=e[r];for(let i of n(t))yield*Ta(i,e,r+1)},qf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Lwe(r,Number(e),t)},Lwe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ta(n,r,e+1)},zwe=function*(t){yield t}});import{Transform as Uwe,getDefaultHighWaterMark as aW}from"node:stream";var UR,Eb,cW,Ab=y(()=>{_r();xb();tW();MR();oW();zR();UR=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=cW(t,s,o),l=Aa(e),u=Aa(r),d=l?FR.bind(void 0,kb,a):LR.bind(void 0,Ta),f=l||u?FR.bind(void 0,nW,a):LR.bind(void 0,qf),p=l||u?iW.bind(void 0,a):void 0;return{stream:new Uwe({writableObjectMode:n,writableHighWaterMark:aW(n),readableObjectMode:i,readableHighWaterMark:aW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Eb=(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=cW(s,r,a);t=sW(c,t)}return t},cW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:XV(n,a)},$b(r,s,n),wb(r,o,n,c),{transform:t,final:e},{transform:QV(i,a)},YV({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var lW,qwe,Bwe,Hwe,Gwe,uW=y(()=>{Ab();tn();_r();lW=(t,e)=>{for(let r of qwe(t))Bwe(t,r,e)},qwe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Bwe=(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 ${as[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Hwe(a,n));r.input=Ef(s)},Hwe=(t,e)=>{let r=Eb(t,e,"utf8",!0);return Gwe(r),Ef(r)},Gwe=t=>{let e=t.find(r=>typeof r!="string"&&!Ft(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 Tb,Zwe,Vwe,dW,fW,Wwe,pW,qR=y(()=>{xa();_r();cl();ns();Tb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&al(r,n)&&!rn.has(e)&&Zwe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Vwe.has(o))||t.every(({type:i})=>kn.has(i))),Zwe=t=>t===1||t===2,Vwe=new Set(["pipe","overlapped"]),dW=async(t,e,r,n)=>{for await(let i of t)Wwe(e)||pW(i,r,n)},fW=(t,e,r)=>{for(let n of t)pW(n,e,r)},Wwe=t=>t._readableState.pipes.length>0,pW=(t,e,r)=>{let n=A_(t);ki({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Kwe,appendFileSync as Jwe}from"node:fs";var mW,Ywe,Xwe,Qwe,exe,txe,hW=y(()=>{qR();Ab();xb();tn();_r();Ea();mW=({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)=>Ywe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Ywe=({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=Q9(t,o,d),p=lo(f),{stdioItems:m,objectMode:h}=e[r],g=Xwe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Qwe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});exe({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&&txe(b,m,i),S}catch(x){return n.error=x,S}},Xwe=(t,e,r,n)=>{try{return Eb(t,e,r,!1)}catch(i){return n.error=i,t}},Qwe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Ef(t)};let s=BH(t,r);return n[o]?{serializedResult:s,finalResult:jR(s,!i[o],e)}:{serializedResult:s}},exe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Tb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=jR(t,!1,s);try{fW(a,e,n)}catch(c){r.error??=c}},txe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>bb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Jwe(n,t):(r.add(o),Kwe(n,t))}}});var gW,yW=y(()=>{tn();Uf();gW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ho(e,r,"all")]:Array.isArray(e)?[ho(t,r,"all"),...e]:Ft(t)&&Ft(e)?IO([t,e]):`${t}${e}`}});import{once as BR}from"node:events";var _W,rxe,bW,vW,nxe,HR,GR=y(()=>{Sa();_W=async(t,e)=>{let[r,n]=await rxe(t);return e.isForcefullyTerminated??=!1,[r,n]},rxe=async t=>{let[e,r]=await Promise.allSettled([BR(t,"spawn"),BR(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?bW(t):r.value},bW=async t=>{try{return await BR(t,"exit")}catch{return bW(t)}},vW=async t=>{let[e,r]=await t;if(!nxe(e,r)&&HR(e,r))throw new Kn;return[e,r]},nxe=(t,e)=>t===void 0&&e===void 0,HR=(t,e)=>t!==0||e!==null});var SW,ixe,wW=y(()=>{Sa();Ea();GR();SW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=ixe(t,e,r),s=o?.code==="ETIMEDOUT",a=X9(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},ixe=(t,e,r)=>t!==void 0?t:HR(e,r)?new Kn:void 0});import{spawnSync as oxe}from"node:child_process";var xW,sxe,axe,cxe,Ob,lxe,uxe,dxe,fxe,$W=y(()=>{zO();mR();hR();zf();gb();WV();Uf();uW();hW();Ea();yW();wW();xW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=sxe(t,e,r),d=lxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return bl(d,c,l)},sxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=R_(t,e,r),a=axe(r),{file:c,commandArguments:l,options:u}=nb(t,e,a);cxe(u);let d=ZV(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},axe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,cxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Ob("ipcInput"),t&&Ob("ipc: true"),r&&Ob("detached: true"),n&&Ob("cancelSignal")},Ob=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},lxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=uxe({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}=SW(c,r),{output:m,error:h=l}=mW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ho(_,r,S)),b=ho(gW(m,r),r,"all");return fxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},uxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{lW(o,r);let a=dxe(r);return oxe(...ib(t,e,a))}catch(a){return _l({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},dxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:mb(e)}),fxe=({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?hb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Lf({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 ZR,on as pxe}from"node:events";var kW,mxe,hxe,gxe,yxe,EW=y(()=>{pl();Df();Cf();kW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(dl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:J_(t)}),mxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),mxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{B_(e,i);let o=ss(t,e,r),s=new AbortController;try{return await Promise.race([hxe(o,n,s),gxe(o,r,s),yxe(o,r,s)])}catch(a){throw fl(t),a}finally{s.abort(),H_(e,i)}},hxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await ZR(t,"message",{signal:r});return n}for await(let[n]of pxe(t,"message",{signal:r}))if(e(n))return n},gxe=async(t,e,{signal:r})=>{await ZR(t,"disconnect",{signal:r}),MZ(e)},yxe=async(t,e,{signal:r})=>{let[n]=await ZR(t,"strict:error",{signal:r});throw L_(n,e)}});import{once as TW,on as _xe}from"node:events";var OW,VR,bxe,vxe,Sxe,AW,WR=y(()=>{pl();Df();Cf();OW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>VR({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),VR=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{dl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:J_(t)}),B_(e,o);let s=ss(t,e,r),a=new AbortController,c={};return bxe(t,s,a),vxe({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),Sxe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},bxe=async(t,e,r)=>{try{await TW(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},vxe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await TW(t,"strict:error",{signal:r.signal});n.error=L_(i,e),r.abort()}catch{}},Sxe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of _xe(r,"message",{signal:o.signal}))AW(s),yield c}catch{AW(s)}finally{o.abort(),H_(e,a),n||fl(t),i&&await t}},AW=({error:t})=>{if(t)throw t}});import RW from"node:process";var IW,PW,CW,KR=y(()=>{tb();EW();WR();W_();IW=(t,{ipc:e})=>{Object.assign(t,CW(t,!1,e))},PW=()=>{let t=RW,e=!0,r=RW.channel!==void 0;return{...CW(t,e,r),getCancelSignal:d9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},CW=(t,e,r)=>({sendMessage:eb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:kW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:OW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as wxe}from"node:child_process";import{PassThrough as xxe,Readable as $xe,Writable as kxe,Duplex as Exe}from"node:stream";var DW,Axe,Bf,Txe,Oxe,Rxe,Ixe,NW=y(()=>{Sb();zf();gb();DW=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{CR(n);let a=new wxe;Axe(a,n),Object.assign(a,{readable:Txe,writable:Oxe,duplex:Rxe});let c=_l({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=Ixe(c,s,i);return{subprocess:a,promise:l}},Axe=(t,e)=>{let r=Bf(),n=Bf(),i=Bf(),o=Array.from({length:e.length-3},Bf),s=Bf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Bf=()=>{let t=new xxe;return t.end(),t},Txe=()=>new $xe({read(){}}),Oxe=()=>new kxe({write(){}}),Rxe=()=>new Exe({read(){},write(){}}),Ixe=async(t,e,r)=>bl(t,e,r)});import{createReadStream as jW,createWriteStream as MW}from"node:fs";import{Buffer as Pxe}from"node:buffer";import{Readable as Hf,Writable as Cxe,Duplex as Dxe}from"node:stream";var LW,Gf,FW,Nxe,zW=y(()=>{Ab();Sb();_r();LW=(t,e)=>vb(Nxe,t,e,!1),Gf=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${as[t]}.`)},FW={fileNumber:Gf,generator:UR,asyncGenerator:UR,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Dxe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Nxe={input:{...FW,fileUrl:({value:t})=>({stream:jW(t)}),filePath:({value:{file:t}})=>({stream:jW(t)}),webStream:({value:t})=>({stream:Hf.fromWeb(t)}),iterable:({value:t})=>({stream:Hf.from(t)}),asyncIterable:({value:t})=>({stream:Hf.from(t)}),string:({value:t})=>({stream:Hf.from(t)}),uint8Array:({value:t})=>({stream:Hf.from(Pxe.from(t))})},output:{...FW,fileUrl:({value:t})=>({stream:MW(t)}),filePath:({value:{file:t,append:e}})=>({stream:MW(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Cxe.fromWeb(t)}),iterable:Gf,asyncIterable:Gf,string:Gf,uint8Array:Gf}}});import{on as jxe,once as UW}from"node:events";import{PassThrough as Mxe,getDefaultHighWaterMark as Fxe}from"node:stream";import{finished as HW}from"node:stream/promises";function Oa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)YR(i);let e=t.some(({readableObjectMode:i})=>i),r=Lxe(t,e),n=new JR({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Lxe,JR,zxe,Uxe,qxe,YR,Bxe,Hxe,Gxe,Zxe,Vxe,GW,ZW,XR,VW,Wxe,Rb,qW,BW,Ib=y(()=>{Lxe=(t,e)=>{if(t.length===0)return Fxe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},JR=class extends Mxe{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(YR(e),this.#t.has(e))return;this.#t.add(e),this.#n??=zxe(this,this.#t,this.#o);let r=Bxe({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(YR(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)}},zxe=async(t,e,r)=>{Rb(t,qW);let n=new AbortController;try{await Promise.race([Uxe(t,n),qxe(t,e,r,n)])}finally{n.abort(),Rb(t,-qW)}},Uxe=async(t,{signal:e})=>{try{await HW(t,{signal:e,cleanup:!0})}catch(r){throw GW(t,r),r}},qxe=async(t,e,r,{signal:n})=>{for await(let[i]of jxe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},YR=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Bxe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Rb(t,BW);let a=new AbortController;try{await Promise.race([Hxe(o,e,a),Gxe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Zxe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Rb(t,-BW)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?XR(t):Vxe(t))},Hxe=async(t,e,{signal:r})=>{try{await t,r.aborted||XR(e)}catch(n){r.aborted||GW(e,n)}},Gxe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await HW(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;ZW(s)?i.add(e):VW(t,s)}},Zxe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await UW(t,i,{signal:o}),!t.readable)return UW(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},Vxe=t=>{t.writable&&t.end()},GW=(t,e)=>{ZW(e)?XR(t):VW(t,e)},ZW=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",XR=t=>{(t.readable||t.writable)&&t.destroy()},VW=(t,e)=>{t.destroyed||(t.once("error",Wxe),t.destroy(e))},Wxe=()=>{},Rb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},qW=2,BW=1});import{finished as WW}from"node:stream/promises";var Sl,Kxe,QR,Jxe,eI,Pb=y(()=>{uo();Sl=(t,e)=>{t.pipe(e),Kxe(t,e),Jxe(t,e)},Kxe=async(t,e)=>{if(!(Wn(t)||Wn(e))){try{await WW(t,{cleanup:!0,readable:!0,writable:!1})}catch{}QR(e)}},QR=t=>{t.writable&&t.end()},Jxe=async(t,e)=>{if(!(Wn(t)||Wn(e))){try{await WW(e,{cleanup:!0,readable:!1,writable:!0})}catch{}eI(t)}},eI=t=>{t.readable&&t.destroy()}});var KW,Yxe,Xxe,Qxe,e0e,t0e,JW=y(()=>{Ib();uo();q_();_r();Pb();KW=(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})=>kn.has(c)))Yxe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!kn.has(c)))Qxe({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]:Oa(o);Sl(s,i)}},Yxe=(t,e,r,n)=>{r==="output"?Sl(t.stdio[n],e):Sl(e,t.stdio[n]);let i=Xxe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Xxe=["stdin","stdout","stderr"],Qxe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;e0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},e0e=(t,{signal:e})=>{Wn(t)&&wa(t,t0e,e)},t0e=2});var Ra,YW=y(()=>{Ra=[];Ra.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ra.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ra.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Cb,tI,rI,r0e,nI,Db,n0e,iI,oI,sI,XW,not,iot,QW=y(()=>{YW();Cb=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",tI=Symbol.for("signal-exit emitter"),rI=globalThis,r0e=Object.defineProperty.bind(Object),nI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(rI[tI])return rI[tI];r0e(rI,tI,{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}},Db=class{},n0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),iI=class extends Db{onExit(){return()=>{}}load(){}unload(){}},oI=class extends Db{#t=sI.platform==="win32"?"SIGINT":"SIGHUP";#r=new nI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ra)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(!Cb(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 Ra)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,Ra.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 Cb(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"&&Cb(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)}},sI=globalThis.process,{onExit:XW,load:not,unload:iot}=n0e(Cb(sI)?new oI(sI):new iI)});import{addAbortListener as i0e}from"node:events";var eK,tK=y(()=>{QW();eK=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=XW(()=>{t.kill()});i0e(n,()=>{i()})}});var nK,o0e,s0e,rK,a0e,iK=y(()=>{RO();O_();os();ol();nK=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=T_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=o0e(r,n,i),{sourceStream:d,sourceError:f}=a0e(t,l),{options:p,fileDescriptors:m}=Ai.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},o0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=s0e(t,e,...r),a=U_(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},s0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(rK,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||TO(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]=y_(r,...n);return{destination:e(rK)(i,o,s),pipeOptions:s}}if(Ai.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}`)},rK=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),a0e=(t,e)=>{try{return{sourceStream:hl(t,e)}}catch(r){return{sourceError:r}}}});var sK,c0e,aI,oK,cI=y(()=>{zf();Pb();sK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=c0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw aI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},c0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return eI(t),n;if(e!==void 0)return QR(r),e},aI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>_l({error:t,command:oK,escapedCommand:oK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),oK="source.pipe(destination)"});var aK,cK=y(()=>{aK=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 l0e}from"node:stream/promises";var lK,u0e,d0e,f0e,Nb,p0e,m0e,uK=y(()=>{Ib();q_();Pb();lK=(t,e,r)=>{let n=Nb.has(e)?d0e(t,e):u0e(t,e);return wa(t,p0e,r.signal),wa(e,m0e,r.signal),f0e(e),n},u0e=(t,e)=>{let r=Oa([t]);return Sl(r,e),Nb.set(e,r),r},d0e=(t,e)=>{let r=Nb.get(e);return r.add(t),r},f0e=async t=>{try{await l0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Nb.delete(t)},Nb=new WeakMap,p0e=2,m0e=1});import{aborted as h0e}from"node:util";var dK,g0e,fK=y(()=>{cI();dK=(t,e)=>t===void 0?[]:[g0e(t,e)],g0e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await h0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw aI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var jb,y0e,_0e,pK=y(()=>{co();iK();cI();cK();uK();fK();jb=(t,...e)=>{if(At(e[0]))return jb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=nK(t,...e),i=y0e({...n,destination:r});return i.pipe=jb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},y0e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=_0e(t,i);sK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=lK(e,o,d);return await Promise.race([aK(u),...dK(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},_0e=(t,e)=>Promise.allSettled([t,e])});import{on as b0e}from"node:events";import{getDefaultHighWaterMark as v0e}from"node:stream";var Mb,S0e,lI,w0e,hK,uI,mK,x0e,$0e,Fb=y(()=>{MR();xb();zR();Mb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return S0e(e,s),hK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},S0e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},lI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;w0e(e,s,t);let a=t.readableObjectMode&&!o;return hK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},w0e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},hK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=b0e(t,"data",{signal:e.signal,highWaterMark:mK,highWatermark:mK});return x0e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},uI=v0e(!0),mK=uI,x0e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=$0e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ta(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*qf(a)}},$0e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[$b(t,r,!e),wb(t,i,!n,{})].filter(Boolean)});import{setImmediate as k0e}from"node:timers/promises";var gK,E0e,A0e,T0e,dI,yK,fI=y(()=>{pb();tn();qR();Fb();Ea();Uf();gK=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=E0e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([A0e(t),d]);return}let f=DR(c,r),p=lI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([T0e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},E0e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Tb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=lI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await dW(a,t,r,o)},A0e=async t=>{await k0e(),t.readableFlowing===null&&t.resume()},T0e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await lb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await ub(r,{maxBuffer:o})):await fb(r,{maxBuffer:o})}catch(a){return yK(K9({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},dI=async t=>{try{return await t}catch(e){return yK(e)}},yK=({bufferedData:t})=>UH(t)?new Uint8Array(t):t});import{finished as O0e}from"node:stream/promises";var Zf,R0e,I0e,P0e,C0e,D0e,pI,Lb,_K,zb=y(()=>{Zf=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=R0e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],O0e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||C0e(a,e,r,n)}finally{s.abort()}},R0e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&I0e(t,r,n),n},I0e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{P0e(e,r),n.call(t,...i)}},P0e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},C0e=(t,e,r,n)=>{if(!D0e(t,e,r,n))throw t},D0e=(t,e,r,n=!0)=>r.propagating?_K(t)||Lb(t):(r.propagating=!0,pI(r,e)===n?_K(t):Lb(t)),pI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Lb=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",_K=t=>t?.code==="EPIPE"});var bK,mI,hI=y(()=>{fI();zb();bK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>mI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),mI=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=Zf(t,e,l);if(pI(l,e)){await u;return}let[d]=await Promise.all([gK({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 vK,SK,N0e,j0e,gI=y(()=>{Ib();hI();vK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Oa([t,e].filter(Boolean)):void 0,SK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>mI({...N0e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:j0e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),N0e=({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}},j0e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var wK,xK,$K=y(()=>{cl();ns();wK=t=>al(t,"ipc"),xK=(t,e)=>{let r=A_(t);ki({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var kK,EK,AK=y(()=>{Ea();$K();po();WR();kK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=wK(o),a=fo(e,"ipc"),c=fo(r,"ipc");for await(let l of VR({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(J9(t,i,c),i.push(l)),s&&xK(l,o);return i},EK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as M0e}from"node:events";var TK,F0e,L0e,z0e,OK=y(()=>{ka();lR();eR();cR();uo();_r();fI();AK();dR();gI();hI();GR();zb();TK=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 _=_W(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=bK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=SK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],A=kK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),E=F0e(h,t,S),C=L0e(m,S);try{return await Promise.race([Promise.all([{},vW(_),Promise.all(x),w,A,S9(t,d),...E,...C]),g,z0e(t,b),...g9(t,o,f,b),...jZ({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...m9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all(x.map(q=>dI(q))),dI(w),EK(A,O),Promise.allSettled(E),Promise.allSettled(C)])}},F0e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Zf(n,i,r)),L0e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Yn(o,{checkOpen:!1})&&!Wn(o)).map(({type:i,value:o,stream:s=o})=>Zf(s,n,e,{isSameDirection:kn.has(i),stopOnExit:i==="native"}))),z0e=async(t,{signal:e})=>{let[r]=await M0e(t,"error",{signal:e});throw r}});var RK,Vf,wl,Ub=y(()=>{ml();RK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Vf=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ei();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},wl=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 IK}from"node:stream/promises";var yI,PK,_I,bI,qb,Bb,vI=y(()=>{zb();yI=async t=>{if(t!==void 0)try{await _I(t)}catch{}},PK=async t=>{if(t!==void 0)try{await bI(t)}catch{}},_I=async t=>{await IK(t,{cleanup:!0,readable:!1,writable:!0})},bI=async t=>{await IK(t,{cleanup:!0,readable:!0,writable:!1})},qb=async(t,e)=>{if(await t,e)throw e},Bb=(t,e,r)=>{r&&!Lb(r)?t.destroy(r):e&&t.destroy()}});import{Readable as U0e}from"node:stream";import{callbackify as q0e}from"node:util";var CK,SI,wI,xI,B0e,$I,kI,DK,EI=y(()=>{xa();os();Fb();ml();Ub();vI();CK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||rn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=SI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=wI(a,s),{read:f,onStdoutDataDone:p}=xI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new U0e({read:f,destroy:q0e(kI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return $I({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},SI=(t,e,r)=>{let n=hl(t,e),i=Vf(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},wI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:uI},xI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ei(),s=Mb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){B0e(this,s,o)},onStdoutDataDone:o}},B0e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},$I=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await bI(t),await n,await yI(i),await e,r.readable&&r.push(null)}catch(o){await yI(i),DK(r,o)}},kI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await wl(r,e)&&(DK(t,n),await qb(e,n))},DK=(t,e)=>{Bb(t,t.readable,e)}});import{Writable as H0e}from"node:stream";import{callbackify as NK}from"node:util";var jK,AI,TI,G0e,Z0e,OI,RI,MK,II=y(()=>{os();Ub();vI();jK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=AI(t,r,e),s=new H0e({...TI(n,t,i),destroy:NK(RI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return OI(n,s),s},AI=(t,e,r)=>{let n=U_(t,e),i=Vf(r,n,"writableFinal"),o=Vf(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},TI=(t,e,r)=>({write:G0e.bind(void 0,t),final:NK(Z0e.bind(void 0,t,e,r))}),G0e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Z0e=async(t,e,r)=>{await wl(r,e)&&(t.writable&&t.end(),await e)},OI=async(t,e,r)=>{try{await _I(t),e.writable&&e.end()}catch(n){await PK(r),MK(e,n)}},RI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await wl(r,e),await wl(n,e)&&(MK(t,i),await qb(e,i))},MK=(t,e)=>{Bb(t,t.writable,e)}});import{Duplex as V0e}from"node:stream";import{callbackify as W0e}from"node:util";var FK,K0e,LK=y(()=>{xa();EI();II();FK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||rn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=SI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=AI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=wI(c,a),{read:g,onStdoutDataDone:b}=xI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new V0e({read:g,...TI(u,t,d),destroy:W0e(K0e.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 $I({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),OI(u,_,c),_},K0e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([kI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),RI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var PI,J0e,zK=y(()=>{xa();os();Fb();PI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||rn.has(e),s=hl(t,r),a=Mb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return J0e(a,s,t)},J0e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var UK,qK=y(()=>{Ub();EI();II();LK();zK();UK=(t,{encoding:e})=>{let r=RK();t.readable=CK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=jK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=FK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=PI.bind(void 0,t,e),t[Symbol.asyncIterator]=PI.bind(void 0,t,e,{})}});var BK,Y0e,X0e,HK=y(()=>{BK=(t,e)=>{for(let[r,n]of X0e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Y0e=(async()=>{})().constructor.prototype,X0e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Y0e,t)])});import{setMaxListeners as Q0e}from"node:events";import{spawn as e$e}from"node:child_process";var GK,t$e,r$e,n$e,i$e,o$e,ZK=y(()=>{pb();zO();mR();os();hR();KR();zf();gb();NW();zW();Uf();JW();M_();tK();pK();gI();OK();qK();ml();HK();GK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=t$e(t,e,r),{subprocess:f,promise:p}=n$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=jb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),BK(f,p),Ai.set(f,{options:u,fileDescriptors:d}),f},t$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=R_(t,e,r),{file:a,commandArguments:c,options:l}=nb(t,e,r),u=r$e(l),d=LW(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},r$e=({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}},n$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=e$e(...ib(t,e,r))}catch(m){return DW({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Q0e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];KW(c,a,l),eK(c,r,l);let d={},f=Ei();c.kill=DZ.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=vK(c,r),UK(c,r),IW(c,r);let p=i$e({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}},i$e=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 TK({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)=>ho(x,e,w)),_=ho(h,e,"all"),S=o$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return bl(S,n,e)},o$e=({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?Lf({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 Ti,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):hb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Hb,s$e,a$e,VK=y(()=>{co();po();Hb=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,s$e(n,t[n],i)]));return{...t,...r}},s$e=(t,e,r)=>a$e.has(t)&&At(e)&&At(r)?{...e,...r}:r,a$e=new Set(["env",...NO])});var cs,c$e,l$e,WK=y(()=>{co();RO();KH();$W();ZK();VK();cs=(t,e,r,n)=>{let i=(s,a,c)=>cs(s,a,r,c),o=(...s)=>c$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},c$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(At(o))return i(t,Hb(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=l$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?xW(a,c,l):GK(a,c,l,i)},l$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=VH(e)?WH(e,r):[e,...r],[s,a,c]=y_(...o),l=Hb(Hb(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 KK,JK,YK,u$e,d$e,XK=y(()=>{KK=({file:t,commandArguments:e})=>YK(t,e),JK=({file:t,commandArguments:e})=>({...YK(t,e),isSync:!0}),YK=(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]=u$e(t);return{file:r,commandArguments:n}},u$e=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(d$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},d$e=/ +/g});var QK,e3,f$e,t3,p$e,r3,n3=y(()=>{QK=(t,e,r)=>{t.sync=e(f$e,r),t.s=t.sync},e3=({options:t})=>t3(t),f$e=({options:t})=>({...t3(t),isSync:!0}),t3=t=>({options:{...p$e(t),...t}}),p$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},r3={preferLocal:!0}});var Vat,Je,Wat,Kat,Jat,Yat,Xat,Qat,ect,tct,jr=y(()=>{WK();XK();uR();n3();KR();Vat=cs(()=>({})),Je=cs(()=>({isSync:!0})),Wat=cs(KK),Kat=cs(JK),Jat=cs(_9),Yat=cs(e3,{},r3,QK),{sendMessage:Xat,getOneMessage:Qat,getEachMessage:ect,getCancelSignal:tct}=PW()});import{existsSync as Gb,statSync as m$e}from"node:fs";import{dirname as CI,extname as h$e,isAbsolute as i3,join as DI,relative as NI,resolve as Zb,sep as g$e}from"node:path";function Vb(t){return t==="./gradlew"||t==="gradle"}function y$e(t){return(Gb(DI(t,"build.gradle.kts"))||Gb(DI(t,"build.gradle")))&&Gb(DI(t,"gradle.properties"))}function _$e(t,e){let n=NI(t,e).split(g$e).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ls(t,e){return t===":"?`:${e}`:`${t}:${e}`}function b$e(t,e){let r=Zb(t,e),n=r;Gb(r)?m$e(r).isFile()&&(n=CI(r)):h$e(r)!==""&&(n=CI(r));let i=NI(t,n);if(i.startsWith("..")||i3(i))return null;let o=n;for(;;){if(y$e(o))return o;if(Zb(o)===Zb(t))return null;let s=CI(o);if(s===o)return null;let a=NI(t,s);if(a.startsWith("..")||i3(a))return null;o=s}}function Wb(t,e){let r=Zb(t),n=new Map,i=[];for(let o of e){let s=b$e(r,o);if(!s){i.push(o);continue}let a=_$e(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 Kb=y(()=>{"use strict"});import{existsSync as v$e,readFileSync as S$e}from"node:fs";import{join as w$e}from"node:path";function xl(t="."){let e=w$e(t,".cladding","config.yaml");if(!v$e(e))return jI;try{let n=(0,o3.parse)(S$e(e,"utf8"))?.gate;if(!n)return jI;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 x$e){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 jI}}function s3(t,e){let r=[],n=!1;for(let i of t){let o=$$e.exec(i);if(o){n=!0;for(let s of e)r.push(ls(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 o3,x$e,jI,$$e,Jb=y(()=>{"use strict";o3=Et(cr(),1);Kb();x$e=["type","lint","test","coverage"],jI={scope:"feature"};$$e=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as FI,readFileSync as a3,readdirSync as k$e,statSync as E$e}from"node:fs";import{join as Yb}from"node:path";function UI(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Yb(t,e);if(FI(r))try{if(c3.test(a3(r,"utf8")))return!0}catch{}}return!1}function l3(t){try{return FI(t)&&c3.test(a3(t,"utf8"))}catch{return!1}}function u3(t,e=0){if(e>4||!FI(t))return!1;let r;try{r=k$e(t)}catch{return!1}for(let n of r){let i=Yb(t,n),o=!1;try{o=E$e(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(u3(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&l3(i))return!0}return!1}function O$e(t){if(UI(t))return!0;for(let e of A$e)if(l3(Yb(t,e)))return!0;for(let e of T$e)if(u3(Yb(t,e)))return!0;return!1}function d3(t="."){let e=xl(t).coverage;return e||(O$e(t)?"kover":"jacoco")}function f3(t="."){return LI[d3(t)]}function p3(t="."){return MI[d3(t)]}var LI,MI,zI,c3,A$e,T$e,Xb=y(()=>{"use strict";Jb();LI={kover:"koverXmlReport",jacoco:"jacocoTestReport"},MI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},zI=[MI.kover,MI.jacoco],c3=/kover/i;A$e=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],T$e=["buildSrc","build-logic"]});import{existsSync as Qb,readFileSync as m3,readdirSync as h3}from"node:fs";import{join as Ia}from"node:path";function qI(t){return Qb(Ia(t,"gradlew"))?"./gradlew":"gradle"}function R$e(t){let e=qI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[f3(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function I$e(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(m3(Ia(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 C$e(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function j$e(t,e){for(let r of e)if(Qb(Ia(t,r)))return r}function M$e(t,e){try{return h3(t).find(n=>n.endsWith(e))}catch{return}}function L$e(t,e){for(let r of F$e)if(r.configs.some(n=>Qb(Ia(t,n))))return r.gate;return e}function U$e(t){if(z$e.some(e=>Qb(Ia(t,e))))return!0;try{return JSON.parse(m3(Ia(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function q$e(t,e){let r=e.lint?{...e,lint:L$e(t,e.lint)}:{...e};return e.test&&e.coverage&&U$e(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function ht(t="."){for(let e of D$e){let r;for(let o of e.manifests)if(o.startsWith(".")?r=M$e(t,o):r=j$e(t,[o]),r)break;if(!r||e.requiresSource&&!C$e(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?q$e(t,n):n;return{language:e.language,manifest:r,gates:i}}return N$e}var P$e,D$e,N$e,F$e,z$e,En=y(()=>{"use strict";Xb();P$e=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);D$e=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:R$e},{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:I$e}],N$e={language:"unknown",manifest:"",gates:{}};F$e=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];z$e=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as B$e,readFileSync as H$e}from"node:fs";import{join as G$e}from"node:path";function Pa(t){return t.code==="ENOENT"}function ev(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=(o||s||`exit ${i}`).slice(0,200);return g3.test(o)||g3.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Lt(t,e,r){return Pa(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function $l(t,e){let r=G$e(t,"package.json");if(!B$e(r))return!1;try{return!!JSON.parse(H$e(r,"utf8")).scripts?.[e]}catch{return!1}}var g3,An=y(()=>{"use strict";g3=/config (is |file )?not found|no such file|ENOENT|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 Z$e(t){let{cwd:e="."}=t,r=ht(e),n=r.gates.arch;if(!n)return[{detector:tv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Pa(i)?[{detector:tv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:ev(i,tv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var tv,Ca,rv=y(()=>{"use strict";jr();En();An();tv="ARCHITECTURE_VIOLATION";Ca={name:tv,subprocess:!0,run:Z$e}});function V$e(t){let{cwd:e="."}=t,r=ht(e),n=r.gates.secret;if(!n)return[{detector:nv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Pa(i)?[{detector:nv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:ev(i,nv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var nv,Da,iv=y(()=>{"use strict";jr();En();An();nv="HARDCODED_SECRET";Da={name:nv,subprocess:!0,run:V$e}});import{existsSync as BI,readdirSync as y3}from"node:fs";import{join as ov}from"node:path";function K$e(t,e){let r=ov(t,e.path);if(!BI(r))return!0;if(e.isDirectory)try{return y3(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function J$e(t){let{cwd:e="."}=t,r=[];for(let i of W$e)K$e(e,i)&&r.push({detector:Wf,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=ov(e,"spec.yaml");if(BI(n)){let i=Q$e(n),o=i?null:Y$e(e);if(i)r.push({detector:Wf,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:Wf,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=X$e(e);s&&r.push({detector:Wf,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 Y$e(t){for(let e of["spec/features","spec/scenarios"]){let r=ov(t,e);if(!BI(r))continue;let n;try{n=y3(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{wi(ov(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function X$e(t){try{return H(t),null}catch(e){return e.message}}function Q$e(t){let e;try{e=wi(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Wf,W$e,_3,b3=y(()=>{"use strict";qe();a_();Wf="ABSENCE_OF_GOVERNANCE",W$e=[{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}];_3={name:Wf,run:J$e}});function sv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function HI(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=sv(r)==="while",o=tke.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 '${sv(r)}'`}let n=eke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:sv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${sv(r)}'`:null}function rke(t,e){let r=HI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function v3(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...rke(r,n));return e}var eke,tke,GI=y(()=>{"use strict";eke={event:"when",state:"while",optional:"where",unwanted:"if"},tke=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var bt=y(()=>{"use strict";qe()});function nke(t){let{cwd:e="."}=t;return he(e,av,ike)}function ike(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:av,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 v3(t.features))e.push({detector:av,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var av,S3,w3=y(()=>{"use strict";GI();bt();av="AC_DRIFT";S3={name:av,run:nke}});function Ri(t=".",e){let n=(e??"").trim().toLowerCase()||ht(t).language;return $3[n]??x3}var oke,ske,ake,x3,cke,lke,$3,uke,k3,Na=y(()=>{"use strict";En();oke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,ske=/^[ \t]*import\s+([\w.]+)/gm,ake=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,x3={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:oke,importStyle:"relative"},cke={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:ske,importStyle:"dotted"},lke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:ake,importStyle:"dotted"},$3={typescript:x3,kotlin:cke,python:lke},uke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],k3=new Set([...Object.values($3).flatMap(t=>t?.extensions??[]),...uke].map(t=>t.toLowerCase()))});import{existsSync as dke,readFileSync as fke,readdirSync as pke,statSync as mke}from"node:fs";import{join as A3,relative as E3}from"node:path";function hke(t,e){if(!dke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=pke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=A3(i,s),c;try{c=mke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function gke(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function _ke(t){return yke.test(t)}function bke(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Ri(e,r.project?.language),o=i.sourceRoots.flatMap(a=>hke(A3(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=fke(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";qe();Na();T3="AI_HINTS_FORBIDDEN_PATTERN";yke=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;O3={name:T3,run:bke}});function vke(t){let{cwd:e="."}=t,r;try{r=H(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:I3,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var I3,P3,C3=y(()=>{"use strict";qe();I3="AC_DUPLICATE_WITHIN_FEATURE";P3={name:I3,run:vke}});import{createRequire as Ske}from"module";import{basename as wke,dirname as VI,normalize as xke,relative as $ke,resolve as kke,sep as j3}from"path";import*as Eke from"fs";function Ake(t){let e=xke(t);return e.length>1&&e[e.length-1]===j3&&(e=e.substring(0,e.length-1)),e}function M3(t,e){return t.replace(Tke,e)}function Rke(t){return t==="/"||Oke.test(t)}function ZI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=kke(t)),(n||o)&&(t=Ake(t)),t===".")return"";let s=t[t.length-1]!==i;return M3(s?t+i:t,i)}function F3(t,e){return e+t}function Ike(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:M3($ke(t,n),e.pathSeparator)+e.pathSeparator+r}}function Pke(t){return t}function Cke(t,e,r){return e+t+r}function Dke(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?Ike(t,e):n?F3:Pke}function Nke(t){return function(e,r){r.push(e.substring(t.length)||".")}}function jke(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function zke(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?jke(t):Nke(t):n&&n.length?Fke:Mke:Lke}function Zke(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?Gke:r&&r.length?n?Uke:qke:n?Bke:Hke}function Kke(t){return t.group?Wke:Vke}function Xke(t){return t.group?Jke:Yke}function tEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?eEe:Qke}function L3(t,e,r){if(r.options.useRealPaths)return rEe(e,r);let n=VI(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=VI(n)}return r.symlinks.set(t,e),i>1}function rEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function cv(t,e,r,n){e(t&&!n?t:null,r)}function dEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?nEe:aEe:n?e?iEe:uEe:i?e?sEe:lEe:e?oEe:cEe}function mEe(t){return t?pEe:fEe}function _Ee(t,e){return new Promise((r,n)=>{q3(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function q3(t,e,r){new U3(t,e,r).start()}function bEe(t,e){return new U3(t,e).start()}var D3,Tke,Oke,Mke,Fke,Lke,Uke,qke,Bke,Hke,Gke,Vke,Wke,Jke,Yke,Qke,eEe,nEe,iEe,oEe,sEe,aEe,cEe,lEe,uEe,z3,fEe,pEe,hEe,gEe,yEe,U3,N3,B3,H3,G3=y(()=>{D3=Ske(import.meta.url);Tke=/[\\/]/g;Oke=/^[a-z]:[\\/]$/i;Mke=(t,e)=>{e.push(t||".")},Fke=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},Lke=()=>{};Uke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},qke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},Bke=(t,e,r,n)=>{r.files++},Hke=(t,e)=>{e.push(t)},Gke=()=>{};Vke=t=>t,Wke=()=>[""].slice(0,0);Jke=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},Yke=()=>{};Qke=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()&&L3(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},eEe=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()&&L3(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};nEe=t=>t.counts,iEe=t=>t.groups,oEe=t=>t.paths,sEe=t=>t.paths.slice(0,t.options.maxFiles),aEe=(t,e,r)=>(cv(e,r,t.counts,t.options.suppressErrors),null),cEe=(t,e,r)=>(cv(e,r,t.paths,t.options.suppressErrors),null),lEe=(t,e,r)=>(cv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),uEe=(t,e,r)=>(cv(e,r,t.groups,t.options.suppressErrors),null);z3={withFileTypes:!0},fEe=(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||".",z3,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},pEe=(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||".",z3)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};hEe=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))}},gEe=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}},yEe=class{aborted=!1;abort(){this.aborted=!0}},U3=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=dEe(e,this.isSynchronous),this.root=ZI(t,e),this.state={root:Rke(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new gEe,options:e,queue:new hEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new yEe,fs:e.fs||Eke},this.joinPath=Dke(this.root,e),this.pushDirectory=zke(this.root,e),this.pushFile=Zke(e),this.getArray=Kke(e),this.groupFiles=Xke(e),this.resolveSymlink=tEe(e,this.isSynchronous),this.walkDirectory=mEe(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(_=ZI(_,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=wke(_),x=ZI(VI(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};N3=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return _Ee(this.root,this.options)}withCallback(t){q3(this.root,this.options,t)}sync(){return bEe(this.root,this.options)}},B3=null;try{D3.resolve("picomatch"),B3=D3("picomatch")}catch{}H3=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:j3,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 N3(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new N3(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||B3;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 Kf=v((ilt,J3)=>{"use strict";var Z3="[^\\\\/]",vEe="(?=.)",V3="[^/]",WI="(?:\\/|$)",W3="(?:^|\\/)",KI=`\\.{1,2}${WI}`,SEe="(?!\\.)",wEe=`(?!${W3}${KI})`,xEe=`(?!\\.{0,1}${WI})`,$Ee=`(?!${KI})`,kEe="[^.\\/]",EEe=`${V3}*?`,AEe="/",K3={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:vEe,QMARK:V3,END_ANCHOR:WI,DOTS_SLASH:KI,NO_DOT:SEe,NO_DOTS:wEe,NO_DOT_SLASH:xEe,NO_DOTS_SLASH:$Ee,QMARK_NO_DOT:kEe,STAR:EEe,START_ANCHOR:W3,SEP:AEe},TEe={...K3,SLASH_LITERAL:"[\\\\/]",QMARK:Z3,STAR:`${Z3}*?`,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:"\\"},OEe={__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"};J3.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:OEe,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?TEe:K3}}});var Jf=v(Mr=>{"use strict";var{REGEX_BACKSLASH:REe,REGEX_REMOVE_BACKSLASH:IEe,REGEX_SPECIAL_CHARS:PEe,REGEX_SPECIAL_CHARS_GLOBAL:CEe}=Kf();Mr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Mr.hasRegexChars=t=>PEe.test(t);Mr.isRegexChar=t=>t.length===1&&Mr.hasRegexChars(t);Mr.escapeRegex=t=>t.replace(CEe,"\\$1");Mr.toPosixSlashes=t=>t.replace(REe,"/");Mr.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};Mr.removeBackslashes=t=>t.replace(IEe,e=>e==="\\"?"":e);Mr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Mr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Mr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Mr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Mr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var iJ=v((slt,nJ)=>{"use strict";var Y3=Jf(),{CHAR_ASTERISK:JI,CHAR_AT:DEe,CHAR_BACKWARD_SLASH:Yf,CHAR_COMMA:NEe,CHAR_DOT:YI,CHAR_EXCLAMATION_MARK:XI,CHAR_FORWARD_SLASH:rJ,CHAR_LEFT_CURLY_BRACE:QI,CHAR_LEFT_PARENTHESES:eP,CHAR_LEFT_SQUARE_BRACKET:jEe,CHAR_PLUS:MEe,CHAR_QUESTION_MARK:X3,CHAR_RIGHT_CURLY_BRACE:FEe,CHAR_RIGHT_PARENTHESES:Q3,CHAR_RIGHT_SQUARE_BRACKET:LEe}=Kf(),eJ=t=>t===rJ||t===Yf,tJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},zEe=(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,O=0,A,E,C={value:"",depth:0,isGlob:!1},k=()=>l>=n,q=()=>c.charCodeAt(l+1),Q=()=>(A=E,c.charCodeAt(++l));for(;l0&&(I=c.slice(0,u),c=c.slice(u),d-=u),Se&&m===!0&&d>0?(Se=c.slice(0,d),P=c.slice(d)):m===!0?(Se="",P=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&eJ(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),r.unescape===!0&&(P&&(P=Y3.removeBackslashes(P)),Se&&_===!0&&(Se=Y3.removeBackslashes(Se)));let Rr={prefix:I,input:t,start:u,base:Se,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Rr.maxDepth=0,eJ(E)||s.push(C),Rr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var Xf=Kf(),nn=Jf(),{MAX_LENGTH:lv,POSIX_REGEX_SOURCE:UEe,REGEX_NON_SPECIAL_CHARS:qEe,REGEX_SPECIAL_CHARS_BACKREF:BEe,REPLACEMENTS:oJ}=Xf,HEe=(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=>nn.escapeRegex(i)).join("..")}return r},kl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,sJ=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},GEe=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},aJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(GEe(e))return e.replace(/\\(.)/g,"$1")},ZEe=t=>{let e=t.map(aJ).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}}}}},VEe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=aJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?nn.escapeRegex(r[0]):`[${r.map(i=>nn.escapeRegex(i)).join("")}]`}*`},WEe=t=>{let e=0,r=t.trim(),n=tP(r);for(;n;)e++,r=n.body.trim(),n=tP(r);return e},KEe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Xf.DEFAULT_MAX_EXTGLOB_RECURSION,n=sJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||ZEe(n)))return{risky:!0};for(let i of n){let o=VEe(i);if(o)return{risky:!0,safeOutput:o};if(WEe(i)>r)return{risky:!0}}return{risky:!1}},rP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=oJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(lv,r.maxLength):lv,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=Xf.globChars(r.windows),l=Xf.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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,A=r.dot?"":h,E=r.dot?_:S,C=r.bash===!0?O(r):x;r.capture&&(C=`(${C})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let k={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=nn.removePrefix(t,k),i=t.length;let q=[],Q=[],Se=[],I=o,P,Rr=()=>k.index===i-1,se=k.peek=(B=1)=>t[k.index+B],Pe=k.advance=()=>t[++k.index]||"",Vt=()=>t.slice(k.index+1),ar=(B="",ft=0)=>{k.consumed+=B,k.index+=ft},Kt=B=>{k.output+=B.output!=null?B.output:B.value,ar(B.value)},to=()=>{let B=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),k.start++,B++;return B%2===0?!1:(k.negated=!0,k.start++,!0)},yi=B=>{k[B]++,Se.push(B)},Jr=B=>{k[B]--,Se.pop()},de=B=>{if(I.type==="globstar"){let ft=k.braces>0&&(B.type==="comma"||B.type==="brace"),U=B.extglob===!0||q.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ft&&!U&&(k.output=k.output.slice(0,-I.output.length),I.type="star",I.value="*",I.output=C,k.output+=I.output)}if(q.length&&B.type!=="paren"&&(q[q.length-1].inner+=B.value),(B.value||B.output)&&Kt(B),I&&I.type==="text"&&B.type==="text"){I.output=(I.output||I.value)+B.value,I.value+=B.value;return}B.prev=I,s.push(B),I=B},ro=(B,ft)=>{let U={...l[ft],conditions:1,inner:""};U.prev=I,U.parens=k.parens,U.output=k.output,U.startIndex=k.index,U.tokensIndex=s.length;let Te=(r.capture?"(":"")+U.open;yi("parens"),de({type:B,value:ft,output:k.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Te}),q.push(U)},Tue=B=>{let ft=t.slice(B.startIndex,k.index+1),U=t.slice(B.startIndex+2,k.index),Te=KEe(U,r);if((B.type==="plus"||B.type==="star")&&Te.risky){let ct=Te.safeOutput?(B.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,_i=s[B.tokensIndex];_i.type="text",_i.value=ft,_i.output=ct||nn.escapeRegex(ft);for(let bi=B.tokensIndex+1;bi1&&B.inner.includes("/")&&(ct=O(r)),(ct!==C||Rr()||/^\)+$/.test(Vt()))&&(lt=B.close=`)$))${ct}`),B.inner.includes("*")&&(jt=Vt())&&/^\.[^\\/.]+$/.test(jt)){let _i=rP(jt,{...e,fastpaths:!1}).output;lt=B.close=`)${_i})${ct})`}B.prev.type==="bos"&&(k.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:lt}),Jr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ft=t.replace(BEe,(U,Te,lt,jt,ct,_i)=>jt==="\\"?(B=!0,U):jt==="?"?Te?Te+jt+(ct?_.repeat(ct.length):""):_i===0?E+(ct?_.repeat(ct.length):""):_.repeat(lt.length):jt==="."?u.repeat(lt.length):jt==="*"?Te?Te+jt+(ct?C:""):C:Te?U:`\\${U}`);return B===!0&&(r.unescape===!0?ft=ft.replace(/\\/g,""):ft=ft.replace(/\\+/g,U=>U.length%2===0?"\\\\":U?"\\":"")),ft===t&&r.contains===!0?(k.output=t,k):(k.output=nn.wrapOutput(ft,k,e),k)}for(;!Rr();){if(P=Pe(),P==="\0")continue;if(P==="\\"){let U=se();if(U==="/"&&r.bash!==!0||U==="."||U===";")continue;if(!U){P+="\\",de({type:"text",value:P});continue}let Te=/^\\+/.exec(Vt()),lt=0;if(Te&&Te[0].length>2&&(lt=Te[0].length,k.index+=lt,lt%2!==0&&(P+="\\")),r.unescape===!0?P=Pe():P+=Pe(),k.brackets===0){de({type:"text",value:P});continue}}if(k.brackets>0&&(P!=="]"||I.value==="["||I.value==="[^")){if(r.posix!==!1&&P===":"){let U=I.value.slice(1);if(U.includes("[")&&(I.posix=!0,U.includes(":"))){let Te=I.value.lastIndexOf("["),lt=I.value.slice(0,Te),jt=I.value.slice(Te+2),ct=UEe[jt];if(ct){I.value=lt+ct,k.backtrack=!0,Pe(),!o.output&&s.indexOf(I)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(I.value==="["||I.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&I.value==="["&&(P="^"),I.value+=P,Kt({value:P});continue}if(k.quotes===1&&P!=='"'){P=nn.escapeRegex(P),I.value+=P,Kt({value:P});continue}if(P==='"'){k.quotes=k.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){yi("parens"),de({type:"paren",value:P});continue}if(P===")"){if(k.parens===0&&r.strictBrackets===!0)throw new SyntaxError(kl("opening","("));let U=q[q.length-1];if(U&&k.parens===U.parens+1){Tue(q.pop());continue}de({type:"paren",value:P,output:k.parens?")":"\\)"}),Jr("parens");continue}if(P==="["){if(r.nobracket===!0||!Vt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(kl("closing","]"));P=`\\${P}`}else yi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||I&&I.type==="bracket"&&I.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if(k.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(kl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Jr("brackets");let U=I.value.slice(1);if(I.posix!==!0&&U[0]==="^"&&!U.includes("/")&&(P=`/${P}`),I.value+=P,Kt({value:P}),r.literalBrackets===!1||nn.hasRegexChars(U))continue;let Te=nn.escapeRegex(I.value);if(k.output=k.output.slice(0,-I.value.length),r.literalBrackets===!0){k.output+=Te,I.value=Te;continue}I.value=`(${a}${Te}|${I.value})`,k.output+=I.value;continue}if(P==="{"&&r.nobrace!==!0){yi("braces");let U={type:"brace",value:P,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};Q.push(U),de(U);continue}if(P==="}"){let U=Q[Q.length-1];if(r.nobrace===!0||!U){de({type:"text",value:P,output:P});continue}let Te=")";if(U.dots===!0){let lt=s.slice(),jt=[];for(let ct=lt.length-1;ct>=0&&(s.pop(),lt[ct].type!=="brace");ct--)lt[ct].type!=="dots"&&jt.unshift(lt[ct].value);Te=HEe(jt,r),k.backtrack=!0}if(U.comma!==!0&&U.dots!==!0){let lt=k.output.slice(0,U.outputIndex),jt=k.tokens.slice(U.tokensIndex);U.value=U.output="\\{",P=Te="\\}",k.output=lt;for(let ct of jt)k.output+=ct.output||ct.value}de({type:"brace",value:P,output:Te}),Jr("braces"),Q.pop();continue}if(P==="|"){q.length>0&&q[q.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let U=P,Te=Q[Q.length-1];Te&&Se[Se.length-1]==="braces"&&(Te.comma=!0,U="|"),de({type:"comma",value:P,output:U});continue}if(P==="/"){if(I.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",s.pop(),I=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if(k.braces>0&&I.type==="dot"){I.value==="."&&(I.output=u);let U=Q[Q.length-1];I.type="dots",I.output+=P,I.value+=P,U.dots=!0;continue}if(k.braces+k.parens===0&&I.type!=="bos"&&I.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(I&&I.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){ro("qmark",P);continue}if(I&&I.type==="paren"){let Te=se(),lt=P;(I.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Vt()))&&(lt=`\\${P}`),de({type:"text",value:P,output:lt});continue}if(r.dot!==!0&&(I.type==="slash"||I.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){ro("negate",P);continue}if(r.nonegate!==!0&&k.index===0){to();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){ro("plus",P);continue}if(I&&I.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(I&&(I.type==="bracket"||I.type==="paren"||I.type==="brace")||k.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let U=qEe.exec(Vt());U&&(P+=U[0],k.index+=U[0].length),de({type:"text",value:P});continue}if(I&&(I.type==="globstar"||I.star===!0)){I.type="star",I.star=!0,I.value+=P,I.output=C,k.backtrack=!0,k.globstar=!0,ar(P);continue}let B=Vt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){ro("star",P);continue}if(I.type==="star"){if(r.noglobstar===!0){ar(P);continue}let U=I.prev,Te=U.prev,lt=U.type==="slash"||U.type==="bos",jt=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!lt||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let ct=k.braces>0&&(U.type==="comma"||U.type==="brace"),_i=q.length&&(U.type==="pipe"||U.type==="paren");if(!lt&&U.type!=="paren"&&!ct&&!_i){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let bi=t[k.index+4];if(bi&&bi!=="/")break;B=B.slice(3),ar("/**",3)}if(U.type==="bos"&&Rr()){I.type="globstar",I.value+=P,I.output=O(r),k.output=I.output,k.globstar=!0,ar(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&!jt&&Rr()){k.output=k.output.slice(0,-(U.output+I.output).length),U.output=`(?:${U.output}`,I.type="globstar",I.output=O(r)+(r.strictSlashes?")":"|$)"),I.value+=P,k.globstar=!0,k.output+=U.output+I.output,ar(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&B[0]==="/"){let bi=B[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(U.output+I.output).length),U.output=`(?:${U.output}`,I.type="globstar",I.output=`${O(r)}${f}|${f}${bi})`,I.value+=P,k.output+=U.output+I.output,k.globstar=!0,ar(P+Pe()),de({type:"slash",value:"/",output:""});continue}if(U.type==="bos"&&B[0]==="/"){I.type="globstar",I.value+=P,I.output=`(?:^|${f}|${O(r)}${f})`,k.output=I.output,k.globstar=!0,ar(P+Pe()),de({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-I.output.length),I.type="globstar",I.output=O(r),I.value+=P,k.output+=I.output,k.globstar=!0,ar(P);continue}let ft={type:"star",value:P,output:C};if(r.bash===!0){ft.output=".*?",(I.type==="bos"||I.type==="slash")&&(ft.output=A+ft.output),de(ft);continue}if(I&&(I.type==="bracket"||I.type==="paren")&&r.regex===!0){ft.output=P,de(ft);continue}(k.index===k.start||I.type==="slash"||I.type==="dot")&&(I.type==="dot"?(k.output+=g,I.output+=g):r.dot===!0?(k.output+=b,I.output+=b):(k.output+=A,I.output+=A),se()!=="*"&&(k.output+=p,I.output+=p)),de(ft)}for(;k.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(kl("closing","]"));k.output=nn.escapeLast(k.output,"["),Jr("brackets")}for(;k.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(kl("closing",")"));k.output=nn.escapeLast(k.output,"("),Jr("parens")}for(;k.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(kl("closing","}"));k.output=nn.escapeLast(k.output,"{"),Jr("braces")}if(r.strictSlashes!==!0&&(I.type==="star"||I.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),k.backtrack===!0){k.output="";for(let B of k.tokens)k.output+=B.output!=null?B.output:B.value,B.suffix&&(k.output+=B.suffix)}return k};rP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(lv,r.maxLength):lv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=oJ[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}=Xf.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 E=/^(.*?)\.(\w+)$/.exec(A);if(!E)return;let C=x(E[1]);return C?C+o+E[2]:void 0}}},w=nn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};cJ.exports=rP});var fJ=v((clt,dJ)=>{"use strict";var JEe=iJ(),nP=lJ(),uJ=Jf(),YEe=Kf(),XEe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=XEe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?uJ.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(uJ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):nP(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>JEe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=nP.fastpaths(t,e)),i.output||(i=nP(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=YEe;dJ.exports=Tt});var gJ=v((llt,hJ)=>{"use strict";var pJ=fJ(),QEe=Jf();function mJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:QEe.isWindows()}),pJ(t,e,r)}Object.assign(mJ,pJ);hJ.exports=mJ});import{readdir as eAe,readdirSync as tAe,realpath as rAe,realpathSync as nAe,stat as iAe,statSync as oAe}from"fs";import{isAbsolute as sAe,posix as ja,resolve as aAe}from"path";import{fileURLToPath as cAe}from"url";function dAe(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]===".."&&uAe.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=>ja.relative(t,n)||".":n=>ja.relative(t,`${e}/${n}`)||"."}function mAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=ja.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function vJ(t){var e;let r=El.default.scan(t,hAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function SAe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=El.default.scan(t);return r.isGlob||r.negated}function Qf(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function SJ(t){return typeof t=="string"?[t]:t??[]}function iP(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=vAe(o);s=sAe(s.replace(xAe,""))?ja.relative(a,s):ja.normalize(s);let c=(i=wAe.exec(s))===null||i===void 0?void 0:i[0],l=vJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?ja.join(o,...d):o}return s}function $Ae(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(iP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(iP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(iP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function kAe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=$Ae(t,e,n);t.debug&&Qf("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(_J,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,El.default)(i.match,f),m=(0,El.default)(i.ignore,f),h=dAe(i.match,f),g=yJ(r,d,o),b=o?g:yJ(r,d,!0),_=(w,O)=>{let A=b(O,!0);return A!=="."&&!h(A)||m(A)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new H3({filters:[a?(w,O)=>{let A=g(w,O),E=p(A)&&!m(A);return E&&Qf(`matched ${A}`),E}:(w,O)=>{let A=g(w,O);return p(A)&&!m(A)}],exclude:a?(w,O)=>{let A=_(w,O);return Qf(`${A?"skipped":"crawling"} ${O}`),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&&Qf("internal properties:",{...n,root:d}),[x,r!==d&&!o&&mAe(r,d)]}function EAe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function TAe(t){let e={...AAe,...t};return e.cwd=(e.cwd instanceof URL?cAe(e.cwd):aAe(e.cwd)).replace(_J,"/"),e.ignore=SJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||eAe,readdirSync:e.fs.readdirSync||tAe,realpath:e.fs.realpath||rAe,realpathSync:e.fs.realpathSync||nAe,stat:e.fs.stat||iAe,statSync:e.fs.statSync||oAe}),e.debug&&Qf("globbing with options:",e),e}function OAe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=lAe(t)||typeof t=="string",i=SJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=TAe(n?e:t);return i.length>0?kAe(o,i):[]}function us(t,e){let[r,n]=OAe(t,e);return r?EAe(r.sync(),n):[]}var El,lAe,_J,bJ,uAe,fAe,pAe,hAe,gAe,yAe,_Ae,bAe,vAe,wAe,xAe,AAe,ep=y(()=>{G3();El=Et(gJ(),1),lAe=Array.isArray,_J=/\\/g,bJ=process.platform==="win32",uAe=/^(\/?\.\.)+$/;fAe=/^[A-Z]:\/$/i,pAe=bJ?t=>fAe.test(t):t=>t==="/";hAe={parts:!0};gAe=/(?t.replace(gAe,"\\$&"),bAe=t=>t.replace(yAe,"\\$&"),vAe=bJ?bAe:_Ae;wAe=/^(\/?\.\.)+/,xAe=/\\(?=[()[\]{}!*+?@|])/g;AAe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as tp,readFileSync as RAe,readdirSync as IAe,statSync as wJ}from"node:fs";import{join as Ma}from"node:path";function PAe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Ri(e,n),o=[],{layers:s,forbiddenImports:a}=oP(r);return(s.size>0||a.length>0)&&!tp(Ma(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&&(CAe(e,i,s,o),DAe(e,i,s,o)),a.length>0&&NAe(e,i,a,o),o)}function oP(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 CAe(t,e,r,n){let i=e.mainRoot,o=Ma(t,i);if(tp(o))for(let s of IAe(o)){let a=Ma(o,s);wJ(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 DAe(t,e,r,n){let i=e.mainRoot,o=Ma(t,i);if(tp(o))for(let s of r){let a=Ma(o,s);tp(a)&&wJ(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 NAe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ma(t,i,s.from);if(!tp(a))continue;let c=us([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ma(a,l),d;try{d=RAe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];jAe(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 jAe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var rp,xJ,sP=y(()=>{"use strict";ep();qe();Na();rp="ARCHITECTURE_FROM_SPEC";xJ={name:rp,run:PAe}});import{existsSync as MAe,readFileSync as FAe}from"node:fs";import{join as LAe}from"node:path";function zAe(t){let{cwd:e="."}=t,r=LAe(e,"spec/capabilities.yaml");if(!MAe(r))return[];let n;try{let c=FAe(r,"utf8"),l=$J.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=H(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:uv,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:uv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:uv,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var $J,uv,kJ,EJ=y(()=>{"use strict";$J=Et(cr(),1);qe();uv="CAPABILITIES_FEATURE_MAPPING";kJ={name:uv,run:zAe}});import{existsSync as UAe,readFileSync as qAe}from"node:fs";import{join as BAe}from"node:path";function HAe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function GAe(t){let{cwd:e="."}=t;return he(e,aP,r=>ZAe(r,e))}function ZAe(t,e){let r=Ri(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=BAe(e,o);if(!UAe(s))continue;let a=qAe(s,"utf8");HAe(a)||n.push({detector:aP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var aP,AJ,TJ=y(()=>{"use strict";Na();bt();aP="CONVENTION_DRIFT";AJ={name:aP,run:GAe}});import{existsSync as cP,readFileSync as OJ}from"node:fs";import{join as dv}from"node:path";function VAe(t){return JSON.parse(t).total?.lines?.pct??0}function RJ(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function JAe(t,e){if(!Vb(ht(t).gates.coverage?.cmd))return null;let r;try{r=Wb(t,e)}catch(c){return[{detector:go,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=zI.find(d=>cP(dv(c.dir,d)));if(!l){s.push(c.path);continue}let u=RJ(OJ(dv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:go,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=IJ(n,i);return a0?[{detector:go,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function YAe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=JAe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Ri(e,r),i=ht(e).language==="kotlin"?zI.find(a=>cP(dv(e,a)))??p3(e):n.coverageSummary,o=dv(e,i);if(!cP(o))return[{detector:go,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=OJ(o,"utf8");s=n.coverageFormat==="jacoco-xml"?WAe(a):n.coverageFormat==="cobertura-xml"?KAe(a):VAe(a)}catch(a){return[{detector:go,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:go,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=fv?[]:[{detector:go,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${fv}%`}]}var go,fv,PJ,CJ=y(()=>{"use strict";qe();Xb();Na();Kb();En();go="COVERAGE_DROP",fv=70;PJ={name:go,run:YAe}});import{existsSync as XAe}from"node:fs";import{join as QAe}from"node:path";function eTe(t){let{cwd:e="."}=t;return he(e,pv,r=>tTe(r,e))}function tTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?XAe(QAe(e,r.path))?[]:[{detector:pv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:pv,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var pv,DJ,NJ=y(()=>{"use strict";bt();pv="DELIVERABLE_INTEGRITY";DJ={name:pv,run:eTe}});function rTe(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:mv,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 nTe(t){let e=rTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:mv,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 iTe(t){let{cwd:e="."}=t;return he(e,mv,r=>nTe(r))}var mv,jJ,MJ=y(()=>{"use strict";bt();mv="SMOKE_PROBE_DEMAND";jJ={name:mv,run:iTe}});function oTe(t){let{cwd:e="."}=t;return he(e,hv,r=>sTe(r,e))}function sTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ts(e);if(n===null)return[{detector:hv,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=p_(n,e,o);s.state!=="fresh"&&i.push({detector:hv,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 hv,gv,lP=y(()=>{"use strict";rl();bt();hv="STALE_ATTESTATION";gv={name:hv,run:oTe}});function aTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return cTe(r)}function cTe(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:FJ,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 FJ,yv,uP=y(()=>{"use strict";qe();FJ="DEPENDENCY_CYCLE";yv={name:FJ,run:aTe}});import{appendFileSync as lTe,existsSync as LJ,mkdirSync as uTe,readFileSync as dTe}from"node:fs";import{dirname as fTe,join as pTe}from"node:path";function zJ(t){return pTe(t,mTe,hTe)}function UJ(t){return dP.add(t),()=>dP.delete(t)}function Fa(t,e){let r=zJ(t),n=fTe(r);LJ(n)||uTe(n,{recursive:!0}),lTe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of dP)try{i(t,e)}catch{}}function Tn(t){let e=zJ(t);if(!LJ(e))return[];let r=dTe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var mTe,hTe,dP,Xn=y(()=>{"use strict";mTe=".cladding",hTe="audit.log.jsonl";dP=new Set});import{existsSync as gTe}from"node:fs";import{join as yTe}from"node:path";function _Te(t){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return[{detector:fP,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&&(gTe(yTe(e,i.artifact))||n.push({detector:fP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var fP,qJ,BJ=y(()=>{"use strict";Xn();fP="EVIDENCE_MISMATCH";qJ={name:fP,run:_Te}});import{existsSync as bTe,readFileSync as vTe}from"node:fs";import{join as STe}from"node:path";function wTe(t){let e=STe(t,VJ);if(!bTe(e))return null;try{let n=((0,ZJ.parse)(vTe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*GJ(t,e){for(let r of t??[])r.startsWith(HJ)&&(yield{ref:r,name:r.slice(HJ.length),field:e})}function xTe(t){let{cwd:e="."}=t,r=wTe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:pP,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=[...GJ(s.evidence_refs,"evidence_refs"),...GJ(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:pP,severity:"warn",path:VJ,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var ZJ,pP,HJ,VJ,WJ,KJ=y(()=>{"use strict";ZJ=Et(cr(),1);qe();pP="FIXTURE_REFERENCE_INVALID",HJ="fixture:",VJ="conformance/fixtures.yaml";WJ={name:pP,run:xTe}});import{existsSync as Al,readFileSync as mP}from"node:fs";import{join as La}from"node:path";function $Te(t){return us(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function np(t){if(!Al(t))return null;try{return JSON.parse(mP(t,"utf8"))}catch{return null}}function kTe(t,e){let r=La(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(mP(r,"utf8"))}catch(c){e.push({detector:yo,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:yo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=$Te(t);s!==a&&e.push({detector:yo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function ETe(t,e){for(let r of JJ){let n=La(t,r.path);if(!Al(n))continue;let i=np(n);if(!i){e.push({detector:yo,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:yo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function ATe(t,e){let r=np(La(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of JJ){let s=La(t,o.path);if(!Al(s))continue;let a=np(s);a?.version&&a.version!==n&&e.push({detector:yo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=La(t,".claude-plugin","marketplace.json");if(Al(i)){let o=np(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:yo,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 TTe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function OTe(t,e){let r=La(t,"src","cli","clad.ts"),n=La(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Al(r)||!Al(n))return;let i=TTe(mP(r,"utf8"));if(i.length===0)return;let s=np(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:yo,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 RTe(t){let{cwd:e="."}=t,r=[];return kTe(e,r),OTe(e,r),ETe(e,r),ATe(e,r),r}var yo,JJ,YJ,XJ=y(()=>{"use strict";ep();yo="HARNESS_INTEGRITY",JJ=[{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"]}];YJ={name:yo,run:RTe}});import{existsSync as ITe,readFileSync as PTe}from"node:fs";import{join as CTe}from"node:path";function NTe(t){let{cwd:e="."}=t;return he(e,_v,r=>MTe(r,e))}function jTe(t){let e=CTe(t,"spec/capabilities.yaml");if(!ITe(e))return!1;try{let r=QJ.default.parse(PTe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function MTe(t,e){let r=t.features.length;if(r{"use strict";QJ=Et(cr(),1);bt();_v="HOLLOW_GOVERNANCE",DTe=8;e8={name:_v,run:NTe}});import{existsSync as r8,readFileSync as n8}from"node:fs";import{join as i8}from"node:path";function o8(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 zTe(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 UTe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function qTe(t){let e=i8(t,"README.md"),r=i8(t,"docs","dogfood","matrix.md");if(!r8(e)||!r8(r))return[];let n=o8(n8(e,"utf8"),FTe),i=o8(n8(r,"utf8"),LTe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=UTe(a);if(c===null)continue;let l=i[s]??"not-run",u=zTe(l);u!==null&&c>u&&o.push({detector:s8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function BTe(t){let{cwd:e="."}=t;return qTe(e)}var s8,FTe,LTe,a8,c8=y(()=>{"use strict";s8="HOST_CLAIM_DRIFT",FTe=//,LTe=//;a8={name:s8,run:BTe}});function HTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return l8(r.features.map(i=>i.id),"feature","spec/features/",n),l8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function l8(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:u8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var u8,d8,f8=y(()=>{"use strict";qe();u8="ID_COLLISION";d8={name:u8,run:HTe}});import{existsSync as ip,readFileSync as hP,readdirSync as gP,statSync as GTe,writeFileSync as m8}from"node:fs";import{join as _o}from"node:path";function p8(t){if(!ip(t))return 0;try{return gP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function ZTe(t){if(!ip(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=gP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=_o(n,o),a;try{a=GTe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function VTe(t){let e=_o(t,"spec","capabilities.yaml");if(!ip(e))return 0;try{let r=bv.default.parse(hP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ds(t="."){let e=p8(_o(t,"spec","features")),r=p8(_o(t,"spec","scenarios")),n=VTe(t),i=ZTe(_o(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Tl(t,e){let r=_o(t,"spec.yaml");if(!ip(r))return;let n=hP(r,"utf8"),i=WTe(n,e);i!==n&&m8(r,i)}function WTe(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 @@ -269,51 +269,51 @@ ${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 La(t="."){let e=_o(t,"spec","features");if(!ip(e))return!1;let r=[];for(let i of hP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,bv.parse)(mP(_o(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 za(t="."){let e=_o(t,"spec","features");if(!ip(e))return!1;let r=[];for(let i of gP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,bv.parse)(hP(_o(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 f8(_o(t,"spec","index.yaml"),n,"utf8"),!0}var bv,op=y(()=>{"use strict";bv=Et(cr(),1)});import{existsSync as p8,readFileSync as m8,readdirSync as HTe}from"node:fs";import{join as gP}from"node:path";function GTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=ls(e),i=r.inventory;if(!i){let s=h8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return yP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...yP(e),{detector:sp,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 h8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:sp,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(...yP(e)),o}function yP(t){let e=gP(t,"spec","index.yaml"),r=gP(t,"spec","features");if(!p8(e)||!p8(r))return[];let n=new Map;try{for(let l of m8(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 HTe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=m8(gP(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:sp,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:sp,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 sp,h8,g8,y8=y(()=>{"use strict";op();qe();sp="INVENTORY_DRIFT",h8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];g8={name:sp,run:GTe}});import{existsSync as ZTe,readFileSync as VTe}from"node:fs";import{join as WTe}from"node:path";function JTe(t){let{cwd:e="."}=t,r=WTe(e,"src","spec","schema.json"),n=[];if(ZTe(r)){let i;try{i=JSON.parse(VTe(r,"utf8"))}catch(o){n.push({detector:ap,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of KTe)i.required?.includes(o)||n.push({detector:ap,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:ap,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==_8&&n.push({detector:ap,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${_8}'`})}catch{}return n}var ap,KTe,_8,b8,v8=y(()=>{"use strict";qe();ap="META_INTEGRITY",KTe=["schema","project","features"],_8="0.1";b8={name:ap,run:JTe}});function YTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return S8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),S8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function S8(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:w8,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 w8,x8,$8=y(()=>{"use strict";qe();w8="SLUG_CONFLICT";x8={name:w8,run:YTe}});function Tl(t){return t==="planned"||t==="in_progress"}var vv=y(()=>{"use strict"});import{existsSync as XTe}from"node:fs";import{join as QTe}from"node:path";function eOe(t){let{cwd:e="."}=t;return he(e,Sv,r=>tOe(r,e))}function tOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=QTe(e,i);XTe(o)||r.push(rOe(n.id,i,n.status))}return r}function rOe(t,e,r){return Tl(r)?{detector:Sv,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:Sv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Sv,wv,_P=y(()=>{"use strict";vv();bt();Sv="MISSING_IMPLEMENTATION";wv={name:Sv,run:eOe}});function nOe(t){let{cwd:e="."}=t;return he(e,bP,iOe)}function iOe(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:bP,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 bP,xv,vP=y(()=>{"use strict";bt();bP="MISSING_TESTS";xv={name:bP,run:nOe}});import{existsSync as oOe,readFileSync as sOe}from"node:fs";import{join as k8}from"node:path";function E8(t){if(oOe(t))try{return JSON.parse(sOe(t,"utf8"))}catch{return}}function uOe(t){let{cwd:e="."}=t,r=E8(k8(e,aOe)),n=E8(k8(e,cOe));if(!r||!n)return[{detector:SP,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>lOe&&i.push({detector:SP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var SP,aOe,cOe,lOe,A8,T8=y(()=>{"use strict";SP="PERFORMANCE_DRIFT",aOe="perf/baseline.json",cOe="perf/current.json",lOe=10;A8={name:SP,run:uOe}});import{existsSync as dOe}from"node:fs";import{join as fOe}from"node:path";function mOe(t){let{cwd:e="."}=t;return he(e,wP,r=>gOe(r,e))}function hOe(t,e){return(t.modules??[]).some(r=>dOe(fOe(e,r)))}function gOe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||hOe(s,e)||r.push(s.id);let n=pOe;if(r.length<=n)return[];let i=r.slice(0,O8).join(", "),o=r.length>O8?", \u2026":"";return[{detector:wP,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 wP,pOe,O8,R8,I8=y(()=>{"use strict";bt();wP="PLANNED_BACKLOG",pOe=5,O8=8;R8={name:wP,run:mOe}});import{existsSync as yOe,readFileSync as _Oe}from"node:fs";import{join as bOe}from"node:path";function wOe(t){let{cwd:e="."}=t;return he(e,xP,r=>xOe(r,e))}function xOe(t,e){if(t.features.lengthn.includes(i))?[{detector:xP,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 xP,vOe,SOe,P8,C8=y(()=>{"use strict";bt();xP="PROJECT_CONTEXT_DRIFT",vOe=8,SOe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];P8={name:xP,run:wOe}});function D8(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:$v,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function $Oe(t){let{cwd:e="."}=t;return he(e,$v,kOe)}function kOe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...D8(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:$v,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...D8(e,n.features,`scenario ${n.id}.features`));return r}var $v,kv,$P=y(()=>{"use strict";bt();$v="REFERENCE_INTEGRITY";kv={name:$v,run:$Oe}});function cp(t=""){return new RegExp(EOe,t)}var EOe,kP=y(()=>{"use strict";EOe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as AOe,readdirSync as TOe,readFileSync as OOe,statSync as ROe,writeFileSync as IOe}from"node:fs";import{dirname as POe,join as lp,normalize as COe,relative as DOe}from"node:path";function LOe(t){let e=[];for(let r of t.matchAll(FOe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(cp("g"))??[])e.push(n);return[...new Set(e)].sort()}function zOe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function N8(t){return t.split("\\").join("/")}function UOe(t){return NOe.some(e=>t===e||t.startsWith(`${e}/`))}function qOe(t){let e=lp(t,"docs");if(!AOe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=TOe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=lp(i,s),c;try{c=ROe(a)}catch{continue}let l=N8(DOe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function BOe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=COe(lp(POe(t),e));return N8(r)}function up(t="."){let e=[];for(let r of qOe(t)){let n;try{n=OOe(lp(t,r),"utf8")}catch{continue}let i=zOe(n),o=LOe(i);if(UOe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(jOe)?[]:i.match(cp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(MOe)){let d=BOe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function j8(t="."){let e=up(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 IOe(lp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return m8(_o(t,"spec","index.yaml"),n,"utf8"),!0}var bv,op=y(()=>{"use strict";bv=Et(cr(),1)});import{existsSync as h8,readFileSync as g8,readdirSync as KTe}from"node:fs";import{join as yP}from"node:path";function JTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=ds(e),i=r.inventory;if(!i){let s=y8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return _P(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[..._P(e),{detector:sp,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 y8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:sp,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(..._P(e)),o}function _P(t){let e=yP(t,"spec","index.yaml"),r=yP(t,"spec","features");if(!h8(e)||!h8(r))return[];let n=new Map;try{for(let l of g8(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 KTe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=g8(yP(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:sp,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:sp,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 sp,y8,_8,b8=y(()=>{"use strict";op();qe();sp="INVENTORY_DRIFT",y8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];_8={name:sp,run:JTe}});import{existsSync as YTe,readFileSync as XTe}from"node:fs";import{join as QTe}from"node:path";function tOe(t){let{cwd:e="."}=t,r=QTe(e,"src","spec","schema.json"),n=[];if(YTe(r)){let i;try{i=JSON.parse(XTe(r,"utf8"))}catch(o){n.push({detector:ap,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of eOe)i.required?.includes(o)||n.push({detector:ap,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:ap,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==v8&&n.push({detector:ap,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${v8}'`})}catch{}return n}var ap,eOe,v8,S8,w8=y(()=>{"use strict";qe();ap="META_INTEGRITY",eOe=["schema","project","features"],v8="0.1";S8={name:ap,run:tOe}});function rOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return x8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),x8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function x8(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:$8,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 $8,k8,E8=y(()=>{"use strict";qe();$8="SLUG_CONFLICT";k8={name:$8,run:rOe}});function Ol(t){return t==="planned"||t==="in_progress"}var vv=y(()=>{"use strict"});import{existsSync as nOe}from"node:fs";import{join as iOe}from"node:path";function oOe(t){let{cwd:e="."}=t;return he(e,Sv,r=>sOe(r,e))}function sOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=iOe(e,i);nOe(o)||r.push(aOe(n.id,i,n.status))}return r}function aOe(t,e,r){return Ol(r)?{detector:Sv,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:Sv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Sv,wv,bP=y(()=>{"use strict";vv();bt();Sv="MISSING_IMPLEMENTATION";wv={name:Sv,run:oOe}});function cOe(t){let{cwd:e="."}=t;return he(e,vP,lOe)}function lOe(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:vP,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 vP,xv,SP=y(()=>{"use strict";bt();vP="MISSING_TESTS";xv={name:vP,run:cOe}});import{existsSync as uOe,readFileSync as dOe}from"node:fs";import{join as A8}from"node:path";function T8(t){if(uOe(t))try{return JSON.parse(dOe(t,"utf8"))}catch{return}}function hOe(t){let{cwd:e="."}=t,r=T8(A8(e,fOe)),n=T8(A8(e,pOe));if(!r||!n)return[{detector:wP,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>mOe&&i.push({detector:wP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var wP,fOe,pOe,mOe,O8,R8=y(()=>{"use strict";wP="PERFORMANCE_DRIFT",fOe="perf/baseline.json",pOe="perf/current.json",mOe=10;O8={name:wP,run:hOe}});import{existsSync as gOe}from"node:fs";import{join as yOe}from"node:path";function bOe(t){let{cwd:e="."}=t;return he(e,xP,r=>SOe(r,e))}function vOe(t,e){return(t.modules??[]).some(r=>gOe(yOe(e,r)))}function SOe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||vOe(s,e)||r.push(s.id);let n=_Oe;if(r.length<=n)return[];let i=r.slice(0,I8).join(", "),o=r.length>I8?", \u2026":"";return[{detector:xP,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 xP,_Oe,I8,P8,C8=y(()=>{"use strict";bt();xP="PLANNED_BACKLOG",_Oe=5,I8=8;P8={name:xP,run:bOe}});import{existsSync as wOe,readFileSync as xOe}from"node:fs";import{join as $Oe}from"node:path";function AOe(t){let{cwd:e="."}=t;return he(e,$P,r=>TOe(r,e))}function TOe(t,e){if(t.features.lengthn.includes(i))?[{detector:$P,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 $P,kOe,EOe,D8,N8=y(()=>{"use strict";bt();$P="PROJECT_CONTEXT_DRIFT",kOe=8,EOe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];D8={name:$P,run:AOe}});function j8(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:$v,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function OOe(t){let{cwd:e="."}=t;return he(e,$v,ROe)}function ROe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...j8(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:$v,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...j8(e,n.features,`scenario ${n.id}.features`));return r}var $v,kv,kP=y(()=>{"use strict";bt();$v="REFERENCE_INTEGRITY";kv={name:$v,run:OOe}});function cp(t=""){return new RegExp(IOe,t)}var IOe,EP=y(()=>{"use strict";IOe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as POe,readdirSync as COe,readFileSync as DOe,statSync as NOe,writeFileSync as jOe}from"node:fs";import{dirname as MOe,join as lp,normalize as FOe,relative as LOe}from"node:path";function HOe(t){let e=[];for(let r of t.matchAll(BOe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(cp("g"))??[])e.push(n);return[...new Set(e)].sort()}function GOe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function M8(t){return t.split("\\").join("/")}function ZOe(t){return zOe.some(e=>t===e||t.startsWith(`${e}/`))}function VOe(t){let e=lp(t,"docs");if(!POe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=COe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=lp(i,s),c;try{c=NOe(a)}catch{continue}let l=M8(LOe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function WOe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=FOe(lp(MOe(t),e));return M8(r)}function up(t="."){let e=[];for(let r of VOe(t)){let n;try{n=DOe(lp(t,r),"utf8")}catch{continue}let i=GOe(n),o=HOe(i);if(ZOe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(UOe)?[]:i.match(cp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(qOe)){let d=WOe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function F8(t="."){let e=up(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 jOe(lp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var NOe,jOe,MOe,FOe,Ev=y(()=>{"use strict";kP();NOe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],jOe="clad-doc-links: ignore",MOe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,FOe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as HOe}from"node:fs";import{join as GOe}from"node:path";function ZOe(t){let{cwd:e="."}=t;return he(e,Av,r=>VOe(r,e))}function VOe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of up(e).docs){for(let o of i.doc_links)HOe(GOe(e,o))||n.push({detector:Av,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:Av,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 Av,Tv,EP=y(()=>{"use strict";Ev();bt();Av="DOC_LINK_INTEGRITY";Tv={name:Av,run:ZOe}});function KOe(t){let{cwd:e="."}=t;return he(e,dp,r=>JOe(r))}function JOe(t){let e=[],r=t.features.length,n=t.scenarios??[];r>=WOe&&n.length===0&&e.push({detector:dp,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 o of n)(o.features??[]).length===0&&e.push({detector:dp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let i=new Map(t.features.filter(o=>typeof o.slug=="string"&&o.slug.length>0).map(o=>[o.slug,o.id]));for(let o of n){if(!o.flow)continue;let s=new Set(o.features??[]),a=new Map;for(let c of o.flow.matchAll(/\(([^)]+)\)/g))for(let l of c[1].split(/[,/·]/)){let u=l.trim(),d=i.get(u);d&&!s.has(d)&&a.set(u,d)}if(a.size>0){let c=[...a].map(([l,u])=>`${l} (${u})`).join(", ");e.push({detector:dp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} flow references ${c} but features[] does not bind ${a.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var dp,WOe,M8,F8=y(()=>{"use strict";bt();dp="SCENARIO_COVERAGE",WOe=8;M8={name:dp,run:KOe}});import{createHash as YOe}from"node:crypto";function XOe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function fp(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??L8),sample:XOe(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(L8),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function pp(t){return(t.features??[]).filter(e=>e.status==="done").length}function QOe(t,e){return e<=0?!1:e>=1?!0:parseInt(YOe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var L8,Ov=y(()=>{"use strict";L8=["unwanted"]});import{existsSync as eRe,readdirSync as tRe}from"node:fs";import{join as U8}from"node:path";import q8 from"node:process";function rRe(t){let e=!1,r=n=>{for(let i of tRe(n,{withFileTypes:!0})){if(e)return;let o=U8(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 AP(t={}){let{cwd:e="."}=t,r=U8(e,us);if(!eRe(r)||!rRe(r))return{stage:Rv,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${us}/ \u2014 skipped`};let n=ht(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Rv,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o=Je(i.cmd,[...i.args,us],{cwd:e,reject:!1}),s=Lt(Rv,i.cmd,o);return s||Yt(Rv,o)}var Rv,us,nRe,TP=y(()=>{"use strict";jr();En();An();Rv="stage_2.3",us="tests/oracle";nRe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${q8.argv[1]}`;if(nRe){let t=AP();console.log(JSON.stringify(t)),q8.exit(t.exitCode)}});import{existsSync as iRe}from"node:fs";import{join as oRe}from"node:path";function sRe(t){let{cwd:e="."}=t;return he(e,Qn,r=>aRe(r,e))}function aRe(t,e){let r=[],n=fp(t.project,pp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?Tn(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(mp(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:Qn,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${us}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!iRe(oRe(e,f))){r.push({detector:Qn,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${us}/`)||r.push({detector:Qn,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${us}/ \u2014 stage_2.3 only runs ${us}/, 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:Qn,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:Qn,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:Qn,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:Qn,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:Qn,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:Qn,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 Qn,B8,H8=y(()=>{"use strict";Xn();Ov();TP();bt();Qn="SPEC_CONFORMANCE";B8={name:Qn,run:sRe}});function cRe(t){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return[{detector:OP,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>G8&&i.push({detector:OP,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${G8})`})}return i}var OP,G8,Z8,V8=y(()=>{"use strict";Xn();OP="STALE_EVIDENCE",G8=90;Z8={name:OP,run:cRe}});import{existsSync as W8}from"node:fs";import{join as K8}from"node:path";function lRe(t){let{cwd:e="."}=t;return he(e,Ol,r=>uRe(r,e))}function uRe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Ol,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:Ol,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=>W8(K8(e,o)));i.length>0&&r.push({detector:Ol,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Tl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>W8(K8(e,i)))&&r.push({detector:Ol,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 Ol,Iv,RP=y(()=>{"use strict";vv();bt();Ol="STALE_SPECIFICATION";Iv={name:Ol,run:lRe}});import{existsSync as J8,statSync as Y8}from"node:fs";import{join as X8}from"node:path";function fRe(t,e){let r=0;for(let n of e){let i=X8(t,n);if(!J8(i))continue;let o=Y8(i).mtimeMs;o>r&&(r=o)}return r}function pRe(t){let{cwd:e="."}=t;return he(e,IP,r=>mRe(r,e))}function mRe(t,e){let r=Ri(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=fRe(e,n);if(i===0)return[];let o=cs([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=X8(e,a);if(!J8(c))continue;let l=Y8(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>dRe&&s.push({detector:IP,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var IP,dRe,Pv,PP=y(()=>{"use strict";ep();Da();bt();IP="STALE_TESTS",dRe=30;Pv={name:IP,run:pRe}});import{existsSync as hRe}from"node:fs";import{join as gRe}from"node:path";function yRe(t){let{cwd:e="."}=t;return he(e,hp,r=>_Re(r,e))}function _Re(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:hp,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=>!hRe(gRe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:hp,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:hp,severity:Tl(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 hp,Cv,CP=y(()=>{"use strict";vv();bt();hp="STATUS_DRIFT";Cv={name:hp,run:yRe}});function bRe(t){let{cwd:e="."}=t;return he(e,Dv,r=>vRe(r,e))}function vRe(t,e){let r=ht(e).language;return r==="unknown"?[{detector:Dv,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:Dv,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var Dv,Q8,e5=y(()=>{"use strict";En();bt();Dv="TECH_STACK_MISMATCH";Q8={name:Dv,run:bRe}});function $Re(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function kRe(t){let{cwd:e="."}=t;return he(e,DP,r=>ERe(r,e))}function ERe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=cs([...$Re(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:DP,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var DP,t5,SRe,wRe,xRe,Nv,NP=y(()=>{"use strict";ep();oP();bt();DP="UNMAPPED_ARTIFACT",t5=["src/stages/**/*.ts","src/spec/**/*.ts"],SRe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},wRe={kotlin:"src/main/kotlin"},xRe=8;Nv={name:DP,run:kRe}});import{existsSync as r5}from"node:fs";import{join as n5}from"node:path";function TRe(t){return ARe.some(e=>t.startsWith(e))}function ORe(t){let{cwd:e="."}=t;return he(e,jP,r=>RRe(r,e))}function RRe(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(TRe(o))continue;let s=o.split("#",1)[0];r5(n5(e,o))||s&&r5(n5(e,s))||r.push({detector:jP,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 ree(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?`[[${XQ(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(QQ);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(QQ);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}/${XQ(s)}.md`,`${a.join(` +`)}`)}return o}function QQ(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as a2e}from"node:fs";import{dirname as c2e,join as DN}from"node:path";import{fileURLToPath as l2e}from"node:url";var NN=c2e(l2e(import.meta.url));function nee(t){for(let e of[DN(NN,"viewer",t),DN(NN,"..","graph","viewer",t),DN(NN,"..","..","dist","viewer",t)])try{return a2e(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function iee(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -867,20 +867,21 @@ ${g.length} question(s) left. continue with \`clad clarify \`. ${o} -`}lP();EP();_P();vP();$P();cP();PP();CP();NP();MP();Om();kP();qe();var o2e=[xv,jv,wv,Nv,kv,Tv,yv,Cv,Pv,gv];function s2e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=cp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function ix(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{ga(e,H(e))}catch{}try{for(let o of o2e){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 s2e(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{ga(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}NN();qe();$i();var c2e=new Set(["mermaid","dot","json","obsidian","html"]);function iee(t={}){try{let e=t.format??"mermaid";if(!c2e.has(e)){M("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=oc(n,".");if(t.focus){let s=Xw(n,i,t.focus);if(s.length===0){M("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){M("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Yw(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=eee(i);for(let[c,l]of a){let u=a2e(s,c);jN(FN(u),{recursive:!0}),MN(u,l,"utf8")}M("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){M("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=nx(i,ix(i,"."));jN(FN(t.out),{recursive:!0}),MN(t.out,s,"utf8"),M("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"?QQ(i):r==="json"?rx(i):XQ(i);t.out?(jN(FN(t.out),{recursive:!0}),MN(t.out,o,"utf8"),M("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){M("fail","graph",e.message),process.exit(1)}}function oee(){try{let t=oc(H(),".");process.stdout.write(nee(ox(t)),()=>process.exit(0))}catch(t){M("fail","graph",t.message),process.exit(1)}}Om();import{createServer as l2e}from"node:http";import{existsSync as u2e,watch as d2e}from"node:fs";import{join as f2e}from"node:path";qe();$i();function p2e(t={}){let e=t.cwd??".",r=new Set,n=()=>oc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}uP();AP();bP();SP();kP();lP();CP();DP();jP();FP();Om();EP();qe();var u2e=[xv,jv,wv,Nv,kv,Tv,yv,Cv,Pv,gv];function d2e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=cp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function ix(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{ya(e,H(e))}catch{}try{for(let o of u2e){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 d2e(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{ya(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}jN();qe();$i();var p2e=new Set(["mermaid","dot","json","obsidian","html"]);function see(t={}){try{let e=t.format??"mermaid";if(!p2e.has(e)){M("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=sc(n,".");if(t.focus){let s=Xw(n,i,t.focus);if(s.length===0){M("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){M("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Yw(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=ree(i);for(let[c,l]of a){let u=f2e(s,c);MN(LN(u),{recursive:!0}),FN(u,l,"utf8")}M("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){M("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=nx(i,ix(i,"."));MN(LN(t.out),{recursive:!0}),FN(t.out,s,"utf8"),M("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"?tee(i):r==="json"?rx(i):eee(i);t.out?(MN(LN(t.out),{recursive:!0}),FN(t.out,o,"utf8"),M("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){M("fail","graph",e.message),process.exit(1)}}function aee(){try{let t=sc(H(),".");process.stdout.write(oee(ox(t)),()=>process.exit(0))}catch(t){M("fail","graph",t.message),process.exit(1)}}Om();import{createServer as m2e}from"node:http";import{existsSync as h2e,watch as g2e}from"node:fs";import{join as y2e}from"node:path";qe();$i();function _2e(t={}){let e=t.cwd??".",r=new Set,n=()=>sc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=l2e((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=rx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(ix(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=m2e((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=rx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(ix(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=nx(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=f2e(e,u);if(u2e(d))try{let f=d2e(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=nx(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=y2e(e,u);if(h2e(d))try{let f=g2e(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 see(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await p2e({port:e,cwd:t.cwd??"."});M("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){M("fail","graph",r.message),process.exit(1)}}var m2e=["stage_1.1","stage_2.1","stage_2.3"];function h2e(t){return(t.features??[]).filter(e=>e.status==="done")}function g2e(t,e){let r=h2e(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 aee(t,e){let r=[];for(let n of m2e){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=g2e(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}Zv();import cee from"node:process";function y2e(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 sx(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=y2e(n,t);i.pass||r.push(i)}return r}Xn();var LN="stage_4.1";function zN(t={}){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return{stage:LN,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=sx(r);if(n.length===0)return{stage:LN,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:LN,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var _2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${cee.argv[1]}`;if(_2e){let t=zN();console.log(JSON.stringify(t)),cee.exit(t.exitCode)}rl();import{randomBytes as b2e}from"node:crypto";import{unlinkSync as v2e}from"node:fs";import{tmpdir as S2e}from"node:os";import{join as w2e,resolve as UN}from"node:path";import x2e from"node:process";var Ur=null;function lee(t){Ur={cwd:UN(t),run:null,jsonFile:null}}function uee(){return Ur!==null}function dee(t,e){if(!Ur||Ur.cwd!==UN(t))return null;if(Ur.run)return Ur.run;let r=w2e(S2e(),`clad-shared-vitest-${x2e.pid}-${b2e(6).toString("hex")}.json`);Ur.jsonFile=r;let n=e(r);return Ur.run={proc:n,jsonFile:r},Ur.run}function fee(t){return!Ur||Ur.cwd!==UN(t)?null:Ur.run}function pee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function mee(){let t=Ur?.jsonFile;if(Ur=null,t)try{v2e(t)}catch{}}jr();import hee from"node:process";var ax="stage_1.4";function qN(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:ax,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:ax,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:ax,pass:!0,exitCode:0}:{stage:ax,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var $2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hee.argv[1]}`;if($2e){let t=qN();console.log(JSON.stringify(t)),hee.exit(t.exitCode)}jr();import gee from"node:process";Rm();An();var cx="stage_2.2";function BN(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Eo("coverage",t))}catch(c){return{stage:cx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:cx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=fee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Lt(cx,r,s);return a||Yt(cx,s)}var A2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${gee.argv[1]}`;if(A2e){let t=BN();console.log(JSON.stringify(t)),gee.exit(t.exitCode)}yp();HN();jr();En();An();import _ee from"node:process";var fx="stage_3.2";function GN(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:fx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!xl(e,o[o.length-1]))return{stage:fx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(fx,i,s);return a||Yt(fx,s)}var H2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${_ee.argv[1]}`;if(H2e){let t=GN();console.log(JSON.stringify(t)),_ee.exit(t.exitCode)}jr();qe();An();import{existsSync as G2e}from"node:fs";import{resolve as vee}from"node:path";import See from"node:process";var ii="stage_2.4",ZN=5e3,Z2e=3e4;function VN(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ii,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return W2e(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ii,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ii,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ii,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=vee(e,r.path);if(!G2e(s))return{stage:ii,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??ZN,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Lt(ii,r.path,c);if(l)return l;if(c.timedOut)return{stage:ii,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:ii,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ii,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var bee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},V2e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function W2e(t,e,r){let n=Math.min(e.length*ZN,Z2e),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(K2e(t,s,r))}return J2e(o)}function K2e(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("/")?vee(t,a):a,u=ZN,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Ia(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 J2e(t){let e="skip";for(let o of t)bee[o.disposition]>bee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${V2e[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:ii,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ii,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var Y2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${See.argv[1]}`;if(Y2e){let t=VN();console.log(JSON.stringify(t)),See.exit(t.exitCode)}jr();En();An();import wee from"node:process";var px="stage_3.1";function WN(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:px,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!xl(e,o[o.length-1]))return{stage:px,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(px,i,s);return a||Yt(px,s)}var X2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wee.argv[1]}`;if(X2e){let t=WN();console.log(JSON.stringify(t)),wee.exit(t.exitCode)}TP();KN();JN();jr();ux();import{randomBytes as oUe}from"node:crypto";import{unlinkSync as sUe}from"node:fs";import{tmpdir as aUe}from"node:os";import{join as cUe}from"node:path";import XN from"node:process";Rm();An();qe();import{readFileSync as tUe}from"node:fs";import{resolve as kee}from"node:path";function rUe(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=kee(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 nUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function iUe(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=nUe(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(kee(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 YN(t,e){try{let r=rUe(tUe(t,"utf8"));return r?iUe(H(e),r,e):[]}catch{return[]}}var Ao="stage_2.1";function Eee(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function lUe(t,e,r){let n,i;try{({cmd:n,args:i}=Eo("coverage",t))}catch{return null}if(!n||!i||!Eee(n,i))return null;let o=n,s=i,a=dee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Lt(Ao,n,c))return null;let u=Yt(Ao,c);if(pee(u)==="fallback")return null;if(r){let d=YN(l,e);if(d.length>0)return{stage:Ao,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ao,pass:!0,exitCode:0}}function QN(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Eo("test",t))}catch(u){return{stage:Ao,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Ao,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Eee(n,i),a=r&&s;if(uee()&&s){let u=lUe(t,e,a);if(u)return u}let c,l=i;a&&(c=cUe(aUe(),`clad-vitest-${XN.pid}-${oUe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Lt(Ao,n,u);if(d)return d;let f=du("unit",Yt(Ao,u),u);if(a&&f.pass&&c){let p=YN(c,e);if(p.length>0)return{stage:Ao,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{sUe(c)}catch{}}}var uUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${XN.argv[1]}`;if(uUe){let t=QN();console.log(JSON.stringify(t)),XN.exit(t.exitCode)}jr();En();An();import Aee from"node:process";var gx="stage_3.3";function ej(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:gx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!xl(e,o[o.length-1]))return{stage:gx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(gx,i,s);return a||Yt(gx,s)}var dUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Aee.argv[1]}`;if(dUe){let t=ej();console.log(JSON.stringify(t)),Aee.exit(t.exitCode)}RP();bf();ca();rj();op();Ev();var Dee=Et(cr(),1);import{existsSync as nj,readFileSync as wUe,readdirSync as Cee,statSync as xUe,writeFileSync as $Ue}from"node:fs";import{basename as Dm,join as Nm,relative as Pee}from"node:path";var kUe=["self-dogfood:","fixture:","derived:"],Nee=/\.(test|spec)\.[jt]sx?$/;function jee(t,e=t,r=[]){let n;try{n=Cee(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Nm(e,i);try{xUe(o).isDirectory()?jee(t,o,r):Nee.test(i)&&r.push(o)}catch{continue}}return r}function Mee(t="."){let e=Nm(t,"spec","features"),r=Nm(t,"tests"),n=[],i=[];if(!nj(e)||!nj(r))return{repaired:n,suggested:i};let o=jee(r),s=new Map;for(let a of o){let c=Pee(t,a).split("\\").join("/"),l=s.get(Dm(a))??[];l.push(c),s.set(Dm(a),l)}for(let a of Cee(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Nm(e,a),l,u;try{l=wUe(c,"utf8"),u=(0,Dee.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(kUe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(nj(Nm(t,b)))continue;let _=s.get(Dm(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=>Dm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Pee(t,h).split("\\").join("/")).find(h=>{let g=Dm(h).replace(Nee,"");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 cee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await _2e({port:e,cwd:t.cwd??"."});M("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){M("fail","graph",r.message),process.exit(1)}}var b2e=["stage_1.1","stage_2.1","stage_2.3"];function v2e(t){return(t.features??[]).filter(e=>e.status==="done")}function S2e(t,e){let r=v2e(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 lee(t,e){let r=[];for(let n of b2e){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=S2e(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}Zv();import uee from"node:process";function w2e(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 sx(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=w2e(n,t);i.pass||r.push(i)}return r}Xn();var zN="stage_4.1";function UN(t={}){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return{stage:zN,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=sx(r);if(n.length===0)return{stage:zN,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:zN,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var x2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${uee.argv[1]}`;if(x2e){let t=UN();console.log(JSON.stringify(t)),uee.exit(t.exitCode)}nl();import{randomBytes as $2e}from"node:crypto";import{unlinkSync as k2e}from"node:fs";import{tmpdir as E2e}from"node:os";import{join as A2e,resolve as qN}from"node:path";import T2e from"node:process";var Ur=null;function dee(t){Ur={cwd:qN(t),run:null,jsonFile:null}}function fee(){return Ur!==null}function pee(t,e){if(!Ur||Ur.cwd!==qN(t))return null;if(Ur.run)return Ur.run;let r=A2e(E2e(),`clad-shared-vitest-${T2e.pid}-${$2e(6).toString("hex")}.json`);Ur.jsonFile=r;let n=e(r);return Ur.run={proc:n,jsonFile:r},Ur.run}function mee(t){return!Ur||Ur.cwd!==qN(t)?null:Ur.run}function hee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function gee(){let t=Ur?.jsonFile;if(Ur=null,t)try{k2e(t)}catch{}}jr();import yee from"node:process";var ax="stage_1.4";function BN(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:ax,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:ax,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:ax,pass:!0,exitCode:0}:{stage:ax,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var O2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${yee.argv[1]}`;if(O2e){let t=BN();console.log(JSON.stringify(t)),yee.exit(t.exitCode)}jr();import _ee from"node:process";Rm();An();var cx="stage_2.2";function HN(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Eo("coverage",t))}catch(c){return{stage:cx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:cx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=mee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Lt(cx,r,s);return a||Yt(cx,s)}var P2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${_ee.argv[1]}`;if(P2e){let t=HN();console.log(JSON.stringify(t)),_ee.exit(t.exitCode)}yp();GN();jr();En();An();import vee from"node:process";var fx="stage_3.2";function ZN(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:fx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!$l(e,o[o.length-1]))return{stage:fx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(fx,i,s);return a||Yt(fx,s)}var K2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${vee.argv[1]}`;if(K2e){let t=ZN();console.log(JSON.stringify(t)),vee.exit(t.exitCode)}jr();qe();An();import{existsSync as J2e}from"node:fs";import{resolve as wee}from"node:path";import xee from"node:process";var ii="stage_2.4",VN=5e3,Y2e=3e4;function WN(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ii,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return Q2e(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ii,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ii,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ii,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=wee(e,r.path);if(!J2e(s))return{stage:ii,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??VN,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Lt(ii,r.path,c);if(l)return l;if(c.timedOut)return{stage:ii,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:ii,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ii,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var See={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},X2e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function Q2e(t,e,r){let n=Math.min(e.length*VN,Y2e),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(eUe(t,s,r))}return tUe(o)}function eUe(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("/")?wee(t,a):a,u=VN,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Pa(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 tUe(t){let e="skip";for(let o of t)See[o.disposition]>See[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${X2e[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:ii,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ii,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var rUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xee.argv[1]}`;if(rUe){let t=WN();console.log(JSON.stringify(t)),xee.exit(t.exitCode)}jr();En();An();import $ee from"node:process";var px="stage_3.1";function KN(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:px,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!$l(e,o[o.length-1]))return{stage:px,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(px,i,s);return a||Yt(px,s)}var nUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${$ee.argv[1]}`;if(nUe){let t=KN();console.log(JSON.stringify(t)),$ee.exit(t.exitCode)}OP();JN();YN();jr();ux();import{randomBytes as uUe}from"node:crypto";import{unlinkSync as dUe}from"node:fs";import{tmpdir as fUe}from"node:os";import{join as pUe}from"node:path";import QN from"node:process";Rm();An();qe();import{readFileSync as sUe}from"node:fs";import{resolve as Aee}from"node:path";function aUe(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=Aee(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 cUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function lUe(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=cUe(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(Aee(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 XN(t,e){try{let r=aUe(sUe(t,"utf8"));return r?lUe(H(e),r,e):[]}catch{return[]}}var Ao="stage_2.1";function Tee(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function mUe(t,e,r){let n,i;try{({cmd:n,args:i}=Eo("coverage",t))}catch{return null}if(!n||!i||!Tee(n,i))return null;let o=n,s=i,a=pee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Lt(Ao,n,c))return null;let u=Yt(Ao,c);if(hee(u)==="fallback")return null;if(r){let d=XN(l,e);if(d.length>0)return{stage:Ao,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ao,pass:!0,exitCode:0}}function ej(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Eo("test",t))}catch(u){return{stage:Ao,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Ao,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Tee(n,i),a=r&&s;if(fee()&&s){let u=mUe(t,e,a);if(u)return u}let c,l=i;a&&(c=pUe(fUe(),`clad-vitest-${QN.pid}-${uUe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Lt(Ao,n,u);if(d)return d;let f=fu("unit",Yt(Ao,u),u);if(a&&f.pass&&c){let p=XN(c,e);if(p.length>0)return{stage:Ao,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{dUe(c)}catch{}}}var hUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${QN.argv[1]}`;if(hUe){let t=ej();console.log(JSON.stringify(t)),QN.exit(t.exitCode)}jr();En();An();import Oee from"node:process";var gx="stage_3.3";function tj(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:gx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!$l(e,o[o.length-1]))return{stage:gx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(gx,i,s);return a||Yt(gx,s)}var gUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Oee.argv[1]}`;if(gUe){let t=tj();console.log(JSON.stringify(t)),Oee.exit(t.exitCode)}IP();bf();la();nj();op();Ev();var jee=Et(cr(),1);import{existsSync as ij,readFileSync as AUe,readdirSync as Nee,statSync as TUe,writeFileSync as OUe}from"node:fs";import{basename as Dm,join as Nm,relative as Dee}from"node:path";var RUe=["self-dogfood:","fixture:","derived:"],Mee=/\.(test|spec)\.[jt]sx?$/;function Fee(t,e=t,r=[]){let n;try{n=Nee(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Nm(e,i);try{TUe(o).isDirectory()?Fee(t,o,r):Mee.test(i)&&r.push(o)}catch{continue}}return r}function Lee(t="."){let e=Nm(t,"spec","features"),r=Nm(t,"tests"),n=[],i=[];if(!ij(e)||!ij(r))return{repaired:n,suggested:i};let o=Fee(r),s=new Map;for(let a of o){let c=Dee(t,a).split("\\").join("/"),l=s.get(Dm(a))??[];l.push(c),s.set(Dm(a),l)}for(let a of Nee(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Nm(e,a),l,u;try{l=AUe(c,"utf8"),u=(0,jee.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(RUe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(ij(Nm(t,b)))continue;let _=s.get(Dm(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=>Dm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Dee(t,h).split("\\").join("/")).find(h=>{let g=Dm(h).replace(Mee,"");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&&$Ue(c,l,"utf8")}return{repaired:n,suggested:i}}tl();import{existsSync as EUe,readFileSync as AUe}from"node:fs";import{join as TUe}from"node:path";function OUe(t,e){let r=TUe(t,e);if(!EUe(r))return[];let n=[];for(let i of AUe(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 Fee(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=>OUe(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 Lee(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(` -`)}Ov();qe();$i();Xn();tl();var ij=["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"],RUe=[...ij,"att"];function IUe(t,e,r){if(e.startsWith("stage_4")){let n=Tn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return sx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function PUe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":p_(e,r,t).state==="fresh"?"\u2713":"!"}function vx(t,e="."){let r=Qo(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...ij.map(o=>IUe(i,o,e)),PUe(i,r,e)]}));return{columns:RUe,rows:n}}function zee(t,e=".",r={}){let n=r.internal??!1,i=vx(t,e),o=[...ij.map(c=>n?c.replace("stage_",""):CUe(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 CUe(t){return _a(t).slice(0,3)}async function H3e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Hle(),Ble)),Promise.resolve().then(()=>(Kle(),Wle)),Promise.resolve().then(()=>(Cp(),fX))]),i=e({cwd:t.cwd});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function G3e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await FQ({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});for(let o of n.created)M("pass",`created ${o}`);for(let o of n.skipped)M("skip",o);for(let o of n.proposals??[])M("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(M("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){V.stdout.write(` +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&OUe(c,l,"utf8")}return{repaired:n,suggested:i}}rl();import{existsSync as IUe,readFileSync as PUe}from"node:fs";import{join as CUe}from"node:path";function DUe(t,e){let r=CUe(t,e);if(!IUe(r))return[];let n=[];for(let i of PUe(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 zee(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=>DUe(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 Uee(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(` +`)}Ov();qe();$i();Xn();rl();var oj=["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"],NUe=[...oj,"att"];function jUe(t,e,r){if(e.startsWith("stage_4")){let n=Tn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return sx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function MUe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":p_(e,r,t).state==="fresh"?"\u2713":"!"}function vx(t,e="."){let r=ts(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...oj.map(o=>jUe(i,o,e)),MUe(i,r,e)]}));return{columns:NUe,rows:n}}function qee(t,e=".",r={}){let n=r.internal??!1,i=vx(t,e),o=[...oj.map(c=>n?c.replace("stage_",""):FUe(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 FUe(t){return ba(t).slice(0,3)}async function eJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Kle(),Wle)),Promise.resolve().then(()=>(eue(),Qle)),Promise.resolve().then(()=>(Cp(),mX))]),i=e({cwd:t.cwd});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function tJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await zQ({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){V.stdout.write(`${JSON.stringify(n,null,2)} +`),V.exit(0);return}for(let o of n.created)M("pass",`created ${o}`);for(let o of n.skipped)M("skip",o);for(let o of n.proposals??[])M("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(M("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){V.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())V.stdout.write(` ${o+1}. ${s} `);V.stdout.write(` @@ -890,30 +891,30 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&$Ue(c,l,"u `),V.stdout.write(` e.g. clad init payment SaaS for B2B `),V.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));V.exit(0)}async function Z3e(t,e){M("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(()=>(vue(),bue)),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)M(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),V.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>xO(l,s)),c=`${gH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;M(i,"run",c),a.length>0&&V.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&M("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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function V3e(t={}){try{let e=H();if(aa("."))M("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ls(".");Al(".",r),La("."),j8(".");let n=Ml(".");n==="created"?M("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&M("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Mee(".");for(let s of i.repaired)M("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)M("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=bx(".");o&&M("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Iv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){M("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);M("note",`propose-archive \xB7 ${s}`,a)}M("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),V.exit(0);return}M("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){M("fail","sync",e.message),V.exit(1)}}function W3e(t){if(!t){M("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=Jy(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";M("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function K3e(t,e={}){if(!t){M("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=Yy(".",t);if(!r){M("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}Xy(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";M("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?V.stdout.write(`Run: git checkout ${r.gitHead} +`));V.exit(0)}async function rJe(t,e){M("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(()=>(kue(),$ue)),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)M(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),V.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>$O(l,s)),c=`${_H(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;M(i,"run",c),a.length>0&&V.stdout.write(`Touched: ${a.join(", ")} +`)}let o=n.stubsCreated.length>0;o&&M("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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function nJe(t={}){try{let e=H();if(ca("."))M("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ds(".");Tl(".",r),za("."),F8(".");let n=Fl(".");n==="created"?M("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&M("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Lee(".");for(let s of i.repaired)M("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)M("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=bx(".");o&&M("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Iv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){M("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);M("note",`propose-archive \xB7 ${s}`,a)}M("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),V.exit(0);return}M("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){M("fail","sync",e.message),V.exit(1)}}function iJe(t){if(!t){M("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=Jy(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";M("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function oJe(t,e={}){if(!t){M("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=Yy(".",t);if(!r){M("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}Xy(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";M("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?V.stdout.write(`Run: git checkout ${r.gitHead} `):V.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),V.exit(0)}async function J3e(t){let e=await aC({force:t.force,quiet:t.quiet});V.exit(e.errors.length>0?1:0)}async function Y3e(){M("note","update","reconciling the current project after the engine upgrade");let t=await PY(".",{wireHosts:async()=>(await aC({quiet:!0})).errors.length});if(M(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){M("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}t.inventoryDeferred?M("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):M("pass","spec",`inventory synced \xB7 ${t.features} features`),M(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),M(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)M("note","deprecated",r);V.stdout.write(` +`),V.exit(0)}async function sJe(t){let e=await cC({force:t.force,quiet:t.quiet});V.exit(e.errors.length>0?1:0)}async function aJe(){M("note","update","reconciling the current project after the engine upgrade");let t=await DY(".",{wireHosts:async()=>(await cC({quiet:!0})).errors.length});if(M(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){M("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}t.inventoryDeferred?M("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):M("pass","spec",`inventory synced \xB7 ${t.features} features`),M(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),M(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)M("note","deprecated",r);V.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),BE({tier:"pre-commit",strict:!0}).anyFailed?V.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"):M("pass","drift","clean against the stricter detectors"),V.exit(t.code)}var X3e={"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 BE(t){let e=t.tier??"all",r=t.silent===!0,n=X3e[e];if(!n)return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):r||M("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",()=>Pm(i)],["stage_1.2",()=>Im(i)],["stage_1.3",()=>ei({...i,strict:t.strict})],["stage_1.4",qN],["stage_1.5",Ha],["stage_1.6",Ep],["stage_2.1",()=>QN({...i,strict:t.strict})],["stage_2.2",()=>BN(i)],["stage_2.3",AP],["stage_2.4",VN],["stage_3.1",WN],["stage_3.2",GN],["stage_3.3",ej],["stage_4.1",zN],["stage_4.2",Cm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ti(d)?"fail":"skip",u=[];m_("."),lee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:_a(d),h=vY(p);ti(h)&&(c=!0,a=Math.max(a,SY(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(M(l(h),m),ti(h)&&sJe(p))}}finally{g_(),mee()}if(t.strict)try{let d=H();for(let f of aee(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&&M("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"||!ti(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=>ti(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&M("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(aa("."))t.json||M("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{jH(".",H())&&(t.json||M("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),lr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function Q3e(t){try{let e=H(),r=Wc(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} -`),V.exit("not_found"in r?1:0)}catch(e){M("fail","context",e.message),V.exit(1)}}function eJe(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=yr(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} -`),V.exit("not_found"in i?1:0)}catch(r){M("fail","impact",r.message),V.exit(1)}}function tJe(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Mv(e,o=>{try{return wue(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),V.exit(0)}catch(e){M("fail","infer-deps",e.message),V.exit(1)}}function rJe(t={}){try{if(t.sessions){VQ(t);return}if(t.trend!==void 0&&t.trend!==!1){WQ(t);return}let e=H(),n=NB(e,o=>{try{return wue(o,"utf8")}catch{return null}},"."),i=MB(".",n);if(t.json)V.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)}`,` ${Kc}`];V.stdout.write(`${c.join(` +`),HE({tier:"pre-commit",strict:!0}).anyFailed?V.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"):M("pass","drift","clean against the stricter detectors"),V.exit(t.code)}var cJe={"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 HE(t){let e=t.tier??"all",r=t.silent===!0,n=cJe[e];if(!n)return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):r||M("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",()=>Pm(i)],["stage_1.2",()=>Im(i)],["stage_1.3",()=>ei({...i,strict:t.strict})],["stage_1.4",BN],["stage_1.5",Ga],["stage_1.6",Ep],["stage_2.1",()=>ej({...i,strict:t.strict})],["stage_2.2",()=>HN(i)],["stage_2.3",TP],["stage_2.4",WN],["stage_3.1",KN],["stage_3.2",ZN],["stage_3.3",tj],["stage_4.1",UN],["stage_4.2",Cm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ti(d)?"fail":"skip",u=[];m_("."),dee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:ba(d),h=wY(p);ti(h)&&(c=!0,a=Math.max(a,xY(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(M(l(h),m),ti(h)&&gJe(p))}}finally{g_(),gee()}if(t.strict)try{let d=H();for(let f of lee(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&&M("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"||!ti(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=>ti(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&M("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(ca("."))t.json||M("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{FH(".",H())&&(t.json||M("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),lr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function lJe(t){try{let e=H(),r=Kc(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} +`),V.exit("not_found"in r?1:0)}catch(e){M("fail","context",e.message),V.exit(1)}}function uJe(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=yr(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} +`),V.exit("not_found"in i?1:0)}catch(r){M("fail","impact",r.message),V.exit(1)}}function dJe(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Mv(e,o=>{try{return Aue(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),V.exit(0)}catch(e){M("fail","infer-deps",e.message),V.exit(1)}}function fJe(t={}){try{if(t.sessions){KQ(t);return}if(t.trend!==void 0&&t.trend!==!1){JQ(t);return}let e=H(),n=MB(e,o=>{try{return Aue(o,"utf8")}catch{return null}},"."),i=LB(".",n);if(t.json)V.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)}`,` ${Jc}`];V.stdout.write(`${c.join(` `)} -`),i.appended?M("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?M("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&M("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}V.exit(0)}catch(e){M("fail","measure",e.message),V.exit(1)}}function nJe(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(M("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){M("fail","check",r.message),V.exit(1)}V.exitCode=BE({...t,focusModules:e}).worst}function iJe(t){let e=tY(".",t,{checkStages:BE,onIndex:La,gitOpInProgress:BT});M(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function oJe(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){M("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=z8(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),i.appended?M("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?M("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&M("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}V.exit(0)}catch(e){M("fail","measure",e.message),V.exit(1)}}function pJe(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(M("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){M("fail","check",r.message),V.exit(1)}V.exitCode=HE({...t,focusModules:e}).worst}function mJe(t){let e=nY(".",t,{checkStages:HE,onIndex:za,gitOpInProgress:HT});M(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function hJe(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){M("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=q8(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),V.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";V.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}V.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),V.exit(s.length>0?1:0);return}if(!t){M("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),V.exit(1);return}let i=Fee(n,t,e.ac,r);if(!i||i.acs.length===0){M("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),V.exit(1);return}V.stdout.write(`${Lee(i)} -`),V.exit(0)}function sJe(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=Sue($f(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] +`),V.exit(s.length>0?1:0);return}if(!t){M("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),V.exit(1);return}let i=zee(n,t,e.ac,r);if(!i||i.acs.length===0){M("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),V.exit(1);return}V.stdout.write(`${Uee(i)} +`),V.exit(0)}function gJe(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=Eue($f(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&V.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&V.stdout.write(` ${Sue(e.trim(),160)} -`)}}function Sue(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function aJe(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(vx(e,"."),null,2)} -`),V.exitCode=0;return}V.stdout.write(`${zee(e,".",{internal:t.internal})} -`),V.exit(0)}function cJe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function lJe(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){M("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=vx(i,e),s={gitHead:ua(e),version:Pl(),generatedAt:t.now??new Date().toISOString()},a=Xc(i),c;try{let l=t.since??Wo(e),u=Ko(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:Jc(u),auditMarkdown:Yc(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=TH({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){M("fail","bundle",i.message),V.exit(1);return}try{B3e(r,n,"utf8")}catch(i){M("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}M("pass","bundle",`${r} \xB7 ${cJe(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function uJe(t){let e=cA(t);M("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function dJe(){let t=new Eq;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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.").action(G3e),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(Z3e),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(V3e),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(J3e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(Y3e),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(nJe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(W3e),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(iJe),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)=>oJe(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(K3e),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(aJe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(Q3e),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)=>eJe(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=>TY(r,{checkStages:BE})),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=>tJe(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=>rJe(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=>iee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>oee()),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=>{see(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=>hH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>v5(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=>lJe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(uJe),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(bY),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(H3e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){X5({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}x5(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(HQ),t}var fJe=!!globalThis.__CLADDING_BUNDLED,pJe=fJe||import.meta.url===`file://${V.argv[1]}`;pJe&&dJe().parse();export{X3e as TIER_STAGES,dJe as createProgram,lJe as runBundleCommand,nJe as runCheckCommand,BE as runCheckStages,W3e as runCheckpointCommand,Q3e as runContextCommand,iJe as runDoneCommand,eJe as runImpactCommand,tJe as runInferDepsCommand,G3e as runInitCommand,rJe as runMeasureCommand,oJe as runOracleCommand,K3e as runRollbackCommand,uJe as runRouteCommand,Z3e as runRunCommand,H3e as runServeCommand,J3e as runSetupCommand,aJe as runStatusCommand,V3e as runSyncCommand,Y3e as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&V.stdout.write(` ${Eue(e.trim(),160)} +`)}}function Eue(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function yJe(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(vx(e,"."),null,2)} +`),V.exitCode=0;return}V.stdout.write(`${qee(e,".",{internal:t.internal})} +`),V.exit(0)}function _Je(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function bJe(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){M("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=vx(i,e),s={gitHead:da(e),version:Cl(),generatedAt:t.now??new Date().toISOString()},a=Qc(i),c;try{let l=t.since??Jo(e),u=Yo(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:Yc(u),auditMarkdown:Xc(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=RH({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){M("fail","bundle",i.message),V.exit(1);return}try{Q3e(r,n,"utf8")}catch(i){M("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}M("pass","bundle",`${r} \xB7 ${_Je(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function vJe(t){let e=lA(t);M("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function SJe(){let t=new Tq;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(tJe),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(rJe),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(nJe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(sJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(aJe),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(pJe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(iJe),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(mJe),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)=>hJe(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(oJe),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(yJe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(lJe),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)=>uJe(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=>RY(r,{checkStages:HE})),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=>dJe(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=>fJe(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=>see(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>aee()),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=>{cee(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=>yH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>w5(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=>bJe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(vJe),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(SY),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(eJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){eY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}k5(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(ZQ),t}var wJe=!!globalThis.__CLADDING_BUNDLED,xJe=wJe||import.meta.url===`file://${V.argv[1]}`;xJe&&SJe().parse();export{cJe as TIER_STAGES,SJe as createProgram,bJe as runBundleCommand,pJe as runCheckCommand,HE as runCheckStages,iJe as runCheckpointCommand,lJe as runContextCommand,mJe as runDoneCommand,uJe as runImpactCommand,dJe as runInferDepsCommand,tJe as runInitCommand,fJe as runMeasureCommand,hJe as runOracleCommand,oJe as runRollbackCommand,vJe as runRouteCommand,rJe as runRunCommand,eJe as runServeCommand,sJe as runSetupCommand,yJe as runStatusCommand,nJe as runSyncCommand,aJe as runUpdateCommand}; diff --git a/plugins/codex/skills/init/SKILL.md b/plugins/codex/skills/init/SKILL.md index 3b5bec99..8e7da77a 100644 --- a/plugins/codex/skills/init/SKILL.md +++ b/plugins/codex/skills/init/SKILL.md @@ -98,4 +98,4 @@ Behavior: - **Directory** ending in `.md` (rare) → stderr warning + free-text fallback. - **Non-text argument** (e.g. `결제 SaaS 만들거야`) → existing free-text behavior, zero regression. -Plugin invocations (`/cladding init docs/plan.md` from Claude Code · Codex CLI · Gemini CLI marketplace installs) inherit this behavior automatically — every plugin skill shells out to the same `clad init` CLI. +Host invocations inherit this behavior automatically because every skill, command, and MCP init tool delegates to the same `clad init` engine. Claude Code and Gemini CLI expose `/cladding:init`; in Codex, type `$cladding` and choose `init (cladding)`; MCP-only hosts can ask in natural language. diff --git a/plugins/gemini-cli/commands/init.toml b/plugins/gemini-cli/commands/init.toml index b7390df4..7797ad3c 100644 --- a/plugins/gemini-cli/commands/init.toml +++ b/plugins/gemini-cli/commands/init.toml @@ -96,5 +96,5 @@ Behavior: - **Directory** ending in `.md` (rare) → stderr warning + free-text fallback. - **Non-text argument** (e.g. `결제 SaaS 만들거야`) → existing free-text behavior, zero regression. -Plugin invocations (`/cladding init docs/plan.md` from Claude Code · Codex CLI · Gemini CLI marketplace installs) inherit this behavior automatically — every plugin skill shells out to the same `clad init` CLI. +Host invocations inherit this behavior automatically because every skill, command, and MCP init tool delegates to the same `clad init` engine. Claude Code and Gemini CLI expose `/cladding:init`; in Codex, type `$cladding` and choose `init (cladding)`; MCP-only hosts can ask in natural language. ''' diff --git a/skills/init/SKILL.md b/skills/init/SKILL.md index 3b5bec99..8e7da77a 100644 --- a/skills/init/SKILL.md +++ b/skills/init/SKILL.md @@ -98,4 +98,4 @@ Behavior: - **Directory** ending in `.md` (rare) → stderr warning + free-text fallback. - **Non-text argument** (e.g. `결제 SaaS 만들거야`) → existing free-text behavior, zero regression. -Plugin invocations (`/cladding init docs/plan.md` from Claude Code · Codex CLI · Gemini CLI marketplace installs) inherit this behavior automatically — every plugin skill shells out to the same `clad init` CLI. +Host invocations inherit this behavior automatically because every skill, command, and MCP init tool delegates to the same `clad init` engine. Claude Code and Gemini CLI expose `/cladding:init`; in Codex, type `$cladding` and choose `init (cladding)`; MCP-only hosts can ask in natural language. diff --git a/spec.yaml b/spec.yaml index fa015e0a..09fd4e18 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: 254 + features: 255 scenarios: 2 capabilities: 6 - test_files: 234 + test_files: 235 diff --git a/spec/capabilities.yaml b/spec/capabilities.yaml index a2f975a8..88b62505 100644 --- a/spec/capabilities.yaml +++ b/spec/capabilities.yaml @@ -27,7 +27,7 @@ capabilities: title: "MCP host (clad serve)" summary: "Exposes cladding's verbs as MCP tools for AI agents to drive directly" surface: tool - features: [F-bb15e6, F-836a90] + features: [F-bb15e6, F-836a90, F-0f4dd6] - id: ab-evaluation title: "A/B evaluation framework" summary: "Measures cladding vs vanilla Claude Code across 8 structural + 2 outcome dimensions" diff --git a/spec/features/natural-language-init-0f4dd6.yaml b/spec/features/natural-language-init-0f4dd6.yaml new file mode 100644 index 00000000..338f8ed8 --- /dev/null +++ b/spec/features/natural-language-init-0f4dd6.yaml @@ -0,0 +1,76 @@ +id: F-0f4dd6 +slug: natural-language-init +title: "Natural-language init across skill and MCP hosts" +status: in_progress +modules: + - src/serve/server.ts + - src/cli/init.ts + - src/cli/clarify.ts + - src/cli/hook.ts + - src/ui/softShell.ts + - src/init/host-setup.ts + - README.md + - docs/glossary.md +depends_on: [F-56abaa, F-5f6b45, F-80d19d] +acceptance_criteria: + - id: AC-001 + ears: ubiquitous + action: expose project initialization and onboarding answers as MCP tools that reuse the CLI core + response: MCP hosts can complete init and its follow-up Q&A without asking the user to run a shell command + text: The system shall expose project initialization and onboarding answers as MCP tools that reuse the CLI core, so MCP hosts can complete init and its follow-up Q&A without asking the user to run a shell command. + test_refs: [tests/serve/server.test.ts] + - id: AC-002 + ears: event + condition: when a new-project initialization request omits the project idea + action: return a needs-input result before creating any project artifact + response: the host asks for intent instead of producing a generic scaffold + text: When a new-project initialization request omits the project idea, the system shall return a needs-input result before creating any project artifact, so the host asks for intent instead of producing a generic scaffold. + test_refs: [tests/serve/init-tools.test.ts] + - id: AC-003 + ears: event + condition: when initialization uses a planning document + action: read a recognized UTF-8 text file confined to the connected project root and pass its complete body through the existing intent-aware onboarding path + response: the planning document is neither truncated nor mistaken for literal intent + text: When initialization uses a planning document, the system shall read a recognized UTF-8 text file confined to the connected project root and pass its complete body through the existing intent-aware onboarding path, so the planning document is neither truncated nor mistaken for literal intent. + test_refs: [tests/serve/init-tools.test.ts] + - id: AC-004 + ears: event + condition: when initialization adopts an existing project + action: force the observed scan path even when the project contains fewer than three source files + response: sparse existing projects are not treated as greenfield ideas + text: When initialization adopts an existing project, the system shall force the observed scan path even when the project contains fewer than three source files, so sparse existing projects are not treated as greenfield ideas. + test_refs: [tests/serve/init-tools.test.ts] + - id: AC-005 + ears: unwanted + condition: if the connected project already contains spec.yaml and refresh was not explicitly requested + action: return an already-initialized result without creating proposals or changing project files + response: repeated natural-language requests remain non-destructive + text: If the connected project already contains spec.yaml and refresh was not explicitly requested, the system shall return an already-initialized result without creating proposals or changing project files, so repeated natural-language requests remain non-destructive. + test_refs: [tests/serve/init-tools.test.ts] + - id: AC-006 + ears: event + condition: when init or clarify returns pending product questions + action: include the next question and onboarding status in structured MCP output + response: the host can continue one answer at a time until onboarding is complete + text: When init or clarify returns pending product questions, the system shall include the next question and onboarding status in structured MCP output, so the host can continue one answer at a time until onboarding is complete. + test_refs: [tests/serve/init-tools.test.ts] + - id: AC-007 + ears: state + condition: while clad setup wires host integrations + action: leave the current project tree unchanged and direct the user to open a project and request Cladding in natural language + response: global host setup never implies project adoption + text: While clad setup wires host integrations, the system shall leave the current project tree unchanged and direct the user to open a project and request Cladding in natural language, so global host setup never implies project adoption. + test_refs: [tests/cli/setup.test.ts] + - id: AC-008 + ears: ubiquitous + action: document natural-language init as the primary path and describe each host's optional explicit invocation syntax accurately + response: Claude and Gemini use their slash command, Codex uses its Cladding skill picker, and MCP hosts use natural language + text: The system shall document natural-language init as the primary path and describe each host's optional explicit invocation syntax accurately, so Claude and Gemini use their slash command, Codex uses its Cladding skill picker, and MCP hosts use natural language. + evidence_refs: [README.md, docs/setup.md] + notes: | + ## Decision + Keep raw `clad init` as a compatibility and automation surface, not the primary onboarding UX. + ## Why + A host-neutral natural-language entry point preserves the product model while host-specific syntax remains an optional accelerator. + ## Trade-off + MCP init and clarify tools are required to make that promise deterministic for hosts without a bundled skill. diff --git a/spec/index.yaml b/spec/index.yaml index 7cbadbcf..e163780e 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -94,6 +94,7 @@ features: F-0e84628e: {slug: merge-ritual-docs, status: done, modules: 2} F-0ed2db: {slug: ai-hints-consumer-instructions, status: done, modules: 11} F-0f2984d0: {slug: infer-deps-dynamic-flag, status: done, modules: 2} + F-0f4dd6: {slug: natural-language-init, status: in_progress, modules: 8} F-10cc42d1: {slug: git-op-write-guard, status: done, modules: 5} F-12d740: {slug: atomic-ac-evidence-fanout, status: done, modules: 1} F-15999130: {slug: inferable-depends-on-detector, status: done, modules: 2} diff --git a/src/cli/clad.ts b/src/cli/clad.ts index 04ae5a01..d00ae570 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -122,6 +122,7 @@ export async function runInitCommand( roots?: string; withHook?: boolean; withCi?: boolean; + json?: boolean; }, ): Promise { const intent = intentTokens && intentTokens.length > 0 ? intentTokens.join(' ').trim() : undefined; @@ -135,6 +136,11 @@ export async function runInitCommand( withHook: opts.withHook, withCi: opts.withCi, }); + if (opts.json) { + process.stdout.write(`${JSON.stringify(result, null, 2)}\n`); + process.exit(0); + return; + } for (const c of result.created) pulse('pass', `created ${c}`); for (const s of result.skipped) pulse('skip', s); for (const p of result.proposals ?? []) pulse('note', 'proposal', p); @@ -1027,6 +1033,7 @@ export function createProgram(): Command { .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 — the authoritative enforcement layer.') + .option('--json', 'emit the raw InitResult for tooling; default is the human-readable surface') .action(runInitCommand); program diff --git a/src/cli/clarify.ts b/src/cli/clarify.ts index 7199616e..35a5816e 100644 --- a/src/cli/clarify.ts +++ b/src/cli/clarify.ts @@ -57,6 +57,8 @@ export interface RefineReport { readonly newQuestions: readonly string[]; readonly mode: OnboardingResult['mode'] | null; readonly status: OnboardingState['status']; + readonly nextQuestion: string | null; + readonly remainingQuestions: number; } /** @@ -235,6 +237,8 @@ function buildReport( newQuestions, mode, status: state.status, + nextQuestion: state.qa.find((qa) => qa.answer === null)?.question ?? null, + remainingQuestions: state.qa.filter((qa) => qa.answer === null).length, }; } diff --git a/src/cli/hook.ts b/src/cli/hook.ts index f88af7e0..9cf62490 100644 --- a/src/cli/hook.ts +++ b/src/cli/hook.ts @@ -222,7 +222,7 @@ const INTENT_HINTS: Readonly>> = { run: 'feature cycle: spec entry → implement → tests → clad done', check: 'verify with clad check --strict', sync: 'clad sync validates + heals the spec', - init: 'scaffold with /cladding:init', + init: 'apply Cladding to this project', }; // Completion claims were the WEAKEST measured engagement surface (the 0.6.0 @@ -252,7 +252,8 @@ function classifyPromptSuggestion(input: unknown): {readonly kind: string; reado const intent = suggestIntent(prompt); const hint = intent ? INTENT_HINTS[intent] : undefined; if (!intent || !hint) return null; - return {kind: intent, text: `cladding: this looks like ${intent} work — ${hint}`}; + const workLabel = intent === 'init' ? 'project setup' : `${intent} work`; + return {kind: intent, text: `cladding: this looks like ${workLabel} — ${hint}`}; } // --- PreToolUse — structural guard on spec edits ------------------------ diff --git a/src/cli/init.ts b/src/cli/init.ts index f2bb3873..d05692c0 100644 --- a/src/cli/init.ts +++ b/src/cli/init.ts @@ -304,7 +304,7 @@ export function scaffoldCiWorkflow(cwd: string): 'created' | 'exists' { * Returns null when the wire state matches the running binary (no notice). */ export function hostWireNotice(lastSetup: string | null, pkgVersion: string | null): string | null { if (lastSetup == null) { - return 'host channels not wired yet — run `clad setup` to enable `/cladding init` from Claude Code / Codex / Gemini'; + return 'host channels not wired yet — run `clad setup`, restart your AI tool, then ask it to apply Cladding to this project'; } if (pkgVersion && lastSetup !== pkgVersion) { return `host wire was set up at v${lastSetup} (current binary v${pkgVersion}) — symlinks usually auto-follow, but run \`clad setup\` to be sure`; diff --git a/src/init/host-setup.ts b/src/init/host-setup.ts index d043f1ba..b25a337e 100644 --- a/src/init/host-setup.ts +++ b/src/init/host-setup.ts @@ -518,7 +518,7 @@ export function renderSetupReport( lines.push('Next steps:'); lines.push(' 1. Restart your AI tool (Claude Code / Codex / Gemini / Cursor)'); lines.push(' 2. Open the project directory'); - lines.push(' 3. Type /cladding init "..." (inside the LLM) or `clad init "..."` (terminal)'); + lines.push(' 3. Ask: "Apply Cladding to this project"'); lines.push(' 4. Start building — cladding checks that spec ↔ code stay in sync on every commit'); return lines.join('\n'); } diff --git a/src/serve/server.ts b/src/serve/server.ts index bd3450c7..571c75aa 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -19,8 +19,8 @@ // @see spec/features/F-073.yaml — server scaffold AC matrix. import {spawnSync} from 'node:child_process'; -import {readFileSync, existsSync, statSync} from 'node:fs'; -import {dirname, join} from 'node:path'; +import {readFileSync, existsSync, realpathSync, statSync} from 'node:fs'; +import {basename, dirname, extname, isAbsolute, join, relative, resolve, sep} from 'node:path'; import {fileURLToPath} from 'node:url'; import {McpServer} from '@modelcontextprotocol/sdk/server/mcp.js'; @@ -71,6 +71,8 @@ export const PERSONA_PROMPT_ALIASES: Readonly> = { /** Tool names cladding's MCP server exposes (stable wire identifiers). */ export const TOOL_NAMES = [ + 'clad_init', + 'clad_clarify', 'clad_list_features', 'clad_get_feature', 'clad_run_check', @@ -266,10 +268,154 @@ function engineShim(): string | null { if (existsSync(candidate)) return candidate; dir = dirname(dir); } + // Marketplace plugins ship the self-contained dist/clad.js without the + // package-level bin/ shim. In that layout the running entry is itself the + // executable engine, so child verbs can safely re-enter it. + const runningEntry = process.argv[1]; + if (runningEntry && basename(runningEntry) === 'clad.js' && existsSync(runningEntry)) { + return runningEntry; + } return null; } +interface EngineJsonResult { + readonly ok: boolean; + readonly payload?: unknown; + readonly error?: string; +} + +/** Runs a CLI verb through the shipped engine and parses its JSON boundary. */ +function runEngineJson(cwd: string, args: readonly string[]): EngineJsonResult { + const shim = engineShim(); + if (!shim) return {ok: false, error: 'cladding engine shim was not found'}; + const result = spawnSync(shim, args, { + cwd, + encoding: 'utf8', + maxBuffer: 10 * 1024 * 1024, + }); + if (result.status !== 0) { + return { + ok: false, + error: (result.stderr || result.stdout || `cladding engine exited ${result.status ?? 'without a status'}`).trim(), + }; + } + try { + return {ok: true, payload: JSON.parse(result.stdout)}; + } catch { + return {ok: false, error: `cladding engine returned invalid JSON: ${result.stdout.slice(0, 500)}`}; + } +} + +const INTENT_FILE_EXTENSIONS = new Set(['.md', '.txt', '.yaml', '.yml', '.markdown']); + +/** Resolves a planning document without permitting reads outside the project. */ +function projectIntentPath(cwd: string, requested: string): {path?: string; error?: string} { + if (!requested.trim()) return {error: 'document_path is required for document mode'}; + if (isAbsolute(requested)) return {error: 'document_path must be relative to the connected project'}; + const root = realpathSync(resolve(cwd)); + const candidate = resolve(root, requested); + if (!existsSync(candidate)) return {error: `planning document not found: ${requested}`}; + let target: string; + try { + target = realpathSync(candidate); + } catch (error) { + return {error: `planning document could not be resolved: ${(error as Error).message}`}; + } + const rel = relative(root, target); + if (rel === '..' || rel.startsWith(`..${sep}`) || isAbsolute(rel)) { + return {error: 'planning document must stay inside the connected project'}; + } + if (!statSync(target).isFile()) return {error: 'planning document must be a regular file'}; + if (!INTENT_FILE_EXTENSIONS.has(extname(target).toLowerCase())) { + return {error: 'planning document must be .md, .txt, .yaml, .yml, or .markdown'}; + } + try { + readFileSync(target, 'utf8'); + } catch (error) { + return {error: `planning document is not readable UTF-8 text: ${(error as Error).message}`}; + } + return {path: rel}; +} + function registerTools(server: McpServer, cwd: string): void { + server.registerTool( + 'clad_init', + { + title: 'Initialize Cladding in the connected project', + description: + 'Use only after the user explicitly asks to initialize or adopt Cladding. Supports a new idea, ' + + 'a planning document inside the project, or adoption of an existing codebase. Returns product-level ' + + 'follow-up questions; answer them with clad_clarify. Never call merely because a repository was opened.', + inputSchema: { + mode: z.enum(['idea', 'document', 'existing']).describe('The user\'s starting point'), + intent: z.string().optional().describe('Project idea, or optional adoption goal for existing mode'), + document_path: z.string().optional().describe('Project-relative planning document for document mode'), + refresh: z.boolean().optional().describe('Explicitly re-scan an already initialized project'), + no_llm: z.boolean().optional().describe('Use deterministic onboarding; intended for offline verification'), + }, + }, + async (args) => { + if (existsSync(join(cwd, 'spec.yaml')) && !args.refresh) { + return { + content: [{type: 'text', text: JSON.stringify({status: 'already_initialized', changed: false}, null, 2)}], + }; + } + if (args.mode === 'idea' && !args.intent?.trim()) { + return { + content: [{type: 'text', text: JSON.stringify({status: 'needs_input', changed: false, question: 'What kind of project are you building?'}, null, 2)}], + }; + } + + const command = ['init']; + if (args.mode === 'document') { + const resolved = projectIntentPath(cwd, args.document_path ?? ''); + if (resolved.error) { + return {isError: true, content: [{type: 'text', text: resolved.error}]}; + } + command.push(resolved.path!); + } else if (args.intent?.trim()) { + command.push(args.intent.trim()); + } + if (args.mode === 'existing') command.push('--scan'); + if (args.no_llm) command.push('--no-llm'); + command.push('--json'); + + const result = runEngineJson(cwd, command); + if (!result.ok) return {isError: true, content: [{type: 'text', text: result.error!}]}; + const init = result.payload as {clarifyingQuestions?: readonly string[]}; + const questions = init.clarifyingQuestions ?? []; + const payload = { + status: questions.length > 0 ? 'needs_answers' : 'initialized', + changed: true, + ...init, + nextQuestion: questions[0] ?? null, + remainingQuestions: questions.length, + }; + return {content: [{type: 'text', text: JSON.stringify(payload, null, 2)}]}; + }, + ); + + server.registerTool( + 'clad_clarify', + { + title: 'Answer the next Cladding onboarding question', + description: + 'Pass the user\'s answer to the next pending product question after clad_init. Returns the next question ' + + 'or a completed status. Do not invent answers.', + inputSchema: { + answer: z.string().min(1).describe('The user\'s answer, verbatim'), + no_llm: z.boolean().optional().describe('Use deterministic refinement; intended for offline verification'), + }, + }, + async (args) => { + const command = ['clarify', args.answer, '--json']; + if (args.no_llm) command.push('--no-llm'); + const result = runEngineJson(cwd, command); + if (!result.ok) return {isError: true, content: [{type: 'text', text: result.error!}]}; + return {content: [{type: 'text', text: JSON.stringify(result.payload, null, 2)}]}; + }, + ); + // clad_list_features — list features in the active spec. // v0.3.10 (F-085) — slug_substring + sort options. server.registerTool( diff --git a/src/ui/softShell.ts b/src/ui/softShell.ts index 0fe74c23..62d4cd7d 100644 --- a/src/ui/softShell.ts +++ b/src/ui/softShell.ts @@ -169,13 +169,13 @@ export const DETECTOR_PLAIN: Readonly> = { AC_DUPLICATE_WITHIN_FEATURE: {lead: 'The same criterion id appears twice inside one feature', action: 'renumber or remove the duplicate criterion'}, ARCHITECTURE_FROM_SPEC: {lead: 'The code imports across layers in a way the architecture rules forbid', action: 'remove the cross-layer import or update the architecture rules'}, CAPABILITIES_FEATURE_MAPPING: {lead: 'A capability lists a feature id that does not exist', action: 'fix the capability feature list'}, - ABSENCE_OF_GOVERNANCE: {lead: 'This project has no cladding spec set up, so the checks have nothing to inspect', action: 'run `clad init` to set up the spec'}, + ABSENCE_OF_GOVERNANCE: {lead: 'This project has no cladding spec set up, so the checks have nothing to inspect', action: 'ask your AI tool to apply Cladding to this project'}, AI_HINTS_FORBIDDEN_PATTERN: {lead: 'The code uses a pattern the project rules told the AI never to use', action: 'remove the forbidden pattern named in the project ai_hints'}, PLANNED_BACKLOG: {lead: 'Several features are specced but have no code yet — the plan has run ahead of the work', action: 'implement the pending features before adding more'}, HOLLOW_GOVERNANCE: {lead: 'The design files exist but are still empty templates', action: 'fill in the capabilities and architecture files'}, DEPENDENCY_CYCLE: {lead: 'Features depend on each other in a loop, so none of them can ever start', action: 'break the dependency loop between the features'}, SCENARIO_COVERAGE: {lead: 'This project defines no user-journey scenarios, or a scenario links no features', action: 'add a scenario, or bind features to the empty one'}, - PROJECT_CONTEXT_DRIFT: {lead: 'The project why-it-exists document is still the empty starter stub', action: 'write docs/project-context.md, or re-run `clad init`'}, + PROJECT_CONTEXT_DRIFT: {lead: 'The project why-it-exists document is still the empty starter stub', action: 'write docs/project-context.md, or ask your AI tool to refresh the Cladding project context'}, SPEC_CONFORMANCE: {lead: 'A finished feature is missing the spec-derived test that should prove it', action: 'add the required oracle test — `clad oracle ` prints the brief'}, DELIVERABLE_INTEGRITY: {lead: 'The declared entry point is missing, or a shipped feature declares none to smoke-test', action: 'fix project.deliverable.path, or declare the entry point'}, SMOKE_PROBE_DEMAND: {lead: 'A shipped, runnable project has no smoke check proving its entry point actually runs', action: 'add a smoke probe under project.smoke'}, diff --git a/tests/cli/setup.test.ts b/tests/cli/setup.test.ts index 6b826631..a0f6e73b 100644 --- a/tests/cli/setup.test.ts +++ b/tests/cli/setup.test.ts @@ -113,6 +113,21 @@ describe('runHostSetup', () => { expect(existsSync(join(home, '.cladding'))).toBe(false); }); + test('setup wires only global host state and does not create project instructions', async () => { + const project = mkdtempSync(join(tmpdir(), 'clad-setup-project-')); + writeFileSync(join(project, 'user-file.txt'), 'keep'); + mkdirSync(join(home, '.codex'), {recursive: true}); + + try { + await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); + expect(existsSync(join(project, 'AGENTS.md'))).toBe(false); + expect(existsSync(join(project, 'CLAUDE.md'))).toBe(false); + expect(readFileSync(join(project, 'user-file.txt'), 'utf8')).toBe('keep'); + } finally { + rmSync(project, {recursive: true, force: true}); + } + }); + // AC-009 — directory-copy fallback with diverged contents → skipped unless --force. test('refuses to overwrite a non-symlink wire without --force', async () => { mkdirSync(join(home, '.claude'), {recursive: true}); @@ -333,13 +348,17 @@ describe('setup report (AC-010) and init wire notices (AC-006/AC-007)', () => { expect(report).toContain('Next steps:'); expect(report).toContain('1. Restart your AI tool'); expect(report).toContain('2. Open the project directory'); - expect(report).toContain('3. Type /cladding init'); + expect(report).toContain('3. Ask: "Apply Cladding to this project"'); + expect(report).not.toContain('clad init'); expect(report).toContain('4. Start building'); }); // AC-006 — never ran `clad setup`. test('hostWireNotice points at clad setup when no setup-status exists', () => { - expect(hostWireNotice(null, '0.6.0')).toContain('run `clad setup`'); + const notice = hostWireNotice(null, '0.6.0'); + expect(notice).toContain('run `clad setup`'); + expect(notice).toContain('ask it to apply Cladding'); + expect(notice).not.toContain('/cladding init'); }); // AC-007 — wired at an older binary version. diff --git a/tests/serve/init-tools.test.ts b/tests/serve/init-tools.test.ts new file mode 100644 index 00000000..54d06b59 --- /dev/null +++ b/tests/serve/init-tools.test.ts @@ -0,0 +1,178 @@ +// Cladding · natural-language init MCP boundary (F-0f4dd6). + +import {existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {dirname, join} from 'node:path'; + +import {Client} from '@modelcontextprotocol/sdk/client/index.js'; +import {InMemoryTransport} from '@modelcontextprotocol/sdk/inMemory.js'; +import {afterEach, beforeEach, describe, expect, test} from 'vitest'; + +import {saveState} from '../../src/cli/scan/onboarding-state.js'; +import {buildServer} from '../../src/serve/server.js'; + +interface Pair { + readonly client: Client; + readonly cleanup: () => Promise; +} + +async function makePair(cwd: string): Promise { + const server = buildServer({cwd, name: 'cladding-init-test', version: '0.0.0-test'}); + const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair(); + const client = new Client({name: 'cladding-init-client', version: '0.0.0-test'}); + await Promise.all([server.connect(serverTransport), client.connect(clientTransport)]); + return { + client, + cleanup: async () => { + await client.close(); + await server.close(); + }, + }; +} + +function payload(result: Awaited>): Record { + const text = (result.content as Array<{type: string; text: string}>)[0].text; + return JSON.parse(text) as Record; +} + +describe('serve/server — natural-language init tools', () => { + let dir: string; + + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-mcp-init-')); + }); + + afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + test('idea mode asks for intent before writing any project artifact', async () => { + const {client, cleanup} = await makePair(dir); + try { + const result = await client.callTool({name: 'clad_init', arguments: {mode: 'idea'}}); + expect(payload(result)).toMatchObject({status: 'needs_input', changed: false}); + expect(readdirSync(dir)).toEqual([]); + } finally { + await cleanup(); + } + }); + + test('idea mode initializes through the shared engine and writes host instructions after spec', async () => { + const {client, cleanup} = await makePair(dir); + try { + const result = await client.callTool({ + name: 'clad_init', + arguments: {mode: 'idea', intent: 'B2B payment SaaS', no_llm: true}, + }); + expect(result.isError).not.toBe(true); + expect(payload(result)).toMatchObject({status: 'initialized', changed: true}); + expect(existsSync(join(dir, 'spec.yaml'))).toBe(true); + expect(existsSync(join(dir, 'AGENTS.md'))).toBe(true); + expect(existsSync(join(dir, 'CLAUDE.md'))).toBe(true); + } finally { + await cleanup(); + } + }); + + test('document mode loads the full project-local planning document', async () => { + mkdirSync(join(dir, 'docs')); + const plan = Array.from({length: 40}, (_, i) => `Section ${i}: payment requirement`).join('\n'); + writeFileSync(join(dir, 'docs', 'plan.md'), plan); + const {client, cleanup} = await makePair(dir); + try { + const result = await client.callTool({ + name: 'clad_init', + arguments: {mode: 'document', document_path: 'docs/plan.md', no_llm: true}, + }); + expect(result.isError).not.toBe(true); + expect(readFileSync(join(dir, 'docs', 'project-context.md'), 'utf8')).toContain(plan); + } finally { + await cleanup(); + } + }); + + test('document mode rejects a path that escapes the connected project', async () => { + const outside = join(dirname(dir), 'outside-plan.md'); + writeFileSync(outside, 'outside'); + const {client, cleanup} = await makePair(dir); + try { + const result = await client.callTool({ + name: 'clad_init', + arguments: {mode: 'document', document_path: '../outside-plan.md', no_llm: true}, + }); + expect(result.isError).toBe(true); + expect(existsSync(join(dir, 'spec.yaml'))).toBe(false); + } finally { + await cleanup(); + rmSync(outside, {force: true}); + } + }); + + test('existing mode forces observed scanning for a sparse codebase', async () => { + mkdirSync(join(dir, 'src')); + writeFileSync(join(dir, 'src', 'index.ts'), 'export const value = 1;\n'); + const {client, cleanup} = await makePair(dir); + try { + const result = await client.callTool({ + name: 'clad_init', + arguments: {mode: 'existing', no_llm: true}, + }); + expect(result.isError).not.toBe(true); + const conventions = readFileSync(join(dir, 'docs', 'conventions.md'), 'utf8'); + expect(conventions).toContain('derived from observed code'); + expect(conventions).toContain('## Observed style'); + } finally { + await cleanup(); + } + }); + + test('an initialized project returns without changing files unless refresh is explicit', async () => { + writeFileSync(join(dir, 'spec.yaml'), 'sentinel\n'); + const {client, cleanup} = await makePair(dir); + try { + const before = readFileSync(join(dir, 'spec.yaml'), 'utf8'); + const result = await client.callTool({name: 'clad_init', arguments: {mode: 'existing'}}); + expect(payload(result)).toEqual({status: 'already_initialized', changed: false}); + expect(readFileSync(join(dir, 'spec.yaml'), 'utf8')).toBe(before); + expect(readdirSync(dir)).toEqual(['spec.yaml']); + } finally { + await cleanup(); + } + }); + + test('clarify returns the next pending question as structured output', async () => { + saveState(dir, { + intent: 'B2B payment SaaS', + language: 'typescript', + projectName: 'demo', + mode: 'greenfield', + startedAt: '2026-07-14T00:00:00.000Z', + status: 'active', + qa: [ + {question: 'Who is the primary user?', answer: null}, + {question: 'Which market launches first?', answer: null}, + ], + }); + mkdirSync(join(dir, 'docs'), {recursive: true}); + mkdirSync(join(dir, 'spec'), {recursive: true}); + writeFileSync(join(dir, 'docs', 'project-context.md'), '# Context\n'); + writeFileSync(join(dir, 'spec', 'capabilities.yaml'), 'schema: "0.1"\ncapabilities: []\n'); + writeFileSync(join(dir, 'spec', 'architecture.yaml'), 'version: "0.1"\nlayers: []\n'); + + const {client, cleanup} = await makePair(dir); + try { + const result = await client.callTool({ + name: 'clad_clarify', + arguments: {answer: 'Business operators', no_llm: true}, + }); + expect(result.isError).not.toBe(true); + expect(payload(result)).toMatchObject({ + status: 'active', + nextQuestion: 'Which market launches first?', + remainingQuestions: 1, + }); + } finally { + await cleanup(); + } + }); +}); From 48aba8473862a715fd5b92e7e24a9bf6e4c3c308 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 14 Jul 2026 15:54:57 +0900 Subject: [PATCH 02/28] fix(onboarding): preserve host sampling across MCP init --- README.html | 2 +- README.ja.md | 2 +- README.ko.html | 2 +- README.ko.md | 2 +- README.md | 2 +- README.zh.md | 2 +- docs/setup.md | 5 +- plugins/claude-code/dist/clad.js | 670 +++++++++--------- .../natural-language-init-0f4dd6.yaml | 2 +- src/cli/clad.ts | 10 +- src/cli/clarify.ts | 204 +++--- src/cli/init.ts | 3 + src/serve/server.ts | 87 ++- tests/cli/clad.test.ts | 8 +- tests/cli/setup.test.ts | 3 + tests/serve/init-tools.test.ts | 95 ++- 16 files changed, 642 insertions(+), 457 deletions(-) diff --git a/README.html b/README.html index db8e0350..5448da05 100644 --- a/README.html +++ b/README.html @@ -520,7 +520,7 @@

Or update from the terminal

npm update -g cladding   # 1. get the new version
 cd <project>             # 2. your project
 clad update              # 3. align this project with the installed version
-

The update preserves your code, spec.yaml, and docs. If the new version reports drift, hand that result to your AI tool:

+

The update preserves your authored code, feature/spec content, and documentation. It may refresh derived inventory/index data and the Cladding-managed block in AGENTS.md or CLAUDE.md. If the new version reports drift, hand that result to your AI tool:

Reconcile the drift the update flagged.
diff --git a/README.ja.md b/README.ja.md index d4b16dec..87a0ae9b 100644 --- a/README.ja.md +++ b/README.ja.md @@ -316,7 +316,7 @@ cd # 2. プロジェクトへ移動 clad update # 3. プロジェクトをインストール済みバージョンに合わせる ``` -更新はコード・`spec.yaml`・ドキュメントを保持する。新しいバージョンが乖離を報告したら、その結果を AI ツールに渡せばよい: +更新はユーザーが作成したコード・機能や spec の本文・ドキュメントを保持する。派生した inventory/index と、`AGENTS.md` または `CLAUDE.md` の Cladding 管理ブロックは新しいバージョンに合わせて更新される場合がある。新しいバージョンが乖離を報告したら、その結果を AI ツールに渡せばよい: ``` 更新で指摘された乖離を解消して。 diff --git a/README.ko.html b/README.ko.html index 480a10e4..824e4a1d 100644 --- a/README.ko.html +++ b/README.ko.html @@ -556,7 +556,7 @@

또는 터미널에서 직접 업데이트하기

npm update -g cladding   # 1. 새 버전 받기
 cd <project>             # 2. 프로젝트로 이동
 clad update              # 3. 설치된 버전에 프로젝트 맞추기
-

업데이트는 코드 · spec.yaml · 문서를 보존한다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다:

+

업데이트는 사용자가 작성한 코드 · 기능/스펙 본문 · 문서를 보존한다. 파생된 인벤토리와 인덱스, AGENTS.md 또는 CLAUDE.md의 Cladding 관리 블록은 새 버전에 맞게 갱신될 수 있다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다:

업데이트가 짚은 어긋남을 정리해줘.
diff --git a/README.ko.md b/README.ko.md index b8379432..f68f3324 100644 --- a/README.ko.md +++ b/README.ko.md @@ -315,7 +315,7 @@ cd # 2. 프로젝트로 이동 clad update # 3. 설치된 버전에 프로젝트 맞추기 ``` -업데이트는 코드 · `spec.yaml` · 문서를 보존한다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다: +업데이트는 사용자가 작성한 코드 · 기능/스펙 본문 · 문서를 보존한다. 파생된 인벤토리와 인덱스, `AGENTS.md` 또는 `CLAUDE.md`의 Cladding 관리 블록은 새 버전에 맞게 갱신될 수 있다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다: ``` 업데이트가 짚은 어긋남을 정리해줘. diff --git a/README.md b/README.md index 19589ca5..201cc53d 100644 --- a/README.md +++ b/README.md @@ -314,7 +314,7 @@ cd # 2. your project clad update # 3. align this project with the installed version ``` -The update preserves your code, `spec.yaml`, and docs. If the new version reports drift, hand that result to your AI tool: +The update preserves your authored code, feature/spec content, and documentation. It may refresh derived inventory/index data and the Cladding-managed block in `AGENTS.md` or `CLAUDE.md`. If the new version reports drift, hand that result to your AI tool: ``` Reconcile the drift the update flagged. diff --git a/README.zh.md b/README.zh.md index 4071bb91..d09685e9 100644 --- a/README.zh.md +++ b/README.zh.md @@ -312,7 +312,7 @@ cd # 2. 进入项目目录 clad update # 3. 让项目与已安装版本对齐 ``` -更新会保留代码、`spec.yaml` 和文档。如果新版本报告了漂移,把结果交给 AI 工具即可: +更新会保留用户编写的代码、功能/spec 正文和文档。派生的 inventory/index 数据以及 `AGENTS.md` 或 `CLAUDE.md` 中由 Cladding 管理的区块可能会随新版本刷新。如果新版本报告了漂移,把结果交给 AI 工具即可: ``` 修复这次更新标出的漂移。 diff --git a/docs/setup.md b/docs/setup.md index fe198c3c..fe40265c 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -44,5 +44,6 @@ cd # 2. once per project clad update # 3. bring it in line with the new version ``` -Your code · `spec.yaml` · docs are left untouched, so it is safe. If the newer version is -stricter and has something to flag, it just **points it out** — it won't block or fix anything. +Your authored code, feature/spec content, and documentation are preserved. The command may refresh +derived inventory/index data and the Cladding-managed block in `AGENTS.md` or `CLAUDE.md`. If the +newer version is stricter, it only **points out** drift — it does not rewrite authored project intent. diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 656d33a0..d99aa9cd 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,42 +4,42 @@ 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 Oue=Object.create;var GE=Object.defineProperty;var Rue=Object.getOwnPropertyDescriptor;var Iue=Object.getOwnPropertyNames;var Pue=Object.getPrototypeOf,Cue=Object.prototype.hasOwnProperty;var He=(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ir=(t,e)=>{for(var r in e)GE(t,r,{get:e[r],enumerable:!0})},Due=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Iue(e))!Cue.call(t,i)&&i!==r&&GE(t,i,{get:()=>e[i],enumerable:!(n=Rue(e,i))||n.enumerable});return t};var Et=(t,e,r)=>(r=t!=null?Oue(Pue(t)):{},Due(e||!t||!t.__esModule?GE(r,"default",{value:t,enumerable:!0}):r,t));var Ld=v(VE=>{var qg=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}},ZE=class extends qg{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};VE.CommanderError=qg;VE.InvalidArgumentError=ZE});var Bg=v(KE=>{var{InvalidArgumentError:Nue}=Ld(),WE=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 Nue(`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 jue(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}KE.Argument=WE;KE.humanReadableArgName=jue});var XE=v(YE=>{var{humanReadableArgName:Mue}=Bg(),JE=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=>Mue(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 hq(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Rr=(t,e)=>{for(var r in e)GE(t,r,{get:e[r],enumerable:!0})},Nue=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Pue(e))!Due.call(t,i)&&i!==r&&GE(t,i,{get:()=>e[i],enumerable:!(n=Iue(e,i))||n.enumerable});return t};var Et=(t,e,r)=>(r=t!=null?Rue(Cue(t)):{},Nue(e||!t||!t.__esModule?GE(r,"default",{value:t,enumerable:!0}):r,t));var Ld=v(VE=>{var qg=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}},ZE=class extends qg{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};VE.CommanderError=qg;VE.InvalidArgumentError=ZE});var Bg=v(KE=>{var{InvalidArgumentError:jue}=Ld(),WE=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 jue(`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 Mue(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}KE.Argument=WE;KE.humanReadableArgName=Mue});var XE=v(YE=>{var{humanReadableArgName:Fue}=Bg(),JE=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=>Fue(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 yq(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 hq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}YE.Help=JE;YE.stripColor=hq});var rA=v(tA=>{var{InvalidArgumentError:Fue}=Ld(),QE=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=Lue(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 Fue(`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?gq(this.name().replace(/^no-/,"")):gq(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}},eA=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 gq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Lue(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 yq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}YE.Help=JE;YE.stripColor=yq});var rA=v(tA=>{var{InvalidArgumentError:Lue}=Ld(),QE=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=zue(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 Lue(`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?_q(this.name().replace(/^no-/,"")):_q(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}},eA=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 _q(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function zue(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}}tA.Option=QE;tA.DualOptions=eA});var _q=v(yq=>{function zue(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 Uue(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=zue(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}}tA.Option=QE;tA.DualOptions=eA});var vq=v(bq=>{function Uue(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 que(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=Uue(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]}?)`:""}yq.suggestSimilar=Uue});var wq=v(aA=>{var que=He("node:events").EventEmitter,nA=He("node:child_process"),no=He("node:path"),Hg=He("node:fs"),Ue=He("node:process"),{Argument:Bue,humanReadableArgName:Hue}=Bg(),{CommanderError:iA}=Ld(),{Help:Gue,stripColor:Zue}=XE(),{Option:bq,DualOptions:Vue}=rA(),{suggestSimilar:vq}=_q(),oA=class t extends que{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>sA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>sA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Zue(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 Gue,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 Bue(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 iA(e,r,n)),Ue.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 bq(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 bq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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]}?)`:""}bq.suggestSimilar=que});var $q=v(aA=>{var Bue=He("node:events").EventEmitter,nA=He("node:child_process"),ro=He("node:path"),Hg=He("node:fs"),Ue=He("node:process"),{Argument:Hue,humanReadableArgName:Gue}=Bg(),{CommanderError:iA}=Ld(),{Help:Zue,stripColor:Vue}=XE(),{Option:Sq,DualOptions:Wue}=rA(),{suggestSimilar:wq}=vq(),oA=class t extends Bue{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>sA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>sA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Vue(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 Zue,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 Hue(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 iA(e,r,n)),Ue.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 Sq(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 Sq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(Hg.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=no.resolve(u,d);if(Hg.existsSync(f))return f;if(i.includes(no.extname(d)))return;let p=i.find(m=>Hg.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=Hg.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=no.resolve(no.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=no.basename(this._scriptPath,no.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(no.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Sq(Ue.execArgv).concat(r),c=nA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=nA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Sq(Ue.execArgv).concat(r),c=nA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 iA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new iA(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=ro.resolve(u,d);if(Hg.existsSync(f))return f;if(i.includes(ro.extname(d)))return;let p=i.find(m=>Hg.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=Hg.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=ro.resolve(ro.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=ro.basename(this._scriptPath,ro.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(ro.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=xq(Ue.execArgv).concat(r),c=nA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=nA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=xq(Ue.execArgv).concat(r),c=nA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 iA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new iA(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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Vue(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=vq(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=vq(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=>Hue(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=no.basename(e,no.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(Ue.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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Wue(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=wq(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=wq(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=>Gue(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=ro.basename(e,ro.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(Ue.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 Sq(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 sA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}aA.Command=oA;aA.useColor=sA});var Eq=v(Sn=>{var{Argument:xq}=Bg(),{Command:cA}=wq(),{CommanderError:Wue,InvalidArgumentError:$q}=Ld(),{Help:Kue}=XE(),{Option:kq}=rA();Sn.program=new cA;Sn.createCommand=t=>new cA(t);Sn.createOption=(t,e)=>new kq(t,e);Sn.createArgument=(t,e)=>new xq(t,e);Sn.Command=cA;Sn.Option=kq;Sn.Argument=xq;Sn.Help=Kue;Sn.CommanderError=Wue;Sn.InvalidArgumentError=$q;Sn.InvalidOptionArgumentError=$q});var Ce=v(Jt=>{"use strict";var uA=Symbol.for("yaml.alias"),Rq=Symbol.for("yaml.document"),Gg=Symbol.for("yaml.map"),Iq=Symbol.for("yaml.pair"),dA=Symbol.for("yaml.scalar"),Zg=Symbol.for("yaml.seq"),io=Symbol.for("yaml.node.type"),tde=t=>!!t&&typeof t=="object"&&t[io]===uA,rde=t=>!!t&&typeof t=="object"&&t[io]===Rq,nde=t=>!!t&&typeof t=="object"&&t[io]===Gg,ide=t=>!!t&&typeof t=="object"&&t[io]===Iq,Pq=t=>!!t&&typeof t=="object"&&t[io]===dA,ode=t=>!!t&&typeof t=="object"&&t[io]===Zg;function Cq(t){if(t&&typeof t=="object")switch(t[io]){case Gg:case Zg:return!0}return!1}function sde(t){if(t&&typeof t=="object")switch(t[io]){case uA:case Gg:case dA:case Zg:return!0}return!1}var ade=t=>(Pq(t)||Cq(t))&&!!t.anchor;Jt.ALIAS=uA;Jt.DOC=Rq;Jt.MAP=Gg;Jt.NODE_TYPE=io;Jt.PAIR=Iq;Jt.SCALAR=dA;Jt.SEQ=Zg;Jt.hasAnchor=ade;Jt.isAlias=tde;Jt.isCollection=Cq;Jt.isDocument=rde;Jt.isMap=nde;Jt.isNode=sde;Jt.isPair=ide;Jt.isScalar=Pq;Jt.isSeq=ode});var zd=v(fA=>{"use strict";var Mt=Ce(),Pr=Symbol("break visit"),Dq=Symbol("skip children"),vi=Symbol("remove node");function Vg(t,e){let r=Nq(e);Mt.isDocument(t)?jc(null,t.contents,r,Object.freeze([t]))===vi&&(t.contents=null):jc(null,t,r,Object.freeze([]))}Vg.BREAK=Pr;Vg.SKIP=Dq;Vg.REMOVE=vi;function jc(t,e,r,n){let i=jq(t,e,r,n);if(Mt.isNode(i)||Mt.isPair(i))return Mq(t,n,i),jc(t,i,r,n);if(typeof i!="symbol"){if(Mt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var Fq=Ce(),cde=zd(),lde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ude=t=>t.replace(/[!,[\]{}]/g,e=>lde[e]),Ud=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+ude(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&&Fq.isNode(e.contents)){let o={};cde.visit(e.contents,(s,a)=>{Fq.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(` -`)}};Ud.defaultYaml={explicit:!1,version:"1.2"};Ud.defaultTags={"!!":"tag:yaml.org,2002:"};Lq.Directives=Ud});var Kg=v(qd=>{"use strict";var zq=Ce(),dde=zd();function fde(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 Uq(t){let e=new Set;return dde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function qq(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function pde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=Uq(t));let s=qq(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(zq.isScalar(s.node)||zq.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}}qd.anchorIsValid=fde;qd.anchorNames=Uq;qd.createNodeAnchors=pde;qd.findNewAnchor=qq});var mA=v(Bq=>{"use strict";function Bd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var mde=Ce();function Hq(t,e,r){if(Array.isArray(t))return t.map((n,i)=>Hq(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!mde.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}Gq.toJS=Hq});var Jg=v(Vq=>{"use strict";var hde=mA(),Zq=Ce(),gde=zo(),hA=class{constructor(e){Object.defineProperty(this,Zq.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(!Zq.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=gde.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?hde.applyReviver(o,{"":a},"",a):a}};Vq.NodeBase=hA});var Hd=v(Wq=>{"use strict";var yde=Kg(),_de=zd(),Fc=Ce(),bde=Jg(),vde=zo(),gA=class extends bde.NodeBase{constructor(e){super(Fc.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=[],_de.visit(e,{Node:(o,s)=>{(Fc.isAlias(s)||Fc.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||(vde.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=Yg(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(yde.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 Yg(t,e,r){if(Fc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Fc.isCollection(e)){let n=0;for(let i of e.items){let o=Yg(t,i,r);o>n&&(n=o)}return n}else if(Fc.isPair(e)){let n=Yg(t,e.key,r),i=Yg(t,e.value,r);return Math.max(n,i)}return 1}Wq.Alias=gA});var It=v(yA=>{"use strict";var Sde=Ce(),wde=Jg(),xde=zo(),$de=t=>!t||typeof t!="function"&&typeof t!="object",Uo=class extends wde.NodeBase{constructor(e){super(Sde.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:xde.toJS(this.value,e,r)}toString(){return String(this.value)}};Uo.BLOCK_FOLDED="BLOCK_FOLDED";Uo.BLOCK_LITERAL="BLOCK_LITERAL";Uo.PLAIN="PLAIN";Uo.QUOTE_DOUBLE="QUOTE_DOUBLE";Uo.QUOTE_SINGLE="QUOTE_SINGLE";yA.Scalar=Uo;yA.isScalarValue=$de});var Gd=v(Jq=>{"use strict";var kde=Hd(),ra=Ce(),Kq=It(),Ede="tag:yaml.org,2002:";function Ade(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 Tde(t,e,r){if(ra.isDocument(t)&&(t=t.contents),ra.isNode(t))return t;if(ra.isPair(t)){let d=r.schema[ra.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 kde.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Ede+e.slice(2));let l=Ade(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new Kq.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ra.MAP]:Symbol.iterator in Object(t)?s[ra.SEQ]:s[ra.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 Kq.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Jq.createNode=Tde});var Qg=v(Xg=>{"use strict";var Ode=Gd(),Si=Ce(),Rde=Jg();function _A(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 Ode.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 Yq=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,bA=class extends Rde.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=>Si.isNode(n)||Si.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Yq(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Si.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,_A(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(Si.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&&Si.isScalar(o)?o.value:o:Si.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Si.isPair(r))return!1;let n=r.value;return n==null||e&&Si.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 Si.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(Si.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,_A(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Xg.Collection=bA;Xg.collectionFromPath=_A;Xg.isEmptyPath=Yq});var Zd=v(ey=>{"use strict";var Ide=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function vA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Pde=(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 xq(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 sA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}aA.Command=oA;aA.useColor=sA});var Tq=v(vn=>{var{Argument:kq}=Bg(),{Command:cA}=$q(),{CommanderError:Kue,InvalidArgumentError:Eq}=Ld(),{Help:Jue}=XE(),{Option:Aq}=rA();vn.program=new cA;vn.createCommand=t=>new cA(t);vn.createOption=(t,e)=>new Aq(t,e);vn.createArgument=(t,e)=>new kq(t,e);vn.Command=cA;vn.Option=Aq;vn.Argument=kq;vn.Help=Jue;vn.CommanderError=Kue;vn.InvalidArgumentError=Eq;vn.InvalidOptionArgumentError=Eq});var Ce=v(Jt=>{"use strict";var uA=Symbol.for("yaml.alias"),Pq=Symbol.for("yaml.document"),Gg=Symbol.for("yaml.map"),Cq=Symbol.for("yaml.pair"),dA=Symbol.for("yaml.scalar"),Zg=Symbol.for("yaml.seq"),no=Symbol.for("yaml.node.type"),rde=t=>!!t&&typeof t=="object"&&t[no]===uA,nde=t=>!!t&&typeof t=="object"&&t[no]===Pq,ide=t=>!!t&&typeof t=="object"&&t[no]===Gg,ode=t=>!!t&&typeof t=="object"&&t[no]===Cq,Dq=t=>!!t&&typeof t=="object"&&t[no]===dA,sde=t=>!!t&&typeof t=="object"&&t[no]===Zg;function Nq(t){if(t&&typeof t=="object")switch(t[no]){case Gg:case Zg:return!0}return!1}function ade(t){if(t&&typeof t=="object")switch(t[no]){case uA:case Gg:case dA:case Zg:return!0}return!1}var cde=t=>(Dq(t)||Nq(t))&&!!t.anchor;Jt.ALIAS=uA;Jt.DOC=Pq;Jt.MAP=Gg;Jt.NODE_TYPE=no;Jt.PAIR=Cq;Jt.SCALAR=dA;Jt.SEQ=Zg;Jt.hasAnchor=cde;Jt.isAlias=rde;Jt.isCollection=Nq;Jt.isDocument=nde;Jt.isMap=ide;Jt.isNode=ade;Jt.isPair=ode;Jt.isScalar=Dq;Jt.isSeq=sde});var zd=v(fA=>{"use strict";var Mt=Ce(),Ir=Symbol("break visit"),jq=Symbol("skip children"),bi=Symbol("remove node");function Vg(t,e){let r=Mq(e);Mt.isDocument(t)?jc(null,t.contents,r,Object.freeze([t]))===bi&&(t.contents=null):jc(null,t,r,Object.freeze([]))}Vg.BREAK=Ir;Vg.SKIP=jq;Vg.REMOVE=bi;function jc(t,e,r,n){let i=Fq(t,e,r,n);if(Mt.isNode(i)||Mt.isPair(i))return Lq(t,n,i),jc(t,i,r,n);if(typeof i!="symbol"){if(Mt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var zq=Ce(),lde=zd(),ude={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},dde=t=>t.replace(/[!,[\]{}]/g,e=>ude[e]),Ud=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+dde(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&&zq.isNode(e.contents)){let o={};lde.visit(e.contents,(s,a)=>{zq.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(` +`)}};Ud.defaultYaml={explicit:!1,version:"1.2"};Ud.defaultTags={"!!":"tag:yaml.org,2002:"};Uq.Directives=Ud});var Kg=v(qd=>{"use strict";var qq=Ce(),fde=zd();function pde(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 Bq(t){let e=new Set;return fde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function Hq(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function mde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=Bq(t));let s=Hq(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(qq.isScalar(s.node)||qq.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}}qd.anchorIsValid=pde;qd.anchorNames=Bq;qd.createNodeAnchors=mde;qd.findNewAnchor=Hq});var mA=v(Gq=>{"use strict";function Bd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var hde=Ce();function Zq(t,e,r){if(Array.isArray(t))return t.map((n,i)=>Zq(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!hde.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}Vq.toJS=Zq});var Jg=v(Kq=>{"use strict";var gde=mA(),Wq=Ce(),yde=zo(),hA=class{constructor(e){Object.defineProperty(this,Wq.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(!Wq.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=yde.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?gde.applyReviver(o,{"":a},"",a):a}};Kq.NodeBase=hA});var Hd=v(Jq=>{"use strict";var _de=Kg(),bde=zd(),Fc=Ce(),vde=Jg(),Sde=zo(),gA=class extends vde.NodeBase{constructor(e){super(Fc.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=[],bde.visit(e,{Node:(o,s)=>{(Fc.isAlias(s)||Fc.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||(Sde.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=Yg(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(_de.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 Yg(t,e,r){if(Fc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Fc.isCollection(e)){let n=0;for(let i of e.items){let o=Yg(t,i,r);o>n&&(n=o)}return n}else if(Fc.isPair(e)){let n=Yg(t,e.key,r),i=Yg(t,e.value,r);return Math.max(n,i)}return 1}Jq.Alias=gA});var It=v(yA=>{"use strict";var wde=Ce(),xde=Jg(),$de=zo(),kde=t=>!t||typeof t!="function"&&typeof t!="object",Uo=class extends xde.NodeBase{constructor(e){super(wde.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:$de.toJS(this.value,e,r)}toString(){return String(this.value)}};Uo.BLOCK_FOLDED="BLOCK_FOLDED";Uo.BLOCK_LITERAL="BLOCK_LITERAL";Uo.PLAIN="PLAIN";Uo.QUOTE_DOUBLE="QUOTE_DOUBLE";Uo.QUOTE_SINGLE="QUOTE_SINGLE";yA.Scalar=Uo;yA.isScalarValue=kde});var Gd=v(Xq=>{"use strict";var Ede=Hd(),ra=Ce(),Yq=It(),Ade="tag:yaml.org,2002:";function Tde(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 Ode(t,e,r){if(ra.isDocument(t)&&(t=t.contents),ra.isNode(t))return t;if(ra.isPair(t)){let d=r.schema[ra.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 Ede.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Ade+e.slice(2));let l=Tde(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new Yq.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ra.MAP]:Symbol.iterator in Object(t)?s[ra.SEQ]:s[ra.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 Yq.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Xq.createNode=Ode});var Qg=v(Xg=>{"use strict";var Rde=Gd(),vi=Ce(),Ide=Jg();function _A(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 Rde.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 Qq=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,bA=class extends Ide.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=>vi.isNode(n)||vi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Qq(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(vi.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,_A(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(vi.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&&vi.isScalar(o)?o.value:o:vi.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!vi.isPair(r))return!1;let n=r.value;return n==null||e&&vi.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 vi.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(vi.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,_A(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Xg.Collection=bA;Xg.collectionFromPath=_A;Xg.isEmptyPath=Qq});var Zd=v(ey=>{"use strict";var Pde=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function vA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Cde=(t,e,r)=>t.endsWith(` `)?vA(r,e):r.includes(` `)?` -`+vA(r,e):(t.endsWith(" ")?"":" ")+r;ey.indentComment=vA;ey.lineComment=Pde;ey.stringifyComment=Ide});var Qq=v(Vd=>{"use strict";var Cde="flow",SA="block",ty="quoted";function Dde(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===SA&&(h=Xq(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===ty&&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===SA&&(h=Xq(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+vA(r,e):(t.endsWith(" ")?"":" ")+r;ey.indentComment=vA;ey.lineComment=Cde;ey.stringifyComment=Pde});var t4=v(Vd=>{"use strict";var Dde="flow",SA="block",ty="quoted";function Nde(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===SA&&(h=e4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===ty&&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===SA&&(h=e4(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===ty){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 Hn=It(),qo=Qq(),ny=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),iy=t=>/^(%|---|\.\.\.)/m.test(t);function Nde(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 Bn=It(),qo=t4(),ny=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),iy=t=>/^(%|---|\.\.\.)/m.test(t);function jde(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 Wd(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(iy(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(xA,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{O=!0});let E=qo.foldFlowLines(`${_}${w}${p}`,l,qo.FOLD_BLOCK,A);if(!O)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,A=ny(n,!0);s!=="folded"&&e!==Bn.Scalar.BLOCK_FOLDED&&(A.onOverflow=()=>{O=!0});let E=qo.foldFlowLines(`${_}${w}${p}`,l,qo.FOLD_BLOCK,A);if(!O)return`>${x} ${l}${E}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function jde(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 Mde(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 Lc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?Lc(o,e):ry(t,e,r,n);if(!a&&!u&&i!==Hn.Scalar.PLAIN&&o.includes(` +`)?Lc(o,e):ry(t,e,r,n);if(!a&&!u&&i!==Bn.Scalar.PLAIN&&o.includes(` `))return ry(t,e,r,n);if(iy(o)){if(c==="")return e.forceBlockIndent=!0,ry(t,e,r,n);if(a&&c===l)return Lc(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 Lc(o,e)}return a?d:qo.foldFlowLines(d,c,qo.FOLD_FLOW,ny(e,!1))}function Mde(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!==Hn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Hn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Hn.Scalar.BLOCK_FOLDED:case Hn.Scalar.BLOCK_LITERAL:return i||o?Lc(s.value,e):ry(s,e,r,n);case Hn.Scalar.QUOTE_DOUBLE:return Wd(s.value,e);case Hn.Scalar.QUOTE_SINGLE:return wA(s.value,e);case Hn.Scalar.PLAIN:return jde(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}e4.stringifyString=Mde});var Jd=v($A=>{"use strict";var Fde=Kg(),Bo=Ce(),Lde=Zd(),zde=Kd();function Ude(t,e){let r=Object.assign({blockQuote:!0,commentString:Lde.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 qde(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(Bo.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 Bde(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Bo.isScalar(t)||Bo.isCollection(t))&&t.anchor;o&&Fde.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 Hde(t,e,r,n){if(Bo.isPair(t))return t.toString(e,r,n);if(Bo.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=Bo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=qde(e.doc.schema.tags,o));let s=Bde(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):Bo.isScalar(o)?zde.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Bo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}$A.createStringifyContext=Ude;$A.stringify=Hde});var i4=v(n4=>{"use strict";var oo=Ce(),t4=It(),r4=Jd(),Yd=Zd();function Gde({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=oo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(oo.isCollection(t)||!oo.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||oo.isCollection(t)||(oo.isScalar(t)?t.type===t4.Scalar.BLOCK_FOLDED||t.type===t4.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=r4.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+=Yd.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Yd.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=Yd.lineComment(g,r.indent,l(f))));let b,_,S;oo.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&&oo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&oo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=r4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +${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 Lc(o,e)}return a?d:qo.foldFlowLines(d,c,qo.FOLD_FLOW,ny(e,!1))}function Fde(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!==Bn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Bn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Bn.Scalar.BLOCK_FOLDED:case Bn.Scalar.BLOCK_LITERAL:return i||o?Lc(s.value,e):ry(s,e,r,n);case Bn.Scalar.QUOTE_DOUBLE:return Wd(s.value,e);case Bn.Scalar.QUOTE_SINGLE:return wA(s.value,e);case Bn.Scalar.PLAIN:return Mde(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}r4.stringifyString=Fde});var Jd=v($A=>{"use strict";var Lde=Kg(),Bo=Ce(),zde=Zd(),Ude=Kd();function qde(t,e){let r=Object.assign({blockQuote:!0,commentString:zde.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 Bde(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(Bo.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 Hde(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Bo.isScalar(t)||Bo.isCollection(t))&&t.anchor;o&&Lde.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 Gde(t,e,r,n){if(Bo.isPair(t))return t.toString(e,r,n);if(Bo.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=Bo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Bde(e.doc.schema.tags,o));let s=Hde(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):Bo.isScalar(o)?Ude.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Bo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}$A.createStringifyContext=qde;$A.stringify=Gde});var s4=v(o4=>{"use strict";var io=Ce(),n4=It(),i4=Jd(),Yd=Zd();function Zde({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=io.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(io.isCollection(t)||!io.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||io.isCollection(t)||(io.isScalar(t)?t.type===n4.Scalar.BLOCK_FOLDED||t.type===n4.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=i4.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+=Yd.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Yd.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=Yd.lineComment(g,r.indent,l(f))));let b,_,S;io.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&&io.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&io.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=i4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let A=l(_);O+=` ${Yd.indentComment(A,r.indent)}`}w===""&&!r.inFlow?O===` `&&S&&(O=` `):O+=` -${r.indent}`}else if(!p&&oo.isCollection(e)){let A=w[0],E=w.indexOf(` +${r.indent}`}else if(!p&&io.isCollection(e)){let A=w[0],E=w.indexOf(` `),C=E!==-1,k=r.inFlow??e.flow??e.items.length===0;if(C||!k){let q=!1;if(C&&(A==="&"||A==="!")){let Q=w.indexOf(" ");A==="&"&&Q!==-1&&Q{"use strict";var o4=He("process");function Zde(t,...e){t==="debug"&&console.log(...e)}function Vde(t,e){(t==="debug"||t==="warn")&&(typeof o4.emitWarning=="function"?o4.emitWarning(e):console.warn(e))}kA.debug=Zde;kA.warn=Vde});var ly=v(cy=>{"use strict";var ay=Ce(),s4=It(),oy="<<",sy={identify:t=>t===oy||typeof t=="symbol"&&t.description===oy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new s4.Scalar(Symbol(oy)),{addToJSMap:a4}),stringify:()=>oy},Wde=(t,e)=>(sy.identify(e)||ay.isScalar(e)&&(!e.type||e.type===s4.Scalar.PLAIN)&&sy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===sy.tag&&r.default);function a4(t,e,r){let n=c4(t,r);if(ay.isSeq(n))for(let i of n.items)AA(t,e,i);else if(Array.isArray(n))for(let i of n)AA(t,e,i);else AA(t,e,n)}function AA(t,e,r){let n=c4(t,r);if(!ay.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 c4(t,e){return t&&ay.isAlias(e)?e.resolve(t.doc,t):e}cy.addMergeToJSMap=a4;cy.isMergeKey=Wde;cy.merge=sy});var OA=v(d4=>{"use strict";var Kde=EA(),l4=ly(),Jde=Jd(),u4=Ce(),TA=zo();function Yde(t,e,{key:r,value:n}){if(u4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(l4.isMergeKey(t,r))l4.addMergeToJSMap(t,e,n);else{let i=TA.toJS(r,"",t);if(e instanceof Map)e.set(i,TA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Xde(r,i,t),s=TA.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 Xde(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(u4.isNode(t)&&r?.doc){let n=Jde.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)+'..."'),Kde.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)}d4.addPairToJSMap=Yde});var Ho=v(RA=>{"use strict";var f4=Gd(),Qde=i4(),efe=OA(),uy=Ce();function tfe(t,e,r){let n=f4.createNode(t,void 0,r),i=f4.createNode(e,void 0,r);return new dy(n,i)}var dy=class t{constructor(e,r=null){Object.defineProperty(this,uy.NODE_TYPE,{value:uy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return uy.isNode(r)&&(r=r.clone(e)),uy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return efe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Qde.stringifyPair(this,e,r,n):JSON.stringify(this)}};RA.Pair=dy;RA.createPair=tfe});var IA=v(m4=>{"use strict";var na=Ce(),p4=Jd(),fy=Zd();function rfe(t,e,r){return(e.inFlow??t.flow?ife:nfe)(t,e,r)}function nfe({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+=fy.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 a4=He("process");function Vde(t,...e){t==="debug"&&console.log(...e)}function Wde(t,e){(t==="debug"||t==="warn")&&(typeof a4.emitWarning=="function"?a4.emitWarning(e):console.warn(e))}kA.debug=Vde;kA.warn=Wde});var ly=v(cy=>{"use strict";var ay=Ce(),c4=It(),oy="<<",sy={identify:t=>t===oy||typeof t=="symbol"&&t.description===oy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new c4.Scalar(Symbol(oy)),{addToJSMap:l4}),stringify:()=>oy},Kde=(t,e)=>(sy.identify(e)||ay.isScalar(e)&&(!e.type||e.type===c4.Scalar.PLAIN)&&sy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===sy.tag&&r.default);function l4(t,e,r){let n=u4(t,r);if(ay.isSeq(n))for(let i of n.items)AA(t,e,i);else if(Array.isArray(n))for(let i of n)AA(t,e,i);else AA(t,e,n)}function AA(t,e,r){let n=u4(t,r);if(!ay.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 u4(t,e){return t&&ay.isAlias(e)?e.resolve(t.doc,t):e}cy.addMergeToJSMap=l4;cy.isMergeKey=Kde;cy.merge=sy});var OA=v(p4=>{"use strict";var Jde=EA(),d4=ly(),Yde=Jd(),f4=Ce(),TA=zo();function Xde(t,e,{key:r,value:n}){if(f4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(d4.isMergeKey(t,r))d4.addMergeToJSMap(t,e,n);else{let i=TA.toJS(r,"",t);if(e instanceof Map)e.set(i,TA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Qde(r,i,t),s=TA.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 Qde(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(f4.isNode(t)&&r?.doc){let n=Yde.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)+'..."'),Jde.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)}p4.addPairToJSMap=Xde});var Ho=v(RA=>{"use strict";var m4=Gd(),efe=s4(),tfe=OA(),uy=Ce();function rfe(t,e,r){let n=m4.createNode(t,void 0,r),i=m4.createNode(e,void 0,r);return new dy(n,i)}var dy=class t{constructor(e,r=null){Object.defineProperty(this,uy.NODE_TYPE,{value:uy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return uy.isNode(r)&&(r=r.clone(e)),uy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return tfe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?efe.stringifyPair(this,e,r,n):JSON.stringify(this)}};RA.Pair=dy;RA.createPair=rfe});var IA=v(g4=>{"use strict";var na=Ce(),h4=Jd(),fy=Zd();function nfe(t,e,r){return(e.inFlow??t.flow?ofe:ife)(t,e,r)}function ife({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+=fy.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(` +`+fy.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function ofe({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+=fy.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 py({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=fy.indentComment(e(n),t);r.push(o.trimStart())}}m4.stringifyCollection=rfe});var Zo=v(CA=>{"use strict";var ofe=IA(),sfe=OA(),afe=Qg(),Go=Ce(),my=Ho(),cfe=It();function Xd(t,e){let r=Go.isScalar(e)?e.value:e;for(let n of t)if(Go.isPair(n)&&(n.key===e||n.key===r||Go.isScalar(n.key)&&n.key.value===r))return n}var PA=class extends afe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Go.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(my.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;Go.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new my.Pair(e,e?.value):n=new my.Pair(e.key,e.value);let i=Xd(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Go.isScalar(i.value)&&cfe.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=Xd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Xd(this.items,e)?.value;return(!r&&Go.isScalar(i)?i.value:i)??void 0}has(e){return!!Xd(this.items,e)}set(e,r){this.add(new my.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)sfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Go.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})),ofe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};CA.YAMLMap=PA;CA.findPair=Xd});var zc=v(g4=>{"use strict";var lfe=Ce(),h4=Zo(),ufe={collection:"map",default:!0,nodeClass:h4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return lfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>h4.YAMLMap.from(t,e,r)};g4.map=ufe});var Vo=v(y4=>{"use strict";var dfe=Gd(),ffe=IA(),pfe=Qg(),gy=Ce(),mfe=It(),hfe=zo(),DA=class extends pfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(gy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=hy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=hy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&gy.isScalar(i)?i.value:i}has(e){let r=hy(e);return typeof r=="number"&&r=0?e:null}y4.YAMLSeq=DA});var Uc=v(b4=>{"use strict";var gfe=Ce(),_4=Vo(),yfe={collection:"seq",default:!0,nodeClass:_4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return gfe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>_4.YAMLSeq.from(t,e,r)};b4.seq=yfe});var Qd=v(v4=>{"use strict";var _fe=Kd(),bfe={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),_fe.stringifyString(t,e,r,n)}};v4.string=bfe});var yy=v(x4=>{"use strict";var S4=It(),w4={identify:t=>t==null,createNode:()=>new S4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new S4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&w4.test.test(t)?t:e.options.nullStr};x4.nullTag=w4});var NA=v(k4=>{"use strict";var vfe=It(),$4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new vfe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&$4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};k4.boolTag=$4});var qc=v(E4=>{"use strict";function Sfe({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}E4.stringifyNumber=Sfe});var MA=v(_y=>{"use strict";var wfe=It(),jA=qc(),xfe={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:jA.stringifyNumber},$fe={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():jA.stringifyNumber(t)}},kfe={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 wfe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:jA.stringifyNumber};_y.float=kfe;_y.floatExp=$fe;_y.floatNaN=xfe});var LA=v(vy=>{"use strict";var A4=qc(),by=t=>typeof t=="bigint"||Number.isInteger(t),FA=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function T4(t,e,r){let{value:n}=t;return by(n)&&n>=0?r+n.toString(e):A4.stringifyNumber(t)}var Efe={identify:t=>by(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>FA(t,2,8,r),stringify:t=>T4(t,8,"0o")},Afe={identify:by,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>FA(t,0,10,r),stringify:A4.stringifyNumber},Tfe={identify:t=>by(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>FA(t,2,16,r),stringify:t=>T4(t,16,"0x")};vy.int=Afe;vy.intHex=Tfe;vy.intOct=Efe});var R4=v(O4=>{"use strict";var Ofe=zc(),Rfe=yy(),Ife=Uc(),Pfe=Qd(),Cfe=NA(),zA=MA(),UA=LA(),Dfe=[Ofe.map,Ife.seq,Pfe.string,Rfe.nullTag,Cfe.boolTag,UA.intOct,UA.int,UA.intHex,zA.floatNaN,zA.floatExp,zA.float];O4.schema=Dfe});var C4=v(P4=>{"use strict";var Nfe=It(),jfe=zc(),Mfe=Uc();function I4(t){return typeof t=="bigint"||Number.isInteger(t)}var Sy=({value:t})=>JSON.stringify(t),Ffe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Sy},{identify:t=>t==null,createNode:()=>new Nfe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Sy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Sy},{identify:I4,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})=>I4(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:Sy}],Lfe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},zfe=[jfe.map,Mfe.seq].concat(Ffe,Lfe);P4.schema=zfe});var BA=v(D4=>{"use strict";var ef=He("buffer"),qA=It(),Ufe=Kd(),qfe={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 wy=Ce(),HA=Ho(),Bfe=It(),Hfe=Vo();function N4(t,e){if(wy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new HA.Pair(new Bfe.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function py({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=fy.indentComment(e(n),t);r.push(o.trimStart())}}g4.stringifyCollection=nfe});var Zo=v(CA=>{"use strict";var sfe=IA(),afe=OA(),cfe=Qg(),Go=Ce(),my=Ho(),lfe=It();function Xd(t,e){let r=Go.isScalar(e)?e.value:e;for(let n of t)if(Go.isPair(n)&&(n.key===e||n.key===r||Go.isScalar(n.key)&&n.key.value===r))return n}var PA=class extends cfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Go.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(my.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;Go.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new my.Pair(e,e?.value):n=new my.Pair(e.key,e.value);let i=Xd(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Go.isScalar(i.value)&&lfe.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=Xd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Xd(this.items,e)?.value;return(!r&&Go.isScalar(i)?i.value:i)??void 0}has(e){return!!Xd(this.items,e)}set(e,r){this.add(new my.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)afe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Go.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})),sfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};CA.YAMLMap=PA;CA.findPair=Xd});var zc=v(_4=>{"use strict";var ufe=Ce(),y4=Zo(),dfe={collection:"map",default:!0,nodeClass:y4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return ufe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>y4.YAMLMap.from(t,e,r)};_4.map=dfe});var Vo=v(b4=>{"use strict";var ffe=Gd(),pfe=IA(),mfe=Qg(),gy=Ce(),hfe=It(),gfe=zo(),DA=class extends mfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(gy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=hy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=hy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&gy.isScalar(i)?i.value:i}has(e){let r=hy(e);return typeof r=="number"&&r=0?e:null}b4.YAMLSeq=DA});var Uc=v(S4=>{"use strict";var yfe=Ce(),v4=Vo(),_fe={collection:"seq",default:!0,nodeClass:v4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return yfe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>v4.YAMLSeq.from(t,e,r)};S4.seq=_fe});var Qd=v(w4=>{"use strict";var bfe=Kd(),vfe={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),bfe.stringifyString(t,e,r,n)}};w4.string=vfe});var yy=v(k4=>{"use strict";var x4=It(),$4={identify:t=>t==null,createNode:()=>new x4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new x4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&$4.test.test(t)?t:e.options.nullStr};k4.nullTag=$4});var NA=v(A4=>{"use strict";var Sfe=It(),E4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Sfe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&E4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};A4.boolTag=E4});var qc=v(T4=>{"use strict";function wfe({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}T4.stringifyNumber=wfe});var MA=v(_y=>{"use strict";var xfe=It(),jA=qc(),$fe={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:jA.stringifyNumber},kfe={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():jA.stringifyNumber(t)}},Efe={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 xfe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:jA.stringifyNumber};_y.float=Efe;_y.floatExp=kfe;_y.floatNaN=$fe});var LA=v(vy=>{"use strict";var O4=qc(),by=t=>typeof t=="bigint"||Number.isInteger(t),FA=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function R4(t,e,r){let{value:n}=t;return by(n)&&n>=0?r+n.toString(e):O4.stringifyNumber(t)}var Afe={identify:t=>by(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>FA(t,2,8,r),stringify:t=>R4(t,8,"0o")},Tfe={identify:by,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>FA(t,0,10,r),stringify:O4.stringifyNumber},Ofe={identify:t=>by(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>FA(t,2,16,r),stringify:t=>R4(t,16,"0x")};vy.int=Tfe;vy.intHex=Ofe;vy.intOct=Afe});var P4=v(I4=>{"use strict";var Rfe=zc(),Ife=yy(),Pfe=Uc(),Cfe=Qd(),Dfe=NA(),zA=MA(),UA=LA(),Nfe=[Rfe.map,Pfe.seq,Cfe.string,Ife.nullTag,Dfe.boolTag,UA.intOct,UA.int,UA.intHex,zA.floatNaN,zA.floatExp,zA.float];I4.schema=Nfe});var N4=v(D4=>{"use strict";var jfe=It(),Mfe=zc(),Ffe=Uc();function C4(t){return typeof t=="bigint"||Number.isInteger(t)}var Sy=({value:t})=>JSON.stringify(t),Lfe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Sy},{identify:t=>t==null,createNode:()=>new jfe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Sy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Sy},{identify:C4,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})=>C4(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:Sy}],zfe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Ufe=[Mfe.map,Ffe.seq].concat(Lfe,zfe);D4.schema=Ufe});var BA=v(j4=>{"use strict";var ef=He("buffer"),qA=It(),qfe=Kd(),Bfe={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 wy=Ce(),HA=Ho(),Hfe=It(),Gfe=Vo();function M4(t,e){if(wy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new HA.Pair(new Hfe.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]=wy.isPair(n)?n:new HA.Pair(n)}}else e("Expected a sequence for this tag");return t}function j4(t,e,r){let{replacer:n}=r,i=new Hfe.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(HA.createPair(a,c,r))}return i}var Gfe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:N4,createNode:j4};xy.createPairs=j4;xy.pairs=Gfe;xy.resolvePairs=N4});var VA=v(ZA=>{"use strict";var M4=Ce(),GA=zo(),tf=Zo(),Zfe=Vo(),F4=$y(),ia=class t extends Zfe.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(M4.isPair(i)?(o=GA.toJS(i.key,"",r),s=GA.toJS(i.value,o,r)):o=GA.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=F4.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ia.tag="tag:yaml.org,2002:omap";var Vfe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ia,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=F4.resolvePairs(t,e),n=[];for(let{key:i}of r.items)M4.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ia,r)},createNode:(t,e,r)=>ia.from(t,e,r)};ZA.YAMLOMap=ia;ZA.omap=Vfe});var B4=v(WA=>{"use strict";var L4=It();function z4({value:t,source:e},r){return e&&(t?U4:q4).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var U4={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 L4.Scalar(!0),stringify:z4},q4={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 L4.Scalar(!1),stringify:z4};WA.falseTag=q4;WA.trueTag=U4});var H4=v(ky=>{"use strict";var Wfe=It(),KA=qc(),Kfe={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:KA.stringifyNumber},Jfe={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():KA.stringifyNumber(t)}},Yfe={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 Wfe.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:KA.stringifyNumber};ky.float=Yfe;ky.floatExp=Jfe;ky.floatNaN=Kfe});var Z4=v(nf=>{"use strict";var G4=qc(),rf=t=>typeof t=="bigint"||Number.isInteger(t);function Ey(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 JA(t,e,r){let{value:n}=t;if(rf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return G4.stringifyNumber(t)}var Xfe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Ey(t,2,2,r),stringify:t=>JA(t,2,"0b")},Qfe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Ey(t,1,8,r),stringify:t=>JA(t,8,"0")},epe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Ey(t,0,10,r),stringify:G4.stringifyNumber},tpe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Ey(t,2,16,r),stringify:t=>JA(t,16,"0x")};nf.int=epe;nf.intBin=Xfe;nf.intHex=tpe;nf.intOct=Qfe});var XA=v(YA=>{"use strict";var Oy=Ce(),Ay=Ho(),Ty=Zo(),oa=class t extends Ty.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Oy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Ay.Pair(e.key,null):r=new Ay.Pair(e,null),Ty.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Ty.findPair(this.items,e);return!r&&Oy.isPair(n)?Oy.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=Ty.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Ay.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(Ay.createPair(s,null,n));return o}};oa.tag="tag:yaml.org,2002:set";var rpe={collection:"map",identify:t=>t instanceof Set,nodeClass:oa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>oa.from(t,e,r),resolve(t,e){if(Oy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new oa,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};YA.YAMLSet=oa;YA.set=rpe});var eT=v(Ry=>{"use strict";var npe=qc();function QA(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 V4(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return npe.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 ipe={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})=>QA(t,r),stringify:V4},ope={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=>QA(t,!1),stringify:V4},W4={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(W4.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=QA(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$/,"")??""};Ry.floatTime=ope;Ry.intTime=ipe;Ry.timestamp=W4});var Y4=v(J4=>{"use strict";var spe=zc(),ape=yy(),cpe=Uc(),lpe=Qd(),upe=BA(),K4=B4(),tT=H4(),Iy=Z4(),dpe=ly(),fpe=VA(),ppe=$y(),mpe=XA(),rT=eT(),hpe=[spe.map,cpe.seq,lpe.string,ape.nullTag,K4.trueTag,K4.falseTag,Iy.intBin,Iy.intOct,Iy.int,Iy.intHex,tT.floatNaN,tT.floatExp,tT.float,upe.binary,dpe.merge,fpe.omap,ppe.pairs,mpe.set,rT.intTime,rT.floatTime,rT.timestamp];J4.schema=hpe});var a6=v(oT=>{"use strict";var t6=zc(),gpe=yy(),r6=Uc(),ype=Qd(),_pe=NA(),nT=MA(),iT=LA(),bpe=R4(),vpe=C4(),n6=BA(),of=ly(),i6=VA(),o6=$y(),X4=Y4(),s6=XA(),Py=eT(),Q4=new Map([["core",bpe.schema],["failsafe",[t6.map,r6.seq,ype.string]],["json",vpe.schema],["yaml11",X4.schema],["yaml-1.1",X4.schema]]),e6={binary:n6.binary,bool:_pe.boolTag,float:nT.float,floatExp:nT.floatExp,floatNaN:nT.floatNaN,floatTime:Py.floatTime,int:iT.int,intHex:iT.intHex,intOct:iT.intOct,intTime:Py.intTime,map:t6.map,merge:of.merge,null:gpe.nullTag,omap:i6.omap,pairs:o6.pairs,seq:r6.seq,set:s6.set,timestamp:Py.timestamp},Spe={"tag:yaml.org,2002:binary":n6.binary,"tag:yaml.org,2002:merge":of.merge,"tag:yaml.org,2002:omap":i6.omap,"tag:yaml.org,2002:pairs":o6.pairs,"tag:yaml.org,2002:set":s6.set,"tag:yaml.org,2002:timestamp":Py.timestamp};function wpe(t,e,r){let n=Q4.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(Q4.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"?e6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(e6).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},[])}oT.coreKnownTags=Spe;oT.getTags=wpe});var cT=v(c6=>{"use strict";var sT=Ce(),xpe=zc(),$pe=Uc(),kpe=Qd(),Cy=a6(),Epe=(t,e)=>t.keye.key?1:0,aT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Cy.getTags(e,"compat"):e?Cy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Cy.coreKnownTags:{},this.tags=Cy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,sT.MAP,{value:xpe.map}),Object.defineProperty(this,sT.SCALAR,{value:kpe.string}),Object.defineProperty(this,sT.SEQ,{value:$pe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Epe:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};c6.Schema=aT});var u6=v(l6=>{"use strict";var Ape=Ce(),lT=Jd(),sf=Zd();function Tpe(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=lT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(sf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Ape.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(sf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=lT.stringify(t.contents,i,()=>a=null,c);a&&(l+=sf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(lT.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]=wy.isPair(n)?n:new HA.Pair(n)}}else e("Expected a sequence for this tag");return t}function F4(t,e,r){let{replacer:n}=r,i=new Gfe.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(HA.createPair(a,c,r))}return i}var Zfe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:M4,createNode:F4};xy.createPairs=F4;xy.pairs=Zfe;xy.resolvePairs=M4});var VA=v(ZA=>{"use strict";var L4=Ce(),GA=zo(),tf=Zo(),Vfe=Vo(),z4=$y(),ia=class t extends Vfe.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(L4.isPair(i)?(o=GA.toJS(i.key,"",r),s=GA.toJS(i.value,o,r)):o=GA.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=z4.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ia.tag="tag:yaml.org,2002:omap";var Wfe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ia,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=z4.resolvePairs(t,e),n=[];for(let{key:i}of r.items)L4.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ia,r)},createNode:(t,e,r)=>ia.from(t,e,r)};ZA.YAMLOMap=ia;ZA.omap=Wfe});var G4=v(WA=>{"use strict";var U4=It();function q4({value:t,source:e},r){return e&&(t?B4:H4).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var B4={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 U4.Scalar(!0),stringify:q4},H4={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 U4.Scalar(!1),stringify:q4};WA.falseTag=H4;WA.trueTag=B4});var Z4=v(ky=>{"use strict";var Kfe=It(),KA=qc(),Jfe={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:KA.stringifyNumber},Yfe={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():KA.stringifyNumber(t)}},Xfe={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 Kfe.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:KA.stringifyNumber};ky.float=Xfe;ky.floatExp=Yfe;ky.floatNaN=Jfe});var W4=v(nf=>{"use strict";var V4=qc(),rf=t=>typeof t=="bigint"||Number.isInteger(t);function Ey(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 JA(t,e,r){let{value:n}=t;if(rf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return V4.stringifyNumber(t)}var Qfe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Ey(t,2,2,r),stringify:t=>JA(t,2,"0b")},epe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Ey(t,1,8,r),stringify:t=>JA(t,8,"0")},tpe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Ey(t,0,10,r),stringify:V4.stringifyNumber},rpe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Ey(t,2,16,r),stringify:t=>JA(t,16,"0x")};nf.int=tpe;nf.intBin=Qfe;nf.intHex=rpe;nf.intOct=epe});var XA=v(YA=>{"use strict";var Oy=Ce(),Ay=Ho(),Ty=Zo(),oa=class t extends Ty.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Oy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Ay.Pair(e.key,null):r=new Ay.Pair(e,null),Ty.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Ty.findPair(this.items,e);return!r&&Oy.isPair(n)?Oy.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=Ty.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Ay.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(Ay.createPair(s,null,n));return o}};oa.tag="tag:yaml.org,2002:set";var npe={collection:"map",identify:t=>t instanceof Set,nodeClass:oa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>oa.from(t,e,r),resolve(t,e){if(Oy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new oa,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};YA.YAMLSet=oa;YA.set=npe});var eT=v(Ry=>{"use strict";var ipe=qc();function QA(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 K4(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return ipe.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 ope={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})=>QA(t,r),stringify:K4},spe={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=>QA(t,!1),stringify:K4},J4={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(J4.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=QA(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$/,"")??""};Ry.floatTime=spe;Ry.intTime=ope;Ry.timestamp=J4});var Q4=v(X4=>{"use strict";var ape=zc(),cpe=yy(),lpe=Uc(),upe=Qd(),dpe=BA(),Y4=G4(),tT=Z4(),Iy=W4(),fpe=ly(),ppe=VA(),mpe=$y(),hpe=XA(),rT=eT(),gpe=[ape.map,lpe.seq,upe.string,cpe.nullTag,Y4.trueTag,Y4.falseTag,Iy.intBin,Iy.intOct,Iy.int,Iy.intHex,tT.floatNaN,tT.floatExp,tT.float,dpe.binary,fpe.merge,ppe.omap,mpe.pairs,hpe.set,rT.intTime,rT.floatTime,rT.timestamp];X4.schema=gpe});var l6=v(oT=>{"use strict";var n6=zc(),ype=yy(),i6=Uc(),_pe=Qd(),bpe=NA(),nT=MA(),iT=LA(),vpe=P4(),Spe=N4(),o6=BA(),of=ly(),s6=VA(),a6=$y(),e6=Q4(),c6=XA(),Py=eT(),t6=new Map([["core",vpe.schema],["failsafe",[n6.map,i6.seq,_pe.string]],["json",Spe.schema],["yaml11",e6.schema],["yaml-1.1",e6.schema]]),r6={binary:o6.binary,bool:bpe.boolTag,float:nT.float,floatExp:nT.floatExp,floatNaN:nT.floatNaN,floatTime:Py.floatTime,int:iT.int,intHex:iT.intHex,intOct:iT.intOct,intTime:Py.intTime,map:n6.map,merge:of.merge,null:ype.nullTag,omap:s6.omap,pairs:a6.pairs,seq:i6.seq,set:c6.set,timestamp:Py.timestamp},wpe={"tag:yaml.org,2002:binary":o6.binary,"tag:yaml.org,2002:merge":of.merge,"tag:yaml.org,2002:omap":s6.omap,"tag:yaml.org,2002:pairs":a6.pairs,"tag:yaml.org,2002:set":c6.set,"tag:yaml.org,2002:timestamp":Py.timestamp};function xpe(t,e,r){let n=t6.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(t6.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"?r6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(r6).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},[])}oT.coreKnownTags=wpe;oT.getTags=xpe});var cT=v(u6=>{"use strict";var sT=Ce(),$pe=zc(),kpe=Uc(),Epe=Qd(),Cy=l6(),Ape=(t,e)=>t.keye.key?1:0,aT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Cy.getTags(e,"compat"):e?Cy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Cy.coreKnownTags:{},this.tags=Cy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,sT.MAP,{value:$pe.map}),Object.defineProperty(this,sT.SCALAR,{value:Epe.string}),Object.defineProperty(this,sT.SEQ,{value:kpe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Ape:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};u6.Schema=aT});var f6=v(d6=>{"use strict";var Tpe=Ce(),lT=Jd(),sf=Zd();function Ope(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=lT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(sf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Tpe.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(sf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=lT.stringify(t.contents,i,()=>a=null,c);a&&(l+=sf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(lT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` `)?(r.push("..."),r.push(sf.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(sf.indentComment(o(c),"")))}return r.join(` `)+` -`}l6.stringifyDocument=Tpe});var af=v(d6=>{"use strict";var Ope=Hd(),Bc=Qg(),wn=Ce(),Rpe=Ho(),Ipe=zo(),Ppe=cT(),Cpe=u6(),uT=Kg(),Dpe=mA(),Npe=Gd(),dT=pA(),fT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,wn.NODE_TYPE,{value:wn.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 dT.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,{[wn.NODE_TYPE]:{value:wn.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=wn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Hc(this.contents)&&this.contents.add(e)}addIn(e,r){Hc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=uT.anchorNames(this);e.anchor=!r||n.has(r)?uT.findNewAnchor(r||"a",n):r}return new Ope.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}=uT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Npe.createNode(e,u,m);return a&&wn.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 Rpe.Pair(i,o)}delete(e){return Hc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Bc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Hc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return wn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Bc.isEmptyPath(e)?!r&&wn.isScalar(this.contents)?this.contents.value:this.contents:wn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return wn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Bc.isEmptyPath(e)?this.contents!==void 0:wn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Bc.collectionFromPath(this.schema,[e],r):Hc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Bc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Bc.collectionFromPath(this.schema,Array.from(e),r):Hc(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 dT.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 dT.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 Ppe.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=Ipe.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"?Dpe.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 Cpe.stringifyDocument(this,e)}};function Hc(t){if(wn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}d6.Document=fT});var uf=v(lf=>{"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}},pT=class extends cf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},mT=class extends cf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},jpe=(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 +`}d6.stringifyDocument=Ope});var af=v(p6=>{"use strict";var Rpe=Hd(),Bc=Qg(),Sn=Ce(),Ipe=Ho(),Ppe=zo(),Cpe=cT(),Dpe=f6(),uT=Kg(),Npe=mA(),jpe=Gd(),dT=pA(),fT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Sn.NODE_TYPE,{value:Sn.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 dT.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,{[Sn.NODE_TYPE]:{value:Sn.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=Sn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Hc(this.contents)&&this.contents.add(e)}addIn(e,r){Hc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=uT.anchorNames(this);e.anchor=!r||n.has(r)?uT.findNewAnchor(r||"a",n):r}return new Rpe.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}=uT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=jpe.createNode(e,u,m);return a&&Sn.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 Ipe.Pair(i,o)}delete(e){return Hc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Bc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Hc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Sn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Bc.isEmptyPath(e)?!r&&Sn.isScalar(this.contents)?this.contents.value:this.contents:Sn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Sn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Bc.isEmptyPath(e)?this.contents!==void 0:Sn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Bc.collectionFromPath(this.schema,[e],r):Hc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Bc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Bc.collectionFromPath(this.schema,Array.from(e),r):Hc(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 dT.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 dT.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 Cpe.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=Ppe.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"?Npe.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 Dpe.stringifyDocument(this,e)}};function Hc(t){if(Sn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}p6.Document=fT});var uf=v(lf=>{"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}},pT=class extends cf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},mT=class extends cf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Mpe=(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} -`}};lf.YAMLError=cf;lf.YAMLParseError=pT;lf.YAMLWarning=mT;lf.prettifyError=jpe});var df=v(f6=>{"use strict";function Mpe(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 E of t)switch(m&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&o(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&E.type!=="comment"&&E.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),E.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&E.source.includes(" ")&&(h=E),u=!0;break;case"comment":{u||o(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=E.source.substring(1)||" ";d?d+=f+C:d=C,f="",l=!1;break}case"newline":l?d?d+=E.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=E.source,l=!0,p=!0,(g||b)&&(_=E),u=!0;break;case"anchor":g&&o(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&o(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=E,w??(w=E.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(E,"MULTIPLE_TAGS","A node can have at most one tag"),b=E,w??(w=E.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),x&&o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),x=E,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=E,l=!1,u=!1;break}default:o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),l=!1,u=!1}let O=t[t.length-1],A=O?O.offset+O.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}}f6.resolveProps=Mpe});var Dy=v(p6=>{"use strict";function hT(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(hT(e.key)||hT(e.value))return!0}return!1;default:return!0}}p6.containsNewline=hT});var gT=v(m6=>{"use strict";var Fpe=Dy();function Lpe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Fpe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}m6.flowIndentCheck=Lpe});var yT=v(g6=>{"use strict";var h6=Ce();function zpe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||h6.isScalar(o)&&h6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}g6.mapIncludes=zpe});var w6=v(S6=>{"use strict";var y6=Ho(),Upe=Zo(),_6=df(),qpe=Dy(),b6=gT(),Bpe=yT(),v6="All mapping items must start at the same column";function Hpe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Upe.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=_6.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",v6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||qpe.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",v6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&b6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Bpe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=_6.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 Gpe=Vo(),Zpe=df(),Vpe=gT();function Wpe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Gpe.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=Zpe.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&&Vpe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}x6.resolveBlockSeq=Wpe});var Gc=v(k6=>{"use strict";function Kpe(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}}k6.resolveEnd=Kpe});var O6=v(T6=>{"use strict";var Jpe=Ce(),Ype=Ho(),E6=Zo(),Xpe=Vo(),Qpe=Gc(),A6=df(),eme=Dy(),tme=yT(),_T="Block collections are not allowed within flow collections",bT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function rme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?E6.YAMLMap:Xpe.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=Qpe.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}T6.resolveFlowCollection=rme});var I6=v(R6=>{"use strict";var nme=Ce(),ime=It(),ome=Zo(),sme=Vo(),ame=w6(),cme=$6(),lme=O6();function vT(t,e,r,n,i,o){let s=r.type==="block-map"?ame.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?cme.resolveBlockSeq(t,e,r,n,o):lme.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 ume(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),vT(t,e,r,i,s)}let l=vT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=nme.isNode(u)?u:new ime.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}R6.composeCollection=ume});var wT=v(P6=>{"use strict";var ST=It();function dme(t,e,r){let n=e.offset,i=fme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?ST.Scalar.BLOCK_FOLDED:ST.Scalar.BLOCK_LITERAL,s=e.source?pme(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?` +`}};lf.YAMLError=cf;lf.YAMLParseError=pT;lf.YAMLWarning=mT;lf.prettifyError=Mpe});var df=v(m6=>{"use strict";function Fpe(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 E of t)switch(m&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&o(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&E.type!=="comment"&&E.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),E.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&E.source.includes(" ")&&(h=E),u=!0;break;case"comment":{u||o(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=E.source.substring(1)||" ";d?d+=f+C:d=C,f="",l=!1;break}case"newline":l?d?d+=E.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=E.source,l=!0,p=!0,(g||b)&&(_=E),u=!0;break;case"anchor":g&&o(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&o(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=E,w??(w=E.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(E,"MULTIPLE_TAGS","A node can have at most one tag"),b=E,w??(w=E.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),x&&o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),x=E,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=E,l=!1,u=!1;break}default:o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),l=!1,u=!1}let O=t[t.length-1],A=O?O.offset+O.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}}m6.resolveProps=Fpe});var Dy=v(h6=>{"use strict";function hT(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(hT(e.key)||hT(e.value))return!0}return!1;default:return!0}}h6.containsNewline=hT});var gT=v(g6=>{"use strict";var Lpe=Dy();function zpe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Lpe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}g6.flowIndentCheck=zpe});var yT=v(_6=>{"use strict";var y6=Ce();function Upe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||y6.isScalar(o)&&y6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}_6.mapIncludes=Upe});var $6=v(x6=>{"use strict";var b6=Ho(),qpe=Zo(),v6=df(),Bpe=Dy(),S6=gT(),Hpe=yT(),w6="All mapping items must start at the same column";function Gpe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??qpe.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=v6.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",w6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Bpe.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",w6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&S6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Hpe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=v6.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 Zpe=Vo(),Vpe=df(),Wpe=gT();function Kpe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Zpe.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=Vpe.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&&Wpe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}k6.resolveBlockSeq=Kpe});var Gc=v(A6=>{"use strict";function Jpe(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}}A6.resolveEnd=Jpe});var I6=v(R6=>{"use strict";var Ype=Ce(),Xpe=Ho(),T6=Zo(),Qpe=Vo(),eme=Gc(),O6=df(),tme=Dy(),rme=yT(),_T="Block collections are not allowed within flow collections",bT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function nme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?T6.YAMLMap:Qpe.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=eme.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}R6.resolveFlowCollection=nme});var C6=v(P6=>{"use strict";var ime=Ce(),ome=It(),sme=Zo(),ame=Vo(),cme=$6(),lme=E6(),ume=I6();function vT(t,e,r,n,i,o){let s=r.type==="block-map"?cme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?lme.resolveBlockSeq(t,e,r,n,o):ume.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 dme(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),vT(t,e,r,i,s)}let l=vT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=ime.isNode(u)?u:new ome.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}P6.composeCollection=dme});var wT=v(D6=>{"use strict";var ST=It();function fme(t,e,r){let n=e.offset,i=pme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?ST.Scalar.BLOCK_FOLDED:ST.Scalar.BLOCK_LITERAL,s=e.source?mme(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,91 +112,91 @@ ${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 fme({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 xT=It(),mme=Gc();function hme(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=xT.Scalar.PLAIN,c=gme(o,l);break;case"single-quoted-scalar":a=xT.Scalar.QUOTE_SINGLE,c=yme(o,l);break;case"double-quoted-scalar":a=xT.Scalar.QUOTE_DOUBLE,c=_me(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=mme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function gme(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}`),C6(t)}function yme(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),C6(t.slice(1,-1)).replace(/''/g,"'")}function C6(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var xT=It(),hme=Gc();function gme(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=xT.Scalar.PLAIN,c=yme(o,l);break;case"single-quoted-scalar":a=xT.Scalar.QUOTE_SINGLE,c=_me(o,l);break;case"double-quoted-scalar":a=xT.Scalar.QUOTE_DOUBLE,c=bme(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=hme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function yme(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}`),N6(t)}function _me(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),N6(t.slice(1,-1)).replace(/''/g,"'")}function N6(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 bme(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 vme(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 vme={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Sme(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}}D6.resolveFlowScalar=hme});var M6=v(j6=>{"use strict";var sa=Ce(),N6=It(),wme=wT(),xme=$T();function $me(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?wme.resolveBlockScalar(t,e,n):xme.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[sa.SCALAR]:c?l=kme(t.schema,i,c,r,n):e.type==="scalar"?l=Eme(t,i,e,n):l=t.schema[sa.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=sa.isScalar(d)?d:new N6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new N6.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 kme(t,e,r,n,i){if(r==="!")return t[sa.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[sa.SCALAR])}function Eme({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[sa.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[sa.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}j6.composeScalar=$me});var L6=v(F6=>{"use strict";function Ame(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}F6.emptyScalarPosition=Ame});var q6=v(ET=>{"use strict";var Tme=Hd(),Ome=Ce(),Rme=I6(),z6=M6(),Ime=Gc(),Pme=L6(),Cme={composeNode:U6,composeEmptyNode:kT};function U6(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=Dme(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=z6.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Rme.composeCollection(Cme,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=kT(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&&(!Ome.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 kT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Pme.emptyScalarPosition(e,r,n),indent:-1,source:""},d=z6.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 Dme({options:t},{offset:e,source:r,end:n},i){let o=new Tme.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=Ime.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ET.composeEmptyNode=kT;ET.composeNode=U6});var G6=v(H6=>{"use strict";var Nme=af(),B6=q6(),jme=Gc(),Mme=df();function Fme(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Nme.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Mme.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?B6.composeNode(l,i,u,s):B6.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=jme.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}H6.composeDoc=Fme});var TT=v(W6=>{"use strict";var Lme=He("process"),zme=pA(),Ume=af(),ff=uf(),Z6=Ce(),qme=G6(),Bme=Gc();function pf(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 V6(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var sa=Ce(),M6=It(),xme=wT(),$me=$T();function kme(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?xme.resolveBlockScalar(t,e,n):$me.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[sa.SCALAR]:c?l=Eme(t.schema,i,c,r,n):e.type==="scalar"?l=Ame(t,i,e,n):l=t.schema[sa.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=sa.isScalar(d)?d:new M6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new M6.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 Eme(t,e,r,n,i){if(r==="!")return t[sa.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[sa.SCALAR])}function Ame({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[sa.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[sa.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}F6.composeScalar=kme});var U6=v(z6=>{"use strict";function Tme(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}z6.emptyScalarPosition=Tme});var H6=v(ET=>{"use strict";var Ome=Hd(),Rme=Ce(),Ime=C6(),q6=L6(),Pme=Gc(),Cme=U6(),Dme={composeNode:B6,composeEmptyNode:kT};function B6(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=Nme(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=Ime.composeCollection(Dme,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=kT(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&&(!Rme.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 kT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Cme.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 Nme({options:t},{offset:e,source:r,end:n},i){let o=new Ome.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=Pme.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ET.composeEmptyNode=kT;ET.composeNode=B6});var V6=v(Z6=>{"use strict";var jme=af(),G6=H6(),Mme=Gc(),Fme=df();function Lme(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new jme.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Fme.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?G6.composeNode(l,i,u,s):G6.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Mme.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}Z6.composeDoc=Lme});var TT=v(J6=>{"use strict";var zme=He("process"),Ume=pA(),qme=af(),ff=uf(),W6=Ce(),Bme=V6(),Hme=Gc();function pf(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 K6(t){let e="",r=!1,n=!1;for(let i=0;i{let s=pf(r);o?this.warnings.push(new ff.YAMLWarning(s,n,i)):this.errors.push(new ff.YAMLParseError(s,n,i))},this.directives=new zme.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=V6(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(Z6.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];Z6.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 AT=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=pf(r);o?this.warnings.push(new ff.YAMLWarning(s,n,i)):this.errors.push(new ff.YAMLParseError(s,n,i))},this.directives=new Ume.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=K6(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(W6.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];W6.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=pf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=qme.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(pf(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(pf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Bme.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(pf(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 Ume.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}}};W6.Composer=AT});var Y6=v(Ny=>{"use strict";var Hme=wT(),Gme=$T(),Zme=uf(),K6=Kd();function Vme(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 Zme.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Gme.resolveFlowScalar(t,e,n);case"block-scalar":return Hme.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Wme(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=K6.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=pf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Bme.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(pf(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(pf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Hme.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(pf(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 qme.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}}};J6.Composer=AT});var Q6=v(Ny=>{"use strict";var Gme=wT(),Zme=$T(),Vme=uf(),Y6=Kd();function Wme(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 Vme.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Zme.resolveFlowScalar(t,e,n);case"block-scalar":return Gme.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Kme(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=Y6.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 J6(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 Kme(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=K6.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">":Jme(t,c);break;case'"':OT(t,c,"double-quoted-scalar");break;case"'":OT(t,c,"single-quoted-scalar");break;default:OT(t,c,"scalar")}}function Jme(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return X6(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 Jme(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=Y6.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">":Yme(t,c);break;case'"':OT(t,c,"double-quoted-scalar");break;case"'":OT(t,c,"single-quoted-scalar");break;default:OT(t,c,"scalar")}}function Yme(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}];J6(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 J6(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 OT(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})}}}Ny.createScalarToken=Wme;Ny.resolveAsScalar=Vme;Ny.setScalarValue=Kme});var Q6=v(X6=>{"use strict";var Yme=t=>"type"in t?My(t):jy(t);function My(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=My(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=jy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=jy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=jy(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 jy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=My(e)),r)for(let o of r)i+=o.source;return n&&(i+=My(n)),i}X6.stringify=Yme});var nB=v(rB=>{"use strict";var RT=Symbol("break visit"),Xme=Symbol("skip children"),eB=Symbol("remove item");function aa(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),tB(Object.freeze([]),t,e)}aa.BREAK=RT;aa.SKIP=Xme;aa.REMOVE=eB;aa.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};aa.parentCollection=(t,e)=>{let r=aa.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 tB(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 IT=Y6(),Qme=Q6(),ehe=nB(),PT="\uFEFF",CT="",DT="",NT="",the=t=>!!t&&"items"in t,rhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function nhe(t){switch(t){case PT:return"";case CT:return"";case DT:return"";case NT:return"";default:return JSON.stringify(t)}}function ihe(t){switch(t){case PT:return"byte-order-mark";case CT:return"doc-mode";case DT:return"flow-error-end";case NT: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}];X6(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 X6(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 OT(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})}}}Ny.createScalarToken=Kme;Ny.resolveAsScalar=Wme;Ny.setScalarValue=Jme});var tB=v(eB=>{"use strict";var Xme=t=>"type"in t?My(t):jy(t);function My(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=My(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=jy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=jy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=jy(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 jy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=My(e)),r)for(let o of r)i+=o.source;return n&&(i+=My(n)),i}eB.stringify=Xme});var oB=v(iB=>{"use strict";var RT=Symbol("break visit"),Qme=Symbol("skip children"),rB=Symbol("remove item");function aa(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),nB(Object.freeze([]),t,e)}aa.BREAK=RT;aa.SKIP=Qme;aa.REMOVE=rB;aa.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};aa.parentCollection=(t,e)=>{let r=aa.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 nB(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 IT=Q6(),ehe=tB(),the=oB(),PT="\uFEFF",CT="",DT="",NT="",rhe=t=>!!t&&"items"in t,nhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function ihe(t){switch(t){case PT:return"";case CT:return"";case DT:return"";case NT:return"";default:return JSON.stringify(t)}}function ohe(t){switch(t){case PT:return"byte-order-mark";case CT:return"doc-mode";case DT:return"flow-error-end";case NT: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}Cr.createScalarToken=IT.createScalarToken;Cr.resolveAsScalar=IT.resolveAsScalar;Cr.setScalarValue=IT.setScalarValue;Cr.stringify=Qme.stringify;Cr.visit=ehe.visit;Cr.BOM=PT;Cr.DOCUMENT=CT;Cr.FLOW_END=DT;Cr.SCALAR=NT;Cr.isCollection=the;Cr.isScalar=rhe;Cr.prettyToken=nhe;Cr.tokenType=ihe});var FT=v(oB=>{"use strict";var mf=Fy();function Gn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var iB=new Set("0123456789ABCDEFabcdef"),ohe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Ly=new Set(",[]{}"),she=new Set(` ,[]{} -\r `),jT=t=>!t||she.has(t),MT=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}Pr.createScalarToken=IT.createScalarToken;Pr.resolveAsScalar=IT.resolveAsScalar;Pr.setScalarValue=IT.setScalarValue;Pr.stringify=ehe.stringify;Pr.visit=the.visit;Pr.BOM=PT;Pr.DOCUMENT=CT;Pr.FLOW_END=DT;Pr.SCALAR=NT;Pr.isCollection=rhe;Pr.isScalar=nhe;Pr.prettyToken=ihe;Pr.tokenType=ohe});var FT=v(aB=>{"use strict";var mf=Fy();function Hn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var sB=new Set("0123456789ABCDEFabcdef"),she=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Ly=new Set(",[]{}"),ahe=new Set(` ,[]{} +\r `),jT=t=>!t||ahe.has(t),MT=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==="...")&&Gn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Gn(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===":")&&Gn(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(jT),"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=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Hn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Hn(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===":")&&Hn(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(jT),"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=>Gn(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` +`,o)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Hn(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 mf.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(Gn(o)||e&&Ly.has(o))break;r=n}else if(Gn(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 mf.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(Hn(o)||e&&Ly.has(o))break;r=n}else if(Hn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` `,o=this.buffer[n+1]):r=n),o==="#"||e&&Ly.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&Ly.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield mf.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(jT),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Gn(n)||r&&Ly.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(;!Gn(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(ohe.has(r))r=this.buffer[++e];else if(r==="%"&&iB.has(this.buffer[e+1])&&iB.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&&Ly.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield mf.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(jT),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Hn(n)||r&&Ly.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(;!Hn(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(she.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)}};oB.Lexer=MT});var zT=v(sB=>{"use strict";var LT=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 ahe=He("process"),aB=Fy(),che=FT();function Wo(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 Uy(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"&&lB(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&&cB(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)}};aB.Lexer=MT});var zT=v(cB=>{"use strict";var LT=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 che=He("process"),lB=Fy(),lhe=FT();function Wo(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 Uy(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"&&dB(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&&uB(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(Wo(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(uB(r.key)&&!Wo(r.sep,"newline")){let s=Zc(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(Wo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Zc(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]}):Wo(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&&!Wo(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)){Uy(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||Wo(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=zy(n),o=Zc(i);lB(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)){Uy(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(Wo(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(fB(r.key)&&!Wo(r.sep,"newline")){let s=Zc(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(Wo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Zc(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]}):Wo(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&&!Wo(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)){Uy(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||Wo(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=zy(n),o=Zc(i);dB(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=zy(e),n=Zc(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=zy(e),n=Zc(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())}}};dB.Parser=UT});var gB=v(gf=>{"use strict";var fB=TT(),lhe=af(),hf=uf(),uhe=EA(),dhe=Ce(),fhe=zT(),pB=qT();function mB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new fhe.LineCounter||null,prettyErrors:e}}function phe(t,e={}){let{lineCounter:r,prettyErrors:n}=mB(e),i=new pB.Parser(r?.addNewLine),o=new fB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(hf.prettifyError(t,r)),a.warnings.forEach(hf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function hB(t,e={}){let{lineCounter:r,prettyErrors:n}=mB(e),i=new pB.Parser(r?.addNewLine),o=new fB.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 hf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(hf.prettifyError(t,r)),s.warnings.forEach(hf.prettifyError(t,r))),s}function mhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=hB(t,r);if(!i)return null;if(i.warnings.forEach(o=>uhe.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 hhe(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 dhe.isDocument(t)&&!n?t.toString(r):new lhe.Document(t,n,r).toString(r)}gf.parse=mhe;gf.parseAllDocuments=phe;gf.parseDocument=hB;gf.stringify=hhe});var cr=v(Ge=>{"use strict";var ghe=TT(),yhe=af(),_he=cT(),BT=uf(),bhe=Hd(),Ko=Ce(),vhe=Ho(),She=It(),whe=Zo(),xhe=Vo(),$he=Fy(),khe=FT(),Ehe=zT(),Ahe=qT(),qy=gB(),yB=zd();Ge.Composer=ghe.Composer;Ge.Document=yhe.Document;Ge.Schema=_he.Schema;Ge.YAMLError=BT.YAMLError;Ge.YAMLParseError=BT.YAMLParseError;Ge.YAMLWarning=BT.YAMLWarning;Ge.Alias=bhe.Alias;Ge.isAlias=Ko.isAlias;Ge.isCollection=Ko.isCollection;Ge.isDocument=Ko.isDocument;Ge.isMap=Ko.isMap;Ge.isNode=Ko.isNode;Ge.isPair=Ko.isPair;Ge.isScalar=Ko.isScalar;Ge.isSeq=Ko.isSeq;Ge.Pair=vhe.Pair;Ge.Scalar=She.Scalar;Ge.YAMLMap=whe.YAMLMap;Ge.YAMLSeq=xhe.YAMLSeq;Ge.CST=$he;Ge.Lexer=khe.Lexer;Ge.LineCounter=Ehe.LineCounter;Ge.Parser=Ahe.Parser;Ge.parse=qy.parse;Ge.parseAllDocuments=qy.parseAllDocuments;Ge.parseDocument=qy.parseDocument;Ge.stringify=qy.stringify;Ge.visit=yB.visit;Ge.visitAsync=yB.visitAsync});import{execFileSync as _B}from"node:child_process";import{existsSync as By}from"node:fs";import{join as Hy,resolve as The}from"node:path";function Ohe(t){try{let e=_B("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?The(t,e):null}catch{return null}}function HT(t){let e=Ohe(t);if(!e)return null;try{if(By(Hy(e,"MERGE_HEAD")))return"merge";if(By(Hy(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(By(Hy(e,"rebase-merge"))||By(Hy(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ca(t){return HT(t)!==null}function GT(t,e){try{let r=_B("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 Gy(t,e){return GT(t,e)!==null}var la=y(()=>{"use strict"});import{execFileSync as Rhe}from"node:child_process";import{existsSync as Ihe,readFileSync as Phe}from"node:fs";import{join as SB}from"node:path";function yf(t,e){return Rhe("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Jo(t){try{let e=yf(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 Yo(t,e){Che(t,e);let r=yf(t,["rev-parse","HEAD"]).trim(),n=Dhe(t,e);return{groups:Nhe(t,n),head:r,inventory:{after:vB(Vy(t,"spec.yaml")),before:vB(ZT(t,e,"spec.yaml"))},since:e,unsharded_commits:Lhe(t,e)}}function VT(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 Che(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!Gy(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 Dhe(t,e){let r=yf(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(!(!bB(c)&&!bB(a)))if(s.startsWith("A")){let l=Zy(Vy(t,c));if(!l)continue;l.status==="done"?n.push(Vc(l,"added-as-done")):l.status==="archived"&&n.push(Vc(l,"archived"))}else if(s.startsWith("D")){let l=Zy(ZT(t,e,a));l&&n.push(Vc(l,"archived"))}else{let l=Zy(Vy(t,c));if(!l)continue;let d=Zy(ZT(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(Vc(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(Vc(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(Vc(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function bB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function Vc(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>VT(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function Zy(t){if(t===null)return null;let e;try{e=(0,Wy.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 Vy(t,e){let r=SB(t,e);if(!Ihe(r))return null;try{return Phe(r,"utf8")}catch{return null}}function ZT(t,e,r){try{return yf(t,["show",`${e}:${r}`])}catch{return null}}function Nhe(t,e){let r=jhe(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 jhe(t){let e=Vy(t,SB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,Wy.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function vB(t){let e={};if(t!==null)try{let n=(0,Wy.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 Lhe(t,e){let r=yf(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);Mhe.test(a)&&(Fhe.test(a)||n.push({hash:s,subject:a}))}return n}var Wy,Mhe,Fhe,Wc=y(()=>{"use strict";Wy=Et(cr(),1);la();Mhe=/^(feat|fix)(\([^)]*\))?!?:/,Fhe=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as wB}from"node:child_process";import{appendFileSync as zhe,existsSync as WT,mkdirSync as Uhe,readFileSync as qhe,renameSync as Bhe,statSync as Hhe}from"node:fs";import{userInfo as Ghe}from"node:os";import{dirname as Zhe,join as JT}from"node:path";function YT(t){return JT(t,xB,Vhe)}function Yr(t,e){let r=YT(t),n=Zhe(r);WT(n)||Uhe(n,{recursive:!0});try{WT(r)&&Hhe(r).size>Whe&&Bhe(r,JT(n,$B))}catch{}zhe(r,`${JSON.stringify(e)} -`,"utf8")}function KT(t){if(!WT(t))return[];let e=qhe(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ua(t){return KT(YT(t))}function Ky(t){return[...KT(JT(t,xB,$B)),...KT(YT(t))]}function Xr(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 Khe(t){let e;try{e=wB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Ghe().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Jhe(t){try{return wB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function _f(t,e){try{let r=ua(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function lr(t,e,r){try{let n=Jhe(t),i=Khe(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=_f(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Yr(t,Xr(e,o))}catch{}}var xB,Vhe,$B,Whe,Dr=y(()=>{"use strict";xB=".cladding",Vhe="events.log.jsonl",$B="events.log.1.jsonl",Whe=5*1024*1024});import{execFileSync as Yhe}from"node:child_process";import{existsSync as kB,readdirSync as Xhe,readFileSync as Qhe,statSync as EB}from"node:fs";import{createHash as ege}from"node:crypto";import{join as XT}from"node:path";function da(t){try{return Yhe("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function QT(t){let e=[],r=XT(t,"spec.yaml");kB(r)&&EB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=XT(t,"spec",i);if(!(!kB(o)||!EB(o).isDirectory()))for(let s of Xhe(o))s.endsWith(".yaml")&&e.push(XT(o,s))}e.sort();let n=ege("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Qhe(i)),n.update("\0")}return n.digest("hex")}function Jy(t,e){let r={featureId:e,gitHead:da(t),specDigest:QT(t),timestamp:new Date().toISOString()};return Yr(t,Xr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function Yy(t,e){let r=ua(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 Xy(t,e,r,n){let i=Xr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Yr(t,i),i}var bf=y(()=>{"use strict";Dr()});import{readFileSync as tge,statSync as rge}from"node:fs";import{extname as nge,resolve as eO,sep as ige}from"node:path";function Qr(t){return Math.ceil(t.length/4)}function age(t,e){let r=eO(e),n=eO(r,t);return n===r||n.startsWith(r+ige)}function TB(t,e,r,n){if(!age(t,e))return{path:t,omitted:"unsafe-path"};if(!oge.has(nge(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>AB)return{path:t,omitted:"too-large",bytes:o}}else{let l=eO(e,t);try{o=rge(l).size}catch{return{path:t,omitted:"missing"}}if(o>AB)return{path:t,omitted:"too-large",bytes:o};try{i=tge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(sge))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=zy(e),n=Zc(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=zy(e),n=Zc(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())}}};pB.Parser=UT});var _B=v(gf=>{"use strict";var mB=TT(),uhe=af(),hf=uf(),dhe=EA(),fhe=Ce(),phe=zT(),hB=qT();function gB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new phe.LineCounter||null,prettyErrors:e}}function mhe(t,e={}){let{lineCounter:r,prettyErrors:n}=gB(e),i=new hB.Parser(r?.addNewLine),o=new mB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(hf.prettifyError(t,r)),a.warnings.forEach(hf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function yB(t,e={}){let{lineCounter:r,prettyErrors:n}=gB(e),i=new hB.Parser(r?.addNewLine),o=new mB.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 hf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(hf.prettifyError(t,r)),s.warnings.forEach(hf.prettifyError(t,r))),s}function hhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=yB(t,r);if(!i)return null;if(i.warnings.forEach(o=>dhe.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 ghe(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 fhe.isDocument(t)&&!n?t.toString(r):new uhe.Document(t,n,r).toString(r)}gf.parse=hhe;gf.parseAllDocuments=mhe;gf.parseDocument=yB;gf.stringify=ghe});var cr=v(Ge=>{"use strict";var yhe=TT(),_he=af(),bhe=cT(),BT=uf(),vhe=Hd(),Ko=Ce(),She=Ho(),whe=It(),xhe=Zo(),$he=Vo(),khe=Fy(),Ehe=FT(),Ahe=zT(),The=qT(),qy=_B(),bB=zd();Ge.Composer=yhe.Composer;Ge.Document=_he.Document;Ge.Schema=bhe.Schema;Ge.YAMLError=BT.YAMLError;Ge.YAMLParseError=BT.YAMLParseError;Ge.YAMLWarning=BT.YAMLWarning;Ge.Alias=vhe.Alias;Ge.isAlias=Ko.isAlias;Ge.isCollection=Ko.isCollection;Ge.isDocument=Ko.isDocument;Ge.isMap=Ko.isMap;Ge.isNode=Ko.isNode;Ge.isPair=Ko.isPair;Ge.isScalar=Ko.isScalar;Ge.isSeq=Ko.isSeq;Ge.Pair=She.Pair;Ge.Scalar=whe.Scalar;Ge.YAMLMap=xhe.YAMLMap;Ge.YAMLSeq=$he.YAMLSeq;Ge.CST=khe;Ge.Lexer=Ehe.Lexer;Ge.LineCounter=Ahe.LineCounter;Ge.Parser=The.Parser;Ge.parse=qy.parse;Ge.parseAllDocuments=qy.parseAllDocuments;Ge.parseDocument=qy.parseDocument;Ge.stringify=qy.stringify;Ge.visit=bB.visit;Ge.visitAsync=bB.visitAsync});import{execFileSync as vB}from"node:child_process";import{existsSync as By}from"node:fs";import{join as Hy,resolve as Ohe}from"node:path";function Rhe(t){try{let e=vB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Ohe(t,e):null}catch{return null}}function HT(t){let e=Rhe(t);if(!e)return null;try{if(By(Hy(e,"MERGE_HEAD")))return"merge";if(By(Hy(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(By(Hy(e,"rebase-merge"))||By(Hy(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ca(t){return HT(t)!==null}function GT(t,e){try{let r=vB("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 Gy(t,e){return GT(t,e)!==null}var la=y(()=>{"use strict"});import{execFileSync as Ihe}from"node:child_process";import{existsSync as Phe,readFileSync as Che}from"node:fs";import{join as xB}from"node:path";function yf(t,e){return Ihe("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Jo(t){try{let e=yf(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 Yo(t,e){Dhe(t,e);let r=yf(t,["rev-parse","HEAD"]).trim(),n=Nhe(t,e);return{groups:jhe(t,n),head:r,inventory:{after:wB(Vy(t,"spec.yaml")),before:wB(ZT(t,e,"spec.yaml"))},since:e,unsharded_commits:zhe(t,e)}}function VT(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 Dhe(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!Gy(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 Nhe(t,e){let r=yf(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(!(!SB(c)&&!SB(a)))if(s.startsWith("A")){let l=Zy(Vy(t,c));if(!l)continue;l.status==="done"?n.push(Vc(l,"added-as-done")):l.status==="archived"&&n.push(Vc(l,"archived"))}else if(s.startsWith("D")){let l=Zy(ZT(t,e,a));l&&n.push(Vc(l,"archived"))}else{let l=Zy(Vy(t,c));if(!l)continue;let d=Zy(ZT(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(Vc(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(Vc(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(Vc(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function SB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function Vc(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>VT(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function Zy(t){if(t===null)return null;let e;try{e=(0,Wy.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 Vy(t,e){let r=xB(t,e);if(!Phe(r))return null;try{return Che(r,"utf8")}catch{return null}}function ZT(t,e,r){try{return yf(t,["show",`${e}:${r}`])}catch{return null}}function jhe(t,e){let r=Mhe(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 Mhe(t){let e=Vy(t,xB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,Wy.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function wB(t){let e={};if(t!==null)try{let n=(0,Wy.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 zhe(t,e){let r=yf(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);Fhe.test(a)&&(Lhe.test(a)||n.push({hash:s,subject:a}))}return n}var Wy,Fhe,Lhe,Wc=y(()=>{"use strict";Wy=Et(cr(),1);la();Fhe=/^(feat|fix)(\([^)]*\))?!?:/,Lhe=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as $B}from"node:child_process";import{appendFileSync as Uhe,existsSync as WT,mkdirSync as qhe,readFileSync as Bhe,renameSync as Hhe,statSync as Ghe}from"node:fs";import{userInfo as Zhe}from"node:os";import{dirname as Vhe,join as JT}from"node:path";function YT(t){return JT(t,kB,Whe)}function Jr(t,e){let r=YT(t),n=Vhe(r);WT(n)||qhe(n,{recursive:!0});try{WT(r)&&Ghe(r).size>Khe&&Hhe(r,JT(n,EB))}catch{}Uhe(r,`${JSON.stringify(e)} +`,"utf8")}function KT(t){if(!WT(t))return[];let e=Bhe(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ua(t){return KT(YT(t))}function Ky(t){return[...KT(JT(t,kB,EB)),...KT(YT(t))]}function Yr(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 Jhe(t){let e;try{e=$B("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Zhe().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Yhe(t){try{return $B("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function _f(t,e){try{let r=ua(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function lr(t,e,r){try{let n=Yhe(t),i=Jhe(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=_f(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Jr(t,Yr(e,o))}catch{}}var kB,Whe,EB,Khe,Cr=y(()=>{"use strict";kB=".cladding",Whe="events.log.jsonl",EB="events.log.1.jsonl",Khe=5*1024*1024});import{execFileSync as Xhe}from"node:child_process";import{existsSync as AB,readdirSync as Qhe,readFileSync as ege,statSync as TB}from"node:fs";import{createHash as tge}from"node:crypto";import{join as XT}from"node:path";function da(t){try{return Xhe("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function QT(t){let e=[],r=XT(t,"spec.yaml");AB(r)&&TB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=XT(t,"spec",i);if(!(!AB(o)||!TB(o).isDirectory()))for(let s of Qhe(o))s.endsWith(".yaml")&&e.push(XT(o,s))}e.sort();let n=tge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(ege(i)),n.update("\0")}return n.digest("hex")}function Jy(t,e){let r={featureId:e,gitHead:da(t),specDigest:QT(t),timestamp:new Date().toISOString()};return Jr(t,Yr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function Yy(t,e){let r=ua(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 Xy(t,e,r,n){let i=Yr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Jr(t,i),i}var bf=y(()=>{"use strict";Cr()});import{readFileSync as rge,statSync as nge}from"node:fs";import{extname as ige,resolve as eO,sep as oge}from"node:path";function Xr(t){return Math.ceil(t.length/4)}function cge(t,e){let r=eO(e),n=eO(r,t);return n===r||n.startsWith(r+oge)}function RB(t,e,r,n){if(!cge(t,e))return{path:t,omitted:"unsafe-path"};if(!sge.has(ige(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>OB)return{path:t,omitted:"too-large",bytes:o}}else{let l=eO(e,t);try{o=nge(l).size}catch{return{path:t,omitted:"missing"}}if(o>OB)return{path:t,omitted:"too-large",bytes:o};try{i=rge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(age))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 oge,AB,sge,Qy=y(()=>{"use strict";oge=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"]),AB=2e6,sge="\0"});function lge(t){for(let i of cge)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 tO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function uge(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??[])tO(e,s,o);for(let s of i.modules??[])tO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=lge(a);c&&tO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function xn(t){let e=OB.get(t);return e||(e=uge(t),OB.set(t,e)),e}var cge,OB,fa=y(()=>{"use strict";cge=["derived:","fixture:","script:","self-dogfood:"];OB=new WeakMap});function rO(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 yr(t,e,r={}){let n=r.depth??1/0,i=xn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=dge(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=rO(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:nO(i)}}var pa=y(()=>{"use strict";fa()});function RB(t){return t.impacted.length}function t_(t,e,r={}){let n=r.initialDepth??e_.initialDepth,i=r.maxDepth??e_.maxDepth,o=r.coverageThreshold??e_.coverageThreshold,s=r.marginYieldThreshold??e_.marginYieldThreshold,a=xn(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=yr(t,e,{depth:1});return"not_found"in b,b}let d=rO(l,a.dependents,1/0).size;if(d===0){let b=yr(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 _=yr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=RB(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,A=x===0&&b>n,E={frontierExhausted:A,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(A)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:E};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:E};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var e_,iO=y(()=>{"use strict";pa();fa();e_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function fge(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 IB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=fge(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 PB=y(()=>{"use strict"});function pge(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 Kc(t,e){let r=pge(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=IB(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 r_=y(()=>{"use strict";PB()});import{existsSync as DB,readdirSync as mge,readFileSync as hge}from"node:fs";import{join as sO}from"node:path";function aO(t,e=yge){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function _ge(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:aO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:aO(`done reverted \u2014 pre-push strict gate red${r}`)}}function CB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function bge(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 aO(n)}function vge(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)=>CB(m)-CB(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(-gge).map(_ge),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?bge(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 oO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Sge(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 wge(t,e,r){let n=oO(t,/_Rolled back at_\s*`([^`]+)`/),i=oO(t,/Last failed gate:\s*`([^`]+)`/),o=oO(t,/Retry attempts:\s*(\d+)/),s=Sge(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function xge(t,e){let r=sO(t,".cladding","post-mortems");if(!DB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of mge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(wge(hge(sO(r,o),"utf8"),e,o))}catch{}return i}function NB(t,e){try{let r=Ky(t),n=xge(t,e),i=DB(sO(t,".cladding","events.log.1.jsonl"));return vge(r,n,e,{truncated:i})}catch{return}}var gge,yge,jB=y(()=>{"use strict";Dr();gge=5,yge=120});function n_(t,e,r){return Qr(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function ma(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:$ge,o=e,s,a=xn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=Kc(t,o);if("not_found"in c)return c;let l=c.focus,u=NB(n,l.id),d=a&&a.size>0?e:l.id,f=t_(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}},O=[...c.ancestors];for(;O.length>kge&&n_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}E.push(Vt),Vt.truncated&&x.push(`code: clipped ${se}`)}A>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let C=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),k=(se,Pe,Vt,ar)=>{let Kt=Vt+ar>0?[`breaks: omitted ${Vt} feature(s) / ${ar} test(s)`]:[],to={...w,needs:O,must_edit:{...w.must_edit,code:E},breaks_if_changed:C(se,Pe),budget:{...w.budget,truncated:[...x,...Kt]}};return Qr(JSON.stringify(to))>i},q=m,Q=h;if(k(q,Q,0,0)){let se=yr(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Vt=new Set("not_found"in se?[]:se.test_refs),Kt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],to=0;for(;Kt.length>Pe.size&&k(Kt,Q,to,0);)Kt=Kt.slice(0,-1),to++;let yi=[...h],Jr=0;for(;k(Kt,yi,to,Jr);){let de=-1;for(let ro=yi.length-1;ro>=0;ro--)if(!Vt.has(yi[ro])){de=ro;break}if(de<0)break;yi.splice(de,1),Jr++}q=Kt,Q=yi,to+Jr>0&&x.push(`breaks: omitted ${to} feature(s) / ${Jr} test(s)`),k(q,Q,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Se=C(q,Q),I={...w,needs:O,must_edit:{...w.must_edit,code:E},breaks_if_changed:Se},P=I;if(u){let se={...I,prior_attempts:u};Qr(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Rr=Qr(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Rr,truncated:x}}}var $ge,kge,i_=y(()=>{"use strict";Qy();r_();iO();jB();pa();fa();$ge=3e3,kge=3});function Zn(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 Ege(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 MB(t,e,r="."){let n=xn(t),i=t.features??[],o=[];for(let f of i){let p=ma(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=ma(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=t_(t,f.id),g=!("not_found"in h),b=Qr(JSON.stringify(p)),_="not_found"in m?b:Qr(JSON.stringify(m)),S=Qr(JSON.stringify(f));for(let O of f.modules??[]){let A=e(O);A&&(S+=Qr(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(Zn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Zn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Zn(a(c))*10)/10,medianShrinkTruncated:Math.round(Zn(a(l))*10)/10,medianStructuralRatio:Math.round(Zn(u)*100)/100,medianSliceTokens:Math.round(Zn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Zn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Zn(o.map(f=>f.searchDepth)),p95Depth:Ege(o.map(f=>f.searchDepth),95),medianEdges:Zn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Zn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Zn(o.map(f=>f.regressionTests))},features:o}}var Jc,o_=y(()=>{"use strict";Qy();iO();i_();fa();Jc="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Age,existsSync as cO,mkdirSync as Tge,readFileSync as FB}from"node:fs";import{dirname as Oge,join as Rge}from"node:path";function lO(t){return Rge(t,Ige,Pge)}function Cge(t,e){return{timestamp:new Date().toISOString(),head:da(t),spec_digest:QT(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function LB(t,e){try{let r=Cge(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=uO(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=lO(t),s=Oge(o);return cO(s)||Tge(s,{recursive:!0}),Age(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function zB(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 uO(t,e){let r=lO(t);if(!cO(r))return[];let n;try{n=FB(r,"utf8")}catch{return[]}let i=zB(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function UB(t){let e=lO(t);if(!cO(e))return{snapshots:[],unreadable:!1};let r;try{r=FB(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=zB(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 qB(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(` ${Jc}`),i.join(` -`)}var Ige,Pge,Sf=y(()=>{"use strict";bf();o_();Ige=".cladding",Pge="measure.jsonl"});import{existsSync as Dge}from"node:fs";import{join as Nge}from"node:path";function Yc(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}** (${jge[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 HB(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(` +`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var sge,OB,age,Qy=y(()=>{"use strict";sge=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"]),OB=2e6,age="\0"});function uge(t){for(let i of lge)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 tO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function dge(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??[])tO(e,s,o);for(let s of i.modules??[])tO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=uge(a);c&&tO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function wn(t){let e=IB.get(t);return e||(e=dge(t),IB.set(t,e)),e}var lge,IB,fa=y(()=>{"use strict";lge=["derived:","fixture:","script:","self-dogfood:"];IB=new WeakMap});function rO(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 yr(t,e,r={}){let n=r.depth??1/0,i=wn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=fge(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=rO(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:nO(i)}}var pa=y(()=>{"use strict";fa()});function PB(t){return t.impacted.length}function t_(t,e,r={}){let n=r.initialDepth??e_.initialDepth,i=r.maxDepth??e_.maxDepth,o=r.coverageThreshold??e_.coverageThreshold,s=r.marginYieldThreshold??e_.marginYieldThreshold,a=wn(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=yr(t,e,{depth:1});return"not_found"in b,b}let d=rO(l,a.dependents,1/0).size;if(d===0){let b=yr(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 _=yr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=PB(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,A=x===0&&b>n,E={frontierExhausted:A,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(A)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:E};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:E};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var e_,iO=y(()=>{"use strict";pa();fa();e_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function pge(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 CB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=pge(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 DB=y(()=>{"use strict"});function mge(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 Kc(t,e){let r=mge(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=CB(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 r_=y(()=>{"use strict";DB()});import{existsSync as jB,readdirSync as hge,readFileSync as gge}from"node:fs";import{join as sO}from"node:path";function aO(t,e=_ge){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function bge(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:aO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:aO(`done reverted \u2014 pre-push strict gate red${r}`)}}function NB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function vge(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 aO(n)}function Sge(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)=>NB(m)-NB(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(-yge).map(bge),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?vge(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 oO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function wge(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 xge(t,e,r){let n=oO(t,/_Rolled back at_\s*`([^`]+)`/),i=oO(t,/Last failed gate:\s*`([^`]+)`/),o=oO(t,/Retry attempts:\s*(\d+)/),s=wge(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function $ge(t,e){let r=sO(t,".cladding","post-mortems");if(!jB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of hge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(xge(gge(sO(r,o),"utf8"),e,o))}catch{}return i}function MB(t,e){try{let r=Ky(t),n=$ge(t,e),i=jB(sO(t,".cladding","events.log.1.jsonl"));return Sge(r,n,e,{truncated:i})}catch{return}}var yge,_ge,FB=y(()=>{"use strict";Cr();yge=5,_ge=120});function n_(t,e,r){return Xr(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function ma(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:kge,o=e,s,a=wn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=Kc(t,o);if("not_found"in c)return c;let l=c.focus,u=MB(n,l.id),d=a&&a.size>0?e:l.id,f=t_(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}},O=[...c.ancestors];for(;O.length>Ege&&n_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}E.push(Vt),Vt.truncated&&x.push(`code: clipped ${se}`)}A>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let C=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),k=(se,Pe,Vt,ar)=>{let Kt=Vt+ar>0?[`breaks: omitted ${Vt} feature(s) / ${ar} test(s)`]:[],eo={...w,needs:O,must_edit:{...w.must_edit,code:E},breaks_if_changed:C(se,Pe),budget:{...w.budget,truncated:[...x,...Kt]}};return Xr(JSON.stringify(eo))>i},q=m,Q=h;if(k(q,Q,0,0)){let se=yr(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Vt=new Set("not_found"in se?[]:se.test_refs),Kt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],eo=0;for(;Kt.length>Pe.size&&k(Kt,Q,eo,0);)Kt=Kt.slice(0,-1),eo++;let gi=[...h],Kr=0;for(;k(Kt,gi,eo,Kr);){let de=-1;for(let to=gi.length-1;to>=0;to--)if(!Vt.has(gi[to])){de=to;break}if(de<0)break;gi.splice(de,1),Kr++}q=Kt,Q=gi,eo+Kr>0&&x.push(`breaks: omitted ${eo} feature(s) / ${Kr} test(s)`),k(q,Q,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Se=C(q,Q),I={...w,needs:O,must_edit:{...w.must_edit,code:E},breaks_if_changed:Se},P=I;if(u){let se={...I,prior_attempts:u};Xr(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Or=Xr(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Or,truncated:x}}}var kge,Ege,i_=y(()=>{"use strict";Qy();r_();iO();FB();pa();fa();kge=3e3,Ege=3});function Gn(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 Age(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 LB(t,e,r="."){let n=wn(t),i=t.features??[],o=[];for(let f of i){let p=ma(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=ma(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=t_(t,f.id),g=!("not_found"in h),b=Xr(JSON.stringify(p)),_="not_found"in m?b:Xr(JSON.stringify(m)),S=Xr(JSON.stringify(f));for(let O of f.modules??[]){let A=e(O);A&&(S+=Xr(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(Gn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Gn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Gn(a(c))*10)/10,medianShrinkTruncated:Math.round(Gn(a(l))*10)/10,medianStructuralRatio:Math.round(Gn(u)*100)/100,medianSliceTokens:Math.round(Gn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Gn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Gn(o.map(f=>f.searchDepth)),p95Depth:Age(o.map(f=>f.searchDepth),95),medianEdges:Gn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Gn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Gn(o.map(f=>f.regressionTests))},features:o}}var Jc,o_=y(()=>{"use strict";Qy();iO();i_();fa();Jc="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Tge,existsSync as cO,mkdirSync as Oge,readFileSync as zB}from"node:fs";import{dirname as Rge,join as Ige}from"node:path";function lO(t){return Ige(t,Pge,Cge)}function Dge(t,e){return{timestamp:new Date().toISOString(),head:da(t),spec_digest:QT(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function UB(t,e){try{let r=Dge(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=uO(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=lO(t),s=Rge(o);return cO(s)||Oge(s,{recursive:!0}),Tge(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function qB(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 uO(t,e){let r=lO(t);if(!cO(r))return[];let n;try{n=zB(r,"utf8")}catch{return[]}let i=qB(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function BB(t){let e=lO(t);if(!cO(e))return{snapshots:[],unreadable:!1};let r;try{r=zB(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=qB(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 HB(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(` ${Jc}`),i.join(` +`)}var Pge,Cge,Sf=y(()=>{"use strict";bf();o_();Pge=".cladding",Cge="measure.jsonl"});import{existsSync as Nge}from"node:fs";import{join as jge}from"node:path";function Yc(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}** (${Mge[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 ZB(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`,"",Jc),r.join(` -`)}function Xc(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"} | ${Fge(l,r)} |`)}return n.join(` -`)}function Fge(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 Mge)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Dge(Nge(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function Qc(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),BB(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)BB(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function BB(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=VT(r);n&&t.push(`- ${n}`)}t.push("")}var jge,Mge,s_=y(()=>{"use strict";Sf();o_();Wc();jge={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Mge=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Lge}from"node:fs";function wi(t="./spec.yaml"){let e=Lge(t,"utf8");return(0,GB.parse)(e)}var GB,a_=y(()=>{"use strict";GB=Et(cr(),1)});var Xo=v((Nr,mO)=>{"use strict";var dO=Nr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+VB(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()};dO.prototype.toString=function(){return this.property+" "+this.message};var c_=Nr.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};c_.prototype.addError=function(e){var r;if(typeof e=="string")r=new dO(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 dO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new ha(this);if(this.throwError)throw r;return r};c_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function zge(t,e){return e+": "+t.toString()+` -`}c_.prototype.toString=function(e){return this.errors.map(zge).join("")};Object.defineProperty(c_.prototype,"valid",{get:function(){return!this.errors.length}});mO.exports.ValidatorResultError=ha;function ha(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ha),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}ha.prototype=new Error;ha.prototype.constructor=ha;ha.prototype.name="Validation Error";var ZB=Nr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};ZB.prototype=Object.create(Error.prototype,{constructor:{value:ZB,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var fO=Nr.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+VB(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};fO.prototype.resolve=function(e){return WB(this.base,e)};fO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=WB(this.base,i||"");var s=new fO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Vn=Nr.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]+$/};Vn.regexp=Vn.regex;Vn.pattern=Vn.regex;Vn.ipv4=Vn["ip-address"];Nr.isFormat=function(e,r,n){if(typeof e=="string"&&Vn[r]!==void 0){if(Vn[r]instanceof RegExp)return Vn[r].test(e);if(typeof Vn[r]=="function")return Vn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var VB=Nr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Nr.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 Uge(t,e,r,n){typeof r=="object"?e[n]=pO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function qge(t,e,r){e[r]=t[r]}function Bge(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=pO(t[n],e[n]):r[n]=e[n]}function pO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Uge.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(qge.bind(null,t,n)),Object.keys(e).forEach(Bge.bind(null,t,e,n))),n}mO.exports.deepMerge=pO;Nr.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 Hge(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Nr.encodePath=function(e){return e.map(Hge).join("")};Nr.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};Nr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var WB=Nr.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 XB=v((hYe,YB)=>{"use strict";var en=Xo(),Fe=en.ValidatorResult,Qo=en.SchemaError,hO={};hO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=hO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 gO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new Qo("anyOf must be an array");if(!r.anyOf.some(gO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new Qo("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new Qo("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(gO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!en.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=gO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!en.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(!en.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 yO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!en.isSchema(s))throw new Qo('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(yO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 Qo('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=yO(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 KB(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 Qo('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&&KB.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)KB.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!en.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Gge(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var _O=Xo();bO.exports.SchemaScanResult=QB;function QB(t,e){this.id=t,this.ref=e}bO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=_O.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=_O.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!_O.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 eH=XB(),es=Xo(),tH=l_().scan,rH=es.ValidatorResult,Zge=es.ValidatorResultError,wf=es.SchemaError,nH=es.SchemaContext,Vge="/",Wt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(xi),this.attributes=Object.create(eH.validators)};Wt.prototype.customFormats={};Wt.prototype.schemas=null;Wt.prototype.types=null;Wt.prototype.attributes=null;Wt.prototype.unresolvedRefs=null;Wt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=tH(r||Vge,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]};Wt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=es.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}};Wt.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 xi=Wt.prototype.types={};xi.string=function(e){return typeof e=="string"};xi.number=function(e){return typeof e=="number"&&isFinite(e)};xi.integer=function(e){return typeof e=="number"&&e%1===0};xi.boolean=function(e){return typeof e=="boolean"};xi.array=function(e){return Array.isArray(e)};xi.null=function(e){return e===null};xi.date=function(e){return e instanceof Date};xi.any=function(e){return!0};xi.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};oH.exports=Wt});var aH=v((_Ye,so)=>{"use strict";var Wge=so.exports.Validator=sH();so.exports.ValidatorResult=Xo().ValidatorResult;so.exports.ValidatorResultError=Xo().ValidatorResultError;so.exports.ValidationError=Xo().ValidationError;so.exports.SchemaError=Xo().SchemaError;so.exports.SchemaScanResult=l_().SchemaScanResult;so.exports.scan=l_().scan;so.exports.validate=function(t,e,r){var n=new Wge;return n.validate(t,e,r)}});import{readFileSync as Kge}from"node:fs";import{dirname as Jge,join as Yge}from"node:path";import{fileURLToPath as Xge}from"node:url";function nye(t){let e=rye.validate(t,tye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function lH(t){let e=nye(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`)}function Xc(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"} | ${Lge(l,r)} |`)}return n.join(` +`)}function Lge(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 Fge)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Nge(jge(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function Qc(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),GB(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)GB(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function GB(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=VT(r);n&&t.push(`- ${n}`)}t.push("")}var Mge,Fge,s_=y(()=>{"use strict";Sf();o_();Wc();Mge={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Fge=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as zge}from"node:fs";function Si(t="./spec.yaml"){let e=zge(t,"utf8");return(0,VB.parse)(e)}var VB,a_=y(()=>{"use strict";VB=Et(cr(),1)});var Xo=v((Dr,mO)=>{"use strict";var dO=Dr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+KB(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()};dO.prototype.toString=function(){return this.property+" "+this.message};var c_=Dr.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};c_.prototype.addError=function(e){var r;if(typeof e=="string")r=new dO(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 dO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new ha(this);if(this.throwError)throw r;return r};c_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Uge(t,e){return e+": "+t.toString()+` +`}c_.prototype.toString=function(e){return this.errors.map(Uge).join("")};Object.defineProperty(c_.prototype,"valid",{get:function(){return!this.errors.length}});mO.exports.ValidatorResultError=ha;function ha(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ha),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}ha.prototype=new Error;ha.prototype.constructor=ha;ha.prototype.name="Validation Error";var WB=Dr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};WB.prototype=Object.create(Error.prototype,{constructor:{value:WB,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var fO=Dr.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+KB(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};fO.prototype.resolve=function(e){return JB(this.base,e)};fO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=JB(this.base,i||"");var s=new fO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Zn=Dr.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]+$/};Zn.regexp=Zn.regex;Zn.pattern=Zn.regex;Zn.ipv4=Zn["ip-address"];Dr.isFormat=function(e,r,n){if(typeof e=="string"&&Zn[r]!==void 0){if(Zn[r]instanceof RegExp)return Zn[r].test(e);if(typeof Zn[r]=="function")return Zn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var KB=Dr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Dr.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 qge(t,e,r,n){typeof r=="object"?e[n]=pO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Bge(t,e,r){e[r]=t[r]}function Hge(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=pO(t[n],e[n]):r[n]=e[n]}function pO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(qge.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Bge.bind(null,t,n)),Object.keys(e).forEach(Hge.bind(null,t,e,n))),n}mO.exports.deepMerge=pO;Dr.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 Gge(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Dr.encodePath=function(e){return e.map(Gge).join("")};Dr.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};Dr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var JB=Dr.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 eH=v((gYe,QB)=>{"use strict";var Qr=Xo(),Fe=Qr.ValidatorResult,Qo=Qr.SchemaError,hO={};hO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=hO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 gO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new Qo("anyOf must be an array");if(!r.anyOf.some(gO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new Qo("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new Qo("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(gO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!Qr.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=gO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!Qr.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(!Qr.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 yO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!Qr.isSchema(s))throw new Qo('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(yO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 Qo('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=yO(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 YB(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 Qo('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&&YB.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)YB.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!Qr.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Zge(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var _O=Xo();bO.exports.SchemaScanResult=tH;function tH(t,e){this.id=t,this.ref=e}bO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=_O.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=_O.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!_O.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 rH=eH(),es=Xo(),nH=l_().scan,iH=es.ValidatorResult,Vge=es.ValidatorResultError,wf=es.SchemaError,oH=es.SchemaContext,Wge="/",Wt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(wi),this.attributes=Object.create(rH.validators)};Wt.prototype.customFormats={};Wt.prototype.schemas=null;Wt.prototype.types=null;Wt.prototype.attributes=null;Wt.prototype.unresolvedRefs=null;Wt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=nH(r||Wge,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]};Wt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=es.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}};Wt.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 wi=Wt.prototype.types={};wi.string=function(e){return typeof e=="string"};wi.number=function(e){return typeof e=="number"&&isFinite(e)};wi.integer=function(e){return typeof e=="number"&&e%1===0};wi.boolean=function(e){return typeof e=="boolean"};wi.array=function(e){return Array.isArray(e)};wi.null=function(e){return e===null};wi.date=function(e){return e instanceof Date};wi.any=function(e){return!0};wi.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};aH.exports=Wt});var lH=v((bYe,oo)=>{"use strict";var Kge=oo.exports.Validator=cH();oo.exports.ValidatorResult=Xo().ValidatorResult;oo.exports.ValidatorResultError=Xo().ValidatorResultError;oo.exports.ValidationError=Xo().ValidationError;oo.exports.SchemaError=Xo().SchemaError;oo.exports.SchemaScanResult=l_().SchemaScanResult;oo.exports.scan=l_().scan;oo.exports.validate=function(t,e,r){var n=new Kge;return n.validate(t,e,r)}});import{readFileSync as Jge}from"node:fs";import{dirname as Yge,join as Xge}from"node:path";import{fileURLToPath as Qge}from"node:url";function iye(t){let e=nye.validate(t,rye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function dH(t){let e=iye(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var cH,Qge,eye,tye,rye,uH=y(()=>{"use strict";cH=Et(aH(),1),Qge=Jge(Xge(import.meta.url)),eye=Yge(Qge,"schema.json"),tye=JSON.parse(Kge(eye,"utf8")),rye=new cH.Validator});import{existsSync as vO,readdirSync as iye}from"node:fs";import{dirname as oye,join as ga,resolve as fH}from"node:path";function dH(t){return vO(t)?iye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>wi(ga(t,r))):[]}function ya(t,e){u_=e?{cwd:fH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return u_&&e==="spec.yaml"&&fH(t)===u_.cwd?u_.spec:sye(t,e)}function sye(t,e){let r=ga(t,e),n=wi(r),i=ga(t,oye(e),"spec");if(!n.features||n.features.length===0){let o=dH(ga(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=dH(ga(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ga(i,"architecture.yaml");vO(o)&&(n.architecture=wi(o))}if(!n.capabilities||n.capabilities.length===0){let o=ga(i,"capabilities.yaml");if(vO(o)){let s=wi(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return lH(n),n}var u_,qe=y(()=>{"use strict";a_();uH();u_=null});import el from"node:process";function xO(){return!!el.stdout.isTTY}function M(t,e,r=""){let n=pH[t],i=r?` ${r}`:"";xO()?el.stdout.write(`${SO[t]}${n}${wO} ${e}${i} + `)}`)}var uH,eye,tye,rye,nye,fH=y(()=>{"use strict";uH=Et(lH(),1),eye=Yge(Qge(import.meta.url)),tye=Xge(eye,"schema.json"),rye=JSON.parse(Jge(tye,"utf8")),nye=new uH.Validator});import{existsSync as vO,readdirSync as oye}from"node:fs";import{dirname as sye,join as ga,resolve as mH}from"node:path";function pH(t){return vO(t)?oye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Si(ga(t,r))):[]}function ya(t,e){u_=e?{cwd:mH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return u_&&e==="spec.yaml"&&mH(t)===u_.cwd?u_.spec:aye(t,e)}function aye(t,e){let r=ga(t,e),n=Si(r),i=ga(t,sye(e),"spec");if(!n.features||n.features.length===0){let o=pH(ga(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=pH(ga(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ga(i,"architecture.yaml");vO(o)&&(n.architecture=Si(o))}if(!n.capabilities||n.capabilities.length===0){let o=ga(i,"capabilities.yaml");if(vO(o)){let s=Si(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return dH(n),n}var u_,qe=y(()=>{"use strict";a_();fH();u_=null});import el from"node:process";function xO(){return!!el.stdout.isTTY}function F(t,e,r=""){let n=hH[t],i=r?` ${r}`:"";xO()?el.stdout.write(`${SO[t]}${n}${wO} ${e}${i} `):el.stdout.write(`${n} ${e}${i} -`)}function xf(t,e,r=""){if(!xO())return;let n=r?` ${r}`:"";el.stdout.write(`${mH}${SO.start}\xB7${wO} ${t} \xB7 ${e}${n}`)}function _a(t,e,r=""){let n=pH[t],i=r?` ${r}`:"";xO()?el.stdout.write(`${mH}${SO[t]}${n}${wO} ${e}${i} +`)}function xf(t,e,r=""){if(!xO())return;let n=r?` ${r}`:"";el.stdout.write(`${gH}${SO.start}\xB7${wO} ${t} \xB7 ${e}${n}`)}function _a(t,e,r=""){let n=hH[t],i=r?` ${r}`:"";xO()?el.stdout.write(`${gH}${SO[t]}${n}${wO} ${e}${i} `):el.stdout.write(`${n} ${e}${i} -`)}var pH,SO,wO,mH,$i=y(()=>{"use strict";pH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},SO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},wO="\x1B[0m",mH="\r\x1B[K"});import{createHash as NH}from"node:crypto";import{existsSync as Fye,readFileSync as EO,writeFileSync as Lye}from"node:fs";import{join as d_}from"node:path";function zye(t,e){let r=NH("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(EO(d_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function MH(t,e){let r=NH("sha256");try{r.update(EO(d_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ts(t){let e=d_(t,...jH);if(!Fye(e))return null;let r;try{r=EO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function f_(t){return t.features?.size??t.v1?.size??0}function p_(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)!==MH(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===zye(e,n)?{state:"fresh"}:{state:"stale"}}function FH(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${MH(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=Uye+`attested_modules: +`)}var hH,SO,wO,gH,xi=y(()=>{"use strict";hH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},SO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},wO="\x1B[0m",gH="\r\x1B[K"});import{createHash as MH}from"node:crypto";import{existsSync as Lye,readFileSync as EO,writeFileSync as zye}from"node:fs";import{join as d_}from"node:path";function Uye(t,e){let r=MH("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(EO(d_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function LH(t,e){let r=MH("sha256");try{r.update(EO(d_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ts(t){let e=d_(t,...FH);if(!Lye(e))return null;let r;try{r=EO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function f_(t){return t.features?.size??t.v1?.size??0}function p_(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)!==LH(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===Uye(e,n)?{state:"fresh"}:{state:"stale"}}function zH(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${LH(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=qye+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return Lye(d_(t,...jH),s,"utf8"),!0}var jH,Uye,rl=y(()=>{"use strict";jH=["spec","attestation.yaml"];Uye=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return zye(d_(t,...FH),s,"utf8"),!0}var FH,qye,rl=y(()=>{"use strict";FH=["spec","attestation.yaml"];qye=`# 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. # @@ -211,52 +211,52 @@ 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 AO}from"node:path";function m_(t){rs={cwd:AO(t),results:new Map}}function LH(t,e,r){!rs||rs.cwd!==AO(e)||rs.results.set(t,r)}function h_(t,e){return!rs||rs.cwd!==AO(e)?null:rs.results.get(t)??null}function g_(){rs=null}var rs,nl=y(()=>{"use strict";rs=null});function At(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 co=y(()=>{});import{fileURLToPath as qye}from"node:url";var il,Bye,TO,OO,ol=y(()=>{il=(t,e)=>{let r=OO(Bye(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Bye=t=>TO(t)?t.toString():t,TO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,OO=t=>t instanceof URL?qye(t):t});var y_,RO=y(()=>{co();ol();y_=(t,e=[],r={})=>{let n=il(t,"First argument"),[i,o]=At(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(!At(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as Hye}from"node:string_decoder";var zH,UH,Ft,lo,Gye,qH,Zye,__,BH,Vye,Ef,Wye,IO,Kye,tn=y(()=>{({toString:zH}=Object.prototype),UH=t=>zH.call(t)==="[object ArrayBuffer]",Ft=t=>zH.call(t)==="[object Uint8Array]",lo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Gye=new TextEncoder,qH=t=>Gye.encode(t),Zye=new TextDecoder,__=t=>Zye.decode(t),BH=(t,e)=>Vye(t,e).join(""),Vye=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Hye(e),n=t.map(o=>typeof o=="string"?qH(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Ef=t=>t.length===1&&Ft(t[0])?t[0]:IO(Wye(t)),Wye=t=>t.map(e=>typeof e=="string"?qH(e):e),IO=t=>{let e=new Uint8Array(Kye(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Kye=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Jye}from"node:child_process";var VH,WH,Yye,Xye,HH,Qye,GH,ZH,e_e,KH=y(()=>{co();tn();VH=t=>Array.isArray(t)&&Array.isArray(t.raw),WH=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Yye({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,{}]},Yye=({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}=Xye(i,t.raw[n]),c=GH(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>ZH(d)):[ZH(l)];return GH(c,u,a)},Xye=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=HH.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)],ZH=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(At(t)&&("stdout"in t||"isMaxBuffer"in t))return e_e(t);throw t instanceof Jye||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`)},e_e=({stdout:t})=>{if(typeof t=="string")return t;if(Ft(t))return __(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 PO from"node:process";var Wn,b_,$n,v_,uo=y(()=>{Wn=t=>b_.includes(t),b_=[PO.stdin,PO.stdout,PO.stderr],$n=["stdin","stdout","stderr"],v_=t=>$n[t]??`stdio[${t}]`});import{debuglog as t_e}from"node:util";var YH,CO,r_e,n_e,i_e,o_e,JH,s_e,DO,a_e,c_e,l_e,u_e,NO,fo,po=y(()=>{co();uo();YH=t=>{let e={...t};for(let r of NO)e[r]=CO(t,r);return e},CO=(t,e)=>{let r=Array.from({length:r_e(t)+1}),n=n_e(t[e],r,e);return c_e(n,e)},r_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,$n.length):$n.length,n_e=(t,e,r)=>At(t)?i_e(t,e,r):e.fill(t),i_e=(t,e,r)=>{for(let n of Object.keys(t).sort(o_e))for(let i of s_e(n,r,e))e[i]=t[n];return e},o_e=(t,e)=>JH(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,s_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=DO(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as AO}from"node:path";function m_(t){rs={cwd:AO(t),results:new Map}}function UH(t,e,r){!rs||rs.cwd!==AO(e)||rs.results.set(t,r)}function h_(t,e){return!rs||rs.cwd!==AO(e)?null:rs.results.get(t)??null}function g_(){rs=null}var rs,nl=y(()=>{"use strict";rs=null});function At(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 ao=y(()=>{});import{fileURLToPath as Bye}from"node:url";var il,Hye,TO,OO,ol=y(()=>{il=(t,e)=>{let r=OO(Hye(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Hye=t=>TO(t)?t.toString():t,TO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,OO=t=>t instanceof URL?Bye(t):t});var y_,RO=y(()=>{ao();ol();y_=(t,e=[],r={})=>{let n=il(t,"First argument"),[i,o]=At(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(!At(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as Gye}from"node:string_decoder";var qH,BH,Ft,co,Zye,HH,Vye,__,GH,Wye,Ef,Kye,IO,Jye,en=y(()=>{({toString:qH}=Object.prototype),BH=t=>qH.call(t)==="[object ArrayBuffer]",Ft=t=>qH.call(t)==="[object Uint8Array]",co=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Zye=new TextEncoder,HH=t=>Zye.encode(t),Vye=new TextDecoder,__=t=>Vye.decode(t),GH=(t,e)=>Wye(t,e).join(""),Wye=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Gye(e),n=t.map(o=>typeof o=="string"?HH(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Ef=t=>t.length===1&&Ft(t[0])?t[0]:IO(Kye(t)),Kye=t=>t.map(e=>typeof e=="string"?HH(e):e),IO=t=>{let e=new Uint8Array(Jye(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Jye=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Yye}from"node:child_process";var KH,JH,Xye,Qye,ZH,e_e,VH,WH,t_e,YH=y(()=>{ao();en();KH=t=>Array.isArray(t)&&Array.isArray(t.raw),JH=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Xye({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,{}]},Xye=({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}=Qye(i,t.raw[n]),c=VH(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>WH(d)):[WH(l)];return VH(c,u,a)},Qye=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=ZH.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)],WH=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(At(t)&&("stdout"in t||"isMaxBuffer"in t))return t_e(t);throw t instanceof Yye||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`)},t_e=({stdout:t})=>{if(typeof t=="string")return t;if(Ft(t))return __(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 PO from"node:process";var Vn,b_,xn,v_,lo=y(()=>{Vn=t=>b_.includes(t),b_=[PO.stdin,PO.stdout,PO.stderr],xn=["stdin","stdout","stderr"],v_=t=>xn[t]??`stdio[${t}]`});import{debuglog as r_e}from"node:util";var QH,CO,n_e,i_e,o_e,s_e,XH,a_e,DO,c_e,l_e,u_e,d_e,NO,uo,fo=y(()=>{ao();lo();QH=t=>{let e={...t};for(let r of NO)e[r]=CO(t,r);return e},CO=(t,e)=>{let r=Array.from({length:n_e(t)+1}),n=i_e(t[e],r,e);return l_e(n,e)},n_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,xn.length):xn.length,i_e=(t,e,r)=>At(t)?o_e(t,e,r):e.fill(t),o_e=(t,e,r)=>{for(let n of Object.keys(t).sort(s_e))for(let i of a_e(n,r,e))e[i]=t[n];return e},s_e=(t,e)=>XH(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,a_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=DO(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]},DO=t=>{if(t==="all")return t;if($n.includes(t))return $n.indexOf(t);let e=a_e.exec(t);if(e!==null)return Number(e[1])},a_e=/^fd(\d+)$/,c_e=(t,e)=>t.map(r=>r===void 0?u_e[e]:r),l_e=t_e("execa").enabled?"full":"none",u_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:l_e,stripFinalNewline:!0},NO=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],fo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var sl,al,XH,jO,d_e,S_,w_,ns=y(()=>{po();sl=({verbose:t},e)=>jO(t,e)!=="none",al=({verbose:t},e)=>!["none","short"].includes(jO(t,e)),XH=({verbose:t},e)=>{let r=jO(t,e);return S_(r)?r:void 0},jO=(t,e)=>e===void 0?d_e(t):fo(t,e),d_e=t=>t.find(e=>S_(e))??w_.findLast(e=>t.includes(e)),S_=t=>typeof t=="function",w_=["none","short","full"]});import{platform as f_e}from"node:process";import{stripVTControlCharacters as p_e}from"node:util";var QH,Af,eG,m_e,h_e,g_e,y_e,__e,b_e,v_e,x_=y(()=>{QH=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>b_e(eG(o))).join(" ");return{command:n,escapedCommand:i}},Af=t=>p_e(t).split(` -`).map(e=>eG(e)).join(` -`),eG=t=>t.replaceAll(g_e,e=>m_e(e)),m_e=t=>{let e=y_e[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=__e?`\\u${n.padStart(4,"0")}`:`\\U${n}`},h_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},g_e=h_e(),y_e={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},__e=65535,b_e=t=>v_e.test(t)?t:f_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,v_e=/^[\w./-]+$/});import tG from"node:process";function MO(){let{env:t}=tG,{TERM:e,TERM_PROGRAM:r}=t;return tG.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 rG=y(()=>{});var nG,iG,S_e,w_e,x_e,$_e,k_e,$_,wXe,oG=y(()=>{rG();nG={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"},iG={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"},S_e={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"},w_e={...nG,...iG},x_e={...nG,...S_e},$_e=MO(),k_e=$_e?w_e:x_e,$_=k_e,wXe=Object.entries(iG)});import E_e from"node:tty";var A_e,_e,kXe,sG,EXe,AXe,TXe,OXe,RXe,IXe,PXe,CXe,DXe,NXe,jXe,MXe,FXe,LXe,zXe,k_,UXe,qXe,BXe,HXe,GXe,ZXe,VXe,WXe,KXe,aG,JXe,cG,YXe,XXe,QXe,e7e,t7e,r7e,n7e,i7e,o7e,s7e,a7e,FO=y(()=>{A_e=E_e?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!A_e)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}},kXe=_e(0,0),sG=_e(1,22),EXe=_e(2,22),AXe=_e(3,23),TXe=_e(4,24),OXe=_e(53,55),RXe=_e(7,27),IXe=_e(8,28),PXe=_e(9,29),CXe=_e(30,39),DXe=_e(31,39),NXe=_e(32,39),jXe=_e(33,39),MXe=_e(34,39),FXe=_e(35,39),LXe=_e(36,39),zXe=_e(37,39),k_=_e(90,39),UXe=_e(40,49),qXe=_e(41,49),BXe=_e(42,49),HXe=_e(43,49),GXe=_e(44,49),ZXe=_e(45,49),VXe=_e(46,49),WXe=_e(47,49),KXe=_e(100,49),aG=_e(91,39),JXe=_e(92,39),cG=_e(93,39),YXe=_e(94,39),XXe=_e(95,39),QXe=_e(96,39),e7e=_e(97,39),t7e=_e(101,49),r7e=_e(102,49),n7e=_e(103,49),i7e=_e(104,49),o7e=_e(105,49),s7e=_e(106,49),a7e=_e(107,49)});var lG=y(()=>{FO();FO()});var fG,O_e,E_,uG,R_e,dG,I_e,pG=y(()=>{oG();lG();fG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=O_e(r),c=R_e[t]({failed:o,reject:s,piped:n}),l=I_e[t]({reject:s});return`${k_(`[${a}]`)} ${k_(`[${i}]`)} ${l(c)} ${l(e)}`},O_e=t=>`${E_(t.getHours(),2)}:${E_(t.getMinutes(),2)}:${E_(t.getSeconds(),2)}.${E_(t.getMilliseconds(),3)}`,E_=(t,e)=>String(t).padStart(e,"0"),uG=({failed:t,reject:e})=>t?e?$_.cross:$_.warning:$_.tick,R_e={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:uG,duration:uG},dG=t=>t,I_e={command:()=>sG,output:()=>dG,ipc:()=>dG,error:({reject:t})=>t?aG:cG,duration:()=>k_}});var mG,P_e,C_e,hG=y(()=>{ns();mG=(t,e,r)=>{let n=XH(e,r);return t.map(({verboseLine:i,verboseObject:o})=>P_e(i,o,n)).filter(i=>i!==void 0).map(i=>C_e(i)).join("")},P_e=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},C_e=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},DO=t=>{if(t==="all")return t;if(xn.includes(t))return xn.indexOf(t);let e=c_e.exec(t);if(e!==null)return Number(e[1])},c_e=/^fd(\d+)$/,l_e=(t,e)=>t.map(r=>r===void 0?d_e[e]:r),u_e=r_e("execa").enabled?"full":"none",d_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:u_e,stripFinalNewline:!0},NO=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],uo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var sl,al,eG,jO,f_e,S_,w_,ns=y(()=>{fo();sl=({verbose:t},e)=>jO(t,e)!=="none",al=({verbose:t},e)=>!["none","short"].includes(jO(t,e)),eG=({verbose:t},e)=>{let r=jO(t,e);return S_(r)?r:void 0},jO=(t,e)=>e===void 0?f_e(t):uo(t,e),f_e=t=>t.find(e=>S_(e))??w_.findLast(e=>t.includes(e)),S_=t=>typeof t=="function",w_=["none","short","full"]});import{platform as p_e}from"node:process";import{stripVTControlCharacters as m_e}from"node:util";var tG,Af,rG,h_e,g_e,y_e,__e,b_e,v_e,S_e,x_=y(()=>{tG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>v_e(rG(o))).join(" ");return{command:n,escapedCommand:i}},Af=t=>m_e(t).split(` +`).map(e=>rG(e)).join(` +`),rG=t=>t.replaceAll(y_e,e=>h_e(e)),h_e=t=>{let e=__e[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=b_e?`\\u${n.padStart(4,"0")}`:`\\U${n}`},g_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},y_e=g_e(),__e={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},b_e=65535,v_e=t=>S_e.test(t)?t:p_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,S_e=/^[\w./-]+$/});import nG from"node:process";function MO(){let{env:t}=nG,{TERM:e,TERM_PROGRAM:r}=t;return nG.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 iG=y(()=>{});var oG,sG,w_e,x_e,$_e,k_e,E_e,$_,xXe,aG=y(()=>{iG();oG={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"},sG={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"},w_e={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"},x_e={...oG,...sG},$_e={...oG,...w_e},k_e=MO(),E_e=k_e?x_e:$_e,$_=E_e,xXe=Object.entries(sG)});import A_e from"node:tty";var T_e,_e,EXe,cG,AXe,TXe,OXe,RXe,IXe,PXe,CXe,DXe,NXe,jXe,MXe,FXe,LXe,zXe,UXe,k_,qXe,BXe,HXe,GXe,ZXe,VXe,WXe,KXe,JXe,lG,YXe,uG,XXe,QXe,e7e,t7e,r7e,n7e,i7e,o7e,s7e,a7e,c7e,FO=y(()=>{T_e=A_e?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!T_e)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}},EXe=_e(0,0),cG=_e(1,22),AXe=_e(2,22),TXe=_e(3,23),OXe=_e(4,24),RXe=_e(53,55),IXe=_e(7,27),PXe=_e(8,28),CXe=_e(9,29),DXe=_e(30,39),NXe=_e(31,39),jXe=_e(32,39),MXe=_e(33,39),FXe=_e(34,39),LXe=_e(35,39),zXe=_e(36,39),UXe=_e(37,39),k_=_e(90,39),qXe=_e(40,49),BXe=_e(41,49),HXe=_e(42,49),GXe=_e(43,49),ZXe=_e(44,49),VXe=_e(45,49),WXe=_e(46,49),KXe=_e(47,49),JXe=_e(100,49),lG=_e(91,39),YXe=_e(92,39),uG=_e(93,39),XXe=_e(94,39),QXe=_e(95,39),e7e=_e(96,39),t7e=_e(97,39),r7e=_e(101,49),n7e=_e(102,49),i7e=_e(103,49),o7e=_e(104,49),s7e=_e(105,49),a7e=_e(106,49),c7e=_e(107,49)});var dG=y(()=>{FO();FO()});var mG,R_e,E_,fG,I_e,pG,P_e,hG=y(()=>{aG();dG();mG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=R_e(r),c=I_e[t]({failed:o,reject:s,piped:n}),l=P_e[t]({reject:s});return`${k_(`[${a}]`)} ${k_(`[${i}]`)} ${l(c)} ${l(e)}`},R_e=t=>`${E_(t.getHours(),2)}:${E_(t.getMinutes(),2)}:${E_(t.getSeconds(),2)}.${E_(t.getMilliseconds(),3)}`,E_=(t,e)=>String(t).padStart(e,"0"),fG=({failed:t,reject:e})=>t?e?$_.cross:$_.warning:$_.tick,I_e={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:fG,duration:fG},pG=t=>t,P_e={command:()=>cG,output:()=>pG,ipc:()=>pG,error:({reject:t})=>t?lG:uG,duration:()=>k_}});var gG,C_e,D_e,yG=y(()=>{ns();gG=(t,e,r)=>{let n=eG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>C_e(i,o,n)).filter(i=>i!==void 0).map(i=>D_e(i)).join("")},C_e=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},D_e=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as D_e}from"node:util";var ki,N_e,j_e,M_e,A_,F_e,cl=y(()=>{x_();pG();hG();ki=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=N_e({type:t,result:i,verboseInfo:n}),s=j_e(e,o),a=mG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},N_e=({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}),j_e=(t,e)=>t.split(` -`).map(r=>M_e({...e,message:r})),M_e=t=>({verboseLine:fG(t),verboseObject:t}),A_=t=>{let e=typeof t=="string"?t:D_e(t);return Af(e).replaceAll(" "," ".repeat(F_e))},F_e=2});var gG,yG=y(()=>{ns();cl();gG=(t,e)=>{sl(e)&&ki({type:"command",verboseMessage:t,verboseInfo:e})}});var _G,L_e,z_e,U_e,bG=y(()=>{ns();_G=(t,e,r)=>{U_e(t);let n=L_e(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},L_e=t=>sl({verbose:t})?z_e++:void 0,z_e=0n,U_e=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(!w_.includes(e)&&!S_(e)){let r=w_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as vG}from"node:process";var T_,LO,O_=y(()=>{T_=()=>vG.bigint(),LO=t=>Number(vG.bigint()-t)/1e6});var R_,zO=y(()=>{yG();bG();O_();x_();po();R_=(t,e,r)=>{let n=T_(),{command:i,escapedCommand:o}=QH(t,e),s=CO(r,"verbose"),a=_G(s,o,{...r});return gG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var kG=v((C7e,$G)=>{$G.exports=xG;xG.sync=B_e;var SG=He("fs");function q_e(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{OG.exports=AG;AG.sync=H_e;var EG=He("fs");function AG(t,e,r){EG.stat(t,function(n,i){r(n,n?!1:TG(i,e))})}function H_e(t,e){return TG(EG.statSync(t),e)}function TG(t,e){return t.isFile()&&G_e(t,e)}function G_e(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 PG=v((j7e,IG)=>{var N7e=He("fs"),I_;process.platform==="win32"||global.TESTING_WINDOWS?I_=kG():I_=RG();IG.exports=UO;UO.sync=Z_e;function UO(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){UO(t,e||{},function(o,s){o?i(o):n(s)})})}I_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Z_e(t,e){try{return I_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var LG=v((M7e,FG)=>{var ll=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",CG=He("path"),V_e=ll?";":":",DG=PG(),NG=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),jG=(t,e)=>{let r=e.colon||V_e,n=t.match(/\//)||ll&&t.match(/\\/)?[""]:[...ll?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=ll?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=ll?i.split(r):[""];return ll&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},MG=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=jG(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(NG(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=CG.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];DG(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)},W_e=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=jG(t,e),o=[];for(let s=0;s{"use strict";var zG=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};qO.exports=zG;qO.exports.default=zG});var GG=v((L7e,HG)=>{"use strict";var qG=He("path"),K_e=LG(),J_e=UG();function BG(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=K_e.sync(t.command,{path:r[J_e({env:r})],pathExt:e?qG.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=qG.resolve(i?t.options.cwd:"",s)),s}function Y_e(t){return BG(t)||BG(t,!0)}HG.exports=Y_e});var ZG=v((z7e,HO)=>{"use strict";var BO=/([()\][%!^"`<>&|;, *?])/g;function X_e(t){return t=t.replace(BO,"^$1"),t}function Q_e(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(BO,"^$1"),e&&(t=t.replace(BO,"^$1")),t}HO.exports.command=X_e;HO.exports.argument=Q_e});var WG=v((U7e,VG)=>{"use strict";VG.exports=/^#!(.*)/});var JG=v((q7e,KG)=>{"use strict";var ebe=WG();KG.exports=(t="")=>{let e=t.match(ebe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var XG=v((B7e,YG)=>{"use strict";var GO=He("fs"),tbe=JG();function rbe(t){let r=Buffer.alloc(150),n;try{n=GO.openSync(t,"r"),GO.readSync(n,r,0,150,0),GO.closeSync(n)}catch{}return tbe(r.toString())}YG.exports=rbe});var rZ=v((H7e,tZ)=>{"use strict";var nbe=He("path"),QG=GG(),eZ=ZG(),ibe=XG(),obe=process.platform==="win32",sbe=/\.(?:com|exe)$/i,abe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function cbe(t){t.file=QG(t);let e=t.file&&ibe(t.file);return e?(t.args.unshift(t.file),t.command=e,QG(t)):t.file}function lbe(t){if(!obe)return t;let e=cbe(t),r=!sbe.test(e);if(t.options.forceShell||r){let n=abe.test(e);t.command=nbe.normalize(t.command),t.command=eZ.command(t.command),t.args=t.args.map(o=>eZ.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 ube(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:lbe(n)}tZ.exports=ube});var oZ=v((G7e,iZ)=>{"use strict";var ZO=process.platform==="win32";function VO(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 dbe(t,e){if(!ZO)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=nZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function nZ(t,e){return ZO&&t===1&&!e.file?VO(e.original,"spawn"):null}function fbe(t,e){return ZO&&t===1&&!e.file?VO(e.original,"spawnSync"):null}iZ.exports={hookChildProcess:dbe,verifyENOENT:nZ,verifyENOENTSync:fbe,notFoundError:VO}});var cZ=v((Z7e,ul)=>{"use strict";var sZ=He("child_process"),WO=rZ(),KO=oZ();function aZ(t,e,r){let n=WO(t,e,r),i=sZ.spawn(n.command,n.args,n.options);return KO.hookChildProcess(i,n),i}function pbe(t,e,r){let n=WO(t,e,r),i=sZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||KO.verifyENOENTSync(i.status,n),i}ul.exports=aZ;ul.exports.spawn=aZ;ul.exports.sync=pbe;ul.exports._parse=WO;ul.exports._enoent=KO});function P_(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 lZ=y(()=>{});var uZ=y(()=>{});import{promisify as mbe}from"node:util";import{execFile as hbe,execFileSync as Y7e}from"node:child_process";import dZ from"node:path";import{fileURLToPath as gbe}from"node:url";function C_(t){return t instanceof URL?gbe(t):t}function fZ(t){return{*[Symbol.iterator](){let e=dZ.resolve(C_(t)),r;for(;r!==e;)yield e,r=e,e=dZ.resolve(e,"..")}}}var eQe,tQe,pZ=y(()=>{uZ();eQe=mbe(hbe);tQe=10*1024*1024});import D_ from"node:process";import va from"node:path";var ybe,_be,bbe,mZ,hZ=y(()=>{lZ();pZ();ybe=({cwd:t=D_.cwd(),path:e=D_.env[P_()],preferLocal:r=!0,execPath:n=D_.execPath,addExecPath:i=!0}={})=>{let o=va.resolve(C_(t)),s=[],a=e.split(va.delimiter);return r&&_be(s,a,o),i&&bbe(s,a,n,o),e===""||e===va.delimiter?`${s.join(va.delimiter)}${e}`:[...s,e].join(va.delimiter)},_be=(t,e,r)=>{for(let n of fZ(r)){let i=va.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},bbe=(t,e,r,n)=>{let i=va.resolve(n,C_(r),"..");e.includes(i)||t.push(i)},mZ=({env:t=D_.env,...e}={})=>{t={...t};let r=P_({env:t});return e.path=t[r],t[r]=ybe(e),t}});var gZ,Kn,yZ,_Z,bZ,N_,Tf,Of,Sa=y(()=>{gZ=(t,e,r)=>{let n=r?Of:Tf,i=t instanceof Kn?{}:{cause:t};return new n(e,i)},Kn=class extends Error{},yZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,bZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},_Z=t=>N_(t)&&bZ in t,bZ=Symbol("isExecaError"),N_=t=>Object.prototype.toString.call(t)==="[object Error]",Tf=class extends Error{};yZ(Tf,Tf.name);Of=class extends Error{};yZ(Of,Of.name)});var vZ,vbe,SZ,wZ,xZ=y(()=>{vZ=()=>{let t=wZ-SZ+1;return Array.from({length:t},vbe)},vbe=(t,e)=>({name:`SIGRT${e+1}`,number:SZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),SZ=34,wZ=64});var $Z,kZ=y(()=>{$Z=[{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 Sbe}from"node:os";var JO,wbe,EZ=y(()=>{kZ();xZ();JO=()=>{let t=vZ();return[...$Z,...t].map(wbe)},wbe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Sbe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as xbe}from"node:os";var $be,kbe,AZ,Ebe,Abe,Tbe,_Qe,TZ=y(()=>{EZ();$be=()=>{let t=JO();return Object.fromEntries(t.map(kbe))},kbe=({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}],AZ=$be(),Ebe=()=>{let t=JO(),e=65,r=Array.from({length:e},(n,i)=>Abe(i,t));return Object.assign({},...r)},Abe=(t,e)=>{let r=Tbe(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}}},Tbe=(t,e)=>{let r=e.find(({name:n})=>xbe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},_Qe=Ebe()});import{constants as Rf}from"node:os";var RZ,IZ,PZ,Obe,Rbe,OZ,Ibe,YO,Pbe,Cbe,j_,If=y(()=>{TZ();RZ=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return PZ(t,e)},IZ=t=>t===0?t:PZ(t,"`subprocess.kill()`'s argument"),PZ=(t,e)=>{if(Number.isInteger(t))return Obe(t,e);if(typeof t=="string")return Ibe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${YO()}`)},Obe=(t,e)=>{if(OZ.has(t))return OZ.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${YO()}`)},Rbe=()=>new Map(Object.entries(Rf.signals).reverse().map(([t,e])=>[e,t])),OZ=Rbe(),Ibe=(t,e)=>{if(t in Rf.signals)return t;throw t.toUpperCase()in Rf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${YO()}`)},YO=()=>`Available signal names: ${Pbe()}. -Available signal numbers: ${Cbe()}.`,Pbe=()=>Object.keys(Rf.signals).sort().map(t=>`'${t}'`).join(", "),Cbe=()=>[...new Set(Object.values(Rf.signals).sort((t,e)=>t-e))].join(", "),j_=t=>AZ[t].description});import{setTimeout as Dbe}from"node:timers/promises";var CZ,Nbe,DZ,jbe,Mbe,Fbe,XO,M_=y(()=>{Sa();If();CZ=t=>{if(t===!1)return t;if(t===!0)return Nbe;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},Nbe=1e3*5,DZ=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=jbe(s,a,r);Mbe(l,n);let u=t(c);return Fbe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},jbe=(t,e,r)=>{let[n=r,i]=N_(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&&!N_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:IZ(n),error:i}},Mbe=(t,e)=>{t!==void 0&&e.reject(t)},Fbe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&XO({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},XO=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Dbe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Lbe}from"node:events";var F_,QO=y(()=>{F_=async(t,e)=>{t.aborted||await Lbe(t,"abort",{signal:e})}});var NZ,jZ,zbe,eR=y(()=>{QO();NZ=({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)}`)},jZ=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[zbe(t,e,n,i)],zbe=async(t,e,r,{signal:n})=>{throw await F_(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var dl,Ube,tR,MZ,FZ,L_,LZ,zZ,UZ,qZ,BZ,HZ,qbe,Bbe,Hbe,Jn,Gbe,is,fl,pl=y(()=>{dl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Ube(t,e,r),tR(t,e,n)},Ube=(t,e,r)=>{if(!r)throw new Error(`${Jn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},tR=(t,e,r)=>{if(!r)throw new Error(`${Jn(t,e)} cannot be used: the ${is(e)} has already exited or disconnected.`)},MZ=t=>{throw new Error(`${Jn("getOneMessage",t)} could not complete: the ${is(t)} exited or disconnected.`)},FZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${is(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as N_e}from"node:util";var $i,j_e,M_e,F_e,A_,L_e,cl=y(()=>{x_();hG();yG();$i=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=j_e({type:t,result:i,verboseInfo:n}),s=M_e(e,o),a=gG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},j_e=({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}),M_e=(t,e)=>t.split(` +`).map(r=>F_e({...e,message:r})),F_e=t=>({verboseLine:mG(t),verboseObject:t}),A_=t=>{let e=typeof t=="string"?t:N_e(t);return Af(e).replaceAll(" "," ".repeat(L_e))},L_e=2});var _G,bG=y(()=>{ns();cl();_G=(t,e)=>{sl(e)&&$i({type:"command",verboseMessage:t,verboseInfo:e})}});var vG,z_e,U_e,q_e,SG=y(()=>{ns();vG=(t,e,r)=>{q_e(t);let n=z_e(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},z_e=t=>sl({verbose:t})?U_e++:void 0,U_e=0n,q_e=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(!w_.includes(e)&&!S_(e)){let r=w_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as wG}from"node:process";var T_,LO,O_=y(()=>{T_=()=>wG.bigint(),LO=t=>Number(wG.bigint()-t)/1e6});var R_,zO=y(()=>{bG();SG();O_();x_();fo();R_=(t,e,r)=>{let n=T_(),{command:i,escapedCommand:o}=tG(t,e),s=CO(r,"verbose"),a=vG(s,o,{...r});return _G(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var AG=v((D7e,EG)=>{EG.exports=kG;kG.sync=H_e;var xG=He("fs");function B_e(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{IG.exports=OG;OG.sync=G_e;var TG=He("fs");function OG(t,e,r){TG.stat(t,function(n,i){r(n,n?!1:RG(i,e))})}function G_e(t,e){return RG(TG.statSync(t),e)}function RG(t,e){return t.isFile()&&Z_e(t,e)}function Z_e(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 DG=v((M7e,CG)=>{var j7e=He("fs"),I_;process.platform==="win32"||global.TESTING_WINDOWS?I_=AG():I_=PG();CG.exports=UO;UO.sync=V_e;function UO(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){UO(t,e||{},function(o,s){o?i(o):n(s)})})}I_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function V_e(t,e){try{return I_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var UG=v((F7e,zG)=>{var ll=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",NG=He("path"),W_e=ll?";":":",jG=DG(),MG=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),FG=(t,e)=>{let r=e.colon||W_e,n=t.match(/\//)||ll&&t.match(/\\/)?[""]:[...ll?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=ll?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=ll?i.split(r):[""];return ll&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},LG=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=FG(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(MG(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=NG.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];jG(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)},K_e=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=FG(t,e),o=[];for(let s=0;s{"use strict";var qG=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};qO.exports=qG;qO.exports.default=qG});var VG=v((z7e,ZG)=>{"use strict";var HG=He("path"),J_e=UG(),Y_e=BG();function GG(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=J_e.sync(t.command,{path:r[Y_e({env:r})],pathExt:e?HG.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=HG.resolve(i?t.options.cwd:"",s)),s}function X_e(t){return GG(t)||GG(t,!0)}ZG.exports=X_e});var WG=v((U7e,HO)=>{"use strict";var BO=/([()\][%!^"`<>&|;, *?])/g;function Q_e(t){return t=t.replace(BO,"^$1"),t}function ebe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(BO,"^$1"),e&&(t=t.replace(BO,"^$1")),t}HO.exports.command=Q_e;HO.exports.argument=ebe});var JG=v((q7e,KG)=>{"use strict";KG.exports=/^#!(.*)/});var XG=v((B7e,YG)=>{"use strict";var tbe=JG();YG.exports=(t="")=>{let e=t.match(tbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var eZ=v((H7e,QG)=>{"use strict";var GO=He("fs"),rbe=XG();function nbe(t){let r=Buffer.alloc(150),n;try{n=GO.openSync(t,"r"),GO.readSync(n,r,0,150,0),GO.closeSync(n)}catch{}return rbe(r.toString())}QG.exports=nbe});var iZ=v((G7e,nZ)=>{"use strict";var ibe=He("path"),tZ=VG(),rZ=WG(),obe=eZ(),sbe=process.platform==="win32",abe=/\.(?:com|exe)$/i,cbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function lbe(t){t.file=tZ(t);let e=t.file&&obe(t.file);return e?(t.args.unshift(t.file),t.command=e,tZ(t)):t.file}function ube(t){if(!sbe)return t;let e=lbe(t),r=!abe.test(e);if(t.options.forceShell||r){let n=cbe.test(e);t.command=ibe.normalize(t.command),t.command=rZ.command(t.command),t.args=t.args.map(o=>rZ.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 dbe(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:ube(n)}nZ.exports=dbe});var aZ=v((Z7e,sZ)=>{"use strict";var ZO=process.platform==="win32";function VO(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 fbe(t,e){if(!ZO)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=oZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function oZ(t,e){return ZO&&t===1&&!e.file?VO(e.original,"spawn"):null}function pbe(t,e){return ZO&&t===1&&!e.file?VO(e.original,"spawnSync"):null}sZ.exports={hookChildProcess:fbe,verifyENOENT:oZ,verifyENOENTSync:pbe,notFoundError:VO}});var uZ=v((V7e,ul)=>{"use strict";var cZ=He("child_process"),WO=iZ(),KO=aZ();function lZ(t,e,r){let n=WO(t,e,r),i=cZ.spawn(n.command,n.args,n.options);return KO.hookChildProcess(i,n),i}function mbe(t,e,r){let n=WO(t,e,r),i=cZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||KO.verifyENOENTSync(i.status,n),i}ul.exports=lZ;ul.exports.spawn=lZ;ul.exports.sync=mbe;ul.exports._parse=WO;ul.exports._enoent=KO});function P_(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 dZ=y(()=>{});var fZ=y(()=>{});import{promisify as hbe}from"node:util";import{execFile as gbe,execFileSync as X7e}from"node:child_process";import pZ from"node:path";import{fileURLToPath as ybe}from"node:url";function C_(t){return t instanceof URL?ybe(t):t}function mZ(t){return{*[Symbol.iterator](){let e=pZ.resolve(C_(t)),r;for(;r!==e;)yield e,r=e,e=pZ.resolve(e,"..")}}}var tQe,rQe,hZ=y(()=>{fZ();tQe=hbe(gbe);rQe=10*1024*1024});import D_ from"node:process";import va from"node:path";var _be,bbe,vbe,gZ,yZ=y(()=>{dZ();hZ();_be=({cwd:t=D_.cwd(),path:e=D_.env[P_()],preferLocal:r=!0,execPath:n=D_.execPath,addExecPath:i=!0}={})=>{let o=va.resolve(C_(t)),s=[],a=e.split(va.delimiter);return r&&bbe(s,a,o),i&&vbe(s,a,n,o),e===""||e===va.delimiter?`${s.join(va.delimiter)}${e}`:[...s,e].join(va.delimiter)},bbe=(t,e,r)=>{for(let n of mZ(r)){let i=va.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},vbe=(t,e,r,n)=>{let i=va.resolve(n,C_(r),"..");e.includes(i)||t.push(i)},gZ=({env:t=D_.env,...e}={})=>{t={...t};let r=P_({env:t});return e.path=t[r],t[r]=_be(e),t}});var _Z,Wn,bZ,vZ,SZ,N_,Tf,Of,Sa=y(()=>{_Z=(t,e,r)=>{let n=r?Of:Tf,i=t instanceof Wn?{}:{cause:t};return new n(e,i)},Wn=class extends Error{},bZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,SZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},vZ=t=>N_(t)&&SZ in t,SZ=Symbol("isExecaError"),N_=t=>Object.prototype.toString.call(t)==="[object Error]",Tf=class extends Error{};bZ(Tf,Tf.name);Of=class extends Error{};bZ(Of,Of.name)});var wZ,Sbe,xZ,$Z,kZ=y(()=>{wZ=()=>{let t=$Z-xZ+1;return Array.from({length:t},Sbe)},Sbe=(t,e)=>({name:`SIGRT${e+1}`,number:xZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),xZ=34,$Z=64});var EZ,AZ=y(()=>{EZ=[{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 wbe}from"node:os";var JO,xbe,TZ=y(()=>{AZ();kZ();JO=()=>{let t=wZ();return[...EZ,...t].map(xbe)},xbe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=wbe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as $be}from"node:os";var kbe,Ebe,OZ,Abe,Tbe,Obe,bQe,RZ=y(()=>{TZ();kbe=()=>{let t=JO();return Object.fromEntries(t.map(Ebe))},Ebe=({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}],OZ=kbe(),Abe=()=>{let t=JO(),e=65,r=Array.from({length:e},(n,i)=>Tbe(i,t));return Object.assign({},...r)},Tbe=(t,e)=>{let r=Obe(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}}},Obe=(t,e)=>{let r=e.find(({name:n})=>$be.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},bQe=Abe()});import{constants as Rf}from"node:os";var PZ,CZ,DZ,Rbe,Ibe,IZ,Pbe,YO,Cbe,Dbe,j_,If=y(()=>{RZ();PZ=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return DZ(t,e)},CZ=t=>t===0?t:DZ(t,"`subprocess.kill()`'s argument"),DZ=(t,e)=>{if(Number.isInteger(t))return Rbe(t,e);if(typeof t=="string")return Pbe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${YO()}`)},Rbe=(t,e)=>{if(IZ.has(t))return IZ.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${YO()}`)},Ibe=()=>new Map(Object.entries(Rf.signals).reverse().map(([t,e])=>[e,t])),IZ=Ibe(),Pbe=(t,e)=>{if(t in Rf.signals)return t;throw t.toUpperCase()in Rf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${YO()}`)},YO=()=>`Available signal names: ${Cbe()}. +Available signal numbers: ${Dbe()}.`,Cbe=()=>Object.keys(Rf.signals).sort().map(t=>`'${t}'`).join(", "),Dbe=()=>[...new Set(Object.values(Rf.signals).sort((t,e)=>t-e))].join(", "),j_=t=>OZ[t].description});import{setTimeout as Nbe}from"node:timers/promises";var NZ,jbe,jZ,Mbe,Fbe,Lbe,XO,M_=y(()=>{Sa();If();NZ=t=>{if(t===!1)return t;if(t===!0)return jbe;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},jbe=1e3*5,jZ=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Mbe(s,a,r);Fbe(l,n);let u=t(c);return Lbe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Mbe=(t,e,r)=>{let[n=r,i]=N_(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&&!N_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:CZ(n),error:i}},Fbe=(t,e)=>{t!==void 0&&e.reject(t)},Lbe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&XO({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},XO=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Nbe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as zbe}from"node:events";var F_,QO=y(()=>{F_=async(t,e)=>{t.aborted||await zbe(t,"abort",{signal:e})}});var MZ,FZ,Ube,eR=y(()=>{QO();MZ=({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)}`)},FZ=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Ube(t,e,n,i)],Ube=async(t,e,r,{signal:n})=>{throw await F_(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var dl,qbe,tR,LZ,zZ,L_,UZ,qZ,BZ,HZ,GZ,ZZ,Bbe,Hbe,Gbe,Kn,Zbe,is,fl,pl=y(()=>{dl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{qbe(t,e,r),tR(t,e,n)},qbe=(t,e,r)=>{if(!r)throw new Error(`${Kn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},tR=(t,e,r)=>{if(!r)throw new Error(`${Kn(t,e)} cannot be used: the ${is(e)} has already exited or disconnected.`)},LZ=t=>{throw new Error(`${Kn("getOneMessage",t)} could not complete: the ${is(t)} exited or disconnected.`)},zZ=t=>{throw new Error(`${Kn("sendMessage",t)} failed: the ${is(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([ - ${Jn("getOneMessage",t)}, - ${Jn("sendMessage",t,"message, {strict: true}")}, -]);`)},L_=(t,e)=>new Error(`${Jn("sendMessage",e)} failed when sending an acknowledgment response to the ${is(e)}.`,{cause:t}),LZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${is(t)} is not listening to incoming messages.`)},zZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${is(t)} exited without listening to incoming messages.`)},UZ=()=>new Error(`\`cancelSignal\` aborted: the ${is(!0)} disconnected.`),qZ=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},BZ=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Jn(e,r)} cannot be used: the ${is(r)} is disconnecting.`,{cause:t})},HZ=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(qbe(t))throw new Error(`${Jn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},qbe=({code:t,message:e})=>Bbe.has(t)||Hbe.some(r=>e.includes(r)),Bbe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Hbe=["could not be cloned","circular structure","call stack size exceeded"],Jn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Gbe(e)}${t}(${r})`,Gbe=t=>t?"":"subprocess.",is=t=>t?"parent process":"subprocess",fl=t=>{t.connected&&t.disconnect()}});var Ei,ml=y(()=>{Ei=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var U_,hl,Ai,GZ,Zbe,Vbe,ZZ,Wbe,VZ,Pf,z_,os=y(()=>{po();U_=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ai.get(t),o=GZ(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(ZZ(o,e,n,!0));return s},hl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ai.get(t),o=GZ(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(ZZ(o,e,n,!1));return s},Ai=new WeakMap,GZ=(t,e,r)=>{let n=Zbe(e,r);return Vbe(n,e,r,t),n},Zbe=(t,e)=>{let r=DO(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(`"${Pf(e)}" must not be "${t}". + ${Kn("getOneMessage",t)}, + ${Kn("sendMessage",t,"message, {strict: true}")}, +]);`)},L_=(t,e)=>new Error(`${Kn("sendMessage",e)} failed when sending an acknowledgment response to the ${is(e)}.`,{cause:t}),UZ=t=>{throw new Error(`${Kn("sendMessage",t)} failed: the ${is(t)} is not listening to incoming messages.`)},qZ=t=>{throw new Error(`${Kn("sendMessage",t)} failed: the ${is(t)} exited without listening to incoming messages.`)},BZ=()=>new Error(`\`cancelSignal\` aborted: the ${is(!0)} disconnected.`),HZ=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},GZ=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Kn(e,r)} cannot be used: the ${is(r)} is disconnecting.`,{cause:t})},ZZ=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Bbe(t))throw new Error(`${Kn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Bbe=({code:t,message:e})=>Hbe.has(t)||Gbe.some(r=>e.includes(r)),Hbe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Gbe=["could not be cloned","circular structure","call stack size exceeded"],Kn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Zbe(e)}${t}(${r})`,Zbe=t=>t?"":"subprocess.",is=t=>t?"parent process":"subprocess",fl=t=>{t.connected&&t.disconnect()}});var ki,ml=y(()=>{ki=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var U_,hl,Ei,VZ,Vbe,Wbe,WZ,Kbe,KZ,Pf,z_,os=y(()=>{fo();U_=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ei.get(t),o=VZ(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(WZ(o,e,n,!0));return s},hl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ei.get(t),o=VZ(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(WZ(o,e,n,!1));return s},Ei=new WeakMap,VZ=(t,e,r)=>{let n=Vbe(e,r);return Wbe(n,e,r,t),n},Vbe=(t,e)=>{let r=DO(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(`"${Pf(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},Vbe=(t,e,r,n)=>{let i=n[VZ(t)];if(i===void 0)throw new TypeError(`"${Pf(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(`"${Pf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Pf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},ZZ=(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}=Wbe(t,r);return`The "${i}: ${z_(o)}" option is incompatible with using "${Pf(n)}: ${z_(e)}". -Please set this option with "pipe" instead.`},Wbe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=VZ(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]}},VZ=t=>t==="all"?1:t,Pf=t=>t?"to":"from",z_=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Kbe}from"node:events";var wa,q_=y(()=>{wa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Kbe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var B_,rR,H_,nR,WZ,KZ,Cf=y(()=>{B_=(t,e)=>{e&&rR(t)},rR=t=>{t.refCounted()},H_=(t,e)=>{e&&nR(t)},nR=t=>{t.unrefCounted()},WZ=(t,e)=>{e&&(nR(t),nR(t))},KZ=(t,e)=>{e&&(rR(t),rR(t))}});import{once as Jbe}from"node:events";import{scheduler as Ybe}from"node:timers/promises";var JZ,YZ,G_,XZ=y(()=>{V_();Cf();Z_();W_();JZ=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(e9(i)||r9(i))return;G_.has(t)||G_.set(t,[]);let o=G_.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await t9(t,n,i),await Ybe.yield();let s=await QZ({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},YZ=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{iR();let o=G_.get(t);for(;o?.length>0;)await Jbe(n,"message:done");t.removeListener("message",i),KZ(e,r),n.connected=!1,n.emit("disconnect")},G_=new WeakMap});import{EventEmitter as Xbe}from"node:events";var ss,K_,Qbe,J_,Df=y(()=>{XZ();Cf();ss=(t,e,r)=>{if(K_.has(t))return K_.get(t);let n=new Xbe;return n.connected=!0,K_.set(t,n),Qbe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},K_=new WeakMap,Qbe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=JZ.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",YZ.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),WZ(r,n)},J_=t=>{let e=K_.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as eve}from"node:events";var n9,tve,i9,QZ,e9,o9,Y_,rve,X_,s9,Z_=y(()=>{ml();q_();tb();pl();Df();V_();n9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ss(t,e,r),s=Q_(t,o);return{id:tve++,type:X_,message:n,hasListeners:s}},tve=0n,i9=(t,e)=>{if(!(e?.type!==X_||e.hasListeners))for(let{id:r}of t)r!==void 0&&Y_[r].resolve({isDeadlock:!0,hasListeners:!1})},QZ=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==X_||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:s9,message:Q_(e,i)};try{await eb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},e9=t=>{if(t?.type!==s9)return!1;let{id:e,message:r}=t;return Y_[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},o9=async(t,e,r)=>{if(t?.type!==X_)return;let n=Ei();Y_[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,rve(e,r,i)]);o&&FZ(r),s||LZ(r)}finally{i.abort(),delete Y_[t.id]}},Y_={},rve=async(t,e,{signal:r})=>{wa(t,1,r),await eve(t,"disconnect",{signal:r}),zZ(e)},X_="execa:ipc:request",s9="execa:ipc:response"});var a9,c9,t9,Nf,Q_,nve,V_=y(()=>{ml();po();os();Z_();a9=(t,e,r)=>{Nf.has(t)||Nf.set(t,new Set);let n=Nf.get(t),i=Ei(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},c9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},t9=async(t,e,r)=>{for(;!Q_(t,e)&&Nf.get(t)?.size>0;){let n=[...Nf.get(t)];i9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Nf=new WeakMap,Q_=(t,e)=>e.listenerCount("message")>nve(t),nve=t=>Ai.has(t)&&!fo(Ai.get(t).options.buffer,"ipc")?1:0});import{promisify as ive}from"node:util";var eb,ove,sR,sve,oR,tb=y(()=>{pl();V_();Z_();eb=({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}),ove({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},ove=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=n9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=a9(t,s,o);try{await sR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw fl(t),c}finally{c9(a)}},sR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=sve(t);try{await Promise.all([o9(n,t,r),o(n)])}catch(s){throw BZ({error:s,methodName:e,isSubprocess:r}),HZ({error:s,methodName:e,isSubprocess:r,message:i}),s}},sve=t=>{if(oR.has(t))return oR.get(t);let e=ive(t.send.bind(t));return oR.set(t,e),e},oR=new WeakMap});import{scheduler as ave}from"node:timers/promises";var u9,d9,cve,l9,r9,f9,iR,aR,W_=y(()=>{tb();Df();pl();u9=(t,e)=>{let r="cancelSignal";return tR(r,!1,t.connected),sR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:f9,message:e},message:e})},d9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await cve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),aR.signal),cve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!l9){if(l9=!0,!n){qZ();return}if(e===null){iR();return}ss(t,e,r),await ave.yield()}},l9=!1,r9=t=>t?.type!==f9?!1:(aR.abort(t.message),!0),f9="execa:ipc:cancel",iR=()=>{aR.abort(UZ())},aR=new AbortController});var p9,m9,lve,uve,cR=y(()=>{QO();W_();M_();p9=({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?[lve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],lve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await F_(e,i);let o=uve(e);throw await u9(t,o),XO({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},uve=({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 dve}from"node:timers/promises";var h9,g9,fve,lR=y(()=>{Sa();h9=({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})`)},g9=(t,e,r,n)=>e===0||e===void 0?[]:[fve(t,e,r,n)],fve=async(t,e,r,{signal:n})=>{throw await dve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Kn}});import{execPath as pve,execArgv as mve}from"node:process";import y9 from"node:path";var _9,b9,uR=y(()=>{ol();_9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},b9=(t,e,{node:r=!1,nodePath:n=pve,nodeOptions:i=mve.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=il(n,'The "nodePath" option'),l=y9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(y9.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 hve}from"node:v8";var v9,gve,yve,_ve,S9,dR=y(()=>{v9=({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`.");_ve[r](t)}},gve=t=>{try{hve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},yve=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},_ve={advanced:gve,json:yve},S9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var x9,bve,rn,fR,vve,w9,rb,xa=y(()=>{x9=({encoding:t})=>{if(fR.has(t))return;let e=vve(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${rb(t)}\`. +It is optional and defaults to "${i}".`)},Wbe=(t,e,r,n)=>{let i=n[KZ(t)];if(i===void 0)throw new TypeError(`"${Pf(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(`"${Pf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Pf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},WZ=(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}=Kbe(t,r);return`The "${i}: ${z_(o)}" option is incompatible with using "${Pf(n)}: ${z_(e)}". +Please set this option with "pipe" instead.`},Kbe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=KZ(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]}},KZ=t=>t==="all"?1:t,Pf=t=>t?"to":"from",z_=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Jbe}from"node:events";var wa,q_=y(()=>{wa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Jbe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var B_,rR,H_,nR,JZ,YZ,Cf=y(()=>{B_=(t,e)=>{e&&rR(t)},rR=t=>{t.refCounted()},H_=(t,e)=>{e&&nR(t)},nR=t=>{t.unrefCounted()},JZ=(t,e)=>{e&&(nR(t),nR(t))},YZ=(t,e)=>{e&&(rR(t),rR(t))}});import{once as Ybe}from"node:events";import{scheduler as Xbe}from"node:timers/promises";var XZ,QZ,G_,e9=y(()=>{V_();Cf();Z_();W_();XZ=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(r9(i)||i9(i))return;G_.has(t)||G_.set(t,[]);let o=G_.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await n9(t,n,i),await Xbe.yield();let s=await t9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},QZ=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{iR();let o=G_.get(t);for(;o?.length>0;)await Ybe(n,"message:done");t.removeListener("message",i),YZ(e,r),n.connected=!1,n.emit("disconnect")},G_=new WeakMap});import{EventEmitter as Qbe}from"node:events";var ss,K_,eve,J_,Df=y(()=>{e9();Cf();ss=(t,e,r)=>{if(K_.has(t))return K_.get(t);let n=new Qbe;return n.connected=!0,K_.set(t,n),eve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},K_=new WeakMap,eve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=XZ.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",QZ.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),JZ(r,n)},J_=t=>{let e=K_.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as tve}from"node:events";var o9,rve,s9,t9,r9,a9,Y_,nve,X_,c9,Z_=y(()=>{ml();q_();tb();pl();Df();V_();o9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ss(t,e,r),s=Q_(t,o);return{id:rve++,type:X_,message:n,hasListeners:s}},rve=0n,s9=(t,e)=>{if(!(e?.type!==X_||e.hasListeners))for(let{id:r}of t)r!==void 0&&Y_[r].resolve({isDeadlock:!0,hasListeners:!1})},t9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==X_||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:c9,message:Q_(e,i)};try{await eb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},r9=t=>{if(t?.type!==c9)return!1;let{id:e,message:r}=t;return Y_[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},a9=async(t,e,r)=>{if(t?.type!==X_)return;let n=ki();Y_[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,nve(e,r,i)]);o&&zZ(r),s||UZ(r)}finally{i.abort(),delete Y_[t.id]}},Y_={},nve=async(t,e,{signal:r})=>{wa(t,1,r),await tve(t,"disconnect",{signal:r}),qZ(e)},X_="execa:ipc:request",c9="execa:ipc:response"});var l9,u9,n9,Nf,Q_,ive,V_=y(()=>{ml();fo();os();Z_();l9=(t,e,r)=>{Nf.has(t)||Nf.set(t,new Set);let n=Nf.get(t),i=ki(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},u9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},n9=async(t,e,r)=>{for(;!Q_(t,e)&&Nf.get(t)?.size>0;){let n=[...Nf.get(t)];s9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Nf=new WeakMap,Q_=(t,e)=>e.listenerCount("message")>ive(t),ive=t=>Ei.has(t)&&!uo(Ei.get(t).options.buffer,"ipc")?1:0});import{promisify as ove}from"node:util";var eb,sve,sR,ave,oR,tb=y(()=>{pl();V_();Z_();eb=({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}),sve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},sve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=o9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=l9(t,s,o);try{await sR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw fl(t),c}finally{u9(a)}},sR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=ave(t);try{await Promise.all([a9(n,t,r),o(n)])}catch(s){throw GZ({error:s,methodName:e,isSubprocess:r}),ZZ({error:s,methodName:e,isSubprocess:r,message:i}),s}},ave=t=>{if(oR.has(t))return oR.get(t);let e=ove(t.send.bind(t));return oR.set(t,e),e},oR=new WeakMap});import{scheduler as cve}from"node:timers/promises";var f9,p9,lve,d9,i9,m9,iR,aR,W_=y(()=>{tb();Df();pl();f9=(t,e)=>{let r="cancelSignal";return tR(r,!1,t.connected),sR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:m9,message:e},message:e})},p9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await lve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),aR.signal),lve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!d9){if(d9=!0,!n){HZ();return}if(e===null){iR();return}ss(t,e,r),await cve.yield()}},d9=!1,i9=t=>t?.type!==m9?!1:(aR.abort(t.message),!0),m9="execa:ipc:cancel",iR=()=>{aR.abort(BZ())},aR=new AbortController});var h9,g9,uve,dve,cR=y(()=>{QO();W_();M_();h9=({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.")}},g9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[uve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],uve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await F_(e,i);let o=dve(e);throw await f9(t,o),XO({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},dve=({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 fve}from"node:timers/promises";var y9,_9,pve,lR=y(()=>{Sa();y9=({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})`)},_9=(t,e,r,n)=>e===0||e===void 0?[]:[pve(t,e,r,n)],pve=async(t,e,r,{signal:n})=>{throw await fve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Wn}});import{execPath as mve,execArgv as hve}from"node:process";import b9 from"node:path";var v9,S9,uR=y(()=>{ol();v9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},S9=(t,e,{node:r=!1,nodePath:n=mve,nodeOptions:i=hve.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=il(n,'The "nodePath" option'),l=b9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(b9.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 gve}from"node:v8";var w9,yve,_ve,bve,x9,dR=y(()=>{w9=({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`.");bve[r](t)}},yve=t=>{try{gve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},_ve=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},bve={advanced:yve,json:_ve},x9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var k9,vve,tn,fR,Sve,$9,rb,xa=y(()=>{k9=({encoding:t})=>{if(fR.has(t))return;let e=Sve(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${rb(t)}\`. Please rename it to ${rb(e)}.`);let r=[...fR].map(n=>rb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${rb(t)}\`. -Please rename it to one of: ${r}.`)},bve=new Set(["utf8","utf16le"]),rn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),fR=new Set([...bve,...rn]),vve=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in w9)return w9[e];if(fR.has(e))return e},w9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},rb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as Sve}from"node:fs";import wve from"node:path";import xve from"node:process";var $9,k9,E9,pR=y(()=>{ol();$9=(t=k9())=>{let e=il(t,'The "cwd" option');return wve.resolve(e)},k9=()=>{try{return xve.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},E9=(t,e)=>{if(e===k9())return t;let r;try{r=Sve(e)}catch(n){return`The "cwd" option is invalid: ${e}. +Please rename it to one of: ${r}.`)},vve=new Set(["utf8","utf16le"]),tn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),fR=new Set([...vve,...tn]),Sve=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in $9)return $9[e];if(fR.has(e))return e},$9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},rb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as wve}from"node:fs";import xve from"node:path";import $ve from"node:process";var E9,A9,T9,pR=y(()=>{ol();E9=(t=A9())=>{let e=il(t,'The "cwd" option');return xve.resolve(e)},A9=()=>{try{return $ve.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},T9=(t,e)=>{if(e===A9())return t;let r;try{r=wve(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 $ve from"node:path";import A9 from"node:process";var T9,nb,kve,Eve,mR=y(()=>{T9=Et(cZ(),1);hZ();M_();If();eR();cR();lR();uR();dR();xa();pR();ol();po();nb=(t,e,r)=>{r.cwd=$9(r.cwd);let[n,i,o]=b9(t,e,r),{command:s,args:a,options:c}=T9.default._parse(n,i,o),l=YH(c),u=kve(l);return h9(u),x9(u),v9(u),NZ(u),p9(u),u.shell=OO(u.shell),u.env=Eve(u),u.killSignal=RZ(u.killSignal),u.forceKillAfterDelay=CZ(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!rn.has(u.encoding)&&u.buffer[f]),A9.platform==="win32"&&$ve.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},kve=({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}),Eve=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...A9.env,...t}:t;return r||n?mZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var ib,hR=y(()=>{ib=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function gl(t){if(typeof t=="string")return Ave(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Tve(t)}var Ave,Tve,O9,Ove,R9,Rve,gR=y(()=>{Ave=t=>t.at(-1)===O9?t.slice(0,t.at(-2)===R9?-2:-1):t,Tve=t=>t.at(-1)===Ove?t.subarray(0,t.at(-2)===Rve?-2:-1):t,O9=` -`,Ove=O9.codePointAt(0),R9="\r",Rve=R9.codePointAt(0)});function Yn(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 yR(t,{checkOpen:e=!0}={}){return Yn(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 $a(t,{checkOpen:e=!0}={}){return Yn(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 _R(t,e){return yR(t,e)&&$a(t,e)}var ka=y(()=>{});function I9(){return this[vR].next()}function P9(t){return this[vR].return(t)}function SR({preventCancel:t=!1}={}){let e=this.getReader(),r=new bR(e,t),n=Object.create(Pve);return n[vR]=r,n}var Ive,bR,vR,Pve,C9=y(()=>{Ive=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),bR=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}}},vR=Symbol();Object.defineProperty(I9,"name",{value:"next"});Object.defineProperty(P9,"name",{value:"return"});Pve=Object.create(Ive,{next:{enumerable:!0,configurable:!0,writable:!0,value:I9},return:{enumerable:!0,configurable:!0,writable:!0,value:P9}})});var D9=y(()=>{});var N9=y(()=>{C9();D9()});var j9,Cve,Dve,Nve,jf,wR=y(()=>{ka();N9();j9=t=>{if($a(t,{checkOpen:!1})&&jf.on!==void 0)return Dve(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Cve.call(t)==="[object ReadableStream]")return SR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Cve}=Object.prototype,Dve=async function*(t){let e=new AbortController,r={};Nve(t,e,r);try{for await(let[n]of jf.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()}},Nve=async(t,e,r)=>{try{await jf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},jf={}});var yl,jve,L9,M9,Mve,F9,Ti,Mf=y(()=>{wR();yl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=j9(t),u=e();u.length=0;try{for await(let d of l){let f=Mve(d),p=r[f](d,u);L9({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return jve({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}},jve=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&L9({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},L9=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){M9(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&M9(c,e,i,o),new Ti},M9=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Mve=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=F9.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&F9.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:F9}=Object.prototype,Ti=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var mo,Ff,ob,sb,ab,cb=y(()=>{mo=t=>t,Ff=()=>{},ob=({contents:t})=>t,sb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},ab=t=>t.length});async function lb(t,e){return yl(t,Uve,e)}var Fve,Lve,zve,Uve,z9=y(()=>{Mf();cb();Fve=()=>({contents:[]}),Lve=()=>1,zve=(t,{contents:e})=>(e.push(t),e),Uve={init:Fve,convertChunk:{string:mo,buffer:mo,arrayBuffer:mo,dataView:mo,typedArray:mo,others:mo},getSize:Lve,truncateChunk:Ff,addChunk:zve,getFinalChunk:Ff,finalize:ob}});async function ub(t,e){return yl(t,Jve,e)}var qve,Bve,Hve,U9,q9,Gve,Zve,Vve,Wve,H9,B9,Kve,G9,Jve,Z9=y(()=>{Mf();cb();qve=()=>({contents:new ArrayBuffer(0)}),Bve=t=>Hve.encode(t),Hve=new TextEncoder,U9=t=>new Uint8Array(t),q9=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Gve=(t,e)=>t.slice(0,e),Zve=(t,{contents:e,length:r},n)=>{let i=G9()?Wve(e,n):Vve(e,n);return new Uint8Array(i).set(t,r),i},Vve=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(H9(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Wve=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:H9(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},H9=t=>B9**Math.ceil(Math.log(t)/Math.log(B9)),B9=2,Kve=({contents:t,length:e})=>G9()?t:t.slice(0,e),G9=()=>"resize"in ArrayBuffer.prototype,Jve={init:qve,convertChunk:{string:Bve,buffer:U9,arrayBuffer:U9,dataView:q9,typedArray:q9,others:sb},getSize:ab,truncateChunk:Gve,addChunk:Zve,getFinalChunk:Ff,finalize:Kve}});async function fb(t,e){return yl(t,tSe,e)}var Yve,db,Xve,Qve,eSe,tSe,V9=y(()=>{Mf();cb();Yve=()=>({contents:"",textDecoder:new TextDecoder}),db=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Xve=(t,{contents:e})=>e+t,Qve=(t,e)=>t.slice(0,e),eSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},tSe={init:Yve,convertChunk:{string:mo,buffer:db,arrayBuffer:db,dataView:db,typedArray:db,others:sb},getSize:ab,truncateChunk:Qve,addChunk:Xve,getFinalChunk:eSe,finalize:ob}});var W9=y(()=>{z9();Z9();V9();Mf()});import{on as rSe}from"node:events";import{finished as nSe}from"node:stream/promises";var pb=y(()=>{wR();W9();Object.assign(jf,{on:rSe,finished:nSe})});var K9,iSe,J9,Y9,oSe,X9,Q9,mb,Ea=y(()=>{pb();uo();po();K9=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ti))throw t;if(o==="all")return t;let s=iSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},iSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",J9=(t,e,r)=>{if(e.length!==r)return;let n=new Ti;throw n.maxBufferInfo={fdNumber:"ipc"},n},Y9=(t,e)=>{let{streamName:r,threshold:n,unit:i}=oSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},oSe=(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=fo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:v_(r),threshold:i,unit:n}},X9=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>mb(r)),Q9=(t,e,r)=>{if(!e)return t;let n=mb(r);return t.length>n?t.slice(0,n):t},mb=([,t])=>t});import{inspect as sSe}from"node:util";var tV,aSe,cSe,lSe,uSe,dSe,eV,rV=y(()=>{gR();tn();pR();x_();Ea();If();Sa();tV=({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=aSe({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=lSe(n,b),w=x===void 0?"":` -${x}`,O=`${S}: ${a}${w}`,A=e===void 0?[t[2],t[1]]:[e],E=[O,...A,...t.slice(3),r.map(C=>uSe(C)).join(` -`)].map(C=>Af(gl(dSe(C)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:O,message:E}},aSe=({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=cSe(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?`${Y9(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${j_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},cSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",lSe=(t,e)=>{if(t instanceof Kn)return;let r=_Z(t)?t.originalMessage:String(t?.message??t),n=Af(E9(r,e));return n===""?void 0:n},uSe=t=>typeof t=="string"?t:sSe(t),dSe=t=>Array.isArray(t)?t.map(e=>gl(eV(e))).filter(Boolean).join(` -`):eV(t),eV=t=>typeof t=="string"?t:Ft(t)?__(t):""});var hb,_l,Lf,fSe,nV,pSe,zf=y(()=>{If();O_();Sa();rV();hb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>nV({command:t,escapedCommand:e,cwd:o,durationMs:LO(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:[]}),_l=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Lf({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}),Lf=({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:O,signalDescription:A}=pSe(l,u),{originalMessage:E,shortMessage:C,message:k}=tV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,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:_}),q=gZ(t,k,x);return Object.assign(q,fSe({error:q,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:A,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:E,shortMessage:C})),q},fSe=({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})=>nV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:LO(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:[]}),nV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),pSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:j_(e);return{exitCode:r,signal:n,signalDescription:i}}});function mSe(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(iV(t*1e3)%1e3),nanoseconds:Math.trunc(iV(t*1e6)%1e3)}}function hSe(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 xR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return mSe(t);break}case"bigint":return hSe(t)}throw new TypeError("Expected a finite number or bigint")}var iV,oV=y(()=>{iV=t=>Number.isFinite(t)?t:0});function $R(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+_Se);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&gSe(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?" "+ySe(d,u):f;i.push(p)}},a=xR(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%bSe):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 gSe,ySe,_Se,bSe,sV=y(()=>{oV();gSe=t=>t===0||t===0n,ySe=(t,e)=>e===1||e===1n?t:`${t}s`,_Se=1e-7,bSe=24n*60n*60n*1000n});var aV,cV=y(()=>{cl();aV=(t,e)=>{t.failed&&ki({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var lV,vSe,uV=y(()=>{sV();ns();cl();cV();lV=(t,e)=>{sl(e)&&(aV(t,e),vSe(t,e))},vSe=(t,e)=>{let r=`(done in ${$R(t.durationMs)})`;ki({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var bl,gb=y(()=>{uV();bl=(t,e,{reject:r})=>{if(lV(t,e),t.failed&&r)throw t;return t}});var pV,SSe,wSe,mV,hV,dV,xSe,kR,fV,Aa,gV,$Se,yb,yV,kSe,ESe,ER,_V,ASe,bV,_b,TSe,AR,OSe,RSe,vV,kn,bb,TR,SV,wV,as,_r=y(()=>{ka();co();tn();pV=(t,e)=>Aa(t)?"asyncGenerator":gV(t)?"generator":yb(t)?"fileUrl":kSe(t)?"filePath":TSe(t)?"webStream":Yn(t,{checkOpen:!1})?"native":Ft(t)?"uint8Array":OSe(t)?"asyncIterable":RSe(t)?"iterable":AR(t)?mV({transform:t},e):$Se(t)?SSe(t,e):"native",SSe=(t,e)=>_R(t.transform,{checkOpen:!1})?wSe(t,e):AR(t.transform)?mV(t,e):xSe(t,e),wSe=(t,e)=>(hV(t,e,"Duplex stream"),"duplex"),mV=(t,e)=>(hV(t,e,"web TransformStream"),"webTransform"),hV=({final:t,binary:e,objectMode:r},n,i)=>{dV(t,`${n}.final`,i),dV(e,`${n}.binary`,i),kR(r,`${n}.objectMode`)},dV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},xSe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!fV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(_R(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(AR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!fV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return kR(r,`${i}.binary`),kR(n,`${i}.objectMode`),Aa(t)||Aa(e)?"asyncGenerator":"generator"},kR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},fV=t=>Aa(t)||gV(t),Aa=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",gV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",$Se=t=>At(t)&&(t.transform!==void 0||t.final!==void 0),yb=t=>Object.prototype.toString.call(t)==="[object URL]",yV=t=>yb(t)&&t.protocol!=="file:",kSe=t=>At(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>ESe.has(e))&&ER(t.file),ESe=new Set(["file","append"]),ER=t=>typeof t=="string",_V=(t,e)=>t==="native"&&typeof e=="string"&&!ASe.has(e),ASe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),bV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",_b=t=>Object.prototype.toString.call(t)==="[object WritableStream]",TSe=t=>bV(t)||_b(t),AR=t=>bV(t?.readable)&&_b(t?.writable),OSe=t=>vV(t)&&typeof t[Symbol.asyncIterator]=="function",RSe=t=>vV(t)&&typeof t[Symbol.iterator]=="function",vV=t=>typeof t=="object"&&t!==null,kn=new Set(["generator","asyncGenerator","duplex","webTransform"]),bb=new Set(["fileUrl","filePath","fileNumber"]),TR=new Set(["fileUrl","filePath"]),SV=new Set([...TR,"webStream","nodeStream"]),wV=new Set(["webTransform","duplex"]),as={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 OR,ISe,PSe,xV,RR=y(()=>{_r();OR=(t,e,r,n)=>n==="output"?ISe(t,e,r):PSe(t,e,r),ISe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},PSe=(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}},xV=(t,e)=>{let r=t.findLast(({type:n})=>kn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var $V,CSe,DSe,NSe,jSe,MSe,FSe,kV=y(()=>{co();xa();_r();RR();$V=(t,e,r,n)=>[...t.filter(({type:i})=>!kn.has(i)),...CSe(t,e,r,n)],CSe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>kn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=DSe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return FSe(o,r)},DSe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?NSe({stdioItem:t,optionName:i}):e==="webTransform"?jSe({stdioItem:t,index:r,newTransforms:n,direction:o}):MSe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),NSe=({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}}},jSe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=At(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=OR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},MSe=({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}=At(e)?e:{transform:e},d=c||rn.has(o),{writableObjectMode:f,readableObjectMode:p}=OR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},FSe=(t,e)=>e==="input"?t.reverse():t});import IR from"node:process";var EV,LSe,zSe,vl,PR,AV,USe,qSe,TV=y(()=>{ka();_r();EV=(t,e,r)=>{let n=t.map(i=>LSe(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)??qSe},LSe=({type:t,value:e},r)=>zSe[r]??AV[t](e),zSe=["input","output","output"],vl=()=>{},PR=()=>"input",AV={generator:vl,asyncGenerator:vl,fileUrl:vl,filePath:vl,iterable:PR,asyncIterable:PR,uint8Array:PR,webStream:t=>_b(t)?"output":"input",nodeStream(t){return $a(t,{checkOpen:!1})?yR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:vl,duplex:vl,native(t){let e=USe(t);if(e!==void 0)return e;if(Yn(t,{checkOpen:!1}))return AV.nodeStream(t)}},USe=t=>{if([0,IR.stdin].includes(t))return"input";if([1,2,IR.stdout,IR.stderr].includes(t))return"output"},qSe="output"});var OV,RV=y(()=>{OV=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var IV,BSe,HSe,PV,GSe,ZSe,CV=y(()=>{uo();RV();ns();IV=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=BSe(t,n).map((a,c)=>PV(a,c));return o?GSe(s,r,i):OV(s,e)},BSe=(t,e)=>{if(t===void 0)return $n.map(n=>e[n]);if(HSe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${$n.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,$n.length);return Array.from({length:r},(n,i)=>t[i])},HSe=t=>$n.some(e=>t[e]!==void 0),PV=(t,e)=>Array.isArray(t)?t.map(r=>PV(r,e)):t??(e>=$n.length?"ignore":"pipe"),GSe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!al(r,i)&&ZSe(n)?"ignore":n),ZSe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as VSe}from"node:fs";import WSe from"node:tty";var NV,KSe,JSe,YSe,XSe,DV,jV=y(()=>{ka();uo();tn();os();NV=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?KSe({stdioItem:t,fdNumber:n,direction:i}):XSe({stdioItem:t,fdNumber:n}),KSe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=JSe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(Yn(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},JSe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=YSe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(WSe.isatty(i))throw new TypeError(`The \`${e}: ${z_(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:lo(VSe(i)),optionName:e}}},YSe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=b_.indexOf(t);if(r!==-1)return r},XSe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:DV(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:DV(e,e,r),optionName:r}:Yn(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,DV=(t,e,r)=>{let n=b_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var MV,QSe,ewe,twe,rwe,FV=y(()=>{ka();tn();_r();MV=({input:t,inputFile:e},r)=>r===0?[...QSe(t),...twe(e)]:[],QSe=t=>t===void 0?[]:[{type:ewe(t),value:t,optionName:"input"}],ewe=t=>{if($a(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ft(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},twe=t=>t===void 0?[]:[{...rwe(t),optionName:"inputFile"}],rwe=t=>{if(yb(t))return{type:"fileUrl",value:t};if(ER(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var LV,zV,nwe,iwe,UV,owe,swe,qV,BV=y(()=>{_r();LV=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),zV=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=nwe(i,t);if(s.length!==0){if(o){iwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(SV.has(t))return UV({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});wV.has(t)&&swe({otherStdioItems:s,type:t,value:e,optionName:r})}},nwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),iwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{TR.has(e)&&UV({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},UV=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>owe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return qV(s,n,e),i==="output"?o[0].stream:void 0},owe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,swe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);qV(i,n,e)},qV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${as[r]} that is the same.`)}});var vb,awe,cwe,lwe,uwe,dwe,fwe,pwe,mwe,hwe,gwe,ywe,CR,_we,Sb=y(()=>{uo();kV();RR();_r();TV();CV();jV();FV();BV();vb=(t,e,r,n)=>{let o=IV(e,r,n).map((a,c)=>awe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=hwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>_we(a)),s},awe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=v_(e),{stdioItems:o,isStdioArray:s}=cwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=EV(o,e,i),c=o.map(d=>NV({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=$V(c,i,a,r),u=xV(l,a);return mwe(l,u),{direction:a,objectMode:u,stdioItems:l}},cwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>lwe(c,n)),...MV(r,e)],s=LV(o),a=s.length>1;return uwe(s,a,n),fwe(s),{stdioItems:s,isStdioArray:a}},lwe=(t,e)=>({type:pV(t,e),value:t,optionName:e}),uwe=(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(dwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},dwe=new Set(["ignore","ipc"]),fwe=t=>{for(let e of t)pwe(e)},pwe=({type:t,value:e,optionName:r})=>{if(yV(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(_V(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},mwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>bb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},hwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(gwe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw CR(i),o}},gwe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>ywe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},ywe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=zV({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},CR=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Wn(r)&&r.destroy()},_we=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 HV}from"node:fs";var ZV,Oi,bwe,VV,GV,vwe,WV=y(()=>{tn();Sb();_r();ZV=(t,e)=>vb(vwe,t,e,!0),Oi=({type:t,optionName:e})=>{VV(e,as[t])},bwe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&VV(t,`"${e}"`),{}),VV=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},GV={generator(){},asyncGenerator:Oi,webStream:Oi,nodeStream:Oi,webTransform:Oi,duplex:Oi,asyncIterable:Oi,native:bwe},vwe={input:{...GV,fileUrl:({value:t})=>({contents:[lo(HV(t))]}),filePath:({value:{file:t}})=>({contents:[lo(HV(t))]}),fileNumber:Oi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...GV,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Oi,string:Oi,uint8Array:Oi}}});var ho,DR,Uf=y(()=>{gR();ho=(t,{stripFinalNewline:e},r)=>DR(e,r)&&t!==void 0&&!Array.isArray(t)?gl(t):t,DR=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var wb,jR,KV,JV,Swe,wwe,xwe,YV,$we,NR,kwe,Ewe,Awe,xb=y(()=>{wb=(t,e,r,n)=>t||r?void 0:JV(e,n),jR=(t,e,r)=>r?t.flatMap(n=>KV(n,e)):KV(t,e),KV=(t,e)=>{let{transform:r,final:n}=JV(e,{});return[...r(t),...n()]},JV=(t,e)=>(e.previousChunks="",{transform:Swe.bind(void 0,e,t),final:xwe.bind(void 0,e)}),Swe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=NR(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=NR(n,r.slice(i+1))),t.previousChunks=n},wwe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),xwe=function*({previousChunks:t}){t.length>0&&(yield t)},YV=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:$we.bind(void 0,n)},$we=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?kwe:Awe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},NR=(t,e)=>`${t}${e}`,kwe={windowsNewline:`\r +${t}`}});import kve from"node:path";import O9 from"node:process";var R9,nb,Eve,Ave,mR=y(()=>{R9=Et(uZ(),1);yZ();M_();If();eR();cR();lR();uR();dR();xa();pR();ol();fo();nb=(t,e,r)=>{r.cwd=E9(r.cwd);let[n,i,o]=S9(t,e,r),{command:s,args:a,options:c}=R9.default._parse(n,i,o),l=QH(c),u=Eve(l);return y9(u),k9(u),w9(u),MZ(u),h9(u),u.shell=OO(u.shell),u.env=Ave(u),u.killSignal=PZ(u.killSignal),u.forceKillAfterDelay=NZ(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!tn.has(u.encoding)&&u.buffer[f]),O9.platform==="win32"&&kve.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},Eve=({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}),Ave=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...O9.env,...t}:t;return r||n?gZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var ib,hR=y(()=>{ib=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function gl(t){if(typeof t=="string")return Tve(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Ove(t)}var Tve,Ove,I9,Rve,P9,Ive,gR=y(()=>{Tve=t=>t.at(-1)===I9?t.slice(0,t.at(-2)===P9?-2:-1):t,Ove=t=>t.at(-1)===Rve?t.subarray(0,t.at(-2)===Ive?-2:-1):t,I9=` +`,Rve=I9.codePointAt(0),P9="\r",Ive=P9.codePointAt(0)});function Jn(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 yR(t,{checkOpen:e=!0}={}){return Jn(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 $a(t,{checkOpen:e=!0}={}){return Jn(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 _R(t,e){return yR(t,e)&&$a(t,e)}var ka=y(()=>{});function C9(){return this[vR].next()}function D9(t){return this[vR].return(t)}function SR({preventCancel:t=!1}={}){let e=this.getReader(),r=new bR(e,t),n=Object.create(Cve);return n[vR]=r,n}var Pve,bR,vR,Cve,N9=y(()=>{Pve=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),bR=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}}},vR=Symbol();Object.defineProperty(C9,"name",{value:"next"});Object.defineProperty(D9,"name",{value:"return"});Cve=Object.create(Pve,{next:{enumerable:!0,configurable:!0,writable:!0,value:C9},return:{enumerable:!0,configurable:!0,writable:!0,value:D9}})});var j9=y(()=>{});var M9=y(()=>{N9();j9()});var F9,Dve,Nve,jve,jf,wR=y(()=>{ka();M9();F9=t=>{if($a(t,{checkOpen:!1})&&jf.on!==void 0)return Nve(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Dve.call(t)==="[object ReadableStream]")return SR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Dve}=Object.prototype,Nve=async function*(t){let e=new AbortController,r={};jve(t,e,r);try{for await(let[n]of jf.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()}},jve=async(t,e,r)=>{try{await jf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},jf={}});var yl,Mve,U9,L9,Fve,z9,Ai,Mf=y(()=>{wR();yl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=F9(t),u=e();u.length=0;try{for await(let d of l){let f=Fve(d),p=r[f](d,u);U9({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Mve({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}},Mve=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&U9({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},U9=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){L9(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&L9(c,e,i,o),new Ai},L9=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Fve=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=z9.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&z9.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:z9}=Object.prototype,Ai=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var po,Ff,ob,sb,ab,cb=y(()=>{po=t=>t,Ff=()=>{},ob=({contents:t})=>t,sb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},ab=t=>t.length});async function lb(t,e){return yl(t,qve,e)}var Lve,zve,Uve,qve,q9=y(()=>{Mf();cb();Lve=()=>({contents:[]}),zve=()=>1,Uve=(t,{contents:e})=>(e.push(t),e),qve={init:Lve,convertChunk:{string:po,buffer:po,arrayBuffer:po,dataView:po,typedArray:po,others:po},getSize:zve,truncateChunk:Ff,addChunk:Uve,getFinalChunk:Ff,finalize:ob}});async function ub(t,e){return yl(t,Yve,e)}var Bve,Hve,Gve,B9,H9,Zve,Vve,Wve,Kve,Z9,G9,Jve,V9,Yve,W9=y(()=>{Mf();cb();Bve=()=>({contents:new ArrayBuffer(0)}),Hve=t=>Gve.encode(t),Gve=new TextEncoder,B9=t=>new Uint8Array(t),H9=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Zve=(t,e)=>t.slice(0,e),Vve=(t,{contents:e,length:r},n)=>{let i=V9()?Kve(e,n):Wve(e,n);return new Uint8Array(i).set(t,r),i},Wve=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(Z9(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Kve=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:Z9(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},Z9=t=>G9**Math.ceil(Math.log(t)/Math.log(G9)),G9=2,Jve=({contents:t,length:e})=>V9()?t:t.slice(0,e),V9=()=>"resize"in ArrayBuffer.prototype,Yve={init:Bve,convertChunk:{string:Hve,buffer:B9,arrayBuffer:B9,dataView:H9,typedArray:H9,others:sb},getSize:ab,truncateChunk:Zve,addChunk:Vve,getFinalChunk:Ff,finalize:Jve}});async function fb(t,e){return yl(t,rSe,e)}var Xve,db,Qve,eSe,tSe,rSe,K9=y(()=>{Mf();cb();Xve=()=>({contents:"",textDecoder:new TextDecoder}),db=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Qve=(t,{contents:e})=>e+t,eSe=(t,e)=>t.slice(0,e),tSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},rSe={init:Xve,convertChunk:{string:po,buffer:db,arrayBuffer:db,dataView:db,typedArray:db,others:sb},getSize:ab,truncateChunk:eSe,addChunk:Qve,getFinalChunk:tSe,finalize:ob}});var J9=y(()=>{q9();W9();K9();Mf()});import{on as nSe}from"node:events";import{finished as iSe}from"node:stream/promises";var pb=y(()=>{wR();J9();Object.assign(jf,{on:nSe,finished:iSe})});var Y9,oSe,X9,Q9,sSe,eV,tV,mb,Ea=y(()=>{pb();lo();fo();Y9=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ai))throw t;if(o==="all")return t;let s=oSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},oSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",X9=(t,e,r)=>{if(e.length!==r)return;let n=new Ai;throw n.maxBufferInfo={fdNumber:"ipc"},n},Q9=(t,e)=>{let{streamName:r,threshold:n,unit:i}=sSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},sSe=(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=uo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:v_(r),threshold:i,unit:n}},eV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>mb(r)),tV=(t,e,r)=>{if(!e)return t;let n=mb(r);return t.length>n?t.slice(0,n):t},mb=([,t])=>t});import{inspect as aSe}from"node:util";var nV,cSe,lSe,uSe,dSe,fSe,rV,iV=y(()=>{gR();en();pR();x_();Ea();If();Sa();nV=({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=cSe({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=uSe(n,b),w=x===void 0?"":` +${x}`,O=`${S}: ${a}${w}`,A=e===void 0?[t[2],t[1]]:[e],E=[O,...A,...t.slice(3),r.map(C=>dSe(C)).join(` +`)].map(C=>Af(gl(fSe(C)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:O,message:E}},cSe=({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=lSe(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?`${Q9(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${j_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},lSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",uSe=(t,e)=>{if(t instanceof Wn)return;let r=vZ(t)?t.originalMessage:String(t?.message??t),n=Af(T9(r,e));return n===""?void 0:n},dSe=t=>typeof t=="string"?t:aSe(t),fSe=t=>Array.isArray(t)?t.map(e=>gl(rV(e))).filter(Boolean).join(` +`):rV(t),rV=t=>typeof t=="string"?t:Ft(t)?__(t):""});var hb,_l,Lf,pSe,oV,mSe,zf=y(()=>{If();O_();Sa();iV();hb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>oV({command:t,escapedCommand:e,cwd:o,durationMs:LO(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:[]}),_l=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Lf({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}),Lf=({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:O,signalDescription:A}=mSe(l,u),{originalMessage:E,shortMessage:C,message:k}=nV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,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:_}),q=_Z(t,k,x);return Object.assign(q,pSe({error:q,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:A,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:E,shortMessage:C})),q},pSe=({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})=>oV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:LO(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:[]}),oV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),mSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:j_(e);return{exitCode:r,signal:n,signalDescription:i}}});function hSe(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(sV(t*1e3)%1e3),nanoseconds:Math.trunc(sV(t*1e6)%1e3)}}function gSe(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 xR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return hSe(t);break}case"bigint":return gSe(t)}throw new TypeError("Expected a finite number or bigint")}var sV,aV=y(()=>{sV=t=>Number.isFinite(t)?t:0});function $R(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+bSe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ySe(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?" "+_Se(d,u):f;i.push(p)}},a=xR(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%vSe):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 ySe,_Se,bSe,vSe,cV=y(()=>{aV();ySe=t=>t===0||t===0n,_Se=(t,e)=>e===1||e===1n?t:`${t}s`,bSe=1e-7,vSe=24n*60n*60n*1000n});var lV,uV=y(()=>{cl();lV=(t,e)=>{t.failed&&$i({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var dV,SSe,fV=y(()=>{cV();ns();cl();uV();dV=(t,e)=>{sl(e)&&(lV(t,e),SSe(t,e))},SSe=(t,e)=>{let r=`(done in ${$R(t.durationMs)})`;$i({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var bl,gb=y(()=>{fV();bl=(t,e,{reject:r})=>{if(dV(t,e),t.failed&&r)throw t;return t}});var hV,wSe,xSe,gV,yV,pV,$Se,kR,mV,Aa,_V,kSe,yb,bV,ESe,ASe,ER,vV,TSe,SV,_b,OSe,AR,RSe,ISe,wV,$n,bb,TR,xV,$V,as,_r=y(()=>{ka();ao();en();hV=(t,e)=>Aa(t)?"asyncGenerator":_V(t)?"generator":yb(t)?"fileUrl":ESe(t)?"filePath":OSe(t)?"webStream":Jn(t,{checkOpen:!1})?"native":Ft(t)?"uint8Array":RSe(t)?"asyncIterable":ISe(t)?"iterable":AR(t)?gV({transform:t},e):kSe(t)?wSe(t,e):"native",wSe=(t,e)=>_R(t.transform,{checkOpen:!1})?xSe(t,e):AR(t.transform)?gV(t,e):$Se(t,e),xSe=(t,e)=>(yV(t,e,"Duplex stream"),"duplex"),gV=(t,e)=>(yV(t,e,"web TransformStream"),"webTransform"),yV=({final:t,binary:e,objectMode:r},n,i)=>{pV(t,`${n}.final`,i),pV(e,`${n}.binary`,i),kR(r,`${n}.objectMode`)},pV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},$Se=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!mV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(_R(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(AR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!mV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return kR(r,`${i}.binary`),kR(n,`${i}.objectMode`),Aa(t)||Aa(e)?"asyncGenerator":"generator"},kR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},mV=t=>Aa(t)||_V(t),Aa=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",_V=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",kSe=t=>At(t)&&(t.transform!==void 0||t.final!==void 0),yb=t=>Object.prototype.toString.call(t)==="[object URL]",bV=t=>yb(t)&&t.protocol!=="file:",ESe=t=>At(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>ASe.has(e))&&ER(t.file),ASe=new Set(["file","append"]),ER=t=>typeof t=="string",vV=(t,e)=>t==="native"&&typeof e=="string"&&!TSe.has(e),TSe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),SV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",_b=t=>Object.prototype.toString.call(t)==="[object WritableStream]",OSe=t=>SV(t)||_b(t),AR=t=>SV(t?.readable)&&_b(t?.writable),RSe=t=>wV(t)&&typeof t[Symbol.asyncIterator]=="function",ISe=t=>wV(t)&&typeof t[Symbol.iterator]=="function",wV=t=>typeof t=="object"&&t!==null,$n=new Set(["generator","asyncGenerator","duplex","webTransform"]),bb=new Set(["fileUrl","filePath","fileNumber"]),TR=new Set(["fileUrl","filePath"]),xV=new Set([...TR,"webStream","nodeStream"]),$V=new Set(["webTransform","duplex"]),as={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 OR,PSe,CSe,kV,RR=y(()=>{_r();OR=(t,e,r,n)=>n==="output"?PSe(t,e,r):CSe(t,e,r),PSe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},CSe=(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}},kV=(t,e)=>{let r=t.findLast(({type:n})=>$n.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var EV,DSe,NSe,jSe,MSe,FSe,LSe,AV=y(()=>{ao();xa();_r();RR();EV=(t,e,r,n)=>[...t.filter(({type:i})=>!$n.has(i)),...DSe(t,e,r,n)],DSe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>$n.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=NSe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return LSe(o,r)},NSe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?jSe({stdioItem:t,optionName:i}):e==="webTransform"?MSe({stdioItem:t,index:r,newTransforms:n,direction:o}):FSe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),jSe=({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}}},MSe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=At(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=OR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},FSe=({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}=At(e)?e:{transform:e},d=c||tn.has(o),{writableObjectMode:f,readableObjectMode:p}=OR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},LSe=(t,e)=>e==="input"?t.reverse():t});import IR from"node:process";var TV,zSe,USe,vl,PR,OV,qSe,BSe,RV=y(()=>{ka();_r();TV=(t,e,r)=>{let n=t.map(i=>zSe(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)??BSe},zSe=({type:t,value:e},r)=>USe[r]??OV[t](e),USe=["input","output","output"],vl=()=>{},PR=()=>"input",OV={generator:vl,asyncGenerator:vl,fileUrl:vl,filePath:vl,iterable:PR,asyncIterable:PR,uint8Array:PR,webStream:t=>_b(t)?"output":"input",nodeStream(t){return $a(t,{checkOpen:!1})?yR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:vl,duplex:vl,native(t){let e=qSe(t);if(e!==void 0)return e;if(Jn(t,{checkOpen:!1}))return OV.nodeStream(t)}},qSe=t=>{if([0,IR.stdin].includes(t))return"input";if([1,2,IR.stdout,IR.stderr].includes(t))return"output"},BSe="output"});var IV,PV=y(()=>{IV=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var CV,HSe,GSe,DV,ZSe,VSe,NV=y(()=>{lo();PV();ns();CV=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=HSe(t,n).map((a,c)=>DV(a,c));return o?ZSe(s,r,i):IV(s,e)},HSe=(t,e)=>{if(t===void 0)return xn.map(n=>e[n]);if(GSe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${xn.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,xn.length);return Array.from({length:r},(n,i)=>t[i])},GSe=t=>xn.some(e=>t[e]!==void 0),DV=(t,e)=>Array.isArray(t)?t.map(r=>DV(r,e)):t??(e>=xn.length?"ignore":"pipe"),ZSe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!al(r,i)&&VSe(n)?"ignore":n),VSe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as WSe}from"node:fs";import KSe from"node:tty";var MV,JSe,YSe,XSe,QSe,jV,FV=y(()=>{ka();lo();en();os();MV=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?JSe({stdioItem:t,fdNumber:n,direction:i}):QSe({stdioItem:t,fdNumber:n}),JSe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=YSe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(Jn(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},YSe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=XSe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(KSe.isatty(i))throw new TypeError(`The \`${e}: ${z_(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:co(WSe(i)),optionName:e}}},XSe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=b_.indexOf(t);if(r!==-1)return r},QSe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:jV(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:jV(e,e,r),optionName:r}:Jn(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,jV=(t,e,r)=>{let n=b_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var LV,ewe,twe,rwe,nwe,zV=y(()=>{ka();en();_r();LV=({input:t,inputFile:e},r)=>r===0?[...ewe(t),...rwe(e)]:[],ewe=t=>t===void 0?[]:[{type:twe(t),value:t,optionName:"input"}],twe=t=>{if($a(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ft(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},rwe=t=>t===void 0?[]:[{...nwe(t),optionName:"inputFile"}],nwe=t=>{if(yb(t))return{type:"fileUrl",value:t};if(ER(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var UV,qV,iwe,owe,BV,swe,awe,HV,GV=y(()=>{_r();UV=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),qV=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=iwe(i,t);if(s.length!==0){if(o){owe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(xV.has(t))return BV({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});$V.has(t)&&awe({otherStdioItems:s,type:t,value:e,optionName:r})}},iwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),owe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{TR.has(e)&&BV({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},BV=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>swe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return HV(s,n,e),i==="output"?o[0].stream:void 0},swe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,awe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);HV(i,n,e)},HV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${as[r]} that is the same.`)}});var vb,cwe,lwe,uwe,dwe,fwe,pwe,mwe,hwe,gwe,ywe,_we,CR,bwe,Sb=y(()=>{lo();AV();RR();_r();RV();NV();FV();zV();GV();vb=(t,e,r,n)=>{let o=CV(e,r,n).map((a,c)=>cwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=gwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>bwe(a)),s},cwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=v_(e),{stdioItems:o,isStdioArray:s}=lwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=TV(o,e,i),c=o.map(d=>MV({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=EV(c,i,a,r),u=kV(l,a);return hwe(l,u),{direction:a,objectMode:u,stdioItems:l}},lwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>uwe(c,n)),...LV(r,e)],s=UV(o),a=s.length>1;return dwe(s,a,n),pwe(s),{stdioItems:s,isStdioArray:a}},uwe=(t,e)=>({type:hV(t,e),value:t,optionName:e}),dwe=(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(fwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},fwe=new Set(["ignore","ipc"]),pwe=t=>{for(let e of t)mwe(e)},mwe=({type:t,value:e,optionName:r})=>{if(bV(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(vV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},hwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>bb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},gwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(ywe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw CR(i),o}},ywe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>_we({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},_we=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=qV({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},CR=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Vn(r)&&r.destroy()},bwe=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 ZV}from"node:fs";var WV,Ti,vwe,KV,VV,Swe,JV=y(()=>{en();Sb();_r();WV=(t,e)=>vb(Swe,t,e,!0),Ti=({type:t,optionName:e})=>{KV(e,as[t])},vwe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&KV(t,`"${e}"`),{}),KV=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},VV={generator(){},asyncGenerator:Ti,webStream:Ti,nodeStream:Ti,webTransform:Ti,duplex:Ti,asyncIterable:Ti,native:vwe},Swe={input:{...VV,fileUrl:({value:t})=>({contents:[co(ZV(t))]}),filePath:({value:{file:t}})=>({contents:[co(ZV(t))]}),fileNumber:Ti,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...VV,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Ti,string:Ti,uint8Array:Ti}}});var mo,DR,Uf=y(()=>{gR();mo=(t,{stripFinalNewline:e},r)=>DR(e,r)&&t!==void 0&&!Array.isArray(t)?gl(t):t,DR=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var wb,jR,YV,XV,wwe,xwe,$we,QV,kwe,NR,Ewe,Awe,Twe,xb=y(()=>{wb=(t,e,r,n)=>t||r?void 0:XV(e,n),jR=(t,e,r)=>r?t.flatMap(n=>YV(n,e)):YV(t,e),YV=(t,e)=>{let{transform:r,final:n}=XV(e,{});return[...r(t),...n()]},XV=(t,e)=>(e.previousChunks="",{transform:wwe.bind(void 0,e,t),final:$we.bind(void 0,e)}),wwe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=NR(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=NR(n,r.slice(i+1))),t.previousChunks=n},xwe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),$we=function*({previousChunks:t}){t.length>0&&(yield t)},QV=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:kwe.bind(void 0,n)},kwe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Ewe:Twe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},NR=(t,e)=>`${t}${e}`,Ewe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:NR},Ewe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Awe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Ewe}});import{Buffer as Twe}from"node:buffer";var XV,Owe,QV,Rwe,Iwe,eW,tW=y(()=>{tn();XV=(t,e)=>t?void 0:Owe.bind(void 0,e),Owe=function*(t,e){if(typeof e!="string"&&!Ft(e)&&!Twe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},QV=(t,e)=>t?Rwe.bind(void 0,e):Iwe.bind(void 0,e),Rwe=function*(t,e){eW(t,e),yield e},Iwe=function*(t,e){if(eW(t,e),typeof e!="string"&&!Ft(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},eW=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:NR},Awe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Twe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Awe}});import{Buffer as Owe}from"node:buffer";var eW,Rwe,tW,Iwe,Pwe,rW,nW=y(()=>{en();eW=(t,e)=>t?void 0:Rwe.bind(void 0,e),Rwe=function*(t,e){if(typeof e!="string"&&!Ft(e)&&!Owe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},tW=(t,e)=>t?Iwe.bind(void 0,e):Pwe.bind(void 0,e),Iwe=function*(t,e){rW(t,e),yield e},Pwe=function*(t,e){if(rW(t,e),typeof e!="string"&&!Ft(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},rW=(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 Pwe}from"node:buffer";import{StringDecoder as Cwe}from"node:string_decoder";var $b,Dwe,Nwe,jwe,MR=y(()=>{tn();$b=(t,e,r)=>{if(r)return;if(t)return{transform:Dwe.bind(void 0,new TextEncoder)};let n=new Cwe(e);return{transform:Nwe.bind(void 0,n),final:jwe.bind(void 0,n)}},Dwe=function*(t,e){Pwe.isBuffer(e)?yield lo(e):typeof e=="string"?yield t.encode(e):yield e},Nwe=function*(t,e){yield Ft(e)?t.write(e):e},jwe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as rW}from"node:util";var FR,kb,nW,Mwe,iW,Fwe,oW=y(()=>{FR=rW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),kb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Fwe}=e[r];for await(let i of n(t))yield*kb(i,e,r+1)},nW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Mwe(r,Number(e),t)},Mwe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*kb(n,r,e+1)},iW=rW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Fwe=function*(t){yield t}});var LR,sW,Ta,qf,Lwe,zwe,zR=y(()=>{LR=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},sW=(t,e)=>[...e.flatMap(r=>[...Ta(r,t,0)]),...qf(t)],Ta=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=zwe}=e[r];for(let i of n(t))yield*Ta(i,e,r+1)},qf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Lwe(r,Number(e),t)},Lwe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ta(n,r,e+1)},zwe=function*(t){yield t}});import{Transform as Uwe,getDefaultHighWaterMark as aW}from"node:stream";var UR,Eb,cW,Ab=y(()=>{_r();xb();tW();MR();oW();zR();UR=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=cW(t,s,o),l=Aa(e),u=Aa(r),d=l?FR.bind(void 0,kb,a):LR.bind(void 0,Ta),f=l||u?FR.bind(void 0,nW,a):LR.bind(void 0,qf),p=l||u?iW.bind(void 0,a):void 0;return{stream:new Uwe({writableObjectMode:n,writableHighWaterMark:aW(n),readableObjectMode:i,readableHighWaterMark:aW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Eb=(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=cW(s,r,a);t=sW(c,t)}return t},cW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:XV(n,a)},$b(r,s,n),wb(r,o,n,c),{transform:t,final:e},{transform:QV(i,a)},YV({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var lW,qwe,Bwe,Hwe,Gwe,uW=y(()=>{Ab();tn();_r();lW=(t,e)=>{for(let r of qwe(t))Bwe(t,r,e)},qwe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Bwe=(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 ${as[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Hwe(a,n));r.input=Ef(s)},Hwe=(t,e)=>{let r=Eb(t,e,"utf8",!0);return Gwe(r),Ef(r)},Gwe=t=>{let e=t.find(r=>typeof r!="string"&&!Ft(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 Tb,Zwe,Vwe,dW,fW,Wwe,pW,qR=y(()=>{xa();_r();cl();ns();Tb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&al(r,n)&&!rn.has(e)&&Zwe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Vwe.has(o))||t.every(({type:i})=>kn.has(i))),Zwe=t=>t===1||t===2,Vwe=new Set(["pipe","overlapped"]),dW=async(t,e,r,n)=>{for await(let i of t)Wwe(e)||pW(i,r,n)},fW=(t,e,r)=>{for(let n of t)pW(n,e,r)},Wwe=t=>t._readableState.pipes.length>0,pW=(t,e,r)=>{let n=A_(t);ki({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Kwe,appendFileSync as Jwe}from"node:fs";var mW,Ywe,Xwe,Qwe,exe,txe,hW=y(()=>{qR();Ab();xb();tn();_r();Ea();mW=({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)=>Ywe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Ywe=({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=Q9(t,o,d),p=lo(f),{stdioItems:m,objectMode:h}=e[r],g=Xwe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Qwe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});exe({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&&txe(b,m,i),S}catch(x){return n.error=x,S}},Xwe=(t,e,r,n)=>{try{return Eb(t,e,r,!1)}catch(i){return n.error=i,t}},Qwe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Ef(t)};let s=BH(t,r);return n[o]?{serializedResult:s,finalResult:jR(s,!i[o],e)}:{serializedResult:s}},exe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Tb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=jR(t,!1,s);try{fW(a,e,n)}catch(c){r.error??=c}},txe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>bb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Jwe(n,t):(r.add(o),Kwe(n,t))}}});var gW,yW=y(()=>{tn();Uf();gW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ho(e,r,"all")]:Array.isArray(e)?[ho(t,r,"all"),...e]:Ft(t)&&Ft(e)?IO([t,e]):`${t}${e}`}});import{once as BR}from"node:events";var _W,rxe,bW,vW,nxe,HR,GR=y(()=>{Sa();_W=async(t,e)=>{let[r,n]=await rxe(t);return e.isForcefullyTerminated??=!1,[r,n]},rxe=async t=>{let[e,r]=await Promise.allSettled([BR(t,"spawn"),BR(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?bW(t):r.value},bW=async t=>{try{return await BR(t,"exit")}catch{return bW(t)}},vW=async t=>{let[e,r]=await t;if(!nxe(e,r)&&HR(e,r))throw new Kn;return[e,r]},nxe=(t,e)=>t===void 0&&e===void 0,HR=(t,e)=>t!==0||e!==null});var SW,ixe,wW=y(()=>{Sa();Ea();GR();SW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=ixe(t,e,r),s=o?.code==="ETIMEDOUT",a=X9(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},ixe=(t,e,r)=>t!==void 0?t:HR(e,r)?new Kn:void 0});import{spawnSync as oxe}from"node:child_process";var xW,sxe,axe,cxe,Ob,lxe,uxe,dxe,fxe,$W=y(()=>{zO();mR();hR();zf();gb();WV();Uf();uW();hW();Ea();yW();wW();xW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=sxe(t,e,r),d=lxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return bl(d,c,l)},sxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=R_(t,e,r),a=axe(r),{file:c,commandArguments:l,options:u}=nb(t,e,a);cxe(u);let d=ZV(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},axe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,cxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Ob("ipcInput"),t&&Ob("ipc: true"),r&&Ob("detached: true"),n&&Ob("cancelSignal")},Ob=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},lxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=uxe({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}=SW(c,r),{output:m,error:h=l}=mW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ho(_,r,S)),b=ho(gW(m,r),r,"all");return fxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},uxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{lW(o,r);let a=dxe(r);return oxe(...ib(t,e,a))}catch(a){return _l({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},dxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:mb(e)}),fxe=({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?hb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Lf({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 ZR,on as pxe}from"node:events";var kW,mxe,hxe,gxe,yxe,EW=y(()=>{pl();Df();Cf();kW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(dl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:J_(t)}),mxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),mxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{B_(e,i);let o=ss(t,e,r),s=new AbortController;try{return await Promise.race([hxe(o,n,s),gxe(o,r,s),yxe(o,r,s)])}catch(a){throw fl(t),a}finally{s.abort(),H_(e,i)}},hxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await ZR(t,"message",{signal:r});return n}for await(let[n]of pxe(t,"message",{signal:r}))if(e(n))return n},gxe=async(t,e,{signal:r})=>{await ZR(t,"disconnect",{signal:r}),MZ(e)},yxe=async(t,e,{signal:r})=>{let[n]=await ZR(t,"strict:error",{signal:r});throw L_(n,e)}});import{once as TW,on as _xe}from"node:events";var OW,VR,bxe,vxe,Sxe,AW,WR=y(()=>{pl();Df();Cf();OW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>VR({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),VR=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{dl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:J_(t)}),B_(e,o);let s=ss(t,e,r),a=new AbortController,c={};return bxe(t,s,a),vxe({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),Sxe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},bxe=async(t,e,r)=>{try{await TW(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},vxe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await TW(t,"strict:error",{signal:r.signal});n.error=L_(i,e),r.abort()}catch{}},Sxe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of _xe(r,"message",{signal:o.signal}))AW(s),yield c}catch{AW(s)}finally{o.abort(),H_(e,a),n||fl(t),i&&await t}},AW=({error:t})=>{if(t)throw t}});import RW from"node:process";var IW,PW,CW,KR=y(()=>{tb();EW();WR();W_();IW=(t,{ipc:e})=>{Object.assign(t,CW(t,!1,e))},PW=()=>{let t=RW,e=!0,r=RW.channel!==void 0;return{...CW(t,e,r),getCancelSignal:d9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},CW=(t,e,r)=>({sendMessage:eb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:kW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:OW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as wxe}from"node:child_process";import{PassThrough as xxe,Readable as $xe,Writable as kxe,Duplex as Exe}from"node:stream";var DW,Axe,Bf,Txe,Oxe,Rxe,Ixe,NW=y(()=>{Sb();zf();gb();DW=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{CR(n);let a=new wxe;Axe(a,n),Object.assign(a,{readable:Txe,writable:Oxe,duplex:Rxe});let c=_l({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=Ixe(c,s,i);return{subprocess:a,promise:l}},Axe=(t,e)=>{let r=Bf(),n=Bf(),i=Bf(),o=Array.from({length:e.length-3},Bf),s=Bf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Bf=()=>{let t=new xxe;return t.end(),t},Txe=()=>new $xe({read(){}}),Oxe=()=>new kxe({write(){}}),Rxe=()=>new Exe({read(){},write(){}}),Ixe=async(t,e,r)=>bl(t,e,r)});import{createReadStream as jW,createWriteStream as MW}from"node:fs";import{Buffer as Pxe}from"node:buffer";import{Readable as Hf,Writable as Cxe,Duplex as Dxe}from"node:stream";var LW,Gf,FW,Nxe,zW=y(()=>{Ab();Sb();_r();LW=(t,e)=>vb(Nxe,t,e,!1),Gf=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${as[t]}.`)},FW={fileNumber:Gf,generator:UR,asyncGenerator:UR,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Dxe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Nxe={input:{...FW,fileUrl:({value:t})=>({stream:jW(t)}),filePath:({value:{file:t}})=>({stream:jW(t)}),webStream:({value:t})=>({stream:Hf.fromWeb(t)}),iterable:({value:t})=>({stream:Hf.from(t)}),asyncIterable:({value:t})=>({stream:Hf.from(t)}),string:({value:t})=>({stream:Hf.from(t)}),uint8Array:({value:t})=>({stream:Hf.from(Pxe.from(t))})},output:{...FW,fileUrl:({value:t})=>({stream:MW(t)}),filePath:({value:{file:t,append:e}})=>({stream:MW(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Cxe.fromWeb(t)}),iterable:Gf,asyncIterable:Gf,string:Gf,uint8Array:Gf}}});import{on as jxe,once as UW}from"node:events";import{PassThrough as Mxe,getDefaultHighWaterMark as Fxe}from"node:stream";import{finished as HW}from"node:stream/promises";function Oa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)YR(i);let e=t.some(({readableObjectMode:i})=>i),r=Lxe(t,e),n=new JR({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Lxe,JR,zxe,Uxe,qxe,YR,Bxe,Hxe,Gxe,Zxe,Vxe,GW,ZW,XR,VW,Wxe,Rb,qW,BW,Ib=y(()=>{Lxe=(t,e)=>{if(t.length===0)return Fxe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},JR=class extends Mxe{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(YR(e),this.#t.has(e))return;this.#t.add(e),this.#n??=zxe(this,this.#t,this.#o);let r=Bxe({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(YR(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)}},zxe=async(t,e,r)=>{Rb(t,qW);let n=new AbortController;try{await Promise.race([Uxe(t,n),qxe(t,e,r,n)])}finally{n.abort(),Rb(t,-qW)}},Uxe=async(t,{signal:e})=>{try{await HW(t,{signal:e,cleanup:!0})}catch(r){throw GW(t,r),r}},qxe=async(t,e,r,{signal:n})=>{for await(let[i]of jxe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},YR=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Bxe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Rb(t,BW);let a=new AbortController;try{await Promise.race([Hxe(o,e,a),Gxe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Zxe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Rb(t,-BW)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?XR(t):Vxe(t))},Hxe=async(t,e,{signal:r})=>{try{await t,r.aborted||XR(e)}catch(n){r.aborted||GW(e,n)}},Gxe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await HW(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;ZW(s)?i.add(e):VW(t,s)}},Zxe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await UW(t,i,{signal:o}),!t.readable)return UW(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},Vxe=t=>{t.writable&&t.end()},GW=(t,e)=>{ZW(e)?XR(t):VW(t,e)},ZW=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",XR=t=>{(t.readable||t.writable)&&t.destroy()},VW=(t,e)=>{t.destroyed||(t.once("error",Wxe),t.destroy(e))},Wxe=()=>{},Rb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},qW=2,BW=1});import{finished as WW}from"node:stream/promises";var Sl,Kxe,QR,Jxe,eI,Pb=y(()=>{uo();Sl=(t,e)=>{t.pipe(e),Kxe(t,e),Jxe(t,e)},Kxe=async(t,e)=>{if(!(Wn(t)||Wn(e))){try{await WW(t,{cleanup:!0,readable:!0,writable:!1})}catch{}QR(e)}},QR=t=>{t.writable&&t.end()},Jxe=async(t,e)=>{if(!(Wn(t)||Wn(e))){try{await WW(e,{cleanup:!0,readable:!1,writable:!0})}catch{}eI(t)}},eI=t=>{t.readable&&t.destroy()}});var KW,Yxe,Xxe,Qxe,e0e,t0e,JW=y(()=>{Ib();uo();q_();_r();Pb();KW=(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})=>kn.has(c)))Yxe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!kn.has(c)))Qxe({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]:Oa(o);Sl(s,i)}},Yxe=(t,e,r,n)=>{r==="output"?Sl(t.stdio[n],e):Sl(e,t.stdio[n]);let i=Xxe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Xxe=["stdin","stdout","stderr"],Qxe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;e0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},e0e=(t,{signal:e})=>{Wn(t)&&wa(t,t0e,e)},t0e=2});var Ra,YW=y(()=>{Ra=[];Ra.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ra.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ra.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Cb,tI,rI,r0e,nI,Db,n0e,iI,oI,sI,XW,not,iot,QW=y(()=>{YW();Cb=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",tI=Symbol.for("signal-exit emitter"),rI=globalThis,r0e=Object.defineProperty.bind(Object),nI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(rI[tI])return rI[tI];r0e(rI,tI,{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}},Db=class{},n0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),iI=class extends Db{onExit(){return()=>{}}load(){}unload(){}},oI=class extends Db{#t=sI.platform==="win32"?"SIGINT":"SIGHUP";#r=new nI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ra)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(!Cb(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 Ra)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,Ra.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 Cb(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"&&Cb(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)}},sI=globalThis.process,{onExit:XW,load:not,unload:iot}=n0e(Cb(sI)?new oI(sI):new iI)});import{addAbortListener as i0e}from"node:events";var eK,tK=y(()=>{QW();eK=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=XW(()=>{t.kill()});i0e(n,()=>{i()})}});var nK,o0e,s0e,rK,a0e,iK=y(()=>{RO();O_();os();ol();nK=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=T_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=o0e(r,n,i),{sourceStream:d,sourceError:f}=a0e(t,l),{options:p,fileDescriptors:m}=Ai.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},o0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=s0e(t,e,...r),a=U_(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},s0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(rK,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||TO(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]=y_(r,...n);return{destination:e(rK)(i,o,s),pipeOptions:s}}if(Ai.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}`)},rK=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),a0e=(t,e)=>{try{return{sourceStream:hl(t,e)}}catch(r){return{sourceError:r}}}});var sK,c0e,aI,oK,cI=y(()=>{zf();Pb();sK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=c0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw aI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},c0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return eI(t),n;if(e!==void 0)return QR(r),e},aI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>_l({error:t,command:oK,escapedCommand:oK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),oK="source.pipe(destination)"});var aK,cK=y(()=>{aK=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 l0e}from"node:stream/promises";var lK,u0e,d0e,f0e,Nb,p0e,m0e,uK=y(()=>{Ib();q_();Pb();lK=(t,e,r)=>{let n=Nb.has(e)?d0e(t,e):u0e(t,e);return wa(t,p0e,r.signal),wa(e,m0e,r.signal),f0e(e),n},u0e=(t,e)=>{let r=Oa([t]);return Sl(r,e),Nb.set(e,r),r},d0e=(t,e)=>{let r=Nb.get(e);return r.add(t),r},f0e=async t=>{try{await l0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Nb.delete(t)},Nb=new WeakMap,p0e=2,m0e=1});import{aborted as h0e}from"node:util";var dK,g0e,fK=y(()=>{cI();dK=(t,e)=>t===void 0?[]:[g0e(t,e)],g0e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await h0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw aI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var jb,y0e,_0e,pK=y(()=>{co();iK();cI();cK();uK();fK();jb=(t,...e)=>{if(At(e[0]))return jb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=nK(t,...e),i=y0e({...n,destination:r});return i.pipe=jb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},y0e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=_0e(t,i);sK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=lK(e,o,d);return await Promise.race([aK(u),...dK(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},_0e=(t,e)=>Promise.allSettled([t,e])});import{on as b0e}from"node:events";import{getDefaultHighWaterMark as v0e}from"node:stream";var Mb,S0e,lI,w0e,hK,uI,mK,x0e,$0e,Fb=y(()=>{MR();xb();zR();Mb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return S0e(e,s),hK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},S0e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},lI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;w0e(e,s,t);let a=t.readableObjectMode&&!o;return hK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},w0e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},hK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=b0e(t,"data",{signal:e.signal,highWaterMark:mK,highWatermark:mK});return x0e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},uI=v0e(!0),mK=uI,x0e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=$0e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ta(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*qf(a)}},$0e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[$b(t,r,!e),wb(t,i,!n,{})].filter(Boolean)});import{setImmediate as k0e}from"node:timers/promises";var gK,E0e,A0e,T0e,dI,yK,fI=y(()=>{pb();tn();qR();Fb();Ea();Uf();gK=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=E0e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([A0e(t),d]);return}let f=DR(c,r),p=lI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([T0e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},E0e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Tb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=lI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await dW(a,t,r,o)},A0e=async t=>{await k0e(),t.readableFlowing===null&&t.resume()},T0e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await lb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await ub(r,{maxBuffer:o})):await fb(r,{maxBuffer:o})}catch(a){return yK(K9({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},dI=async t=>{try{return await t}catch(e){return yK(e)}},yK=({bufferedData:t})=>UH(t)?new Uint8Array(t):t});import{finished as O0e}from"node:stream/promises";var Zf,R0e,I0e,P0e,C0e,D0e,pI,Lb,_K,zb=y(()=>{Zf=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=R0e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],O0e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||C0e(a,e,r,n)}finally{s.abort()}},R0e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&I0e(t,r,n),n},I0e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{P0e(e,r),n.call(t,...i)}},P0e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},C0e=(t,e,r,n)=>{if(!D0e(t,e,r,n))throw t},D0e=(t,e,r,n=!0)=>r.propagating?_K(t)||Lb(t):(r.propagating=!0,pI(r,e)===n?_K(t):Lb(t)),pI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Lb=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",_K=t=>t?.code==="EPIPE"});var bK,mI,hI=y(()=>{fI();zb();bK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>mI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),mI=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=Zf(t,e,l);if(pI(l,e)){await u;return}let[d]=await Promise.all([gK({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 vK,SK,N0e,j0e,gI=y(()=>{Ib();hI();vK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Oa([t,e].filter(Boolean)):void 0,SK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>mI({...N0e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:j0e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),N0e=({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}},j0e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var wK,xK,$K=y(()=>{cl();ns();wK=t=>al(t,"ipc"),xK=(t,e)=>{let r=A_(t);ki({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var kK,EK,AK=y(()=>{Ea();$K();po();WR();kK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=wK(o),a=fo(e,"ipc"),c=fo(r,"ipc");for await(let l of VR({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(J9(t,i,c),i.push(l)),s&&xK(l,o);return i},EK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as M0e}from"node:events";var TK,F0e,L0e,z0e,OK=y(()=>{ka();lR();eR();cR();uo();_r();fI();AK();dR();gI();hI();GR();zb();TK=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 _=_W(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=bK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=SK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],A=kK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),E=F0e(h,t,S),C=L0e(m,S);try{return await Promise.race([Promise.all([{},vW(_),Promise.all(x),w,A,S9(t,d),...E,...C]),g,z0e(t,b),...g9(t,o,f,b),...jZ({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...m9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all(x.map(q=>dI(q))),dI(w),EK(A,O),Promise.allSettled(E),Promise.allSettled(C)])}},F0e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Zf(n,i,r)),L0e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Yn(o,{checkOpen:!1})&&!Wn(o)).map(({type:i,value:o,stream:s=o})=>Zf(s,n,e,{isSameDirection:kn.has(i),stopOnExit:i==="native"}))),z0e=async(t,{signal:e})=>{let[r]=await M0e(t,"error",{signal:e});throw r}});var RK,Vf,wl,Ub=y(()=>{ml();RK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Vf=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ei();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},wl=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 IK}from"node:stream/promises";var yI,PK,_I,bI,qb,Bb,vI=y(()=>{zb();yI=async t=>{if(t!==void 0)try{await _I(t)}catch{}},PK=async t=>{if(t!==void 0)try{await bI(t)}catch{}},_I=async t=>{await IK(t,{cleanup:!0,readable:!1,writable:!0})},bI=async t=>{await IK(t,{cleanup:!0,readable:!0,writable:!1})},qb=async(t,e)=>{if(await t,e)throw e},Bb=(t,e,r)=>{r&&!Lb(r)?t.destroy(r):e&&t.destroy()}});import{Readable as U0e}from"node:stream";import{callbackify as q0e}from"node:util";var CK,SI,wI,xI,B0e,$I,kI,DK,EI=y(()=>{xa();os();Fb();ml();Ub();vI();CK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||rn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=SI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=wI(a,s),{read:f,onStdoutDataDone:p}=xI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new U0e({read:f,destroy:q0e(kI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return $I({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},SI=(t,e,r)=>{let n=hl(t,e),i=Vf(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},wI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:uI},xI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ei(),s=Mb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){B0e(this,s,o)},onStdoutDataDone:o}},B0e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},$I=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await bI(t),await n,await yI(i),await e,r.readable&&r.push(null)}catch(o){await yI(i),DK(r,o)}},kI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await wl(r,e)&&(DK(t,n),await qb(e,n))},DK=(t,e)=>{Bb(t,t.readable,e)}});import{Writable as H0e}from"node:stream";import{callbackify as NK}from"node:util";var jK,AI,TI,G0e,Z0e,OI,RI,MK,II=y(()=>{os();Ub();vI();jK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=AI(t,r,e),s=new H0e({...TI(n,t,i),destroy:NK(RI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return OI(n,s),s},AI=(t,e,r)=>{let n=U_(t,e),i=Vf(r,n,"writableFinal"),o=Vf(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},TI=(t,e,r)=>({write:G0e.bind(void 0,t),final:NK(Z0e.bind(void 0,t,e,r))}),G0e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Z0e=async(t,e,r)=>{await wl(r,e)&&(t.writable&&t.end(),await e)},OI=async(t,e,r)=>{try{await _I(t),e.writable&&e.end()}catch(n){await PK(r),MK(e,n)}},RI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await wl(r,e),await wl(n,e)&&(MK(t,i),await qb(e,i))},MK=(t,e)=>{Bb(t,t.writable,e)}});import{Duplex as V0e}from"node:stream";import{callbackify as W0e}from"node:util";var FK,K0e,LK=y(()=>{xa();EI();II();FK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||rn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=SI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=AI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=wI(c,a),{read:g,onStdoutDataDone:b}=xI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new V0e({read:g,...TI(u,t,d),destroy:W0e(K0e.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 $I({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),OI(u,_,c),_},K0e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([kI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),RI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var PI,J0e,zK=y(()=>{xa();os();Fb();PI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||rn.has(e),s=hl(t,r),a=Mb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return J0e(a,s,t)},J0e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var UK,qK=y(()=>{Ub();EI();II();LK();zK();UK=(t,{encoding:e})=>{let r=RK();t.readable=CK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=jK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=FK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=PI.bind(void 0,t,e),t[Symbol.asyncIterator]=PI.bind(void 0,t,e,{})}});var BK,Y0e,X0e,HK=y(()=>{BK=(t,e)=>{for(let[r,n]of X0e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Y0e=(async()=>{})().constructor.prototype,X0e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Y0e,t)])});import{setMaxListeners as Q0e}from"node:events";import{spawn as e$e}from"node:child_process";var GK,t$e,r$e,n$e,i$e,o$e,ZK=y(()=>{pb();zO();mR();os();hR();KR();zf();gb();NW();zW();Uf();JW();M_();tK();pK();gI();OK();qK();ml();HK();GK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=t$e(t,e,r),{subprocess:f,promise:p}=n$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=jb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),BK(f,p),Ai.set(f,{options:u,fileDescriptors:d}),f},t$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=R_(t,e,r),{file:a,commandArguments:c,options:l}=nb(t,e,r),u=r$e(l),d=LW(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},r$e=({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}},n$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=e$e(...ib(t,e,r))}catch(m){return DW({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Q0e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];KW(c,a,l),eK(c,r,l);let d={},f=Ei();c.kill=DZ.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=vK(c,r),UK(c,r),IW(c,r);let p=i$e({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}},i$e=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 TK({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)=>ho(x,e,w)),_=ho(h,e,"all"),S=o$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return bl(S,n,e)},o$e=({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?Lf({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 Ti,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):hb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Hb,s$e,a$e,VK=y(()=>{co();po();Hb=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,s$e(n,t[n],i)]));return{...t,...r}},s$e=(t,e,r)=>a$e.has(t)&&At(e)&&At(r)?{...e,...r}:r,a$e=new Set(["env",...NO])});var cs,c$e,l$e,WK=y(()=>{co();RO();KH();$W();ZK();VK();cs=(t,e,r,n)=>{let i=(s,a,c)=>cs(s,a,r,c),o=(...s)=>c$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},c$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(At(o))return i(t,Hb(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=l$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?xW(a,c,l):GK(a,c,l,i)},l$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=VH(e)?WH(e,r):[e,...r],[s,a,c]=y_(...o),l=Hb(Hb(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 KK,JK,YK,u$e,d$e,XK=y(()=>{KK=({file:t,commandArguments:e})=>YK(t,e),JK=({file:t,commandArguments:e})=>({...YK(t,e),isSync:!0}),YK=(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]=u$e(t);return{file:r,commandArguments:n}},u$e=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(d$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},d$e=/ +/g});var QK,e3,f$e,t3,p$e,r3,n3=y(()=>{QK=(t,e,r)=>{t.sync=e(f$e,r),t.s=t.sync},e3=({options:t})=>t3(t),f$e=({options:t})=>({...t3(t),isSync:!0}),t3=t=>({options:{...p$e(t),...t}}),p$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},r3={preferLocal:!0}});var Vat,Je,Wat,Kat,Jat,Yat,Xat,Qat,ect,tct,jr=y(()=>{WK();XK();uR();n3();KR();Vat=cs(()=>({})),Je=cs(()=>({isSync:!0})),Wat=cs(KK),Kat=cs(JK),Jat=cs(_9),Yat=cs(e3,{},r3,QK),{sendMessage:Xat,getOneMessage:Qat,getEachMessage:ect,getCancelSignal:tct}=PW()});import{existsSync as Gb,statSync as m$e}from"node:fs";import{dirname as CI,extname as h$e,isAbsolute as i3,join as DI,relative as NI,resolve as Zb,sep as g$e}from"node:path";function Vb(t){return t==="./gradlew"||t==="gradle"}function y$e(t){return(Gb(DI(t,"build.gradle.kts"))||Gb(DI(t,"build.gradle")))&&Gb(DI(t,"gradle.properties"))}function _$e(t,e){let n=NI(t,e).split(g$e).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ls(t,e){return t===":"?`:${e}`:`${t}:${e}`}function b$e(t,e){let r=Zb(t,e),n=r;Gb(r)?m$e(r).isFile()&&(n=CI(r)):h$e(r)!==""&&(n=CI(r));let i=NI(t,n);if(i.startsWith("..")||i3(i))return null;let o=n;for(;;){if(y$e(o))return o;if(Zb(o)===Zb(t))return null;let s=CI(o);if(s===o)return null;let a=NI(t,s);if(a.startsWith("..")||i3(a))return null;o=s}}function Wb(t,e){let r=Zb(t),n=new Map,i=[];for(let o of e){let s=b$e(r,o);if(!s){i.push(o);continue}let a=_$e(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 Kb=y(()=>{"use strict"});import{existsSync as v$e,readFileSync as S$e}from"node:fs";import{join as w$e}from"node:path";function xl(t="."){let e=w$e(t,".cladding","config.yaml");if(!v$e(e))return jI;try{let n=(0,o3.parse)(S$e(e,"utf8"))?.gate;if(!n)return jI;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 x$e){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 jI}}function s3(t,e){let r=[],n=!1;for(let i of t){let o=$$e.exec(i);if(o){n=!0;for(let s of e)r.push(ls(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 o3,x$e,jI,$$e,Jb=y(()=>{"use strict";o3=Et(cr(),1);Kb();x$e=["type","lint","test","coverage"],jI={scope:"feature"};$$e=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as FI,readFileSync as a3,readdirSync as k$e,statSync as E$e}from"node:fs";import{join as Yb}from"node:path";function UI(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Yb(t,e);if(FI(r))try{if(c3.test(a3(r,"utf8")))return!0}catch{}}return!1}function l3(t){try{return FI(t)&&c3.test(a3(t,"utf8"))}catch{return!1}}function u3(t,e=0){if(e>4||!FI(t))return!1;let r;try{r=k$e(t)}catch{return!1}for(let n of r){let i=Yb(t,n),o=!1;try{o=E$e(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(u3(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&l3(i))return!0}return!1}function O$e(t){if(UI(t))return!0;for(let e of A$e)if(l3(Yb(t,e)))return!0;for(let e of T$e)if(u3(Yb(t,e)))return!0;return!1}function d3(t="."){let e=xl(t).coverage;return e||(O$e(t)?"kover":"jacoco")}function f3(t="."){return LI[d3(t)]}function p3(t="."){return MI[d3(t)]}var LI,MI,zI,c3,A$e,T$e,Xb=y(()=>{"use strict";Jb();LI={kover:"koverXmlReport",jacoco:"jacocoTestReport"},MI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},zI=[MI.kover,MI.jacoco],c3=/kover/i;A$e=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],T$e=["buildSrc","build-logic"]});import{existsSync as Qb,readFileSync as m3,readdirSync as h3}from"node:fs";import{join as Ia}from"node:path";function qI(t){return Qb(Ia(t,"gradlew"))?"./gradlew":"gradle"}function R$e(t){let e=qI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[f3(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function I$e(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(m3(Ia(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 C$e(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function j$e(t,e){for(let r of e)if(Qb(Ia(t,r)))return r}function M$e(t,e){try{return h3(t).find(n=>n.endsWith(e))}catch{return}}function L$e(t,e){for(let r of F$e)if(r.configs.some(n=>Qb(Ia(t,n))))return r.gate;return e}function U$e(t){if(z$e.some(e=>Qb(Ia(t,e))))return!0;try{return JSON.parse(m3(Ia(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function q$e(t,e){let r=e.lint?{...e,lint:L$e(t,e.lint)}:{...e};return e.test&&e.coverage&&U$e(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function ht(t="."){for(let e of D$e){let r;for(let o of e.manifests)if(o.startsWith(".")?r=M$e(t,o):r=j$e(t,[o]),r)break;if(!r||e.requiresSource&&!C$e(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?q$e(t,n):n;return{language:e.language,manifest:r,gates:i}}return N$e}var P$e,D$e,N$e,F$e,z$e,En=y(()=>{"use strict";Xb();P$e=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);D$e=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:R$e},{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:I$e}],N$e={language:"unknown",manifest:"",gates:{}};F$e=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];z$e=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as B$e,readFileSync as H$e}from"node:fs";import{join as G$e}from"node:path";function Pa(t){return t.code==="ENOENT"}function ev(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=(o||s||`exit ${i}`).slice(0,200);return g3.test(o)||g3.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Lt(t,e,r){return Pa(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function $l(t,e){let r=G$e(t,"package.json");if(!B$e(r))return!1;try{return!!JSON.parse(H$e(r,"utf8")).scripts?.[e]}catch{return!1}}var g3,An=y(()=>{"use strict";g3=/config (is |file )?not found|no such file|ENOENT|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 Z$e(t){let{cwd:e="."}=t,r=ht(e),n=r.gates.arch;if(!n)return[{detector:tv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Pa(i)?[{detector:tv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:ev(i,tv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var tv,Ca,rv=y(()=>{"use strict";jr();En();An();tv="ARCHITECTURE_VIOLATION";Ca={name:tv,subprocess:!0,run:Z$e}});function V$e(t){let{cwd:e="."}=t,r=ht(e),n=r.gates.secret;if(!n)return[{detector:nv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Pa(i)?[{detector:nv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:ev(i,nv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var nv,Da,iv=y(()=>{"use strict";jr();En();An();nv="HARDCODED_SECRET";Da={name:nv,subprocess:!0,run:V$e}});import{existsSync as BI,readdirSync as y3}from"node:fs";import{join as ov}from"node:path";function K$e(t,e){let r=ov(t,e.path);if(!BI(r))return!0;if(e.isDirectory)try{return y3(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function J$e(t){let{cwd:e="."}=t,r=[];for(let i of W$e)K$e(e,i)&&r.push({detector:Wf,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=ov(e,"spec.yaml");if(BI(n)){let i=Q$e(n),o=i?null:Y$e(e);if(i)r.push({detector:Wf,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:Wf,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=X$e(e);s&&r.push({detector:Wf,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 Y$e(t){for(let e of["spec/features","spec/scenarios"]){let r=ov(t,e);if(!BI(r))continue;let n;try{n=y3(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{wi(ov(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function X$e(t){try{return H(t),null}catch(e){return e.message}}function Q$e(t){let e;try{e=wi(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Wf,W$e,_3,b3=y(()=>{"use strict";qe();a_();Wf="ABSENCE_OF_GOVERNANCE",W$e=[{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}];_3={name:Wf,run:J$e}});function sv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function HI(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=sv(r)==="while",o=tke.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 '${sv(r)}'`}let n=eke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:sv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${sv(r)}'`:null}function rke(t,e){let r=HI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function v3(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...rke(r,n));return e}var eke,tke,GI=y(()=>{"use strict";eke={event:"when",state:"while",optional:"where",unwanted:"if"},tke=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var bt=y(()=>{"use strict";qe()});function nke(t){let{cwd:e="."}=t;return he(e,av,ike)}function ike(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:av,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 v3(t.features))e.push({detector:av,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var av,S3,w3=y(()=>{"use strict";GI();bt();av="AC_DRIFT";S3={name:av,run:nke}});function Ri(t=".",e){let n=(e??"").trim().toLowerCase()||ht(t).language;return $3[n]??x3}var oke,ske,ake,x3,cke,lke,$3,uke,k3,Na=y(()=>{"use strict";En();oke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,ske=/^[ \t]*import\s+([\w.]+)/gm,ake=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,x3={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:oke,importStyle:"relative"},cke={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:ske,importStyle:"dotted"},lke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:ake,importStyle:"dotted"},$3={typescript:x3,kotlin:cke,python:lke},uke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],k3=new Set([...Object.values($3).flatMap(t=>t?.extensions??[]),...uke].map(t=>t.toLowerCase()))});import{existsSync as dke,readFileSync as fke,readdirSync as pke,statSync as mke}from"node:fs";import{join as A3,relative as E3}from"node:path";function hke(t,e){if(!dke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=pke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=A3(i,s),c;try{c=mke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function gke(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function _ke(t){return yke.test(t)}function bke(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Ri(e,r.project?.language),o=i.sourceRoots.flatMap(a=>hke(A3(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=fke(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";qe();Na();T3="AI_HINTS_FORBIDDEN_PATTERN";yke=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;O3={name:T3,run:bke}});function vke(t){let{cwd:e="."}=t,r;try{r=H(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:I3,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var I3,P3,C3=y(()=>{"use strict";qe();I3="AC_DUPLICATE_WITHIN_FEATURE";P3={name:I3,run:vke}});import{createRequire as Ske}from"module";import{basename as wke,dirname as VI,normalize as xke,relative as $ke,resolve as kke,sep as j3}from"path";import*as Eke from"fs";function Ake(t){let e=xke(t);return e.length>1&&e[e.length-1]===j3&&(e=e.substring(0,e.length-1)),e}function M3(t,e){return t.replace(Tke,e)}function Rke(t){return t==="/"||Oke.test(t)}function ZI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=kke(t)),(n||o)&&(t=Ake(t)),t===".")return"";let s=t[t.length-1]!==i;return M3(s?t+i:t,i)}function F3(t,e){return e+t}function Ike(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:M3($ke(t,n),e.pathSeparator)+e.pathSeparator+r}}function Pke(t){return t}function Cke(t,e,r){return e+t+r}function Dke(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?Ike(t,e):n?F3:Pke}function Nke(t){return function(e,r){r.push(e.substring(t.length)||".")}}function jke(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function zke(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?jke(t):Nke(t):n&&n.length?Fke:Mke:Lke}function Zke(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?Gke:r&&r.length?n?Uke:qke:n?Bke:Hke}function Kke(t){return t.group?Wke:Vke}function Xke(t){return t.group?Jke:Yke}function tEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?eEe:Qke}function L3(t,e,r){if(r.options.useRealPaths)return rEe(e,r);let n=VI(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=VI(n)}return r.symlinks.set(t,e),i>1}function rEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function cv(t,e,r,n){e(t&&!n?t:null,r)}function dEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?nEe:aEe:n?e?iEe:uEe:i?e?sEe:lEe:e?oEe:cEe}function mEe(t){return t?pEe:fEe}function _Ee(t,e){return new Promise((r,n)=>{q3(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function q3(t,e,r){new U3(t,e,r).start()}function bEe(t,e){return new U3(t,e).start()}var D3,Tke,Oke,Mke,Fke,Lke,Uke,qke,Bke,Hke,Gke,Vke,Wke,Jke,Yke,Qke,eEe,nEe,iEe,oEe,sEe,aEe,cEe,lEe,uEe,z3,fEe,pEe,hEe,gEe,yEe,U3,N3,B3,H3,G3=y(()=>{D3=Ske(import.meta.url);Tke=/[\\/]/g;Oke=/^[a-z]:[\\/]$/i;Mke=(t,e)=>{e.push(t||".")},Fke=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},Lke=()=>{};Uke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},qke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},Bke=(t,e,r,n)=>{r.files++},Hke=(t,e)=>{e.push(t)},Gke=()=>{};Vke=t=>t,Wke=()=>[""].slice(0,0);Jke=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},Yke=()=>{};Qke=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()&&L3(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},eEe=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()&&L3(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};nEe=t=>t.counts,iEe=t=>t.groups,oEe=t=>t.paths,sEe=t=>t.paths.slice(0,t.options.maxFiles),aEe=(t,e,r)=>(cv(e,r,t.counts,t.options.suppressErrors),null),cEe=(t,e,r)=>(cv(e,r,t.paths,t.options.suppressErrors),null),lEe=(t,e,r)=>(cv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),uEe=(t,e,r)=>(cv(e,r,t.groups,t.options.suppressErrors),null);z3={withFileTypes:!0},fEe=(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||".",z3,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},pEe=(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||".",z3)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};hEe=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))}},gEe=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}},yEe=class{aborted=!1;abort(){this.aborted=!0}},U3=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=dEe(e,this.isSynchronous),this.root=ZI(t,e),this.state={root:Rke(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new gEe,options:e,queue:new hEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new yEe,fs:e.fs||Eke},this.joinPath=Dke(this.root,e),this.pushDirectory=zke(this.root,e),this.pushFile=Zke(e),this.getArray=Kke(e),this.groupFiles=Xke(e),this.resolveSymlink=tEe(e,this.isSynchronous),this.walkDirectory=mEe(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(_=ZI(_,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=wke(_),x=ZI(VI(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};N3=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return _Ee(this.root,this.options)}withCallback(t){q3(this.root,this.options,t)}sync(){return bEe(this.root,this.options)}},B3=null;try{D3.resolve("picomatch"),B3=D3("picomatch")}catch{}H3=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:j3,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 N3(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new N3(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||B3;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 Kf=v((ilt,J3)=>{"use strict";var Z3="[^\\\\/]",vEe="(?=.)",V3="[^/]",WI="(?:\\/|$)",W3="(?:^|\\/)",KI=`\\.{1,2}${WI}`,SEe="(?!\\.)",wEe=`(?!${W3}${KI})`,xEe=`(?!\\.{0,1}${WI})`,$Ee=`(?!${KI})`,kEe="[^.\\/]",EEe=`${V3}*?`,AEe="/",K3={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:vEe,QMARK:V3,END_ANCHOR:WI,DOTS_SLASH:KI,NO_DOT:SEe,NO_DOTS:wEe,NO_DOT_SLASH:xEe,NO_DOTS_SLASH:$Ee,QMARK_NO_DOT:kEe,STAR:EEe,START_ANCHOR:W3,SEP:AEe},TEe={...K3,SLASH_LITERAL:"[\\\\/]",QMARK:Z3,STAR:`${Z3}*?`,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:"\\"},OEe={__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"};J3.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:OEe,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?TEe:K3}}});var Jf=v(Mr=>{"use strict";var{REGEX_BACKSLASH:REe,REGEX_REMOVE_BACKSLASH:IEe,REGEX_SPECIAL_CHARS:PEe,REGEX_SPECIAL_CHARS_GLOBAL:CEe}=Kf();Mr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Mr.hasRegexChars=t=>PEe.test(t);Mr.isRegexChar=t=>t.length===1&&Mr.hasRegexChars(t);Mr.escapeRegex=t=>t.replace(CEe,"\\$1");Mr.toPosixSlashes=t=>t.replace(REe,"/");Mr.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};Mr.removeBackslashes=t=>t.replace(IEe,e=>e==="\\"?"":e);Mr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Mr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Mr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Mr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Mr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var iJ=v((slt,nJ)=>{"use strict";var Y3=Jf(),{CHAR_ASTERISK:JI,CHAR_AT:DEe,CHAR_BACKWARD_SLASH:Yf,CHAR_COMMA:NEe,CHAR_DOT:YI,CHAR_EXCLAMATION_MARK:XI,CHAR_FORWARD_SLASH:rJ,CHAR_LEFT_CURLY_BRACE:QI,CHAR_LEFT_PARENTHESES:eP,CHAR_LEFT_SQUARE_BRACKET:jEe,CHAR_PLUS:MEe,CHAR_QUESTION_MARK:X3,CHAR_RIGHT_CURLY_BRACE:FEe,CHAR_RIGHT_PARENTHESES:Q3,CHAR_RIGHT_SQUARE_BRACKET:LEe}=Kf(),eJ=t=>t===rJ||t===Yf,tJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},zEe=(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,O=0,A,E,C={value:"",depth:0,isGlob:!1},k=()=>l>=n,q=()=>c.charCodeAt(l+1),Q=()=>(A=E,c.charCodeAt(++l));for(;l0&&(I=c.slice(0,u),c=c.slice(u),d-=u),Se&&m===!0&&d>0?(Se=c.slice(0,d),P=c.slice(d)):m===!0?(Se="",P=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&eJ(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),r.unescape===!0&&(P&&(P=Y3.removeBackslashes(P)),Se&&_===!0&&(Se=Y3.removeBackslashes(Se)));let Rr={prefix:I,input:t,start:u,base:Se,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Rr.maxDepth=0,eJ(E)||s.push(C),Rr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var Xf=Kf(),nn=Jf(),{MAX_LENGTH:lv,POSIX_REGEX_SOURCE:UEe,REGEX_NON_SPECIAL_CHARS:qEe,REGEX_SPECIAL_CHARS_BACKREF:BEe,REPLACEMENTS:oJ}=Xf,HEe=(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=>nn.escapeRegex(i)).join("..")}return r},kl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,sJ=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},GEe=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},aJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(GEe(e))return e.replace(/\\(.)/g,"$1")},ZEe=t=>{let e=t.map(aJ).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}}}}},VEe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=aJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?nn.escapeRegex(r[0]):`[${r.map(i=>nn.escapeRegex(i)).join("")}]`}*`},WEe=t=>{let e=0,r=t.trim(),n=tP(r);for(;n;)e++,r=n.body.trim(),n=tP(r);return e},KEe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Xf.DEFAULT_MAX_EXTGLOB_RECURSION,n=sJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||ZEe(n)))return{risky:!0};for(let i of n){let o=VEe(i);if(o)return{risky:!0,safeOutput:o};if(WEe(i)>r)return{risky:!0}}return{risky:!1}},rP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=oJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(lv,r.maxLength):lv,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=Xf.globChars(r.windows),l=Xf.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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,A=r.dot?"":h,E=r.dot?_:S,C=r.bash===!0?O(r):x;r.capture&&(C=`(${C})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let k={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=nn.removePrefix(t,k),i=t.length;let q=[],Q=[],Se=[],I=o,P,Rr=()=>k.index===i-1,se=k.peek=(B=1)=>t[k.index+B],Pe=k.advance=()=>t[++k.index]||"",Vt=()=>t.slice(k.index+1),ar=(B="",ft=0)=>{k.consumed+=B,k.index+=ft},Kt=B=>{k.output+=B.output!=null?B.output:B.value,ar(B.value)},to=()=>{let B=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),k.start++,B++;return B%2===0?!1:(k.negated=!0,k.start++,!0)},yi=B=>{k[B]++,Se.push(B)},Jr=B=>{k[B]--,Se.pop()},de=B=>{if(I.type==="globstar"){let ft=k.braces>0&&(B.type==="comma"||B.type==="brace"),U=B.extglob===!0||q.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ft&&!U&&(k.output=k.output.slice(0,-I.output.length),I.type="star",I.value="*",I.output=C,k.output+=I.output)}if(q.length&&B.type!=="paren"&&(q[q.length-1].inner+=B.value),(B.value||B.output)&&Kt(B),I&&I.type==="text"&&B.type==="text"){I.output=(I.output||I.value)+B.value,I.value+=B.value;return}B.prev=I,s.push(B),I=B},ro=(B,ft)=>{let U={...l[ft],conditions:1,inner:""};U.prev=I,U.parens=k.parens,U.output=k.output,U.startIndex=k.index,U.tokensIndex=s.length;let Te=(r.capture?"(":"")+U.open;yi("parens"),de({type:B,value:ft,output:k.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Te}),q.push(U)},Tue=B=>{let ft=t.slice(B.startIndex,k.index+1),U=t.slice(B.startIndex+2,k.index),Te=KEe(U,r);if((B.type==="plus"||B.type==="star")&&Te.risky){let ct=Te.safeOutput?(B.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,_i=s[B.tokensIndex];_i.type="text",_i.value=ft,_i.output=ct||nn.escapeRegex(ft);for(let bi=B.tokensIndex+1;bi1&&B.inner.includes("/")&&(ct=O(r)),(ct!==C||Rr()||/^\)+$/.test(Vt()))&&(lt=B.close=`)$))${ct}`),B.inner.includes("*")&&(jt=Vt())&&/^\.[^\\/.]+$/.test(jt)){let _i=rP(jt,{...e,fastpaths:!1}).output;lt=B.close=`)${_i})${ct})`}B.prev.type==="bos"&&(k.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:lt}),Jr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ft=t.replace(BEe,(U,Te,lt,jt,ct,_i)=>jt==="\\"?(B=!0,U):jt==="?"?Te?Te+jt+(ct?_.repeat(ct.length):""):_i===0?E+(ct?_.repeat(ct.length):""):_.repeat(lt.length):jt==="."?u.repeat(lt.length):jt==="*"?Te?Te+jt+(ct?C:""):C:Te?U:`\\${U}`);return B===!0&&(r.unescape===!0?ft=ft.replace(/\\/g,""):ft=ft.replace(/\\+/g,U=>U.length%2===0?"\\\\":U?"\\":"")),ft===t&&r.contains===!0?(k.output=t,k):(k.output=nn.wrapOutput(ft,k,e),k)}for(;!Rr();){if(P=Pe(),P==="\0")continue;if(P==="\\"){let U=se();if(U==="/"&&r.bash!==!0||U==="."||U===";")continue;if(!U){P+="\\",de({type:"text",value:P});continue}let Te=/^\\+/.exec(Vt()),lt=0;if(Te&&Te[0].length>2&&(lt=Te[0].length,k.index+=lt,lt%2!==0&&(P+="\\")),r.unescape===!0?P=Pe():P+=Pe(),k.brackets===0){de({type:"text",value:P});continue}}if(k.brackets>0&&(P!=="]"||I.value==="["||I.value==="[^")){if(r.posix!==!1&&P===":"){let U=I.value.slice(1);if(U.includes("[")&&(I.posix=!0,U.includes(":"))){let Te=I.value.lastIndexOf("["),lt=I.value.slice(0,Te),jt=I.value.slice(Te+2),ct=UEe[jt];if(ct){I.value=lt+ct,k.backtrack=!0,Pe(),!o.output&&s.indexOf(I)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(I.value==="["||I.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&I.value==="["&&(P="^"),I.value+=P,Kt({value:P});continue}if(k.quotes===1&&P!=='"'){P=nn.escapeRegex(P),I.value+=P,Kt({value:P});continue}if(P==='"'){k.quotes=k.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){yi("parens"),de({type:"paren",value:P});continue}if(P===")"){if(k.parens===0&&r.strictBrackets===!0)throw new SyntaxError(kl("opening","("));let U=q[q.length-1];if(U&&k.parens===U.parens+1){Tue(q.pop());continue}de({type:"paren",value:P,output:k.parens?")":"\\)"}),Jr("parens");continue}if(P==="["){if(r.nobracket===!0||!Vt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(kl("closing","]"));P=`\\${P}`}else yi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||I&&I.type==="bracket"&&I.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if(k.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(kl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Jr("brackets");let U=I.value.slice(1);if(I.posix!==!0&&U[0]==="^"&&!U.includes("/")&&(P=`/${P}`),I.value+=P,Kt({value:P}),r.literalBrackets===!1||nn.hasRegexChars(U))continue;let Te=nn.escapeRegex(I.value);if(k.output=k.output.slice(0,-I.value.length),r.literalBrackets===!0){k.output+=Te,I.value=Te;continue}I.value=`(${a}${Te}|${I.value})`,k.output+=I.value;continue}if(P==="{"&&r.nobrace!==!0){yi("braces");let U={type:"brace",value:P,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};Q.push(U),de(U);continue}if(P==="}"){let U=Q[Q.length-1];if(r.nobrace===!0||!U){de({type:"text",value:P,output:P});continue}let Te=")";if(U.dots===!0){let lt=s.slice(),jt=[];for(let ct=lt.length-1;ct>=0&&(s.pop(),lt[ct].type!=="brace");ct--)lt[ct].type!=="dots"&&jt.unshift(lt[ct].value);Te=HEe(jt,r),k.backtrack=!0}if(U.comma!==!0&&U.dots!==!0){let lt=k.output.slice(0,U.outputIndex),jt=k.tokens.slice(U.tokensIndex);U.value=U.output="\\{",P=Te="\\}",k.output=lt;for(let ct of jt)k.output+=ct.output||ct.value}de({type:"brace",value:P,output:Te}),Jr("braces"),Q.pop();continue}if(P==="|"){q.length>0&&q[q.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let U=P,Te=Q[Q.length-1];Te&&Se[Se.length-1]==="braces"&&(Te.comma=!0,U="|"),de({type:"comma",value:P,output:U});continue}if(P==="/"){if(I.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",s.pop(),I=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if(k.braces>0&&I.type==="dot"){I.value==="."&&(I.output=u);let U=Q[Q.length-1];I.type="dots",I.output+=P,I.value+=P,U.dots=!0;continue}if(k.braces+k.parens===0&&I.type!=="bos"&&I.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(I&&I.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){ro("qmark",P);continue}if(I&&I.type==="paren"){let Te=se(),lt=P;(I.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Vt()))&&(lt=`\\${P}`),de({type:"text",value:P,output:lt});continue}if(r.dot!==!0&&(I.type==="slash"||I.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){ro("negate",P);continue}if(r.nonegate!==!0&&k.index===0){to();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){ro("plus",P);continue}if(I&&I.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(I&&(I.type==="bracket"||I.type==="paren"||I.type==="brace")||k.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let U=qEe.exec(Vt());U&&(P+=U[0],k.index+=U[0].length),de({type:"text",value:P});continue}if(I&&(I.type==="globstar"||I.star===!0)){I.type="star",I.star=!0,I.value+=P,I.output=C,k.backtrack=!0,k.globstar=!0,ar(P);continue}let B=Vt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){ro("star",P);continue}if(I.type==="star"){if(r.noglobstar===!0){ar(P);continue}let U=I.prev,Te=U.prev,lt=U.type==="slash"||U.type==="bos",jt=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!lt||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let ct=k.braces>0&&(U.type==="comma"||U.type==="brace"),_i=q.length&&(U.type==="pipe"||U.type==="paren");if(!lt&&U.type!=="paren"&&!ct&&!_i){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let bi=t[k.index+4];if(bi&&bi!=="/")break;B=B.slice(3),ar("/**",3)}if(U.type==="bos"&&Rr()){I.type="globstar",I.value+=P,I.output=O(r),k.output=I.output,k.globstar=!0,ar(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&!jt&&Rr()){k.output=k.output.slice(0,-(U.output+I.output).length),U.output=`(?:${U.output}`,I.type="globstar",I.output=O(r)+(r.strictSlashes?")":"|$)"),I.value+=P,k.globstar=!0,k.output+=U.output+I.output,ar(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&B[0]==="/"){let bi=B[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(U.output+I.output).length),U.output=`(?:${U.output}`,I.type="globstar",I.output=`${O(r)}${f}|${f}${bi})`,I.value+=P,k.output+=U.output+I.output,k.globstar=!0,ar(P+Pe()),de({type:"slash",value:"/",output:""});continue}if(U.type==="bos"&&B[0]==="/"){I.type="globstar",I.value+=P,I.output=`(?:^|${f}|${O(r)}${f})`,k.output=I.output,k.globstar=!0,ar(P+Pe()),de({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-I.output.length),I.type="globstar",I.output=O(r),I.value+=P,k.output+=I.output,k.globstar=!0,ar(P);continue}let ft={type:"star",value:P,output:C};if(r.bash===!0){ft.output=".*?",(I.type==="bos"||I.type==="slash")&&(ft.output=A+ft.output),de(ft);continue}if(I&&(I.type==="bracket"||I.type==="paren")&&r.regex===!0){ft.output=P,de(ft);continue}(k.index===k.start||I.type==="slash"||I.type==="dot")&&(I.type==="dot"?(k.output+=g,I.output+=g):r.dot===!0?(k.output+=b,I.output+=b):(k.output+=A,I.output+=A),se()!=="*"&&(k.output+=p,I.output+=p)),de(ft)}for(;k.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(kl("closing","]"));k.output=nn.escapeLast(k.output,"["),Jr("brackets")}for(;k.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(kl("closing",")"));k.output=nn.escapeLast(k.output,"("),Jr("parens")}for(;k.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(kl("closing","}"));k.output=nn.escapeLast(k.output,"{"),Jr("braces")}if(r.strictSlashes!==!0&&(I.type==="star"||I.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),k.backtrack===!0){k.output="";for(let B of k.tokens)k.output+=B.output!=null?B.output:B.value,B.suffix&&(k.output+=B.suffix)}return k};rP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(lv,r.maxLength):lv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=oJ[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}=Xf.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 E=/^(.*?)\.(\w+)$/.exec(A);if(!E)return;let C=x(E[1]);return C?C+o+E[2]:void 0}}},w=nn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};cJ.exports=rP});var fJ=v((clt,dJ)=>{"use strict";var JEe=iJ(),nP=lJ(),uJ=Jf(),YEe=Kf(),XEe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=XEe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?uJ.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(uJ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):nP(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>JEe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=nP.fastpaths(t,e)),i.output||(i=nP(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=YEe;dJ.exports=Tt});var gJ=v((llt,hJ)=>{"use strict";var pJ=fJ(),QEe=Jf();function mJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:QEe.isWindows()}),pJ(t,e,r)}Object.assign(mJ,pJ);hJ.exports=mJ});import{readdir as eAe,readdirSync as tAe,realpath as rAe,realpathSync as nAe,stat as iAe,statSync as oAe}from"fs";import{isAbsolute as sAe,posix as ja,resolve as aAe}from"path";import{fileURLToPath as cAe}from"url";function dAe(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]===".."&&uAe.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=>ja.relative(t,n)||".":n=>ja.relative(t,`${e}/${n}`)||"."}function mAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=ja.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function vJ(t){var e;let r=El.default.scan(t,hAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function SAe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=El.default.scan(t);return r.isGlob||r.negated}function Qf(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function SJ(t){return typeof t=="string"?[t]:t??[]}function iP(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=vAe(o);s=sAe(s.replace(xAe,""))?ja.relative(a,s):ja.normalize(s);let c=(i=wAe.exec(s))===null||i===void 0?void 0:i[0],l=vJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?ja.join(o,...d):o}return s}function $Ae(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(iP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(iP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(iP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function kAe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=$Ae(t,e,n);t.debug&&Qf("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(_J,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,El.default)(i.match,f),m=(0,El.default)(i.ignore,f),h=dAe(i.match,f),g=yJ(r,d,o),b=o?g:yJ(r,d,!0),_=(w,O)=>{let A=b(O,!0);return A!=="."&&!h(A)||m(A)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new H3({filters:[a?(w,O)=>{let A=g(w,O),E=p(A)&&!m(A);return E&&Qf(`matched ${A}`),E}:(w,O)=>{let A=g(w,O);return p(A)&&!m(A)}],exclude:a?(w,O)=>{let A=_(w,O);return Qf(`${A?"skipped":"crawling"} ${O}`),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&&Qf("internal properties:",{...n,root:d}),[x,r!==d&&!o&&mAe(r,d)]}function EAe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function TAe(t){let e={...AAe,...t};return e.cwd=(e.cwd instanceof URL?cAe(e.cwd):aAe(e.cwd)).replace(_J,"/"),e.ignore=SJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||eAe,readdirSync:e.fs.readdirSync||tAe,realpath:e.fs.realpath||rAe,realpathSync:e.fs.realpathSync||nAe,stat:e.fs.stat||iAe,statSync:e.fs.statSync||oAe}),e.debug&&Qf("globbing with options:",e),e}function OAe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=lAe(t)||typeof t=="string",i=SJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=TAe(n?e:t);return i.length>0?kAe(o,i):[]}function us(t,e){let[r,n]=OAe(t,e);return r?EAe(r.sync(),n):[]}var El,lAe,_J,bJ,uAe,fAe,pAe,hAe,gAe,yAe,_Ae,bAe,vAe,wAe,xAe,AAe,ep=y(()=>{G3();El=Et(gJ(),1),lAe=Array.isArray,_J=/\\/g,bJ=process.platform==="win32",uAe=/^(\/?\.\.)+$/;fAe=/^[A-Z]:\/$/i,pAe=bJ?t=>fAe.test(t):t=>t==="/";hAe={parts:!0};gAe=/(?t.replace(gAe,"\\$&"),bAe=t=>t.replace(yAe,"\\$&"),vAe=bJ?bAe:_Ae;wAe=/^(\/?\.\.)+/,xAe=/\\(?=[()[\]{}!*+?@|])/g;AAe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as tp,readFileSync as RAe,readdirSync as IAe,statSync as wJ}from"node:fs";import{join as Ma}from"node:path";function PAe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Ri(e,n),o=[],{layers:s,forbiddenImports:a}=oP(r);return(s.size>0||a.length>0)&&!tp(Ma(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&&(CAe(e,i,s,o),DAe(e,i,s,o)),a.length>0&&NAe(e,i,a,o),o)}function oP(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 CAe(t,e,r,n){let i=e.mainRoot,o=Ma(t,i);if(tp(o))for(let s of IAe(o)){let a=Ma(o,s);wJ(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 DAe(t,e,r,n){let i=e.mainRoot,o=Ma(t,i);if(tp(o))for(let s of r){let a=Ma(o,s);tp(a)&&wJ(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 NAe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ma(t,i,s.from);if(!tp(a))continue;let c=us([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ma(a,l),d;try{d=RAe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];jAe(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 jAe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var rp,xJ,sP=y(()=>{"use strict";ep();qe();Na();rp="ARCHITECTURE_FROM_SPEC";xJ={name:rp,run:PAe}});import{existsSync as MAe,readFileSync as FAe}from"node:fs";import{join as LAe}from"node:path";function zAe(t){let{cwd:e="."}=t,r=LAe(e,"spec/capabilities.yaml");if(!MAe(r))return[];let n;try{let c=FAe(r,"utf8"),l=$J.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=H(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:uv,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:uv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:uv,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var $J,uv,kJ,EJ=y(()=>{"use strict";$J=Et(cr(),1);qe();uv="CAPABILITIES_FEATURE_MAPPING";kJ={name:uv,run:zAe}});import{existsSync as UAe,readFileSync as qAe}from"node:fs";import{join as BAe}from"node:path";function HAe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function GAe(t){let{cwd:e="."}=t;return he(e,aP,r=>ZAe(r,e))}function ZAe(t,e){let r=Ri(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=BAe(e,o);if(!UAe(s))continue;let a=qAe(s,"utf8");HAe(a)||n.push({detector:aP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var aP,AJ,TJ=y(()=>{"use strict";Na();bt();aP="CONVENTION_DRIFT";AJ={name:aP,run:GAe}});import{existsSync as cP,readFileSync as OJ}from"node:fs";import{join as dv}from"node:path";function VAe(t){return JSON.parse(t).total?.lines?.pct??0}function RJ(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function JAe(t,e){if(!Vb(ht(t).gates.coverage?.cmd))return null;let r;try{r=Wb(t,e)}catch(c){return[{detector:go,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=zI.find(d=>cP(dv(c.dir,d)));if(!l){s.push(c.path);continue}let u=RJ(OJ(dv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:go,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=IJ(n,i);return a0?[{detector:go,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function YAe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=JAe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Ri(e,r),i=ht(e).language==="kotlin"?zI.find(a=>cP(dv(e,a)))??p3(e):n.coverageSummary,o=dv(e,i);if(!cP(o))return[{detector:go,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=OJ(o,"utf8");s=n.coverageFormat==="jacoco-xml"?WAe(a):n.coverageFormat==="cobertura-xml"?KAe(a):VAe(a)}catch(a){return[{detector:go,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:go,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=fv?[]:[{detector:go,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${fv}%`}]}var go,fv,PJ,CJ=y(()=>{"use strict";qe();Xb();Na();Kb();En();go="COVERAGE_DROP",fv=70;PJ={name:go,run:YAe}});import{existsSync as XAe}from"node:fs";import{join as QAe}from"node:path";function eTe(t){let{cwd:e="."}=t;return he(e,pv,r=>tTe(r,e))}function tTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?XAe(QAe(e,r.path))?[]:[{detector:pv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:pv,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var pv,DJ,NJ=y(()=>{"use strict";bt();pv="DELIVERABLE_INTEGRITY";DJ={name:pv,run:eTe}});function rTe(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:mv,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 nTe(t){let e=rTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:mv,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 iTe(t){let{cwd:e="."}=t;return he(e,mv,r=>nTe(r))}var mv,jJ,MJ=y(()=>{"use strict";bt();mv="SMOKE_PROBE_DEMAND";jJ={name:mv,run:iTe}});function oTe(t){let{cwd:e="."}=t;return he(e,hv,r=>sTe(r,e))}function sTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ts(e);if(n===null)return[{detector:hv,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=p_(n,e,o);s.state!=="fresh"&&i.push({detector:hv,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 hv,gv,lP=y(()=>{"use strict";rl();bt();hv="STALE_ATTESTATION";gv={name:hv,run:oTe}});function aTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return cTe(r)}function cTe(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:FJ,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 FJ,yv,uP=y(()=>{"use strict";qe();FJ="DEPENDENCY_CYCLE";yv={name:FJ,run:aTe}});import{appendFileSync as lTe,existsSync as LJ,mkdirSync as uTe,readFileSync as dTe}from"node:fs";import{dirname as fTe,join as pTe}from"node:path";function zJ(t){return pTe(t,mTe,hTe)}function UJ(t){return dP.add(t),()=>dP.delete(t)}function Fa(t,e){let r=zJ(t),n=fTe(r);LJ(n)||uTe(n,{recursive:!0}),lTe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of dP)try{i(t,e)}catch{}}function Tn(t){let e=zJ(t);if(!LJ(e))return[];let r=dTe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var mTe,hTe,dP,Xn=y(()=>{"use strict";mTe=".cladding",hTe="audit.log.jsonl";dP=new Set});import{existsSync as gTe}from"node:fs";import{join as yTe}from"node:path";function _Te(t){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return[{detector:fP,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&&(gTe(yTe(e,i.artifact))||n.push({detector:fP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var fP,qJ,BJ=y(()=>{"use strict";Xn();fP="EVIDENCE_MISMATCH";qJ={name:fP,run:_Te}});import{existsSync as bTe,readFileSync as vTe}from"node:fs";import{join as STe}from"node:path";function wTe(t){let e=STe(t,VJ);if(!bTe(e))return null;try{let n=((0,ZJ.parse)(vTe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*GJ(t,e){for(let r of t??[])r.startsWith(HJ)&&(yield{ref:r,name:r.slice(HJ.length),field:e})}function xTe(t){let{cwd:e="."}=t,r=wTe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:pP,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=[...GJ(s.evidence_refs,"evidence_refs"),...GJ(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:pP,severity:"warn",path:VJ,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var ZJ,pP,HJ,VJ,WJ,KJ=y(()=>{"use strict";ZJ=Et(cr(),1);qe();pP="FIXTURE_REFERENCE_INVALID",HJ="fixture:",VJ="conformance/fixtures.yaml";WJ={name:pP,run:xTe}});import{existsSync as Al,readFileSync as mP}from"node:fs";import{join as La}from"node:path";function $Te(t){return us(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function np(t){if(!Al(t))return null;try{return JSON.parse(mP(t,"utf8"))}catch{return null}}function kTe(t,e){let r=La(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(mP(r,"utf8"))}catch(c){e.push({detector:yo,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:yo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=$Te(t);s!==a&&e.push({detector:yo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function ETe(t,e){for(let r of JJ){let n=La(t,r.path);if(!Al(n))continue;let i=np(n);if(!i){e.push({detector:yo,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:yo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function ATe(t,e){let r=np(La(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of JJ){let s=La(t,o.path);if(!Al(s))continue;let a=np(s);a?.version&&a.version!==n&&e.push({detector:yo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=La(t,".claude-plugin","marketplace.json");if(Al(i)){let o=np(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:yo,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 TTe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function OTe(t,e){let r=La(t,"src","cli","clad.ts"),n=La(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Al(r)||!Al(n))return;let i=TTe(mP(r,"utf8"));if(i.length===0)return;let s=np(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:yo,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 RTe(t){let{cwd:e="."}=t,r=[];return kTe(e,r),OTe(e,r),ETe(e,r),ATe(e,r),r}var yo,JJ,YJ,XJ=y(()=>{"use strict";ep();yo="HARNESS_INTEGRITY",JJ=[{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"]}];YJ={name:yo,run:RTe}});import{existsSync as ITe,readFileSync as PTe}from"node:fs";import{join as CTe}from"node:path";function NTe(t){let{cwd:e="."}=t;return he(e,_v,r=>MTe(r,e))}function jTe(t){let e=CTe(t,"spec/capabilities.yaml");if(!ITe(e))return!1;try{let r=QJ.default.parse(PTe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function MTe(t,e){let r=t.features.length;if(r{"use strict";QJ=Et(cr(),1);bt();_v="HOLLOW_GOVERNANCE",DTe=8;e8={name:_v,run:NTe}});import{existsSync as r8,readFileSync as n8}from"node:fs";import{join as i8}from"node:path";function o8(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 zTe(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 UTe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function qTe(t){let e=i8(t,"README.md"),r=i8(t,"docs","dogfood","matrix.md");if(!r8(e)||!r8(r))return[];let n=o8(n8(e,"utf8"),FTe),i=o8(n8(r,"utf8"),LTe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=UTe(a);if(c===null)continue;let l=i[s]??"not-run",u=zTe(l);u!==null&&c>u&&o.push({detector:s8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function BTe(t){let{cwd:e="."}=t;return qTe(e)}var s8,FTe,LTe,a8,c8=y(()=>{"use strict";s8="HOST_CLAIM_DRIFT",FTe=//,LTe=//;a8={name:s8,run:BTe}});function HTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return l8(r.features.map(i=>i.id),"feature","spec/features/",n),l8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function l8(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:u8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var u8,d8,f8=y(()=>{"use strict";qe();u8="ID_COLLISION";d8={name:u8,run:HTe}});import{existsSync as ip,readFileSync as hP,readdirSync as gP,statSync as GTe,writeFileSync as m8}from"node:fs";import{join as _o}from"node:path";function p8(t){if(!ip(t))return 0;try{return gP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function ZTe(t){if(!ip(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=gP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=_o(n,o),a;try{a=GTe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function VTe(t){let e=_o(t,"spec","capabilities.yaml");if(!ip(e))return 0;try{let r=bv.default.parse(hP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ds(t="."){let e=p8(_o(t,"spec","features")),r=p8(_o(t,"spec","scenarios")),n=VTe(t),i=ZTe(_o(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Tl(t,e){let r=_o(t,"spec.yaml");if(!ip(r))return;let n=hP(r,"utf8"),i=WTe(n,e);i!==n&&m8(r,i)}function WTe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as Cwe}from"node:buffer";import{StringDecoder as Dwe}from"node:string_decoder";var $b,Nwe,jwe,Mwe,MR=y(()=>{en();$b=(t,e,r)=>{if(r)return;if(t)return{transform:Nwe.bind(void 0,new TextEncoder)};let n=new Dwe(e);return{transform:jwe.bind(void 0,n),final:Mwe.bind(void 0,n)}},Nwe=function*(t,e){Cwe.isBuffer(e)?yield co(e):typeof e=="string"?yield t.encode(e):yield e},jwe=function*(t,e){yield Ft(e)?t.write(e):e},Mwe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as iW}from"node:util";var FR,kb,oW,Fwe,sW,Lwe,aW=y(()=>{FR=iW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),kb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Lwe}=e[r];for await(let i of n(t))yield*kb(i,e,r+1)},oW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Fwe(r,Number(e),t)},Fwe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*kb(n,r,e+1)},sW=iW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Lwe=function*(t){yield t}});var LR,cW,Ta,qf,zwe,Uwe,zR=y(()=>{LR=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},cW=(t,e)=>[...e.flatMap(r=>[...Ta(r,t,0)]),...qf(t)],Ta=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Uwe}=e[r];for(let i of n(t))yield*Ta(i,e,r+1)},qf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*zwe(r,Number(e),t)},zwe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ta(n,r,e+1)},Uwe=function*(t){yield t}});import{Transform as qwe,getDefaultHighWaterMark as lW}from"node:stream";var UR,Eb,uW,Ab=y(()=>{_r();xb();nW();MR();aW();zR();UR=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=uW(t,s,o),l=Aa(e),u=Aa(r),d=l?FR.bind(void 0,kb,a):LR.bind(void 0,Ta),f=l||u?FR.bind(void 0,oW,a):LR.bind(void 0,qf),p=l||u?sW.bind(void 0,a):void 0;return{stream:new qwe({writableObjectMode:n,writableHighWaterMark:lW(n),readableObjectMode:i,readableHighWaterMark:lW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Eb=(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=uW(s,r,a);t=cW(c,t)}return t},uW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:eW(n,a)},$b(r,s,n),wb(r,o,n,c),{transform:t,final:e},{transform:tW(i,a)},QV({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var dW,Bwe,Hwe,Gwe,Zwe,fW=y(()=>{Ab();en();_r();dW=(t,e)=>{for(let r of Bwe(t))Hwe(t,r,e)},Bwe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Hwe=(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 ${as[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Gwe(a,n));r.input=Ef(s)},Gwe=(t,e)=>{let r=Eb(t,e,"utf8",!0);return Zwe(r),Ef(r)},Zwe=t=>{let e=t.find(r=>typeof r!="string"&&!Ft(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 Tb,Vwe,Wwe,pW,mW,Kwe,hW,qR=y(()=>{xa();_r();cl();ns();Tb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&al(r,n)&&!tn.has(e)&&Vwe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Wwe.has(o))||t.every(({type:i})=>$n.has(i))),Vwe=t=>t===1||t===2,Wwe=new Set(["pipe","overlapped"]),pW=async(t,e,r,n)=>{for await(let i of t)Kwe(e)||hW(i,r,n)},mW=(t,e,r)=>{for(let n of t)hW(n,e,r)},Kwe=t=>t._readableState.pipes.length>0,hW=(t,e,r)=>{let n=A_(t);$i({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Jwe,appendFileSync as Ywe}from"node:fs";var gW,Xwe,Qwe,exe,txe,rxe,yW=y(()=>{qR();Ab();xb();en();_r();Ea();gW=({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)=>Xwe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Xwe=({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=tV(t,o,d),p=co(f),{stdioItems:m,objectMode:h}=e[r],g=Qwe([p],m,c,n),{serializedResult:b,finalResult:_=b}=exe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});txe({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&&rxe(b,m,i),S}catch(x){return n.error=x,S}},Qwe=(t,e,r,n)=>{try{return Eb(t,e,r,!1)}catch(i){return n.error=i,t}},exe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Ef(t)};let s=GH(t,r);return n[o]?{serializedResult:s,finalResult:jR(s,!i[o],e)}:{serializedResult:s}},txe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Tb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=jR(t,!1,s);try{mW(a,e,n)}catch(c){r.error??=c}},rxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>bb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Ywe(n,t):(r.add(o),Jwe(n,t))}}});var _W,bW=y(()=>{en();Uf();_W=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,mo(e,r,"all")]:Array.isArray(e)?[mo(t,r,"all"),...e]:Ft(t)&&Ft(e)?IO([t,e]):`${t}${e}`}});import{once as BR}from"node:events";var vW,nxe,SW,wW,ixe,HR,GR=y(()=>{Sa();vW=async(t,e)=>{let[r,n]=await nxe(t);return e.isForcefullyTerminated??=!1,[r,n]},nxe=async t=>{let[e,r]=await Promise.allSettled([BR(t,"spawn"),BR(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?SW(t):r.value},SW=async t=>{try{return await BR(t,"exit")}catch{return SW(t)}},wW=async t=>{let[e,r]=await t;if(!ixe(e,r)&&HR(e,r))throw new Wn;return[e,r]},ixe=(t,e)=>t===void 0&&e===void 0,HR=(t,e)=>t!==0||e!==null});var xW,oxe,$W=y(()=>{Sa();Ea();GR();xW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=oxe(t,e,r),s=o?.code==="ETIMEDOUT",a=eV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},oxe=(t,e,r)=>t!==void 0?t:HR(e,r)?new Wn:void 0});import{spawnSync as sxe}from"node:child_process";var kW,axe,cxe,lxe,Ob,uxe,dxe,fxe,pxe,EW=y(()=>{zO();mR();hR();zf();gb();JV();Uf();fW();yW();Ea();bW();$W();kW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=axe(t,e,r),d=uxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return bl(d,c,l)},axe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=R_(t,e,r),a=cxe(r),{file:c,commandArguments:l,options:u}=nb(t,e,a);lxe(u);let d=WV(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},cxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,lxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Ob("ipcInput"),t&&Ob("ipc: true"),r&&Ob("detached: true"),n&&Ob("cancelSignal")},Ob=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},uxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=dxe({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}=xW(c,r),{output:m,error:h=l}=gW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>mo(_,r,S)),b=mo(_W(m,r),r,"all");return pxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},dxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{dW(o,r);let a=fxe(r);return sxe(...ib(t,e,a))}catch(a){return _l({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},fxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:mb(e)}),pxe=({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?hb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Lf({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 ZR,on as mxe}from"node:events";var AW,hxe,gxe,yxe,_xe,TW=y(()=>{pl();Df();Cf();AW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(dl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:J_(t)}),hxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),hxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{B_(e,i);let o=ss(t,e,r),s=new AbortController;try{return await Promise.race([gxe(o,n,s),yxe(o,r,s),_xe(o,r,s)])}catch(a){throw fl(t),a}finally{s.abort(),H_(e,i)}},gxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await ZR(t,"message",{signal:r});return n}for await(let[n]of mxe(t,"message",{signal:r}))if(e(n))return n},yxe=async(t,e,{signal:r})=>{await ZR(t,"disconnect",{signal:r}),LZ(e)},_xe=async(t,e,{signal:r})=>{let[n]=await ZR(t,"strict:error",{signal:r});throw L_(n,e)}});import{once as RW,on as bxe}from"node:events";var IW,VR,vxe,Sxe,wxe,OW,WR=y(()=>{pl();Df();Cf();IW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>VR({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),VR=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{dl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:J_(t)}),B_(e,o);let s=ss(t,e,r),a=new AbortController,c={};return vxe(t,s,a),Sxe({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),wxe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},vxe=async(t,e,r)=>{try{await RW(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Sxe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await RW(t,"strict:error",{signal:r.signal});n.error=L_(i,e),r.abort()}catch{}},wxe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of bxe(r,"message",{signal:o.signal}))OW(s),yield c}catch{OW(s)}finally{o.abort(),H_(e,a),n||fl(t),i&&await t}},OW=({error:t})=>{if(t)throw t}});import PW from"node:process";var CW,DW,NW,KR=y(()=>{tb();TW();WR();W_();CW=(t,{ipc:e})=>{Object.assign(t,NW(t,!1,e))},DW=()=>{let t=PW,e=!0,r=PW.channel!==void 0;return{...NW(t,e,r),getCancelSignal:p9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},NW=(t,e,r)=>({sendMessage:eb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:AW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:IW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as xxe}from"node:child_process";import{PassThrough as $xe,Readable as kxe,Writable as Exe,Duplex as Axe}from"node:stream";var jW,Txe,Bf,Oxe,Rxe,Ixe,Pxe,MW=y(()=>{Sb();zf();gb();jW=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{CR(n);let a=new xxe;Txe(a,n),Object.assign(a,{readable:Oxe,writable:Rxe,duplex:Ixe});let c=_l({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=Pxe(c,s,i);return{subprocess:a,promise:l}},Txe=(t,e)=>{let r=Bf(),n=Bf(),i=Bf(),o=Array.from({length:e.length-3},Bf),s=Bf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Bf=()=>{let t=new $xe;return t.end(),t},Oxe=()=>new kxe({read(){}}),Rxe=()=>new Exe({write(){}}),Ixe=()=>new Axe({read(){},write(){}}),Pxe=async(t,e,r)=>bl(t,e,r)});import{createReadStream as FW,createWriteStream as LW}from"node:fs";import{Buffer as Cxe}from"node:buffer";import{Readable as Hf,Writable as Dxe,Duplex as Nxe}from"node:stream";var UW,Gf,zW,jxe,qW=y(()=>{Ab();Sb();_r();UW=(t,e)=>vb(jxe,t,e,!1),Gf=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${as[t]}.`)},zW={fileNumber:Gf,generator:UR,asyncGenerator:UR,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Nxe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},jxe={input:{...zW,fileUrl:({value:t})=>({stream:FW(t)}),filePath:({value:{file:t}})=>({stream:FW(t)}),webStream:({value:t})=>({stream:Hf.fromWeb(t)}),iterable:({value:t})=>({stream:Hf.from(t)}),asyncIterable:({value:t})=>({stream:Hf.from(t)}),string:({value:t})=>({stream:Hf.from(t)}),uint8Array:({value:t})=>({stream:Hf.from(Cxe.from(t))})},output:{...zW,fileUrl:({value:t})=>({stream:LW(t)}),filePath:({value:{file:t,append:e}})=>({stream:LW(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Dxe.fromWeb(t)}),iterable:Gf,asyncIterable:Gf,string:Gf,uint8Array:Gf}}});import{on as Mxe,once as BW}from"node:events";import{PassThrough as Fxe,getDefaultHighWaterMark as Lxe}from"node:stream";import{finished as ZW}from"node:stream/promises";function Oa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)YR(i);let e=t.some(({readableObjectMode:i})=>i),r=zxe(t,e),n=new JR({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var zxe,JR,Uxe,qxe,Bxe,YR,Hxe,Gxe,Zxe,Vxe,Wxe,VW,WW,XR,KW,Kxe,Rb,HW,GW,Ib=y(()=>{zxe=(t,e)=>{if(t.length===0)return Lxe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},JR=class extends Fxe{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(YR(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Uxe(this,this.#t,this.#o);let r=Hxe({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(YR(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)}},Uxe=async(t,e,r)=>{Rb(t,HW);let n=new AbortController;try{await Promise.race([qxe(t,n),Bxe(t,e,r,n)])}finally{n.abort(),Rb(t,-HW)}},qxe=async(t,{signal:e})=>{try{await ZW(t,{signal:e,cleanup:!0})}catch(r){throw VW(t,r),r}},Bxe=async(t,e,r,{signal:n})=>{for await(let[i]of Mxe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},YR=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Hxe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Rb(t,GW);let a=new AbortController;try{await Promise.race([Gxe(o,e,a),Zxe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Vxe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Rb(t,-GW)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?XR(t):Wxe(t))},Gxe=async(t,e,{signal:r})=>{try{await t,r.aborted||XR(e)}catch(n){r.aborted||VW(e,n)}},Zxe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await ZW(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;WW(s)?i.add(e):KW(t,s)}},Vxe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await BW(t,i,{signal:o}),!t.readable)return BW(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},Wxe=t=>{t.writable&&t.end()},VW=(t,e)=>{WW(e)?XR(t):KW(t,e)},WW=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",XR=t=>{(t.readable||t.writable)&&t.destroy()},KW=(t,e)=>{t.destroyed||(t.once("error",Kxe),t.destroy(e))},Kxe=()=>{},Rb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},HW=2,GW=1});import{finished as JW}from"node:stream/promises";var Sl,Jxe,QR,Yxe,eI,Pb=y(()=>{lo();Sl=(t,e)=>{t.pipe(e),Jxe(t,e),Yxe(t,e)},Jxe=async(t,e)=>{if(!(Vn(t)||Vn(e))){try{await JW(t,{cleanup:!0,readable:!0,writable:!1})}catch{}QR(e)}},QR=t=>{t.writable&&t.end()},Yxe=async(t,e)=>{if(!(Vn(t)||Vn(e))){try{await JW(e,{cleanup:!0,readable:!1,writable:!0})}catch{}eI(t)}},eI=t=>{t.readable&&t.destroy()}});var YW,Xxe,Qxe,e0e,t0e,r0e,XW=y(()=>{Ib();lo();q_();_r();Pb();YW=(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})=>$n.has(c)))Xxe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!$n.has(c)))e0e({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]:Oa(o);Sl(s,i)}},Xxe=(t,e,r,n)=>{r==="output"?Sl(t.stdio[n],e):Sl(e,t.stdio[n]);let i=Qxe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Qxe=["stdin","stdout","stderr"],e0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;t0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},t0e=(t,{signal:e})=>{Vn(t)&&wa(t,r0e,e)},r0e=2});var Ra,QW=y(()=>{Ra=[];Ra.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ra.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ra.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Cb,tI,rI,n0e,nI,Db,i0e,iI,oI,sI,eK,iot,oot,tK=y(()=>{QW();Cb=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",tI=Symbol.for("signal-exit emitter"),rI=globalThis,n0e=Object.defineProperty.bind(Object),nI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(rI[tI])return rI[tI];n0e(rI,tI,{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}},Db=class{},i0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),iI=class extends Db{onExit(){return()=>{}}load(){}unload(){}},oI=class extends Db{#t=sI.platform==="win32"?"SIGINT":"SIGHUP";#r=new nI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ra)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(!Cb(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 Ra)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,Ra.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 Cb(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"&&Cb(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)}},sI=globalThis.process,{onExit:eK,load:iot,unload:oot}=i0e(Cb(sI)?new oI(sI):new iI)});import{addAbortListener as o0e}from"node:events";var rK,nK=y(()=>{tK();rK=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=eK(()=>{t.kill()});o0e(n,()=>{i()})}});var oK,s0e,a0e,iK,c0e,sK=y(()=>{RO();O_();os();ol();oK=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=T_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=s0e(r,n,i),{sourceStream:d,sourceError:f}=c0e(t,l),{options:p,fileDescriptors:m}=Ei.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},s0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=a0e(t,e,...r),a=U_(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},a0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(iK,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||TO(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]=y_(r,...n);return{destination:e(iK)(i,o,s),pipeOptions:s}}if(Ei.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}`)},iK=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),c0e=(t,e)=>{try{return{sourceStream:hl(t,e)}}catch(r){return{sourceError:r}}}});var cK,l0e,aI,aK,cI=y(()=>{zf();Pb();cK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=l0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw aI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},l0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return eI(t),n;if(e!==void 0)return QR(r),e},aI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>_l({error:t,command:aK,escapedCommand:aK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),aK="source.pipe(destination)"});var lK,uK=y(()=>{lK=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 u0e}from"node:stream/promises";var dK,d0e,f0e,p0e,Nb,m0e,h0e,fK=y(()=>{Ib();q_();Pb();dK=(t,e,r)=>{let n=Nb.has(e)?f0e(t,e):d0e(t,e);return wa(t,m0e,r.signal),wa(e,h0e,r.signal),p0e(e),n},d0e=(t,e)=>{let r=Oa([t]);return Sl(r,e),Nb.set(e,r),r},f0e=(t,e)=>{let r=Nb.get(e);return r.add(t),r},p0e=async t=>{try{await u0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Nb.delete(t)},Nb=new WeakMap,m0e=2,h0e=1});import{aborted as g0e}from"node:util";var pK,y0e,mK=y(()=>{cI();pK=(t,e)=>t===void 0?[]:[y0e(t,e)],y0e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await g0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw aI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var jb,_0e,b0e,hK=y(()=>{ao();sK();cI();uK();fK();mK();jb=(t,...e)=>{if(At(e[0]))return jb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=oK(t,...e),i=_0e({...n,destination:r});return i.pipe=jb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},_0e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=b0e(t,i);cK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=dK(e,o,d);return await Promise.race([lK(u),...pK(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},b0e=(t,e)=>Promise.allSettled([t,e])});import{on as v0e}from"node:events";import{getDefaultHighWaterMark as S0e}from"node:stream";var Mb,w0e,lI,x0e,yK,uI,gK,$0e,k0e,Fb=y(()=>{MR();xb();zR();Mb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return w0e(e,s),yK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},w0e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},lI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;x0e(e,s,t);let a=t.readableObjectMode&&!o;return yK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},x0e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},yK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=v0e(t,"data",{signal:e.signal,highWaterMark:gK,highWatermark:gK});return $0e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},uI=S0e(!0),gK=uI,$0e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=k0e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ta(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*qf(a)}},k0e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[$b(t,r,!e),wb(t,i,!n,{})].filter(Boolean)});import{setImmediate as E0e}from"node:timers/promises";var _K,A0e,T0e,O0e,dI,bK,fI=y(()=>{pb();en();qR();Fb();Ea();Uf();_K=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=A0e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([T0e(t),d]);return}let f=DR(c,r),p=lI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([O0e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},A0e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Tb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=lI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await pW(a,t,r,o)},T0e=async t=>{await E0e(),t.readableFlowing===null&&t.resume()},O0e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await lb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await ub(r,{maxBuffer:o})):await fb(r,{maxBuffer:o})}catch(a){return bK(Y9({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},dI=async t=>{try{return await t}catch(e){return bK(e)}},bK=({bufferedData:t})=>BH(t)?new Uint8Array(t):t});import{finished as R0e}from"node:stream/promises";var Zf,I0e,P0e,C0e,D0e,N0e,pI,Lb,vK,zb=y(()=>{Zf=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=I0e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],R0e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||D0e(a,e,r,n)}finally{s.abort()}},I0e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&P0e(t,r,n),n},P0e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{C0e(e,r),n.call(t,...i)}},C0e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},D0e=(t,e,r,n)=>{if(!N0e(t,e,r,n))throw t},N0e=(t,e,r,n=!0)=>r.propagating?vK(t)||Lb(t):(r.propagating=!0,pI(r,e)===n?vK(t):Lb(t)),pI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Lb=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",vK=t=>t?.code==="EPIPE"});var SK,mI,hI=y(()=>{fI();zb();SK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>mI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),mI=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=Zf(t,e,l);if(pI(l,e)){await u;return}let[d]=await Promise.all([_K({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 wK,xK,j0e,M0e,gI=y(()=>{Ib();hI();wK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Oa([t,e].filter(Boolean)):void 0,xK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>mI({...j0e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:M0e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),j0e=({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}},M0e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var $K,kK,EK=y(()=>{cl();ns();$K=t=>al(t,"ipc"),kK=(t,e)=>{let r=A_(t);$i({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var AK,TK,OK=y(()=>{Ea();EK();fo();WR();AK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=$K(o),a=uo(e,"ipc"),c=uo(r,"ipc");for await(let l of VR({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(X9(t,i,c),i.push(l)),s&&kK(l,o);return i},TK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as F0e}from"node:events";var RK,L0e,z0e,U0e,IK=y(()=>{ka();lR();eR();cR();lo();_r();fI();OK();dR();gI();hI();GR();zb();RK=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 _=vW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=SK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=xK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],A=AK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),E=L0e(h,t,S),C=z0e(m,S);try{return await Promise.race([Promise.all([{},wW(_),Promise.all(x),w,A,x9(t,d),...E,...C]),g,U0e(t,b),..._9(t,o,f,b),...FZ({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...g9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all(x.map(q=>dI(q))),dI(w),TK(A,O),Promise.allSettled(E),Promise.allSettled(C)])}},L0e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Zf(n,i,r)),z0e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Jn(o,{checkOpen:!1})&&!Vn(o)).map(({type:i,value:o,stream:s=o})=>Zf(s,n,e,{isSameDirection:$n.has(i),stopOnExit:i==="native"}))),U0e=async(t,{signal:e})=>{let[r]=await F0e(t,"error",{signal:e});throw r}});var PK,Vf,wl,Ub=y(()=>{ml();PK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Vf=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=ki();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},wl=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 CK}from"node:stream/promises";var yI,DK,_I,bI,qb,Bb,vI=y(()=>{zb();yI=async t=>{if(t!==void 0)try{await _I(t)}catch{}},DK=async t=>{if(t!==void 0)try{await bI(t)}catch{}},_I=async t=>{await CK(t,{cleanup:!0,readable:!1,writable:!0})},bI=async t=>{await CK(t,{cleanup:!0,readable:!0,writable:!1})},qb=async(t,e)=>{if(await t,e)throw e},Bb=(t,e,r)=>{r&&!Lb(r)?t.destroy(r):e&&t.destroy()}});import{Readable as q0e}from"node:stream";import{callbackify as B0e}from"node:util";var NK,SI,wI,xI,H0e,$I,kI,jK,EI=y(()=>{xa();os();Fb();ml();Ub();vI();NK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||tn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=SI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=wI(a,s),{read:f,onStdoutDataDone:p}=xI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new q0e({read:f,destroy:B0e(kI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return $I({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},SI=(t,e,r)=>{let n=hl(t,e),i=Vf(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},wI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:uI},xI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=ki(),s=Mb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){H0e(this,s,o)},onStdoutDataDone:o}},H0e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},$I=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await bI(t),await n,await yI(i),await e,r.readable&&r.push(null)}catch(o){await yI(i),jK(r,o)}},kI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await wl(r,e)&&(jK(t,n),await qb(e,n))},jK=(t,e)=>{Bb(t,t.readable,e)}});import{Writable as G0e}from"node:stream";import{callbackify as MK}from"node:util";var FK,AI,TI,Z0e,V0e,OI,RI,LK,II=y(()=>{os();Ub();vI();FK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=AI(t,r,e),s=new G0e({...TI(n,t,i),destroy:MK(RI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return OI(n,s),s},AI=(t,e,r)=>{let n=U_(t,e),i=Vf(r,n,"writableFinal"),o=Vf(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},TI=(t,e,r)=>({write:Z0e.bind(void 0,t),final:MK(V0e.bind(void 0,t,e,r))}),Z0e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},V0e=async(t,e,r)=>{await wl(r,e)&&(t.writable&&t.end(),await e)},OI=async(t,e,r)=>{try{await _I(t),e.writable&&e.end()}catch(n){await DK(r),LK(e,n)}},RI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await wl(r,e),await wl(n,e)&&(LK(t,i),await qb(e,i))},LK=(t,e)=>{Bb(t,t.writable,e)}});import{Duplex as W0e}from"node:stream";import{callbackify as K0e}from"node:util";var zK,J0e,UK=y(()=>{xa();EI();II();zK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||tn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=SI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=AI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=wI(c,a),{read:g,onStdoutDataDone:b}=xI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new W0e({read:g,...TI(u,t,d),destroy:K0e(J0e.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 $I({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),OI(u,_,c),_},J0e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([kI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),RI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var PI,Y0e,qK=y(()=>{xa();os();Fb();PI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||tn.has(e),s=hl(t,r),a=Mb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Y0e(a,s,t)},Y0e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var BK,HK=y(()=>{Ub();EI();II();UK();qK();BK=(t,{encoding:e})=>{let r=PK();t.readable=NK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=FK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=zK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=PI.bind(void 0,t,e),t[Symbol.asyncIterator]=PI.bind(void 0,t,e,{})}});var GK,X0e,Q0e,ZK=y(()=>{GK=(t,e)=>{for(let[r,n]of Q0e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},X0e=(async()=>{})().constructor.prototype,Q0e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(X0e,t)])});import{setMaxListeners as e$e}from"node:events";import{spawn as t$e}from"node:child_process";var VK,r$e,n$e,i$e,o$e,s$e,WK=y(()=>{pb();zO();mR();os();hR();KR();zf();gb();MW();qW();Uf();XW();M_();nK();hK();gI();IK();HK();ml();ZK();VK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=r$e(t,e,r),{subprocess:f,promise:p}=i$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=jb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),GK(f,p),Ei.set(f,{options:u,fileDescriptors:d}),f},r$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=R_(t,e,r),{file:a,commandArguments:c,options:l}=nb(t,e,r),u=n$e(l),d=UW(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},n$e=({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}},i$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=t$e(...ib(t,e,r))}catch(m){return jW({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;e$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];YW(c,a,l),rK(c,r,l);let d={},f=ki();c.kill=jZ.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=wK(c,r),BK(c,r),CW(c,r);let p=o$e({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}},o$e=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 RK({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)=>mo(x,e,w)),_=mo(h,e,"all"),S=s$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return bl(S,n,e)},s$e=({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?Lf({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 Ai,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):hb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Hb,a$e,c$e,KK=y(()=>{ao();fo();Hb=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,a$e(n,t[n],i)]));return{...t,...r}},a$e=(t,e,r)=>c$e.has(t)&&At(e)&&At(r)?{...e,...r}:r,c$e=new Set(["env",...NO])});var cs,l$e,u$e,JK=y(()=>{ao();RO();YH();EW();WK();KK();cs=(t,e,r,n)=>{let i=(s,a,c)=>cs(s,a,r,c),o=(...s)=>l$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},l$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(At(o))return i(t,Hb(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=u$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?kW(a,c,l):VK(a,c,l,i)},u$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=KH(e)?JH(e,r):[e,...r],[s,a,c]=y_(...o),l=Hb(Hb(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 YK,XK,QK,d$e,f$e,e3=y(()=>{YK=({file:t,commandArguments:e})=>QK(t,e),XK=({file:t,commandArguments:e})=>({...QK(t,e),isSync:!0}),QK=(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]=d$e(t);return{file:r,commandArguments:n}},d$e=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(f$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},f$e=/ +/g});var t3,r3,p$e,n3,m$e,i3,o3=y(()=>{t3=(t,e,r)=>{t.sync=e(p$e,r),t.s=t.sync},r3=({options:t})=>n3(t),p$e=({options:t})=>({...n3(t),isSync:!0}),n3=t=>({options:{...m$e(t),...t}}),m$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},i3={preferLocal:!0}});var Wat,Je,Kat,Jat,Yat,Xat,Qat,ect,tct,rct,Nr=y(()=>{JK();e3();uR();o3();KR();Wat=cs(()=>({})),Je=cs(()=>({isSync:!0})),Kat=cs(YK),Jat=cs(XK),Yat=cs(v9),Xat=cs(r3,{},i3,t3),{sendMessage:Qat,getOneMessage:ect,getEachMessage:tct,getCancelSignal:rct}=DW()});import{existsSync as Gb,statSync as h$e}from"node:fs";import{dirname as CI,extname as g$e,isAbsolute as s3,join as DI,relative as NI,resolve as Zb,sep as y$e}from"node:path";function Vb(t){return t==="./gradlew"||t==="gradle"}function _$e(t){return(Gb(DI(t,"build.gradle.kts"))||Gb(DI(t,"build.gradle")))&&Gb(DI(t,"gradle.properties"))}function b$e(t,e){let n=NI(t,e).split(y$e).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ls(t,e){return t===":"?`:${e}`:`${t}:${e}`}function v$e(t,e){let r=Zb(t,e),n=r;Gb(r)?h$e(r).isFile()&&(n=CI(r)):g$e(r)!==""&&(n=CI(r));let i=NI(t,n);if(i.startsWith("..")||s3(i))return null;let o=n;for(;;){if(_$e(o))return o;if(Zb(o)===Zb(t))return null;let s=CI(o);if(s===o)return null;let a=NI(t,s);if(a.startsWith("..")||s3(a))return null;o=s}}function Wb(t,e){let r=Zb(t),n=new Map,i=[];for(let o of e){let s=v$e(r,o);if(!s){i.push(o);continue}let a=b$e(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 Kb=y(()=>{"use strict"});import{existsSync as S$e,readFileSync as w$e}from"node:fs";import{join as x$e}from"node:path";function xl(t="."){let e=x$e(t,".cladding","config.yaml");if(!S$e(e))return jI;try{let n=(0,a3.parse)(w$e(e,"utf8"))?.gate;if(!n)return jI;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 $$e){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 jI}}function c3(t,e){let r=[],n=!1;for(let i of t){let o=k$e.exec(i);if(o){n=!0;for(let s of e)r.push(ls(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 a3,$$e,jI,k$e,Jb=y(()=>{"use strict";a3=Et(cr(),1);Kb();$$e=["type","lint","test","coverage"],jI={scope:"feature"};k$e=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as FI,readFileSync as l3,readdirSync as E$e,statSync as A$e}from"node:fs";import{join as Yb}from"node:path";function UI(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Yb(t,e);if(FI(r))try{if(u3.test(l3(r,"utf8")))return!0}catch{}}return!1}function d3(t){try{return FI(t)&&u3.test(l3(t,"utf8"))}catch{return!1}}function f3(t,e=0){if(e>4||!FI(t))return!1;let r;try{r=E$e(t)}catch{return!1}for(let n of r){let i=Yb(t,n),o=!1;try{o=A$e(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(f3(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&d3(i))return!0}return!1}function R$e(t){if(UI(t))return!0;for(let e of T$e)if(d3(Yb(t,e)))return!0;for(let e of O$e)if(f3(Yb(t,e)))return!0;return!1}function p3(t="."){let e=xl(t).coverage;return e||(R$e(t)?"kover":"jacoco")}function m3(t="."){return LI[p3(t)]}function h3(t="."){return MI[p3(t)]}var LI,MI,zI,u3,T$e,O$e,Xb=y(()=>{"use strict";Jb();LI={kover:"koverXmlReport",jacoco:"jacocoTestReport"},MI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},zI=[MI.kover,MI.jacoco],u3=/kover/i;T$e=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],O$e=["buildSrc","build-logic"]});import{existsSync as Qb,readFileSync as g3,readdirSync as y3}from"node:fs";import{join as Ia}from"node:path";function qI(t){return Qb(Ia(t,"gradlew"))?"./gradlew":"gradle"}function I$e(t){let e=qI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[m3(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function P$e(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(g3(Ia(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 D$e(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function M$e(t,e){for(let r of e)if(Qb(Ia(t,r)))return r}function F$e(t,e){try{return y3(t).find(n=>n.endsWith(e))}catch{return}}function z$e(t,e){for(let r of L$e)if(r.configs.some(n=>Qb(Ia(t,n))))return r.gate;return e}function q$e(t){if(U$e.some(e=>Qb(Ia(t,e))))return!0;try{return JSON.parse(g3(Ia(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function B$e(t,e){let r=e.lint?{...e,lint:z$e(t,e.lint)}:{...e};return e.test&&e.coverage&&q$e(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function ht(t="."){for(let e of N$e){let r;for(let o of e.manifests)if(o.startsWith(".")?r=F$e(t,o):r=M$e(t,[o]),r)break;if(!r||e.requiresSource&&!D$e(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?B$e(t,n):n;return{language:e.language,manifest:r,gates:i}}return j$e}var C$e,N$e,j$e,L$e,U$e,kn=y(()=>{"use strict";Xb();C$e=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);N$e=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:I$e},{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:P$e}],j$e={language:"unknown",manifest:"",gates:{}};L$e=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];U$e=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as H$e,readFileSync as G$e}from"node:fs";import{join as Z$e}from"node:path";function Pa(t){return t.code==="ENOENT"}function ev(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=(o||s||`exit ${i}`).slice(0,200);return _3.test(o)||_3.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Lt(t,e,r){return Pa(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function $l(t,e){let r=Z$e(t,"package.json");if(!H$e(r))return!1;try{return!!JSON.parse(G$e(r,"utf8")).scripts?.[e]}catch{return!1}}var _3,En=y(()=>{"use strict";_3=/config (is |file )?not found|no such file|ENOENT|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 V$e(t){let{cwd:e="."}=t,r=ht(e),n=r.gates.arch;if(!n)return[{detector:tv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Pa(i)?[{detector:tv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:ev(i,tv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var tv,Ca,rv=y(()=>{"use strict";Nr();kn();En();tv="ARCHITECTURE_VIOLATION";Ca={name:tv,subprocess:!0,run:V$e}});function W$e(t){let{cwd:e="."}=t,r=ht(e),n=r.gates.secret;if(!n)return[{detector:nv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Pa(i)?[{detector:nv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:ev(i,nv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var nv,Da,iv=y(()=>{"use strict";Nr();kn();En();nv="HARDCODED_SECRET";Da={name:nv,subprocess:!0,run:W$e}});import{existsSync as BI,readdirSync as b3}from"node:fs";import{join as ov}from"node:path";function J$e(t,e){let r=ov(t,e.path);if(!BI(r))return!0;if(e.isDirectory)try{return b3(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Y$e(t){let{cwd:e="."}=t,r=[];for(let i of K$e)J$e(e,i)&&r.push({detector:Wf,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=ov(e,"spec.yaml");if(BI(n)){let i=eke(n),o=i?null:X$e(e);if(i)r.push({detector:Wf,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:Wf,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=Q$e(e);s&&r.push({detector:Wf,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 X$e(t){for(let e of["spec/features","spec/scenarios"]){let r=ov(t,e);if(!BI(r))continue;let n;try{n=b3(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Si(ov(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function Q$e(t){try{return H(t),null}catch(e){return e.message}}function eke(t){let e;try{e=Si(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Wf,K$e,v3,S3=y(()=>{"use strict";qe();a_();Wf="ABSENCE_OF_GOVERNANCE",K$e=[{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}];v3={name:Wf,run:Y$e}});function sv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function HI(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=sv(r)==="while",o=rke.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 '${sv(r)}'`}let n=tke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:sv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${sv(r)}'`:null}function nke(t,e){let r=HI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function w3(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...nke(r,n));return e}var tke,rke,GI=y(()=>{"use strict";tke={event:"when",state:"while",optional:"where",unwanted:"if"},rke=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var bt=y(()=>{"use strict";qe()});function ike(t){let{cwd:e="."}=t;return he(e,av,oke)}function oke(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:av,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 w3(t.features))e.push({detector:av,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var av,x3,$3=y(()=>{"use strict";GI();bt();av="AC_DRIFT";x3={name:av,run:ike}});function Oi(t=".",e){let n=(e??"").trim().toLowerCase()||ht(t).language;return E3[n]??k3}var ske,ake,cke,k3,lke,uke,E3,dke,A3,Na=y(()=>{"use strict";kn();ske=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,ake=/^[ \t]*import\s+([\w.]+)/gm,cke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,k3={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:ske,importStyle:"relative"},lke={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:ake,importStyle:"dotted"},uke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:cke,importStyle:"dotted"},E3={typescript:k3,kotlin:lke,python:uke},dke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],A3=new Set([...Object.values(E3).flatMap(t=>t?.extensions??[]),...dke].map(t=>t.toLowerCase()))});import{existsSync as fke,readFileSync as pke,readdirSync as mke,statSync as hke}from"node:fs";import{join as O3,relative as T3}from"node:path";function gke(t,e){if(!fke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=mke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=O3(i,s),c;try{c=hke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function yke(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function bke(t){return _ke.test(t)}function vke(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Oi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>gke(O3(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=pke(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";qe();Na();R3="AI_HINTS_FORBIDDEN_PATTERN";_ke=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;I3={name:R3,run:vke}});function Ske(t){let{cwd:e="."}=t,r;try{r=H(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:C3,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var C3,D3,N3=y(()=>{"use strict";qe();C3="AC_DUPLICATE_WITHIN_FEATURE";D3={name:C3,run:Ske}});import{createRequire as wke}from"module";import{basename as xke,dirname as VI,normalize as $ke,relative as kke,resolve as Eke,sep as F3}from"path";import*as Ake from"fs";function Tke(t){let e=$ke(t);return e.length>1&&e[e.length-1]===F3&&(e=e.substring(0,e.length-1)),e}function L3(t,e){return t.replace(Oke,e)}function Ike(t){return t==="/"||Rke.test(t)}function ZI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=Eke(t)),(n||o)&&(t=Tke(t)),t===".")return"";let s=t[t.length-1]!==i;return L3(s?t+i:t,i)}function z3(t,e){return e+t}function Pke(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:L3(kke(t,n),e.pathSeparator)+e.pathSeparator+r}}function Cke(t){return t}function Dke(t,e,r){return e+t+r}function Nke(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?Pke(t,e):n?z3:Cke}function jke(t){return function(e,r){r.push(e.substring(t.length)||".")}}function Mke(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function Uke(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?Mke(t):jke(t):n&&n.length?Lke:Fke:zke}function Vke(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?Zke:r&&r.length?n?qke:Bke:n?Hke:Gke}function Jke(t){return t.group?Kke:Wke}function Qke(t){return t.group?Yke:Xke}function rEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?tEe:eEe}function U3(t,e,r){if(r.options.useRealPaths)return nEe(e,r);let n=VI(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=VI(n)}return r.symlinks.set(t,e),i>1}function nEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function cv(t,e,r,n){e(t&&!n?t:null,r)}function fEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?iEe:cEe:n?e?oEe:dEe:i?e?aEe:uEe:e?sEe:lEe}function hEe(t){return t?mEe:pEe}function bEe(t,e){return new Promise((r,n)=>{H3(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function H3(t,e,r){new B3(t,e,r).start()}function vEe(t,e){return new B3(t,e).start()}var j3,Oke,Rke,Fke,Lke,zke,qke,Bke,Hke,Gke,Zke,Wke,Kke,Yke,Xke,eEe,tEe,iEe,oEe,sEe,aEe,cEe,lEe,uEe,dEe,q3,pEe,mEe,gEe,yEe,_Ee,B3,M3,G3,Z3,V3=y(()=>{j3=wke(import.meta.url);Oke=/[\\/]/g;Rke=/^[a-z]:[\\/]$/i;Fke=(t,e)=>{e.push(t||".")},Lke=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},zke=()=>{};qke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},Bke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},Hke=(t,e,r,n)=>{r.files++},Gke=(t,e)=>{e.push(t)},Zke=()=>{};Wke=t=>t,Kke=()=>[""].slice(0,0);Yke=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},Xke=()=>{};eEe=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()&&U3(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},tEe=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()&&U3(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};iEe=t=>t.counts,oEe=t=>t.groups,sEe=t=>t.paths,aEe=t=>t.paths.slice(0,t.options.maxFiles),cEe=(t,e,r)=>(cv(e,r,t.counts,t.options.suppressErrors),null),lEe=(t,e,r)=>(cv(e,r,t.paths,t.options.suppressErrors),null),uEe=(t,e,r)=>(cv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),dEe=(t,e,r)=>(cv(e,r,t.groups,t.options.suppressErrors),null);q3={withFileTypes:!0},pEe=(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||".",q3,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},mEe=(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||".",q3)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};gEe=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))}},yEe=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}},_Ee=class{aborted=!1;abort(){this.aborted=!0}},B3=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=fEe(e,this.isSynchronous),this.root=ZI(t,e),this.state={root:Ike(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new yEe,options:e,queue:new gEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new _Ee,fs:e.fs||Ake},this.joinPath=Nke(this.root,e),this.pushDirectory=Uke(this.root,e),this.pushFile=Vke(e),this.getArray=Jke(e),this.groupFiles=Qke(e),this.resolveSymlink=rEe(e,this.isSynchronous),this.walkDirectory=hEe(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(_=ZI(_,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=xke(_),x=ZI(VI(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};M3=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return bEe(this.root,this.options)}withCallback(t){H3(this.root,this.options,t)}sync(){return vEe(this.root,this.options)}},G3=null;try{j3.resolve("picomatch"),G3=j3("picomatch")}catch{}Z3=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:F3,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 M3(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new M3(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||G3;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 Kf=v((olt,X3)=>{"use strict";var W3="[^\\\\/]",SEe="(?=.)",K3="[^/]",WI="(?:\\/|$)",J3="(?:^|\\/)",KI=`\\.{1,2}${WI}`,wEe="(?!\\.)",xEe=`(?!${J3}${KI})`,$Ee=`(?!\\.{0,1}${WI})`,kEe=`(?!${KI})`,EEe="[^.\\/]",AEe=`${K3}*?`,TEe="/",Y3={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:SEe,QMARK:K3,END_ANCHOR:WI,DOTS_SLASH:KI,NO_DOT:wEe,NO_DOTS:xEe,NO_DOT_SLASH:$Ee,NO_DOTS_SLASH:kEe,QMARK_NO_DOT:EEe,STAR:AEe,START_ANCHOR:J3,SEP:TEe},OEe={...Y3,SLASH_LITERAL:"[\\\\/]",QMARK:W3,STAR:`${W3}*?`,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:"\\"},REe={__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"};X3.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:REe,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?OEe:Y3}}});var Jf=v(jr=>{"use strict";var{REGEX_BACKSLASH:IEe,REGEX_REMOVE_BACKSLASH:PEe,REGEX_SPECIAL_CHARS:CEe,REGEX_SPECIAL_CHARS_GLOBAL:DEe}=Kf();jr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);jr.hasRegexChars=t=>CEe.test(t);jr.isRegexChar=t=>t.length===1&&jr.hasRegexChars(t);jr.escapeRegex=t=>t.replace(DEe,"\\$1");jr.toPosixSlashes=t=>t.replace(IEe,"/");jr.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};jr.removeBackslashes=t=>t.replace(PEe,e=>e==="\\"?"":e);jr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?jr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};jr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};jr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};jr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var sJ=v((alt,oJ)=>{"use strict";var Q3=Jf(),{CHAR_ASTERISK:JI,CHAR_AT:NEe,CHAR_BACKWARD_SLASH:Yf,CHAR_COMMA:jEe,CHAR_DOT:YI,CHAR_EXCLAMATION_MARK:XI,CHAR_FORWARD_SLASH:iJ,CHAR_LEFT_CURLY_BRACE:QI,CHAR_LEFT_PARENTHESES:eP,CHAR_LEFT_SQUARE_BRACKET:MEe,CHAR_PLUS:FEe,CHAR_QUESTION_MARK:eJ,CHAR_RIGHT_CURLY_BRACE:LEe,CHAR_RIGHT_PARENTHESES:tJ,CHAR_RIGHT_SQUARE_BRACKET:zEe}=Kf(),rJ=t=>t===iJ||t===Yf,nJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},UEe=(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,O=0,A,E,C={value:"",depth:0,isGlob:!1},k=()=>l>=n,q=()=>c.charCodeAt(l+1),Q=()=>(A=E,c.charCodeAt(++l));for(;l0&&(I=c.slice(0,u),c=c.slice(u),d-=u),Se&&m===!0&&d>0?(Se=c.slice(0,d),P=c.slice(d)):m===!0?(Se="",P=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&rJ(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),r.unescape===!0&&(P&&(P=Q3.removeBackslashes(P)),Se&&_===!0&&(Se=Q3.removeBackslashes(Se)));let Or={prefix:I,input:t,start:u,base:Se,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Or.maxDepth=0,rJ(E)||s.push(C),Or.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var Xf=Kf(),rn=Jf(),{MAX_LENGTH:lv,POSIX_REGEX_SOURCE:qEe,REGEX_NON_SPECIAL_CHARS:BEe,REGEX_SPECIAL_CHARS_BACKREF:HEe,REPLACEMENTS:aJ}=Xf,GEe=(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=>rn.escapeRegex(i)).join("..")}return r},kl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,cJ=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},ZEe=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},lJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(ZEe(e))return e.replace(/\\(.)/g,"$1")},VEe=t=>{let e=t.map(lJ).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}}}}},WEe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=lJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?rn.escapeRegex(r[0]):`[${r.map(i=>rn.escapeRegex(i)).join("")}]`}*`},KEe=t=>{let e=0,r=t.trim(),n=tP(r);for(;n;)e++,r=n.body.trim(),n=tP(r);return e},JEe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Xf.DEFAULT_MAX_EXTGLOB_RECURSION,n=cJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||VEe(n)))return{risky:!0};for(let i of n){let o=WEe(i);if(o)return{risky:!0,safeOutput:o};if(KEe(i)>r)return{risky:!0}}return{risky:!1}},rP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=aJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(lv,r.maxLength):lv,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=Xf.globChars(r.windows),l=Xf.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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,A=r.dot?"":h,E=r.dot?_:S,C=r.bash===!0?O(r):x;r.capture&&(C=`(${C})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let k={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=rn.removePrefix(t,k),i=t.length;let q=[],Q=[],Se=[],I=o,P,Or=()=>k.index===i-1,se=k.peek=(B=1)=>t[k.index+B],Pe=k.advance=()=>t[++k.index]||"",Vt=()=>t.slice(k.index+1),ar=(B="",ft=0)=>{k.consumed+=B,k.index+=ft},Kt=B=>{k.output+=B.output!=null?B.output:B.value,ar(B.value)},eo=()=>{let B=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),k.start++,B++;return B%2===0?!1:(k.negated=!0,k.start++,!0)},gi=B=>{k[B]++,Se.push(B)},Kr=B=>{k[B]--,Se.pop()},de=B=>{if(I.type==="globstar"){let ft=k.braces>0&&(B.type==="comma"||B.type==="brace"),U=B.extglob===!0||q.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ft&&!U&&(k.output=k.output.slice(0,-I.output.length),I.type="star",I.value="*",I.output=C,k.output+=I.output)}if(q.length&&B.type!=="paren"&&(q[q.length-1].inner+=B.value),(B.value||B.output)&&Kt(B),I&&I.type==="text"&&B.type==="text"){I.output=(I.output||I.value)+B.value,I.value+=B.value;return}B.prev=I,s.push(B),I=B},to=(B,ft)=>{let U={...l[ft],conditions:1,inner:""};U.prev=I,U.parens=k.parens,U.output=k.output,U.startIndex=k.index,U.tokensIndex=s.length;let Te=(r.capture?"(":"")+U.open;gi("parens"),de({type:B,value:ft,output:k.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Te}),q.push(U)},Oue=B=>{let ft=t.slice(B.startIndex,k.index+1),U=t.slice(B.startIndex+2,k.index),Te=JEe(U,r);if((B.type==="plus"||B.type==="star")&&Te.risky){let ct=Te.safeOutput?(B.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,yi=s[B.tokensIndex];yi.type="text",yi.value=ft,yi.output=ct||rn.escapeRegex(ft);for(let _i=B.tokensIndex+1;_i1&&B.inner.includes("/")&&(ct=O(r)),(ct!==C||Or()||/^\)+$/.test(Vt()))&&(lt=B.close=`)$))${ct}`),B.inner.includes("*")&&(jt=Vt())&&/^\.[^\\/.]+$/.test(jt)){let yi=rP(jt,{...e,fastpaths:!1}).output;lt=B.close=`)${yi})${ct})`}B.prev.type==="bos"&&(k.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:lt}),Kr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ft=t.replace(HEe,(U,Te,lt,jt,ct,yi)=>jt==="\\"?(B=!0,U):jt==="?"?Te?Te+jt+(ct?_.repeat(ct.length):""):yi===0?E+(ct?_.repeat(ct.length):""):_.repeat(lt.length):jt==="."?u.repeat(lt.length):jt==="*"?Te?Te+jt+(ct?C:""):C:Te?U:`\\${U}`);return B===!0&&(r.unescape===!0?ft=ft.replace(/\\/g,""):ft=ft.replace(/\\+/g,U=>U.length%2===0?"\\\\":U?"\\":"")),ft===t&&r.contains===!0?(k.output=t,k):(k.output=rn.wrapOutput(ft,k,e),k)}for(;!Or();){if(P=Pe(),P==="\0")continue;if(P==="\\"){let U=se();if(U==="/"&&r.bash!==!0||U==="."||U===";")continue;if(!U){P+="\\",de({type:"text",value:P});continue}let Te=/^\\+/.exec(Vt()),lt=0;if(Te&&Te[0].length>2&&(lt=Te[0].length,k.index+=lt,lt%2!==0&&(P+="\\")),r.unescape===!0?P=Pe():P+=Pe(),k.brackets===0){de({type:"text",value:P});continue}}if(k.brackets>0&&(P!=="]"||I.value==="["||I.value==="[^")){if(r.posix!==!1&&P===":"){let U=I.value.slice(1);if(U.includes("[")&&(I.posix=!0,U.includes(":"))){let Te=I.value.lastIndexOf("["),lt=I.value.slice(0,Te),jt=I.value.slice(Te+2),ct=qEe[jt];if(ct){I.value=lt+ct,k.backtrack=!0,Pe(),!o.output&&s.indexOf(I)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(I.value==="["||I.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&I.value==="["&&(P="^"),I.value+=P,Kt({value:P});continue}if(k.quotes===1&&P!=='"'){P=rn.escapeRegex(P),I.value+=P,Kt({value:P});continue}if(P==='"'){k.quotes=k.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){gi("parens"),de({type:"paren",value:P});continue}if(P===")"){if(k.parens===0&&r.strictBrackets===!0)throw new SyntaxError(kl("opening","("));let U=q[q.length-1];if(U&&k.parens===U.parens+1){Oue(q.pop());continue}de({type:"paren",value:P,output:k.parens?")":"\\)"}),Kr("parens");continue}if(P==="["){if(r.nobracket===!0||!Vt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(kl("closing","]"));P=`\\${P}`}else gi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||I&&I.type==="bracket"&&I.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if(k.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(kl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Kr("brackets");let U=I.value.slice(1);if(I.posix!==!0&&U[0]==="^"&&!U.includes("/")&&(P=`/${P}`),I.value+=P,Kt({value:P}),r.literalBrackets===!1||rn.hasRegexChars(U))continue;let Te=rn.escapeRegex(I.value);if(k.output=k.output.slice(0,-I.value.length),r.literalBrackets===!0){k.output+=Te,I.value=Te;continue}I.value=`(${a}${Te}|${I.value})`,k.output+=I.value;continue}if(P==="{"&&r.nobrace!==!0){gi("braces");let U={type:"brace",value:P,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};Q.push(U),de(U);continue}if(P==="}"){let U=Q[Q.length-1];if(r.nobrace===!0||!U){de({type:"text",value:P,output:P});continue}let Te=")";if(U.dots===!0){let lt=s.slice(),jt=[];for(let ct=lt.length-1;ct>=0&&(s.pop(),lt[ct].type!=="brace");ct--)lt[ct].type!=="dots"&&jt.unshift(lt[ct].value);Te=GEe(jt,r),k.backtrack=!0}if(U.comma!==!0&&U.dots!==!0){let lt=k.output.slice(0,U.outputIndex),jt=k.tokens.slice(U.tokensIndex);U.value=U.output="\\{",P=Te="\\}",k.output=lt;for(let ct of jt)k.output+=ct.output||ct.value}de({type:"brace",value:P,output:Te}),Kr("braces"),Q.pop();continue}if(P==="|"){q.length>0&&q[q.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let U=P,Te=Q[Q.length-1];Te&&Se[Se.length-1]==="braces"&&(Te.comma=!0,U="|"),de({type:"comma",value:P,output:U});continue}if(P==="/"){if(I.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",s.pop(),I=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if(k.braces>0&&I.type==="dot"){I.value==="."&&(I.output=u);let U=Q[Q.length-1];I.type="dots",I.output+=P,I.value+=P,U.dots=!0;continue}if(k.braces+k.parens===0&&I.type!=="bos"&&I.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(I&&I.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){to("qmark",P);continue}if(I&&I.type==="paren"){let Te=se(),lt=P;(I.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Vt()))&&(lt=`\\${P}`),de({type:"text",value:P,output:lt});continue}if(r.dot!==!0&&(I.type==="slash"||I.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){to("negate",P);continue}if(r.nonegate!==!0&&k.index===0){eo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){to("plus",P);continue}if(I&&I.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(I&&(I.type==="bracket"||I.type==="paren"||I.type==="brace")||k.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let U=BEe.exec(Vt());U&&(P+=U[0],k.index+=U[0].length),de({type:"text",value:P});continue}if(I&&(I.type==="globstar"||I.star===!0)){I.type="star",I.star=!0,I.value+=P,I.output=C,k.backtrack=!0,k.globstar=!0,ar(P);continue}let B=Vt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){to("star",P);continue}if(I.type==="star"){if(r.noglobstar===!0){ar(P);continue}let U=I.prev,Te=U.prev,lt=U.type==="slash"||U.type==="bos",jt=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!lt||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let ct=k.braces>0&&(U.type==="comma"||U.type==="brace"),yi=q.length&&(U.type==="pipe"||U.type==="paren");if(!lt&&U.type!=="paren"&&!ct&&!yi){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let _i=t[k.index+4];if(_i&&_i!=="/")break;B=B.slice(3),ar("/**",3)}if(U.type==="bos"&&Or()){I.type="globstar",I.value+=P,I.output=O(r),k.output=I.output,k.globstar=!0,ar(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&!jt&&Or()){k.output=k.output.slice(0,-(U.output+I.output).length),U.output=`(?:${U.output}`,I.type="globstar",I.output=O(r)+(r.strictSlashes?")":"|$)"),I.value+=P,k.globstar=!0,k.output+=U.output+I.output,ar(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&B[0]==="/"){let _i=B[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(U.output+I.output).length),U.output=`(?:${U.output}`,I.type="globstar",I.output=`${O(r)}${f}|${f}${_i})`,I.value+=P,k.output+=U.output+I.output,k.globstar=!0,ar(P+Pe()),de({type:"slash",value:"/",output:""});continue}if(U.type==="bos"&&B[0]==="/"){I.type="globstar",I.value+=P,I.output=`(?:^|${f}|${O(r)}${f})`,k.output=I.output,k.globstar=!0,ar(P+Pe()),de({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-I.output.length),I.type="globstar",I.output=O(r),I.value+=P,k.output+=I.output,k.globstar=!0,ar(P);continue}let ft={type:"star",value:P,output:C};if(r.bash===!0){ft.output=".*?",(I.type==="bos"||I.type==="slash")&&(ft.output=A+ft.output),de(ft);continue}if(I&&(I.type==="bracket"||I.type==="paren")&&r.regex===!0){ft.output=P,de(ft);continue}(k.index===k.start||I.type==="slash"||I.type==="dot")&&(I.type==="dot"?(k.output+=g,I.output+=g):r.dot===!0?(k.output+=b,I.output+=b):(k.output+=A,I.output+=A),se()!=="*"&&(k.output+=p,I.output+=p)),de(ft)}for(;k.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(kl("closing","]"));k.output=rn.escapeLast(k.output,"["),Kr("brackets")}for(;k.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(kl("closing",")"));k.output=rn.escapeLast(k.output,"("),Kr("parens")}for(;k.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(kl("closing","}"));k.output=rn.escapeLast(k.output,"{"),Kr("braces")}if(r.strictSlashes!==!0&&(I.type==="star"||I.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),k.backtrack===!0){k.output="";for(let B of k.tokens)k.output+=B.output!=null?B.output:B.value,B.suffix&&(k.output+=B.suffix)}return k};rP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(lv,r.maxLength):lv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=aJ[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}=Xf.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 E=/^(.*?)\.(\w+)$/.exec(A);if(!E)return;let C=x(E[1]);return C?C+o+E[2]:void 0}}},w=rn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};uJ.exports=rP});var mJ=v((llt,pJ)=>{"use strict";var YEe=sJ(),nP=dJ(),fJ=Jf(),XEe=Kf(),QEe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=QEe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?fJ.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(fJ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):nP(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>YEe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=nP.fastpaths(t,e)),i.output||(i=nP(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=XEe;pJ.exports=Tt});var _J=v((ult,yJ)=>{"use strict";var hJ=mJ(),eAe=Jf();function gJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:eAe.isWindows()}),hJ(t,e,r)}Object.assign(gJ,hJ);yJ.exports=gJ});import{readdir as tAe,readdirSync as rAe,realpath as nAe,realpathSync as iAe,stat as oAe,statSync as sAe}from"fs";import{isAbsolute as aAe,posix as ja,resolve as cAe}from"path";import{fileURLToPath as lAe}from"url";function fAe(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]===".."&&dAe.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=>ja.relative(t,n)||".":n=>ja.relative(t,`${e}/${n}`)||"."}function hAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=ja.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function wJ(t){var e;let r=El.default.scan(t,gAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function wAe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=El.default.scan(t);return r.isGlob||r.negated}function Qf(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function xJ(t){return typeof t=="string"?[t]:t??[]}function iP(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=SAe(o);s=aAe(s.replace($Ae,""))?ja.relative(a,s):ja.normalize(s);let c=(i=xAe.exec(s))===null||i===void 0?void 0:i[0],l=wJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?ja.join(o,...d):o}return s}function kAe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(iP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(iP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(iP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function EAe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=kAe(t,e,n);t.debug&&Qf("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(vJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,El.default)(i.match,f),m=(0,El.default)(i.ignore,f),h=fAe(i.match,f),g=bJ(r,d,o),b=o?g:bJ(r,d,!0),_=(w,O)=>{let A=b(O,!0);return A!=="."&&!h(A)||m(A)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new Z3({filters:[a?(w,O)=>{let A=g(w,O),E=p(A)&&!m(A);return E&&Qf(`matched ${A}`),E}:(w,O)=>{let A=g(w,O);return p(A)&&!m(A)}],exclude:a?(w,O)=>{let A=_(w,O);return Qf(`${A?"skipped":"crawling"} ${O}`),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&&Qf("internal properties:",{...n,root:d}),[x,r!==d&&!o&&hAe(r,d)]}function AAe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function OAe(t){let e={...TAe,...t};return e.cwd=(e.cwd instanceof URL?lAe(e.cwd):cAe(e.cwd)).replace(vJ,"/"),e.ignore=xJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||tAe,readdirSync:e.fs.readdirSync||rAe,realpath:e.fs.realpath||nAe,realpathSync:e.fs.realpathSync||iAe,stat:e.fs.stat||oAe,statSync:e.fs.statSync||sAe}),e.debug&&Qf("globbing with options:",e),e}function RAe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=uAe(t)||typeof t=="string",i=xJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=OAe(n?e:t);return i.length>0?EAe(o,i):[]}function us(t,e){let[r,n]=RAe(t,e);return r?AAe(r.sync(),n):[]}var El,uAe,vJ,SJ,dAe,pAe,mAe,gAe,yAe,_Ae,bAe,vAe,SAe,xAe,$Ae,TAe,ep=y(()=>{V3();El=Et(_J(),1),uAe=Array.isArray,vJ=/\\/g,SJ=process.platform==="win32",dAe=/^(\/?\.\.)+$/;pAe=/^[A-Z]:\/$/i,mAe=SJ?t=>pAe.test(t):t=>t==="/";gAe={parts:!0};yAe=/(?t.replace(yAe,"\\$&"),vAe=t=>t.replace(_Ae,"\\$&"),SAe=SJ?vAe:bAe;xAe=/^(\/?\.\.)+/,$Ae=/\\(?=[()[\]{}!*+?@|])/g;TAe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as tp,readFileSync as IAe,readdirSync as PAe,statSync as $J}from"node:fs";import{join as Ma}from"node:path";function CAe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Oi(e,n),o=[],{layers:s,forbiddenImports:a}=oP(r);return(s.size>0||a.length>0)&&!tp(Ma(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&&(DAe(e,i,s,o),NAe(e,i,s,o)),a.length>0&&jAe(e,i,a,o),o)}function oP(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 DAe(t,e,r,n){let i=e.mainRoot,o=Ma(t,i);if(tp(o))for(let s of PAe(o)){let a=Ma(o,s);$J(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 NAe(t,e,r,n){let i=e.mainRoot,o=Ma(t,i);if(tp(o))for(let s of r){let a=Ma(o,s);tp(a)&&$J(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 jAe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ma(t,i,s.from);if(!tp(a))continue;let c=us([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ma(a,l),d;try{d=IAe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];MAe(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 MAe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var rp,kJ,sP=y(()=>{"use strict";ep();qe();Na();rp="ARCHITECTURE_FROM_SPEC";kJ={name:rp,run:CAe}});import{existsSync as FAe,readFileSync as LAe}from"node:fs";import{join as zAe}from"node:path";function UAe(t){let{cwd:e="."}=t,r=zAe(e,"spec/capabilities.yaml");if(!FAe(r))return[];let n;try{let c=LAe(r,"utf8"),l=EJ.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=H(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:uv,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:uv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:uv,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var EJ,uv,AJ,TJ=y(()=>{"use strict";EJ=Et(cr(),1);qe();uv="CAPABILITIES_FEATURE_MAPPING";AJ={name:uv,run:UAe}});import{existsSync as qAe,readFileSync as BAe}from"node:fs";import{join as HAe}from"node:path";function GAe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function ZAe(t){let{cwd:e="."}=t;return he(e,aP,r=>VAe(r,e))}function VAe(t,e){let r=Oi(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=HAe(e,o);if(!qAe(s))continue;let a=BAe(s,"utf8");GAe(a)||n.push({detector:aP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var aP,OJ,RJ=y(()=>{"use strict";Na();bt();aP="CONVENTION_DRIFT";OJ={name:aP,run:ZAe}});import{existsSync as cP,readFileSync as IJ}from"node:fs";import{join as dv}from"node:path";function WAe(t){return JSON.parse(t).total?.lines?.pct??0}function PJ(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function YAe(t,e){if(!Vb(ht(t).gates.coverage?.cmd))return null;let r;try{r=Wb(t,e)}catch(c){return[{detector:ho,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=zI.find(d=>cP(dv(c.dir,d)));if(!l){s.push(c.path);continue}let u=PJ(IJ(dv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:ho,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=CJ(n,i);return a0?[{detector:ho,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function XAe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=YAe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Oi(e,r),i=ht(e).language==="kotlin"?zI.find(a=>cP(dv(e,a)))??h3(e):n.coverageSummary,o=dv(e,i);if(!cP(o))return[{detector:ho,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=IJ(o,"utf8");s=n.coverageFormat==="jacoco-xml"?KAe(a):n.coverageFormat==="cobertura-xml"?JAe(a):WAe(a)}catch(a){return[{detector:ho,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:ho,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=fv?[]:[{detector:ho,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${fv}%`}]}var ho,fv,DJ,NJ=y(()=>{"use strict";qe();Xb();Na();Kb();kn();ho="COVERAGE_DROP",fv=70;DJ={name:ho,run:XAe}});import{existsSync as QAe}from"node:fs";import{join as eTe}from"node:path";function tTe(t){let{cwd:e="."}=t;return he(e,pv,r=>rTe(r,e))}function rTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?QAe(eTe(e,r.path))?[]:[{detector:pv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:pv,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var pv,jJ,MJ=y(()=>{"use strict";bt();pv="DELIVERABLE_INTEGRITY";jJ={name:pv,run:tTe}});function nTe(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:mv,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 iTe(t){let e=nTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:mv,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 oTe(t){let{cwd:e="."}=t;return he(e,mv,r=>iTe(r))}var mv,FJ,LJ=y(()=>{"use strict";bt();mv="SMOKE_PROBE_DEMAND";FJ={name:mv,run:oTe}});function sTe(t){let{cwd:e="."}=t;return he(e,hv,r=>aTe(r,e))}function aTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ts(e);if(n===null)return[{detector:hv,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=p_(n,e,o);s.state!=="fresh"&&i.push({detector:hv,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 hv,gv,lP=y(()=>{"use strict";rl();bt();hv="STALE_ATTESTATION";gv={name:hv,run:sTe}});function cTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return lTe(r)}function lTe(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:zJ,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 zJ,yv,uP=y(()=>{"use strict";qe();zJ="DEPENDENCY_CYCLE";yv={name:zJ,run:cTe}});import{appendFileSync as uTe,existsSync as UJ,mkdirSync as dTe,readFileSync as fTe}from"node:fs";import{dirname as pTe,join as mTe}from"node:path";function qJ(t){return mTe(t,hTe,gTe)}function BJ(t){return dP.add(t),()=>dP.delete(t)}function Fa(t,e){let r=qJ(t),n=pTe(r);UJ(n)||dTe(n,{recursive:!0}),uTe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of dP)try{i(t,e)}catch{}}function An(t){let e=qJ(t);if(!UJ(e))return[];let r=fTe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var hTe,gTe,dP,Yn=y(()=>{"use strict";hTe=".cladding",gTe="audit.log.jsonl";dP=new Set});import{existsSync as yTe}from"node:fs";import{join as _Te}from"node:path";function bTe(t){let{cwd:e="."}=t,r=An(e);if(r.length===0)return[{detector:fP,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&&(yTe(_Te(e,i.artifact))||n.push({detector:fP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var fP,HJ,GJ=y(()=>{"use strict";Yn();fP="EVIDENCE_MISMATCH";HJ={name:fP,run:bTe}});import{existsSync as vTe,readFileSync as STe}from"node:fs";import{join as wTe}from"node:path";function xTe(t){let e=wTe(t,KJ);if(!vTe(e))return null;try{let n=((0,WJ.parse)(STe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*VJ(t,e){for(let r of t??[])r.startsWith(ZJ)&&(yield{ref:r,name:r.slice(ZJ.length),field:e})}function $Te(t){let{cwd:e="."}=t,r=xTe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:pP,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=[...VJ(s.evidence_refs,"evidence_refs"),...VJ(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:pP,severity:"warn",path:KJ,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var WJ,pP,ZJ,KJ,JJ,YJ=y(()=>{"use strict";WJ=Et(cr(),1);qe();pP="FIXTURE_REFERENCE_INVALID",ZJ="fixture:",KJ="conformance/fixtures.yaml";JJ={name:pP,run:$Te}});import{existsSync as Al,readFileSync as mP}from"node:fs";import{join as La}from"node:path";function kTe(t){return us(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function np(t){if(!Al(t))return null;try{return JSON.parse(mP(t,"utf8"))}catch{return null}}function ETe(t,e){let r=La(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(mP(r,"utf8"))}catch(c){e.push({detector:go,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:go,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=kTe(t);s!==a&&e.push({detector:go,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function ATe(t,e){for(let r of XJ){let n=La(t,r.path);if(!Al(n))continue;let i=np(n);if(!i){e.push({detector:go,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:go,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function TTe(t,e){let r=np(La(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of XJ){let s=La(t,o.path);if(!Al(s))continue;let a=np(s);a?.version&&a.version!==n&&e.push({detector:go,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=La(t,".claude-plugin","marketplace.json");if(Al(i)){let o=np(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:go,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 OTe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function RTe(t,e){let r=La(t,"src","cli","clad.ts"),n=La(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Al(r)||!Al(n))return;let i=OTe(mP(r,"utf8"));if(i.length===0)return;let s=np(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:go,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 ITe(t){let{cwd:e="."}=t,r=[];return ETe(e,r),RTe(e,r),ATe(e,r),TTe(e,r),r}var go,XJ,QJ,e8=y(()=>{"use strict";ep();go="HARNESS_INTEGRITY",XJ=[{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"]}];QJ={name:go,run:ITe}});import{existsSync as PTe,readFileSync as CTe}from"node:fs";import{join as DTe}from"node:path";function jTe(t){let{cwd:e="."}=t;return he(e,_v,r=>FTe(r,e))}function MTe(t){let e=DTe(t,"spec/capabilities.yaml");if(!PTe(e))return!1;try{let r=t8.default.parse(CTe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function FTe(t,e){let r=t.features.length;if(r{"use strict";t8=Et(cr(),1);bt();_v="HOLLOW_GOVERNANCE",NTe=8;r8={name:_v,run:jTe}});import{existsSync as i8,readFileSync as o8}from"node:fs";import{join as s8}from"node:path";function a8(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 UTe(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 qTe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function BTe(t){let e=s8(t,"README.md"),r=s8(t,"docs","dogfood","matrix.md");if(!i8(e)||!i8(r))return[];let n=a8(o8(e,"utf8"),LTe),i=a8(o8(r,"utf8"),zTe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=qTe(a);if(c===null)continue;let l=i[s]??"not-run",u=UTe(l);u!==null&&c>u&&o.push({detector:c8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function HTe(t){let{cwd:e="."}=t;return BTe(e)}var c8,LTe,zTe,l8,u8=y(()=>{"use strict";c8="HOST_CLAIM_DRIFT",LTe=//,zTe=//;l8={name:c8,run:HTe}});function GTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return d8(r.features.map(i=>i.id),"feature","spec/features/",n),d8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function d8(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:f8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var f8,p8,m8=y(()=>{"use strict";qe();f8="ID_COLLISION";p8={name:f8,run:GTe}});import{existsSync as ip,readFileSync as hP,readdirSync as gP,statSync as ZTe,writeFileSync as g8}from"node:fs";import{join as yo}from"node:path";function h8(t){if(!ip(t))return 0;try{return gP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function VTe(t){if(!ip(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=gP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=yo(n,o),a;try{a=ZTe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function WTe(t){let e=yo(t,"spec","capabilities.yaml");if(!ip(e))return 0;try{let r=bv.default.parse(hP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ds(t="."){let e=h8(yo(t,"spec","features")),r=h8(yo(t,"spec","scenarios")),n=WTe(t),i=VTe(yo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Tl(t,e){let r=yo(t,"spec.yaml");if(!ip(r))return;let n=hP(r,"utf8"),i=KTe(n,e);i!==n&&g8(r,i)}function KTe(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 @@ -269,51 +269,51 @@ ${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 za(t="."){let e=_o(t,"spec","features");if(!ip(e))return!1;let r=[];for(let i of gP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,bv.parse)(hP(_o(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 za(t="."){let e=yo(t,"spec","features");if(!ip(e))return!1;let r=[];for(let i of gP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,bv.parse)(hP(yo(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 m8(_o(t,"spec","index.yaml"),n,"utf8"),!0}var bv,op=y(()=>{"use strict";bv=Et(cr(),1)});import{existsSync as h8,readFileSync as g8,readdirSync as KTe}from"node:fs";import{join as yP}from"node:path";function JTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=ds(e),i=r.inventory;if(!i){let s=y8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return _P(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[..._P(e),{detector:sp,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 y8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:sp,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(..._P(e)),o}function _P(t){let e=yP(t,"spec","index.yaml"),r=yP(t,"spec","features");if(!h8(e)||!h8(r))return[];let n=new Map;try{for(let l of g8(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 KTe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=g8(yP(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:sp,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:sp,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 sp,y8,_8,b8=y(()=>{"use strict";op();qe();sp="INVENTORY_DRIFT",y8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];_8={name:sp,run:JTe}});import{existsSync as YTe,readFileSync as XTe}from"node:fs";import{join as QTe}from"node:path";function tOe(t){let{cwd:e="."}=t,r=QTe(e,"src","spec","schema.json"),n=[];if(YTe(r)){let i;try{i=JSON.parse(XTe(r,"utf8"))}catch(o){n.push({detector:ap,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of eOe)i.required?.includes(o)||n.push({detector:ap,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:ap,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==v8&&n.push({detector:ap,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${v8}'`})}catch{}return n}var ap,eOe,v8,S8,w8=y(()=>{"use strict";qe();ap="META_INTEGRITY",eOe=["schema","project","features"],v8="0.1";S8={name:ap,run:tOe}});function rOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return x8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),x8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function x8(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:$8,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 $8,k8,E8=y(()=>{"use strict";qe();$8="SLUG_CONFLICT";k8={name:$8,run:rOe}});function Ol(t){return t==="planned"||t==="in_progress"}var vv=y(()=>{"use strict"});import{existsSync as nOe}from"node:fs";import{join as iOe}from"node:path";function oOe(t){let{cwd:e="."}=t;return he(e,Sv,r=>sOe(r,e))}function sOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=iOe(e,i);nOe(o)||r.push(aOe(n.id,i,n.status))}return r}function aOe(t,e,r){return Ol(r)?{detector:Sv,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:Sv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Sv,wv,bP=y(()=>{"use strict";vv();bt();Sv="MISSING_IMPLEMENTATION";wv={name:Sv,run:oOe}});function cOe(t){let{cwd:e="."}=t;return he(e,vP,lOe)}function lOe(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:vP,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 vP,xv,SP=y(()=>{"use strict";bt();vP="MISSING_TESTS";xv={name:vP,run:cOe}});import{existsSync as uOe,readFileSync as dOe}from"node:fs";import{join as A8}from"node:path";function T8(t){if(uOe(t))try{return JSON.parse(dOe(t,"utf8"))}catch{return}}function hOe(t){let{cwd:e="."}=t,r=T8(A8(e,fOe)),n=T8(A8(e,pOe));if(!r||!n)return[{detector:wP,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>mOe&&i.push({detector:wP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var wP,fOe,pOe,mOe,O8,R8=y(()=>{"use strict";wP="PERFORMANCE_DRIFT",fOe="perf/baseline.json",pOe="perf/current.json",mOe=10;O8={name:wP,run:hOe}});import{existsSync as gOe}from"node:fs";import{join as yOe}from"node:path";function bOe(t){let{cwd:e="."}=t;return he(e,xP,r=>SOe(r,e))}function vOe(t,e){return(t.modules??[]).some(r=>gOe(yOe(e,r)))}function SOe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||vOe(s,e)||r.push(s.id);let n=_Oe;if(r.length<=n)return[];let i=r.slice(0,I8).join(", "),o=r.length>I8?", \u2026":"";return[{detector:xP,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 xP,_Oe,I8,P8,C8=y(()=>{"use strict";bt();xP="PLANNED_BACKLOG",_Oe=5,I8=8;P8={name:xP,run:bOe}});import{existsSync as wOe,readFileSync as xOe}from"node:fs";import{join as $Oe}from"node:path";function AOe(t){let{cwd:e="."}=t;return he(e,$P,r=>TOe(r,e))}function TOe(t,e){if(t.features.lengthn.includes(i))?[{detector:$P,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 $P,kOe,EOe,D8,N8=y(()=>{"use strict";bt();$P="PROJECT_CONTEXT_DRIFT",kOe=8,EOe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];D8={name:$P,run:AOe}});function j8(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:$v,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function OOe(t){let{cwd:e="."}=t;return he(e,$v,ROe)}function ROe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...j8(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:$v,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...j8(e,n.features,`scenario ${n.id}.features`));return r}var $v,kv,kP=y(()=>{"use strict";bt();$v="REFERENCE_INTEGRITY";kv={name:$v,run:OOe}});function cp(t=""){return new RegExp(IOe,t)}var IOe,EP=y(()=>{"use strict";IOe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as POe,readdirSync as COe,readFileSync as DOe,statSync as NOe,writeFileSync as jOe}from"node:fs";import{dirname as MOe,join as lp,normalize as FOe,relative as LOe}from"node:path";function HOe(t){let e=[];for(let r of t.matchAll(BOe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(cp("g"))??[])e.push(n);return[...new Set(e)].sort()}function GOe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function M8(t){return t.split("\\").join("/")}function ZOe(t){return zOe.some(e=>t===e||t.startsWith(`${e}/`))}function VOe(t){let e=lp(t,"docs");if(!POe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=COe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=lp(i,s),c;try{c=NOe(a)}catch{continue}let l=M8(LOe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function WOe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=FOe(lp(MOe(t),e));return M8(r)}function up(t="."){let e=[];for(let r of VOe(t)){let n;try{n=DOe(lp(t,r),"utf8")}catch{continue}let i=GOe(n),o=HOe(i);if(ZOe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(UOe)?[]:i.match(cp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(qOe)){let d=WOe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function F8(t="."){let e=up(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 jOe(lp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return g8(yo(t,"spec","index.yaml"),n,"utf8"),!0}var bv,op=y(()=>{"use strict";bv=Et(cr(),1)});import{existsSync as y8,readFileSync as _8,readdirSync as JTe}from"node:fs";import{join as yP}from"node:path";function YTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=ds(e),i=r.inventory;if(!i){let s=b8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return _P(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[..._P(e),{detector:sp,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 b8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:sp,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(..._P(e)),o}function _P(t){let e=yP(t,"spec","index.yaml"),r=yP(t,"spec","features");if(!y8(e)||!y8(r))return[];let n=new Map;try{for(let l of _8(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 JTe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=_8(yP(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:sp,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:sp,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 sp,b8,v8,S8=y(()=>{"use strict";op();qe();sp="INVENTORY_DRIFT",b8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];v8={name:sp,run:YTe}});import{existsSync as XTe,readFileSync as QTe}from"node:fs";import{join as eOe}from"node:path";function rOe(t){let{cwd:e="."}=t,r=eOe(e,"src","spec","schema.json"),n=[];if(XTe(r)){let i;try{i=JSON.parse(QTe(r,"utf8"))}catch(o){n.push({detector:ap,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of tOe)i.required?.includes(o)||n.push({detector:ap,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:ap,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==w8&&n.push({detector:ap,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${w8}'`})}catch{}return n}var ap,tOe,w8,x8,$8=y(()=>{"use strict";qe();ap="META_INTEGRITY",tOe=["schema","project","features"],w8="0.1";x8={name:ap,run:rOe}});function nOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return k8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),k8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function k8(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:E8,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 E8,A8,T8=y(()=>{"use strict";qe();E8="SLUG_CONFLICT";A8={name:E8,run:nOe}});function Ol(t){return t==="planned"||t==="in_progress"}var vv=y(()=>{"use strict"});import{existsSync as iOe}from"node:fs";import{join as oOe}from"node:path";function sOe(t){let{cwd:e="."}=t;return he(e,Sv,r=>aOe(r,e))}function aOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=oOe(e,i);iOe(o)||r.push(cOe(n.id,i,n.status))}return r}function cOe(t,e,r){return Ol(r)?{detector:Sv,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:Sv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Sv,wv,bP=y(()=>{"use strict";vv();bt();Sv="MISSING_IMPLEMENTATION";wv={name:Sv,run:sOe}});function lOe(t){let{cwd:e="."}=t;return he(e,vP,uOe)}function uOe(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:vP,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 vP,xv,SP=y(()=>{"use strict";bt();vP="MISSING_TESTS";xv={name:vP,run:lOe}});import{existsSync as dOe,readFileSync as fOe}from"node:fs";import{join as O8}from"node:path";function R8(t){if(dOe(t))try{return JSON.parse(fOe(t,"utf8"))}catch{return}}function gOe(t){let{cwd:e="."}=t,r=R8(O8(e,pOe)),n=R8(O8(e,mOe));if(!r||!n)return[{detector:wP,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>hOe&&i.push({detector:wP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var wP,pOe,mOe,hOe,I8,P8=y(()=>{"use strict";wP="PERFORMANCE_DRIFT",pOe="perf/baseline.json",mOe="perf/current.json",hOe=10;I8={name:wP,run:gOe}});import{existsSync as yOe}from"node:fs";import{join as _Oe}from"node:path";function vOe(t){let{cwd:e="."}=t;return he(e,xP,r=>wOe(r,e))}function SOe(t,e){return(t.modules??[]).some(r=>yOe(_Oe(e,r)))}function wOe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||SOe(s,e)||r.push(s.id);let n=bOe;if(r.length<=n)return[];let i=r.slice(0,C8).join(", "),o=r.length>C8?", \u2026":"";return[{detector:xP,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 xP,bOe,C8,D8,N8=y(()=>{"use strict";bt();xP="PLANNED_BACKLOG",bOe=5,C8=8;D8={name:xP,run:vOe}});import{existsSync as xOe,readFileSync as $Oe}from"node:fs";import{join as kOe}from"node:path";function TOe(t){let{cwd:e="."}=t;return he(e,$P,r=>OOe(r,e))}function OOe(t,e){if(t.features.lengthn.includes(i))?[{detector:$P,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 $P,EOe,AOe,j8,M8=y(()=>{"use strict";bt();$P="PROJECT_CONTEXT_DRIFT",EOe=8,AOe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];j8={name:$P,run:TOe}});function F8(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:$v,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function ROe(t){let{cwd:e="."}=t;return he(e,$v,IOe)}function IOe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...F8(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:$v,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...F8(e,n.features,`scenario ${n.id}.features`));return r}var $v,kv,kP=y(()=>{"use strict";bt();$v="REFERENCE_INTEGRITY";kv={name:$v,run:ROe}});function cp(t=""){return new RegExp(POe,t)}var POe,EP=y(()=>{"use strict";POe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as COe,readdirSync as DOe,readFileSync as NOe,statSync as jOe,writeFileSync as MOe}from"node:fs";import{dirname as FOe,join as lp,normalize as LOe,relative as zOe}from"node:path";function GOe(t){let e=[];for(let r of t.matchAll(HOe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(cp("g"))??[])e.push(n);return[...new Set(e)].sort()}function ZOe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function L8(t){return t.split("\\").join("/")}function VOe(t){return UOe.some(e=>t===e||t.startsWith(`${e}/`))}function WOe(t){let e=lp(t,"docs");if(!COe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=DOe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=lp(i,s),c;try{c=jOe(a)}catch{continue}let l=L8(zOe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function KOe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=LOe(lp(FOe(t),e));return L8(r)}function up(t="."){let e=[];for(let r of WOe(t)){let n;try{n=NOe(lp(t,r),"utf8")}catch{continue}let i=ZOe(n),o=GOe(i);if(VOe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(qOe)?[]:i.match(cp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(BOe)){let d=KOe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function z8(t="."){let e=up(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 MOe(lp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var zOe,UOe,qOe,BOe,Ev=y(()=>{"use strict";EP();zOe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],UOe="clad-doc-links: ignore",qOe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,BOe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as KOe}from"node:fs";import{join as JOe}from"node:path";function YOe(t){let{cwd:e="."}=t;return he(e,Av,r=>XOe(r,e))}function XOe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of up(e).docs){for(let o of i.doc_links)KOe(JOe(e,o))||n.push({detector:Av,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:Av,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 Av,Tv,AP=y(()=>{"use strict";Ev();bt();Av="DOC_LINK_INTEGRITY";Tv={name:Av,run:YOe}});function eRe(t){let{cwd:e="."}=t;return he(e,dp,r=>tRe(r))}function tRe(t){let e=[],r=t.features.length,n=t.scenarios??[];r>=QOe&&n.length===0&&e.push({detector:dp,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 o of n)(o.features??[]).length===0&&e.push({detector:dp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let i=new Map(t.features.filter(o=>typeof o.slug=="string"&&o.slug.length>0).map(o=>[o.slug,o.id]));for(let o of n){if(!o.flow)continue;let s=new Set(o.features??[]),a=new Map;for(let c of o.flow.matchAll(/\(([^)]+)\)/g))for(let l of c[1].split(/[,/·]/)){let u=l.trim(),d=i.get(u);d&&!s.has(d)&&a.set(u,d)}if(a.size>0){let c=[...a].map(([l,u])=>`${l} (${u})`).join(", ");e.push({detector:dp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} flow references ${c} but features[] does not bind ${a.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var dp,QOe,L8,z8=y(()=>{"use strict";bt();dp="SCENARIO_COVERAGE",QOe=8;L8={name:dp,run:eRe}});import{createHash as rRe}from"node:crypto";function nRe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function fp(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??U8),sample:nRe(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(U8),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function pp(t){return(t.features??[]).filter(e=>e.status==="done").length}function iRe(t,e){return e<=0?!1:e>=1?!0:parseInt(rRe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var U8,Ov=y(()=>{"use strict";U8=["unwanted"]});import{existsSync as oRe,readdirSync as sRe}from"node:fs";import{join as B8}from"node:path";import H8 from"node:process";function aRe(t){let e=!1,r=n=>{for(let i of sRe(n,{withFileTypes:!0})){if(e)return;let o=B8(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 TP(t={}){let{cwd:e="."}=t,r=B8(e,fs);if(!oRe(r)||!aRe(r))return{stage:Rv,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${fs}/ \u2014 skipped`};let n=ht(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Rv,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o=Je(i.cmd,[...i.args,fs],{cwd:e,reject:!1}),s=Lt(Rv,i.cmd,o);return s||Yt(Rv,o)}var Rv,fs,cRe,OP=y(()=>{"use strict";jr();En();An();Rv="stage_2.3",fs="tests/oracle";cRe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${H8.argv[1]}`;if(cRe){let t=TP();console.log(JSON.stringify(t)),H8.exit(t.exitCode)}});import{existsSync as lRe}from"node:fs";import{join as uRe}from"node:path";function dRe(t){let{cwd:e="."}=t;return he(e,Qn,r=>fRe(r,e))}function fRe(t,e){let r=[],n=fp(t.project,pp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?Tn(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(mp(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:Qn,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${fs}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!lRe(uRe(e,f))){r.push({detector:Qn,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${fs}/`)||r.push({detector:Qn,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${fs}/ \u2014 stage_2.3 only runs ${fs}/, 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:Qn,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:Qn,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:Qn,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:Qn,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:Qn,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:Qn,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 Qn,G8,Z8=y(()=>{"use strict";Xn();Ov();OP();bt();Qn="SPEC_CONFORMANCE";G8={name:Qn,run:dRe}});function pRe(t){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return[{detector:RP,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>V8&&i.push({detector:RP,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${V8})`})}return i}var RP,V8,W8,K8=y(()=>{"use strict";Xn();RP="STALE_EVIDENCE",V8=90;W8={name:RP,run:pRe}});import{existsSync as J8}from"node:fs";import{join as Y8}from"node:path";function mRe(t){let{cwd:e="."}=t;return he(e,Rl,r=>hRe(r,e))}function hRe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Rl,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:Rl,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=>J8(Y8(e,o)));i.length>0&&r.push({detector:Rl,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Ol(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>J8(Y8(e,i)))&&r.push({detector:Rl,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 Rl,Iv,IP=y(()=>{"use strict";vv();bt();Rl="STALE_SPECIFICATION";Iv={name:Rl,run:mRe}});import{existsSync as X8,statSync as Q8}from"node:fs";import{join as e5}from"node:path";function yRe(t,e){let r=0;for(let n of e){let i=e5(t,n);if(!X8(i))continue;let o=Q8(i).mtimeMs;o>r&&(r=o)}return r}function _Re(t){let{cwd:e="."}=t;return he(e,PP,r=>bRe(r,e))}function bRe(t,e){let r=Ri(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=yRe(e,n);if(i===0)return[];let o=us([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=e5(e,a);if(!X8(c))continue;let l=Q8(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>gRe&&s.push({detector:PP,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var PP,gRe,Pv,CP=y(()=>{"use strict";ep();Na();bt();PP="STALE_TESTS",gRe=30;Pv={name:PP,run:_Re}});import{existsSync as vRe}from"node:fs";import{join as SRe}from"node:path";function wRe(t){let{cwd:e="."}=t;return he(e,hp,r=>xRe(r,e))}function xRe(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:hp,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=>!vRe(SRe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:hp,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:hp,severity:Ol(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 hp,Cv,DP=y(()=>{"use strict";vv();bt();hp="STATUS_DRIFT";Cv={name:hp,run:wRe}});function $Re(t){let{cwd:e="."}=t;return he(e,Dv,r=>kRe(r,e))}function kRe(t,e){let r=ht(e).language;return r==="unknown"?[{detector:Dv,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:Dv,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var Dv,t5,r5=y(()=>{"use strict";En();bt();Dv="TECH_STACK_MISMATCH";t5={name:Dv,run:$Re}});function ORe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function RRe(t){let{cwd:e="."}=t;return he(e,NP,r=>IRe(r,e))}function IRe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=us([...ORe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:NP,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var NP,n5,ERe,ARe,TRe,Nv,jP=y(()=>{"use strict";ep();sP();bt();NP="UNMAPPED_ARTIFACT",n5=["src/stages/**/*.ts","src/spec/**/*.ts"],ERe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},ARe={kotlin:"src/main/kotlin"},TRe=8;Nv={name:NP,run:RRe}});import{existsSync as i5}from"node:fs";import{join as o5}from"node:path";function CRe(t){return PRe.some(e=>t.startsWith(e))}function DRe(t){let{cwd:e="."}=t;return he(e,MP,r=>NRe(r,e))}function NRe(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(CRe(o))continue;let s=o.split("#",1)[0];i5(o5(e,o))||s&&i5(o5(e,s))||r.push({detector:MP,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 nee(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?`[[${QQ(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(eee);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(eee);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}/${QQ(s)}.md`,`${a.join(` +`)}`)}return o}function eee(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as c2e}from"node:fs";import{dirname as l2e,join as jN}from"node:path";import{fileURLToPath as u2e}from"node:url";var MN=l2e(u2e(import.meta.url));function iee(t){for(let e of[jN(MN,"viewer",t),jN(MN,"..","graph","viewer",t),jN(MN,"..","..","dist","viewer",t)])try{return c2e(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function oee(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -867,21 +865,21 @@ ${g.length} question(s) left. continue with \`clad clarify \`. ${o} -`}uP();AP();bP();SP();kP();lP();CP();DP();jP();FP();Om();EP();qe();var u2e=[xv,jv,wv,Nv,kv,Tv,yv,Cv,Pv,gv];function d2e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=cp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function ix(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{ya(e,H(e))}catch{}try{for(let o of u2e){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 d2e(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{ya(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}jN();qe();$i();var p2e=new Set(["mermaid","dot","json","obsidian","html"]);function see(t={}){try{let e=t.format??"mermaid";if(!p2e.has(e)){M("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=sc(n,".");if(t.focus){let s=Xw(n,i,t.focus);if(s.length===0){M("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){M("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Yw(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=ree(i);for(let[c,l]of a){let u=f2e(s,c);MN(LN(u),{recursive:!0}),FN(u,l,"utf8")}M("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){M("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=nx(i,ix(i,"."));MN(LN(t.out),{recursive:!0}),FN(t.out,s,"utf8"),M("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"?tee(i):r==="json"?rx(i):eee(i);t.out?(MN(LN(t.out),{recursive:!0}),FN(t.out,o,"utf8"),M("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){M("fail","graph",e.message),process.exit(1)}}function aee(){try{let t=sc(H(),".");process.stdout.write(oee(ox(t)),()=>process.exit(0))}catch(t){M("fail","graph",t.message),process.exit(1)}}Om();import{createServer as m2e}from"node:http";import{existsSync as h2e,watch as g2e}from"node:fs";import{join as y2e}from"node:path";qe();$i();function _2e(t={}){let e=t.cwd??".",r=new Set,n=()=>sc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}uP();AP();bP();SP();kP();lP();CP();DP();jP();FP();Om();EP();qe();var d2e=[xv,jv,wv,Nv,kv,Tv,yv,Cv,Pv,gv];function f2e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=cp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function ix(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{ya(e,H(e))}catch{}try{for(let o of d2e){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 f2e(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{ya(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}FN();qe();xi();var m2e=new Set(["mermaid","dot","json","obsidian","html"]);function aee(t={}){try{let e=t.format??"mermaid";if(!m2e.has(e)){F("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=sc(n,".");if(t.focus){let s=Xw(n,i,t.focus);if(s.length===0){F("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){F("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Yw(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=nee(i);for(let[c,l]of a){let u=p2e(s,c);LN(UN(u),{recursive:!0}),zN(u,l,"utf8")}F("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){F("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=nx(i,ix(i,"."));LN(UN(t.out),{recursive:!0}),zN(t.out,s,"utf8"),F("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"?ree(i):r==="json"?rx(i):tee(i);t.out?(LN(UN(t.out),{recursive:!0}),zN(t.out,o,"utf8"),F("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){F("fail","graph",e.message),process.exit(1)}}function cee(){try{let t=sc(H(),".");process.stdout.write(see(ox(t)),()=>process.exit(0))}catch(t){F("fail","graph",t.message),process.exit(1)}}Om();import{createServer as h2e}from"node:http";import{existsSync as g2e,watch as y2e}from"node:fs";import{join as _2e}from"node:path";qe();xi();function b2e(t={}){let e=t.cwd??".",r=new Set,n=()=>sc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=m2e((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=rx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(ix(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=h2e((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=rx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(ix(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=nx(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=y2e(e,u);if(h2e(d))try{let f=g2e(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=nx(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=_2e(e,u);if(g2e(d))try{let f=y2e(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 cee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await _2e({port:e,cwd:t.cwd??"."});M("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){M("fail","graph",r.message),process.exit(1)}}var b2e=["stage_1.1","stage_2.1","stage_2.3"];function v2e(t){return(t.features??[]).filter(e=>e.status==="done")}function S2e(t,e){let r=v2e(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 lee(t,e){let r=[];for(let n of b2e){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=S2e(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}Zv();import uee from"node:process";function w2e(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 sx(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=w2e(n,t);i.pass||r.push(i)}return r}Xn();var zN="stage_4.1";function UN(t={}){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return{stage:zN,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=sx(r);if(n.length===0)return{stage:zN,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:zN,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var x2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${uee.argv[1]}`;if(x2e){let t=UN();console.log(JSON.stringify(t)),uee.exit(t.exitCode)}nl();import{randomBytes as $2e}from"node:crypto";import{unlinkSync as k2e}from"node:fs";import{tmpdir as E2e}from"node:os";import{join as A2e,resolve as qN}from"node:path";import T2e from"node:process";var Ur=null;function dee(t){Ur={cwd:qN(t),run:null,jsonFile:null}}function fee(){return Ur!==null}function pee(t,e){if(!Ur||Ur.cwd!==qN(t))return null;if(Ur.run)return Ur.run;let r=A2e(E2e(),`clad-shared-vitest-${T2e.pid}-${$2e(6).toString("hex")}.json`);Ur.jsonFile=r;let n=e(r);return Ur.run={proc:n,jsonFile:r},Ur.run}function mee(t){return!Ur||Ur.cwd!==qN(t)?null:Ur.run}function hee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function gee(){let t=Ur?.jsonFile;if(Ur=null,t)try{k2e(t)}catch{}}jr();import yee from"node:process";var ax="stage_1.4";function BN(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:ax,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:ax,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:ax,pass:!0,exitCode:0}:{stage:ax,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var O2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${yee.argv[1]}`;if(O2e){let t=BN();console.log(JSON.stringify(t)),yee.exit(t.exitCode)}jr();import _ee from"node:process";Rm();An();var cx="stage_2.2";function HN(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Eo("coverage",t))}catch(c){return{stage:cx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:cx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=mee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Lt(cx,r,s);return a||Yt(cx,s)}var P2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${_ee.argv[1]}`;if(P2e){let t=HN();console.log(JSON.stringify(t)),_ee.exit(t.exitCode)}yp();GN();jr();En();An();import vee from"node:process";var fx="stage_3.2";function ZN(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:fx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!$l(e,o[o.length-1]))return{stage:fx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(fx,i,s);return a||Yt(fx,s)}var K2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${vee.argv[1]}`;if(K2e){let t=ZN();console.log(JSON.stringify(t)),vee.exit(t.exitCode)}jr();qe();An();import{existsSync as J2e}from"node:fs";import{resolve as wee}from"node:path";import xee from"node:process";var ii="stage_2.4",VN=5e3,Y2e=3e4;function WN(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ii,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return Q2e(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ii,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ii,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ii,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=wee(e,r.path);if(!J2e(s))return{stage:ii,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??VN,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Lt(ii,r.path,c);if(l)return l;if(c.timedOut)return{stage:ii,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:ii,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ii,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var See={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},X2e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function Q2e(t,e,r){let n=Math.min(e.length*VN,Y2e),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(eUe(t,s,r))}return tUe(o)}function eUe(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("/")?wee(t,a):a,u=VN,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Pa(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 tUe(t){let e="skip";for(let o of t)See[o.disposition]>See[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${X2e[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:ii,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ii,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var rUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xee.argv[1]}`;if(rUe){let t=WN();console.log(JSON.stringify(t)),xee.exit(t.exitCode)}jr();En();An();import $ee from"node:process";var px="stage_3.1";function KN(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:px,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!$l(e,o[o.length-1]))return{stage:px,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(px,i,s);return a||Yt(px,s)}var nUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${$ee.argv[1]}`;if(nUe){let t=KN();console.log(JSON.stringify(t)),$ee.exit(t.exitCode)}OP();JN();YN();jr();ux();import{randomBytes as uUe}from"node:crypto";import{unlinkSync as dUe}from"node:fs";import{tmpdir as fUe}from"node:os";import{join as pUe}from"node:path";import QN from"node:process";Rm();An();qe();import{readFileSync as sUe}from"node:fs";import{resolve as Aee}from"node:path";function aUe(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=Aee(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 cUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function lUe(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=cUe(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(Aee(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 XN(t,e){try{let r=aUe(sUe(t,"utf8"));return r?lUe(H(e),r,e):[]}catch{return[]}}var Ao="stage_2.1";function Tee(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function mUe(t,e,r){let n,i;try{({cmd:n,args:i}=Eo("coverage",t))}catch{return null}if(!n||!i||!Tee(n,i))return null;let o=n,s=i,a=pee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Lt(Ao,n,c))return null;let u=Yt(Ao,c);if(hee(u)==="fallback")return null;if(r){let d=XN(l,e);if(d.length>0)return{stage:Ao,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ao,pass:!0,exitCode:0}}function ej(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Eo("test",t))}catch(u){return{stage:Ao,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Ao,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Tee(n,i),a=r&&s;if(fee()&&s){let u=mUe(t,e,a);if(u)return u}let c,l=i;a&&(c=pUe(fUe(),`clad-vitest-${QN.pid}-${uUe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Lt(Ao,n,u);if(d)return d;let f=fu("unit",Yt(Ao,u),u);if(a&&f.pass&&c){let p=XN(c,e);if(p.length>0)return{stage:Ao,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{dUe(c)}catch{}}}var hUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${QN.argv[1]}`;if(hUe){let t=ej();console.log(JSON.stringify(t)),QN.exit(t.exitCode)}jr();En();An();import Oee from"node:process";var gx="stage_3.3";function tj(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:gx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!$l(e,o[o.length-1]))return{stage:gx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(gx,i,s);return a||Yt(gx,s)}var gUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Oee.argv[1]}`;if(gUe){let t=tj();console.log(JSON.stringify(t)),Oee.exit(t.exitCode)}IP();bf();la();nj();op();Ev();var jee=Et(cr(),1);import{existsSync as ij,readFileSync as AUe,readdirSync as Nee,statSync as TUe,writeFileSync as OUe}from"node:fs";import{basename as Dm,join as Nm,relative as Dee}from"node:path";var RUe=["self-dogfood:","fixture:","derived:"],Mee=/\.(test|spec)\.[jt]sx?$/;function Fee(t,e=t,r=[]){let n;try{n=Nee(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Nm(e,i);try{TUe(o).isDirectory()?Fee(t,o,r):Mee.test(i)&&r.push(o)}catch{continue}}return r}function Lee(t="."){let e=Nm(t,"spec","features"),r=Nm(t,"tests"),n=[],i=[];if(!ij(e)||!ij(r))return{repaired:n,suggested:i};let o=Fee(r),s=new Map;for(let a of o){let c=Dee(t,a).split("\\").join("/"),l=s.get(Dm(a))??[];l.push(c),s.set(Dm(a),l)}for(let a of Nee(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Nm(e,a),l,u;try{l=AUe(c,"utf8"),u=(0,jee.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(RUe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(ij(Nm(t,b)))continue;let _=s.get(Dm(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=>Dm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Dee(t,h).split("\\").join("/")).find(h=>{let g=Dm(h).replace(Mee,"");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 lee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await b2e({port:e,cwd:t.cwd??"."});F("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){F("fail","graph",r.message),process.exit(1)}}var v2e=["stage_1.1","stage_2.1","stage_2.3"];function S2e(t){return(t.features??[]).filter(e=>e.status==="done")}function w2e(t,e){let r=S2e(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 uee(t,e){let r=[];for(let n of v2e){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=w2e(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}Zv();import dee from"node:process";function x2e(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 sx(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=x2e(n,t);i.pass||r.push(i)}return r}Yn();var qN="stage_4.1";function BN(t={}){let{cwd:e="."}=t,r=An(e);if(r.length===0)return{stage:qN,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=sx(r);if(n.length===0)return{stage:qN,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:qN,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var $2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dee.argv[1]}`;if($2e){let t=BN();console.log(JSON.stringify(t)),dee.exit(t.exitCode)}nl();import{randomBytes as k2e}from"node:crypto";import{unlinkSync as E2e}from"node:fs";import{tmpdir as A2e}from"node:os";import{join as T2e,resolve as HN}from"node:path";import O2e from"node:process";var zr=null;function fee(t){zr={cwd:HN(t),run:null,jsonFile:null}}function pee(){return zr!==null}function mee(t,e){if(!zr||zr.cwd!==HN(t))return null;if(zr.run)return zr.run;let r=T2e(A2e(),`clad-shared-vitest-${O2e.pid}-${k2e(6).toString("hex")}.json`);zr.jsonFile=r;let n=e(r);return zr.run={proc:n,jsonFile:r},zr.run}function hee(t){return!zr||zr.cwd!==HN(t)?null:zr.run}function gee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function yee(){let t=zr?.jsonFile;if(zr=null,t)try{E2e(t)}catch{}}Nr();import _ee from"node:process";var ax="stage_1.4";function GN(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:ax,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:ax,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:ax,pass:!0,exitCode:0}:{stage:ax,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var R2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${_ee.argv[1]}`;if(R2e){let t=GN();console.log(JSON.stringify(t)),_ee.exit(t.exitCode)}Nr();import bee from"node:process";Rm();En();var cx="stage_2.2";function ZN(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Eo("coverage",t))}catch(c){return{stage:cx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:cx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=hee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Lt(cx,r,s);return a||Yt(cx,s)}var C2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${bee.argv[1]}`;if(C2e){let t=ZN();console.log(JSON.stringify(t)),bee.exit(t.exitCode)}yp();VN();Nr();kn();En();import See from"node:process";var fx="stage_3.2";function WN(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:fx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!$l(e,o[o.length-1]))return{stage:fx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(fx,i,s);return a||Yt(fx,s)}var J2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${See.argv[1]}`;if(J2e){let t=WN();console.log(JSON.stringify(t)),See.exit(t.exitCode)}Nr();qe();En();import{existsSync as Y2e}from"node:fs";import{resolve as xee}from"node:path";import $ee from"node:process";var ni="stage_2.4",KN=5e3,X2e=3e4;function JN(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ni,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return eUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ni,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ni,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ni,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=xee(e,r.path);if(!Y2e(s))return{stage:ni,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??KN,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Lt(ni,r.path,c);if(l)return l;if(c.timedOut)return{stage:ni,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:ni,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ni,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var wee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},Q2e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function eUe(t,e,r){let n=Math.min(e.length*KN,X2e),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(tUe(t,s,r))}return rUe(o)}function tUe(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("/")?xee(t,a):a,u=KN,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Pa(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 rUe(t){let e="skip";for(let o of t)wee[o.disposition]>wee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${Q2e[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:ni,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ni,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var nUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${$ee.argv[1]}`;if(nUe){let t=JN();console.log(JSON.stringify(t)),$ee.exit(t.exitCode)}Nr();kn();En();import kee from"node:process";var px="stage_3.1";function YN(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:px,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!$l(e,o[o.length-1]))return{stage:px,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(px,i,s);return a||Yt(px,s)}var iUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${kee.argv[1]}`;if(iUe){let t=YN();console.log(JSON.stringify(t)),kee.exit(t.exitCode)}OP();XN();QN();Nr();ux();import{randomBytes as dUe}from"node:crypto";import{unlinkSync as fUe}from"node:fs";import{tmpdir as pUe}from"node:os";import{join as mUe}from"node:path";import tj from"node:process";Rm();En();qe();import{readFileSync as aUe}from"node:fs";import{resolve as Tee}from"node:path";function cUe(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=Tee(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 lUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function uUe(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=lUe(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(Tee(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 ej(t,e){try{let r=cUe(aUe(t,"utf8"));return r?uUe(H(e),r,e):[]}catch{return[]}}var Ao="stage_2.1";function Oee(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function hUe(t,e,r){let n,i;try{({cmd:n,args:i}=Eo("coverage",t))}catch{return null}if(!n||!i||!Oee(n,i))return null;let o=n,s=i,a=mee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Lt(Ao,n,c))return null;let u=Yt(Ao,c);if(gee(u)==="fallback")return null;if(r){let d=ej(l,e);if(d.length>0)return{stage:Ao,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ao,pass:!0,exitCode:0}}function rj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Eo("test",t))}catch(u){return{stage:Ao,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Ao,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Oee(n,i),a=r&&s;if(pee()&&s){let u=hUe(t,e,a);if(u)return u}let c,l=i;a&&(c=mUe(pUe(),`clad-vitest-${tj.pid}-${dUe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Lt(Ao,n,u);if(d)return d;let f=fu("unit",Yt(Ao,u),u);if(a&&f.pass&&c){let p=ej(c,e);if(p.length>0)return{stage:Ao,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{fUe(c)}catch{}}}var gUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tj.argv[1]}`;if(gUe){let t=rj();console.log(JSON.stringify(t)),tj.exit(t.exitCode)}Nr();kn();En();import Ree from"node:process";var gx="stage_3.3";function nj(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:gx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!$l(e,o[o.length-1]))return{stage:gx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(gx,i,s);return a||Yt(gx,s)}var yUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ree.argv[1]}`;if(yUe){let t=nj();console.log(JSON.stringify(t)),Ree.exit(t.exitCode)}IP();bf();la();oj();op();Ev();var Mee=Et(cr(),1);import{existsSync as sj,readFileSync as TUe,readdirSync as jee,statSync as OUe,writeFileSync as RUe}from"node:fs";import{basename as Dm,join as Nm,relative as Nee}from"node:path";var IUe=["self-dogfood:","fixture:","derived:"],Fee=/\.(test|spec)\.[jt]sx?$/;function Lee(t,e=t,r=[]){let n;try{n=jee(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Nm(e,i);try{OUe(o).isDirectory()?Lee(t,o,r):Fee.test(i)&&r.push(o)}catch{continue}}return r}function zee(t="."){let e=Nm(t,"spec","features"),r=Nm(t,"tests"),n=[],i=[];if(!sj(e)||!sj(r))return{repaired:n,suggested:i};let o=Lee(r),s=new Map;for(let a of o){let c=Nee(t,a).split("\\").join("/"),l=s.get(Dm(a))??[];l.push(c),s.set(Dm(a),l)}for(let a of jee(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Nm(e,a),l,u;try{l=TUe(c,"utf8"),u=(0,Mee.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(IUe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(sj(Nm(t,b)))continue;let _=s.get(Dm(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=>Dm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Nee(t,h).split("\\").join("/")).find(h=>{let g=Dm(h).replace(Fee,"");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&&OUe(c,l,"utf8")}return{repaired:n,suggested:i}}rl();import{existsSync as IUe,readFileSync as PUe}from"node:fs";import{join as CUe}from"node:path";function DUe(t,e){let r=CUe(t,e);if(!IUe(r))return[];let n=[];for(let i of PUe(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 zee(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=>DUe(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 Uee(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(` -`)}Ov();qe();$i();Xn();rl();var oj=["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"],NUe=[...oj,"att"];function jUe(t,e,r){if(e.startsWith("stage_4")){let n=Tn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return sx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function MUe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":p_(e,r,t).state==="fresh"?"\u2713":"!"}function vx(t,e="."){let r=ts(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...oj.map(o=>jUe(i,o,e)),MUe(i,r,e)]}));return{columns:NUe,rows:n}}function qee(t,e=".",r={}){let n=r.internal??!1,i=vx(t,e),o=[...oj.map(c=>n?c.replace("stage_",""):FUe(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 FUe(t){return ba(t).slice(0,3)}async function eJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Kle(),Wle)),Promise.resolve().then(()=>(eue(),Qle)),Promise.resolve().then(()=>(Cp(),mX))]),i=e({cwd:t.cwd});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function tJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await zQ({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){V.stdout.write(`${JSON.stringify(n,null,2)} -`),V.exit(0);return}for(let o of n.created)M("pass",`created ${o}`);for(let o of n.skipped)M("skip",o);for(let o of n.proposals??[])M("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(M("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){V.stdout.write(` +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&RUe(c,l,"utf8")}return{repaired:n,suggested:i}}rl();import{existsSync as PUe,readFileSync as CUe}from"node:fs";import{join as DUe}from"node:path";function NUe(t,e){let r=DUe(t,e);if(!PUe(r))return[];let n=[];for(let i of CUe(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 Uee(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=>NUe(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 qee(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(` +`)}Ov();qe();xi();Yn();rl();var aj=["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"],jUe=[...aj,"att"];function MUe(t,e,r){if(e.startsWith("stage_4")){let n=An(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return sx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function FUe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":p_(e,r,t).state==="fresh"?"\u2713":"!"}function vx(t,e="."){let r=ts(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...aj.map(o=>MUe(i,o,e)),FUe(i,r,e)]}));return{columns:jUe,rows:n}}function Bee(t,e=".",r={}){let n=r.internal??!1,i=vx(t,e),o=[...aj.map(c=>n?c.replace("stage_",""):LUe(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 LUe(t){return ba(t).slice(0,3)}async function tJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Jle(),Kle)),Promise.resolve().then(()=>(tue(),eue)),Promise.resolve().then(()=>(Cp(),gX))]),i=e({cwd:t.cwd,onboarding:{initialize:AN,clarify:IN}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function rJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await AN({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){V.stdout.write(`${JSON.stringify(n,null,2)} +`),V.exit(0);return}for(let o of n.created)F("pass",`created ${o}`);for(let o of n.skipped)F("skip",o);for(let o of n.proposals??[])F("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(F("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){V.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())V.stdout.write(` ${o+1}. ${s} `);V.stdout.write(` @@ -891,30 +889,30 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&OUe(c,l,"u `),V.stdout.write(` e.g. clad init payment SaaS for B2B `),V.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));V.exit(0)}async function rJe(t,e){M("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(()=>(kue(),$ue)),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)M(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),V.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>$O(l,s)),c=`${_H(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;M(i,"run",c),a.length>0&&V.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&M("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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function nJe(t={}){try{let e=H();if(ca("."))M("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ds(".");Tl(".",r),za("."),F8(".");let n=Fl(".");n==="created"?M("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&M("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=Lee(".");for(let s of i.repaired)M("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)M("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=bx(".");o&&M("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Iv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){M("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);M("note",`propose-archive \xB7 ${s}`,a)}M("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),V.exit(0);return}M("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){M("fail","sync",e.message),V.exit(1)}}function iJe(t){if(!t){M("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=Jy(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";M("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function oJe(t,e={}){if(!t){M("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=Yy(".",t);if(!r){M("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}Xy(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";M("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?V.stdout.write(`Run: git checkout ${r.gitHead} +`));V.exit(0)}async function nJe(t,e){F("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(()=>(Eue(),kue)),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)F(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),V.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>$O(l,s)),c=`${vH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;F(i,"run",c),a.length>0&&V.stdout.write(`Touched: ${a.join(", ")} +`)}let o=n.stubsCreated.length>0;o&&F("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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function iJe(t={}){try{let e=H();if(ca("."))F("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ds(".");Tl(".",r),za("."),z8(".");let n=Fl(".");n==="created"?F("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&F("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=zee(".");for(let s of i.repaired)F("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)F("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=bx(".");o&&F("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Iv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){F("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);F("note",`propose-archive \xB7 ${s}`,a)}F("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),V.exit(0);return}F("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){F("fail","sync",e.message),V.exit(1)}}function oJe(t){if(!t){F("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=Jy(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";F("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function sJe(t,e={}){if(!t){F("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=Yy(".",t);if(!r){F("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}Xy(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";F("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?V.stdout.write(`Run: git checkout ${r.gitHead} `):V.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),V.exit(0)}async function sJe(t){let e=await cC({force:t.force,quiet:t.quiet});V.exit(e.errors.length>0?1:0)}async function aJe(){M("note","update","reconciling the current project after the engine upgrade");let t=await DY(".",{wireHosts:async()=>(await cC({quiet:!0})).errors.length});if(M(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){M("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}t.inventoryDeferred?M("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):M("pass","spec",`inventory synced \xB7 ${t.features} features`),M(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),M(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)M("note","deprecated",r);V.stdout.write(` +`),V.exit(0)}async function aJe(t){let e=await cC({force:t.force,quiet:t.quiet});V.exit(e.errors.length>0?1:0)}async function cJe(){F("note","update","reconciling the current project after the engine upgrade");let t=await jY(".",{wireHosts:async()=>(await cC({quiet:!0})).errors.length});if(F(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){F("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}t.inventoryDeferred?F("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):F("pass","spec",`inventory synced \xB7 ${t.features} features`),F(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),F(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)F("note","deprecated",r);V.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),HE({tier:"pre-commit",strict:!0}).anyFailed?V.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"):M("pass","drift","clean against the stricter detectors"),V.exit(t.code)}var cJe={"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 HE(t){let e=t.tier??"all",r=t.silent===!0,n=cJe[e];if(!n)return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):r||M("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",()=>Pm(i)],["stage_1.2",()=>Im(i)],["stage_1.3",()=>ei({...i,strict:t.strict})],["stage_1.4",BN],["stage_1.5",Ga],["stage_1.6",Ep],["stage_2.1",()=>ej({...i,strict:t.strict})],["stage_2.2",()=>HN(i)],["stage_2.3",TP],["stage_2.4",WN],["stage_3.1",KN],["stage_3.2",ZN],["stage_3.3",tj],["stage_4.1",UN],["stage_4.2",Cm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ti(d)?"fail":"skip",u=[];m_("."),dee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:ba(d),h=wY(p);ti(h)&&(c=!0,a=Math.max(a,xY(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(M(l(h),m),ti(h)&&gJe(p))}}finally{g_(),gee()}if(t.strict)try{let d=H();for(let f of lee(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&&M("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"||!ti(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=>ti(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&M("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(ca("."))t.json||M("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{FH(".",H())&&(t.json||M("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),lr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function lJe(t){try{let e=H(),r=Kc(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} -`),V.exit("not_found"in r?1:0)}catch(e){M("fail","context",e.message),V.exit(1)}}function uJe(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=yr(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} -`),V.exit("not_found"in i?1:0)}catch(r){M("fail","impact",r.message),V.exit(1)}}function dJe(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Mv(e,o=>{try{return Aue(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),V.exit(0)}catch(e){M("fail","infer-deps",e.message),V.exit(1)}}function fJe(t={}){try{if(t.sessions){KQ(t);return}if(t.trend!==void 0&&t.trend!==!1){JQ(t);return}let e=H(),n=MB(e,o=>{try{return Aue(o,"utf8")}catch{return null}},"."),i=LB(".",n);if(t.json)V.stdout.write(`${JSON.stringify(n,null,2)} +`),HE({tier:"pre-commit",strict:!0}).anyFailed?V.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"):F("pass","drift","clean against the stricter detectors"),V.exit(t.code)}var lJe={"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 HE(t){let e=t.tier??"all",r=t.silent===!0,n=lJe[e];if(!n)return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):r||F("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",()=>Pm(i)],["stage_1.2",()=>Im(i)],["stage_1.3",()=>Qn({...i,strict:t.strict})],["stage_1.4",GN],["stage_1.5",Ga],["stage_1.6",Ep],["stage_2.1",()=>rj({...i,strict:t.strict})],["stage_2.2",()=>ZN(i)],["stage_2.3",TP],["stage_2.4",JN],["stage_3.1",YN],["stage_3.2",WN],["stage_3.3",nj],["stage_4.1",BN],["stage_4.2",Cm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ei(d)?"fail":"skip",u=[];m_("."),fee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:ba(d),h=$Y(p);ei(h)&&(c=!0,a=Math.max(a,kY(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(F(l(h),m),ei(h)&&yJe(p))}}finally{g_(),yee()}if(t.strict)try{let d=H();for(let f of uee(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&&F("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"||!ei(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=>ei(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&F("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(ca("."))t.json||F("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{zH(".",H())&&(t.json||F("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),lr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function uJe(t){try{let e=H(),r=Kc(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} +`),V.exit("not_found"in r?1:0)}catch(e){F("fail","context",e.message),V.exit(1)}}function dJe(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=yr(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} +`),V.exit("not_found"in i?1:0)}catch(r){F("fail","impact",r.message),V.exit(1)}}function fJe(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Mv(e,o=>{try{return Tue(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),V.exit(0)}catch(e){F("fail","infer-deps",e.message),V.exit(1)}}function pJe(t={}){try{if(t.sessions){JQ(t);return}if(t.trend!==void 0&&t.trend!==!1){YQ(t);return}let e=H(),n=LB(e,o=>{try{return Tue(o,"utf8")}catch{return null}},"."),i=UB(".",n);if(t.json)V.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)}`,` ${Jc}`];V.stdout.write(`${c.join(` `)} -`),i.appended?M("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?M("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&M("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}V.exit(0)}catch(e){M("fail","measure",e.message),V.exit(1)}}function pJe(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(M("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){M("fail","check",r.message),V.exit(1)}V.exitCode=HE({...t,focusModules:e}).worst}function mJe(t){let e=nY(".",t,{checkStages:HE,onIndex:za,gitOpInProgress:HT});M(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function hJe(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){M("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=q8(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),i.appended?F("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?F("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&F("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}V.exit(0)}catch(e){F("fail","measure",e.message),V.exit(1)}}function mJe(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(F("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){F("fail","check",r.message),V.exit(1)}V.exitCode=HE({...t,focusModules:e}).worst}function hJe(t){let e=oY(".",t,{checkStages:HE,onIndex:za,gitOpInProgress:HT});F(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function gJe(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){F("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=H8(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),V.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";V.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}V.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),V.exit(s.length>0?1:0);return}if(!t){M("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),V.exit(1);return}let i=zee(n,t,e.ac,r);if(!i||i.acs.length===0){M("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),V.exit(1);return}V.stdout.write(`${Uee(i)} -`),V.exit(0)}function gJe(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=Eue($f(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] +`),V.exit(s.length>0?1:0);return}if(!t){F("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),V.exit(1);return}let i=Uee(n,t,e.ac,r);if(!i||i.acs.length===0){F("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),V.exit(1);return}V.stdout.write(`${qee(i)} +`),V.exit(0)}function yJe(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=Aue($f(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&V.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&V.stdout.write(` ${Eue(e.trim(),160)} -`)}}function Eue(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function yJe(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(vx(e,"."),null,2)} -`),V.exitCode=0;return}V.stdout.write(`${qee(e,".",{internal:t.internal})} -`),V.exit(0)}function _Je(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function bJe(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){M("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=vx(i,e),s={gitHead:da(e),version:Cl(),generatedAt:t.now??new Date().toISOString()},a=Qc(i),c;try{let l=t.since??Jo(e),u=Yo(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:Yc(u),auditMarkdown:Xc(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=RH({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){M("fail","bundle",i.message),V.exit(1);return}try{Q3e(r,n,"utf8")}catch(i){M("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}M("pass","bundle",`${r} \xB7 ${_Je(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function vJe(t){let e=lA(t);M("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function SJe(){let t=new Tq;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(tJe),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(rJe),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(nJe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(sJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(aJe),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(pJe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(iJe),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(mJe),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)=>hJe(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(oJe),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(yJe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(lJe),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)=>uJe(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=>RY(r,{checkStages:HE})),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=>dJe(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=>fJe(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=>see(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>aee()),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=>{cee(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=>yH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>w5(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=>bJe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(vJe),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(SY),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(eJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){eY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}k5(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(ZQ),t}var wJe=!!globalThis.__CLADDING_BUNDLED,xJe=wJe||import.meta.url===`file://${V.argv[1]}`;xJe&&SJe().parse();export{cJe as TIER_STAGES,SJe as createProgram,bJe as runBundleCommand,pJe as runCheckCommand,HE as runCheckStages,iJe as runCheckpointCommand,lJe as runContextCommand,mJe as runDoneCommand,uJe as runImpactCommand,dJe as runInferDepsCommand,tJe as runInitCommand,fJe as runMeasureCommand,hJe as runOracleCommand,oJe as runRollbackCommand,vJe as runRouteCommand,rJe as runRunCommand,eJe as runServeCommand,sJe as runSetupCommand,yJe as runStatusCommand,nJe as runSyncCommand,aJe as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&V.stdout.write(` ${Aue(e.trim(),160)} +`)}}function Aue(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function _Je(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(vx(e,"."),null,2)} +`),V.exitCode=0;return}V.stdout.write(`${Bee(e,".",{internal:t.internal})} +`),V.exit(0)}function bJe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function vJe(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){F("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=vx(i,e),s={gitHead:da(e),version:Cl(),generatedAt:t.now??new Date().toISOString()},a=Qc(i),c;try{let l=t.since??Jo(e),u=Yo(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:Yc(u),auditMarkdown:Xc(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=PH({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){F("fail","bundle",i.message),V.exit(1);return}try{eJe(r,n,"utf8")}catch(i){F("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}F("pass","bundle",`${r} \xB7 ${bJe(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function SJe(t){let e=lA(t);F("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function wJe(){let t=new Rq;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(rJe),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(nJe),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(iJe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(aJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(cJe),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(mJe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(oJe),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(hJe),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)=>gJe(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(sJe),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(_Je),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(uJe),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)=>dJe(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=>PY(r,{checkStages:HE})),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=>fJe(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=>pJe(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=>aee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>cee()),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=>{lee(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=>bH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>$5(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=>vJe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(SJe),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(xY),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(tJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){rY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}A5(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(VQ),t}var xJe=!!globalThis.__CLADDING_BUNDLED,$Je=xJe||import.meta.url===`file://${V.argv[1]}`;$Je&&wJe().parse();export{lJe as TIER_STAGES,wJe as createProgram,vJe as runBundleCommand,mJe as runCheckCommand,HE as runCheckStages,oJe as runCheckpointCommand,uJe as runContextCommand,hJe as runDoneCommand,dJe as runImpactCommand,fJe as runInferDepsCommand,rJe as runInitCommand,pJe as runMeasureCommand,gJe as runOracleCommand,sJe as runRollbackCommand,SJe as runRouteCommand,nJe as runRunCommand,tJe as runServeCommand,aJe as runSetupCommand,_Je as runStatusCommand,iJe as runSyncCommand,cJe as runUpdateCommand}; diff --git a/spec/features/natural-language-init-0f4dd6.yaml b/spec/features/natural-language-init-0f4dd6.yaml index 338f8ed8..4abab9d9 100644 --- a/spec/features/natural-language-init-0f4dd6.yaml +++ b/spec/features/natural-language-init-0f4dd6.yaml @@ -18,7 +18,7 @@ acceptance_criteria: action: expose project initialization and onboarding answers as MCP tools that reuse the CLI core response: MCP hosts can complete init and its follow-up Q&A without asking the user to run a shell command text: The system shall expose project initialization and onboarding answers as MCP tools that reuse the CLI core, so MCP hosts can complete init and its follow-up Q&A without asking the user to run a shell command. - test_refs: [tests/serve/server.test.ts] + test_refs: [tests/serve/server.test.ts, tests/serve/init-tools.test.ts] - id: AC-002 ears: event condition: when a new-project initialization request omits the project idea diff --git a/src/cli/clad.ts b/src/cli/clad.ts index d00ae570..20488074 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -24,7 +24,7 @@ import {runHookCommand} from './hook.js'; import {runVerdictCommand} from './verdict.js'; import {runUpdate} from './update.js'; import {runInit} from './init.js'; -import {runClarifyCommand} from './clarify.js'; +import {refineOnboarding, runClarifyCommand} from './clarify.js'; import {getCurrentCladdingVersion, runHostSetup} from '../init/host-setup.js'; import {recordEvent} from '../events/log.js'; import {buildContextSlice} from '../optimizer/context-slice.js'; @@ -80,7 +80,13 @@ export async function runServeCommand(opts: {cwd?: string}): Promise { import('@modelcontextprotocol/sdk/server/stdio.js'), import('../adapters/host/sampling-context.js'), ]); - const server = buildServer({cwd: opts.cwd}); + const server = buildServer({ + cwd: opts.cwd, + onboarding: { + initialize: runInit, + clarify: refineOnboarding, + }, + }); // v0.2.26 (F-075): register the server in the sampling context so // the host adapters (`generic-mcp`, `claude-code`) automatically // route LLM dispatch through McpSamplingTransport instead of the diff --git a/src/cli/clarify.ts b/src/cli/clarify.ts index 35a5816e..43188b6a 100644 --- a/src/cli/clarify.ts +++ b/src/cli/clarify.ts @@ -61,75 +61,75 @@ export interface RefineReport { readonly remainingQuestions: number; } -/** - * Handler for `clad clarify [answer...]`. The positional argument is - * joined with spaces so users can pass natural-language answers in any - * language without quoting: `clad clarify B2B only (no sole proprietors)`. - * - * Exit codes: - * 0 — answer accepted (or no-op when state is already `status: done`) - * 1 — fatal error (corrupt state file) - * 2 — usage error (no state file present, or no answer provided - * while a pending question exists) - */ -export async function runClarifyCommand( - answerTokens: readonly string[] | undefined, - opts: RefineCommandOptions = {}, -): Promise { +/** Process-independent result used by both the CLI and MCP boundaries. */ +export interface RefineOutcome { + readonly ok: boolean; + readonly code: 0 | 1 | 2; + readonly report?: RefineReport; + readonly error?: string; + readonly message?: string; + readonly source?: OnboardingResult['source']; + readonly created: readonly string[]; + readonly proposals: readonly string[]; +} + +/** Applies one onboarding answer without writing to stdout or exiting. */ +export async function refineOnboarding( + answer: string, + opts: Omit = {}, +): Promise { const cwd = opts.cwd ?? '.'; let state: OnboardingState | null; try { state = loadState(cwd); } catch (err) { - pulse('fail', 'clarify', (err as Error).message); - process.exit(1); - return; + return {ok: false, code: 1, error: (err as Error).message, created: [], proposals: []}; } if (state === null) { - pulse( - 'fail', - 'clarify', - 'no onboarding session — run `clad init ` first to start the Q&A loop', - ); - process.exit(2); - return; + return { + ok: false, + code: 2, + error: 'no onboarding session — initialize Cladding with a project intent first', + created: [], + proposals: [], + }; } - if (state.status === 'done') { - pulse('note', 'clarify', 'onboarding already complete (state.yaml status: done)'); - if (opts.json) { - process.stdout.write(`${JSON.stringify(buildReport(cwd, null, [], null, state), null, 2)}\n`); - } - process.exit(0); - return; + return { + ok: true, + code: 0, + message: 'onboarding already complete (state.yaml status: done)', + report: buildReport(cwd, null, [], null, state), + created: [], + proposals: [], + }; } const pendingIdx = firstPendingIndex(state); if (pendingIdx === -1) { - // Every existing question is answered but `isComplete` may still be - // false if the LLM was about to emit new questions; mark done. const done = markDone(state); saveState(cwd, done); - pulse('pass', 'clarify', 'onboarding complete · state.yaml marked done'); - if (opts.json) { - process.stdout.write(`${JSON.stringify(buildReport(cwd, null, [], null, done), null, 2)}\n`); - } - process.exit(0); - return; + return { + ok: true, + code: 0, + message: 'onboarding complete · state.yaml marked done', + report: buildReport(cwd, null, [], null, done), + created: [], + proposals: [], + }; } - - const answer = (answerTokens ?? []).join(' ').trim(); - if (answer.length === 0) { - pulse( - 'fail', - 'clarify', - `provide an answer for: "${state.qa[pendingIdx].question}" (usage: \`clad clarify \`)`, - ); - process.exit(2); - return; + if (!answer.trim()) { + return { + ok: false, + code: 2, + error: `provide an answer for: "${state.qa[pendingIdx].question}"`, + created: [], + proposals: [], + }; } - const stateAfterAnswer = markFirstPendingAnswered(state, answer); + const normalizedAnswer = answer.trim(); + const stateAfterAnswer = markFirstPendingAnswered(state, normalizedAnswer); const projectName = stateAfterAnswer.projectName || basename(resolve(cwd)); const observed: OnboardingObserved = { cwdBasename: basename(resolve(cwd)), @@ -143,7 +143,6 @@ export async function runClarifyCommand( const qaHistory: RefinementQa[] = stateAfterAnswer.qa.flatMap((qa) => qa.answer === null ? [] : [{question: qa.question, answer: qa.answer}], ); - const dispatcher = selectDispatcher({noLlm: opts.noLlm}); const refined = await interpretRefinementWithFallback( stateAfterAnswer.intent, @@ -154,73 +153,90 @@ export async function runClarifyCommand( cwd, ); - // Write the refined artifacts. The existing `writeArtifact` divert - // pattern is inlined here so `clarify` does not depend on `init.ts`; - // refresh on a populated file lands the new body in - // `.cladding/scan/.proposal` instead of overwriting hand - // edits. const proposals: string[] = []; const created: string[] = []; writeArtifact(cwd, 'docs/project-context.md', refined.projectContextMd, created, proposals); writeArtifact(cwd, 'spec/architecture.yaml', refined.architectureYaml, created, proposals); writeArtifact(cwd, 'spec/capabilities.yaml', refined.capabilitiesYaml, created, proposals); - // v0.3.45 (F-d12edf) — refined scenarios land in spec/scenarios/ - // alongside the other refined artifacts; existing scenario files - // divert to .cladding/scan/.proposal so the planner + - // user can diff before promotion. for (const scenario of refined.scenarios) { const hash = scenario.id.replace(/^S-/, ''); - const filename = `spec/scenarios/${scenario.slug}-${hash}.yaml`; - const body = renderScenarioYaml(scenario); - writeArtifact(cwd, filename, body, created, proposals); + writeArtifact( + cwd, + `spec/scenarios/${scenario.slug}-${hash}.yaml`, + renderScenarioYaml(scenario), + created, + proposals, + ); } - // Persist state: add new questions (de-dup), mark done when no more - // questions and every existing question is answered. let updated = appendNewQuestions(stateAfterAnswer, refined.clarifyingQuestions); - if (refined.clarifyingQuestions.length === 0 && isComplete(updated)) { - updated = markDone(updated); - } + if (refined.clarifyingQuestions.length === 0 && isComplete(updated)) updated = markDone(updated); saveState(cwd, updated); - - // Output - if (opts.json) { - const answeredQa = stateAfterAnswer.qa[pendingIdx]; - const report = buildReport( + const answeredQa = stateAfterAnswer.qa[pendingIdx]; + return { + ok: true, + code: 0, + report: buildReport( cwd, - // safe — we just set this entry's answer via markFirstPendingAnswered - {question: answeredQa.question, answer: answer}, + {question: answeredQa.question, answer: normalizedAnswer}, refined.clarifyingQuestions, refined.mode, updated, - ); - process.stdout.write(`${JSON.stringify(report, null, 2)}\n`); + ), + source: refined.source, + created, + proposals, + }; +} + +/** + * Handler for `clad clarify [answer...]`. The positional argument is + * joined with spaces so users can pass natural-language answers in any + * language without quoting: `clad clarify B2B only (no sole proprietors)`. + * + * Exit codes: + * 0 — answer accepted (or no-op when state is already `status: done`) + * 1 — fatal error (corrupt state file) + * 2 — usage error (no state file present, or no answer provided + * while a pending question exists) + */ +export async function runClarifyCommand( + answerTokens: readonly string[] | undefined, + opts: RefineCommandOptions = {}, +): Promise { + const answer = (answerTokens ?? []).join(' ').trim(); + const outcome = await refineOnboarding(answer, {cwd: opts.cwd, noLlm: opts.noLlm}); + if (!outcome.ok) { + pulse('fail', 'clarify', outcome.error!); + process.exit(outcome.code); + return; + } + if (opts.json) { + process.stdout.write(`${JSON.stringify(outcome.report, null, 2)}\n`); process.exit(0); return; } + if (outcome.message) pulse('note', 'clarify', outcome.message); + if (outcome.source && outcome.report) { + pulse('pass', 'clarify', `answered · mode: ${outcome.report.mode} · source: ${outcome.source}`); + } + for (const c of outcome.created) pulse('pass', `created ${c}`); + for (const p of outcome.proposals) pulse('note', 'proposal', p); - pulse('pass', 'clarify', `answered · mode: ${refined.mode} · source: ${refined.source}`); - for (const c of created) pulse('pass', `created ${c}`); - for (const p of proposals) pulse('note', 'proposal', p); - - if (refined.clarifyingQuestions.length > 0) { + const newQuestions = outcome.report?.newQuestions ?? []; + if (newQuestions.length > 0) { process.stdout.write('\n💡 Next questions:\n'); - for (const [i, q] of refined.clarifyingQuestions.entries()) { + for (const [i, q] of newQuestions.entries()) { process.stdout.write(` ${i + 1}. ${q}\n`); } - const remaining = updated.qa.filter((q) => q.answer === null); - if (remaining.length > 0) { - process.stdout.write(`\n${remaining.length} question(s) left · continue with \`clad clarify \`.\n\n`); + if ((outcome.report?.remainingQuestions ?? 0) > 0) { + process.stdout.write(`\n${outcome.report!.remainingQuestions} question(s) left · continue with \`clad clarify \`.\n\n`); } - } else if (updated.status === 'done') { + } else if (outcome.report?.status === 'done') { process.stdout.write('\n✓ All questions answered — onboarding complete. state.yaml status: done.\n\n'); - } else { - const remaining = updated.qa.filter((q) => q.answer === null); - if (remaining.length > 0) { - process.stdout.write(`\n${remaining.length} question(s) left. continue with \`clad clarify \`.\n\n`); - } + } else if ((outcome.report?.remainingQuestions ?? 0) > 0) { + process.stdout.write(`\n${outcome.report!.remainingQuestions} question(s) left. continue with \`clad clarify \`.\n\n`); } - process.exit(0); } diff --git a/src/cli/init.ts b/src/cli/init.ts index d05692c0..3cfa623b 100644 --- a/src/cli/init.ts +++ b/src/cli/init.ts @@ -83,6 +83,8 @@ export interface InitResult { readonly clarifyingQuestions?: readonly string[]; /** Mode the onboarding pass classified the project as (intent path only). */ readonly onboardingMode?: OnboardingResult['mode']; + /** Reports whether intent onboarding used the host LLM or a fallback. */ + readonly onboardingSource?: OnboardingResult['source']; } // v0.3.30 — Scenarios in cladding capture *user journeys* (business @@ -674,6 +676,7 @@ export async function runInit(opts: InitOptions = {}): Promise { proposals: proposals.length ? proposals : undefined, clarifyingQuestions: onboarding?.clarifyingQuestions.length ? [...onboarding.clarifyingQuestions] : undefined, onboardingMode: onboarding?.mode, + onboardingSource: onboarding?.source, }; } diff --git a/src/serve/server.ts b/src/serve/server.ts index 571c75aa..1ae640fc 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -104,6 +104,35 @@ export interface ServerOptions { readonly name?: string; /** Server version advertised to clients. */ readonly version?: string; + /** In-process onboarding operations supplied by the CLI composition root. */ + readonly onboarding?: OnboardingOperations; +} + +/** Process-independent onboarding contract injected at the serve boundary. */ +export interface OnboardingOperations { + readonly initialize: (opts: { + cwd: string; + intent?: string; + scan?: boolean; + noLlm?: boolean; + }) => Promise<{ + readonly created?: readonly string[]; + readonly skipped?: readonly string[]; + readonly language?: string; + readonly proposals?: readonly string[]; + readonly clarifyingQuestions?: readonly string[]; + readonly onboardingMode?: 'greenfield' | 'existing-adoption' | 'mixed'; + readonly onboardingSource?: 'llm' | 'hybrid' | 'deterministic'; + }>; + readonly clarify: ( + answer: string, + opts: {cwd: string; noLlm?: boolean}, + ) => Promise<{ + readonly ok: boolean; + readonly error?: string; + readonly report?: unknown; + readonly source?: 'llm' | 'hybrid' | 'deterministic'; + }>; } /** @@ -134,7 +163,7 @@ export function buildServer(opts: ServerOptions = {}): McpServer { }, ); - registerTools(server, cwd); + registerTools(server, cwd, opts.onboarding); registerResources(server, cwd); registerPrompts(server, cwd); registerSubscribeHandlers(server); @@ -337,7 +366,7 @@ function projectIntentPath(cwd: string, requested: string): {path?: string; erro return {path: rel}; } -function registerTools(server: McpServer, cwd: string): void { +function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOperations): void { server.registerTool( 'clad_init', { @@ -366,26 +395,49 @@ function registerTools(server: McpServer, cwd: string): void { }; } - const command = ['init']; + let intent: string | undefined; if (args.mode === 'document') { const resolved = projectIntentPath(cwd, args.document_path ?? ''); if (resolved.error) { return {isError: true, content: [{type: 'text', text: resolved.error}]}; } - command.push(resolved.path!); + intent = resolved.path!; } else if (args.intent?.trim()) { - command.push(args.intent.trim()); + intent = args.intent.trim(); + } + let init: { + readonly created?: readonly string[]; + readonly skipped?: readonly string[]; + readonly language?: string; + readonly proposals?: readonly string[]; + readonly clarifyingQuestions?: readonly string[]; + readonly onboardingMode?: 'greenfield' | 'existing-adoption' | 'mixed'; + readonly onboardingSource?: 'llm' | 'hybrid' | 'deterministic'; + }; + if (onboarding) { + init = await onboarding.initialize({ + cwd, + intent, + scan: args.mode === 'existing' ? true : undefined, + noLlm: args.no_llm, + }); + } else { + const command = ['init', ...(intent ? [intent] : [])]; + if (args.mode === 'existing') command.push('--scan'); + if (args.no_llm) command.push('--no-llm'); + command.push('--json'); + const result = runEngineJson(cwd, command); + if (!result.ok) return {isError: true, content: [{type: 'text', text: result.error!}]}; + init = result.payload as typeof init; } - if (args.mode === 'existing') command.push('--scan'); - if (args.no_llm) command.push('--no-llm'); - command.push('--json'); - - const result = runEngineJson(cwd, command); - if (!result.ok) return {isError: true, content: [{type: 'text', text: result.error!}]}; - const init = result.payload as {clarifyingQuestions?: readonly string[]}; const questions = init.clarifyingQuestions ?? []; const payload = { - status: questions.length > 0 ? 'needs_answers' : 'initialized', + status: + questions.length > 0 + ? 'needs_answers' + : init.onboardingSource === 'deterministic' + ? 'initialized_with_fallback' + : 'initialized', changed: true, ...init, nextQuestion: questions[0] ?? null, @@ -408,6 +460,15 @@ function registerTools(server: McpServer, cwd: string): void { }, }, async (args) => { + if (onboarding) { + const outcome = await onboarding.clarify(args.answer, {cwd, noLlm: args.no_llm}); + if (!outcome.ok) { + return {isError: true, content: [{type: 'text', text: outcome.error ?? 'onboarding clarification failed'}]}; + } + return { + content: [{type: 'text', text: JSON.stringify({...((outcome.report ?? {}) as object), refinementSource: outcome.source}, null, 2)}], + }; + } const command = ['clarify', args.answer, '--json']; if (args.no_llm) command.push('--no-llm'); const result = runEngineJson(cwd, command); diff --git a/tests/cli/clad.test.ts b/tests/cli/clad.test.ts index cd4700b0..bb39c6b2 100644 --- a/tests/cli/clad.test.ts +++ b/tests/cli/clad.test.ts @@ -577,7 +577,13 @@ describe('cli/clad — runServeCommand', () => { StdioMock.mockClear(); setMock.mockClear(); await clad.runServeCommand({cwd: '/tmp/probe'}); - expect(buildMock).toHaveBeenCalledWith({cwd: '/tmp/probe'}); + expect(buildMock).toHaveBeenCalledWith({ + cwd: '/tmp/probe', + onboarding: { + initialize: expect.any(Function), + clarify: expect.any(Function), + }, + }); expect(StdioMock).toHaveBeenCalledOnce(); // v0.2.26 (F-075): clad serve registers its own server so host // adapters route through McpSamplingTransport. diff --git a/tests/cli/setup.test.ts b/tests/cli/setup.test.ts index a0f6e73b..06ae6267 100644 --- a/tests/cli/setup.test.ts +++ b/tests/cli/setup.test.ts @@ -115,15 +115,18 @@ describe('runHostSetup', () => { test('setup wires only global host state and does not create project instructions', async () => { const project = mkdtempSync(join(tmpdir(), 'clad-setup-project-')); + const previousCwd = process.cwd(); writeFileSync(join(project, 'user-file.txt'), 'keep'); mkdirSync(join(home, '.codex'), {recursive: true}); try { + process.chdir(project); await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); expect(existsSync(join(project, 'AGENTS.md'))).toBe(false); expect(existsSync(join(project, 'CLAUDE.md'))).toBe(false); expect(readFileSync(join(project, 'user-file.txt'), 'utf8')).toBe('keep'); } finally { + process.chdir(previousCwd); rmSync(project, {recursive: true, force: true}); } }); diff --git a/tests/serve/init-tools.test.ts b/tests/serve/init-tools.test.ts index 54d06b59..f95347ac 100644 --- a/tests/serve/init-tools.test.ts +++ b/tests/serve/init-tools.test.ts @@ -7,7 +7,12 @@ import {dirname, join} from 'node:path'; import {Client} from '@modelcontextprotocol/sdk/client/index.js'; import {InMemoryTransport} from '@modelcontextprotocol/sdk/inMemory.js'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; +import {vi} from 'vitest'; +import type {SamplingCapableServer} from '../../src/adapters/host/transport.js'; +import {setHostMcpServer} from '../../src/adapters/host/sampling-context.js'; +import {refineOnboarding} from '../../src/cli/clarify.js'; +import {runInit} from '../../src/cli/init.js'; import {saveState} from '../../src/cli/scan/onboarding-state.js'; import {buildServer} from '../../src/serve/server.js'; @@ -17,7 +22,12 @@ interface Pair { } async function makePair(cwd: string): Promise { - const server = buildServer({cwd, name: 'cladding-init-test', version: '0.0.0-test'}); + const server = buildServer({ + cwd, + name: 'cladding-init-test', + version: '0.0.0-test', + onboarding: {initialize: runInit, clarify: refineOnboarding}, + }); const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair(); const client = new Client({name: 'cladding-init-client', version: '0.0.0-test'}); await Promise.all([server.connect(serverTransport), client.connect(clientTransport)]); @@ -65,7 +75,11 @@ describe('serve/server — natural-language init tools', () => { arguments: {mode: 'idea', intent: 'B2B payment SaaS', no_llm: true}, }); expect(result.isError).not.toBe(true); - expect(payload(result)).toMatchObject({status: 'initialized', changed: true}); + expect(payload(result)).toMatchObject({ + status: 'initialized_with_fallback', + changed: true, + onboardingSource: 'deterministic', + }); expect(existsSync(join(dir, 'spec.yaml'))).toBe(true); expect(existsSync(join(dir, 'AGENTS.md'))).toBe(true); expect(existsSync(join(dir, 'CLAUDE.md'))).toBe(true); @@ -74,6 +88,83 @@ describe('serve/server — natural-language init tools', () => { } }); + test('host sampling drives init and clarify in the MCP server process', async () => { + const createMessage = vi + .fn() + .mockResolvedValueOnce({ + content: { + type: 'text', + text: [ + '=== ONBOARDING_MODE ===', + 'greenfield', + '=== PROJECT_CONTEXT_MD ===', + '# Payment platform context', + '=== CAPABILITIES_YAML ===', + 'schema: "0.1"', + 'capabilities:', + ' - id: payments', + ' title: "Payments"', + '=== ARCHITECTURE_YAML ===', + 'layers: []', + '=== SPEC_SEED_TITLE ===', + 'Payment platform', + '=== SCENARIOS_YAML ===', + '[]', + '=== PROJECT_METADATA_YAML ===', + '{}', + '=== CLARIFYING_QUESTIONS ===', + '- Which market launches first?', + ].join('\n'), + }, + }) + .mockResolvedValueOnce({ + content: { + type: 'text', + text: [ + '=== ONBOARDING_MODE ===', + 'greenfield', + '=== PROJECT_CONTEXT_MD ===', + '# Korea launch context', + '=== CAPABILITIES_YAML ===', + 'schema: "0.1"', + 'capabilities: []', + '=== ARCHITECTURE_YAML ===', + 'layers: []', + '=== SPEC_SEED_TITLE ===', + 'Payment platform', + '=== CLARIFYING_QUESTIONS ===', + ].join('\n'), + }, + }); + const disposeSampling = setHostMcpServer({createMessage} as SamplingCapableServer); + const {client, cleanup} = await makePair(dir); + try { + const initialized = await client.callTool({ + name: 'clad_init', + arguments: {mode: 'idea', intent: 'B2B payment SaaS'}, + }); + expect(payload(initialized)).toMatchObject({ + status: 'needs_answers', + onboardingSource: 'llm', + nextQuestion: 'Which market launches first?', + }); + + const clarified = await client.callTool({ + name: 'clad_clarify', + arguments: {answer: 'Korea'}, + }); + expect(payload(clarified)).toMatchObject({ + status: 'done', + remainingQuestions: 0, + refinementSource: 'llm', + }); + expect(createMessage).toHaveBeenCalledTimes(2); + } finally { + disposeSampling(); + await cleanup(); + } + }); + test('document mode loads the full project-local planning document', async () => { mkdirSync(join(dir, 'docs')); const plan = Array.from({length: 40}, (_, i) => `Section ${i}: payment requirement`).join('\n'); From c54cc52bc34cb49fee284477fbe1a7d17520d247 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 14 Jul 2026 15:55:36 +0900 Subject: [PATCH 03/28] chore(spec): refresh verification attestation --- spec/attestation.yaml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 7eb31850..a4a1341d 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -21,10 +21,10 @@ attested_modules: CHANGELOG.md: d437104f3e6b98c3 CLAUDE.md: d81d8832976cd5ee GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 879094d34b157bdf - README.ko.html: 4cf3fa280dc89f5e - README.ko.md: 46cb7908fde99f14 - README.md: ff1cdcdb5e4ce99b + README.html: 1a020a2174f7e1a6 + README.ko.html: 90b6c2c123e863fa + README.ko.md: abf66779d7a314d8 + README.md: 9865e3c9b19a56a6 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -52,7 +52,7 @@ attested_modules: docs/dogfood/claude-code-2026-05-20.md: 04870d41e75576d6 docs/dogfood/gemini-cli-2026-05-20.md: 2da1ba66c4f108f0 docs/feature-cycle.md: 6af4ff8fe15db28a - docs/glossary.md: a098105826459c02 + docs/glossary.md: 4207bd5114b70df0 docs/img/en/ecosystem.svg: ed14d1d17f088b00 docs/img/en/relationship.svg: c7a24203925b4664 docs/img/ko/ecosystem.svg: 2b7341576c2af0a8 @@ -69,13 +69,13 @@ attested_modules: plugins/claude-code/agents/orchestrator.md: d30919c2b78b88e4 plugins/claude-code/agents/planner.md: 9514f785ba65a58c plugins/claude-code/agents/reviewer.md: 91922293457a3d6a - plugins/claude-code/commands/init.md: b7b5beedee6ddafb + plugins/claude-code/commands/init.md: da27018d417ccd26 plugins/claude-code/hooks/hooks.json: 42321ead26fb1da8 plugins/codex/.codex-plugin/plugin.json: e2898491a8fd62b8 plugins/codex/.mcp.json: 43e3f4b2af24aa18 plugins/codex/skills/check/SKILL.md: 355826df90846d2f plugins/codex/skills/developer/SKILL.md: b0ef3775132d159a - plugins/codex/skills/init/SKILL.md: b7b5beedee6ddafb + plugins/codex/skills/init/SKILL.md: da27018d417ccd26 plugins/codex/skills/observability/SKILL.md: 81f73e284ee9b3ba plugins/codex/skills/orchestrator/SKILL.md: d30919c2b78b88e4 plugins/codex/skills/planner/SKILL.md: 9514f785ba65a58c @@ -86,7 +86,7 @@ attested_modules: plugins/codex/skills/sync/SKILL.md: 709c20212aa5627e plugins/gemini-cli/GEMINI.md: ba08eaf2cd557a65 plugins/gemini-cli/commands/README.md: 3527d771578431bd - plugins/gemini-cli/commands/init.toml: fbf24f25bb8cf921 + plugins/gemini-cli/commands/init.toml: 959aae4aa0667332 plugins/gemini-cli/gemini-extension.json: 47685e98f1f67e11 scripts/build-plugin.mjs: 57ffa3f0e6317a6b scripts/build.mjs: 3a4b204063024ef1 @@ -97,7 +97,7 @@ attested_modules: skills/checkpoint/SKILL.md: 97bde8bd4553d38f skills/clarify/SKILL.md: 4b1e37af84817586 skills/doctor/SKILL.md: 5363d3b34e69c516 - skills/init/SKILL.md: b7b5beedee6ddafb + skills/init/SKILL.md: da27018d417ccd26 skills/oracle/SKILL.md: 3fc7f21e0309dad3 skills/rollback/SKILL.md: 2597ab798e61ded8 skills/route/SKILL.md: 624a6cf60db7960d @@ -105,7 +105,7 @@ attested_modules: skills/serve/SKILL.md: 4cee65dfb691e3b0 skills/status/SKILL.md: b3cb6e7a12bf4023 skills/sync/SKILL.md: 709c20212aa5627e - spec.yaml: d16fcb27b7afb3c6 + spec.yaml: bc97738633904690 spec/README.md: 7c257426396d435c spec/architecture.yaml: f0888480405a13a8 spec/features/: a4d0f0eb87fed960 @@ -138,15 +138,15 @@ attested_modules: src/cli: a4d0f0eb87fed960 src/cli/benchmark.ts: 77f84d2a898d724f src/cli/changelog.ts: 2de1adb009b89ab4 - src/cli/clad.ts: aa1c4687e89be1f4 - src/cli/clarify.ts: ff084951de081592 + src/cli/clad.ts: bb42e20baf8949e3 + src/cli/clarify.ts: 3bcb68fe55e6c516 src/cli/doctor-hosts.ts: 1ad79105b47fd8e5 src/cli/doctor.ts: b98b955fe75e7f7e src/cli/done.ts: ad2b2d49034296bd src/cli/graph-serve.ts: 23e6e389225d0f98 src/cli/graph.ts: bab410061b8c746a - src/cli/hook.ts: a856ab95e025bb75 - src/cli/init.ts: 5e55fd44c53a93b9 + src/cli/hook.ts: 201f82f4c89e173f + src/cli/init.ts: caf68d5a9caf1409 src/cli/intent-from-path.ts: e69862821d979f22 src/cli/measure.ts: 3a562f16589e26c2 src/cli/report.ts: 911f859b2446834b @@ -195,7 +195,7 @@ attested_modules: src/init/agents-md.ts: c411aaa8b724d496 src/init/git-hook.ts: 4e02f177b3764ae8 src/init/host-instructions.ts: f6d10695ef0c4763 - src/init/host-setup.ts: ee6bca9c8fbc2fb2 + src/init/host-setup.ts: ffc4007d97049900 src/optimizer: a4d0f0eb87fed960 src/optimizer/code-excerpt.ts: e2c4598efcd28d2a src/optimizer/context-slice.ts: b5864aaed1e7ae48 @@ -218,7 +218,7 @@ attested_modules: src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 - src/serve/server.ts: 0586a1785106e8d0 + src/serve/server.ts: 98c24d3712507231 src/spec: a4d0f0eb87fed960 src/spec/attestation.ts: 294a1e99c42d4aef src/spec/cli.ts: 7a9bcd0f66677810 @@ -316,7 +316,7 @@ attested_modules: src/ui: a4d0f0eb87fed960 src/ui/panel.ts: 8b78cb14dafb28fb src/ui/pulse.ts: ee4255f5c6e49f51 - src/ui/softShell.ts: c095f4185ab3d624 + src/ui/softShell.ts: 6db9d46de2d2e1b0 src/verdict/gate-progress.ts: ac75e3082cc97a40 src/verdict/verdict.ts: 493251b3a2c494d3 tests/adapters/anthropic.test.ts: fa2fc7faf032a782 @@ -324,7 +324,7 @@ attested_modules: tests/adapters/transport.test.ts: 68f22e9e8df7b813 tests/agents/loader.test.ts: a7df7b1c9a95d37d tests/cli/benchmark.test.ts: b4a87289605ee75f - tests/cli/clad.test.ts: 6515b07cfd168433 + tests/cli/clad.test.ts: cb5bec7ba35f4b26 tests/cli/gate-golden-matrix.test.ts: 39cf615407a55abe tests/cli/init.test.ts: 3428a89708fc9330 tests/cli/intent-onboarding.test.ts: 0681b98ce2e74c22 From 958977b43101db11cb0bcb35430626a67940a204 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 14 Jul 2026 17:06:49 +0900 Subject: [PATCH 04/28] feat(F-0f4dd6): make host onboarding consent-safe --- README.md | 4 + docs/glossary.md | 6 +- docs/setup.md | 10 + plugins/claude-code/agents/orchestrator.md | 12 +- plugins/claude-code/commands/init.md | 106 +-- .../claude-code/dist/agents/orchestrator.md | 12 +- plugins/claude-code/dist/clad.js | 808 +++++++++--------- plugins/codex/skills/clarify/SKILL.md | 85 +- plugins/codex/skills/init/SKILL.md | 106 +-- plugins/codex/skills/orchestrator/SKILL.md | 12 +- plugins/gemini-cli/commands/init.toml | 106 +-- skills/clarify/SKILL.md | 85 +- skills/init/SKILL.md | 106 +-- .../natural-language-init-0f4dd6.yaml | 15 + spec/index.yaml | 2 +- src/agents/orchestrator.md | 12 +- src/cli/clad.ts | 4 + src/cli/clarify.ts | 5 +- src/cli/host-onboarding.ts | 134 +++ src/cli/init.ts | 5 +- src/serve/server.ts | 318 ++++--- tests/cli/clad.test.ts | 3 + tests/serve/init-tools.test.ts | 201 +++-- 23 files changed, 989 insertions(+), 1168 deletions(-) create mode 100644 src/cli/host-onboarding.ts diff --git a/README.md b/README.md index 201cc53d..ff57b0c4 100644 --- a/README.md +++ b/README.md @@ -258,6 +258,10 @@ cd Choose the starting point that fits and say it naturally in your AI tool. +Cladding first inspects the project without changing it. Your AI shows the files it plans to create +and asks for confirmation; initialization begins only after your separate affirmative reply. +Opening a project or asking a question about Cladding never authorizes file changes. + #### An idea, nothing else ``` diff --git a/docs/glossary.md b/docs/glossary.md index 3664af50..883c9e21 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -86,8 +86,10 @@ | Tool | Meaning | |---|---| -| `clad_init` | Initialize Cladding from an idea, a project-local planning document, or an existing codebase. | -| `clad_clarify` | Apply the user's answer to the next pending onboarding question. | +| `clad_prepare_init` | Read the project and return a bounded briefing plus one-time token; never writes files. | +| `clad_init` | Validate and apply the host model's structured onboarding draft. | +| `clad_prepare_clarify` | Read current onboarding state and prepare a real user answer for host-model refinement. | +| `clad_clarify` | Validate and apply the host model's structured refinement draft. | | `clad_list_features` | Query features by status/slug. | | `clad_get_feature` | Fetch one feature + ACs by id or slug. | | `clad_run_check` | Run drift detection in-process (terse by default). | diff --git a/docs/setup.md b/docs/setup.md index fe40265c..0559f577 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -29,6 +29,16 @@ All 4 hosts wire cladding as an MCP server — only the wire *location* differs. something you invoke directly and there is no manual connect step. A host may provide an `/mcp` diagnostic view, but normal use starts by asking the AI to apply Cladding to the open project. +Every host follows the same portable onboarding protocol under the surface: Cladding first returns +a read-only, bounded project briefing; the host's own model drafts structured onboarding data; then +Cladding validates and writes it. Follow-up answers use the same prepare/apply split. This requires +only standard MCP tool calls—not server-side sampling—and prevents incomplete, stale, or replayed +drafts from partially changing the project. + +Initialization never writes immediately from the first natural-language request. The host previews +the planned files and asks for confirmation; only a separate affirmative user reply authorizes the +write step. Merely opening a project, asking about Cladding, or running `clad setup` is not consent. + | Host | Primary request | Optional explicit invocation | |---|---|---| | Claude Code | `Apply Cladding to this project` | `/cladding:init` | diff --git a/plugins/claude-code/agents/orchestrator.md b/plugins/claude-code/agents/orchestrator.md index 49b89e79..db1ea39e 100644 --- a/plugins/claude-code/agents/orchestrator.md +++ b/plugins/claude-code/agents/orchestrator.md @@ -29,17 +29,7 @@ You do NOT pre-load Tier C (conventions — developer's concern). 3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. 4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). 5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. -6. **Init + refine policy (의무)** — Two-step Q&A loop that captures intent and refines spec/docs through the user's own answers. - - **Step 6a (init).** Before calling `clad init` on a greenfield project (empty directory or `<3` source files), **ASK THE USER for their project intent in one line**. A natural question is enough: "어떤 종류의 프로젝트인가요? 한 줄로 설명해주세요". Forward the user's reply as the positional intent: `clad init ` (no quotes needed — commander treats trailing tokens as variadic). The init handler routes the LLM to produce a domain-aware project-context + capabilities + architecture + a real first-feature title (used when the AI later registers the first feature via `clad_create_feature`) + 2-3 product-level clarifying questions, and writes `.cladding/onboarding/state.yaml` with the questions marked pending. DO NOT call bare `clad init` on a greenfield workspace — the result is a generic toolchain scaffold that misses the user's actual intent. (For an existing project ≥3 source files, bare `clad init` is fine — the observed scan path captures the codebase shape directly.) - - **Step 6b (clarify loop).** After init, drive the Q&A loop until the onboarding state file is marked `status: done`: - - Read `.cladding/onboarding/state.yaml` and find the first `answer: null` entry. - - Ask the user that exact question in chat, verbatim. Do NOT rephrase technical-sounding questions into your own words — the LLM calibrated them at product-owner vocabulary level. - - When the user replies, run `clad clarify ` (no quotes needed). The handler marks the question answered, calls the LLM with the full Q-A history, refines `docs/project-context.md` + `spec/capabilities.yaml` + `spec/architecture.yaml`, and may add new follow-up questions. - - Loop until `clad clarify --json` reports `status: "done"` OR the user says they have enough. Never invent extra questions — only the LLM's questions are sanctioned for this loop. - - If the user declines to answer a question, accept that and skip it (they can revisit via `clad clarify ` later, since pending state persists). +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes, and wait for a separate affirmative user reply. The original request is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. ## Feature cycle — one feature at a time diff --git a/plugins/claude-code/commands/init.md b/plugins/claude-code/commands/init.md index 8e7da77a..ef6ebedd 100644 --- a/plugins/claude-code/commands/init.md +++ b/plugins/claude-code/commands/init.md @@ -1,101 +1,25 @@ --- -description: Scaffold a cladding workspace. Pass a free-text project description as positional argument to drive intent-aware onboarding — the LLM produces domain-aware spec/docs plus product-level follow-up questions. Use when the user wants to start a new Ironclad project, adopt cladding into an existing repo, or refresh artifacts via re-scan. +description: Scaffold a Cladding workspace from a new idea, a planning document, or an existing project. Use the MCP prepare/apply flow so the current host model drafts domain-aware artifacts without requiring MCP sampling or a shell command. --- # Cladding init -Run `clad init` from the directory where the cladding workspace should live. Idempotent — skips files that already exist unless `--force` is supplied. +Use this workflow only when the user explicitly asks to initialize, adopt, or refresh Cladding. Opening a repository alone is not consent to initialize it. -## Artifacts produced (by Tier) +## Required host workflow -| Tier | File | Authority | -|---|---|---| -| A | `spec.yaml` (seed) | Spec SSoT (Iron Law sealed) | -| A | `spec/scenarios/-.yaml` (v0.3.45+, intent path only) | Spec SSoT (onboarding output) | -| B | `spec/architecture.yaml` | Design SSoT | -| B | `spec/capabilities.yaml` | Design SSoT | -| B | `docs/project-context.md` | Design SSoT (intent + Why/What/Purpose) | -| C | `docs/conventions.md` | derived from observed code OR greenfield seed | -| D | `.cladding/onboarding/state.yaml` (intent path only) | transient — Q&A audit | +1. If a greenfield request has no project intent, ask for one short description. +2. Call `clad_prepare_init` with exactly one starting mode: + - `idea` with the user's description. + - `document` with a project-relative planning-document path. + - `existing` for an existing codebase; include an optional adoption goal. +3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. +4. Show `plannedChanges` and `confirmationQuestion` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only after an affirmative user reply, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. +6. Ask the returned `nextQuestion` verbatim. Continue with the Cladding clarify workflow after the user answers. -See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the full 4-tier governance. +Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. -## Intent-aware onboarding (v0.3.43+) +`clad_prepare_init` is read-only. Never call prepare and apply in the same assistant turn. Only `clad_init` writes artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. -The strongest path is to pass the user's project intent as positional argument (no `--intent` keyword, no quotes needed): - -``` -clad init 결제 SaaS for B2B Stripe Toss 지원 -clad init AI 코드 리뷰 봇 만들거야 -clad init 이 프로젝트 분석해서 클래딩 적용해줘 -``` - -The LLM dispatcher then produces **domain-aware** artifacts that exceed what the user explicitly stated: - -- `docs/project-context.md` — Why/What/Purpose with inferred domain context (compliance norms, scale assumptions, common patterns) -- `spec/capabilities.yaml` — user-stated + inferred capabilities (3-8 entries; payment → idempotency, webhook signing; ML → data lineage, eval harness; SaaS → multi-tenancy, audit log) -- `spec/architecture.yaml` — layers tailored to domain + language -- 2-3 follow-up clarifying questions printed to stdout as CLI hints (product/business level — not technical jargon) - -**AI orchestrators MUST ask the user for intent before invoking `clad init` on a greenfield workspace** (see `src/agents/orchestrator.md` principle 6). A bare `clad init` on a brand-new project falls back to generic toolchain seeds and misses the user's intent. For existing projects (≥3 source files) bare `clad init` is fine — the observed scan path captures shape directly. - -## Flags - -- `--name ` — override the project name (default: cwd basename). -- `--force` — overwrite an existing `spec.yaml`. -- `--scan` — force-walk the existing codebase to write observed artifacts. Default auto-detects (≥3 source files trigger scan); use `--no-scan` to skip even when source is present. Orthogonal to positional intent — can combine (`clad init 결제 SaaS --scan`). -- `--no-llm` — force the deterministic interpreter. Intent text still routes but falls back to a deterministic body quoting the intent verbatim. -- `--roots ` — comma-separated source-root override (e.g. `packages/a/src,packages/b/src`). Otherwise inferred from manifests + directory heuristics. - -When `--scan` runs (or auto-runs on a codebase with ≥3 source files) it writes: - -- `docs/conventions.md` — observed indent / quote / naming / error-handling / test-location conventions plus a representative module quote. -- `spec/architecture.yaml` — observed layers + forbidden-import candidates derived from the import graph. -- `spec/capabilities.yaml` — README `##` headings rendered as capability candidates (v0.3.38+). -- `docs/project-context.md` — forest-level Why / What / Purpose; LLM-refined when a dispatcher is available, deterministic template otherwise. -- `spec/scenarios/README.md` — explains the scenarios-are-intent policy (v0.3.30+). - -Existing files are diverted to `.cladding/scan/*.proposal` rather than overwritten. - -### Greenfield seeds (v0.3.42+) - -When `--scan` does **not** fire (brand-new project with <3 source files), `clad init` still writes the same three artifacts as **greenfield seeds** so the spec/docs surface is always complete: - -- `docs/conventions.md` — toolchain-default 14-signal table. TypeScript → 2-space + single quote + camelCase + `tests-dir` test layout, Python → 4-space + double quote + snake_case, Go → tab + PascalCase + `sibling-test`, Rust → 4-space + snake_case + result-pattern, etc. Each seed inlines a one-line link to the canonical style guide (Google TS / PEP 8 / Effective Go / Google Java / …). -- `spec/architecture.yaml` — `version: "0.1"` + empty `layers: []` + a language-specific baseline suggestion in the header comment (TypeScript → `src/cli/` / `src/core/` / `src/lib/` / `src/ui/`, Python → `src//` / `tests/`, Go → `cmd/` / `pkg/` / `internal/`, …). -- `spec/capabilities.yaml` — `schema: "0.1"` + `source: README.md` + empty `capabilities: []` + guidance comment on the per-entry shape. - -Each seed carries a header marking it as a greenfield template. After you write initial code (and optionally a README), re-run `clad init --scan`; the observed bodies divert to `.cladding/scan/.proposal` so you can diff seed vs reality and merge the parts you want. Personas downstream (`developer`, `planner`) therefore treat every scan artifact as **always present**, with the SEED header telling them which mode is live. - -After init: - -1. Edit `spec.yaml` (project metadata). Features are added on demand — ask the AI in natural language ("add a feature for login flow"), call the `clad_create_feature` MCP tool, or use the `clad` CLI. Feature shards always use the hash-based id `F-` (v0.3.9+) — filename `-.yaml`, `id: F-`, `slug: `. `clad init` does **not** write a legacy `F-001` placeholder for external users (v0.4.0+). -2. Run `clad sync` to verify the spec is valid. -3. Run `clad check` to see which Iron Law stages are wired up for the toolchain cladding detects in the cwd. -4. (Optional) Run `clad doctor` to confirm `.cladding/events.log.jsonl` shows no `sentinel_miss` events from the scan refinement. - -``` -clad init # bare (greenfield seeds + hint, or observed scan) -clad init 결제 SaaS for B2B # intent-aware onboarding (positional, no quotes needed) -clad init "AI 코드 리뷰 봇" # quotes OK too -clad init 이 프로젝트 분석해서 클래딩 적용해줘 # intent that signals existing adoption -clad init docs/plan.md # path-aware intent (v0.3.61+) — file contents auto-loaded as intent -clad init /absolute/path/spec.md # absolute path also supported (same .md/.txt/.yaml/.yml/.markdown rule) -clad init --name my-project -clad init --force -clad init --scan --no-llm -clad init --roots packages/a/src,packages/b/src -``` - -## Path-aware intent (v0.3.61+, F-5f6b45) - -When the positional argument looks like a text-file path (recognized extension `.md` / `.txt` / `.yaml` / `.yml` / `.markdown`) and the file exists under cwd, cladding loads the file body and forwards *that* to the onboarding LLM dispatcher — not the literal path string. This closes the gap where `clad init "$(cat docs/plan.md)"` (shell substitution) was the only way to feed a planning document into onboarding. - -Behavior: - -- **Existing text file** → contents become the intent. stderr prints `loaded intent from ` for transparency. -- **Missing file** with a path-like extension → stderr warning + free-text fallback (the literal argument is forwarded as intent so onboarding still runs). -- **Directory** ending in `.md` (rare) → stderr warning + free-text fallback. -- **Non-text argument** (e.g. `결제 SaaS 만들거야`) → existing free-text behavior, zero regression. - -Host invocations inherit this behavior automatically because every skill, command, and MCP init tool delegates to the same `clad init` engine. Claude Code and Gemini CLI expose `/cladding:init`; in Codex, type `$cladding` and choose `init (cladding)`; MCP-only hosts can ask in natural language. +The raw CLI remains available for terminal, CI, offline, and explicitly configured SDK automation; it is not the primary host onboarding path. diff --git a/plugins/claude-code/dist/agents/orchestrator.md b/plugins/claude-code/dist/agents/orchestrator.md index 49b89e79..db1ea39e 100644 --- a/plugins/claude-code/dist/agents/orchestrator.md +++ b/plugins/claude-code/dist/agents/orchestrator.md @@ -29,17 +29,7 @@ You do NOT pre-load Tier C (conventions — developer's concern). 3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. 4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). 5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. -6. **Init + refine policy (의무)** — Two-step Q&A loop that captures intent and refines spec/docs through the user's own answers. - - **Step 6a (init).** Before calling `clad init` on a greenfield project (empty directory or `<3` source files), **ASK THE USER for their project intent in one line**. A natural question is enough: "어떤 종류의 프로젝트인가요? 한 줄로 설명해주세요". Forward the user's reply as the positional intent: `clad init ` (no quotes needed — commander treats trailing tokens as variadic). The init handler routes the LLM to produce a domain-aware project-context + capabilities + architecture + a real first-feature title (used when the AI later registers the first feature via `clad_create_feature`) + 2-3 product-level clarifying questions, and writes `.cladding/onboarding/state.yaml` with the questions marked pending. DO NOT call bare `clad init` on a greenfield workspace — the result is a generic toolchain scaffold that misses the user's actual intent. (For an existing project ≥3 source files, bare `clad init` is fine — the observed scan path captures the codebase shape directly.) - - **Step 6b (clarify loop).** After init, drive the Q&A loop until the onboarding state file is marked `status: done`: - - Read `.cladding/onboarding/state.yaml` and find the first `answer: null` entry. - - Ask the user that exact question in chat, verbatim. Do NOT rephrase technical-sounding questions into your own words — the LLM calibrated them at product-owner vocabulary level. - - When the user replies, run `clad clarify ` (no quotes needed). The handler marks the question answered, calls the LLM with the full Q-A history, refines `docs/project-context.md` + `spec/capabilities.yaml` + `spec/architecture.yaml`, and may add new follow-up questions. - - Loop until `clad clarify --json` reports `status: "done"` OR the user says they have enough. Never invent extra questions — only the LLM's questions are sanctioned for this loop. - - If the user declines to answer a question, accept that and skip it (they can revisit via `clad clarify ` later, since pending state persists). +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes, and wait for a separate affirmative user reply. The original request is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. ## Feature cycle — one feature at a time diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index d99aa9cd..33cccea1 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 Rue=Object.create;var GE=Object.defineProperty;var Iue=Object.getOwnPropertyDescriptor;var Pue=Object.getOwnPropertyNames;var Cue=Object.getPrototypeOf,Due=Object.prototype.hasOwnProperty;var He=(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Rr=(t,e)=>{for(var r in e)GE(t,r,{get:e[r],enumerable:!0})},Nue=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Pue(e))!Due.call(t,i)&&i!==r&&GE(t,i,{get:()=>e[i],enumerable:!(n=Iue(e,i))||n.enumerable});return t};var Et=(t,e,r)=>(r=t!=null?Rue(Cue(t)):{},Nue(e||!t||!t.__esModule?GE(r,"default",{value:t,enumerable:!0}):r,t));var Ld=v(VE=>{var qg=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}},ZE=class extends qg{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};VE.CommanderError=qg;VE.InvalidArgumentError=ZE});var Bg=v(KE=>{var{InvalidArgumentError:jue}=Ld(),WE=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 jue(`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 Mue(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}KE.Argument=WE;KE.humanReadableArgName=Mue});var XE=v(YE=>{var{humanReadableArgName:Fue}=Bg(),JE=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=>Fue(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 yq(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ir=(t,e)=>{for(var r in e)JE(t,r,{get:e[r],enumerable:!0})},Gue=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of que(e))!Hue.call(t,i)&&i!==r&&JE(t,i,{get:()=>e[i],enumerable:!(n=Uue(e,i))||n.enumerable});return t};var bt=(t,e,r)=>(r=t!=null?zue(Bue(t)):{},Gue(e||!t||!t.__esModule?JE(r,"default",{value:t,enumerable:!0}):r,t));var zd=v(XE=>{var Gg=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}},YE=class extends Gg{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};XE.CommanderError=Gg;XE.InvalidArgumentError=YE});var Zg=v(eA=>{var{InvalidArgumentError:Zue}=zd(),QE=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 Zue(`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 Vue(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}eA.Argument=QE;eA.humanReadableArgName=Vue});var nA=v(rA=>{var{humanReadableArgName:Wue}=Zg(),tA=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=>Wue(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 xq(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 yq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}YE.Help=JE;YE.stripColor=yq});var rA=v(tA=>{var{InvalidArgumentError:Lue}=Ld(),QE=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=zue(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 Lue(`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?_q(this.name().replace(/^no-/,"")):_q(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}},eA=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 _q(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function zue(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 xq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}rA.Help=tA;rA.stripColor=xq});var aA=v(sA=>{var{InvalidArgumentError:Kue}=zd(),iA=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=Jue(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 Kue(`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?$q(this.name().replace(/^no-/,"")):$q(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}},oA=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 $q(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Jue(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}}tA.Option=QE;tA.DualOptions=eA});var vq=v(bq=>{function Uue(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 que(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=Uue(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}}sA.Option=iA;sA.DualOptions=oA});var Eq=v(kq=>{function Yue(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 Xue(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=Yue(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]}?)`:""}bq.suggestSimilar=que});var $q=v(aA=>{var Bue=He("node:events").EventEmitter,nA=He("node:child_process"),ro=He("node:path"),Hg=He("node:fs"),Ue=He("node:process"),{Argument:Hue,humanReadableArgName:Gue}=Bg(),{CommanderError:iA}=Ld(),{Help:Zue,stripColor:Vue}=XE(),{Option:Sq,DualOptions:Wue}=rA(),{suggestSimilar:wq}=vq(),oA=class t extends Bue{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>sA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>sA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Vue(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 Zue,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 Hue(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 iA(e,r,n)),Ue.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 Sq(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 Sq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(Hg.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]}?)`:""}kq.suggestSimilar=Xue});var Rq=v(fA=>{var Que=He("node:events").EventEmitter,cA=He("node:child_process"),oo=He("node:path"),Vg=He("node:fs"),Ue=He("node:process"),{Argument:ede,humanReadableArgName:tde}=Zg(),{CommanderError:lA}=zd(),{Help:rde,stripColor:nde}=nA(),{Option:Aq,DualOptions:ide}=aA(),{suggestSimilar:Tq}=Eq(),uA=class t extends Que{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>dA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>dA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>nde(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 rde,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 ede(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 lA(e,r,n)),Ue.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 Aq(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 Aq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(Vg.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=ro.resolve(u,d);if(Hg.existsSync(f))return f;if(i.includes(ro.extname(d)))return;let p=i.find(m=>Hg.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=Hg.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=ro.resolve(ro.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=ro.basename(this._scriptPath,ro.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(ro.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=xq(Ue.execArgv).concat(r),c=nA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=nA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=xq(Ue.execArgv).concat(r),c=nA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 iA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new iA(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=oo.resolve(u,d);if(Vg.existsSync(f))return f;if(i.includes(oo.extname(d)))return;let p=i.find(m=>Vg.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=Vg.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=oo.resolve(oo.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=oo.basename(this._scriptPath,oo.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(oo.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Oq(Ue.execArgv).concat(r),c=cA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=cA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Oq(Ue.execArgv).concat(r),c=cA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 lA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new lA(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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Wue(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=wq(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=wq(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=>Gue(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=ro.basename(e,ro.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(Ue.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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new ide(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=Tq(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=Tq(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=>tde(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=oo.basename(e,oo.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(Ue.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 xq(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 sA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}aA.Command=oA;aA.useColor=sA});var Tq=v(vn=>{var{Argument:kq}=Bg(),{Command:cA}=$q(),{CommanderError:Kue,InvalidArgumentError:Eq}=Ld(),{Help:Jue}=XE(),{Option:Aq}=rA();vn.program=new cA;vn.createCommand=t=>new cA(t);vn.createOption=(t,e)=>new Aq(t,e);vn.createArgument=(t,e)=>new kq(t,e);vn.Command=cA;vn.Option=Aq;vn.Argument=kq;vn.Help=Jue;vn.CommanderError=Kue;vn.InvalidArgumentError=Eq;vn.InvalidOptionArgumentError=Eq});var Ce=v(Jt=>{"use strict";var uA=Symbol.for("yaml.alias"),Pq=Symbol.for("yaml.document"),Gg=Symbol.for("yaml.map"),Cq=Symbol.for("yaml.pair"),dA=Symbol.for("yaml.scalar"),Zg=Symbol.for("yaml.seq"),no=Symbol.for("yaml.node.type"),rde=t=>!!t&&typeof t=="object"&&t[no]===uA,nde=t=>!!t&&typeof t=="object"&&t[no]===Pq,ide=t=>!!t&&typeof t=="object"&&t[no]===Gg,ode=t=>!!t&&typeof t=="object"&&t[no]===Cq,Dq=t=>!!t&&typeof t=="object"&&t[no]===dA,sde=t=>!!t&&typeof t=="object"&&t[no]===Zg;function Nq(t){if(t&&typeof t=="object")switch(t[no]){case Gg:case Zg:return!0}return!1}function ade(t){if(t&&typeof t=="object")switch(t[no]){case uA:case Gg:case dA:case Zg:return!0}return!1}var cde=t=>(Dq(t)||Nq(t))&&!!t.anchor;Jt.ALIAS=uA;Jt.DOC=Pq;Jt.MAP=Gg;Jt.NODE_TYPE=no;Jt.PAIR=Cq;Jt.SCALAR=dA;Jt.SEQ=Zg;Jt.hasAnchor=cde;Jt.isAlias=rde;Jt.isCollection=Nq;Jt.isDocument=nde;Jt.isMap=ide;Jt.isNode=ade;Jt.isPair=ode;Jt.isScalar=Dq;Jt.isSeq=sde});var zd=v(fA=>{"use strict";var Mt=Ce(),Ir=Symbol("break visit"),jq=Symbol("skip children"),bi=Symbol("remove node");function Vg(t,e){let r=Mq(e);Mt.isDocument(t)?jc(null,t.contents,r,Object.freeze([t]))===bi&&(t.contents=null):jc(null,t,r,Object.freeze([]))}Vg.BREAK=Ir;Vg.SKIP=jq;Vg.REMOVE=bi;function jc(t,e,r,n){let i=Fq(t,e,r,n);if(Mt.isNode(i)||Mt.isPair(i))return Lq(t,n,i),jc(t,i,r,n);if(typeof i!="symbol"){if(Mt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var zq=Ce(),lde=zd(),ude={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},dde=t=>t.replace(/[!,[\]{}]/g,e=>ude[e]),Ud=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+dde(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&&zq.isNode(e.contents)){let o={};lde.visit(e.contents,(s,a)=>{zq.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(` -`)}};Ud.defaultYaml={explicit:!1,version:"1.2"};Ud.defaultTags={"!!":"tag:yaml.org,2002:"};Uq.Directives=Ud});var Kg=v(qd=>{"use strict";var qq=Ce(),fde=zd();function pde(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 Bq(t){let e=new Set;return fde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function Hq(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function mde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=Bq(t));let s=Hq(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(qq.isScalar(s.node)||qq.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}}qd.anchorIsValid=pde;qd.anchorNames=Bq;qd.createNodeAnchors=mde;qd.findNewAnchor=Hq});var mA=v(Gq=>{"use strict";function Bd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var hde=Ce();function Zq(t,e,r){if(Array.isArray(t))return t.map((n,i)=>Zq(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!hde.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}Vq.toJS=Zq});var Jg=v(Kq=>{"use strict";var gde=mA(),Wq=Ce(),yde=zo(),hA=class{constructor(e){Object.defineProperty(this,Wq.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(!Wq.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=yde.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?gde.applyReviver(o,{"":a},"",a):a}};Kq.NodeBase=hA});var Hd=v(Jq=>{"use strict";var _de=Kg(),bde=zd(),Fc=Ce(),vde=Jg(),Sde=zo(),gA=class extends vde.NodeBase{constructor(e){super(Fc.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=[],bde.visit(e,{Node:(o,s)=>{(Fc.isAlias(s)||Fc.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||(Sde.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=Yg(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(_de.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 Yg(t,e,r){if(Fc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Fc.isCollection(e)){let n=0;for(let i of e.items){let o=Yg(t,i,r);o>n&&(n=o)}return n}else if(Fc.isPair(e)){let n=Yg(t,e.key,r),i=Yg(t,e.value,r);return Math.max(n,i)}return 1}Jq.Alias=gA});var It=v(yA=>{"use strict";var wde=Ce(),xde=Jg(),$de=zo(),kde=t=>!t||typeof t!="function"&&typeof t!="object",Uo=class extends xde.NodeBase{constructor(e){super(wde.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:$de.toJS(this.value,e,r)}toString(){return String(this.value)}};Uo.BLOCK_FOLDED="BLOCK_FOLDED";Uo.BLOCK_LITERAL="BLOCK_LITERAL";Uo.PLAIN="PLAIN";Uo.QUOTE_DOUBLE="QUOTE_DOUBLE";Uo.QUOTE_SINGLE="QUOTE_SINGLE";yA.Scalar=Uo;yA.isScalarValue=kde});var Gd=v(Xq=>{"use strict";var Ede=Hd(),ra=Ce(),Yq=It(),Ade="tag:yaml.org,2002:";function Tde(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 Ode(t,e,r){if(ra.isDocument(t)&&(t=t.contents),ra.isNode(t))return t;if(ra.isPair(t)){let d=r.schema[ra.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 Ede.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Ade+e.slice(2));let l=Tde(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new Yq.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ra.MAP]:Symbol.iterator in Object(t)?s[ra.SEQ]:s[ra.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 Yq.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Xq.createNode=Ode});var Qg=v(Xg=>{"use strict";var Rde=Gd(),vi=Ce(),Ide=Jg();function _A(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 Rde.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 Qq=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,bA=class extends Ide.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=>vi.isNode(n)||vi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(Qq(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(vi.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,_A(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(vi.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&&vi.isScalar(o)?o.value:o:vi.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!vi.isPair(r))return!1;let n=r.value;return n==null||e&&vi.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 vi.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(vi.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,_A(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Xg.Collection=bA;Xg.collectionFromPath=_A;Xg.isEmptyPath=Qq});var Zd=v(ey=>{"use strict";var Pde=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function vA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Cde=(t,e,r)=>t.endsWith(` -`)?vA(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 Oq(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 dA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}fA.Command=uA;fA.useColor=dA});var Dq=v(wn=>{var{Argument:Iq}=Zg(),{Command:pA}=Rq(),{CommanderError:ode,InvalidArgumentError:Pq}=zd(),{Help:sde}=nA(),{Option:Cq}=aA();wn.program=new pA;wn.createCommand=t=>new pA(t);wn.createOption=(t,e)=>new Cq(t,e);wn.createArgument=(t,e)=>new Iq(t,e);wn.Command=pA;wn.Option=Cq;wn.Argument=Iq;wn.Help=sde;wn.CommanderError=ode;wn.InvalidArgumentError=Pq;wn.InvalidOptionArgumentError=Pq});var Ce=v(Yt=>{"use strict";var hA=Symbol.for("yaml.alias"),Fq=Symbol.for("yaml.document"),Wg=Symbol.for("yaml.map"),Lq=Symbol.for("yaml.pair"),gA=Symbol.for("yaml.scalar"),Kg=Symbol.for("yaml.seq"),so=Symbol.for("yaml.node.type"),fde=t=>!!t&&typeof t=="object"&&t[so]===hA,pde=t=>!!t&&typeof t=="object"&&t[so]===Fq,mde=t=>!!t&&typeof t=="object"&&t[so]===Wg,hde=t=>!!t&&typeof t=="object"&&t[so]===Lq,zq=t=>!!t&&typeof t=="object"&&t[so]===gA,gde=t=>!!t&&typeof t=="object"&&t[so]===Kg;function Uq(t){if(t&&typeof t=="object")switch(t[so]){case Wg:case Kg:return!0}return!1}function yde(t){if(t&&typeof t=="object")switch(t[so]){case hA:case Wg:case gA:case Kg:return!0}return!1}var _de=t=>(zq(t)||Uq(t))&&!!t.anchor;Yt.ALIAS=hA;Yt.DOC=Fq;Yt.MAP=Wg;Yt.NODE_TYPE=so;Yt.PAIR=Lq;Yt.SCALAR=gA;Yt.SEQ=Kg;Yt.hasAnchor=_de;Yt.isAlias=fde;Yt.isCollection=Uq;Yt.isDocument=pde;Yt.isMap=mde;Yt.isNode=yde;Yt.isPair=hde;Yt.isScalar=zq;Yt.isSeq=gde});var Ud=v(yA=>{"use strict";var Mt=Ce(),Pr=Symbol("break visit"),qq=Symbol("skip children"),Si=Symbol("remove node");function Jg(t,e){let r=Bq(e);Mt.isDocument(t)?Mc(null,t.contents,r,Object.freeze([t]))===Si&&(t.contents=null):Mc(null,t,r,Object.freeze([]))}Jg.BREAK=Pr;Jg.SKIP=qq;Jg.REMOVE=Si;function Mc(t,e,r,n){let i=Hq(t,e,r,n);if(Mt.isNode(i)||Mt.isPair(i))return Gq(t,n,i),Mc(t,i,r,n);if(typeof i!="symbol"){if(Mt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var Zq=Ce(),bde=Ud(),vde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Sde=t=>t.replace(/[!,[\]{}]/g,e=>vde[e]),qd=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+Sde(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&&Zq.isNode(e.contents)){let o={};bde.visit(e.contents,(s,a)=>{Zq.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(` +`)}};qd.defaultYaml={explicit:!1,version:"1.2"};qd.defaultTags={"!!":"tag:yaml.org,2002:"};Vq.Directives=qd});var Xg=v(Bd=>{"use strict";var Wq=Ce(),wde=Ud();function xde(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 Kq(t){let e=new Set;return wde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function Jq(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function $de(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=Kq(t));let s=Jq(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(Wq.isScalar(s.node)||Wq.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}}Bd.anchorIsValid=xde;Bd.anchorNames=Kq;Bd.createNodeAnchors=$de;Bd.findNewAnchor=Jq});var bA=v(Yq=>{"use strict";function Hd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var kde=Ce();function Xq(t,e,r){if(Array.isArray(t))return t.map((n,i)=>Xq(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!kde.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}Qq.toJS=Xq});var Qg=v(t4=>{"use strict";var Ede=bA(),e4=Ce(),Ade=Uo(),vA=class{constructor(e){Object.defineProperty(this,e4.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(!e4.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=Ade.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Ede.applyReviver(o,{"":a},"",a):a}};t4.NodeBase=vA});var Gd=v(r4=>{"use strict";var Tde=Xg(),Ode=Ud(),Lc=Ce(),Rde=Qg(),Ide=Uo(),SA=class extends Rde.NodeBase{constructor(e){super(Lc.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=[],Ode.visit(e,{Node:(o,s)=>{(Lc.isAlias(s)||Lc.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||(Ide.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=ey(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(Tde.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 ey(t,e,r){if(Lc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Lc.isCollection(e)){let n=0;for(let i of e.items){let o=ey(t,i,r);o>n&&(n=o)}return n}else if(Lc.isPair(e)){let n=ey(t,e.key,r),i=ey(t,e.value,r);return Math.max(n,i)}return 1}r4.Alias=SA});var It=v(wA=>{"use strict";var Pde=Ce(),Cde=Qg(),Dde=Uo(),Nde=t=>!t||typeof t!="function"&&typeof t!="object",qo=class extends Cde.NodeBase{constructor(e){super(Pde.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Dde.toJS(this.value,e,r)}toString(){return String(this.value)}};qo.BLOCK_FOLDED="BLOCK_FOLDED";qo.BLOCK_LITERAL="BLOCK_LITERAL";qo.PLAIN="PLAIN";qo.QUOTE_DOUBLE="QUOTE_DOUBLE";qo.QUOTE_SINGLE="QUOTE_SINGLE";wA.Scalar=qo;wA.isScalarValue=Nde});var Zd=v(i4=>{"use strict";var jde=Gd(),na=Ce(),n4=It(),Mde="tag:yaml.org,2002:";function Fde(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 Lde(t,e,r){if(na.isDocument(t)&&(t=t.contents),na.isNode(t))return t;if(na.isPair(t)){let d=r.schema[na.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 jde.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Mde+e.slice(2));let l=Fde(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new n4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[na.MAP]:Symbol.iterator in Object(t)?s[na.SEQ]:s[na.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 n4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}i4.createNode=Lde});var ry=v(ty=>{"use strict";var zde=Zd(),wi=Ce(),Ude=Qg();function xA(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 zde.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 o4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,$A=class extends Ude.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=>wi.isNode(n)||wi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(o4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(wi.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,xA(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(wi.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&&wi.isScalar(o)?o.value:o:wi.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!wi.isPair(r))return!1;let n=r.value;return n==null||e&&wi.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 wi.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(wi.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,xA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};ty.Collection=$A;ty.collectionFromPath=xA;ty.isEmptyPath=o4});var Vd=v(ny=>{"use strict";var qde=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function kA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Bde=(t,e,r)=>t.endsWith(` +`)?kA(r,e):r.includes(` `)?` -`+vA(r,e):(t.endsWith(" ")?"":" ")+r;ey.indentComment=vA;ey.lineComment=Cde;ey.stringifyComment=Pde});var t4=v(Vd=>{"use strict";var Dde="flow",SA="block",ty="quoted";function Nde(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===SA&&(h=e4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===ty&&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===SA&&(h=e4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+kA(r,e):(t.endsWith(" ")?"":" ")+r;ny.indentComment=kA;ny.lineComment=Bde;ny.stringifyComment=qde});var a4=v(Wd=>{"use strict";var Hde="flow",EA="block",iy="quoted";function Gde(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===EA&&(h=s4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===iy&&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===EA&&(h=s4(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===ty){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 Bn=It(),qo=t4(),ny=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),iy=t=>/^(%|---|\.\.\.)/m.test(t);function jde(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 Wd(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(iy(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===iy){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 Hn=It(),Bo=a4(),sy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),ay=t=>/^(%|---|\.\.\.)/m.test(t);function Zde(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 Kd(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(ay(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(xA,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{O=!0});let E=qo.foldFlowLines(`${_}${w}${p}`,l,qo.FOLD_BLOCK,A);if(!O)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),R=!1,A=sy(n,!0);s!=="folded"&&e!==Hn.Scalar.BLOCK_FOLDED&&(A.onOverflow=()=>{R=!0});let E=Bo.foldFlowLines(`${_}${w}${p}`,l,Bo.FOLD_BLOCK,A);if(!R)return`>${x} ${l}${E}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function Mde(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 Lc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?Lc(o,e):ry(t,e,r,n);if(!a&&!u&&i!==Bn.Scalar.PLAIN&&o.includes(` -`))return ry(t,e,r,n);if(iy(o)){if(c==="")return e.forceBlockIndent=!0,ry(t,e,r,n);if(a&&c===l)return Lc(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 Lc(o,e)}return a?d:qo.foldFlowLines(d,c,qo.FOLD_FLOW,ny(e,!1))}function Fde(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!==Bn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Bn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Bn.Scalar.BLOCK_FOLDED:case Bn.Scalar.BLOCK_LITERAL:return i||o?Lc(s.value,e):ry(s,e,r,n);case Bn.Scalar.QUOTE_DOUBLE:return Wd(s.value,e);case Bn.Scalar.QUOTE_SINGLE:return wA(s.value,e);case Bn.Scalar.PLAIN:return Mde(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}r4.stringifyString=Fde});var Jd=v($A=>{"use strict";var Lde=Kg(),Bo=Ce(),zde=Zd(),Ude=Kd();function qde(t,e){let r=Object.assign({blockQuote:!0,commentString:zde.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 Bde(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(Bo.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 Hde(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Bo.isScalar(t)||Bo.isCollection(t))&&t.anchor;o&&Lde.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 Gde(t,e,r,n){if(Bo.isPair(t))return t.toString(e,r,n);if(Bo.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=Bo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Bde(e.doc.schema.tags,o));let s=Hde(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):Bo.isScalar(o)?Ude.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Bo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}$A.createStringifyContext=qde;$A.stringify=Gde});var s4=v(o4=>{"use strict";var io=Ce(),n4=It(),i4=Jd(),Yd=Zd();function Zde({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=io.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(io.isCollection(t)||!io.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||io.isCollection(t)||(io.isScalar(t)?t.type===n4.Scalar.BLOCK_FOLDED||t.type===n4.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=i4.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+=Yd.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Yd.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=Yd.lineComment(g,r.indent,l(f))));let b,_,S;io.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&&io.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&io.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=i4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` -`:"",_){let A=l(_);O+=` -${Yd.indentComment(A,r.indent)}`}w===""&&!r.inFlow?O===` -`&&S&&(O=` - -`):O+=` -${r.indent}`}else if(!p&&io.isCollection(e)){let A=w[0],E=w.indexOf(` -`),C=E!==-1,k=r.inFlow??e.flow??e.items.length===0;if(C||!k){let q=!1;if(C&&(A==="&"||A==="!")){let Q=w.indexOf(" ");A==="&"&&Q!==-1&&Q'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?zc(o,e):oy(t,e,r,n);if(!a&&!u&&i!==Hn.Scalar.PLAIN&&o.includes(` +`))return oy(t,e,r,n);if(ay(o)){if(c==="")return e.forceBlockIndent=!0,oy(t,e,r,n);if(a&&c===l)return zc(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 zc(o,e)}return a?d:Bo.foldFlowLines(d,c,Bo.FOLD_FLOW,sy(e,!1))}function Wde(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!==Hn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Hn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Hn.Scalar.BLOCK_FOLDED:case Hn.Scalar.BLOCK_LITERAL:return i||o?zc(s.value,e):oy(s,e,r,n);case Hn.Scalar.QUOTE_DOUBLE:return Kd(s.value,e);case Hn.Scalar.QUOTE_SINGLE:return AA(s.value,e);case Hn.Scalar.PLAIN:return Vde(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}c4.stringifyString=Wde});var Yd=v(OA=>{"use strict";var Kde=Xg(),Ho=Ce(),Jde=Vd(),Yde=Jd();function Xde(t,e){let r=Object.assign({blockQuote:!0,commentString:Jde.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 Qde(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(Ho.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 efe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Ho.isScalar(t)||Ho.isCollection(t))&&t.anchor;o&&Kde.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 tfe(t,e,r,n){if(Ho.isPair(t))return t.toString(e,r,n);if(Ho.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=Ho.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Qde(e.doc.schema.tags,o));let s=efe(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):Ho.isScalar(o)?Yde.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Ho.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}OA.createStringifyContext=Xde;OA.stringify=tfe});var f4=v(d4=>{"use strict";var ao=Ce(),l4=It(),u4=Yd(),Xd=Vd();function rfe({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=ao.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(ao.isCollection(t)||!ao.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||ao.isCollection(t)||(ao.isScalar(t)?t.type===l4.Scalar.BLOCK_FOLDED||t.type===l4.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=u4.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+=Xd.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Xd.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=Xd.lineComment(g,r.indent,l(f))));let b,_,S;ao.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&&ao.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&ao.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=u4.stringify(e,r,()=>x=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` +`:"",_){let A=l(_);R+=` +${Xd.indentComment(A,r.indent)}`}w===""&&!r.inFlow?R===` +`&&S&&(R=` + +`):R+=` +${r.indent}`}else if(!p&&ao.isCollection(e)){let A=w[0],E=w.indexOf(` +`),D=E!==-1,k=r.inFlow??e.flow??e.items.length===0;if(D||!k){let B=!1;if(D&&(A==="&"||A==="!")){let Q=w.indexOf(" ");A==="&"&&Q!==-1&&Q{"use strict";var a4=He("process");function Vde(t,...e){t==="debug"&&console.log(...e)}function Wde(t,e){(t==="debug"||t==="warn")&&(typeof a4.emitWarning=="function"?a4.emitWarning(e):console.warn(e))}kA.debug=Vde;kA.warn=Wde});var ly=v(cy=>{"use strict";var ay=Ce(),c4=It(),oy="<<",sy={identify:t=>t===oy||typeof t=="symbol"&&t.description===oy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new c4.Scalar(Symbol(oy)),{addToJSMap:l4}),stringify:()=>oy},Kde=(t,e)=>(sy.identify(e)||ay.isScalar(e)&&(!e.type||e.type===c4.Scalar.PLAIN)&&sy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===sy.tag&&r.default);function l4(t,e,r){let n=u4(t,r);if(ay.isSeq(n))for(let i of n.items)AA(t,e,i);else if(Array.isArray(n))for(let i of n)AA(t,e,i);else AA(t,e,n)}function AA(t,e,r){let n=u4(t,r);if(!ay.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 u4(t,e){return t&&ay.isAlias(e)?e.resolve(t.doc,t):e}cy.addMergeToJSMap=l4;cy.isMergeKey=Kde;cy.merge=sy});var OA=v(p4=>{"use strict";var Jde=EA(),d4=ly(),Yde=Jd(),f4=Ce(),TA=zo();function Xde(t,e,{key:r,value:n}){if(f4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(d4.isMergeKey(t,r))d4.addMergeToJSMap(t,e,n);else{let i=TA.toJS(r,"",t);if(e instanceof Map)e.set(i,TA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Qde(r,i,t),s=TA.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 Qde(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(f4.isNode(t)&&r?.doc){let n=Yde.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)+'..."'),Jde.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)}p4.addPairToJSMap=Xde});var Ho=v(RA=>{"use strict";var m4=Gd(),efe=s4(),tfe=OA(),uy=Ce();function rfe(t,e,r){let n=m4.createNode(t,void 0,r),i=m4.createNode(e,void 0,r);return new dy(n,i)}var dy=class t{constructor(e,r=null){Object.defineProperty(this,uy.NODE_TYPE,{value:uy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return uy.isNode(r)&&(r=r.clone(e)),uy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return tfe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?efe.stringifyPair(this,e,r,n):JSON.stringify(this)}};RA.Pair=dy;RA.createPair=rfe});var IA=v(g4=>{"use strict";var na=Ce(),h4=Jd(),fy=Zd();function nfe(t,e,r){return(e.inFlow??t.flow?ofe:ife)(t,e,r)}function ife({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+=fy.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 p4=He("process");function nfe(t,...e){t==="debug"&&console.log(...e)}function ife(t,e){(t==="debug"||t==="warn")&&(typeof p4.emitWarning=="function"?p4.emitWarning(e):console.warn(e))}RA.debug=nfe;RA.warn=ife});var fy=v(dy=>{"use strict";var uy=Ce(),m4=It(),cy="<<",ly={identify:t=>t===cy||typeof t=="symbol"&&t.description===cy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new m4.Scalar(Symbol(cy)),{addToJSMap:h4}),stringify:()=>cy},ofe=(t,e)=>(ly.identify(e)||uy.isScalar(e)&&(!e.type||e.type===m4.Scalar.PLAIN)&&ly.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===ly.tag&&r.default);function h4(t,e,r){let n=g4(t,r);if(uy.isSeq(n))for(let i of n.items)PA(t,e,i);else if(Array.isArray(n))for(let i of n)PA(t,e,i);else PA(t,e,n)}function PA(t,e,r){let n=g4(t,r);if(!uy.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 g4(t,e){return t&&uy.isAlias(e)?e.resolve(t.doc,t):e}dy.addMergeToJSMap=h4;dy.isMergeKey=ofe;dy.merge=ly});var DA=v(b4=>{"use strict";var sfe=IA(),y4=fy(),afe=Yd(),_4=Ce(),CA=Uo();function cfe(t,e,{key:r,value:n}){if(_4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(y4.isMergeKey(t,r))y4.addMergeToJSMap(t,e,n);else{let i=CA.toJS(r,"",t);if(e instanceof Map)e.set(i,CA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=lfe(r,i,t),s=CA.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 lfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(_4.isNode(t)&&r?.doc){let n=afe.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)+'..."'),sfe.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)}b4.addPairToJSMap=cfe});var Go=v(NA=>{"use strict";var v4=Zd(),ufe=f4(),dfe=DA(),py=Ce();function ffe(t,e,r){let n=v4.createNode(t,void 0,r),i=v4.createNode(e,void 0,r);return new my(n,i)}var my=class t{constructor(e,r=null){Object.defineProperty(this,py.NODE_TYPE,{value:py.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return py.isNode(r)&&(r=r.clone(e)),py.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return dfe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?ufe.stringifyPair(this,e,r,n):JSON.stringify(this)}};NA.Pair=my;NA.createPair=ffe});var jA=v(w4=>{"use strict";var ia=Ce(),S4=Yd(),hy=Vd();function pfe(t,e,r){return(e.inFlow??t.flow?hfe:mfe)(t,e,r)}function mfe({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+=hy.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+=fy.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?` +`+hy.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function hfe({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+=hy.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 py({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=fy.indentComment(e(n),t);r.push(o.trimStart())}}g4.stringifyCollection=nfe});var Zo=v(CA=>{"use strict";var sfe=IA(),afe=OA(),cfe=Qg(),Go=Ce(),my=Ho(),lfe=It();function Xd(t,e){let r=Go.isScalar(e)?e.value:e;for(let n of t)if(Go.isPair(n)&&(n.key===e||n.key===r||Go.isScalar(n.key)&&n.key.value===r))return n}var PA=class extends cfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Go.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(my.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;Go.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new my.Pair(e,e?.value):n=new my.Pair(e.key,e.value);let i=Xd(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Go.isScalar(i.value)&&lfe.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=Xd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Xd(this.items,e)?.value;return(!r&&Go.isScalar(i)?i.value:i)??void 0}has(e){return!!Xd(this.items,e)}set(e,r){this.add(new my.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)afe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Go.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})),sfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};CA.YAMLMap=PA;CA.findPair=Xd});var zc=v(_4=>{"use strict";var ufe=Ce(),y4=Zo(),dfe={collection:"map",default:!0,nodeClass:y4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return ufe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>y4.YAMLMap.from(t,e,r)};_4.map=dfe});var Vo=v(b4=>{"use strict";var ffe=Gd(),pfe=IA(),mfe=Qg(),gy=Ce(),hfe=It(),gfe=zo(),DA=class extends mfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(gy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=hy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=hy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&gy.isScalar(i)?i.value:i}has(e){let r=hy(e);return typeof r=="number"&&r=0?e:null}b4.YAMLSeq=DA});var Uc=v(S4=>{"use strict";var yfe=Ce(),v4=Vo(),_fe={collection:"seq",default:!0,nodeClass:v4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return yfe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>v4.YAMLSeq.from(t,e,r)};S4.seq=_fe});var Qd=v(w4=>{"use strict";var bfe=Kd(),vfe={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),bfe.stringifyString(t,e,r,n)}};w4.string=vfe});var yy=v(k4=>{"use strict";var x4=It(),$4={identify:t=>t==null,createNode:()=>new x4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new x4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&$4.test.test(t)?t:e.options.nullStr};k4.nullTag=$4});var NA=v(A4=>{"use strict";var Sfe=It(),E4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Sfe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&E4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};A4.boolTag=E4});var qc=v(T4=>{"use strict";function wfe({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}T4.stringifyNumber=wfe});var MA=v(_y=>{"use strict";var xfe=It(),jA=qc(),$fe={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:jA.stringifyNumber},kfe={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():jA.stringifyNumber(t)}},Efe={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 xfe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:jA.stringifyNumber};_y.float=Efe;_y.floatExp=kfe;_y.floatNaN=$fe});var LA=v(vy=>{"use strict";var O4=qc(),by=t=>typeof t=="bigint"||Number.isInteger(t),FA=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function R4(t,e,r){let{value:n}=t;return by(n)&&n>=0?r+n.toString(e):O4.stringifyNumber(t)}var Afe={identify:t=>by(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>FA(t,2,8,r),stringify:t=>R4(t,8,"0o")},Tfe={identify:by,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>FA(t,0,10,r),stringify:O4.stringifyNumber},Ofe={identify:t=>by(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>FA(t,2,16,r),stringify:t=>R4(t,16,"0x")};vy.int=Tfe;vy.intHex=Ofe;vy.intOct=Afe});var P4=v(I4=>{"use strict";var Rfe=zc(),Ife=yy(),Pfe=Uc(),Cfe=Qd(),Dfe=NA(),zA=MA(),UA=LA(),Nfe=[Rfe.map,Pfe.seq,Cfe.string,Ife.nullTag,Dfe.boolTag,UA.intOct,UA.int,UA.intHex,zA.floatNaN,zA.floatExp,zA.float];I4.schema=Nfe});var N4=v(D4=>{"use strict";var jfe=It(),Mfe=zc(),Ffe=Uc();function C4(t){return typeof t=="bigint"||Number.isInteger(t)}var Sy=({value:t})=>JSON.stringify(t),Lfe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Sy},{identify:t=>t==null,createNode:()=>new jfe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Sy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Sy},{identify:C4,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})=>C4(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:Sy}],zfe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Ufe=[Mfe.map,Ffe.seq].concat(Lfe,zfe);D4.schema=Ufe});var BA=v(j4=>{"use strict";var ef=He("buffer"),qA=It(),qfe=Kd(),Bfe={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 wy=Ce(),HA=Ho(),Hfe=It(),Gfe=Vo();function M4(t,e){if(wy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new HA.Pair(new Hfe.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function gy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=hy.indentComment(e(n),t);r.push(o.trimStart())}}w4.stringifyCollection=pfe});var Vo=v(FA=>{"use strict";var gfe=jA(),yfe=DA(),_fe=ry(),Zo=Ce(),yy=Go(),bfe=It();function Qd(t,e){let r=Zo.isScalar(e)?e.value:e;for(let n of t)if(Zo.isPair(n)&&(n.key===e||n.key===r||Zo.isScalar(n.key)&&n.key.value===r))return n}var MA=class extends _fe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Zo.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(yy.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;Zo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new yy.Pair(e,e?.value):n=new yy.Pair(e.key,e.value);let i=Qd(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Zo.isScalar(i.value)&&bfe.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=Qd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Qd(this.items,e)?.value;return(!r&&Zo.isScalar(i)?i.value:i)??void 0}has(e){return!!Qd(this.items,e)}set(e,r){this.add(new yy.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)yfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Zo.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})),gfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};FA.YAMLMap=MA;FA.findPair=Qd});var Uc=v($4=>{"use strict";var vfe=Ce(),x4=Vo(),Sfe={collection:"map",default:!0,nodeClass:x4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return vfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>x4.YAMLMap.from(t,e,r)};$4.map=Sfe});var Wo=v(k4=>{"use strict";var wfe=Zd(),xfe=jA(),$fe=ry(),by=Ce(),kfe=It(),Efe=Uo(),LA=class extends $fe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(by.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=_y(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=_y(e);if(typeof n!="number")return;let i=this.items[n];return!r&&by.isScalar(i)?i.value:i}has(e){let r=_y(e);return typeof r=="number"&&r=0?e:null}k4.YAMLSeq=LA});var qc=v(A4=>{"use strict";var Afe=Ce(),E4=Wo(),Tfe={collection:"seq",default:!0,nodeClass:E4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Afe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>E4.YAMLSeq.from(t,e,r)};A4.seq=Tfe});var ef=v(T4=>{"use strict";var Ofe=Jd(),Rfe={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),Ofe.stringifyString(t,e,r,n)}};T4.string=Rfe});var vy=v(I4=>{"use strict";var O4=It(),R4={identify:t=>t==null,createNode:()=>new O4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new O4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&R4.test.test(t)?t:e.options.nullStr};I4.nullTag=R4});var zA=v(C4=>{"use strict";var Ife=It(),P4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Ife.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&P4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};C4.boolTag=P4});var Bc=v(D4=>{"use strict";function Pfe({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}D4.stringifyNumber=Pfe});var qA=v(Sy=>{"use strict";var Cfe=It(),UA=Bc(),Dfe={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:UA.stringifyNumber},Nfe={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():UA.stringifyNumber(t)}},jfe={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 Cfe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:UA.stringifyNumber};Sy.float=jfe;Sy.floatExp=Nfe;Sy.floatNaN=Dfe});var HA=v(xy=>{"use strict";var N4=Bc(),wy=t=>typeof t=="bigint"||Number.isInteger(t),BA=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function j4(t,e,r){let{value:n}=t;return wy(n)&&n>=0?r+n.toString(e):N4.stringifyNumber(t)}var Mfe={identify:t=>wy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>BA(t,2,8,r),stringify:t=>j4(t,8,"0o")},Ffe={identify:wy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>BA(t,0,10,r),stringify:N4.stringifyNumber},Lfe={identify:t=>wy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>BA(t,2,16,r),stringify:t=>j4(t,16,"0x")};xy.int=Ffe;xy.intHex=Lfe;xy.intOct=Mfe});var F4=v(M4=>{"use strict";var zfe=Uc(),Ufe=vy(),qfe=qc(),Bfe=ef(),Hfe=zA(),GA=qA(),ZA=HA(),Gfe=[zfe.map,qfe.seq,Bfe.string,Ufe.nullTag,Hfe.boolTag,ZA.intOct,ZA.int,ZA.intHex,GA.floatNaN,GA.floatExp,GA.float];M4.schema=Gfe});var U4=v(z4=>{"use strict";var Zfe=It(),Vfe=Uc(),Wfe=qc();function L4(t){return typeof t=="bigint"||Number.isInteger(t)}var $y=({value:t})=>JSON.stringify(t),Kfe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:$y},{identify:t=>t==null,createNode:()=>new Zfe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:$y},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:$y},{identify:L4,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})=>L4(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:$y}],Jfe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Yfe=[Vfe.map,Wfe.seq].concat(Kfe,Jfe);z4.schema=Yfe});var WA=v(q4=>{"use strict";var tf=He("buffer"),VA=It(),Xfe=Jd(),Qfe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof tf.Buffer=="function")return tf.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 ky=Ce(),KA=Go(),epe=It(),tpe=Wo();function B4(t,e){if(ky.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new KA.Pair(new epe.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]=wy.isPair(n)?n:new HA.Pair(n)}}else e("Expected a sequence for this tag");return t}function F4(t,e,r){let{replacer:n}=r,i=new Gfe.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(HA.createPair(a,c,r))}return i}var Zfe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:M4,createNode:F4};xy.createPairs=F4;xy.pairs=Zfe;xy.resolvePairs=M4});var VA=v(ZA=>{"use strict";var L4=Ce(),GA=zo(),tf=Zo(),Vfe=Vo(),z4=$y(),ia=class t extends Vfe.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(L4.isPair(i)?(o=GA.toJS(i.key,"",r),s=GA.toJS(i.value,o,r)):o=GA.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=z4.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ia.tag="tag:yaml.org,2002:omap";var Wfe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ia,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=z4.resolvePairs(t,e),n=[];for(let{key:i}of r.items)L4.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ia,r)},createNode:(t,e,r)=>ia.from(t,e,r)};ZA.YAMLOMap=ia;ZA.omap=Wfe});var G4=v(WA=>{"use strict";var U4=It();function q4({value:t,source:e},r){return e&&(t?B4:H4).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var B4={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 U4.Scalar(!0),stringify:q4},H4={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 U4.Scalar(!1),stringify:q4};WA.falseTag=H4;WA.trueTag=B4});var Z4=v(ky=>{"use strict";var Kfe=It(),KA=qc(),Jfe={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:KA.stringifyNumber},Yfe={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():KA.stringifyNumber(t)}},Xfe={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 Kfe.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:KA.stringifyNumber};ky.float=Xfe;ky.floatExp=Yfe;ky.floatNaN=Jfe});var W4=v(nf=>{"use strict";var V4=qc(),rf=t=>typeof t=="bigint"||Number.isInteger(t);function Ey(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 JA(t,e,r){let{value:n}=t;if(rf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return V4.stringifyNumber(t)}var Qfe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Ey(t,2,2,r),stringify:t=>JA(t,2,"0b")},epe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Ey(t,1,8,r),stringify:t=>JA(t,8,"0")},tpe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Ey(t,0,10,r),stringify:V4.stringifyNumber},rpe={identify:rf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Ey(t,2,16,r),stringify:t=>JA(t,16,"0x")};nf.int=tpe;nf.intBin=Qfe;nf.intHex=rpe;nf.intOct=epe});var XA=v(YA=>{"use strict";var Oy=Ce(),Ay=Ho(),Ty=Zo(),oa=class t extends Ty.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Oy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Ay.Pair(e.key,null):r=new Ay.Pair(e,null),Ty.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Ty.findPair(this.items,e);return!r&&Oy.isPair(n)?Oy.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=Ty.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Ay.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(Ay.createPair(s,null,n));return o}};oa.tag="tag:yaml.org,2002:set";var npe={collection:"map",identify:t=>t instanceof Set,nodeClass:oa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>oa.from(t,e,r),resolve(t,e){if(Oy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new oa,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};YA.YAMLSet=oa;YA.set=npe});var eT=v(Ry=>{"use strict";var ipe=qc();function QA(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 K4(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return ipe.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 ope={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})=>QA(t,r),stringify:K4},spe={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=>QA(t,!1),stringify:K4},J4={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(J4.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=QA(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$/,"")??""};Ry.floatTime=spe;Ry.intTime=ope;Ry.timestamp=J4});var Q4=v(X4=>{"use strict";var ape=zc(),cpe=yy(),lpe=Uc(),upe=Qd(),dpe=BA(),Y4=G4(),tT=Z4(),Iy=W4(),fpe=ly(),ppe=VA(),mpe=$y(),hpe=XA(),rT=eT(),gpe=[ape.map,lpe.seq,upe.string,cpe.nullTag,Y4.trueTag,Y4.falseTag,Iy.intBin,Iy.intOct,Iy.int,Iy.intHex,tT.floatNaN,tT.floatExp,tT.float,dpe.binary,fpe.merge,ppe.omap,mpe.pairs,hpe.set,rT.intTime,rT.floatTime,rT.timestamp];X4.schema=gpe});var l6=v(oT=>{"use strict";var n6=zc(),ype=yy(),i6=Uc(),_pe=Qd(),bpe=NA(),nT=MA(),iT=LA(),vpe=P4(),Spe=N4(),o6=BA(),of=ly(),s6=VA(),a6=$y(),e6=Q4(),c6=XA(),Py=eT(),t6=new Map([["core",vpe.schema],["failsafe",[n6.map,i6.seq,_pe.string]],["json",Spe.schema],["yaml11",e6.schema],["yaml-1.1",e6.schema]]),r6={binary:o6.binary,bool:bpe.boolTag,float:nT.float,floatExp:nT.floatExp,floatNaN:nT.floatNaN,floatTime:Py.floatTime,int:iT.int,intHex:iT.intHex,intOct:iT.intOct,intTime:Py.intTime,map:n6.map,merge:of.merge,null:ype.nullTag,omap:s6.omap,pairs:a6.pairs,seq:i6.seq,set:c6.set,timestamp:Py.timestamp},wpe={"tag:yaml.org,2002:binary":o6.binary,"tag:yaml.org,2002:merge":of.merge,"tag:yaml.org,2002:omap":s6.omap,"tag:yaml.org,2002:pairs":a6.pairs,"tag:yaml.org,2002:set":c6.set,"tag:yaml.org,2002:timestamp":Py.timestamp};function xpe(t,e,r){let n=t6.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(t6.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"?r6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(r6).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},[])}oT.coreKnownTags=wpe;oT.getTags=xpe});var cT=v(u6=>{"use strict";var sT=Ce(),$pe=zc(),kpe=Uc(),Epe=Qd(),Cy=l6(),Ape=(t,e)=>t.keye.key?1:0,aT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Cy.getTags(e,"compat"):e?Cy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Cy.coreKnownTags:{},this.tags=Cy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,sT.MAP,{value:$pe.map}),Object.defineProperty(this,sT.SCALAR,{value:Epe.string}),Object.defineProperty(this,sT.SEQ,{value:kpe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Ape:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};u6.Schema=aT});var f6=v(d6=>{"use strict";var Tpe=Ce(),lT=Jd(),sf=Zd();function Ope(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=lT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(sf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Tpe.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(sf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=lT.stringify(t.contents,i,()=>a=null,c);a&&(l+=sf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(lT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(sf.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(sf.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=ky.isPair(n)?n:new KA.Pair(n)}}else e("Expected a sequence for this tag");return t}function H4(t,e,r){let{replacer:n}=r,i=new tpe.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(KA.createPair(a,c,r))}return i}var rpe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:B4,createNode:H4};Ey.createPairs=H4;Ey.pairs=rpe;Ey.resolvePairs=B4});var XA=v(YA=>{"use strict";var G4=Ce(),JA=Uo(),rf=Vo(),npe=Wo(),Z4=Ay(),oa=class t extends npe.YAMLSeq{constructor(){super(),this.add=rf.YAMLMap.prototype.add.bind(this),this.delete=rf.YAMLMap.prototype.delete.bind(this),this.get=rf.YAMLMap.prototype.get.bind(this),this.has=rf.YAMLMap.prototype.has.bind(this),this.set=rf.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(G4.isPair(i)?(o=JA.toJS(i.key,"",r),s=JA.toJS(i.value,o,r)):o=JA.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=Z4.createPairs(e,r,n),o=new this;return o.items=i.items,o}};oa.tag="tag:yaml.org,2002:omap";var ipe={collection:"seq",identify:t=>t instanceof Map,nodeClass:oa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=Z4.resolvePairs(t,e),n=[];for(let{key:i}of r.items)G4.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new oa,r)},createNode:(t,e,r)=>oa.from(t,e,r)};YA.YAMLOMap=oa;YA.omap=ipe});var Y4=v(QA=>{"use strict";var V4=It();function W4({value:t,source:e},r){return e&&(t?K4:J4).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var K4={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 V4.Scalar(!0),stringify:W4},J4={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 V4.Scalar(!1),stringify:W4};QA.falseTag=J4;QA.trueTag=K4});var X4=v(Ty=>{"use strict";var ope=It(),eT=Bc(),spe={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:eT.stringifyNumber},ape={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():eT.stringifyNumber(t)}},cpe={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 ope.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:eT.stringifyNumber};Ty.float=cpe;Ty.floatExp=ape;Ty.floatNaN=spe});var e6=v(of=>{"use strict";var Q4=Bc(),nf=t=>typeof t=="bigint"||Number.isInteger(t);function Oy(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 tT(t,e,r){let{value:n}=t;if(nf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return Q4.stringifyNumber(t)}var lpe={identify:nf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Oy(t,2,2,r),stringify:t=>tT(t,2,"0b")},upe={identify:nf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Oy(t,1,8,r),stringify:t=>tT(t,8,"0")},dpe={identify:nf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Oy(t,0,10,r),stringify:Q4.stringifyNumber},fpe={identify:nf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Oy(t,2,16,r),stringify:t=>tT(t,16,"0x")};of.int=dpe;of.intBin=lpe;of.intHex=fpe;of.intOct=upe});var nT=v(rT=>{"use strict";var Py=Ce(),Ry=Go(),Iy=Vo(),sa=class t extends Iy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Py.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Ry.Pair(e.key,null):r=new Ry.Pair(e,null),Iy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Iy.findPair(this.items,e);return!r&&Py.isPair(n)?Py.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=Iy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Ry.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(Ry.createPair(s,null,n));return o}};sa.tag="tag:yaml.org,2002:set";var ppe={collection:"map",identify:t=>t instanceof Set,nodeClass:sa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>sa.from(t,e,r),resolve(t,e){if(Py.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new sa,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};rT.YAMLSet=sa;rT.set=ppe});var oT=v(Cy=>{"use strict";var mpe=Bc();function iT(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 t6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return mpe.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 hpe={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})=>iT(t,r),stringify:t6},gpe={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=>iT(t,!1),stringify:t6},r6={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(r6.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=iT(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$/,"")??""};Cy.floatTime=gpe;Cy.intTime=hpe;Cy.timestamp=r6});var o6=v(i6=>{"use strict";var ype=Uc(),_pe=vy(),bpe=qc(),vpe=ef(),Spe=WA(),n6=Y4(),sT=X4(),Dy=e6(),wpe=fy(),xpe=XA(),$pe=Ay(),kpe=nT(),aT=oT(),Epe=[ype.map,bpe.seq,vpe.string,_pe.nullTag,n6.trueTag,n6.falseTag,Dy.intBin,Dy.intOct,Dy.int,Dy.intHex,sT.floatNaN,sT.floatExp,sT.float,Spe.binary,wpe.merge,xpe.omap,$pe.pairs,kpe.set,aT.intTime,aT.floatTime,aT.timestamp];i6.schema=Epe});var h6=v(uT=>{"use strict";var l6=Uc(),Ape=vy(),u6=qc(),Tpe=ef(),Ope=zA(),cT=qA(),lT=HA(),Rpe=F4(),Ipe=U4(),d6=WA(),sf=fy(),f6=XA(),p6=Ay(),s6=o6(),m6=nT(),Ny=oT(),a6=new Map([["core",Rpe.schema],["failsafe",[l6.map,u6.seq,Tpe.string]],["json",Ipe.schema],["yaml11",s6.schema],["yaml-1.1",s6.schema]]),c6={binary:d6.binary,bool:Ope.boolTag,float:cT.float,floatExp:cT.floatExp,floatNaN:cT.floatNaN,floatTime:Ny.floatTime,int:lT.int,intHex:lT.intHex,intOct:lT.intOct,intTime:Ny.intTime,map:l6.map,merge:sf.merge,null:Ape.nullTag,omap:f6.omap,pairs:p6.pairs,seq:u6.seq,set:m6.set,timestamp:Ny.timestamp},Ppe={"tag:yaml.org,2002:binary":d6.binary,"tag:yaml.org,2002:merge":sf.merge,"tag:yaml.org,2002:omap":f6.omap,"tag:yaml.org,2002:pairs":p6.pairs,"tag:yaml.org,2002:set":m6.set,"tag:yaml.org,2002:timestamp":Ny.timestamp};function Cpe(t,e,r){let n=a6.get(e);if(n&&!t)return r&&!n.includes(sf.merge)?n.concat(sf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(a6.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(sf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?c6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(c6).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},[])}uT.coreKnownTags=Ppe;uT.getTags=Cpe});var pT=v(g6=>{"use strict";var dT=Ce(),Dpe=Uc(),Npe=qc(),jpe=ef(),jy=h6(),Mpe=(t,e)=>t.keye.key?1:0,fT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?jy.getTags(e,"compat"):e?jy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?jy.coreKnownTags:{},this.tags=jy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,dT.MAP,{value:Dpe.map}),Object.defineProperty(this,dT.SCALAR,{value:jpe.string}),Object.defineProperty(this,dT.SEQ,{value:Npe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Mpe:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};g6.Schema=fT});var _6=v(y6=>{"use strict";var Fpe=Ce(),mT=Yd(),af=Vd();function Lpe(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=mT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(af.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Fpe.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(af.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=mT.stringify(t.contents,i,()=>a=null,c);a&&(l+=af.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(mT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(af.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(af.indentComment(o(c),"")))}return r.join(` `)+` -`}d6.stringifyDocument=Ope});var af=v(p6=>{"use strict";var Rpe=Hd(),Bc=Qg(),Sn=Ce(),Ipe=Ho(),Ppe=zo(),Cpe=cT(),Dpe=f6(),uT=Kg(),Npe=mA(),jpe=Gd(),dT=pA(),fT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Sn.NODE_TYPE,{value:Sn.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 dT.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,{[Sn.NODE_TYPE]:{value:Sn.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=Sn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Hc(this.contents)&&this.contents.add(e)}addIn(e,r){Hc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=uT.anchorNames(this);e.anchor=!r||n.has(r)?uT.findNewAnchor(r||"a",n):r}return new Rpe.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}=uT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=jpe.createNode(e,u,m);return a&&Sn.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 Ipe.Pair(i,o)}delete(e){return Hc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Bc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Hc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Sn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Bc.isEmptyPath(e)?!r&&Sn.isScalar(this.contents)?this.contents.value:this.contents:Sn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Sn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Bc.isEmptyPath(e)?this.contents!==void 0:Sn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Bc.collectionFromPath(this.schema,[e],r):Hc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Bc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Bc.collectionFromPath(this.schema,Array.from(e),r):Hc(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 dT.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 dT.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 Cpe.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=Ppe.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"?Npe.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 Dpe.stringifyDocument(this,e)}};function Hc(t){if(Sn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}p6.Document=fT});var uf=v(lf=>{"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}},pT=class extends cf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},mT=class extends cf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Mpe=(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 +`}y6.stringifyDocument=Lpe});var cf=v(b6=>{"use strict";var zpe=Gd(),Hc=ry(),xn=Ce(),Upe=Go(),qpe=Uo(),Bpe=pT(),Hpe=_6(),hT=Xg(),Gpe=bA(),Zpe=Zd(),gT=_A(),yT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,xn.NODE_TYPE,{value:xn.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 gT.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,{[xn.NODE_TYPE]:{value:xn.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=xn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Gc(this.contents)&&this.contents.add(e)}addIn(e,r){Gc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=hT.anchorNames(this);e.anchor=!r||n.has(r)?hT.findNewAnchor(r||"a",n):r}return new zpe.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}=hT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Zpe.createNode(e,u,m);return a&&xn.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 Upe.Pair(i,o)}delete(e){return Gc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Hc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Gc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return xn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Hc.isEmptyPath(e)?!r&&xn.isScalar(this.contents)?this.contents.value:this.contents:xn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return xn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Hc.isEmptyPath(e)?this.contents!==void 0:xn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Hc.collectionFromPath(this.schema,[e],r):Gc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Hc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Hc.collectionFromPath(this.schema,Array.from(e),r):Gc(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 gT.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 gT.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 Bpe.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=qpe.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"?Gpe.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 Hpe.stringifyDocument(this,e)}};function Gc(t){if(xn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}b6.Document=yT});var df=v(uf=>{"use strict";var lf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},_T=class extends lf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},bT=class extends lf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Vpe=(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} -`}};lf.YAMLError=cf;lf.YAMLParseError=pT;lf.YAMLWarning=mT;lf.prettifyError=Mpe});var df=v(m6=>{"use strict";function Fpe(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 E of t)switch(m&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&o(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&E.type!=="comment"&&E.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),E.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&E.source.includes(" ")&&(h=E),u=!0;break;case"comment":{u||o(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=E.source.substring(1)||" ";d?d+=f+C:d=C,f="",l=!1;break}case"newline":l?d?d+=E.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=E.source,l=!0,p=!0,(g||b)&&(_=E),u=!0;break;case"anchor":g&&o(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&o(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=E,w??(w=E.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(E,"MULTIPLE_TAGS","A node can have at most one tag"),b=E,w??(w=E.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),x&&o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),x=E,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=E,l=!1,u=!1;break}default:o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),l=!1,u=!1}let O=t[t.length-1],A=O?O.offset+O.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}}m6.resolveProps=Fpe});var Dy=v(h6=>{"use strict";function hT(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(hT(e.key)||hT(e.value))return!0}return!1;default:return!0}}h6.containsNewline=hT});var gT=v(g6=>{"use strict";var Lpe=Dy();function zpe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Lpe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}g6.flowIndentCheck=zpe});var yT=v(_6=>{"use strict";var y6=Ce();function Upe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||y6.isScalar(o)&&y6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}_6.mapIncludes=Upe});var $6=v(x6=>{"use strict";var b6=Ho(),qpe=Zo(),v6=df(),Bpe=Dy(),S6=gT(),Hpe=yT(),w6="All mapping items must start at the same column";function Gpe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??qpe.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=v6.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",w6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Bpe.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",w6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&S6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Hpe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=v6.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 Zpe=Vo(),Vpe=df(),Wpe=gT();function Kpe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Zpe.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=Vpe.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&&Wpe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}k6.resolveBlockSeq=Kpe});var Gc=v(A6=>{"use strict";function Jpe(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}}A6.resolveEnd=Jpe});var I6=v(R6=>{"use strict";var Ype=Ce(),Xpe=Ho(),T6=Zo(),Qpe=Vo(),eme=Gc(),O6=df(),tme=Dy(),rme=yT(),_T="Block collections are not allowed within flow collections",bT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function nme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?T6.YAMLMap:Qpe.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=eme.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}R6.resolveFlowCollection=nme});var C6=v(P6=>{"use strict";var ime=Ce(),ome=It(),sme=Zo(),ame=Vo(),cme=$6(),lme=E6(),ume=I6();function vT(t,e,r,n,i,o){let s=r.type==="block-map"?cme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?lme.resolveBlockSeq(t,e,r,n,o):ume.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 dme(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),vT(t,e,r,i,s)}let l=vT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=ime.isNode(u)?u:new ome.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}P6.composeCollection=dme});var wT=v(D6=>{"use strict";var ST=It();function fme(t,e,r){let n=e.offset,i=pme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?ST.Scalar.BLOCK_FOLDED:ST.Scalar.BLOCK_LITERAL,s=e.source?mme(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?` +`}};uf.YAMLError=lf;uf.YAMLParseError=_T;uf.YAMLWarning=bT;uf.prettifyError=Vpe});var ff=v(v6=>{"use strict";function Wpe(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 E of t)switch(m&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&o(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&E.type!=="comment"&&E.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),E.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&E.source.includes(" ")&&(h=E),u=!0;break;case"comment":{u||o(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=E.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=E.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=E.source,l=!0,p=!0,(g||b)&&(_=E),u=!0;break;case"anchor":g&&o(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&o(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=E,w??(w=E.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(E,"MULTIPLE_TAGS","A node can have at most one tag"),b=E,w??(w=E.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),x&&o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),x=E,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=E,l=!1,u=!1;break}default:o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.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}}v6.resolveProps=Wpe});var My=v(S6=>{"use strict";function vT(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(vT(e.key)||vT(e.value))return!0}return!1;default:return!0}}S6.containsNewline=vT});var ST=v(w6=>{"use strict";var Kpe=My();function Jpe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Kpe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}w6.flowIndentCheck=Jpe});var wT=v($6=>{"use strict";var x6=Ce();function Ype(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||x6.isScalar(o)&&x6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}$6.mapIncludes=Ype});var R6=v(O6=>{"use strict";var k6=Go(),Xpe=Vo(),E6=ff(),Qpe=My(),A6=ST(),eme=wT(),T6="All mapping items must start at the same column";function tme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Xpe.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=E6.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",T6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Qpe.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",T6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&A6.flowIndentCheck(n.indent,f,i),r.atKey=!1,eme.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=E6.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 rme=Wo(),nme=ff(),ime=ST();function ome({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??rme.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=nme.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&&ime.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}I6.resolveBlockSeq=ome});var Zc=v(C6=>{"use strict";function sme(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}}C6.resolveEnd=sme});var M6=v(j6=>{"use strict";var ame=Ce(),cme=Go(),D6=Vo(),lme=Wo(),ume=Zc(),N6=ff(),dme=My(),fme=wT(),xT="Block collections are not allowed within flow collections",$T=t=>t&&(t.type==="block-map"||t.type==="block-seq");function pme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?D6.YAMLMap:lme.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=ume.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}j6.resolveFlowCollection=pme});var L6=v(F6=>{"use strict";var mme=Ce(),hme=It(),gme=Vo(),yme=Wo(),_me=R6(),bme=P6(),vme=M6();function kT(t,e,r,n,i,o){let s=r.type==="block-map"?_me.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?bme.resolveBlockSeq(t,e,r,n,o):vme.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 Sme(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),kT(t,e,r,i,s)}let l=kT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=mme.isNode(u)?u:new hme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}F6.composeCollection=Sme});var AT=v(z6=>{"use strict";var ET=It();function wme(t,e,r){let n=e.offset,i=xme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?ET.Scalar.BLOCK_FOLDED:ET.Scalar.BLOCK_LITERAL,s=e.source?$me(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,91 +112,91 @@ ${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 pme({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 xT=It(),hme=Gc();function gme(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=xT.Scalar.PLAIN,c=yme(o,l);break;case"single-quoted-scalar":a=xT.Scalar.QUOTE_SINGLE,c=_me(o,l);break;case"double-quoted-scalar":a=xT.Scalar.QUOTE_DOUBLE,c=bme(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=hme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function yme(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}`),N6(t)}function _me(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),N6(t.slice(1,-1)).replace(/''/g,"'")}function N6(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var TT=It(),kme=Zc();function Eme(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=TT.Scalar.PLAIN,c=Ame(o,l);break;case"single-quoted-scalar":a=TT.Scalar.QUOTE_SINGLE,c=Tme(o,l);break;case"double-quoted-scalar":a=TT.Scalar.QUOTE_DOUBLE,c=Ome(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=kme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function Ame(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}`),U6(t)}function Tme(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),U6(t.slice(1,-1)).replace(/''/g,"'")}function U6(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 vme(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 Rme(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 Sme={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function wme(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}}j6.resolveFlowScalar=gme});var L6=v(F6=>{"use strict";var sa=Ce(),M6=It(),xme=wT(),$me=$T();function kme(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?xme.resolveBlockScalar(t,e,n):$me.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[sa.SCALAR]:c?l=Eme(t.schema,i,c,r,n):e.type==="scalar"?l=Ame(t,i,e,n):l=t.schema[sa.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=sa.isScalar(d)?d:new M6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new M6.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 Eme(t,e,r,n,i){if(r==="!")return t[sa.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[sa.SCALAR])}function Ame({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[sa.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[sa.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}F6.composeScalar=kme});var U6=v(z6=>{"use strict";function Tme(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}z6.emptyScalarPosition=Tme});var H6=v(ET=>{"use strict";var Ome=Hd(),Rme=Ce(),Ime=C6(),q6=L6(),Pme=Gc(),Cme=U6(),Dme={composeNode:B6,composeEmptyNode:kT};function B6(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=Nme(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=Ime.composeCollection(Dme,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=kT(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&&(!Rme.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 kT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Cme.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 Nme({options:t},{offset:e,source:r,end:n},i){let o=new Ome.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=Pme.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ET.composeEmptyNode=kT;ET.composeNode=B6});var V6=v(Z6=>{"use strict";var jme=af(),G6=H6(),Mme=Gc(),Fme=df();function Lme(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new jme.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Fme.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?G6.composeNode(l,i,u,s):G6.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Mme.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}Z6.composeDoc=Lme});var TT=v(J6=>{"use strict";var zme=He("process"),Ume=pA(),qme=af(),ff=uf(),W6=Ce(),Bme=V6(),Hme=Gc();function pf(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 K6(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var aa=Ce(),B6=It(),Cme=AT(),Dme=OT();function Nme(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Cme.resolveBlockScalar(t,e,n):Dme.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[aa.SCALAR]:c?l=jme(t.schema,i,c,r,n):e.type==="scalar"?l=Mme(t,i,e,n):l=t.schema[aa.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=aa.isScalar(d)?d:new B6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new B6.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 jme(t,e,r,n,i){if(r==="!")return t[aa.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[aa.SCALAR])}function Mme({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[aa.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[aa.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}H6.composeScalar=Nme});var V6=v(Z6=>{"use strict";function Fme(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}Z6.emptyScalarPosition=Fme});var J6=v(IT=>{"use strict";var Lme=Gd(),zme=Ce(),Ume=L6(),W6=G6(),qme=Zc(),Bme=V6(),Hme={composeNode:K6,composeEmptyNode:RT};function K6(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=Gme(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=W6.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Ume.composeCollection(Hme,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=RT(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&&(!zme.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 RT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Bme.emptyScalarPosition(e,r,n),indent:-1,source:""},d=W6.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 Gme({options:t},{offset:e,source:r,end:n},i){let o=new Lme.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=qme.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}IT.composeEmptyNode=RT;IT.composeNode=K6});var Q6=v(X6=>{"use strict";var Zme=cf(),Y6=J6(),Vme=Zc(),Wme=ff();function Kme(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Zme.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Wme.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?Y6.composeNode(l,i,u,s):Y6.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Vme.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}X6.composeDoc=Kme});var CT=v(rB=>{"use strict";var Jme=He("process"),Yme=_A(),Xme=cf(),pf=df(),eB=Ce(),Qme=Q6(),ehe=Zc();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 tB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=pf(r);o?this.warnings.push(new ff.YAMLWarning(s,n,i)):this.errors.push(new ff.YAMLParseError(s,n,i))},this.directives=new Ume.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=K6(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(W6.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];W6.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 PT=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=mf(r);o?this.warnings.push(new pf.YAMLWarning(s,n,i)):this.errors.push(new pf.YAMLParseError(s,n,i))},this.directives=new Yme.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=tB(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(eB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];eB.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=pf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Bme.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(pf(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(pf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Hme.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(pf(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 qme.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}}};J6.Composer=AT});var Q6=v(Ny=>{"use strict";var Gme=wT(),Zme=$T(),Vme=uf(),Y6=Kd();function Wme(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 Vme.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Zme.resolveFlowScalar(t,e,n);case"block-scalar":return Gme.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Kme(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=Y6.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=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=Qme.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 pf.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 pf.YAMLParseError(mf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=ehe.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 pf.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 Xme.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}}};rB.Composer=PT});var oB=v(Fy=>{"use strict";var the=AT(),rhe=OT(),nhe=df(),nB=Jd();function ihe(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 nhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return rhe.resolveFlowScalar(t,e,n);case"block-scalar":return the.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function ohe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=nB.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 X6(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 Jme(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=Y6.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">":Yme(t,c);break;case'"':OT(t,c,"double-quoted-scalar");break;case"'":OT(t,c,"single-quoted-scalar");break;default:OT(t,c,"scalar")}}function Yme(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return iB(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 she(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=nB.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">":ahe(t,c);break;case'"':DT(t,c,"double-quoted-scalar");break;case"'":DT(t,c,"single-quoted-scalar");break;default:DT(t,c,"scalar")}}function ahe(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}];X6(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 X6(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 OT(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})}}}Ny.createScalarToken=Kme;Ny.resolveAsScalar=Wme;Ny.setScalarValue=Jme});var tB=v(eB=>{"use strict";var Xme=t=>"type"in t?My(t):jy(t);function My(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=My(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=jy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=jy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=jy(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 jy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=My(e)),r)for(let o of r)i+=o.source;return n&&(i+=My(n)),i}eB.stringify=Xme});var oB=v(iB=>{"use strict";var RT=Symbol("break visit"),Qme=Symbol("skip children"),rB=Symbol("remove item");function aa(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),nB(Object.freeze([]),t,e)}aa.BREAK=RT;aa.SKIP=Qme;aa.REMOVE=rB;aa.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};aa.parentCollection=(t,e)=>{let r=aa.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 nB(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 IT=Q6(),ehe=tB(),the=oB(),PT="\uFEFF",CT="",DT="",NT="",rhe=t=>!!t&&"items"in t,nhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function ihe(t){switch(t){case PT:return"";case CT:return"";case DT:return"";case NT:return"";default:return JSON.stringify(t)}}function ohe(t){switch(t){case PT:return"byte-order-mark";case CT:return"doc-mode";case DT:return"flow-error-end";case NT: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}];iB(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 iB(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 DT(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})}}}Fy.createScalarToken=ohe;Fy.resolveAsScalar=ihe;Fy.setScalarValue=she});var aB=v(sB=>{"use strict";var che=t=>"type"in t?zy(t):Ly(t);function zy(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=zy(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Ly(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Ly(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Ly(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 Ly({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=zy(e)),r)for(let o of r)i+=o.source;return n&&(i+=zy(n)),i}sB.stringify=che});var dB=v(uB=>{"use strict";var NT=Symbol("break visit"),lhe=Symbol("skip children"),cB=Symbol("remove item");function ca(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),lB(Object.freeze([]),t,e)}ca.BREAK=NT;ca.SKIP=lhe;ca.REMOVE=cB;ca.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};ca.parentCollection=(t,e)=>{let r=ca.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 lB(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 jT=oB(),uhe=aB(),dhe=dB(),MT="\uFEFF",FT="",LT="",zT="",fhe=t=>!!t&&"items"in t,phe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function mhe(t){switch(t){case MT:return"";case FT:return"";case LT:return"";case zT:return"";default:return JSON.stringify(t)}}function hhe(t){switch(t){case MT:return"byte-order-mark";case FT:return"doc-mode";case LT:return"flow-error-end";case zT: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}Pr.createScalarToken=IT.createScalarToken;Pr.resolveAsScalar=IT.resolveAsScalar;Pr.setScalarValue=IT.setScalarValue;Pr.stringify=ehe.stringify;Pr.visit=the.visit;Pr.BOM=PT;Pr.DOCUMENT=CT;Pr.FLOW_END=DT;Pr.SCALAR=NT;Pr.isCollection=rhe;Pr.isScalar=nhe;Pr.prettyToken=ihe;Pr.tokenType=ohe});var FT=v(aB=>{"use strict";var mf=Fy();function Hn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var sB=new Set("0123456789ABCDEFabcdef"),she=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Ly=new Set(",[]{}"),ahe=new Set(` ,[]{} -\r `),jT=t=>!t||ahe.has(t),MT=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}Cr.createScalarToken=jT.createScalarToken;Cr.resolveAsScalar=jT.resolveAsScalar;Cr.setScalarValue=jT.setScalarValue;Cr.stringify=uhe.stringify;Cr.visit=dhe.visit;Cr.BOM=MT;Cr.DOCUMENT=FT;Cr.FLOW_END=LT;Cr.SCALAR=zT;Cr.isCollection=fhe;Cr.isScalar=phe;Cr.prettyToken=mhe;Cr.tokenType=hhe});var BT=v(pB=>{"use strict";var hf=Uy();function Gn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var fB=new Set("0123456789ABCDEFabcdef"),ghe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),qy=new Set(",[]{}"),yhe=new Set(` ,[]{} +\r `),UT=t=>!t||yhe.has(t),qT=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==="...")&&Hn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Hn(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===":")&&Hn(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(jT),"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=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Gn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Gn(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===":")&&Gn(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(UT),"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=>Hn(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` +`,o)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Gn(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 mf.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(Hn(o)||e&&Ly.has(o))break;r=n}else if(Hn(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 hf.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(Gn(o)||e&&qy.has(o))break;r=n}else if(Gn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&Ly.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&Ly.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield mf.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(jT),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Hn(n)||r&&Ly.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(;!Hn(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(she.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===` +`,o=this.buffer[n+1]):r=n),o==="#"||e&&qy.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&qy.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield hf.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(UT),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Gn(n)||r&&qy.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(;!Gn(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(ghe.has(r))r=this.buffer[++e];else if(r==="%"&&fB.has(this.buffer[e+1])&&fB.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)}};aB.Lexer=MT});var zT=v(cB=>{"use strict";var LT=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 che=He("process"),lB=Fy(),lhe=FT();function Wo(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 Uy(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"&&dB(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&&uB(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)}};pB.Lexer=qT});var GT=v(mB=>{"use strict";var HT=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 _he=He("process"),hB=Uy(),bhe=BT();function Ko(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 Hy(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"&&yB(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&&gB(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(Wo(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(fB(r.key)&&!Wo(r.sep,"newline")){let s=Zc(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(Wo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Zc(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]}):Wo(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&&!Wo(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)){Uy(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||Wo(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=zy(n),o=Zc(i);dB(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)){Hy(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(Ko(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(_B(r.key)&&!Ko(r.sep,"newline")){let s=Vc(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(Ko(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Vc(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]}):Ko(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&&!Ko(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)){Hy(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||Ko(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=By(n),o=Vc(i);yB(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=zy(e),n=Zc(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=zy(e),n=Zc(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())}}};pB.Parser=UT});var _B=v(gf=>{"use strict";var mB=TT(),uhe=af(),hf=uf(),dhe=EA(),fhe=Ce(),phe=zT(),hB=qT();function gB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new phe.LineCounter||null,prettyErrors:e}}function mhe(t,e={}){let{lineCounter:r,prettyErrors:n}=gB(e),i=new hB.Parser(r?.addNewLine),o=new mB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(hf.prettifyError(t,r)),a.warnings.forEach(hf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function yB(t,e={}){let{lineCounter:r,prettyErrors:n}=gB(e),i=new hB.Parser(r?.addNewLine),o=new mB.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 hf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(hf.prettifyError(t,r)),s.warnings.forEach(hf.prettifyError(t,r))),s}function hhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=yB(t,r);if(!i)return null;if(i.warnings.forEach(o=>dhe.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 ghe(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 fhe.isDocument(t)&&!n?t.toString(r):new uhe.Document(t,n,r).toString(r)}gf.parse=hhe;gf.parseAllDocuments=mhe;gf.parseDocument=yB;gf.stringify=ghe});var cr=v(Ge=>{"use strict";var yhe=TT(),_he=af(),bhe=cT(),BT=uf(),vhe=Hd(),Ko=Ce(),She=Ho(),whe=It(),xhe=Zo(),$he=Vo(),khe=Fy(),Ehe=FT(),Ahe=zT(),The=qT(),qy=_B(),bB=zd();Ge.Composer=yhe.Composer;Ge.Document=_he.Document;Ge.Schema=bhe.Schema;Ge.YAMLError=BT.YAMLError;Ge.YAMLParseError=BT.YAMLParseError;Ge.YAMLWarning=BT.YAMLWarning;Ge.Alias=vhe.Alias;Ge.isAlias=Ko.isAlias;Ge.isCollection=Ko.isCollection;Ge.isDocument=Ko.isDocument;Ge.isMap=Ko.isMap;Ge.isNode=Ko.isNode;Ge.isPair=Ko.isPair;Ge.isScalar=Ko.isScalar;Ge.isSeq=Ko.isSeq;Ge.Pair=She.Pair;Ge.Scalar=whe.Scalar;Ge.YAMLMap=xhe.YAMLMap;Ge.YAMLSeq=$he.YAMLSeq;Ge.CST=khe;Ge.Lexer=Ehe.Lexer;Ge.LineCounter=Ahe.LineCounter;Ge.Parser=The.Parser;Ge.parse=qy.parse;Ge.parseAllDocuments=qy.parseAllDocuments;Ge.parseDocument=qy.parseDocument;Ge.stringify=qy.stringify;Ge.visit=bB.visit;Ge.visitAsync=bB.visitAsync});import{execFileSync as vB}from"node:child_process";import{existsSync as By}from"node:fs";import{join as Hy,resolve as Ohe}from"node:path";function Rhe(t){try{let e=vB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Ohe(t,e):null}catch{return null}}function HT(t){let e=Rhe(t);if(!e)return null;try{if(By(Hy(e,"MERGE_HEAD")))return"merge";if(By(Hy(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(By(Hy(e,"rebase-merge"))||By(Hy(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ca(t){return HT(t)!==null}function GT(t,e){try{let r=vB("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 Gy(t,e){return GT(t,e)!==null}var la=y(()=>{"use strict"});import{execFileSync as Ihe}from"node:child_process";import{existsSync as Phe,readFileSync as Che}from"node:fs";import{join as xB}from"node:path";function yf(t,e){return Ihe("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Jo(t){try{let e=yf(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 Yo(t,e){Dhe(t,e);let r=yf(t,["rev-parse","HEAD"]).trim(),n=Nhe(t,e);return{groups:jhe(t,n),head:r,inventory:{after:wB(Vy(t,"spec.yaml")),before:wB(ZT(t,e,"spec.yaml"))},since:e,unsharded_commits:zhe(t,e)}}function VT(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 Dhe(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!Gy(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 Nhe(t,e){let r=yf(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(!(!SB(c)&&!SB(a)))if(s.startsWith("A")){let l=Zy(Vy(t,c));if(!l)continue;l.status==="done"?n.push(Vc(l,"added-as-done")):l.status==="archived"&&n.push(Vc(l,"archived"))}else if(s.startsWith("D")){let l=Zy(ZT(t,e,a));l&&n.push(Vc(l,"archived"))}else{let l=Zy(Vy(t,c));if(!l)continue;let d=Zy(ZT(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(Vc(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(Vc(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(Vc(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function SB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function Vc(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>VT(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function Zy(t){if(t===null)return null;let e;try{e=(0,Wy.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 Vy(t,e){let r=xB(t,e);if(!Phe(r))return null;try{return Che(r,"utf8")}catch{return null}}function ZT(t,e,r){try{return yf(t,["show",`${e}:${r}`])}catch{return null}}function jhe(t,e){let r=Mhe(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 Mhe(t){let e=Vy(t,xB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,Wy.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function wB(t){let e={};if(t!==null)try{let n=(0,Wy.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 zhe(t,e){let r=yf(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);Fhe.test(a)&&(Lhe.test(a)||n.push({hash:s,subject:a}))}return n}var Wy,Fhe,Lhe,Wc=y(()=>{"use strict";Wy=Et(cr(),1);la();Fhe=/^(feat|fix)(\([^)]*\))?!?:/,Lhe=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as $B}from"node:child_process";import{appendFileSync as Uhe,existsSync as WT,mkdirSync as qhe,readFileSync as Bhe,renameSync as Hhe,statSync as Ghe}from"node:fs";import{userInfo as Zhe}from"node:os";import{dirname as Vhe,join as JT}from"node:path";function YT(t){return JT(t,kB,Whe)}function Jr(t,e){let r=YT(t),n=Vhe(r);WT(n)||qhe(n,{recursive:!0});try{WT(r)&&Ghe(r).size>Khe&&Hhe(r,JT(n,EB))}catch{}Uhe(r,`${JSON.stringify(e)} -`,"utf8")}function KT(t){if(!WT(t))return[];let e=Bhe(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ua(t){return KT(YT(t))}function Ky(t){return[...KT(JT(t,kB,EB)),...KT(YT(t))]}function Yr(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 Jhe(t){let e;try{e=$B("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Zhe().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Yhe(t){try{return $B("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function _f(t,e){try{let r=ua(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function lr(t,e,r){try{let n=Yhe(t),i=Jhe(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=_f(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Jr(t,Yr(e,o))}catch{}}var kB,Whe,EB,Khe,Cr=y(()=>{"use strict";kB=".cladding",Whe="events.log.jsonl",EB="events.log.1.jsonl",Khe=5*1024*1024});import{execFileSync as Xhe}from"node:child_process";import{existsSync as AB,readdirSync as Qhe,readFileSync as ege,statSync as TB}from"node:fs";import{createHash as tge}from"node:crypto";import{join as XT}from"node:path";function da(t){try{return Xhe("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function QT(t){let e=[],r=XT(t,"spec.yaml");AB(r)&&TB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=XT(t,"spec",i);if(!(!AB(o)||!TB(o).isDirectory()))for(let s of Qhe(o))s.endsWith(".yaml")&&e.push(XT(o,s))}e.sort();let n=tge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(ege(i)),n.update("\0")}return n.digest("hex")}function Jy(t,e){let r={featureId:e,gitHead:da(t),specDigest:QT(t),timestamp:new Date().toISOString()};return Jr(t,Yr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function Yy(t,e){let r=ua(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 Xy(t,e,r,n){let i=Yr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Jr(t,i),i}var bf=y(()=>{"use strict";Cr()});import{readFileSync as rge,statSync as nge}from"node:fs";import{extname as ige,resolve as eO,sep as oge}from"node:path";function Xr(t){return Math.ceil(t.length/4)}function cge(t,e){let r=eO(e),n=eO(r,t);return n===r||n.startsWith(r+oge)}function RB(t,e,r,n){if(!cge(t,e))return{path:t,omitted:"unsafe-path"};if(!sge.has(ige(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>OB)return{path:t,omitted:"too-large",bytes:o}}else{let l=eO(e,t);try{o=nge(l).size}catch{return{path:t,omitted:"missing"}}if(o>OB)return{path:t,omitted:"too-large",bytes:o};try{i=rge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(age))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=By(e),n=Vc(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=By(e),n=Vc(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())}}};bB.Parser=ZT});var $B=v(yf=>{"use strict";var vB=CT(),vhe=cf(),gf=df(),She=IA(),whe=Ce(),xhe=GT(),SB=VT();function wB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new xhe.LineCounter||null,prettyErrors:e}}function $he(t,e={}){let{lineCounter:r,prettyErrors:n}=wB(e),i=new SB.Parser(r?.addNewLine),o=new vB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(gf.prettifyError(t,r)),a.warnings.forEach(gf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function xB(t,e={}){let{lineCounter:r,prettyErrors:n}=wB(e),i=new SB.Parser(r?.addNewLine),o=new vB.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 gf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(gf.prettifyError(t,r)),s.warnings.forEach(gf.prettifyError(t,r))),s}function khe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=xB(t,r);if(!i)return null;if(i.warnings.forEach(o=>She.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 Ehe(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 whe.isDocument(t)&&!n?t.toString(r):new vhe.Document(t,n,r).toString(r)}yf.parse=khe;yf.parseAllDocuments=$he;yf.parseDocument=xB;yf.stringify=Ehe});var Xt=v(Ge=>{"use strict";var Ahe=CT(),The=cf(),Ohe=pT(),WT=df(),Rhe=Gd(),Jo=Ce(),Ihe=Go(),Phe=It(),Che=Vo(),Dhe=Wo(),Nhe=Uy(),jhe=BT(),Mhe=GT(),Fhe=VT(),Gy=$B(),kB=Ud();Ge.Composer=Ahe.Composer;Ge.Document=The.Document;Ge.Schema=Ohe.Schema;Ge.YAMLError=WT.YAMLError;Ge.YAMLParseError=WT.YAMLParseError;Ge.YAMLWarning=WT.YAMLWarning;Ge.Alias=Rhe.Alias;Ge.isAlias=Jo.isAlias;Ge.isCollection=Jo.isCollection;Ge.isDocument=Jo.isDocument;Ge.isMap=Jo.isMap;Ge.isNode=Jo.isNode;Ge.isPair=Jo.isPair;Ge.isScalar=Jo.isScalar;Ge.isSeq=Jo.isSeq;Ge.Pair=Ihe.Pair;Ge.Scalar=Phe.Scalar;Ge.YAMLMap=Che.YAMLMap;Ge.YAMLSeq=Dhe.YAMLSeq;Ge.CST=Nhe;Ge.Lexer=jhe.Lexer;Ge.LineCounter=Mhe.LineCounter;Ge.Parser=Fhe.Parser;Ge.parse=Gy.parse;Ge.parseAllDocuments=Gy.parseAllDocuments;Ge.parseDocument=Gy.parseDocument;Ge.stringify=Gy.stringify;Ge.visit=kB.visit;Ge.visitAsync=kB.visitAsync});import{execFileSync as EB}from"node:child_process";import{existsSync as Zy}from"node:fs";import{join as Vy,resolve as Lhe}from"node:path";function zhe(t){try{let e=EB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Lhe(t,e):null}catch{return null}}function KT(t){let e=zhe(t);if(!e)return null;try{if(Zy(Vy(e,"MERGE_HEAD")))return"merge";if(Zy(Vy(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(Zy(Vy(e,"rebase-merge"))||Zy(Vy(e,"rebase-apply")))return"rebase"}catch{return null}return null}function la(t){return KT(t)!==null}function JT(t,e){try{let r=EB("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 Wy(t,e){return JT(t,e)!==null}var ua=y(()=>{"use strict"});import{execFileSync as Uhe}from"node:child_process";import{existsSync as qhe,readFileSync as Bhe}from"node:fs";import{join as OB}from"node:path";function _f(t,e){return Uhe("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Yo(t){try{let e=_f(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 Xo(t,e){Hhe(t,e);let r=_f(t,["rev-parse","HEAD"]).trim(),n=Ghe(t,e);return{groups:Zhe(t,n),head:r,inventory:{after:TB(Jy(t,"spec.yaml")),before:TB(YT(t,e,"spec.yaml"))},since:e,unsharded_commits:Jhe(t,e)}}function XT(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 Hhe(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!Wy(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 Ghe(t,e){let r=_f(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(!(!AB(c)&&!AB(a)))if(s.startsWith("A")){let l=Ky(Jy(t,c));if(!l)continue;l.status==="done"?n.push(Wc(l,"added-as-done")):l.status==="archived"&&n.push(Wc(l,"archived"))}else if(s.startsWith("D")){let l=Ky(YT(t,e,a));l&&n.push(Wc(l,"archived"))}else{let l=Ky(Jy(t,c));if(!l)continue;let d=Ky(YT(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(Wc(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(Wc(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(Wc(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function AB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function Wc(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>XT(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function Ky(t){if(t===null)return null;let e;try{e=(0,Yy.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 Jy(t,e){let r=OB(t,e);if(!qhe(r))return null;try{return Bhe(r,"utf8")}catch{return null}}function YT(t,e,r){try{return _f(t,["show",`${e}:${r}`])}catch{return null}}function Zhe(t,e){let r=Vhe(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 Vhe(t){let e=Jy(t,OB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,Yy.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function TB(t){let e={};if(t!==null)try{let n=(0,Yy.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 Jhe(t,e){let r=_f(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);Whe.test(a)&&(Khe.test(a)||n.push({hash:s,subject:a}))}return n}var Yy,Whe,Khe,Kc=y(()=>{"use strict";Yy=bt(Xt(),1);ua();Whe=/^(feat|fix)(\([^)]*\))?!?:/,Khe=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as RB}from"node:child_process";import{appendFileSync as Yhe,existsSync as QT,mkdirSync as Xhe,readFileSync as Qhe,renameSync as ege,statSync as tge}from"node:fs";import{userInfo as rge}from"node:os";import{dirname as nge,join as tO}from"node:path";function rO(t){return tO(t,IB,ige)}function Yr(t,e){let r=rO(t),n=nge(r);QT(n)||Xhe(n,{recursive:!0});try{QT(r)&&tge(r).size>oge&&ege(r,tO(n,PB))}catch{}Yhe(r,`${JSON.stringify(e)} +`,"utf8")}function eO(t){if(!QT(t))return[];let e=Qhe(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function da(t){return eO(rO(t))}function Xy(t){return[...eO(tO(t,IB,PB)),...eO(rO(t))]}function Xr(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 sge(t){let e;try{e=RB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=rge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function age(t){try{return RB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function bf(t,e){try{let r=da(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function ur(t,e,r){try{let n=age(t),i=sge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=bf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Yr(t,Xr(e,o))}catch{}}var IB,ige,PB,oge,Dr=y(()=>{"use strict";IB=".cladding",ige="events.log.jsonl",PB="events.log.1.jsonl",oge=5*1024*1024});import{execFileSync as cge}from"node:child_process";import{existsSync as CB,readdirSync as lge,readFileSync as uge,statSync as DB}from"node:fs";import{createHash as dge}from"node:crypto";import{join as nO}from"node:path";function fa(t){try{return cge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function iO(t){let e=[],r=nO(t,"spec.yaml");CB(r)&&DB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=nO(t,"spec",i);if(!(!CB(o)||!DB(o).isDirectory()))for(let s of lge(o))s.endsWith(".yaml")&&e.push(nO(o,s))}e.sort();let n=dge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(uge(i)),n.update("\0")}return n.digest("hex")}function Qy(t,e){let r={featureId:e,gitHead:fa(t),specDigest:iO(t),timestamp:new Date().toISOString()};return Yr(t,Xr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function e_(t,e){let r=da(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 t_(t,e,r,n){let i=Xr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Yr(t,i),i}var vf=y(()=>{"use strict";Dr()});import{readFileSync as fge,statSync as pge}from"node:fs";import{extname as mge,resolve as oO,sep as hge}from"node:path";function Qr(t){return Math.ceil(t.length/4)}function _ge(t,e){let r=oO(e),n=oO(r,t);return n===r||n.startsWith(r+hge)}function jB(t,e,r,n){if(!_ge(t,e))return{path:t,omitted:"unsafe-path"};if(!gge.has(mge(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>NB)return{path:t,omitted:"too-large",bytes:o}}else{let l=oO(e,t);try{o=pge(l).size}catch{return{path:t,omitted:"missing"}}if(o>NB)return{path:t,omitted:"too-large",bytes:o};try{i=fge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(yge))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 sge,OB,age,Qy=y(()=>{"use strict";sge=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"]),OB=2e6,age="\0"});function uge(t){for(let i of lge)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 tO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function dge(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??[])tO(e,s,o);for(let s of i.modules??[])tO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=uge(a);c&&tO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function wn(t){let e=IB.get(t);return e||(e=dge(t),IB.set(t,e)),e}var lge,IB,fa=y(()=>{"use strict";lge=["derived:","fixture:","script:","self-dogfood:"];IB=new WeakMap});function rO(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 yr(t,e,r={}){let n=r.depth??1/0,i=wn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=fge(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=rO(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:nO(i)}}var pa=y(()=>{"use strict";fa()});function PB(t){return t.impacted.length}function t_(t,e,r={}){let n=r.initialDepth??e_.initialDepth,i=r.maxDepth??e_.maxDepth,o=r.coverageThreshold??e_.coverageThreshold,s=r.marginYieldThreshold??e_.marginYieldThreshold,a=wn(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=yr(t,e,{depth:1});return"not_found"in b,b}let d=rO(l,a.dependents,1/0).size;if(d===0){let b=yr(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 _=yr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=PB(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,A=x===0&&b>n,E={frontierExhausted:A,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(A)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:E};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:E};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var e_,iO=y(()=>{"use strict";pa();fa();e_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function pge(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 CB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=pge(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 DB=y(()=>{"use strict"});function mge(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 Kc(t,e){let r=mge(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=CB(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 r_=y(()=>{"use strict";DB()});import{existsSync as jB,readdirSync as hge,readFileSync as gge}from"node:fs";import{join as sO}from"node:path";function aO(t,e=_ge){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function bge(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:aO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:aO(`done reverted \u2014 pre-push strict gate red${r}`)}}function NB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function vge(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 aO(n)}function Sge(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)=>NB(m)-NB(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(-yge).map(bge),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?vge(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 oO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function wge(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 xge(t,e,r){let n=oO(t,/_Rolled back at_\s*`([^`]+)`/),i=oO(t,/Last failed gate:\s*`([^`]+)`/),o=oO(t,/Retry attempts:\s*(\d+)/),s=wge(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function $ge(t,e){let r=sO(t,".cladding","post-mortems");if(!jB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of hge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(xge(gge(sO(r,o),"utf8"),e,o))}catch{}return i}function MB(t,e){try{let r=Ky(t),n=$ge(t,e),i=jB(sO(t,".cladding","events.log.1.jsonl"));return Sge(r,n,e,{truncated:i})}catch{return}}var yge,_ge,FB=y(()=>{"use strict";Cr();yge=5,_ge=120});function n_(t,e,r){return Xr(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function ma(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:kge,o=e,s,a=wn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=Kc(t,o);if("not_found"in c)return c;let l=c.focus,u=MB(n,l.id),d=a&&a.size>0?e:l.id,f=t_(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}},O=[...c.ancestors];for(;O.length>Ege&&n_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}E.push(Vt),Vt.truncated&&x.push(`code: clipped ${se}`)}A>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let C=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),k=(se,Pe,Vt,ar)=>{let Kt=Vt+ar>0?[`breaks: omitted ${Vt} feature(s) / ${ar} test(s)`]:[],eo={...w,needs:O,must_edit:{...w.must_edit,code:E},breaks_if_changed:C(se,Pe),budget:{...w.budget,truncated:[...x,...Kt]}};return Xr(JSON.stringify(eo))>i},q=m,Q=h;if(k(q,Q,0,0)){let se=yr(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Vt=new Set("not_found"in se?[]:se.test_refs),Kt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],eo=0;for(;Kt.length>Pe.size&&k(Kt,Q,eo,0);)Kt=Kt.slice(0,-1),eo++;let gi=[...h],Kr=0;for(;k(Kt,gi,eo,Kr);){let de=-1;for(let to=gi.length-1;to>=0;to--)if(!Vt.has(gi[to])){de=to;break}if(de<0)break;gi.splice(de,1),Kr++}q=Kt,Q=gi,eo+Kr>0&&x.push(`breaks: omitted ${eo} feature(s) / ${Kr} test(s)`),k(q,Q,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Se=C(q,Q),I={...w,needs:O,must_edit:{...w.must_edit,code:E},breaks_if_changed:Se},P=I;if(u){let se={...I,prior_attempts:u};Xr(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Or=Xr(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Or,truncated:x}}}var kge,Ege,i_=y(()=>{"use strict";Qy();r_();iO();FB();pa();fa();kge=3e3,Ege=3});function Gn(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 Age(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 LB(t,e,r="."){let n=wn(t),i=t.features??[],o=[];for(let f of i){let p=ma(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=ma(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=t_(t,f.id),g=!("not_found"in h),b=Xr(JSON.stringify(p)),_="not_found"in m?b:Xr(JSON.stringify(m)),S=Xr(JSON.stringify(f));for(let O of f.modules??[]){let A=e(O);A&&(S+=Xr(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(Gn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Gn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Gn(a(c))*10)/10,medianShrinkTruncated:Math.round(Gn(a(l))*10)/10,medianStructuralRatio:Math.round(Gn(u)*100)/100,medianSliceTokens:Math.round(Gn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Gn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Gn(o.map(f=>f.searchDepth)),p95Depth:Age(o.map(f=>f.searchDepth),95),medianEdges:Gn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Gn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Gn(o.map(f=>f.regressionTests))},features:o}}var Jc,o_=y(()=>{"use strict";Qy();iO();i_();fa();Jc="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Tge,existsSync as cO,mkdirSync as Oge,readFileSync as zB}from"node:fs";import{dirname as Rge,join as Ige}from"node:path";function lO(t){return Ige(t,Pge,Cge)}function Dge(t,e){return{timestamp:new Date().toISOString(),head:da(t),spec_digest:QT(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function UB(t,e){try{let r=Dge(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=uO(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=lO(t),s=Rge(o);return cO(s)||Oge(s,{recursive:!0}),Tge(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function qB(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 uO(t,e){let r=lO(t);if(!cO(r))return[];let n;try{n=zB(r,"utf8")}catch{return[]}let i=qB(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function BB(t){let e=lO(t);if(!cO(e))return{snapshots:[],unreadable:!1};let r;try{r=zB(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=qB(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 HB(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(` ${Jc}`),i.join(` -`)}var Pge,Cge,Sf=y(()=>{"use strict";bf();o_();Pge=".cladding",Cge="measure.jsonl"});import{existsSync as Nge}from"node:fs";import{join as jge}from"node:path";function Yc(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}** (${Mge[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 ZB(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`,"",Jc),r.join(` -`)}function Xc(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"} | ${Lge(l,r)} |`)}return n.join(` -`)}function Lge(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 Fge)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Nge(jge(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function Qc(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),GB(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)GB(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function GB(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=VT(r);n&&t.push(`- ${n}`)}t.push("")}var Mge,Fge,s_=y(()=>{"use strict";Sf();o_();Wc();Mge={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Fge=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as zge}from"node:fs";function Si(t="./spec.yaml"){let e=zge(t,"utf8");return(0,VB.parse)(e)}var VB,a_=y(()=>{"use strict";VB=Et(cr(),1)});var Xo=v((Dr,mO)=>{"use strict";var dO=Dr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+KB(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()};dO.prototype.toString=function(){return this.property+" "+this.message};var c_=Dr.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};c_.prototype.addError=function(e){var r;if(typeof e=="string")r=new dO(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 dO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new ha(this);if(this.throwError)throw r;return r};c_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Uge(t,e){return e+": "+t.toString()+` -`}c_.prototype.toString=function(e){return this.errors.map(Uge).join("")};Object.defineProperty(c_.prototype,"valid",{get:function(){return!this.errors.length}});mO.exports.ValidatorResultError=ha;function ha(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ha),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}ha.prototype=new Error;ha.prototype.constructor=ha;ha.prototype.name="Validation Error";var WB=Dr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};WB.prototype=Object.create(Error.prototype,{constructor:{value:WB,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var fO=Dr.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+KB(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};fO.prototype.resolve=function(e){return JB(this.base,e)};fO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=JB(this.base,i||"");var s=new fO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Zn=Dr.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]+$/};Zn.regexp=Zn.regex;Zn.pattern=Zn.regex;Zn.ipv4=Zn["ip-address"];Dr.isFormat=function(e,r,n){if(typeof e=="string"&&Zn[r]!==void 0){if(Zn[r]instanceof RegExp)return Zn[r].test(e);if(typeof Zn[r]=="function")return Zn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var KB=Dr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Dr.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 qge(t,e,r,n){typeof r=="object"?e[n]=pO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Bge(t,e,r){e[r]=t[r]}function Hge(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=pO(t[n],e[n]):r[n]=e[n]}function pO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(qge.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Bge.bind(null,t,n)),Object.keys(e).forEach(Hge.bind(null,t,e,n))),n}mO.exports.deepMerge=pO;Dr.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 Gge(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Dr.encodePath=function(e){return e.map(Gge).join("")};Dr.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};Dr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var JB=Dr.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 eH=v((gYe,QB)=>{"use strict";var Qr=Xo(),Fe=Qr.ValidatorResult,Qo=Qr.SchemaError,hO={};hO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=hO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 gO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new Qo("anyOf must be an array");if(!r.anyOf.some(gO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new Qo("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new Qo("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(gO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!Qr.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=gO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!Qr.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(!Qr.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 yO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!Qr.isSchema(s))throw new Qo('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(yO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 Qo('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=yO(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 YB(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 Qo('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&&YB.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)YB.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!Qr.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Zge(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var _O=Xo();bO.exports.SchemaScanResult=tH;function tH(t,e){this.id=t,this.ref=e}bO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=_O.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=_O.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!_O.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 rH=eH(),es=Xo(),nH=l_().scan,iH=es.ValidatorResult,Vge=es.ValidatorResultError,wf=es.SchemaError,oH=es.SchemaContext,Wge="/",Wt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(wi),this.attributes=Object.create(rH.validators)};Wt.prototype.customFormats={};Wt.prototype.schemas=null;Wt.prototype.types=null;Wt.prototype.attributes=null;Wt.prototype.unresolvedRefs=null;Wt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=nH(r||Wge,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]};Wt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=es.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}};Wt.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 wi=Wt.prototype.types={};wi.string=function(e){return typeof e=="string"};wi.number=function(e){return typeof e=="number"&&isFinite(e)};wi.integer=function(e){return typeof e=="number"&&e%1===0};wi.boolean=function(e){return typeof e=="boolean"};wi.array=function(e){return Array.isArray(e)};wi.null=function(e){return e===null};wi.date=function(e){return e instanceof Date};wi.any=function(e){return!0};wi.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};aH.exports=Wt});var lH=v((bYe,oo)=>{"use strict";var Kge=oo.exports.Validator=cH();oo.exports.ValidatorResult=Xo().ValidatorResult;oo.exports.ValidatorResultError=Xo().ValidatorResultError;oo.exports.ValidationError=Xo().ValidationError;oo.exports.SchemaError=Xo().SchemaError;oo.exports.SchemaScanResult=l_().SchemaScanResult;oo.exports.scan=l_().scan;oo.exports.validate=function(t,e,r){var n=new Kge;return n.validate(t,e,r)}});import{readFileSync as Jge}from"node:fs";import{dirname as Yge,join as Xge}from"node:path";import{fileURLToPath as Qge}from"node:url";function iye(t){let e=nye.validate(t,rye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function dH(t){let e=iye(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 gge,NB,yge,r_=y(()=>{"use strict";gge=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"]),NB=2e6,yge="\0"});function vge(t){for(let i of bge)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 sO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Sge(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??[])sO(e,s,o);for(let s of i.modules??[])sO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=vge(a);c&&sO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function $n(t){let e=MB.get(t);return e||(e=Sge(t),MB.set(t,e)),e}var bge,MB,pa=y(()=>{"use strict";bge=["derived:","fixture:","script:","self-dogfood:"];MB=new WeakMap});function aO(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 _r(t,e,r={}){let n=r.depth??1/0,i=$n(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=wge(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=aO(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:cO(i)}}var ma=y(()=>{"use strict";pa()});function FB(t){return t.impacted.length}function i_(t,e,r={}){let n=r.initialDepth??n_.initialDepth,i=r.maxDepth??n_.maxDepth,o=r.coverageThreshold??n_.coverageThreshold,s=r.marginYieldThreshold??n_.marginYieldThreshold,a=$n(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=_r(t,e,{depth:1});return"not_found"in b,b}let d=aO(l,a.dependents,1/0).size;if(d===0){let b=_r(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 _=_r(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=FB(_),x=S-p,w=S>0?x/S:0;f.push(w);let R=d>0?S/d:1,A=x===0&&b>n,E={frontierExhausted:A,coverage:R,marginalYields:[...f],totalKnownDependents:d};if(A)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:E};if(R>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:E};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var n_,lO=y(()=>{"use strict";ma();pa();n_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function xge(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 LB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=xge(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 $ge(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 Jc(t,e){let r=$ge(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=LB(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 o_=y(()=>{"use strict";zB()});import{existsSync as qB,readdirSync as kge,readFileSync as Ege}from"node:fs";import{join as dO}from"node:path";function fO(t,e=Tge){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function Oge(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:fO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:fO(`done reverted \u2014 pre-push strict gate red${r}`)}}function UB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Rge(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 fO(n)}function Ige(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)=>UB(m)-UB(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(-Age).map(Oge),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?Rge(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 uO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Pge(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 Cge(t,e,r){let n=uO(t,/_Rolled back at_\s*`([^`]+)`/),i=uO(t,/Last failed gate:\s*`([^`]+)`/),o=uO(t,/Retry attempts:\s*(\d+)/),s=Pge(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function Dge(t,e){let r=dO(t,".cladding","post-mortems");if(!qB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of kge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(Cge(Ege(dO(r,o),"utf8"),e,o))}catch{}return i}function BB(t,e){try{let r=Xy(t),n=Dge(t,e),i=qB(dO(t,".cladding","events.log.1.jsonl"));return Ige(r,n,e,{truncated:i})}catch{return}}var Age,Tge,HB=y(()=>{"use strict";Dr();Age=5,Tge=120});function s_(t,e,r){return Qr(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function ha(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:Nge,o=e,s,a=$n(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=Jc(t,o);if("not_found"in c)return c;let l=c.focus,u=BB(n,l.id),d=a&&a.size>0?e:l.id,f=i_(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>jge&&s_(w,R,[])>i;)R.pop();R.lengthi){x.push(`code: omitted ${se} (budget)`);continue}E.push(Vt),Vt.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,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),k=(se,Pe,Vt,lr)=>{let Jt=Vt+lr>0?[`breaks: omitted ${Vt} feature(s) / ${lr} test(s)`]:[],no={...w,needs:R,must_edit:{...w.must_edit,code:E},breaks_if_changed:D(se,Pe),budget:{...w.budget,truncated:[...x,...Jt]}};return Qr(JSON.stringify(no))>i},B=m,Q=h;if(k(B,Q,0,0)){let se=_r(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Vt=new Set("not_found"in se?[]:se.test_refs),Jt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],no=0;for(;Jt.length>Pe.size&&k(Jt,Q,no,0);)Jt=Jt.slice(0,-1),no++;let _i=[...h],Jr=0;for(;k(Jt,_i,no,Jr);){let de=-1;for(let io=_i.length-1;io>=0;io--)if(!Vt.has(_i[io])){de=io;break}if(de<0)break;_i.splice(de,1),Jr++}B=Jt,Q=_i,no+Jr>0&&x.push(`breaks: omitted ${no} feature(s) / ${Jr} test(s)`),k(B,Q,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Se=D(B,Q),P={...w,needs:R,must_edit:{...w.must_edit,code:E},breaks_if_changed:Se},C=P;if(u){let se={...P,prior_attempts:u};Qr(JSON.stringify(se))<=i?C=se:x.push("prior_attempts: omitted (budget)")}let Rr=Qr(JSON.stringify(C));return{...C,budget:{max_tokens:i,used_tokens:Rr,truncated:x}}}var Nge,jge,a_=y(()=>{"use strict";r_();o_();lO();HB();ma();pa();Nge=3e3,jge=3});function Zn(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 Mge(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 GB(t,e,r="."){let n=$n(t),i=t.features??[],o=[];for(let f of i){let p=ha(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=ha(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=i_(t,f.id),g=!("not_found"in h),b=Qr(JSON.stringify(p)),_="not_found"in m?b:Qr(JSON.stringify(m)),S=Qr(JSON.stringify(f));for(let R of f.modules??[]){let A=e(R);A&&(S+=Qr(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(Zn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Zn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Zn(a(c))*10)/10,medianShrinkTruncated:Math.round(Zn(a(l))*10)/10,medianStructuralRatio:Math.round(Zn(u)*100)/100,medianSliceTokens:Math.round(Zn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Zn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Zn(o.map(f=>f.searchDepth)),p95Depth:Mge(o.map(f=>f.searchDepth),95),medianEdges:Zn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Zn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Zn(o.map(f=>f.regressionTests))},features:o}}var Yc,c_=y(()=>{"use strict";r_();lO();a_();pa();Yc="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Fge,existsSync as pO,mkdirSync as Lge,readFileSync as ZB}from"node:fs";import{dirname as zge,join as Uge}from"node:path";function mO(t){return Uge(t,qge,Bge)}function Hge(t,e){return{timestamp:new Date().toISOString(),head:fa(t),spec_digest:iO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function VB(t,e){try{let r=Hge(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=hO(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=mO(t),s=zge(o);return pO(s)||Lge(s,{recursive:!0}),Fge(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function WB(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 hO(t,e){let r=mO(t);if(!pO(r))return[];let n;try{n=ZB(r,"utf8")}catch{return[]}let i=WB(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function KB(t){let e=mO(t);if(!pO(e))return{snapshots:[],unreadable:!1};let r;try{r=ZB(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=WB(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Sf(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 JB(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?` (${Sf(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(` ${Yc}`),i.join(` +`)}var qge,Bge,wf=y(()=>{"use strict";vf();c_();qge=".cladding",Bge="measure.jsonl"});import{existsSync as Gge}from"node:fs";import{join as Zge}from"node:path";function Xc(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}** (${Vge[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 XB(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 ${Sf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Sf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Sf(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`,"",Yc),r.join(` +`)}function Qc(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"} | ${Kge(l,r)} |`)}return n.join(` +`)}function Kge(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 Wge)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Gge(Zge(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function el(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),YB(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)YB(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function YB(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=XT(r);n&&t.push(`- ${n}`)}t.push("")}var Vge,Wge,l_=y(()=>{"use strict";wf();c_();Kc();Vge={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Wge=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Jge}from"node:fs";function xi(t="./spec.yaml"){let e=Jge(t,"utf8");return(0,QB.parse)(e)}var QB,u_=y(()=>{"use strict";QB=bt(Xt(),1)});var Qo=v((Nr,bO)=>{"use strict";var gO=Nr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+tH(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()};gO.prototype.toString=function(){return this.property+" "+this.message};var d_=Nr.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};d_.prototype.addError=function(e){var r;if(typeof e=="string")r=new gO(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 gO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new ga(this);if(this.throwError)throw r;return r};d_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Yge(t,e){return e+": "+t.toString()+` +`}d_.prototype.toString=function(e){return this.errors.map(Yge).join("")};Object.defineProperty(d_.prototype,"valid",{get:function(){return!this.errors.length}});bO.exports.ValidatorResultError=ga;function ga(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ga),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}ga.prototype=new Error;ga.prototype.constructor=ga;ga.prototype.name="Validation Error";var eH=Nr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};eH.prototype=Object.create(Error.prototype,{constructor:{value:eH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var yO=Nr.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+tH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};yO.prototype.resolve=function(e){return rH(this.base,e)};yO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=rH(this.base,i||"");var s=new yO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Vn=Nr.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]+$/};Vn.regexp=Vn.regex;Vn.pattern=Vn.regex;Vn.ipv4=Vn["ip-address"];Nr.isFormat=function(e,r,n){if(typeof e=="string"&&Vn[r]!==void 0){if(Vn[r]instanceof RegExp)return Vn[r].test(e);if(typeof Vn[r]=="function")return Vn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var tH=Nr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Nr.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 Xge(t,e,r,n){typeof r=="object"?e[n]=_O(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Qge(t,e,r){e[r]=t[r]}function eye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=_O(t[n],e[n]):r[n]=e[n]}function _O(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Xge.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Qge.bind(null,t,n)),Object.keys(e).forEach(eye.bind(null,t,e,n))),n}bO.exports.deepMerge=_O;Nr.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 tye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Nr.encodePath=function(e){return e.map(tye).join("")};Nr.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};Nr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var rH=Nr.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 sH=v((PYe,oH)=>{"use strict";var en=Qo(),Fe=en.ValidatorResult,es=en.SchemaError,vO={};vO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=vO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 SO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new es("anyOf must be an array");if(!r.anyOf.some(SO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new es("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new es("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(SO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!en.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=SO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!en.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(!en.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 wO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!en.isSchema(s))throw new es('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(wO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 es('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=wO(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 nH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 es('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&&nH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)nH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!en.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 rye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var xO=Qo();$O.exports.SchemaScanResult=aH;function aH(t,e){this.id=t,this.ref=e}$O.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=xO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=xO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!xO.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 cH=sH(),ts=Qo(),lH=f_().scan,uH=ts.ValidatorResult,nye=ts.ValidatorResultError,xf=ts.SchemaError,dH=ts.SchemaContext,iye="/",Wt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create($i),this.attributes=Object.create(cH.validators)};Wt.prototype.customFormats={};Wt.prototype.schemas=null;Wt.prototype.types=null;Wt.prototype.attributes=null;Wt.prototype.unresolvedRefs=null;Wt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=lH(r||iye,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]};Wt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ts.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new xf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Wt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new xf('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 $i=Wt.prototype.types={};$i.string=function(e){return typeof e=="string"};$i.number=function(e){return typeof e=="number"&&isFinite(e)};$i.integer=function(e){return typeof e=="number"&&e%1===0};$i.boolean=function(e){return typeof e=="boolean"};$i.array=function(e){return Array.isArray(e)};$i.null=function(e){return e===null};$i.date=function(e){return e instanceof Date};$i.any=function(e){return!0};$i.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};pH.exports=Wt});var hH=v((NYe,co)=>{"use strict";var oye=co.exports.Validator=mH();co.exports.ValidatorResult=Qo().ValidatorResult;co.exports.ValidatorResultError=Qo().ValidatorResultError;co.exports.ValidationError=Qo().ValidationError;co.exports.SchemaError=Qo().SchemaError;co.exports.SchemaScanResult=f_().SchemaScanResult;co.exports.scan=f_().scan;co.exports.validate=function(t,e,r){var n=new oye;return n.validate(t,e,r)}});import{readFileSync as sye}from"node:fs";import{dirname as aye,join as cye}from"node:path";import{fileURLToPath as lye}from"node:url";function mye(t){let e=pye.validate(t,fye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function yH(t){let e=mye(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var uH,eye,tye,rye,nye,fH=y(()=>{"use strict";uH=Et(lH(),1),eye=Yge(Qge(import.meta.url)),tye=Xge(eye,"schema.json"),rye=JSON.parse(Jge(tye,"utf8")),nye=new uH.Validator});import{existsSync as vO,readdirSync as oye}from"node:fs";import{dirname as sye,join as ga,resolve as mH}from"node:path";function pH(t){return vO(t)?oye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Si(ga(t,r))):[]}function ya(t,e){u_=e?{cwd:mH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return u_&&e==="spec.yaml"&&mH(t)===u_.cwd?u_.spec:aye(t,e)}function aye(t,e){let r=ga(t,e),n=Si(r),i=ga(t,sye(e),"spec");if(!n.features||n.features.length===0){let o=pH(ga(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=pH(ga(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ga(i,"architecture.yaml");vO(o)&&(n.architecture=Si(o))}if(!n.capabilities||n.capabilities.length===0){let o=ga(i,"capabilities.yaml");if(vO(o)){let s=Si(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return dH(n),n}var u_,qe=y(()=>{"use strict";a_();fH();u_=null});import el from"node:process";function xO(){return!!el.stdout.isTTY}function F(t,e,r=""){let n=hH[t],i=r?` ${r}`:"";xO()?el.stdout.write(`${SO[t]}${n}${wO} ${e}${i} -`):el.stdout.write(`${n} ${e}${i} -`)}function xf(t,e,r=""){if(!xO())return;let n=r?` ${r}`:"";el.stdout.write(`${gH}${SO.start}\xB7${wO} ${t} \xB7 ${e}${n}`)}function _a(t,e,r=""){let n=hH[t],i=r?` ${r}`:"";xO()?el.stdout.write(`${gH}${SO[t]}${n}${wO} ${e}${i} -`):el.stdout.write(`${n} ${e}${i} -`)}var hH,SO,wO,gH,xi=y(()=>{"use strict";hH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},SO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},wO="\x1B[0m",gH="\r\x1B[K"});import{createHash as MH}from"node:crypto";import{existsSync as Lye,readFileSync as EO,writeFileSync as zye}from"node:fs";import{join as d_}from"node:path";function Uye(t,e){let r=MH("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(EO(d_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function LH(t,e){let r=MH("sha256");try{r.update(EO(d_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ts(t){let e=d_(t,...FH);if(!Lye(e))return null;let r;try{r=EO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function f_(t){return t.features?.size??t.v1?.size??0}function p_(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)!==LH(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===Uye(e,n)?{state:"fresh"}:{state:"stale"}}function zH(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${LH(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=qye+`attested_modules: + `)}`)}var gH,uye,dye,fye,pye,_H=y(()=>{"use strict";gH=bt(hH(),1),uye=aye(lye(import.meta.url)),dye=cye(uye,"schema.json"),fye=JSON.parse(sye(dye,"utf8")),pye=new gH.Validator});import{existsSync as kO,readdirSync as hye}from"node:fs";import{dirname as gye,join as ya,resolve as vH}from"node:path";function bH(t){return kO(t)?hye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>xi(ya(t,r))):[]}function _a(t,e){p_=e?{cwd:vH(t),spec:e}:null}function G(t=".",e="spec.yaml"){return p_&&e==="spec.yaml"&&vH(t)===p_.cwd?p_.spec:yye(t,e)}function yye(t,e){let r=ya(t,e),n=xi(r),i=ya(t,gye(e),"spec");if(!n.features||n.features.length===0){let o=bH(ya(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=bH(ya(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ya(i,"architecture.yaml");kO(o)&&(n.architecture=xi(o))}if(!n.capabilities||n.capabilities.length===0){let o=ya(i,"capabilities.yaml");if(kO(o)){let s=xi(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return yH(n),n}var p_,qe=y(()=>{"use strict";u_();_H();p_=null});import tl from"node:process";function TO(){return!!tl.stdout.isTTY}function L(t,e,r=""){let n=SH[t],i=r?` ${r}`:"";TO()?tl.stdout.write(`${EO[t]}${n}${AO} ${e}${i} +`):tl.stdout.write(`${n} ${e}${i} +`)}function $f(t,e,r=""){if(!TO())return;let n=r?` ${r}`:"";tl.stdout.write(`${wH}${EO.start}\xB7${AO} ${t} \xB7 ${e}${n}`)}function ba(t,e,r=""){let n=SH[t],i=r?` ${r}`:"";TO()?tl.stdout.write(`${wH}${EO[t]}${n}${AO} ${e}${i} +`):tl.stdout.write(`${n} ${e}${i} +`)}var SH,EO,AO,wH,ki=y(()=>{"use strict";SH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},EO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},AO="\x1B[0m",wH="\r\x1B[K"});import{createHash as BH}from"node:crypto";import{existsSync as Kye,readFileSync as IO,writeFileSync as Jye}from"node:fs";import{join as m_}from"node:path";function Yye(t,e){let r=BH("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(IO(m_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function GH(t,e){let r=BH("sha256");try{r.update(IO(m_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function rs(t){let e=m_(t,...HH);if(!Kye(e))return null;let r;try{r=IO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function h_(t){return t.features?.size??t.v1?.size??0}function g_(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)!==GH(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===Yye(e,n)?{state:"fresh"}:{state:"stale"}}function ZH(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${GH(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=Xye+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return zye(d_(t,...FH),s,"utf8"),!0}var FH,qye,rl=y(()=>{"use strict";FH=["spec","attestation.yaml"];qye=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return Jye(m_(t,...HH),s,"utf8"),!0}var HH,Xye,nl=y(()=>{"use strict";HH=["spec","attestation.yaml"];Xye=`# 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. # @@ -211,52 +211,52 @@ 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 AO}from"node:path";function m_(t){rs={cwd:AO(t),results:new Map}}function UH(t,e,r){!rs||rs.cwd!==AO(e)||rs.results.set(t,r)}function h_(t,e){return!rs||rs.cwd!==AO(e)?null:rs.results.get(t)??null}function g_(){rs=null}var rs,nl=y(()=>{"use strict";rs=null});function At(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 ao=y(()=>{});import{fileURLToPath as Bye}from"node:url";var il,Hye,TO,OO,ol=y(()=>{il=(t,e)=>{let r=OO(Hye(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Hye=t=>TO(t)?t.toString():t,TO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,OO=t=>t instanceof URL?Bye(t):t});var y_,RO=y(()=>{ao();ol();y_=(t,e=[],r={})=>{let n=il(t,"First argument"),[i,o]=At(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(!At(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as Gye}from"node:string_decoder";var qH,BH,Ft,co,Zye,HH,Vye,__,GH,Wye,Ef,Kye,IO,Jye,en=y(()=>{({toString:qH}=Object.prototype),BH=t=>qH.call(t)==="[object ArrayBuffer]",Ft=t=>qH.call(t)==="[object Uint8Array]",co=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Zye=new TextEncoder,HH=t=>Zye.encode(t),Vye=new TextDecoder,__=t=>Vye.decode(t),GH=(t,e)=>Wye(t,e).join(""),Wye=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Gye(e),n=t.map(o=>typeof o=="string"?HH(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Ef=t=>t.length===1&&Ft(t[0])?t[0]:IO(Kye(t)),Kye=t=>t.map(e=>typeof e=="string"?HH(e):e),IO=t=>{let e=new Uint8Array(Jye(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Jye=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Yye}from"node:child_process";var KH,JH,Xye,Qye,ZH,e_e,VH,WH,t_e,YH=y(()=>{ao();en();KH=t=>Array.isArray(t)&&Array.isArray(t.raw),JH=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Xye({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,{}]},Xye=({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}=Qye(i,t.raw[n]),c=VH(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>WH(d)):[WH(l)];return VH(c,u,a)},Qye=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=ZH.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)],WH=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(At(t)&&("stdout"in t||"isMaxBuffer"in t))return t_e(t);throw t instanceof Yye||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`)},t_e=({stdout:t})=>{if(typeof t=="string")return t;if(Ft(t))return __(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 PO from"node:process";var Vn,b_,xn,v_,lo=y(()=>{Vn=t=>b_.includes(t),b_=[PO.stdin,PO.stdout,PO.stderr],xn=["stdin","stdout","stderr"],v_=t=>xn[t]??`stdio[${t}]`});import{debuglog as r_e}from"node:util";var QH,CO,n_e,i_e,o_e,s_e,XH,a_e,DO,c_e,l_e,u_e,d_e,NO,uo,fo=y(()=>{ao();lo();QH=t=>{let e={...t};for(let r of NO)e[r]=CO(t,r);return e},CO=(t,e)=>{let r=Array.from({length:n_e(t)+1}),n=i_e(t[e],r,e);return l_e(n,e)},n_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,xn.length):xn.length,i_e=(t,e,r)=>At(t)?o_e(t,e,r):e.fill(t),o_e=(t,e,r)=>{for(let n of Object.keys(t).sort(s_e))for(let i of a_e(n,r,e))e[i]=t[n];return e},s_e=(t,e)=>XH(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,a_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=DO(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as PO}from"node:path";function y_(t){ns={cwd:PO(t),results:new Map}}function VH(t,e,r){!ns||ns.cwd!==PO(e)||ns.results.set(t,r)}function __(t,e){return!ns||ns.cwd!==PO(e)?null:ns.results.get(t)??null}function b_(){ns=null}var ns,il=y(()=>{"use strict";ns=null});function At(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 uo=y(()=>{});import{fileURLToPath as Qye}from"node:url";var ol,e_e,CO,DO,sl=y(()=>{ol=(t,e)=>{let r=DO(e_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},e_e=t=>CO(t)?t.toString():t,CO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,DO=t=>t instanceof URL?Qye(t):t});var v_,NO=y(()=>{uo();sl();v_=(t,e=[],r={})=>{let n=ol(t,"First argument"),[i,o]=At(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(!At(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as t_e}from"node:string_decoder";var WH,KH,Ft,fo,r_e,JH,n_e,S_,YH,i_e,Af,o_e,jO,s_e,tn=y(()=>{({toString:WH}=Object.prototype),KH=t=>WH.call(t)==="[object ArrayBuffer]",Ft=t=>WH.call(t)==="[object Uint8Array]",fo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),r_e=new TextEncoder,JH=t=>r_e.encode(t),n_e=new TextDecoder,S_=t=>n_e.decode(t),YH=(t,e)=>i_e(t,e).join(""),i_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new t_e(e),n=t.map(o=>typeof o=="string"?JH(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Af=t=>t.length===1&&Ft(t[0])?t[0]:jO(o_e(t)),o_e=t=>t.map(e=>typeof e=="string"?JH(e):e),jO=t=>{let e=new Uint8Array(s_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},s_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as a_e}from"node:child_process";var tG,rG,c_e,l_e,XH,u_e,QH,eG,d_e,nG=y(()=>{uo();tn();tG=t=>Array.isArray(t)&&Array.isArray(t.raw),rG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=c_e({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,{}]},c_e=({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}=l_e(i,t.raw[n]),c=QH(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>eG(d)):[eG(l)];return QH(c,u,a)},l_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=XH.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)],eG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(At(t)&&("stdout"in t||"isMaxBuffer"in t))return d_e(t);throw t instanceof a_e||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`)},d_e=({stdout:t})=>{if(typeof t=="string")return t;if(Ft(t))return S_(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 MO from"node:process";var Wn,w_,kn,x_,po=y(()=>{Wn=t=>w_.includes(t),w_=[MO.stdin,MO.stdout,MO.stderr],kn=["stdin","stdout","stderr"],x_=t=>kn[t]??`stdio[${t}]`});import{debuglog as f_e}from"node:util";var oG,FO,p_e,m_e,h_e,g_e,iG,y_e,LO,__e,b_e,v_e,S_e,zO,mo,ho=y(()=>{uo();po();oG=t=>{let e={...t};for(let r of zO)e[r]=FO(t,r);return e},FO=(t,e)=>{let r=Array.from({length:p_e(t)+1}),n=m_e(t[e],r,e);return b_e(n,e)},p_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,kn.length):kn.length,m_e=(t,e,r)=>At(t)?h_e(t,e,r):e.fill(t),h_e=(t,e,r)=>{for(let n of Object.keys(t).sort(g_e))for(let i of y_e(n,r,e))e[i]=t[n];return e},g_e=(t,e)=>iG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,y_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=LO(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]},DO=t=>{if(t==="all")return t;if(xn.includes(t))return xn.indexOf(t);let e=c_e.exec(t);if(e!==null)return Number(e[1])},c_e=/^fd(\d+)$/,l_e=(t,e)=>t.map(r=>r===void 0?d_e[e]:r),u_e=r_e("execa").enabled?"full":"none",d_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:u_e,stripFinalNewline:!0},NO=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],uo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var sl,al,eG,jO,f_e,S_,w_,ns=y(()=>{fo();sl=({verbose:t},e)=>jO(t,e)!=="none",al=({verbose:t},e)=>!["none","short"].includes(jO(t,e)),eG=({verbose:t},e)=>{let r=jO(t,e);return S_(r)?r:void 0},jO=(t,e)=>e===void 0?f_e(t):uo(t,e),f_e=t=>t.find(e=>S_(e))??w_.findLast(e=>t.includes(e)),S_=t=>typeof t=="function",w_=["none","short","full"]});import{platform as p_e}from"node:process";import{stripVTControlCharacters as m_e}from"node:util";var tG,Af,rG,h_e,g_e,y_e,__e,b_e,v_e,S_e,x_=y(()=>{tG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>v_e(rG(o))).join(" ");return{command:n,escapedCommand:i}},Af=t=>m_e(t).split(` -`).map(e=>rG(e)).join(` -`),rG=t=>t.replaceAll(y_e,e=>h_e(e)),h_e=t=>{let e=__e[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=b_e?`\\u${n.padStart(4,"0")}`:`\\U${n}`},g_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},y_e=g_e(),__e={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},b_e=65535,v_e=t=>S_e.test(t)?t:p_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,S_e=/^[\w./-]+$/});import nG from"node:process";function MO(){let{env:t}=nG,{TERM:e,TERM_PROGRAM:r}=t;return nG.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 iG=y(()=>{});var oG,sG,w_e,x_e,$_e,k_e,E_e,$_,xXe,aG=y(()=>{iG();oG={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"},sG={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"},w_e={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"},x_e={...oG,...sG},$_e={...oG,...w_e},k_e=MO(),E_e=k_e?x_e:$_e,$_=E_e,xXe=Object.entries(sG)});import A_e from"node:tty";var T_e,_e,EXe,cG,AXe,TXe,OXe,RXe,IXe,PXe,CXe,DXe,NXe,jXe,MXe,FXe,LXe,zXe,UXe,k_,qXe,BXe,HXe,GXe,ZXe,VXe,WXe,KXe,JXe,lG,YXe,uG,XXe,QXe,e7e,t7e,r7e,n7e,i7e,o7e,s7e,a7e,c7e,FO=y(()=>{T_e=A_e?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!T_e)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}},EXe=_e(0,0),cG=_e(1,22),AXe=_e(2,22),TXe=_e(3,23),OXe=_e(4,24),RXe=_e(53,55),IXe=_e(7,27),PXe=_e(8,28),CXe=_e(9,29),DXe=_e(30,39),NXe=_e(31,39),jXe=_e(32,39),MXe=_e(33,39),FXe=_e(34,39),LXe=_e(35,39),zXe=_e(36,39),UXe=_e(37,39),k_=_e(90,39),qXe=_e(40,49),BXe=_e(41,49),HXe=_e(42,49),GXe=_e(43,49),ZXe=_e(44,49),VXe=_e(45,49),WXe=_e(46,49),KXe=_e(47,49),JXe=_e(100,49),lG=_e(91,39),YXe=_e(92,39),uG=_e(93,39),XXe=_e(94,39),QXe=_e(95,39),e7e=_e(96,39),t7e=_e(97,39),r7e=_e(101,49),n7e=_e(102,49),i7e=_e(103,49),o7e=_e(104,49),s7e=_e(105,49),a7e=_e(106,49),c7e=_e(107,49)});var dG=y(()=>{FO();FO()});var mG,R_e,E_,fG,I_e,pG,P_e,hG=y(()=>{aG();dG();mG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=R_e(r),c=I_e[t]({failed:o,reject:s,piped:n}),l=P_e[t]({reject:s});return`${k_(`[${a}]`)} ${k_(`[${i}]`)} ${l(c)} ${l(e)}`},R_e=t=>`${E_(t.getHours(),2)}:${E_(t.getMinutes(),2)}:${E_(t.getSeconds(),2)}.${E_(t.getMilliseconds(),3)}`,E_=(t,e)=>String(t).padStart(e,"0"),fG=({failed:t,reject:e})=>t?e?$_.cross:$_.warning:$_.tick,I_e={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:fG,duration:fG},pG=t=>t,P_e={command:()=>cG,output:()=>pG,ipc:()=>pG,error:({reject:t})=>t?lG:uG,duration:()=>k_}});var gG,C_e,D_e,yG=y(()=>{ns();gG=(t,e,r)=>{let n=eG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>C_e(i,o,n)).filter(i=>i!==void 0).map(i=>D_e(i)).join("")},C_e=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},D_e=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},LO=t=>{if(t==="all")return t;if(kn.includes(t))return kn.indexOf(t);let e=__e.exec(t);if(e!==null)return Number(e[1])},__e=/^fd(\d+)$/,b_e=(t,e)=>t.map(r=>r===void 0?S_e[e]:r),v_e=f_e("execa").enabled?"full":"none",S_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:v_e,stripFinalNewline:!0},zO=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],mo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var al,cl,sG,UO,w_e,$_,k_,is=y(()=>{ho();al=({verbose:t},e)=>UO(t,e)!=="none",cl=({verbose:t},e)=>!["none","short"].includes(UO(t,e)),sG=({verbose:t},e)=>{let r=UO(t,e);return $_(r)?r:void 0},UO=(t,e)=>e===void 0?w_e(t):mo(t,e),w_e=t=>t.find(e=>$_(e))??k_.findLast(e=>t.includes(e)),$_=t=>typeof t=="function",k_=["none","short","full"]});import{platform as x_e}from"node:process";import{stripVTControlCharacters as $_e}from"node:util";var aG,Tf,cG,k_e,E_e,A_e,T_e,O_e,R_e,I_e,E_=y(()=>{aG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>R_e(cG(o))).join(" ");return{command:n,escapedCommand:i}},Tf=t=>$_e(t).split(` +`).map(e=>cG(e)).join(` +`),cG=t=>t.replaceAll(A_e,e=>k_e(e)),k_e=t=>{let e=T_e[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=O_e?`\\u${n.padStart(4,"0")}`:`\\U${n}`},E_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},A_e=E_e(),T_e={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},O_e=65535,R_e=t=>I_e.test(t)?t:x_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,I_e=/^[\w./-]+$/});import lG from"node:process";function qO(){let{env:t}=lG,{TERM:e,TERM_PROGRAM:r}=t;return lG.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 uG=y(()=>{});var dG,fG,P_e,C_e,D_e,N_e,j_e,A_,LXe,pG=y(()=>{uG();dG={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"},fG={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"},P_e={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"},C_e={...dG,...fG},D_e={...dG,...P_e},N_e=qO(),j_e=N_e?C_e:D_e,A_=j_e,LXe=Object.entries(fG)});import M_e from"node:tty";var F_e,_e,qXe,mG,BXe,HXe,GXe,ZXe,VXe,WXe,KXe,JXe,YXe,XXe,QXe,e7e,t7e,r7e,n7e,T_,i7e,o7e,s7e,a7e,c7e,l7e,u7e,d7e,f7e,hG,p7e,gG,m7e,h7e,g7e,y7e,_7e,b7e,v7e,S7e,w7e,x7e,$7e,BO=y(()=>{F_e=M_e?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!F_e)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}},qXe=_e(0,0),mG=_e(1,22),BXe=_e(2,22),HXe=_e(3,23),GXe=_e(4,24),ZXe=_e(53,55),VXe=_e(7,27),WXe=_e(8,28),KXe=_e(9,29),JXe=_e(30,39),YXe=_e(31,39),XXe=_e(32,39),QXe=_e(33,39),e7e=_e(34,39),t7e=_e(35,39),r7e=_e(36,39),n7e=_e(37,39),T_=_e(90,39),i7e=_e(40,49),o7e=_e(41,49),s7e=_e(42,49),a7e=_e(43,49),c7e=_e(44,49),l7e=_e(45,49),u7e=_e(46,49),d7e=_e(47,49),f7e=_e(100,49),hG=_e(91,39),p7e=_e(92,39),gG=_e(93,39),m7e=_e(94,39),h7e=_e(95,39),g7e=_e(96,39),y7e=_e(97,39),_7e=_e(101,49),b7e=_e(102,49),v7e=_e(103,49),S7e=_e(104,49),w7e=_e(105,49),x7e=_e(106,49),$7e=_e(107,49)});var yG=y(()=>{BO();BO()});var vG,z_e,O_,_G,U_e,bG,q_e,SG=y(()=>{pG();yG();vG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=z_e(r),c=U_e[t]({failed:o,reject:s,piped:n}),l=q_e[t]({reject:s});return`${T_(`[${a}]`)} ${T_(`[${i}]`)} ${l(c)} ${l(e)}`},z_e=t=>`${O_(t.getHours(),2)}:${O_(t.getMinutes(),2)}:${O_(t.getSeconds(),2)}.${O_(t.getMilliseconds(),3)}`,O_=(t,e)=>String(t).padStart(e,"0"),_G=({failed:t,reject:e})=>t?e?A_.cross:A_.warning:A_.tick,U_e={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:_G,duration:_G},bG=t=>t,q_e={command:()=>mG,output:()=>bG,ipc:()=>bG,error:({reject:t})=>t?hG:gG,duration:()=>T_}});var wG,B_e,H_e,xG=y(()=>{is();wG=(t,e,r)=>{let n=sG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>B_e(i,o,n)).filter(i=>i!==void 0).map(i=>H_e(i)).join("")},B_e=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},H_e=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as N_e}from"node:util";var $i,j_e,M_e,F_e,A_,L_e,cl=y(()=>{x_();hG();yG();$i=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=j_e({type:t,result:i,verboseInfo:n}),s=M_e(e,o),a=gG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},j_e=({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}),M_e=(t,e)=>t.split(` -`).map(r=>F_e({...e,message:r})),F_e=t=>({verboseLine:mG(t),verboseObject:t}),A_=t=>{let e=typeof t=="string"?t:N_e(t);return Af(e).replaceAll(" "," ".repeat(L_e))},L_e=2});var _G,bG=y(()=>{ns();cl();_G=(t,e)=>{sl(e)&&$i({type:"command",verboseMessage:t,verboseInfo:e})}});var vG,z_e,U_e,q_e,SG=y(()=>{ns();vG=(t,e,r)=>{q_e(t);let n=z_e(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},z_e=t=>sl({verbose:t})?U_e++:void 0,U_e=0n,q_e=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(!w_.includes(e)&&!S_(e)){let r=w_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as wG}from"node:process";var T_,LO,O_=y(()=>{T_=()=>wG.bigint(),LO=t=>Number(wG.bigint()-t)/1e6});var R_,zO=y(()=>{bG();SG();O_();x_();fo();R_=(t,e,r)=>{let n=T_(),{command:i,escapedCommand:o}=tG(t,e),s=CO(r,"verbose"),a=vG(s,o,{...r});return _G(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var AG=v((D7e,EG)=>{EG.exports=kG;kG.sync=H_e;var xG=He("fs");function B_e(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{IG.exports=OG;OG.sync=G_e;var TG=He("fs");function OG(t,e,r){TG.stat(t,function(n,i){r(n,n?!1:RG(i,e))})}function G_e(t,e){return RG(TG.statSync(t),e)}function RG(t,e){return t.isFile()&&Z_e(t,e)}function Z_e(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 DG=v((M7e,CG)=>{var j7e=He("fs"),I_;process.platform==="win32"||global.TESTING_WINDOWS?I_=AG():I_=PG();CG.exports=UO;UO.sync=V_e;function UO(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){UO(t,e||{},function(o,s){o?i(o):n(s)})})}I_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function V_e(t,e){try{return I_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var UG=v((F7e,zG)=>{var ll=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",NG=He("path"),W_e=ll?";":":",jG=DG(),MG=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),FG=(t,e)=>{let r=e.colon||W_e,n=t.match(/\//)||ll&&t.match(/\\/)?[""]:[...ll?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=ll?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=ll?i.split(r):[""];return ll&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},LG=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=FG(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(MG(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=NG.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];jG(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)},K_e=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=FG(t,e),o=[];for(let s=0;s{"use strict";var qG=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};qO.exports=qG;qO.exports.default=qG});var VG=v((z7e,ZG)=>{"use strict";var HG=He("path"),J_e=UG(),Y_e=BG();function GG(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=J_e.sync(t.command,{path:r[Y_e({env:r})],pathExt:e?HG.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=HG.resolve(i?t.options.cwd:"",s)),s}function X_e(t){return GG(t)||GG(t,!0)}ZG.exports=X_e});var WG=v((U7e,HO)=>{"use strict";var BO=/([()\][%!^"`<>&|;, *?])/g;function Q_e(t){return t=t.replace(BO,"^$1"),t}function ebe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(BO,"^$1"),e&&(t=t.replace(BO,"^$1")),t}HO.exports.command=Q_e;HO.exports.argument=ebe});var JG=v((q7e,KG)=>{"use strict";KG.exports=/^#!(.*)/});var XG=v((B7e,YG)=>{"use strict";var tbe=JG();YG.exports=(t="")=>{let e=t.match(tbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var eZ=v((H7e,QG)=>{"use strict";var GO=He("fs"),rbe=XG();function nbe(t){let r=Buffer.alloc(150),n;try{n=GO.openSync(t,"r"),GO.readSync(n,r,0,150,0),GO.closeSync(n)}catch{}return rbe(r.toString())}QG.exports=nbe});var iZ=v((G7e,nZ)=>{"use strict";var ibe=He("path"),tZ=VG(),rZ=WG(),obe=eZ(),sbe=process.platform==="win32",abe=/\.(?:com|exe)$/i,cbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function lbe(t){t.file=tZ(t);let e=t.file&&obe(t.file);return e?(t.args.unshift(t.file),t.command=e,tZ(t)):t.file}function ube(t){if(!sbe)return t;let e=lbe(t),r=!abe.test(e);if(t.options.forceShell||r){let n=cbe.test(e);t.command=ibe.normalize(t.command),t.command=rZ.command(t.command),t.args=t.args.map(o=>rZ.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 dbe(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:ube(n)}nZ.exports=dbe});var aZ=v((Z7e,sZ)=>{"use strict";var ZO=process.platform==="win32";function VO(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 fbe(t,e){if(!ZO)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=oZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function oZ(t,e){return ZO&&t===1&&!e.file?VO(e.original,"spawn"):null}function pbe(t,e){return ZO&&t===1&&!e.file?VO(e.original,"spawnSync"):null}sZ.exports={hookChildProcess:fbe,verifyENOENT:oZ,verifyENOENTSync:pbe,notFoundError:VO}});var uZ=v((V7e,ul)=>{"use strict";var cZ=He("child_process"),WO=iZ(),KO=aZ();function lZ(t,e,r){let n=WO(t,e,r),i=cZ.spawn(n.command,n.args,n.options);return KO.hookChildProcess(i,n),i}function mbe(t,e,r){let n=WO(t,e,r),i=cZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||KO.verifyENOENTSync(i.status,n),i}ul.exports=lZ;ul.exports.spawn=lZ;ul.exports.sync=mbe;ul.exports._parse=WO;ul.exports._enoent=KO});function P_(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 dZ=y(()=>{});var fZ=y(()=>{});import{promisify as hbe}from"node:util";import{execFile as gbe,execFileSync as X7e}from"node:child_process";import pZ from"node:path";import{fileURLToPath as ybe}from"node:url";function C_(t){return t instanceof URL?ybe(t):t}function mZ(t){return{*[Symbol.iterator](){let e=pZ.resolve(C_(t)),r;for(;r!==e;)yield e,r=e,e=pZ.resolve(e,"..")}}}var tQe,rQe,hZ=y(()=>{fZ();tQe=hbe(gbe);rQe=10*1024*1024});import D_ from"node:process";import va from"node:path";var _be,bbe,vbe,gZ,yZ=y(()=>{dZ();hZ();_be=({cwd:t=D_.cwd(),path:e=D_.env[P_()],preferLocal:r=!0,execPath:n=D_.execPath,addExecPath:i=!0}={})=>{let o=va.resolve(C_(t)),s=[],a=e.split(va.delimiter);return r&&bbe(s,a,o),i&&vbe(s,a,n,o),e===""||e===va.delimiter?`${s.join(va.delimiter)}${e}`:[...s,e].join(va.delimiter)},bbe=(t,e,r)=>{for(let n of mZ(r)){let i=va.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},vbe=(t,e,r,n)=>{let i=va.resolve(n,C_(r),"..");e.includes(i)||t.push(i)},gZ=({env:t=D_.env,...e}={})=>{t={...t};let r=P_({env:t});return e.path=t[r],t[r]=_be(e),t}});var _Z,Wn,bZ,vZ,SZ,N_,Tf,Of,Sa=y(()=>{_Z=(t,e,r)=>{let n=r?Of:Tf,i=t instanceof Wn?{}:{cause:t};return new n(e,i)},Wn=class extends Error{},bZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,SZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},vZ=t=>N_(t)&&SZ in t,SZ=Symbol("isExecaError"),N_=t=>Object.prototype.toString.call(t)==="[object Error]",Tf=class extends Error{};bZ(Tf,Tf.name);Of=class extends Error{};bZ(Of,Of.name)});var wZ,Sbe,xZ,$Z,kZ=y(()=>{wZ=()=>{let t=$Z-xZ+1;return Array.from({length:t},Sbe)},Sbe=(t,e)=>({name:`SIGRT${e+1}`,number:xZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),xZ=34,$Z=64});var EZ,AZ=y(()=>{EZ=[{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 wbe}from"node:os";var JO,xbe,TZ=y(()=>{AZ();kZ();JO=()=>{let t=wZ();return[...EZ,...t].map(xbe)},xbe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=wbe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as $be}from"node:os";var kbe,Ebe,OZ,Abe,Tbe,Obe,bQe,RZ=y(()=>{TZ();kbe=()=>{let t=JO();return Object.fromEntries(t.map(Ebe))},Ebe=({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}],OZ=kbe(),Abe=()=>{let t=JO(),e=65,r=Array.from({length:e},(n,i)=>Tbe(i,t));return Object.assign({},...r)},Tbe=(t,e)=>{let r=Obe(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}}},Obe=(t,e)=>{let r=e.find(({name:n})=>$be.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},bQe=Abe()});import{constants as Rf}from"node:os";var PZ,CZ,DZ,Rbe,Ibe,IZ,Pbe,YO,Cbe,Dbe,j_,If=y(()=>{RZ();PZ=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return DZ(t,e)},CZ=t=>t===0?t:DZ(t,"`subprocess.kill()`'s argument"),DZ=(t,e)=>{if(Number.isInteger(t))return Rbe(t,e);if(typeof t=="string")return Pbe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${YO()}`)},Rbe=(t,e)=>{if(IZ.has(t))return IZ.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${YO()}`)},Ibe=()=>new Map(Object.entries(Rf.signals).reverse().map(([t,e])=>[e,t])),IZ=Ibe(),Pbe=(t,e)=>{if(t in Rf.signals)return t;throw t.toUpperCase()in Rf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${YO()}`)},YO=()=>`Available signal names: ${Cbe()}. -Available signal numbers: ${Dbe()}.`,Cbe=()=>Object.keys(Rf.signals).sort().map(t=>`'${t}'`).join(", "),Dbe=()=>[...new Set(Object.values(Rf.signals).sort((t,e)=>t-e))].join(", "),j_=t=>OZ[t].description});import{setTimeout as Nbe}from"node:timers/promises";var NZ,jbe,jZ,Mbe,Fbe,Lbe,XO,M_=y(()=>{Sa();If();NZ=t=>{if(t===!1)return t;if(t===!0)return jbe;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},jbe=1e3*5,jZ=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Mbe(s,a,r);Fbe(l,n);let u=t(c);return Lbe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Mbe=(t,e,r)=>{let[n=r,i]=N_(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&&!N_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:CZ(n),error:i}},Fbe=(t,e)=>{t!==void 0&&e.reject(t)},Lbe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&XO({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},XO=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Nbe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as zbe}from"node:events";var F_,QO=y(()=>{F_=async(t,e)=>{t.aborted||await zbe(t,"abort",{signal:e})}});var MZ,FZ,Ube,eR=y(()=>{QO();MZ=({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)}`)},FZ=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Ube(t,e,n,i)],Ube=async(t,e,r,{signal:n})=>{throw await F_(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var dl,qbe,tR,LZ,zZ,L_,UZ,qZ,BZ,HZ,GZ,ZZ,Bbe,Hbe,Gbe,Kn,Zbe,is,fl,pl=y(()=>{dl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{qbe(t,e,r),tR(t,e,n)},qbe=(t,e,r)=>{if(!r)throw new Error(`${Kn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},tR=(t,e,r)=>{if(!r)throw new Error(`${Kn(t,e)} cannot be used: the ${is(e)} has already exited or disconnected.`)},LZ=t=>{throw new Error(`${Kn("getOneMessage",t)} could not complete: the ${is(t)} exited or disconnected.`)},zZ=t=>{throw new Error(`${Kn("sendMessage",t)} failed: the ${is(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as G_e}from"node:util";var Ei,Z_e,V_e,W_e,R_,K_e,ll=y(()=>{E_();SG();xG();Ei=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Z_e({type:t,result:i,verboseInfo:n}),s=V_e(e,o),a=wG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Z_e=({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}),V_e=(t,e)=>t.split(` +`).map(r=>W_e({...e,message:r})),W_e=t=>({verboseLine:vG(t),verboseObject:t}),R_=t=>{let e=typeof t=="string"?t:G_e(t);return Tf(e).replaceAll(" "," ".repeat(K_e))},K_e=2});var $G,kG=y(()=>{is();ll();$G=(t,e)=>{al(e)&&Ei({type:"command",verboseMessage:t,verboseInfo:e})}});var EG,J_e,Y_e,X_e,AG=y(()=>{is();EG=(t,e,r)=>{X_e(t);let n=J_e(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},J_e=t=>al({verbose:t})?Y_e++:void 0,Y_e=0n,X_e=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(!k_.includes(e)&&!$_(e)){let r=k_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as TG}from"node:process";var I_,HO,P_=y(()=>{I_=()=>TG.bigint(),HO=t=>Number(TG.bigint()-t)/1e6});var C_,GO=y(()=>{kG();AG();P_();E_();ho();C_=(t,e,r)=>{let n=I_(),{command:i,escapedCommand:o}=aG(t,e),s=FO(r,"verbose"),a=EG(s,o,{...r});return $G(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var CG=v((J7e,PG)=>{PG.exports=IG;IG.sync=ebe;var OG=He("fs");function Q_e(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{MG.exports=NG;NG.sync=tbe;var DG=He("fs");function NG(t,e,r){DG.stat(t,function(n,i){r(n,n?!1:jG(i,e))})}function tbe(t,e){return jG(DG.statSync(t),e)}function jG(t,e){return t.isFile()&&rbe(t,e)}function rbe(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 zG=v((Q7e,LG)=>{var X7e=He("fs"),D_;process.platform==="win32"||global.TESTING_WINDOWS?D_=CG():D_=FG();LG.exports=ZO;ZO.sync=nbe;function ZO(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){ZO(t,e||{},function(o,s){o?i(o):n(s)})})}D_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function nbe(t,e){try{return D_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var VG=v((eQe,ZG)=>{var ul=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",UG=He("path"),ibe=ul?";":":",qG=zG(),BG=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),HG=(t,e)=>{let r=e.colon||ibe,n=t.match(/\//)||ul&&t.match(/\\/)?[""]:[...ul?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=ul?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=ul?i.split(r):[""];return ul&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},GG=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=HG(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(BG(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=UG.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];qG(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)},obe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=HG(t,e),o=[];for(let s=0;s{"use strict";var WG=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};VO.exports=WG;VO.exports.default=WG});var QG=v((rQe,XG)=>{"use strict";var JG=He("path"),sbe=VG(),abe=KG();function YG(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=sbe.sync(t.command,{path:r[abe({env:r})],pathExt:e?JG.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=JG.resolve(i?t.options.cwd:"",s)),s}function cbe(t){return YG(t)||YG(t,!0)}XG.exports=cbe});var eZ=v((nQe,KO)=>{"use strict";var WO=/([()\][%!^"`<>&|;, *?])/g;function lbe(t){return t=t.replace(WO,"^$1"),t}function ube(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(WO,"^$1"),e&&(t=t.replace(WO,"^$1")),t}KO.exports.command=lbe;KO.exports.argument=ube});var rZ=v((iQe,tZ)=>{"use strict";tZ.exports=/^#!(.*)/});var iZ=v((oQe,nZ)=>{"use strict";var dbe=rZ();nZ.exports=(t="")=>{let e=t.match(dbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var sZ=v((sQe,oZ)=>{"use strict";var JO=He("fs"),fbe=iZ();function pbe(t){let r=Buffer.alloc(150),n;try{n=JO.openSync(t,"r"),JO.readSync(n,r,0,150,0),JO.closeSync(n)}catch{}return fbe(r.toString())}oZ.exports=pbe});var uZ=v((aQe,lZ)=>{"use strict";var mbe=He("path"),aZ=QG(),cZ=eZ(),hbe=sZ(),gbe=process.platform==="win32",ybe=/\.(?:com|exe)$/i,_be=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function bbe(t){t.file=aZ(t);let e=t.file&&hbe(t.file);return e?(t.args.unshift(t.file),t.command=e,aZ(t)):t.file}function vbe(t){if(!gbe)return t;let e=bbe(t),r=!ybe.test(e);if(t.options.forceShell||r){let n=_be.test(e);t.command=mbe.normalize(t.command),t.command=cZ.command(t.command),t.args=t.args.map(o=>cZ.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 Sbe(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:vbe(n)}lZ.exports=Sbe});var pZ=v((cQe,fZ)=>{"use strict";var YO=process.platform==="win32";function XO(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 wbe(t,e){if(!YO)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=dZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function dZ(t,e){return YO&&t===1&&!e.file?XO(e.original,"spawn"):null}function xbe(t,e){return YO&&t===1&&!e.file?XO(e.original,"spawnSync"):null}fZ.exports={hookChildProcess:wbe,verifyENOENT:dZ,verifyENOENTSync:xbe,notFoundError:XO}});var gZ=v((lQe,dl)=>{"use strict";var mZ=He("child_process"),QO=uZ(),eR=pZ();function hZ(t,e,r){let n=QO(t,e,r),i=mZ.spawn(n.command,n.args,n.options);return eR.hookChildProcess(i,n),i}function $be(t,e,r){let n=QO(t,e,r),i=mZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||eR.verifyENOENTSync(i.status,n),i}dl.exports=hZ;dl.exports.spawn=hZ;dl.exports.sync=$be;dl.exports._parse=QO;dl.exports._enoent=eR});function N_(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 yZ=y(()=>{});var _Z=y(()=>{});import{promisify as kbe}from"node:util";import{execFile as Ebe,execFileSync as mQe}from"node:child_process";import bZ from"node:path";import{fileURLToPath as Abe}from"node:url";function j_(t){return t instanceof URL?Abe(t):t}function vZ(t){return{*[Symbol.iterator](){let e=bZ.resolve(j_(t)),r;for(;r!==e;)yield e,r=e,e=bZ.resolve(e,"..")}}}var yQe,_Qe,SZ=y(()=>{_Z();yQe=kbe(Ebe);_Qe=10*1024*1024});import M_ from"node:process";import Sa from"node:path";var Tbe,Obe,Rbe,wZ,xZ=y(()=>{yZ();SZ();Tbe=({cwd:t=M_.cwd(),path:e=M_.env[N_()],preferLocal:r=!0,execPath:n=M_.execPath,addExecPath:i=!0}={})=>{let o=Sa.resolve(j_(t)),s=[],a=e.split(Sa.delimiter);return r&&Obe(s,a,o),i&&Rbe(s,a,n,o),e===""||e===Sa.delimiter?`${s.join(Sa.delimiter)}${e}`:[...s,e].join(Sa.delimiter)},Obe=(t,e,r)=>{for(let n of vZ(r)){let i=Sa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Rbe=(t,e,r,n)=>{let i=Sa.resolve(n,j_(r),"..");e.includes(i)||t.push(i)},wZ=({env:t=M_.env,...e}={})=>{t={...t};let r=N_({env:t});return e.path=t[r],t[r]=Tbe(e),t}});var $Z,Kn,kZ,EZ,AZ,F_,Of,Rf,wa=y(()=>{$Z=(t,e,r)=>{let n=r?Rf:Of,i=t instanceof Kn?{}:{cause:t};return new n(e,i)},Kn=class extends Error{},kZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,AZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},EZ=t=>F_(t)&&AZ in t,AZ=Symbol("isExecaError"),F_=t=>Object.prototype.toString.call(t)==="[object Error]",Of=class extends Error{};kZ(Of,Of.name);Rf=class extends Error{};kZ(Rf,Rf.name)});var TZ,Ibe,OZ,RZ,IZ=y(()=>{TZ=()=>{let t=RZ-OZ+1;return Array.from({length:t},Ibe)},Ibe=(t,e)=>({name:`SIGRT${e+1}`,number:OZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),OZ=34,RZ=64});var PZ,CZ=y(()=>{PZ=[{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 Pbe}from"node:os";var tR,Cbe,DZ=y(()=>{CZ();IZ();tR=()=>{let t=TZ();return[...PZ,...t].map(Cbe)},Cbe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Pbe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Dbe}from"node:os";var Nbe,jbe,NZ,Mbe,Fbe,Lbe,NQe,jZ=y(()=>{DZ();Nbe=()=>{let t=tR();return Object.fromEntries(t.map(jbe))},jbe=({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}],NZ=Nbe(),Mbe=()=>{let t=tR(),e=65,r=Array.from({length:e},(n,i)=>Fbe(i,t));return Object.assign({},...r)},Fbe=(t,e)=>{let r=Lbe(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}}},Lbe=(t,e)=>{let r=e.find(({name:n})=>Dbe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},NQe=Mbe()});import{constants as If}from"node:os";var FZ,LZ,zZ,zbe,Ube,MZ,qbe,rR,Bbe,Hbe,L_,Pf=y(()=>{jZ();FZ=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return zZ(t,e)},LZ=t=>t===0?t:zZ(t,"`subprocess.kill()`'s argument"),zZ=(t,e)=>{if(Number.isInteger(t))return zbe(t,e);if(typeof t=="string")return qbe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${rR()}`)},zbe=(t,e)=>{if(MZ.has(t))return MZ.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${rR()}`)},Ube=()=>new Map(Object.entries(If.signals).reverse().map(([t,e])=>[e,t])),MZ=Ube(),qbe=(t,e)=>{if(t in If.signals)return t;throw t.toUpperCase()in If.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${rR()}`)},rR=()=>`Available signal names: ${Bbe()}. +Available signal numbers: ${Hbe()}.`,Bbe=()=>Object.keys(If.signals).sort().map(t=>`'${t}'`).join(", "),Hbe=()=>[...new Set(Object.values(If.signals).sort((t,e)=>t-e))].join(", "),L_=t=>NZ[t].description});import{setTimeout as Gbe}from"node:timers/promises";var UZ,Zbe,qZ,Vbe,Wbe,Kbe,nR,z_=y(()=>{wa();Pf();UZ=t=>{if(t===!1)return t;if(t===!0)return Zbe;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},Zbe=1e3*5,qZ=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Vbe(s,a,r);Wbe(l,n);let u=t(c);return Kbe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Vbe=(t,e,r)=>{let[n=r,i]=F_(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&&!F_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:LZ(n),error:i}},Wbe=(t,e)=>{t!==void 0&&e.reject(t)},Kbe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&nR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},nR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Gbe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Jbe}from"node:events";var U_,iR=y(()=>{U_=async(t,e)=>{t.aborted||await Jbe(t,"abort",{signal:e})}});var BZ,HZ,Ybe,oR=y(()=>{iR();BZ=({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)}`)},HZ=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Ybe(t,e,n,i)],Ybe=async(t,e,r,{signal:n})=>{throw await U_(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var fl,Xbe,sR,GZ,ZZ,q_,VZ,WZ,KZ,JZ,YZ,XZ,Qbe,eve,tve,Jn,rve,os,pl,ml=y(()=>{fl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Xbe(t,e,r),sR(t,e,n)},Xbe=(t,e,r)=>{if(!r)throw new Error(`${Jn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},sR=(t,e,r)=>{if(!r)throw new Error(`${Jn(t,e)} cannot be used: the ${os(e)} has already exited or disconnected.`)},GZ=t=>{throw new Error(`${Jn("getOneMessage",t)} could not complete: the ${os(t)} exited or disconnected.`)},ZZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${os(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([ - ${Kn("getOneMessage",t)}, - ${Kn("sendMessage",t,"message, {strict: true}")}, -]);`)},L_=(t,e)=>new Error(`${Kn("sendMessage",e)} failed when sending an acknowledgment response to the ${is(e)}.`,{cause:t}),UZ=t=>{throw new Error(`${Kn("sendMessage",t)} failed: the ${is(t)} is not listening to incoming messages.`)},qZ=t=>{throw new Error(`${Kn("sendMessage",t)} failed: the ${is(t)} exited without listening to incoming messages.`)},BZ=()=>new Error(`\`cancelSignal\` aborted: the ${is(!0)} disconnected.`),HZ=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},GZ=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Kn(e,r)} cannot be used: the ${is(r)} is disconnecting.`,{cause:t})},ZZ=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Bbe(t))throw new Error(`${Kn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Bbe=({code:t,message:e})=>Hbe.has(t)||Gbe.some(r=>e.includes(r)),Hbe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Gbe=["could not be cloned","circular structure","call stack size exceeded"],Kn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Zbe(e)}${t}(${r})`,Zbe=t=>t?"":"subprocess.",is=t=>t?"parent process":"subprocess",fl=t=>{t.connected&&t.disconnect()}});var ki,ml=y(()=>{ki=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var U_,hl,Ei,VZ,Vbe,Wbe,WZ,Kbe,KZ,Pf,z_,os=y(()=>{fo();U_=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ei.get(t),o=VZ(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(WZ(o,e,n,!0));return s},hl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ei.get(t),o=VZ(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(WZ(o,e,n,!1));return s},Ei=new WeakMap,VZ=(t,e,r)=>{let n=Vbe(e,r);return Wbe(n,e,r,t),n},Vbe=(t,e)=>{let r=DO(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(`"${Pf(e)}" must not be "${t}". + ${Jn("getOneMessage",t)}, + ${Jn("sendMessage",t,"message, {strict: true}")}, +]);`)},q_=(t,e)=>new Error(`${Jn("sendMessage",e)} failed when sending an acknowledgment response to the ${os(e)}.`,{cause:t}),VZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${os(t)} is not listening to incoming messages.`)},WZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${os(t)} exited without listening to incoming messages.`)},KZ=()=>new Error(`\`cancelSignal\` aborted: the ${os(!0)} disconnected.`),JZ=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},YZ=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Jn(e,r)} cannot be used: the ${os(r)} is disconnecting.`,{cause:t})},XZ=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Qbe(t))throw new Error(`${Jn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Qbe=({code:t,message:e})=>eve.has(t)||tve.some(r=>e.includes(r)),eve=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),tve=["could not be cloned","circular structure","call stack size exceeded"],Jn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${rve(e)}${t}(${r})`,rve=t=>t?"":"subprocess.",os=t=>t?"parent process":"subprocess",pl=t=>{t.connected&&t.disconnect()}});var Ai,hl=y(()=>{Ai=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var H_,gl,Ti,QZ,nve,ive,e9,ove,t9,Cf,B_,ss=y(()=>{ho();H_=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ti.get(t),o=QZ(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(e9(o,e,n,!0));return s},gl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ti.get(t),o=QZ(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(e9(o,e,n,!1));return s},Ti=new WeakMap,QZ=(t,e,r)=>{let n=nve(e,r);return ive(n,e,r,t),n},nve=(t,e)=>{let r=LO(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(`"${Cf(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},Wbe=(t,e,r,n)=>{let i=n[KZ(t)];if(i===void 0)throw new TypeError(`"${Pf(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(`"${Pf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Pf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},WZ=(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}=Kbe(t,r);return`The "${i}: ${z_(o)}" option is incompatible with using "${Pf(n)}: ${z_(e)}". -Please set this option with "pipe" instead.`},Kbe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=KZ(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]}},KZ=t=>t==="all"?1:t,Pf=t=>t?"to":"from",z_=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Jbe}from"node:events";var wa,q_=y(()=>{wa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Jbe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var B_,rR,H_,nR,JZ,YZ,Cf=y(()=>{B_=(t,e)=>{e&&rR(t)},rR=t=>{t.refCounted()},H_=(t,e)=>{e&&nR(t)},nR=t=>{t.unrefCounted()},JZ=(t,e)=>{e&&(nR(t),nR(t))},YZ=(t,e)=>{e&&(rR(t),rR(t))}});import{once as Ybe}from"node:events";import{scheduler as Xbe}from"node:timers/promises";var XZ,QZ,G_,e9=y(()=>{V_();Cf();Z_();W_();XZ=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(r9(i)||i9(i))return;G_.has(t)||G_.set(t,[]);let o=G_.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await n9(t,n,i),await Xbe.yield();let s=await t9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},QZ=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{iR();let o=G_.get(t);for(;o?.length>0;)await Ybe(n,"message:done");t.removeListener("message",i),YZ(e,r),n.connected=!1,n.emit("disconnect")},G_=new WeakMap});import{EventEmitter as Qbe}from"node:events";var ss,K_,eve,J_,Df=y(()=>{e9();Cf();ss=(t,e,r)=>{if(K_.has(t))return K_.get(t);let n=new Qbe;return n.connected=!0,K_.set(t,n),eve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},K_=new WeakMap,eve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=XZ.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",QZ.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),JZ(r,n)},J_=t=>{let e=K_.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as tve}from"node:events";var o9,rve,s9,t9,r9,a9,Y_,nve,X_,c9,Z_=y(()=>{ml();q_();tb();pl();Df();V_();o9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ss(t,e,r),s=Q_(t,o);return{id:rve++,type:X_,message:n,hasListeners:s}},rve=0n,s9=(t,e)=>{if(!(e?.type!==X_||e.hasListeners))for(let{id:r}of t)r!==void 0&&Y_[r].resolve({isDeadlock:!0,hasListeners:!1})},t9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==X_||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:c9,message:Q_(e,i)};try{await eb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},r9=t=>{if(t?.type!==c9)return!1;let{id:e,message:r}=t;return Y_[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},a9=async(t,e,r)=>{if(t?.type!==X_)return;let n=ki();Y_[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,nve(e,r,i)]);o&&zZ(r),s||UZ(r)}finally{i.abort(),delete Y_[t.id]}},Y_={},nve=async(t,e,{signal:r})=>{wa(t,1,r),await tve(t,"disconnect",{signal:r}),qZ(e)},X_="execa:ipc:request",c9="execa:ipc:response"});var l9,u9,n9,Nf,Q_,ive,V_=y(()=>{ml();fo();os();Z_();l9=(t,e,r)=>{Nf.has(t)||Nf.set(t,new Set);let n=Nf.get(t),i=ki(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},u9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},n9=async(t,e,r)=>{for(;!Q_(t,e)&&Nf.get(t)?.size>0;){let n=[...Nf.get(t)];s9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Nf=new WeakMap,Q_=(t,e)=>e.listenerCount("message")>ive(t),ive=t=>Ei.has(t)&&!uo(Ei.get(t).options.buffer,"ipc")?1:0});import{promisify as ove}from"node:util";var eb,sve,sR,ave,oR,tb=y(()=>{pl();V_();Z_();eb=({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}),sve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},sve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=o9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=l9(t,s,o);try{await sR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw fl(t),c}finally{u9(a)}},sR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=ave(t);try{await Promise.all([a9(n,t,r),o(n)])}catch(s){throw GZ({error:s,methodName:e,isSubprocess:r}),ZZ({error:s,methodName:e,isSubprocess:r,message:i}),s}},ave=t=>{if(oR.has(t))return oR.get(t);let e=ove(t.send.bind(t));return oR.set(t,e),e},oR=new WeakMap});import{scheduler as cve}from"node:timers/promises";var f9,p9,lve,d9,i9,m9,iR,aR,W_=y(()=>{tb();Df();pl();f9=(t,e)=>{let r="cancelSignal";return tR(r,!1,t.connected),sR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:m9,message:e},message:e})},p9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await lve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),aR.signal),lve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!d9){if(d9=!0,!n){HZ();return}if(e===null){iR();return}ss(t,e,r),await cve.yield()}},d9=!1,i9=t=>t?.type!==m9?!1:(aR.abort(t.message),!0),m9="execa:ipc:cancel",iR=()=>{aR.abort(BZ())},aR=new AbortController});var h9,g9,uve,dve,cR=y(()=>{QO();W_();M_();h9=({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.")}},g9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[uve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],uve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await F_(e,i);let o=dve(e);throw await f9(t,o),XO({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},dve=({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 fve}from"node:timers/promises";var y9,_9,pve,lR=y(()=>{Sa();y9=({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})`)},_9=(t,e,r,n)=>e===0||e===void 0?[]:[pve(t,e,r,n)],pve=async(t,e,r,{signal:n})=>{throw await fve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Wn}});import{execPath as mve,execArgv as hve}from"node:process";import b9 from"node:path";var v9,S9,uR=y(()=>{ol();v9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},S9=(t,e,{node:r=!1,nodePath:n=mve,nodeOptions:i=hve.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=il(n,'The "nodePath" option'),l=b9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(b9.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 gve}from"node:v8";var w9,yve,_ve,bve,x9,dR=y(()=>{w9=({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`.");bve[r](t)}},yve=t=>{try{gve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},_ve=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},bve={advanced:yve,json:_ve},x9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var k9,vve,tn,fR,Sve,$9,rb,xa=y(()=>{k9=({encoding:t})=>{if(fR.has(t))return;let e=Sve(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${rb(t)}\`. -Please rename it to ${rb(e)}.`);let r=[...fR].map(n=>rb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${rb(t)}\`. -Please rename it to one of: ${r}.`)},vve=new Set(["utf8","utf16le"]),tn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),fR=new Set([...vve,...tn]),Sve=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in $9)return $9[e];if(fR.has(e))return e},$9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},rb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as wve}from"node:fs";import xve from"node:path";import $ve from"node:process";var E9,A9,T9,pR=y(()=>{ol();E9=(t=A9())=>{let e=il(t,'The "cwd" option');return xve.resolve(e)},A9=()=>{try{return $ve.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},T9=(t,e)=>{if(e===A9())return t;let r;try{r=wve(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},ive=(t,e,r,n)=>{let i=n[t9(t)];if(i===void 0)throw new TypeError(`"${Cf(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(`"${Cf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Cf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},e9=(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}=ove(t,r);return`The "${i}: ${B_(o)}" option is incompatible with using "${Cf(n)}: ${B_(e)}". +Please set this option with "pipe" instead.`},ove=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=t9(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]}},t9=t=>t==="all"?1:t,Cf=t=>t?"to":"from",B_=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as sve}from"node:events";var xa,G_=y(()=>{xa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),sve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Z_,aR,V_,cR,r9,n9,Df=y(()=>{Z_=(t,e)=>{e&&aR(t)},aR=t=>{t.refCounted()},V_=(t,e)=>{e&&cR(t)},cR=t=>{t.unrefCounted()},r9=(t,e)=>{e&&(cR(t),cR(t))},n9=(t,e)=>{e&&(aR(t),aR(t))}});import{once as ave}from"node:events";import{scheduler as cve}from"node:timers/promises";var i9,o9,W_,s9=y(()=>{J_();Df();K_();Y_();i9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(c9(i)||u9(i))return;W_.has(t)||W_.set(t,[]);let o=W_.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await l9(t,n,i),await cve.yield();let s=await a9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},o9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{lR();let o=W_.get(t);for(;o?.length>0;)await ave(n,"message:done");t.removeListener("message",i),n9(e,r),n.connected=!1,n.emit("disconnect")},W_=new WeakMap});import{EventEmitter as lve}from"node:events";var as,X_,uve,Q_,Nf=y(()=>{s9();Df();as=(t,e,r)=>{if(X_.has(t))return X_.get(t);let n=new lve;return n.connected=!0,X_.set(t,n),uve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},X_=new WeakMap,uve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=i9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",o9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),r9(r,n)},Q_=t=>{let e=X_.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as dve}from"node:events";var d9,fve,f9,a9,c9,p9,eb,pve,tb,m9,K_=y(()=>{hl();G_();ib();ml();Nf();J_();d9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=as(t,e,r),s=rb(t,o);return{id:fve++,type:tb,message:n,hasListeners:s}},fve=0n,f9=(t,e)=>{if(!(e?.type!==tb||e.hasListeners))for(let{id:r}of t)r!==void 0&&eb[r].resolve({isDeadlock:!0,hasListeners:!1})},a9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==tb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:m9,message:rb(e,i)};try{await nb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},c9=t=>{if(t?.type!==m9)return!1;let{id:e,message:r}=t;return eb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},p9=async(t,e,r)=>{if(t?.type!==tb)return;let n=Ai();eb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,pve(e,r,i)]);o&&ZZ(r),s||VZ(r)}finally{i.abort(),delete eb[t.id]}},eb={},pve=async(t,e,{signal:r})=>{xa(t,1,r),await dve(t,"disconnect",{signal:r}),WZ(e)},tb="execa:ipc:request",m9="execa:ipc:response"});var h9,g9,l9,jf,rb,mve,J_=y(()=>{hl();ho();ss();K_();h9=(t,e,r)=>{jf.has(t)||jf.set(t,new Set);let n=jf.get(t),i=Ai(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},g9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},l9=async(t,e,r)=>{for(;!rb(t,e)&&jf.get(t)?.size>0;){let n=[...jf.get(t)];f9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},jf=new WeakMap,rb=(t,e)=>e.listenerCount("message")>mve(t),mve=t=>Ti.has(t)&&!mo(Ti.get(t).options.buffer,"ipc")?1:0});import{promisify as hve}from"node:util";var nb,gve,dR,yve,uR,ib=y(()=>{ml();J_();K_();nb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return fl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),gve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},gve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=d9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=h9(t,s,o);try{await dR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw pl(t),c}finally{g9(a)}},dR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=yve(t);try{await Promise.all([p9(n,t,r),o(n)])}catch(s){throw YZ({error:s,methodName:e,isSubprocess:r}),XZ({error:s,methodName:e,isSubprocess:r,message:i}),s}},yve=t=>{if(uR.has(t))return uR.get(t);let e=hve(t.send.bind(t));return uR.set(t,e),e},uR=new WeakMap});import{scheduler as _ve}from"node:timers/promises";var _9,b9,bve,y9,u9,v9,lR,fR,Y_=y(()=>{ib();Nf();ml();_9=(t,e)=>{let r="cancelSignal";return sR(r,!1,t.connected),dR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:v9,message:e},message:e})},b9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await bve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),fR.signal),bve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!y9){if(y9=!0,!n){JZ();return}if(e===null){lR();return}as(t,e,r),await _ve.yield()}},y9=!1,u9=t=>t?.type!==v9?!1:(fR.abort(t.message),!0),v9="execa:ipc:cancel",lR=()=>{fR.abort(KZ())},fR=new AbortController});var S9,w9,vve,Sve,pR=y(()=>{iR();Y_();z_();S9=({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.")}},w9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[vve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],vve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await U_(e,i);let o=Sve(e);throw await _9(t,o),nR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Sve=({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 wve}from"node:timers/promises";var x9,$9,xve,mR=y(()=>{wa();x9=({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})`)},$9=(t,e,r,n)=>e===0||e===void 0?[]:[xve(t,e,r,n)],xve=async(t,e,r,{signal:n})=>{throw await wve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Kn}});import{execPath as $ve,execArgv as kve}from"node:process";import k9 from"node:path";var E9,A9,hR=y(()=>{sl();E9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},A9=(t,e,{node:r=!1,nodePath:n=$ve,nodeOptions:i=kve.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=k9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(k9.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 Eve}from"node:v8";var T9,Ave,Tve,Ove,O9,gR=y(()=>{T9=({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`.");Ove[r](t)}},Ave=t=>{try{Eve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},Tve=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},Ove={advanced:Ave,json:Tve},O9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var I9,Rve,rn,yR,Ive,R9,ob,$a=y(()=>{I9=({encoding:t})=>{if(yR.has(t))return;let e=Ive(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${ob(t)}\`. +Please rename it to ${ob(e)}.`);let r=[...yR].map(n=>ob(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${ob(t)}\`. +Please rename it to one of: ${r}.`)},Rve=new Set(["utf8","utf16le"]),rn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),yR=new Set([...Rve,...rn]),Ive=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in R9)return R9[e];if(yR.has(e))return e},R9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},ob=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as Pve}from"node:fs";import Cve from"node:path";import Dve from"node:process";var P9,C9,D9,_R=y(()=>{sl();P9=(t=C9())=>{let e=ol(t,'The "cwd" option');return Cve.resolve(e)},C9=()=>{try{return Dve.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},D9=(t,e)=>{if(e===C9())return t;let r;try{r=Pve(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 kve from"node:path";import O9 from"node:process";var R9,nb,Eve,Ave,mR=y(()=>{R9=Et(uZ(),1);yZ();M_();If();eR();cR();lR();uR();dR();xa();pR();ol();fo();nb=(t,e,r)=>{r.cwd=E9(r.cwd);let[n,i,o]=S9(t,e,r),{command:s,args:a,options:c}=R9.default._parse(n,i,o),l=QH(c),u=Eve(l);return y9(u),k9(u),w9(u),MZ(u),h9(u),u.shell=OO(u.shell),u.env=Ave(u),u.killSignal=PZ(u.killSignal),u.forceKillAfterDelay=NZ(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!tn.has(u.encoding)&&u.buffer[f]),O9.platform==="win32"&&kve.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},Eve=({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}),Ave=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...O9.env,...t}:t;return r||n?gZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var ib,hR=y(()=>{ib=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function gl(t){if(typeof t=="string")return Tve(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Ove(t)}var Tve,Ove,I9,Rve,P9,Ive,gR=y(()=>{Tve=t=>t.at(-1)===I9?t.slice(0,t.at(-2)===P9?-2:-1):t,Ove=t=>t.at(-1)===Rve?t.subarray(0,t.at(-2)===Ive?-2:-1):t,I9=` -`,Rve=I9.codePointAt(0),P9="\r",Ive=P9.codePointAt(0)});function Jn(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 yR(t,{checkOpen:e=!0}={}){return Jn(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 $a(t,{checkOpen:e=!0}={}){return Jn(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 _R(t,e){return yR(t,e)&&$a(t,e)}var ka=y(()=>{});function C9(){return this[vR].next()}function D9(t){return this[vR].return(t)}function SR({preventCancel:t=!1}={}){let e=this.getReader(),r=new bR(e,t),n=Object.create(Cve);return n[vR]=r,n}var Pve,bR,vR,Cve,N9=y(()=>{Pve=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),bR=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}}},vR=Symbol();Object.defineProperty(C9,"name",{value:"next"});Object.defineProperty(D9,"name",{value:"return"});Cve=Object.create(Pve,{next:{enumerable:!0,configurable:!0,writable:!0,value:C9},return:{enumerable:!0,configurable:!0,writable:!0,value:D9}})});var j9=y(()=>{});var M9=y(()=>{N9();j9()});var F9,Dve,Nve,jve,jf,wR=y(()=>{ka();M9();F9=t=>{if($a(t,{checkOpen:!1})&&jf.on!==void 0)return Nve(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Dve.call(t)==="[object ReadableStream]")return SR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Dve}=Object.prototype,Nve=async function*(t){let e=new AbortController,r={};jve(t,e,r);try{for await(let[n]of jf.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()}},jve=async(t,e,r)=>{try{await jf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},jf={}});var yl,Mve,U9,L9,Fve,z9,Ai,Mf=y(()=>{wR();yl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=F9(t),u=e();u.length=0;try{for await(let d of l){let f=Fve(d),p=r[f](d,u);U9({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Mve({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}},Mve=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&U9({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},U9=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){L9(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&L9(c,e,i,o),new Ai},L9=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Fve=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=z9.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&z9.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:z9}=Object.prototype,Ai=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var po,Ff,ob,sb,ab,cb=y(()=>{po=t=>t,Ff=()=>{},ob=({contents:t})=>t,sb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},ab=t=>t.length});async function lb(t,e){return yl(t,qve,e)}var Lve,zve,Uve,qve,q9=y(()=>{Mf();cb();Lve=()=>({contents:[]}),zve=()=>1,Uve=(t,{contents:e})=>(e.push(t),e),qve={init:Lve,convertChunk:{string:po,buffer:po,arrayBuffer:po,dataView:po,typedArray:po,others:po},getSize:zve,truncateChunk:Ff,addChunk:Uve,getFinalChunk:Ff,finalize:ob}});async function ub(t,e){return yl(t,Yve,e)}var Bve,Hve,Gve,B9,H9,Zve,Vve,Wve,Kve,Z9,G9,Jve,V9,Yve,W9=y(()=>{Mf();cb();Bve=()=>({contents:new ArrayBuffer(0)}),Hve=t=>Gve.encode(t),Gve=new TextEncoder,B9=t=>new Uint8Array(t),H9=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Zve=(t,e)=>t.slice(0,e),Vve=(t,{contents:e,length:r},n)=>{let i=V9()?Kve(e,n):Wve(e,n);return new Uint8Array(i).set(t,r),i},Wve=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(Z9(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Kve=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:Z9(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},Z9=t=>G9**Math.ceil(Math.log(t)/Math.log(G9)),G9=2,Jve=({contents:t,length:e})=>V9()?t:t.slice(0,e),V9=()=>"resize"in ArrayBuffer.prototype,Yve={init:Bve,convertChunk:{string:Hve,buffer:B9,arrayBuffer:B9,dataView:H9,typedArray:H9,others:sb},getSize:ab,truncateChunk:Zve,addChunk:Vve,getFinalChunk:Ff,finalize:Jve}});async function fb(t,e){return yl(t,rSe,e)}var Xve,db,Qve,eSe,tSe,rSe,K9=y(()=>{Mf();cb();Xve=()=>({contents:"",textDecoder:new TextDecoder}),db=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Qve=(t,{contents:e})=>e+t,eSe=(t,e)=>t.slice(0,e),tSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},rSe={init:Xve,convertChunk:{string:po,buffer:db,arrayBuffer:db,dataView:db,typedArray:db,others:sb},getSize:ab,truncateChunk:eSe,addChunk:Qve,getFinalChunk:tSe,finalize:ob}});var J9=y(()=>{q9();W9();K9();Mf()});import{on as nSe}from"node:events";import{finished as iSe}from"node:stream/promises";var pb=y(()=>{wR();J9();Object.assign(jf,{on:nSe,finished:iSe})});var Y9,oSe,X9,Q9,sSe,eV,tV,mb,Ea=y(()=>{pb();lo();fo();Y9=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ai))throw t;if(o==="all")return t;let s=oSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},oSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",X9=(t,e,r)=>{if(e.length!==r)return;let n=new Ai;throw n.maxBufferInfo={fdNumber:"ipc"},n},Q9=(t,e)=>{let{streamName:r,threshold:n,unit:i}=sSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},sSe=(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=uo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:v_(r),threshold:i,unit:n}},eV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>mb(r)),tV=(t,e,r)=>{if(!e)return t;let n=mb(r);return t.length>n?t.slice(0,n):t},mb=([,t])=>t});import{inspect as aSe}from"node:util";var nV,cSe,lSe,uSe,dSe,fSe,rV,iV=y(()=>{gR();en();pR();x_();Ea();If();Sa();nV=({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=cSe({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=uSe(n,b),w=x===void 0?"":` -${x}`,O=`${S}: ${a}${w}`,A=e===void 0?[t[2],t[1]]:[e],E=[O,...A,...t.slice(3),r.map(C=>dSe(C)).join(` -`)].map(C=>Af(gl(fSe(C)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:O,message:E}},cSe=({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=lSe(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?`${Q9(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${j_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},lSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",uSe=(t,e)=>{if(t instanceof Wn)return;let r=vZ(t)?t.originalMessage:String(t?.message??t),n=Af(T9(r,e));return n===""?void 0:n},dSe=t=>typeof t=="string"?t:aSe(t),fSe=t=>Array.isArray(t)?t.map(e=>gl(rV(e))).filter(Boolean).join(` -`):rV(t),rV=t=>typeof t=="string"?t:Ft(t)?__(t):""});var hb,_l,Lf,pSe,oV,mSe,zf=y(()=>{If();O_();Sa();iV();hb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>oV({command:t,escapedCommand:e,cwd:o,durationMs:LO(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:[]}),_l=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Lf({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}),Lf=({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:O,signalDescription:A}=mSe(l,u),{originalMessage:E,shortMessage:C,message:k}=nV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,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:_}),q=_Z(t,k,x);return Object.assign(q,pSe({error:q,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:A,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:E,shortMessage:C})),q},pSe=({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})=>oV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:LO(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:[]}),oV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),mSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:j_(e);return{exitCode:r,signal:n,signalDescription:i}}});function hSe(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(sV(t*1e3)%1e3),nanoseconds:Math.trunc(sV(t*1e6)%1e3)}}function gSe(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 xR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return hSe(t);break}case"bigint":return gSe(t)}throw new TypeError("Expected a finite number or bigint")}var sV,aV=y(()=>{sV=t=>Number.isFinite(t)?t:0});function $R(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+bSe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ySe(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?" "+_Se(d,u):f;i.push(p)}},a=xR(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%vSe):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 ySe,_Se,bSe,vSe,cV=y(()=>{aV();ySe=t=>t===0||t===0n,_Se=(t,e)=>e===1||e===1n?t:`${t}s`,bSe=1e-7,vSe=24n*60n*60n*1000n});var lV,uV=y(()=>{cl();lV=(t,e)=>{t.failed&&$i({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var dV,SSe,fV=y(()=>{cV();ns();cl();uV();dV=(t,e)=>{sl(e)&&(lV(t,e),SSe(t,e))},SSe=(t,e)=>{let r=`(done in ${$R(t.durationMs)})`;$i({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var bl,gb=y(()=>{fV();bl=(t,e,{reject:r})=>{if(dV(t,e),t.failed&&r)throw t;return t}});var hV,wSe,xSe,gV,yV,pV,$Se,kR,mV,Aa,_V,kSe,yb,bV,ESe,ASe,ER,vV,TSe,SV,_b,OSe,AR,RSe,ISe,wV,$n,bb,TR,xV,$V,as,_r=y(()=>{ka();ao();en();hV=(t,e)=>Aa(t)?"asyncGenerator":_V(t)?"generator":yb(t)?"fileUrl":ESe(t)?"filePath":OSe(t)?"webStream":Jn(t,{checkOpen:!1})?"native":Ft(t)?"uint8Array":RSe(t)?"asyncIterable":ISe(t)?"iterable":AR(t)?gV({transform:t},e):kSe(t)?wSe(t,e):"native",wSe=(t,e)=>_R(t.transform,{checkOpen:!1})?xSe(t,e):AR(t.transform)?gV(t,e):$Se(t,e),xSe=(t,e)=>(yV(t,e,"Duplex stream"),"duplex"),gV=(t,e)=>(yV(t,e,"web TransformStream"),"webTransform"),yV=({final:t,binary:e,objectMode:r},n,i)=>{pV(t,`${n}.final`,i),pV(e,`${n}.binary`,i),kR(r,`${n}.objectMode`)},pV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},$Se=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!mV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(_R(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(AR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!mV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return kR(r,`${i}.binary`),kR(n,`${i}.objectMode`),Aa(t)||Aa(e)?"asyncGenerator":"generator"},kR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},mV=t=>Aa(t)||_V(t),Aa=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",_V=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",kSe=t=>At(t)&&(t.transform!==void 0||t.final!==void 0),yb=t=>Object.prototype.toString.call(t)==="[object URL]",bV=t=>yb(t)&&t.protocol!=="file:",ESe=t=>At(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>ASe.has(e))&&ER(t.file),ASe=new Set(["file","append"]),ER=t=>typeof t=="string",vV=(t,e)=>t==="native"&&typeof e=="string"&&!TSe.has(e),TSe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),SV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",_b=t=>Object.prototype.toString.call(t)==="[object WritableStream]",OSe=t=>SV(t)||_b(t),AR=t=>SV(t?.readable)&&_b(t?.writable),RSe=t=>wV(t)&&typeof t[Symbol.asyncIterator]=="function",ISe=t=>wV(t)&&typeof t[Symbol.iterator]=="function",wV=t=>typeof t=="object"&&t!==null,$n=new Set(["generator","asyncGenerator","duplex","webTransform"]),bb=new Set(["fileUrl","filePath","fileNumber"]),TR=new Set(["fileUrl","filePath"]),xV=new Set([...TR,"webStream","nodeStream"]),$V=new Set(["webTransform","duplex"]),as={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 OR,PSe,CSe,kV,RR=y(()=>{_r();OR=(t,e,r,n)=>n==="output"?PSe(t,e,r):CSe(t,e,r),PSe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},CSe=(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}},kV=(t,e)=>{let r=t.findLast(({type:n})=>$n.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var EV,DSe,NSe,jSe,MSe,FSe,LSe,AV=y(()=>{ao();xa();_r();RR();EV=(t,e,r,n)=>[...t.filter(({type:i})=>!$n.has(i)),...DSe(t,e,r,n)],DSe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>$n.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=NSe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return LSe(o,r)},NSe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?jSe({stdioItem:t,optionName:i}):e==="webTransform"?MSe({stdioItem:t,index:r,newTransforms:n,direction:o}):FSe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),jSe=({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}}},MSe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=At(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=OR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},FSe=({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}=At(e)?e:{transform:e},d=c||tn.has(o),{writableObjectMode:f,readableObjectMode:p}=OR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},LSe=(t,e)=>e==="input"?t.reverse():t});import IR from"node:process";var TV,zSe,USe,vl,PR,OV,qSe,BSe,RV=y(()=>{ka();_r();TV=(t,e,r)=>{let n=t.map(i=>zSe(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)??BSe},zSe=({type:t,value:e},r)=>USe[r]??OV[t](e),USe=["input","output","output"],vl=()=>{},PR=()=>"input",OV={generator:vl,asyncGenerator:vl,fileUrl:vl,filePath:vl,iterable:PR,asyncIterable:PR,uint8Array:PR,webStream:t=>_b(t)?"output":"input",nodeStream(t){return $a(t,{checkOpen:!1})?yR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:vl,duplex:vl,native(t){let e=qSe(t);if(e!==void 0)return e;if(Jn(t,{checkOpen:!1}))return OV.nodeStream(t)}},qSe=t=>{if([0,IR.stdin].includes(t))return"input";if([1,2,IR.stdout,IR.stderr].includes(t))return"output"},BSe="output"});var IV,PV=y(()=>{IV=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var CV,HSe,GSe,DV,ZSe,VSe,NV=y(()=>{lo();PV();ns();CV=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=HSe(t,n).map((a,c)=>DV(a,c));return o?ZSe(s,r,i):IV(s,e)},HSe=(t,e)=>{if(t===void 0)return xn.map(n=>e[n]);if(GSe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${xn.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,xn.length);return Array.from({length:r},(n,i)=>t[i])},GSe=t=>xn.some(e=>t[e]!==void 0),DV=(t,e)=>Array.isArray(t)?t.map(r=>DV(r,e)):t??(e>=xn.length?"ignore":"pipe"),ZSe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!al(r,i)&&VSe(n)?"ignore":n),VSe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as WSe}from"node:fs";import KSe from"node:tty";var MV,JSe,YSe,XSe,QSe,jV,FV=y(()=>{ka();lo();en();os();MV=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?JSe({stdioItem:t,fdNumber:n,direction:i}):QSe({stdioItem:t,fdNumber:n}),JSe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=YSe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(Jn(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},YSe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=XSe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(KSe.isatty(i))throw new TypeError(`The \`${e}: ${z_(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:co(WSe(i)),optionName:e}}},XSe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=b_.indexOf(t);if(r!==-1)return r},QSe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:jV(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:jV(e,e,r),optionName:r}:Jn(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,jV=(t,e,r)=>{let n=b_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var LV,ewe,twe,rwe,nwe,zV=y(()=>{ka();en();_r();LV=({input:t,inputFile:e},r)=>r===0?[...ewe(t),...rwe(e)]:[],ewe=t=>t===void 0?[]:[{type:twe(t),value:t,optionName:"input"}],twe=t=>{if($a(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ft(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},rwe=t=>t===void 0?[]:[{...nwe(t),optionName:"inputFile"}],nwe=t=>{if(yb(t))return{type:"fileUrl",value:t};if(ER(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var UV,qV,iwe,owe,BV,swe,awe,HV,GV=y(()=>{_r();UV=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),qV=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=iwe(i,t);if(s.length!==0){if(o){owe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(xV.has(t))return BV({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});$V.has(t)&&awe({otherStdioItems:s,type:t,value:e,optionName:r})}},iwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),owe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{TR.has(e)&&BV({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},BV=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>swe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return HV(s,n,e),i==="output"?o[0].stream:void 0},swe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,awe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);HV(i,n,e)},HV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${as[r]} that is the same.`)}});var vb,cwe,lwe,uwe,dwe,fwe,pwe,mwe,hwe,gwe,ywe,_we,CR,bwe,Sb=y(()=>{lo();AV();RR();_r();RV();NV();FV();zV();GV();vb=(t,e,r,n)=>{let o=CV(e,r,n).map((a,c)=>cwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=gwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>bwe(a)),s},cwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=v_(e),{stdioItems:o,isStdioArray:s}=lwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=TV(o,e,i),c=o.map(d=>MV({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=EV(c,i,a,r),u=kV(l,a);return hwe(l,u),{direction:a,objectMode:u,stdioItems:l}},lwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>uwe(c,n)),...LV(r,e)],s=UV(o),a=s.length>1;return dwe(s,a,n),pwe(s),{stdioItems:s,isStdioArray:a}},uwe=(t,e)=>({type:hV(t,e),value:t,optionName:e}),dwe=(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(fwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},fwe=new Set(["ignore","ipc"]),pwe=t=>{for(let e of t)mwe(e)},mwe=({type:t,value:e,optionName:r})=>{if(bV(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(vV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},hwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>bb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},gwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(ywe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw CR(i),o}},ywe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>_we({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},_we=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=qV({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},CR=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Vn(r)&&r.destroy()},bwe=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 ZV}from"node:fs";var WV,Ti,vwe,KV,VV,Swe,JV=y(()=>{en();Sb();_r();WV=(t,e)=>vb(Swe,t,e,!0),Ti=({type:t,optionName:e})=>{KV(e,as[t])},vwe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&KV(t,`"${e}"`),{}),KV=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},VV={generator(){},asyncGenerator:Ti,webStream:Ti,nodeStream:Ti,webTransform:Ti,duplex:Ti,asyncIterable:Ti,native:vwe},Swe={input:{...VV,fileUrl:({value:t})=>({contents:[co(ZV(t))]}),filePath:({value:{file:t}})=>({contents:[co(ZV(t))]}),fileNumber:Ti,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...VV,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Ti,string:Ti,uint8Array:Ti}}});var mo,DR,Uf=y(()=>{gR();mo=(t,{stripFinalNewline:e},r)=>DR(e,r)&&t!==void 0&&!Array.isArray(t)?gl(t):t,DR=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var wb,jR,YV,XV,wwe,xwe,$we,QV,kwe,NR,Ewe,Awe,Twe,xb=y(()=>{wb=(t,e,r,n)=>t||r?void 0:XV(e,n),jR=(t,e,r)=>r?t.flatMap(n=>YV(n,e)):YV(t,e),YV=(t,e)=>{let{transform:r,final:n}=XV(e,{});return[...r(t),...n()]},XV=(t,e)=>(e.previousChunks="",{transform:wwe.bind(void 0,e,t),final:$we.bind(void 0,e)}),wwe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=NR(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=NR(n,r.slice(i+1))),t.previousChunks=n},xwe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),$we=function*({previousChunks:t}){t.length>0&&(yield t)},QV=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:kwe.bind(void 0,n)},kwe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Ewe:Twe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},NR=(t,e)=>`${t}${e}`,Ewe={windowsNewline:`\r +${t}`}});import Nve from"node:path";import N9 from"node:process";var j9,sb,jve,Mve,bR=y(()=>{j9=bt(gZ(),1);xZ();z_();Pf();oR();pR();mR();hR();gR();$a();_R();sl();ho();sb=(t,e,r)=>{r.cwd=P9(r.cwd);let[n,i,o]=A9(t,e,r),{command:s,args:a,options:c}=j9.default._parse(n,i,o),l=oG(c),u=jve(l);return x9(u),I9(u),T9(u),BZ(u),S9(u),u.shell=DO(u.shell),u.env=Mve(u),u.killSignal=FZ(u.killSignal),u.forceKillAfterDelay=UZ(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!rn.has(u.encoding)&&u.buffer[f]),N9.platform==="win32"&&Nve.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},jve=({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}),Mve=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...N9.env,...t}:t;return r||n?wZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var ab,vR=y(()=>{ab=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function yl(t){if(typeof t=="string")return Fve(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Lve(t)}var Fve,Lve,M9,zve,F9,Uve,SR=y(()=>{Fve=t=>t.at(-1)===M9?t.slice(0,t.at(-2)===F9?-2:-1):t,Lve=t=>t.at(-1)===zve?t.subarray(0,t.at(-2)===Uve?-2:-1):t,M9=` +`,zve=M9.codePointAt(0),F9="\r",Uve=F9.codePointAt(0)});function Yn(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 wR(t,{checkOpen:e=!0}={}){return Yn(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 ka(t,{checkOpen:e=!0}={}){return Yn(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 xR(t,e){return wR(t,e)&&ka(t,e)}var Ea=y(()=>{});function L9(){return this[kR].next()}function z9(t){return this[kR].return(t)}function ER({preventCancel:t=!1}={}){let e=this.getReader(),r=new $R(e,t),n=Object.create(Bve);return n[kR]=r,n}var qve,$R,kR,Bve,U9=y(()=>{qve=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),$R=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}}},kR=Symbol();Object.defineProperty(L9,"name",{value:"next"});Object.defineProperty(z9,"name",{value:"return"});Bve=Object.create(qve,{next:{enumerable:!0,configurable:!0,writable:!0,value:L9},return:{enumerable:!0,configurable:!0,writable:!0,value:z9}})});var q9=y(()=>{});var B9=y(()=>{U9();q9()});var H9,Hve,Gve,Zve,Mf,AR=y(()=>{Ea();B9();H9=t=>{if(ka(t,{checkOpen:!1})&&Mf.on!==void 0)return Gve(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Hve.call(t)==="[object ReadableStream]")return ER.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Hve}=Object.prototype,Gve=async function*(t){let e=new AbortController,r={};Zve(t,e,r);try{for await(let[n]of Mf.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()}},Zve=async(t,e,r)=>{try{await Mf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Mf={}});var _l,Vve,V9,G9,Wve,Z9,Oi,Ff=y(()=>{AR();_l=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=H9(t),u=e();u.length=0;try{for await(let d of l){let f=Wve(d),p=r[f](d,u);V9({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Vve({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}},Vve=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&V9({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},V9=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){G9(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&G9(c,e,i,o),new Oi},G9=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Wve=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=Z9.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&Z9.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:Z9}=Object.prototype,Oi=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var go,Lf,cb,lb,ub,db=y(()=>{go=t=>t,Lf=()=>{},cb=({contents:t})=>t,lb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},ub=t=>t.length});async function fb(t,e){return _l(t,Xve,e)}var Kve,Jve,Yve,Xve,W9=y(()=>{Ff();db();Kve=()=>({contents:[]}),Jve=()=>1,Yve=(t,{contents:e})=>(e.push(t),e),Xve={init:Kve,convertChunk:{string:go,buffer:go,arrayBuffer:go,dataView:go,typedArray:go,others:go},getSize:Jve,truncateChunk:Lf,addChunk:Yve,getFinalChunk:Lf,finalize:cb}});async function pb(t,e){return _l(t,aSe,e)}var Qve,eSe,tSe,K9,J9,rSe,nSe,iSe,oSe,X9,Y9,sSe,Q9,aSe,eV=y(()=>{Ff();db();Qve=()=>({contents:new ArrayBuffer(0)}),eSe=t=>tSe.encode(t),tSe=new TextEncoder,K9=t=>new Uint8Array(t),J9=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),rSe=(t,e)=>t.slice(0,e),nSe=(t,{contents:e,length:r},n)=>{let i=Q9()?oSe(e,n):iSe(e,n);return new Uint8Array(i).set(t,r),i},iSe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(X9(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},oSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:X9(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},X9=t=>Y9**Math.ceil(Math.log(t)/Math.log(Y9)),Y9=2,sSe=({contents:t,length:e})=>Q9()?t:t.slice(0,e),Q9=()=>"resize"in ArrayBuffer.prototype,aSe={init:Qve,convertChunk:{string:eSe,buffer:K9,arrayBuffer:K9,dataView:J9,typedArray:J9,others:lb},getSize:ub,truncateChunk:rSe,addChunk:nSe,getFinalChunk:Lf,finalize:sSe}});async function hb(t,e){return _l(t,fSe,e)}var cSe,mb,lSe,uSe,dSe,fSe,tV=y(()=>{Ff();db();cSe=()=>({contents:"",textDecoder:new TextDecoder}),mb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),lSe=(t,{contents:e})=>e+t,uSe=(t,e)=>t.slice(0,e),dSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},fSe={init:cSe,convertChunk:{string:go,buffer:mb,arrayBuffer:mb,dataView:mb,typedArray:mb,others:lb},getSize:ub,truncateChunk:uSe,addChunk:lSe,getFinalChunk:dSe,finalize:cb}});var rV=y(()=>{W9();eV();tV();Ff()});import{on as pSe}from"node:events";import{finished as mSe}from"node:stream/promises";var gb=y(()=>{AR();rV();Object.assign(Mf,{on:pSe,finished:mSe})});var nV,hSe,iV,oV,gSe,sV,aV,yb,Aa=y(()=>{gb();po();ho();nV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Oi))throw t;if(o==="all")return t;let s=hSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},hSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",iV=(t,e,r)=>{if(e.length!==r)return;let n=new Oi;throw n.maxBufferInfo={fdNumber:"ipc"},n},oV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=gSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},gSe=(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=mo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:x_(r),threshold:i,unit:n}},sV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>yb(r)),aV=(t,e,r)=>{if(!e)return t;let n=yb(r);return t.length>n?t.slice(0,n):t},yb=([,t])=>t});import{inspect as ySe}from"node:util";var lV,_Se,bSe,vSe,SSe,wSe,cV,uV=y(()=>{SR();tn();_R();E_();Aa();Pf();wa();lV=({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=_Se({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=vSe(n,b),w=x===void 0?"":` +${x}`,R=`${S}: ${a}${w}`,A=e===void 0?[t[2],t[1]]:[e],E=[R,...A,...t.slice(3),r.map(D=>SSe(D)).join(` +`)].map(D=>Tf(yl(wSe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:R,message:E}},_Se=({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=bSe(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?`${oV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${L_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},bSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",vSe=(t,e)=>{if(t instanceof Kn)return;let r=EZ(t)?t.originalMessage:String(t?.message??t),n=Tf(D9(r,e));return n===""?void 0:n},SSe=t=>typeof t=="string"?t:ySe(t),wSe=t=>Array.isArray(t)?t.map(e=>yl(cV(e))).filter(Boolean).join(` +`):cV(t),cV=t=>typeof t=="string"?t:Ft(t)?S_(t):""});var _b,bl,zf,xSe,dV,$Se,Uf=y(()=>{Pf();P_();wa();uV();_b=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>dV({command:t,escapedCommand:e,cwd:o,durationMs:HO(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:[]}),bl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>zf({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}),zf=({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}=$Se(l,u),{originalMessage:E,shortMessage:D,message:k}=lV({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:_}),B=$Z(t,k,x);return Object.assign(B,xSe({error:B,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:E,shortMessage:D})),B},xSe=({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})=>dV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:HO(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:[]}),dV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),$Se=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:L_(e);return{exitCode:r,signal:n,signalDescription:i}}});function kSe(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(fV(t*1e3)%1e3),nanoseconds:Math.trunc(fV(t*1e6)%1e3)}}function ESe(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 TR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return kSe(t);break}case"bigint":return ESe(t)}throw new TypeError("Expected a finite number or bigint")}var fV,pV=y(()=>{fV=t=>Number.isFinite(t)?t:0});function OR(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+OSe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ASe(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?" "+TSe(d,u):f;i.push(p)}},a=TR(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%RSe):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 ASe,TSe,OSe,RSe,mV=y(()=>{pV();ASe=t=>t===0||t===0n,TSe=(t,e)=>e===1||e===1n?t:`${t}s`,OSe=1e-7,RSe=24n*60n*60n*1000n});var hV,gV=y(()=>{ll();hV=(t,e)=>{t.failed&&Ei({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var yV,ISe,_V=y(()=>{mV();is();ll();gV();yV=(t,e)=>{al(e)&&(hV(t,e),ISe(t,e))},ISe=(t,e)=>{let r=`(done in ${OR(t.durationMs)})`;Ei({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var vl,bb=y(()=>{_V();vl=(t,e,{reject:r})=>{if(yV(t,e),t.failed&&r)throw t;return t}});var SV,PSe,CSe,wV,xV,bV,DSe,RR,vV,Ta,$V,NSe,vb,kV,jSe,MSe,IR,EV,FSe,AV,Sb,LSe,PR,zSe,USe,TV,En,wb,CR,OV,RV,cs,br=y(()=>{Ea();uo();tn();SV=(t,e)=>Ta(t)?"asyncGenerator":$V(t)?"generator":vb(t)?"fileUrl":jSe(t)?"filePath":LSe(t)?"webStream":Yn(t,{checkOpen:!1})?"native":Ft(t)?"uint8Array":zSe(t)?"asyncIterable":USe(t)?"iterable":PR(t)?wV({transform:t},e):NSe(t)?PSe(t,e):"native",PSe=(t,e)=>xR(t.transform,{checkOpen:!1})?CSe(t,e):PR(t.transform)?wV(t,e):DSe(t,e),CSe=(t,e)=>(xV(t,e,"Duplex stream"),"duplex"),wV=(t,e)=>(xV(t,e,"web TransformStream"),"webTransform"),xV=({final:t,binary:e,objectMode:r},n,i)=>{bV(t,`${n}.final`,i),bV(e,`${n}.binary`,i),RR(r,`${n}.objectMode`)},bV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},DSe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!vV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(xR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(PR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!vV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return RR(r,`${i}.binary`),RR(n,`${i}.objectMode`),Ta(t)||Ta(e)?"asyncGenerator":"generator"},RR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},vV=t=>Ta(t)||$V(t),Ta=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",$V=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",NSe=t=>At(t)&&(t.transform!==void 0||t.final!==void 0),vb=t=>Object.prototype.toString.call(t)==="[object URL]",kV=t=>vb(t)&&t.protocol!=="file:",jSe=t=>At(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>MSe.has(e))&&IR(t.file),MSe=new Set(["file","append"]),IR=t=>typeof t=="string",EV=(t,e)=>t==="native"&&typeof e=="string"&&!FSe.has(e),FSe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),AV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Sb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",LSe=t=>AV(t)||Sb(t),PR=t=>AV(t?.readable)&&Sb(t?.writable),zSe=t=>TV(t)&&typeof t[Symbol.asyncIterator]=="function",USe=t=>TV(t)&&typeof t[Symbol.iterator]=="function",TV=t=>typeof t=="object"&&t!==null,En=new Set(["generator","asyncGenerator","duplex","webTransform"]),wb=new Set(["fileUrl","filePath","fileNumber"]),CR=new Set(["fileUrl","filePath"]),OV=new Set([...CR,"webStream","nodeStream"]),RV=new Set(["webTransform","duplex"]),cs={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 DR,qSe,BSe,IV,NR=y(()=>{br();DR=(t,e,r,n)=>n==="output"?qSe(t,e,r):BSe(t,e,r),qSe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},BSe=(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}},IV=(t,e)=>{let r=t.findLast(({type:n})=>En.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var PV,HSe,GSe,ZSe,VSe,WSe,KSe,CV=y(()=>{uo();$a();br();NR();PV=(t,e,r,n)=>[...t.filter(({type:i})=>!En.has(i)),...HSe(t,e,r,n)],HSe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>En.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=GSe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return KSe(o,r)},GSe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?ZSe({stdioItem:t,optionName:i}):e==="webTransform"?VSe({stdioItem:t,index:r,newTransforms:n,direction:o}):WSe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),ZSe=({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}}},VSe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=At(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=DR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},WSe=({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}=At(e)?e:{transform:e},d=c||rn.has(o),{writableObjectMode:f,readableObjectMode:p}=DR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},KSe=(t,e)=>e==="input"?t.reverse():t});import jR from"node:process";var DV,JSe,YSe,Sl,MR,NV,XSe,QSe,jV=y(()=>{Ea();br();DV=(t,e,r)=>{let n=t.map(i=>JSe(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)??QSe},JSe=({type:t,value:e},r)=>YSe[r]??NV[t](e),YSe=["input","output","output"],Sl=()=>{},MR=()=>"input",NV={generator:Sl,asyncGenerator:Sl,fileUrl:Sl,filePath:Sl,iterable:MR,asyncIterable:MR,uint8Array:MR,webStream:t=>Sb(t)?"output":"input",nodeStream(t){return ka(t,{checkOpen:!1})?wR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Sl,duplex:Sl,native(t){let e=XSe(t);if(e!==void 0)return e;if(Yn(t,{checkOpen:!1}))return NV.nodeStream(t)}},XSe=t=>{if([0,jR.stdin].includes(t))return"input";if([1,2,jR.stdout,jR.stderr].includes(t))return"output"},QSe="output"});var MV,FV=y(()=>{MV=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var LV,ewe,twe,zV,rwe,nwe,UV=y(()=>{po();FV();is();LV=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=ewe(t,n).map((a,c)=>zV(a,c));return o?rwe(s,r,i):MV(s,e)},ewe=(t,e)=>{if(t===void 0)return kn.map(n=>e[n]);if(twe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${kn.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,kn.length);return Array.from({length:r},(n,i)=>t[i])},twe=t=>kn.some(e=>t[e]!==void 0),zV=(t,e)=>Array.isArray(t)?t.map(r=>zV(r,e)):t??(e>=kn.length?"ignore":"pipe"),rwe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!cl(r,i)&&nwe(n)?"ignore":n),nwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as iwe}from"node:fs";import owe from"node:tty";var BV,swe,awe,cwe,lwe,qV,HV=y(()=>{Ea();po();tn();ss();BV=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?swe({stdioItem:t,fdNumber:n,direction:i}):lwe({stdioItem:t,fdNumber:n}),swe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=awe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(Yn(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},awe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=cwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(owe.isatty(i))throw new TypeError(`The \`${e}: ${B_(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:fo(iwe(i)),optionName:e}}},cwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=w_.indexOf(t);if(r!==-1)return r},lwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:qV(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:qV(e,e,r),optionName:r}:Yn(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,qV=(t,e,r)=>{let n=w_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var GV,uwe,dwe,fwe,pwe,ZV=y(()=>{Ea();tn();br();GV=({input:t,inputFile:e},r)=>r===0?[...uwe(t),...fwe(e)]:[],uwe=t=>t===void 0?[]:[{type:dwe(t),value:t,optionName:"input"}],dwe=t=>{if(ka(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ft(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},fwe=t=>t===void 0?[]:[{...pwe(t),optionName:"inputFile"}],pwe=t=>{if(vb(t))return{type:"fileUrl",value:t};if(IR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var VV,WV,mwe,hwe,KV,gwe,ywe,JV,YV=y(()=>{br();VV=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),WV=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=mwe(i,t);if(s.length!==0){if(o){hwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(OV.has(t))return KV({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});RV.has(t)&&ywe({otherStdioItems:s,type:t,value:e,optionName:r})}},mwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),hwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{CR.has(e)&&KV({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},KV=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>gwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return JV(s,n,e),i==="output"?o[0].stream:void 0},gwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,ywe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);JV(i,n,e)},JV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${cs[r]} that is the same.`)}});var xb,_we,bwe,vwe,Swe,wwe,xwe,$we,kwe,Ewe,Awe,Twe,FR,Owe,$b=y(()=>{po();CV();NR();br();jV();UV();HV();ZV();YV();xb=(t,e,r,n)=>{let o=LV(e,r,n).map((a,c)=>_we({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Ewe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Owe(a)),s},_we=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=x_(e),{stdioItems:o,isStdioArray:s}=bwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=DV(o,e,i),c=o.map(d=>BV({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=PV(c,i,a,r),u=IV(l,a);return kwe(l,u),{direction:a,objectMode:u,stdioItems:l}},bwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>vwe(c,n)),...GV(r,e)],s=VV(o),a=s.length>1;return Swe(s,a,n),xwe(s),{stdioItems:s,isStdioArray:a}},vwe=(t,e)=>({type:SV(t,e),value:t,optionName:e}),Swe=(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(wwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},wwe=new Set(["ignore","ipc"]),xwe=t=>{for(let e of t)$we(e)},$we=({type:t,value:e,optionName:r})=>{if(kV(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(EV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},kwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>wb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Ewe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(Awe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw FR(i),o}},Awe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Twe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Twe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=WV({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},FR=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Wn(r)&&r.destroy()},Owe=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 XV}from"node:fs";var eW,Ri,Rwe,tW,QV,Iwe,rW=y(()=>{tn();$b();br();eW=(t,e)=>xb(Iwe,t,e,!0),Ri=({type:t,optionName:e})=>{tW(e,cs[t])},Rwe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&tW(t,`"${e}"`),{}),tW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},QV={generator(){},asyncGenerator:Ri,webStream:Ri,nodeStream:Ri,webTransform:Ri,duplex:Ri,asyncIterable:Ri,native:Rwe},Iwe={input:{...QV,fileUrl:({value:t})=>({contents:[fo(XV(t))]}),filePath:({value:{file:t}})=>({contents:[fo(XV(t))]}),fileNumber:Ri,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...QV,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Ri,string:Ri,uint8Array:Ri}}});var yo,LR,qf=y(()=>{SR();yo=(t,{stripFinalNewline:e},r)=>LR(e,r)&&t!==void 0&&!Array.isArray(t)?yl(t):t,LR=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var kb,UR,nW,iW,Pwe,Cwe,Dwe,oW,Nwe,zR,jwe,Mwe,Fwe,Eb=y(()=>{kb=(t,e,r,n)=>t||r?void 0:iW(e,n),UR=(t,e,r)=>r?t.flatMap(n=>nW(n,e)):nW(t,e),nW=(t,e)=>{let{transform:r,final:n}=iW(e,{});return[...r(t),...n()]},iW=(t,e)=>(e.previousChunks="",{transform:Pwe.bind(void 0,e,t),final:Dwe.bind(void 0,e)}),Pwe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=zR(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=zR(n,r.slice(i+1))),t.previousChunks=n},Cwe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Dwe=function*({previousChunks:t}){t.length>0&&(yield t)},oW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:Nwe.bind(void 0,n)},Nwe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?jwe:Fwe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},zR=(t,e)=>`${t}${e}`,jwe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:NR},Awe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Twe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Awe}});import{Buffer as Owe}from"node:buffer";var eW,Rwe,tW,Iwe,Pwe,rW,nW=y(()=>{en();eW=(t,e)=>t?void 0:Rwe.bind(void 0,e),Rwe=function*(t,e){if(typeof e!="string"&&!Ft(e)&&!Owe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},tW=(t,e)=>t?Iwe.bind(void 0,e):Pwe.bind(void 0,e),Iwe=function*(t,e){rW(t,e),yield e},Pwe=function*(t,e){if(rW(t,e),typeof e!="string"&&!Ft(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},rW=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:zR},Mwe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Fwe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Mwe}});import{Buffer as Lwe}from"node:buffer";var sW,zwe,aW,Uwe,qwe,cW,lW=y(()=>{tn();sW=(t,e)=>t?void 0:zwe.bind(void 0,e),zwe=function*(t,e){if(typeof e!="string"&&!Ft(e)&&!Lwe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},aW=(t,e)=>t?Uwe.bind(void 0,e):qwe.bind(void 0,e),Uwe=function*(t,e){cW(t,e),yield e},qwe=function*(t,e){if(cW(t,e),typeof e!="string"&&!Ft(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},cW=(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 Cwe}from"node:buffer";import{StringDecoder as Dwe}from"node:string_decoder";var $b,Nwe,jwe,Mwe,MR=y(()=>{en();$b=(t,e,r)=>{if(r)return;if(t)return{transform:Nwe.bind(void 0,new TextEncoder)};let n=new Dwe(e);return{transform:jwe.bind(void 0,n),final:Mwe.bind(void 0,n)}},Nwe=function*(t,e){Cwe.isBuffer(e)?yield co(e):typeof e=="string"?yield t.encode(e):yield e},jwe=function*(t,e){yield Ft(e)?t.write(e):e},Mwe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as iW}from"node:util";var FR,kb,oW,Fwe,sW,Lwe,aW=y(()=>{FR=iW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),kb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Lwe}=e[r];for await(let i of n(t))yield*kb(i,e,r+1)},oW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Fwe(r,Number(e),t)},Fwe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*kb(n,r,e+1)},sW=iW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Lwe=function*(t){yield t}});var LR,cW,Ta,qf,zwe,Uwe,zR=y(()=>{LR=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},cW=(t,e)=>[...e.flatMap(r=>[...Ta(r,t,0)]),...qf(t)],Ta=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Uwe}=e[r];for(let i of n(t))yield*Ta(i,e,r+1)},qf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*zwe(r,Number(e),t)},zwe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ta(n,r,e+1)},Uwe=function*(t){yield t}});import{Transform as qwe,getDefaultHighWaterMark as lW}from"node:stream";var UR,Eb,uW,Ab=y(()=>{_r();xb();nW();MR();aW();zR();UR=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=uW(t,s,o),l=Aa(e),u=Aa(r),d=l?FR.bind(void 0,kb,a):LR.bind(void 0,Ta),f=l||u?FR.bind(void 0,oW,a):LR.bind(void 0,qf),p=l||u?sW.bind(void 0,a):void 0;return{stream:new qwe({writableObjectMode:n,writableHighWaterMark:lW(n),readableObjectMode:i,readableHighWaterMark:lW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Eb=(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=uW(s,r,a);t=cW(c,t)}return t},uW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:eW(n,a)},$b(r,s,n),wb(r,o,n,c),{transform:t,final:e},{transform:tW(i,a)},QV({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var dW,Bwe,Hwe,Gwe,Zwe,fW=y(()=>{Ab();en();_r();dW=(t,e)=>{for(let r of Bwe(t))Hwe(t,r,e)},Bwe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Hwe=(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 ${as[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Gwe(a,n));r.input=Ef(s)},Gwe=(t,e)=>{let r=Eb(t,e,"utf8",!0);return Zwe(r),Ef(r)},Zwe=t=>{let e=t.find(r=>typeof r!="string"&&!Ft(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 Tb,Vwe,Wwe,pW,mW,Kwe,hW,qR=y(()=>{xa();_r();cl();ns();Tb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&al(r,n)&&!tn.has(e)&&Vwe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Wwe.has(o))||t.every(({type:i})=>$n.has(i))),Vwe=t=>t===1||t===2,Wwe=new Set(["pipe","overlapped"]),pW=async(t,e,r,n)=>{for await(let i of t)Kwe(e)||hW(i,r,n)},mW=(t,e,r)=>{for(let n of t)hW(n,e,r)},Kwe=t=>t._readableState.pipes.length>0,hW=(t,e,r)=>{let n=A_(t);$i({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Jwe,appendFileSync as Ywe}from"node:fs";var gW,Xwe,Qwe,exe,txe,rxe,yW=y(()=>{qR();Ab();xb();en();_r();Ea();gW=({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)=>Xwe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Xwe=({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=tV(t,o,d),p=co(f),{stdioItems:m,objectMode:h}=e[r],g=Qwe([p],m,c,n),{serializedResult:b,finalResult:_=b}=exe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});txe({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&&rxe(b,m,i),S}catch(x){return n.error=x,S}},Qwe=(t,e,r,n)=>{try{return Eb(t,e,r,!1)}catch(i){return n.error=i,t}},exe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Ef(t)};let s=GH(t,r);return n[o]?{serializedResult:s,finalResult:jR(s,!i[o],e)}:{serializedResult:s}},txe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Tb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=jR(t,!1,s);try{mW(a,e,n)}catch(c){r.error??=c}},rxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>bb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Ywe(n,t):(r.add(o),Jwe(n,t))}}});var _W,bW=y(()=>{en();Uf();_W=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,mo(e,r,"all")]:Array.isArray(e)?[mo(t,r,"all"),...e]:Ft(t)&&Ft(e)?IO([t,e]):`${t}${e}`}});import{once as BR}from"node:events";var vW,nxe,SW,wW,ixe,HR,GR=y(()=>{Sa();vW=async(t,e)=>{let[r,n]=await nxe(t);return e.isForcefullyTerminated??=!1,[r,n]},nxe=async t=>{let[e,r]=await Promise.allSettled([BR(t,"spawn"),BR(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?SW(t):r.value},SW=async t=>{try{return await BR(t,"exit")}catch{return SW(t)}},wW=async t=>{let[e,r]=await t;if(!ixe(e,r)&&HR(e,r))throw new Wn;return[e,r]},ixe=(t,e)=>t===void 0&&e===void 0,HR=(t,e)=>t!==0||e!==null});var xW,oxe,$W=y(()=>{Sa();Ea();GR();xW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=oxe(t,e,r),s=o?.code==="ETIMEDOUT",a=eV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},oxe=(t,e,r)=>t!==void 0?t:HR(e,r)?new Wn:void 0});import{spawnSync as sxe}from"node:child_process";var kW,axe,cxe,lxe,Ob,uxe,dxe,fxe,pxe,EW=y(()=>{zO();mR();hR();zf();gb();JV();Uf();fW();yW();Ea();bW();$W();kW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=axe(t,e,r),d=uxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return bl(d,c,l)},axe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=R_(t,e,r),a=cxe(r),{file:c,commandArguments:l,options:u}=nb(t,e,a);lxe(u);let d=WV(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},cxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,lxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Ob("ipcInput"),t&&Ob("ipc: true"),r&&Ob("detached: true"),n&&Ob("cancelSignal")},Ob=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},uxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=dxe({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}=xW(c,r),{output:m,error:h=l}=gW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>mo(_,r,S)),b=mo(_W(m,r),r,"all");return pxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},dxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{dW(o,r);let a=fxe(r);return sxe(...ib(t,e,a))}catch(a){return _l({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},fxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:mb(e)}),pxe=({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?hb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Lf({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 ZR,on as mxe}from"node:events";var AW,hxe,gxe,yxe,_xe,TW=y(()=>{pl();Df();Cf();AW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(dl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:J_(t)}),hxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),hxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{B_(e,i);let o=ss(t,e,r),s=new AbortController;try{return await Promise.race([gxe(o,n,s),yxe(o,r,s),_xe(o,r,s)])}catch(a){throw fl(t),a}finally{s.abort(),H_(e,i)}},gxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await ZR(t,"message",{signal:r});return n}for await(let[n]of mxe(t,"message",{signal:r}))if(e(n))return n},yxe=async(t,e,{signal:r})=>{await ZR(t,"disconnect",{signal:r}),LZ(e)},_xe=async(t,e,{signal:r})=>{let[n]=await ZR(t,"strict:error",{signal:r});throw L_(n,e)}});import{once as RW,on as bxe}from"node:events";var IW,VR,vxe,Sxe,wxe,OW,WR=y(()=>{pl();Df();Cf();IW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>VR({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),VR=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{dl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:J_(t)}),B_(e,o);let s=ss(t,e,r),a=new AbortController,c={};return vxe(t,s,a),Sxe({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),wxe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},vxe=async(t,e,r)=>{try{await RW(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Sxe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await RW(t,"strict:error",{signal:r.signal});n.error=L_(i,e),r.abort()}catch{}},wxe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of bxe(r,"message",{signal:o.signal}))OW(s),yield c}catch{OW(s)}finally{o.abort(),H_(e,a),n||fl(t),i&&await t}},OW=({error:t})=>{if(t)throw t}});import PW from"node:process";var CW,DW,NW,KR=y(()=>{tb();TW();WR();W_();CW=(t,{ipc:e})=>{Object.assign(t,NW(t,!1,e))},DW=()=>{let t=PW,e=!0,r=PW.channel!==void 0;return{...NW(t,e,r),getCancelSignal:p9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},NW=(t,e,r)=>({sendMessage:eb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:AW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:IW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as xxe}from"node:child_process";import{PassThrough as $xe,Readable as kxe,Writable as Exe,Duplex as Axe}from"node:stream";var jW,Txe,Bf,Oxe,Rxe,Ixe,Pxe,MW=y(()=>{Sb();zf();gb();jW=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{CR(n);let a=new xxe;Txe(a,n),Object.assign(a,{readable:Oxe,writable:Rxe,duplex:Ixe});let c=_l({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=Pxe(c,s,i);return{subprocess:a,promise:l}},Txe=(t,e)=>{let r=Bf(),n=Bf(),i=Bf(),o=Array.from({length:e.length-3},Bf),s=Bf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Bf=()=>{let t=new $xe;return t.end(),t},Oxe=()=>new kxe({read(){}}),Rxe=()=>new Exe({write(){}}),Ixe=()=>new Axe({read(){},write(){}}),Pxe=async(t,e,r)=>bl(t,e,r)});import{createReadStream as FW,createWriteStream as LW}from"node:fs";import{Buffer as Cxe}from"node:buffer";import{Readable as Hf,Writable as Dxe,Duplex as Nxe}from"node:stream";var UW,Gf,zW,jxe,qW=y(()=>{Ab();Sb();_r();UW=(t,e)=>vb(jxe,t,e,!1),Gf=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${as[t]}.`)},zW={fileNumber:Gf,generator:UR,asyncGenerator:UR,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Nxe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},jxe={input:{...zW,fileUrl:({value:t})=>({stream:FW(t)}),filePath:({value:{file:t}})=>({stream:FW(t)}),webStream:({value:t})=>({stream:Hf.fromWeb(t)}),iterable:({value:t})=>({stream:Hf.from(t)}),asyncIterable:({value:t})=>({stream:Hf.from(t)}),string:({value:t})=>({stream:Hf.from(t)}),uint8Array:({value:t})=>({stream:Hf.from(Cxe.from(t))})},output:{...zW,fileUrl:({value:t})=>({stream:LW(t)}),filePath:({value:{file:t,append:e}})=>({stream:LW(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Dxe.fromWeb(t)}),iterable:Gf,asyncIterable:Gf,string:Gf,uint8Array:Gf}}});import{on as Mxe,once as BW}from"node:events";import{PassThrough as Fxe,getDefaultHighWaterMark as Lxe}from"node:stream";import{finished as ZW}from"node:stream/promises";function Oa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)YR(i);let e=t.some(({readableObjectMode:i})=>i),r=zxe(t,e),n=new JR({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var zxe,JR,Uxe,qxe,Bxe,YR,Hxe,Gxe,Zxe,Vxe,Wxe,VW,WW,XR,KW,Kxe,Rb,HW,GW,Ib=y(()=>{zxe=(t,e)=>{if(t.length===0)return Lxe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},JR=class extends Fxe{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(YR(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Uxe(this,this.#t,this.#o);let r=Hxe({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(YR(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)}},Uxe=async(t,e,r)=>{Rb(t,HW);let n=new AbortController;try{await Promise.race([qxe(t,n),Bxe(t,e,r,n)])}finally{n.abort(),Rb(t,-HW)}},qxe=async(t,{signal:e})=>{try{await ZW(t,{signal:e,cleanup:!0})}catch(r){throw VW(t,r),r}},Bxe=async(t,e,r,{signal:n})=>{for await(let[i]of Mxe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},YR=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Hxe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Rb(t,GW);let a=new AbortController;try{await Promise.race([Gxe(o,e,a),Zxe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Vxe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Rb(t,-GW)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?XR(t):Wxe(t))},Gxe=async(t,e,{signal:r})=>{try{await t,r.aborted||XR(e)}catch(n){r.aborted||VW(e,n)}},Zxe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await ZW(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;WW(s)?i.add(e):KW(t,s)}},Vxe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await BW(t,i,{signal:o}),!t.readable)return BW(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},Wxe=t=>{t.writable&&t.end()},VW=(t,e)=>{WW(e)?XR(t):KW(t,e)},WW=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",XR=t=>{(t.readable||t.writable)&&t.destroy()},KW=(t,e)=>{t.destroyed||(t.once("error",Kxe),t.destroy(e))},Kxe=()=>{},Rb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},HW=2,GW=1});import{finished as JW}from"node:stream/promises";var Sl,Jxe,QR,Yxe,eI,Pb=y(()=>{lo();Sl=(t,e)=>{t.pipe(e),Jxe(t,e),Yxe(t,e)},Jxe=async(t,e)=>{if(!(Vn(t)||Vn(e))){try{await JW(t,{cleanup:!0,readable:!0,writable:!1})}catch{}QR(e)}},QR=t=>{t.writable&&t.end()},Yxe=async(t,e)=>{if(!(Vn(t)||Vn(e))){try{await JW(e,{cleanup:!0,readable:!1,writable:!0})}catch{}eI(t)}},eI=t=>{t.readable&&t.destroy()}});var YW,Xxe,Qxe,e0e,t0e,r0e,XW=y(()=>{Ib();lo();q_();_r();Pb();YW=(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})=>$n.has(c)))Xxe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!$n.has(c)))e0e({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]:Oa(o);Sl(s,i)}},Xxe=(t,e,r,n)=>{r==="output"?Sl(t.stdio[n],e):Sl(e,t.stdio[n]);let i=Qxe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Qxe=["stdin","stdout","stderr"],e0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;t0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},t0e=(t,{signal:e})=>{Vn(t)&&wa(t,r0e,e)},r0e=2});var Ra,QW=y(()=>{Ra=[];Ra.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ra.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ra.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Cb,tI,rI,n0e,nI,Db,i0e,iI,oI,sI,eK,iot,oot,tK=y(()=>{QW();Cb=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",tI=Symbol.for("signal-exit emitter"),rI=globalThis,n0e=Object.defineProperty.bind(Object),nI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(rI[tI])return rI[tI];n0e(rI,tI,{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}},Db=class{},i0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),iI=class extends Db{onExit(){return()=>{}}load(){}unload(){}},oI=class extends Db{#t=sI.platform==="win32"?"SIGINT":"SIGHUP";#r=new nI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ra)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(!Cb(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 Ra)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,Ra.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 Cb(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"&&Cb(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)}},sI=globalThis.process,{onExit:eK,load:iot,unload:oot}=i0e(Cb(sI)?new oI(sI):new iI)});import{addAbortListener as o0e}from"node:events";var rK,nK=y(()=>{tK();rK=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=eK(()=>{t.kill()});o0e(n,()=>{i()})}});var oK,s0e,a0e,iK,c0e,sK=y(()=>{RO();O_();os();ol();oK=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=T_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=s0e(r,n,i),{sourceStream:d,sourceError:f}=c0e(t,l),{options:p,fileDescriptors:m}=Ei.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},s0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=a0e(t,e,...r),a=U_(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},a0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(iK,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||TO(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]=y_(r,...n);return{destination:e(iK)(i,o,s),pipeOptions:s}}if(Ei.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}`)},iK=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),c0e=(t,e)=>{try{return{sourceStream:hl(t,e)}}catch(r){return{sourceError:r}}}});var cK,l0e,aI,aK,cI=y(()=>{zf();Pb();cK=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=l0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw aI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},l0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return eI(t),n;if(e!==void 0)return QR(r),e},aI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>_l({error:t,command:aK,escapedCommand:aK,fileDescriptors:e,options:r,startTime:n,isSync:!1}),aK="source.pipe(destination)"});var lK,uK=y(()=>{lK=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 u0e}from"node:stream/promises";var dK,d0e,f0e,p0e,Nb,m0e,h0e,fK=y(()=>{Ib();q_();Pb();dK=(t,e,r)=>{let n=Nb.has(e)?f0e(t,e):d0e(t,e);return wa(t,m0e,r.signal),wa(e,h0e,r.signal),p0e(e),n},d0e=(t,e)=>{let r=Oa([t]);return Sl(r,e),Nb.set(e,r),r},f0e=(t,e)=>{let r=Nb.get(e);return r.add(t),r},p0e=async t=>{try{await u0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Nb.delete(t)},Nb=new WeakMap,m0e=2,h0e=1});import{aborted as g0e}from"node:util";var pK,y0e,mK=y(()=>{cI();pK=(t,e)=>t===void 0?[]:[y0e(t,e)],y0e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await g0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw aI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var jb,_0e,b0e,hK=y(()=>{ao();sK();cI();uK();fK();mK();jb=(t,...e)=>{if(At(e[0]))return jb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=oK(t,...e),i=_0e({...n,destination:r});return i.pipe=jb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},_0e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=b0e(t,i);cK({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=dK(e,o,d);return await Promise.race([lK(u),...pK(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},b0e=(t,e)=>Promise.allSettled([t,e])});import{on as v0e}from"node:events";import{getDefaultHighWaterMark as S0e}from"node:stream";var Mb,w0e,lI,x0e,yK,uI,gK,$0e,k0e,Fb=y(()=>{MR();xb();zR();Mb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return w0e(e,s),yK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},w0e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},lI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;x0e(e,s,t);let a=t.readableObjectMode&&!o;return yK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},x0e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},yK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=v0e(t,"data",{signal:e.signal,highWaterMark:gK,highWatermark:gK});return $0e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},uI=S0e(!0),gK=uI,$0e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=k0e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ta(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*qf(a)}},k0e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[$b(t,r,!e),wb(t,i,!n,{})].filter(Boolean)});import{setImmediate as E0e}from"node:timers/promises";var _K,A0e,T0e,O0e,dI,bK,fI=y(()=>{pb();en();qR();Fb();Ea();Uf();_K=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=A0e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([T0e(t),d]);return}let f=DR(c,r),p=lI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([O0e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},A0e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Tb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=lI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await pW(a,t,r,o)},T0e=async t=>{await E0e(),t.readableFlowing===null&&t.resume()},O0e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await lb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await ub(r,{maxBuffer:o})):await fb(r,{maxBuffer:o})}catch(a){return bK(Y9({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},dI=async t=>{try{return await t}catch(e){return bK(e)}},bK=({bufferedData:t})=>BH(t)?new Uint8Array(t):t});import{finished as R0e}from"node:stream/promises";var Zf,I0e,P0e,C0e,D0e,N0e,pI,Lb,vK,zb=y(()=>{Zf=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=I0e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],R0e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||D0e(a,e,r,n)}finally{s.abort()}},I0e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&P0e(t,r,n),n},P0e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{C0e(e,r),n.call(t,...i)}},C0e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},D0e=(t,e,r,n)=>{if(!N0e(t,e,r,n))throw t},N0e=(t,e,r,n=!0)=>r.propagating?vK(t)||Lb(t):(r.propagating=!0,pI(r,e)===n?vK(t):Lb(t)),pI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Lb=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",vK=t=>t?.code==="EPIPE"});var SK,mI,hI=y(()=>{fI();zb();SK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>mI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),mI=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=Zf(t,e,l);if(pI(l,e)){await u;return}let[d]=await Promise.all([_K({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 wK,xK,j0e,M0e,gI=y(()=>{Ib();hI();wK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Oa([t,e].filter(Boolean)):void 0,xK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>mI({...j0e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:M0e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),j0e=({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}},M0e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var $K,kK,EK=y(()=>{cl();ns();$K=t=>al(t,"ipc"),kK=(t,e)=>{let r=A_(t);$i({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var AK,TK,OK=y(()=>{Ea();EK();fo();WR();AK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=$K(o),a=uo(e,"ipc"),c=uo(r,"ipc");for await(let l of VR({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(X9(t,i,c),i.push(l)),s&&kK(l,o);return i},TK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as F0e}from"node:events";var RK,L0e,z0e,U0e,IK=y(()=>{ka();lR();eR();cR();lo();_r();fI();OK();dR();gI();hI();GR();zb();RK=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 _=vW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=SK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=xK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],A=AK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),E=L0e(h,t,S),C=z0e(m,S);try{return await Promise.race([Promise.all([{},wW(_),Promise.all(x),w,A,x9(t,d),...E,...C]),g,U0e(t,b),..._9(t,o,f,b),...FZ({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...g9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all(x.map(q=>dI(q))),dI(w),TK(A,O),Promise.allSettled(E),Promise.allSettled(C)])}},L0e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Zf(n,i,r)),z0e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Jn(o,{checkOpen:!1})&&!Vn(o)).map(({type:i,value:o,stream:s=o})=>Zf(s,n,e,{isSameDirection:$n.has(i),stopOnExit:i==="native"}))),U0e=async(t,{signal:e})=>{let[r]=await F0e(t,"error",{signal:e});throw r}});var PK,Vf,wl,Ub=y(()=>{ml();PK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Vf=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=ki();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},wl=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 CK}from"node:stream/promises";var yI,DK,_I,bI,qb,Bb,vI=y(()=>{zb();yI=async t=>{if(t!==void 0)try{await _I(t)}catch{}},DK=async t=>{if(t!==void 0)try{await bI(t)}catch{}},_I=async t=>{await CK(t,{cleanup:!0,readable:!1,writable:!0})},bI=async t=>{await CK(t,{cleanup:!0,readable:!0,writable:!1})},qb=async(t,e)=>{if(await t,e)throw e},Bb=(t,e,r)=>{r&&!Lb(r)?t.destroy(r):e&&t.destroy()}});import{Readable as q0e}from"node:stream";import{callbackify as B0e}from"node:util";var NK,SI,wI,xI,H0e,$I,kI,jK,EI=y(()=>{xa();os();Fb();ml();Ub();vI();NK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||tn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=SI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=wI(a,s),{read:f,onStdoutDataDone:p}=xI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new q0e({read:f,destroy:B0e(kI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return $I({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},SI=(t,e,r)=>{let n=hl(t,e),i=Vf(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},wI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:uI},xI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=ki(),s=Mb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){H0e(this,s,o)},onStdoutDataDone:o}},H0e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},$I=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await bI(t),await n,await yI(i),await e,r.readable&&r.push(null)}catch(o){await yI(i),jK(r,o)}},kI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await wl(r,e)&&(jK(t,n),await qb(e,n))},jK=(t,e)=>{Bb(t,t.readable,e)}});import{Writable as G0e}from"node:stream";import{callbackify as MK}from"node:util";var FK,AI,TI,Z0e,V0e,OI,RI,LK,II=y(()=>{os();Ub();vI();FK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=AI(t,r,e),s=new G0e({...TI(n,t,i),destroy:MK(RI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return OI(n,s),s},AI=(t,e,r)=>{let n=U_(t,e),i=Vf(r,n,"writableFinal"),o=Vf(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},TI=(t,e,r)=>({write:Z0e.bind(void 0,t),final:MK(V0e.bind(void 0,t,e,r))}),Z0e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},V0e=async(t,e,r)=>{await wl(r,e)&&(t.writable&&t.end(),await e)},OI=async(t,e,r)=>{try{await _I(t),e.writable&&e.end()}catch(n){await DK(r),LK(e,n)}},RI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await wl(r,e),await wl(n,e)&&(LK(t,i),await qb(e,i))},LK=(t,e)=>{Bb(t,t.writable,e)}});import{Duplex as W0e}from"node:stream";import{callbackify as K0e}from"node:util";var zK,J0e,UK=y(()=>{xa();EI();II();zK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||tn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=SI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=AI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=wI(c,a),{read:g,onStdoutDataDone:b}=xI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new W0e({read:g,...TI(u,t,d),destroy:K0e(J0e.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 $I({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),OI(u,_,c),_},J0e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([kI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),RI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var PI,Y0e,qK=y(()=>{xa();os();Fb();PI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||tn.has(e),s=hl(t,r),a=Mb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Y0e(a,s,t)},Y0e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var BK,HK=y(()=>{Ub();EI();II();UK();qK();BK=(t,{encoding:e})=>{let r=PK();t.readable=NK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=FK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=zK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=PI.bind(void 0,t,e),t[Symbol.asyncIterator]=PI.bind(void 0,t,e,{})}});var GK,X0e,Q0e,ZK=y(()=>{GK=(t,e)=>{for(let[r,n]of Q0e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},X0e=(async()=>{})().constructor.prototype,Q0e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(X0e,t)])});import{setMaxListeners as e$e}from"node:events";import{spawn as t$e}from"node:child_process";var VK,r$e,n$e,i$e,o$e,s$e,WK=y(()=>{pb();zO();mR();os();hR();KR();zf();gb();MW();qW();Uf();XW();M_();nK();hK();gI();IK();HK();ml();ZK();VK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=r$e(t,e,r),{subprocess:f,promise:p}=i$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=jb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),GK(f,p),Ei.set(f,{options:u,fileDescriptors:d}),f},r$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=R_(t,e,r),{file:a,commandArguments:c,options:l}=nb(t,e,r),u=n$e(l),d=UW(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},n$e=({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}},i$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=t$e(...ib(t,e,r))}catch(m){return jW({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;e$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];YW(c,a,l),rK(c,r,l);let d={},f=ki();c.kill=jZ.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=wK(c,r),BK(c,r),CW(c,r);let p=o$e({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}},o$e=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 RK({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)=>mo(x,e,w)),_=mo(h,e,"all"),S=s$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return bl(S,n,e)},s$e=({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?Lf({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 Ai,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):hb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Hb,a$e,c$e,KK=y(()=>{ao();fo();Hb=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,a$e(n,t[n],i)]));return{...t,...r}},a$e=(t,e,r)=>c$e.has(t)&&At(e)&&At(r)?{...e,...r}:r,c$e=new Set(["env",...NO])});var cs,l$e,u$e,JK=y(()=>{ao();RO();YH();EW();WK();KK();cs=(t,e,r,n)=>{let i=(s,a,c)=>cs(s,a,r,c),o=(...s)=>l$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},l$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(At(o))return i(t,Hb(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=u$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?kW(a,c,l):VK(a,c,l,i)},u$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=KH(e)?JH(e,r):[e,...r],[s,a,c]=y_(...o),l=Hb(Hb(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 YK,XK,QK,d$e,f$e,e3=y(()=>{YK=({file:t,commandArguments:e})=>QK(t,e),XK=({file:t,commandArguments:e})=>({...QK(t,e),isSync:!0}),QK=(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]=d$e(t);return{file:r,commandArguments:n}},d$e=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(f$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},f$e=/ +/g});var t3,r3,p$e,n3,m$e,i3,o3=y(()=>{t3=(t,e,r)=>{t.sync=e(p$e,r),t.s=t.sync},r3=({options:t})=>n3(t),p$e=({options:t})=>({...n3(t),isSync:!0}),n3=t=>({options:{...m$e(t),...t}}),m$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},i3={preferLocal:!0}});var Wat,Je,Kat,Jat,Yat,Xat,Qat,ect,tct,rct,Nr=y(()=>{JK();e3();uR();o3();KR();Wat=cs(()=>({})),Je=cs(()=>({isSync:!0})),Kat=cs(YK),Jat=cs(XK),Yat=cs(v9),Xat=cs(r3,{},i3,t3),{sendMessage:Qat,getOneMessage:ect,getEachMessage:tct,getCancelSignal:rct}=DW()});import{existsSync as Gb,statSync as h$e}from"node:fs";import{dirname as CI,extname as g$e,isAbsolute as s3,join as DI,relative as NI,resolve as Zb,sep as y$e}from"node:path";function Vb(t){return t==="./gradlew"||t==="gradle"}function _$e(t){return(Gb(DI(t,"build.gradle.kts"))||Gb(DI(t,"build.gradle")))&&Gb(DI(t,"gradle.properties"))}function b$e(t,e){let n=NI(t,e).split(y$e).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ls(t,e){return t===":"?`:${e}`:`${t}:${e}`}function v$e(t,e){let r=Zb(t,e),n=r;Gb(r)?h$e(r).isFile()&&(n=CI(r)):g$e(r)!==""&&(n=CI(r));let i=NI(t,n);if(i.startsWith("..")||s3(i))return null;let o=n;for(;;){if(_$e(o))return o;if(Zb(o)===Zb(t))return null;let s=CI(o);if(s===o)return null;let a=NI(t,s);if(a.startsWith("..")||s3(a))return null;o=s}}function Wb(t,e){let r=Zb(t),n=new Map,i=[];for(let o of e){let s=v$e(r,o);if(!s){i.push(o);continue}let a=b$e(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 Kb=y(()=>{"use strict"});import{existsSync as S$e,readFileSync as w$e}from"node:fs";import{join as x$e}from"node:path";function xl(t="."){let e=x$e(t,".cladding","config.yaml");if(!S$e(e))return jI;try{let n=(0,a3.parse)(w$e(e,"utf8"))?.gate;if(!n)return jI;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 $$e){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 jI}}function c3(t,e){let r=[],n=!1;for(let i of t){let o=k$e.exec(i);if(o){n=!0;for(let s of e)r.push(ls(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 a3,$$e,jI,k$e,Jb=y(()=>{"use strict";a3=Et(cr(),1);Kb();$$e=["type","lint","test","coverage"],jI={scope:"feature"};k$e=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as FI,readFileSync as l3,readdirSync as E$e,statSync as A$e}from"node:fs";import{join as Yb}from"node:path";function UI(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=Yb(t,e);if(FI(r))try{if(u3.test(l3(r,"utf8")))return!0}catch{}}return!1}function d3(t){try{return FI(t)&&u3.test(l3(t,"utf8"))}catch{return!1}}function f3(t,e=0){if(e>4||!FI(t))return!1;let r;try{r=E$e(t)}catch{return!1}for(let n of r){let i=Yb(t,n),o=!1;try{o=A$e(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(f3(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&d3(i))return!0}return!1}function R$e(t){if(UI(t))return!0;for(let e of T$e)if(d3(Yb(t,e)))return!0;for(let e of O$e)if(f3(Yb(t,e)))return!0;return!1}function p3(t="."){let e=xl(t).coverage;return e||(R$e(t)?"kover":"jacoco")}function m3(t="."){return LI[p3(t)]}function h3(t="."){return MI[p3(t)]}var LI,MI,zI,u3,T$e,O$e,Xb=y(()=>{"use strict";Jb();LI={kover:"koverXmlReport",jacoco:"jacocoTestReport"},MI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},zI=[MI.kover,MI.jacoco],u3=/kover/i;T$e=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],O$e=["buildSrc","build-logic"]});import{existsSync as Qb,readFileSync as g3,readdirSync as y3}from"node:fs";import{join as Ia}from"node:path";function qI(t){return Qb(Ia(t,"gradlew"))?"./gradlew":"gradle"}function I$e(t){let e=qI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[m3(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function P$e(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(g3(Ia(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 D$e(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function M$e(t,e){for(let r of e)if(Qb(Ia(t,r)))return r}function F$e(t,e){try{return y3(t).find(n=>n.endsWith(e))}catch{return}}function z$e(t,e){for(let r of L$e)if(r.configs.some(n=>Qb(Ia(t,n))))return r.gate;return e}function q$e(t){if(U$e.some(e=>Qb(Ia(t,e))))return!0;try{return JSON.parse(g3(Ia(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function B$e(t,e){let r=e.lint?{...e,lint:z$e(t,e.lint)}:{...e};return e.test&&e.coverage&&q$e(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function ht(t="."){for(let e of N$e){let r;for(let o of e.manifests)if(o.startsWith(".")?r=F$e(t,o):r=M$e(t,[o]),r)break;if(!r||e.requiresSource&&!D$e(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?B$e(t,n):n;return{language:e.language,manifest:r,gates:i}}return j$e}var C$e,N$e,j$e,L$e,U$e,kn=y(()=>{"use strict";Xb();C$e=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);N$e=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:I$e},{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:P$e}],j$e={language:"unknown",manifest:"",gates:{}};L$e=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];U$e=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as H$e,readFileSync as G$e}from"node:fs";import{join as Z$e}from"node:path";function Pa(t){return t.code==="ENOENT"}function ev(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=(o||s||`exit ${i}`).slice(0,200);return _3.test(o)||_3.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Lt(t,e,r){return Pa(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function Yt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function $l(t,e){let r=Z$e(t,"package.json");if(!H$e(r))return!1;try{return!!JSON.parse(G$e(r,"utf8")).scripts?.[e]}catch{return!1}}var _3,En=y(()=>{"use strict";_3=/config (is |file )?not found|no such file|ENOENT|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 V$e(t){let{cwd:e="."}=t,r=ht(e),n=r.gates.arch;if(!n)return[{detector:tv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Pa(i)?[{detector:tv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:ev(i,tv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var tv,Ca,rv=y(()=>{"use strict";Nr();kn();En();tv="ARCHITECTURE_VIOLATION";Ca={name:tv,subprocess:!0,run:V$e}});function W$e(t){let{cwd:e="."}=t,r=ht(e),n=r.gates.secret;if(!n)return[{detector:nv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Pa(i)?[{detector:nv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:ev(i,nv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var nv,Da,iv=y(()=>{"use strict";Nr();kn();En();nv="HARDCODED_SECRET";Da={name:nv,subprocess:!0,run:W$e}});import{existsSync as BI,readdirSync as b3}from"node:fs";import{join as ov}from"node:path";function J$e(t,e){let r=ov(t,e.path);if(!BI(r))return!0;if(e.isDirectory)try{return b3(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Y$e(t){let{cwd:e="."}=t,r=[];for(let i of K$e)J$e(e,i)&&r.push({detector:Wf,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=ov(e,"spec.yaml");if(BI(n)){let i=eke(n),o=i?null:X$e(e);if(i)r.push({detector:Wf,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:Wf,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=Q$e(e);s&&r.push({detector:Wf,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 X$e(t){for(let e of["spec/features","spec/scenarios"]){let r=ov(t,e);if(!BI(r))continue;let n;try{n=b3(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Si(ov(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function Q$e(t){try{return H(t),null}catch(e){return e.message}}function eke(t){let e;try{e=Si(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Wf,K$e,v3,S3=y(()=>{"use strict";qe();a_();Wf="ABSENCE_OF_GOVERNANCE",K$e=[{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}];v3={name:Wf,run:Y$e}});function sv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function HI(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=sv(r)==="while",o=rke.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 '${sv(r)}'`}let n=tke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:sv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${sv(r)}'`:null}function nke(t,e){let r=HI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function w3(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...nke(r,n));return e}var tke,rke,GI=y(()=>{"use strict";tke={event:"when",state:"while",optional:"where",unwanted:"if"},rke=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var bt=y(()=>{"use strict";qe()});function ike(t){let{cwd:e="."}=t;return he(e,av,oke)}function oke(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:av,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 w3(t.features))e.push({detector:av,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var av,x3,$3=y(()=>{"use strict";GI();bt();av="AC_DRIFT";x3={name:av,run:ike}});function Oi(t=".",e){let n=(e??"").trim().toLowerCase()||ht(t).language;return E3[n]??k3}var ske,ake,cke,k3,lke,uke,E3,dke,A3,Na=y(()=>{"use strict";kn();ske=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,ake=/^[ \t]*import\s+([\w.]+)/gm,cke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,k3={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:ske,importStyle:"relative"},lke={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:ake,importStyle:"dotted"},uke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:cke,importStyle:"dotted"},E3={typescript:k3,kotlin:lke,python:uke},dke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],A3=new Set([...Object.values(E3).flatMap(t=>t?.extensions??[]),...dke].map(t=>t.toLowerCase()))});import{existsSync as fke,readFileSync as pke,readdirSync as mke,statSync as hke}from"node:fs";import{join as O3,relative as T3}from"node:path";function gke(t,e){if(!fke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=mke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=O3(i,s),c;try{c=hke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function yke(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function bke(t){return _ke.test(t)}function vke(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Oi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>gke(O3(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=pke(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";qe();Na();R3="AI_HINTS_FORBIDDEN_PATTERN";_ke=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;I3={name:R3,run:vke}});function Ske(t){let{cwd:e="."}=t,r;try{r=H(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:C3,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var C3,D3,N3=y(()=>{"use strict";qe();C3="AC_DUPLICATE_WITHIN_FEATURE";D3={name:C3,run:Ske}});import{createRequire as wke}from"module";import{basename as xke,dirname as VI,normalize as $ke,relative as kke,resolve as Eke,sep as F3}from"path";import*as Ake from"fs";function Tke(t){let e=$ke(t);return e.length>1&&e[e.length-1]===F3&&(e=e.substring(0,e.length-1)),e}function L3(t,e){return t.replace(Oke,e)}function Ike(t){return t==="/"||Rke.test(t)}function ZI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=Eke(t)),(n||o)&&(t=Tke(t)),t===".")return"";let s=t[t.length-1]!==i;return L3(s?t+i:t,i)}function z3(t,e){return e+t}function Pke(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:L3(kke(t,n),e.pathSeparator)+e.pathSeparator+r}}function Cke(t){return t}function Dke(t,e,r){return e+t+r}function Nke(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?Pke(t,e):n?z3:Cke}function jke(t){return function(e,r){r.push(e.substring(t.length)||".")}}function Mke(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function Uke(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?Mke(t):jke(t):n&&n.length?Lke:Fke:zke}function Vke(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?Zke:r&&r.length?n?qke:Bke:n?Hke:Gke}function Jke(t){return t.group?Kke:Wke}function Qke(t){return t.group?Yke:Xke}function rEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?tEe:eEe}function U3(t,e,r){if(r.options.useRealPaths)return nEe(e,r);let n=VI(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=VI(n)}return r.symlinks.set(t,e),i>1}function nEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function cv(t,e,r,n){e(t&&!n?t:null,r)}function fEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?iEe:cEe:n?e?oEe:dEe:i?e?aEe:uEe:e?sEe:lEe}function hEe(t){return t?mEe:pEe}function bEe(t,e){return new Promise((r,n)=>{H3(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function H3(t,e,r){new B3(t,e,r).start()}function vEe(t,e){return new B3(t,e).start()}var j3,Oke,Rke,Fke,Lke,zke,qke,Bke,Hke,Gke,Zke,Wke,Kke,Yke,Xke,eEe,tEe,iEe,oEe,sEe,aEe,cEe,lEe,uEe,dEe,q3,pEe,mEe,gEe,yEe,_Ee,B3,M3,G3,Z3,V3=y(()=>{j3=wke(import.meta.url);Oke=/[\\/]/g;Rke=/^[a-z]:[\\/]$/i;Fke=(t,e)=>{e.push(t||".")},Lke=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},zke=()=>{};qke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},Bke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},Hke=(t,e,r,n)=>{r.files++},Gke=(t,e)=>{e.push(t)},Zke=()=>{};Wke=t=>t,Kke=()=>[""].slice(0,0);Yke=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},Xke=()=>{};eEe=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()&&U3(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},tEe=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()&&U3(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};iEe=t=>t.counts,oEe=t=>t.groups,sEe=t=>t.paths,aEe=t=>t.paths.slice(0,t.options.maxFiles),cEe=(t,e,r)=>(cv(e,r,t.counts,t.options.suppressErrors),null),lEe=(t,e,r)=>(cv(e,r,t.paths,t.options.suppressErrors),null),uEe=(t,e,r)=>(cv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),dEe=(t,e,r)=>(cv(e,r,t.groups,t.options.suppressErrors),null);q3={withFileTypes:!0},pEe=(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||".",q3,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},mEe=(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||".",q3)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};gEe=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))}},yEe=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}},_Ee=class{aborted=!1;abort(){this.aborted=!0}},B3=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=fEe(e,this.isSynchronous),this.root=ZI(t,e),this.state={root:Ike(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new yEe,options:e,queue:new gEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new _Ee,fs:e.fs||Ake},this.joinPath=Nke(this.root,e),this.pushDirectory=Uke(this.root,e),this.pushFile=Vke(e),this.getArray=Jke(e),this.groupFiles=Qke(e),this.resolveSymlink=rEe(e,this.isSynchronous),this.walkDirectory=hEe(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(_=ZI(_,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=xke(_),x=ZI(VI(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};M3=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return bEe(this.root,this.options)}withCallback(t){H3(this.root,this.options,t)}sync(){return vEe(this.root,this.options)}},G3=null;try{j3.resolve("picomatch"),G3=j3("picomatch")}catch{}Z3=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:F3,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 M3(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new M3(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||G3;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 Kf=v((olt,X3)=>{"use strict";var W3="[^\\\\/]",SEe="(?=.)",K3="[^/]",WI="(?:\\/|$)",J3="(?:^|\\/)",KI=`\\.{1,2}${WI}`,wEe="(?!\\.)",xEe=`(?!${J3}${KI})`,$Ee=`(?!\\.{0,1}${WI})`,kEe=`(?!${KI})`,EEe="[^.\\/]",AEe=`${K3}*?`,TEe="/",Y3={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:SEe,QMARK:K3,END_ANCHOR:WI,DOTS_SLASH:KI,NO_DOT:wEe,NO_DOTS:xEe,NO_DOT_SLASH:$Ee,NO_DOTS_SLASH:kEe,QMARK_NO_DOT:EEe,STAR:AEe,START_ANCHOR:J3,SEP:TEe},OEe={...Y3,SLASH_LITERAL:"[\\\\/]",QMARK:W3,STAR:`${W3}*?`,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:"\\"},REe={__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"};X3.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:REe,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?OEe:Y3}}});var Jf=v(jr=>{"use strict";var{REGEX_BACKSLASH:IEe,REGEX_REMOVE_BACKSLASH:PEe,REGEX_SPECIAL_CHARS:CEe,REGEX_SPECIAL_CHARS_GLOBAL:DEe}=Kf();jr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);jr.hasRegexChars=t=>CEe.test(t);jr.isRegexChar=t=>t.length===1&&jr.hasRegexChars(t);jr.escapeRegex=t=>t.replace(DEe,"\\$1");jr.toPosixSlashes=t=>t.replace(IEe,"/");jr.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};jr.removeBackslashes=t=>t.replace(PEe,e=>e==="\\"?"":e);jr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?jr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};jr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};jr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};jr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var sJ=v((alt,oJ)=>{"use strict";var Q3=Jf(),{CHAR_ASTERISK:JI,CHAR_AT:NEe,CHAR_BACKWARD_SLASH:Yf,CHAR_COMMA:jEe,CHAR_DOT:YI,CHAR_EXCLAMATION_MARK:XI,CHAR_FORWARD_SLASH:iJ,CHAR_LEFT_CURLY_BRACE:QI,CHAR_LEFT_PARENTHESES:eP,CHAR_LEFT_SQUARE_BRACKET:MEe,CHAR_PLUS:FEe,CHAR_QUESTION_MARK:eJ,CHAR_RIGHT_CURLY_BRACE:LEe,CHAR_RIGHT_PARENTHESES:tJ,CHAR_RIGHT_SQUARE_BRACKET:zEe}=Kf(),rJ=t=>t===iJ||t===Yf,nJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},UEe=(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,O=0,A,E,C={value:"",depth:0,isGlob:!1},k=()=>l>=n,q=()=>c.charCodeAt(l+1),Q=()=>(A=E,c.charCodeAt(++l));for(;l0&&(I=c.slice(0,u),c=c.slice(u),d-=u),Se&&m===!0&&d>0?(Se=c.slice(0,d),P=c.slice(d)):m===!0?(Se="",P=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&rJ(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),r.unescape===!0&&(P&&(P=Q3.removeBackslashes(P)),Se&&_===!0&&(Se=Q3.removeBackslashes(Se)));let Or={prefix:I,input:t,start:u,base:Se,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Or.maxDepth=0,rJ(E)||s.push(C),Or.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var Xf=Kf(),rn=Jf(),{MAX_LENGTH:lv,POSIX_REGEX_SOURCE:qEe,REGEX_NON_SPECIAL_CHARS:BEe,REGEX_SPECIAL_CHARS_BACKREF:HEe,REPLACEMENTS:aJ}=Xf,GEe=(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=>rn.escapeRegex(i)).join("..")}return r},kl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,cJ=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},ZEe=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},lJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(ZEe(e))return e.replace(/\\(.)/g,"$1")},VEe=t=>{let e=t.map(lJ).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}}}}},WEe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=lJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?rn.escapeRegex(r[0]):`[${r.map(i=>rn.escapeRegex(i)).join("")}]`}*`},KEe=t=>{let e=0,r=t.trim(),n=tP(r);for(;n;)e++,r=n.body.trim(),n=tP(r);return e},JEe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Xf.DEFAULT_MAX_EXTGLOB_RECURSION,n=cJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||VEe(n)))return{risky:!0};for(let i of n){let o=WEe(i);if(o)return{risky:!0,safeOutput:o};if(KEe(i)>r)return{risky:!0}}return{risky:!1}},rP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=aJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(lv,r.maxLength):lv,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=Xf.globChars(r.windows),l=Xf.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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,A=r.dot?"":h,E=r.dot?_:S,C=r.bash===!0?O(r):x;r.capture&&(C=`(${C})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let k={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=rn.removePrefix(t,k),i=t.length;let q=[],Q=[],Se=[],I=o,P,Or=()=>k.index===i-1,se=k.peek=(B=1)=>t[k.index+B],Pe=k.advance=()=>t[++k.index]||"",Vt=()=>t.slice(k.index+1),ar=(B="",ft=0)=>{k.consumed+=B,k.index+=ft},Kt=B=>{k.output+=B.output!=null?B.output:B.value,ar(B.value)},eo=()=>{let B=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),k.start++,B++;return B%2===0?!1:(k.negated=!0,k.start++,!0)},gi=B=>{k[B]++,Se.push(B)},Kr=B=>{k[B]--,Se.pop()},de=B=>{if(I.type==="globstar"){let ft=k.braces>0&&(B.type==="comma"||B.type==="brace"),U=B.extglob===!0||q.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ft&&!U&&(k.output=k.output.slice(0,-I.output.length),I.type="star",I.value="*",I.output=C,k.output+=I.output)}if(q.length&&B.type!=="paren"&&(q[q.length-1].inner+=B.value),(B.value||B.output)&&Kt(B),I&&I.type==="text"&&B.type==="text"){I.output=(I.output||I.value)+B.value,I.value+=B.value;return}B.prev=I,s.push(B),I=B},to=(B,ft)=>{let U={...l[ft],conditions:1,inner:""};U.prev=I,U.parens=k.parens,U.output=k.output,U.startIndex=k.index,U.tokensIndex=s.length;let Te=(r.capture?"(":"")+U.open;gi("parens"),de({type:B,value:ft,output:k.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Te}),q.push(U)},Oue=B=>{let ft=t.slice(B.startIndex,k.index+1),U=t.slice(B.startIndex+2,k.index),Te=JEe(U,r);if((B.type==="plus"||B.type==="star")&&Te.risky){let ct=Te.safeOutput?(B.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,yi=s[B.tokensIndex];yi.type="text",yi.value=ft,yi.output=ct||rn.escapeRegex(ft);for(let _i=B.tokensIndex+1;_i1&&B.inner.includes("/")&&(ct=O(r)),(ct!==C||Or()||/^\)+$/.test(Vt()))&&(lt=B.close=`)$))${ct}`),B.inner.includes("*")&&(jt=Vt())&&/^\.[^\\/.]+$/.test(jt)){let yi=rP(jt,{...e,fastpaths:!1}).output;lt=B.close=`)${yi})${ct})`}B.prev.type==="bos"&&(k.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:lt}),Kr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ft=t.replace(HEe,(U,Te,lt,jt,ct,yi)=>jt==="\\"?(B=!0,U):jt==="?"?Te?Te+jt+(ct?_.repeat(ct.length):""):yi===0?E+(ct?_.repeat(ct.length):""):_.repeat(lt.length):jt==="."?u.repeat(lt.length):jt==="*"?Te?Te+jt+(ct?C:""):C:Te?U:`\\${U}`);return B===!0&&(r.unescape===!0?ft=ft.replace(/\\/g,""):ft=ft.replace(/\\+/g,U=>U.length%2===0?"\\\\":U?"\\":"")),ft===t&&r.contains===!0?(k.output=t,k):(k.output=rn.wrapOutput(ft,k,e),k)}for(;!Or();){if(P=Pe(),P==="\0")continue;if(P==="\\"){let U=se();if(U==="/"&&r.bash!==!0||U==="."||U===";")continue;if(!U){P+="\\",de({type:"text",value:P});continue}let Te=/^\\+/.exec(Vt()),lt=0;if(Te&&Te[0].length>2&&(lt=Te[0].length,k.index+=lt,lt%2!==0&&(P+="\\")),r.unescape===!0?P=Pe():P+=Pe(),k.brackets===0){de({type:"text",value:P});continue}}if(k.brackets>0&&(P!=="]"||I.value==="["||I.value==="[^")){if(r.posix!==!1&&P===":"){let U=I.value.slice(1);if(U.includes("[")&&(I.posix=!0,U.includes(":"))){let Te=I.value.lastIndexOf("["),lt=I.value.slice(0,Te),jt=I.value.slice(Te+2),ct=qEe[jt];if(ct){I.value=lt+ct,k.backtrack=!0,Pe(),!o.output&&s.indexOf(I)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(I.value==="["||I.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&I.value==="["&&(P="^"),I.value+=P,Kt({value:P});continue}if(k.quotes===1&&P!=='"'){P=rn.escapeRegex(P),I.value+=P,Kt({value:P});continue}if(P==='"'){k.quotes=k.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){gi("parens"),de({type:"paren",value:P});continue}if(P===")"){if(k.parens===0&&r.strictBrackets===!0)throw new SyntaxError(kl("opening","("));let U=q[q.length-1];if(U&&k.parens===U.parens+1){Oue(q.pop());continue}de({type:"paren",value:P,output:k.parens?")":"\\)"}),Kr("parens");continue}if(P==="["){if(r.nobracket===!0||!Vt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(kl("closing","]"));P=`\\${P}`}else gi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||I&&I.type==="bracket"&&I.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if(k.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(kl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Kr("brackets");let U=I.value.slice(1);if(I.posix!==!0&&U[0]==="^"&&!U.includes("/")&&(P=`/${P}`),I.value+=P,Kt({value:P}),r.literalBrackets===!1||rn.hasRegexChars(U))continue;let Te=rn.escapeRegex(I.value);if(k.output=k.output.slice(0,-I.value.length),r.literalBrackets===!0){k.output+=Te,I.value=Te;continue}I.value=`(${a}${Te}|${I.value})`,k.output+=I.value;continue}if(P==="{"&&r.nobrace!==!0){gi("braces");let U={type:"brace",value:P,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};Q.push(U),de(U);continue}if(P==="}"){let U=Q[Q.length-1];if(r.nobrace===!0||!U){de({type:"text",value:P,output:P});continue}let Te=")";if(U.dots===!0){let lt=s.slice(),jt=[];for(let ct=lt.length-1;ct>=0&&(s.pop(),lt[ct].type!=="brace");ct--)lt[ct].type!=="dots"&&jt.unshift(lt[ct].value);Te=GEe(jt,r),k.backtrack=!0}if(U.comma!==!0&&U.dots!==!0){let lt=k.output.slice(0,U.outputIndex),jt=k.tokens.slice(U.tokensIndex);U.value=U.output="\\{",P=Te="\\}",k.output=lt;for(let ct of jt)k.output+=ct.output||ct.value}de({type:"brace",value:P,output:Te}),Kr("braces"),Q.pop();continue}if(P==="|"){q.length>0&&q[q.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let U=P,Te=Q[Q.length-1];Te&&Se[Se.length-1]==="braces"&&(Te.comma=!0,U="|"),de({type:"comma",value:P,output:U});continue}if(P==="/"){if(I.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",s.pop(),I=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if(k.braces>0&&I.type==="dot"){I.value==="."&&(I.output=u);let U=Q[Q.length-1];I.type="dots",I.output+=P,I.value+=P,U.dots=!0;continue}if(k.braces+k.parens===0&&I.type!=="bos"&&I.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(I&&I.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){to("qmark",P);continue}if(I&&I.type==="paren"){let Te=se(),lt=P;(I.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Vt()))&&(lt=`\\${P}`),de({type:"text",value:P,output:lt});continue}if(r.dot!==!0&&(I.type==="slash"||I.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){to("negate",P);continue}if(r.nonegate!==!0&&k.index===0){eo();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){to("plus",P);continue}if(I&&I.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(I&&(I.type==="bracket"||I.type==="paren"||I.type==="brace")||k.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let U=BEe.exec(Vt());U&&(P+=U[0],k.index+=U[0].length),de({type:"text",value:P});continue}if(I&&(I.type==="globstar"||I.star===!0)){I.type="star",I.star=!0,I.value+=P,I.output=C,k.backtrack=!0,k.globstar=!0,ar(P);continue}let B=Vt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){to("star",P);continue}if(I.type==="star"){if(r.noglobstar===!0){ar(P);continue}let U=I.prev,Te=U.prev,lt=U.type==="slash"||U.type==="bos",jt=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!lt||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let ct=k.braces>0&&(U.type==="comma"||U.type==="brace"),yi=q.length&&(U.type==="pipe"||U.type==="paren");if(!lt&&U.type!=="paren"&&!ct&&!yi){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let _i=t[k.index+4];if(_i&&_i!=="/")break;B=B.slice(3),ar("/**",3)}if(U.type==="bos"&&Or()){I.type="globstar",I.value+=P,I.output=O(r),k.output=I.output,k.globstar=!0,ar(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&!jt&&Or()){k.output=k.output.slice(0,-(U.output+I.output).length),U.output=`(?:${U.output}`,I.type="globstar",I.output=O(r)+(r.strictSlashes?")":"|$)"),I.value+=P,k.globstar=!0,k.output+=U.output+I.output,ar(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&B[0]==="/"){let _i=B[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(U.output+I.output).length),U.output=`(?:${U.output}`,I.type="globstar",I.output=`${O(r)}${f}|${f}${_i})`,I.value+=P,k.output+=U.output+I.output,k.globstar=!0,ar(P+Pe()),de({type:"slash",value:"/",output:""});continue}if(U.type==="bos"&&B[0]==="/"){I.type="globstar",I.value+=P,I.output=`(?:^|${f}|${O(r)}${f})`,k.output=I.output,k.globstar=!0,ar(P+Pe()),de({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-I.output.length),I.type="globstar",I.output=O(r),I.value+=P,k.output+=I.output,k.globstar=!0,ar(P);continue}let ft={type:"star",value:P,output:C};if(r.bash===!0){ft.output=".*?",(I.type==="bos"||I.type==="slash")&&(ft.output=A+ft.output),de(ft);continue}if(I&&(I.type==="bracket"||I.type==="paren")&&r.regex===!0){ft.output=P,de(ft);continue}(k.index===k.start||I.type==="slash"||I.type==="dot")&&(I.type==="dot"?(k.output+=g,I.output+=g):r.dot===!0?(k.output+=b,I.output+=b):(k.output+=A,I.output+=A),se()!=="*"&&(k.output+=p,I.output+=p)),de(ft)}for(;k.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(kl("closing","]"));k.output=rn.escapeLast(k.output,"["),Kr("brackets")}for(;k.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(kl("closing",")"));k.output=rn.escapeLast(k.output,"("),Kr("parens")}for(;k.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(kl("closing","}"));k.output=rn.escapeLast(k.output,"{"),Kr("braces")}if(r.strictSlashes!==!0&&(I.type==="star"||I.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),k.backtrack===!0){k.output="";for(let B of k.tokens)k.output+=B.output!=null?B.output:B.value,B.suffix&&(k.output+=B.suffix)}return k};rP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(lv,r.maxLength):lv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=aJ[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}=Xf.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 E=/^(.*?)\.(\w+)$/.exec(A);if(!E)return;let C=x(E[1]);return C?C+o+E[2]:void 0}}},w=rn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};uJ.exports=rP});var mJ=v((llt,pJ)=>{"use strict";var YEe=sJ(),nP=dJ(),fJ=Jf(),XEe=Kf(),QEe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=QEe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?fJ.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(fJ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):nP(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>YEe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=nP.fastpaths(t,e)),i.output||(i=nP(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=XEe;pJ.exports=Tt});var _J=v((ult,yJ)=>{"use strict";var hJ=mJ(),eAe=Jf();function gJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:eAe.isWindows()}),hJ(t,e,r)}Object.assign(gJ,hJ);yJ.exports=gJ});import{readdir as tAe,readdirSync as rAe,realpath as nAe,realpathSync as iAe,stat as oAe,statSync as sAe}from"fs";import{isAbsolute as aAe,posix as ja,resolve as cAe}from"path";import{fileURLToPath as lAe}from"url";function fAe(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]===".."&&dAe.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=>ja.relative(t,n)||".":n=>ja.relative(t,`${e}/${n}`)||"."}function hAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=ja.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function wJ(t){var e;let r=El.default.scan(t,gAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function wAe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=El.default.scan(t);return r.isGlob||r.negated}function Qf(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function xJ(t){return typeof t=="string"?[t]:t??[]}function iP(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=SAe(o);s=aAe(s.replace($Ae,""))?ja.relative(a,s):ja.normalize(s);let c=(i=xAe.exec(s))===null||i===void 0?void 0:i[0],l=wJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?ja.join(o,...d):o}return s}function kAe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(iP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(iP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(iP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function EAe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=kAe(t,e,n);t.debug&&Qf("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(vJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,El.default)(i.match,f),m=(0,El.default)(i.ignore,f),h=fAe(i.match,f),g=bJ(r,d,o),b=o?g:bJ(r,d,!0),_=(w,O)=>{let A=b(O,!0);return A!=="."&&!h(A)||m(A)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new Z3({filters:[a?(w,O)=>{let A=g(w,O),E=p(A)&&!m(A);return E&&Qf(`matched ${A}`),E}:(w,O)=>{let A=g(w,O);return p(A)&&!m(A)}],exclude:a?(w,O)=>{let A=_(w,O);return Qf(`${A?"skipped":"crawling"} ${O}`),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&&Qf("internal properties:",{...n,root:d}),[x,r!==d&&!o&&hAe(r,d)]}function AAe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function OAe(t){let e={...TAe,...t};return e.cwd=(e.cwd instanceof URL?lAe(e.cwd):cAe(e.cwd)).replace(vJ,"/"),e.ignore=xJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||tAe,readdirSync:e.fs.readdirSync||rAe,realpath:e.fs.realpath||nAe,realpathSync:e.fs.realpathSync||iAe,stat:e.fs.stat||oAe,statSync:e.fs.statSync||sAe}),e.debug&&Qf("globbing with options:",e),e}function RAe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=uAe(t)||typeof t=="string",i=xJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=OAe(n?e:t);return i.length>0?EAe(o,i):[]}function us(t,e){let[r,n]=RAe(t,e);return r?AAe(r.sync(),n):[]}var El,uAe,vJ,SJ,dAe,pAe,mAe,gAe,yAe,_Ae,bAe,vAe,SAe,xAe,$Ae,TAe,ep=y(()=>{V3();El=Et(_J(),1),uAe=Array.isArray,vJ=/\\/g,SJ=process.platform==="win32",dAe=/^(\/?\.\.)+$/;pAe=/^[A-Z]:\/$/i,mAe=SJ?t=>pAe.test(t):t=>t==="/";gAe={parts:!0};yAe=/(?t.replace(yAe,"\\$&"),vAe=t=>t.replace(_Ae,"\\$&"),SAe=SJ?vAe:bAe;xAe=/^(\/?\.\.)+/,$Ae=/\\(?=[()[\]{}!*+?@|])/g;TAe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as tp,readFileSync as IAe,readdirSync as PAe,statSync as $J}from"node:fs";import{join as Ma}from"node:path";function CAe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Oi(e,n),o=[],{layers:s,forbiddenImports:a}=oP(r);return(s.size>0||a.length>0)&&!tp(Ma(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&&(DAe(e,i,s,o),NAe(e,i,s,o)),a.length>0&&jAe(e,i,a,o),o)}function oP(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 DAe(t,e,r,n){let i=e.mainRoot,o=Ma(t,i);if(tp(o))for(let s of PAe(o)){let a=Ma(o,s);$J(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 NAe(t,e,r,n){let i=e.mainRoot,o=Ma(t,i);if(tp(o))for(let s of r){let a=Ma(o,s);tp(a)&&$J(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 jAe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ma(t,i,s.from);if(!tp(a))continue;let c=us([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ma(a,l),d;try{d=IAe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];MAe(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 MAe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var rp,kJ,sP=y(()=>{"use strict";ep();qe();Na();rp="ARCHITECTURE_FROM_SPEC";kJ={name:rp,run:CAe}});import{existsSync as FAe,readFileSync as LAe}from"node:fs";import{join as zAe}from"node:path";function UAe(t){let{cwd:e="."}=t,r=zAe(e,"spec/capabilities.yaml");if(!FAe(r))return[];let n;try{let c=LAe(r,"utf8"),l=EJ.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=H(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:uv,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:uv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:uv,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var EJ,uv,AJ,TJ=y(()=>{"use strict";EJ=Et(cr(),1);qe();uv="CAPABILITIES_FEATURE_MAPPING";AJ={name:uv,run:UAe}});import{existsSync as qAe,readFileSync as BAe}from"node:fs";import{join as HAe}from"node:path";function GAe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function ZAe(t){let{cwd:e="."}=t;return he(e,aP,r=>VAe(r,e))}function VAe(t,e){let r=Oi(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=HAe(e,o);if(!qAe(s))continue;let a=BAe(s,"utf8");GAe(a)||n.push({detector:aP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var aP,OJ,RJ=y(()=>{"use strict";Na();bt();aP="CONVENTION_DRIFT";OJ={name:aP,run:ZAe}});import{existsSync as cP,readFileSync as IJ}from"node:fs";import{join as dv}from"node:path";function WAe(t){return JSON.parse(t).total?.lines?.pct??0}function PJ(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function YAe(t,e){if(!Vb(ht(t).gates.coverage?.cmd))return null;let r;try{r=Wb(t,e)}catch(c){return[{detector:ho,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=zI.find(d=>cP(dv(c.dir,d)));if(!l){s.push(c.path);continue}let u=PJ(IJ(dv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:ho,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=CJ(n,i);return a0?[{detector:ho,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function XAe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=YAe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Oi(e,r),i=ht(e).language==="kotlin"?zI.find(a=>cP(dv(e,a)))??h3(e):n.coverageSummary,o=dv(e,i);if(!cP(o))return[{detector:ho,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=IJ(o,"utf8");s=n.coverageFormat==="jacoco-xml"?KAe(a):n.coverageFormat==="cobertura-xml"?JAe(a):WAe(a)}catch(a){return[{detector:ho,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:ho,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=fv?[]:[{detector:ho,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${fv}%`}]}var ho,fv,DJ,NJ=y(()=>{"use strict";qe();Xb();Na();Kb();kn();ho="COVERAGE_DROP",fv=70;DJ={name:ho,run:XAe}});import{existsSync as QAe}from"node:fs";import{join as eTe}from"node:path";function tTe(t){let{cwd:e="."}=t;return he(e,pv,r=>rTe(r,e))}function rTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?QAe(eTe(e,r.path))?[]:[{detector:pv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:pv,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var pv,jJ,MJ=y(()=>{"use strict";bt();pv="DELIVERABLE_INTEGRITY";jJ={name:pv,run:tTe}});function nTe(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:mv,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 iTe(t){let e=nTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:mv,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 oTe(t){let{cwd:e="."}=t;return he(e,mv,r=>iTe(r))}var mv,FJ,LJ=y(()=>{"use strict";bt();mv="SMOKE_PROBE_DEMAND";FJ={name:mv,run:oTe}});function sTe(t){let{cwd:e="."}=t;return he(e,hv,r=>aTe(r,e))}function aTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ts(e);if(n===null)return[{detector:hv,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=p_(n,e,o);s.state!=="fresh"&&i.push({detector:hv,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 hv,gv,lP=y(()=>{"use strict";rl();bt();hv="STALE_ATTESTATION";gv={name:hv,run:sTe}});function cTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return lTe(r)}function lTe(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:zJ,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 zJ,yv,uP=y(()=>{"use strict";qe();zJ="DEPENDENCY_CYCLE";yv={name:zJ,run:cTe}});import{appendFileSync as uTe,existsSync as UJ,mkdirSync as dTe,readFileSync as fTe}from"node:fs";import{dirname as pTe,join as mTe}from"node:path";function qJ(t){return mTe(t,hTe,gTe)}function BJ(t){return dP.add(t),()=>dP.delete(t)}function Fa(t,e){let r=qJ(t),n=pTe(r);UJ(n)||dTe(n,{recursive:!0}),uTe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of dP)try{i(t,e)}catch{}}function An(t){let e=qJ(t);if(!UJ(e))return[];let r=fTe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var hTe,gTe,dP,Yn=y(()=>{"use strict";hTe=".cladding",gTe="audit.log.jsonl";dP=new Set});import{existsSync as yTe}from"node:fs";import{join as _Te}from"node:path";function bTe(t){let{cwd:e="."}=t,r=An(e);if(r.length===0)return[{detector:fP,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&&(yTe(_Te(e,i.artifact))||n.push({detector:fP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var fP,HJ,GJ=y(()=>{"use strict";Yn();fP="EVIDENCE_MISMATCH";HJ={name:fP,run:bTe}});import{existsSync as vTe,readFileSync as STe}from"node:fs";import{join as wTe}from"node:path";function xTe(t){let e=wTe(t,KJ);if(!vTe(e))return null;try{let n=((0,WJ.parse)(STe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*VJ(t,e){for(let r of t??[])r.startsWith(ZJ)&&(yield{ref:r,name:r.slice(ZJ.length),field:e})}function $Te(t){let{cwd:e="."}=t,r=xTe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:pP,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=[...VJ(s.evidence_refs,"evidence_refs"),...VJ(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:pP,severity:"warn",path:KJ,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var WJ,pP,ZJ,KJ,JJ,YJ=y(()=>{"use strict";WJ=Et(cr(),1);qe();pP="FIXTURE_REFERENCE_INVALID",ZJ="fixture:",KJ="conformance/fixtures.yaml";JJ={name:pP,run:$Te}});import{existsSync as Al,readFileSync as mP}from"node:fs";import{join as La}from"node:path";function kTe(t){return us(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function np(t){if(!Al(t))return null;try{return JSON.parse(mP(t,"utf8"))}catch{return null}}function ETe(t,e){let r=La(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(mP(r,"utf8"))}catch(c){e.push({detector:go,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:go,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=kTe(t);s!==a&&e.push({detector:go,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function ATe(t,e){for(let r of XJ){let n=La(t,r.path);if(!Al(n))continue;let i=np(n);if(!i){e.push({detector:go,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:go,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function TTe(t,e){let r=np(La(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of XJ){let s=La(t,o.path);if(!Al(s))continue;let a=np(s);a?.version&&a.version!==n&&e.push({detector:go,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=La(t,".claude-plugin","marketplace.json");if(Al(i)){let o=np(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:go,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 OTe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function RTe(t,e){let r=La(t,"src","cli","clad.ts"),n=La(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Al(r)||!Al(n))return;let i=OTe(mP(r,"utf8"));if(i.length===0)return;let s=np(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:go,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 ITe(t){let{cwd:e="."}=t,r=[];return ETe(e,r),RTe(e,r),ATe(e,r),TTe(e,r),r}var go,XJ,QJ,e8=y(()=>{"use strict";ep();go="HARNESS_INTEGRITY",XJ=[{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"]}];QJ={name:go,run:ITe}});import{existsSync as PTe,readFileSync as CTe}from"node:fs";import{join as DTe}from"node:path";function jTe(t){let{cwd:e="."}=t;return he(e,_v,r=>FTe(r,e))}function MTe(t){let e=DTe(t,"spec/capabilities.yaml");if(!PTe(e))return!1;try{let r=t8.default.parse(CTe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function FTe(t,e){let r=t.features.length;if(r{"use strict";t8=Et(cr(),1);bt();_v="HOLLOW_GOVERNANCE",NTe=8;r8={name:_v,run:jTe}});import{existsSync as i8,readFileSync as o8}from"node:fs";import{join as s8}from"node:path";function a8(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 UTe(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 qTe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function BTe(t){let e=s8(t,"README.md"),r=s8(t,"docs","dogfood","matrix.md");if(!i8(e)||!i8(r))return[];let n=a8(o8(e,"utf8"),LTe),i=a8(o8(r,"utf8"),zTe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=qTe(a);if(c===null)continue;let l=i[s]??"not-run",u=UTe(l);u!==null&&c>u&&o.push({detector:c8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function HTe(t){let{cwd:e="."}=t;return BTe(e)}var c8,LTe,zTe,l8,u8=y(()=>{"use strict";c8="HOST_CLAIM_DRIFT",LTe=//,zTe=//;l8={name:c8,run:HTe}});function GTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return d8(r.features.map(i=>i.id),"feature","spec/features/",n),d8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function d8(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:f8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var f8,p8,m8=y(()=>{"use strict";qe();f8="ID_COLLISION";p8={name:f8,run:GTe}});import{existsSync as ip,readFileSync as hP,readdirSync as gP,statSync as ZTe,writeFileSync as g8}from"node:fs";import{join as yo}from"node:path";function h8(t){if(!ip(t))return 0;try{return gP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function VTe(t){if(!ip(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=gP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=yo(n,o),a;try{a=ZTe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function WTe(t){let e=yo(t,"spec","capabilities.yaml");if(!ip(e))return 0;try{let r=bv.default.parse(hP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ds(t="."){let e=h8(yo(t,"spec","features")),r=h8(yo(t,"spec","scenarios")),n=WTe(t),i=VTe(yo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Tl(t,e){let r=yo(t,"spec.yaml");if(!ip(r))return;let n=hP(r,"utf8"),i=KTe(n,e);i!==n&&g8(r,i)}function KTe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as Bwe}from"node:buffer";import{StringDecoder as Hwe}from"node:string_decoder";var Ab,Gwe,Zwe,Vwe,qR=y(()=>{tn();Ab=(t,e,r)=>{if(r)return;if(t)return{transform:Gwe.bind(void 0,new TextEncoder)};let n=new Hwe(e);return{transform:Zwe.bind(void 0,n),final:Vwe.bind(void 0,n)}},Gwe=function*(t,e){Bwe.isBuffer(e)?yield fo(e):typeof e=="string"?yield t.encode(e):yield e},Zwe=function*(t,e){yield Ft(e)?t.write(e):e},Vwe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as uW}from"node:util";var BR,Tb,dW,Wwe,fW,Kwe,pW=y(()=>{BR=uW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Tb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Kwe}=e[r];for await(let i of n(t))yield*Tb(i,e,r+1)},dW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Wwe(r,Number(e),t)},Wwe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Tb(n,r,e+1)},fW=uW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Kwe=function*(t){yield t}});var HR,mW,Oa,Bf,Jwe,Ywe,GR=y(()=>{HR=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},mW=(t,e)=>[...e.flatMap(r=>[...Oa(r,t,0)]),...Bf(t)],Oa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Ywe}=e[r];for(let i of n(t))yield*Oa(i,e,r+1)},Bf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Jwe(r,Number(e),t)},Jwe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Oa(n,r,e+1)},Ywe=function*(t){yield t}});import{Transform as Xwe,getDefaultHighWaterMark as hW}from"node:stream";var ZR,Ob,gW,Rb=y(()=>{br();Eb();lW();qR();pW();GR();ZR=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=gW(t,s,o),l=Ta(e),u=Ta(r),d=l?BR.bind(void 0,Tb,a):HR.bind(void 0,Oa),f=l||u?BR.bind(void 0,dW,a):HR.bind(void 0,Bf),p=l||u?fW.bind(void 0,a):void 0;return{stream:new Xwe({writableObjectMode:n,writableHighWaterMark:hW(n),readableObjectMode:i,readableHighWaterMark:hW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Ob=(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=gW(s,r,a);t=mW(c,t)}return t},gW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:sW(n,a)},Ab(r,s,n),kb(r,o,n,c),{transform:t,final:e},{transform:aW(i,a)},oW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var yW,Qwe,exe,txe,rxe,_W=y(()=>{Rb();tn();br();yW=(t,e)=>{for(let r of Qwe(t))exe(t,r,e)},Qwe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),exe=(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 ${cs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>txe(a,n));r.input=Af(s)},txe=(t,e)=>{let r=Ob(t,e,"utf8",!0);return rxe(r),Af(r)},rxe=t=>{let e=t.find(r=>typeof r!="string"&&!Ft(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 Ib,nxe,ixe,bW,vW,oxe,SW,VR=y(()=>{$a();br();ll();is();Ib=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&cl(r,n)&&!rn.has(e)&&nxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&ixe.has(o))||t.every(({type:i})=>En.has(i))),nxe=t=>t===1||t===2,ixe=new Set(["pipe","overlapped"]),bW=async(t,e,r,n)=>{for await(let i of t)oxe(e)||SW(i,r,n)},vW=(t,e,r)=>{for(let n of t)SW(n,e,r)},oxe=t=>t._readableState.pipes.length>0,SW=(t,e,r)=>{let n=R_(t);Ei({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as sxe,appendFileSync as axe}from"node:fs";var wW,cxe,lxe,uxe,dxe,fxe,xW=y(()=>{VR();Rb();Eb();tn();br();Aa();wW=({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)=>cxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},cxe=({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=aV(t,o,d),p=fo(f),{stdioItems:m,objectMode:h}=e[r],g=lxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=uxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});dxe({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&&fxe(b,m,i),S}catch(x){return n.error=x,S}},lxe=(t,e,r,n)=>{try{return Ob(t,e,r,!1)}catch(i){return n.error=i,t}},uxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Af(t)};let s=YH(t,r);return n[o]?{serializedResult:s,finalResult:UR(s,!i[o],e)}:{serializedResult:s}},dxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Ib({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=UR(t,!1,s);try{vW(a,e,n)}catch(c){r.error??=c}},fxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>wb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?axe(n,t):(r.add(o),sxe(n,t))}}});var $W,kW=y(()=>{tn();qf();$W=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,yo(e,r,"all")]:Array.isArray(e)?[yo(t,r,"all"),...e]:Ft(t)&&Ft(e)?jO([t,e]):`${t}${e}`}});import{once as WR}from"node:events";var EW,pxe,AW,TW,mxe,KR,JR=y(()=>{wa();EW=async(t,e)=>{let[r,n]=await pxe(t);return e.isForcefullyTerminated??=!1,[r,n]},pxe=async t=>{let[e,r]=await Promise.allSettled([WR(t,"spawn"),WR(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?AW(t):r.value},AW=async t=>{try{return await WR(t,"exit")}catch{return AW(t)}},TW=async t=>{let[e,r]=await t;if(!mxe(e,r)&&KR(e,r))throw new Kn;return[e,r]},mxe=(t,e)=>t===void 0&&e===void 0,KR=(t,e)=>t!==0||e!==null});var OW,hxe,RW=y(()=>{wa();Aa();JR();OW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=hxe(t,e,r),s=o?.code==="ETIMEDOUT",a=sV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},hxe=(t,e,r)=>t!==void 0?t:KR(e,r)?new Kn:void 0});import{spawnSync as gxe}from"node:child_process";var IW,yxe,_xe,bxe,Pb,vxe,Sxe,wxe,xxe,PW=y(()=>{GO();bR();vR();Uf();bb();rW();qf();_W();xW();Aa();kW();RW();IW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=yxe(t,e,r),d=vxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return vl(d,c,l)},yxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=C_(t,e,r),a=_xe(r),{file:c,commandArguments:l,options:u}=sb(t,e,a);bxe(u);let d=eW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},_xe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,bxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Pb("ipcInput"),t&&Pb("ipc: true"),r&&Pb("detached: true"),n&&Pb("cancelSignal")},Pb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},vxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Sxe({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}=OW(c,r),{output:m,error:h=l}=wW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>yo(_,r,S)),b=yo($W(m,r),r,"all");return xxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Sxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{yW(o,r);let a=wxe(r);return gxe(...ab(t,e,a))}catch(a){return bl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},wxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:yb(e)}),xxe=({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?_b({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):zf({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 YR,on as $xe}from"node:events";var CW,kxe,Exe,Axe,Txe,DW=y(()=>{ml();Nf();Df();CW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(fl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Q_(t)}),kxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),kxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{Z_(e,i);let o=as(t,e,r),s=new AbortController;try{return await Promise.race([Exe(o,n,s),Axe(o,r,s),Txe(o,r,s)])}catch(a){throw pl(t),a}finally{s.abort(),V_(e,i)}},Exe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await YR(t,"message",{signal:r});return n}for await(let[n]of $xe(t,"message",{signal:r}))if(e(n))return n},Axe=async(t,e,{signal:r})=>{await YR(t,"disconnect",{signal:r}),GZ(e)},Txe=async(t,e,{signal:r})=>{let[n]=await YR(t,"strict:error",{signal:r});throw q_(n,e)}});import{once as jW,on as Oxe}from"node:events";var MW,XR,Rxe,Ixe,Pxe,NW,QR=y(()=>{ml();Nf();Df();MW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>XR({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),XR=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{fl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Q_(t)}),Z_(e,o);let s=as(t,e,r),a=new AbortController,c={};return Rxe(t,s,a),Ixe({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),Pxe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Rxe=async(t,e,r)=>{try{await jW(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Ixe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await jW(t,"strict:error",{signal:r.signal});n.error=q_(i,e),r.abort()}catch{}},Pxe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of Oxe(r,"message",{signal:o.signal}))NW(s),yield c}catch{NW(s)}finally{o.abort(),V_(e,a),n||pl(t),i&&await t}},NW=({error:t})=>{if(t)throw t}});import FW from"node:process";var LW,zW,UW,eI=y(()=>{ib();DW();QR();Y_();LW=(t,{ipc:e})=>{Object.assign(t,UW(t,!1,e))},zW=()=>{let t=FW,e=!0,r=FW.channel!==void 0;return{...UW(t,e,r),getCancelSignal:b9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},UW=(t,e,r)=>({sendMessage:nb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:CW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:MW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as Cxe}from"node:child_process";import{PassThrough as Dxe,Readable as Nxe,Writable as jxe,Duplex as Mxe}from"node:stream";var qW,Fxe,Hf,Lxe,zxe,Uxe,qxe,BW=y(()=>{$b();Uf();bb();qW=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{FR(n);let a=new Cxe;Fxe(a,n),Object.assign(a,{readable:Lxe,writable:zxe,duplex:Uxe});let c=bl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=qxe(c,s,i);return{subprocess:a,promise:l}},Fxe=(t,e)=>{let r=Hf(),n=Hf(),i=Hf(),o=Array.from({length:e.length-3},Hf),s=Hf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Hf=()=>{let t=new Dxe;return t.end(),t},Lxe=()=>new Nxe({read(){}}),zxe=()=>new jxe({write(){}}),Uxe=()=>new Mxe({read(){},write(){}}),qxe=async(t,e,r)=>vl(t,e,r)});import{createReadStream as HW,createWriteStream as GW}from"node:fs";import{Buffer as Bxe}from"node:buffer";import{Readable as Gf,Writable as Hxe,Duplex as Gxe}from"node:stream";var VW,Zf,ZW,Zxe,WW=y(()=>{Rb();$b();br();VW=(t,e)=>xb(Zxe,t,e,!1),Zf=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${cs[t]}.`)},ZW={fileNumber:Zf,generator:ZR,asyncGenerator:ZR,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Gxe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Zxe={input:{...ZW,fileUrl:({value:t})=>({stream:HW(t)}),filePath:({value:{file:t}})=>({stream:HW(t)}),webStream:({value:t})=>({stream:Gf.fromWeb(t)}),iterable:({value:t})=>({stream:Gf.from(t)}),asyncIterable:({value:t})=>({stream:Gf.from(t)}),string:({value:t})=>({stream:Gf.from(t)}),uint8Array:({value:t})=>({stream:Gf.from(Bxe.from(t))})},output:{...ZW,fileUrl:({value:t})=>({stream:GW(t)}),filePath:({value:{file:t,append:e}})=>({stream:GW(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Hxe.fromWeb(t)}),iterable:Zf,asyncIterable:Zf,string:Zf,uint8Array:Zf}}});import{on as Vxe,once as KW}from"node:events";import{PassThrough as Wxe,getDefaultHighWaterMark as Kxe}from"node:stream";import{finished as XW}from"node:stream/promises";function Ra(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)rI(i);let e=t.some(({readableObjectMode:i})=>i),r=Jxe(t,e),n=new tI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Jxe,tI,Yxe,Xxe,Qxe,rI,e0e,t0e,r0e,n0e,i0e,QW,e3,nI,t3,o0e,Cb,JW,YW,Db=y(()=>{Jxe=(t,e)=>{if(t.length===0)return Kxe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},tI=class extends Wxe{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(rI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Yxe(this,this.#t,this.#o);let r=e0e({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(rI(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)}},Yxe=async(t,e,r)=>{Cb(t,JW);let n=new AbortController;try{await Promise.race([Xxe(t,n),Qxe(t,e,r,n)])}finally{n.abort(),Cb(t,-JW)}},Xxe=async(t,{signal:e})=>{try{await XW(t,{signal:e,cleanup:!0})}catch(r){throw QW(t,r),r}},Qxe=async(t,e,r,{signal:n})=>{for await(let[i]of Vxe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},rI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},e0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Cb(t,YW);let a=new AbortController;try{await Promise.race([t0e(o,e,a),r0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),n0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Cb(t,-YW)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?nI(t):i0e(t))},t0e=async(t,e,{signal:r})=>{try{await t,r.aborted||nI(e)}catch(n){r.aborted||QW(e,n)}},r0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await XW(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;e3(s)?i.add(e):t3(t,s)}},n0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await KW(t,i,{signal:o}),!t.readable)return KW(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},i0e=t=>{t.writable&&t.end()},QW=(t,e)=>{e3(e)?nI(t):t3(t,e)},e3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",nI=t=>{(t.readable||t.writable)&&t.destroy()},t3=(t,e)=>{t.destroyed||(t.once("error",o0e),t.destroy(e))},o0e=()=>{},Cb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},JW=2,YW=1});import{finished as r3}from"node:stream/promises";var wl,s0e,iI,a0e,oI,Nb=y(()=>{po();wl=(t,e)=>{t.pipe(e),s0e(t,e),a0e(t,e)},s0e=async(t,e)=>{if(!(Wn(t)||Wn(e))){try{await r3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}iI(e)}},iI=t=>{t.writable&&t.end()},a0e=async(t,e)=>{if(!(Wn(t)||Wn(e))){try{await r3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}oI(t)}},oI=t=>{t.readable&&t.destroy()}});var n3,c0e,l0e,u0e,d0e,f0e,i3=y(()=>{Db();po();G_();br();Nb();n3=(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})=>En.has(c)))c0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!En.has(c)))u0e({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]:Ra(o);wl(s,i)}},c0e=(t,e,r,n)=>{r==="output"?wl(t.stdio[n],e):wl(e,t.stdio[n]);let i=l0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},l0e=["stdin","stdout","stderr"],u0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;d0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},d0e=(t,{signal:e})=>{Wn(t)&&xa(t,f0e,e)},f0e=2});var Ia,o3=y(()=>{Ia=[];Ia.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ia.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ia.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var jb,sI,aI,p0e,cI,Mb,m0e,lI,uI,dI,s3,vot,Sot,a3=y(()=>{o3();jb=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",sI=Symbol.for("signal-exit emitter"),aI=globalThis,p0e=Object.defineProperty.bind(Object),cI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(aI[sI])return aI[sI];p0e(aI,sI,{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}},Mb=class{},m0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),lI=class extends Mb{onExit(){return()=>{}}load(){}unload(){}},uI=class extends Mb{#t=dI.platform==="win32"?"SIGINT":"SIGHUP";#r=new cI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ia)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(!jb(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 Ia)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,Ia.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 jb(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"&&jb(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)}},dI=globalThis.process,{onExit:s3,load:vot,unload:Sot}=m0e(jb(dI)?new uI(dI):new lI)});import{addAbortListener as h0e}from"node:events";var c3,l3=y(()=>{a3();c3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=s3(()=>{t.kill()});h0e(n,()=>{i()})}});var d3,g0e,y0e,u3,_0e,f3=y(()=>{NO();P_();ss();sl();d3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=I_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=g0e(r,n,i),{sourceStream:d,sourceError:f}=_0e(t,l),{options:p,fileDescriptors:m}=Ti.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},g0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=y0e(t,e,...r),a=H_(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},y0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(u3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||CO(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]=v_(r,...n);return{destination:e(u3)(i,o,s),pipeOptions:s}}if(Ti.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}`)},u3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),_0e=(t,e)=>{try{return{sourceStream:gl(t,e)}}catch(r){return{sourceError:r}}}});var m3,b0e,fI,p3,pI=y(()=>{Uf();Nb();m3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=b0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw fI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},b0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return oI(t),n;if(e!==void 0)return iI(r),e},fI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>bl({error:t,command:p3,escapedCommand:p3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),p3="source.pipe(destination)"});var h3,g3=y(()=>{h3=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 v0e}from"node:stream/promises";var y3,S0e,w0e,x0e,Fb,$0e,k0e,_3=y(()=>{Db();G_();Nb();y3=(t,e,r)=>{let n=Fb.has(e)?w0e(t,e):S0e(t,e);return xa(t,$0e,r.signal),xa(e,k0e,r.signal),x0e(e),n},S0e=(t,e)=>{let r=Ra([t]);return wl(r,e),Fb.set(e,r),r},w0e=(t,e)=>{let r=Fb.get(e);return r.add(t),r},x0e=async t=>{try{await v0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Fb.delete(t)},Fb=new WeakMap,$0e=2,k0e=1});import{aborted as E0e}from"node:util";var b3,A0e,v3=y(()=>{pI();b3=(t,e)=>t===void 0?[]:[A0e(t,e)],A0e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await E0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw fI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var Lb,T0e,O0e,S3=y(()=>{uo();f3();pI();g3();_3();v3();Lb=(t,...e)=>{if(At(e[0]))return Lb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=d3(t,...e),i=T0e({...n,destination:r});return i.pipe=Lb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},T0e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=O0e(t,i);m3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=y3(e,o,d);return await Promise.race([h3(u),...b3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},O0e=(t,e)=>Promise.allSettled([t,e])});import{on as R0e}from"node:events";import{getDefaultHighWaterMark as I0e}from"node:stream";var zb,P0e,mI,C0e,x3,hI,w3,D0e,N0e,Ub=y(()=>{qR();Eb();GR();zb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return P0e(e,s),x3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},P0e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},mI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;C0e(e,s,t);let a=t.readableObjectMode&&!o;return x3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},C0e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},x3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=R0e(t,"data",{signal:e.signal,highWaterMark:w3,highWatermark:w3});return D0e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},hI=I0e(!0),w3=hI,D0e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=N0e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Oa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Bf(a)}},N0e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Ab(t,r,!e),kb(t,i,!n,{})].filter(Boolean)});import{setImmediate as j0e}from"node:timers/promises";var $3,M0e,F0e,L0e,gI,k3,yI=y(()=>{gb();tn();VR();Ub();Aa();qf();$3=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=M0e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([F0e(t),d]);return}let f=LR(c,r),p=mI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([L0e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},M0e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Ib({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=mI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await bW(a,t,r,o)},F0e=async t=>{await j0e(),t.readableFlowing===null&&t.resume()},L0e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await fb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await pb(r,{maxBuffer:o})):await hb(r,{maxBuffer:o})}catch(a){return k3(nV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},gI=async t=>{try{return await t}catch(e){return k3(e)}},k3=({bufferedData:t})=>KH(t)?new Uint8Array(t):t});import{finished as z0e}from"node:stream/promises";var Vf,U0e,q0e,B0e,H0e,G0e,_I,qb,E3,Bb=y(()=>{Vf=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=U0e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],z0e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||H0e(a,e,r,n)}finally{s.abort()}},U0e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&q0e(t,r,n),n},q0e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{B0e(e,r),n.call(t,...i)}},B0e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},H0e=(t,e,r,n)=>{if(!G0e(t,e,r,n))throw t},G0e=(t,e,r,n=!0)=>r.propagating?E3(t)||qb(t):(r.propagating=!0,_I(r,e)===n?E3(t):qb(t)),_I=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",qb=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",E3=t=>t?.code==="EPIPE"});var A3,bI,vI=y(()=>{yI();Bb();A3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>bI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),bI=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=Vf(t,e,l);if(_I(l,e)){await u;return}let[d]=await Promise.all([$3({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 T3,O3,Z0e,V0e,SI=y(()=>{Db();vI();T3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ra([t,e].filter(Boolean)):void 0,O3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>bI({...Z0e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:V0e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Z0e=({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}},V0e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var R3,I3,P3=y(()=>{ll();is();R3=t=>cl(t,"ipc"),I3=(t,e)=>{let r=R_(t);Ei({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var C3,D3,N3=y(()=>{Aa();P3();ho();QR();C3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=R3(o),a=mo(e,"ipc"),c=mo(r,"ipc");for await(let l of XR({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(iV(t,i,c),i.push(l)),s&&I3(l,o);return i},D3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as W0e}from"node:events";var j3,K0e,J0e,Y0e,M3=y(()=>{Ea();mR();oR();pR();po();br();yI();N3();gR();SI();vI();JR();Bb();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 _=EW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=A3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=O3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=C3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),E=K0e(h,t,S),D=J0e(m,S);try{return await Promise.race([Promise.all([{},TW(_),Promise.all(x),w,A,O9(t,d),...E,...D]),g,Y0e(t,b),...$9(t,o,f,b),...HZ({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...w9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all(x.map(B=>gI(B))),gI(w),D3(A,R),Promise.allSettled(E),Promise.allSettled(D)])}},K0e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Vf(n,i,r)),J0e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Yn(o,{checkOpen:!1})&&!Wn(o)).map(({type:i,value:o,stream:s=o})=>Vf(s,n,e,{isSameDirection:En.has(i),stopOnExit:i==="native"}))),Y0e=async(t,{signal:e})=>{let[r]=await W0e(t,"error",{signal:e});throw r}});var F3,Wf,xl,Hb=y(()=>{hl();F3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Wf=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ai();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},xl=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 L3}from"node:stream/promises";var wI,z3,xI,$I,Gb,Zb,kI=y(()=>{Bb();wI=async t=>{if(t!==void 0)try{await xI(t)}catch{}},z3=async t=>{if(t!==void 0)try{await $I(t)}catch{}},xI=async t=>{await L3(t,{cleanup:!0,readable:!1,writable:!0})},$I=async t=>{await L3(t,{cleanup:!0,readable:!0,writable:!1})},Gb=async(t,e)=>{if(await t,e)throw e},Zb=(t,e,r)=>{r&&!qb(r)?t.destroy(r):e&&t.destroy()}});import{Readable as X0e}from"node:stream";import{callbackify as Q0e}from"node:util";var U3,EI,AI,TI,e$e,OI,RI,q3,II=y(()=>{$a();ss();Ub();hl();Hb();kI();U3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||rn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=EI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=AI(a,s),{read:f,onStdoutDataDone:p}=TI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new X0e({read:f,destroy:Q0e(RI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return OI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},EI=(t,e,r)=>{let n=gl(t,e),i=Wf(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},AI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:hI},TI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ai(),s=zb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){e$e(this,s,o)},onStdoutDataDone:o}},e$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},OI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await $I(t),await n,await wI(i),await e,r.readable&&r.push(null)}catch(o){await wI(i),q3(r,o)}},RI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await xl(r,e)&&(q3(t,n),await Gb(e,n))},q3=(t,e)=>{Zb(t,t.readable,e)}});import{Writable as t$e}from"node:stream";import{callbackify as B3}from"node:util";var H3,PI,CI,r$e,n$e,DI,NI,G3,jI=y(()=>{ss();Hb();kI();H3=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=PI(t,r,e),s=new t$e({...CI(n,t,i),destroy:B3(NI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return DI(n,s),s},PI=(t,e,r)=>{let n=H_(t,e),i=Wf(r,n,"writableFinal"),o=Wf(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},CI=(t,e,r)=>({write:r$e.bind(void 0,t),final:B3(n$e.bind(void 0,t,e,r))}),r$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},n$e=async(t,e,r)=>{await xl(r,e)&&(t.writable&&t.end(),await e)},DI=async(t,e,r)=>{try{await xI(t),e.writable&&e.end()}catch(n){await z3(r),G3(e,n)}},NI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await xl(r,e),await xl(n,e)&&(G3(t,i),await Gb(e,i))},G3=(t,e)=>{Zb(t,t.writable,e)}});import{Duplex as i$e}from"node:stream";import{callbackify as o$e}from"node:util";var Z3,s$e,V3=y(()=>{$a();II();jI();Z3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||rn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=EI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=PI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=AI(c,a),{read:g,onStdoutDataDone:b}=TI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new i$e({read:g,...CI(u,t,d),destroy:o$e(s$e.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 OI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),DI(u,_,c),_},s$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([RI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),NI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var MI,a$e,W3=y(()=>{$a();ss();Ub();MI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||rn.has(e),s=gl(t,r),a=zb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return a$e(a,s,t)},a$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var K3,J3=y(()=>{Hb();II();jI();V3();W3();K3=(t,{encoding:e})=>{let r=F3();t.readable=U3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=H3.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Z3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=MI.bind(void 0,t,e),t[Symbol.asyncIterator]=MI.bind(void 0,t,e,{})}});var Y3,c$e,l$e,X3=y(()=>{Y3=(t,e)=>{for(let[r,n]of l$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},c$e=(async()=>{})().constructor.prototype,l$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(c$e,t)])});import{setMaxListeners as u$e}from"node:events";import{spawn as d$e}from"node:child_process";var Q3,f$e,p$e,m$e,h$e,g$e,eK=y(()=>{gb();GO();bR();ss();vR();eI();Uf();bb();BW();WW();qf();i3();z_();l3();S3();SI();M3();J3();hl();X3();Q3=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=f$e(t,e,r),{subprocess:f,promise:p}=m$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Lb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Y3(f,p),Ti.set(f,{options:u,fileDescriptors:d}),f},f$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=C_(t,e,r),{file:a,commandArguments:c,options:l}=sb(t,e,r),u=p$e(l),d=VW(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},p$e=({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}},m$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=d$e(...ab(t,e,r))}catch(m){return qW({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;u$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];n3(c,a,l),c3(c,r,l);let d={},f=Ai();c.kill=qZ.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=T3(c,r),K3(c,r),LW(c,r);let p=h$e({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}},h$e=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)=>yo(x,e,w)),_=yo(h,e,"all"),S=g$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return vl(S,n,e)},g$e=({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?zf({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 Oi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):_b({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Vb,y$e,_$e,tK=y(()=>{uo();ho();Vb=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,y$e(n,t[n],i)]));return{...t,...r}},y$e=(t,e,r)=>_$e.has(t)&&At(e)&&At(r)?{...e,...r}:r,_$e=new Set(["env",...zO])});var ls,b$e,v$e,rK=y(()=>{uo();NO();nG();PW();eK();tK();ls=(t,e,r,n)=>{let i=(s,a,c)=>ls(s,a,r,c),o=(...s)=>b$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},b$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(At(o))return i(t,Vb(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=v$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?IW(a,c,l):Q3(a,c,l,i)},v$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=tG(e)?rG(e,r):[e,...r],[s,a,c]=v_(...o),l=Vb(Vb(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 nK,iK,oK,S$e,w$e,sK=y(()=>{nK=({file:t,commandArguments:e})=>oK(t,e),iK=({file:t,commandArguments:e})=>({...oK(t,e),isSync:!0}),oK=(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]=S$e(t);return{file:r,commandArguments:n}},S$e=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(w$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},w$e=/ +/g});var aK,cK,x$e,lK,$$e,uK,dK=y(()=>{aK=(t,e,r)=>{t.sync=e(x$e,r),t.s=t.sync},cK=({options:t})=>lK(t),x$e=({options:t})=>({...lK(t),isSync:!0}),lK=t=>({options:{...$$e(t),...t}}),$$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},uK={preferLocal:!0}});var uct,Je,dct,fct,pct,mct,hct,gct,yct,_ct,jr=y(()=>{rK();sK();hR();dK();eI();uct=ls(()=>({})),Je=ls(()=>({isSync:!0})),dct=ls(nK),fct=ls(iK),pct=ls(E9),mct=ls(cK,{},uK,aK),{sendMessage:hct,getOneMessage:gct,getEachMessage:yct,getCancelSignal:_ct}=zW()});import{existsSync as Wb,statSync as k$e}from"node:fs";import{dirname as FI,extname as E$e,isAbsolute as fK,join as LI,relative as zI,resolve as Kb,sep as A$e}from"node:path";function Jb(t){return t==="./gradlew"||t==="gradle"}function T$e(t){return(Wb(LI(t,"build.gradle.kts"))||Wb(LI(t,"build.gradle")))&&Wb(LI(t,"gradle.properties"))}function O$e(t,e){let n=zI(t,e).split(A$e).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function us(t,e){return t===":"?`:${e}`:`${t}:${e}`}function R$e(t,e){let r=Kb(t,e),n=r;Wb(r)?k$e(r).isFile()&&(n=FI(r)):E$e(r)!==""&&(n=FI(r));let i=zI(t,n);if(i.startsWith("..")||fK(i))return null;let o=n;for(;;){if(T$e(o))return o;if(Kb(o)===Kb(t))return null;let s=FI(o);if(s===o)return null;let a=zI(t,s);if(a.startsWith("..")||fK(a))return null;o=s}}function Yb(t,e){let r=Kb(t),n=new Map,i=[];for(let o of e){let s=R$e(r,o);if(!s){i.push(o);continue}let a=O$e(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 Xb=y(()=>{"use strict"});import{existsSync as I$e,readFileSync as P$e}from"node:fs";import{join as C$e}from"node:path";function $l(t="."){let e=C$e(t,".cladding","config.yaml");if(!I$e(e))return UI;try{let n=(0,pK.parse)(P$e(e,"utf8"))?.gate;if(!n)return UI;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 D$e){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 UI}}function mK(t,e){let r=[],n=!1;for(let i of t){let o=N$e.exec(i);if(o){n=!0;for(let s of e)r.push(us(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 pK,D$e,UI,N$e,Qb=y(()=>{"use strict";pK=bt(Xt(),1);Xb();D$e=["type","lint","test","coverage"],UI={scope:"feature"};N$e=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as BI,readFileSync as hK,readdirSync as j$e,statSync as M$e}from"node:fs";import{join as ev}from"node:path";function ZI(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=ev(t,e);if(BI(r))try{if(gK.test(hK(r,"utf8")))return!0}catch{}}return!1}function yK(t){try{return BI(t)&&gK.test(hK(t,"utf8"))}catch{return!1}}function _K(t,e=0){if(e>4||!BI(t))return!1;let r;try{r=j$e(t)}catch{return!1}for(let n of r){let i=ev(t,n),o=!1;try{o=M$e(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(_K(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&yK(i))return!0}return!1}function z$e(t){if(ZI(t))return!0;for(let e of F$e)if(yK(ev(t,e)))return!0;for(let e of L$e)if(_K(ev(t,e)))return!0;return!1}function bK(t="."){let e=$l(t).coverage;return e||(z$e(t)?"kover":"jacoco")}function vK(t="."){return HI[bK(t)]}function SK(t="."){return qI[bK(t)]}var HI,qI,GI,gK,F$e,L$e,tv=y(()=>{"use strict";Qb();HI={kover:"koverXmlReport",jacoco:"jacocoTestReport"},qI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},GI=[qI.kover,qI.jacoco],gK=/kover/i;F$e=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],L$e=["buildSrc","build-logic"]});import{existsSync as rv,readFileSync as wK,readdirSync as xK}from"node:fs";import{join as Pa}from"node:path";function VI(t){return rv(Pa(t,"gradlew"))?"./gradlew":"gradle"}function U$e(t){let e=VI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[vK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function q$e(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(wK(Pa(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 H$e(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function V$e(t,e){for(let r of e)if(rv(Pa(t,r)))return r}function W$e(t,e){try{return xK(t).find(n=>n.endsWith(e))}catch{return}}function J$e(t,e){for(let r of K$e)if(r.configs.some(n=>rv(Pa(t,n))))return r.gate;return e}function X$e(t){if(Y$e.some(e=>rv(Pa(t,e))))return!0;try{return JSON.parse(wK(Pa(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function Q$e(t,e){let r=e.lint?{...e,lint:J$e(t,e.lint)}:{...e};return e.test&&e.coverage&&X$e(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function ut(t="."){for(let e of G$e){let r;for(let o of e.manifests)if(o.startsWith(".")?r=W$e(t,o):r=V$e(t,[o]),r)break;if(!r||e.requiresSource&&!H$e(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Q$e(t,n):n;return{language:e.language,manifest:r,gates:i}}return Z$e}var B$e,G$e,Z$e,K$e,Y$e,nn=y(()=>{"use strict";tv();B$e=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);G$e=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:U$e},{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:q$e}],Z$e={language:"unknown",manifest:"",gates:{}};K$e=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];Y$e=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as eke,readFileSync as tke}from"node:fs";import{join as rke}from"node:path";function Ca(t){return t.code==="ENOENT"}function nv(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=(o||s||`exit ${i}`).slice(0,200);return $K.test(o)||$K.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Lt(t,e,r){return Ca(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function Qt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function kl(t,e){let r=rke(t,"package.json");if(!eke(r))return!1;try{return!!JSON.parse(tke(r,"utf8")).scripts?.[e]}catch{return!1}}var $K,An=y(()=>{"use strict";$K=/config (is |file )?not found|no such file|ENOENT|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 nke(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.arch;if(!n)return[{detector:iv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Ca(i)?[{detector:iv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:nv(i,iv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var iv,Da,ov=y(()=>{"use strict";jr();nn();An();iv="ARCHITECTURE_VIOLATION";Da={name:iv,subprocess:!0,run:nke}});function ike(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.secret;if(!n)return[{detector:sv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Ca(i)?[{detector:sv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:nv(i,sv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var sv,Na,av=y(()=>{"use strict";jr();nn();An();sv="HARDCODED_SECRET";Na={name:sv,subprocess:!0,run:ike}});import{existsSync as WI,readdirSync as kK}from"node:fs";import{join as cv}from"node:path";function ske(t,e){let r=cv(t,e.path);if(!WI(r))return!0;if(e.isDirectory)try{return kK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function ake(t){let{cwd:e="."}=t,r=[];for(let i of oke)ske(e,i)&&r.push({detector:Kf,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=cv(e,"spec.yaml");if(WI(n)){let i=uke(n),o=i?null:cke(e);if(i)r.push({detector:Kf,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:Kf,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=lke(e);s&&r.push({detector:Kf,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 cke(t){for(let e of["spec/features","spec/scenarios"]){let r=cv(t,e);if(!WI(r))continue;let n;try{n=kK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{xi(cv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function lke(t){try{return G(t),null}catch(e){return e.message}}function uke(t){let e;try{e=xi(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Kf,oke,EK,AK=y(()=>{"use strict";qe();u_();Kf="ABSENCE_OF_GOVERNANCE",oke=[{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}];EK={name:Kf,run:ake}});function lv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function KI(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=lv(r)==="while",o=fke.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 '${lv(r)}'`}let n=dke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:lv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${lv(r)}'`:null}function pke(t,e){let r=KI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function TK(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...pke(r,n));return e}var dke,fke,JI=y(()=>{"use strict";dke={event:"when",state:"while",optional:"where",unwanted:"if"},fke=/\bwhen\b/i});function he(t,e,r){let n;try{n=G(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var vt=y(()=>{"use strict";qe()});function mke(t){let{cwd:e="."}=t;return he(e,uv,hke)}function hke(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:uv,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 TK(t.features))e.push({detector:uv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var uv,OK,RK=y(()=>{"use strict";JI();vt();uv="AC_DRIFT";OK={name:uv,run:mke}});function Ii(t=".",e){let n=(e??"").trim().toLowerCase()||ut(t).language;return PK[n]??IK}var gke,yke,_ke,IK,bke,vke,PK,Ske,CK,ja=y(()=>{"use strict";nn();gke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,yke=/^[ \t]*import\s+([\w.]+)/gm,_ke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,IK={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:gke,importStyle:"relative"},bke={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:yke,importStyle:"dotted"},vke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:_ke,importStyle:"dotted"},PK={typescript:IK,kotlin:bke,python:vke},Ske=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],CK=new Set([...Object.values(PK).flatMap(t=>t?.extensions??[]),...Ske].map(t=>t.toLowerCase()))});import{existsSync as wke,readFileSync as xke,readdirSync as $ke,statSync as kke}from"node:fs";import{join as NK,relative as DK}from"node:path";function Eke(t,e){if(!wke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=$ke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=NK(i,s),c;try{c=kke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function Ake(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function Oke(t){return Tke.test(t)}function Rke(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Ii(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Eke(NK(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=xke(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";qe();ja();jK="AI_HINTS_FORBIDDEN_PATTERN";Tke=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;MK={name:jK,run:Rke}});function Ike(t){let{cwd:e="."}=t,r;try{r=G(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:LK,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var LK,zK,UK=y(()=>{"use strict";qe();LK="AC_DUPLICATE_WITHIN_FEATURE";zK={name:LK,run:Ike}});import{createRequire as Pke}from"module";import{basename as Cke,dirname as XI,normalize as Dke,relative as Nke,resolve as jke,sep as HK}from"path";import*as Mke from"fs";function Fke(t){let e=Dke(t);return e.length>1&&e[e.length-1]===HK&&(e=e.substring(0,e.length-1)),e}function GK(t,e){return t.replace(Lke,e)}function Uke(t){return t==="/"||zke.test(t)}function YI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=jke(t)),(n||o)&&(t=Fke(t)),t===".")return"";let s=t[t.length-1]!==i;return GK(s?t+i:t,i)}function ZK(t,e){return e+t}function qke(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:GK(Nke(t,n),e.pathSeparator)+e.pathSeparator+r}}function Bke(t){return t}function Hke(t,e,r){return e+t+r}function Gke(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?qke(t,e):n?ZK:Bke}function Zke(t){return function(e,r){r.push(e.substring(t.length)||".")}}function Vke(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function Yke(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?Vke(t):Zke(t):n&&n.length?Kke:Wke:Jke}function nEe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?rEe:r&&r.length?n?Xke:Qke:n?eEe:tEe}function sEe(t){return t.group?oEe:iEe}function lEe(t){return t.group?aEe:cEe}function fEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?dEe:uEe}function VK(t,e,r){if(r.options.useRealPaths)return pEe(e,r);let n=XI(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=XI(n)}return r.symlinks.set(t,e),i>1}function pEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function dv(t,e,r,n){e(t&&!n?t:null,r)}function wEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?mEe:_Ee:n?e?hEe:SEe:i?e?yEe:vEe:e?gEe:bEe}function kEe(t){return t?$Ee:xEe}function OEe(t,e){return new Promise((r,n)=>{JK(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function JK(t,e,r){new KK(t,e,r).start()}function REe(t,e){return new KK(t,e).start()}var qK,Lke,zke,Wke,Kke,Jke,Xke,Qke,eEe,tEe,rEe,iEe,oEe,aEe,cEe,uEe,dEe,mEe,hEe,gEe,yEe,_Ee,bEe,vEe,SEe,WK,xEe,$Ee,EEe,AEe,TEe,KK,BK,YK,XK,QK=y(()=>{qK=Pke(import.meta.url);Lke=/[\\/]/g;zke=/^[a-z]:[\\/]$/i;Wke=(t,e)=>{e.push(t||".")},Kke=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},Jke=()=>{};Xke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},Qke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},eEe=(t,e,r,n)=>{r.files++},tEe=(t,e)=>{e.push(t)},rEe=()=>{};iEe=t=>t,oEe=()=>[""].slice(0,0);aEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},cEe=()=>{};uEe=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()&&VK(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},dEe=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()&&VK(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};mEe=t=>t.counts,hEe=t=>t.groups,gEe=t=>t.paths,yEe=t=>t.paths.slice(0,t.options.maxFiles),_Ee=(t,e,r)=>(dv(e,r,t.counts,t.options.suppressErrors),null),bEe=(t,e,r)=>(dv(e,r,t.paths,t.options.suppressErrors),null),vEe=(t,e,r)=>(dv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),SEe=(t,e,r)=>(dv(e,r,t.groups,t.options.suppressErrors),null);WK={withFileTypes:!0},xEe=(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||".",WK,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},$Ee=(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||".",WK)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};EEe=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))}},AEe=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}},TEe=class{aborted=!1;abort(){this.aborted=!0}},KK=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=wEe(e,this.isSynchronous),this.root=YI(t,e),this.state={root:Uke(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new AEe,options:e,queue:new EEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new TEe,fs:e.fs||Mke},this.joinPath=Gke(this.root,e),this.pushDirectory=Yke(this.root,e),this.pushFile=nEe(e),this.getArray=sEe(e),this.groupFiles=lEe(e),this.resolveSymlink=fEe(e,this.isSynchronous),this.walkDirectory=kEe(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(_=YI(_,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=Cke(_),x=YI(XI(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};BK=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return OEe(this.root,this.options)}withCallback(t){JK(this.root,this.options,t)}sync(){return REe(this.root,this.options)}},YK=null;try{qK.resolve("picomatch"),YK=qK("picomatch")}catch{}XK=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:HK,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 BK(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new BK(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||YK;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 Jf=v((Slt,iJ)=>{"use strict";var eJ="[^\\\\/]",IEe="(?=.)",tJ="[^/]",QI="(?:\\/|$)",rJ="(?:^|\\/)",eP=`\\.{1,2}${QI}`,PEe="(?!\\.)",CEe=`(?!${rJ}${eP})`,DEe=`(?!\\.{0,1}${QI})`,NEe=`(?!${eP})`,jEe="[^.\\/]",MEe=`${tJ}*?`,FEe="/",nJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:IEe,QMARK:tJ,END_ANCHOR:QI,DOTS_SLASH:eP,NO_DOT:PEe,NO_DOTS:CEe,NO_DOT_SLASH:DEe,NO_DOTS_SLASH:NEe,QMARK_NO_DOT:jEe,STAR:MEe,START_ANCHOR:rJ,SEP:FEe},LEe={...nJ,SLASH_LITERAL:"[\\\\/]",QMARK:eJ,STAR:`${eJ}*?`,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:"\\"},zEe={__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"};iJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:zEe,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?LEe:nJ}}});var Yf=v(Mr=>{"use strict";var{REGEX_BACKSLASH:UEe,REGEX_REMOVE_BACKSLASH:qEe,REGEX_SPECIAL_CHARS:BEe,REGEX_SPECIAL_CHARS_GLOBAL:HEe}=Jf();Mr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Mr.hasRegexChars=t=>BEe.test(t);Mr.isRegexChar=t=>t.length===1&&Mr.hasRegexChars(t);Mr.escapeRegex=t=>t.replace(HEe,"\\$1");Mr.toPosixSlashes=t=>t.replace(UEe,"/");Mr.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};Mr.removeBackslashes=t=>t.replace(qEe,e=>e==="\\"?"":e);Mr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Mr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Mr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Mr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Mr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var fJ=v((xlt,dJ)=>{"use strict";var oJ=Yf(),{CHAR_ASTERISK:tP,CHAR_AT:GEe,CHAR_BACKWARD_SLASH:Xf,CHAR_COMMA:ZEe,CHAR_DOT:rP,CHAR_EXCLAMATION_MARK:nP,CHAR_FORWARD_SLASH:uJ,CHAR_LEFT_CURLY_BRACE:iP,CHAR_LEFT_PARENTHESES:oP,CHAR_LEFT_SQUARE_BRACKET:VEe,CHAR_PLUS:WEe,CHAR_QUESTION_MARK:sJ,CHAR_RIGHT_CURLY_BRACE:KEe,CHAR_RIGHT_PARENTHESES:aJ,CHAR_RIGHT_SQUARE_BRACKET:JEe}=Jf(),cJ=t=>t===uJ||t===Xf,lJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},YEe=(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,E,D={value:"",depth:0,isGlob:!1},k=()=>l>=n,B=()=>c.charCodeAt(l+1),Q=()=>(A=E,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),Se&&m===!0&&d>0?(Se=c.slice(0,d),C=c.slice(d)):m===!0?(Se="",C=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&cJ(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),r.unescape===!0&&(C&&(C=oJ.removeBackslashes(C)),Se&&_===!0&&(Se=oJ.removeBackslashes(Se)));let Rr={prefix:P,input:t,start:u,base:Se,glob:C,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Rr.maxDepth=0,cJ(E)||s.push(D),Rr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var Qf=Jf(),on=Yf(),{MAX_LENGTH:fv,POSIX_REGEX_SOURCE:XEe,REGEX_NON_SPECIAL_CHARS:QEe,REGEX_SPECIAL_CHARS_BACKREF:eAe,REPLACEMENTS:pJ}=Qf,tAe=(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=>on.escapeRegex(i)).join("..")}return r},El=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,mJ=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},rAe=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},hJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(rAe(e))return e.replace(/\\(.)/g,"$1")},nAe=t=>{let e=t.map(hJ).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}}}}},iAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=hJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?on.escapeRegex(r[0]):`[${r.map(i=>on.escapeRegex(i)).join("")}]`}*`},oAe=t=>{let e=0,r=t.trim(),n=sP(r);for(;n;)e++,r=n.body.trim(),n=sP(r);return e},sAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Qf.DEFAULT_MAX_EXTGLOB_RECURSION,n=mJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||nAe(n)))return{risky:!0};for(let i of n){let o=iAe(i);if(o)return{risky:!0,safeOutput:o};if(oAe(i)>r)return{risky:!0}}return{risky:!1}},aP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=pJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(fv,r.maxLength):fv,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=Qf.globChars(r.windows),l=Qf.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=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,A=r.dot?"":h,E=r.dot?_:S,D=r.bash===!0?R(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let k={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=on.removePrefix(t,k),i=t.length;let B=[],Q=[],Se=[],P=o,C,Rr=()=>k.index===i-1,se=k.peek=(H=1)=>t[k.index+H],Pe=k.advance=()=>t[++k.index]||"",Vt=()=>t.slice(k.index+1),lr=(H="",pt=0)=>{k.consumed+=H,k.index+=pt},Jt=H=>{k.output+=H.output!=null?H.output:H.value,lr(H.value)},no=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),k.start++,H++;return H%2===0?!1:(k.negated=!0,k.start++,!0)},_i=H=>{k[H]++,Se.push(H)},Jr=H=>{k[H]--,Se.pop()},de=H=>{if(P.type==="globstar"){let pt=k.braces>0&&(H.type==="comma"||H.type==="brace"),q=H.extglob===!0||B.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!pt&&!q&&(k.output=k.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=D,k.output+=P.output)}if(B.length&&H.type!=="paren"&&(B[B.length-1].inner+=H.value),(H.value||H.output)&&Jt(H),P&&P.type==="text"&&H.type==="text"){P.output=(P.output||P.value)+H.value,P.value+=H.value;return}H.prev=P,s.push(H),P=H},io=(H,pt)=>{let q={...l[pt],conditions:1,inner:""};q.prev=P,q.parens=k.parens,q.output=k.output,q.startIndex=k.index,q.tokensIndex=s.length;let Te=(r.capture?"(":"")+q.open;_i("parens"),de({type:H,value:pt,output:k.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Te}),B.push(q)},Lue=H=>{let pt=t.slice(H.startIndex,k.index+1),q=t.slice(H.startIndex+2,k.index),Te=sAe(q,r);if((H.type==="plus"||H.type==="star")&&Te.risky){let ct=Te.safeOutput?(H.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,bi=s[H.tokensIndex];bi.type="text",bi.value=pt,bi.output=ct||on.escapeRegex(pt);for(let vi=H.tokensIndex+1;vi1&&H.inner.includes("/")&&(ct=R(r)),(ct!==D||Rr()||/^\)+$/.test(Vt()))&&(lt=H.close=`)$))${ct}`),H.inner.includes("*")&&(jt=Vt())&&/^\.[^\\/.]+$/.test(jt)){let bi=aP(jt,{...e,fastpaths:!1}).output;lt=H.close=`)${bi})${ct})`}H.prev.type==="bos"&&(k.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:C,output:lt}),Jr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,pt=t.replace(eAe,(q,Te,lt,jt,ct,bi)=>jt==="\\"?(H=!0,q):jt==="?"?Te?Te+jt+(ct?_.repeat(ct.length):""):bi===0?E+(ct?_.repeat(ct.length):""):_.repeat(lt.length):jt==="."?u.repeat(lt.length):jt==="*"?Te?Te+jt+(ct?D:""):D:Te?q:`\\${q}`);return H===!0&&(r.unescape===!0?pt=pt.replace(/\\/g,""):pt=pt.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),pt===t&&r.contains===!0?(k.output=t,k):(k.output=on.wrapOutput(pt,k,e),k)}for(;!Rr();){if(C=Pe(),C==="\0")continue;if(C==="\\"){let q=se();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){C+="\\",de({type:"text",value:C});continue}let Te=/^\\+/.exec(Vt()),lt=0;if(Te&&Te[0].length>2&&(lt=Te[0].length,k.index+=lt,lt%2!==0&&(C+="\\")),r.unescape===!0?C=Pe():C+=Pe(),k.brackets===0){de({type:"text",value:C});continue}}if(k.brackets>0&&(C!=="]"||P.value==="["||P.value==="[^")){if(r.posix!==!1&&C===":"){let q=P.value.slice(1);if(q.includes("[")&&(P.posix=!0,q.includes(":"))){let Te=P.value.lastIndexOf("["),lt=P.value.slice(0,Te),jt=P.value.slice(Te+2),ct=XEe[jt];if(ct){P.value=lt+ct,k.backtrack=!0,Pe(),!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,Jt({value:C});continue}if(k.quotes===1&&C!=='"'){C=on.escapeRegex(C),P.value+=C,Jt({value:C});continue}if(C==='"'){k.quotes=k.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:C});continue}if(C==="("){_i("parens"),de({type:"paren",value:C});continue}if(C===")"){if(k.parens===0&&r.strictBrackets===!0)throw new SyntaxError(El("opening","("));let q=B[B.length-1];if(q&&k.parens===q.parens+1){Lue(B.pop());continue}de({type:"paren",value:C,output:k.parens?")":"\\)"}),Jr("parens");continue}if(C==="["){if(r.nobracket===!0||!Vt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(El("closing","]"));C=`\\${C}`}else _i("brackets");de({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){de({type:"text",value:C,output:`\\${C}`});continue}if(k.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(El("opening","["));de({type:"text",value:C,output:`\\${C}`});continue}Jr("brackets");let q=P.value.slice(1);if(P.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(C=`/${C}`),P.value+=C,Jt({value:C}),r.literalBrackets===!1||on.hasRegexChars(q))continue;let Te=on.escapeRegex(P.value);if(k.output=k.output.slice(0,-P.value.length),r.literalBrackets===!0){k.output+=Te,P.value=Te;continue}P.value=`(${a}${Te}|${P.value})`,k.output+=P.value;continue}if(C==="{"&&r.nobrace!==!0){_i("braces");let q={type:"brace",value:C,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};Q.push(q),de(q);continue}if(C==="}"){let q=Q[Q.length-1];if(r.nobrace===!0||!q){de({type:"text",value:C,output:C});continue}let Te=")";if(q.dots===!0){let lt=s.slice(),jt=[];for(let ct=lt.length-1;ct>=0&&(s.pop(),lt[ct].type!=="brace");ct--)lt[ct].type!=="dots"&&jt.unshift(lt[ct].value);Te=tAe(jt,r),k.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let lt=k.output.slice(0,q.outputIndex),jt=k.tokens.slice(q.tokensIndex);q.value=q.output="\\{",C=Te="\\}",k.output=lt;for(let ct of jt)k.output+=ct.output||ct.value}de({type:"brace",value:C,output:Te}),Jr("braces"),Q.pop();continue}if(C==="|"){B.length>0&&B[B.length-1].conditions++,de({type:"text",value:C});continue}if(C===","){let q=C,Te=Q[Q.length-1];Te&&Se[Se.length-1]==="braces"&&(Te.comma=!0,q="|"),de({type:"comma",value:C,output:q});continue}if(C==="/"){if(P.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",s.pop(),P=o;continue}de({type:"slash",value:C,output:f});continue}if(C==="."){if(k.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let q=Q[Q.length-1];P.type="dots",P.output+=C,P.value+=C,q.dots=!0;continue}if(k.braces+k.parens===0&&P.type!=="bos"&&P.type!=="slash"){de({type:"text",value:C,output:u});continue}de({type:"dot",value:C,output:u});continue}if(C==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){io("qmark",C);continue}if(P&&P.type==="paren"){let Te=se(),lt=C;(P.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Vt()))&&(lt=`\\${C}`),de({type:"text",value:C,output:lt});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){de({type:"qmark",value:C,output:S});continue}de({type:"qmark",value:C,output:_});continue}if(C==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){io("negate",C);continue}if(r.nonegate!==!0&&k.index===0){no();continue}}if(C==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){io("plus",C);continue}if(P&&P.value==="("||r.regex===!1){de({type:"plus",value:C,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||k.parens>0){de({type:"plus",value:C});continue}de({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:C,output:""});continue}de({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let q=QEe.exec(Vt());q&&(C+=q[0],k.index+=q[0].length),de({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,k.backtrack=!0,k.globstar=!0,lr(C);continue}let H=Vt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){io("star",C);continue}if(P.type==="star"){if(r.noglobstar===!0){lr(C);continue}let q=P.prev,Te=q.prev,lt=q.type==="slash"||q.type==="bos",jt=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!lt||H[0]&&H[0]!=="/")){de({type:"star",value:C,output:""});continue}let ct=k.braces>0&&(q.type==="comma"||q.type==="brace"),bi=B.length&&(q.type==="pipe"||q.type==="paren");if(!lt&&q.type!=="paren"&&!ct&&!bi){de({type:"star",value:C,output:""});continue}for(;H.slice(0,3)==="/**";){let vi=t[k.index+4];if(vi&&vi!=="/")break;H=H.slice(3),lr("/**",3)}if(q.type==="bos"&&Rr()){P.type="globstar",P.value+=C,P.output=R(r),k.output=P.output,k.globstar=!0,lr(C);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!jt&&Rr()){k.output=k.output.slice(0,-(q.output+P.output).length),q.output=`(?:${q.output}`,P.type="globstar",P.output=R(r)+(r.strictSlashes?")":"|$)"),P.value+=C,k.globstar=!0,k.output+=q.output+P.output,lr(C);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&H[0]==="/"){let vi=H[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(q.output+P.output).length),q.output=`(?:${q.output}`,P.type="globstar",P.output=`${R(r)}${f}|${f}${vi})`,P.value+=C,k.output+=q.output+P.output,k.globstar=!0,lr(C+Pe()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&H[0]==="/"){P.type="globstar",P.value+=C,P.output=`(?:^|${f}|${R(r)}${f})`,k.output=P.output,k.globstar=!0,lr(C+Pe()),de({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-P.output.length),P.type="globstar",P.output=R(r),P.value+=C,k.output+=P.output,k.globstar=!0,lr(C);continue}let pt={type:"star",value:C,output:D};if(r.bash===!0){pt.output=".*?",(P.type==="bos"||P.type==="slash")&&(pt.output=A+pt.output),de(pt);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){pt.output=C,de(pt);continue}(k.index===k.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(k.output+=g,P.output+=g):r.dot===!0?(k.output+=b,P.output+=b):(k.output+=A,P.output+=A),se()!=="*"&&(k.output+=p,P.output+=p)),de(pt)}for(;k.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(El("closing","]"));k.output=on.escapeLast(k.output,"["),Jr("brackets")}for(;k.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(El("closing",")"));k.output=on.escapeLast(k.output,"("),Jr("parens")}for(;k.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(El("closing","}"));k.output=on.escapeLast(k.output,"{"),Jr("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),k.backtrack===!0){k.output="";for(let H of k.tokens)k.output+=H.output!=null?H.output:H.value,H.suffix&&(k.output+=H.suffix)}return k};aP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(fv,r.maxLength):fv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=pJ[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}=Qf.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 E=/^(.*?)\.(\w+)$/.exec(A);if(!E)return;let D=x(E[1]);return D?D+o+E[2]:void 0}}},w=on.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};gJ.exports=aP});var vJ=v((klt,bJ)=>{"use strict";var aAe=fJ(),cP=yJ(),_J=Yf(),cAe=Jf(),lAe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=lAe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?_J.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(_J.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):cP(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>aAe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=cP.fastpaths(t,e)),i.output||(i=cP(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=cAe;bJ.exports=Tt});var $J=v((Elt,xJ)=>{"use strict";var SJ=vJ(),uAe=Yf();function wJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:uAe.isWindows()}),SJ(t,e,r)}Object.assign(wJ,SJ);xJ.exports=wJ});import{readdir as dAe,readdirSync as fAe,realpath as pAe,realpathSync as mAe,stat as hAe,statSync as gAe}from"fs";import{isAbsolute as yAe,posix as Ma,resolve as _Ae}from"path";import{fileURLToPath as bAe}from"url";function wAe(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]===".."&&SAe.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=>Ma.relative(t,n)||".":n=>Ma.relative(t,`${e}/${n}`)||"."}function kAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ma.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function TJ(t){var e;let r=Al.default.scan(t,EAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function PAe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Al.default.scan(t);return r.isGlob||r.negated}function ep(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function OJ(t){return typeof t=="string"?[t]:t??[]}function lP(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=IAe(o);s=yAe(s.replace(DAe,""))?Ma.relative(a,s):Ma.normalize(s);let c=(i=CAe.exec(s))===null||i===void 0?void 0:i[0],l=TJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?Ma.join(o,...d):o}return s}function NAe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(lP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(lP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(lP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function jAe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=NAe(t,e,n);t.debug&&ep("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(EJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Al.default)(i.match,f),m=(0,Al.default)(i.ignore,f),h=wAe(i.match,f),g=kJ(r,d,o),b=o?g:kJ(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 XK({filters:[a?(w,R)=>{let A=g(w,R),E=p(A)&&!m(A);return E&&ep(`matched ${A}`),E}:(w,R)=>{let A=g(w,R);return p(A)&&!m(A)}],exclude:a?(w,R)=>{let A=_(w,R);return ep(`${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&&ep("internal properties:",{...n,root:d}),[x,r!==d&&!o&&kAe(r,d)]}function MAe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function LAe(t){let e={...FAe,...t};return e.cwd=(e.cwd instanceof URL?bAe(e.cwd):_Ae(e.cwd)).replace(EJ,"/"),e.ignore=OJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||dAe,readdirSync:e.fs.readdirSync||fAe,realpath:e.fs.realpath||pAe,realpathSync:e.fs.realpathSync||mAe,stat:e.fs.stat||hAe,statSync:e.fs.statSync||gAe}),e.debug&&ep("globbing with options:",e),e}function zAe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=vAe(t)||typeof t=="string",i=OJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=LAe(n?e:t);return i.length>0?jAe(o,i):[]}function ds(t,e){let[r,n]=zAe(t,e);return r?MAe(r.sync(),n):[]}var Al,vAe,EJ,AJ,SAe,xAe,$Ae,EAe,AAe,TAe,OAe,RAe,IAe,CAe,DAe,FAe,tp=y(()=>{QK();Al=bt($J(),1),vAe=Array.isArray,EJ=/\\/g,AJ=process.platform==="win32",SAe=/^(\/?\.\.)+$/;xAe=/^[A-Z]:\/$/i,$Ae=AJ?t=>xAe.test(t):t=>t==="/";EAe={parts:!0};AAe=/(?t.replace(AAe,"\\$&"),RAe=t=>t.replace(TAe,"\\$&"),IAe=AJ?RAe:OAe;CAe=/^(\/?\.\.)+/,DAe=/\\(?=[()[\]{}!*+?@|])/g;FAe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as rp,readFileSync as UAe,readdirSync as qAe,statSync as RJ}from"node:fs";import{join as Fa}from"node:path";function BAe(t){let{cwd:e="."}=t,r,n;try{let c=G(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Ii(e,n),o=[],{layers:s,forbiddenImports:a}=uP(r);return(s.size>0||a.length>0)&&!rp(Fa(e,i.mainRoot))?[{detector:np,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&&(HAe(e,i,s,o),GAe(e,i,s,o)),a.length>0&&ZAe(e,i,a,o),o)}function uP(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 HAe(t,e,r,n){let i=e.mainRoot,o=Fa(t,i);if(rp(o))for(let s of qAe(o)){let a=Fa(o,s);RJ(a).isDirectory()&&(r.has(s)||n.push({detector:np,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function GAe(t,e,r,n){let i=e.mainRoot,o=Fa(t,i);if(rp(o))for(let s of r){let a=Fa(o,s);rp(a)&&RJ(a).isDirectory()||n.push({detector:np,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 ZAe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Fa(t,i,s.from);if(!rp(a))continue;let c=ds([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Fa(a,l),d;try{d=UAe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];VAe(p,s.to,e.importStyle)&&n.push({detector:np,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 VAe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var np,IJ,dP=y(()=>{"use strict";tp();qe();ja();np="ARCHITECTURE_FROM_SPEC";IJ={name:np,run:BAe}});import{existsSync as WAe,readFileSync as KAe}from"node:fs";import{join as JAe}from"node:path";function YAe(t){let{cwd:e="."}=t,r=JAe(e,"spec/capabilities.yaml");if(!WAe(r))return[];let n;try{let c=KAe(r,"utf8"),l=PJ.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=G(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:pv,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:pv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:pv,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var PJ,pv,CJ,DJ=y(()=>{"use strict";PJ=bt(Xt(),1);qe();pv="CAPABILITIES_FEATURE_MAPPING";CJ={name:pv,run:YAe}});import{existsSync as XAe,readFileSync as QAe}from"node:fs";import{join as eTe}from"node:path";function tTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function rTe(t){let{cwd:e="."}=t;return he(e,fP,r=>nTe(r,e))}function nTe(t,e){let r=Ii(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=eTe(e,o);if(!XAe(s))continue;let a=QAe(s,"utf8");tTe(a)||n.push({detector:fP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var fP,NJ,jJ=y(()=>{"use strict";ja();vt();fP="CONVENTION_DRIFT";NJ={name:fP,run:rTe}});import{existsSync as pP,readFileSync as MJ}from"node:fs";import{join as mv}from"node:path";function iTe(t){return JSON.parse(t).total?.lines?.pct??0}function FJ(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function aTe(t,e){if(!Jb(ut(t).gates.coverage?.cmd))return null;let r;try{r=Yb(t,e)}catch(c){return[{detector:_o,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=GI.find(d=>pP(mv(c.dir,d)));if(!l){s.push(c.path);continue}let u=FJ(MJ(mv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:_o,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=LJ(n,i);return a0?[{detector:_o,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function cTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=aTe(e,t.focusModules);if(a)return a}let r;try{r=G(e).project?.language}catch{}let n=Ii(e,r),i=ut(e).language==="kotlin"?GI.find(a=>pP(mv(e,a)))??SK(e):n.coverageSummary,o=mv(e,i);if(!pP(o))return[{detector:_o,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=MJ(o,"utf8");s=n.coverageFormat==="jacoco-xml"?oTe(a):n.coverageFormat==="cobertura-xml"?sTe(a):iTe(a)}catch(a){return[{detector:_o,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:_o,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=hv?[]:[{detector:_o,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${hv}%`}]}var _o,hv,zJ,UJ=y(()=>{"use strict";qe();tv();ja();Xb();nn();_o="COVERAGE_DROP",hv=70;zJ={name:_o,run:cTe}});import{existsSync as lTe}from"node:fs";import{join as uTe}from"node:path";function dTe(t){let{cwd:e="."}=t;return he(e,gv,r=>fTe(r,e))}function fTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?lTe(uTe(e,r.path))?[]:[{detector:gv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:gv,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var gv,qJ,BJ=y(()=>{"use strict";vt();gv="DELIVERABLE_INTEGRITY";qJ={name:gv,run:dTe}});function pTe(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 mTe(t){let e=pTe(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 hTe(t){let{cwd:e="."}=t;return he(e,yv,r=>mTe(r))}var yv,HJ,GJ=y(()=>{"use strict";vt();yv="SMOKE_PROBE_DEMAND";HJ={name:yv,run:hTe}});function gTe(t){let{cwd:e="."}=t;return he(e,_v,r=>yTe(r,e))}function yTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=rs(e);if(n===null)return[{detector:_v,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=g_(n,e,o);s.state!=="fresh"&&i.push({detector:_v,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 _v,bv,mP=y(()=>{"use strict";nl();vt();_v="STALE_ATTESTATION";bv={name:_v,run:gTe}});function _Te(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}return bTe(r)}function bTe(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:ZJ,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 ZJ,vv,hP=y(()=>{"use strict";qe();ZJ="DEPENDENCY_CYCLE";vv={name:ZJ,run:_Te}});import{appendFileSync as vTe,existsSync as VJ,mkdirSync as STe,readFileSync as wTe}from"node:fs";import{dirname as xTe,join as $Te}from"node:path";function WJ(t){return $Te(t,kTe,ETe)}function KJ(t){return gP.add(t),()=>gP.delete(t)}function La(t,e){let r=WJ(t),n=xTe(r);VJ(n)||STe(n,{recursive:!0}),vTe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of gP)try{i(t,e)}catch{}}function Tn(t){let e=WJ(t);if(!VJ(e))return[];let r=wTe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var kTe,ETe,gP,Xn=y(()=>{"use strict";kTe=".cladding",ETe="audit.log.jsonl";gP=new Set});import{existsSync as ATe}from"node:fs";import{join as TTe}from"node:path";function OTe(t){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return[{detector:yP,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&&(ATe(TTe(e,i.artifact))||n.push({detector:yP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var yP,JJ,YJ=y(()=>{"use strict";Xn();yP="EVIDENCE_MISMATCH";JJ={name:yP,run:OTe}});import{existsSync as RTe,readFileSync as ITe}from"node:fs";import{join as PTe}from"node:path";function CTe(t){let e=PTe(t,t8);if(!RTe(e))return null;try{let n=((0,e8.parse)(ITe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*QJ(t,e){for(let r of t??[])r.startsWith(XJ)&&(yield{ref:r,name:r.slice(XJ.length),field:e})}function DTe(t){let{cwd:e="."}=t,r=CTe(e);if(r===null)return[];let n;try{n=G(e)}catch(o){return[{detector:_P,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=[...QJ(s.evidence_refs,"evidence_refs"),...QJ(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:_P,severity:"warn",path:t8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var e8,_P,XJ,t8,r8,n8=y(()=>{"use strict";e8=bt(Xt(),1);qe();_P="FIXTURE_REFERENCE_INVALID",XJ="fixture:",t8="conformance/fixtures.yaml";r8={name:_P,run:DTe}});import{existsSync as Tl,readFileSync as bP}from"node:fs";import{join as za}from"node:path";function NTe(t){return ds(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function ip(t){if(!Tl(t))return null;try{return JSON.parse(bP(t,"utf8"))}catch{return null}}function jTe(t,e){let r=za(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(bP(r,"utf8"))}catch(c){e.push({detector:bo,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:bo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=NTe(t);s!==a&&e.push({detector:bo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function MTe(t,e){for(let r of i8){let n=za(t,r.path);if(!Tl(n))continue;let i=ip(n);if(!i){e.push({detector:bo,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:bo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function FTe(t,e){let r=ip(za(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of i8){let s=za(t,o.path);if(!Tl(s))continue;let a=ip(s);a?.version&&a.version!==n&&e.push({detector:bo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=za(t,".claude-plugin","marketplace.json");if(Tl(i)){let o=ip(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:bo,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 LTe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function zTe(t,e){let r=za(t,"src","cli","clad.ts"),n=za(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Tl(r)||!Tl(n))return;let i=LTe(bP(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:bo,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 UTe(t){let{cwd:e="."}=t,r=[];return jTe(e,r),zTe(e,r),MTe(e,r),FTe(e,r),r}var bo,i8,o8,s8=y(()=>{"use strict";tp();bo="HARNESS_INTEGRITY",i8=[{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"]}];o8={name:bo,run:UTe}});import{existsSync as qTe,readFileSync as BTe}from"node:fs";import{join as HTe}from"node:path";function ZTe(t){let{cwd:e="."}=t;return he(e,Sv,r=>WTe(r,e))}function VTe(t){let e=HTe(t,"spec/capabilities.yaml");if(!qTe(e))return!1;try{let r=a8.default.parse(BTe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function WTe(t,e){let r=t.features.length;if(r{"use strict";a8=bt(Xt(),1);vt();Sv="HOLLOW_GOVERNANCE",GTe=8;c8={name:Sv,run:ZTe}});import{existsSync as u8,readFileSync as d8}from"node:fs";import{join as f8}from"node:path";function p8(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 YTe(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 XTe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function QTe(t){let e=f8(t,"README.md"),r=f8(t,"docs","dogfood","matrix.md");if(!u8(e)||!u8(r))return[];let n=p8(d8(e,"utf8"),KTe),i=p8(d8(r,"utf8"),JTe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=XTe(a);if(c===null)continue;let l=i[s]??"not-run",u=YTe(l);u!==null&&c>u&&o.push({detector:m8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function eOe(t){let{cwd:e="."}=t;return QTe(e)}var m8,KTe,JTe,h8,g8=y(()=>{"use strict";m8="HOST_CLAIM_DRIFT",KTe=//,JTe=//;h8={name:m8,run:eOe}});function tOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return y8(r.features.map(i=>i.id),"feature","spec/features/",n),y8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function y8(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:_8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var _8,b8,v8=y(()=>{"use strict";qe();_8="ID_COLLISION";b8={name:_8,run:tOe}});import{existsSync as op,readFileSync as vP,readdirSync as SP,statSync as rOe,writeFileSync as w8}from"node:fs";import{join as vo}from"node:path";function S8(t){if(!op(t))return 0;try{return SP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function nOe(t){if(!op(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=SP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=vo(n,o),a;try{a=rOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function iOe(t){let e=vo(t,"spec","capabilities.yaml");if(!op(e))return 0;try{let r=wv.default.parse(vP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function fs(t="."){let e=S8(vo(t,"spec","features")),r=S8(vo(t,"spec","scenarios")),n=iOe(t),i=nOe(vo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Ol(t,e){let r=vo(t,"spec.yaml");if(!op(r))return;let n=vP(r,"utf8"),i=oOe(n,e);i!==n&&w8(r,i)}function oOe(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 @@ -269,51 +269,51 @@ ${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 za(t="."){let e=yo(t,"spec","features");if(!ip(e))return!1;let r=[];for(let i of gP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,bv.parse)(hP(yo(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 Ua(t="."){let e=vo(t,"spec","features");if(!op(e))return!1;let r=[];for(let i of SP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,wv.parse)(vP(vo(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 g8(yo(t,"spec","index.yaml"),n,"utf8"),!0}var bv,op=y(()=>{"use strict";bv=Et(cr(),1)});import{existsSync as y8,readFileSync as _8,readdirSync as JTe}from"node:fs";import{join as yP}from"node:path";function YTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=ds(e),i=r.inventory;if(!i){let s=b8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return _P(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[..._P(e),{detector:sp,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 b8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:sp,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(..._P(e)),o}function _P(t){let e=yP(t,"spec","index.yaml"),r=yP(t,"spec","features");if(!y8(e)||!y8(r))return[];let n=new Map;try{for(let l of _8(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 JTe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=_8(yP(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:sp,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:sp,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 sp,b8,v8,S8=y(()=>{"use strict";op();qe();sp="INVENTORY_DRIFT",b8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];v8={name:sp,run:YTe}});import{existsSync as XTe,readFileSync as QTe}from"node:fs";import{join as eOe}from"node:path";function rOe(t){let{cwd:e="."}=t,r=eOe(e,"src","spec","schema.json"),n=[];if(XTe(r)){let i;try{i=JSON.parse(QTe(r,"utf8"))}catch(o){n.push({detector:ap,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of tOe)i.required?.includes(o)||n.push({detector:ap,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:ap,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==w8&&n.push({detector:ap,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${w8}'`})}catch{}return n}var ap,tOe,w8,x8,$8=y(()=>{"use strict";qe();ap="META_INTEGRITY",tOe=["schema","project","features"],w8="0.1";x8={name:ap,run:rOe}});function nOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return k8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),k8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function k8(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:E8,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 E8,A8,T8=y(()=>{"use strict";qe();E8="SLUG_CONFLICT";A8={name:E8,run:nOe}});function Ol(t){return t==="planned"||t==="in_progress"}var vv=y(()=>{"use strict"});import{existsSync as iOe}from"node:fs";import{join as oOe}from"node:path";function sOe(t){let{cwd:e="."}=t;return he(e,Sv,r=>aOe(r,e))}function aOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=oOe(e,i);iOe(o)||r.push(cOe(n.id,i,n.status))}return r}function cOe(t,e,r){return Ol(r)?{detector:Sv,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:Sv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Sv,wv,bP=y(()=>{"use strict";vv();bt();Sv="MISSING_IMPLEMENTATION";wv={name:Sv,run:sOe}});function lOe(t){let{cwd:e="."}=t;return he(e,vP,uOe)}function uOe(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:vP,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 vP,xv,SP=y(()=>{"use strict";bt();vP="MISSING_TESTS";xv={name:vP,run:lOe}});import{existsSync as dOe,readFileSync as fOe}from"node:fs";import{join as O8}from"node:path";function R8(t){if(dOe(t))try{return JSON.parse(fOe(t,"utf8"))}catch{return}}function gOe(t){let{cwd:e="."}=t,r=R8(O8(e,pOe)),n=R8(O8(e,mOe));if(!r||!n)return[{detector:wP,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>hOe&&i.push({detector:wP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var wP,pOe,mOe,hOe,I8,P8=y(()=>{"use strict";wP="PERFORMANCE_DRIFT",pOe="perf/baseline.json",mOe="perf/current.json",hOe=10;I8={name:wP,run:gOe}});import{existsSync as yOe}from"node:fs";import{join as _Oe}from"node:path";function vOe(t){let{cwd:e="."}=t;return he(e,xP,r=>wOe(r,e))}function SOe(t,e){return(t.modules??[]).some(r=>yOe(_Oe(e,r)))}function wOe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||SOe(s,e)||r.push(s.id);let n=bOe;if(r.length<=n)return[];let i=r.slice(0,C8).join(", "),o=r.length>C8?", \u2026":"";return[{detector:xP,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 xP,bOe,C8,D8,N8=y(()=>{"use strict";bt();xP="PLANNED_BACKLOG",bOe=5,C8=8;D8={name:xP,run:vOe}});import{existsSync as xOe,readFileSync as $Oe}from"node:fs";import{join as kOe}from"node:path";function TOe(t){let{cwd:e="."}=t;return he(e,$P,r=>OOe(r,e))}function OOe(t,e){if(t.features.lengthn.includes(i))?[{detector:$P,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 $P,EOe,AOe,j8,M8=y(()=>{"use strict";bt();$P="PROJECT_CONTEXT_DRIFT",EOe=8,AOe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];j8={name:$P,run:TOe}});function F8(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:$v,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function ROe(t){let{cwd:e="."}=t;return he(e,$v,IOe)}function IOe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...F8(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:$v,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...F8(e,n.features,`scenario ${n.id}.features`));return r}var $v,kv,kP=y(()=>{"use strict";bt();$v="REFERENCE_INTEGRITY";kv={name:$v,run:ROe}});function cp(t=""){return new RegExp(POe,t)}var POe,EP=y(()=>{"use strict";POe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as COe,readdirSync as DOe,readFileSync as NOe,statSync as jOe,writeFileSync as MOe}from"node:fs";import{dirname as FOe,join as lp,normalize as LOe,relative as zOe}from"node:path";function GOe(t){let e=[];for(let r of t.matchAll(HOe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(cp("g"))??[])e.push(n);return[...new Set(e)].sort()}function ZOe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function L8(t){return t.split("\\").join("/")}function VOe(t){return UOe.some(e=>t===e||t.startsWith(`${e}/`))}function WOe(t){let e=lp(t,"docs");if(!COe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=DOe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=lp(i,s),c;try{c=jOe(a)}catch{continue}let l=L8(zOe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function KOe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=LOe(lp(FOe(t),e));return L8(r)}function up(t="."){let e=[];for(let r of WOe(t)){let n;try{n=NOe(lp(t,r),"utf8")}catch{continue}let i=ZOe(n),o=GOe(i);if(VOe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(qOe)?[]:i.match(cp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(BOe)){let d=KOe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function z8(t="."){let e=up(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 MOe(lp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return w8(vo(t,"spec","index.yaml"),n,"utf8"),!0}var wv,sp=y(()=>{"use strict";wv=bt(Xt(),1)});import{existsSync as x8,readFileSync as $8,readdirSync as sOe}from"node:fs";import{join as wP}from"node:path";function aOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=fs(e),i=r.inventory;if(!i){let s=k8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return xP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...xP(e),{detector:ap,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 k8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:ap,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(...xP(e)),o}function xP(t){let e=wP(t,"spec","index.yaml"),r=wP(t,"spec","features");if(!x8(e)||!x8(r))return[];let n=new Map;try{for(let l of $8(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 sOe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=$8(wP(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:ap,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:ap,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 ap,k8,E8,A8=y(()=>{"use strict";sp();qe();ap="INVENTORY_DRIFT",k8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];E8={name:ap,run:aOe}});import{existsSync as cOe,readFileSync as lOe}from"node:fs";import{join as uOe}from"node:path";function fOe(t){let{cwd:e="."}=t,r=uOe(e,"src","spec","schema.json"),n=[];if(cOe(r)){let i;try{i=JSON.parse(lOe(r,"utf8"))}catch(o){n.push({detector:cp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of dOe)i.required?.includes(o)||n.push({detector:cp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:cp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=G(e);i.schema!==T8&&n.push({detector:cp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${T8}'`})}catch{}return n}var cp,dOe,T8,O8,R8=y(()=>{"use strict";qe();cp="META_INTEGRITY",dOe=["schema","project","features"],T8="0.1";O8={name:cp,run:fOe}});function pOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return I8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),I8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function I8(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:P8,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 P8,C8,D8=y(()=>{"use strict";qe();P8="SLUG_CONFLICT";C8={name:P8,run:pOe}});function Rl(t){return t==="planned"||t==="in_progress"}var xv=y(()=>{"use strict"});import{existsSync as mOe}from"node:fs";import{join as hOe}from"node:path";function gOe(t){let{cwd:e="."}=t;return he(e,$v,r=>yOe(r,e))}function yOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=hOe(e,i);mOe(o)||r.push(_Oe(n.id,i,n.status))}return r}function _Oe(t,e,r){return Rl(r)?{detector:$v,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:$v,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var $v,kv,$P=y(()=>{"use strict";xv();vt();$v="MISSING_IMPLEMENTATION";kv={name:$v,run:gOe}});function bOe(t){let{cwd:e="."}=t;return he(e,kP,vOe)}function vOe(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:kP,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 kP,Ev,EP=y(()=>{"use strict";vt();kP="MISSING_TESTS";Ev={name:kP,run:bOe}});import{existsSync as SOe,readFileSync as wOe}from"node:fs";import{join as N8}from"node:path";function j8(t){if(SOe(t))try{return JSON.parse(wOe(t,"utf8"))}catch{return}}function EOe(t){let{cwd:e="."}=t,r=j8(N8(e,xOe)),n=j8(N8(e,$Oe));if(!r||!n)return[{detector:AP,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>kOe&&i.push({detector:AP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var AP,xOe,$Oe,kOe,M8,F8=y(()=>{"use strict";AP="PERFORMANCE_DRIFT",xOe="perf/baseline.json",$Oe="perf/current.json",kOe=10;M8={name:AP,run:EOe}});import{existsSync as AOe}from"node:fs";import{join as TOe}from"node:path";function ROe(t){let{cwd:e="."}=t;return he(e,TP,r=>POe(r,e))}function IOe(t,e){return(t.modules??[]).some(r=>AOe(TOe(e,r)))}function POe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||IOe(s,e)||r.push(s.id);let n=OOe;if(r.length<=n)return[];let i=r.slice(0,L8).join(", "),o=r.length>L8?", \u2026":"";return[{detector:TP,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 TP,OOe,L8,z8,U8=y(()=>{"use strict";vt();TP="PLANNED_BACKLOG",OOe=5,L8=8;z8={name:TP,run:ROe}});import{existsSync as COe,readFileSync as DOe}from"node:fs";import{join as NOe}from"node:path";function FOe(t){let{cwd:e="."}=t;return he(e,OP,r=>LOe(r,e))}function LOe(t,e){if(t.features.lengthn.includes(i))?[{detector:OP,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 OP,jOe,MOe,q8,B8=y(()=>{"use strict";vt();OP="PROJECT_CONTEXT_DRIFT",jOe=8,MOe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];q8={name:OP,run:FOe}});function H8(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Av,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function zOe(t){let{cwd:e="."}=t;return he(e,Av,UOe)}function UOe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...H8(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Av,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...H8(e,n.features,`scenario ${n.id}.features`));return r}var Av,Tv,RP=y(()=>{"use strict";vt();Av="REFERENCE_INTEGRITY";Tv={name:Av,run:zOe}});function lp(t=""){return new RegExp(qOe,t)}var qOe,IP=y(()=>{"use strict";qOe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as BOe,readdirSync as HOe,readFileSync as GOe,statSync as ZOe,writeFileSync as VOe}from"node:fs";import{dirname as WOe,join as up,normalize as KOe,relative as JOe}from"node:path";function tRe(t){let e=[];for(let r of t.matchAll(eRe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(lp("g"))??[])e.push(n);return[...new Set(e)].sort()}function rRe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function G8(t){return t.split("\\").join("/")}function nRe(t){return YOe.some(e=>t===e||t.startsWith(`${e}/`))}function iRe(t){let e=up(t,"docs");if(!BOe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=HOe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=up(i,s),c;try{c=ZOe(a)}catch{continue}let l=G8(JOe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function oRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=KOe(up(WOe(t),e));return G8(r)}function dp(t="."){let e=[];for(let r of iRe(t)){let n;try{n=GOe(up(t,r),"utf8")}catch{continue}let i=rRe(n),o=tRe(i);if(nRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(XOe)?[]:i.match(lp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(QOe)){let d=oRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function Z8(t="."){let e=dp(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 VOe(up(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var UOe,qOe,BOe,HOe,Ev=y(()=>{"use strict";EP();UOe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],qOe="clad-doc-links: ignore",BOe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,HOe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as JOe}from"node:fs";import{join as YOe}from"node:path";function XOe(t){let{cwd:e="."}=t;return he(e,Av,r=>QOe(r,e))}function QOe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of up(e).docs){for(let o of i.doc_links)JOe(YOe(e,o))||n.push({detector:Av,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:Av,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 Av,Tv,AP=y(()=>{"use strict";Ev();bt();Av="DOC_LINK_INTEGRITY";Tv={name:Av,run:XOe}});function tRe(t){let{cwd:e="."}=t;return he(e,dp,r=>rRe(r))}function rRe(t){let e=[],r=t.features.length,n=t.scenarios??[];r>=eRe&&n.length===0&&e.push({detector:dp,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 o of n)(o.features??[]).length===0&&e.push({detector:dp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let i=new Map(t.features.filter(o=>typeof o.slug=="string"&&o.slug.length>0).map(o=>[o.slug,o.id]));for(let o of n){if(!o.flow)continue;let s=new Set(o.features??[]),a=new Map;for(let c of o.flow.matchAll(/\(([^)]+)\)/g))for(let l of c[1].split(/[,/·]/)){let u=l.trim(),d=i.get(u);d&&!s.has(d)&&a.set(u,d)}if(a.size>0){let c=[...a].map(([l,u])=>`${l} (${u})`).join(", ");e.push({detector:dp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} flow references ${c} but features[] does not bind ${a.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var dp,eRe,U8,q8=y(()=>{"use strict";bt();dp="SCENARIO_COVERAGE",eRe=8;U8={name:dp,run:tRe}});import{createHash as nRe}from"node:crypto";function iRe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function fp(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??B8),sample:iRe(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(B8),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function pp(t){return(t.features??[]).filter(e=>e.status==="done").length}function oRe(t,e){return e<=0?!1:e>=1?!0:parseInt(nRe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var B8,Ov=y(()=>{"use strict";B8=["unwanted"]});import{existsSync as sRe,readdirSync as aRe}from"node:fs";import{join as G8}from"node:path";import Z8 from"node:process";function cRe(t){let e=!1,r=n=>{for(let i of aRe(n,{withFileTypes:!0})){if(e)return;let o=G8(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 TP(t={}){let{cwd:e="."}=t,r=G8(e,fs);if(!sRe(r)||!cRe(r))return{stage:Rv,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${fs}/ \u2014 skipped`};let n=ht(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Rv,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o=Je(i.cmd,[...i.args,fs],{cwd:e,reject:!1}),s=Lt(Rv,i.cmd,o);return s||Yt(Rv,o)}var Rv,fs,lRe,OP=y(()=>{"use strict";Nr();kn();En();Rv="stage_2.3",fs="tests/oracle";lRe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Z8.argv[1]}`;if(lRe){let t=TP();console.log(JSON.stringify(t)),Z8.exit(t.exitCode)}});import{existsSync as uRe}from"node:fs";import{join as dRe}from"node:path";function fRe(t){let{cwd:e="."}=t;return he(e,Xn,r=>pRe(r,e))}function pRe(t,e){let r=[],n=fp(t.project,pp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?An(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(mp(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:Xn,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${fs}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!uRe(dRe(e,f))){r.push({detector:Xn,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${fs}/`)||r.push({detector:Xn,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${fs}/ \u2014 stage_2.3 only runs ${fs}/, 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:Xn,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:Xn,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:Xn,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:Xn,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:Xn,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:Xn,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 Xn,V8,W8=y(()=>{"use strict";Yn();Ov();OP();bt();Xn="SPEC_CONFORMANCE";V8={name:Xn,run:fRe}});function mRe(t){let{cwd:e="."}=t,r=An(e);if(r.length===0)return[{detector:RP,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>K8&&i.push({detector:RP,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${K8})`})}return i}var RP,K8,J8,Y8=y(()=>{"use strict";Yn();RP="STALE_EVIDENCE",K8=90;J8={name:RP,run:mRe}});import{existsSync as X8}from"node:fs";import{join as Q8}from"node:path";function hRe(t){let{cwd:e="."}=t;return he(e,Rl,r=>gRe(r,e))}function gRe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Rl,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:Rl,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=>X8(Q8(e,o)));i.length>0&&r.push({detector:Rl,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Ol(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>X8(Q8(e,i)))&&r.push({detector:Rl,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 Rl,Iv,IP=y(()=>{"use strict";vv();bt();Rl="STALE_SPECIFICATION";Iv={name:Rl,run:hRe}});import{existsSync as e5,statSync as t5}from"node:fs";import{join as r5}from"node:path";function _Re(t,e){let r=0;for(let n of e){let i=r5(t,n);if(!e5(i))continue;let o=t5(i).mtimeMs;o>r&&(r=o)}return r}function bRe(t){let{cwd:e="."}=t;return he(e,PP,r=>vRe(r,e))}function vRe(t,e){let r=Oi(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=_Re(e,n);if(i===0)return[];let o=us([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=r5(e,a);if(!e5(c))continue;let l=t5(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>yRe&&s.push({detector:PP,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var PP,yRe,Pv,CP=y(()=>{"use strict";ep();Na();bt();PP="STALE_TESTS",yRe=30;Pv={name:PP,run:bRe}});import{existsSync as SRe}from"node:fs";import{join as wRe}from"node:path";function xRe(t){let{cwd:e="."}=t;return he(e,hp,r=>$Re(r,e))}function $Re(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:hp,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=>!SRe(wRe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:hp,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:hp,severity:Ol(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 hp,Cv,DP=y(()=>{"use strict";vv();bt();hp="STATUS_DRIFT";Cv={name:hp,run:xRe}});function kRe(t){let{cwd:e="."}=t;return he(e,Dv,r=>ERe(r,e))}function ERe(t,e){let r=ht(e).language;return r==="unknown"?[{detector:Dv,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:Dv,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var Dv,n5,i5=y(()=>{"use strict";kn();bt();Dv="TECH_STACK_MISMATCH";n5={name:Dv,run:kRe}});function RRe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function IRe(t){let{cwd:e="."}=t;return he(e,NP,r=>PRe(r,e))}function PRe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=us([...RRe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:NP,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var NP,o5,ARe,TRe,ORe,Nv,jP=y(()=>{"use strict";ep();sP();bt();NP="UNMAPPED_ARTIFACT",o5=["src/stages/**/*.ts","src/spec/**/*.ts"],ARe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},TRe={kotlin:"src/main/kotlin"},ORe=8;Nv={name:NP,run:IRe}});import{existsSync as s5}from"node:fs";import{join as a5}from"node:path";function DRe(t){return CRe.some(e=>t.startsWith(e))}function NRe(t){let{cwd:e="."}=t;return he(e,MP,r=>jRe(r,e))}function jRe(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(DRe(o))continue;let s=o.split("#",1)[0];s5(a5(e,o))||s&&s5(a5(e,s))||r.push({detector:MP,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 ax(t){return`${JSON.stringify(t,null,2)} +`}function uee(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?`[[${see(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(aee);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(aee);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}/${see(s)}.md`,`${a.join(` +`)}`)}return o}function aee(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as x2e}from"node:fs";import{dirname as $2e,join as BN}from"node:path";import{fileURLToPath as k2e}from"node:url";var HN=$2e(k2e(import.meta.url));function dee(t){for(let e of[BN(HN,"viewer",t),BN(HN,"..","graph","viewer",t),BN(HN,"..","..","dist","viewer",t)])try{return x2e(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function fee(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -865,54 +871,54 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}uP();AP();bP();SP();kP();lP();CP();DP();jP();FP();Om();EP();qe();var d2e=[xv,jv,wv,Nv,kv,Tv,yv,Cv,Pv,gv];function f2e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=cp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function ix(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{ya(e,H(e))}catch{}try{for(let o of d2e){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 f2e(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{ya(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}FN();qe();xi();var m2e=new Set(["mermaid","dot","json","obsidian","html"]);function aee(t={}){try{let e=t.format??"mermaid";if(!m2e.has(e)){F("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=sc(n,".");if(t.focus){let s=Xw(n,i,t.focus);if(s.length===0){F("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){F("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=Yw(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=nee(i);for(let[c,l]of a){let u=p2e(s,c);LN(UN(u),{recursive:!0}),zN(u,l,"utf8")}F("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){F("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=nx(i,ix(i,"."));LN(UN(t.out),{recursive:!0}),zN(t.out,s,"utf8"),F("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"?ree(i):r==="json"?rx(i):tee(i);t.out?(LN(UN(t.out),{recursive:!0}),zN(t.out,o,"utf8"),F("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){F("fail","graph",e.message),process.exit(1)}}function cee(){try{let t=sc(H(),".");process.stdout.write(see(ox(t)),()=>process.exit(0))}catch(t){F("fail","graph",t.message),process.exit(1)}}Om();import{createServer as h2e}from"node:http";import{existsSync as g2e,watch as y2e}from"node:fs";import{join as _2e}from"node:path";qe();xi();function b2e(t={}){let e=t.cwd??".",r=new Set,n=()=>sc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}hP();PP();$P();EP();RP();mP();FP();LP();UP();BP();Im();IP();qe();var E2e=[Ev,Lv,kv,Fv,Tv,Iv,vv,jv,Nv,bv];function A2e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=lp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function lx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{_a(e,G(e))}catch{}try{for(let o of E2e){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 A2e(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{_a(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}GN();qe();ki();var O2e=new Set(["mermaid","dot","json","obsidian","html"]);function mee(t={}){try{let e=t.format??"mermaid";if(!O2e.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=G(),i=ac(n,".");if(t.focus){let s=nx(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=rx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=uee(i);for(let[c,l]of a){let u=T2e(s,c);ZN(WN(u),{recursive:!0}),VN(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=cx(i,lx(i,"."));ZN(WN(t.out),{recursive:!0}),VN(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"?lee(i):r==="json"?ax(i):cee(i);t.out?(ZN(WN(t.out),{recursive:!0}),VN(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 hee(){try{let t=ac(G(),".");process.stdout.write(pee(ux(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Im();import{createServer as R2e}from"node:http";import{existsSync as I2e,watch as P2e}from"node:fs";import{join as C2e}from"node:path";qe();ki();function D2e(t={}){let e=t.cwd??".",r=new Set,n=()=>ac(G(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=h2e((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=rx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(ix(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=R2e((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=ax(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(lx(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=nx(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=_2e(e,u);if(g2e(d))try{let f=y2e(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=cx(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=C2e(e,u);if(I2e(d))try{let f=P2e(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 lee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await b2e({port:e,cwd:t.cwd??"."});F("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){F("fail","graph",r.message),process.exit(1)}}var v2e=["stage_1.1","stage_2.1","stage_2.3"];function S2e(t){return(t.features??[]).filter(e=>e.status==="done")}function w2e(t,e){let r=S2e(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 uee(t,e){let r=[];for(let n of v2e){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=w2e(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}Zv();import dee from"node:process";function x2e(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 sx(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=x2e(n,t);i.pass||r.push(i)}return r}Yn();var qN="stage_4.1";function BN(t={}){let{cwd:e="."}=t,r=An(e);if(r.length===0)return{stage:qN,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=sx(r);if(n.length===0)return{stage:qN,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:qN,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var $2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dee.argv[1]}`;if($2e){let t=BN();console.log(JSON.stringify(t)),dee.exit(t.exitCode)}nl();import{randomBytes as k2e}from"node:crypto";import{unlinkSync as E2e}from"node:fs";import{tmpdir as A2e}from"node:os";import{join as T2e,resolve as HN}from"node:path";import O2e from"node:process";var zr=null;function fee(t){zr={cwd:HN(t),run:null,jsonFile:null}}function pee(){return zr!==null}function mee(t,e){if(!zr||zr.cwd!==HN(t))return null;if(zr.run)return zr.run;let r=T2e(A2e(),`clad-shared-vitest-${O2e.pid}-${k2e(6).toString("hex")}.json`);zr.jsonFile=r;let n=e(r);return zr.run={proc:n,jsonFile:r},zr.run}function hee(t){return!zr||zr.cwd!==HN(t)?null:zr.run}function gee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function yee(){let t=zr?.jsonFile;if(zr=null,t)try{E2e(t)}catch{}}Nr();import _ee from"node:process";var ax="stage_1.4";function GN(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:ax,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:ax,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:ax,pass:!0,exitCode:0}:{stage:ax,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var R2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${_ee.argv[1]}`;if(R2e){let t=GN();console.log(JSON.stringify(t)),_ee.exit(t.exitCode)}Nr();import bee from"node:process";Rm();En();var cx="stage_2.2";function ZN(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Eo("coverage",t))}catch(c){return{stage:cx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:cx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=hee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Lt(cx,r,s);return a||Yt(cx,s)}var C2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${bee.argv[1]}`;if(C2e){let t=ZN();console.log(JSON.stringify(t)),bee.exit(t.exitCode)}yp();VN();Nr();kn();En();import See from"node:process";var fx="stage_3.2";function WN(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:fx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!$l(e,o[o.length-1]))return{stage:fx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(fx,i,s);return a||Yt(fx,s)}var J2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${See.argv[1]}`;if(J2e){let t=WN();console.log(JSON.stringify(t)),See.exit(t.exitCode)}Nr();qe();En();import{existsSync as Y2e}from"node:fs";import{resolve as xee}from"node:path";import $ee from"node:process";var ni="stage_2.4",KN=5e3,X2e=3e4;function JN(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ni,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return eUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ni,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ni,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ni,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=xee(e,r.path);if(!Y2e(s))return{stage:ni,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??KN,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Lt(ni,r.path,c);if(l)return l;if(c.timedOut)return{stage:ni,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:ni,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ni,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var wee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},Q2e={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function eUe(t,e,r){let n=Math.min(e.length*KN,X2e),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(tUe(t,s,r))}return rUe(o)}function tUe(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("/")?xee(t,a):a,u=KN,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Pa(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 rUe(t){let e="skip";for(let o of t)wee[o.disposition]>wee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${Q2e[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:ni,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ni,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var nUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${$ee.argv[1]}`;if(nUe){let t=JN();console.log(JSON.stringify(t)),$ee.exit(t.exitCode)}Nr();kn();En();import kee from"node:process";var px="stage_3.1";function YN(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:px,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!$l(e,o[o.length-1]))return{stage:px,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(px,i,s);return a||Yt(px,s)}var iUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${kee.argv[1]}`;if(iUe){let t=YN();console.log(JSON.stringify(t)),kee.exit(t.exitCode)}OP();XN();QN();Nr();ux();import{randomBytes as dUe}from"node:crypto";import{unlinkSync as fUe}from"node:fs";import{tmpdir as pUe}from"node:os";import{join as mUe}from"node:path";import tj from"node:process";Rm();En();qe();import{readFileSync as aUe}from"node:fs";import{resolve as Tee}from"node:path";function cUe(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=Tee(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 lUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function uUe(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=lUe(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(Tee(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 ej(t,e){try{let r=cUe(aUe(t,"utf8"));return r?uUe(H(e),r,e):[]}catch{return[]}}var Ao="stage_2.1";function Oee(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function hUe(t,e,r){let n,i;try{({cmd:n,args:i}=Eo("coverage",t))}catch{return null}if(!n||!i||!Oee(n,i))return null;let o=n,s=i,a=mee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Lt(Ao,n,c))return null;let u=Yt(Ao,c);if(gee(u)==="fallback")return null;if(r){let d=ej(l,e);if(d.length>0)return{stage:Ao,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ao,pass:!0,exitCode:0}}function rj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Eo("test",t))}catch(u){return{stage:Ao,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Ao,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Oee(n,i),a=r&&s;if(pee()&&s){let u=hUe(t,e,a);if(u)return u}let c,l=i;a&&(c=mUe(pUe(),`clad-vitest-${tj.pid}-${dUe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Lt(Ao,n,u);if(d)return d;let f=fu("unit",Yt(Ao,u),u);if(a&&f.pass&&c){let p=ej(c,e);if(p.length>0)return{stage:Ao,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{fUe(c)}catch{}}}var gUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tj.argv[1]}`;if(gUe){let t=rj();console.log(JSON.stringify(t)),tj.exit(t.exitCode)}Nr();kn();En();import Ree from"node:process";var gx="stage_3.3";function nj(t={}){let{cwd:e="."}=t,r=ht(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:gx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!$l(e,o[o.length-1]))return{stage:gx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(gx,i,s);return a||Yt(gx,s)}var yUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Ree.argv[1]}`;if(yUe){let t=nj();console.log(JSON.stringify(t)),Ree.exit(t.exitCode)}IP();bf();la();oj();op();Ev();var Mee=Et(cr(),1);import{existsSync as sj,readFileSync as TUe,readdirSync as jee,statSync as OUe,writeFileSync as RUe}from"node:fs";import{basename as Dm,join as Nm,relative as Nee}from"node:path";var IUe=["self-dogfood:","fixture:","derived:"],Fee=/\.(test|spec)\.[jt]sx?$/;function Lee(t,e=t,r=[]){let n;try{n=jee(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Nm(e,i);try{OUe(o).isDirectory()?Lee(t,o,r):Fee.test(i)&&r.push(o)}catch{continue}}return r}function zee(t="."){let e=Nm(t,"spec","features"),r=Nm(t,"tests"),n=[],i=[];if(!sj(e)||!sj(r))return{repaired:n,suggested:i};let o=Lee(r),s=new Map;for(let a of o){let c=Nee(t,a).split("\\").join("/"),l=s.get(Dm(a))??[];l.push(c),s.set(Dm(a),l)}for(let a of jee(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Nm(e,a),l,u;try{l=TUe(c,"utf8"),u=(0,Mee.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(IUe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(sj(Nm(t,b)))continue;let _=s.get(Dm(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=>Dm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Nee(t,h).split("\\").join("/")).find(h=>{let g=Dm(h).replace(Fee,"");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 gee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await D2e({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 N2e=["stage_1.1","stage_2.1","stage_2.3"];function j2e(t){return(t.features??[]).filter(e=>e.status==="done")}function M2e(t,e){let r=j2e(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 yee(t,e){let r=[];for(let n of N2e){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=M2e(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}Kv();import _ee from"node:process";function F2e(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 dx(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=F2e(n,t);i.pass||r.push(i)}return r}Xn();var KN="stage_4.1";function JN(t={}){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return{stage:KN,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=dx(r);if(n.length===0)return{stage:KN,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:KN,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var L2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${_ee.argv[1]}`;if(L2e){let t=JN();console.log(JSON.stringify(t)),_ee.exit(t.exitCode)}il();import{randomBytes as z2e}from"node:crypto";import{unlinkSync as U2e}from"node:fs";import{tmpdir as q2e}from"node:os";import{join as B2e,resolve as YN}from"node:path";import H2e from"node:process";var Ur=null;function bee(t){Ur={cwd:YN(t),run:null,jsonFile:null}}function vee(){return Ur!==null}function See(t,e){if(!Ur||Ur.cwd!==YN(t))return null;if(Ur.run)return Ur.run;let r=B2e(q2e(),`clad-shared-vitest-${H2e.pid}-${z2e(6).toString("hex")}.json`);Ur.jsonFile=r;let n=e(r);return Ur.run={proc:n,jsonFile:r},Ur.run}function wee(t){return!Ur||Ur.cwd!==YN(t)?null:Ur.run}function xee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function $ee(){let t=Ur?.jsonFile;if(Ur=null,t)try{U2e(t)}catch{}}jr();import kee from"node:process";var fx="stage_1.4";function XN(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:fx,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:fx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:fx,pass:!0,exitCode:0}:{stage:fx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var G2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${kee.argv[1]}`;if(G2e){let t=XN();console.log(JSON.stringify(t)),kee.exit(t.exitCode)}jr();import Eee from"node:process";Pm();An();var px="stage_2.2";function QN(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Oo("coverage",t))}catch(c){return{stage:px,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:px,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=wee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Lt(px,r,s);return a||Qt(px,s)}var W2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Eee.argv[1]}`;if(W2e){let t=QN();console.log(JSON.stringify(t)),Eee.exit(t.exitCode)}_p();ej();jr();nn();An();import Tee from"node:process";var yx="stage_3.2";function tj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:yx,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:yx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(yx,i,s);return a||Qt(yx,s)}var dUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Tee.argv[1]}`;if(dUe){let t=tj();console.log(JSON.stringify(t)),Tee.exit(t.exitCode)}jr();qe();An();import{existsSync as fUe}from"node:fs";import{resolve as Ree}from"node:path";import Iee from"node:process";var ii="stage_2.4",rj=5e3,pUe=3e4;function nj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=G(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:ii,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return hUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ii,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ii,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ii,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Ree(e,r.path);if(!fUe(s))return{stage:ii,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??rj,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Lt(ii,r.path,c);if(l)return l;if(c.timedOut)return{stage:ii,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:ii,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ii,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Oee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},mUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function hUe(t,e,r){let n=Math.min(e.length*rj,pUe),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(gUe(t,s,r))}return yUe(o)}function gUe(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("/")?Ree(t,a):a,u=rj,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Ca(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 yUe(t){let e="skip";for(let o of t)Oee[o.disposition]>Oee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${mUe[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:ii,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ii,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var _Ue=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Iee.argv[1]}`;if(_Ue){let t=nj();console.log(JSON.stringify(t)),Iee.exit(t.exitCode)}jr();nn();An();import Pee from"node:process";var _x="stage_3.1";function ij(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:_x,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:_x,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(_x,i,s);return a||Qt(_x,s)}var bUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Pee.argv[1]}`;if(bUe){let t=ij();console.log(JSON.stringify(t)),Pee.exit(t.exitCode)}DP();oj();sj();jr();hx();import{randomBytes as EUe}from"node:crypto";import{unlinkSync as AUe}from"node:fs";import{tmpdir as TUe}from"node:os";import{join as OUe}from"node:path";import cj from"node:process";Pm();An();qe();import{readFileSync as wUe}from"node:fs";import{resolve as Nee}from"node:path";function xUe(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=Nee(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 $Ue(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function kUe(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=$Ue(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(Nee(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 aj(t,e){try{let r=xUe(wUe(t,"utf8"));return r?kUe(G(e),r,e):[]}catch{return[]}}var Ro="stage_2.1";function jee(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function RUe(t,e,r){let n,i;try{({cmd:n,args:i}=Oo("coverage",t))}catch{return null}if(!n||!i||!jee(n,i))return null;let o=n,s=i,a=See(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Lt(Ro,n,c))return null;let u=Qt(Ro,c);if(xee(u)==="fallback")return null;if(r){let d=aj(l,e);if(d.length>0)return{stage:Ro,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ro,pass:!0,exitCode:0}}function lj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Oo("test",t))}catch(u){return{stage:Ro,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Ro,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=jee(n,i),a=r&&s;if(vee()&&s){let u=RUe(t,e,a);if(u)return u}let c,l=i;a&&(c=OUe(TUe(),`clad-vitest-${cj.pid}-${EUe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Lt(Ro,n,u);if(d)return d;let f=pu("unit",Qt(Ro,u),u);if(a&&f.pass&&c){let p=aj(c,e);if(p.length>0)return{stage:Ro,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{AUe(c)}catch{}}}var IUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${cj.argv[1]}`;if(IUe){let t=lj();console.log(JSON.stringify(t)),cj.exit(t.exitCode)}jr();nn();An();import Mee from"node:process";var Sx="stage_3.3";function uj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Sx,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:Sx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(Sx,i,s);return a||Qt(Sx,s)}var PUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Mee.argv[1]}`;if(PUe){let t=uj();console.log(JSON.stringify(t)),Mee.exit(t.exitCode)}jP();vf();ua();fj();sp();Ov();var Hee=bt(Xt(),1);import{existsSync as pj,readFileSync as BUe,readdirSync as Bee,statSync as HUe,writeFileSync as GUe}from"node:fs";import{basename as jm,join as Mm,relative as qee}from"node:path";var ZUe=["self-dogfood:","fixture:","derived:"],Gee=/\.(test|spec)\.[jt]sx?$/;function Zee(t,e=t,r=[]){let n;try{n=Bee(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Mm(e,i);try{HUe(o).isDirectory()?Zee(t,o,r):Gee.test(i)&&r.push(o)}catch{continue}}return r}function Vee(t="."){let e=Mm(t,"spec","features"),r=Mm(t,"tests"),n=[],i=[];if(!pj(e)||!pj(r))return{repaired:n,suggested:i};let o=Zee(r),s=new Map;for(let a of o){let c=qee(t,a).split("\\").join("/"),l=s.get(jm(a))??[];l.push(c),s.set(jm(a),l)}for(let a of Bee(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Mm(e,a),l,u;try{l=BUe(c,"utf8"),u=(0,Hee.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(ZUe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(pj(Mm(t,b)))continue;let _=s.get(jm(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=>jm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>qee(t,h).split("\\").join("/")).find(h=>{let g=jm(h).replace(Gee,"");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&&RUe(c,l,"utf8")}return{repaired:n,suggested:i}}rl();import{existsSync as PUe,readFileSync as CUe}from"node:fs";import{join as DUe}from"node:path";function NUe(t,e){let r=DUe(t,e);if(!PUe(r))return[];let n=[];for(let i of CUe(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 Uee(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=>NUe(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 qee(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(` -`)}Ov();qe();xi();Yn();rl();var aj=["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"],jUe=[...aj,"att"];function MUe(t,e,r){if(e.startsWith("stage_4")){let n=An(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return sx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function FUe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":p_(e,r,t).state==="fresh"?"\u2713":"!"}function vx(t,e="."){let r=ts(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...aj.map(o=>MUe(i,o,e)),FUe(i,r,e)]}));return{columns:jUe,rows:n}}function Bee(t,e=".",r={}){let n=r.internal??!1,i=vx(t,e),o=[...aj.map(c=>n?c.replace("stage_",""):LUe(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 LUe(t){return ba(t).slice(0,3)}async function tJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Jle(),Kle)),Promise.resolve().then(()=>(tue(),eue)),Promise.resolve().then(()=>(Cp(),gX))]),i=e({cwd:t.cwd,onboarding:{initialize:AN,clarify:IN}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function rJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await AN({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){V.stdout.write(`${JSON.stringify(n,null,2)} -`),V.exit(0);return}for(let o of n.created)F("pass",`created ${o}`);for(let o of n.skipped)F("skip",o);for(let o of n.proposals??[])F("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(F("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){V.stdout.write(` +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&GUe(c,l,"utf8")}return{repaired:n,suggested:i}}nl();import{existsSync as VUe,readFileSync as WUe}from"node:fs";import{join as KUe}from"node:path";function JUe(t,e){let r=KUe(t,e);if(!VUe(r))return[];let n=[];for(let i of WUe(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 Wee(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=>JUe(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 Kee(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(` +`)}Pv();qe();ki();Xn();nl();var mj=["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"],YUe=[...mj,"att"];function XUe(t,e,r){if(e.startsWith("stage_4")){let n=Tn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return dx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function QUe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":g_(e,r,t).state==="fresh"?"\u2713":"!"}function kx(t,e="."){let r=rs(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...mj.map(o=>XUe(i,o,e)),QUe(i,r,e)]}));return{columns:YUe,rows:n}}function Jee(t,e=".",r={}){let n=r.internal??!1,i=kx(t,e),o=[...mj.map(c=>n?c.replace("stage_",""):eqe(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 eqe(t){return va(t).slice(0,3)}async function yJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(sue(),oue)),Promise.resolve().then(()=>(due(),uue)),Promise.resolve().then(()=>(Dp(),wX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>eee(s),prepareInit:({cwd:s,mode:a,intent:c})=>XQ(s,a,c),initialize:PN,prepareClarify:(s,{cwd:a})=>QQ(a,s),clarify:jN}});n(i.server);let o=new r;W.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function _Je(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await PN({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){W.stdout.write(`${JSON.stringify(n,null,2)} +`),W.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){W.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: -`);for(let[o,s]of n.clarifyingQuestions.entries())V.stdout.write(` ${o+1}. ${s} -`);V.stdout.write(` -`)}else r||n.created.some(s=>s==="docs/conventions.md")&&(V.stdout.write(` +`);for(let[o,s]of n.clarifyingQuestions.entries())W.stdout.write(` ${o+1}. ${s} +`);W.stdout.write(` +`)}else r||n.created.some(s=>s==="docs/conventions.md")&&(W.stdout.write(` \u{1F4A1} Tip: for a more precise scaffold, describe the project: -`),V.stdout.write(` clad init -`),V.stdout.write(` e.g. clad init payment SaaS for B2B -`),V.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. - -`));V.exit(0)}async function nJe(t,e){F("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(()=>(Eue(),kue)),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)F(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),V.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>$O(l,s)),c=`${vH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;F(i,"run",c),a.length>0&&V.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&F("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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function iJe(t={}){try{let e=H();if(ca("."))F("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ds(".");Tl(".",r),za("."),z8(".");let n=Fl(".");n==="created"?F("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&F("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=zee(".");for(let s of i.repaired)F("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)F("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=bx(".");o&&F("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Iv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){F("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);F("note",`propose-archive \xB7 ${s}`,a)}F("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),V.exit(0);return}F("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){F("fail","sync",e.message),V.exit(1)}}function oJe(t){if(!t){F("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=Jy(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";F("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function sJe(t,e={}){if(!t){F("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=Yy(".",t);if(!r){F("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}Xy(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";F("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?V.stdout.write(`Run: git checkout ${r.gitHead} -`):V.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),V.exit(0)}async function aJe(t){let e=await cC({force:t.force,quiet:t.quiet});V.exit(e.errors.length>0?1:0)}async function cJe(){F("note","update","reconciling the current project after the engine upgrade");let t=await jY(".",{wireHosts:async()=>(await cC({quiet:!0})).errors.length});if(F(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){F("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}t.inventoryDeferred?F("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):F("pass","spec",`inventory synced \xB7 ${t.features} features`),F(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),F(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)F("note","deprecated",r);V.stdout.write(` +`),W.stdout.write(` clad init +`),W.stdout.write(` e.g. clad init payment SaaS for B2B +`),W.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. + +`));W.exit(0)}async function bJe(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(()=>(jue(),Nue)),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}`),W.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=G(e.cwd??"."),a=n.featuresTouched.map(l=>OO(l,s)),c=`${EH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&W.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.`),W.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function vJe(t={}){try{let e=G();if(la("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=fs(".");Ol(".",r),Ua("."),Z8(".");let n=Ll(".");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=Vee(".");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=$x(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Dv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),W.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)`),W.exit(0);return}L("pass","sync",`${e.features.length} features valid`),W.exit(0)}catch(e){L("fail","sync",e.message),W.exit(1)}}function SJe(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),W.exit(2);return}let e=Qy(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),W.exit(0)}function wJe(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),W.exit(2);return}let r=e_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),W.exit(1);return}t_(".",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?W.stdout.write(`Run: git checkout ${r.gitHead} +`):W.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. +`),W.exit(0)}async function xJe(t){let e=await pC({force:t.force,quiet:t.quiet});W.exit(e.errors.length>0?1:0)}async function $Je(){L("note","update","reconciling the current project after the engine upgrade");let t=await qY(".",{wireHosts:async()=>(await pC({quiet:!0})).errors.length});if(L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){L("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),W.exit(t.code);return}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);W.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),HE({tier:"pre-commit",strict:!0}).anyFailed?V.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"):F("pass","drift","clean against the stricter detectors"),V.exit(t.code)}var lJe={"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 HE(t){let e=t.tier??"all",r=t.silent===!0,n=lJe[e];if(!n)return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):r||F("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",()=>Pm(i)],["stage_1.2",()=>Im(i)],["stage_1.3",()=>Qn({...i,strict:t.strict})],["stage_1.4",GN],["stage_1.5",Ga],["stage_1.6",Ep],["stage_2.1",()=>rj({...i,strict:t.strict})],["stage_2.2",()=>ZN(i)],["stage_2.3",TP],["stage_2.4",JN],["stage_3.1",YN],["stage_3.2",WN],["stage_3.3",nj],["stage_4.1",BN],["stage_4.2",Cm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ei(d)?"fail":"skip",u=[];m_("."),fee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:ba(d),h=$Y(p);ei(h)&&(c=!0,a=Math.max(a,kY(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(F(l(h),m),ei(h)&&yJe(p))}}finally{g_(),yee()}if(t.strict)try{let d=H();for(let f of uee(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&&F("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"||!ei(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=>ei(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&F("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(ca("."))t.json||F("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{zH(".",H())&&(t.json||F("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),lr(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function uJe(t){try{let e=H(),r=Kc(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} -`),V.exit("not_found"in r?1:0)}catch(e){F("fail","context",e.message),V.exit(1)}}function dJe(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=yr(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} -`),V.exit("not_found"in i?1:0)}catch(r){F("fail","impact",r.message),V.exit(1)}}function fJe(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Mv(e,o=>{try{return Tue(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),V.exit(0)}catch(e){F("fail","infer-deps",e.message),V.exit(1)}}function pJe(t={}){try{if(t.sessions){JQ(t);return}if(t.trend!==void 0&&t.trend!==!1){YQ(t);return}let e=H(),n=LB(e,o=>{try{return Tue(o,"utf8")}catch{return null}},"."),i=UB(".",n);if(t.json)V.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)}`,` ${Jc}`];V.stdout.write(`${c.join(` +`),KE({tier:"pre-commit",strict:!0}).anyFailed?W.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"),W.exit(t.code)}var kJe={"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 KE(t){let e=t.tier??"all",r=t.silent===!0,n=kJe[e];if(!n)return t.json&&!r?W.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",()=>Dm(i)],["stage_1.2",()=>Cm(i)],["stage_1.3",()=>ei({...i,strict:t.strict})],["stage_1.4",XN],["stage_1.5",Za],["stage_1.6",Ap],["stage_2.1",()=>lj({...i,strict:t.strict})],["stage_2.2",()=>QN(i)],["stage_2.3",CP],["stage_2.4",nj],["stage_3.1",ij],["stage_3.2",tj],["stage_3.3",uj],["stage_4.1",JN],["stage_4.2",Nm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ti(d)?"fail":"skip",u=[];y_("."),bee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:va(d),h=RY(p);ti(h)&&(c=!0,a=Math.max(a,IY(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),ti(h)&&CJe(p))}}finally{b_(),$ee()}if(t.strict)try{let d=G();for(let f of yee(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"||!ti(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=>ti(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(la("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{ZH(".",G())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?W.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&W.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),ur(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function EJe(t){try{let e=G(),r=Jc(e,t);W.stdout.write(`${JSON.stringify(r,null,2)} +`),W.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),W.exit(1)}}function AJe(t,e={}){try{let r=G(),n=e.depth!==void 0?Number(e.depth):void 0,i=_r(r,t,{depth:n});W.stdout.write(`${JSON.stringify(i,null,2)} +`),W.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),W.exit(1)}}function TJe(t={}){try{let e=G(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=zv(e,o=>{try{return Fue(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});W.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),W.exit(0)}catch(e){L("fail","infer-deps",e.message),W.exit(1)}}function OJe(t={}){try{if(t.sessions){nee(t);return}if(t.trend!==void 0&&t.trend!==!1){iee(t);return}let e=G(),n=GB(e,o=>{try{return Fue(o,"utf8")}catch{return null}},"."),i=VB(".",n);if(t.json)W.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)}`,` ${Yc}`];W.stdout.write(`${c.join(` `)} -`),i.appended?F("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?F("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&F("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}V.exit(0)}catch(e){F("fail","measure",e.message),V.exit(1)}}function mJe(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(F("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){F("fail","check",r.message),V.exit(1)}V.exitCode=HE({...t,focusModules:e}).worst}function hJe(t){let e=oY(".",t,{checkStages:HE,onIndex:za,gitOpInProgress:HT});F(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function gJe(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){F("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=H8(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. -`),V.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";V.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} -`)}V.stdout.write(` +`),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)")}W.exit(0)}catch(e){L("fail","measure",e.message),W.exit(1)}}function RJe(t){let e;if(t.feature)try{let n=(G().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),W.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),W.exit(1)}W.exitCode=KE({...t,focusModules:e}).worst}function IJe(t){let e=dY(".",t,{checkStages:KE,onIndex:Ua,gitOpInProgress:KT});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),W.exit(e.code)}function PJe(t,e={}){let r=e.cwd??".",n;try{n=G(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),W.exit(1);return}if(e.required){t&&W.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=J8(n);if(o.length===0){W.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),W.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";W.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} +`)}W.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),V.exit(s.length>0?1:0);return}if(!t){F("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),V.exit(1);return}let i=Uee(n,t,e.ac,r);if(!i||i.acs.length===0){F("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),V.exit(1);return}V.stdout.write(`${qee(i)} -`),V.exit(0)}function yJe(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=Aue($f(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] -`)}n.length>3&&V.stdout.write(` \u2026 and ${n.length-3} more finding(s) +`),W.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"),W.exit(1);return}let i=Wee(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`),W.exit(1);return}W.stdout.write(`${Kee(i)} +`),W.exit(0)}function CJe(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=Mue(kf(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";W.stdout.write(` ${o}${s} [${i.detector}] +`)}n.length>3&&W.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&V.stdout.write(` ${Aue(e.trim(),160)} -`)}}function Aue(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function _Je(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(vx(e,"."),null,2)} -`),V.exitCode=0;return}V.stdout.write(`${Bee(e,".",{internal:t.internal})} -`),V.exit(0)}function bJe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function vJe(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){F("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=vx(i,e),s={gitHead:da(e),version:Cl(),generatedAt:t.now??new Date().toISOString()},a=Qc(i),c;try{let l=t.since??Jo(e),u=Yo(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:Yc(u),auditMarkdown:Xc(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=PH({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){F("fail","bundle",i.message),V.exit(1);return}try{eJe(r,n,"utf8")}catch(i){F("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}F("pass","bundle",`${r} \xB7 ${bJe(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function SJe(t){let e=lA(t);F("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function wJe(){let t=new Rq;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(rJe),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(nJe),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(iJe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(aJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(cJe),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(mJe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(oJe),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(hJe),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)=>gJe(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(sJe),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(_Je),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(uJe),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)=>dJe(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=>PY(r,{checkStages:HE})),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=>fJe(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=>pJe(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=>aee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>cee()),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=>{lee(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=>bH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>$5(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=>vJe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(SJe),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(xY),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(tJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){rY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}A5(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(VQ),t}var xJe=!!globalThis.__CLADDING_BUNDLED,$Je=xJe||import.meta.url===`file://${V.argv[1]}`;$Je&&wJe().parse();export{lJe as TIER_STAGES,wJe as createProgram,vJe as runBundleCommand,mJe as runCheckCommand,HE as runCheckStages,oJe as runCheckpointCommand,uJe as runContextCommand,hJe as runDoneCommand,dJe as runImpactCommand,fJe as runInferDepsCommand,rJe as runInitCommand,pJe as runMeasureCommand,gJe as runOracleCommand,sJe as runRollbackCommand,SJe as runRouteCommand,nJe as runRunCommand,tJe as runServeCommand,aJe as runSetupCommand,_Je as runStatusCommand,iJe as runSyncCommand,cJe as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&W.stdout.write(` ${Mue(e.trim(),160)} +`)}}function Mue(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function DJe(t){let e=G();if(t.json){W.stdout.write(`${JSON.stringify(kx(e,"."),null,2)} +`),W.exitCode=0;return}W.stdout.write(`${Jee(e,".",{internal:t.internal})} +`),W.exit(0)}function NJe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function jJe(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"),W.exit(1);return}let n;try{let i=G(e),o=kx(i,e),s={gitHead:fa(e),version:Dl(),generatedAt:t.now??new Date().toISOString()},a=el(i),c;try{let l=t.since??Yo(e),u=Xo(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:Xc(u),auditMarkdown:Qc(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=FH({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),W.exit(1);return}try{gJe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),W.exit(1);return}L("pass","bundle",`${r} \xB7 ${NJe(Buffer.byteLength(n,"utf8"))}`),W.exit(0)}function MJe(t){let e=mA(t);L("note",`route \u2192 ${e}`,t),W.exit(e==="unknown"?1:0)}function FJe(){let t=new jq;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(_Je),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(bJe),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(vJe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(xJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action($Je),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(RJe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(SJe),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(IJe),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)=>PJe(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(wJe),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(DJe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(EJe),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)=>AJe(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=>FY(r,{checkStages:KE})),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=>TJe(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=>OJe(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=>mee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>hee()),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=>{gee(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=>kH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>R5(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=>jJe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(MJe),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(OY),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(yJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){cY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}C5(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(YQ),t}var LJe=!!globalThis.__CLADDING_BUNDLED,zJe=LJe||import.meta.url===`file://${W.argv[1]}`;zJe&&FJe().parse();export{kJe as TIER_STAGES,FJe as createProgram,jJe as runBundleCommand,RJe as runCheckCommand,KE as runCheckStages,SJe as runCheckpointCommand,EJe as runContextCommand,IJe as runDoneCommand,AJe as runImpactCommand,TJe as runInferDepsCommand,_Je as runInitCommand,OJe as runMeasureCommand,PJe as runOracleCommand,wJe as runRollbackCommand,MJe as runRouteCommand,bJe as runRunCommand,yJe as runServeCommand,xJe as runSetupCommand,DJe as runStatusCommand,vJe as runSyncCommand,$Je as runUpdateCommand}; diff --git a/plugins/codex/skills/clarify/SKILL.md b/plugins/codex/skills/clarify/SKILL.md index f92b3a3c..7b428b97 100644 --- a/plugins/codex/skills/clarify/SKILL.md +++ b/plugins/codex/skills/clarify/SKILL.md @@ -1,83 +1,14 @@ --- -description: Advance the onboarding Q&A loop after `clad init `. Pass the user's answer to the next pending question as a positional argument; 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`. Use when the user is mid-onboarding and you have collected their reply to one clarifying question — never invent answers. +description: Advance Cladding onboarding after the user answers a pending product question. Use the MCP prepare/apply flow, preserve the answer verbatim, and never invent answers. --- -# Cladding clarify (formerly `refine`) +# Cladding clarify -Drives the **iterative onboarding loop** initiated by `clad init `. The init pass writes `.cladding/onboarding/state.yaml` with 2–3 clarifying questions; `clad clarify ` advances the loop one question at a time. +Use this workflow only after Cladding initialization returned a pending question and the user has answered it. -## Artifacts produced (by Tier) +1. Call `clad_prepare_clarify` with the user's answer verbatim. +2. Read the returned prompt, current state, and artifacts. Draft the structured refinement required by `clad_clarify` using the current host model. +3. Call `clad_clarify` with the same answer, the one-time token, and the draft. +4. Ask `nextQuestion` verbatim when one remains; otherwise report that onboarding is complete. -| Tier | File | Authority | -|---|---|---| -| A | `spec/scenarios/-.yaml` (refined, v0.3.45+) | Spec SSoT (onboarding output) | -| B | `spec/architecture.yaml` (refined) | Design SSoT | -| B | `spec/capabilities.yaml` (refined) | Design SSoT | -| B | `docs/project-context.md` (refined) | Design SSoT | -| D | `.cladding/onboarding/state.yaml` (Q&A history updated) | transient audit | - -Existing files divert to `.cladding/scan/*.proposal` per the SSoT model's refresh policy. See [`docs/ssot-model.md`](../../docs/ssot-model.md). - -## Flow - -1. `clad init ` → produces initial artifacts + writes `state.yaml` with pending questions -2. Orchestrator asks the user the **first pending question verbatim** -3. User replies -4. Orchestrator runs `clad clarify ` (positional, no quotes needed) -5. `clad clarify` marks the question answered, re-runs the LLM with the full Q-A history, refines artifacts, may add new follow-up questions -6. Loop until `status: done` - -## Variadic positional - -``` -clad clarify 법인 사업자만 (개인사업자 제외) -clad clarify "한국 시장 위주" -clad clarify 카드 + 간편결제 우선 -``` - -All tokens are joined with spaces — quoting is optional. - -## Flags - -- `--cwd ` — directory containing `.cladding/onboarding/state.yaml` (default cwd) -- `--no-llm` — force deterministic interpreter; current artifact bodies are preserved and the answer is logged as a Q&A footnote in `docs/project-context.md` -- `--json` — emit a `RefineReport` JSON (`{cwd, answered, newQuestions, mode, status}`) instead of the formatted text - -## Output (text mode) - -- Pulse summary line — `✓ clarify answered · mode: greenfield · source: llm` -- Created / proposal entries for refined artifacts (existing files divert to `.cladding/scan/*.proposal`) -- New clarifying questions printed as a numbered list (if any) -- Closing line — `남은 질문: N 개. clad clarify <답변> 으로 계속.` OR `✓ 모든 질문에 답변 완료 — 온보딩 종료.` - -## Exit codes - -- `0` — answer accepted (or no-op when state is already done) -- `1` — fatal error (corrupt state file) -- `2` — usage error (no state file present, or no answer provided) - -## State file - -`.cladding/onboarding/state.yaml` shape: - -```yaml -intent: "결제 SaaS for B2B" -language: typescript -projectName: payment-saas -mode: greenfield -startedAt: 2026-05-21T12:34:56.789Z -status: active -qa: - - question: "주 사용자가 개인? 사업자?" - answer: "법인 사업자만" - - question: "어떤 결제수단 우선?" - answer: null -``` - -`status: done` is set once every question has an answer AND the latest refinement returned no new questions. The file stays on disk as an audit log of the onboarding decisions. - -## When NOT to invoke - -- `state.yaml` does not exist → exit 2. Run `clad init ` first. -- The user has not replied yet — never invent answers. Wait for their actual response. -- The user is asking about an unrelated topic — pause the loop and resume later when they're ready. +Do not run `clad clarify` in a shell from an AI host. Do not use MCP sampling. Never answer a product question on the user's behalf. A stale, malformed, replayed, or answer-mismatched apply request is a no-op and must be prepared again. diff --git a/plugins/codex/skills/init/SKILL.md b/plugins/codex/skills/init/SKILL.md index 8e7da77a..ef6ebedd 100644 --- a/plugins/codex/skills/init/SKILL.md +++ b/plugins/codex/skills/init/SKILL.md @@ -1,101 +1,25 @@ --- -description: Scaffold a cladding workspace. Pass a free-text project description as positional argument to drive intent-aware onboarding — the LLM produces domain-aware spec/docs plus product-level follow-up questions. Use when the user wants to start a new Ironclad project, adopt cladding into an existing repo, or refresh artifacts via re-scan. +description: Scaffold a Cladding workspace from a new idea, a planning document, or an existing project. Use the MCP prepare/apply flow so the current host model drafts domain-aware artifacts without requiring MCP sampling or a shell command. --- # Cladding init -Run `clad init` from the directory where the cladding workspace should live. Idempotent — skips files that already exist unless `--force` is supplied. +Use this workflow only when the user explicitly asks to initialize, adopt, or refresh Cladding. Opening a repository alone is not consent to initialize it. -## Artifacts produced (by Tier) +## Required host workflow -| Tier | File | Authority | -|---|---|---| -| A | `spec.yaml` (seed) | Spec SSoT (Iron Law sealed) | -| A | `spec/scenarios/-.yaml` (v0.3.45+, intent path only) | Spec SSoT (onboarding output) | -| B | `spec/architecture.yaml` | Design SSoT | -| B | `spec/capabilities.yaml` | Design SSoT | -| B | `docs/project-context.md` | Design SSoT (intent + Why/What/Purpose) | -| C | `docs/conventions.md` | derived from observed code OR greenfield seed | -| D | `.cladding/onboarding/state.yaml` (intent path only) | transient — Q&A audit | +1. If a greenfield request has no project intent, ask for one short description. +2. Call `clad_prepare_init` with exactly one starting mode: + - `idea` with the user's description. + - `document` with a project-relative planning-document path. + - `existing` for an existing codebase; include an optional adoption goal. +3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. +4. Show `plannedChanges` and `confirmationQuestion` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only after an affirmative user reply, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. +6. Ask the returned `nextQuestion` verbatim. Continue with the Cladding clarify workflow after the user answers. -See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the full 4-tier governance. +Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. -## Intent-aware onboarding (v0.3.43+) +`clad_prepare_init` is read-only. Never call prepare and apply in the same assistant turn. Only `clad_init` writes artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. -The strongest path is to pass the user's project intent as positional argument (no `--intent` keyword, no quotes needed): - -``` -clad init 결제 SaaS for B2B Stripe Toss 지원 -clad init AI 코드 리뷰 봇 만들거야 -clad init 이 프로젝트 분석해서 클래딩 적용해줘 -``` - -The LLM dispatcher then produces **domain-aware** artifacts that exceed what the user explicitly stated: - -- `docs/project-context.md` — Why/What/Purpose with inferred domain context (compliance norms, scale assumptions, common patterns) -- `spec/capabilities.yaml` — user-stated + inferred capabilities (3-8 entries; payment → idempotency, webhook signing; ML → data lineage, eval harness; SaaS → multi-tenancy, audit log) -- `spec/architecture.yaml` — layers tailored to domain + language -- 2-3 follow-up clarifying questions printed to stdout as CLI hints (product/business level — not technical jargon) - -**AI orchestrators MUST ask the user for intent before invoking `clad init` on a greenfield workspace** (see `src/agents/orchestrator.md` principle 6). A bare `clad init` on a brand-new project falls back to generic toolchain seeds and misses the user's intent. For existing projects (≥3 source files) bare `clad init` is fine — the observed scan path captures shape directly. - -## Flags - -- `--name ` — override the project name (default: cwd basename). -- `--force` — overwrite an existing `spec.yaml`. -- `--scan` — force-walk the existing codebase to write observed artifacts. Default auto-detects (≥3 source files trigger scan); use `--no-scan` to skip even when source is present. Orthogonal to positional intent — can combine (`clad init 결제 SaaS --scan`). -- `--no-llm` — force the deterministic interpreter. Intent text still routes but falls back to a deterministic body quoting the intent verbatim. -- `--roots ` — comma-separated source-root override (e.g. `packages/a/src,packages/b/src`). Otherwise inferred from manifests + directory heuristics. - -When `--scan` runs (or auto-runs on a codebase with ≥3 source files) it writes: - -- `docs/conventions.md` — observed indent / quote / naming / error-handling / test-location conventions plus a representative module quote. -- `spec/architecture.yaml` — observed layers + forbidden-import candidates derived from the import graph. -- `spec/capabilities.yaml` — README `##` headings rendered as capability candidates (v0.3.38+). -- `docs/project-context.md` — forest-level Why / What / Purpose; LLM-refined when a dispatcher is available, deterministic template otherwise. -- `spec/scenarios/README.md` — explains the scenarios-are-intent policy (v0.3.30+). - -Existing files are diverted to `.cladding/scan/*.proposal` rather than overwritten. - -### Greenfield seeds (v0.3.42+) - -When `--scan` does **not** fire (brand-new project with <3 source files), `clad init` still writes the same three artifacts as **greenfield seeds** so the spec/docs surface is always complete: - -- `docs/conventions.md` — toolchain-default 14-signal table. TypeScript → 2-space + single quote + camelCase + `tests-dir` test layout, Python → 4-space + double quote + snake_case, Go → tab + PascalCase + `sibling-test`, Rust → 4-space + snake_case + result-pattern, etc. Each seed inlines a one-line link to the canonical style guide (Google TS / PEP 8 / Effective Go / Google Java / …). -- `spec/architecture.yaml` — `version: "0.1"` + empty `layers: []` + a language-specific baseline suggestion in the header comment (TypeScript → `src/cli/` / `src/core/` / `src/lib/` / `src/ui/`, Python → `src//` / `tests/`, Go → `cmd/` / `pkg/` / `internal/`, …). -- `spec/capabilities.yaml` — `schema: "0.1"` + `source: README.md` + empty `capabilities: []` + guidance comment on the per-entry shape. - -Each seed carries a header marking it as a greenfield template. After you write initial code (and optionally a README), re-run `clad init --scan`; the observed bodies divert to `.cladding/scan/.proposal` so you can diff seed vs reality and merge the parts you want. Personas downstream (`developer`, `planner`) therefore treat every scan artifact as **always present**, with the SEED header telling them which mode is live. - -After init: - -1. Edit `spec.yaml` (project metadata). Features are added on demand — ask the AI in natural language ("add a feature for login flow"), call the `clad_create_feature` MCP tool, or use the `clad` CLI. Feature shards always use the hash-based id `F-` (v0.3.9+) — filename `-.yaml`, `id: F-`, `slug: `. `clad init` does **not** write a legacy `F-001` placeholder for external users (v0.4.0+). -2. Run `clad sync` to verify the spec is valid. -3. Run `clad check` to see which Iron Law stages are wired up for the toolchain cladding detects in the cwd. -4. (Optional) Run `clad doctor` to confirm `.cladding/events.log.jsonl` shows no `sentinel_miss` events from the scan refinement. - -``` -clad init # bare (greenfield seeds + hint, or observed scan) -clad init 결제 SaaS for B2B # intent-aware onboarding (positional, no quotes needed) -clad init "AI 코드 리뷰 봇" # quotes OK too -clad init 이 프로젝트 분석해서 클래딩 적용해줘 # intent that signals existing adoption -clad init docs/plan.md # path-aware intent (v0.3.61+) — file contents auto-loaded as intent -clad init /absolute/path/spec.md # absolute path also supported (same .md/.txt/.yaml/.yml/.markdown rule) -clad init --name my-project -clad init --force -clad init --scan --no-llm -clad init --roots packages/a/src,packages/b/src -``` - -## Path-aware intent (v0.3.61+, F-5f6b45) - -When the positional argument looks like a text-file path (recognized extension `.md` / `.txt` / `.yaml` / `.yml` / `.markdown`) and the file exists under cwd, cladding loads the file body and forwards *that* to the onboarding LLM dispatcher — not the literal path string. This closes the gap where `clad init "$(cat docs/plan.md)"` (shell substitution) was the only way to feed a planning document into onboarding. - -Behavior: - -- **Existing text file** → contents become the intent. stderr prints `loaded intent from ` for transparency. -- **Missing file** with a path-like extension → stderr warning + free-text fallback (the literal argument is forwarded as intent so onboarding still runs). -- **Directory** ending in `.md` (rare) → stderr warning + free-text fallback. -- **Non-text argument** (e.g. `결제 SaaS 만들거야`) → existing free-text behavior, zero regression. - -Host invocations inherit this behavior automatically because every skill, command, and MCP init tool delegates to the same `clad init` engine. Claude Code and Gemini CLI expose `/cladding:init`; in Codex, type `$cladding` and choose `init (cladding)`; MCP-only hosts can ask in natural language. +The raw CLI remains available for terminal, CI, offline, and explicitly configured SDK automation; it is not the primary host onboarding path. diff --git a/plugins/codex/skills/orchestrator/SKILL.md b/plugins/codex/skills/orchestrator/SKILL.md index 49b89e79..db1ea39e 100644 --- a/plugins/codex/skills/orchestrator/SKILL.md +++ b/plugins/codex/skills/orchestrator/SKILL.md @@ -29,17 +29,7 @@ You do NOT pre-load Tier C (conventions — developer's concern). 3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. 4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). 5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. -6. **Init + refine policy (의무)** — Two-step Q&A loop that captures intent and refines spec/docs through the user's own answers. - - **Step 6a (init).** Before calling `clad init` on a greenfield project (empty directory or `<3` source files), **ASK THE USER for their project intent in one line**. A natural question is enough: "어떤 종류의 프로젝트인가요? 한 줄로 설명해주세요". Forward the user's reply as the positional intent: `clad init ` (no quotes needed — commander treats trailing tokens as variadic). The init handler routes the LLM to produce a domain-aware project-context + capabilities + architecture + a real first-feature title (used when the AI later registers the first feature via `clad_create_feature`) + 2-3 product-level clarifying questions, and writes `.cladding/onboarding/state.yaml` with the questions marked pending. DO NOT call bare `clad init` on a greenfield workspace — the result is a generic toolchain scaffold that misses the user's actual intent. (For an existing project ≥3 source files, bare `clad init` is fine — the observed scan path captures the codebase shape directly.) - - **Step 6b (clarify loop).** After init, drive the Q&A loop until the onboarding state file is marked `status: done`: - - Read `.cladding/onboarding/state.yaml` and find the first `answer: null` entry. - - Ask the user that exact question in chat, verbatim. Do NOT rephrase technical-sounding questions into your own words — the LLM calibrated them at product-owner vocabulary level. - - When the user replies, run `clad clarify ` (no quotes needed). The handler marks the question answered, calls the LLM with the full Q-A history, refines `docs/project-context.md` + `spec/capabilities.yaml` + `spec/architecture.yaml`, and may add new follow-up questions. - - Loop until `clad clarify --json` reports `status: "done"` OR the user says they have enough. Never invent extra questions — only the LLM's questions are sanctioned for this loop. - - If the user declines to answer a question, accept that and skip it (they can revisit via `clad clarify ` later, since pending state persists). +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes, and wait for a separate affirmative user reply. The original request is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. ## Feature cycle — one feature at a time diff --git a/plugins/gemini-cli/commands/init.toml b/plugins/gemini-cli/commands/init.toml index 7797ad3c..e9ad6ff3 100644 --- a/plugins/gemini-cli/commands/init.toml +++ b/plugins/gemini-cli/commands/init.toml @@ -1,100 +1,24 @@ -description = "Scaffold a cladding workspace. Pass a free-text project description as positional argument to drive intent-aware onboarding — the LLM produces domain-aware spec/docs plus product-level follow-up questions. Use when the user wants to start a new Ironclad project, adopt cladding into an existing repo, or refresh artifacts via re-scan." +description = "Scaffold a Cladding workspace from a new idea, a planning document, or an existing project. Use the MCP prepare/apply flow so the current host model drafts domain-aware artifacts without requiring MCP sampling or a shell command." prompt = ''' # Cladding init -Run `clad init` from the directory where the cladding workspace should live. Idempotent — skips files that already exist unless `--force` is supplied. +Use this workflow only when the user explicitly asks to initialize, adopt, or refresh Cladding. Opening a repository alone is not consent to initialize it. -## Artifacts produced (by Tier) +## Required host workflow -| Tier | File | Authority | -|---|---|---| -| A | `spec.yaml` (seed) | Spec SSoT (Iron Law sealed) | -| A | `spec/scenarios/-.yaml` (v0.3.45+, intent path only) | Spec SSoT (onboarding output) | -| B | `spec/architecture.yaml` | Design SSoT | -| B | `spec/capabilities.yaml` | Design SSoT | -| B | `docs/project-context.md` | Design SSoT (intent + Why/What/Purpose) | -| C | `docs/conventions.md` | derived from observed code OR greenfield seed | -| D | `.cladding/onboarding/state.yaml` (intent path only) | transient — Q&A audit | +1. If a greenfield request has no project intent, ask for one short description. +2. Call `clad_prepare_init` with exactly one starting mode: + - `idea` with the user's description. + - `document` with a project-relative planning-document path. + - `existing` for an existing codebase; include an optional adoption goal. +3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. +4. Show `plannedChanges` and `confirmationQuestion` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only after an affirmative user reply, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. +6. Ask the returned `nextQuestion` verbatim. Continue with the Cladding clarify workflow after the user answers. -See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the full 4-tier governance. +Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. -## Intent-aware onboarding (v0.3.43+) +`clad_prepare_init` is read-only. Never call prepare and apply in the same assistant turn. Only `clad_init` writes artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. -The strongest path is to pass the user's project intent as positional argument (no `--intent` keyword, no quotes needed): - -``` -clad init 결제 SaaS for B2B Stripe Toss 지원 -clad init AI 코드 리뷰 봇 만들거야 -clad init 이 프로젝트 분석해서 클래딩 적용해줘 -``` - -The LLM dispatcher then produces **domain-aware** artifacts that exceed what the user explicitly stated: - -- `docs/project-context.md` — Why/What/Purpose with inferred domain context (compliance norms, scale assumptions, common patterns) -- `spec/capabilities.yaml` — user-stated + inferred capabilities (3-8 entries; payment → idempotency, webhook signing; ML → data lineage, eval harness; SaaS → multi-tenancy, audit log) -- `spec/architecture.yaml` — layers tailored to domain + language -- 2-3 follow-up clarifying questions printed to stdout as CLI hints (product/business level — not technical jargon) - -**AI orchestrators MUST ask the user for intent before invoking `clad init` on a greenfield workspace** (see `src/agents/orchestrator.md` principle 6). A bare `clad init` on a brand-new project falls back to generic toolchain seeds and misses the user's intent. For existing projects (≥3 source files) bare `clad init` is fine — the observed scan path captures shape directly. - -## Flags - -- `--name ` — override the project name (default: cwd basename). -- `--force` — overwrite an existing `spec.yaml`. -- `--scan` — force-walk the existing codebase to write observed artifacts. Default auto-detects (≥3 source files trigger scan); use `--no-scan` to skip even when source is present. Orthogonal to positional intent — can combine (`clad init 결제 SaaS --scan`). -- `--no-llm` — force the deterministic interpreter. Intent text still routes but falls back to a deterministic body quoting the intent verbatim. -- `--roots ` — comma-separated source-root override (e.g. `packages/a/src,packages/b/src`). Otherwise inferred from manifests + directory heuristics. - -When `--scan` runs (or auto-runs on a codebase with ≥3 source files) it writes: - -- `docs/conventions.md` — observed indent / quote / naming / error-handling / test-location conventions plus a representative module quote. -- `spec/architecture.yaml` — observed layers + forbidden-import candidates derived from the import graph. -- `spec/capabilities.yaml` — README `##` headings rendered as capability candidates (v0.3.38+). -- `docs/project-context.md` — forest-level Why / What / Purpose; LLM-refined when a dispatcher is available, deterministic template otherwise. -- `spec/scenarios/README.md` — explains the scenarios-are-intent policy (v0.3.30+). - -Existing files are diverted to `.cladding/scan/*.proposal` rather than overwritten. - -### Greenfield seeds (v0.3.42+) - -When `--scan` does **not** fire (brand-new project with <3 source files), `clad init` still writes the same three artifacts as **greenfield seeds** so the spec/docs surface is always complete: - -- `docs/conventions.md` — toolchain-default 14-signal table. TypeScript → 2-space + single quote + camelCase + `tests-dir` test layout, Python → 4-space + double quote + snake_case, Go → tab + PascalCase + `sibling-test`, Rust → 4-space + snake_case + result-pattern, etc. Each seed inlines a one-line link to the canonical style guide (Google TS / PEP 8 / Effective Go / Google Java / …). -- `spec/architecture.yaml` — `version: "0.1"` + empty `layers: []` + a language-specific baseline suggestion in the header comment (TypeScript → `src/cli/` / `src/core/` / `src/lib/` / `src/ui/`, Python → `src//` / `tests/`, Go → `cmd/` / `pkg/` / `internal/`, …). -- `spec/capabilities.yaml` — `schema: "0.1"` + `source: README.md` + empty `capabilities: []` + guidance comment on the per-entry shape. - -Each seed carries a header marking it as a greenfield template. After you write initial code (and optionally a README), re-run `clad init --scan`; the observed bodies divert to `.cladding/scan/.proposal` so you can diff seed vs reality and merge the parts you want. Personas downstream (`developer`, `planner`) therefore treat every scan artifact as **always present**, with the SEED header telling them which mode is live. - -After init: - -1. Edit `spec.yaml` (project metadata). Features are added on demand — ask the AI in natural language ("add a feature for login flow"), call the `clad_create_feature` MCP tool, or use the `clad` CLI. Feature shards always use the hash-based id `F-` (v0.3.9+) — filename `-.yaml`, `id: F-`, `slug: `. `clad init` does **not** write a legacy `F-001` placeholder for external users (v0.4.0+). -2. Run `clad sync` to verify the spec is valid. -3. Run `clad check` to see which Iron Law stages are wired up for the toolchain cladding detects in the cwd. -4. (Optional) Run `clad doctor` to confirm `.cladding/events.log.jsonl` shows no `sentinel_miss` events from the scan refinement. - -``` -clad init # bare (greenfield seeds + hint, or observed scan) -clad init 결제 SaaS for B2B # intent-aware onboarding (positional, no quotes needed) -clad init "AI 코드 리뷰 봇" # quotes OK too -clad init 이 프로젝트 분석해서 클래딩 적용해줘 # intent that signals existing adoption -clad init docs/plan.md # path-aware intent (v0.3.61+) — file contents auto-loaded as intent -clad init /absolute/path/spec.md # absolute path also supported (same .md/.txt/.yaml/.yml/.markdown rule) -clad init --name my-project -clad init --force -clad init --scan --no-llm -clad init --roots packages/a/src,packages/b/src -``` - -## Path-aware intent (v0.3.61+, F-5f6b45) - -When the positional argument looks like a text-file path (recognized extension `.md` / `.txt` / `.yaml` / `.yml` / `.markdown`) and the file exists under cwd, cladding loads the file body and forwards *that* to the onboarding LLM dispatcher — not the literal path string. This closes the gap where `clad init "$(cat docs/plan.md)"` (shell substitution) was the only way to feed a planning document into onboarding. - -Behavior: - -- **Existing text file** → contents become the intent. stderr prints `loaded intent from ` for transparency. -- **Missing file** with a path-like extension → stderr warning + free-text fallback (the literal argument is forwarded as intent so onboarding still runs). -- **Directory** ending in `.md` (rare) → stderr warning + free-text fallback. -- **Non-text argument** (e.g. `결제 SaaS 만들거야`) → existing free-text behavior, zero regression. - -Host invocations inherit this behavior automatically because every skill, command, and MCP init tool delegates to the same `clad init` engine. Claude Code and Gemini CLI expose `/cladding:init`; in Codex, type `$cladding` and choose `init (cladding)`; MCP-only hosts can ask in natural language. +The raw CLI remains available for terminal, CI, offline, and explicitly configured SDK automation; it is not the primary host onboarding path. ''' diff --git a/skills/clarify/SKILL.md b/skills/clarify/SKILL.md index f92b3a3c..7b428b97 100644 --- a/skills/clarify/SKILL.md +++ b/skills/clarify/SKILL.md @@ -1,83 +1,14 @@ --- -description: Advance the onboarding Q&A loop after `clad init `. Pass the user's answer to the next pending question as a positional argument; 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`. Use when the user is mid-onboarding and you have collected their reply to one clarifying question — never invent answers. +description: Advance Cladding onboarding after the user answers a pending product question. Use the MCP prepare/apply flow, preserve the answer verbatim, and never invent answers. --- -# Cladding clarify (formerly `refine`) +# Cladding clarify -Drives the **iterative onboarding loop** initiated by `clad init `. The init pass writes `.cladding/onboarding/state.yaml` with 2–3 clarifying questions; `clad clarify ` advances the loop one question at a time. +Use this workflow only after Cladding initialization returned a pending question and the user has answered it. -## Artifacts produced (by Tier) +1. Call `clad_prepare_clarify` with the user's answer verbatim. +2. Read the returned prompt, current state, and artifacts. Draft the structured refinement required by `clad_clarify` using the current host model. +3. Call `clad_clarify` with the same answer, the one-time token, and the draft. +4. Ask `nextQuestion` verbatim when one remains; otherwise report that onboarding is complete. -| Tier | File | Authority | -|---|---|---| -| A | `spec/scenarios/-.yaml` (refined, v0.3.45+) | Spec SSoT (onboarding output) | -| B | `spec/architecture.yaml` (refined) | Design SSoT | -| B | `spec/capabilities.yaml` (refined) | Design SSoT | -| B | `docs/project-context.md` (refined) | Design SSoT | -| D | `.cladding/onboarding/state.yaml` (Q&A history updated) | transient audit | - -Existing files divert to `.cladding/scan/*.proposal` per the SSoT model's refresh policy. See [`docs/ssot-model.md`](../../docs/ssot-model.md). - -## Flow - -1. `clad init ` → produces initial artifacts + writes `state.yaml` with pending questions -2. Orchestrator asks the user the **first pending question verbatim** -3. User replies -4. Orchestrator runs `clad clarify ` (positional, no quotes needed) -5. `clad clarify` marks the question answered, re-runs the LLM with the full Q-A history, refines artifacts, may add new follow-up questions -6. Loop until `status: done` - -## Variadic positional - -``` -clad clarify 법인 사업자만 (개인사업자 제외) -clad clarify "한국 시장 위주" -clad clarify 카드 + 간편결제 우선 -``` - -All tokens are joined with spaces — quoting is optional. - -## Flags - -- `--cwd ` — directory containing `.cladding/onboarding/state.yaml` (default cwd) -- `--no-llm` — force deterministic interpreter; current artifact bodies are preserved and the answer is logged as a Q&A footnote in `docs/project-context.md` -- `--json` — emit a `RefineReport` JSON (`{cwd, answered, newQuestions, mode, status}`) instead of the formatted text - -## Output (text mode) - -- Pulse summary line — `✓ clarify answered · mode: greenfield · source: llm` -- Created / proposal entries for refined artifacts (existing files divert to `.cladding/scan/*.proposal`) -- New clarifying questions printed as a numbered list (if any) -- Closing line — `남은 질문: N 개. clad clarify <답변> 으로 계속.` OR `✓ 모든 질문에 답변 완료 — 온보딩 종료.` - -## Exit codes - -- `0` — answer accepted (or no-op when state is already done) -- `1` — fatal error (corrupt state file) -- `2` — usage error (no state file present, or no answer provided) - -## State file - -`.cladding/onboarding/state.yaml` shape: - -```yaml -intent: "결제 SaaS for B2B" -language: typescript -projectName: payment-saas -mode: greenfield -startedAt: 2026-05-21T12:34:56.789Z -status: active -qa: - - question: "주 사용자가 개인? 사업자?" - answer: "법인 사업자만" - - question: "어떤 결제수단 우선?" - answer: null -``` - -`status: done` is set once every question has an answer AND the latest refinement returned no new questions. The file stays on disk as an audit log of the onboarding decisions. - -## When NOT to invoke - -- `state.yaml` does not exist → exit 2. Run `clad init ` first. -- The user has not replied yet — never invent answers. Wait for their actual response. -- The user is asking about an unrelated topic — pause the loop and resume later when they're ready. +Do not run `clad clarify` in a shell from an AI host. Do not use MCP sampling. Never answer a product question on the user's behalf. A stale, malformed, replayed, or answer-mismatched apply request is a no-op and must be prepared again. diff --git a/skills/init/SKILL.md b/skills/init/SKILL.md index 8e7da77a..ef6ebedd 100644 --- a/skills/init/SKILL.md +++ b/skills/init/SKILL.md @@ -1,101 +1,25 @@ --- -description: Scaffold a cladding workspace. Pass a free-text project description as positional argument to drive intent-aware onboarding — the LLM produces domain-aware spec/docs plus product-level follow-up questions. Use when the user wants to start a new Ironclad project, adopt cladding into an existing repo, or refresh artifacts via re-scan. +description: Scaffold a Cladding workspace from a new idea, a planning document, or an existing project. Use the MCP prepare/apply flow so the current host model drafts domain-aware artifacts without requiring MCP sampling or a shell command. --- # Cladding init -Run `clad init` from the directory where the cladding workspace should live. Idempotent — skips files that already exist unless `--force` is supplied. +Use this workflow only when the user explicitly asks to initialize, adopt, or refresh Cladding. Opening a repository alone is not consent to initialize it. -## Artifacts produced (by Tier) +## Required host workflow -| Tier | File | Authority | -|---|---|---| -| A | `spec.yaml` (seed) | Spec SSoT (Iron Law sealed) | -| A | `spec/scenarios/-.yaml` (v0.3.45+, intent path only) | Spec SSoT (onboarding output) | -| B | `spec/architecture.yaml` | Design SSoT | -| B | `spec/capabilities.yaml` | Design SSoT | -| B | `docs/project-context.md` | Design SSoT (intent + Why/What/Purpose) | -| C | `docs/conventions.md` | derived from observed code OR greenfield seed | -| D | `.cladding/onboarding/state.yaml` (intent path only) | transient — Q&A audit | +1. If a greenfield request has no project intent, ask for one short description. +2. Call `clad_prepare_init` with exactly one starting mode: + - `idea` with the user's description. + - `document` with a project-relative planning-document path. + - `existing` for an existing codebase; include an optional adoption goal. +3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. +4. Show `plannedChanges` and `confirmationQuestion` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only after an affirmative user reply, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. +6. Ask the returned `nextQuestion` verbatim. Continue with the Cladding clarify workflow after the user answers. -See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the full 4-tier governance. +Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. -## Intent-aware onboarding (v0.3.43+) +`clad_prepare_init` is read-only. Never call prepare and apply in the same assistant turn. Only `clad_init` writes artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. -The strongest path is to pass the user's project intent as positional argument (no `--intent` keyword, no quotes needed): - -``` -clad init 결제 SaaS for B2B Stripe Toss 지원 -clad init AI 코드 리뷰 봇 만들거야 -clad init 이 프로젝트 분석해서 클래딩 적용해줘 -``` - -The LLM dispatcher then produces **domain-aware** artifacts that exceed what the user explicitly stated: - -- `docs/project-context.md` — Why/What/Purpose with inferred domain context (compliance norms, scale assumptions, common patterns) -- `spec/capabilities.yaml` — user-stated + inferred capabilities (3-8 entries; payment → idempotency, webhook signing; ML → data lineage, eval harness; SaaS → multi-tenancy, audit log) -- `spec/architecture.yaml` — layers tailored to domain + language -- 2-3 follow-up clarifying questions printed to stdout as CLI hints (product/business level — not technical jargon) - -**AI orchestrators MUST ask the user for intent before invoking `clad init` on a greenfield workspace** (see `src/agents/orchestrator.md` principle 6). A bare `clad init` on a brand-new project falls back to generic toolchain seeds and misses the user's intent. For existing projects (≥3 source files) bare `clad init` is fine — the observed scan path captures shape directly. - -## Flags - -- `--name ` — override the project name (default: cwd basename). -- `--force` — overwrite an existing `spec.yaml`. -- `--scan` — force-walk the existing codebase to write observed artifacts. Default auto-detects (≥3 source files trigger scan); use `--no-scan` to skip even when source is present. Orthogonal to positional intent — can combine (`clad init 결제 SaaS --scan`). -- `--no-llm` — force the deterministic interpreter. Intent text still routes but falls back to a deterministic body quoting the intent verbatim. -- `--roots ` — comma-separated source-root override (e.g. `packages/a/src,packages/b/src`). Otherwise inferred from manifests + directory heuristics. - -When `--scan` runs (or auto-runs on a codebase with ≥3 source files) it writes: - -- `docs/conventions.md` — observed indent / quote / naming / error-handling / test-location conventions plus a representative module quote. -- `spec/architecture.yaml` — observed layers + forbidden-import candidates derived from the import graph. -- `spec/capabilities.yaml` — README `##` headings rendered as capability candidates (v0.3.38+). -- `docs/project-context.md` — forest-level Why / What / Purpose; LLM-refined when a dispatcher is available, deterministic template otherwise. -- `spec/scenarios/README.md` — explains the scenarios-are-intent policy (v0.3.30+). - -Existing files are diverted to `.cladding/scan/*.proposal` rather than overwritten. - -### Greenfield seeds (v0.3.42+) - -When `--scan` does **not** fire (brand-new project with <3 source files), `clad init` still writes the same three artifacts as **greenfield seeds** so the spec/docs surface is always complete: - -- `docs/conventions.md` — toolchain-default 14-signal table. TypeScript → 2-space + single quote + camelCase + `tests-dir` test layout, Python → 4-space + double quote + snake_case, Go → tab + PascalCase + `sibling-test`, Rust → 4-space + snake_case + result-pattern, etc. Each seed inlines a one-line link to the canonical style guide (Google TS / PEP 8 / Effective Go / Google Java / …). -- `spec/architecture.yaml` — `version: "0.1"` + empty `layers: []` + a language-specific baseline suggestion in the header comment (TypeScript → `src/cli/` / `src/core/` / `src/lib/` / `src/ui/`, Python → `src//` / `tests/`, Go → `cmd/` / `pkg/` / `internal/`, …). -- `spec/capabilities.yaml` — `schema: "0.1"` + `source: README.md` + empty `capabilities: []` + guidance comment on the per-entry shape. - -Each seed carries a header marking it as a greenfield template. After you write initial code (and optionally a README), re-run `clad init --scan`; the observed bodies divert to `.cladding/scan/.proposal` so you can diff seed vs reality and merge the parts you want. Personas downstream (`developer`, `planner`) therefore treat every scan artifact as **always present**, with the SEED header telling them which mode is live. - -After init: - -1. Edit `spec.yaml` (project metadata). Features are added on demand — ask the AI in natural language ("add a feature for login flow"), call the `clad_create_feature` MCP tool, or use the `clad` CLI. Feature shards always use the hash-based id `F-` (v0.3.9+) — filename `-.yaml`, `id: F-`, `slug: `. `clad init` does **not** write a legacy `F-001` placeholder for external users (v0.4.0+). -2. Run `clad sync` to verify the spec is valid. -3. Run `clad check` to see which Iron Law stages are wired up for the toolchain cladding detects in the cwd. -4. (Optional) Run `clad doctor` to confirm `.cladding/events.log.jsonl` shows no `sentinel_miss` events from the scan refinement. - -``` -clad init # bare (greenfield seeds + hint, or observed scan) -clad init 결제 SaaS for B2B # intent-aware onboarding (positional, no quotes needed) -clad init "AI 코드 리뷰 봇" # quotes OK too -clad init 이 프로젝트 분석해서 클래딩 적용해줘 # intent that signals existing adoption -clad init docs/plan.md # path-aware intent (v0.3.61+) — file contents auto-loaded as intent -clad init /absolute/path/spec.md # absolute path also supported (same .md/.txt/.yaml/.yml/.markdown rule) -clad init --name my-project -clad init --force -clad init --scan --no-llm -clad init --roots packages/a/src,packages/b/src -``` - -## Path-aware intent (v0.3.61+, F-5f6b45) - -When the positional argument looks like a text-file path (recognized extension `.md` / `.txt` / `.yaml` / `.yml` / `.markdown`) and the file exists under cwd, cladding loads the file body and forwards *that* to the onboarding LLM dispatcher — not the literal path string. This closes the gap where `clad init "$(cat docs/plan.md)"` (shell substitution) was the only way to feed a planning document into onboarding. - -Behavior: - -- **Existing text file** → contents become the intent. stderr prints `loaded intent from ` for transparency. -- **Missing file** with a path-like extension → stderr warning + free-text fallback (the literal argument is forwarded as intent so onboarding still runs). -- **Directory** ending in `.md` (rare) → stderr warning + free-text fallback. -- **Non-text argument** (e.g. `결제 SaaS 만들거야`) → existing free-text behavior, zero regression. - -Host invocations inherit this behavior automatically because every skill, command, and MCP init tool delegates to the same `clad init` engine. Claude Code and Gemini CLI expose `/cladding:init`; in Codex, type `$cladding` and choose `init (cladding)`; MCP-only hosts can ask in natural language. +The raw CLI remains available for terminal, CI, offline, and explicitly configured SDK automation; it is not the primary host onboarding path. diff --git a/spec/features/natural-language-init-0f4dd6.yaml b/spec/features/natural-language-init-0f4dd6.yaml index 4abab9d9..38e661a3 100644 --- a/spec/features/natural-language-init-0f4dd6.yaml +++ b/spec/features/natural-language-init-0f4dd6.yaml @@ -6,6 +6,7 @@ modules: - src/serve/server.ts - src/cli/init.ts - src/cli/clarify.ts + - src/cli/host-onboarding.ts - src/cli/hook.ts - src/ui/softShell.ts - src/init/host-setup.ts @@ -74,3 +75,17 @@ acceptance_criteria: A host-neutral natural-language entry point preserves the product model while host-specific syntax remains an optional accelerator. ## Trade-off MCP init and clarify tools are required to make that promise deterministic for hosts without a bundled skill. + - id: AC-009 + ears: unwanted + condition: if an initialization request has not been followed by a separate affirmative user confirmation after the read-only preview + action: reject the apply step without creating project artifacts + response: opening a project, asking about Cladding, or making the initial natural-language request cannot silently authorize file changes + text: If an initialization request has not been followed by a separate affirmative user confirmation after the read-only preview, the system shall reject the apply step without creating project artifacts, so opening a project, asking about Cladding, or making the initial natural-language request cannot silently authorize file changes. + test_refs: [tests/serve/init-tools.test.ts] + notes: | + ## Decision + Natural language may start the read-only preparation, but a distinct user turn authorizes the write. + ## Why + All supported MCP hosts can call tools, but they do not expose a common cryptographic user-consent primitive. + ## Trade-off + The host instruction and verbatim confirmation field provide the strongest portable boundary; a malicious host could still fabricate consent, so this is not presented as a sandbox guarantee. diff --git a/spec/index.yaml b/spec/index.yaml index e163780e..38cc2f0f 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -94,7 +94,7 @@ features: F-0e84628e: {slug: merge-ritual-docs, status: done, modules: 2} F-0ed2db: {slug: ai-hints-consumer-instructions, status: done, modules: 11} F-0f2984d0: {slug: infer-deps-dynamic-flag, status: done, modules: 2} - F-0f4dd6: {slug: natural-language-init, status: in_progress, modules: 8} + F-0f4dd6: {slug: natural-language-init, status: in_progress, modules: 9} F-10cc42d1: {slug: git-op-write-guard, status: done, modules: 5} F-12d740: {slug: atomic-ac-evidence-fanout, status: done, modules: 1} F-15999130: {slug: inferable-depends-on-detector, status: done, modules: 2} diff --git a/src/agents/orchestrator.md b/src/agents/orchestrator.md index 49b89e79..db1ea39e 100644 --- a/src/agents/orchestrator.md +++ b/src/agents/orchestrator.md @@ -29,17 +29,7 @@ You do NOT pre-load Tier C (conventions — developer's concern). 3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. 4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). 5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. -6. **Init + refine policy (의무)** — Two-step Q&A loop that captures intent and refines spec/docs through the user's own answers. - - **Step 6a (init).** Before calling `clad init` on a greenfield project (empty directory or `<3` source files), **ASK THE USER for their project intent in one line**. A natural question is enough: "어떤 종류의 프로젝트인가요? 한 줄로 설명해주세요". Forward the user's reply as the positional intent: `clad init ` (no quotes needed — commander treats trailing tokens as variadic). The init handler routes the LLM to produce a domain-aware project-context + capabilities + architecture + a real first-feature title (used when the AI later registers the first feature via `clad_create_feature`) + 2-3 product-level clarifying questions, and writes `.cladding/onboarding/state.yaml` with the questions marked pending. DO NOT call bare `clad init` on a greenfield workspace — the result is a generic toolchain scaffold that misses the user's actual intent. (For an existing project ≥3 source files, bare `clad init` is fine — the observed scan path captures the codebase shape directly.) - - **Step 6b (clarify loop).** After init, drive the Q&A loop until the onboarding state file is marked `status: done`: - - Read `.cladding/onboarding/state.yaml` and find the first `answer: null` entry. - - Ask the user that exact question in chat, verbatim. Do NOT rephrase technical-sounding questions into your own words — the LLM calibrated them at product-owner vocabulary level. - - When the user replies, run `clad clarify ` (no quotes needed). The handler marks the question answered, calls the LLM with the full Q-A history, refines `docs/project-context.md` + `spec/capabilities.yaml` + `spec/architecture.yaml`, and may add new follow-up questions. - - Loop until `clad clarify --json` reports `status: "done"` OR the user says they have enough. Never invent extra questions — only the LLM's questions are sanctioned for this loop. - - If the user declines to answer a question, accept that and skip it (they can revisit via `clad clarify ` later, since pending state persists). +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes, and wait for a separate affirmative user reply. The original request is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. ## Feature cycle — one feature at a time diff --git a/src/cli/clad.ts b/src/cli/clad.ts index 20488074..fae6521e 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -25,6 +25,7 @@ import {runVerdictCommand} from './verdict.js'; import {runUpdate} from './update.js'; import {runInit} from './init.js'; import {refineOnboarding, runClarifyCommand} from './clarify.js'; +import {prepareHostClarify, prepareHostInit, renderHostDraft} from './host-onboarding.js'; import {getCurrentCladdingVersion, runHostSetup} from '../init/host-setup.js'; import {recordEvent} from '../events/log.js'; import {buildContextSlice} from '../optimizer/context-slice.js'; @@ -83,7 +84,10 @@ export async function runServeCommand(opts: {cwd?: string}): Promise { const server = buildServer({ cwd: opts.cwd, onboarding: { + renderDraft: (draft) => renderHostDraft(draft as Parameters[0]), + prepareInit: ({cwd, mode, intent}) => prepareHostInit(cwd, mode, intent), initialize: runInit, + prepareClarify: (answer, {cwd}) => prepareHostClarify(cwd, answer), clarify: refineOnboarding, }, }); diff --git a/src/cli/clarify.ts b/src/cli/clarify.ts index 43188b6a..5cb19f96 100644 --- a/src/cli/clarify.ts +++ b/src/cli/clarify.ts @@ -41,6 +41,7 @@ import { type RefinementQa, } from './scan/intent-onboarding.js'; import {pulse} from '../ui/pulse.js'; +import type {ScanLlmDispatcher} from './scan/llm.js'; export interface RefineCommandOptions { readonly cwd?: string; @@ -48,6 +49,8 @@ export interface RefineCommandOptions { readonly json?: boolean; /** Force the deterministic interpreter (matches `clad init --no-llm`). */ readonly noLlm?: boolean; + /** Host-produced refinement response; used by the MCP prepare/apply flow. */ + readonly hostDispatcher?: ScanLlmDispatcher; } /** Wire format for `clad clarify --json`. */ @@ -143,7 +146,7 @@ export async function refineOnboarding( const qaHistory: RefinementQa[] = stateAfterAnswer.qa.flatMap((qa) => qa.answer === null ? [] : [{question: qa.question, answer: qa.answer}], ); - const dispatcher = selectDispatcher({noLlm: opts.noLlm}); + const dispatcher = opts.hostDispatcher ?? selectDispatcher({noLlm: opts.noLlm}); const refined = await interpretRefinementWithFallback( stateAfterAnswer.intent, observed, diff --git a/src/cli/host-onboarding.ts b/src/cli/host-onboarding.ts new file mode 100644 index 00000000..59c20451 --- /dev/null +++ b/src/cli/host-onboarding.ts @@ -0,0 +1,134 @@ +/** Host-model prepare/apply bridge for onboarding (F-0f4dd6). */ + +import {basename, join, resolve} from 'node:path'; +import {existsSync, readFileSync} from 'node:fs'; + +import yaml from 'yaml'; + +import {detectToolchain} from '../stages/toolchain/detect.js'; +import {scanRoot} from './scan/index.js'; +import {loadState} from './scan/onboarding-state.js'; + +export interface HostOnboardingDraft { + readonly mode: 'greenfield' | 'existing-adoption' | 'mixed'; + readonly project_context: { + readonly why: string; + readonly problem: string; + readonly purpose: string; + }; + readonly capabilities: ReadonlyArray<{ + readonly id: string; + readonly title: string; + readonly summary: string; + readonly surface: 'feature' | 'platform' | 'tool' | 'infrastructure'; + }>; + readonly architecture: { + readonly layers: ReadonlyArray<{readonly name: string; readonly forbidden_imports: readonly string[]}>; + }; + readonly first_feature_title: string; + readonly scenarios: ReadonlyArray<{ + readonly slug: string; + readonly title: string; + readonly flow: string; + }>; + readonly questions: readonly string[]; + readonly ai_hints?: Record; +} + +export interface HostPreparation { + readonly prompt: string; + readonly request: {readonly mode: string; readonly intent: string}; + readonly observation: Record; +} + +function compactScan(cwd: string): Record { + const scan = scanRoot({cwd}); + return { + project_name: basename(resolve(cwd)), + language: scan.stats.dominantLanguage === 'unknown' ? detectToolchain(cwd) : scan.stats.dominantLanguage, + source_file_count: scan.stats.filesScanned, + readme_first_paragraph: scan.projectContext?.readmeFirstParagraph ?? null, + readme_headings: (scan.projectContext?.readmeHeadings ?? []).slice(0, 10), + layers: scan.architecture.layers.slice(0, 12).map((layer) => ({name: layer.name, modules: layer.moduleCount})), + import_edges: scan.architecture.importGraph.slice(0, 12), + conventions: scan.conventions, + public_signatures: scan.examples.slice(0, 6).map((example) => ({ + layer: example.layer, + module: example.modulePath, + signature: example.moduleContent.split('\n').filter((line) => /\b(export|class|interface|function)\b/.test(line)).slice(0, 3), + })), + }; +} + +/** Builds a bounded, read-only briefing for the current host model. */ +export function prepareHostInit(cwd: string, mode: string, intent: string): HostPreparation { + const observation = compactScan(cwd); + const prompt = [ + 'Draft Cladding onboarding data from the user request and observations below.', + 'Return one object matching the supplied MCP draft schema; do not edit files or run shell commands.', + 'Use the user language. Infer useful domain practices, but keep questions at product/business level.', + 'Produce 3-8 capabilities, 1-3 user-journey scenarios, and 2-3 questions.', + 'Architecture layers must be lean and use kebab-case capability/scenario identifiers.', + '', + `Starting mode: ${mode}`, + 'User intent:', + intent, + '', + 'Observed project:', + JSON.stringify(observation, null, 2), + ].join('\n'); + return {prompt, request: {mode, intent}, observation}; +} + +/** Builds a read-only refinement briefing without consuming the answer. */ +export function prepareHostClarify(cwd: string, answer: string): HostPreparation | {readonly error: string} { + const state = loadState(cwd); + if (!state) return {error: 'no onboarding session'}; + const pending = state.qa.find((qa) => qa.answer === null); + if (!pending) return {error: 'onboarding is already complete'}; + const current = { + project_context: readOptional(join(cwd, 'docs/project-context.md')), + capabilities: readOptional(join(cwd, 'spec/capabilities.yaml')), + architecture: readOptional(join(cwd, 'spec/architecture.yaml')), + }; + const observation = {state, current}; + const prompt = [ + 'Refine the Cladding onboarding draft using the user answer below.', + 'Return one object matching the supplied MCP draft schema; preserve decisions that the answer does not change.', + 'Do not edit files or run shell commands. Ask 0-3 new product-level questions only when needed.', + '', + `Pending question: ${pending.question}`, + `User answer (verbatim): ${answer}`, + '', + 'Current onboarding state and artifacts:', + JSON.stringify(observation, null, 2), + ].join('\n'); + return {prompt, request: {mode: state.mode, intent: state.intent}, observation}; +} + +function readOptional(path: string): string { + return existsSync(path) ? readFileSync(path, 'utf8') : ''; +} + +/** Converts validated host data into the existing sentinel interpreter input. */ +export function renderHostDraft(draft: HostOnboardingDraft): string { + const context = [ + '## 1. Why does this project exist?', '', draft.project_context.why, + '', '## 2. What problem does it solve?', '', draft.project_context.problem, + '', '## 3. What is its purpose?', '', draft.project_context.purpose, + ].join('\n'); + const capabilities = yaml.stringify({schema: '0.1', source: 'intent', capabilities: draft.capabilities}, {lineWidth: 0}).trim(); + const architecture = yaml.stringify({layers: draft.architecture.layers}, {lineWidth: 0}).trim(); + const scenarios = yaml.stringify(draft.scenarios.map((scenario) => ({...scenario, features: []})), {lineWidth: 0}).trim(); + const metadata = draft.ai_hints ? yaml.stringify(draft.ai_hints, {lineWidth: 0}).trim() : ''; + return [ + '=== ONBOARDING_MODE ===', draft.mode, + '=== PROJECT_CONTEXT_MD ===', context, + '=== CAPABILITIES_YAML ===', capabilities, + '=== ARCHITECTURE_YAML ===', architecture, + '=== SPEC_SEED_TITLE ===', draft.first_feature_title, + '=== SCENARIOS_YAML ===', scenarios, + '=== PROJECT_METADATA ===', metadata, + '=== CLARIFYING_QUESTIONS ===', ...draft.questions.map((question) => `- ${question}`), + ].join('\n'); +} diff --git a/src/cli/init.ts b/src/cli/init.ts index 3cfa623b..6cdd2e9c 100644 --- a/src/cli/init.ts +++ b/src/cli/init.ts @@ -32,6 +32,7 @@ import { type OnboardingObserved, type OnboardingResult, } from './scan/intent-onboarding.js'; +import type {ScanLlmDispatcher} from './scan/llm.js'; import {saveState, type OnboardingState} from './scan/onboarding-state.js'; import {detectToolchain} from '../stages/toolchain/detect.js'; import {writeClaudeMdSection} from '../init/host-instructions.js'; @@ -67,6 +68,8 @@ export interface InitOptions { readonly withHook?: boolean; /** Scaffold the authoritative CI gate workflow (F-16746b). */ readonly withCi?: boolean; + /** Host-produced onboarding response; used by the MCP prepare/apply flow. */ + readonly hostDispatcher?: ScanLlmDispatcher; } export interface InitResult { @@ -378,7 +381,7 @@ export async function runInit(opts: InitOptions = {}): Promise { // dispatcher both fall back to a deterministic variant that quotes // the intent verbatim. let onboarding: OnboardingResult | null = null; - const dispatcher = selectDispatcher({noLlm: opts.noLlm}); + const dispatcher = opts.hostDispatcher ?? selectDispatcher({noLlm: opts.noLlm}); if (intent && intent.length > 0) { const observed: OnboardingObserved = { cwdBasename: basename(resolve(cwd)), diff --git a/src/serve/server.ts b/src/serve/server.ts index 1ae640fc..6e3bafcf 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -19,7 +19,8 @@ // @see spec/features/F-073.yaml — server scaffold AC matrix. import {spawnSync} from 'node:child_process'; -import {readFileSync, existsSync, realpathSync, statSync} from 'node:fs'; +import {createHash, randomUUID} from 'node:crypto'; +import {readFileSync, existsSync, realpathSync, readdirSync, statSync} from 'node:fs'; import {basename, dirname, extname, isAbsolute, join, relative, resolve, sep} from 'node:path'; import {fileURLToPath} from 'node:url'; @@ -71,7 +72,9 @@ export const PERSONA_PROMPT_ALIASES: Readonly> = { /** Tool names cladding's MCP server exposes (stable wire identifiers). */ export const TOOL_NAMES = [ + 'clad_prepare_init', 'clad_init', + 'clad_prepare_clarify', 'clad_clarify', 'clad_list_features', 'clad_get_feature', @@ -110,11 +113,18 @@ export interface ServerOptions { /** Process-independent onboarding contract injected at the serve boundary. */ export interface OnboardingOperations { + readonly renderDraft: (draft: unknown) => string; + readonly prepareInit: (opts: {cwd: string; mode: string; intent: string}) => { + readonly prompt: string; + readonly request: {readonly mode: string; readonly intent: string}; + readonly observation: Record; + }; readonly initialize: (opts: { cwd: string; intent?: string; scan?: boolean; noLlm?: boolean; + hostDispatcher?: (prompt: string) => Promise; }) => Promise<{ readonly created?: readonly string[]; readonly skipped?: readonly string[]; @@ -124,9 +134,13 @@ export interface OnboardingOperations { readonly onboardingMode?: 'greenfield' | 'existing-adoption' | 'mixed'; readonly onboardingSource?: 'llm' | 'hybrid' | 'deterministic'; }>; + readonly prepareClarify: ( + answer: string, + opts: {cwd: string}, + ) => {readonly prompt: string; readonly request: {readonly mode: string; readonly intent: string}; readonly observation: Record} | {readonly error: string}; readonly clarify: ( answer: string, - opts: {cwd: string; noLlm?: boolean}, + opts: {cwd: string; noLlm?: boolean; hostDispatcher?: (prompt: string) => Promise}, ) => Promise<{ readonly ok: boolean; readonly error?: string; @@ -153,6 +167,12 @@ export function buildServer(opts: ServerOptions = {}): McpServer { version: opts.version ?? '0.8.3', }, { + instructions: + 'For explicit Cladding onboarding, always call clad_prepare_init first, draft the requested structured data ' + + 'with the current host model, show the planned changes, and wait for a separate user confirmation before ' + + 'calling clad_init with its token and the confirmation verbatim. For each real user answer, call ' + + 'clad_prepare_clarify and then clad_clarify. Never run onboarding shell commands or request MCP sampling. ' + + 'Prepare tools are read-only; apply tools validate and write.', // Declare subscribe support so clients can subscribe to // cladding://audit and receive notifications/resources/updated // when new evidence lands. The wire-level handlers themselves @@ -288,8 +308,7 @@ function recordServe( } } -/** Locate the engine's bin shim relative to this module — works in the dist - * bundle (dist/clad.js → ../bin/clad) and the dev tree (src/serve/ → ../../bin/clad). */ +/** Locates the CLI shim for legacy MCP tools that still wrap CLI verbs. */ function engineShim(): string | null { let dir = dirname(fileURLToPath(import.meta.url)); for (let i = 0; i < 5; i++) { @@ -297,42 +316,10 @@ function engineShim(): string | null { if (existsSync(candidate)) return candidate; dir = dirname(dir); } - // Marketplace plugins ship the self-contained dist/clad.js without the - // package-level bin/ shim. In that layout the running entry is itself the - // executable engine, so child verbs can safely re-enter it. const runningEntry = process.argv[1]; - if (runningEntry && basename(runningEntry) === 'clad.js' && existsSync(runningEntry)) { - return runningEntry; - } - return null; -} - -interface EngineJsonResult { - readonly ok: boolean; - readonly payload?: unknown; - readonly error?: string; -} - -/** Runs a CLI verb through the shipped engine and parses its JSON boundary. */ -function runEngineJson(cwd: string, args: readonly string[]): EngineJsonResult { - const shim = engineShim(); - if (!shim) return {ok: false, error: 'cladding engine shim was not found'}; - const result = spawnSync(shim, args, { - cwd, - encoding: 'utf8', - maxBuffer: 10 * 1024 * 1024, - }); - if (result.status !== 0) { - return { - ok: false, - error: (result.stderr || result.stdout || `cladding engine exited ${result.status ?? 'without a status'}`).trim(), - }; - } - try { - return {ok: true, payload: JSON.parse(result.stdout)}; - } catch { - return {ok: false, error: `cladding engine returned invalid JSON: ${result.stdout.slice(0, 500)}`}; - } + return runningEntry && basename(runningEntry) === 'clad.js' && existsSync(runningEntry) + ? runningEntry + : null; } const INTENT_FILE_EXTENSIONS = new Set(['.md', '.txt', '.yaml', '.yml', '.markdown']); @@ -366,84 +353,187 @@ function projectIntentPath(cwd: string, requested: string): {path?: string; erro return {path: rel}; } +const hostDraftSchema = z.object({ + mode: z.enum(['greenfield', 'existing-adoption', 'mixed']), + project_context: z.object({why: z.string().min(1), problem: z.string().min(1), purpose: z.string().min(1)}), + capabilities: z.array(z.object({ + id: z.string().min(1), + title: z.string().min(1), + summary: z.string().min(1), + surface: z.enum(['feature', 'platform', 'tool', 'infrastructure']), + })).min(3).max(8), + architecture: z.object({layers: z.array(z.object({name: z.string().min(1), forbidden_imports: z.array(z.string())}))}), + first_feature_title: z.string().min(1), + scenarios: z.array(z.object({slug: z.string().min(1), title: z.string().min(1), flow: z.string().min(1)})).min(1).max(3), + questions: z.array(z.string().min(1)).max(3), + ai_hints: z.record(z.string(), z.unknown()).optional(), +}); + +interface PreparedOnboarding { + readonly kind: 'init' | 'clarify'; + readonly snapshot: string; + readonly mode: 'idea' | 'document' | 'existing'; + readonly intent: string; + readonly answer?: string; + readonly refresh?: boolean; +} + +function workspaceSnapshot(cwd: string): string { + const hash = createHash('sha256'); + const visit = (dir: string): void => { + if (!existsSync(dir)) return; + for (const entry of readdirSync(dir, {withFileTypes: true}).sort((a, b) => a.name.localeCompare(b.name))) { + if (entry.name === '.git' || entry.name === '.cladding' || entry.name === 'node_modules') continue; + const path = join(dir, entry.name); + const rel = relative(cwd, path); + if (entry.isDirectory()) visit(path); + else if (entry.isFile()) { + const stat = statSync(path); + hash.update(`${rel}\0${stat.size}\0${stat.mtimeMs}\n`); + } + } + }; + visit(cwd); + return hash.digest('hex'); +} + +function mcpPayload(payload: Record, isError = false): { + readonly isError?: boolean; + readonly structuredContent: Record; + readonly content: Array<{readonly type: 'text'; readonly text: string}>; +} { + return { + ...(isError ? {isError: true} : {}), + structuredContent: payload, + content: [{type: 'text', text: JSON.stringify(payload, null, 2)}], + }; +} + function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOperations): void { + const prepared = new Map(); + server.registerTool( - 'clad_init', + 'clad_prepare_init', { - title: 'Initialize Cladding in the connected project', + title: 'Prepare Cladding onboarding context', description: - 'Use only after the user explicitly asks to initialize or adopt Cladding. Supports a new idea, ' + - 'a planning document inside the project, or adoption of an existing codebase. Returns product-level ' + - 'follow-up questions; answer them with clad_clarify. Never call merely because a repository was opened.', + 'Read-only first step for every explicit Cladding initialization request. Inspect the connected project, ' + + 'then use this tool result to draft the structured input for clad_init. Never run clad init in a shell.', inputSchema: { - mode: z.enum(['idea', 'document', 'existing']).describe('The user\'s starting point'), - intent: z.string().optional().describe('Project idea, or optional adoption goal for existing mode'), - document_path: z.string().optional().describe('Project-relative planning document for document mode'), - refresh: z.boolean().optional().describe('Explicitly re-scan an already initialized project'), - no_llm: z.boolean().optional().describe('Use deterministic onboarding; intended for offline verification'), + mode: z.enum(['idea', 'document', 'existing']), + intent: z.string().optional(), + document_path: z.string().optional(), + refresh: z.boolean().optional(), + }, + outputSchema: { + status: z.string(), changed: z.boolean(), schemaVersion: z.number().optional(), token: z.string().optional(), + prompt: z.string().optional(), request: z.object({mode: z.string(), intent: z.string()}).optional(), + observation: z.record(z.string(), z.unknown()).optional(), question: z.string().optional(), error: z.string().optional(), + plannedChanges: z.array(z.string()).optional(), confirmationQuestion: z.string().optional(), + requiresSeparateUserConfirmation: z.boolean().optional(), }, + annotations: {readOnlyHint: true, destructiveHint: false, idempotentHint: true}, }, async (args) => { + if (!onboarding) return mcpPayload({status: 'unavailable', changed: false}, true); if (existsSync(join(cwd, 'spec.yaml')) && !args.refresh) { - return { - content: [{type: 'text', text: JSON.stringify({status: 'already_initialized', changed: false}, null, 2)}], - }; + return mcpPayload({status: 'already_initialized', changed: false}); } - if (args.mode === 'idea' && !args.intent?.trim()) { - return { - content: [{type: 'text', text: JSON.stringify({status: 'needs_input', changed: false, question: 'What kind of project are you building?'}, null, 2)}], - }; + let intent = args.intent?.trim() ?? ''; + if (args.mode === 'idea' && !intent) { + return mcpPayload({status: 'needs_input', changed: false, question: 'What kind of project are you building?'}); } - - let intent: string | undefined; if (args.mode === 'document') { const resolved = projectIntentPath(cwd, args.document_path ?? ''); - if (resolved.error) { - return {isError: true, content: [{type: 'text', text: resolved.error}]}; - } - intent = resolved.path!; - } else if (args.intent?.trim()) { - intent = args.intent.trim(); + if (resolved.error) return mcpPayload({status: 'invalid_request', changed: false, error: resolved.error}, true); + intent = readFileSync(join(cwd, resolved.path!), 'utf8'); } - let init: { - readonly created?: readonly string[]; - readonly skipped?: readonly string[]; - readonly language?: string; - readonly proposals?: readonly string[]; - readonly clarifyingQuestions?: readonly string[]; - readonly onboardingMode?: 'greenfield' | 'existing-adoption' | 'mixed'; - readonly onboardingSource?: 'llm' | 'hybrid' | 'deterministic'; - }; - if (onboarding) { - init = await onboarding.initialize({ - cwd, - intent, - scan: args.mode === 'existing' ? true : undefined, - noLlm: args.no_llm, - }); - } else { - const command = ['init', ...(intent ? [intent] : [])]; - if (args.mode === 'existing') command.push('--scan'); - if (args.no_llm) command.push('--no-llm'); - command.push('--json'); - const result = runEngineJson(cwd, command); - if (!result.ok) return {isError: true, content: [{type: 'text', text: result.error!}]}; - init = result.payload as typeof init; + if (args.mode === 'existing' && !intent) intent = 'Adopt Cladding into the observed existing project.'; + const briefing = onboarding.prepareInit({cwd, mode: args.mode, intent}); + const token = randomUUID(); + prepared.set(token, { + kind: 'init', snapshot: workspaceSnapshot(cwd), mode: args.mode, intent, refresh: args.refresh, + }); + return mcpPayload({ + status: 'needs_confirmation', changed: false, schemaVersion: 1, token, + prompt: briefing.prompt, request: briefing.request, observation: briefing.observation, + plannedChanges: args.refresh + ? ['Create review proposals for refreshed Cladding spec and design artifacts; preserve authored files.'] + : ['Create spec.yaml and spec design files.', 'Create project context and conventions documents.', 'Create Cladding runtime state and managed AI-host instructions.'], + confirmationQuestion: 'Cladding will create the listed project files. Should I proceed with initialization?', + requiresSeparateUserConfirmation: true, + }); + }, + ); + + server.registerTool( + 'clad_init', + { + title: 'Apply a validated Cladding onboarding draft', + description: + 'Write Cladding artifacts from the host model draft returned after clad_prepare_init. ' + + 'Requires its one-time token; malformed, stale, or replayed requests do not write files.', + inputSchema: { + token: z.string().uuid(), + confirmation: z.string().min(1).describe('The user\'s separate confirmation reply, verbatim'), + draft: hostDraftSchema, + }, + outputSchema: { + status: z.string(), changed: z.boolean(), created: z.array(z.string()).optional(), skipped: z.array(z.string()).optional(), + language: z.string().optional(), proposals: z.array(z.string()).optional(), clarifyingQuestions: z.array(z.string()).optional(), + onboardingMode: z.enum(['greenfield', 'existing-adoption', 'mixed']).optional(), onboardingSource: z.string().optional(), + nextQuestion: z.string().nullable().optional(), remainingQuestions: z.number().optional(), error: z.string().optional(), + confirmation: z.string().optional(), + }, + annotations: {readOnlyHint: false, destructiveHint: true, idempotentHint: false}, + }, + async (args) => { + const request = prepared.get(args.token); + if (!request || request.kind !== 'init') return mcpPayload({status: 'invalid_token', changed: false}, true); + if (args.confirmation.trim() === request.intent.trim()) { + return mcpPayload({status: 'confirmation_required', changed: false, error: 'A separate user confirmation is required after the preview.'}, true); } + if (request.snapshot !== workspaceSnapshot(cwd)) return mcpPayload({status: 'stale_preparation', changed: false}, true); + if (!onboarding) return mcpPayload({status: 'unavailable', changed: false}, true); + prepared.delete(args.token); + const response = onboarding.renderDraft(args.draft); + const init = await onboarding.initialize({ + cwd, intent: request.intent, scan: request.mode === 'existing' ? true : undefined, + hostDispatcher: async () => response, + }); const questions = init.clarifyingQuestions ?? []; const payload = { - status: - questions.length > 0 - ? 'needs_answers' - : init.onboardingSource === 'deterministic' - ? 'initialized_with_fallback' - : 'initialized', - changed: true, + status: questions.length > 0 ? 'needs_answers' : 'initialized', changed: true, ...init, + onboardingSource: 'host', + confirmation: args.confirmation, nextQuestion: questions[0] ?? null, remainingQuestions: questions.length, }; - return {content: [{type: 'text', text: JSON.stringify(payload, null, 2)}]}; + return mcpPayload(payload); + }, + ); + + server.registerTool( + 'clad_prepare_clarify', + { + title: 'Prepare the next Cladding onboarding answer', + description: 'Read-only step. Pass the user answer verbatim, then draft the structured refinement for clad_clarify.', + inputSchema: {answer: z.string().min(1)}, + outputSchema: { + status: z.string(), changed: z.boolean(), schemaVersion: z.number().optional(), token: z.string().optional(), + prompt: z.string().optional(), request: z.object({mode: z.string(), intent: z.string()}).optional(), + observation: z.record(z.string(), z.unknown()).optional(), error: z.string().optional(), + }, + annotations: {readOnlyHint: true, destructiveHint: false, idempotentHint: true}, + }, + async (args) => { + if (!onboarding) return mcpPayload({status: 'unavailable', changed: false}, true); + const briefing = onboarding.prepareClarify(args.answer, {cwd}); + if ('error' in briefing) return mcpPayload({status: 'invalid_state', changed: false, error: briefing.error}, true); + const token = randomUUID(); + prepared.set(token, {kind: 'clarify', snapshot: workspaceSnapshot(cwd), mode: 'idea', intent: briefing.request.intent, answer: args.answer}); + return mcpPayload({status: 'needs_host_draft', changed: false, schemaVersion: 1, token, prompt: briefing.prompt, request: briefing.request, observation: briefing.observation}); }, ); @@ -452,28 +542,30 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp { title: 'Answer the next Cladding onboarding question', description: - 'Pass the user\'s answer to the next pending product question after clad_init. Returns the next question ' + - 'or a completed status. Do not invent answers.', + 'Apply a host-model refinement after clad_prepare_clarify. Do not invent or alter the user answer.', inputSchema: { answer: z.string().min(1).describe('The user\'s answer, verbatim'), - no_llm: z.boolean().optional().describe('Use deterministic refinement; intended for offline verification'), + token: z.string().uuid(), + draft: hostDraftSchema, + }, + outputSchema: { + status: z.string(), changed: z.boolean(), cwd: z.string().optional(), answered: z.unknown().optional(), + newQuestions: z.array(z.string()).optional(), mode: z.enum(['greenfield', 'existing-adoption', 'mixed']).nullable().optional(), + nextQuestion: z.string().nullable().optional(), remainingQuestions: z.number().optional(), refinementSource: z.string().optional(), + error: z.string().optional(), }, + annotations: {readOnlyHint: false, destructiveHint: true, idempotentHint: false}, }, async (args) => { - if (onboarding) { - const outcome = await onboarding.clarify(args.answer, {cwd, noLlm: args.no_llm}); - if (!outcome.ok) { - return {isError: true, content: [{type: 'text', text: outcome.error ?? 'onboarding clarification failed'}]}; - } - return { - content: [{type: 'text', text: JSON.stringify({...((outcome.report ?? {}) as object), refinementSource: outcome.source}, null, 2)}], - }; - } - const command = ['clarify', args.answer, '--json']; - if (args.no_llm) command.push('--no-llm'); - const result = runEngineJson(cwd, command); - if (!result.ok) return {isError: true, content: [{type: 'text', text: result.error!}]}; - return {content: [{type: 'text', text: JSON.stringify(result.payload, null, 2)}]}; + const request = prepared.get(args.token); + if (!request || request.kind !== 'clarify' || request.answer !== args.answer) return mcpPayload({status: 'invalid_token', changed: false}, true); + if (request.snapshot !== workspaceSnapshot(cwd)) return mcpPayload({status: 'stale_preparation', changed: false}, true); + if (!onboarding) return mcpPayload({status: 'unavailable', changed: false}, true); + prepared.delete(args.token); + const response = onboarding.renderDraft(args.draft); + const outcome = await onboarding.clarify(args.answer, {cwd, hostDispatcher: async () => response}); + if (!outcome.ok) return mcpPayload({status: 'failed', changed: false, error: outcome.error ?? 'onboarding clarification failed'}, true); + return mcpPayload({...((outcome.report ?? {}) as object), changed: true, refinementSource: 'host'}); }, ); diff --git a/tests/cli/clad.test.ts b/tests/cli/clad.test.ts index bb39c6b2..97a60f6e 100644 --- a/tests/cli/clad.test.ts +++ b/tests/cli/clad.test.ts @@ -580,7 +580,10 @@ describe('cli/clad — runServeCommand', () => { expect(buildMock).toHaveBeenCalledWith({ cwd: '/tmp/probe', onboarding: { + renderDraft: expect.any(Function), + prepareInit: expect.any(Function), initialize: expect.any(Function), + prepareClarify: expect.any(Function), clarify: expect.any(Function), }, }); diff --git a/tests/serve/init-tools.test.ts b/tests/serve/init-tools.test.ts index f95347ac..1e5d78ff 100644 --- a/tests/serve/init-tools.test.ts +++ b/tests/serve/init-tools.test.ts @@ -7,11 +7,8 @@ import {dirname, join} from 'node:path'; import {Client} from '@modelcontextprotocol/sdk/client/index.js'; import {InMemoryTransport} from '@modelcontextprotocol/sdk/inMemory.js'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; -import {vi} from 'vitest'; - -import type {SamplingCapableServer} from '../../src/adapters/host/transport.js'; -import {setHostMcpServer} from '../../src/adapters/host/sampling-context.js'; import {refineOnboarding} from '../../src/cli/clarify.js'; +import {prepareHostClarify, prepareHostInit, renderHostDraft} from '../../src/cli/host-onboarding.js'; import {runInit} from '../../src/cli/init.js'; import {saveState} from '../../src/cli/scan/onboarding-state.js'; import {buildServer} from '../../src/serve/server.js'; @@ -26,7 +23,13 @@ async function makePair(cwd: string): Promise { cwd, name: 'cladding-init-test', version: '0.0.0-test', - onboarding: {initialize: runInit, clarify: refineOnboarding}, + onboarding: { + renderDraft: (value) => renderHostDraft(value as Parameters[0]), + prepareInit: ({cwd: root, mode, intent}) => prepareHostInit(root, mode, intent), + initialize: runInit, + prepareClarify: (answer, {cwd: root}) => prepareHostClarify(root, answer), + clarify: refineOnboarding, + }, }); const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair(); const client = new Client({name: 'cladding-init-client', version: '0.0.0-test'}); @@ -45,6 +48,26 @@ function payload(result: Awaited>): Record; } +const draft = { + mode: 'greenfield', + project_context: {why: 'Enable reliable B2B payments.', problem: 'Payment operations are fragmented.', purpose: 'Give operators one safe workflow.'}, + capabilities: [ + {id: 'payments', title: 'Payments', summary: 'Process payments safely.', surface: 'feature'}, + {id: 'audit', title: 'Audit', summary: 'Trace operator actions.', surface: 'platform'}, + {id: 'webhooks', title: 'Webhooks', summary: 'Deliver signed events.', surface: 'infrastructure'}, + ], + architecture: {layers: [{name: 'core', forbidden_imports: ['adapters']}]}, + first_feature_title: 'Payment authorization', + scenarios: [{slug: 'payment-flow', title: 'Payment flow', flow: 'An operator requests and confirms a payment.'}], + questions: ['Which market launches first?'], +} as const; +const confirmation = 'Proceed with Cladding initialization.'; + +async function prepare(client: Client, arguments_: Record): Promise { + const result = await client.callTool({name: 'clad_prepare_init', arguments: arguments_}); + return payload(result).token as string; +} + describe('serve/server — natural-language init tools', () => { let dir: string; @@ -59,7 +82,7 @@ describe('serve/server — natural-language init tools', () => { test('idea mode asks for intent before writing any project artifact', async () => { const {client, cleanup} = await makePair(dir); try { - const result = await client.callTool({name: 'clad_init', arguments: {mode: 'idea'}}); + const result = await client.callTool({name: 'clad_prepare_init', arguments: {mode: 'idea'}}); expect(payload(result)).toMatchObject({status: 'needs_input', changed: false}); expect(readdirSync(dir)).toEqual([]); } finally { @@ -70,15 +93,13 @@ describe('serve/server — natural-language init tools', () => { test('idea mode initializes through the shared engine and writes host instructions after spec', async () => { const {client, cleanup} = await makePair(dir); try { - const result = await client.callTool({ - name: 'clad_init', - arguments: {mode: 'idea', intent: 'B2B payment SaaS', no_llm: true}, - }); + const token = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + const result = await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft}}); expect(result.isError).not.toBe(true); expect(payload(result)).toMatchObject({ - status: 'initialized_with_fallback', + status: 'needs_answers', changed: true, - onboardingSource: 'deterministic', + onboardingSource: 'host', }); expect(existsSync(join(dir, 'spec.yaml'))).toBe(true); expect(existsSync(join(dir, 'AGENTS.md'))).toBe(true); @@ -88,79 +109,64 @@ describe('serve/server — natural-language init tools', () => { } }); - test('host sampling drives init and clarify in the MCP server process', async () => { - const createMessage = vi - .fn() - .mockResolvedValueOnce({ - content: { - type: 'text', - text: [ - '=== ONBOARDING_MODE ===', - 'greenfield', - '=== PROJECT_CONTEXT_MD ===', - '# Payment platform context', - '=== CAPABILITIES_YAML ===', - 'schema: "0.1"', - 'capabilities:', - ' - id: payments', - ' title: "Payments"', - '=== ARCHITECTURE_YAML ===', - 'layers: []', - '=== SPEC_SEED_TITLE ===', - 'Payment platform', - '=== SCENARIOS_YAML ===', - '[]', - '=== PROJECT_METADATA_YAML ===', - '{}', - '=== CLARIFYING_QUESTIONS ===', - '- Which market launches first?', - ].join('\n'), - }, - }) - .mockResolvedValueOnce({ - content: { - type: 'text', - text: [ - '=== ONBOARDING_MODE ===', - 'greenfield', - '=== PROJECT_CONTEXT_MD ===', - '# Korea launch context', - '=== CAPABILITIES_YAML ===', - 'schema: "0.1"', - 'capabilities: []', - '=== ARCHITECTURE_YAML ===', - 'layers: []', - '=== SPEC_SEED_TITLE ===', - 'Payment platform', - '=== CLARIFYING_QUESTIONS ===', - ].join('\n'), - }, - }); - const disposeSampling = setHostMcpServer({createMessage} as SamplingCapableServer); + test('initial request is not accepted as the separate write confirmation', async () => { const {client, cleanup} = await makePair(dir); try { - const initialized = await client.callTool({ - name: 'clad_init', - arguments: {mode: 'idea', intent: 'B2B payment SaaS'}, + const intent = 'B2B payment SaaS'; + const preparation = await client.callTool({name: 'clad_prepare_init', arguments: {mode: 'idea', intent}}); + expect(payload(preparation)).toMatchObject({ + status: 'needs_confirmation', + changed: false, + requiresSeparateUserConfirmation: true, }); + const token = payload(preparation).token as string; + const result = await client.callTool({name: 'clad_init', arguments: {token, confirmation: intent, draft}}); + expect(payload(result)).toMatchObject({status: 'confirmation_required', changed: false}); + expect(existsSync(join(dir, 'spec.yaml'))).toBe(false); + } finally { + await cleanup(); + } + }); + + test('a malformed host draft is rejected before any write', async () => { + const {client, cleanup} = await makePair(dir); + try { + const token = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + const result = await client.callTool({name: 'clad_init', arguments: { + token, + confirmation, + draft: {...draft, capabilities: []}, + }}); + expect(result.isError).toBe(true); + expect(existsSync(join(dir, 'spec.yaml'))).toBe(false); + expect(readdirSync(dir)).toEqual([]); + } finally { + await cleanup(); + } + }); + + test('tools-only MCP client drives init and clarify without sampling', async () => { + const {client, cleanup} = await makePair(dir); + try { + const token = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + const initialized = await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft}}); expect(payload(initialized)).toMatchObject({ status: 'needs_answers', - onboardingSource: 'llm', + onboardingSource: 'host', nextQuestion: 'Which market launches first?', }); - const clarified = await client.callTool({ - name: 'clad_clarify', - arguments: {answer: 'Korea'}, - }); + const preparedClarify = await client.callTool({name: 'clad_prepare_clarify', arguments: {answer: 'Korea'}}); + const clarifyToken = payload(preparedClarify).token as string; + const clarified = await client.callTool({name: 'clad_clarify', arguments: { + answer: 'Korea', token: clarifyToken, draft: {...draft, questions: []}, + }}); expect(payload(clarified)).toMatchObject({ status: 'done', remainingQuestions: 0, - refinementSource: 'llm', + refinementSource: 'host', }); - expect(createMessage).toHaveBeenCalledTimes(2); } finally { - disposeSampling(); await cleanup(); } }); @@ -171,12 +177,13 @@ describe('serve/server — natural-language init tools', () => { writeFileSync(join(dir, 'docs', 'plan.md'), plan); const {client, cleanup} = await makePair(dir); try { - const result = await client.callTool({ - name: 'clad_init', - arguments: {mode: 'document', document_path: 'docs/plan.md', no_llm: true}, - }); + const preparation = await client.callTool({name: 'clad_prepare_init', arguments: {mode: 'document', document_path: 'docs/plan.md'}}); + const preparedPayload = payload(preparation); + expect(preparedPayload.prompt).toContain(plan); + const token = preparedPayload.token as string; + const result = await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft}}); expect(result.isError).not.toBe(true); - expect(readFileSync(join(dir, 'docs', 'project-context.md'), 'utf8')).toContain(plan); + expect(readFileSync(join(dir, 'docs', 'project-context.md'), 'utf8')).toContain('Enable reliable B2B payments.'); } finally { await cleanup(); } @@ -188,7 +195,7 @@ describe('serve/server — natural-language init tools', () => { const {client, cleanup} = await makePair(dir); try { const result = await client.callTool({ - name: 'clad_init', + name: 'clad_prepare_init', arguments: {mode: 'document', document_path: '../outside-plan.md', no_llm: true}, }); expect(result.isError).toBe(true); @@ -204,10 +211,8 @@ describe('serve/server — natural-language init tools', () => { writeFileSync(join(dir, 'src', 'index.ts'), 'export const value = 1;\n'); const {client, cleanup} = await makePair(dir); try { - const result = await client.callTool({ - name: 'clad_init', - arguments: {mode: 'existing', no_llm: true}, - }); + const token = await prepare(client, {mode: 'existing'}); + const result = await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft: {...draft, mode: 'existing-adoption'}}}); expect(result.isError).not.toBe(true); const conventions = readFileSync(join(dir, 'docs', 'conventions.md'), 'utf8'); expect(conventions).toContain('derived from observed code'); @@ -222,7 +227,7 @@ describe('serve/server — natural-language init tools', () => { const {client, cleanup} = await makePair(dir); try { const before = readFileSync(join(dir, 'spec.yaml'), 'utf8'); - const result = await client.callTool({name: 'clad_init', arguments: {mode: 'existing'}}); + const result = await client.callTool({name: 'clad_prepare_init', arguments: {mode: 'existing'}}); expect(payload(result)).toEqual({status: 'already_initialized', changed: false}); expect(readFileSync(join(dir, 'spec.yaml'), 'utf8')).toBe(before); expect(readdirSync(dir)).toEqual(['spec.yaml']); @@ -231,6 +236,27 @@ describe('serve/server — natural-language init tools', () => { } }); + test('stale and replayed apply tokens never write twice', async () => { + const {client, cleanup} = await makePair(dir); + try { + const staleToken = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + writeFileSync(join(dir, 'README.md'), '# changed after prepare\n'); + const stale = await client.callTool({name: 'clad_init', arguments: {token: staleToken, confirmation, draft}}); + expect(payload(stale)).toMatchObject({status: 'stale_preparation', changed: false}); + expect(existsSync(join(dir, 'spec.yaml'))).toBe(false); + + const token = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + const first = await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft}}); + expect(payload(first)).toMatchObject({changed: true}); + const specBeforeReplay = readFileSync(join(dir, 'spec.yaml'), 'utf8'); + const replay = await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft}}); + expect(payload(replay)).toMatchObject({status: 'invalid_token', changed: false}); + expect(readFileSync(join(dir, 'spec.yaml'), 'utf8')).toBe(specBeforeReplay); + } finally { + await cleanup(); + } + }); + test('clarify returns the next pending question as structured output', async () => { saveState(dir, { intent: 'B2B payment SaaS', @@ -252,10 +278,11 @@ describe('serve/server — natural-language init tools', () => { const {client, cleanup} = await makePair(dir); try { - const result = await client.callTool({ - name: 'clad_clarify', - arguments: {answer: 'Business operators', no_llm: true}, - }); + const preparedClarify = await client.callTool({name: 'clad_prepare_clarify', arguments: {answer: 'Business operators'}}); + const token = payload(preparedClarify).token as string; + const result = await client.callTool({name: 'clad_clarify', arguments: { + answer: 'Business operators', token, draft: {...draft, questions: []}, + }}); expect(result.isError).not.toBe(true); expect(payload(result)).toMatchObject({ status: 'active', From abf6ebb2446c1ac1d37bd6b0a8b9dcd2a1154443 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 14 Jul 2026 17:07:31 +0900 Subject: [PATCH 05/28] chore(spec): refresh onboarding verification attestation --- spec/attestation.yaml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/spec/attestation.yaml b/spec/attestation.yaml index a4a1341d..b619ba26 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -24,7 +24,7 @@ attested_modules: README.html: 1a020a2174f7e1a6 README.ko.html: 90b6c2c123e863fa README.ko.md: abf66779d7a314d8 - README.md: 9865e3c9b19a56a6 + README.md: 8f7137aec82a278a SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -52,7 +52,7 @@ attested_modules: docs/dogfood/claude-code-2026-05-20.md: 04870d41e75576d6 docs/dogfood/gemini-cli-2026-05-20.md: 2da1ba66c4f108f0 docs/feature-cycle.md: 6af4ff8fe15db28a - docs/glossary.md: 4207bd5114b70df0 + docs/glossary.md: 56619c81c8bfb424 docs/img/en/ecosystem.svg: ed14d1d17f088b00 docs/img/en/relationship.svg: c7a24203925b4664 docs/img/ko/ecosystem.svg: 2b7341576c2af0a8 @@ -66,18 +66,18 @@ attested_modules: plugins/claude-code/.claude-plugin/plugin.json: 7493e69dee9ae24d plugins/claude-code/agents/developer.md: b0ef3775132d159a plugins/claude-code/agents/observability.md: 81f73e284ee9b3ba - plugins/claude-code/agents/orchestrator.md: d30919c2b78b88e4 + plugins/claude-code/agents/orchestrator.md: 56b335a91e818e40 plugins/claude-code/agents/planner.md: 9514f785ba65a58c plugins/claude-code/agents/reviewer.md: 91922293457a3d6a - plugins/claude-code/commands/init.md: da27018d417ccd26 + plugins/claude-code/commands/init.md: 32b2bd25fbbc9a5a plugins/claude-code/hooks/hooks.json: 42321ead26fb1da8 plugins/codex/.codex-plugin/plugin.json: e2898491a8fd62b8 plugins/codex/.mcp.json: 43e3f4b2af24aa18 plugins/codex/skills/check/SKILL.md: 355826df90846d2f plugins/codex/skills/developer/SKILL.md: b0ef3775132d159a - plugins/codex/skills/init/SKILL.md: da27018d417ccd26 + plugins/codex/skills/init/SKILL.md: 32b2bd25fbbc9a5a plugins/codex/skills/observability/SKILL.md: 81f73e284ee9b3ba - plugins/codex/skills/orchestrator/SKILL.md: d30919c2b78b88e4 + plugins/codex/skills/orchestrator/SKILL.md: 56b335a91e818e40 plugins/codex/skills/planner/SKILL.md: 9514f785ba65a58c plugins/codex/skills/reviewer/SKILL.md: 91922293457a3d6a plugins/codex/skills/run/SKILL.md: 43683062ac062846 @@ -86,7 +86,7 @@ attested_modules: plugins/codex/skills/sync/SKILL.md: 709c20212aa5627e plugins/gemini-cli/GEMINI.md: ba08eaf2cd557a65 plugins/gemini-cli/commands/README.md: 3527d771578431bd - plugins/gemini-cli/commands/init.toml: 959aae4aa0667332 + plugins/gemini-cli/commands/init.toml: 6a0a5b7570f754d5 plugins/gemini-cli/gemini-extension.json: 47685e98f1f67e11 scripts/build-plugin.mjs: 57ffa3f0e6317a6b scripts/build.mjs: 3a4b204063024ef1 @@ -95,9 +95,9 @@ attested_modules: scripts/version-bump.mjs: 05a3aa76667ed9ce skills/check/SKILL.md: 355826df90846d2f skills/checkpoint/SKILL.md: 97bde8bd4553d38f - skills/clarify/SKILL.md: 4b1e37af84817586 + skills/clarify/SKILL.md: 4cfc870233a356b2 skills/doctor/SKILL.md: 5363d3b34e69c516 - skills/init/SKILL.md: da27018d417ccd26 + skills/init/SKILL.md: 32b2bd25fbbc9a5a skills/oracle/SKILL.md: 3fc7f21e0309dad3 skills/rollback/SKILL.md: 2597ab798e61ded8 skills/route/SKILL.md: 624a6cf60db7960d @@ -130,7 +130,7 @@ attested_modules: src/agents/developer.md: b0ef3775132d159a src/agents/loader.ts: 6d35560c47f9ae85 src/agents/observability.md: 81f73e284ee9b3ba - src/agents/orchestrator.md: d30919c2b78b88e4 + src/agents/orchestrator.md: 56b335a91e818e40 src/agents/planner.md: 9514f785ba65a58c src/agents/reviewer.md: 91922293457a3d6a src/changelog/collect.ts: a6c936a7b8c34e2a @@ -138,15 +138,15 @@ attested_modules: src/cli: a4d0f0eb87fed960 src/cli/benchmark.ts: 77f84d2a898d724f src/cli/changelog.ts: 2de1adb009b89ab4 - src/cli/clad.ts: bb42e20baf8949e3 - src/cli/clarify.ts: 3bcb68fe55e6c516 + src/cli/clad.ts: cb33063566a9e86a + src/cli/clarify.ts: 21fd375caa5586ab src/cli/doctor-hosts.ts: 1ad79105b47fd8e5 src/cli/doctor.ts: b98b955fe75e7f7e src/cli/done.ts: ad2b2d49034296bd src/cli/graph-serve.ts: 23e6e389225d0f98 src/cli/graph.ts: bab410061b8c746a src/cli/hook.ts: 201f82f4c89e173f - src/cli/init.ts: caf68d5a9caf1409 + src/cli/init.ts: 54c33d905644c4c1 src/cli/intent-from-path.ts: e69862821d979f22 src/cli/measure.ts: 3a562f16589e26c2 src/cli/report.ts: 911f859b2446834b @@ -218,7 +218,7 @@ attested_modules: src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 - src/serve/server.ts: 98c24d3712507231 + src/serve/server.ts: 7f44fae8da80fb14 src/spec: a4d0f0eb87fed960 src/spec/attestation.ts: 294a1e99c42d4aef src/spec/cli.ts: 7a9bcd0f66677810 @@ -324,7 +324,7 @@ attested_modules: tests/adapters/transport.test.ts: 68f22e9e8df7b813 tests/agents/loader.test.ts: a7df7b1c9a95d37d tests/cli/benchmark.test.ts: b4a87289605ee75f - tests/cli/clad.test.ts: cb5bec7ba35f4b26 + tests/cli/clad.test.ts: 85bd0782fc8e10c0 tests/cli/gate-golden-matrix.test.ts: 39cf615407a55abe tests/cli/init.test.ts: 3428a89708fc9330 tests/cli/intent-onboarding.test.ts: 0681b98ce2e74c22 From abe37cd12fb08d904a4c1dde346378fef8dea472 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 14 Jul 2026 22:45:25 +0900 Subject: [PATCH 06/28] feat(onboarding): harden natural-language initialization --- README.ja.md | 6 +- README.ko.md | 6 +- README.md | 9 +- README.zh.md | 6 +- docs/ab-evaluation/case-existing-adoption.md | 10 +- docs/ab-evaluation/case-payment-saas.md | 10 +- docs/feature-cycle.md | 8 +- docs/glossary.md | 6 +- docs/setup.md | 10 +- docs/ssot-model.md | 15 +- docs/ssot-testing.md | 4 +- plugins/claude-code/agents/blind-author.md | 2 +- plugins/claude-code/agents/developer.md | 2 +- plugins/claude-code/agents/observability.md | 2 +- plugins/claude-code/agents/orchestrator.md | 4 +- plugins/claude-code/agents/planner.md | 2 +- plugins/claude-code/agents/reviewer.md | 2 +- plugins/claude-code/commands/init.md | 4 +- .../claude-code/dist/agents/blind-author.md | 2 +- plugins/claude-code/dist/agents/developer.md | 2 +- .../claude-code/dist/agents/observability.md | 2 +- .../claude-code/dist/agents/orchestrator.md | 4 +- plugins/claude-code/dist/agents/planner.md | 2 +- plugins/claude-code/dist/agents/reviewer.md | 2 +- plugins/claude-code/dist/clad.js | 773 +++++++++--------- plugins/claude-code/dist/schema.json | 12 + plugins/codex/skills/blind-author/SKILL.md | 2 +- plugins/codex/skills/changelog/SKILL.md | 2 +- plugins/codex/skills/check/SKILL.md | 2 +- plugins/codex/skills/checkpoint/SKILL.md | 2 +- plugins/codex/skills/clarify/SKILL.md | 6 +- plugins/codex/skills/developer/SKILL.md | 2 +- plugins/codex/skills/doctor/SKILL.md | 2 +- plugins/codex/skills/init/SKILL.md | 4 +- plugins/codex/skills/observability/SKILL.md | 2 +- plugins/codex/skills/oracle/SKILL.md | 2 +- plugins/codex/skills/orchestrator/SKILL.md | 4 +- plugins/codex/skills/planner/SKILL.md | 2 +- plugins/codex/skills/reviewer/SKILL.md | 2 +- plugins/codex/skills/rollback/SKILL.md | 2 +- plugins/codex/skills/route/SKILL.md | 2 +- plugins/codex/skills/run/SKILL.md | 2 +- plugins/codex/skills/serve/SKILL.md | 2 +- plugins/codex/skills/status/SKILL.md | 2 +- plugins/codex/skills/sync/SKILL.md | 2 +- plugins/gemini-cli/commands/init.toml | 4 +- skills/changelog/SKILL.md | 2 +- skills/check/SKILL.md | 2 +- skills/checkpoint/SKILL.md | 2 +- skills/clarify/SKILL.md | 6 +- skills/doctor/SKILL.md | 2 +- skills/init/SKILL.md | 4 +- skills/oracle/SKILL.md | 2 +- skills/rollback/SKILL.md | 2 +- skills/route/SKILL.md | 2 +- skills/run/SKILL.md | 2 +- skills/serve/SKILL.md | 2 +- skills/status/SKILL.md | 2 +- skills/sync/SKILL.md | 2 +- spec.yaml | 2 +- .../natural-language-init-0f4dd6.yaml | 71 ++ spec/index.yaml | 2 +- src/agents/blind-author.md | 2 +- src/agents/developer.md | 2 +- src/agents/observability.md | 2 +- src/agents/orchestrator.md | 4 +- src/agents/planner.md | 2 +- src/agents/reviewer.md | 2 +- src/cli/clad.ts | 3 +- src/cli/clarify.ts | 156 +++- src/cli/done.ts | 20 +- src/cli/host-onboarding.ts | 7 +- src/cli/init.ts | 10 +- src/cli/scan/intent-onboarding.ts | 7 +- src/cli/scan/onboarding-state.ts | 46 +- src/events/log.ts | 1 + src/init/agents-md.ts | 8 + src/init/host-setup.ts | 2 +- src/serve/server.ts | 293 ++++++- src/spec/new.ts | 114 ++- src/spec/schema.json | 12 + src/spec/types.ts | 8 + tests/cli/clad.test.ts | 1 + tests/cli/clarify.test.ts | 54 +- tests/cli/done.test.ts | 18 + tests/init/skill-activation.test.ts | 24 + .../existing-adoption-lifecycle.test.ts | 9 +- tests/scenarios/greenfield-lifecycle.test.ts | 13 +- tests/serve/gate-footer-unavailable.test.ts | 2 +- tests/serve/init-tools.test.ts | 154 +++- tests/serve/server.test.ts | 106 ++- 91 files changed, 1547 insertions(+), 599 deletions(-) create mode 100644 tests/init/skill-activation.test.ts diff --git a/README.ja.md b/README.ja.md index 87a0ae9b..984a1fa3 100644 --- a/README.ja.md +++ b/README.ja.md @@ -262,13 +262,15 @@ cd 自分の出発点に合う依頼を AI ツールへ自然な言葉で伝える。 +Cladding はまずプロジェクトを読み取り専用で調査する。AI が正確なファイル操作と一度限りの承認フレーズを示し、ユーザーが別の返信でそのフレーズをそのまま入力した場合にだけ初期化を開始する。プロジェクトを開いたり Cladding について質問したりするだけでは、ファイルは変更されない。 + #### アイデアだけがある場合 ``` B2B 決済 SaaS を cladding で始めて。 ``` -LLM がドメインを分析し、spec・ドキュメント・ポリシーを作成してから、2〜3 個の追加質問を行う。 +LLM がドメインを分析し、spec・ドキュメント・ポリシーを作成する。重要なプロダクト判断が未解決の場合にだけ最大 3 個の追加質問を行い、完成した計画には質問しない。 #### 企画ドキュメントがある場合 @@ -286,7 +288,7 @@ docs/plan.md を基に cladding を適用して。 既存コードをスキャンし、観察したパターンとユーザーの intent を組み合わせる。 -> **初期化が完了したら、同じ会話でそのまま開発を続ければよい。** 次の機能を自然な言葉で依頼すると、AI は生成された spec とドキュメントを基準に開発し、cladding はバックグラウンドで検証ループを実行する。 +> **初期化が完了したら、同じ会話でそのまま開発を続ければよい。** 次の機能を自然な言葉で依頼すると、AI は生成された spec とドキュメントを基準に開発し、重要な設計変更もプロジェクトの成長に合わせて反映する。検査はホストが呼び出した時に実行され、自動強制が必要なら任意の Git hook または CI gate を使用する。 ``` メールログイン機能をテスト込みで実装して。 diff --git a/README.ko.md b/README.ko.md index f68f3324..4ff268a7 100644 --- a/README.ko.md +++ b/README.ko.md @@ -261,13 +261,15 @@ cd 자신의 시작 상황에 맞는 요청을 AI 도구에 자연스럽게 말한다. +Cladding은 먼저 프로젝트를 읽기 전용으로 조사한다. AI가 정확한 파일 작업과 일회용 승인 문구를 보여주며, 사용자가 별도 답변에서 그 문구를 그대로 입력해야만 초기화가 시작된다. 프로젝트를 열거나 Cladding에 관해 질문하는 것만으로는 어떤 파일도 변경되지 않는다. + #### 아이디어만 있을 때 ``` B2B 결제 SaaS를 cladding으로 시작해줘. ``` -LLM이 도메인을 분석해 spec · 문서 · 정책을 만들고, 후속 질문 2–3개를 이어간다. +LLM이 도메인을 분석해 spec · 문서 · 정책을 만든다. 중요한 제품 결정이 실제로 비어 있을 때만 후속 질문을 최대 3개 하며, 완성된 기획에는 질문하지 않는다. #### 기획 문서가 있을 때 @@ -285,7 +287,7 @@ docs/plan.md를 기준으로 cladding을 적용해줘. 기존 코드를 스캔하고, 관찰한 패턴을 사용자의 intent와 결합한다. -> **초기화가 끝나면 같은 대화에서 바로 개발을 이어가면 된다.** 다음 기능을 자연어로 요청하면 AI가 생성된 spec과 문서를 기준으로 개발하고, cladding은 배경에서 검증 루프를 실행한다. +> **초기화가 끝나면 같은 대화에서 바로 개발을 이어가면 된다.** 다음 기능을 자연어로 요청하면 AI가 생성된 spec과 문서를 기준으로 개발하고, 중요한 설계 변경도 프로젝트 성장에 맞춰 함께 반영한다. 검사는 호스트가 호출할 때 실행되며, 자동 강제가 필요하면 선택형 Git hook이나 CI 게이트를 사용한다. ``` 이메일 로그인 기능을 테스트까지 포함해서 구현해줘. diff --git a/README.md b/README.md index ff57b0c4..6a4986dc 100644 --- a/README.md +++ b/README.md @@ -258,8 +258,8 @@ cd Choose the starting point that fits and say it naturally in your AI tool. -Cladding first inspects the project without changing it. Your AI shows the files it plans to create -and asks for confirmation; initialization begins only after your separate affirmative reply. +Cladding first inspects the project without changing it. Your AI shows the exact file operations and +a one-time approval phrase; initialization begins only when you repeat that phrase in a separate reply. Opening a project or asking a question about Cladding never authorizes file changes. #### An idea, nothing else @@ -268,7 +268,8 @@ Opening a project or asking a question about Cladding never authorizes file chan Start this B2B payment SaaS with Cladding. ``` -The LLM analyzes the domain, creates the spec, docs, and policies, then asks 2–3 follow-up questions. +The LLM analyzes the domain and creates the spec, docs, and policies. It asks up to three follow-up +questions only when an important product decision is still unresolved; a complete plan asks none. #### A planning document @@ -286,7 +287,7 @@ Analyze this project and apply Cladding. Cladding scans the existing code and combines the observed patterns with your intent. -> **Once initialization is complete, keep developing in the same conversation.** Ask for the next feature in plain language; the AI uses the generated spec and docs while cladding runs its verification loop in the background. +> **Once initialization is complete, keep developing in the same conversation.** Ask for the next feature in plain language; the AI uses the generated spec and docs and keeps material design changes aligned as the project grows. Checks run when the host invokes them; use the optional Git hooks or CI gate when you want automatic enforcement. ``` Implement email sign-in, including tests. diff --git a/README.zh.md b/README.zh.md index d09685e9..ebf71f61 100644 --- a/README.zh.md +++ b/README.zh.md @@ -258,13 +258,15 @@ cd 根据自己的起点,用自然语言告诉 AI 工具。 +Cladding 会先以只读方式检查项目。AI 会展示准确的文件操作和一次性批准短语;只有当用户在单独回复中原样输入该短语时,初始化才会开始。仅仅打开项目或询问 Cladding 不会修改任何文件。 + #### 只有一个想法时 ``` 用 cladding 开始这个 B2B 支付 SaaS。 ``` -LLM 会分析领域、创建 spec、文档和策略,然后提出 2–3 个后续问题。 +LLM 会分析领域并创建 spec、文档和策略。只有关键产品决策尚未明确时才会提出最多 3 个后续问题;完整的规划不会被强制追问。 #### 已有规划文档时 @@ -282,7 +284,7 @@ Cladding 会加载该文件,并将其内容作为项目意图。 Cladding 会扫描现有代码,并把观察到的模式与你的意图结合起来。 -> **初始化完成后,直接在同一段对话中继续开发即可。** 用自然语言提出下一个功能,AI 会依据生成的 spec 和文档开发,cladding 则在后台运行验证循环。 +> **初始化完成后,直接在同一段对话中继续开发即可。** 用自然语言提出下一个功能,AI 会依据生成的 spec 和文档开发,并让重要设计随项目成长同步演进。检查会在宿主调用时运行;如需自动强制,请启用可选的 Git hook 或 CI gate。 ``` 实现邮箱登录功能,并包含测试。 diff --git a/docs/ab-evaluation/case-existing-adoption.md b/docs/ab-evaluation/case-existing-adoption.md index 673575a0..3e24c6cc 100644 --- a/docs/ab-evaluation/case-existing-adoption.md +++ b/docs/ab-evaluation/case-existing-adoption.md @@ -51,8 +51,8 @@ No spec, no architecture invariants — just code on the existing tree. | Test files | 1 | 1 | +0 | | Test LoC | 14 | 14 | +0 | | Test cases | 1 | 1 | +0 | -| Total chars (artifacts + code) | 10843 | 3864 | +6979 | -| Estimated tokens | 2713 | 967 | +1746 | +| Total chars (artifacts + code) | 11242 | 3864 | +7378 | +| Estimated tokens | 2813 | 967 | +1846 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -90,8 +90,8 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 | Test files | 2 | 2 | +0 | | Test LoC | 27 | 27 | +0 | | Test cases | 3 | 3 | +0 | -| Total chars (artifacts + code) | 12386 | 5115 | +7271 | -| Estimated tokens | 3099 | 1280 | +1819 | +| Total chars (artifacts + code) | 12785 | 5115 | +7670 | +| Estimated tokens | 3199 | 1280 | +1919 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -111,7 +111,7 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 - **Spec ↔ code traceability**: cladding emits 1 feature(s), 2 AC(s), 1 scenario(s), 3 capability(s); vanilla has 0 of each. - **Architecture enforcement**: cladding declares 3 layer(s) with 0 forbidden-import rule(s); vanilla has 0. - **Detector behavior**: cladding-managed tree → 1 error(s) / 5 warn(s) / 7 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 ~3099 tokens vs vanilla's ~1280 (heuristic chars/4) — Δ ≈ 1819 tokens, the price of structure. +- **Token cost**: cladding's cumulative artifact + code consumes ~3199 tokens vs vanilla's ~1280 (heuristic chars/4) — Δ ≈ 1919 tokens, the price of structure. - **Code surface**: vanilla writes 9 source file(s) / 144 LoC + 2 test file(s) / 3 test case(s); cladding writes 9 / 128 + 2 / 3. (Vanilla front-loads code, cladding front-loads spec — both converge by M2.) ## Outcome Quality (F-ba2e05) diff --git a/docs/ab-evaluation/case-payment-saas.md b/docs/ab-evaluation/case-payment-saas.md index de6ac103..2031cb2e 100644 --- a/docs/ab-evaluation/case-payment-saas.md +++ b/docs/ab-evaluation/case-payment-saas.md @@ -50,8 +50,8 @@ no spec, no scenarios, no architecture invariants. | Test files | 0 | 1 | -1 | | Test LoC | 0 | 20 | -20 | | Test cases | 0 | 2 | -2 | -| Total chars (artifacts + code) | 6175 | 3463 | +2712 | -| Estimated tokens | 1545 | 867 | +678 | +| Total chars (artifacts + code) | 6682 | 3463 | +3219 | +| Estimated tokens | 1672 | 867 | +805 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -89,8 +89,8 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 | Test files | 1 | 2 | -1 | | Test LoC | 8 | 33 | -25 | | Test cases | 1 | 4 | -3 | -| Total chars (artifacts + code) | 7339 | 5592 | +1747 | -| Estimated tokens | 1836 | 1399 | +437 | +| Total chars (artifacts + code) | 7846 | 5592 | +2254 | +| Estimated tokens | 1963 | 1399 | +564 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -110,7 +110,7 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 - **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) / 9 warn(s) / 9 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 ~1836 tokens vs vanilla's ~1399 (heuristic chars/4) — Δ ≈ 437 tokens, the price of structure. +- **Token cost**: cladding's cumulative artifact + code consumes ~1963 tokens vs vanilla's ~1399 (heuristic chars/4) — Δ ≈ 564 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.) ## Outcome Quality (F-ba2e05) diff --git a/docs/feature-cycle.md b/docs/feature-cycle.md index caefe03c..b33cdc5b 100644 --- a/docs/feature-cycle.md +++ b/docs/feature-cycle.md @@ -22,6 +22,11 @@ say-so alone, never skip a `▣`. `test_refs`) + the `modules` you're about to build + any scenario it needs — in one `clad_create_feature` call (the tool takes ACs/modules). Not the whole backlog; just the feature you're about to build. + Classify its design impact in the same call: `none` for a genuinely internal change, + `additive` to bind it to a capability and optional existing scenario, or `structural` when + architecture/project context must change. Additive links land with the shard. Structural impact + stays `review_required`; show the Tier-B diff and call `clad_resolve_design_impact` only after the + listed artifacts actually changed with user approval. - ▣ **Barrier:** `clad sync` — the shard itself must be valid (schema, EARS shape, consistent inventory) before any code. **Spec-first is the hard rule:** you author the shard *before* the code, and no code that no feature claims may land (`UNMAPPED_ARTIFACT` blocks that at step 3's @@ -61,7 +66,8 @@ say-so alone, never skip a `▣`. the feature to done with **`clad done `** — it re-runs the pre-push strict gate with the feature evaluated as done and writes `status: done` **only if that gate is GREEN**, reverting otherwise. Do not hand-write `status: done`: the verb is what keeps "done" from claiming more than - the gate verifies. `clad sync` keeps the inventory honest. Sign-off identity ≠ any implementer + the gate verifies. An unresolved structural design impact is refused before the gate runs. + `clad sync` keeps the inventory honest. Sign-off identity ≠ any implementer (independent agent, or a human at L4 / UAT). **Then start the next feature's cycle.** ## Parallelism = N concurrent instances of this same cycle diff --git a/docs/glossary.md b/docs/glossary.md index 883c9e21..07493b80 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -90,11 +90,13 @@ | `clad_init` | Validate and apply the host model's structured onboarding draft. | | `clad_prepare_clarify` | Read current onboarding state and prepare a real user answer for host-model refinement. | | `clad_clarify` | Validate and apply the host model's structured refinement draft. | +| `clad_resolve_onboarding_review` | Apply only the onboarding proposal targets the user explicitly reviewed and approved. | | `clad_list_features` | Query features by status/slug. | | `clad_get_feature` | Fetch one feature + ACs by id or slug. | | `clad_run_check` | Run drift detection in-process (terse by default). | | `clad_get_events` | Tail the lifecycle event log. | -| `clad_create_feature` | Author a feature shard with hash id + ACs. | +| `clad_create_feature` | Author a feature shard with hash id + ACs + a durable design-impact decision. | +| `clad_resolve_design_impact` | Mark structural design impact resolved after every listed Tier-B artifact actually changed. | | `clad_create_scenario` | Author a scenario shard with hash id. | | `clad_link_capability` | Upsert a capability ↔ feature binding (Tier B). | | `clad_author_oracle` | Record a host-authored impl-blind oracle + provenance. | @@ -151,7 +153,7 @@ four distinct Korean words too, so the conflation cannot survive translation: `stage_started` · `stage_completed` · `feature_activated` · `feature_completed` · `evidence_recorded` · `drift_detected` · `feature_checkpoint` · `feature_rolled_back` · `sentinel_miss` -Added 0.6.0 (F-b84c38 — payloads carry `identity` + `head`): `feature_created` (spec shard authored) · `scenario_created` · `done_attempted` (gated flip, kept or reverted) · `gate_run` (tier verification outcome; deduped per identical HEAD/tier/strict/worst) · `stop_blocked` (F-1d23a6 — the Stop host hook blocked a session end on a fresh failure fingerprint; identical fingerprints demote without an event). +Added 0.6.0 (F-b84c38 — payloads carry `identity` + `head`): `feature_created` (spec shard authored) · `scenario_created` · `done_attempted` (gated flip, kept or reverted) · `gate_run` (tier verification outcome; deduped per identical HEAD/tier/strict/worst) · `stop_blocked` (F-1d23a6 — the Stop host hook blocked a session end on a fresh failure fingerprint; identical fingerprints demote without an event). `design_impact_resolved` records that a structural feature's reviewed Tier-B changes were applied. Added 0.8.0 (F-6ba22c5c — value-delivery telemetry, so a silent surface is distinguishable from an unwired one): `impact_card_fired` (a PostToolUse impact card produced output — payload file/feature/impacted/tests/unledgered) · `impact_card_skipped` (the card was skipped — `reason` ∈ a closed enum, one per degrade branch; the two high-frequency reasons are aggregated to one event per debounce window) · `session_card_rendered` (a non-empty SessionStart card — payload bytes) · `prompt_suggestion_served` (a non-empty UserPromptSubmit suggestion — payload kind) · `working_set_served` (an MCP read serve of `clad_get_working_set` / `clad_get_context` / `clad_get_impact` — payload tool/query/resolved). Summarized by `clad measure --sessions` as DELIVERY (did the surfaces fire), never adoption. diff --git a/docs/setup.md b/docs/setup.md index 0559f577..cfd1ae42 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -19,8 +19,9 @@ the detail behind them: where each host is wired, how the MCP server works, and binaries are on PATH. It is safe to re-run after an upgrade or after installing a new AI tool. **Verification level (honesty note).** Claude Code is fully verified through real-usage -campaigns (including real-time intervention). Codex · Gemini CLI wire automatically; their behavior isn't verified yet. Cursor wires automatically, but real-usage verification is still pending — -to be updated as it lands. (The machine-readable claim lives in the README's `clad:host-claims` +campaigns (including real-time intervention). Codex onboarding is live-verified for idea, +planning-document, existing-project, and uninitialized control cases. Gemini CLI and Cursor wire +automatically, but their real-usage onboarding verification is still pending. (The machine-readable claim lives in the README's `clad:host-claims` fence, which `HOST_CLAIM_DRIFT` polices against `docs/dogfood/matrix.md`.) ## About the MCP server @@ -36,8 +37,9 @@ only standard MCP tool calls—not server-side sampling—and prevents incomplet drafts from partially changing the project. Initialization never writes immediately from the first natural-language request. The host previews -the planned files and asks for confirmation; only a separate affirmative user reply authorizes the -write step. Merely opening a project, asking about Cladding, or running `clad setup` is not consent. +the planned file operations and shows a one-time approval phrase; only a separate user reply that +exactly repeats that phrase authorizes the write step. Questions, paraphrases, merely opening a +project, asking about Cladding, or running `clad setup` are not consent. | Host | Primary request | Optional explicit invocation | |---|---|---| diff --git a/docs/ssot-model.md b/docs/ssot-model.md index d1fe251e..587f8d0e 100644 --- a/docs/ssot-model.md +++ b/docs/ssot-model.md @@ -35,7 +35,7 @@ A Tier B artifact must answer: **who reads this and what decision do they make?* Orphan artifacts get demoted (move to Tier D as historical reference) or removed. This cycle resolves the v0.3.45 orphans: - `spec/capabilities.yaml` gains the `CAPABILITIES_FEATURE_MAPPING` detector - `docs/project-context.md` becomes the scenario generator's source (clear, named role) -- `spec/scenarios/*.yaml` gains a clear producer (onboarding / `clad_create_scenario`) and consumer (the reference detectors + the host AI). *(NOTE v0.4.x: an earlier draft claimed `clad_create_feature` binds scenarios; it does not — `createFeature` in `src/spec/new.ts` takes no scenario argument. Scenarios are authored independently via `clad_create_scenario`.)* +- `spec/scenarios/*.yaml` gains a clear producer (onboarding / `clad_create_scenario`) and consumer (the reference detectors + the host AI). The public `clad_create_feature` transaction may bind an existing scenario when its design impact is additive; the lower-level `createFeature` helper stays single-purpose. ## Artifact registry @@ -84,11 +84,10 @@ single-responsibility (and keeps a tool's name honest as it grows). | **refine** | holistic DOCUMENT (one per project, not enumerated) | LLM/manual rewrite | `clad clarify` (formerly `refine`) → `architecture.yaml`, `project-context.md`, `conventions.md` | A capability is **accumulative** (created once, then features land on it over time), -so its verb is `link`, not `create` — re-"creating" an existing capability would -collide. `clad_create_feature` therefore does NOT grow capabilities as a side effect -(that would make its name lie); instead its result carries a non-mutating `hint` to -call `clad_link_capability`. This is the deterministic development-time firing path -for the Tier-B design SSoT, complementing the onboarding-time `clad clarify` path. +so its underlying verb remains `link`, not `create`. The public `clad_create_feature` +transaction requires a design-impact decision: `additive` composes that link (and an +optional scenario link) with feature creation; `structural` records the affected Tier-B +artifacts as `review_required` until their approved contents actually change. ## Capturing WHY — the decision micro-format (Tier A content) @@ -213,8 +212,8 @@ Conflict resolution (when same information lives in multiple tiers): | `clad init` (bare, greenfield) | spec.yaml seed, .cladding/, .gitignore, project-context template, scenarios README, conventions/architecture/capabilities greenfield seeds | new files only — existing files skip via idempotency | | `clad init ` (onboarding) | + project-context.md (LLM-refined), capabilities.yaml (LLM-inferred), architecture.yaml (LLM-inferred), spec.yaml F-001 title, **scenarios stubs (NEW v0.3.45)**, onboarding state.yaml | existing files divert to `.cladding/scan/*.proposal` | | `clad init --scan` (existing-project) | conventions.md (observed), architecture.yaml (observed), capabilities.yaml (README headings), project-context.md (LLM-refined) | existing files divert to proposal | -| `clad clarify ` | project-context.md, capabilities.yaml, architecture.yaml, scenarios stubs (refined Q-A history) | existing files divert to proposal | -| `clad_create_feature` MCP tool | spec/features/-.yaml + binds to existing scenario via `features[]` | rejects on collision | +| `clad clarify ` | project-context.md, capabilities.yaml, architecture.yaml, scenarios stubs (refined Q-A history) | untouched generated design updates in place; user-edited design diverts to proposal and remains `needs_review` until explicitly accepted | +| `clad_create_feature` MCP tool | spec/features/-.yaml + durable design-impact decision; additive capability/scenario links | structural impact remains review-required and blocks `clad done` | | append-only (Tier D) | events.log, audit.log entries | no divert — strict append | ## Quick decision flowchart for adding a new artifact diff --git a/docs/ssot-testing.md b/docs/ssot-testing.md index 6e45e442..dad9879f 100644 --- a/docs/ssot-testing.md +++ b/docs/ssot-testing.md @@ -16,7 +16,7 @@ Empty tmpdir + user intent "결제 SaaS for B2B": | Stage | What happens | What we assert | |---|---|---| | **S1** | `clad init ` with LLM-mocked onboarding response | All 4 tiers present, every artifact's first line is the standard Tier banner, F-001 title is intent-derived, 2 scenarios shards land | -| **S2** | `clad clarify 법인 사업자만` | First pending question marked answered, existing artifacts diverted to `.cladding/scan/*.proposal`, capabilities grow by 1 | +| **S2** | `clad clarify 법인 사업자만` | First pending question marked answered; untouched generated design updates in place, while user-edited design stays preserved with review proposals | | **S3** | Test writes 3+ TS files matching the architecture's suggested layers | (no command — simulates real-world development) | | **S4** | Cross-tier consistency check (`assertCrossTierClean`) | `CAPABILITIES_FEATURE_MAPPING` + `ARCHITECTURE_FROM_SPEC` + `REFERENCE_INTEGRITY` emit zero errors | | **S5** | `clad init --scan` re-runs after code was written | `docs/conventions.md` + `spec/architecture.yaml` diverted to proposal; live files preserve onboarding seed | @@ -118,7 +118,7 @@ PR #131's claim is that the 4-tier model improves development output quality. Th 2. **Cross-document drift errors → 0** — every detector emits clean at end-of-lifecycle. `CAPABILITIES_FEATURE_MAPPING` confirms the capability ↔ feature link in Case 2 S5. -3. **Refresh policy preserved** — re-running `clad init --scan` (Greenfield S5) and `clad clarify` (S2) diverts to `.cladding/scan/*.proposal` instead of overwriting user edits. `assertProposalDivert` codifies this. +3. **Refresh policy preserved** — re-running `clad init --scan` (Greenfield S5) diverts to `.cladding/scan/*.proposal`. During active onboarding, `clad clarify` updates byte-identical generated design directly; if a user edited it, the answer remains `needs_review` and proposal-diverts until explicitly accepted. If these three signals stay green across the full lifecycle, the SSoT model is delivering the promised quality improvement. If any regress, the failing test names the gap. diff --git a/plugins/claude-code/agents/blind-author.md b/plugins/claude-code/agents/blind-author.md index dac74eea..8b0eacab 100644 --- a/plugins/claude-code/agents/blind-author.md +++ b/plugins/claude-code/agents/blind-author.md @@ -1,6 +1,6 @@ --- name: blind-author -description: Impl-blind test/oracle author — writes conformance tests from a spec-only brief. Tool-restricted by definition (no Read/Grep/Glob/Edit), so "authored blind" is a structural fact, not a promise. +description: Impl-blind test/oracle author — writes conformance tests from a spec-only brief. Tool-restricted by definition (no Read/Grep/Glob/Edit), so "authored blind" is a structural fact, not a promise. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Write, Bash capabilities: [write, exec] --- diff --git a/plugins/claude-code/agents/developer.md b/plugins/claude-code/agents/developer.md index 6d1c2835..7393b7cf 100644 --- a/plugins/claude-code/agents/developer.md +++ b/plugins/claude-code/agents/developer.md @@ -1,6 +1,6 @@ --- name: developer -description: Implementer — writes production code, tests, and migrations. The "generic engineer" fallback when no narrower specialist exists. +description: Implementer — writes production code, tests, and migrations. The "generic engineer" fallback when no narrower specialist exists. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Write, Edit, Bash capabilities: [read, write, edit, exec] --- diff --git a/plugins/claude-code/agents/observability.md b/plugins/claude-code/agents/observability.md index da1e4251..5beb1a28 100644 --- a/plugins/claude-code/agents/observability.md +++ b/plugins/claude-code/agents/observability.md @@ -1,6 +1,6 @@ --- name: observability -description: Log and metrics analyst — reads .cladding/audit.log.jsonl, perf/baseline.json, and drift reports; surfaces patterns the human can act on. +description: Log and metrics analyst — reads .cladding/audit.log.jsonl, perf/baseline.json, and drift reports; surfaces patterns the human can act on. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Bash capabilities: [read, exec] --- diff --git a/plugins/claude-code/agents/orchestrator.md b/plugins/claude-code/agents/orchestrator.md index db1ea39e..073305af 100644 --- a/plugins/claude-code/agents/orchestrator.md +++ b/plugins/claude-code/agents/orchestrator.md @@ -1,6 +1,6 @@ --- name: orchestrator -description: Workflow conductor — sequences agents based on the 5 invocation principles. Routes user intent to the right persona. +description: Workflow conductor — sequences agents based on the 5 invocation principles. Routes user intent to the right persona. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Write, Edit, Bash, Agent capabilities: [read, write, edit, exec, dispatch] --- @@ -29,7 +29,7 @@ You do NOT pre-load Tier C (conventions — developer's concern). 3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. 4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). 5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. -6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes, and wait for a separate affirmative user reply. The original request is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. ## Feature cycle — one feature at a time diff --git a/plugins/claude-code/agents/planner.md b/plugins/claude-code/agents/planner.md index b2f7ed45..7967b1e1 100644 --- a/plugins/claude-code/agents/planner.md +++ b/plugins/claude-code/agents/planner.md @@ -1,6 +1,6 @@ --- name: planner -description: SSoT custodian — keeps spec.yaml structurally clean. Adds features, archives them, and ensures EARS pattern compliance. +description: SSoT custodian — keeps spec.yaml structurally clean. Adds features, archives them, and ensures EARS pattern compliance. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Write, Edit, Bash capabilities: [read, write, edit, exec] --- diff --git a/plugins/claude-code/agents/reviewer.md b/plugins/claude-code/agents/reviewer.md index 99246fc8..837d92e0 100644 --- a/plugins/claude-code/agents/reviewer.md +++ b/plugins/claude-code/agents/reviewer.md @@ -1,6 +1,6 @@ --- name: reviewer -description: Philosophical guardrails enforcer — independently audits code, tests, and spec for layered-integrity, Why>What, error-as-data, and the related Ironclad philosophical invariants. +description: Philosophical guardrails enforcer — independently audits code, tests, and spec for layered-integrity, Why>What, error-as-data, and the related Ironclad philosophical invariants. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Bash capabilities: [read, exec] --- diff --git a/plugins/claude-code/commands/init.md b/plugins/claude-code/commands/init.md index ef6ebedd..15925604 100644 --- a/plugins/claude-code/commands/init.md +++ b/plugins/claude-code/commands/init.md @@ -14,8 +14,8 @@ Use this workflow only when the user explicitly asks to initialize, adopt, or re - `document` with a project-relative planning-document path. - `existing` for an existing codebase; include an optional adoption goal. 3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. -4. Show `plannedChanges` and `confirmationQuestion` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. -5. Only after an affirmative user reply, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. +4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. Questions, paraphrases, and generic acknowledgements are not approval. 6. Ask the returned `nextQuestion` verbatim. Continue with the Cladding clarify workflow after the user answers. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. diff --git a/plugins/claude-code/dist/agents/blind-author.md b/plugins/claude-code/dist/agents/blind-author.md index dac74eea..8b0eacab 100644 --- a/plugins/claude-code/dist/agents/blind-author.md +++ b/plugins/claude-code/dist/agents/blind-author.md @@ -1,6 +1,6 @@ --- name: blind-author -description: Impl-blind test/oracle author — writes conformance tests from a spec-only brief. Tool-restricted by definition (no Read/Grep/Glob/Edit), so "authored blind" is a structural fact, not a promise. +description: Impl-blind test/oracle author — writes conformance tests from a spec-only brief. Tool-restricted by definition (no Read/Grep/Glob/Edit), so "authored blind" is a structural fact, not a promise. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Write, Bash capabilities: [write, exec] --- diff --git a/plugins/claude-code/dist/agents/developer.md b/plugins/claude-code/dist/agents/developer.md index 6d1c2835..7393b7cf 100644 --- a/plugins/claude-code/dist/agents/developer.md +++ b/plugins/claude-code/dist/agents/developer.md @@ -1,6 +1,6 @@ --- name: developer -description: Implementer — writes production code, tests, and migrations. The "generic engineer" fallback when no narrower specialist exists. +description: Implementer — writes production code, tests, and migrations. The "generic engineer" fallback when no narrower specialist exists. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Write, Edit, Bash capabilities: [read, write, edit, exec] --- diff --git a/plugins/claude-code/dist/agents/observability.md b/plugins/claude-code/dist/agents/observability.md index da1e4251..5beb1a28 100644 --- a/plugins/claude-code/dist/agents/observability.md +++ b/plugins/claude-code/dist/agents/observability.md @@ -1,6 +1,6 @@ --- name: observability -description: Log and metrics analyst — reads .cladding/audit.log.jsonl, perf/baseline.json, and drift reports; surfaces patterns the human can act on. +description: Log and metrics analyst — reads .cladding/audit.log.jsonl, perf/baseline.json, and drift reports; surfaces patterns the human can act on. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Bash capabilities: [read, exec] --- diff --git a/plugins/claude-code/dist/agents/orchestrator.md b/plugins/claude-code/dist/agents/orchestrator.md index db1ea39e..073305af 100644 --- a/plugins/claude-code/dist/agents/orchestrator.md +++ b/plugins/claude-code/dist/agents/orchestrator.md @@ -1,6 +1,6 @@ --- name: orchestrator -description: Workflow conductor — sequences agents based on the 5 invocation principles. Routes user intent to the right persona. +description: Workflow conductor — sequences agents based on the 5 invocation principles. Routes user intent to the right persona. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Write, Edit, Bash, Agent capabilities: [read, write, edit, exec, dispatch] --- @@ -29,7 +29,7 @@ You do NOT pre-load Tier C (conventions — developer's concern). 3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. 4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). 5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. -6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes, and wait for a separate affirmative user reply. The original request is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. ## Feature cycle — one feature at a time diff --git a/plugins/claude-code/dist/agents/planner.md b/plugins/claude-code/dist/agents/planner.md index b2f7ed45..7967b1e1 100644 --- a/plugins/claude-code/dist/agents/planner.md +++ b/plugins/claude-code/dist/agents/planner.md @@ -1,6 +1,6 @@ --- name: planner -description: SSoT custodian — keeps spec.yaml structurally clean. Adds features, archives them, and ensures EARS pattern compliance. +description: SSoT custodian — keeps spec.yaml structurally clean. Adds features, archives them, and ensures EARS pattern compliance. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Write, Edit, Bash capabilities: [read, write, edit, exec] --- diff --git a/plugins/claude-code/dist/agents/reviewer.md b/plugins/claude-code/dist/agents/reviewer.md index 99246fc8..837d92e0 100644 --- a/plugins/claude-code/dist/agents/reviewer.md +++ b/plugins/claude-code/dist/agents/reviewer.md @@ -1,6 +1,6 @@ --- name: reviewer -description: Philosophical guardrails enforcer — independently audits code, tests, and spec for layered-integrity, Why>What, error-as-data, and the related Ironclad philosophical invariants. +description: Philosophical guardrails enforcer — independently audits code, tests, and spec for layered-integrity, Why>What, error-as-data, and the related Ironclad philosophical invariants. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Bash capabilities: [read, exec] --- diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 33cccea1..351506bf 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 zue=Object.create;var JE=Object.defineProperty;var Uue=Object.getOwnPropertyDescriptor;var que=Object.getOwnPropertyNames;var Bue=Object.getPrototypeOf,Hue=Object.prototype.hasOwnProperty;var He=(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ir=(t,e)=>{for(var r in e)JE(t,r,{get:e[r],enumerable:!0})},Gue=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of que(e))!Hue.call(t,i)&&i!==r&&JE(t,i,{get:()=>e[i],enumerable:!(n=Uue(e,i))||n.enumerable});return t};var bt=(t,e,r)=>(r=t!=null?zue(Bue(t)):{},Gue(e||!t||!t.__esModule?JE(r,"default",{value:t,enumerable:!0}):r,t));var zd=v(XE=>{var Gg=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}},YE=class extends Gg{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};XE.CommanderError=Gg;XE.InvalidArgumentError=YE});var Zg=v(eA=>{var{InvalidArgumentError:Zue}=zd(),QE=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 Zue(`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 Vue(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}eA.Argument=QE;eA.humanReadableArgName=Vue});var nA=v(rA=>{var{humanReadableArgName:Wue}=Zg(),tA=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=>Wue(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 xq(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)dA(t,r,{get:e[r],enumerable:!0})},pde=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ude(e))!fde.call(t,i)&&i!==r&&dA(t,i,{get:()=>e[i],enumerable:!(n=lde(e,i))||n.enumerable});return t};var bt=(t,e,r)=>(r=t!=null?cde(dde(t)):{},pde(e||!t||!t.__esModule?dA(r,"default",{value:t,enumerable:!0}):r,t));var Vd=v(pA=>{var ry=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 ry{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};pA.CommanderError=ry;pA.InvalidArgumentError=fA});var ny=v(hA=>{var{InvalidArgumentError:mde}=Vd(),mA=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 mde(`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 hde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}hA.Argument=mA;hA.humanReadableArgName=hde});var _A=v(yA=>{var{humanReadableArgName:gde}=ny(),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=>gde(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 Mq(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 xq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}rA.Help=tA;rA.stripColor=xq});var aA=v(sA=>{var{InvalidArgumentError:Kue}=zd(),iA=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=Jue(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 Kue(`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?$q(this.name().replace(/^no-/,"")):$q(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}},oA=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 $q(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Jue(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 Mq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}yA.Help=gA;yA.stripColor=Mq});var wA=v(SA=>{var{InvalidArgumentError:yde}=Vd(),bA=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=_de(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 yde(`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?Fq(this.name().replace(/^no-/,"")):Fq(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 Fq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function _de(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}}sA.Option=iA;sA.DualOptions=oA});var Eq=v(kq=>{function Yue(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 Xue(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=Yue(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}}SA.Option=bA;SA.DualOptions=vA});var zq=v(Lq=>{function bde(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 vde(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=bde(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]}?)`:""}kq.suggestSimilar=Xue});var Rq=v(fA=>{var Que=He("node:events").EventEmitter,cA=He("node:child_process"),oo=He("node:path"),Vg=He("node:fs"),Ue=He("node:process"),{Argument:ede,humanReadableArgName:tde}=Zg(),{CommanderError:lA}=zd(),{Help:rde,stripColor:nde}=nA(),{Option:Aq,DualOptions:ide}=aA(),{suggestSimilar:Tq}=Eq(),uA=class t extends Que{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>dA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>dA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>nde(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 rde,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 ede(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 lA(e,r,n)),Ue.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 Aq(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 Aq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(Vg.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]}?)`:""}Lq.suggestSimilar=vde});var Hq=v(AA=>{var Sde=He("node:events").EventEmitter,xA=He("node:child_process"),ao=He("node:path"),iy=He("node:fs"),Ue=He("node:process"),{Argument:wde,humanReadableArgName:xde}=ny(),{CommanderError:$A}=Vd(),{Help:$de,stripColor:kde}=_A(),{Option:Uq,DualOptions:Ede}=wA(),{suggestSimilar:qq}=zq(),kA=class t extends Sde{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>EA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>EA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>kde(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 $de,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 wde(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 $A(e,r,n)),Ue.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 Uq(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 Uq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(iy.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=oo.resolve(u,d);if(Vg.existsSync(f))return f;if(i.includes(oo.extname(d)))return;let p=i.find(m=>Vg.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=Vg.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=oo.resolve(oo.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=oo.basename(this._scriptPath,oo.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(oo.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Oq(Ue.execArgv).concat(r),c=cA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=cA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Oq(Ue.execArgv).concat(r),c=cA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 lA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new lA(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=ao.resolve(u,d);if(iy.existsSync(f))return f;if(i.includes(ao.extname(d)))return;let p=i.find(m=>iy.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=iy.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=ao.resolve(ao.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=ao.basename(this._scriptPath,ao.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(ao.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Bq(Ue.execArgv).concat(r),c=xA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=xA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Bq(Ue.execArgv).concat(r),c=xA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 $A(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new $A(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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new ide(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=Tq(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=Tq(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=>tde(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=oo.basename(e,oo.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(Ue.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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Ede(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=qq(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=qq(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=>xde(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=ao.basename(e,ao.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(Ue.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 Oq(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 dA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}fA.Command=uA;fA.useColor=dA});var Dq=v(wn=>{var{Argument:Iq}=Zg(),{Command:pA}=Rq(),{CommanderError:ode,InvalidArgumentError:Pq}=zd(),{Help:sde}=nA(),{Option:Cq}=aA();wn.program=new pA;wn.createCommand=t=>new pA(t);wn.createOption=(t,e)=>new Cq(t,e);wn.createArgument=(t,e)=>new Iq(t,e);wn.Command=pA;wn.Option=Cq;wn.Argument=Iq;wn.Help=sde;wn.CommanderError=ode;wn.InvalidArgumentError=Pq;wn.InvalidOptionArgumentError=Pq});var Ce=v(Yt=>{"use strict";var hA=Symbol.for("yaml.alias"),Fq=Symbol.for("yaml.document"),Wg=Symbol.for("yaml.map"),Lq=Symbol.for("yaml.pair"),gA=Symbol.for("yaml.scalar"),Kg=Symbol.for("yaml.seq"),so=Symbol.for("yaml.node.type"),fde=t=>!!t&&typeof t=="object"&&t[so]===hA,pde=t=>!!t&&typeof t=="object"&&t[so]===Fq,mde=t=>!!t&&typeof t=="object"&&t[so]===Wg,hde=t=>!!t&&typeof t=="object"&&t[so]===Lq,zq=t=>!!t&&typeof t=="object"&&t[so]===gA,gde=t=>!!t&&typeof t=="object"&&t[so]===Kg;function Uq(t){if(t&&typeof t=="object")switch(t[so]){case Wg:case Kg:return!0}return!1}function yde(t){if(t&&typeof t=="object")switch(t[so]){case hA:case Wg:case gA:case Kg:return!0}return!1}var _de=t=>(zq(t)||Uq(t))&&!!t.anchor;Yt.ALIAS=hA;Yt.DOC=Fq;Yt.MAP=Wg;Yt.NODE_TYPE=so;Yt.PAIR=Lq;Yt.SCALAR=gA;Yt.SEQ=Kg;Yt.hasAnchor=_de;Yt.isAlias=fde;Yt.isCollection=Uq;Yt.isDocument=pde;Yt.isMap=mde;Yt.isNode=yde;Yt.isPair=hde;Yt.isScalar=zq;Yt.isSeq=gde});var Ud=v(yA=>{"use strict";var Mt=Ce(),Pr=Symbol("break visit"),qq=Symbol("skip children"),Si=Symbol("remove node");function Jg(t,e){let r=Bq(e);Mt.isDocument(t)?Mc(null,t.contents,r,Object.freeze([t]))===Si&&(t.contents=null):Mc(null,t,r,Object.freeze([]))}Jg.BREAK=Pr;Jg.SKIP=qq;Jg.REMOVE=Si;function Mc(t,e,r,n){let i=Hq(t,e,r,n);if(Mt.isNode(i)||Mt.isPair(i))return Gq(t,n,i),Mc(t,i,r,n);if(typeof i!="symbol"){if(Mt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var Zq=Ce(),bde=Ud(),vde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Sde=t=>t.replace(/[!,[\]{}]/g,e=>vde[e]),qd=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+Sde(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&&Zq.isNode(e.contents)){let o={};bde.visit(e.contents,(s,a)=>{Zq.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(` -`)}};qd.defaultYaml={explicit:!1,version:"1.2"};qd.defaultTags={"!!":"tag:yaml.org,2002:"};Vq.Directives=qd});var Xg=v(Bd=>{"use strict";var Wq=Ce(),wde=Ud();function xde(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 Kq(t){let e=new Set;return wde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function Jq(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function $de(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=Kq(t));let s=Jq(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(Wq.isScalar(s.node)||Wq.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}}Bd.anchorIsValid=xde;Bd.anchorNames=Kq;Bd.createNodeAnchors=$de;Bd.findNewAnchor=Jq});var bA=v(Yq=>{"use strict";function Hd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var kde=Ce();function Xq(t,e,r){if(Array.isArray(t))return t.map((n,i)=>Xq(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!kde.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}Qq.toJS=Xq});var Qg=v(t4=>{"use strict";var Ede=bA(),e4=Ce(),Ade=Uo(),vA=class{constructor(e){Object.defineProperty(this,e4.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(!e4.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=Ade.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Ede.applyReviver(o,{"":a},"",a):a}};t4.NodeBase=vA});var Gd=v(r4=>{"use strict";var Tde=Xg(),Ode=Ud(),Lc=Ce(),Rde=Qg(),Ide=Uo(),SA=class extends Rde.NodeBase{constructor(e){super(Lc.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=[],Ode.visit(e,{Node:(o,s)=>{(Lc.isAlias(s)||Lc.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||(Ide.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=ey(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(Tde.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 ey(t,e,r){if(Lc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Lc.isCollection(e)){let n=0;for(let i of e.items){let o=ey(t,i,r);o>n&&(n=o)}return n}else if(Lc.isPair(e)){let n=ey(t,e.key,r),i=ey(t,e.value,r);return Math.max(n,i)}return 1}r4.Alias=SA});var It=v(wA=>{"use strict";var Pde=Ce(),Cde=Qg(),Dde=Uo(),Nde=t=>!t||typeof t!="function"&&typeof t!="object",qo=class extends Cde.NodeBase{constructor(e){super(Pde.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Dde.toJS(this.value,e,r)}toString(){return String(this.value)}};qo.BLOCK_FOLDED="BLOCK_FOLDED";qo.BLOCK_LITERAL="BLOCK_LITERAL";qo.PLAIN="PLAIN";qo.QUOTE_DOUBLE="QUOTE_DOUBLE";qo.QUOTE_SINGLE="QUOTE_SINGLE";wA.Scalar=qo;wA.isScalarValue=Nde});var Zd=v(i4=>{"use strict";var jde=Gd(),na=Ce(),n4=It(),Mde="tag:yaml.org,2002:";function Fde(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 Lde(t,e,r){if(na.isDocument(t)&&(t=t.contents),na.isNode(t))return t;if(na.isPair(t)){let d=r.schema[na.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 jde.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Mde+e.slice(2));let l=Fde(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new n4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[na.MAP]:Symbol.iterator in Object(t)?s[na.SEQ]:s[na.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 n4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}i4.createNode=Lde});var ry=v(ty=>{"use strict";var zde=Zd(),wi=Ce(),Ude=Qg();function xA(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 zde.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 o4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,$A=class extends Ude.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=>wi.isNode(n)||wi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(o4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(wi.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,xA(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(wi.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&&wi.isScalar(o)?o.value:o:wi.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!wi.isPair(r))return!1;let n=r.value;return n==null||e&&wi.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 wi.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(wi.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,xA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};ty.Collection=$A;ty.collectionFromPath=xA;ty.isEmptyPath=o4});var Vd=v(ny=>{"use strict";var qde=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function kA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Bde=(t,e,r)=>t.endsWith(` -`)?kA(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 Bq(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 EA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}AA.Command=kA;AA.useColor=EA});var Wq=v(xn=>{var{Argument:Gq}=ny(),{Command:TA}=Hq(),{CommanderError:Ade,InvalidArgumentError:Zq}=Vd(),{Help:Tde}=_A(),{Option:Vq}=wA();xn.program=new TA;xn.createCommand=t=>new TA(t);xn.createOption=(t,e)=>new Vq(t,e);xn.createArgument=(t,e)=>new Gq(t,e);xn.Command=TA;xn.Option=Vq;xn.Argument=Gq;xn.Help=Tde;xn.CommanderError=Ade;xn.InvalidArgumentError=Zq;xn.InvalidOptionArgumentError=Zq});var Ce=v(Xt=>{"use strict";var RA=Symbol.for("yaml.alias"),Xq=Symbol.for("yaml.document"),oy=Symbol.for("yaml.map"),Qq=Symbol.for("yaml.pair"),IA=Symbol.for("yaml.scalar"),sy=Symbol.for("yaml.seq"),co=Symbol.for("yaml.node.type"),Dde=t=>!!t&&typeof t=="object"&&t[co]===RA,Nde=t=>!!t&&typeof t=="object"&&t[co]===Xq,jde=t=>!!t&&typeof t=="object"&&t[co]===oy,Mde=t=>!!t&&typeof t=="object"&&t[co]===Qq,e4=t=>!!t&&typeof t=="object"&&t[co]===IA,Fde=t=>!!t&&typeof t=="object"&&t[co]===sy;function t4(t){if(t&&typeof t=="object")switch(t[co]){case oy:case sy:return!0}return!1}function Lde(t){if(t&&typeof t=="object")switch(t[co]){case RA:case oy:case IA:case sy:return!0}return!1}var zde=t=>(e4(t)||t4(t))&&!!t.anchor;Xt.ALIAS=RA;Xt.DOC=Xq;Xt.MAP=oy;Xt.NODE_TYPE=co;Xt.PAIR=Qq;Xt.SCALAR=IA;Xt.SEQ=sy;Xt.hasAnchor=zde;Xt.isAlias=Dde;Xt.isCollection=t4;Xt.isDocument=Nde;Xt.isMap=jde;Xt.isNode=Lde;Xt.isPair=Mde;Xt.isScalar=e4;Xt.isSeq=Fde});var Wd=v(PA=>{"use strict";var Lt=Ce(),Cr=Symbol("break visit"),r4=Symbol("skip children"),xi=Symbol("remove node");function ay(t,e){let r=n4(e);Lt.isDocument(t)?Bc(null,t.contents,r,Object.freeze([t]))===xi&&(t.contents=null):Bc(null,t,r,Object.freeze([]))}ay.BREAK=Cr;ay.SKIP=r4;ay.REMOVE=xi;function Bc(t,e,r,n){let i=i4(t,e,r,n);if(Lt.isNode(i)||Lt.isPair(i))return o4(t,n,i),Bc(t,i,r,n);if(typeof i!="symbol"){if(Lt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var s4=Ce(),Ude=Wd(),qde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Bde=t=>t.replace(/[!,[\]{}]/g,e=>qde[e]),Kd=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+Bde(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&&s4.isNode(e.contents)){let o={};Ude.visit(e.contents,(s,a)=>{s4.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(` +`)}};Kd.defaultYaml={explicit:!1,version:"1.2"};Kd.defaultTags={"!!":"tag:yaml.org,2002:"};a4.Directives=Kd});var ly=v(Jd=>{"use strict";var c4=Ce(),Hde=Wd();function Gde(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 l4(t){let e=new Set;return Hde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function u4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Zde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=l4(t));let s=u4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(c4.isScalar(s.node)||c4.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}}Jd.anchorIsValid=Gde;Jd.anchorNames=l4;Jd.createNodeAnchors=Zde;Jd.findNewAnchor=u4});var DA=v(d4=>{"use strict";function Yd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Vde=Ce();function f4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>f4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Vde.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}p4.toJS=f4});var uy=v(h4=>{"use strict";var Wde=DA(),m4=Ce(),Kde=Bo(),NA=class{constructor(e){Object.defineProperty(this,m4.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(!m4.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=Kde.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Wde.applyReviver(o,{"":a},"",a):a}};h4.NodeBase=NA});var Xd=v(g4=>{"use strict";var Jde=ly(),Yde=Wd(),Gc=Ce(),Xde=uy(),Qde=Bo(),jA=class extends Xde.NodeBase{constructor(e){super(Gc.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=[],Yde.visit(e,{Node:(o,s)=>{(Gc.isAlias(s)||Gc.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||(Qde.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=dy(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(Jde.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 dy(t,e,r){if(Gc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Gc.isCollection(e)){let n=0;for(let i of e.items){let o=dy(t,i,r);o>n&&(n=o)}return n}else if(Gc.isPair(e)){let n=dy(t,e.key,r),i=dy(t,e.value,r);return Math.max(n,i)}return 1}g4.Alias=jA});var Pt=v(MA=>{"use strict";var efe=Ce(),tfe=uy(),rfe=Bo(),nfe=t=>!t||typeof t!="function"&&typeof t!="object",Ho=class extends tfe.NodeBase{constructor(e){super(efe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:rfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Ho.BLOCK_FOLDED="BLOCK_FOLDED";Ho.BLOCK_LITERAL="BLOCK_LITERAL";Ho.PLAIN="PLAIN";Ho.QUOTE_DOUBLE="QUOTE_DOUBLE";Ho.QUOTE_SINGLE="QUOTE_SINGLE";MA.Scalar=Ho;MA.isScalarValue=nfe});var Qd=v(_4=>{"use strict";var ife=Xd(),oa=Ce(),y4=Pt(),ofe="tag:yaml.org,2002:";function sfe(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 afe(t,e,r){if(oa.isDocument(t)&&(t=t.contents),oa.isNode(t))return t;if(oa.isPair(t)){let d=r.schema[oa.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 ife.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=ofe+e.slice(2));let l=sfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new y4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[oa.MAP]:Symbol.iterator in Object(t)?s[oa.SEQ]:s[oa.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 y4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}_4.createNode=afe});var py=v(fy=>{"use strict";var cfe=Qd(),$i=Ce(),lfe=uy();function FA(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 cfe.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 b4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,LA=class extends lfe.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=>$i.isNode(n)||$i.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(b4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if($i.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,FA(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($i.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&&$i.isScalar(o)?o.value:o:$i.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!$i.isPair(r))return!1;let n=r.value;return n==null||e&&$i.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 $i.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($i.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,FA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};fy.Collection=LA;fy.collectionFromPath=FA;fy.isEmptyPath=b4});var ef=v(my=>{"use strict";var ufe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function zA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var dfe=(t,e,r)=>t.endsWith(` +`)?zA(r,e):r.includes(` `)?` -`+kA(r,e):(t.endsWith(" ")?"":" ")+r;ny.indentComment=kA;ny.lineComment=Bde;ny.stringifyComment=qde});var a4=v(Wd=>{"use strict";var Hde="flow",EA="block",iy="quoted";function Gde(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===EA&&(h=s4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===iy&&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===EA&&(h=s4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+zA(r,e):(t.endsWith(" ")?"":" ")+r;my.indentComment=zA;my.lineComment=dfe;my.stringifyComment=ufe});var S4=v(tf=>{"use strict";var ffe="flow",UA="block",hy="quoted";function pfe(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===UA&&(h=v4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===hy&&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===UA&&(h=v4(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===iy){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 Hn=It(),Bo=a4(),sy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),ay=t=>/^(%|---|\.\.\.)/m.test(t);function Zde(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 Kd(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(ay(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===hy){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 Vn=Pt(),Go=S4(),yy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),_y=t=>/^(%|---|\.\.\.)/m.test(t);function mfe(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 rf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(_y(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(TA,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{R=!0});let E=Bo.foldFlowLines(`${_}${w}${p}`,l,Bo.FOLD_BLOCK,A);if(!R)return`>${x} -${l}${E}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function Vde(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 zc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?zc(o,e):oy(t,e,r,n);if(!a&&!u&&i!==Hn.Scalar.PLAIN&&o.includes(` -`))return oy(t,e,r,n);if(ay(o)){if(c==="")return e.forceBlockIndent=!0,oy(t,e,r,n);if(a&&c===l)return zc(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 zc(o,e)}return a?d:Bo.foldFlowLines(d,c,Bo.FOLD_FLOW,sy(e,!1))}function Wde(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!==Hn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Hn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Hn.Scalar.BLOCK_FOLDED:case Hn.Scalar.BLOCK_LITERAL:return i||o?zc(s.value,e):oy(s,e,r,n);case Hn.Scalar.QUOTE_DOUBLE:return Kd(s.value,e);case Hn.Scalar.QUOTE_SINGLE:return AA(s.value,e);case Hn.Scalar.PLAIN:return Vde(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}c4.stringifyString=Wde});var Yd=v(OA=>{"use strict";var Kde=Xg(),Ho=Ce(),Jde=Vd(),Yde=Jd();function Xde(t,e){let r=Object.assign({blockQuote:!0,commentString:Jde.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 Qde(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(Ho.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 efe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Ho.isScalar(t)||Ho.isCollection(t))&&t.anchor;o&&Kde.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 tfe(t,e,r,n){if(Ho.isPair(t))return t.toString(e,r,n);if(Ho.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=Ho.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Qde(e.doc.schema.tags,o));let s=efe(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):Ho.isScalar(o)?Yde.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Ho.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}OA.createStringifyContext=Xde;OA.stringify=tfe});var f4=v(d4=>{"use strict";var ao=Ce(),l4=It(),u4=Yd(),Xd=Vd();function rfe({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=ao.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(ao.isCollection(t)||!ao.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||ao.isCollection(t)||(ao.isScalar(t)?t.type===l4.Scalar.BLOCK_FOLDED||t.type===l4.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=u4.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+=Xd.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Xd.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=Xd.lineComment(g,r.indent,l(f))));let b,_,S;ao.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&&ao.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&ao.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=u4.stringify(e,r,()=>x=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` -`:"",_){let A=l(_);R+=` -${Xd.indentComment(A,r.indent)}`}w===""&&!r.inFlow?R===` -`&&S&&(R=` - -`):R+=` -${r.indent}`}else if(!p&&ao.isCollection(e)){let A=w[0],E=w.indexOf(` -`),D=E!==-1,k=r.inFlow??e.flow??e.items.length===0;if(D||!k){let B=!1;if(D&&(A==="&"||A==="!")){let Q=w.indexOf(" ");A==="&"&&Q!==-1&&Q{O=!0});let A=Go.foldFlowLines(`${_}${w}${p}`,l,Go.FOLD_BLOCK,T);if(!O)return`>${x} +${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} +${l}${_}${r}${p}`}function hfe(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 Zc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?Zc(o,e):gy(t,e,r,n);if(!a&&!u&&i!==Vn.Scalar.PLAIN&&o.includes(` +`))return gy(t,e,r,n);if(_y(o)){if(c==="")return e.forceBlockIndent=!0,gy(t,e,r,n);if(a&&c===l)return Zc(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 Zc(o,e)}return a?d:Go.foldFlowLines(d,c,Go.FOLD_FLOW,yy(e,!1))}function gfe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Zc(s.value,e):gy(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return rf(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return qA(s.value,e);case Vn.Scalar.PLAIN:return hfe(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}w4.stringifyString=gfe});var of=v(HA=>{"use strict";var yfe=ly(),Zo=Ce(),_fe=ef(),bfe=nf();function vfe(t,e){let r=Object.assign({blockQuote:!0,commentString:_fe.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 Sfe(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(Zo.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 wfe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Zo.isScalar(t)||Zo.isCollection(t))&&t.anchor;o&&yfe.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 xfe(t,e,r,n){if(Zo.isPair(t))return t.toString(e,r,n);if(Zo.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=Zo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Sfe(e.doc.schema.tags,o));let s=wfe(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):Zo.isScalar(o)?bfe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Zo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}HA.createStringifyContext=vfe;HA.stringify=xfe});var E4=v(k4=>{"use strict";var lo=Ce(),x4=Pt(),$4=of(),sf=ef();function $fe({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=lo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(lo.isCollection(t)||!lo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||lo.isCollection(t)||(lo.isScalar(t)?t.type===x4.Scalar.BLOCK_FOLDED||t.type===x4.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=$4.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+=sf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=sf.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=sf.lineComment(g,r.indent,l(f))));let b,_,S;lo.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&&lo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&lo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=$4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +`:"",_){let T=l(_);O+=` +${sf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` +`&&S&&(O=` + +`):O+=` +${r.indent}`}else if(!p&&lo.isCollection(e)){let T=w[0],A=w.indexOf(` +`),D=A!==-1,E=r.inFlow??e.flow??e.items.length===0;if(D||!E){let q=!1;if(D&&(T==="&"||T==="!")){let Q=w.indexOf(" ");T==="&"&&Q!==-1&&Q{"use strict";var p4=He("process");function nfe(t,...e){t==="debug"&&console.log(...e)}function ife(t,e){(t==="debug"||t==="warn")&&(typeof p4.emitWarning=="function"?p4.emitWarning(e):console.warn(e))}RA.debug=nfe;RA.warn=ife});var fy=v(dy=>{"use strict";var uy=Ce(),m4=It(),cy="<<",ly={identify:t=>t===cy||typeof t=="symbol"&&t.description===cy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new m4.Scalar(Symbol(cy)),{addToJSMap:h4}),stringify:()=>cy},ofe=(t,e)=>(ly.identify(e)||uy.isScalar(e)&&(!e.type||e.type===m4.Scalar.PLAIN)&&ly.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===ly.tag&&r.default);function h4(t,e,r){let n=g4(t,r);if(uy.isSeq(n))for(let i of n.items)PA(t,e,i);else if(Array.isArray(n))for(let i of n)PA(t,e,i);else PA(t,e,n)}function PA(t,e,r){let n=g4(t,r);if(!uy.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 g4(t,e){return t&&uy.isAlias(e)?e.resolve(t.doc,t):e}dy.addMergeToJSMap=h4;dy.isMergeKey=ofe;dy.merge=ly});var DA=v(b4=>{"use strict";var sfe=IA(),y4=fy(),afe=Yd(),_4=Ce(),CA=Uo();function cfe(t,e,{key:r,value:n}){if(_4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(y4.isMergeKey(t,r))y4.addMergeToJSMap(t,e,n);else{let i=CA.toJS(r,"",t);if(e instanceof Map)e.set(i,CA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=lfe(r,i,t),s=CA.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 lfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(_4.isNode(t)&&r?.doc){let n=afe.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)+'..."'),sfe.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)}b4.addPairToJSMap=cfe});var Go=v(NA=>{"use strict";var v4=Zd(),ufe=f4(),dfe=DA(),py=Ce();function ffe(t,e,r){let n=v4.createNode(t,void 0,r),i=v4.createNode(e,void 0,r);return new my(n,i)}var my=class t{constructor(e,r=null){Object.defineProperty(this,py.NODE_TYPE,{value:py.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return py.isNode(r)&&(r=r.clone(e)),py.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return dfe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?ufe.stringifyPair(this,e,r,n):JSON.stringify(this)}};NA.Pair=my;NA.createPair=ffe});var jA=v(w4=>{"use strict";var ia=Ce(),S4=Yd(),hy=Vd();function pfe(t,e,r){return(e.inFlow??t.flow?hfe:mfe)(t,e,r)}function mfe({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+=hy.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 A4=He("process");function kfe(t,...e){t==="debug"&&console.log(...e)}function Efe(t,e){(t==="debug"||t==="warn")&&(typeof A4.emitWarning=="function"?A4.emitWarning(e):console.warn(e))}GA.debug=kfe;GA.warn=Efe});var xy=v(wy=>{"use strict";var Sy=Ce(),T4=Pt(),by="<<",vy={identify:t=>t===by||typeof t=="symbol"&&t.description===by,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new T4.Scalar(Symbol(by)),{addToJSMap:O4}),stringify:()=>by},Afe=(t,e)=>(vy.identify(e)||Sy.isScalar(e)&&(!e.type||e.type===T4.Scalar.PLAIN)&&vy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===vy.tag&&r.default);function O4(t,e,r){let n=R4(t,r);if(Sy.isSeq(n))for(let i of n.items)VA(t,e,i);else if(Array.isArray(n))for(let i of n)VA(t,e,i);else VA(t,e,n)}function VA(t,e,r){let n=R4(t,r);if(!Sy.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 R4(t,e){return t&&Sy.isAlias(e)?e.resolve(t.doc,t):e}wy.addMergeToJSMap=O4;wy.isMergeKey=Afe;wy.merge=vy});var KA=v(C4=>{"use strict";var Tfe=ZA(),I4=xy(),Ofe=of(),P4=Ce(),WA=Bo();function Rfe(t,e,{key:r,value:n}){if(P4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(I4.isMergeKey(t,r))I4.addMergeToJSMap(t,e,n);else{let i=WA.toJS(r,"",t);if(e instanceof Map)e.set(i,WA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Ife(r,i,t),s=WA.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 Ife(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(P4.isNode(t)&&r?.doc){let n=Ofe.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)+'..."'),Tfe.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)}C4.addPairToJSMap=Rfe});var Vo=v(JA=>{"use strict";var D4=Qd(),Pfe=E4(),Cfe=KA(),$y=Ce();function Dfe(t,e,r){let n=D4.createNode(t,void 0,r),i=D4.createNode(e,void 0,r);return new ky(n,i)}var ky=class t{constructor(e,r=null){Object.defineProperty(this,$y.NODE_TYPE,{value:$y.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return $y.isNode(r)&&(r=r.clone(e)),$y.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Cfe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Pfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};JA.Pair=ky;JA.createPair=Dfe});var YA=v(j4=>{"use strict";var sa=Ce(),N4=of(),Ey=ef();function Nfe(t,e,r){return(e.inFlow??t.flow?Mfe:jfe)(t,e,r)}function jfe({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+=Ey.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+=hy.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?` +`+Ey.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function Mfe({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+=Ey.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 gy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=hy.indentComment(e(n),t);r.push(o.trimStart())}}w4.stringifyCollection=pfe});var Vo=v(FA=>{"use strict";var gfe=jA(),yfe=DA(),_fe=ry(),Zo=Ce(),yy=Go(),bfe=It();function Qd(t,e){let r=Zo.isScalar(e)?e.value:e;for(let n of t)if(Zo.isPair(n)&&(n.key===e||n.key===r||Zo.isScalar(n.key)&&n.key.value===r))return n}var MA=class extends _fe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Zo.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(yy.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;Zo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new yy.Pair(e,e?.value):n=new yy.Pair(e.key,e.value);let i=Qd(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Zo.isScalar(i.value)&&bfe.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=Qd(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Qd(this.items,e)?.value;return(!r&&Zo.isScalar(i)?i.value:i)??void 0}has(e){return!!Qd(this.items,e)}set(e,r){this.add(new yy.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)yfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Zo.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})),gfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};FA.YAMLMap=MA;FA.findPair=Qd});var Uc=v($4=>{"use strict";var vfe=Ce(),x4=Vo(),Sfe={collection:"map",default:!0,nodeClass:x4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return vfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>x4.YAMLMap.from(t,e,r)};$4.map=Sfe});var Wo=v(k4=>{"use strict";var wfe=Zd(),xfe=jA(),$fe=ry(),by=Ce(),kfe=It(),Efe=Uo(),LA=class extends $fe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(by.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=_y(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=_y(e);if(typeof n!="number")return;let i=this.items[n];return!r&&by.isScalar(i)?i.value:i}has(e){let r=_y(e);return typeof r=="number"&&r=0?e:null}k4.YAMLSeq=LA});var qc=v(A4=>{"use strict";var Afe=Ce(),E4=Wo(),Tfe={collection:"seq",default:!0,nodeClass:E4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Afe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>E4.YAMLSeq.from(t,e,r)};A4.seq=Tfe});var ef=v(T4=>{"use strict";var Ofe=Jd(),Rfe={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),Ofe.stringifyString(t,e,r,n)}};T4.string=Rfe});var vy=v(I4=>{"use strict";var O4=It(),R4={identify:t=>t==null,createNode:()=>new O4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new O4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&R4.test.test(t)?t:e.options.nullStr};I4.nullTag=R4});var zA=v(C4=>{"use strict";var Ife=It(),P4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Ife.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&P4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};C4.boolTag=P4});var Bc=v(D4=>{"use strict";function Pfe({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}D4.stringifyNumber=Pfe});var qA=v(Sy=>{"use strict";var Cfe=It(),UA=Bc(),Dfe={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:UA.stringifyNumber},Nfe={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():UA.stringifyNumber(t)}},jfe={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 Cfe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:UA.stringifyNumber};Sy.float=jfe;Sy.floatExp=Nfe;Sy.floatNaN=Dfe});var HA=v(xy=>{"use strict";var N4=Bc(),wy=t=>typeof t=="bigint"||Number.isInteger(t),BA=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function j4(t,e,r){let{value:n}=t;return wy(n)&&n>=0?r+n.toString(e):N4.stringifyNumber(t)}var Mfe={identify:t=>wy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>BA(t,2,8,r),stringify:t=>j4(t,8,"0o")},Ffe={identify:wy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>BA(t,0,10,r),stringify:N4.stringifyNumber},Lfe={identify:t=>wy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>BA(t,2,16,r),stringify:t=>j4(t,16,"0x")};xy.int=Ffe;xy.intHex=Lfe;xy.intOct=Mfe});var F4=v(M4=>{"use strict";var zfe=Uc(),Ufe=vy(),qfe=qc(),Bfe=ef(),Hfe=zA(),GA=qA(),ZA=HA(),Gfe=[zfe.map,qfe.seq,Bfe.string,Ufe.nullTag,Hfe.boolTag,ZA.intOct,ZA.int,ZA.intHex,GA.floatNaN,GA.floatExp,GA.float];M4.schema=Gfe});var U4=v(z4=>{"use strict";var Zfe=It(),Vfe=Uc(),Wfe=qc();function L4(t){return typeof t=="bigint"||Number.isInteger(t)}var $y=({value:t})=>JSON.stringify(t),Kfe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:$y},{identify:t=>t==null,createNode:()=>new Zfe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:$y},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:$y},{identify:L4,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})=>L4(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:$y}],Jfe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Yfe=[Vfe.map,Wfe.seq].concat(Kfe,Jfe);z4.schema=Yfe});var WA=v(q4=>{"use strict";var tf=He("buffer"),VA=It(),Xfe=Jd(),Qfe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof tf.Buffer=="function")return tf.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 ky=Ce(),KA=Go(),epe=It(),tpe=Wo();function B4(t,e){if(ky.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new KA.Pair(new epe.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Ay({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Ey.indentComment(e(n),t);r.push(o.trimStart())}}j4.stringifyCollection=Nfe});var Ko=v(QA=>{"use strict";var Ffe=YA(),Lfe=KA(),zfe=py(),Wo=Ce(),Ty=Vo(),Ufe=Pt();function af(t,e){let r=Wo.isScalar(e)?e.value:e;for(let n of t)if(Wo.isPair(n)&&(n.key===e||n.key===r||Wo.isScalar(n.key)&&n.key.value===r))return n}var XA=class extends zfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Wo.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(Ty.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;Wo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Ty.Pair(e,e?.value):n=new Ty.Pair(e.key,e.value);let i=af(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Wo.isScalar(i.value)&&Ufe.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=af(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=af(this.items,e)?.value;return(!r&&Wo.isScalar(i)?i.value:i)??void 0}has(e){return!!af(this.items,e)}set(e,r){this.add(new Ty.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)Lfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Wo.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})),Ffe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};QA.YAMLMap=XA;QA.findPair=af});var Vc=v(F4=>{"use strict";var qfe=Ce(),M4=Ko(),Bfe={collection:"map",default:!0,nodeClass:M4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return qfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>M4.YAMLMap.from(t,e,r)};F4.map=Bfe});var Jo=v(L4=>{"use strict";var Hfe=Qd(),Gfe=YA(),Zfe=py(),Ry=Ce(),Vfe=Pt(),Wfe=Bo(),eT=class extends Zfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Ry.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Oy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Oy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Ry.isScalar(i)?i.value:i}has(e){let r=Oy(e);return typeof r=="number"&&r=0?e:null}L4.YAMLSeq=eT});var Wc=v(U4=>{"use strict";var Kfe=Ce(),z4=Jo(),Jfe={collection:"seq",default:!0,nodeClass:z4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Kfe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>z4.YAMLSeq.from(t,e,r)};U4.seq=Jfe});var cf=v(q4=>{"use strict";var Yfe=nf(),Xfe={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),Yfe.stringifyString(t,e,r,n)}};q4.string=Xfe});var Iy=v(G4=>{"use strict";var B4=Pt(),H4={identify:t=>t==null,createNode:()=>new B4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new B4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&H4.test.test(t)?t:e.options.nullStr};G4.nullTag=H4});var tT=v(V4=>{"use strict";var Qfe=Pt(),Z4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Qfe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&Z4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};V4.boolTag=Z4});var Kc=v(W4=>{"use strict";function epe({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}W4.stringifyNumber=epe});var nT=v(Py=>{"use strict";var tpe=Pt(),rT=Kc(),rpe={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},npe={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)}},ipe={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 tpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:rT.stringifyNumber};Py.float=ipe;Py.floatExp=npe;Py.floatNaN=rpe});var oT=v(Dy=>{"use strict";var K4=Kc(),Cy=t=>typeof t=="bigint"||Number.isInteger(t),iT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function J4(t,e,r){let{value:n}=t;return Cy(n)&&n>=0?r+n.toString(e):K4.stringifyNumber(t)}var ope={identify:t=>Cy(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=>J4(t,8,"0o")},spe={identify:Cy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>iT(t,0,10,r),stringify:K4.stringifyNumber},ape={identify:t=>Cy(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=>J4(t,16,"0x")};Dy.int=spe;Dy.intHex=ape;Dy.intOct=ope});var X4=v(Y4=>{"use strict";var cpe=Vc(),lpe=Iy(),upe=Wc(),dpe=cf(),fpe=tT(),sT=nT(),aT=oT(),ppe=[cpe.map,upe.seq,dpe.string,lpe.nullTag,fpe.boolTag,aT.intOct,aT.int,aT.intHex,sT.floatNaN,sT.floatExp,sT.float];Y4.schema=ppe});var t6=v(e6=>{"use strict";var mpe=Pt(),hpe=Vc(),gpe=Wc();function Q4(t){return typeof t=="bigint"||Number.isInteger(t)}var Ny=({value:t})=>JSON.stringify(t),ype=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Ny},{identify:t=>t==null,createNode:()=>new mpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ny},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Ny},{identify:Q4,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})=>Q4(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:Ny}],_pe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},bpe=[hpe.map,gpe.seq].concat(ype,_pe);e6.schema=bpe});var lT=v(r6=>{"use strict";var lf=He("buffer"),cT=Pt(),vpe=nf(),Spe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof lf.Buffer=="function")return lf.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 jy=Ce(),uT=Vo(),wpe=Pt(),xpe=Jo();function n6(t,e){if(jy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new uT.Pair(new wpe.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]=ky.isPair(n)?n:new KA.Pair(n)}}else e("Expected a sequence for this tag");return t}function H4(t,e,r){let{replacer:n}=r,i=new tpe.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(KA.createPair(a,c,r))}return i}var rpe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:B4,createNode:H4};Ey.createPairs=H4;Ey.pairs=rpe;Ey.resolvePairs=B4});var XA=v(YA=>{"use strict";var G4=Ce(),JA=Uo(),rf=Vo(),npe=Wo(),Z4=Ay(),oa=class t extends npe.YAMLSeq{constructor(){super(),this.add=rf.YAMLMap.prototype.add.bind(this),this.delete=rf.YAMLMap.prototype.delete.bind(this),this.get=rf.YAMLMap.prototype.get.bind(this),this.has=rf.YAMLMap.prototype.has.bind(this),this.set=rf.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(G4.isPair(i)?(o=JA.toJS(i.key,"",r),s=JA.toJS(i.value,o,r)):o=JA.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=Z4.createPairs(e,r,n),o=new this;return o.items=i.items,o}};oa.tag="tag:yaml.org,2002:omap";var ipe={collection:"seq",identify:t=>t instanceof Map,nodeClass:oa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=Z4.resolvePairs(t,e),n=[];for(let{key:i}of r.items)G4.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new oa,r)},createNode:(t,e,r)=>oa.from(t,e,r)};YA.YAMLOMap=oa;YA.omap=ipe});var Y4=v(QA=>{"use strict";var V4=It();function W4({value:t,source:e},r){return e&&(t?K4:J4).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var K4={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 V4.Scalar(!0),stringify:W4},J4={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 V4.Scalar(!1),stringify:W4};QA.falseTag=J4;QA.trueTag=K4});var X4=v(Ty=>{"use strict";var ope=It(),eT=Bc(),spe={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:eT.stringifyNumber},ape={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():eT.stringifyNumber(t)}},cpe={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 ope.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:eT.stringifyNumber};Ty.float=cpe;Ty.floatExp=ape;Ty.floatNaN=spe});var e6=v(of=>{"use strict";var Q4=Bc(),nf=t=>typeof t=="bigint"||Number.isInteger(t);function Oy(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 tT(t,e,r){let{value:n}=t;if(nf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return Q4.stringifyNumber(t)}var lpe={identify:nf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Oy(t,2,2,r),stringify:t=>tT(t,2,"0b")},upe={identify:nf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Oy(t,1,8,r),stringify:t=>tT(t,8,"0")},dpe={identify:nf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Oy(t,0,10,r),stringify:Q4.stringifyNumber},fpe={identify:nf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Oy(t,2,16,r),stringify:t=>tT(t,16,"0x")};of.int=dpe;of.intBin=lpe;of.intHex=fpe;of.intOct=upe});var nT=v(rT=>{"use strict";var Py=Ce(),Ry=Go(),Iy=Vo(),sa=class t extends Iy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Py.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Ry.Pair(e.key,null):r=new Ry.Pair(e,null),Iy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Iy.findPair(this.items,e);return!r&&Py.isPair(n)?Py.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=Iy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Ry.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(Ry.createPair(s,null,n));return o}};sa.tag="tag:yaml.org,2002:set";var ppe={collection:"map",identify:t=>t instanceof Set,nodeClass:sa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>sa.from(t,e,r),resolve(t,e){if(Py.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new sa,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};rT.YAMLSet=sa;rT.set=ppe});var oT=v(Cy=>{"use strict";var mpe=Bc();function iT(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 t6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return mpe.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 hpe={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})=>iT(t,r),stringify:t6},gpe={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=>iT(t,!1),stringify:t6},r6={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(r6.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=iT(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$/,"")??""};Cy.floatTime=gpe;Cy.intTime=hpe;Cy.timestamp=r6});var o6=v(i6=>{"use strict";var ype=Uc(),_pe=vy(),bpe=qc(),vpe=ef(),Spe=WA(),n6=Y4(),sT=X4(),Dy=e6(),wpe=fy(),xpe=XA(),$pe=Ay(),kpe=nT(),aT=oT(),Epe=[ype.map,bpe.seq,vpe.string,_pe.nullTag,n6.trueTag,n6.falseTag,Dy.intBin,Dy.intOct,Dy.int,Dy.intHex,sT.floatNaN,sT.floatExp,sT.float,Spe.binary,wpe.merge,xpe.omap,$pe.pairs,kpe.set,aT.intTime,aT.floatTime,aT.timestamp];i6.schema=Epe});var h6=v(uT=>{"use strict";var l6=Uc(),Ape=vy(),u6=qc(),Tpe=ef(),Ope=zA(),cT=qA(),lT=HA(),Rpe=F4(),Ipe=U4(),d6=WA(),sf=fy(),f6=XA(),p6=Ay(),s6=o6(),m6=nT(),Ny=oT(),a6=new Map([["core",Rpe.schema],["failsafe",[l6.map,u6.seq,Tpe.string]],["json",Ipe.schema],["yaml11",s6.schema],["yaml-1.1",s6.schema]]),c6={binary:d6.binary,bool:Ope.boolTag,float:cT.float,floatExp:cT.floatExp,floatNaN:cT.floatNaN,floatTime:Ny.floatTime,int:lT.int,intHex:lT.intHex,intOct:lT.intOct,intTime:Ny.intTime,map:l6.map,merge:sf.merge,null:Ape.nullTag,omap:f6.omap,pairs:p6.pairs,seq:u6.seq,set:m6.set,timestamp:Ny.timestamp},Ppe={"tag:yaml.org,2002:binary":d6.binary,"tag:yaml.org,2002:merge":sf.merge,"tag:yaml.org,2002:omap":f6.omap,"tag:yaml.org,2002:pairs":p6.pairs,"tag:yaml.org,2002:set":m6.set,"tag:yaml.org,2002:timestamp":Ny.timestamp};function Cpe(t,e,r){let n=a6.get(e);if(n&&!t)return r&&!n.includes(sf.merge)?n.concat(sf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(a6.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(sf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?c6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(c6).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},[])}uT.coreKnownTags=Ppe;uT.getTags=Cpe});var pT=v(g6=>{"use strict";var dT=Ce(),Dpe=Uc(),Npe=qc(),jpe=ef(),jy=h6(),Mpe=(t,e)=>t.keye.key?1:0,fT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?jy.getTags(e,"compat"):e?jy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?jy.coreKnownTags:{},this.tags=jy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,dT.MAP,{value:Dpe.map}),Object.defineProperty(this,dT.SCALAR,{value:jpe.string}),Object.defineProperty(this,dT.SEQ,{value:Npe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Mpe:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};g6.Schema=fT});var _6=v(y6=>{"use strict";var Fpe=Ce(),mT=Yd(),af=Vd();function Lpe(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=mT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(af.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Fpe.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(af.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=mT.stringify(t.contents,i,()=>a=null,c);a&&(l+=af.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(mT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(af.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(af.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=jy.isPair(n)?n:new uT.Pair(n)}}else e("Expected a sequence for this tag");return t}function i6(t,e,r){let{replacer:n}=r,i=new xpe.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(uT.createPair(a,c,r))}return i}var $pe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:n6,createNode:i6};My.createPairs=i6;My.pairs=$pe;My.resolvePairs=n6});var pT=v(fT=>{"use strict";var o6=Ce(),dT=Bo(),uf=Ko(),kpe=Jo(),s6=Fy(),aa=class t extends kpe.YAMLSeq{constructor(){super(),this.add=uf.YAMLMap.prototype.add.bind(this),this.delete=uf.YAMLMap.prototype.delete.bind(this),this.get=uf.YAMLMap.prototype.get.bind(this),this.has=uf.YAMLMap.prototype.has.bind(this),this.set=uf.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(o6.isPair(i)?(o=dT.toJS(i.key,"",r),s=dT.toJS(i.value,o,r)):o=dT.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=s6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};aa.tag="tag:yaml.org,2002:omap";var Epe={collection:"seq",identify:t=>t instanceof Map,nodeClass:aa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=s6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)o6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new aa,r)},createNode:(t,e,r)=>aa.from(t,e,r)};fT.YAMLOMap=aa;fT.omap=Epe});var d6=v(mT=>{"use strict";var a6=Pt();function c6({value:t,source:e},r){return e&&(t?l6:u6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var l6={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 a6.Scalar(!0),stringify:c6},u6={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 a6.Scalar(!1),stringify:c6};mT.falseTag=u6;mT.trueTag=l6});var f6=v(Ly=>{"use strict";var Ape=Pt(),hT=Kc(),Tpe={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},Ope={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)}},Rpe={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 Ape.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};Ly.float=Rpe;Ly.floatExp=Ope;Ly.floatNaN=Tpe});var m6=v(ff=>{"use strict";var p6=Kc(),df=t=>typeof t=="bigint"||Number.isInteger(t);function zy(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 gT(t,e,r){let{value:n}=t;if(df(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return p6.stringifyNumber(t)}var Ipe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>zy(t,2,2,r),stringify:t=>gT(t,2,"0b")},Ppe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>zy(t,1,8,r),stringify:t=>gT(t,8,"0")},Cpe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>zy(t,0,10,r),stringify:p6.stringifyNumber},Dpe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>zy(t,2,16,r),stringify:t=>gT(t,16,"0x")};ff.int=Cpe;ff.intBin=Ipe;ff.intHex=Dpe;ff.intOct=Ppe});var _T=v(yT=>{"use strict";var By=Ce(),Uy=Vo(),qy=Ko(),ca=class t extends qy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;By.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Uy.Pair(e.key,null):r=new Uy.Pair(e,null),qy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=qy.findPair(this.items,e);return!r&&By.isPair(n)?By.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=qy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Uy.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(Uy.createPair(s,null,n));return o}};ca.tag="tag:yaml.org,2002:set";var Npe={collection:"map",identify:t=>t instanceof Set,nodeClass:ca,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ca.from(t,e,r),resolve(t,e){if(By.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ca,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};yT.YAMLSet=ca;yT.set=Npe});var vT=v(Hy=>{"use strict";var jpe=Kc();function bT(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 h6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return jpe.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 Mpe={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})=>bT(t,r),stringify:h6},Fpe={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=>bT(t,!1),stringify:h6},g6={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(g6.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=bT(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$/,"")??""};Hy.floatTime=Fpe;Hy.intTime=Mpe;Hy.timestamp=g6});var b6=v(_6=>{"use strict";var Lpe=Vc(),zpe=Iy(),Upe=Wc(),qpe=cf(),Bpe=lT(),y6=d6(),ST=f6(),Gy=m6(),Hpe=xy(),Gpe=pT(),Zpe=Fy(),Vpe=_T(),wT=vT(),Wpe=[Lpe.map,Upe.seq,qpe.string,zpe.nullTag,y6.trueTag,y6.falseTag,Gy.intBin,Gy.intOct,Gy.int,Gy.intHex,ST.floatNaN,ST.floatExp,ST.float,Bpe.binary,Hpe.merge,Gpe.omap,Zpe.pairs,Vpe.set,wT.intTime,wT.floatTime,wT.timestamp];_6.schema=Wpe});var O6=v(kT=>{"use strict";var x6=Vc(),Kpe=Iy(),$6=Wc(),Jpe=cf(),Ype=tT(),xT=nT(),$T=oT(),Xpe=X4(),Qpe=t6(),k6=lT(),pf=xy(),E6=pT(),A6=Fy(),v6=b6(),T6=_T(),Zy=vT(),S6=new Map([["core",Xpe.schema],["failsafe",[x6.map,$6.seq,Jpe.string]],["json",Qpe.schema],["yaml11",v6.schema],["yaml-1.1",v6.schema]]),w6={binary:k6.binary,bool:Ype.boolTag,float:xT.float,floatExp:xT.floatExp,floatNaN:xT.floatNaN,floatTime:Zy.floatTime,int:$T.int,intHex:$T.intHex,intOct:$T.intOct,intTime:Zy.intTime,map:x6.map,merge:pf.merge,null:Kpe.nullTag,omap:E6.omap,pairs:A6.pairs,seq:$6.seq,set:T6.set,timestamp:Zy.timestamp},eme={"tag:yaml.org,2002:binary":k6.binary,"tag:yaml.org,2002:merge":pf.merge,"tag:yaml.org,2002:omap":E6.omap,"tag:yaml.org,2002:pairs":A6.pairs,"tag:yaml.org,2002:set":T6.set,"tag:yaml.org,2002:timestamp":Zy.timestamp};function tme(t,e,r){let n=S6.get(e);if(n&&!t)return r&&!n.includes(pf.merge)?n.concat(pf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(S6.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(pf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?w6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(w6).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},[])}kT.coreKnownTags=eme;kT.getTags=tme});var TT=v(R6=>{"use strict";var ET=Ce(),rme=Vc(),nme=Wc(),ime=cf(),Vy=O6(),ome=(t,e)=>t.keye.key?1:0,AT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Vy.getTags(e,"compat"):e?Vy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Vy.coreKnownTags:{},this.tags=Vy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,ET.MAP,{value:rme.map}),Object.defineProperty(this,ET.SCALAR,{value:ime.string}),Object.defineProperty(this,ET.SEQ,{value:nme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?ome:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};R6.Schema=AT});var P6=v(I6=>{"use strict";var sme=Ce(),OT=of(),mf=ef();function ame(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=OT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(mf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(sme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(mf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=OT.stringify(t.contents,i,()=>a=null,c);a&&(l+=mf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(OT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(mf.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(mf.indentComment(o(c),"")))}return r.join(` `)+` -`}y6.stringifyDocument=Lpe});var cf=v(b6=>{"use strict";var zpe=Gd(),Hc=ry(),xn=Ce(),Upe=Go(),qpe=Uo(),Bpe=pT(),Hpe=_6(),hT=Xg(),Gpe=bA(),Zpe=Zd(),gT=_A(),yT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,xn.NODE_TYPE,{value:xn.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 gT.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,{[xn.NODE_TYPE]:{value:xn.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=xn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Gc(this.contents)&&this.contents.add(e)}addIn(e,r){Gc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=hT.anchorNames(this);e.anchor=!r||n.has(r)?hT.findNewAnchor(r||"a",n):r}return new zpe.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}=hT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Zpe.createNode(e,u,m);return a&&xn.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 Upe.Pair(i,o)}delete(e){return Gc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Hc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Gc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return xn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Hc.isEmptyPath(e)?!r&&xn.isScalar(this.contents)?this.contents.value:this.contents:xn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return xn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Hc.isEmptyPath(e)?this.contents!==void 0:xn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Hc.collectionFromPath(this.schema,[e],r):Gc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Hc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Hc.collectionFromPath(this.schema,Array.from(e),r):Gc(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 gT.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 gT.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 Bpe.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=qpe.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"?Gpe.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 Hpe.stringifyDocument(this,e)}};function Gc(t){if(xn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}b6.Document=yT});var df=v(uf=>{"use strict";var lf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},_T=class extends lf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},bT=class extends lf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Vpe=(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 +`}I6.stringifyDocument=ame});var hf=v(C6=>{"use strict";var cme=Xd(),Jc=py(),$n=Ce(),lme=Vo(),ume=Bo(),dme=TT(),fme=P6(),RT=ly(),pme=DA(),mme=Qd(),IT=CA(),PT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 IT.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Yc(this.contents)&&this.contents.add(e)}addIn(e,r){Yc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=RT.anchorNames(this);e.anchor=!r||n.has(r)?RT.findNewAnchor(r||"a",n):r}return new cme.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}=RT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=mme.createNode(e,u,m);return a&&$n.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 lme.Pair(i,o)}delete(e){return Yc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Jc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Yc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Jc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Jc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Jc.collectionFromPath(this.schema,[e],r):Yc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Jc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Jc.collectionFromPath(this.schema,Array.from(e),r):Yc(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 IT.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 IT.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 dme.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=ume.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"?pme.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 fme.stringifyDocument(this,e)}};function Yc(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}C6.Document=PT});var _f=v(yf=>{"use strict";var gf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},CT=class extends gf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},DT=class extends gf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},hme=(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} -`}};uf.YAMLError=lf;uf.YAMLParseError=_T;uf.YAMLWarning=bT;uf.prettifyError=Vpe});var ff=v(v6=>{"use strict";function Wpe(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 E of t)switch(m&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&o(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&E.type!=="comment"&&E.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),E.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&E.source.includes(" ")&&(h=E),u=!0;break;case"comment":{u||o(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=E.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=E.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=E.source,l=!0,p=!0,(g||b)&&(_=E),u=!0;break;case"anchor":g&&o(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&o(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=E,w??(w=E.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(E,"MULTIPLE_TAGS","A node can have at most one tag"),b=E,w??(w=E.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),x&&o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),x=E,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=E,l=!1,u=!1;break}default:o(E,"UNEXPECTED_TOKEN",`Unexpected ${E.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}}v6.resolveProps=Wpe});var My=v(S6=>{"use strict";function vT(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(vT(e.key)||vT(e.value))return!0}return!1;default:return!0}}S6.containsNewline=vT});var ST=v(w6=>{"use strict";var Kpe=My();function Jpe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Kpe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}w6.flowIndentCheck=Jpe});var wT=v($6=>{"use strict";var x6=Ce();function Ype(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||x6.isScalar(o)&&x6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}$6.mapIncludes=Ype});var R6=v(O6=>{"use strict";var k6=Go(),Xpe=Vo(),E6=ff(),Qpe=My(),A6=ST(),eme=wT(),T6="All mapping items must start at the same column";function tme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Xpe.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=E6.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",T6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Qpe.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",T6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&A6.flowIndentCheck(n.indent,f,i),r.atKey=!1,eme.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=E6.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 rme=Wo(),nme=ff(),ime=ST();function ome({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??rme.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=nme.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&&ime.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}I6.resolveBlockSeq=ome});var Zc=v(C6=>{"use strict";function sme(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}}C6.resolveEnd=sme});var M6=v(j6=>{"use strict";var ame=Ce(),cme=Go(),D6=Vo(),lme=Wo(),ume=Zc(),N6=ff(),dme=My(),fme=wT(),xT="Block collections are not allowed within flow collections",$T=t=>t&&(t.type==="block-map"||t.type==="block-seq");function pme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?D6.YAMLMap:lme.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=ume.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}j6.resolveFlowCollection=pme});var L6=v(F6=>{"use strict";var mme=Ce(),hme=It(),gme=Vo(),yme=Wo(),_me=R6(),bme=P6(),vme=M6();function kT(t,e,r,n,i,o){let s=r.type==="block-map"?_me.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?bme.resolveBlockSeq(t,e,r,n,o):vme.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 Sme(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),kT(t,e,r,i,s)}let l=kT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=mme.isNode(u)?u:new hme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}F6.composeCollection=Sme});var AT=v(z6=>{"use strict";var ET=It();function wme(t,e,r){let n=e.offset,i=xme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?ET.Scalar.BLOCK_FOLDED:ET.Scalar.BLOCK_LITERAL,s=e.source?$me(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?` +`}};yf.YAMLError=gf;yf.YAMLParseError=CT;yf.YAMLWarning=DT;yf.prettifyError=hme});var bf=v(D6=>{"use strict";function gme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}D6.resolveProps=gme});var Wy=v(N6=>{"use strict";function NT(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(NT(e.key)||NT(e.value))return!0}return!1;default:return!0}}N6.containsNewline=NT});var jT=v(j6=>{"use strict";var yme=Wy();function _me(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&yme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}j6.flowIndentCheck=_me});var MT=v(F6=>{"use strict";var M6=Ce();function bme(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||M6.isScalar(o)&&M6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}F6.mapIncludes=bme});var H6=v(B6=>{"use strict";var L6=Vo(),vme=Ko(),z6=bf(),Sme=Wy(),U6=jT(),wme=MT(),q6="All mapping items must start at the same column";function xme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??vme.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=z6.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",q6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Sme.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",q6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&U6.flowIndentCheck(n.indent,f,i),r.atKey=!1,wme.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=z6.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 $me=Jo(),kme=bf(),Eme=jT();function Ame({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??$me.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=kme.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&&Eme.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}G6.resolveBlockSeq=Ame});var Xc=v(V6=>{"use strict";function Tme(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}}V6.resolveEnd=Tme});var Y6=v(J6=>{"use strict";var Ome=Ce(),Rme=Vo(),W6=Ko(),Ime=Jo(),Pme=Xc(),K6=bf(),Cme=Wy(),Dme=MT(),FT="Block collections are not allowed within flow collections",LT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Nme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?W6.YAMLMap:Ime.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=Pme.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}J6.resolveFlowCollection=Nme});var Q6=v(X6=>{"use strict";var jme=Ce(),Mme=Pt(),Fme=Ko(),Lme=Jo(),zme=H6(),Ume=Z6(),qme=Y6();function zT(t,e,r,n,i,o){let s=r.type==="block-map"?zme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Ume.resolveBlockSeq(t,e,r,n,o):qme.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 Bme(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),zT(t,e,r,i,s)}let l=zT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=jme.isNode(u)?u:new Mme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}X6.composeCollection=Bme});var qT=v(eB=>{"use strict";var UT=Pt();function Hme(t,e,r){let n=e.offset,i=Gme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?UT.Scalar.BLOCK_FOLDED:UT.Scalar.BLOCK_LITERAL,s=e.source?Zme(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,91 +112,91 @@ ${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 xme({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 TT=It(),kme=Zc();function Eme(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=TT.Scalar.PLAIN,c=Ame(o,l);break;case"single-quoted-scalar":a=TT.Scalar.QUOTE_SINGLE,c=Tme(o,l);break;case"double-quoted-scalar":a=TT.Scalar.QUOTE_DOUBLE,c=Ome(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=kme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function Ame(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}`),U6(t)}function Tme(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),U6(t.slice(1,-1)).replace(/''/g,"'")}function U6(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var BT=Pt(),Vme=Xc();function Wme(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=BT.Scalar.PLAIN,c=Kme(o,l);break;case"single-quoted-scalar":a=BT.Scalar.QUOTE_SINGLE,c=Jme(o,l);break;case"double-quoted-scalar":a=BT.Scalar.QUOTE_DOUBLE,c=Yme(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=Vme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function Kme(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}`),tB(t)}function Jme(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),tB(t.slice(1,-1)).replace(/''/g,"'")}function tB(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 Rme(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 Xme(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 Ime={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Pme(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}}q6.resolveFlowScalar=Eme});var G6=v(H6=>{"use strict";var aa=Ce(),B6=It(),Cme=AT(),Dme=OT();function Nme(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Cme.resolveBlockScalar(t,e,n):Dme.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[aa.SCALAR]:c?l=jme(t.schema,i,c,r,n):e.type==="scalar"?l=Mme(t,i,e,n):l=t.schema[aa.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=aa.isScalar(d)?d:new B6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new B6.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 jme(t,e,r,n,i){if(r==="!")return t[aa.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[aa.SCALAR])}function Mme({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[aa.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[aa.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}H6.composeScalar=Nme});var V6=v(Z6=>{"use strict";function Fme(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}Z6.emptyScalarPosition=Fme});var J6=v(IT=>{"use strict";var Lme=Gd(),zme=Ce(),Ume=L6(),W6=G6(),qme=Zc(),Bme=V6(),Hme={composeNode:K6,composeEmptyNode:RT};function K6(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=Gme(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=W6.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Ume.composeCollection(Hme,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=RT(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&&(!zme.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 RT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Bme.emptyScalarPosition(e,r,n),indent:-1,source:""},d=W6.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 Gme({options:t},{offset:e,source:r,end:n},i){let o=new Lme.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=qme.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}IT.composeEmptyNode=RT;IT.composeNode=K6});var Q6=v(X6=>{"use strict";var Zme=cf(),Y6=J6(),Vme=Zc(),Wme=ff();function Kme(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Zme.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Wme.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?Y6.composeNode(l,i,u,s):Y6.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Vme.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}X6.composeDoc=Kme});var CT=v(rB=>{"use strict";var Jme=He("process"),Yme=_A(),Xme=cf(),pf=df(),eB=Ce(),Qme=Q6(),ehe=Zc();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 tB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var la=Ce(),nB=Pt(),the=qT(),rhe=HT();function nhe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?the.resolveBlockScalar(t,e,n):rhe.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[la.SCALAR]:c?l=ihe(t.schema,i,c,r,n):e.type==="scalar"?l=ohe(t,i,e,n):l=t.schema[la.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=la.isScalar(d)?d:new nB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new nB.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 ihe(t,e,r,n,i){if(r==="!")return t[la.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[la.SCALAR])}function ohe({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[la.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[la.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}iB.composeScalar=nhe});var aB=v(sB=>{"use strict";function she(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}sB.emptyScalarPosition=she});var uB=v(ZT=>{"use strict";var ahe=Xd(),che=Ce(),lhe=Q6(),cB=oB(),uhe=Xc(),dhe=aB(),fhe={composeNode:lB,composeEmptyNode:GT};function lB(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=phe(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=cB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=lhe.composeCollection(fhe,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=GT(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&&(!che.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 GT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:dhe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=cB.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 phe({options:t},{offset:e,source:r,end:n},i){let o=new ahe.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=uhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ZT.composeEmptyNode=GT;ZT.composeNode=lB});var pB=v(fB=>{"use strict";var mhe=hf(),dB=uB(),hhe=Xc(),ghe=bf();function yhe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new mhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=ghe.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?dB.composeNode(l,i,u,s):dB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=hhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}fB.composeDoc=yhe});var WT=v(gB=>{"use strict";var _he=He("process"),bhe=CA(),vhe=hf(),vf=_f(),mB=Ce(),She=pB(),whe=Xc();function Sf(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 hB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=mf(r);o?this.warnings.push(new pf.YAMLWarning(s,n,i)):this.errors.push(new pf.YAMLParseError(s,n,i))},this.directives=new Yme.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=tB(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(eB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];eB.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 VT=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=Sf(r);o?this.warnings.push(new vf.YAMLWarning(s,n,i)):this.errors.push(new vf.YAMLParseError(s,n,i))},this.directives=new bhe.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=hB(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(mB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];mB.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=Qme.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 pf.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 pf.YAMLParseError(mf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=ehe.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 pf.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 Xme.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}}};rB.Composer=PT});var oB=v(Fy=>{"use strict";var the=AT(),rhe=OT(),nhe=df(),nB=Jd();function ihe(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 nhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return rhe.resolveFlowScalar(t,e,n);case"block-scalar":return the.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function ohe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=nB.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=Sf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=She.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 vf.YAMLParseError(Sf(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 vf.YAMLParseError(Sf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=whe.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 vf.YAMLParseError(Sf(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 vhe.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}}};gB.Composer=VT});var bB=v(Ky=>{"use strict";var xhe=qT(),$he=HT(),khe=_f(),yB=nf();function Ehe(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 khe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return $he.resolveFlowScalar(t,e,n);case"block-scalar":return xhe.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Ahe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=yB.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 iB(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 she(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=nB.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">":ahe(t,c);break;case'"':DT(t,c,"double-quoted-scalar");break;case"'":DT(t,c,"single-quoted-scalar");break;default:DT(t,c,"scalar")}}function ahe(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return _B(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 The(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=yB.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">":Ohe(t,c);break;case'"':KT(t,c,"double-quoted-scalar");break;case"'":KT(t,c,"single-quoted-scalar");break;default:KT(t,c,"scalar")}}function Ohe(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}];iB(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 iB(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 DT(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})}}}Fy.createScalarToken=ohe;Fy.resolveAsScalar=ihe;Fy.setScalarValue=she});var aB=v(sB=>{"use strict";var che=t=>"type"in t?zy(t):Ly(t);function zy(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=zy(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Ly(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Ly(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Ly(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 Ly({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=zy(e)),r)for(let o of r)i+=o.source;return n&&(i+=zy(n)),i}sB.stringify=che});var dB=v(uB=>{"use strict";var NT=Symbol("break visit"),lhe=Symbol("skip children"),cB=Symbol("remove item");function ca(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),lB(Object.freeze([]),t,e)}ca.BREAK=NT;ca.SKIP=lhe;ca.REMOVE=cB;ca.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};ca.parentCollection=(t,e)=>{let r=ca.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 lB(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 jT=oB(),uhe=aB(),dhe=dB(),MT="\uFEFF",FT="",LT="",zT="",fhe=t=>!!t&&"items"in t,phe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function mhe(t){switch(t){case MT:return"";case FT:return"";case LT:return"";case zT:return"";default:return JSON.stringify(t)}}function hhe(t){switch(t){case MT:return"byte-order-mark";case FT:return"doc-mode";case LT:return"flow-error-end";case zT: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}];_B(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 _B(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 KT(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})}}}Ky.createScalarToken=Ahe;Ky.resolveAsScalar=Ehe;Ky.setScalarValue=The});var SB=v(vB=>{"use strict";var Rhe=t=>"type"in t?Yy(t):Jy(t);function Yy(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Yy(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Jy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Jy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Jy(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 Jy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Yy(e)),r)for(let o of r)i+=o.source;return n&&(i+=Yy(n)),i}vB.stringify=Rhe});var kB=v($B=>{"use strict";var JT=Symbol("break visit"),Ihe=Symbol("skip children"),wB=Symbol("remove item");function ua(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),xB(Object.freeze([]),t,e)}ua.BREAK=JT;ua.SKIP=Ihe;ua.REMOVE=wB;ua.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};ua.parentCollection=(t,e)=>{let r=ua.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 xB(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 YT=bB(),Phe=SB(),Che=kB(),XT="\uFEFF",QT="",eO="",tO="",Dhe=t=>!!t&&"items"in t,Nhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function jhe(t){switch(t){case XT:return"";case QT:return"";case eO:return"";case tO:return"";default:return JSON.stringify(t)}}function Mhe(t){switch(t){case XT:return"byte-order-mark";case QT:return"doc-mode";case eO: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}Cr.createScalarToken=jT.createScalarToken;Cr.resolveAsScalar=jT.resolveAsScalar;Cr.setScalarValue=jT.setScalarValue;Cr.stringify=uhe.stringify;Cr.visit=dhe.visit;Cr.BOM=MT;Cr.DOCUMENT=FT;Cr.FLOW_END=LT;Cr.SCALAR=zT;Cr.isCollection=fhe;Cr.isScalar=phe;Cr.prettyToken=mhe;Cr.tokenType=hhe});var BT=v(pB=>{"use strict";var hf=Uy();function Gn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var fB=new Set("0123456789ABCDEFabcdef"),ghe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),qy=new Set(",[]{}"),yhe=new Set(` ,[]{} -\r `),UT=t=>!t||yhe.has(t),qT=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}Dr.createScalarToken=YT.createScalarToken;Dr.resolveAsScalar=YT.resolveAsScalar;Dr.setScalarValue=YT.setScalarValue;Dr.stringify=Phe.stringify;Dr.visit=Che.visit;Dr.BOM=XT;Dr.DOCUMENT=QT;Dr.FLOW_END=eO;Dr.SCALAR=tO;Dr.isCollection=Dhe;Dr.isScalar=Nhe;Dr.prettyToken=jhe;Dr.tokenType=Mhe});var iO=v(AB=>{"use strict";var wf=Xy();function Wn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var EB=new Set("0123456789ABCDEFabcdef"),Fhe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Qy=new Set(",[]{}"),Lhe=new Set(` ,[]{} +\r `),rO=t=>!t||Lhe.has(t),nO=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==="...")&&Gn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Gn(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===":")&&Gn(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(UT),"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=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Wn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Wn(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===":")&&Wn(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=>Gn(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` +`,o)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Wn(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 hf.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(Gn(o)||e&&qy.has(o))break;r=n}else if(Gn(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 wf.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(Wn(o)||e&&Qy.has(o))break;r=n}else if(Wn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&qy.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&qy.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield hf.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(UT),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Gn(n)||r&&qy.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(;!Gn(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(ghe.has(r))r=this.buffer[++e];else if(r==="%"&&fB.has(this.buffer[e+1])&&fB.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&&Qy.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&Qy.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield wf.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(Wn(n)||r&&Qy.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(;!Wn(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(Fhe.has(r))r=this.buffer[++e];else if(r==="%"&&EB.has(this.buffer[e+1])&&EB.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)}};pB.Lexer=qT});var GT=v(mB=>{"use strict";var HT=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 _he=He("process"),hB=Uy(),bhe=BT();function Ko(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 Hy(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"&&yB(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&&gB(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)}};AB.Lexer=nO});var sO=v(TB=>{"use strict";var oO=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 zhe=He("process"),OB=Xy(),Uhe=iO();function Yo(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 t_(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"&&IB(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&&RB(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(Ko(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(_B(r.key)&&!Ko(r.sep,"newline")){let s=Vc(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(Ko(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Vc(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]}):Ko(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&&!Ko(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)){Hy(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||Ko(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=By(n),o=Vc(i);yB(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)){t_(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(Yo(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(PB(r.key)&&!Yo(r.sep,"newline")){let s=Qc(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(Yo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Qc(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]}):Yo(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&&!Yo(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)){t_(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||Yo(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=Qc(i);IB(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=By(e),n=Vc(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=By(e),n=Vc(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())}}};bB.Parser=ZT});var $B=v(yf=>{"use strict";var vB=CT(),vhe=cf(),gf=df(),She=IA(),whe=Ce(),xhe=GT(),SB=VT();function wB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new xhe.LineCounter||null,prettyErrors:e}}function $he(t,e={}){let{lineCounter:r,prettyErrors:n}=wB(e),i=new SB.Parser(r?.addNewLine),o=new vB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(gf.prettifyError(t,r)),a.warnings.forEach(gf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function xB(t,e={}){let{lineCounter:r,prettyErrors:n}=wB(e),i=new SB.Parser(r?.addNewLine),o=new vB.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 gf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(gf.prettifyError(t,r)),s.warnings.forEach(gf.prettifyError(t,r))),s}function khe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=xB(t,r);if(!i)return null;if(i.warnings.forEach(o=>She.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 Ehe(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 whe.isDocument(t)&&!n?t.toString(r):new vhe.Document(t,n,r).toString(r)}yf.parse=khe;yf.parseAllDocuments=$he;yf.parseDocument=xB;yf.stringify=Ehe});var Xt=v(Ge=>{"use strict";var Ahe=CT(),The=cf(),Ohe=pT(),WT=df(),Rhe=Gd(),Jo=Ce(),Ihe=Go(),Phe=It(),Che=Vo(),Dhe=Wo(),Nhe=Uy(),jhe=BT(),Mhe=GT(),Fhe=VT(),Gy=$B(),kB=Ud();Ge.Composer=Ahe.Composer;Ge.Document=The.Document;Ge.Schema=Ohe.Schema;Ge.YAMLError=WT.YAMLError;Ge.YAMLParseError=WT.YAMLParseError;Ge.YAMLWarning=WT.YAMLWarning;Ge.Alias=Rhe.Alias;Ge.isAlias=Jo.isAlias;Ge.isCollection=Jo.isCollection;Ge.isDocument=Jo.isDocument;Ge.isMap=Jo.isMap;Ge.isNode=Jo.isNode;Ge.isPair=Jo.isPair;Ge.isScalar=Jo.isScalar;Ge.isSeq=Jo.isSeq;Ge.Pair=Ihe.Pair;Ge.Scalar=Phe.Scalar;Ge.YAMLMap=Che.YAMLMap;Ge.YAMLSeq=Dhe.YAMLSeq;Ge.CST=Nhe;Ge.Lexer=jhe.Lexer;Ge.LineCounter=Mhe.LineCounter;Ge.Parser=Fhe.Parser;Ge.parse=Gy.parse;Ge.parseAllDocuments=Gy.parseAllDocuments;Ge.parseDocument=Gy.parseDocument;Ge.stringify=Gy.stringify;Ge.visit=kB.visit;Ge.visitAsync=kB.visitAsync});import{execFileSync as EB}from"node:child_process";import{existsSync as Zy}from"node:fs";import{join as Vy,resolve as Lhe}from"node:path";function zhe(t){try{let e=EB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Lhe(t,e):null}catch{return null}}function KT(t){let e=zhe(t);if(!e)return null;try{if(Zy(Vy(e,"MERGE_HEAD")))return"merge";if(Zy(Vy(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(Zy(Vy(e,"rebase-merge"))||Zy(Vy(e,"rebase-apply")))return"rebase"}catch{return null}return null}function la(t){return KT(t)!==null}function JT(t,e){try{let r=EB("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 Wy(t,e){return JT(t,e)!==null}var ua=y(()=>{"use strict"});import{execFileSync as Uhe}from"node:child_process";import{existsSync as qhe,readFileSync as Bhe}from"node:fs";import{join as OB}from"node:path";function _f(t,e){return Uhe("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Yo(t){try{let e=_f(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 Xo(t,e){Hhe(t,e);let r=_f(t,["rev-parse","HEAD"]).trim(),n=Ghe(t,e);return{groups:Zhe(t,n),head:r,inventory:{after:TB(Jy(t,"spec.yaml")),before:TB(YT(t,e,"spec.yaml"))},since:e,unsharded_commits:Jhe(t,e)}}function XT(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 Hhe(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!Wy(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 Ghe(t,e){let r=_f(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(!(!AB(c)&&!AB(a)))if(s.startsWith("A")){let l=Ky(Jy(t,c));if(!l)continue;l.status==="done"?n.push(Wc(l,"added-as-done")):l.status==="archived"&&n.push(Wc(l,"archived"))}else if(s.startsWith("D")){let l=Ky(YT(t,e,a));l&&n.push(Wc(l,"archived"))}else{let l=Ky(Jy(t,c));if(!l)continue;let d=Ky(YT(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(Wc(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(Wc(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(Wc(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function AB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function Wc(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>XT(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function Ky(t){if(t===null)return null;let e;try{e=(0,Yy.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 Jy(t,e){let r=OB(t,e);if(!qhe(r))return null;try{return Bhe(r,"utf8")}catch{return null}}function YT(t,e,r){try{return _f(t,["show",`${e}:${r}`])}catch{return null}}function Zhe(t,e){let r=Vhe(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 Vhe(t){let e=Jy(t,OB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,Yy.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function TB(t){let e={};if(t!==null)try{let n=(0,Yy.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 Jhe(t,e){let r=_f(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);Whe.test(a)&&(Khe.test(a)||n.push({hash:s,subject:a}))}return n}var Yy,Whe,Khe,Kc=y(()=>{"use strict";Yy=bt(Xt(),1);ua();Whe=/^(feat|fix)(\([^)]*\))?!?:/,Khe=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as RB}from"node:child_process";import{appendFileSync as Yhe,existsSync as QT,mkdirSync as Xhe,readFileSync as Qhe,renameSync as ege,statSync as tge}from"node:fs";import{userInfo as rge}from"node:os";import{dirname as nge,join as tO}from"node:path";function rO(t){return tO(t,IB,ige)}function Yr(t,e){let r=rO(t),n=nge(r);QT(n)||Xhe(n,{recursive:!0});try{QT(r)&&tge(r).size>oge&&ege(r,tO(n,PB))}catch{}Yhe(r,`${JSON.stringify(e)} -`,"utf8")}function eO(t){if(!QT(t))return[];let e=Qhe(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function da(t){return eO(rO(t))}function Xy(t){return[...eO(tO(t,IB,PB)),...eO(rO(t))]}function Xr(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 sge(t){let e;try{e=RB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=rge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function age(t){try{return RB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function bf(t,e){try{let r=da(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function ur(t,e,r){try{let n=age(t),i=sge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=bf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Yr(t,Xr(e,o))}catch{}}var IB,ige,PB,oge,Dr=y(()=>{"use strict";IB=".cladding",ige="events.log.jsonl",PB="events.log.1.jsonl",oge=5*1024*1024});import{execFileSync as cge}from"node:child_process";import{existsSync as CB,readdirSync as lge,readFileSync as uge,statSync as DB}from"node:fs";import{createHash as dge}from"node:crypto";import{join as nO}from"node:path";function fa(t){try{return cge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function iO(t){let e=[],r=nO(t,"spec.yaml");CB(r)&&DB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=nO(t,"spec",i);if(!(!CB(o)||!DB(o).isDirectory()))for(let s of lge(o))s.endsWith(".yaml")&&e.push(nO(o,s))}e.sort();let n=dge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(uge(i)),n.update("\0")}return n.digest("hex")}function Qy(t,e){let r={featureId:e,gitHead:fa(t),specDigest:iO(t),timestamp:new Date().toISOString()};return Yr(t,Xr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function e_(t,e){let r=da(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 t_(t,e,r,n){let i=Xr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Yr(t,i),i}var vf=y(()=>{"use strict";Dr()});import{readFileSync as fge,statSync as pge}from"node:fs";import{extname as mge,resolve as oO,sep as hge}from"node:path";function Qr(t){return Math.ceil(t.length/4)}function _ge(t,e){let r=oO(e),n=oO(r,t);return n===r||n.startsWith(r+hge)}function jB(t,e,r,n){if(!_ge(t,e))return{path:t,omitted:"unsafe-path"};if(!gge.has(mge(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>NB)return{path:t,omitted:"too-large",bytes:o}}else{let l=oO(e,t);try{o=pge(l).size}catch{return{path:t,omitted:"missing"}}if(o>NB)return{path:t,omitted:"too-large",bytes:o};try{i=fge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(yge))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=Qc(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=Qc(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())}}};CB.Parser=aO});var FB=v($f=>{"use strict";var DB=WT(),qhe=hf(),xf=_f(),Bhe=ZA(),Hhe=Ce(),Ghe=sO(),NB=cO();function jB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Ghe.LineCounter||null,prettyErrors:e}}function Zhe(t,e={}){let{lineCounter:r,prettyErrors:n}=jB(e),i=new NB.Parser(r?.addNewLine),o=new DB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(xf.prettifyError(t,r)),a.warnings.forEach(xf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function MB(t,e={}){let{lineCounter:r,prettyErrors:n}=jB(e),i=new NB.Parser(r?.addNewLine),o=new DB.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 xf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(xf.prettifyError(t,r)),s.warnings.forEach(xf.prettifyError(t,r))),s}function Vhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=MB(t,r);if(!i)return null;if(i.warnings.forEach(o=>Bhe.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 Whe(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 Hhe.isDocument(t)&&!n?t.toString(r):new qhe.Document(t,n,r).toString(r)}$f.parse=Vhe;$f.parseAllDocuments=Zhe;$f.parseDocument=MB;$f.stringify=Whe});var Qt=v(Ge=>{"use strict";var Khe=WT(),Jhe=hf(),Yhe=TT(),lO=_f(),Xhe=Xd(),Xo=Ce(),Qhe=Vo(),ege=Pt(),tge=Ko(),rge=Jo(),nge=Xy(),ige=iO(),oge=sO(),sge=cO(),r_=FB(),LB=Wd();Ge.Composer=Khe.Composer;Ge.Document=Jhe.Document;Ge.Schema=Yhe.Schema;Ge.YAMLError=lO.YAMLError;Ge.YAMLParseError=lO.YAMLParseError;Ge.YAMLWarning=lO.YAMLWarning;Ge.Alias=Xhe.Alias;Ge.isAlias=Xo.isAlias;Ge.isCollection=Xo.isCollection;Ge.isDocument=Xo.isDocument;Ge.isMap=Xo.isMap;Ge.isNode=Xo.isNode;Ge.isPair=Xo.isPair;Ge.isScalar=Xo.isScalar;Ge.isSeq=Xo.isSeq;Ge.Pair=Qhe.Pair;Ge.Scalar=ege.Scalar;Ge.YAMLMap=tge.YAMLMap;Ge.YAMLSeq=rge.YAMLSeq;Ge.CST=nge;Ge.Lexer=ige.Lexer;Ge.LineCounter=oge.LineCounter;Ge.Parser=sge.Parser;Ge.parse=r_.parse;Ge.parseAllDocuments=r_.parseAllDocuments;Ge.parseDocument=r_.parseDocument;Ge.stringify=r_.stringify;Ge.visit=LB.visit;Ge.visitAsync=LB.visitAsync});import{execFileSync as zB}from"node:child_process";import{existsSync as n_}from"node:fs";import{join as i_,resolve as age}from"node:path";function cge(t){try{let e=zB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?age(t,e):null}catch{return null}}function uO(t){let e=cge(t);if(!e)return null;try{if(n_(i_(e,"MERGE_HEAD")))return"merge";if(n_(i_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(n_(i_(e,"rebase-merge"))||n_(i_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function da(t){return uO(t)!==null}function dO(t,e){try{let r=zB("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 o_(t,e){return dO(t,e)!==null}var fa=y(()=>{"use strict"});import{execFileSync as lge}from"node:child_process";import{existsSync as uge,readFileSync as dge}from"node:fs";import{join as BB}from"node:path";function kf(t,e){return lge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Qo(t){try{let e=kf(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 es(t,e){fge(t,e);let r=kf(t,["rev-parse","HEAD"]).trim(),n=pge(t,e);return{groups:mge(t,n),head:r,inventory:{after:qB(a_(t,"spec.yaml")),before:qB(fO(t,e,"spec.yaml"))},since:e,unsharded_commits:_ge(t,e)}}function pO(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 fge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!o_(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 pge(t,e){let r=kf(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(!(!UB(c)&&!UB(a)))if(s.startsWith("A")){let l=s_(a_(t,c));if(!l)continue;l.status==="done"?n.push(el(l,"added-as-done")):l.status==="archived"&&n.push(el(l,"archived"))}else if(s.startsWith("D")){let l=s_(fO(t,e,a));l&&n.push(el(l,"archived"))}else{let l=s_(a_(t,c));if(!l)continue;let d=s_(fO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(el(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(el(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(el(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function UB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function el(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>pO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function s_(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 a_(t,e){let r=BB(t,e);if(!uge(r))return null;try{return dge(r,"utf8")}catch{return null}}function fO(t,e,r){try{return kf(t,["show",`${e}:${r}`])}catch{return null}}function mge(t,e){let r=hge(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 hge(t){let e=a_(t,BB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,c_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function qB(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 _ge(t,e){let r=kf(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);gge.test(a)&&(yge.test(a)||n.push({hash:s,subject:a}))}return n}var c_,gge,yge,tl=y(()=>{"use strict";c_=bt(Qt(),1);fa();gge=/^(feat|fix)(\([^)]*\))?!?:/,yge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as HB}from"node:child_process";import{appendFileSync as bge,existsSync as mO,mkdirSync as vge,readFileSync as Sge,renameSync as wge,statSync as xge}from"node:fs";import{userInfo as $ge}from"node:os";import{dirname as kge,join as gO}from"node:path";function yO(t){return gO(t,GB,Ege)}function Xr(t,e){let r=yO(t),n=kge(r);mO(n)||vge(n,{recursive:!0});try{mO(r)&&xge(r).size>Age&&wge(r,gO(n,ZB))}catch{}bge(r,`${JSON.stringify(e)} +`,"utf8")}function hO(t){if(!mO(t))return[];let e=Sge(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function pa(t){return hO(yO(t))}function l_(t){return[...hO(gO(t,GB,ZB)),...hO(yO(t))]}function Qr(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 Tge(t){let e;try{e=HB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=$ge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Oge(t){try{return HB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Ef(t,e){try{let r=pa(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Oge(t),i=Tge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Ef(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var GB,Ege,ZB,Age,Nr=y(()=>{"use strict";GB=".cladding",Ege="events.log.jsonl",ZB="events.log.1.jsonl",Age=5*1024*1024});import{execFileSync as Rge}from"node:child_process";import{existsSync as VB,readdirSync as Ige,readFileSync as Pge,statSync as WB}from"node:fs";import{createHash as Cge}from"node:crypto";import{join as _O}from"node:path";function ma(t){try{return Rge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function bO(t){let e=[],r=_O(t,"spec.yaml");VB(r)&&WB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=_O(t,"spec",i);if(!(!VB(o)||!WB(o).isDirectory()))for(let s of Ige(o))s.endsWith(".yaml")&&e.push(_O(o,s))}e.sort();let n=Cge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Pge(i)),n.update("\0")}return n.digest("hex")}function u_(t,e){let r={featureId:e,gitHead:ma(t),specDigest:bO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function d_(t,e){let r=pa(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=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Af=y(()=>{"use strict";Nr()});import{readFileSync as Dge,statSync as Nge}from"node:fs";import{extname as jge,resolve as vO,sep as Mge}from"node:path";function en(t){return Math.ceil(t.length/4)}function zge(t,e){let r=vO(e),n=vO(r,t);return n===r||n.startsWith(r+Mge)}function JB(t,e,r,n){if(!zge(t,e))return{path:t,omitted:"unsafe-path"};if(!Fge.has(jge(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>KB)return{path:t,omitted:"too-large",bytes:o}}else{let l=vO(e,t);try{o=Nge(l).size}catch{return{path:t,omitted:"missing"}}if(o>KB)return{path:t,omitted:"too-large",bytes:o};try{i=Dge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Lge))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 gge,NB,yge,r_=y(()=>{"use strict";gge=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"]),NB=2e6,yge="\0"});function vge(t){for(let i of bge)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 sO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Sge(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??[])sO(e,s,o);for(let s of i.modules??[])sO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=vge(a);c&&sO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function $n(t){let e=MB.get(t);return e||(e=Sge(t),MB.set(t,e)),e}var bge,MB,pa=y(()=>{"use strict";bge=["derived:","fixture:","script:","self-dogfood:"];MB=new WeakMap});function aO(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 _r(t,e,r={}){let n=r.depth??1/0,i=$n(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=wge(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=aO(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:cO(i)}}var ma=y(()=>{"use strict";pa()});function FB(t){return t.impacted.length}function i_(t,e,r={}){let n=r.initialDepth??n_.initialDepth,i=r.maxDepth??n_.maxDepth,o=r.coverageThreshold??n_.coverageThreshold,s=r.marginYieldThreshold??n_.marginYieldThreshold,a=$n(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=_r(t,e,{depth:1});return"not_found"in b,b}let d=aO(l,a.dependents,1/0).size;if(d===0){let b=_r(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 _=_r(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=FB(_),x=S-p,w=S>0?x/S:0;f.push(w);let R=d>0?S/d:1,A=x===0&&b>n,E={frontierExhausted:A,coverage:R,marginalYields:[...f],totalKnownDependents:d};if(A)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:E};if(R>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:E};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var n_,lO=y(()=>{"use strict";ma();pa();n_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function xge(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 LB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=xge(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 $ge(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 Jc(t,e){let r=$ge(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=LB(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 o_=y(()=>{"use strict";zB()});import{existsSync as qB,readdirSync as kge,readFileSync as Ege}from"node:fs";import{join as dO}from"node:path";function fO(t,e=Tge){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function Oge(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:fO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:fO(`done reverted \u2014 pre-push strict gate red${r}`)}}function UB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Rge(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 fO(n)}function Ige(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)=>UB(m)-UB(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(-Age).map(Oge),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?Rge(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 uO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function Pge(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 Cge(t,e,r){let n=uO(t,/_Rolled back at_\s*`([^`]+)`/),i=uO(t,/Last failed gate:\s*`([^`]+)`/),o=uO(t,/Retry attempts:\s*(\d+)/),s=Pge(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function Dge(t,e){let r=dO(t,".cladding","post-mortems");if(!qB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of kge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(Cge(Ege(dO(r,o),"utf8"),e,o))}catch{}return i}function BB(t,e){try{let r=Xy(t),n=Dge(t,e),i=qB(dO(t,".cladding","events.log.1.jsonl"));return Ige(r,n,e,{truncated:i})}catch{return}}var Age,Tge,HB=y(()=>{"use strict";Dr();Age=5,Tge=120});function s_(t,e,r){return Qr(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function ha(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:Nge,o=e,s,a=$n(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=Jc(t,o);if("not_found"in c)return c;let l=c.focus,u=BB(n,l.id),d=a&&a.size>0?e:l.id,f=i_(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>jge&&s_(w,R,[])>i;)R.pop();R.lengthi){x.push(`code: omitted ${se} (budget)`);continue}E.push(Vt),Vt.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,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),k=(se,Pe,Vt,lr)=>{let Jt=Vt+lr>0?[`breaks: omitted ${Vt} feature(s) / ${lr} test(s)`]:[],no={...w,needs:R,must_edit:{...w.must_edit,code:E},breaks_if_changed:D(se,Pe),budget:{...w.budget,truncated:[...x,...Jt]}};return Qr(JSON.stringify(no))>i},B=m,Q=h;if(k(B,Q,0,0)){let se=_r(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Vt=new Set("not_found"in se?[]:se.test_refs),Jt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],no=0;for(;Jt.length>Pe.size&&k(Jt,Q,no,0);)Jt=Jt.slice(0,-1),no++;let _i=[...h],Jr=0;for(;k(Jt,_i,no,Jr);){let de=-1;for(let io=_i.length-1;io>=0;io--)if(!Vt.has(_i[io])){de=io;break}if(de<0)break;_i.splice(de,1),Jr++}B=Jt,Q=_i,no+Jr>0&&x.push(`breaks: omitted ${no} feature(s) / ${Jr} test(s)`),k(B,Q,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Se=D(B,Q),P={...w,needs:R,must_edit:{...w.must_edit,code:E},breaks_if_changed:Se},C=P;if(u){let se={...P,prior_attempts:u};Qr(JSON.stringify(se))<=i?C=se:x.push("prior_attempts: omitted (budget)")}let Rr=Qr(JSON.stringify(C));return{...C,budget:{max_tokens:i,used_tokens:Rr,truncated:x}}}var Nge,jge,a_=y(()=>{"use strict";r_();o_();lO();HB();ma();pa();Nge=3e3,jge=3});function Zn(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 Mge(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 GB(t,e,r="."){let n=$n(t),i=t.features??[],o=[];for(let f of i){let p=ha(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=ha(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=i_(t,f.id),g=!("not_found"in h),b=Qr(JSON.stringify(p)),_="not_found"in m?b:Qr(JSON.stringify(m)),S=Qr(JSON.stringify(f));for(let R of f.modules??[]){let A=e(R);A&&(S+=Qr(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(Zn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Zn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Zn(a(c))*10)/10,medianShrinkTruncated:Math.round(Zn(a(l))*10)/10,medianStructuralRatio:Math.round(Zn(u)*100)/100,medianSliceTokens:Math.round(Zn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Zn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Zn(o.map(f=>f.searchDepth)),p95Depth:Mge(o.map(f=>f.searchDepth),95),medianEdges:Zn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Zn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Zn(o.map(f=>f.regressionTests))},features:o}}var Yc,c_=y(()=>{"use strict";r_();lO();a_();pa();Yc="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Fge,existsSync as pO,mkdirSync as Lge,readFileSync as ZB}from"node:fs";import{dirname as zge,join as Uge}from"node:path";function mO(t){return Uge(t,qge,Bge)}function Hge(t,e){return{timestamp:new Date().toISOString(),head:fa(t),spec_digest:iO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function VB(t,e){try{let r=Hge(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=hO(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=mO(t),s=zge(o);return pO(s)||Lge(s,{recursive:!0}),Fge(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function WB(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 hO(t,e){let r=mO(t);if(!pO(r))return[];let n;try{n=ZB(r,"utf8")}catch{return[]}let i=WB(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function KB(t){let e=mO(t);if(!pO(e))return{snapshots:[],unreadable:!1};let r;try{r=ZB(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=WB(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Sf(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 JB(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?` (${Sf(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(` ${Yc}`),i.join(` -`)}var qge,Bge,wf=y(()=>{"use strict";vf();c_();qge=".cladding",Bge="measure.jsonl"});import{existsSync as Gge}from"node:fs";import{join as Zge}from"node:path";function Xc(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}** (${Vge[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 XB(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 ${Sf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Sf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Sf(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`,"",Yc),r.join(` -`)}function Qc(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"} | ${Kge(l,r)} |`)}return n.join(` -`)}function Kge(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 Wge)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Gge(Zge(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function el(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),YB(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)YB(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function YB(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=XT(r);n&&t.push(`- ${n}`)}t.push("")}var Vge,Wge,l_=y(()=>{"use strict";wf();c_();Kc();Vge={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Wge=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Jge}from"node:fs";function xi(t="./spec.yaml"){let e=Jge(t,"utf8");return(0,QB.parse)(e)}var QB,u_=y(()=>{"use strict";QB=bt(Xt(),1)});var Qo=v((Nr,bO)=>{"use strict";var gO=Nr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+tH(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()};gO.prototype.toString=function(){return this.property+" "+this.message};var d_=Nr.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};d_.prototype.addError=function(e){var r;if(typeof e=="string")r=new gO(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 gO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new ga(this);if(this.throwError)throw r;return r};d_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Yge(t,e){return e+": "+t.toString()+` -`}d_.prototype.toString=function(e){return this.errors.map(Yge).join("")};Object.defineProperty(d_.prototype,"valid",{get:function(){return!this.errors.length}});bO.exports.ValidatorResultError=ga;function ga(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ga),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}ga.prototype=new Error;ga.prototype.constructor=ga;ga.prototype.name="Validation Error";var eH=Nr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};eH.prototype=Object.create(Error.prototype,{constructor:{value:eH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var yO=Nr.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+tH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};yO.prototype.resolve=function(e){return rH(this.base,e)};yO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=rH(this.base,i||"");var s=new yO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Vn=Nr.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]+$/};Vn.regexp=Vn.regex;Vn.pattern=Vn.regex;Vn.ipv4=Vn["ip-address"];Nr.isFormat=function(e,r,n){if(typeof e=="string"&&Vn[r]!==void 0){if(Vn[r]instanceof RegExp)return Vn[r].test(e);if(typeof Vn[r]=="function")return Vn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var tH=Nr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Nr.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 Xge(t,e,r,n){typeof r=="object"?e[n]=_O(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Qge(t,e,r){e[r]=t[r]}function eye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=_O(t[n],e[n]):r[n]=e[n]}function _O(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Xge.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Qge.bind(null,t,n)),Object.keys(e).forEach(eye.bind(null,t,e,n))),n}bO.exports.deepMerge=_O;Nr.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 tye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Nr.encodePath=function(e){return e.map(tye).join("")};Nr.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};Nr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var rH=Nr.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 sH=v((PYe,oH)=>{"use strict";var en=Qo(),Fe=en.ValidatorResult,es=en.SchemaError,vO={};vO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=vO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 SO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new es("anyOf must be an array");if(!r.anyOf.some(SO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new es("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new es("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(SO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!en.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=SO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!en.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(!en.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 wO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!en.isSchema(s))throw new es('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(wO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 es('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=wO(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 nH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 es('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&&nH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)nH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!en.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 rye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var xO=Qo();$O.exports.SchemaScanResult=aH;function aH(t,e){this.id=t,this.ref=e}$O.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=xO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=xO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!xO.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 cH=sH(),ts=Qo(),lH=f_().scan,uH=ts.ValidatorResult,nye=ts.ValidatorResultError,xf=ts.SchemaError,dH=ts.SchemaContext,iye="/",Wt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create($i),this.attributes=Object.create(cH.validators)};Wt.prototype.customFormats={};Wt.prototype.schemas=null;Wt.prototype.types=null;Wt.prototype.attributes=null;Wt.prototype.unresolvedRefs=null;Wt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=lH(r||iye,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]};Wt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ts.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new xf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Wt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new xf('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 $i=Wt.prototype.types={};$i.string=function(e){return typeof e=="string"};$i.number=function(e){return typeof e=="number"&&isFinite(e)};$i.integer=function(e){return typeof e=="number"&&e%1===0};$i.boolean=function(e){return typeof e=="boolean"};$i.array=function(e){return Array.isArray(e)};$i.null=function(e){return e===null};$i.date=function(e){return e instanceof Date};$i.any=function(e){return!0};$i.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};pH.exports=Wt});var hH=v((NYe,co)=>{"use strict";var oye=co.exports.Validator=mH();co.exports.ValidatorResult=Qo().ValidatorResult;co.exports.ValidatorResultError=Qo().ValidatorResultError;co.exports.ValidationError=Qo().ValidationError;co.exports.SchemaError=Qo().SchemaError;co.exports.SchemaScanResult=f_().SchemaScanResult;co.exports.scan=f_().scan;co.exports.validate=function(t,e,r){var n=new oye;return n.validate(t,e,r)}});import{readFileSync as sye}from"node:fs";import{dirname as aye,join as cye}from"node:path";import{fileURLToPath as lye}from"node:url";function mye(t){let e=pye.validate(t,fye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function yH(t){let e=mye(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 Fge,KB,Lge,p_=y(()=>{"use strict";Fge=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"]),KB=2e6,Lge="\0"});function qge(t){for(let i of Uge)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 SO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Bge(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??[])SO(e,s,o);for(let s of i.modules??[])SO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=qge(a);c&&SO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=YB.get(t);return e||(e=Bge(t),YB.set(t,e)),e}var Uge,YB,ha=y(()=>{"use strict";Uge=["derived:","fixture:","script:","self-dogfood:"];YB=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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Hge(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:xO(i)}}var ga=y(()=>{"use strict";ha()});function XB(t){return t.impacted.length}function h_(t,e,r={}){let n=r.initialDepth??m_.initialDepth,i=r.maxDepth??m_.maxDepth,o=r.coverageThreshold??m_.coverageThreshold,s=r.marginYieldThreshold??m_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=wO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=XB(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var m_,$O=y(()=>{"use strict";ga();ha();m_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Gge(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 QB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Gge(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 eH=y(()=>{"use strict"});function Zge(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 rl(t,e){let r=Zge(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=QB(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 g_=y(()=>{"use strict";eH()});import{existsSync as rH,readdirSync as Vge,readFileSync as Wge}from"node:fs";import{join as EO}from"node:path";function AO(t,e=Jge){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function Yge(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:AO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:AO(`done reverted \u2014 pre-push strict gate red${r}`)}}function tH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Xge(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 AO(n)}function Qge(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)=>tH(m)-tH(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(-Kge).map(Yge),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?Xge(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 kO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function eye(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 tye(t,e,r){let n=kO(t,/_Rolled back at_\s*`([^`]+)`/),i=kO(t,/Last failed gate:\s*`([^`]+)`/),o=kO(t,/Retry attempts:\s*(\d+)/),s=eye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function rye(t,e){let r=EO(t,".cladding","post-mortems");if(!rH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Vge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(tye(Wge(EO(r,o),"utf8"),e,o))}catch{}return i}function nH(t,e){try{let r=l_(t),n=rye(t,e),i=rH(EO(t,".cladding","events.log.1.jsonl"));return Qge(r,n,e,{truncated:i})}catch{return}}var Kge,Jge,iH=y(()=>{"use strict";Nr();Kge=5,Jge=120});function y_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function ya(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:nye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=rl(t,o);if("not_found"in c)return c;let l=c.focus,u=nH(n,l.id),d=a&&a.size>0?e:l.id,f=h_(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}},O=[...c.ancestors];for(;O.length>iye&&y_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Wt),Wt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),E=(se,Pe,Wt,dr)=>{let Yt=Wt+dr>0?[`breaks: omitted ${Wt} feature(s) / ${dr} test(s)`]:[],oo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(oo))>i},q=m,Q=h;if(E(q,Q,0,0)){let se=br(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Wt=new Set("not_found"in se?[]:se.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],oo=0;for(;Yt.length>Pe.size&&E(Yt,Q,oo,0);)Yt=Yt.slice(0,-1),oo++;let vi=[...h],Yr=0;for(;E(Yt,vi,oo,Yr);){let de=-1;for(let so=vi.length-1;so>=0;so--)if(!Wt.has(vi[so])){de=so;break}if(de<0)break;vi.splice(de,1),Yr++}q=Yt,Q=vi,oo+Yr>0&&x.push(`breaks: omitted ${oo} feature(s) / ${Yr} test(s)`),E(q,Q,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Se=D(q,Q),P={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Se},C=P;if(u){let se={...P,prior_attempts:u};en(JSON.stringify(se))<=i?C=se:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(C));return{...C,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var nye,iye,__=y(()=>{"use strict";p_();g_();$O();iH();ga();ha();nye=3e3,iye=3});function Kn(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 oye(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 oH(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=ya(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=ya(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=h_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:oye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var nl,b_=y(()=>{"use strict";p_();$O();__();ha();nl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as sye,existsSync as TO,mkdirSync as aye,readFileSync as sH}from"node:fs";import{dirname as cye,join as lye}from"node:path";function OO(t){return lye(t,uye,dye)}function fye(t,e){return{timestamp:new Date().toISOString(),head:ma(t),spec_digest:bO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function aH(t,e){try{let r=fye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=RO(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=OO(t),s=cye(o);return TO(s)||aye(s,{recursive:!0}),sye(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function cH(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 RO(t,e){let r=OO(t);if(!TO(r))return[];let n;try{n=sH(r,"utf8")}catch{return[]}let i=cH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function lH(t){let e=OO(t);if(!TO(e))return{snapshots:[],unreadable:!1};let r;try{r=sH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=cH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Tf(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 uH(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?` (${Tf(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(` ${nl}`),i.join(` +`)}var uye,dye,Of=y(()=>{"use strict";Af();b_();uye=".cladding",dye="measure.jsonl"});import{existsSync as pye}from"node:fs";import{join as mye}from"node:path";function il(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}** (${hye[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 fH(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 ${Tf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Tf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Tf(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`,"",nl),r.join(` +`)}function ol(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"} | ${yye(l,r)} |`)}return n.join(` +`)}function yye(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 gye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${pye(mye(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),dH(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)dH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function dH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=pO(r);n&&t.push(`- ${n}`)}t.push("")}var hye,gye,v_=y(()=>{"use strict";Of();b_();tl();hye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};gye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as _ye}from"node:fs";function ki(t="./spec.yaml"){let e=_ye(t,"utf8");return(0,pH.parse)(e)}var pH,S_=y(()=>{"use strict";pH=bt(Qt(),1)});var ts=v((jr,DO)=>{"use strict";var IO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+hH(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()};IO.prototype.toString=function(){return this.property+" "+this.message};var w_=jr.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 IO(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 IO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new _a(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 bye(t,e){return e+": "+t.toString()+` +`}w_.prototype.toString=function(e){return this.errors.map(bye).join("")};Object.defineProperty(w_.prototype,"valid",{get:function(){return!this.errors.length}});DO.exports.ValidatorResultError=_a;function _a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,_a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}_a.prototype=new Error;_a.prototype.constructor=_a;_a.prototype.name="Validation Error";var mH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};mH.prototype=Object.create(Error.prototype,{constructor:{value:mH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var PO=jr.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+hH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};PO.prototype.resolve=function(e){return gH(this.base,e)};PO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=gH(this.base,i||"");var s=new PO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var hH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 vye(t,e,r,n){typeof r=="object"?e[n]=CO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Sye(t,e,r){e[r]=t[r]}function wye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=CO(t[n],e[n]):r[n]=e[n]}function CO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(vye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Sye.bind(null,t,n)),Object.keys(e).forEach(wye.bind(null,t,e,n))),n}DO.exports.deepMerge=CO;jr.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 xye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(xye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var gH=jr.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 vH=v((aXe,bH)=>{"use strict";var tn=ts(),Fe=tn.ValidatorResult,rs=tn.SchemaError,NO={};NO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=NO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 jO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new rs("anyOf must be an array");if(!r.anyOf.some(jO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new rs("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new rs("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(jO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=jO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 MO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new rs('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(MO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=MO(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 yH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('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&&yH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)yH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 $ye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var FO=ts();LO.exports.SchemaScanResult=SH;function SH(t,e){this.id=t,this.ref=e}LO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=FO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=FO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!FO.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 wH=vH(),ns=ts(),xH=x_().scan,$H=ns.ValidatorResult,kye=ns.ValidatorResultError,Rf=ns.SchemaError,kH=ns.SchemaContext,Eye="/",Kt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ei),this.attributes=Object.create(wH.validators)};Kt.prototype.customFormats={};Kt.prototype.schemas=null;Kt.prototype.types=null;Kt.prototype.attributes=null;Kt.prototype.unresolvedRefs=null;Kt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=xH(r||Eye,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]};Kt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ns.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Rf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Kt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Rf('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 Ei=Kt.prototype.types={};Ei.string=function(e){return typeof e=="string"};Ei.number=function(e){return typeof e=="number"&&isFinite(e)};Ei.integer=function(e){return typeof e=="number"&&e%1===0};Ei.boolean=function(e){return typeof e=="boolean"};Ei.array=function(e){return Array.isArray(e)};Ei.null=function(e){return e===null};Ei.date=function(e){return e instanceof Date};Ei.any=function(e){return!0};Ei.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};AH.exports=Kt});var OH=v((uXe,uo)=>{"use strict";var Aye=uo.exports.Validator=TH();uo.exports.ValidatorResult=ts().ValidatorResult;uo.exports.ValidatorResultError=ts().ValidatorResultError;uo.exports.ValidationError=ts().ValidationError;uo.exports.SchemaError=ts().SchemaError;uo.exports.SchemaScanResult=x_().SchemaScanResult;uo.exports.scan=x_().scan;uo.exports.validate=function(t,e,r){var n=new Aye;return n.validate(t,e,r)}});import{readFileSync as Tye}from"node:fs";import{dirname as Oye,join as Rye}from"node:path";import{fileURLToPath as Iye}from"node:url";function jye(t){let e=Nye.validate(t,Dye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function IH(t){let e=jye(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var gH,uye,dye,fye,pye,_H=y(()=>{"use strict";gH=bt(hH(),1),uye=aye(lye(import.meta.url)),dye=cye(uye,"schema.json"),fye=JSON.parse(sye(dye,"utf8")),pye=new gH.Validator});import{existsSync as kO,readdirSync as hye}from"node:fs";import{dirname as gye,join as ya,resolve as vH}from"node:path";function bH(t){return kO(t)?hye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>xi(ya(t,r))):[]}function _a(t,e){p_=e?{cwd:vH(t),spec:e}:null}function G(t=".",e="spec.yaml"){return p_&&e==="spec.yaml"&&vH(t)===p_.cwd?p_.spec:yye(t,e)}function yye(t,e){let r=ya(t,e),n=xi(r),i=ya(t,gye(e),"spec");if(!n.features||n.features.length===0){let o=bH(ya(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=bH(ya(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ya(i,"architecture.yaml");kO(o)&&(n.architecture=xi(o))}if(!n.capabilities||n.capabilities.length===0){let o=ya(i,"capabilities.yaml");if(kO(o)){let s=xi(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return yH(n),n}var p_,qe=y(()=>{"use strict";u_();_H();p_=null});import tl from"node:process";function TO(){return!!tl.stdout.isTTY}function L(t,e,r=""){let n=SH[t],i=r?` ${r}`:"";TO()?tl.stdout.write(`${EO[t]}${n}${AO} ${e}${i} -`):tl.stdout.write(`${n} ${e}${i} -`)}function $f(t,e,r=""){if(!TO())return;let n=r?` ${r}`:"";tl.stdout.write(`${wH}${EO.start}\xB7${AO} ${t} \xB7 ${e}${n}`)}function ba(t,e,r=""){let n=SH[t],i=r?` ${r}`:"";TO()?tl.stdout.write(`${wH}${EO[t]}${n}${AO} ${e}${i} -`):tl.stdout.write(`${n} ${e}${i} -`)}var SH,EO,AO,wH,ki=y(()=>{"use strict";SH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},EO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},AO="\x1B[0m",wH="\r\x1B[K"});import{createHash as BH}from"node:crypto";import{existsSync as Kye,readFileSync as IO,writeFileSync as Jye}from"node:fs";import{join as m_}from"node:path";function Yye(t,e){let r=BH("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(IO(m_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function GH(t,e){let r=BH("sha256");try{r.update(IO(m_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function rs(t){let e=m_(t,...HH);if(!Kye(e))return null;let r;try{r=IO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function h_(t){return t.features?.size??t.v1?.size??0}function g_(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)!==GH(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===Yye(e,n)?{state:"fresh"}:{state:"stale"}}function ZH(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${GH(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=Xye+`attested_modules: + `)}`)}var RH,Pye,Cye,Dye,Nye,PH=y(()=>{"use strict";RH=bt(OH(),1),Pye=Oye(Iye(import.meta.url)),Cye=Rye(Pye,"schema.json"),Dye=JSON.parse(Tye(Cye,"utf8")),Nye=new RH.Validator});import{existsSync as zO,readdirSync as Mye}from"node:fs";import{dirname as Fye,join as ba,resolve as DH}from"node:path";function CH(t){return zO(t)?Mye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ki(ba(t,r))):[]}function va(t,e){$_=e?{cwd:DH(t),spec:e}:null}function G(t=".",e="spec.yaml"){return $_&&e==="spec.yaml"&&DH(t)===$_.cwd?$_.spec:Lye(t,e)}function Lye(t,e){let r=ba(t,e),n=ki(r),i=ba(t,Fye(e),"spec");if(!n.features||n.features.length===0){let o=CH(ba(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=CH(ba(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ba(i,"architecture.yaml");zO(o)&&(n.architecture=ki(o))}if(!n.capabilities||n.capabilities.length===0){let o=ba(i,"capabilities.yaml");if(zO(o)){let s=ki(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return IH(n),n}var $_,qe=y(()=>{"use strict";S_();PH();$_=null});import al from"node:process";function BO(){return!!al.stdout.isTTY}function L(t,e,r=""){let n=NH[t],i=r?` ${r}`:"";BO()?al.stdout.write(`${UO[t]}${n}${qO} ${e}${i} +`):al.stdout.write(`${n} ${e}${i} +`)}function If(t,e,r=""){if(!BO())return;let n=r?` ${r}`:"";al.stdout.write(`${jH}${UO.start}\xB7${qO} ${t} \xB7 ${e}${n}`)}function Sa(t,e,r=""){let n=NH[t],i=r?` ${r}`:"";BO()?al.stdout.write(`${jH}${UO[t]}${n}${qO} ${e}${i} +`):al.stdout.write(`${n} ${e}${i} +`)}var NH,UO,qO,jH,Ai=y(()=>{"use strict";NH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},UO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},qO="\x1B[0m",jH="\r\x1B[K"});import{createHash as nG}from"node:crypto";import{existsSync as y_e,readFileSync as ZO,writeFileSync as __e}from"node:fs";import{join as k_}from"node:path";function b_e(t,e){let r=nG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(ZO(k_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function oG(t,e){let r=nG("sha256");try{r.update(ZO(k_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function is(t){let e=k_(t,...iG);if(!y_e(e))return null;let r;try{r=ZO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function E_(t){return t.features?.size??t.v1?.size??0}function A_(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)!==oG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===b_e(e,n)?{state:"fresh"}:{state:"stale"}}function sG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${oG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=v_e+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return Jye(m_(t,...HH),s,"utf8"),!0}var HH,Xye,nl=y(()=>{"use strict";HH=["spec","attestation.yaml"];Xye=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return __e(k_(t,...iG),s,"utf8"),!0}var iG,v_e,ll=y(()=>{"use strict";iG=["spec","attestation.yaml"];v_e=`# 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. # @@ -211,52 +211,52 @@ 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 PO}from"node:path";function y_(t){ns={cwd:PO(t),results:new Map}}function VH(t,e,r){!ns||ns.cwd!==PO(e)||ns.results.set(t,r)}function __(t,e){return!ns||ns.cwd!==PO(e)?null:ns.results.get(t)??null}function b_(){ns=null}var ns,il=y(()=>{"use strict";ns=null});function At(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 uo=y(()=>{});import{fileURLToPath as Qye}from"node:url";var ol,e_e,CO,DO,sl=y(()=>{ol=(t,e)=>{let r=DO(e_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},e_e=t=>CO(t)?t.toString():t,CO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,DO=t=>t instanceof URL?Qye(t):t});var v_,NO=y(()=>{uo();sl();v_=(t,e=[],r={})=>{let n=ol(t,"First argument"),[i,o]=At(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(!At(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as t_e}from"node:string_decoder";var WH,KH,Ft,fo,r_e,JH,n_e,S_,YH,i_e,Af,o_e,jO,s_e,tn=y(()=>{({toString:WH}=Object.prototype),KH=t=>WH.call(t)==="[object ArrayBuffer]",Ft=t=>WH.call(t)==="[object Uint8Array]",fo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),r_e=new TextEncoder,JH=t=>r_e.encode(t),n_e=new TextDecoder,S_=t=>n_e.decode(t),YH=(t,e)=>i_e(t,e).join(""),i_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new t_e(e),n=t.map(o=>typeof o=="string"?JH(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Af=t=>t.length===1&&Ft(t[0])?t[0]:jO(o_e(t)),o_e=t=>t.map(e=>typeof e=="string"?JH(e):e),jO=t=>{let e=new Uint8Array(s_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},s_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as a_e}from"node:child_process";var tG,rG,c_e,l_e,XH,u_e,QH,eG,d_e,nG=y(()=>{uo();tn();tG=t=>Array.isArray(t)&&Array.isArray(t.raw),rG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=c_e({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,{}]},c_e=({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}=l_e(i,t.raw[n]),c=QH(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>eG(d)):[eG(l)];return QH(c,u,a)},l_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=XH.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)],eG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(At(t)&&("stdout"in t||"isMaxBuffer"in t))return d_e(t);throw t instanceof a_e||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`)},d_e=({stdout:t})=>{if(typeof t=="string")return t;if(Ft(t))return S_(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 MO from"node:process";var Wn,w_,kn,x_,po=y(()=>{Wn=t=>w_.includes(t),w_=[MO.stdin,MO.stdout,MO.stderr],kn=["stdin","stdout","stderr"],x_=t=>kn[t]??`stdio[${t}]`});import{debuglog as f_e}from"node:util";var oG,FO,p_e,m_e,h_e,g_e,iG,y_e,LO,__e,b_e,v_e,S_e,zO,mo,ho=y(()=>{uo();po();oG=t=>{let e={...t};for(let r of zO)e[r]=FO(t,r);return e},FO=(t,e)=>{let r=Array.from({length:p_e(t)+1}),n=m_e(t[e],r,e);return b_e(n,e)},p_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,kn.length):kn.length,m_e=(t,e,r)=>At(t)?h_e(t,e,r):e.fill(t),h_e=(t,e,r)=>{for(let n of Object.keys(t).sort(g_e))for(let i of y_e(n,r,e))e[i]=t[n];return e},g_e=(t,e)=>iG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,y_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=LO(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as VO}from"node:path";function T_(t){os={cwd:VO(t),results:new Map}}function aG(t,e,r){!os||os.cwd!==VO(e)||os.results.set(t,r)}function O_(t,e){return!os||os.cwd!==VO(e)?null:os.results.get(t)??null}function R_(){os=null}var os,ul=y(()=>{"use strict";os=null});function At(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 po=y(()=>{});import{fileURLToPath as S_e}from"node:url";var dl,w_e,WO,KO,fl=y(()=>{dl=(t,e)=>{let r=KO(w_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},w_e=t=>WO(t)?t.toString():t,WO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,KO=t=>t instanceof URL?S_e(t):t});var I_,JO=y(()=>{po();fl();I_=(t,e=[],r={})=>{let n=dl(t,"First argument"),[i,o]=At(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(!At(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as x_e}from"node:string_decoder";var cG,lG,zt,mo,$_e,uG,k_e,P_,dG,E_e,Df,A_e,YO,T_e,rn=y(()=>{({toString:cG}=Object.prototype),lG=t=>cG.call(t)==="[object ArrayBuffer]",zt=t=>cG.call(t)==="[object Uint8Array]",mo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),$_e=new TextEncoder,uG=t=>$_e.encode(t),k_e=new TextDecoder,P_=t=>k_e.decode(t),dG=(t,e)=>E_e(t,e).join(""),E_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new x_e(e),n=t.map(o=>typeof o=="string"?uG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Df=t=>t.length===1&&zt(t[0])?t[0]:YO(A_e(t)),A_e=t=>t.map(e=>typeof e=="string"?uG(e):e),YO=t=>{let e=new Uint8Array(T_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},T_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as O_e}from"node:child_process";var hG,gG,R_e,I_e,fG,P_e,pG,mG,C_e,yG=y(()=>{po();rn();hG=t=>Array.isArray(t)&&Array.isArray(t.raw),gG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=R_e({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,{}]},R_e=({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}=I_e(i,t.raw[n]),c=pG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>mG(d)):[mG(l)];return pG(c,u,a)},I_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=fG.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)],mG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(At(t)&&("stdout"in t||"isMaxBuffer"in t))return C_e(t);throw t instanceof O_e||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`)},C_e=({stdout:t})=>{if(typeof t=="string")return t;if(zt(t))return P_(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 XO from"node:process";var Yn,C_,En,D_,ho=y(()=>{Yn=t=>C_.includes(t),C_=[XO.stdin,XO.stdout,XO.stderr],En=["stdin","stdout","stderr"],D_=t=>En[t]??`stdio[${t}]`});import{debuglog as D_e}from"node:util";var bG,QO,N_e,j_e,M_e,F_e,_G,L_e,eR,z_e,U_e,q_e,B_e,tR,go,yo=y(()=>{po();ho();bG=t=>{let e={...t};for(let r of tR)e[r]=QO(t,r);return e},QO=(t,e)=>{let r=Array.from({length:N_e(t)+1}),n=j_e(t[e],r,e);return U_e(n,e)},N_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,j_e=(t,e,r)=>At(t)?M_e(t,e,r):e.fill(t),M_e=(t,e,r)=>{for(let n of Object.keys(t).sort(F_e))for(let i of L_e(n,r,e))e[i]=t[n];return e},F_e=(t,e)=>_G(t)<_G(e)?1:-1,_G=t=>t==="stdout"||t==="stderr"?0:t==="all"?2:1,L_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=eR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},LO=t=>{if(t==="all")return t;if(kn.includes(t))return kn.indexOf(t);let e=__e.exec(t);if(e!==null)return Number(e[1])},__e=/^fd(\d+)$/,b_e=(t,e)=>t.map(r=>r===void 0?S_e[e]:r),v_e=f_e("execa").enabled?"full":"none",S_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:v_e,stripFinalNewline:!0},zO=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],mo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var al,cl,sG,UO,w_e,$_,k_,is=y(()=>{ho();al=({verbose:t},e)=>UO(t,e)!=="none",cl=({verbose:t},e)=>!["none","short"].includes(UO(t,e)),sG=({verbose:t},e)=>{let r=UO(t,e);return $_(r)?r:void 0},UO=(t,e)=>e===void 0?w_e(t):mo(t,e),w_e=t=>t.find(e=>$_(e))??k_.findLast(e=>t.includes(e)),$_=t=>typeof t=="function",k_=["none","short","full"]});import{platform as x_e}from"node:process";import{stripVTControlCharacters as $_e}from"node:util";var aG,Tf,cG,k_e,E_e,A_e,T_e,O_e,R_e,I_e,E_=y(()=>{aG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>R_e(cG(o))).join(" ");return{command:n,escapedCommand:i}},Tf=t=>$_e(t).split(` -`).map(e=>cG(e)).join(` -`),cG=t=>t.replaceAll(A_e,e=>k_e(e)),k_e=t=>{let e=T_e[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=O_e?`\\u${n.padStart(4,"0")}`:`\\U${n}`},E_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},A_e=E_e(),T_e={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},O_e=65535,R_e=t=>I_e.test(t)?t:x_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,I_e=/^[\w./-]+$/});import lG from"node:process";function qO(){let{env:t}=lG,{TERM:e,TERM_PROGRAM:r}=t;return lG.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 uG=y(()=>{});var dG,fG,P_e,C_e,D_e,N_e,j_e,A_,LXe,pG=y(()=>{uG();dG={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"},fG={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"},P_e={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"},C_e={...dG,...fG},D_e={...dG,...P_e},N_e=qO(),j_e=N_e?C_e:D_e,A_=j_e,LXe=Object.entries(fG)});import M_e from"node:tty";var F_e,_e,qXe,mG,BXe,HXe,GXe,ZXe,VXe,WXe,KXe,JXe,YXe,XXe,QXe,e7e,t7e,r7e,n7e,T_,i7e,o7e,s7e,a7e,c7e,l7e,u7e,d7e,f7e,hG,p7e,gG,m7e,h7e,g7e,y7e,_7e,b7e,v7e,S7e,w7e,x7e,$7e,BO=y(()=>{F_e=M_e?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!F_e)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}},qXe=_e(0,0),mG=_e(1,22),BXe=_e(2,22),HXe=_e(3,23),GXe=_e(4,24),ZXe=_e(53,55),VXe=_e(7,27),WXe=_e(8,28),KXe=_e(9,29),JXe=_e(30,39),YXe=_e(31,39),XXe=_e(32,39),QXe=_e(33,39),e7e=_e(34,39),t7e=_e(35,39),r7e=_e(36,39),n7e=_e(37,39),T_=_e(90,39),i7e=_e(40,49),o7e=_e(41,49),s7e=_e(42,49),a7e=_e(43,49),c7e=_e(44,49),l7e=_e(45,49),u7e=_e(46,49),d7e=_e(47,49),f7e=_e(100,49),hG=_e(91,39),p7e=_e(92,39),gG=_e(93,39),m7e=_e(94,39),h7e=_e(95,39),g7e=_e(96,39),y7e=_e(97,39),_7e=_e(101,49),b7e=_e(102,49),v7e=_e(103,49),S7e=_e(104,49),w7e=_e(105,49),x7e=_e(106,49),$7e=_e(107,49)});var yG=y(()=>{BO();BO()});var vG,z_e,O_,_G,U_e,bG,q_e,SG=y(()=>{pG();yG();vG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=z_e(r),c=U_e[t]({failed:o,reject:s,piped:n}),l=q_e[t]({reject:s});return`${T_(`[${a}]`)} ${T_(`[${i}]`)} ${l(c)} ${l(e)}`},z_e=t=>`${O_(t.getHours(),2)}:${O_(t.getMinutes(),2)}:${O_(t.getSeconds(),2)}.${O_(t.getMilliseconds(),3)}`,O_=(t,e)=>String(t).padStart(e,"0"),_G=({failed:t,reject:e})=>t?e?A_.cross:A_.warning:A_.tick,U_e={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:_G,duration:_G},bG=t=>t,q_e={command:()=>mG,output:()=>bG,ipc:()=>bG,error:({reject:t})=>t?hG:gG,duration:()=>T_}});var wG,B_e,H_e,xG=y(()=>{is();wG=(t,e,r)=>{let n=sG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>B_e(i,o,n)).filter(i=>i!==void 0).map(i=>H_e(i)).join("")},B_e=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},H_e=t=>t.endsWith(` +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(En.includes(t))return En.indexOf(t);let e=z_e.exec(t);if(e!==null)return Number(e[1])},z_e=/^fd(\d+)$/,U_e=(t,e)=>t.map(r=>r===void 0?B_e[e]:r),q_e=D_e("execa").enabled?"full":"none",B_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:q_e,stripFinalNewline:!0},tR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],go=(t,e)=>e==="ipc"?t.at(-1):t[e]});var pl,ml,vG,rR,H_e,N_,j_,ss=y(()=>{yo();pl=({verbose:t},e)=>rR(t,e)!=="none",ml=({verbose:t},e)=>!["none","short"].includes(rR(t,e)),vG=({verbose:t},e)=>{let r=rR(t,e);return N_(r)?r:void 0},rR=(t,e)=>e===void 0?H_e(t):go(t,e),H_e=t=>t.find(e=>N_(e))??j_.findLast(e=>t.includes(e)),N_=t=>typeof t=="function",j_=["none","short","full"]});import{platform as G_e}from"node:process";import{stripVTControlCharacters as Z_e}from"node:util";var SG,Nf,wG,V_e,W_e,K_e,J_e,Y_e,X_e,Q_e,M_=y(()=>{SG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>X_e(wG(o))).join(" ");return{command:n,escapedCommand:i}},Nf=t=>Z_e(t).split(` +`).map(e=>wG(e)).join(` +`),wG=t=>t.replaceAll(K_e,e=>V_e(e)),V_e=t=>{let e=J_e[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Y_e?`\\u${n.padStart(4,"0")}`:`\\U${n}`},W_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},K_e=W_e(),J_e={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Y_e=65535,X_e=t=>Q_e.test(t)?t:G_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Q_e=/^[\w./-]+$/});import xG from"node:process";function nR(){let{env:t}=xG,{TERM:e,TERM_PROGRAM:r}=t;return xG.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 $G=y(()=>{});var kG,EG,ebe,tbe,rbe,nbe,ibe,F_,m7e,AG=y(()=>{$G();kG={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"},EG={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"},ebe={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"},tbe={...kG,...EG},rbe={...kG,...ebe},nbe=nR(),ibe=nbe?tbe:rbe,F_=ibe,m7e=Object.entries(EG)});import obe from"node:tty";var sbe,_e,y7e,TG,_7e,b7e,v7e,S7e,w7e,x7e,$7e,k7e,E7e,A7e,T7e,O7e,R7e,I7e,P7e,L_,C7e,D7e,N7e,j7e,M7e,F7e,L7e,z7e,U7e,OG,q7e,RG,B7e,H7e,G7e,Z7e,V7e,W7e,K7e,J7e,Y7e,X7e,Q7e,iR=y(()=>{sbe=obe?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!sbe)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}},y7e=_e(0,0),TG=_e(1,22),_7e=_e(2,22),b7e=_e(3,23),v7e=_e(4,24),S7e=_e(53,55),w7e=_e(7,27),x7e=_e(8,28),$7e=_e(9,29),k7e=_e(30,39),E7e=_e(31,39),A7e=_e(32,39),T7e=_e(33,39),O7e=_e(34,39),R7e=_e(35,39),I7e=_e(36,39),P7e=_e(37,39),L_=_e(90,39),C7e=_e(40,49),D7e=_e(41,49),N7e=_e(42,49),j7e=_e(43,49),M7e=_e(44,49),F7e=_e(45,49),L7e=_e(46,49),z7e=_e(47,49),U7e=_e(100,49),OG=_e(91,39),q7e=_e(92,39),RG=_e(93,39),B7e=_e(94,39),H7e=_e(95,39),G7e=_e(96,39),Z7e=_e(97,39),V7e=_e(101,49),W7e=_e(102,49),K7e=_e(103,49),J7e=_e(104,49),Y7e=_e(105,49),X7e=_e(106,49),Q7e=_e(107,49)});var IG=y(()=>{iR();iR()});var DG,cbe,z_,PG,lbe,CG,ube,NG=y(()=>{AG();IG();DG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=cbe(r),c=lbe[t]({failed:o,reject:s,piped:n}),l=ube[t]({reject:s});return`${L_(`[${a}]`)} ${L_(`[${i}]`)} ${l(c)} ${l(e)}`},cbe=t=>`${z_(t.getHours(),2)}:${z_(t.getMinutes(),2)}:${z_(t.getSeconds(),2)}.${z_(t.getMilliseconds(),3)}`,z_=(t,e)=>String(t).padStart(e,"0"),PG=({failed:t,reject:e})=>t?e?F_.cross:F_.warning:F_.tick,lbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:PG,duration:PG},CG=t=>t,ube={command:()=>TG,output:()=>CG,ipc:()=>CG,error:({reject:t})=>t?OG:RG,duration:()=>L_}});var jG,dbe,fbe,MG=y(()=>{ss();jG=(t,e,r)=>{let n=vG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>dbe(i,o,n)).filter(i=>i!==void 0).map(i=>fbe(i)).join("")},dbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},fbe=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as G_e}from"node:util";var Ei,Z_e,V_e,W_e,R_,K_e,ll=y(()=>{E_();SG();xG();Ei=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Z_e({type:t,result:i,verboseInfo:n}),s=V_e(e,o),a=wG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Z_e=({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}),V_e=(t,e)=>t.split(` -`).map(r=>W_e({...e,message:r})),W_e=t=>({verboseLine:vG(t),verboseObject:t}),R_=t=>{let e=typeof t=="string"?t:G_e(t);return Tf(e).replaceAll(" "," ".repeat(K_e))},K_e=2});var $G,kG=y(()=>{is();ll();$G=(t,e)=>{al(e)&&Ei({type:"command",verboseMessage:t,verboseInfo:e})}});var EG,J_e,Y_e,X_e,AG=y(()=>{is();EG=(t,e,r)=>{X_e(t);let n=J_e(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},J_e=t=>al({verbose:t})?Y_e++:void 0,Y_e=0n,X_e=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(!k_.includes(e)&&!$_(e)){let r=k_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as TG}from"node:process";var I_,HO,P_=y(()=>{I_=()=>TG.bigint(),HO=t=>Number(TG.bigint()-t)/1e6});var C_,GO=y(()=>{kG();AG();P_();E_();ho();C_=(t,e,r)=>{let n=I_(),{command:i,escapedCommand:o}=aG(t,e),s=FO(r,"verbose"),a=EG(s,o,{...r});return $G(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var CG=v((J7e,PG)=>{PG.exports=IG;IG.sync=ebe;var OG=He("fs");function Q_e(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{MG.exports=NG;NG.sync=tbe;var DG=He("fs");function NG(t,e,r){DG.stat(t,function(n,i){r(n,n?!1:jG(i,e))})}function tbe(t,e){return jG(DG.statSync(t),e)}function jG(t,e){return t.isFile()&&rbe(t,e)}function rbe(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 zG=v((Q7e,LG)=>{var X7e=He("fs"),D_;process.platform==="win32"||global.TESTING_WINDOWS?D_=CG():D_=FG();LG.exports=ZO;ZO.sync=nbe;function ZO(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){ZO(t,e||{},function(o,s){o?i(o):n(s)})})}D_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function nbe(t,e){try{return D_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var VG=v((eQe,ZG)=>{var ul=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",UG=He("path"),ibe=ul?";":":",qG=zG(),BG=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),HG=(t,e)=>{let r=e.colon||ibe,n=t.match(/\//)||ul&&t.match(/\\/)?[""]:[...ul?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=ul?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=ul?i.split(r):[""];return ul&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},GG=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=HG(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(BG(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=UG.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];qG(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)},obe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=HG(t,e),o=[];for(let s=0;s{"use strict";var WG=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};VO.exports=WG;VO.exports.default=WG});var QG=v((rQe,XG)=>{"use strict";var JG=He("path"),sbe=VG(),abe=KG();function YG(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=sbe.sync(t.command,{path:r[abe({env:r})],pathExt:e?JG.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=JG.resolve(i?t.options.cwd:"",s)),s}function cbe(t){return YG(t)||YG(t,!0)}XG.exports=cbe});var eZ=v((nQe,KO)=>{"use strict";var WO=/([()\][%!^"`<>&|;, *?])/g;function lbe(t){return t=t.replace(WO,"^$1"),t}function ube(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(WO,"^$1"),e&&(t=t.replace(WO,"^$1")),t}KO.exports.command=lbe;KO.exports.argument=ube});var rZ=v((iQe,tZ)=>{"use strict";tZ.exports=/^#!(.*)/});var iZ=v((oQe,nZ)=>{"use strict";var dbe=rZ();nZ.exports=(t="")=>{let e=t.match(dbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var sZ=v((sQe,oZ)=>{"use strict";var JO=He("fs"),fbe=iZ();function pbe(t){let r=Buffer.alloc(150),n;try{n=JO.openSync(t,"r"),JO.readSync(n,r,0,150,0),JO.closeSync(n)}catch{}return fbe(r.toString())}oZ.exports=pbe});var uZ=v((aQe,lZ)=>{"use strict";var mbe=He("path"),aZ=QG(),cZ=eZ(),hbe=sZ(),gbe=process.platform==="win32",ybe=/\.(?:com|exe)$/i,_be=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function bbe(t){t.file=aZ(t);let e=t.file&&hbe(t.file);return e?(t.args.unshift(t.file),t.command=e,aZ(t)):t.file}function vbe(t){if(!gbe)return t;let e=bbe(t),r=!ybe.test(e);if(t.options.forceShell||r){let n=_be.test(e);t.command=mbe.normalize(t.command),t.command=cZ.command(t.command),t.args=t.args.map(o=>cZ.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 Sbe(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:vbe(n)}lZ.exports=Sbe});var pZ=v((cQe,fZ)=>{"use strict";var YO=process.platform==="win32";function XO(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 wbe(t,e){if(!YO)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=dZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function dZ(t,e){return YO&&t===1&&!e.file?XO(e.original,"spawn"):null}function xbe(t,e){return YO&&t===1&&!e.file?XO(e.original,"spawnSync"):null}fZ.exports={hookChildProcess:wbe,verifyENOENT:dZ,verifyENOENTSync:xbe,notFoundError:XO}});var gZ=v((lQe,dl)=>{"use strict";var mZ=He("child_process"),QO=uZ(),eR=pZ();function hZ(t,e,r){let n=QO(t,e,r),i=mZ.spawn(n.command,n.args,n.options);return eR.hookChildProcess(i,n),i}function $be(t,e,r){let n=QO(t,e,r),i=mZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||eR.verifyENOENTSync(i.status,n),i}dl.exports=hZ;dl.exports.spawn=hZ;dl.exports.sync=$be;dl.exports._parse=QO;dl.exports._enoent=eR});function N_(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 yZ=y(()=>{});var _Z=y(()=>{});import{promisify as kbe}from"node:util";import{execFile as Ebe,execFileSync as mQe}from"node:child_process";import bZ from"node:path";import{fileURLToPath as Abe}from"node:url";function j_(t){return t instanceof URL?Abe(t):t}function vZ(t){return{*[Symbol.iterator](){let e=bZ.resolve(j_(t)),r;for(;r!==e;)yield e,r=e,e=bZ.resolve(e,"..")}}}var yQe,_Qe,SZ=y(()=>{_Z();yQe=kbe(Ebe);_Qe=10*1024*1024});import M_ from"node:process";import Sa from"node:path";var Tbe,Obe,Rbe,wZ,xZ=y(()=>{yZ();SZ();Tbe=({cwd:t=M_.cwd(),path:e=M_.env[N_()],preferLocal:r=!0,execPath:n=M_.execPath,addExecPath:i=!0}={})=>{let o=Sa.resolve(j_(t)),s=[],a=e.split(Sa.delimiter);return r&&Obe(s,a,o),i&&Rbe(s,a,n,o),e===""||e===Sa.delimiter?`${s.join(Sa.delimiter)}${e}`:[...s,e].join(Sa.delimiter)},Obe=(t,e,r)=>{for(let n of vZ(r)){let i=Sa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Rbe=(t,e,r,n)=>{let i=Sa.resolve(n,j_(r),"..");e.includes(i)||t.push(i)},wZ=({env:t=M_.env,...e}={})=>{t={...t};let r=N_({env:t});return e.path=t[r],t[r]=Tbe(e),t}});var $Z,Kn,kZ,EZ,AZ,F_,Of,Rf,wa=y(()=>{$Z=(t,e,r)=>{let n=r?Rf:Of,i=t instanceof Kn?{}:{cause:t};return new n(e,i)},Kn=class extends Error{},kZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,AZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},EZ=t=>F_(t)&&AZ in t,AZ=Symbol("isExecaError"),F_=t=>Object.prototype.toString.call(t)==="[object Error]",Of=class extends Error{};kZ(Of,Of.name);Rf=class extends Error{};kZ(Rf,Rf.name)});var TZ,Ibe,OZ,RZ,IZ=y(()=>{TZ=()=>{let t=RZ-OZ+1;return Array.from({length:t},Ibe)},Ibe=(t,e)=>({name:`SIGRT${e+1}`,number:OZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),OZ=34,RZ=64});var PZ,CZ=y(()=>{PZ=[{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 Pbe}from"node:os";var tR,Cbe,DZ=y(()=>{CZ();IZ();tR=()=>{let t=TZ();return[...PZ,...t].map(Cbe)},Cbe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Pbe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as Dbe}from"node:os";var Nbe,jbe,NZ,Mbe,Fbe,Lbe,NQe,jZ=y(()=>{DZ();Nbe=()=>{let t=tR();return Object.fromEntries(t.map(jbe))},jbe=({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}],NZ=Nbe(),Mbe=()=>{let t=tR(),e=65,r=Array.from({length:e},(n,i)=>Fbe(i,t));return Object.assign({},...r)},Fbe=(t,e)=>{let r=Lbe(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}}},Lbe=(t,e)=>{let r=e.find(({name:n})=>Dbe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},NQe=Mbe()});import{constants as If}from"node:os";var FZ,LZ,zZ,zbe,Ube,MZ,qbe,rR,Bbe,Hbe,L_,Pf=y(()=>{jZ();FZ=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return zZ(t,e)},LZ=t=>t===0?t:zZ(t,"`subprocess.kill()`'s argument"),zZ=(t,e)=>{if(Number.isInteger(t))return zbe(t,e);if(typeof t=="string")return qbe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${rR()}`)},zbe=(t,e)=>{if(MZ.has(t))return MZ.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${rR()}`)},Ube=()=>new Map(Object.entries(If.signals).reverse().map(([t,e])=>[e,t])),MZ=Ube(),qbe=(t,e)=>{if(t in If.signals)return t;throw t.toUpperCase()in If.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${rR()}`)},rR=()=>`Available signal names: ${Bbe()}. -Available signal numbers: ${Hbe()}.`,Bbe=()=>Object.keys(If.signals).sort().map(t=>`'${t}'`).join(", "),Hbe=()=>[...new Set(Object.values(If.signals).sort((t,e)=>t-e))].join(", "),L_=t=>NZ[t].description});import{setTimeout as Gbe}from"node:timers/promises";var UZ,Zbe,qZ,Vbe,Wbe,Kbe,nR,z_=y(()=>{wa();Pf();UZ=t=>{if(t===!1)return t;if(t===!0)return Zbe;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},Zbe=1e3*5,qZ=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Vbe(s,a,r);Wbe(l,n);let u=t(c);return Kbe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Vbe=(t,e,r)=>{let[n=r,i]=F_(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&&!F_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:LZ(n),error:i}},Wbe=(t,e)=>{t!==void 0&&e.reject(t)},Kbe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&nR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},nR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Gbe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Jbe}from"node:events";var U_,iR=y(()=>{U_=async(t,e)=>{t.aborted||await Jbe(t,"abort",{signal:e})}});var BZ,HZ,Ybe,oR=y(()=>{iR();BZ=({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)}`)},HZ=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Ybe(t,e,n,i)],Ybe=async(t,e,r,{signal:n})=>{throw await U_(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var fl,Xbe,sR,GZ,ZZ,q_,VZ,WZ,KZ,JZ,YZ,XZ,Qbe,eve,tve,Jn,rve,os,pl,ml=y(()=>{fl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Xbe(t,e,r),sR(t,e,n)},Xbe=(t,e,r)=>{if(!r)throw new Error(`${Jn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},sR=(t,e,r)=>{if(!r)throw new Error(`${Jn(t,e)} cannot be used: the ${os(e)} has already exited or disconnected.`)},GZ=t=>{throw new Error(`${Jn("getOneMessage",t)} could not complete: the ${os(t)} exited or disconnected.`)},ZZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${os(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as pbe}from"node:util";var Ti,mbe,hbe,gbe,U_,ybe,hl=y(()=>{M_();NG();MG();Ti=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=mbe({type:t,result:i,verboseInfo:n}),s=hbe(e,o),a=jG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},mbe=({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}),hbe=(t,e)=>t.split(` +`).map(r=>gbe({...e,message:r})),gbe=t=>({verboseLine:DG(t),verboseObject:t}),U_=t=>{let e=typeof t=="string"?t:pbe(t);return Nf(e).replaceAll(" "," ".repeat(ybe))},ybe=2});var FG,LG=y(()=>{ss();hl();FG=(t,e)=>{pl(e)&&Ti({type:"command",verboseMessage:t,verboseInfo:e})}});var zG,_be,bbe,vbe,UG=y(()=>{ss();zG=(t,e,r)=>{vbe(t);let n=_be(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},_be=t=>pl({verbose:t})?bbe++:void 0,bbe=0n,vbe=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(!j_.includes(e)&&!N_(e)){let r=j_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as qG}from"node:process";var q_,oR,B_=y(()=>{q_=()=>qG.bigint(),oR=t=>Number(qG.bigint()-t)/1e6});var H_,sR=y(()=>{LG();UG();B_();M_();yo();H_=(t,e,r)=>{let n=q_(),{command:i,escapedCommand:o}=SG(t,e),s=QO(r,"verbose"),a=zG(s,o,{...r});return FG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var VG=v((kQe,ZG)=>{ZG.exports=GG;GG.sync=wbe;var BG=He("fs");function Sbe(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{YG.exports=KG;KG.sync=xbe;var WG=He("fs");function KG(t,e,r){WG.stat(t,function(n,i){r(n,n?!1:JG(i,e))})}function xbe(t,e){return JG(WG.statSync(t),e)}function JG(t,e){return t.isFile()&&$be(t,e)}function $be(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 eZ=v((TQe,QG)=>{var AQe=He("fs"),G_;process.platform==="win32"||global.TESTING_WINDOWS?G_=VG():G_=XG();QG.exports=aR;aR.sync=kbe;function aR(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){aR(t,e||{},function(o,s){o?i(o):n(s)})})}G_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function kbe(t,e){try{return G_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var aZ=v((OQe,sZ)=>{var gl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",tZ=He("path"),Ebe=gl?";":":",rZ=eZ(),nZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),iZ=(t,e)=>{let r=e.colon||Ebe,n=t.match(/\//)||gl&&t.match(/\\/)?[""]:[...gl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=gl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=gl?i.split(r):[""];return gl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},oZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=iZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(nZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=tZ.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];rZ(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)},Abe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=iZ(t,e),o=[];for(let s=0;s{"use strict";var cZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};cR.exports=cZ;cR.exports.default=cZ});var pZ=v((IQe,fZ)=>{"use strict";var uZ=He("path"),Tbe=aZ(),Obe=lZ();function dZ(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=Tbe.sync(t.command,{path:r[Obe({env:r})],pathExt:e?uZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=uZ.resolve(i?t.options.cwd:"",s)),s}function Rbe(t){return dZ(t)||dZ(t,!0)}fZ.exports=Rbe});var mZ=v((PQe,uR)=>{"use strict";var lR=/([()\][%!^"`<>&|;, *?])/g;function Ibe(t){return t=t.replace(lR,"^$1"),t}function Pbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(lR,"^$1"),e&&(t=t.replace(lR,"^$1")),t}uR.exports.command=Ibe;uR.exports.argument=Pbe});var gZ=v((CQe,hZ)=>{"use strict";hZ.exports=/^#!(.*)/});var _Z=v((DQe,yZ)=>{"use strict";var Cbe=gZ();yZ.exports=(t="")=>{let e=t.match(Cbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var vZ=v((NQe,bZ)=>{"use strict";var dR=He("fs"),Dbe=_Z();function Nbe(t){let r=Buffer.alloc(150),n;try{n=dR.openSync(t,"r"),dR.readSync(n,r,0,150,0),dR.closeSync(n)}catch{}return Dbe(r.toString())}bZ.exports=Nbe});var $Z=v((jQe,xZ)=>{"use strict";var jbe=He("path"),SZ=pZ(),wZ=mZ(),Mbe=vZ(),Fbe=process.platform==="win32",Lbe=/\.(?:com|exe)$/i,zbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Ube(t){t.file=SZ(t);let e=t.file&&Mbe(t.file);return e?(t.args.unshift(t.file),t.command=e,SZ(t)):t.file}function qbe(t){if(!Fbe)return t;let e=Ube(t),r=!Lbe.test(e);if(t.options.forceShell||r){let n=zbe.test(e);t.command=jbe.normalize(t.command),t.command=wZ.command(t.command),t.args=t.args.map(o=>wZ.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 Bbe(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:qbe(n)}xZ.exports=Bbe});var AZ=v((MQe,EZ)=>{"use strict";var fR=process.platform==="win32";function pR(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 Hbe(t,e){if(!fR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=kZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function kZ(t,e){return fR&&t===1&&!e.file?pR(e.original,"spawn"):null}function Gbe(t,e){return fR&&t===1&&!e.file?pR(e.original,"spawnSync"):null}EZ.exports={hookChildProcess:Hbe,verifyENOENT:kZ,verifyENOENTSync:Gbe,notFoundError:pR}});var RZ=v((FQe,yl)=>{"use strict";var TZ=He("child_process"),mR=$Z(),hR=AZ();function OZ(t,e,r){let n=mR(t,e,r),i=TZ.spawn(n.command,n.args,n.options);return hR.hookChildProcess(i,n),i}function Zbe(t,e,r){let n=mR(t,e,r),i=TZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||hR.verifyENOENTSync(i.status,n),i}yl.exports=OZ;yl.exports.spawn=OZ;yl.exports.sync=Zbe;yl.exports._parse=mR;yl.exports._enoent=hR});function Z_(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 IZ=y(()=>{});var PZ=y(()=>{});import{promisify as Vbe}from"node:util";import{execFile as Wbe,execFileSync as BQe}from"node:child_process";import CZ from"node:path";import{fileURLToPath as Kbe}from"node:url";function V_(t){return t instanceof URL?Kbe(t):t}function DZ(t){return{*[Symbol.iterator](){let e=CZ.resolve(V_(t)),r;for(;r!==e;)yield e,r=e,e=CZ.resolve(e,"..")}}}var ZQe,VQe,NZ=y(()=>{PZ();ZQe=Vbe(Wbe);VQe=10*1024*1024});import W_ from"node:process";import xa from"node:path";var Jbe,Ybe,Xbe,jZ,MZ=y(()=>{IZ();NZ();Jbe=({cwd:t=W_.cwd(),path:e=W_.env[Z_()],preferLocal:r=!0,execPath:n=W_.execPath,addExecPath:i=!0}={})=>{let o=xa.resolve(V_(t)),s=[],a=e.split(xa.delimiter);return r&&Ybe(s,a,o),i&&Xbe(s,a,n,o),e===""||e===xa.delimiter?`${s.join(xa.delimiter)}${e}`:[...s,e].join(xa.delimiter)},Ybe=(t,e,r)=>{for(let n of DZ(r)){let i=xa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Xbe=(t,e,r,n)=>{let i=xa.resolve(n,V_(r),"..");e.includes(i)||t.push(i)},jZ=({env:t=W_.env,...e}={})=>{t={...t};let r=Z_({env:t});return e.path=t[r],t[r]=Jbe(e),t}});var FZ,Xn,LZ,zZ,UZ,K_,jf,Mf,$a=y(()=>{FZ=(t,e,r)=>{let n=r?Mf:jf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},LZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,UZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},zZ=t=>K_(t)&&UZ in t,UZ=Symbol("isExecaError"),K_=t=>Object.prototype.toString.call(t)==="[object Error]",jf=class extends Error{};LZ(jf,jf.name);Mf=class extends Error{};LZ(Mf,Mf.name)});var qZ,Qbe,BZ,HZ,GZ=y(()=>{qZ=()=>{let t=HZ-BZ+1;return Array.from({length:t},Qbe)},Qbe=(t,e)=>({name:`SIGRT${e+1}`,number:BZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),BZ=34,HZ=64});var ZZ,VZ=y(()=>{ZZ=[{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 eve}from"node:os";var gR,tve,WZ=y(()=>{VZ();GZ();gR=()=>{let t=qZ();return[...ZZ,...t].map(tve)},tve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=eve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as rve}from"node:os";var nve,ive,KZ,ove,sve,ave,det,JZ=y(()=>{WZ();nve=()=>{let t=gR();return Object.fromEntries(t.map(ive))},ive=({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}],KZ=nve(),ove=()=>{let t=gR(),e=65,r=Array.from({length:e},(n,i)=>sve(i,t));return Object.assign({},...r)},sve=(t,e)=>{let r=ave(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}}},ave=(t,e)=>{let r=e.find(({name:n})=>rve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},det=ove()});import{constants as Ff}from"node:os";var XZ,QZ,e9,cve,lve,YZ,uve,yR,dve,fve,J_,Lf=y(()=>{JZ();XZ=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return e9(t,e)},QZ=t=>t===0?t:e9(t,"`subprocess.kill()`'s argument"),e9=(t,e)=>{if(Number.isInteger(t))return cve(t,e);if(typeof t=="string")return uve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${yR()}`)},cve=(t,e)=>{if(YZ.has(t))return YZ.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${yR()}`)},lve=()=>new Map(Object.entries(Ff.signals).reverse().map(([t,e])=>[e,t])),YZ=lve(),uve=(t,e)=>{if(t in Ff.signals)return t;throw t.toUpperCase()in Ff.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${yR()}`)},yR=()=>`Available signal names: ${dve()}. +Available signal numbers: ${fve()}.`,dve=()=>Object.keys(Ff.signals).sort().map(t=>`'${t}'`).join(", "),fve=()=>[...new Set(Object.values(Ff.signals).sort((t,e)=>t-e))].join(", "),J_=t=>KZ[t].description});import{setTimeout as pve}from"node:timers/promises";var t9,mve,r9,hve,gve,yve,_R,Y_=y(()=>{$a();Lf();t9=t=>{if(t===!1)return t;if(t===!0)return mve;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},mve=1e3*5,r9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=hve(s,a,r);gve(l,n);let u=t(c);return yve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},hve=(t,e,r)=>{let[n=r,i]=K_(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&&!K_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:QZ(n),error:i}},gve=(t,e)=>{t!==void 0&&e.reject(t)},yve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&_R({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},_R=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await pve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as _ve}from"node:events";var X_,bR=y(()=>{X_=async(t,e)=>{t.aborted||await _ve(t,"abort",{signal:e})}});var n9,i9,bve,vR=y(()=>{bR();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?[]:[bve(t,e,n,i)],bve=async(t,e,r,{signal:n})=>{throw await X_(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var _l,vve,SR,o9,s9,Q_,a9,c9,l9,u9,d9,f9,Sve,wve,xve,Qn,$ve,as,bl,vl=y(()=>{_l=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{vve(t,e,r),SR(t,e,n)},vve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},SR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${as(e)} has already exited or disconnected.`)},o9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${as(t)} exited or disconnected.`)},s9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(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([ - ${Jn("getOneMessage",t)}, - ${Jn("sendMessage",t,"message, {strict: true}")}, -]);`)},q_=(t,e)=>new Error(`${Jn("sendMessage",e)} failed when sending an acknowledgment response to the ${os(e)}.`,{cause:t}),VZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${os(t)} is not listening to incoming messages.`)},WZ=t=>{throw new Error(`${Jn("sendMessage",t)} failed: the ${os(t)} exited without listening to incoming messages.`)},KZ=()=>new Error(`\`cancelSignal\` aborted: the ${os(!0)} disconnected.`),JZ=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},YZ=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Jn(e,r)} cannot be used: the ${os(r)} is disconnecting.`,{cause:t})},XZ=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Qbe(t))throw new Error(`${Jn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Qbe=({code:t,message:e})=>eve.has(t)||tve.some(r=>e.includes(r)),eve=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),tve=["could not be cloned","circular structure","call stack size exceeded"],Jn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${rve(e)}${t}(${r})`,rve=t=>t?"":"subprocess.",os=t=>t?"parent process":"subprocess",pl=t=>{t.connected&&t.disconnect()}});var Ai,hl=y(()=>{Ai=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var H_,gl,Ti,QZ,nve,ive,e9,ove,t9,Cf,B_,ss=y(()=>{ho();H_=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ti.get(t),o=QZ(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(e9(o,e,n,!0));return s},gl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ti.get(t),o=QZ(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(e9(o,e,n,!1));return s},Ti=new WeakMap,QZ=(t,e,r)=>{let n=nve(e,r);return ive(n,e,r,t),n},nve=(t,e)=>{let r=LO(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(`"${Cf(e)}" must not be "${t}". + ${Qn("getOneMessage",t)}, + ${Qn("sendMessage",t,"message, {strict: true}")}, +]);`)},Q_=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${as(e)}.`,{cause:t}),a9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is not listening to incoming messages.`)},c9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} exited without listening to incoming messages.`)},l9=()=>new Error(`\`cancelSignal\` aborted: the ${as(!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(`${Qn(e,r)} cannot be used: the ${as(r)} is disconnecting.`,{cause:t})},f9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Sve(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Sve=({code:t,message:e})=>wve.has(t)||xve.some(r=>e.includes(r)),wve=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),xve=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${$ve(e)}${t}(${r})`,$ve=t=>t?"":"subprocess.",as=t=>t?"parent process":"subprocess",bl=t=>{t.connected&&t.disconnect()}});var Oi,Sl=y(()=>{Oi=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var tb,wl,Ri,p9,kve,Eve,m9,Ave,h9,zf,eb,cs=y(()=>{yo();tb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=p9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(m9(o,e,n,!0));return s},wl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ri.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},Ri=new WeakMap,p9=(t,e,r)=>{let n=kve(e,r);return Eve(n,e,r,t),n},kve=(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(`"${zf(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},ive=(t,e,r,n)=>{let i=n[t9(t)];if(i===void 0)throw new TypeError(`"${Cf(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(`"${Cf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Cf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},e9=(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}=ove(t,r);return`The "${i}: ${B_(o)}" option is incompatible with using "${Cf(n)}: ${B_(e)}". -Please set this option with "pipe" instead.`},ove=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=t9(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]}},t9=t=>t==="all"?1:t,Cf=t=>t?"to":"from",B_=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as sve}from"node:events";var xa,G_=y(()=>{xa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),sve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Z_,aR,V_,cR,r9,n9,Df=y(()=>{Z_=(t,e)=>{e&&aR(t)},aR=t=>{t.refCounted()},V_=(t,e)=>{e&&cR(t)},cR=t=>{t.unrefCounted()},r9=(t,e)=>{e&&(cR(t),cR(t))},n9=(t,e)=>{e&&(aR(t),aR(t))}});import{once as ave}from"node:events";import{scheduler as cve}from"node:timers/promises";var i9,o9,W_,s9=y(()=>{J_();Df();K_();Y_();i9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(c9(i)||u9(i))return;W_.has(t)||W_.set(t,[]);let o=W_.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await l9(t,n,i),await cve.yield();let s=await a9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},o9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{lR();let o=W_.get(t);for(;o?.length>0;)await ave(n,"message:done");t.removeListener("message",i),n9(e,r),n.connected=!1,n.emit("disconnect")},W_=new WeakMap});import{EventEmitter as lve}from"node:events";var as,X_,uve,Q_,Nf=y(()=>{s9();Df();as=(t,e,r)=>{if(X_.has(t))return X_.get(t);let n=new lve;return n.connected=!0,X_.set(t,n),uve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},X_=new WeakMap,uve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=i9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",o9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),r9(r,n)},Q_=t=>{let e=X_.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as dve}from"node:events";var d9,fve,f9,a9,c9,p9,eb,pve,tb,m9,K_=y(()=>{hl();G_();ib();ml();Nf();J_();d9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=as(t,e,r),s=rb(t,o);return{id:fve++,type:tb,message:n,hasListeners:s}},fve=0n,f9=(t,e)=>{if(!(e?.type!==tb||e.hasListeners))for(let{id:r}of t)r!==void 0&&eb[r].resolve({isDeadlock:!0,hasListeners:!1})},a9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==tb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:m9,message:rb(e,i)};try{await nb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},c9=t=>{if(t?.type!==m9)return!1;let{id:e,message:r}=t;return eb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},p9=async(t,e,r)=>{if(t?.type!==tb)return;let n=Ai();eb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,pve(e,r,i)]);o&&ZZ(r),s||VZ(r)}finally{i.abort(),delete eb[t.id]}},eb={},pve=async(t,e,{signal:r})=>{xa(t,1,r),await dve(t,"disconnect",{signal:r}),WZ(e)},tb="execa:ipc:request",m9="execa:ipc:response"});var h9,g9,l9,jf,rb,mve,J_=y(()=>{hl();ho();ss();K_();h9=(t,e,r)=>{jf.has(t)||jf.set(t,new Set);let n=jf.get(t),i=Ai(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},g9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},l9=async(t,e,r)=>{for(;!rb(t,e)&&jf.get(t)?.size>0;){let n=[...jf.get(t)];f9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},jf=new WeakMap,rb=(t,e)=>e.listenerCount("message")>mve(t),mve=t=>Ti.has(t)&&!mo(Ti.get(t).options.buffer,"ipc")?1:0});import{promisify as hve}from"node:util";var nb,gve,dR,yve,uR,ib=y(()=>{ml();J_();K_();nb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return fl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),gve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},gve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=d9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=h9(t,s,o);try{await dR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw pl(t),c}finally{g9(a)}},dR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=yve(t);try{await Promise.all([p9(n,t,r),o(n)])}catch(s){throw YZ({error:s,methodName:e,isSubprocess:r}),XZ({error:s,methodName:e,isSubprocess:r,message:i}),s}},yve=t=>{if(uR.has(t))return uR.get(t);let e=hve(t.send.bind(t));return uR.set(t,e),e},uR=new WeakMap});import{scheduler as _ve}from"node:timers/promises";var _9,b9,bve,y9,u9,v9,lR,fR,Y_=y(()=>{ib();Nf();ml();_9=(t,e)=>{let r="cancelSignal";return sR(r,!1,t.connected),dR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:v9,message:e},message:e})},b9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await bve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),fR.signal),bve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!y9){if(y9=!0,!n){JZ();return}if(e===null){lR();return}as(t,e,r),await _ve.yield()}},y9=!1,u9=t=>t?.type!==v9?!1:(fR.abort(t.message),!0),v9="execa:ipc:cancel",lR=()=>{fR.abort(KZ())},fR=new AbortController});var S9,w9,vve,Sve,pR=y(()=>{iR();Y_();z_();S9=({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.")}},w9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[vve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],vve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await U_(e,i);let o=Sve(e);throw await _9(t,o),nR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Sve=({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 wve}from"node:timers/promises";var x9,$9,xve,mR=y(()=>{wa();x9=({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})`)},$9=(t,e,r,n)=>e===0||e===void 0?[]:[xve(t,e,r,n)],xve=async(t,e,r,{signal:n})=>{throw await wve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Kn}});import{execPath as $ve,execArgv as kve}from"node:process";import k9 from"node:path";var E9,A9,hR=y(()=>{sl();E9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},A9=(t,e,{node:r=!1,nodePath:n=$ve,nodeOptions:i=kve.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=k9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(k9.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 Eve}from"node:v8";var T9,Ave,Tve,Ove,O9,gR=y(()=>{T9=({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`.");Ove[r](t)}},Ave=t=>{try{Eve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},Tve=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},Ove={advanced:Ave,json:Tve},O9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var I9,Rve,rn,yR,Ive,R9,ob,$a=y(()=>{I9=({encoding:t})=>{if(yR.has(t))return;let e=Ive(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${ob(t)}\`. -Please rename it to ${ob(e)}.`);let r=[...yR].map(n=>ob(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${ob(t)}\`. -Please rename it to one of: ${r}.`)},Rve=new Set(["utf8","utf16le"]),rn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),yR=new Set([...Rve,...rn]),Ive=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in R9)return R9[e];if(yR.has(e))return e},R9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},ob=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as Pve}from"node:fs";import Cve from"node:path";import Dve from"node:process";var P9,C9,D9,_R=y(()=>{sl();P9=(t=C9())=>{let e=ol(t,'The "cwd" option');return Cve.resolve(e)},C9=()=>{try{return Dve.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},D9=(t,e)=>{if(e===C9())return t;let r;try{r=Pve(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},Eve=(t,e,r,n)=>{let i=n[h9(t)];if(i===void 0)throw new TypeError(`"${zf(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(`"${zf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${zf(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}=Ave(t,r);return`The "${i}: ${eb(o)}" option is incompatible with using "${zf(n)}: ${eb(e)}". +Please set this option with "pipe" instead.`},Ave=(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,zf=t=>t?"to":"from",eb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Tve}from"node:events";var ka,rb=y(()=>{ka=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Tve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var nb,wR,ib,xR,g9,y9,Uf=y(()=>{nb=(t,e)=>{e&&wR(t)},wR=t=>{t.refCounted()},ib=(t,e)=>{e&&xR(t)},xR=t=>{t.unrefCounted()},g9=(t,e)=>{e&&(xR(t),xR(t))},y9=(t,e)=>{e&&(wR(t),wR(t))}});import{once as Ove}from"node:events";import{scheduler as Rve}from"node:timers/promises";var _9,b9,ob,v9=y(()=>{ab();Uf();sb();cb();_9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(w9(i)||$9(i))return;ob.has(t)||ob.set(t,[]);let o=ob.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await x9(t,n,i),await Rve.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})=>{$R();let o=ob.get(t);for(;o?.length>0;)await Ove(n,"message:done");t.removeListener("message",i),y9(e,r),n.connected=!1,n.emit("disconnect")},ob=new WeakMap});import{EventEmitter as Ive}from"node:events";var ls,lb,Pve,ub,qf=y(()=>{v9();Uf();ls=(t,e,r)=>{if(lb.has(t))return lb.get(t);let n=new Ive;return n.connected=!0,lb.set(t,n),Pve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},lb=new WeakMap,Pve=({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)},ub=t=>{let e=lb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Cve}from"node:events";var k9,Dve,E9,S9,w9,A9,db,Nve,fb,T9,sb=y(()=>{Sl();rb();hb();vl();qf();ab();k9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ls(t,e,r),s=pb(t,o);return{id:Dve++,type:fb,message:n,hasListeners:s}},Dve=0n,E9=(t,e)=>{if(!(e?.type!==fb||e.hasListeners))for(let{id:r}of t)r!==void 0&&db[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:pb(e,i)};try{await mb({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 db[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},A9=async(t,e,r)=>{if(t?.type!==fb)return;let n=Oi();db[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,Nve(e,r,i)]);o&&s9(r),s||a9(r)}finally{i.abort(),delete db[t.id]}},db={},Nve=async(t,e,{signal:r})=>{ka(t,1,r),await Cve(t,"disconnect",{signal:r}),c9(e)},fb="execa:ipc:request",T9="execa:ipc:response"});var O9,R9,x9,Bf,pb,jve,ab=y(()=>{Sl();yo();cs();sb();O9=(t,e,r)=>{Bf.has(t)||Bf.set(t,new Set);let n=Bf.get(t),i=Oi(),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(;!pb(t,e)&&Bf.get(t)?.size>0;){let n=[...Bf.get(t)];E9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Bf=new WeakMap,pb=(t,e)=>e.listenerCount("message")>jve(t),jve=t=>Ri.has(t)&&!go(Ri.get(t).options.buffer,"ipc")?1:0});import{promisify as Mve}from"node:util";var mb,Fve,ER,Lve,kR,hb=y(()=>{vl();ab();sb();mb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return _l({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),Fve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},Fve=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 ER({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw bl(t),c}finally{R9(a)}},ER=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Lve(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}},Lve=t=>{if(kR.has(t))return kR.get(t);let e=Mve(t.send.bind(t));return kR.set(t,e),e},kR=new WeakMap});import{scheduler as zve}from"node:timers/promises";var P9,C9,Uve,I9,$9,D9,$R,AR,cb=y(()=>{hb();qf();vl();P9=(t,e)=>{let r="cancelSignal";return SR(r,!1,t.connected),ER({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:D9,message:e},message:e})},C9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Uve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),AR.signal),Uve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!I9){if(I9=!0,!n){u9();return}if(e===null){$R();return}ls(t,e,r),await zve.yield()}},I9=!1,$9=t=>t?.type!==D9?!1:(AR.abort(t.message),!0),D9="execa:ipc:cancel",$R=()=>{AR.abort(l9())},AR=new AbortController});var N9,j9,qve,Bve,TR=y(()=>{bR();cb();Y_();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?[qve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],qve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await X_(e,i);let o=Bve(e);throw await P9(t,o),_R({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Bve=({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 Hve}from"node:timers/promises";var M9,F9,Gve,OR=y(()=>{$a();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?[]:[Gve(t,e,r,n)],Gve=async(t,e,r,{signal:n})=>{throw await Hve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as Zve,execArgv as Vve}from"node:process";import L9 from"node:path";var z9,U9,RR=y(()=>{fl();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=Zve,nodeOptions:i=Vve.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=dl(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 Wve}from"node:v8";var q9,Kve,Jve,Yve,B9,IR=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`.");Yve[r](t)}},Kve=t=>{try{Wve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},Jve=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},Yve={advanced:Kve,json:Jve},B9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var G9,Xve,nn,PR,Qve,H9,gb,Ea=y(()=>{G9=({encoding:t})=>{if(PR.has(t))return;let e=Qve(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${gb(t)}\`. +Please rename it to ${gb(e)}.`);let r=[...PR].map(n=>gb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${gb(t)}\`. +Please rename it to one of: ${r}.`)},Xve=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),PR=new Set([...Xve,...nn]),Qve=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in H9)return H9[e];if(PR.has(e))return e},H9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},gb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as eSe}from"node:fs";import tSe from"node:path";import rSe from"node:process";var Z9,V9,W9,CR=y(()=>{fl();Z9=(t=V9())=>{let e=dl(t,'The "cwd" option');return tSe.resolve(e)},V9=()=>{try{return rSe.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=eSe(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 Nve from"node:path";import N9 from"node:process";var j9,sb,jve,Mve,bR=y(()=>{j9=bt(gZ(),1);xZ();z_();Pf();oR();pR();mR();hR();gR();$a();_R();sl();ho();sb=(t,e,r)=>{r.cwd=P9(r.cwd);let[n,i,o]=A9(t,e,r),{command:s,args:a,options:c}=j9.default._parse(n,i,o),l=oG(c),u=jve(l);return x9(u),I9(u),T9(u),BZ(u),S9(u),u.shell=DO(u.shell),u.env=Mve(u),u.killSignal=FZ(u.killSignal),u.forceKillAfterDelay=UZ(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!rn.has(u.encoding)&&u.buffer[f]),N9.platform==="win32"&&Nve.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},jve=({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}),Mve=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...N9.env,...t}:t;return r||n?wZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var ab,vR=y(()=>{ab=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function yl(t){if(typeof t=="string")return Fve(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Lve(t)}var Fve,Lve,M9,zve,F9,Uve,SR=y(()=>{Fve=t=>t.at(-1)===M9?t.slice(0,t.at(-2)===F9?-2:-1):t,Lve=t=>t.at(-1)===zve?t.subarray(0,t.at(-2)===Uve?-2:-1):t,M9=` -`,zve=M9.codePointAt(0),F9="\r",Uve=F9.codePointAt(0)});function Yn(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 wR(t,{checkOpen:e=!0}={}){return Yn(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 ka(t,{checkOpen:e=!0}={}){return Yn(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 xR(t,e){return wR(t,e)&&ka(t,e)}var Ea=y(()=>{});function L9(){return this[kR].next()}function z9(t){return this[kR].return(t)}function ER({preventCancel:t=!1}={}){let e=this.getReader(),r=new $R(e,t),n=Object.create(Bve);return n[kR]=r,n}var qve,$R,kR,Bve,U9=y(()=>{qve=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),$R=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}}},kR=Symbol();Object.defineProperty(L9,"name",{value:"next"});Object.defineProperty(z9,"name",{value:"return"});Bve=Object.create(qve,{next:{enumerable:!0,configurable:!0,writable:!0,value:L9},return:{enumerable:!0,configurable:!0,writable:!0,value:z9}})});var q9=y(()=>{});var B9=y(()=>{U9();q9()});var H9,Hve,Gve,Zve,Mf,AR=y(()=>{Ea();B9();H9=t=>{if(ka(t,{checkOpen:!1})&&Mf.on!==void 0)return Gve(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Hve.call(t)==="[object ReadableStream]")return ER.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Hve}=Object.prototype,Gve=async function*(t){let e=new AbortController,r={};Zve(t,e,r);try{for await(let[n]of Mf.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()}},Zve=async(t,e,r)=>{try{await Mf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Mf={}});var _l,Vve,V9,G9,Wve,Z9,Oi,Ff=y(()=>{AR();_l=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=H9(t),u=e();u.length=0;try{for await(let d of l){let f=Wve(d),p=r[f](d,u);V9({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Vve({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}},Vve=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&V9({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},V9=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){G9(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&G9(c,e,i,o),new Oi},G9=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Wve=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=Z9.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&Z9.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:Z9}=Object.prototype,Oi=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var go,Lf,cb,lb,ub,db=y(()=>{go=t=>t,Lf=()=>{},cb=({contents:t})=>t,lb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},ub=t=>t.length});async function fb(t,e){return _l(t,Xve,e)}var Kve,Jve,Yve,Xve,W9=y(()=>{Ff();db();Kve=()=>({contents:[]}),Jve=()=>1,Yve=(t,{contents:e})=>(e.push(t),e),Xve={init:Kve,convertChunk:{string:go,buffer:go,arrayBuffer:go,dataView:go,typedArray:go,others:go},getSize:Jve,truncateChunk:Lf,addChunk:Yve,getFinalChunk:Lf,finalize:cb}});async function pb(t,e){return _l(t,aSe,e)}var Qve,eSe,tSe,K9,J9,rSe,nSe,iSe,oSe,X9,Y9,sSe,Q9,aSe,eV=y(()=>{Ff();db();Qve=()=>({contents:new ArrayBuffer(0)}),eSe=t=>tSe.encode(t),tSe=new TextEncoder,K9=t=>new Uint8Array(t),J9=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),rSe=(t,e)=>t.slice(0,e),nSe=(t,{contents:e,length:r},n)=>{let i=Q9()?oSe(e,n):iSe(e,n);return new Uint8Array(i).set(t,r),i},iSe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(X9(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},oSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:X9(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},X9=t=>Y9**Math.ceil(Math.log(t)/Math.log(Y9)),Y9=2,sSe=({contents:t,length:e})=>Q9()?t:t.slice(0,e),Q9=()=>"resize"in ArrayBuffer.prototype,aSe={init:Qve,convertChunk:{string:eSe,buffer:K9,arrayBuffer:K9,dataView:J9,typedArray:J9,others:lb},getSize:ub,truncateChunk:rSe,addChunk:nSe,getFinalChunk:Lf,finalize:sSe}});async function hb(t,e){return _l(t,fSe,e)}var cSe,mb,lSe,uSe,dSe,fSe,tV=y(()=>{Ff();db();cSe=()=>({contents:"",textDecoder:new TextDecoder}),mb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),lSe=(t,{contents:e})=>e+t,uSe=(t,e)=>t.slice(0,e),dSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},fSe={init:cSe,convertChunk:{string:go,buffer:mb,arrayBuffer:mb,dataView:mb,typedArray:mb,others:lb},getSize:ub,truncateChunk:uSe,addChunk:lSe,getFinalChunk:dSe,finalize:cb}});var rV=y(()=>{W9();eV();tV();Ff()});import{on as pSe}from"node:events";import{finished as mSe}from"node:stream/promises";var gb=y(()=>{AR();rV();Object.assign(Mf,{on:pSe,finished:mSe})});var nV,hSe,iV,oV,gSe,sV,aV,yb,Aa=y(()=>{gb();po();ho();nV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Oi))throw t;if(o==="all")return t;let s=hSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},hSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",iV=(t,e,r)=>{if(e.length!==r)return;let n=new Oi;throw n.maxBufferInfo={fdNumber:"ipc"},n},oV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=gSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},gSe=(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=mo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:x_(r),threshold:i,unit:n}},sV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>yb(r)),aV=(t,e,r)=>{if(!e)return t;let n=yb(r);return t.length>n?t.slice(0,n):t},yb=([,t])=>t});import{inspect as ySe}from"node:util";var lV,_Se,bSe,vSe,SSe,wSe,cV,uV=y(()=>{SR();tn();_R();E_();Aa();Pf();wa();lV=({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=_Se({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=vSe(n,b),w=x===void 0?"":` -${x}`,R=`${S}: ${a}${w}`,A=e===void 0?[t[2],t[1]]:[e],E=[R,...A,...t.slice(3),r.map(D=>SSe(D)).join(` -`)].map(D=>Tf(yl(wSe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:R,message:E}},_Se=({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=bSe(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?`${oV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${L_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},bSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",vSe=(t,e)=>{if(t instanceof Kn)return;let r=EZ(t)?t.originalMessage:String(t?.message??t),n=Tf(D9(r,e));return n===""?void 0:n},SSe=t=>typeof t=="string"?t:ySe(t),wSe=t=>Array.isArray(t)?t.map(e=>yl(cV(e))).filter(Boolean).join(` -`):cV(t),cV=t=>typeof t=="string"?t:Ft(t)?S_(t):""});var _b,bl,zf,xSe,dV,$Se,Uf=y(()=>{Pf();P_();wa();uV();_b=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>dV({command:t,escapedCommand:e,cwd:o,durationMs:HO(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:[]}),bl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>zf({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}),zf=({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}=$Se(l,u),{originalMessage:E,shortMessage:D,message:k}=lV({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:_}),B=$Z(t,k,x);return Object.assign(B,xSe({error:B,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:E,shortMessage:D})),B},xSe=({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})=>dV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:HO(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:[]}),dV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),$Se=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:L_(e);return{exitCode:r,signal:n,signalDescription:i}}});function kSe(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(fV(t*1e3)%1e3),nanoseconds:Math.trunc(fV(t*1e6)%1e3)}}function ESe(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 TR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return kSe(t);break}case"bigint":return ESe(t)}throw new TypeError("Expected a finite number or bigint")}var fV,pV=y(()=>{fV=t=>Number.isFinite(t)?t:0});function OR(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+OSe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ASe(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?" "+TSe(d,u):f;i.push(p)}},a=TR(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%RSe):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 ASe,TSe,OSe,RSe,mV=y(()=>{pV();ASe=t=>t===0||t===0n,TSe=(t,e)=>e===1||e===1n?t:`${t}s`,OSe=1e-7,RSe=24n*60n*60n*1000n});var hV,gV=y(()=>{ll();hV=(t,e)=>{t.failed&&Ei({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var yV,ISe,_V=y(()=>{mV();is();ll();gV();yV=(t,e)=>{al(e)&&(hV(t,e),ISe(t,e))},ISe=(t,e)=>{let r=`(done in ${OR(t.durationMs)})`;Ei({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var vl,bb=y(()=>{_V();vl=(t,e,{reject:r})=>{if(yV(t,e),t.failed&&r)throw t;return t}});var SV,PSe,CSe,wV,xV,bV,DSe,RR,vV,Ta,$V,NSe,vb,kV,jSe,MSe,IR,EV,FSe,AV,Sb,LSe,PR,zSe,USe,TV,En,wb,CR,OV,RV,cs,br=y(()=>{Ea();uo();tn();SV=(t,e)=>Ta(t)?"asyncGenerator":$V(t)?"generator":vb(t)?"fileUrl":jSe(t)?"filePath":LSe(t)?"webStream":Yn(t,{checkOpen:!1})?"native":Ft(t)?"uint8Array":zSe(t)?"asyncIterable":USe(t)?"iterable":PR(t)?wV({transform:t},e):NSe(t)?PSe(t,e):"native",PSe=(t,e)=>xR(t.transform,{checkOpen:!1})?CSe(t,e):PR(t.transform)?wV(t,e):DSe(t,e),CSe=(t,e)=>(xV(t,e,"Duplex stream"),"duplex"),wV=(t,e)=>(xV(t,e,"web TransformStream"),"webTransform"),xV=({final:t,binary:e,objectMode:r},n,i)=>{bV(t,`${n}.final`,i),bV(e,`${n}.binary`,i),RR(r,`${n}.objectMode`)},bV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},DSe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!vV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(xR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(PR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!vV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return RR(r,`${i}.binary`),RR(n,`${i}.objectMode`),Ta(t)||Ta(e)?"asyncGenerator":"generator"},RR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},vV=t=>Ta(t)||$V(t),Ta=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",$V=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",NSe=t=>At(t)&&(t.transform!==void 0||t.final!==void 0),vb=t=>Object.prototype.toString.call(t)==="[object URL]",kV=t=>vb(t)&&t.protocol!=="file:",jSe=t=>At(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>MSe.has(e))&&IR(t.file),MSe=new Set(["file","append"]),IR=t=>typeof t=="string",EV=(t,e)=>t==="native"&&typeof e=="string"&&!FSe.has(e),FSe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),AV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Sb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",LSe=t=>AV(t)||Sb(t),PR=t=>AV(t?.readable)&&Sb(t?.writable),zSe=t=>TV(t)&&typeof t[Symbol.asyncIterator]=="function",USe=t=>TV(t)&&typeof t[Symbol.iterator]=="function",TV=t=>typeof t=="object"&&t!==null,En=new Set(["generator","asyncGenerator","duplex","webTransform"]),wb=new Set(["fileUrl","filePath","fileNumber"]),CR=new Set(["fileUrl","filePath"]),OV=new Set([...CR,"webStream","nodeStream"]),RV=new Set(["webTransform","duplex"]),cs={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 DR,qSe,BSe,IV,NR=y(()=>{br();DR=(t,e,r,n)=>n==="output"?qSe(t,e,r):BSe(t,e,r),qSe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},BSe=(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}},IV=(t,e)=>{let r=t.findLast(({type:n})=>En.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var PV,HSe,GSe,ZSe,VSe,WSe,KSe,CV=y(()=>{uo();$a();br();NR();PV=(t,e,r,n)=>[...t.filter(({type:i})=>!En.has(i)),...HSe(t,e,r,n)],HSe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>En.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=GSe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return KSe(o,r)},GSe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?ZSe({stdioItem:t,optionName:i}):e==="webTransform"?VSe({stdioItem:t,index:r,newTransforms:n,direction:o}):WSe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),ZSe=({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}}},VSe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=At(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=DR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},WSe=({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}=At(e)?e:{transform:e},d=c||rn.has(o),{writableObjectMode:f,readableObjectMode:p}=DR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},KSe=(t,e)=>e==="input"?t.reverse():t});import jR from"node:process";var DV,JSe,YSe,Sl,MR,NV,XSe,QSe,jV=y(()=>{Ea();br();DV=(t,e,r)=>{let n=t.map(i=>JSe(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)??QSe},JSe=({type:t,value:e},r)=>YSe[r]??NV[t](e),YSe=["input","output","output"],Sl=()=>{},MR=()=>"input",NV={generator:Sl,asyncGenerator:Sl,fileUrl:Sl,filePath:Sl,iterable:MR,asyncIterable:MR,uint8Array:MR,webStream:t=>Sb(t)?"output":"input",nodeStream(t){return ka(t,{checkOpen:!1})?wR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Sl,duplex:Sl,native(t){let e=XSe(t);if(e!==void 0)return e;if(Yn(t,{checkOpen:!1}))return NV.nodeStream(t)}},XSe=t=>{if([0,jR.stdin].includes(t))return"input";if([1,2,jR.stdout,jR.stderr].includes(t))return"output"},QSe="output"});var MV,FV=y(()=>{MV=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var LV,ewe,twe,zV,rwe,nwe,UV=y(()=>{po();FV();is();LV=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=ewe(t,n).map((a,c)=>zV(a,c));return o?rwe(s,r,i):MV(s,e)},ewe=(t,e)=>{if(t===void 0)return kn.map(n=>e[n]);if(twe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${kn.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,kn.length);return Array.from({length:r},(n,i)=>t[i])},twe=t=>kn.some(e=>t[e]!==void 0),zV=(t,e)=>Array.isArray(t)?t.map(r=>zV(r,e)):t??(e>=kn.length?"ignore":"pipe"),rwe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!cl(r,i)&&nwe(n)?"ignore":n),nwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as iwe}from"node:fs";import owe from"node:tty";var BV,swe,awe,cwe,lwe,qV,HV=y(()=>{Ea();po();tn();ss();BV=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?swe({stdioItem:t,fdNumber:n,direction:i}):lwe({stdioItem:t,fdNumber:n}),swe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=awe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(Yn(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},awe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=cwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(owe.isatty(i))throw new TypeError(`The \`${e}: ${B_(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:fo(iwe(i)),optionName:e}}},cwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=w_.indexOf(t);if(r!==-1)return r},lwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:qV(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:qV(e,e,r),optionName:r}:Yn(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,qV=(t,e,r)=>{let n=w_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var GV,uwe,dwe,fwe,pwe,ZV=y(()=>{Ea();tn();br();GV=({input:t,inputFile:e},r)=>r===0?[...uwe(t),...fwe(e)]:[],uwe=t=>t===void 0?[]:[{type:dwe(t),value:t,optionName:"input"}],dwe=t=>{if(ka(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ft(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},fwe=t=>t===void 0?[]:[{...pwe(t),optionName:"inputFile"}],pwe=t=>{if(vb(t))return{type:"fileUrl",value:t};if(IR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var VV,WV,mwe,hwe,KV,gwe,ywe,JV,YV=y(()=>{br();VV=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),WV=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=mwe(i,t);if(s.length!==0){if(o){hwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(OV.has(t))return KV({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});RV.has(t)&&ywe({otherStdioItems:s,type:t,value:e,optionName:r})}},mwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),hwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{CR.has(e)&&KV({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},KV=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>gwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return JV(s,n,e),i==="output"?o[0].stream:void 0},gwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,ywe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);JV(i,n,e)},JV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${cs[r]} that is the same.`)}});var xb,_we,bwe,vwe,Swe,wwe,xwe,$we,kwe,Ewe,Awe,Twe,FR,Owe,$b=y(()=>{po();CV();NR();br();jV();UV();HV();ZV();YV();xb=(t,e,r,n)=>{let o=LV(e,r,n).map((a,c)=>_we({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Ewe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Owe(a)),s},_we=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=x_(e),{stdioItems:o,isStdioArray:s}=bwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=DV(o,e,i),c=o.map(d=>BV({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=PV(c,i,a,r),u=IV(l,a);return kwe(l,u),{direction:a,objectMode:u,stdioItems:l}},bwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>vwe(c,n)),...GV(r,e)],s=VV(o),a=s.length>1;return Swe(s,a,n),xwe(s),{stdioItems:s,isStdioArray:a}},vwe=(t,e)=>({type:SV(t,e),value:t,optionName:e}),Swe=(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(wwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},wwe=new Set(["ignore","ipc"]),xwe=t=>{for(let e of t)$we(e)},$we=({type:t,value:e,optionName:r})=>{if(kV(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(EV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},kwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>wb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Ewe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(Awe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw FR(i),o}},Awe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Twe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Twe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=WV({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},FR=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Wn(r)&&r.destroy()},Owe=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 XV}from"node:fs";var eW,Ri,Rwe,tW,QV,Iwe,rW=y(()=>{tn();$b();br();eW=(t,e)=>xb(Iwe,t,e,!0),Ri=({type:t,optionName:e})=>{tW(e,cs[t])},Rwe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&tW(t,`"${e}"`),{}),tW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},QV={generator(){},asyncGenerator:Ri,webStream:Ri,nodeStream:Ri,webTransform:Ri,duplex:Ri,asyncIterable:Ri,native:Rwe},Iwe={input:{...QV,fileUrl:({value:t})=>({contents:[fo(XV(t))]}),filePath:({value:{file:t}})=>({contents:[fo(XV(t))]}),fileNumber:Ri,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...QV,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Ri,string:Ri,uint8Array:Ri}}});var yo,LR,qf=y(()=>{SR();yo=(t,{stripFinalNewline:e},r)=>LR(e,r)&&t!==void 0&&!Array.isArray(t)?yl(t):t,LR=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var kb,UR,nW,iW,Pwe,Cwe,Dwe,oW,Nwe,zR,jwe,Mwe,Fwe,Eb=y(()=>{kb=(t,e,r,n)=>t||r?void 0:iW(e,n),UR=(t,e,r)=>r?t.flatMap(n=>nW(n,e)):nW(t,e),nW=(t,e)=>{let{transform:r,final:n}=iW(e,{});return[...r(t),...n()]},iW=(t,e)=>(e.previousChunks="",{transform:Pwe.bind(void 0,e,t),final:Dwe.bind(void 0,e)}),Pwe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=zR(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=zR(n,r.slice(i+1))),t.previousChunks=n},Cwe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),Dwe=function*({previousChunks:t}){t.length>0&&(yield t)},oW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:Nwe.bind(void 0,n)},Nwe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?jwe:Fwe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},zR=(t,e)=>`${t}${e}`,jwe={windowsNewline:`\r +${t}`}});import nSe from"node:path";import K9 from"node:process";var J9,yb,iSe,oSe,DR=y(()=>{J9=bt(RZ(),1);MZ();Y_();Lf();vR();TR();OR();RR();IR();Ea();CR();fl();yo();yb=(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=bG(c),u=iSe(l);return M9(u),G9(u),q9(u),n9(u),N9(u),u.shell=KO(u.shell),u.env=oSe(u),u.killSignal=XZ(u.killSignal),u.forceKillAfterDelay=t9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),K9.platform==="win32"&&nSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},iSe=({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}),oSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...K9.env,...t}:t;return r||n?jZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var _b,NR=y(()=>{_b=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function xl(t){if(typeof t=="string")return sSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return aSe(t)}var sSe,aSe,Y9,cSe,X9,lSe,jR=y(()=>{sSe=t=>t.at(-1)===Y9?t.slice(0,t.at(-2)===X9?-2:-1):t,aSe=t=>t.at(-1)===cSe?t.subarray(0,t.at(-2)===lSe?-2:-1):t,Y9=` +`,cSe=Y9.codePointAt(0),X9="\r",lSe=X9.codePointAt(0)});function ei(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 MR(t,{checkOpen:e=!0}={}){return ei(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 Aa(t,{checkOpen:e=!0}={}){return ei(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 FR(t,e){return MR(t,e)&&Aa(t,e)}var Ta=y(()=>{});function Q9(){return this[zR].next()}function eV(t){return this[zR].return(t)}function UR({preventCancel:t=!1}={}){let e=this.getReader(),r=new LR(e,t),n=Object.create(dSe);return n[zR]=r,n}var uSe,LR,zR,dSe,tV=y(()=>{uSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),LR=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}}},zR=Symbol();Object.defineProperty(Q9,"name",{value:"next"});Object.defineProperty(eV,"name",{value:"return"});dSe=Object.create(uSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:Q9},return:{enumerable:!0,configurable:!0,writable:!0,value:eV}})});var rV=y(()=>{});var nV=y(()=>{tV();rV()});var iV,fSe,pSe,mSe,Hf,qR=y(()=>{Ta();nV();iV=t=>{if(Aa(t,{checkOpen:!1})&&Hf.on!==void 0)return pSe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(fSe.call(t)==="[object ReadableStream]")return UR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:fSe}=Object.prototype,pSe=async function*(t){let e=new AbortController,r={};mSe(t,e,r);try{for await(let[n]of Hf.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()}},mSe=async(t,e,r)=>{try{await Hf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Hf={}});var $l,hSe,aV,oV,gSe,sV,Ii,Gf=y(()=>{qR();$l=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=iV(t),u=e();u.length=0;try{for await(let d of l){let f=gSe(d),p=r[f](d,u);aV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return hSe({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}},hSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&aV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},aV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){oV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&oV(c,e,i,o),new Ii},oV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},gSe=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=sV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&sV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:sV}=Object.prototype,Ii=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var _o,Zf,bb,vb,Sb,wb=y(()=>{_o=t=>t,Zf=()=>{},bb=({contents:t})=>t,vb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Sb=t=>t.length});async function xb(t,e){return $l(t,vSe,e)}var ySe,_Se,bSe,vSe,cV=y(()=>{Gf();wb();ySe=()=>({contents:[]}),_Se=()=>1,bSe=(t,{contents:e})=>(e.push(t),e),vSe={init:ySe,convertChunk:{string:_o,buffer:_o,arrayBuffer:_o,dataView:_o,typedArray:_o,others:_o},getSize:_Se,truncateChunk:Zf,addChunk:bSe,getFinalChunk:Zf,finalize:bb}});async function $b(t,e){return $l(t,OSe,e)}var SSe,wSe,xSe,lV,uV,$Se,kSe,ESe,ASe,fV,dV,TSe,pV,OSe,mV=y(()=>{Gf();wb();SSe=()=>({contents:new ArrayBuffer(0)}),wSe=t=>xSe.encode(t),xSe=new TextEncoder,lV=t=>new Uint8Array(t),uV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),$Se=(t,e)=>t.slice(0,e),kSe=(t,{contents:e,length:r},n)=>{let i=pV()?ASe(e,n):ESe(e,n);return new Uint8Array(i).set(t,r),i},ESe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(fV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},ASe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:fV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},fV=t=>dV**Math.ceil(Math.log(t)/Math.log(dV)),dV=2,TSe=({contents:t,length:e})=>pV()?t:t.slice(0,e),pV=()=>"resize"in ArrayBuffer.prototype,OSe={init:SSe,convertChunk:{string:wSe,buffer:lV,arrayBuffer:lV,dataView:uV,typedArray:uV,others:vb},getSize:Sb,truncateChunk:$Se,addChunk:kSe,getFinalChunk:Zf,finalize:TSe}});async function Eb(t,e){return $l(t,DSe,e)}var RSe,kb,ISe,PSe,CSe,DSe,hV=y(()=>{Gf();wb();RSe=()=>({contents:"",textDecoder:new TextDecoder}),kb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),ISe=(t,{contents:e})=>e+t,PSe=(t,e)=>t.slice(0,e),CSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},DSe={init:RSe,convertChunk:{string:_o,buffer:kb,arrayBuffer:kb,dataView:kb,typedArray:kb,others:vb},getSize:Sb,truncateChunk:PSe,addChunk:ISe,getFinalChunk:CSe,finalize:bb}});var gV=y(()=>{cV();mV();hV();Gf()});import{on as NSe}from"node:events";import{finished as jSe}from"node:stream/promises";var Ab=y(()=>{qR();gV();Object.assign(Hf,{on:NSe,finished:jSe})});var yV,MSe,_V,bV,FSe,vV,SV,Tb,Oa=y(()=>{Ab();ho();yo();yV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ii))throw t;if(o==="all")return t;let s=MSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},MSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",_V=(t,e,r)=>{if(e.length!==r)return;let n=new Ii;throw n.maxBufferInfo={fdNumber:"ipc"},n},bV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=FSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},FSe=(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=go(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:D_(r),threshold:i,unit:n}},vV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Tb(r)),SV=(t,e,r)=>{if(!e)return t;let n=Tb(r);return t.length>n?t.slice(0,n):t},Tb=([,t])=>t});import{inspect as LSe}from"node:util";var xV,zSe,USe,qSe,BSe,HSe,wV,$V=y(()=>{jR();rn();CR();M_();Oa();Lf();$a();xV=({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=zSe({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=qSe(n,b),w=x===void 0?"":` +${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>BSe(D)).join(` +`)].map(D=>Nf(xl(HSe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:O,message:A}},zSe=({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=USe(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?`${bV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${J_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},USe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",qSe=(t,e)=>{if(t instanceof Xn)return;let r=zZ(t)?t.originalMessage:String(t?.message??t),n=Nf(W9(r,e));return n===""?void 0:n},BSe=t=>typeof t=="string"?t:LSe(t),HSe=t=>Array.isArray(t)?t.map(e=>xl(wV(e))).filter(Boolean).join(` +`):wV(t),wV=t=>typeof t=="string"?t:zt(t)?P_(t):""});var Ob,kl,Vf,GSe,kV,ZSe,Wf=y(()=>{Lf();B_();$a();$V();Ob=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>kV({command:t,escapedCommand:e,cwd:o,durationMs:oR(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:[]}),kl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Vf({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}),Vf=({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:O,signalDescription:T}=ZSe(l,u),{originalMessage:A,shortMessage:D,message:E}=xV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),q=FZ(t,E,x);return Object.assign(q,GSe({error:q,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),q},GSe=({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})=>kV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:oR(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:[]}),kV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),ZSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:J_(e);return{exitCode:r,signal:n,signalDescription:i}}});function VSe(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(EV(t*1e3)%1e3),nanoseconds:Math.trunc(EV(t*1e6)%1e3)}}function WSe(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 BR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return VSe(t);break}case"bigint":return WSe(t)}throw new TypeError("Expected a finite number or bigint")}var EV,AV=y(()=>{EV=t=>Number.isFinite(t)?t:0});function HR(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+YSe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&KSe(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?" "+JSe(d,u):f;i.push(p)}},a=BR(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%XSe):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 KSe,JSe,YSe,XSe,TV=y(()=>{AV();KSe=t=>t===0||t===0n,JSe=(t,e)=>e===1||e===1n?t:`${t}s`,YSe=1e-7,XSe=24n*60n*60n*1000n});var OV,RV=y(()=>{hl();OV=(t,e)=>{t.failed&&Ti({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var IV,QSe,PV=y(()=>{TV();ss();hl();RV();IV=(t,e)=>{pl(e)&&(OV(t,e),QSe(t,e))},QSe=(t,e)=>{let r=`(done in ${HR(t.durationMs)})`;Ti({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var El,Rb=y(()=>{PV();El=(t,e,{reject:r})=>{if(IV(t,e),t.failed&&r)throw t;return t}});var NV,ewe,twe,jV,MV,CV,rwe,GR,DV,Ra,FV,nwe,Ib,LV,iwe,owe,ZR,zV,swe,UV,Pb,awe,VR,cwe,lwe,qV,An,Cb,WR,BV,HV,us,vr=y(()=>{Ta();po();rn();NV=(t,e)=>Ra(t)?"asyncGenerator":FV(t)?"generator":Ib(t)?"fileUrl":iwe(t)?"filePath":awe(t)?"webStream":ei(t,{checkOpen:!1})?"native":zt(t)?"uint8Array":cwe(t)?"asyncIterable":lwe(t)?"iterable":VR(t)?jV({transform:t},e):nwe(t)?ewe(t,e):"native",ewe=(t,e)=>FR(t.transform,{checkOpen:!1})?twe(t,e):VR(t.transform)?jV(t,e):rwe(t,e),twe=(t,e)=>(MV(t,e,"Duplex stream"),"duplex"),jV=(t,e)=>(MV(t,e,"web TransformStream"),"webTransform"),MV=({final:t,binary:e,objectMode:r},n,i)=>{CV(t,`${n}.final`,i),CV(e,`${n}.binary`,i),GR(r,`${n}.objectMode`)},CV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},rwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!DV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(FR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(VR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!DV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return GR(r,`${i}.binary`),GR(n,`${i}.objectMode`),Ra(t)||Ra(e)?"asyncGenerator":"generator"},GR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},DV=t=>Ra(t)||FV(t),Ra=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",FV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",nwe=t=>At(t)&&(t.transform!==void 0||t.final!==void 0),Ib=t=>Object.prototype.toString.call(t)==="[object URL]",LV=t=>Ib(t)&&t.protocol!=="file:",iwe=t=>At(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>owe.has(e))&&ZR(t.file),owe=new Set(["file","append"]),ZR=t=>typeof t=="string",zV=(t,e)=>t==="native"&&typeof e=="string"&&!swe.has(e),swe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),UV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Pb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",awe=t=>UV(t)||Pb(t),VR=t=>UV(t?.readable)&&Pb(t?.writable),cwe=t=>qV(t)&&typeof t[Symbol.asyncIterator]=="function",lwe=t=>qV(t)&&typeof t[Symbol.iterator]=="function",qV=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),Cb=new Set(["fileUrl","filePath","fileNumber"]),WR=new Set(["fileUrl","filePath"]),BV=new Set([...WR,"webStream","nodeStream"]),HV=new Set(["webTransform","duplex"]),us={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 KR,uwe,dwe,GV,JR=y(()=>{vr();KR=(t,e,r,n)=>n==="output"?uwe(t,e,r):dwe(t,e,r),uwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},dwe=(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}},GV=(t,e)=>{let r=t.findLast(({type:n})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var ZV,fwe,pwe,mwe,hwe,gwe,ywe,VV=y(()=>{po();Ea();vr();JR();ZV=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...fwe(t,e,r,n)],fwe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=pwe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return ywe(o,r)},pwe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?mwe({stdioItem:t,optionName:i}):e==="webTransform"?hwe({stdioItem:t,index:r,newTransforms:n,direction:o}):gwe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),mwe=({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}}},hwe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=At(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=KR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},gwe=({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}=At(e)?e:{transform:e},d=c||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=KR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},ywe=(t,e)=>e==="input"?t.reverse():t});import YR from"node:process";var WV,_we,bwe,Al,XR,KV,vwe,Swe,JV=y(()=>{Ta();vr();WV=(t,e,r)=>{let n=t.map(i=>_we(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)??Swe},_we=({type:t,value:e},r)=>bwe[r]??KV[t](e),bwe=["input","output","output"],Al=()=>{},XR=()=>"input",KV={generator:Al,asyncGenerator:Al,fileUrl:Al,filePath:Al,iterable:XR,asyncIterable:XR,uint8Array:XR,webStream:t=>Pb(t)?"output":"input",nodeStream(t){return Aa(t,{checkOpen:!1})?MR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Al,duplex:Al,native(t){let e=vwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return KV.nodeStream(t)}},vwe=t=>{if([0,YR.stdin].includes(t))return"input";if([1,2,YR.stdout,YR.stderr].includes(t))return"output"},Swe="output"});var YV,XV=y(()=>{YV=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var QV,wwe,xwe,eW,$we,kwe,tW=y(()=>{ho();XV();ss();QV=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=wwe(t,n).map((a,c)=>eW(a,c));return o?$we(s,r,i):YV(s,e)},wwe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(xwe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},xwe=t=>En.some(e=>t[e]!==void 0),eW=(t,e)=>Array.isArray(t)?t.map(r=>eW(r,e)):t??(e>=En.length?"ignore":"pipe"),$we=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!ml(r,i)&&kwe(n)?"ignore":n),kwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Ewe}from"node:fs";import Awe from"node:tty";var nW,Twe,Owe,Rwe,Iwe,rW,iW=y(()=>{Ta();ho();rn();cs();nW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Twe({stdioItem:t,fdNumber:n,direction:i}):Iwe({stdioItem:t,fdNumber:n}),Twe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Owe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Owe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Rwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Awe.isatty(i))throw new TypeError(`The \`${e}: ${eb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:mo(Ewe(i)),optionName:e}}},Rwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=C_.indexOf(t);if(r!==-1)return r},Iwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:rW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:rW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,rW=(t,e,r)=>{let n=C_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var oW,Pwe,Cwe,Dwe,Nwe,sW=y(()=>{Ta();rn();vr();oW=({input:t,inputFile:e},r)=>r===0?[...Pwe(t),...Dwe(e)]:[],Pwe=t=>t===void 0?[]:[{type:Cwe(t),value:t,optionName:"input"}],Cwe=t=>{if(Aa(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(zt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Dwe=t=>t===void 0?[]:[{...Nwe(t),optionName:"inputFile"}],Nwe=t=>{if(Ib(t))return{type:"fileUrl",value:t};if(ZR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var aW,cW,jwe,Mwe,lW,Fwe,Lwe,uW,dW=y(()=>{vr();aW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),cW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=jwe(i,t);if(s.length!==0){if(o){Mwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(BV.has(t))return lW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});HV.has(t)&&Lwe({otherStdioItems:s,type:t,value:e,optionName:r})}},jwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Mwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{WR.has(e)&&lW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},lW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Fwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return uW(s,n,e),i==="output"?o[0].stream:void 0},Fwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Lwe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);uW(i,n,e)},uW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${us[r]} that is the same.`)}});var Db,zwe,Uwe,qwe,Bwe,Hwe,Gwe,Zwe,Vwe,Wwe,Kwe,Jwe,QR,Ywe,Nb=y(()=>{ho();VV();JR();vr();JV();tW();iW();sW();dW();Db=(t,e,r,n)=>{let o=QV(e,r,n).map((a,c)=>zwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Wwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Ywe(a)),s},zwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=D_(e),{stdioItems:o,isStdioArray:s}=Uwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=WV(o,e,i),c=o.map(d=>nW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=ZV(c,i,a,r),u=GV(l,a);return Vwe(l,u),{direction:a,objectMode:u,stdioItems:l}},Uwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>qwe(c,n)),...oW(r,e)],s=aW(o),a=s.length>1;return Bwe(s,a,n),Gwe(s),{stdioItems:s,isStdioArray:a}},qwe=(t,e)=>({type:NV(t,e),value:t,optionName:e}),Bwe=(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(Hwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Hwe=new Set(["ignore","ipc"]),Gwe=t=>{for(let e of t)Zwe(e)},Zwe=({type:t,value:e,optionName:r})=>{if(LV(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(zV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Vwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Cb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Wwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(Kwe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw QR(i),o}},Kwe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Jwe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Jwe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=cW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},QR=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Yn(r)&&r.destroy()},Ywe=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 fW}from"node:fs";var mW,Pi,Xwe,hW,pW,Qwe,gW=y(()=>{rn();Nb();vr();mW=(t,e)=>Db(Qwe,t,e,!0),Pi=({type:t,optionName:e})=>{hW(e,us[t])},Xwe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&hW(t,`"${e}"`),{}),hW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},pW={generator(){},asyncGenerator:Pi,webStream:Pi,nodeStream:Pi,webTransform:Pi,duplex:Pi,asyncIterable:Pi,native:Xwe},Qwe={input:{...pW,fileUrl:({value:t})=>({contents:[mo(fW(t))]}),filePath:({value:{file:t}})=>({contents:[mo(fW(t))]}),fileNumber:Pi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...pW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Pi,string:Pi,uint8Array:Pi}}});var bo,eI,Kf=y(()=>{jR();bo=(t,{stripFinalNewline:e},r)=>eI(e,r)&&t!==void 0&&!Array.isArray(t)?xl(t):t,eI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var jb,rI,yW,_W,exe,txe,rxe,bW,nxe,tI,ixe,oxe,sxe,Mb=y(()=>{jb=(t,e,r,n)=>t||r?void 0:_W(e,n),rI=(t,e,r)=>r?t.flatMap(n=>yW(n,e)):yW(t,e),yW=(t,e)=>{let{transform:r,final:n}=_W(e,{});return[...r(t),...n()]},_W=(t,e)=>(e.previousChunks="",{transform:exe.bind(void 0,e,t),final:rxe.bind(void 0,e)}),exe=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},txe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),rxe=function*({previousChunks:t}){t.length>0&&(yield t)},bW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:nxe.bind(void 0,n)},nxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?ixe:sxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},tI=(t,e)=>`${t}${e}`,ixe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:zR},Mwe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Fwe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Mwe}});import{Buffer as Lwe}from"node:buffer";var sW,zwe,aW,Uwe,qwe,cW,lW=y(()=>{tn();sW=(t,e)=>t?void 0:zwe.bind(void 0,e),zwe=function*(t,e){if(typeof e!="string"&&!Ft(e)&&!Lwe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},aW=(t,e)=>t?Uwe.bind(void 0,e):qwe.bind(void 0,e),Uwe=function*(t,e){cW(t,e),yield e},qwe=function*(t,e){if(cW(t,e),typeof e!="string"&&!Ft(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},cW=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:tI},oxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},sxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:oxe}});import{Buffer as axe}from"node:buffer";var vW,cxe,SW,lxe,uxe,wW,xW=y(()=>{rn();vW=(t,e)=>t?void 0:cxe.bind(void 0,e),cxe=function*(t,e){if(typeof e!="string"&&!zt(e)&&!axe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},SW=(t,e)=>t?lxe.bind(void 0,e):uxe.bind(void 0,e),lxe=function*(t,e){wW(t,e),yield e},uxe=function*(t,e){if(wW(t,e),typeof e!="string"&&!zt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},wW=(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 Bwe}from"node:buffer";import{StringDecoder as Hwe}from"node:string_decoder";var Ab,Gwe,Zwe,Vwe,qR=y(()=>{tn();Ab=(t,e,r)=>{if(r)return;if(t)return{transform:Gwe.bind(void 0,new TextEncoder)};let n=new Hwe(e);return{transform:Zwe.bind(void 0,n),final:Vwe.bind(void 0,n)}},Gwe=function*(t,e){Bwe.isBuffer(e)?yield fo(e):typeof e=="string"?yield t.encode(e):yield e},Zwe=function*(t,e){yield Ft(e)?t.write(e):e},Vwe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as uW}from"node:util";var BR,Tb,dW,Wwe,fW,Kwe,pW=y(()=>{BR=uW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Tb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Kwe}=e[r];for await(let i of n(t))yield*Tb(i,e,r+1)},dW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Wwe(r,Number(e),t)},Wwe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Tb(n,r,e+1)},fW=uW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Kwe=function*(t){yield t}});var HR,mW,Oa,Bf,Jwe,Ywe,GR=y(()=>{HR=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},mW=(t,e)=>[...e.flatMap(r=>[...Oa(r,t,0)]),...Bf(t)],Oa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Ywe}=e[r];for(let i of n(t))yield*Oa(i,e,r+1)},Bf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Jwe(r,Number(e),t)},Jwe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Oa(n,r,e+1)},Ywe=function*(t){yield t}});import{Transform as Xwe,getDefaultHighWaterMark as hW}from"node:stream";var ZR,Ob,gW,Rb=y(()=>{br();Eb();lW();qR();pW();GR();ZR=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=gW(t,s,o),l=Ta(e),u=Ta(r),d=l?BR.bind(void 0,Tb,a):HR.bind(void 0,Oa),f=l||u?BR.bind(void 0,dW,a):HR.bind(void 0,Bf),p=l||u?fW.bind(void 0,a):void 0;return{stream:new Xwe({writableObjectMode:n,writableHighWaterMark:hW(n),readableObjectMode:i,readableHighWaterMark:hW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Ob=(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=gW(s,r,a);t=mW(c,t)}return t},gW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:sW(n,a)},Ab(r,s,n),kb(r,o,n,c),{transform:t,final:e},{transform:aW(i,a)},oW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var yW,Qwe,exe,txe,rxe,_W=y(()=>{Rb();tn();br();yW=(t,e)=>{for(let r of Qwe(t))exe(t,r,e)},Qwe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),exe=(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 ${cs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>txe(a,n));r.input=Af(s)},txe=(t,e)=>{let r=Ob(t,e,"utf8",!0);return rxe(r),Af(r)},rxe=t=>{let e=t.find(r=>typeof r!="string"&&!Ft(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 Ib,nxe,ixe,bW,vW,oxe,SW,VR=y(()=>{$a();br();ll();is();Ib=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&cl(r,n)&&!rn.has(e)&&nxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&ixe.has(o))||t.every(({type:i})=>En.has(i))),nxe=t=>t===1||t===2,ixe=new Set(["pipe","overlapped"]),bW=async(t,e,r,n)=>{for await(let i of t)oxe(e)||SW(i,r,n)},vW=(t,e,r)=>{for(let n of t)SW(n,e,r)},oxe=t=>t._readableState.pipes.length>0,SW=(t,e,r)=>{let n=R_(t);Ei({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as sxe,appendFileSync as axe}from"node:fs";var wW,cxe,lxe,uxe,dxe,fxe,xW=y(()=>{VR();Rb();Eb();tn();br();Aa();wW=({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)=>cxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},cxe=({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=aV(t,o,d),p=fo(f),{stdioItems:m,objectMode:h}=e[r],g=lxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=uxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});dxe({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&&fxe(b,m,i),S}catch(x){return n.error=x,S}},lxe=(t,e,r,n)=>{try{return Ob(t,e,r,!1)}catch(i){return n.error=i,t}},uxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Af(t)};let s=YH(t,r);return n[o]?{serializedResult:s,finalResult:UR(s,!i[o],e)}:{serializedResult:s}},dxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Ib({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=UR(t,!1,s);try{vW(a,e,n)}catch(c){r.error??=c}},fxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>wb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?axe(n,t):(r.add(o),sxe(n,t))}}});var $W,kW=y(()=>{tn();qf();$W=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,yo(e,r,"all")]:Array.isArray(e)?[yo(t,r,"all"),...e]:Ft(t)&&Ft(e)?jO([t,e]):`${t}${e}`}});import{once as WR}from"node:events";var EW,pxe,AW,TW,mxe,KR,JR=y(()=>{wa();EW=async(t,e)=>{let[r,n]=await pxe(t);return e.isForcefullyTerminated??=!1,[r,n]},pxe=async t=>{let[e,r]=await Promise.allSettled([WR(t,"spawn"),WR(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?AW(t):r.value},AW=async t=>{try{return await WR(t,"exit")}catch{return AW(t)}},TW=async t=>{let[e,r]=await t;if(!mxe(e,r)&&KR(e,r))throw new Kn;return[e,r]},mxe=(t,e)=>t===void 0&&e===void 0,KR=(t,e)=>t!==0||e!==null});var OW,hxe,RW=y(()=>{wa();Aa();JR();OW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=hxe(t,e,r),s=o?.code==="ETIMEDOUT",a=sV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},hxe=(t,e,r)=>t!==void 0?t:KR(e,r)?new Kn:void 0});import{spawnSync as gxe}from"node:child_process";var IW,yxe,_xe,bxe,Pb,vxe,Sxe,wxe,xxe,PW=y(()=>{GO();bR();vR();Uf();bb();rW();qf();_W();xW();Aa();kW();RW();IW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=yxe(t,e,r),d=vxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return vl(d,c,l)},yxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=C_(t,e,r),a=_xe(r),{file:c,commandArguments:l,options:u}=sb(t,e,a);bxe(u);let d=eW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},_xe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,bxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Pb("ipcInput"),t&&Pb("ipc: true"),r&&Pb("detached: true"),n&&Pb("cancelSignal")},Pb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},vxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Sxe({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}=OW(c,r),{output:m,error:h=l}=wW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>yo(_,r,S)),b=yo($W(m,r),r,"all");return xxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Sxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{yW(o,r);let a=wxe(r);return gxe(...ab(t,e,a))}catch(a){return bl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},wxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:yb(e)}),xxe=({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?_b({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):zf({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 YR,on as $xe}from"node:events";var CW,kxe,Exe,Axe,Txe,DW=y(()=>{ml();Nf();Df();CW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(fl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Q_(t)}),kxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),kxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{Z_(e,i);let o=as(t,e,r),s=new AbortController;try{return await Promise.race([Exe(o,n,s),Axe(o,r,s),Txe(o,r,s)])}catch(a){throw pl(t),a}finally{s.abort(),V_(e,i)}},Exe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await YR(t,"message",{signal:r});return n}for await(let[n]of $xe(t,"message",{signal:r}))if(e(n))return n},Axe=async(t,e,{signal:r})=>{await YR(t,"disconnect",{signal:r}),GZ(e)},Txe=async(t,e,{signal:r})=>{let[n]=await YR(t,"strict:error",{signal:r});throw q_(n,e)}});import{once as jW,on as Oxe}from"node:events";var MW,XR,Rxe,Ixe,Pxe,NW,QR=y(()=>{ml();Nf();Df();MW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>XR({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),XR=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{fl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Q_(t)}),Z_(e,o);let s=as(t,e,r),a=new AbortController,c={};return Rxe(t,s,a),Ixe({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),Pxe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Rxe=async(t,e,r)=>{try{await jW(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Ixe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await jW(t,"strict:error",{signal:r.signal});n.error=q_(i,e),r.abort()}catch{}},Pxe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of Oxe(r,"message",{signal:o.signal}))NW(s),yield c}catch{NW(s)}finally{o.abort(),V_(e,a),n||pl(t),i&&await t}},NW=({error:t})=>{if(t)throw t}});import FW from"node:process";var LW,zW,UW,eI=y(()=>{ib();DW();QR();Y_();LW=(t,{ipc:e})=>{Object.assign(t,UW(t,!1,e))},zW=()=>{let t=FW,e=!0,r=FW.channel!==void 0;return{...UW(t,e,r),getCancelSignal:b9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},UW=(t,e,r)=>({sendMessage:nb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:CW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:MW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as Cxe}from"node:child_process";import{PassThrough as Dxe,Readable as Nxe,Writable as jxe,Duplex as Mxe}from"node:stream";var qW,Fxe,Hf,Lxe,zxe,Uxe,qxe,BW=y(()=>{$b();Uf();bb();qW=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{FR(n);let a=new Cxe;Fxe(a,n),Object.assign(a,{readable:Lxe,writable:zxe,duplex:Uxe});let c=bl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=qxe(c,s,i);return{subprocess:a,promise:l}},Fxe=(t,e)=>{let r=Hf(),n=Hf(),i=Hf(),o=Array.from({length:e.length-3},Hf),s=Hf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Hf=()=>{let t=new Dxe;return t.end(),t},Lxe=()=>new Nxe({read(){}}),zxe=()=>new jxe({write(){}}),Uxe=()=>new Mxe({read(){},write(){}}),qxe=async(t,e,r)=>vl(t,e,r)});import{createReadStream as HW,createWriteStream as GW}from"node:fs";import{Buffer as Bxe}from"node:buffer";import{Readable as Gf,Writable as Hxe,Duplex as Gxe}from"node:stream";var VW,Zf,ZW,Zxe,WW=y(()=>{Rb();$b();br();VW=(t,e)=>xb(Zxe,t,e,!1),Zf=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${cs[t]}.`)},ZW={fileNumber:Zf,generator:ZR,asyncGenerator:ZR,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Gxe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Zxe={input:{...ZW,fileUrl:({value:t})=>({stream:HW(t)}),filePath:({value:{file:t}})=>({stream:HW(t)}),webStream:({value:t})=>({stream:Gf.fromWeb(t)}),iterable:({value:t})=>({stream:Gf.from(t)}),asyncIterable:({value:t})=>({stream:Gf.from(t)}),string:({value:t})=>({stream:Gf.from(t)}),uint8Array:({value:t})=>({stream:Gf.from(Bxe.from(t))})},output:{...ZW,fileUrl:({value:t})=>({stream:GW(t)}),filePath:({value:{file:t,append:e}})=>({stream:GW(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Hxe.fromWeb(t)}),iterable:Zf,asyncIterable:Zf,string:Zf,uint8Array:Zf}}});import{on as Vxe,once as KW}from"node:events";import{PassThrough as Wxe,getDefaultHighWaterMark as Kxe}from"node:stream";import{finished as XW}from"node:stream/promises";function Ra(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)rI(i);let e=t.some(({readableObjectMode:i})=>i),r=Jxe(t,e),n=new tI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Jxe,tI,Yxe,Xxe,Qxe,rI,e0e,t0e,r0e,n0e,i0e,QW,e3,nI,t3,o0e,Cb,JW,YW,Db=y(()=>{Jxe=(t,e)=>{if(t.length===0)return Kxe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},tI=class extends Wxe{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(rI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Yxe(this,this.#t,this.#o);let r=e0e({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(rI(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)}},Yxe=async(t,e,r)=>{Cb(t,JW);let n=new AbortController;try{await Promise.race([Xxe(t,n),Qxe(t,e,r,n)])}finally{n.abort(),Cb(t,-JW)}},Xxe=async(t,{signal:e})=>{try{await XW(t,{signal:e,cleanup:!0})}catch(r){throw QW(t,r),r}},Qxe=async(t,e,r,{signal:n})=>{for await(let[i]of Vxe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},rI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},e0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Cb(t,YW);let a=new AbortController;try{await Promise.race([t0e(o,e,a),r0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),n0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Cb(t,-YW)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?nI(t):i0e(t))},t0e=async(t,e,{signal:r})=>{try{await t,r.aborted||nI(e)}catch(n){r.aborted||QW(e,n)}},r0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await XW(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;e3(s)?i.add(e):t3(t,s)}},n0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await KW(t,i,{signal:o}),!t.readable)return KW(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},i0e=t=>{t.writable&&t.end()},QW=(t,e)=>{e3(e)?nI(t):t3(t,e)},e3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",nI=t=>{(t.readable||t.writable)&&t.destroy()},t3=(t,e)=>{t.destroyed||(t.once("error",o0e),t.destroy(e))},o0e=()=>{},Cb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},JW=2,YW=1});import{finished as r3}from"node:stream/promises";var wl,s0e,iI,a0e,oI,Nb=y(()=>{po();wl=(t,e)=>{t.pipe(e),s0e(t,e),a0e(t,e)},s0e=async(t,e)=>{if(!(Wn(t)||Wn(e))){try{await r3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}iI(e)}},iI=t=>{t.writable&&t.end()},a0e=async(t,e)=>{if(!(Wn(t)||Wn(e))){try{await r3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}oI(t)}},oI=t=>{t.readable&&t.destroy()}});var n3,c0e,l0e,u0e,d0e,f0e,i3=y(()=>{Db();po();G_();br();Nb();n3=(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})=>En.has(c)))c0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!En.has(c)))u0e({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]:Ra(o);wl(s,i)}},c0e=(t,e,r,n)=>{r==="output"?wl(t.stdio[n],e):wl(e,t.stdio[n]);let i=l0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},l0e=["stdin","stdout","stderr"],u0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;d0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},d0e=(t,{signal:e})=>{Wn(t)&&xa(t,f0e,e)},f0e=2});var Ia,o3=y(()=>{Ia=[];Ia.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ia.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ia.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var jb,sI,aI,p0e,cI,Mb,m0e,lI,uI,dI,s3,vot,Sot,a3=y(()=>{o3();jb=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",sI=Symbol.for("signal-exit emitter"),aI=globalThis,p0e=Object.defineProperty.bind(Object),cI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(aI[sI])return aI[sI];p0e(aI,sI,{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}},Mb=class{},m0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),lI=class extends Mb{onExit(){return()=>{}}load(){}unload(){}},uI=class extends Mb{#t=dI.platform==="win32"?"SIGINT":"SIGHUP";#r=new cI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ia)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(!jb(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 Ia)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,Ia.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 jb(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"&&jb(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)}},dI=globalThis.process,{onExit:s3,load:vot,unload:Sot}=m0e(jb(dI)?new uI(dI):new lI)});import{addAbortListener as h0e}from"node:events";var c3,l3=y(()=>{a3();c3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=s3(()=>{t.kill()});h0e(n,()=>{i()})}});var d3,g0e,y0e,u3,_0e,f3=y(()=>{NO();P_();ss();sl();d3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=I_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=g0e(r,n,i),{sourceStream:d,sourceError:f}=_0e(t,l),{options:p,fileDescriptors:m}=Ti.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},g0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=y0e(t,e,...r),a=H_(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},y0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(u3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||CO(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]=v_(r,...n);return{destination:e(u3)(i,o,s),pipeOptions:s}}if(Ti.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}`)},u3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),_0e=(t,e)=>{try{return{sourceStream:gl(t,e)}}catch(r){return{sourceError:r}}}});var m3,b0e,fI,p3,pI=y(()=>{Uf();Nb();m3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=b0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw fI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},b0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return oI(t),n;if(e!==void 0)return iI(r),e},fI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>bl({error:t,command:p3,escapedCommand:p3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),p3="source.pipe(destination)"});var h3,g3=y(()=>{h3=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 v0e}from"node:stream/promises";var y3,S0e,w0e,x0e,Fb,$0e,k0e,_3=y(()=>{Db();G_();Nb();y3=(t,e,r)=>{let n=Fb.has(e)?w0e(t,e):S0e(t,e);return xa(t,$0e,r.signal),xa(e,k0e,r.signal),x0e(e),n},S0e=(t,e)=>{let r=Ra([t]);return wl(r,e),Fb.set(e,r),r},w0e=(t,e)=>{let r=Fb.get(e);return r.add(t),r},x0e=async t=>{try{await v0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Fb.delete(t)},Fb=new WeakMap,$0e=2,k0e=1});import{aborted as E0e}from"node:util";var b3,A0e,v3=y(()=>{pI();b3=(t,e)=>t===void 0?[]:[A0e(t,e)],A0e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await E0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw fI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var Lb,T0e,O0e,S3=y(()=>{uo();f3();pI();g3();_3();v3();Lb=(t,...e)=>{if(At(e[0]))return Lb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=d3(t,...e),i=T0e({...n,destination:r});return i.pipe=Lb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},T0e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=O0e(t,i);m3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=y3(e,o,d);return await Promise.race([h3(u),...b3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},O0e=(t,e)=>Promise.allSettled([t,e])});import{on as R0e}from"node:events";import{getDefaultHighWaterMark as I0e}from"node:stream";var zb,P0e,mI,C0e,x3,hI,w3,D0e,N0e,Ub=y(()=>{qR();Eb();GR();zb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return P0e(e,s),x3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},P0e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},mI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;C0e(e,s,t);let a=t.readableObjectMode&&!o;return x3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},C0e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},x3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=R0e(t,"data",{signal:e.signal,highWaterMark:w3,highWatermark:w3});return D0e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},hI=I0e(!0),w3=hI,D0e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=N0e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Oa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Bf(a)}},N0e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Ab(t,r,!e),kb(t,i,!n,{})].filter(Boolean)});import{setImmediate as j0e}from"node:timers/promises";var $3,M0e,F0e,L0e,gI,k3,yI=y(()=>{gb();tn();VR();Ub();Aa();qf();$3=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=M0e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([F0e(t),d]);return}let f=LR(c,r),p=mI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([L0e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},M0e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Ib({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=mI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await bW(a,t,r,o)},F0e=async t=>{await j0e(),t.readableFlowing===null&&t.resume()},L0e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await fb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await pb(r,{maxBuffer:o})):await hb(r,{maxBuffer:o})}catch(a){return k3(nV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},gI=async t=>{try{return await t}catch(e){return k3(e)}},k3=({bufferedData:t})=>KH(t)?new Uint8Array(t):t});import{finished as z0e}from"node:stream/promises";var Vf,U0e,q0e,B0e,H0e,G0e,_I,qb,E3,Bb=y(()=>{Vf=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=U0e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],z0e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||H0e(a,e,r,n)}finally{s.abort()}},U0e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&q0e(t,r,n),n},q0e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{B0e(e,r),n.call(t,...i)}},B0e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},H0e=(t,e,r,n)=>{if(!G0e(t,e,r,n))throw t},G0e=(t,e,r,n=!0)=>r.propagating?E3(t)||qb(t):(r.propagating=!0,_I(r,e)===n?E3(t):qb(t)),_I=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",qb=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",E3=t=>t?.code==="EPIPE"});var A3,bI,vI=y(()=>{yI();Bb();A3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>bI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),bI=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=Vf(t,e,l);if(_I(l,e)){await u;return}let[d]=await Promise.all([$3({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 T3,O3,Z0e,V0e,SI=y(()=>{Db();vI();T3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ra([t,e].filter(Boolean)):void 0,O3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>bI({...Z0e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:V0e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Z0e=({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}},V0e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var R3,I3,P3=y(()=>{ll();is();R3=t=>cl(t,"ipc"),I3=(t,e)=>{let r=R_(t);Ei({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var C3,D3,N3=y(()=>{Aa();P3();ho();QR();C3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=R3(o),a=mo(e,"ipc"),c=mo(r,"ipc");for await(let l of XR({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(iV(t,i,c),i.push(l)),s&&I3(l,o);return i},D3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as W0e}from"node:events";var j3,K0e,J0e,Y0e,M3=y(()=>{Ea();mR();oR();pR();po();br();yI();N3();gR();SI();vI();JR();Bb();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 _=EW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=A3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=O3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=C3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),E=K0e(h,t,S),D=J0e(m,S);try{return await Promise.race([Promise.all([{},TW(_),Promise.all(x),w,A,O9(t,d),...E,...D]),g,Y0e(t,b),...$9(t,o,f,b),...HZ({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...w9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all(x.map(B=>gI(B))),gI(w),D3(A,R),Promise.allSettled(E),Promise.allSettled(D)])}},K0e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:Vf(n,i,r)),J0e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Yn(o,{checkOpen:!1})&&!Wn(o)).map(({type:i,value:o,stream:s=o})=>Vf(s,n,e,{isSameDirection:En.has(i),stopOnExit:i==="native"}))),Y0e=async(t,{signal:e})=>{let[r]=await W0e(t,"error",{signal:e});throw r}});var F3,Wf,xl,Hb=y(()=>{hl();F3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Wf=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ai();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},xl=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 L3}from"node:stream/promises";var wI,z3,xI,$I,Gb,Zb,kI=y(()=>{Bb();wI=async t=>{if(t!==void 0)try{await xI(t)}catch{}},z3=async t=>{if(t!==void 0)try{await $I(t)}catch{}},xI=async t=>{await L3(t,{cleanup:!0,readable:!1,writable:!0})},$I=async t=>{await L3(t,{cleanup:!0,readable:!0,writable:!1})},Gb=async(t,e)=>{if(await t,e)throw e},Zb=(t,e,r)=>{r&&!qb(r)?t.destroy(r):e&&t.destroy()}});import{Readable as X0e}from"node:stream";import{callbackify as Q0e}from"node:util";var U3,EI,AI,TI,e$e,OI,RI,q3,II=y(()=>{$a();ss();Ub();hl();Hb();kI();U3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||rn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=EI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=AI(a,s),{read:f,onStdoutDataDone:p}=TI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new X0e({read:f,destroy:Q0e(RI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return OI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},EI=(t,e,r)=>{let n=gl(t,e),i=Wf(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},AI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:hI},TI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ai(),s=zb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){e$e(this,s,o)},onStdoutDataDone:o}},e$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},OI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await $I(t),await n,await wI(i),await e,r.readable&&r.push(null)}catch(o){await wI(i),q3(r,o)}},RI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await xl(r,e)&&(q3(t,n),await Gb(e,n))},q3=(t,e)=>{Zb(t,t.readable,e)}});import{Writable as t$e}from"node:stream";import{callbackify as B3}from"node:util";var H3,PI,CI,r$e,n$e,DI,NI,G3,jI=y(()=>{ss();Hb();kI();H3=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=PI(t,r,e),s=new t$e({...CI(n,t,i),destroy:B3(NI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return DI(n,s),s},PI=(t,e,r)=>{let n=H_(t,e),i=Wf(r,n,"writableFinal"),o=Wf(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},CI=(t,e,r)=>({write:r$e.bind(void 0,t),final:B3(n$e.bind(void 0,t,e,r))}),r$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},n$e=async(t,e,r)=>{await xl(r,e)&&(t.writable&&t.end(),await e)},DI=async(t,e,r)=>{try{await xI(t),e.writable&&e.end()}catch(n){await z3(r),G3(e,n)}},NI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await xl(r,e),await xl(n,e)&&(G3(t,i),await Gb(e,i))},G3=(t,e)=>{Zb(t,t.writable,e)}});import{Duplex as i$e}from"node:stream";import{callbackify as o$e}from"node:util";var Z3,s$e,V3=y(()=>{$a();II();jI();Z3=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||rn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=EI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=PI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=AI(c,a),{read:g,onStdoutDataDone:b}=TI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new i$e({read:g,...CI(u,t,d),destroy:o$e(s$e.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 OI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),DI(u,_,c),_},s$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([RI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),NI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var MI,a$e,W3=y(()=>{$a();ss();Ub();MI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||rn.has(e),s=gl(t,r),a=zb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return a$e(a,s,t)},a$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var K3,J3=y(()=>{Hb();II();jI();V3();W3();K3=(t,{encoding:e})=>{let r=F3();t.readable=U3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=H3.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Z3.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=MI.bind(void 0,t,e),t[Symbol.asyncIterator]=MI.bind(void 0,t,e,{})}});var Y3,c$e,l$e,X3=y(()=>{Y3=(t,e)=>{for(let[r,n]of l$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},c$e=(async()=>{})().constructor.prototype,l$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(c$e,t)])});import{setMaxListeners as u$e}from"node:events";import{spawn as d$e}from"node:child_process";var Q3,f$e,p$e,m$e,h$e,g$e,eK=y(()=>{gb();GO();bR();ss();vR();eI();Uf();bb();BW();WW();qf();i3();z_();l3();S3();SI();M3();J3();hl();X3();Q3=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=f$e(t,e,r),{subprocess:f,promise:p}=m$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Lb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Y3(f,p),Ti.set(f,{options:u,fileDescriptors:d}),f},f$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=C_(t,e,r),{file:a,commandArguments:c,options:l}=sb(t,e,r),u=p$e(l),d=VW(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},p$e=({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}},m$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=d$e(...ab(t,e,r))}catch(m){return qW({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;u$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];n3(c,a,l),c3(c,r,l);let d={},f=Ai();c.kill=qZ.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=T3(c,r),K3(c,r),LW(c,r);let p=h$e({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}},h$e=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)=>yo(x,e,w)),_=yo(h,e,"all"),S=g$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return vl(S,n,e)},g$e=({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?zf({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 Oi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):_b({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Vb,y$e,_$e,tK=y(()=>{uo();ho();Vb=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,y$e(n,t[n],i)]));return{...t,...r}},y$e=(t,e,r)=>_$e.has(t)&&At(e)&&At(r)?{...e,...r}:r,_$e=new Set(["env",...zO])});var ls,b$e,v$e,rK=y(()=>{uo();NO();nG();PW();eK();tK();ls=(t,e,r,n)=>{let i=(s,a,c)=>ls(s,a,r,c),o=(...s)=>b$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},b$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(At(o))return i(t,Vb(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=v$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?IW(a,c,l):Q3(a,c,l,i)},v$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=tG(e)?rG(e,r):[e,...r],[s,a,c]=v_(...o),l=Vb(Vb(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 nK,iK,oK,S$e,w$e,sK=y(()=>{nK=({file:t,commandArguments:e})=>oK(t,e),iK=({file:t,commandArguments:e})=>({...oK(t,e),isSync:!0}),oK=(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]=S$e(t);return{file:r,commandArguments:n}},S$e=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(w$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},w$e=/ +/g});var aK,cK,x$e,lK,$$e,uK,dK=y(()=>{aK=(t,e,r)=>{t.sync=e(x$e,r),t.s=t.sync},cK=({options:t})=>lK(t),x$e=({options:t})=>({...lK(t),isSync:!0}),lK=t=>({options:{...$$e(t),...t}}),$$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},uK={preferLocal:!0}});var uct,Je,dct,fct,pct,mct,hct,gct,yct,_ct,jr=y(()=>{rK();sK();hR();dK();eI();uct=ls(()=>({})),Je=ls(()=>({isSync:!0})),dct=ls(nK),fct=ls(iK),pct=ls(E9),mct=ls(cK,{},uK,aK),{sendMessage:hct,getOneMessage:gct,getEachMessage:yct,getCancelSignal:_ct}=zW()});import{existsSync as Wb,statSync as k$e}from"node:fs";import{dirname as FI,extname as E$e,isAbsolute as fK,join as LI,relative as zI,resolve as Kb,sep as A$e}from"node:path";function Jb(t){return t==="./gradlew"||t==="gradle"}function T$e(t){return(Wb(LI(t,"build.gradle.kts"))||Wb(LI(t,"build.gradle")))&&Wb(LI(t,"gradle.properties"))}function O$e(t,e){let n=zI(t,e).split(A$e).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function us(t,e){return t===":"?`:${e}`:`${t}:${e}`}function R$e(t,e){let r=Kb(t,e),n=r;Wb(r)?k$e(r).isFile()&&(n=FI(r)):E$e(r)!==""&&(n=FI(r));let i=zI(t,n);if(i.startsWith("..")||fK(i))return null;let o=n;for(;;){if(T$e(o))return o;if(Kb(o)===Kb(t))return null;let s=FI(o);if(s===o)return null;let a=zI(t,s);if(a.startsWith("..")||fK(a))return null;o=s}}function Yb(t,e){let r=Kb(t),n=new Map,i=[];for(let o of e){let s=R$e(r,o);if(!s){i.push(o);continue}let a=O$e(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 Xb=y(()=>{"use strict"});import{existsSync as I$e,readFileSync as P$e}from"node:fs";import{join as C$e}from"node:path";function $l(t="."){let e=C$e(t,".cladding","config.yaml");if(!I$e(e))return UI;try{let n=(0,pK.parse)(P$e(e,"utf8"))?.gate;if(!n)return UI;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 D$e){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 UI}}function mK(t,e){let r=[],n=!1;for(let i of t){let o=N$e.exec(i);if(o){n=!0;for(let s of e)r.push(us(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 pK,D$e,UI,N$e,Qb=y(()=>{"use strict";pK=bt(Xt(),1);Xb();D$e=["type","lint","test","coverage"],UI={scope:"feature"};N$e=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as BI,readFileSync as hK,readdirSync as j$e,statSync as M$e}from"node:fs";import{join as ev}from"node:path";function ZI(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=ev(t,e);if(BI(r))try{if(gK.test(hK(r,"utf8")))return!0}catch{}}return!1}function yK(t){try{return BI(t)&&gK.test(hK(t,"utf8"))}catch{return!1}}function _K(t,e=0){if(e>4||!BI(t))return!1;let r;try{r=j$e(t)}catch{return!1}for(let n of r){let i=ev(t,n),o=!1;try{o=M$e(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(_K(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&yK(i))return!0}return!1}function z$e(t){if(ZI(t))return!0;for(let e of F$e)if(yK(ev(t,e)))return!0;for(let e of L$e)if(_K(ev(t,e)))return!0;return!1}function bK(t="."){let e=$l(t).coverage;return e||(z$e(t)?"kover":"jacoco")}function vK(t="."){return HI[bK(t)]}function SK(t="."){return qI[bK(t)]}var HI,qI,GI,gK,F$e,L$e,tv=y(()=>{"use strict";Qb();HI={kover:"koverXmlReport",jacoco:"jacocoTestReport"},qI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},GI=[qI.kover,qI.jacoco],gK=/kover/i;F$e=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],L$e=["buildSrc","build-logic"]});import{existsSync as rv,readFileSync as wK,readdirSync as xK}from"node:fs";import{join as Pa}from"node:path";function VI(t){return rv(Pa(t,"gradlew"))?"./gradlew":"gradle"}function U$e(t){let e=VI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[vK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function q$e(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(wK(Pa(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 H$e(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function V$e(t,e){for(let r of e)if(rv(Pa(t,r)))return r}function W$e(t,e){try{return xK(t).find(n=>n.endsWith(e))}catch{return}}function J$e(t,e){for(let r of K$e)if(r.configs.some(n=>rv(Pa(t,n))))return r.gate;return e}function X$e(t){if(Y$e.some(e=>rv(Pa(t,e))))return!0;try{return JSON.parse(wK(Pa(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function Q$e(t,e){let r=e.lint?{...e,lint:J$e(t,e.lint)}:{...e};return e.test&&e.coverage&&X$e(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function ut(t="."){for(let e of G$e){let r;for(let o of e.manifests)if(o.startsWith(".")?r=W$e(t,o):r=V$e(t,[o]),r)break;if(!r||e.requiresSource&&!H$e(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Q$e(t,n):n;return{language:e.language,manifest:r,gates:i}}return Z$e}var B$e,G$e,Z$e,K$e,Y$e,nn=y(()=>{"use strict";tv();B$e=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);G$e=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:U$e},{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:q$e}],Z$e={language:"unknown",manifest:"",gates:{}};K$e=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];Y$e=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as eke,readFileSync as tke}from"node:fs";import{join as rke}from"node:path";function Ca(t){return t.code==="ENOENT"}function nv(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=(o||s||`exit ${i}`).slice(0,200);return $K.test(o)||$K.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Lt(t,e,r){return Ca(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function Qt(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function kl(t,e){let r=rke(t,"package.json");if(!eke(r))return!1;try{return!!JSON.parse(tke(r,"utf8")).scripts?.[e]}catch{return!1}}var $K,An=y(()=>{"use strict";$K=/config (is |file )?not found|no such file|ENOENT|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 nke(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.arch;if(!n)return[{detector:iv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Ca(i)?[{detector:iv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:nv(i,iv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var iv,Da,ov=y(()=>{"use strict";jr();nn();An();iv="ARCHITECTURE_VIOLATION";Da={name:iv,subprocess:!0,run:nke}});function ike(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.secret;if(!n)return[{detector:sv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Ca(i)?[{detector:sv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:nv(i,sv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var sv,Na,av=y(()=>{"use strict";jr();nn();An();sv="HARDCODED_SECRET";Na={name:sv,subprocess:!0,run:ike}});import{existsSync as WI,readdirSync as kK}from"node:fs";import{join as cv}from"node:path";function ske(t,e){let r=cv(t,e.path);if(!WI(r))return!0;if(e.isDirectory)try{return kK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function ake(t){let{cwd:e="."}=t,r=[];for(let i of oke)ske(e,i)&&r.push({detector:Kf,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=cv(e,"spec.yaml");if(WI(n)){let i=uke(n),o=i?null:cke(e);if(i)r.push({detector:Kf,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:Kf,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=lke(e);s&&r.push({detector:Kf,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 cke(t){for(let e of["spec/features","spec/scenarios"]){let r=cv(t,e);if(!WI(r))continue;let n;try{n=kK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{xi(cv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function lke(t){try{return G(t),null}catch(e){return e.message}}function uke(t){let e;try{e=xi(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var Kf,oke,EK,AK=y(()=>{"use strict";qe();u_();Kf="ABSENCE_OF_GOVERNANCE",oke=[{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}];EK={name:Kf,run:ake}});function lv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function KI(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=lv(r)==="while",o=fke.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 '${lv(r)}'`}let n=dke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:lv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${lv(r)}'`:null}function pke(t,e){let r=KI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function TK(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...pke(r,n));return e}var dke,fke,JI=y(()=>{"use strict";dke={event:"when",state:"while",optional:"where",unwanted:"if"},fke=/\bwhen\b/i});function he(t,e,r){let n;try{n=G(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var vt=y(()=>{"use strict";qe()});function mke(t){let{cwd:e="."}=t;return he(e,uv,hke)}function hke(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:uv,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 TK(t.features))e.push({detector:uv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var uv,OK,RK=y(()=>{"use strict";JI();vt();uv="AC_DRIFT";OK={name:uv,run:mke}});function Ii(t=".",e){let n=(e??"").trim().toLowerCase()||ut(t).language;return PK[n]??IK}var gke,yke,_ke,IK,bke,vke,PK,Ske,CK,ja=y(()=>{"use strict";nn();gke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,yke=/^[ \t]*import\s+([\w.]+)/gm,_ke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,IK={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:gke,importStyle:"relative"},bke={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:yke,importStyle:"dotted"},vke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:_ke,importStyle:"dotted"},PK={typescript:IK,kotlin:bke,python:vke},Ske=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],CK=new Set([...Object.values(PK).flatMap(t=>t?.extensions??[]),...Ske].map(t=>t.toLowerCase()))});import{existsSync as wke,readFileSync as xke,readdirSync as $ke,statSync as kke}from"node:fs";import{join as NK,relative as DK}from"node:path";function Eke(t,e){if(!wke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=$ke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=NK(i,s),c;try{c=kke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function Ake(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function Oke(t){return Tke.test(t)}function Rke(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Ii(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Eke(NK(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=xke(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";qe();ja();jK="AI_HINTS_FORBIDDEN_PATTERN";Tke=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;MK={name:jK,run:Rke}});function Ike(t){let{cwd:e="."}=t,r;try{r=G(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:LK,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var LK,zK,UK=y(()=>{"use strict";qe();LK="AC_DUPLICATE_WITHIN_FEATURE";zK={name:LK,run:Ike}});import{createRequire as Pke}from"module";import{basename as Cke,dirname as XI,normalize as Dke,relative as Nke,resolve as jke,sep as HK}from"path";import*as Mke from"fs";function Fke(t){let e=Dke(t);return e.length>1&&e[e.length-1]===HK&&(e=e.substring(0,e.length-1)),e}function GK(t,e){return t.replace(Lke,e)}function Uke(t){return t==="/"||zke.test(t)}function YI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=jke(t)),(n||o)&&(t=Fke(t)),t===".")return"";let s=t[t.length-1]!==i;return GK(s?t+i:t,i)}function ZK(t,e){return e+t}function qke(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:GK(Nke(t,n),e.pathSeparator)+e.pathSeparator+r}}function Bke(t){return t}function Hke(t,e,r){return e+t+r}function Gke(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?qke(t,e):n?ZK:Bke}function Zke(t){return function(e,r){r.push(e.substring(t.length)||".")}}function Vke(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function Yke(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?Vke(t):Zke(t):n&&n.length?Kke:Wke:Jke}function nEe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?rEe:r&&r.length?n?Xke:Qke:n?eEe:tEe}function sEe(t){return t.group?oEe:iEe}function lEe(t){return t.group?aEe:cEe}function fEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?dEe:uEe}function VK(t,e,r){if(r.options.useRealPaths)return pEe(e,r);let n=XI(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=XI(n)}return r.symlinks.set(t,e),i>1}function pEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function dv(t,e,r,n){e(t&&!n?t:null,r)}function wEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?mEe:_Ee:n?e?hEe:SEe:i?e?yEe:vEe:e?gEe:bEe}function kEe(t){return t?$Ee:xEe}function OEe(t,e){return new Promise((r,n)=>{JK(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function JK(t,e,r){new KK(t,e,r).start()}function REe(t,e){return new KK(t,e).start()}var qK,Lke,zke,Wke,Kke,Jke,Xke,Qke,eEe,tEe,rEe,iEe,oEe,aEe,cEe,uEe,dEe,mEe,hEe,gEe,yEe,_Ee,bEe,vEe,SEe,WK,xEe,$Ee,EEe,AEe,TEe,KK,BK,YK,XK,QK=y(()=>{qK=Pke(import.meta.url);Lke=/[\\/]/g;zke=/^[a-z]:[\\/]$/i;Wke=(t,e)=>{e.push(t||".")},Kke=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},Jke=()=>{};Xke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},Qke=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},eEe=(t,e,r,n)=>{r.files++},tEe=(t,e)=>{e.push(t)},rEe=()=>{};iEe=t=>t,oEe=()=>[""].slice(0,0);aEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},cEe=()=>{};uEe=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()&&VK(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},dEe=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()&&VK(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};mEe=t=>t.counts,hEe=t=>t.groups,gEe=t=>t.paths,yEe=t=>t.paths.slice(0,t.options.maxFiles),_Ee=(t,e,r)=>(dv(e,r,t.counts,t.options.suppressErrors),null),bEe=(t,e,r)=>(dv(e,r,t.paths,t.options.suppressErrors),null),vEe=(t,e,r)=>(dv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),SEe=(t,e,r)=>(dv(e,r,t.groups,t.options.suppressErrors),null);WK={withFileTypes:!0},xEe=(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||".",WK,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},$Ee=(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||".",WK)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};EEe=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))}},AEe=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}},TEe=class{aborted=!1;abort(){this.aborted=!0}},KK=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=wEe(e,this.isSynchronous),this.root=YI(t,e),this.state={root:Uke(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new AEe,options:e,queue:new EEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new TEe,fs:e.fs||Mke},this.joinPath=Gke(this.root,e),this.pushDirectory=Yke(this.root,e),this.pushFile=nEe(e),this.getArray=sEe(e),this.groupFiles=lEe(e),this.resolveSymlink=fEe(e,this.isSynchronous),this.walkDirectory=kEe(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(_=YI(_,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=Cke(_),x=YI(XI(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};BK=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return OEe(this.root,this.options)}withCallback(t){JK(this.root,this.options,t)}sync(){return REe(this.root,this.options)}},YK=null;try{qK.resolve("picomatch"),YK=qK("picomatch")}catch{}XK=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:HK,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 BK(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new BK(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||YK;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 Jf=v((Slt,iJ)=>{"use strict";var eJ="[^\\\\/]",IEe="(?=.)",tJ="[^/]",QI="(?:\\/|$)",rJ="(?:^|\\/)",eP=`\\.{1,2}${QI}`,PEe="(?!\\.)",CEe=`(?!${rJ}${eP})`,DEe=`(?!\\.{0,1}${QI})`,NEe=`(?!${eP})`,jEe="[^.\\/]",MEe=`${tJ}*?`,FEe="/",nJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:IEe,QMARK:tJ,END_ANCHOR:QI,DOTS_SLASH:eP,NO_DOT:PEe,NO_DOTS:CEe,NO_DOT_SLASH:DEe,NO_DOTS_SLASH:NEe,QMARK_NO_DOT:jEe,STAR:MEe,START_ANCHOR:rJ,SEP:FEe},LEe={...nJ,SLASH_LITERAL:"[\\\\/]",QMARK:eJ,STAR:`${eJ}*?`,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:"\\"},zEe={__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"};iJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:zEe,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?LEe:nJ}}});var Yf=v(Mr=>{"use strict";var{REGEX_BACKSLASH:UEe,REGEX_REMOVE_BACKSLASH:qEe,REGEX_SPECIAL_CHARS:BEe,REGEX_SPECIAL_CHARS_GLOBAL:HEe}=Jf();Mr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Mr.hasRegexChars=t=>BEe.test(t);Mr.isRegexChar=t=>t.length===1&&Mr.hasRegexChars(t);Mr.escapeRegex=t=>t.replace(HEe,"\\$1");Mr.toPosixSlashes=t=>t.replace(UEe,"/");Mr.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};Mr.removeBackslashes=t=>t.replace(qEe,e=>e==="\\"?"":e);Mr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Mr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Mr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Mr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Mr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var fJ=v((xlt,dJ)=>{"use strict";var oJ=Yf(),{CHAR_ASTERISK:tP,CHAR_AT:GEe,CHAR_BACKWARD_SLASH:Xf,CHAR_COMMA:ZEe,CHAR_DOT:rP,CHAR_EXCLAMATION_MARK:nP,CHAR_FORWARD_SLASH:uJ,CHAR_LEFT_CURLY_BRACE:iP,CHAR_LEFT_PARENTHESES:oP,CHAR_LEFT_SQUARE_BRACKET:VEe,CHAR_PLUS:WEe,CHAR_QUESTION_MARK:sJ,CHAR_RIGHT_CURLY_BRACE:KEe,CHAR_RIGHT_PARENTHESES:aJ,CHAR_RIGHT_SQUARE_BRACKET:JEe}=Jf(),cJ=t=>t===uJ||t===Xf,lJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},YEe=(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,E,D={value:"",depth:0,isGlob:!1},k=()=>l>=n,B=()=>c.charCodeAt(l+1),Q=()=>(A=E,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),Se&&m===!0&&d>0?(Se=c.slice(0,d),C=c.slice(d)):m===!0?(Se="",C=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&cJ(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),r.unescape===!0&&(C&&(C=oJ.removeBackslashes(C)),Se&&_===!0&&(Se=oJ.removeBackslashes(Se)));let Rr={prefix:P,input:t,start:u,base:Se,glob:C,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Rr.maxDepth=0,cJ(E)||s.push(D),Rr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var Qf=Jf(),on=Yf(),{MAX_LENGTH:fv,POSIX_REGEX_SOURCE:XEe,REGEX_NON_SPECIAL_CHARS:QEe,REGEX_SPECIAL_CHARS_BACKREF:eAe,REPLACEMENTS:pJ}=Qf,tAe=(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=>on.escapeRegex(i)).join("..")}return r},El=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,mJ=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},rAe=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},hJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(rAe(e))return e.replace(/\\(.)/g,"$1")},nAe=t=>{let e=t.map(hJ).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}}}}},iAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=hJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?on.escapeRegex(r[0]):`[${r.map(i=>on.escapeRegex(i)).join("")}]`}*`},oAe=t=>{let e=0,r=t.trim(),n=sP(r);for(;n;)e++,r=n.body.trim(),n=sP(r);return e},sAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Qf.DEFAULT_MAX_EXTGLOB_RECURSION,n=mJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||nAe(n)))return{risky:!0};for(let i of n){let o=iAe(i);if(o)return{risky:!0,safeOutput:o};if(oAe(i)>r)return{risky:!0}}return{risky:!1}},aP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=pJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(fv,r.maxLength):fv,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=Qf.globChars(r.windows),l=Qf.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=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,A=r.dot?"":h,E=r.dot?_:S,D=r.bash===!0?R(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let k={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=on.removePrefix(t,k),i=t.length;let B=[],Q=[],Se=[],P=o,C,Rr=()=>k.index===i-1,se=k.peek=(H=1)=>t[k.index+H],Pe=k.advance=()=>t[++k.index]||"",Vt=()=>t.slice(k.index+1),lr=(H="",pt=0)=>{k.consumed+=H,k.index+=pt},Jt=H=>{k.output+=H.output!=null?H.output:H.value,lr(H.value)},no=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),k.start++,H++;return H%2===0?!1:(k.negated=!0,k.start++,!0)},_i=H=>{k[H]++,Se.push(H)},Jr=H=>{k[H]--,Se.pop()},de=H=>{if(P.type==="globstar"){let pt=k.braces>0&&(H.type==="comma"||H.type==="brace"),q=H.extglob===!0||B.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!pt&&!q&&(k.output=k.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=D,k.output+=P.output)}if(B.length&&H.type!=="paren"&&(B[B.length-1].inner+=H.value),(H.value||H.output)&&Jt(H),P&&P.type==="text"&&H.type==="text"){P.output=(P.output||P.value)+H.value,P.value+=H.value;return}H.prev=P,s.push(H),P=H},io=(H,pt)=>{let q={...l[pt],conditions:1,inner:""};q.prev=P,q.parens=k.parens,q.output=k.output,q.startIndex=k.index,q.tokensIndex=s.length;let Te=(r.capture?"(":"")+q.open;_i("parens"),de({type:H,value:pt,output:k.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Te}),B.push(q)},Lue=H=>{let pt=t.slice(H.startIndex,k.index+1),q=t.slice(H.startIndex+2,k.index),Te=sAe(q,r);if((H.type==="plus"||H.type==="star")&&Te.risky){let ct=Te.safeOutput?(H.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,bi=s[H.tokensIndex];bi.type="text",bi.value=pt,bi.output=ct||on.escapeRegex(pt);for(let vi=H.tokensIndex+1;vi1&&H.inner.includes("/")&&(ct=R(r)),(ct!==D||Rr()||/^\)+$/.test(Vt()))&&(lt=H.close=`)$))${ct}`),H.inner.includes("*")&&(jt=Vt())&&/^\.[^\\/.]+$/.test(jt)){let bi=aP(jt,{...e,fastpaths:!1}).output;lt=H.close=`)${bi})${ct})`}H.prev.type==="bos"&&(k.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:C,output:lt}),Jr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,pt=t.replace(eAe,(q,Te,lt,jt,ct,bi)=>jt==="\\"?(H=!0,q):jt==="?"?Te?Te+jt+(ct?_.repeat(ct.length):""):bi===0?E+(ct?_.repeat(ct.length):""):_.repeat(lt.length):jt==="."?u.repeat(lt.length):jt==="*"?Te?Te+jt+(ct?D:""):D:Te?q:`\\${q}`);return H===!0&&(r.unescape===!0?pt=pt.replace(/\\/g,""):pt=pt.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),pt===t&&r.contains===!0?(k.output=t,k):(k.output=on.wrapOutput(pt,k,e),k)}for(;!Rr();){if(C=Pe(),C==="\0")continue;if(C==="\\"){let q=se();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){C+="\\",de({type:"text",value:C});continue}let Te=/^\\+/.exec(Vt()),lt=0;if(Te&&Te[0].length>2&&(lt=Te[0].length,k.index+=lt,lt%2!==0&&(C+="\\")),r.unescape===!0?C=Pe():C+=Pe(),k.brackets===0){de({type:"text",value:C});continue}}if(k.brackets>0&&(C!=="]"||P.value==="["||P.value==="[^")){if(r.posix!==!1&&C===":"){let q=P.value.slice(1);if(q.includes("[")&&(P.posix=!0,q.includes(":"))){let Te=P.value.lastIndexOf("["),lt=P.value.slice(0,Te),jt=P.value.slice(Te+2),ct=XEe[jt];if(ct){P.value=lt+ct,k.backtrack=!0,Pe(),!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,Jt({value:C});continue}if(k.quotes===1&&C!=='"'){C=on.escapeRegex(C),P.value+=C,Jt({value:C});continue}if(C==='"'){k.quotes=k.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:C});continue}if(C==="("){_i("parens"),de({type:"paren",value:C});continue}if(C===")"){if(k.parens===0&&r.strictBrackets===!0)throw new SyntaxError(El("opening","("));let q=B[B.length-1];if(q&&k.parens===q.parens+1){Lue(B.pop());continue}de({type:"paren",value:C,output:k.parens?")":"\\)"}),Jr("parens");continue}if(C==="["){if(r.nobracket===!0||!Vt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(El("closing","]"));C=`\\${C}`}else _i("brackets");de({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){de({type:"text",value:C,output:`\\${C}`});continue}if(k.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(El("opening","["));de({type:"text",value:C,output:`\\${C}`});continue}Jr("brackets");let q=P.value.slice(1);if(P.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(C=`/${C}`),P.value+=C,Jt({value:C}),r.literalBrackets===!1||on.hasRegexChars(q))continue;let Te=on.escapeRegex(P.value);if(k.output=k.output.slice(0,-P.value.length),r.literalBrackets===!0){k.output+=Te,P.value=Te;continue}P.value=`(${a}${Te}|${P.value})`,k.output+=P.value;continue}if(C==="{"&&r.nobrace!==!0){_i("braces");let q={type:"brace",value:C,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};Q.push(q),de(q);continue}if(C==="}"){let q=Q[Q.length-1];if(r.nobrace===!0||!q){de({type:"text",value:C,output:C});continue}let Te=")";if(q.dots===!0){let lt=s.slice(),jt=[];for(let ct=lt.length-1;ct>=0&&(s.pop(),lt[ct].type!=="brace");ct--)lt[ct].type!=="dots"&&jt.unshift(lt[ct].value);Te=tAe(jt,r),k.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let lt=k.output.slice(0,q.outputIndex),jt=k.tokens.slice(q.tokensIndex);q.value=q.output="\\{",C=Te="\\}",k.output=lt;for(let ct of jt)k.output+=ct.output||ct.value}de({type:"brace",value:C,output:Te}),Jr("braces"),Q.pop();continue}if(C==="|"){B.length>0&&B[B.length-1].conditions++,de({type:"text",value:C});continue}if(C===","){let q=C,Te=Q[Q.length-1];Te&&Se[Se.length-1]==="braces"&&(Te.comma=!0,q="|"),de({type:"comma",value:C,output:q});continue}if(C==="/"){if(P.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",s.pop(),P=o;continue}de({type:"slash",value:C,output:f});continue}if(C==="."){if(k.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let q=Q[Q.length-1];P.type="dots",P.output+=C,P.value+=C,q.dots=!0;continue}if(k.braces+k.parens===0&&P.type!=="bos"&&P.type!=="slash"){de({type:"text",value:C,output:u});continue}de({type:"dot",value:C,output:u});continue}if(C==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){io("qmark",C);continue}if(P&&P.type==="paren"){let Te=se(),lt=C;(P.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Vt()))&&(lt=`\\${C}`),de({type:"text",value:C,output:lt});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){de({type:"qmark",value:C,output:S});continue}de({type:"qmark",value:C,output:_});continue}if(C==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){io("negate",C);continue}if(r.nonegate!==!0&&k.index===0){no();continue}}if(C==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){io("plus",C);continue}if(P&&P.value==="("||r.regex===!1){de({type:"plus",value:C,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||k.parens>0){de({type:"plus",value:C});continue}de({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:C,output:""});continue}de({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let q=QEe.exec(Vt());q&&(C+=q[0],k.index+=q[0].length),de({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,k.backtrack=!0,k.globstar=!0,lr(C);continue}let H=Vt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){io("star",C);continue}if(P.type==="star"){if(r.noglobstar===!0){lr(C);continue}let q=P.prev,Te=q.prev,lt=q.type==="slash"||q.type==="bos",jt=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!lt||H[0]&&H[0]!=="/")){de({type:"star",value:C,output:""});continue}let ct=k.braces>0&&(q.type==="comma"||q.type==="brace"),bi=B.length&&(q.type==="pipe"||q.type==="paren");if(!lt&&q.type!=="paren"&&!ct&&!bi){de({type:"star",value:C,output:""});continue}for(;H.slice(0,3)==="/**";){let vi=t[k.index+4];if(vi&&vi!=="/")break;H=H.slice(3),lr("/**",3)}if(q.type==="bos"&&Rr()){P.type="globstar",P.value+=C,P.output=R(r),k.output=P.output,k.globstar=!0,lr(C);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!jt&&Rr()){k.output=k.output.slice(0,-(q.output+P.output).length),q.output=`(?:${q.output}`,P.type="globstar",P.output=R(r)+(r.strictSlashes?")":"|$)"),P.value+=C,k.globstar=!0,k.output+=q.output+P.output,lr(C);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&H[0]==="/"){let vi=H[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(q.output+P.output).length),q.output=`(?:${q.output}`,P.type="globstar",P.output=`${R(r)}${f}|${f}${vi})`,P.value+=C,k.output+=q.output+P.output,k.globstar=!0,lr(C+Pe()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&H[0]==="/"){P.type="globstar",P.value+=C,P.output=`(?:^|${f}|${R(r)}${f})`,k.output=P.output,k.globstar=!0,lr(C+Pe()),de({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-P.output.length),P.type="globstar",P.output=R(r),P.value+=C,k.output+=P.output,k.globstar=!0,lr(C);continue}let pt={type:"star",value:C,output:D};if(r.bash===!0){pt.output=".*?",(P.type==="bos"||P.type==="slash")&&(pt.output=A+pt.output),de(pt);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){pt.output=C,de(pt);continue}(k.index===k.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(k.output+=g,P.output+=g):r.dot===!0?(k.output+=b,P.output+=b):(k.output+=A,P.output+=A),se()!=="*"&&(k.output+=p,P.output+=p)),de(pt)}for(;k.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(El("closing","]"));k.output=on.escapeLast(k.output,"["),Jr("brackets")}for(;k.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(El("closing",")"));k.output=on.escapeLast(k.output,"("),Jr("parens")}for(;k.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(El("closing","}"));k.output=on.escapeLast(k.output,"{"),Jr("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),k.backtrack===!0){k.output="";for(let H of k.tokens)k.output+=H.output!=null?H.output:H.value,H.suffix&&(k.output+=H.suffix)}return k};aP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(fv,r.maxLength):fv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=pJ[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}=Qf.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 E=/^(.*?)\.(\w+)$/.exec(A);if(!E)return;let D=x(E[1]);return D?D+o+E[2]:void 0}}},w=on.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};gJ.exports=aP});var vJ=v((klt,bJ)=>{"use strict";var aAe=fJ(),cP=yJ(),_J=Yf(),cAe=Jf(),lAe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=lAe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?_J.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(_J.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):cP(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>aAe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=cP.fastpaths(t,e)),i.output||(i=cP(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=cAe;bJ.exports=Tt});var $J=v((Elt,xJ)=>{"use strict";var SJ=vJ(),uAe=Yf();function wJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:uAe.isWindows()}),SJ(t,e,r)}Object.assign(wJ,SJ);xJ.exports=wJ});import{readdir as dAe,readdirSync as fAe,realpath as pAe,realpathSync as mAe,stat as hAe,statSync as gAe}from"fs";import{isAbsolute as yAe,posix as Ma,resolve as _Ae}from"path";import{fileURLToPath as bAe}from"url";function wAe(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]===".."&&SAe.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=>Ma.relative(t,n)||".":n=>Ma.relative(t,`${e}/${n}`)||"."}function kAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ma.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function TJ(t){var e;let r=Al.default.scan(t,EAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function PAe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Al.default.scan(t);return r.isGlob||r.negated}function ep(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function OJ(t){return typeof t=="string"?[t]:t??[]}function lP(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=IAe(o);s=yAe(s.replace(DAe,""))?Ma.relative(a,s):Ma.normalize(s);let c=(i=CAe.exec(s))===null||i===void 0?void 0:i[0],l=TJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?Ma.join(o,...d):o}return s}function NAe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(lP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(lP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(lP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function jAe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=NAe(t,e,n);t.debug&&ep("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(EJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Al.default)(i.match,f),m=(0,Al.default)(i.ignore,f),h=wAe(i.match,f),g=kJ(r,d,o),b=o?g:kJ(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 XK({filters:[a?(w,R)=>{let A=g(w,R),E=p(A)&&!m(A);return E&&ep(`matched ${A}`),E}:(w,R)=>{let A=g(w,R);return p(A)&&!m(A)}],exclude:a?(w,R)=>{let A=_(w,R);return ep(`${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&&ep("internal properties:",{...n,root:d}),[x,r!==d&&!o&&kAe(r,d)]}function MAe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function LAe(t){let e={...FAe,...t};return e.cwd=(e.cwd instanceof URL?bAe(e.cwd):_Ae(e.cwd)).replace(EJ,"/"),e.ignore=OJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||dAe,readdirSync:e.fs.readdirSync||fAe,realpath:e.fs.realpath||pAe,realpathSync:e.fs.realpathSync||mAe,stat:e.fs.stat||hAe,statSync:e.fs.statSync||gAe}),e.debug&&ep("globbing with options:",e),e}function zAe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=vAe(t)||typeof t=="string",i=OJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=LAe(n?e:t);return i.length>0?jAe(o,i):[]}function ds(t,e){let[r,n]=zAe(t,e);return r?MAe(r.sync(),n):[]}var Al,vAe,EJ,AJ,SAe,xAe,$Ae,EAe,AAe,TAe,OAe,RAe,IAe,CAe,DAe,FAe,tp=y(()=>{QK();Al=bt($J(),1),vAe=Array.isArray,EJ=/\\/g,AJ=process.platform==="win32",SAe=/^(\/?\.\.)+$/;xAe=/^[A-Z]:\/$/i,$Ae=AJ?t=>xAe.test(t):t=>t==="/";EAe={parts:!0};AAe=/(?t.replace(AAe,"\\$&"),RAe=t=>t.replace(TAe,"\\$&"),IAe=AJ?RAe:OAe;CAe=/^(\/?\.\.)+/,DAe=/\\(?=[()[\]{}!*+?@|])/g;FAe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as rp,readFileSync as UAe,readdirSync as qAe,statSync as RJ}from"node:fs";import{join as Fa}from"node:path";function BAe(t){let{cwd:e="."}=t,r,n;try{let c=G(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Ii(e,n),o=[],{layers:s,forbiddenImports:a}=uP(r);return(s.size>0||a.length>0)&&!rp(Fa(e,i.mainRoot))?[{detector:np,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&&(HAe(e,i,s,o),GAe(e,i,s,o)),a.length>0&&ZAe(e,i,a,o),o)}function uP(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 HAe(t,e,r,n){let i=e.mainRoot,o=Fa(t,i);if(rp(o))for(let s of qAe(o)){let a=Fa(o,s);RJ(a).isDirectory()&&(r.has(s)||n.push({detector:np,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function GAe(t,e,r,n){let i=e.mainRoot,o=Fa(t,i);if(rp(o))for(let s of r){let a=Fa(o,s);rp(a)&&RJ(a).isDirectory()||n.push({detector:np,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 ZAe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Fa(t,i,s.from);if(!rp(a))continue;let c=ds([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Fa(a,l),d;try{d=UAe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];VAe(p,s.to,e.importStyle)&&n.push({detector:np,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 VAe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var np,IJ,dP=y(()=>{"use strict";tp();qe();ja();np="ARCHITECTURE_FROM_SPEC";IJ={name:np,run:BAe}});import{existsSync as WAe,readFileSync as KAe}from"node:fs";import{join as JAe}from"node:path";function YAe(t){let{cwd:e="."}=t,r=JAe(e,"spec/capabilities.yaml");if(!WAe(r))return[];let n;try{let c=KAe(r,"utf8"),l=PJ.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=G(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:pv,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:pv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:pv,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var PJ,pv,CJ,DJ=y(()=>{"use strict";PJ=bt(Xt(),1);qe();pv="CAPABILITIES_FEATURE_MAPPING";CJ={name:pv,run:YAe}});import{existsSync as XAe,readFileSync as QAe}from"node:fs";import{join as eTe}from"node:path";function tTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function rTe(t){let{cwd:e="."}=t;return he(e,fP,r=>nTe(r,e))}function nTe(t,e){let r=Ii(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=eTe(e,o);if(!XAe(s))continue;let a=QAe(s,"utf8");tTe(a)||n.push({detector:fP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var fP,NJ,jJ=y(()=>{"use strict";ja();vt();fP="CONVENTION_DRIFT";NJ={name:fP,run:rTe}});import{existsSync as pP,readFileSync as MJ}from"node:fs";import{join as mv}from"node:path";function iTe(t){return JSON.parse(t).total?.lines?.pct??0}function FJ(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function aTe(t,e){if(!Jb(ut(t).gates.coverage?.cmd))return null;let r;try{r=Yb(t,e)}catch(c){return[{detector:_o,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=GI.find(d=>pP(mv(c.dir,d)));if(!l){s.push(c.path);continue}let u=FJ(MJ(mv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:_o,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=LJ(n,i);return a0?[{detector:_o,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function cTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=aTe(e,t.focusModules);if(a)return a}let r;try{r=G(e).project?.language}catch{}let n=Ii(e,r),i=ut(e).language==="kotlin"?GI.find(a=>pP(mv(e,a)))??SK(e):n.coverageSummary,o=mv(e,i);if(!pP(o))return[{detector:_o,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=MJ(o,"utf8");s=n.coverageFormat==="jacoco-xml"?oTe(a):n.coverageFormat==="cobertura-xml"?sTe(a):iTe(a)}catch(a){return[{detector:_o,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:_o,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=hv?[]:[{detector:_o,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${hv}%`}]}var _o,hv,zJ,UJ=y(()=>{"use strict";qe();tv();ja();Xb();nn();_o="COVERAGE_DROP",hv=70;zJ={name:_o,run:cTe}});import{existsSync as lTe}from"node:fs";import{join as uTe}from"node:path";function dTe(t){let{cwd:e="."}=t;return he(e,gv,r=>fTe(r,e))}function fTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?lTe(uTe(e,r.path))?[]:[{detector:gv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:gv,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var gv,qJ,BJ=y(()=>{"use strict";vt();gv="DELIVERABLE_INTEGRITY";qJ={name:gv,run:dTe}});function pTe(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 mTe(t){let e=pTe(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 hTe(t){let{cwd:e="."}=t;return he(e,yv,r=>mTe(r))}var yv,HJ,GJ=y(()=>{"use strict";vt();yv="SMOKE_PROBE_DEMAND";HJ={name:yv,run:hTe}});function gTe(t){let{cwd:e="."}=t;return he(e,_v,r=>yTe(r,e))}function yTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=rs(e);if(n===null)return[{detector:_v,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=g_(n,e,o);s.state!=="fresh"&&i.push({detector:_v,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 _v,bv,mP=y(()=>{"use strict";nl();vt();_v="STALE_ATTESTATION";bv={name:_v,run:gTe}});function _Te(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}return bTe(r)}function bTe(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:ZJ,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 ZJ,vv,hP=y(()=>{"use strict";qe();ZJ="DEPENDENCY_CYCLE";vv={name:ZJ,run:_Te}});import{appendFileSync as vTe,existsSync as VJ,mkdirSync as STe,readFileSync as wTe}from"node:fs";import{dirname as xTe,join as $Te}from"node:path";function WJ(t){return $Te(t,kTe,ETe)}function KJ(t){return gP.add(t),()=>gP.delete(t)}function La(t,e){let r=WJ(t),n=xTe(r);VJ(n)||STe(n,{recursive:!0}),vTe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of gP)try{i(t,e)}catch{}}function Tn(t){let e=WJ(t);if(!VJ(e))return[];let r=wTe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var kTe,ETe,gP,Xn=y(()=>{"use strict";kTe=".cladding",ETe="audit.log.jsonl";gP=new Set});import{existsSync as ATe}from"node:fs";import{join as TTe}from"node:path";function OTe(t){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return[{detector:yP,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&&(ATe(TTe(e,i.artifact))||n.push({detector:yP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var yP,JJ,YJ=y(()=>{"use strict";Xn();yP="EVIDENCE_MISMATCH";JJ={name:yP,run:OTe}});import{existsSync as RTe,readFileSync as ITe}from"node:fs";import{join as PTe}from"node:path";function CTe(t){let e=PTe(t,t8);if(!RTe(e))return null;try{let n=((0,e8.parse)(ITe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*QJ(t,e){for(let r of t??[])r.startsWith(XJ)&&(yield{ref:r,name:r.slice(XJ.length),field:e})}function DTe(t){let{cwd:e="."}=t,r=CTe(e);if(r===null)return[];let n;try{n=G(e)}catch(o){return[{detector:_P,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=[...QJ(s.evidence_refs,"evidence_refs"),...QJ(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:_P,severity:"warn",path:t8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var e8,_P,XJ,t8,r8,n8=y(()=>{"use strict";e8=bt(Xt(),1);qe();_P="FIXTURE_REFERENCE_INVALID",XJ="fixture:",t8="conformance/fixtures.yaml";r8={name:_P,run:DTe}});import{existsSync as Tl,readFileSync as bP}from"node:fs";import{join as za}from"node:path";function NTe(t){return ds(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function ip(t){if(!Tl(t))return null;try{return JSON.parse(bP(t,"utf8"))}catch{return null}}function jTe(t,e){let r=za(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(bP(r,"utf8"))}catch(c){e.push({detector:bo,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:bo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=NTe(t);s!==a&&e.push({detector:bo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function MTe(t,e){for(let r of i8){let n=za(t,r.path);if(!Tl(n))continue;let i=ip(n);if(!i){e.push({detector:bo,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:bo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function FTe(t,e){let r=ip(za(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of i8){let s=za(t,o.path);if(!Tl(s))continue;let a=ip(s);a?.version&&a.version!==n&&e.push({detector:bo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=za(t,".claude-plugin","marketplace.json");if(Tl(i)){let o=ip(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:bo,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 LTe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function zTe(t,e){let r=za(t,"src","cli","clad.ts"),n=za(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Tl(r)||!Tl(n))return;let i=LTe(bP(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:bo,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 UTe(t){let{cwd:e="."}=t,r=[];return jTe(e,r),zTe(e,r),MTe(e,r),FTe(e,r),r}var bo,i8,o8,s8=y(()=>{"use strict";tp();bo="HARNESS_INTEGRITY",i8=[{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"]}];o8={name:bo,run:UTe}});import{existsSync as qTe,readFileSync as BTe}from"node:fs";import{join as HTe}from"node:path";function ZTe(t){let{cwd:e="."}=t;return he(e,Sv,r=>WTe(r,e))}function VTe(t){let e=HTe(t,"spec/capabilities.yaml");if(!qTe(e))return!1;try{let r=a8.default.parse(BTe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function WTe(t,e){let r=t.features.length;if(r{"use strict";a8=bt(Xt(),1);vt();Sv="HOLLOW_GOVERNANCE",GTe=8;c8={name:Sv,run:ZTe}});import{existsSync as u8,readFileSync as d8}from"node:fs";import{join as f8}from"node:path";function p8(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 YTe(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 XTe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function QTe(t){let e=f8(t,"README.md"),r=f8(t,"docs","dogfood","matrix.md");if(!u8(e)||!u8(r))return[];let n=p8(d8(e,"utf8"),KTe),i=p8(d8(r,"utf8"),JTe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=XTe(a);if(c===null)continue;let l=i[s]??"not-run",u=YTe(l);u!==null&&c>u&&o.push({detector:m8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function eOe(t){let{cwd:e="."}=t;return QTe(e)}var m8,KTe,JTe,h8,g8=y(()=>{"use strict";m8="HOST_CLAIM_DRIFT",KTe=//,JTe=//;h8={name:m8,run:eOe}});function tOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return y8(r.features.map(i=>i.id),"feature","spec/features/",n),y8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function y8(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:_8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var _8,b8,v8=y(()=>{"use strict";qe();_8="ID_COLLISION";b8={name:_8,run:tOe}});import{existsSync as op,readFileSync as vP,readdirSync as SP,statSync as rOe,writeFileSync as w8}from"node:fs";import{join as vo}from"node:path";function S8(t){if(!op(t))return 0;try{return SP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function nOe(t){if(!op(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=SP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=vo(n,o),a;try{a=rOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function iOe(t){let e=vo(t,"spec","capabilities.yaml");if(!op(e))return 0;try{let r=wv.default.parse(vP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function fs(t="."){let e=S8(vo(t,"spec","features")),r=S8(vo(t,"spec","scenarios")),n=iOe(t),i=nOe(vo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Ol(t,e){let r=vo(t,"spec.yaml");if(!op(r))return;let n=vP(r,"utf8"),i=oOe(n,e);i!==n&&w8(r,i)}function oOe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as dxe}from"node:buffer";import{StringDecoder as fxe}from"node:string_decoder";var Fb,pxe,mxe,hxe,nI=y(()=>{rn();Fb=(t,e,r)=>{if(r)return;if(t)return{transform:pxe.bind(void 0,new TextEncoder)};let n=new fxe(e);return{transform:mxe.bind(void 0,n),final:hxe.bind(void 0,n)}},pxe=function*(t,e){dxe.isBuffer(e)?yield mo(e):typeof e=="string"?yield t.encode(e):yield e},mxe=function*(t,e){yield zt(e)?t.write(e):e},hxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as $W}from"node:util";var iI,Lb,kW,gxe,EW,yxe,AW=y(()=>{iI=$W(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Lb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=yxe}=e[r];for await(let i of n(t))yield*Lb(i,e,r+1)},kW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*gxe(r,Number(e),t)},gxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Lb(n,r,e+1)},EW=$W(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),yxe=function*(t){yield t}});var oI,TW,Ia,Jf,_xe,bxe,sI=y(()=>{oI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},TW=(t,e)=>[...e.flatMap(r=>[...Ia(r,t,0)]),...Jf(t)],Ia=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=bxe}=e[r];for(let i of n(t))yield*Ia(i,e,r+1)},Jf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*_xe(r,Number(e),t)},_xe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ia(n,r,e+1)},bxe=function*(t){yield t}});import{Transform as vxe,getDefaultHighWaterMark as OW}from"node:stream";var aI,zb,RW,Ub=y(()=>{vr();Mb();xW();nI();AW();sI();aI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=RW(t,s,o),l=Ra(e),u=Ra(r),d=l?iI.bind(void 0,Lb,a):oI.bind(void 0,Ia),f=l||u?iI.bind(void 0,kW,a):oI.bind(void 0,Jf),p=l||u?EW.bind(void 0,a):void 0;return{stream:new vxe({writableObjectMode:n,writableHighWaterMark:OW(n),readableObjectMode:i,readableHighWaterMark:OW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},zb=(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=RW(s,r,a);t=TW(c,t)}return t},RW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:vW(n,a)},Fb(r,s,n),jb(r,o,n,c),{transform:t,final:e},{transform:SW(i,a)},bW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var IW,Sxe,wxe,xxe,$xe,PW=y(()=>{Ub();rn();vr();IW=(t,e)=>{for(let r of Sxe(t))wxe(t,r,e)},Sxe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),wxe=(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 ${us[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>xxe(a,n));r.input=Df(s)},xxe=(t,e)=>{let r=zb(t,e,"utf8",!0);return $xe(r),Df(r)},$xe=t=>{let e=t.find(r=>typeof r!="string"&&!zt(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 qb,kxe,Exe,CW,DW,Axe,NW,cI=y(()=>{Ea();vr();hl();ss();qb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&ml(r,n)&&!nn.has(e)&&kxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Exe.has(o))||t.every(({type:i})=>An.has(i))),kxe=t=>t===1||t===2,Exe=new Set(["pipe","overlapped"]),CW=async(t,e,r,n)=>{for await(let i of t)Axe(e)||NW(i,r,n)},DW=(t,e,r)=>{for(let n of t)NW(n,e,r)},Axe=t=>t._readableState.pipes.length>0,NW=(t,e,r)=>{let n=U_(t);Ti({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Txe,appendFileSync as Oxe}from"node:fs";var jW,Rxe,Ixe,Pxe,Cxe,Dxe,MW=y(()=>{cI();Ub();Mb();rn();vr();Oa();jW=({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)=>Rxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Rxe=({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=SV(t,o,d),p=mo(f),{stdioItems:m,objectMode:h}=e[r],g=Ixe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Pxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Cxe({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&&Dxe(b,m,i),S}catch(x){return n.error=x,S}},Ixe=(t,e,r,n)=>{try{return zb(t,e,r,!1)}catch(i){return n.error=i,t}},Pxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Df(t)};let s=dG(t,r);return n[o]?{serializedResult:s,finalResult:rI(s,!i[o],e)}:{serializedResult:s}},Cxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!qb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=rI(t,!1,s);try{DW(a,e,n)}catch(c){r.error??=c}},Dxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Cb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Oxe(n,t):(r.add(o),Txe(n,t))}}});var FW,LW=y(()=>{rn();Kf();FW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,bo(e,r,"all")]:Array.isArray(e)?[bo(t,r,"all"),...e]:zt(t)&&zt(e)?YO([t,e]):`${t}${e}`}});import{once as lI}from"node:events";var zW,Nxe,UW,qW,jxe,uI,dI=y(()=>{$a();zW=async(t,e)=>{let[r,n]=await Nxe(t);return e.isForcefullyTerminated??=!1,[r,n]},Nxe=async t=>{let[e,r]=await Promise.allSettled([lI(t,"spawn"),lI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?UW(t):r.value},UW=async t=>{try{return await lI(t,"exit")}catch{return UW(t)}},qW=async t=>{let[e,r]=await t;if(!jxe(e,r)&&uI(e,r))throw new Xn;return[e,r]},jxe=(t,e)=>t===void 0&&e===void 0,uI=(t,e)=>t!==0||e!==null});var BW,Mxe,HW=y(()=>{$a();Oa();dI();BW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=Mxe(t,e,r),s=o?.code==="ETIMEDOUT",a=vV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},Mxe=(t,e,r)=>t!==void 0?t:uI(e,r)?new Xn:void 0});import{spawnSync as Fxe}from"node:child_process";var GW,Lxe,zxe,Uxe,Bb,qxe,Bxe,Hxe,Gxe,ZW=y(()=>{sR();DR();NR();Wf();Rb();gW();Kf();PW();MW();Oa();LW();HW();GW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Lxe(t,e,r),d=qxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return El(d,c,l)},Lxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=H_(t,e,r),a=zxe(r),{file:c,commandArguments:l,options:u}=yb(t,e,a);Uxe(u);let d=mW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},zxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Uxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Bb("ipcInput"),t&&Bb("ipc: true"),r&&Bb("detached: true"),n&&Bb("cancelSignal")},Bb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},qxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Bxe({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}=BW(c,r),{output:m,error:h=l}=jW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>bo(_,r,S)),b=bo(FW(m,r),r,"all");return Gxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Bxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{IW(o,r);let a=Hxe(r);return Fxe(..._b(t,e,a))}catch(a){return kl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},Hxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Tb(e)}),Gxe=({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?Ob({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Vf({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 Zxe}from"node:events";var VW,Vxe,Wxe,Kxe,Jxe,WW=y(()=>{vl();qf();Uf();VW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(_l({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:ub(t)}),Vxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Vxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{nb(e,i);let o=ls(t,e,r),s=new AbortController;try{return await Promise.race([Wxe(o,n,s),Kxe(o,r,s),Jxe(o,r,s)])}catch(a){throw bl(t),a}finally{s.abort(),ib(e,i)}},Wxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await fI(t,"message",{signal:r});return n}for await(let[n]of Zxe(t,"message",{signal:r}))if(e(n))return n},Kxe=async(t,e,{signal:r})=>{await fI(t,"disconnect",{signal:r}),o9(e)},Jxe=async(t,e,{signal:r})=>{let[n]=await fI(t,"strict:error",{signal:r});throw Q_(n,e)}});import{once as JW,on as Yxe}from"node:events";var YW,pI,Xxe,Qxe,e0e,KW,mI=y(()=>{vl();qf();Uf();YW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>pI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),pI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{_l({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:ub(t)}),nb(e,o);let s=ls(t,e,r),a=new AbortController,c={};return Xxe(t,s,a),Qxe({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),e0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Xxe=async(t,e,r)=>{try{await JW(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Qxe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await JW(t,"strict:error",{signal:r.signal});n.error=Q_(i,e),r.abort()}catch{}},e0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of Yxe(r,"message",{signal:o.signal}))KW(s),yield c}catch{KW(s)}finally{o.abort(),ib(e,a),n||bl(t),i&&await t}},KW=({error:t})=>{if(t)throw t}});import XW from"node:process";var QW,e3,t3,hI=y(()=>{hb();WW();mI();cb();QW=(t,{ipc:e})=>{Object.assign(t,t3(t,!1,e))},e3=()=>{let t=XW,e=!0,r=XW.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:mb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:VW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:YW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as t0e}from"node:child_process";import{PassThrough as r0e,Readable as n0e,Writable as i0e,Duplex as o0e}from"node:stream";var r3,s0e,Yf,a0e,c0e,l0e,u0e,n3=y(()=>{Nb();Wf();Rb();r3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{QR(n);let a=new t0e;s0e(a,n),Object.assign(a,{readable:a0e,writable:c0e,duplex:l0e});let c=kl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=u0e(c,s,i);return{subprocess:a,promise:l}},s0e=(t,e)=>{let r=Yf(),n=Yf(),i=Yf(),o=Array.from({length:e.length-3},Yf),s=Yf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Yf=()=>{let t=new r0e;return t.end(),t},a0e=()=>new n0e({read(){}}),c0e=()=>new i0e({write(){}}),l0e=()=>new o0e({read(){},write(){}}),u0e=async(t,e,r)=>El(t,e,r)});import{createReadStream as i3,createWriteStream as o3}from"node:fs";import{Buffer as d0e}from"node:buffer";import{Readable as Xf,Writable as f0e,Duplex as p0e}from"node:stream";var a3,Qf,s3,m0e,c3=y(()=>{Ub();Nb();vr();a3=(t,e)=>Db(m0e,t,e,!1),Qf=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${us[t]}.`)},s3={fileNumber:Qf,generator:aI,asyncGenerator:aI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:p0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},m0e={input:{...s3,fileUrl:({value:t})=>({stream:i3(t)}),filePath:({value:{file:t}})=>({stream:i3(t)}),webStream:({value:t})=>({stream:Xf.fromWeb(t)}),iterable:({value:t})=>({stream:Xf.from(t)}),asyncIterable:({value:t})=>({stream:Xf.from(t)}),string:({value:t})=>({stream:Xf.from(t)}),uint8Array:({value:t})=>({stream:Xf.from(d0e.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:f0e.fromWeb(t)}),iterable:Qf,asyncIterable:Qf,string:Qf,uint8Array:Qf}}});import{on as h0e,once as l3}from"node:events";import{PassThrough as g0e,getDefaultHighWaterMark as y0e}from"node:stream";import{finished as f3}from"node:stream/promises";function Pa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)yI(i);let e=t.some(({readableObjectMode:i})=>i),r=_0e(t,e),n=new gI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var _0e,gI,b0e,v0e,S0e,yI,w0e,x0e,$0e,k0e,E0e,p3,m3,_I,h3,A0e,Hb,u3,d3,Gb=y(()=>{_0e=(t,e)=>{if(t.length===0)return y0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},gI=class extends g0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(yI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=b0e(this,this.#t,this.#o);let r=w0e({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(yI(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)}},b0e=async(t,e,r)=>{Hb(t,u3);let n=new AbortController;try{await Promise.race([v0e(t,n),S0e(t,e,r,n)])}finally{n.abort(),Hb(t,-u3)}},v0e=async(t,{signal:e})=>{try{await f3(t,{signal:e,cleanup:!0})}catch(r){throw p3(t,r),r}},S0e=async(t,e,r,{signal:n})=>{for await(let[i]of h0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},yI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},w0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Hb(t,d3);let a=new AbortController;try{await Promise.race([x0e(o,e,a),$0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),k0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Hb(t,-d3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?_I(t):E0e(t))},x0e=async(t,e,{signal:r})=>{try{await t,r.aborted||_I(e)}catch(n){r.aborted||p3(e,n)}},$0e=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)}},k0e=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)},E0e=t=>{t.writable&&t.end()},p3=(t,e)=>{m3(e)?_I(t):h3(t,e)},m3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",_I=t=>{(t.readable||t.writable)&&t.destroy()},h3=(t,e)=>{t.destroyed||(t.once("error",A0e),t.destroy(e))},A0e=()=>{},Hb=(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 Tl,T0e,bI,O0e,vI,Zb=y(()=>{ho();Tl=(t,e)=>{t.pipe(e),T0e(t,e),O0e(t,e)},T0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await g3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}bI(e)}},bI=t=>{t.writable&&t.end()},O0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await g3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}vI(t)}},vI=t=>{t.readable&&t.destroy()}});var y3,R0e,I0e,P0e,C0e,D0e,_3=y(()=>{Gb();ho();rb();vr();Zb();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})=>An.has(c)))R0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.has(c)))P0e({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]:Pa(o);Tl(s,i)}},R0e=(t,e,r,n)=>{r==="output"?Tl(t.stdio[n],e):Tl(e,t.stdio[n]);let i=I0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},I0e=["stdin","stdout","stderr"],P0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;C0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},C0e=(t,{signal:e})=>{Yn(t)&&ka(t,D0e,e)},D0e=2});var Ca,b3=y(()=>{Ca=[];Ca.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ca.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ca.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Vb,SI,wI,N0e,xI,Wb,j0e,$I,kI,EI,v3,Kot,Jot,S3=y(()=>{b3();Vb=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",SI=Symbol.for("signal-exit emitter"),wI=globalThis,N0e=Object.defineProperty.bind(Object),xI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(wI[SI])return wI[SI];N0e(wI,SI,{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}},Wb=class{},j0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),$I=class extends Wb{onExit(){return()=>{}}load(){}unload(){}},kI=class extends Wb{#t=EI.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 Ca)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(!Vb(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 Ca)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,Ca.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 Vb(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"&&Vb(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)}},EI=globalThis.process,{onExit:v3,load:Kot,unload:Jot}=j0e(Vb(EI)?new kI(EI):new $I)});import{addAbortListener as M0e}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()});M0e(n,()=>{i()})}});var k3,F0e,L0e,$3,z0e,E3=y(()=>{JO();B_();cs();fl();k3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=q_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=F0e(r,n,i),{sourceStream:d,sourceError:f}=z0e(t,l),{options:p,fileDescriptors:m}=Ri.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},F0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=L0e(t,e,...r),a=tb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},L0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e($3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||WO(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]=I_(r,...n);return{destination:e($3)(i,o,s),pipeOptions:s}}if(Ri.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}}),z0e=(t,e)=>{try{return{sourceStream:wl(t,e)}}catch(r){return{sourceError:r}}}});var T3,U0e,AI,A3,TI=y(()=>{Wf();Zb();T3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=U0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw AI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},U0e=({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 bI(r),e},AI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>kl({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 q0e}from"node:stream/promises";var I3,B0e,H0e,G0e,Kb,Z0e,V0e,P3=y(()=>{Gb();rb();Zb();I3=(t,e,r)=>{let n=Kb.has(e)?H0e(t,e):B0e(t,e);return ka(t,Z0e,r.signal),ka(e,V0e,r.signal),G0e(e),n},B0e=(t,e)=>{let r=Pa([t]);return Tl(r,e),Kb.set(e,r),r},H0e=(t,e)=>{let r=Kb.get(e);return r.add(t),r},G0e=async t=>{try{await q0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Kb.delete(t)},Kb=new WeakMap,Z0e=2,V0e=1});import{aborted as W0e}from"node:util";var C3,K0e,D3=y(()=>{TI();C3=(t,e)=>t===void 0?[]:[K0e(t,e)],K0e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await W0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw AI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var Jb,J0e,Y0e,N3=y(()=>{po();E3();TI();R3();P3();D3();Jb=(t,...e)=>{if(At(e[0]))return Jb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=k3(t,...e),i=J0e({...n,destination:r});return i.pipe=Jb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},J0e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=Y0e(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()}},Y0e=(t,e)=>Promise.allSettled([t,e])});import{on as X0e}from"node:events";import{getDefaultHighWaterMark as Q0e}from"node:stream";var Yb,e$e,OI,t$e,M3,RI,j3,r$e,n$e,Xb=y(()=>{nI();Mb();sI();Yb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return e$e(e,s),M3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},e$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},OI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;t$e(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})},t$e=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=X0e(t,"data",{signal:e.signal,highWaterMark:j3,highWatermark:j3});return r$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},RI=Q0e(!0),j3=RI,r$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=n$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ia(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Jf(a)}},n$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Fb(t,r,!e),jb(t,i,!n,{})].filter(Boolean)});import{setImmediate as i$e}from"node:timers/promises";var F3,o$e,s$e,a$e,II,L3,PI=y(()=>{Ab();rn();cI();Xb();Oa();Kf();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=o$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([s$e(t),d]);return}let f=eI(c,r),p=OI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([a$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},o$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!qb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=OI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await CW(a,t,r,o)},s$e=async t=>{await i$e(),t.readableFlowing===null&&t.resume()},a$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await xb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await $b(r,{maxBuffer:o})):await Eb(r,{maxBuffer:o})}catch(a){return L3(yV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},II=async t=>{try{return await t}catch(e){return L3(e)}},L3=({bufferedData:t})=>lG(t)?new Uint8Array(t):t});import{finished as c$e}from"node:stream/promises";var ep,l$e,u$e,d$e,f$e,p$e,CI,Qb,z3,ev=y(()=>{ep=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=l$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],c$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||f$e(a,e,r,n)}finally{s.abort()}},l$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&u$e(t,r,n),n},u$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{d$e(e,r),n.call(t,...i)}},d$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},f$e=(t,e,r,n)=>{if(!p$e(t,e,r,n))throw t},p$e=(t,e,r,n=!0)=>r.propagating?z3(t)||Qb(t):(r.propagating=!0,CI(r,e)===n?z3(t):Qb(t)),CI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Qb=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",z3=t=>t?.code==="EPIPE"});var U3,DI,NI=y(()=>{PI();ev();U3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>DI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),DI=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=ep(t,e,l);if(CI(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,B3,m$e,h$e,jI=y(()=>{Gb();NI();q3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Pa([t,e].filter(Boolean)):void 0,B3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>DI({...m$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:h$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),m$e=({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}},h$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var H3,G3,Z3=y(()=>{hl();ss();H3=t=>ml(t,"ipc"),G3=(t,e)=>{let r=U_(t);Ti({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var V3,W3,K3=y(()=>{Oa();Z3();yo();mI();V3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=H3(o),a=go(e,"ipc"),c=go(r,"ipc");for await(let l of pI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(_V(t,i,c),i.push(l)),s&&G3(l,o);return i},W3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as g$e}from"node:events";var J3,y$e,_$e,b$e,Y3=y(()=>{Ta();OR();vR();TR();ho();vr();PI();K3();IR();jI();NI();dI();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 _=zW(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=B3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=V3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=y$e(h,t,S),D=_$e(m,S);try{return await Promise.race([Promise.all([{},qW(_),Promise.all(x),w,T,B9(t,d),...A,...D]),g,b$e(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(q=>II(q))),II(w),W3(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},y$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:ep(n,i,r)),_$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>ep(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),b$e=async(t,{signal:e})=>{let[r]=await g$e(t,"error",{signal:e});throw r}});var X3,tp,Ol,tv=y(()=>{Sl();X3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),tp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Oi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Ol=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 MI,eK,FI,LI,rv,nv,zI=y(()=>{ev();MI=async t=>{if(t!==void 0)try{await FI(t)}catch{}},eK=async t=>{if(t!==void 0)try{await LI(t)}catch{}},FI=async t=>{await Q3(t,{cleanup:!0,readable:!1,writable:!0})},LI=async t=>{await Q3(t,{cleanup:!0,readable:!0,writable:!1})},rv=async(t,e)=>{if(await t,e)throw e},nv=(t,e,r)=>{r&&!Qb(r)?t.destroy(r):e&&t.destroy()}});import{Readable as v$e}from"node:stream";import{callbackify as S$e}from"node:util";var tK,UI,qI,BI,w$e,HI,GI,rK,ZI=y(()=>{Ea();cs();Xb();Sl();tv();zI();tK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=UI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=qI(a,s),{read:f,onStdoutDataDone:p}=BI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new v$e({read:f,destroy:S$e(GI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return HI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},UI=(t,e,r)=>{let n=wl(t,e),i=tp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},qI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:RI},BI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Oi(),s=Yb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){w$e(this,s,o)},onStdoutDataDone:o}},w$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},HI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await LI(t),await n,await MI(i),await e,r.readable&&r.push(null)}catch(o){await MI(i),rK(r,o)}},GI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Ol(r,e)&&(rK(t,n),await rv(e,n))},rK=(t,e)=>{nv(t,t.readable,e)}});import{Writable as x$e}from"node:stream";import{callbackify as nK}from"node:util";var iK,VI,WI,$$e,k$e,KI,JI,oK,YI=y(()=>{cs();tv();zI();iK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=VI(t,r,e),s=new x$e({...WI(n,t,i),destroy:nK(JI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return KI(n,s),s},VI=(t,e,r)=>{let n=tb(t,e),i=tp(r,n,"writableFinal"),o=tp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},WI=(t,e,r)=>({write:$$e.bind(void 0,t),final:nK(k$e.bind(void 0,t,e,r))}),$$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},k$e=async(t,e,r)=>{await Ol(r,e)&&(t.writable&&t.end(),await e)},KI=async(t,e,r)=>{try{await FI(t),e.writable&&e.end()}catch(n){await eK(r),oK(e,n)}},JI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Ol(r,e),await Ol(n,e)&&(oK(t,i),await rv(e,i))},oK=(t,e)=>{nv(t,t.writable,e)}});import{Duplex as E$e}from"node:stream";import{callbackify as A$e}from"node:util";var sK,T$e,aK=y(()=>{Ea();ZI();YI();sK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=UI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=VI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=qI(c,a),{read:g,onStdoutDataDone:b}=BI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new E$e({read:g,...WI(u,t,d),destroy:A$e(T$e.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 HI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),KI(u,_,c),_},T$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([GI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),JI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var XI,O$e,cK=y(()=>{Ea();cs();Xb();XI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=wl(t,r),a=Yb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return O$e(a,s,t)},O$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var lK,uK=y(()=>{tv();ZI();YI();aK();cK();lK=(t,{encoding:e})=>{let r=X3();t.readable=tK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=iK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=sK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=XI.bind(void 0,t,e),t[Symbol.asyncIterator]=XI.bind(void 0,t,e,{})}});var dK,R$e,I$e,fK=y(()=>{dK=(t,e)=>{for(let[r,n]of I$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},R$e=(async()=>{})().constructor.prototype,I$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(R$e,t)])});import{setMaxListeners as P$e}from"node:events";import{spawn as C$e}from"node:child_process";var pK,D$e,N$e,j$e,M$e,F$e,mK=y(()=>{Ab();sR();DR();cs();NR();hI();Wf();Rb();n3();c3();Kf();_3();Y_();x3();N3();jI();Y3();uK();Sl();fK();pK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=D$e(t,e,r),{subprocess:f,promise:p}=j$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Jb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),dK(f,p),Ri.set(f,{options:u,fileDescriptors:d}),f},D$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=H_(t,e,r),{file:a,commandArguments:c,options:l}=yb(t,e,r),u=N$e(l),d=a3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},N$e=({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}},j$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=C$e(..._b(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;P$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];y3(c,a,l),w3(c,r,l);let d={},f=Oi();c.kill=r9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=q3(c,r),lK(c,r),QW(c,r);let p=M$e({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}},M$e=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)=>bo(x,e,w)),_=bo(h,e,"all"),S=F$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return El(S,n,e)},F$e=({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?Vf({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 Ii,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Ob({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var iv,L$e,z$e,hK=y(()=>{po();yo();iv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,L$e(n,t[n],i)]));return{...t,...r}},L$e=(t,e,r)=>z$e.has(t)&&At(e)&&At(r)?{...e,...r}:r,z$e=new Set(["env",...tR])});var ds,U$e,q$e,gK=y(()=>{po();JO();yG();ZW();mK();hK();ds=(t,e,r,n)=>{let i=(s,a,c)=>ds(s,a,r,c),o=(...s)=>U$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},U$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(At(o))return i(t,iv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=q$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?GW(a,c,l):pK(a,c,l,i)},q$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=hG(e)?gG(e,r):[e,...r],[s,a,c]=I_(...o),l=iv(iv(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 yK,_K,bK,B$e,H$e,vK=y(()=>{yK=({file:t,commandArguments:e})=>bK(t,e),_K=({file:t,commandArguments:e})=>({...bK(t,e),isSync:!0}),bK=(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]=B$e(t);return{file:r,commandArguments:n}},B$e=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(H$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},H$e=/ +/g});var SK,wK,G$e,xK,Z$e,$K,kK=y(()=>{SK=(t,e,r)=>{t.sync=e(G$e,r),t.s=t.sync},wK=({options:t})=>xK(t),G$e=({options:t})=>({...xK(t),isSync:!0}),xK=t=>({options:{...Z$e(t),...t}}),Z$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},$K={preferLocal:!0}});var Lct,Je,zct,Uct,qct,Bct,Hct,Gct,Zct,Vct,Mr=y(()=>{gK();vK();RR();kK();hI();Lct=ds(()=>({})),Je=ds(()=>({isSync:!0})),zct=ds(yK),Uct=ds(_K),qct=ds(z9),Bct=ds(wK,{},$K,SK),{sendMessage:Hct,getOneMessage:Gct,getEachMessage:Zct,getCancelSignal:Vct}=e3()});import{existsSync as ov,statSync as V$e}from"node:fs";import{dirname as QI,extname as W$e,isAbsolute as EK,join as eP,relative as tP,resolve as sv,sep as K$e}from"node:path";function av(t){return t==="./gradlew"||t==="gradle"}function J$e(t){return(ov(eP(t,"build.gradle.kts"))||ov(eP(t,"build.gradle")))&&ov(eP(t,"gradle.properties"))}function Y$e(t,e){let n=tP(t,e).split(K$e).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function fs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function X$e(t,e){let r=sv(t,e),n=r;ov(r)?V$e(r).isFile()&&(n=QI(r)):W$e(r)!==""&&(n=QI(r));let i=tP(t,n);if(i.startsWith("..")||EK(i))return null;let o=n;for(;;){if(J$e(o))return o;if(sv(o)===sv(t))return null;let s=QI(o);if(s===o)return null;let a=tP(t,s);if(a.startsWith("..")||EK(a))return null;o=s}}function cv(t,e){let r=sv(t),n=new Map,i=[];for(let o of e){let s=X$e(r,o);if(!s){i.push(o);continue}let a=Y$e(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 lv=y(()=>{"use strict"});import{existsSync as Q$e,readFileSync as eke}from"node:fs";import{join as tke}from"node:path";function Rl(t="."){let e=tke(t,".cladding","config.yaml");if(!Q$e(e))return rP;try{let n=(0,AK.parse)(eke(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 rke){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 TK(t,e){let r=[],n=!1;for(let i of t){let o=nke.exec(i);if(o){n=!0;for(let s of e)r.push(fs(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 AK,rke,rP,nke,uv=y(()=>{"use strict";AK=bt(Qt(),1);lv();rke=["type","lint","test","coverage"],rP={scope:"feature"};nke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as iP,readFileSync as OK,readdirSync as ike,statSync as oke}from"node:fs";import{join as dv}from"node:path";function aP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=dv(t,e);if(iP(r))try{if(RK.test(OK(r,"utf8")))return!0}catch{}}return!1}function IK(t){try{return iP(t)&&RK.test(OK(t,"utf8"))}catch{return!1}}function PK(t,e=0){if(e>4||!iP(t))return!1;let r;try{r=ike(t)}catch{return!1}for(let n of r){let i=dv(t,n),o=!1;try{o=oke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(PK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&IK(i))return!0}return!1}function cke(t){if(aP(t))return!0;for(let e of ske)if(IK(dv(t,e)))return!0;for(let e of ake)if(PK(dv(t,e)))return!0;return!1}function CK(t="."){let e=Rl(t).coverage;return e||(cke(t)?"kover":"jacoco")}function DK(t="."){return oP[CK(t)]}function NK(t="."){return nP[CK(t)]}var oP,nP,sP,RK,ske,ake,fv=y(()=>{"use strict";uv();oP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},nP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},sP=[nP.kover,nP.jacoco],RK=/kover/i;ske=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],ake=["buildSrc","build-logic"]});import{existsSync as pv,readFileSync as jK,readdirSync as MK}from"node:fs";import{join as Da}from"node:path";function cP(t){return pv(Da(t,"gradlew"))?"./gradlew":"gradle"}function lke(t){let e=cP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[DK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function uke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(jK(Da(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 fke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function hke(t,e){for(let r of e)if(pv(Da(t,r)))return r}function gke(t,e){try{return MK(t).find(n=>n.endsWith(e))}catch{return}}function _ke(t,e){for(let r of yke)if(r.configs.some(n=>pv(Da(t,n))))return r.gate;return e}function vke(t){if(bke.some(e=>pv(Da(t,e))))return!0;try{return JSON.parse(jK(Da(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function Ske(t,e){let r=e.lint?{...e,lint:_ke(t,e.lint)}:{...e};return e.test&&e.coverage&&vke(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function ut(t="."){for(let e of pke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=gke(t,o):r=hke(t,[o]),r)break;if(!r||e.requiresSource&&!fke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Ske(t,n):n;return{language:e.language,manifest:r,gates:i}}return mke}var dke,pke,mke,yke,bke,on=y(()=>{"use strict";fv();dke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);pke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:lke},{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:uke}],mke={language:"unknown",manifest:"",gates:{}};yke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];bke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as wke,readFileSync as xke}from"node:fs";import{join as $ke}from"node:path";function Na(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=(o||s||`exit ${i}`).slice(0,200);return FK.test(o)||FK.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Ut(t,e,r){return Na(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Il(t,e){let r=$ke(t,"package.json");if(!wke(r))return!1;try{return!!JSON.parse(xke(r,"utf8")).scripts?.[e]}catch{return!1}}var FK,Tn=y(()=>{"use strict";FK=/config (is |file )?not found|no such file|ENOENT|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 kke(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.arch;if(!n)return[{detector:hv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Na(i)?[{detector:hv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:mv(i,hv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var hv,ja,gv=y(()=>{"use strict";Mr();on();Tn();hv="ARCHITECTURE_VIOLATION";ja={name:hv,subprocess:!0,run:kke}});function Eke(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.secret;if(!n)return[{detector:yv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Na(i)?[{detector:yv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:mv(i,yv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var yv,Ma,_v=y(()=>{"use strict";Mr();on();Tn();yv="HARDCODED_SECRET";Ma={name:yv,subprocess:!0,run:Eke}});import{existsSync as lP,readdirSync as LK}from"node:fs";import{join as bv}from"node:path";function Tke(t,e){let r=bv(t,e.path);if(!lP(r))return!0;if(e.isDirectory)try{return LK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Oke(t){let{cwd:e="."}=t,r=[];for(let i of Ake)Tke(e,i)&&r.push({detector:rp,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=bv(e,"spec.yaml");if(lP(n)){let i=Pke(n),o=i?null:Rke(e);if(i)r.push({detector:rp,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:rp,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=Ike(e);s&&r.push({detector:rp,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 Rke(t){for(let e of["spec/features","spec/scenarios"]){let r=bv(t,e);if(!lP(r))continue;let n;try{n=LK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ki(bv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function Ike(t){try{return G(t),null}catch(e){return e.message}}function Pke(t){let e;try{e=ki(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var rp,Ake,zK,UK=y(()=>{"use strict";qe();S_();rp="ABSENCE_OF_GOVERNANCE",Ake=[{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}];zK={name:rp,run:Oke}});function vv(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=vv(r)==="while",o=Dke.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 '${vv(r)}'`}let n=Cke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:vv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${vv(r)}'`:null}function Nke(t,e){let r=uP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function qK(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...Nke(r,n));return e}var Cke,Dke,dP=y(()=>{"use strict";Cke={event:"when",state:"while",optional:"where",unwanted:"if"},Dke=/\bwhen\b/i});function he(t,e,r){let n;try{n=G(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var vt=y(()=>{"use strict";qe()});function jke(t){let{cwd:e="."}=t;return he(e,Sv,Mke)}function Mke(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:Sv,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 qK(t.features))e.push({detector:Sv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Sv,BK,HK=y(()=>{"use strict";dP();vt();Sv="AC_DRIFT";BK={name:Sv,run:jke}});function Ci(t=".",e){let n=(e??"").trim().toLowerCase()||ut(t).language;return ZK[n]??GK}var Fke,Lke,zke,GK,Uke,qke,ZK,Bke,VK,Fa=y(()=>{"use strict";on();Fke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,Lke=/^[ \t]*import\s+([\w.]+)/gm,zke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,GK={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:Fke,importStyle:"relative"},Uke={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:Lke,importStyle:"dotted"},qke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:zke,importStyle:"dotted"},ZK={typescript:GK,kotlin:Uke,python:qke},Bke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],VK=new Set([...Object.values(ZK).flatMap(t=>t?.extensions??[]),...Bke].map(t=>t.toLowerCase()))});import{existsSync as Hke,readFileSync as Gke,readdirSync as Zke,statSync as Vke}from"node:fs";import{join as KK,relative as WK}from"node:path";function Wke(t,e){if(!Hke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=Zke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=KK(i,s),c;try{c=Vke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function Kke(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function Yke(t){return Jke.test(t)}function Xke(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Ci(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Wke(KK(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=Gke(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";qe();Fa();JK="AI_HINTS_FORBIDDEN_PATTERN";Jke=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;YK={name:JK,run:Xke}});function Qke(t){let{cwd:e="."}=t,r;try{r=G(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:QK,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var QK,eJ,tJ=y(()=>{"use strict";qe();QK="AC_DUPLICATE_WITHIN_FEATURE";eJ={name:QK,run:Qke}});import{createRequire as eEe}from"module";import{basename as tEe,dirname as pP,normalize as rEe,relative as nEe,resolve as iEe,sep as iJ}from"path";import*as oEe from"fs";function sEe(t){let e=rEe(t);return e.length>1&&e[e.length-1]===iJ&&(e=e.substring(0,e.length-1)),e}function oJ(t,e){return t.replace(aEe,e)}function lEe(t){return t==="/"||cEe.test(t)}function fP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=iEe(t)),(n||o)&&(t=sEe(t)),t===".")return"";let s=t[t.length-1]!==i;return oJ(s?t+i:t,i)}function sJ(t,e){return e+t}function uEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:oJ(nEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function dEe(t){return t}function fEe(t,e,r){return e+t+r}function pEe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?uEe(t,e):n?sJ:dEe}function mEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function hEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function bEe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?hEe(t):mEe(t):n&&n.length?yEe:gEe:_Ee}function kEe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?$Ee:r&&r.length?n?vEe:SEe:n?wEe:xEe}function TEe(t){return t.group?AEe:EEe}function IEe(t){return t.group?OEe:REe}function DEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?CEe:PEe}function aJ(t,e,r){if(r.options.useRealPaths)return NEe(e,r);let n=pP(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=pP(n)}return r.symlinks.set(t,e),i>1}function NEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function wv(t,e,r,n){e(t&&!n?t:null,r)}function HEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?jEe:zEe:n?e?MEe:BEe:i?e?LEe:qEe:e?FEe:UEe}function VEe(t){return t?ZEe:GEe}function YEe(t,e){return new Promise((r,n)=>{uJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function uJ(t,e,r){new lJ(t,e,r).start()}function XEe(t,e){return new lJ(t,e).start()}var rJ,aEe,cEe,gEe,yEe,_Ee,vEe,SEe,wEe,xEe,$Ee,EEe,AEe,OEe,REe,PEe,CEe,jEe,MEe,FEe,LEe,zEe,UEe,qEe,BEe,cJ,GEe,ZEe,WEe,KEe,JEe,lJ,nJ,dJ,fJ,pJ=y(()=>{rJ=eEe(import.meta.url);aEe=/[\\/]/g;cEe=/^[a-z]:[\\/]$/i;gEe=(t,e)=>{e.push(t||".")},yEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},_Ee=()=>{};vEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},SEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},wEe=(t,e,r,n)=>{r.files++},xEe=(t,e)=>{e.push(t)},$Ee=()=>{};EEe=t=>t,AEe=()=>[""].slice(0,0);OEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},REe=()=>{};PEe=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()&&aJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},CEe=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()&&aJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};jEe=t=>t.counts,MEe=t=>t.groups,FEe=t=>t.paths,LEe=t=>t.paths.slice(0,t.options.maxFiles),zEe=(t,e,r)=>(wv(e,r,t.counts,t.options.suppressErrors),null),UEe=(t,e,r)=>(wv(e,r,t.paths,t.options.suppressErrors),null),qEe=(t,e,r)=>(wv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),BEe=(t,e,r)=>(wv(e,r,t.groups,t.options.suppressErrors),null);cJ={withFileTypes:!0},GEe=(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||".",cJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},ZEe=(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||".",cJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};WEe=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))}},KEe=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}},JEe=class{aborted=!1;abort(){this.aborted=!0}},lJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=HEe(e,this.isSynchronous),this.root=fP(t,e),this.state={root:lEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new KEe,options:e,queue:new WEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new JEe,fs:e.fs||oEe},this.joinPath=pEe(this.root,e),this.pushDirectory=bEe(this.root,e),this.pushFile=kEe(e),this.getArray=TEe(e),this.groupFiles=IEe(e),this.resolveSymlink=DEe(e,this.isSynchronous),this.walkDirectory=VEe(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(_=fP(_,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=tEe(_),x=fP(pP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};nJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return YEe(this.root,this.options)}withCallback(t){uJ(this.root,this.options,t)}sync(){return XEe(this.root,this.options)}},dJ=null;try{rJ.resolve("picomatch"),dJ=rJ("picomatch")}catch{}fJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:iJ,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 nJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new nJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||dJ;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 np=v((Jlt,_J)=>{"use strict";var mJ="[^\\\\/]",QEe="(?=.)",hJ="[^/]",mP="(?:\\/|$)",gJ="(?:^|\\/)",hP=`\\.{1,2}${mP}`,eAe="(?!\\.)",tAe=`(?!${gJ}${hP})`,rAe=`(?!\\.{0,1}${mP})`,nAe=`(?!${hP})`,iAe="[^.\\/]",oAe=`${hJ}*?`,sAe="/",yJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:QEe,QMARK:hJ,END_ANCHOR:mP,DOTS_SLASH:hP,NO_DOT:eAe,NO_DOTS:tAe,NO_DOT_SLASH:rAe,NO_DOTS_SLASH:nAe,QMARK_NO_DOT:iAe,STAR:oAe,START_ANCHOR:gJ,SEP:sAe},aAe={...yJ,SLASH_LITERAL:"[\\\\/]",QMARK:mJ,STAR:`${mJ}*?`,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:"\\"},cAe={__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"};_J.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:cAe,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?aAe:yJ}}});var ip=v(Fr=>{"use strict";var{REGEX_BACKSLASH:lAe,REGEX_REMOVE_BACKSLASH:uAe,REGEX_SPECIAL_CHARS:dAe,REGEX_SPECIAL_CHARS_GLOBAL:fAe}=np();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>dAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(fAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(lAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(uAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var EJ=v((Xlt,kJ)=>{"use strict";var bJ=ip(),{CHAR_ASTERISK:gP,CHAR_AT:pAe,CHAR_BACKWARD_SLASH:op,CHAR_COMMA:mAe,CHAR_DOT:yP,CHAR_EXCLAMATION_MARK:_P,CHAR_FORWARD_SLASH:$J,CHAR_LEFT_CURLY_BRACE:bP,CHAR_LEFT_PARENTHESES:vP,CHAR_LEFT_SQUARE_BRACKET:hAe,CHAR_PLUS:gAe,CHAR_QUESTION_MARK:vJ,CHAR_RIGHT_CURLY_BRACE:yAe,CHAR_RIGHT_PARENTHESES:SJ,CHAR_RIGHT_SQUARE_BRACKET:_Ae}=np(),wJ=t=>t===$J||t===op,xJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},bAe=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},E=()=>l>=n,q=()=>c.charCodeAt(l+1),Q=()=>(T=A,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),Se&&m===!0&&d>0?(Se=c.slice(0,d),C=c.slice(d)):m===!0?(Se="",C=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&wJ(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),r.unescape===!0&&(C&&(C=bJ.removeBackslashes(C)),Se&&_===!0&&(Se=bJ.removeBackslashes(Se)));let Ir={prefix:P,input:t,start:u,base:Se,glob:C,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,wJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var sp=np(),sn=ip(),{MAX_LENGTH:xv,POSIX_REGEX_SOURCE:vAe,REGEX_NON_SPECIAL_CHARS:SAe,REGEX_SPECIAL_CHARS_BACKREF:wAe,REPLACEMENTS:AJ}=sp,xAe=(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=>sn.escapeRegex(i)).join("..")}return r},Pl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,TJ=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},$Ae=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},OJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if($Ae(e))return e.replace(/\\(.)/g,"$1")},kAe=t=>{let e=t.map(OJ).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}}}}},EAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=OJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},AAe=t=>{let e=0,r=t.trim(),n=SP(r);for(;n;)e++,r=n.body.trim(),n=SP(r);return e},TAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:sp.DEFAULT_MAX_EXTGLOB_RECURSION,n=TJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||kAe(n)))return{risky:!0};for(let i of n){let o=EAe(i);if(o)return{risky:!0,safeOutput:o};if(AAe(i)>r)return{risky:!0}}return{risky:!1}},wP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=AJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(xv,r.maxLength):xv,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=sp.globChars(r.windows),l=sp.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,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(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=sn.removePrefix(t,E),i=t.length;let q=[],Q=[],Se=[],P=o,C,Ir=()=>E.index===i-1,se=E.peek=(H=1)=>t[E.index+H],Pe=E.advance=()=>t[++E.index]||"",Wt=()=>t.slice(E.index+1),dr=(H="",pt=0)=>{E.consumed+=H,E.index+=pt},Yt=H=>{E.output+=H.output!=null?H.output:H.value,dr(H.value)},oo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),E.start++,H++;return H%2===0?!1:(E.negated=!0,E.start++,!0)},vi=H=>{E[H]++,Se.push(H)},Yr=H=>{E[H]--,Se.pop()},de=H=>{if(P.type==="globstar"){let pt=E.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||q.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!pt&&!B&&(E.output=E.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=D,E.output+=P.output)}if(q.length&&H.type!=="paren"&&(q[q.length-1].inner+=H.value),(H.value||H.output)&&Yt(H),P&&P.type==="text"&&H.type==="text"){P.output=(P.output||P.value)+H.value,P.value+=H.value;return}H.prev=P,s.push(H),P=H},so=(H,pt)=>{let B={...l[pt],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;vi("parens"),de({type:H,value:pt,output:E.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Te}),q.push(B)},ade=H=>{let pt=t.slice(H.startIndex,E.index+1),B=t.slice(H.startIndex+2,E.index),Te=TAe(B,r);if((H.type==="plus"||H.type==="star")&&Te.risky){let ct=Te.safeOutput?(H.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,Si=s[H.tokensIndex];Si.type="text",Si.value=pt,Si.output=ct||sn.escapeRegex(pt);for(let wi=H.tokensIndex+1;wi1&&H.inner.includes("/")&&(ct=O(r)),(ct!==D||Ir()||/^\)+$/.test(Wt()))&&(lt=H.close=`)$))${ct}`),H.inner.includes("*")&&(Ft=Wt())&&/^\.[^\\/.]+$/.test(Ft)){let Si=wP(Ft,{...e,fastpaths:!1}).output;lt=H.close=`)${Si})${ct})`}H.prev.type==="bos"&&(E.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:C,output:lt}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,pt=t.replace(wAe,(B,Te,lt,Ft,ct,Si)=>Ft==="\\"?(H=!0,B):Ft==="?"?Te?Te+Ft+(ct?_.repeat(ct.length):""):Si===0?A+(ct?_.repeat(ct.length):""):_.repeat(lt.length):Ft==="."?u.repeat(lt.length):Ft==="*"?Te?Te+Ft+(ct?D:""):D:Te?B:`\\${B}`);return H===!0&&(r.unescape===!0?pt=pt.replace(/\\/g,""):pt=pt.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),pt===t&&r.contains===!0?(E.output=t,E):(E.output=sn.wrapOutput(pt,E,e),E)}for(;!Ir();){if(C=Pe(),C==="\0")continue;if(C==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){C+="\\",de({type:"text",value:C});continue}let Te=/^\\+/.exec(Wt()),lt=0;if(Te&&Te[0].length>2&&(lt=Te[0].length,E.index+=lt,lt%2!==0&&(C+="\\")),r.unescape===!0?C=Pe():C+=Pe(),E.brackets===0){de({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("["),lt=P.value.slice(0,Te),Ft=P.value.slice(Te+2),ct=vAe[Ft];if(ct){P.value=lt+ct,E.backtrack=!0,Pe(),!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,Yt({value:C});continue}if(E.quotes===1&&C!=='"'){C=sn.escapeRegex(C),P.value+=C,Yt({value:C});continue}if(C==='"'){E.quotes=E.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:C});continue}if(C==="("){vi("parens"),de({type:"paren",value:C});continue}if(C===")"){if(E.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Pl("opening","("));let B=q[q.length-1];if(B&&E.parens===B.parens+1){ade(q.pop());continue}de({type:"paren",value:C,output:E.parens?")":"\\)"}),Yr("parens");continue}if(C==="["){if(r.nobracket===!0||!Wt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Pl("closing","]"));C=`\\${C}`}else vi("brackets");de({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){de({type:"text",value:C,output:`\\${C}`});continue}if(E.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Pl("opening","["));de({type:"text",value:C,output:`\\${C}`});continue}Yr("brackets");let B=P.value.slice(1);if(P.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(C=`/${C}`),P.value+=C,Yt({value:C}),r.literalBrackets===!1||sn.hasRegexChars(B))continue;let Te=sn.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){vi("braces");let B={type:"brace",value:C,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};Q.push(B),de(B);continue}if(C==="}"){let B=Q[Q.length-1];if(r.nobrace===!0||!B){de({type:"text",value:C,output:C});continue}let Te=")";if(B.dots===!0){let lt=s.slice(),Ft=[];for(let ct=lt.length-1;ct>=0&&(s.pop(),lt[ct].type!=="brace");ct--)lt[ct].type!=="dots"&&Ft.unshift(lt[ct].value);Te=xAe(Ft,r),E.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let lt=E.output.slice(0,B.outputIndex),Ft=E.tokens.slice(B.tokensIndex);B.value=B.output="\\{",C=Te="\\}",E.output=lt;for(let ct of Ft)E.output+=ct.output||ct.value}de({type:"brace",value:C,output:Te}),Yr("braces"),Q.pop();continue}if(C==="|"){q.length>0&&q[q.length-1].conditions++,de({type:"text",value:C});continue}if(C===","){let B=C,Te=Q[Q.length-1];Te&&Se[Se.length-1]==="braces"&&(Te.comma=!0,B="|"),de({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}de({type:"slash",value:C,output:f});continue}if(C==="."){if(E.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let B=Q[Q.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"){de({type:"text",value:C,output:u});continue}de({type:"dot",value:C,output:u});continue}if(C==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){so("qmark",C);continue}if(P&&P.type==="paren"){let Te=se(),lt=C;(P.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Wt()))&&(lt=`\\${C}`),de({type:"text",value:C,output:lt});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){de({type:"qmark",value:C,output:S});continue}de({type:"qmark",value:C,output:_});continue}if(C==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){so("negate",C);continue}if(r.nonegate!==!0&&E.index===0){oo();continue}}if(C==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){so("plus",C);continue}if(P&&P.value==="("||r.regex===!1){de({type:"plus",value:C,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||E.parens>0){de({type:"plus",value:C});continue}de({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:C,output:""});continue}de({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let B=SAe.exec(Wt());B&&(C+=B[0],E.index+=B[0].length),de({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,dr(C);continue}let H=Wt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){so("star",C);continue}if(P.type==="star"){if(r.noglobstar===!0){dr(C);continue}let B=P.prev,Te=B.prev,lt=B.type==="slash"||B.type==="bos",Ft=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!lt||H[0]&&H[0]!=="/")){de({type:"star",value:C,output:""});continue}let ct=E.braces>0&&(B.type==="comma"||B.type==="brace"),Si=q.length&&(B.type==="pipe"||B.type==="paren");if(!lt&&B.type!=="paren"&&!ct&&!Si){de({type:"star",value:C,output:""});continue}for(;H.slice(0,3)==="/**";){let wi=t[E.index+4];if(wi&&wi!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Ir()){P.type="globstar",P.value+=C,P.output=O(r),E.output=P.output,E.globstar=!0,dr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!Ft&&Ir()){E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=O(r)+(r.strictSlashes?")":"|$)"),P.value+=C,E.globstar=!0,E.output+=B.output+P.output,dr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let wi=H[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=`${O(r)}${f}|${f}${wi})`,P.value+=C,E.output+=B.output+P.output,E.globstar=!0,dr(C+Pe()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){P.type="globstar",P.value+=C,P.output=`(?:^|${f}|${O(r)}${f})`,E.output=P.output,E.globstar=!0,dr(C+Pe()),de({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-P.output.length),P.type="globstar",P.output=O(r),P.value+=C,E.output+=P.output,E.globstar=!0,dr(C);continue}let pt={type:"star",value:C,output:D};if(r.bash===!0){pt.output=".*?",(P.type==="bos"||P.type==="slash")&&(pt.output=T+pt.output),de(pt);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){pt.output=C,de(pt);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+=T,P.output+=T),se()!=="*"&&(E.output+=p,P.output+=p)),de(pt)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Pl("closing","]"));E.output=sn.escapeLast(E.output,"["),Yr("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Pl("closing",")"));E.output=sn.escapeLast(E.output,"("),Yr("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Pl("closing","}"));E.output=sn.escapeLast(E.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),E.backtrack===!0){E.output="";for(let H of E.tokens)E.output+=H.output!=null?H.output:H.value,H.suffix&&(E.output+=H.suffix)}return E};wP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(xv,r.maxLength):xv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=AJ[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}=sp.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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};RJ.exports=wP});var DJ=v((eut,CJ)=>{"use strict";var OAe=EJ(),xP=IJ(),PJ=ip(),RAe=np(),IAe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=IAe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?PJ.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(PJ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):xP(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>OAe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=xP.fastpaths(t,e)),i.output||(i=xP(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=RAe;CJ.exports=Tt});var FJ=v((tut,MJ)=>{"use strict";var NJ=DJ(),PAe=ip();function jJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:PAe.isWindows()}),NJ(t,e,r)}Object.assign(jJ,NJ);MJ.exports=jJ});import{readdir as CAe,readdirSync as DAe,realpath as NAe,realpathSync as jAe,stat as MAe,statSync as FAe}from"fs";import{isAbsolute as LAe,posix as La,resolve as zAe}from"path";import{fileURLToPath as UAe}from"url";function HAe(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]===".."&&BAe.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=>La.relative(t,n)||".":n=>La.relative(t,`${e}/${n}`)||"."}function VAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=La.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function qJ(t){var e;let r=Cl.default.scan(t,WAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function eTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Cl.default.scan(t);return r.isGlob||r.negated}function ap(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function BJ(t){return typeof t=="string"?[t]:t??[]}function $P(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=QAe(o);s=LAe(s.replace(rTe,""))?La.relative(a,s):La.normalize(s);let c=(i=tTe.exec(s))===null||i===void 0?void 0:i[0],l=qJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?La.join(o,...d):o}return s}function nTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push($P(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push($P(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push($P(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function iTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=nTe(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(zJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Cl.default)(i.match,f),m=(0,Cl.default)(i.ignore,f),h=HAe(i.match,f),g=LJ(r,d,o),b=o?g:LJ(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new fJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&ap(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return ap(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&VAe(r,d)]}function oTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function aTe(t){let e={...sTe,...t};return e.cwd=(e.cwd instanceof URL?UAe(e.cwd):zAe(e.cwd)).replace(zJ,"/"),e.ignore=BJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||CAe,readdirSync:e.fs.readdirSync||DAe,realpath:e.fs.realpath||NAe,realpathSync:e.fs.realpathSync||jAe,stat:e.fs.stat||MAe,statSync:e.fs.statSync||FAe}),e.debug&&ap("globbing with options:",e),e}function cTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=qAe(t)||typeof t=="string",i=BJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=aTe(n?e:t);return i.length>0?iTe(o,i):[]}function ps(t,e){let[r,n]=cTe(t,e);return r?oTe(r.sync(),n):[]}var Cl,qAe,zJ,UJ,BAe,GAe,ZAe,WAe,KAe,JAe,YAe,XAe,QAe,tTe,rTe,sTe,cp=y(()=>{pJ();Cl=bt(FJ(),1),qAe=Array.isArray,zJ=/\\/g,UJ=process.platform==="win32",BAe=/^(\/?\.\.)+$/;GAe=/^[A-Z]:\/$/i,ZAe=UJ?t=>GAe.test(t):t=>t==="/";WAe={parts:!0};KAe=/(?t.replace(KAe,"\\$&"),XAe=t=>t.replace(JAe,"\\$&"),QAe=UJ?XAe:YAe;tTe=/^(\/?\.\.)+/,rTe=/\\(?=[()[\]{}!*+?@|])/g;sTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as lp,readFileSync as lTe,readdirSync as uTe,statSync as HJ}from"node:fs";import{join as za}from"node:path";function dTe(t){let{cwd:e="."}=t,r,n;try{let c=G(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Ci(e,n),o=[],{layers:s,forbiddenImports:a}=kP(r);return(s.size>0||a.length>0)&&!lp(za(e,i.mainRoot))?[{detector:up,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&&(fTe(e,i,s,o),pTe(e,i,s,o)),a.length>0&&mTe(e,i,a,o),o)}function kP(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 fTe(t,e,r,n){let i=e.mainRoot,o=za(t,i);if(lp(o))for(let s of uTe(o)){let a=za(o,s);HJ(a).isDirectory()&&(r.has(s)||n.push({detector:up,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function pTe(t,e,r,n){let i=e.mainRoot,o=za(t,i);if(lp(o))for(let s of r){let a=za(o,s);lp(a)&&HJ(a).isDirectory()||n.push({detector:up,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 mTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=za(t,i,s.from);if(!lp(a))continue;let c=ps([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=za(a,l),d;try{d=lTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];hTe(p,s.to,e.importStyle)&&n.push({detector:up,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 hTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var up,GJ,EP=y(()=>{"use strict";cp();qe();Fa();up="ARCHITECTURE_FROM_SPEC";GJ={name:up,run:dTe}});import{existsSync as gTe,readFileSync as yTe}from"node:fs";import{join as _Te}from"node:path";function bTe(t){let{cwd:e="."}=t,r=_Te(e,"spec/capabilities.yaml");if(!gTe(r))return[];let n;try{let c=yTe(r,"utf8"),l=ZJ.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=G(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:$v,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:$v,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:$v,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var ZJ,$v,VJ,WJ=y(()=>{"use strict";ZJ=bt(Qt(),1);qe();$v="CAPABILITIES_FEATURE_MAPPING";VJ={name:$v,run:bTe}});import{existsSync as vTe,readFileSync as STe}from"node:fs";import{join as wTe}from"node:path";function xTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function $Te(t){let{cwd:e="."}=t;return he(e,AP,r=>kTe(r,e))}function kTe(t,e){let r=Ci(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=wTe(e,o);if(!vTe(s))continue;let a=STe(s,"utf8");xTe(a)||n.push({detector:AP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var AP,KJ,JJ=y(()=>{"use strict";Fa();vt();AP="CONVENTION_DRIFT";KJ={name:AP,run:$Te}});import{existsSync as TP,readFileSync as YJ}from"node:fs";import{join as kv}from"node:path";function ETe(t){return JSON.parse(t).total?.lines?.pct??0}function XJ(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function OTe(t,e){if(!av(ut(t).gates.coverage?.cmd))return null;let r;try{r=cv(t,e)}catch(c){return[{detector:vo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=sP.find(d=>TP(kv(c.dir,d)));if(!l){s.push(c.path);continue}let u=XJ(YJ(kv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:vo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=QJ(n,i);return a0?[{detector:vo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function RTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=OTe(e,t.focusModules);if(a)return a}let r;try{r=G(e).project?.language}catch{}let n=Ci(e,r),i=ut(e).language==="kotlin"?sP.find(a=>TP(kv(e,a)))??NK(e):n.coverageSummary,o=kv(e,i);if(!TP(o))return[{detector:vo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=YJ(o,"utf8");s=n.coverageFormat==="jacoco-xml"?ATe(a):n.coverageFormat==="cobertura-xml"?TTe(a):ETe(a)}catch(a){return[{detector:vo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:vo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Ev?[]:[{detector:vo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Ev}%`}]}var vo,Ev,e8,t8=y(()=>{"use strict";qe();fv();Fa();lv();on();vo="COVERAGE_DROP",Ev=70;e8={name:vo,run:RTe}});import{existsSync as ITe}from"node:fs";import{join as PTe}from"node:path";function CTe(t){let{cwd:e="."}=t;return he(e,Av,r=>DTe(r,e))}function DTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?ITe(PTe(e,r.path))?[]:[{detector:Av,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:Av,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var Av,r8,n8=y(()=>{"use strict";vt();Av="DELIVERABLE_INTEGRITY";r8={name:Av,run:CTe}});function NTe(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:Tv,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 jTe(t){let e=NTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Tv,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 MTe(t){let{cwd:e="."}=t;return he(e,Tv,r=>jTe(r))}var Tv,i8,o8=y(()=>{"use strict";vt();Tv="SMOKE_PROBE_DEMAND";i8={name:Tv,run:MTe}});function FTe(t){let{cwd:e="."}=t;return he(e,Ov,r=>LTe(r,e))}function LTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=is(e);if(n===null)return[{detector:Ov,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=A_(n,e,o);s.state!=="fresh"&&i.push({detector:Ov,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 Ov,Rv,OP=y(()=>{"use strict";ll();vt();Ov="STALE_ATTESTATION";Rv={name:Ov,run:FTe}});function zTe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}return UTe(r)}function UTe(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:s8,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 s8,Iv,RP=y(()=>{"use strict";qe();s8="DEPENDENCY_CYCLE";Iv={name:s8,run:zTe}});import{appendFileSync as qTe,existsSync as a8,mkdirSync as BTe,readFileSync as HTe}from"node:fs";import{dirname as GTe,join as ZTe}from"node:path";function c8(t){return ZTe(t,VTe,WTe)}function l8(t){return IP.add(t),()=>IP.delete(t)}function Ua(t,e){let r=c8(t),n=GTe(r);a8(n)||BTe(n,{recursive:!0}),qTe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of IP)try{i(t,e)}catch{}}function On(t){let e=c8(t);if(!a8(e))return[];let r=HTe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var VTe,WTe,IP,ti=y(()=>{"use strict";VTe=".cladding",WTe="audit.log.jsonl";IP=new Set});import{existsSync as KTe}from"node:fs";import{join as JTe}from"node:path";function YTe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:PP,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&&(KTe(JTe(e,i.artifact))||n.push({detector:PP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var PP,u8,d8=y(()=>{"use strict";ti();PP="EVIDENCE_MISMATCH";u8={name:PP,run:YTe}});import{existsSync as XTe,readFileSync as QTe}from"node:fs";import{join as eOe}from"node:path";function tOe(t){let e=eOe(t,h8);if(!XTe(e))return null;try{let n=((0,m8.parse)(QTe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*p8(t,e){for(let r of t??[])r.startsWith(f8)&&(yield{ref:r,name:r.slice(f8.length),field:e})}function rOe(t){let{cwd:e="."}=t,r=tOe(e);if(r===null)return[];let n;try{n=G(e)}catch(o){return[{detector:CP,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=[...p8(s.evidence_refs,"evidence_refs"),...p8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:CP,severity:"warn",path:h8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var m8,CP,f8,h8,g8,y8=y(()=>{"use strict";m8=bt(Qt(),1);qe();CP="FIXTURE_REFERENCE_INVALID",f8="fixture:",h8="conformance/fixtures.yaml";g8={name:CP,run:rOe}});import{existsSync as Dl,readFileSync as DP}from"node:fs";import{join as qa}from"node:path";function nOe(t){return ps(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function dp(t){if(!Dl(t))return null;try{return JSON.parse(DP(t,"utf8"))}catch{return null}}function iOe(t,e){let r=qa(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(DP(r,"utf8"))}catch(c){e.push({detector:So,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:So,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=nOe(t);s!==a&&e.push({detector:So,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function oOe(t,e){for(let r of _8){let n=qa(t,r.path);if(!Dl(n))continue;let i=dp(n);if(!i){e.push({detector:So,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:So,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function sOe(t,e){let r=dp(qa(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of _8){let s=qa(t,o.path);if(!Dl(s))continue;let a=dp(s);a?.version&&a.version!==n&&e.push({detector:So,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=qa(t,".claude-plugin","marketplace.json");if(Dl(i)){let o=dp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:So,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 aOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function cOe(t,e){let r=qa(t,"src","cli","clad.ts"),n=qa(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Dl(r)||!Dl(n))return;let i=aOe(DP(r,"utf8"));if(i.length===0)return;let s=dp(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:So,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 lOe(t){let{cwd:e="."}=t,r=[];return iOe(e,r),cOe(e,r),oOe(e,r),sOe(e,r),r}var So,_8,b8,v8=y(()=>{"use strict";cp();So="HARNESS_INTEGRITY",_8=[{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"]}];b8={name:So,run:lOe}});import{existsSync as uOe,readFileSync as dOe}from"node:fs";import{join as fOe}from"node:path";function mOe(t){let{cwd:e="."}=t;return he(e,Pv,r=>gOe(r,e))}function hOe(t){let e=fOe(t,"spec/capabilities.yaml");if(!uOe(e))return!1;try{let r=S8.default.parse(dOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function gOe(t,e){let r=t.features.length;if(r{"use strict";S8=bt(Qt(),1);vt();Pv="HOLLOW_GOVERNANCE",pOe=8;w8={name:Pv,run:mOe}});import{existsSync as $8,readFileSync as k8}from"node:fs";import{join as E8}from"node:path";function A8(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 bOe(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 vOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function SOe(t){let e=E8(t,"README.md"),r=E8(t,"docs","dogfood","matrix.md");if(!$8(e)||!$8(r))return[];let n=A8(k8(e,"utf8"),yOe),i=A8(k8(r,"utf8"),_Oe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=vOe(a);if(c===null)continue;let l=i[s]??"not-run",u=bOe(l);u!==null&&c>u&&o.push({detector:T8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function wOe(t){let{cwd:e="."}=t;return SOe(e)}var T8,yOe,_Oe,O8,R8=y(()=>{"use strict";T8="HOST_CLAIM_DRIFT",yOe=//,_Oe=//;O8={name:T8,run:wOe}});function xOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return I8(r.features.map(i=>i.id),"feature","spec/features/",n),I8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function I8(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:P8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var P8,C8,D8=y(()=>{"use strict";qe();P8="ID_COLLISION";C8={name:P8,run:xOe}});import{existsSync as fp,readFileSync as NP,readdirSync as jP,statSync as $Oe,writeFileSync as j8}from"node:fs";import{join as wo}from"node:path";function N8(t){if(!fp(t))return 0;try{return jP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function kOe(t){if(!fp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=jP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=wo(n,o),a;try{a=$Oe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function EOe(t){let e=wo(t,"spec","capabilities.yaml");if(!fp(e))return 0;try{let r=Cv.default.parse(NP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ms(t="."){let e=N8(wo(t,"spec","features")),r=N8(wo(t,"spec","scenarios")),n=EOe(t),i=kOe(wo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Nl(t,e){let r=wo(t,"spec.yaml");if(!fp(r))return;let n=NP(r,"utf8"),i=AOe(n,e);i!==n&&j8(r,i)}function AOe(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 @@ -269,51 +269,51 @@ ${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 Ua(t="."){let e=vo(t,"spec","features");if(!op(e))return!1;let r=[];for(let i of SP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,wv.parse)(vP(vo(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 Ba(t="."){let e=wo(t,"spec","features");if(!fp(e))return!1;let r=[];for(let i of jP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Cv.parse)(NP(wo(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 w8(vo(t,"spec","index.yaml"),n,"utf8"),!0}var wv,sp=y(()=>{"use strict";wv=bt(Xt(),1)});import{existsSync as x8,readFileSync as $8,readdirSync as sOe}from"node:fs";import{join as wP}from"node:path";function aOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=fs(e),i=r.inventory;if(!i){let s=k8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return xP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...xP(e),{detector:ap,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 k8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:ap,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(...xP(e)),o}function xP(t){let e=wP(t,"spec","index.yaml"),r=wP(t,"spec","features");if(!x8(e)||!x8(r))return[];let n=new Map;try{for(let l of $8(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 sOe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=$8(wP(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:ap,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:ap,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 ap,k8,E8,A8=y(()=>{"use strict";sp();qe();ap="INVENTORY_DRIFT",k8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];E8={name:ap,run:aOe}});import{existsSync as cOe,readFileSync as lOe}from"node:fs";import{join as uOe}from"node:path";function fOe(t){let{cwd:e="."}=t,r=uOe(e,"src","spec","schema.json"),n=[];if(cOe(r)){let i;try{i=JSON.parse(lOe(r,"utf8"))}catch(o){n.push({detector:cp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of dOe)i.required?.includes(o)||n.push({detector:cp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:cp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=G(e);i.schema!==T8&&n.push({detector:cp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${T8}'`})}catch{}return n}var cp,dOe,T8,O8,R8=y(()=>{"use strict";qe();cp="META_INTEGRITY",dOe=["schema","project","features"],T8="0.1";O8={name:cp,run:fOe}});function pOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return I8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),I8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function I8(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:P8,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 P8,C8,D8=y(()=>{"use strict";qe();P8="SLUG_CONFLICT";C8={name:P8,run:pOe}});function Rl(t){return t==="planned"||t==="in_progress"}var xv=y(()=>{"use strict"});import{existsSync as mOe}from"node:fs";import{join as hOe}from"node:path";function gOe(t){let{cwd:e="."}=t;return he(e,$v,r=>yOe(r,e))}function yOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=hOe(e,i);mOe(o)||r.push(_Oe(n.id,i,n.status))}return r}function _Oe(t,e,r){return Rl(r)?{detector:$v,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:$v,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var $v,kv,$P=y(()=>{"use strict";xv();vt();$v="MISSING_IMPLEMENTATION";kv={name:$v,run:gOe}});function bOe(t){let{cwd:e="."}=t;return he(e,kP,vOe)}function vOe(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:kP,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 kP,Ev,EP=y(()=>{"use strict";vt();kP="MISSING_TESTS";Ev={name:kP,run:bOe}});import{existsSync as SOe,readFileSync as wOe}from"node:fs";import{join as N8}from"node:path";function j8(t){if(SOe(t))try{return JSON.parse(wOe(t,"utf8"))}catch{return}}function EOe(t){let{cwd:e="."}=t,r=j8(N8(e,xOe)),n=j8(N8(e,$Oe));if(!r||!n)return[{detector:AP,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>kOe&&i.push({detector:AP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var AP,xOe,$Oe,kOe,M8,F8=y(()=>{"use strict";AP="PERFORMANCE_DRIFT",xOe="perf/baseline.json",$Oe="perf/current.json",kOe=10;M8={name:AP,run:EOe}});import{existsSync as AOe}from"node:fs";import{join as TOe}from"node:path";function ROe(t){let{cwd:e="."}=t;return he(e,TP,r=>POe(r,e))}function IOe(t,e){return(t.modules??[]).some(r=>AOe(TOe(e,r)))}function POe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||IOe(s,e)||r.push(s.id);let n=OOe;if(r.length<=n)return[];let i=r.slice(0,L8).join(", "),o=r.length>L8?", \u2026":"";return[{detector:TP,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 TP,OOe,L8,z8,U8=y(()=>{"use strict";vt();TP="PLANNED_BACKLOG",OOe=5,L8=8;z8={name:TP,run:ROe}});import{existsSync as COe,readFileSync as DOe}from"node:fs";import{join as NOe}from"node:path";function FOe(t){let{cwd:e="."}=t;return he(e,OP,r=>LOe(r,e))}function LOe(t,e){if(t.features.lengthn.includes(i))?[{detector:OP,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 OP,jOe,MOe,q8,B8=y(()=>{"use strict";vt();OP="PROJECT_CONTEXT_DRIFT",jOe=8,MOe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];q8={name:OP,run:FOe}});function H8(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Av,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function zOe(t){let{cwd:e="."}=t;return he(e,Av,UOe)}function UOe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...H8(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Av,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...H8(e,n.features,`scenario ${n.id}.features`));return r}var Av,Tv,RP=y(()=>{"use strict";vt();Av="REFERENCE_INTEGRITY";Tv={name:Av,run:zOe}});function lp(t=""){return new RegExp(qOe,t)}var qOe,IP=y(()=>{"use strict";qOe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as BOe,readdirSync as HOe,readFileSync as GOe,statSync as ZOe,writeFileSync as VOe}from"node:fs";import{dirname as WOe,join as up,normalize as KOe,relative as JOe}from"node:path";function tRe(t){let e=[];for(let r of t.matchAll(eRe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(lp("g"))??[])e.push(n);return[...new Set(e)].sort()}function rRe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function G8(t){return t.split("\\").join("/")}function nRe(t){return YOe.some(e=>t===e||t.startsWith(`${e}/`))}function iRe(t){let e=up(t,"docs");if(!BOe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=HOe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=up(i,s),c;try{c=ZOe(a)}catch{continue}let l=G8(JOe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function oRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=KOe(up(WOe(t),e));return G8(r)}function dp(t="."){let e=[];for(let r of iRe(t)){let n;try{n=GOe(up(t,r),"utf8")}catch{continue}let i=rRe(n),o=tRe(i);if(nRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(XOe)?[]:i.match(lp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(QOe)){let d=oRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function Z8(t="."){let e=dp(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 VOe(up(t,"spec","_doc-links.yaml"),`${r.join(` +`;return j8(wo(t,"spec","index.yaml"),n,"utf8"),!0}var Cv,pp=y(()=>{"use strict";Cv=bt(Qt(),1)});import{existsSync as M8,readFileSync as F8,readdirSync as TOe}from"node:fs";import{join as MP}from"node:path";function OOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=ms(e),i=r.inventory;if(!i){let s=L8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return FP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...FP(e),{detector:mp,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 L8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:mp,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(...FP(e)),o}function FP(t){let e=MP(t,"spec","index.yaml"),r=MP(t,"spec","features");if(!M8(e)||!M8(r))return[];let n=new Map;try{for(let l of F8(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 TOe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=F8(MP(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:mp,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:mp,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 mp,L8,z8,U8=y(()=>{"use strict";pp();qe();mp="INVENTORY_DRIFT",L8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];z8={name:mp,run:OOe}});import{existsSync as ROe,readFileSync as IOe}from"node:fs";import{join as POe}from"node:path";function DOe(t){let{cwd:e="."}=t,r=POe(e,"src","spec","schema.json"),n=[];if(ROe(r)){let i;try{i=JSON.parse(IOe(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 COe)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=G(e);i.schema!==q8&&n.push({detector:hp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${q8}'`})}catch{}return n}var hp,COe,q8,B8,H8=y(()=>{"use strict";qe();hp="META_INTEGRITY",COe=["schema","project","features"],q8="0.1";B8={name:hp,run:DOe}});function NOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return G8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),G8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function G8(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:Z8,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 Z8,V8,W8=y(()=>{"use strict";qe();Z8="SLUG_CONFLICT";V8={name:Z8,run:NOe}});function jl(t){return t==="planned"||t==="in_progress"}var Dv=y(()=>{"use strict"});import{existsSync as jOe}from"node:fs";import{join as MOe}from"node:path";function FOe(t){let{cwd:e="."}=t;return he(e,Nv,r=>LOe(r,e))}function LOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=MOe(e,i);jOe(o)||r.push(zOe(n.id,i,n.status))}return r}function zOe(t,e,r){return jl(r)?{detector:Nv,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:Nv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Nv,jv,LP=y(()=>{"use strict";Dv();vt();Nv="MISSING_IMPLEMENTATION";jv={name:Nv,run:FOe}});function UOe(t){let{cwd:e="."}=t;return he(e,zP,qOe)}function qOe(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:zP,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 zP,Mv,UP=y(()=>{"use strict";vt();zP="MISSING_TESTS";Mv={name:zP,run:UOe}});import{existsSync as BOe,readFileSync as HOe}from"node:fs";import{join as K8}from"node:path";function J8(t){if(BOe(t))try{return JSON.parse(HOe(t,"utf8"))}catch{return}}function WOe(t){let{cwd:e="."}=t,r=J8(K8(e,GOe)),n=J8(K8(e,ZOe));if(!r||!n)return[{detector:qP,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>VOe&&i.push({detector:qP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var qP,GOe,ZOe,VOe,Y8,X8=y(()=>{"use strict";qP="PERFORMANCE_DRIFT",GOe="perf/baseline.json",ZOe="perf/current.json",VOe=10;Y8={name:qP,run:WOe}});import{existsSync as KOe}from"node:fs";import{join as JOe}from"node:path";function XOe(t){let{cwd:e="."}=t;return he(e,BP,r=>eRe(r,e))}function QOe(t,e){return(t.modules??[]).some(r=>KOe(JOe(e,r)))}function eRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||QOe(s,e)||r.push(s.id);let n=YOe;if(r.length<=n)return[];let i=r.slice(0,Q8).join(", "),o=r.length>Q8?", \u2026":"";return[{detector:BP,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 BP,YOe,Q8,e5,t5=y(()=>{"use strict";vt();BP="PLANNED_BACKLOG",YOe=5,Q8=8;e5={name:BP,run:XOe}});import{existsSync as tRe,readFileSync as rRe}from"node:fs";import{join as nRe}from"node:path";function sRe(t){let{cwd:e="."}=t;return he(e,HP,r=>aRe(r,e))}function aRe(t,e){if(t.features.lengthn.includes(i))?[{detector:HP,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 HP,iRe,oRe,r5,n5=y(()=>{"use strict";vt();HP="PROJECT_CONTEXT_DRIFT",iRe=8,oRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];r5={name:HP,run:sRe}});function i5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Fv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function cRe(t){let{cwd:e="."}=t;return he(e,Fv,lRe)}function lRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...i5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Fv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...i5(e,n.features,`scenario ${n.id}.features`));return r}var Fv,Lv,GP=y(()=>{"use strict";vt();Fv="REFERENCE_INTEGRITY";Lv={name:Fv,run:cRe}});function gp(t=""){return new RegExp(uRe,t)}var uRe,ZP=y(()=>{"use strict";uRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as dRe,readdirSync as fRe,readFileSync as pRe,statSync as mRe,writeFileSync as hRe}from"node:fs";import{dirname as gRe,join as yp,normalize as yRe,relative as _Re}from"node:path";function xRe(t){let e=[];for(let r of t.matchAll(wRe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(gp("g"))??[])e.push(n);return[...new Set(e)].sort()}function $Re(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function o5(t){return t.split("\\").join("/")}function kRe(t){return bRe.some(e=>t===e||t.startsWith(`${e}/`))}function ERe(t){let e=yp(t,"docs");if(!dRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=fRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=yp(i,s),c;try{c=mRe(a)}catch{continue}let l=o5(_Re(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function ARe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=yRe(yp(gRe(t),e));return o5(r)}function _p(t="."){let e=[];for(let r of ERe(t)){let n;try{n=pRe(yp(t,r),"utf8")}catch{continue}let i=$Re(n),o=xRe(i);if(kRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(vRe)?[]:i.match(gp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(SRe)){let d=ARe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function s5(t="."){let e=_p(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 hRe(yp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var YOe,XOe,QOe,eRe,Ov=y(()=>{"use strict";IP();YOe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],XOe="clad-doc-links: ignore",QOe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,eRe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as sRe}from"node:fs";import{join as aRe}from"node:path";function cRe(t){let{cwd:e="."}=t;return he(e,Rv,r=>lRe(r,e))}function lRe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of dp(e).docs){for(let o of i.doc_links)sRe(aRe(e,o))||n.push({detector:Rv,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:Rv,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 Rv,Iv,PP=y(()=>{"use strict";Ov();vt();Rv="DOC_LINK_INTEGRITY";Iv={name:Rv,run:cRe}});function dRe(t){let{cwd:e="."}=t;return he(e,fp,r=>fRe(r))}function fRe(t){let e=[],r=t.features.length,n=t.scenarios??[];r>=uRe&&n.length===0&&e.push({detector:fp,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 o of n)(o.features??[]).length===0&&e.push({detector:fp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let i=new Map(t.features.filter(o=>typeof o.slug=="string"&&o.slug.length>0).map(o=>[o.slug,o.id]));for(let o of n){if(!o.flow)continue;let s=new Set(o.features??[]),a=new Map;for(let c of o.flow.matchAll(/\(([^)]+)\)/g))for(let l of c[1].split(/[,/·]/)){let u=l.trim(),d=i.get(u);d&&!s.has(d)&&a.set(u,d)}if(a.size>0){let c=[...a].map(([l,u])=>`${l} (${u})`).join(", ");e.push({detector:fp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} flow references ${c} but features[] does not bind ${a.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var fp,uRe,V8,W8=y(()=>{"use strict";vt();fp="SCENARIO_COVERAGE",uRe=8;V8={name:fp,run:dRe}});import{createHash as pRe}from"node:crypto";function mRe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function pp(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??K8),sample:mRe(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(K8),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function mp(t){return(t.features??[]).filter(e=>e.status==="done").length}function hRe(t,e){return e<=0?!1:e>=1?!0:parseInt(pRe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var K8,Pv=y(()=>{"use strict";K8=["unwanted"]});import{existsSync as gRe,readdirSync as yRe}from"node:fs";import{join as Y8}from"node:path";import X8 from"node:process";function _Re(t){let e=!1,r=n=>{for(let i of yRe(n,{withFileTypes:!0})){if(e)return;let o=Y8(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 CP(t={}){let{cwd:e="."}=t,r=Y8(e,ps);if(!gRe(r)||!_Re(r))return{stage:Cv,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${ps}/ \u2014 skipped`};let n=ut(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Cv,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o=Je(i.cmd,[...i.args,ps],{cwd:e,reject:!1}),s=Lt(Cv,i.cmd,o);return s||Qt(Cv,o)}var Cv,ps,bRe,DP=y(()=>{"use strict";jr();nn();An();Cv="stage_2.3",ps="tests/oracle";bRe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${X8.argv[1]}`;if(bRe){let t=CP();console.log(JSON.stringify(t)),X8.exit(t.exitCode)}});import{existsSync as vRe}from"node:fs";import{join as SRe}from"node:path";function wRe(t){let{cwd:e="."}=t;return he(e,Qn,r=>xRe(r,e))}function xRe(t,e){let r=[],n=pp(t.project,mp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?Tn(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(hp(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:Qn,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${ps}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!vRe(SRe(e,f))){r.push({detector:Qn,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${ps}/`)||r.push({detector:Qn,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${ps}/ \u2014 stage_2.3 only runs ${ps}/, 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:Qn,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:Qn,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:Qn,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:Qn,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:Qn,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:Qn,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 Qn,Q8,e5=y(()=>{"use strict";Xn();Pv();DP();vt();Qn="SPEC_CONFORMANCE";Q8={name:Qn,run:wRe}});function $Re(t){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return[{detector:NP,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>t5&&i.push({detector:NP,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${t5})`})}return i}var NP,t5,r5,n5=y(()=>{"use strict";Xn();NP="STALE_EVIDENCE",t5=90;r5={name:NP,run:$Re}});import{existsSync as i5}from"node:fs";import{join as o5}from"node:path";function kRe(t){let{cwd:e="."}=t;return he(e,Il,r=>ERe(r,e))}function ERe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Il,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:Il,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=>i5(o5(e,o)));i.length>0&&r.push({detector:Il,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Rl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>i5(o5(e,i)))&&r.push({detector:Il,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 Il,Dv,jP=y(()=>{"use strict";xv();vt();Il="STALE_SPECIFICATION";Dv={name:Il,run:kRe}});import{existsSync as s5,statSync as a5}from"node:fs";import{join as c5}from"node:path";function TRe(t,e){let r=0;for(let n of e){let i=c5(t,n);if(!s5(i))continue;let o=a5(i).mtimeMs;o>r&&(r=o)}return r}function ORe(t){let{cwd:e="."}=t;return he(e,MP,r=>RRe(r,e))}function RRe(t,e){let r=Ii(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=TRe(e,n);if(i===0)return[];let o=ds([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=c5(e,a);if(!s5(c))continue;let l=a5(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>ARe&&s.push({detector:MP,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var MP,ARe,Nv,FP=y(()=>{"use strict";tp();ja();vt();MP="STALE_TESTS",ARe=30;Nv={name:MP,run:ORe}});import{existsSync as IRe}from"node:fs";import{join as PRe}from"node:path";function CRe(t){let{cwd:e="."}=t;return he(e,gp,r=>DRe(r,e))}function DRe(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:gp,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=>!IRe(PRe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:gp,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:gp,severity:Rl(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 gp,jv,LP=y(()=>{"use strict";xv();vt();gp="STATUS_DRIFT";jv={name:gp,run:CRe}});function NRe(t){let{cwd:e="."}=t;return he(e,Mv,r=>jRe(r,e))}function jRe(t,e){let r=ut(e).language;return r==="unknown"?[{detector:Mv,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:Mv,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var Mv,l5,u5=y(()=>{"use strict";nn();vt();Mv="TECH_STACK_MISMATCH";l5={name:Mv,run:NRe}});function zRe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function URe(t){let{cwd:e="."}=t;return he(e,zP,r=>qRe(r,e))}function qRe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=ds([...zRe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:zP,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var zP,d5,MRe,FRe,LRe,Fv,UP=y(()=>{"use strict";tp();dP();vt();zP="UNMAPPED_ARTIFACT",d5=["src/stages/**/*.ts","src/spec/**/*.ts"],MRe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},FRe={kotlin:"src/main/kotlin"},LRe=8;Fv={name:zP,run:URe}});import{existsSync as f5}from"node:fs";import{join as p5}from"node:path";function HRe(t){return BRe.some(e=>t.startsWith(e))}function GRe(t){let{cwd:e="."}=t;return he(e,qP,r=>ZRe(r,e))}function ZRe(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(HRe(o))continue;let s=o.split("#",1)[0];f5(p5(e,o))||s&&f5(p5(e,s))||r.push({detector:qP,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 Sx(t){return`${JSON.stringify(t,null,2)} +`}function kee(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?`[[${See(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(wee);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(wee);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}/${See(s)}.md`,`${a.join(` +`)}`)}return o}function wee(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as Z2e}from"node:fs";import{dirname as V2e,join as ij}from"node:path";import{fileURLToPath as W2e}from"node:url";var oj=V2e(W2e(import.meta.url));function Eee(t){for(let e of[ij(oj,"viewer",t),ij(oj,"..","graph","viewer",t),ij(oj,"..","..","dist","viewer",t)])try{return Z2e(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function Aee(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -871,20 +876,20 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify
${n} -`}hP();PP();$P();EP();RP();mP();FP();LP();UP();BP();Im();IP();qe();var E2e=[Ev,Lv,kv,Fv,Tv,Iv,vv,jv,Nv,bv];function A2e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=lp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function lx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{_a(e,G(e))}catch{}try{for(let o of E2e){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 A2e(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{_a(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}GN();qe();ki();var O2e=new Set(["mermaid","dot","json","obsidian","html"]);function mee(t={}){try{let e=t.format??"mermaid";if(!O2e.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=G(),i=ac(n,".");if(t.focus){let s=nx(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=rx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=uee(i);for(let[c,l]of a){let u=T2e(s,c);ZN(WN(u),{recursive:!0}),VN(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=cx(i,lx(i,"."));ZN(WN(t.out),{recursive:!0}),VN(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"?lee(i):r==="json"?ax(i):cee(i);t.out?(ZN(WN(t.out),{recursive:!0}),VN(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 hee(){try{let t=ac(G(),".");process.stdout.write(pee(ux(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Im();import{createServer as R2e}from"node:http";import{existsSync as I2e,watch as P2e}from"node:fs";import{join as C2e}from"node:path";qe();ki();function D2e(t={}){let e=t.cwd??".",r=new Set,n=()=>ac(G(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}RP();VP();LP();UP();GP();OP();QP();eC();rC();iC();Fm();ZP();qe();var K2e=[Mv,Jv,jv,Kv,Lv,qv,Iv,Vv,Zv,Rv];function J2e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=gp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function xx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{va(e,G(e))}catch{}try{for(let o of K2e){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 J2e(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{va(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}sj();qe();Ai();var X2e=new Set(["mermaid","dot","json","obsidian","html"]);function Oee(t={}){try{let e=t.format??"mermaid";if(!X2e.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=G(),i=dc(n,".");if(t.focus){let s=yx(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=gx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=kee(i);for(let[c,l]of a){let u=Y2e(s,c);aj(lj(u),{recursive:!0}),cj(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,xx(i,"."));aj(lj(t.out),{recursive:!0}),cj(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"?$ee(i):r==="json"?Sx(i):xee(i);t.out?(aj(lj(t.out),{recursive:!0}),cj(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 Ree(){try{let t=dc(G(),".");process.stdout.write(Tee($x(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Fm();import{createServer as Q2e}from"node:http";import{existsSync as eUe,watch as tUe}from"node:fs";import{join as rUe}from"node:path";qe();Ai();function nUe(t={}){let e=t.cwd??".",r=new Set,n=()=>dc(G(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=R2e((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=ax(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(lx(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=Q2e((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=Sx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(xx(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=cx(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=C2e(e,u);if(I2e(d))try{let f=P2e(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=rUe(e,u);if(eUe(d))try{let f=tUe(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 gee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await D2e({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 N2e=["stage_1.1","stage_2.1","stage_2.3"];function j2e(t){return(t.features??[]).filter(e=>e.status==="done")}function M2e(t,e){let r=j2e(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 yee(t,e){let r=[];for(let n of N2e){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=M2e(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}Kv();import _ee from"node:process";function F2e(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 dx(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=F2e(n,t);i.pass||r.push(i)}return r}Xn();var KN="stage_4.1";function JN(t={}){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return{stage:KN,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=dx(r);if(n.length===0)return{stage:KN,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:KN,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var L2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${_ee.argv[1]}`;if(L2e){let t=JN();console.log(JSON.stringify(t)),_ee.exit(t.exitCode)}il();import{randomBytes as z2e}from"node:crypto";import{unlinkSync as U2e}from"node:fs";import{tmpdir as q2e}from"node:os";import{join as B2e,resolve as YN}from"node:path";import H2e from"node:process";var Ur=null;function bee(t){Ur={cwd:YN(t),run:null,jsonFile:null}}function vee(){return Ur!==null}function See(t,e){if(!Ur||Ur.cwd!==YN(t))return null;if(Ur.run)return Ur.run;let r=B2e(q2e(),`clad-shared-vitest-${H2e.pid}-${z2e(6).toString("hex")}.json`);Ur.jsonFile=r;let n=e(r);return Ur.run={proc:n,jsonFile:r},Ur.run}function wee(t){return!Ur||Ur.cwd!==YN(t)?null:Ur.run}function xee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function $ee(){let t=Ur?.jsonFile;if(Ur=null,t)try{U2e(t)}catch{}}jr();import kee from"node:process";var fx="stage_1.4";function XN(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:fx,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:fx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:fx,pass:!0,exitCode:0}:{stage:fx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var G2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${kee.argv[1]}`;if(G2e){let t=XN();console.log(JSON.stringify(t)),kee.exit(t.exitCode)}jr();import Eee from"node:process";Pm();An();var px="stage_2.2";function QN(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Oo("coverage",t))}catch(c){return{stage:px,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:px,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=wee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Lt(px,r,s);return a||Qt(px,s)}var W2e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Eee.argv[1]}`;if(W2e){let t=QN();console.log(JSON.stringify(t)),Eee.exit(t.exitCode)}_p();ej();jr();nn();An();import Tee from"node:process";var yx="stage_3.2";function tj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:yx,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:yx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(yx,i,s);return a||Qt(yx,s)}var dUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Tee.argv[1]}`;if(dUe){let t=tj();console.log(JSON.stringify(t)),Tee.exit(t.exitCode)}jr();qe();An();import{existsSync as fUe}from"node:fs";import{resolve as Ree}from"node:path";import Iee from"node:process";var ii="stage_2.4",rj=5e3,pUe=3e4;function nj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=G(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:ii,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return hUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ii,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ii,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ii,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Ree(e,r.path);if(!fUe(s))return{stage:ii,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??rj,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Lt(ii,r.path,c);if(l)return l;if(c.timedOut)return{stage:ii,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:ii,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ii,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Oee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},mUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function hUe(t,e,r){let n=Math.min(e.length*rj,pUe),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(gUe(t,s,r))}return yUe(o)}function gUe(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("/")?Ree(t,a):a,u=rj,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Ca(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 yUe(t){let e="skip";for(let o of t)Oee[o.disposition]>Oee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${mUe[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:ii,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ii,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var _Ue=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Iee.argv[1]}`;if(_Ue){let t=nj();console.log(JSON.stringify(t)),Iee.exit(t.exitCode)}jr();nn();An();import Pee from"node:process";var _x="stage_3.1";function ij(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:_x,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:_x,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(_x,i,s);return a||Qt(_x,s)}var bUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Pee.argv[1]}`;if(bUe){let t=ij();console.log(JSON.stringify(t)),Pee.exit(t.exitCode)}DP();oj();sj();jr();hx();import{randomBytes as EUe}from"node:crypto";import{unlinkSync as AUe}from"node:fs";import{tmpdir as TUe}from"node:os";import{join as OUe}from"node:path";import cj from"node:process";Pm();An();qe();import{readFileSync as wUe}from"node:fs";import{resolve as Nee}from"node:path";function xUe(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=Nee(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 $Ue(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function kUe(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=$Ue(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(Nee(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 aj(t,e){try{let r=xUe(wUe(t,"utf8"));return r?kUe(G(e),r,e):[]}catch{return[]}}var Ro="stage_2.1";function jee(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function RUe(t,e,r){let n,i;try{({cmd:n,args:i}=Oo("coverage",t))}catch{return null}if(!n||!i||!jee(n,i))return null;let o=n,s=i,a=See(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Lt(Ro,n,c))return null;let u=Qt(Ro,c);if(xee(u)==="fallback")return null;if(r){let d=aj(l,e);if(d.length>0)return{stage:Ro,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ro,pass:!0,exitCode:0}}function lj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Oo("test",t))}catch(u){return{stage:Ro,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Ro,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=jee(n,i),a=r&&s;if(vee()&&s){let u=RUe(t,e,a);if(u)return u}let c,l=i;a&&(c=OUe(TUe(),`clad-vitest-${cj.pid}-${EUe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Lt(Ro,n,u);if(d)return d;let f=pu("unit",Qt(Ro,u),u);if(a&&f.pass&&c){let p=aj(c,e);if(p.length>0)return{stage:Ro,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{AUe(c)}catch{}}}var IUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${cj.argv[1]}`;if(IUe){let t=lj();console.log(JSON.stringify(t)),cj.exit(t.exitCode)}jr();nn();An();import Mee from"node:process";var Sx="stage_3.3";function uj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Sx,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:Sx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Lt(Sx,i,s);return a||Qt(Sx,s)}var PUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Mee.argv[1]}`;if(PUe){let t=uj();console.log(JSON.stringify(t)),Mee.exit(t.exitCode)}jP();vf();ua();fj();sp();Ov();var Hee=bt(Xt(),1);import{existsSync as pj,readFileSync as BUe,readdirSync as Bee,statSync as HUe,writeFileSync as GUe}from"node:fs";import{basename as jm,join as Mm,relative as qee}from"node:path";var ZUe=["self-dogfood:","fixture:","derived:"],Gee=/\.(test|spec)\.[jt]sx?$/;function Zee(t,e=t,r=[]){let n;try{n=Bee(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Mm(e,i);try{HUe(o).isDirectory()?Zee(t,o,r):Gee.test(i)&&r.push(o)}catch{continue}}return r}function Vee(t="."){let e=Mm(t,"spec","features"),r=Mm(t,"tests"),n=[],i=[];if(!pj(e)||!pj(r))return{repaired:n,suggested:i};let o=Zee(r),s=new Map;for(let a of o){let c=qee(t,a).split("\\").join("/"),l=s.get(jm(a))??[];l.push(c),s.set(jm(a),l)}for(let a of Bee(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Mm(e,a),l,u;try{l=BUe(c,"utf8"),u=(0,Hee.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(ZUe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(pj(Mm(t,b)))continue;let _=s.get(jm(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=>jm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>qee(t,h).split("\\").join("/")).find(h=>{let g=jm(h).replace(Gee,"");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 Iee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await nUe({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 iUe=["stage_1.1","stage_2.1","stage_2.3"];function oUe(t){return(t.features??[]).filter(e=>e.status==="done")}function sUe(t,e){let r=oUe(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 Pee(t,e){let r=[];for(let n of iUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=sUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}sS();import Cee from"node:process";function aUe(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 kx(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=aUe(n,t);i.pass||r.push(i)}return r}ti();var uj="stage_4.1";function dj(t={}){let{cwd:e="."}=t,r=On(e);if(r.length===0)return{stage:uj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=kx(r);if(n.length===0)return{stage:uj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:uj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var cUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Cee.argv[1]}`;if(cUe){let t=dj();console.log(JSON.stringify(t)),Cee.exit(t.exitCode)}ul();import{randomBytes as lUe}from"node:crypto";import{unlinkSync as uUe}from"node:fs";import{tmpdir as dUe}from"node:os";import{join as fUe,resolve as fj}from"node:path";import pUe from"node:process";var qr=null;function Dee(t){qr={cwd:fj(t),run:null,jsonFile:null}}function Nee(){return qr!==null}function jee(t,e){if(!qr||qr.cwd!==fj(t))return null;if(qr.run)return qr.run;let r=fUe(dUe(),`clad-shared-vitest-${pUe.pid}-${lUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function Mee(t){return!qr||qr.cwd!==fj(t)?null:qr.run}function Fee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Lee(){let t=qr?.jsonFile;if(qr=null,t)try{uUe(t)}catch{}}Mr();import zee from"node:process";var Ex="stage_1.4";function pj(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Ex,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:Ex,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Ex,pass:!0,exitCode:0}:{stage:Ex,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var mUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${zee.argv[1]}`;if(mUe){let t=pj();console.log(JSON.stringify(t)),zee.exit(t.exitCode)}Mr();import Uee from"node:process";Lm();Tn();var Ax="stage_2.2";function mj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Io("coverage",t))}catch(c){return{stage:Ax,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Ax,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Mee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Ut(Ax,r,s);return a||tr(Ax,s)}var yUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Uee.argv[1]}`;if(yUe){let t=mj();console.log(JSON.stringify(t)),Uee.exit(t.exitCode)}kp();hj();Mr();on();Tn();import Bee from"node:process";var Ix="stage_3.2";function gj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Ix,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Ix,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Ix,i,s);return a||tr(Ix,s)}var DUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Bee.argv[1]}`;if(DUe){let t=gj();console.log(JSON.stringify(t)),Bee.exit(t.exitCode)}Mr();qe();Tn();import{existsSync as NUe}from"node:fs";import{resolve as Gee}from"node:path";import Zee from"node:process";var ai="stage_2.4",yj=5e3,jUe=3e4;function _j(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=G(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:ai,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return FUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ai,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ai,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Gee(e,r.path);if(!NUe(s))return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??yj,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Ut(ai,r.path,c);if(l)return l;if(c.timedOut)return{stage:ai,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:ai,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ai,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Hee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},MUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function FUe(t,e,r){let n=Math.min(e.length*yj,jUe),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(LUe(t,s,r))}return zUe(o)}function LUe(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("/")?Gee(t,a):a,u=yj,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Na(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 zUe(t){let e="skip";for(let o of t)Hee[o.disposition]>Hee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${MUe[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:ai,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ai,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var UUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Zee.argv[1]}`;if(UUe){let t=_j();console.log(JSON.stringify(t)),Zee.exit(t.exitCode)}Mr();on();Tn();import Vee from"node:process";var Px="stage_3.1";function bj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Px,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Px,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Px,i,s);return a||tr(Px,s)}var qUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Vee.argv[1]}`;if(qUe){let t=bj();console.log(JSON.stringify(t)),Vee.exit(t.exitCode)}KP();vj();Sj();Mr();Ox();import{randomBytes as KUe}from"node:crypto";import{unlinkSync as JUe}from"node:fs";import{tmpdir as YUe}from"node:os";import{join as XUe}from"node:path";import xj from"node:process";Lm();Tn();qe();import{readFileSync as GUe}from"node:fs";import{resolve as Jee}from"node:path";function ZUe(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=Jee(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 VUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function WUe(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=VUe(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(Jee(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 wj(t,e){try{let r=ZUe(GUe(t,"utf8"));return r?WUe(G(e),r,e):[]}catch{return[]}}var Po="stage_2.1";function Yee(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function QUe(t,e,r){let n,i;try{({cmd:n,args:i}=Io("coverage",t))}catch{return null}if(!n||!i||!Yee(n,i))return null;let o=n,s=i,a=jee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Ut(Po,n,c))return null;let u=tr(Po,c);if(Fee(u)==="fallback")return null;if(r){let d=wj(l,e);if(d.length>0)return{stage:Po,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Po,pass:!0,exitCode:0}}function $j(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Io("test",t))}catch(u){return{stage:Po,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Po,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Yee(n,i),a=r&&s;if(Nee()&&s){let u=QUe(t,e,a);if(u)return u}let c,l=i;a&&(c=XUe(YUe(),`clad-vitest-${xj.pid}-${KUe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Ut(Po,n,u);if(d)return d;let f=Su("unit",tr(Po,u),u);if(a&&f.pass&&c){let p=wj(c,e);if(p.length>0)return{stage:Po,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{JUe(c)}catch{}}}var eqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xj.argv[1]}`;if(eqe){let t=$j();console.log(JSON.stringify(t)),xj.exit(t.exitCode)}Mr();on();Tn();import Xee from"node:process";var Nx="stage_3.3";function kj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Nx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Nx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Nx,i,s);return a||tr(Nx,s)}var tqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Xee.argv[1]}`;if(tqe){let t=kj();console.log(JSON.stringify(t)),Xee.exit(t.exitCode)}YP();Af();fa();Aj();pp();zv();var ote=bt(Qt(),1);import{existsSync as Tj,readFileSync as fqe,readdirSync as ite,statSync as pqe,writeFileSync as mqe}from"node:fs";import{basename as Bm,join as Hm,relative as nte}from"node:path";var hqe=["self-dogfood:","fixture:","derived:"],ste=/\.(test|spec)\.[jt]sx?$/;function ate(t,e=t,r=[]){let n;try{n=ite(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Hm(e,i);try{pqe(o).isDirectory()?ate(t,o,r):ste.test(i)&&r.push(o)}catch{continue}}return r}function cte(t="."){let e=Hm(t,"spec","features"),r=Hm(t,"tests"),n=[],i=[];if(!Tj(e)||!Tj(r))return{repaired:n,suggested:i};let o=ate(r),s=new Map;for(let a of o){let c=nte(t,a).split("\\").join("/"),l=s.get(Bm(a))??[];l.push(c),s.set(Bm(a),l)}for(let a of ite(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Hm(e,a),l,u;try{l=fqe(c,"utf8"),u=(0,ote.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(hqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Tj(Hm(t,b)))continue;let _=s.get(Bm(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=>Bm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>nte(t,h).split("\\").join("/")).find(h=>{let g=Bm(h).replace(ste,"");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&&GUe(c,l,"utf8")}return{repaired:n,suggested:i}}nl();import{existsSync as VUe,readFileSync as WUe}from"node:fs";import{join as KUe}from"node:path";function JUe(t,e){let r=KUe(t,e);if(!VUe(r))return[];let n=[];for(let i of WUe(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 Wee(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=>JUe(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 Kee(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(` -`)}Pv();qe();ki();Xn();nl();var mj=["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"],YUe=[...mj,"att"];function XUe(t,e,r){if(e.startsWith("stage_4")){let n=Tn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return dx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function QUe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":g_(e,r,t).state==="fresh"?"\u2713":"!"}function kx(t,e="."){let r=rs(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...mj.map(o=>XUe(i,o,e)),QUe(i,r,e)]}));return{columns:YUe,rows:n}}function Jee(t,e=".",r={}){let n=r.internal??!1,i=kx(t,e),o=[...mj.map(c=>n?c.replace("stage_",""):eqe(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 eqe(t){return va(t).slice(0,3)}async function yJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(sue(),oue)),Promise.resolve().then(()=>(due(),uue)),Promise.resolve().then(()=>(Dp(),wX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>eee(s),prepareInit:({cwd:s,mode:a,intent:c})=>XQ(s,a,c),initialize:PN,prepareClarify:(s,{cwd:a})=>QQ(a,s),clarify:jN}});n(i.server);let o=new r;W.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function _Je(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await PN({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){W.stdout.write(`${JSON.stringify(n,null,2)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&mqe(c,l,"utf8")}return{repaired:n,suggested:i}}ll();import{existsSync as gqe,readFileSync as yqe}from"node:fs";import{join as _qe}from"node:path";function bqe(t,e){let r=_qe(t,e);if(!gqe(r))return[];let n=[];for(let i of yqe(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 lte(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=>bqe(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 ute(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(` +`)}Bv();qe();Ai();ti();ll();var Oj=["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"],vqe=[...Oj,"att"];function Sqe(t,e,r){if(e.startsWith("stage_4")){let n=On(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return kx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function wqe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":A_(e,r,t).state==="fresh"?"\u2713":"!"}function Lx(t,e="."){let r=is(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Oj.map(o=>Sqe(i,o,e)),wqe(i,r,e)]}));return{columns:vqe,rows:n}}function dte(t,e=".",r={}){let n=r.internal??!1,i=Lx(t,e),o=[...Oj.map(c=>n?c.replace("stage_",""):xqe(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 xqe(t){return wa(t).slice(0,3)}async function ZJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Tue(),Aue)),Promise.resolve().then(()=>(Cue(),Pue)),Promise.resolve().then(()=>(Up(),jX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>hee(s),prepareInit:({cwd:s,mode:a,intent:c})=>pee(s,a,c),initialize:VN,prepareClarify:(s,{cwd:a})=>mee(a,s),clarify:YN,resolveReview:(s,{cwd:a})=>lee(s,{cwd:a})}});n(i.server);let o=new r;W.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function VJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await VN({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){W.stdout.write(`${JSON.stringify(n,null,2)} `),W.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){W.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())W.stdout.write(` ${o+1}. ${s} @@ -895,30 +900,30 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&GUe(c,l,"u `),W.stdout.write(` e.g. clad init payment SaaS for B2B `),W.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));W.exit(0)}async function bJe(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(()=>(jue(),Nue)),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}`),W.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=G(e.cwd??"."),a=n.featuresTouched.map(l=>OO(l,s)),c=`${EH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&W.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.`),W.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function vJe(t={}){try{let e=G();if(la("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=fs(".");Ol(".",r),Ua("."),Z8(".");let n=Ll(".");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=Vee(".");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=$x(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Dv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),W.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)`),W.exit(0);return}L("pass","sync",`${e.features.length} features valid`),W.exit(0)}catch(e){L("fail","sync",e.message),W.exit(1)}}function SJe(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),W.exit(2);return}let e=Qy(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),W.exit(0)}function wJe(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),W.exit(2);return}let r=e_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),W.exit(1);return}t_(".",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?W.stdout.write(`Run: git checkout ${r.gitHead} +`));W.exit(0)}async function WJe(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(()=>(ide(),nde)),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}`),W.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=G(e.cwd??"."),a=n.featuresTouched.map(l=>HO(l,s)),c=`${zH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&W.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.`),W.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function KJe(t={}){try{let e=G();if(da("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ms(".");Nl(".",r),Ba("."),s5(".");let n=Gl(".");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=cte(".");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=Fx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Gv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),W.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)`),W.exit(0);return}L("pass","sync",`${e.features.length} features valid`),W.exit(0)}catch(e){L("fail","sync",e.message),W.exit(1)}}function JJe(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),W.exit(2);return}let e=u_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),W.exit(0)}function YJe(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),W.exit(2);return}let r=d_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),W.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?W.stdout.write(`Run: git checkout ${r.gitHead} `):W.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),W.exit(0)}async function xJe(t){let e=await pC({force:t.force,quiet:t.quiet});W.exit(e.errors.length>0?1:0)}async function $Je(){L("note","update","reconciling the current project after the engine upgrade");let t=await qY(".",{wireHosts:async()=>(await pC({quiet:!0})).errors.length});if(L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){L("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),W.exit(t.code);return}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);W.stdout.write(` +`),W.exit(0)}async function XJe(t){let e=await TC({force:t.force,quiet:t.quiet});W.exit(e.errors.length>0?1:0)}async function QJe(){L("note","update","reconciling the current project after the engine upgrade");let t=await rX(".",{wireHosts:async()=>(await TC({quiet:!0})).errors.length});if(L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){L("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),W.exit(t.code);return}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);W.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),KE({tier:"pre-commit",strict:!0}).anyFailed?W.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"),W.exit(t.code)}var kJe={"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 KE(t){let e=t.tier??"all",r=t.silent===!0,n=kJe[e];if(!n)return t.json&&!r?W.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",()=>Dm(i)],["stage_1.2",()=>Cm(i)],["stage_1.3",()=>ei({...i,strict:t.strict})],["stage_1.4",XN],["stage_1.5",Za],["stage_1.6",Ap],["stage_2.1",()=>lj({...i,strict:t.strict})],["stage_2.2",()=>QN(i)],["stage_2.3",CP],["stage_2.4",nj],["stage_3.1",ij],["stage_3.2",tj],["stage_3.3",uj],["stage_4.1",JN],["stage_4.2",Nm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ti(d)?"fail":"skip",u=[];y_("."),bee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:va(d),h=RY(p);ti(h)&&(c=!0,a=Math.max(a,IY(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),ti(h)&&CJe(p))}}finally{b_(),$ee()}if(t.strict)try{let d=G();for(let f of yee(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"||!ti(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=>ti(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(la("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{ZH(".",G())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?W.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&W.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),ur(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function EJe(t){try{let e=G(),r=Jc(e,t);W.stdout.write(`${JSON.stringify(r,null,2)} -`),W.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),W.exit(1)}}function AJe(t,e={}){try{let r=G(),n=e.depth!==void 0?Number(e.depth):void 0,i=_r(r,t,{depth:n});W.stdout.write(`${JSON.stringify(i,null,2)} -`),W.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),W.exit(1)}}function TJe(t={}){try{let e=G(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=zv(e,o=>{try{return Fue(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});W.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),W.exit(0)}catch(e){L("fail","infer-deps",e.message),W.exit(1)}}function OJe(t={}){try{if(t.sessions){nee(t);return}if(t.trend!==void 0&&t.trend!==!1){iee(t);return}let e=G(),n=GB(e,o=>{try{return Fue(o,"utf8")}catch{return null}},"."),i=VB(".",n);if(t.json)W.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)}`,` ${Yc}`];W.stdout.write(`${c.join(` +`),uA({tier:"pre-commit",strict:!0}).anyFailed?W.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"),W.exit(t.code)}var e8e={"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 uA(t){let e=t.tier??"all",r=t.silent===!0,n=e8e[e];if(!n)return t.json&&!r?W.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",()=>Um(i)],["stage_1.2",()=>zm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",pj],["stage_1.5",Wa],["stage_1.6",Dp],["stage_2.1",()=>$j({...i,strict:t.strict})],["stage_2.2",()=>mj(i)],["stage_2.3",WP],["stage_2.4",_j],["stage_3.1",bj],["stage_3.2",gj],["stage_3.3",kj],["stage_4.1",dj],["stage_4.2",qm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ii(d)?"fail":"skip",u=[];T_("."),Dee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:wa(d),h=HY(p);ii(h)&&(c=!0,a=Math.max(a,GY(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),ii(h)&&c8e(p))}}finally{R_(),Lee()}if(t.strict)try{let d=G();for(let f of Pee(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"||!ii(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=>ii(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(da("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{sG(".",G())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?W.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&W.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function t8e(t){try{let e=G(),r=rl(e,t);W.stdout.write(`${JSON.stringify(r,null,2)} +`),W.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),W.exit(1)}}function r8e(t,e={}){try{let r=G(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});W.stdout.write(`${JSON.stringify(i,null,2)} +`),W.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),W.exit(1)}}function n8e(t={}){try{let e=G(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Yv(e,o=>{try{return sde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});W.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),W.exit(0)}catch(e){L("fail","infer-deps",e.message),W.exit(1)}}function i8e(t={}){try{if(t.sessions){_ee(t);return}if(t.trend!==void 0&&t.trend!==!1){bee(t);return}let e=G(),n=oH(e,o=>{try{return sde(o,"utf8")}catch{return null}},"."),i=aH(".",n);if(t.json)W.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)}`,` ${nl}`];W.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)")}W.exit(0)}catch(e){L("fail","measure",e.message),W.exit(1)}}function RJe(t){let e;if(t.feature)try{let n=(G().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),W.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),W.exit(1)}W.exitCode=KE({...t,focusModules:e}).worst}function IJe(t){let e=dY(".",t,{checkStages:KE,onIndex:Ua,gitOpInProgress:KT});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),W.exit(e.code)}function PJe(t,e={}){let r=e.cwd??".",n;try{n=G(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),W.exit(1);return}if(e.required){t&&W.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=J8(n);if(o.length===0){W.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)")}W.exit(0)}catch(e){L("fail","measure",e.message),W.exit(1)}}function o8e(t){let e;if(t.feature)try{let n=(G().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),W.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),W.exit(1)}W.exitCode=uA({...t,focusModules:e}).worst}function s8e(t){let e=kY(".",t,{checkStages:uA,onIndex:Ba,gitOpInProgress:uO});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),W.exit(e.code)}function a8e(t,e={}){let r=e.cwd??".",n;try{n=G(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),W.exit(1);return}if(e.required){t&&W.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=u5(n);if(o.length===0){W.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),W.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";W.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}W.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),W.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"),W.exit(1);return}let i=Wee(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`),W.exit(1);return}W.stdout.write(`${Kee(i)} -`),W.exit(0)}function CJe(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=Mue(kf(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";W.stdout.write(` ${o}${s} [${i.detector}] +`),W.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"),W.exit(1);return}let i=lte(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`),W.exit(1);return}W.stdout.write(`${ute(i)} +`),W.exit(0)}function c8e(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=ode(Pf(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";W.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&W.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&W.stdout.write(` ${Mue(e.trim(),160)} -`)}}function Mue(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function DJe(t){let e=G();if(t.json){W.stdout.write(`${JSON.stringify(kx(e,"."),null,2)} -`),W.exitCode=0;return}W.stdout.write(`${Jee(e,".",{internal:t.internal})} -`),W.exit(0)}function NJe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function jJe(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"),W.exit(1);return}let n;try{let i=G(e),o=kx(i,e),s={gitHead:fa(e),version:Dl(),generatedAt:t.now??new Date().toISOString()},a=el(i),c;try{let l=t.since??Yo(e),u=Xo(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:Xc(u),auditMarkdown:Qc(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=FH({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),W.exit(1);return}try{gJe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),W.exit(1);return}L("pass","bundle",`${r} \xB7 ${NJe(Buffer.byteLength(n,"utf8"))}`),W.exit(0)}function MJe(t){let e=mA(t);L("note",`route \u2192 ${e}`,t),W.exit(e==="unknown"?1:0)}function FJe(){let t=new jq;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(_Je),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(bJe),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(vJe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(xJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action($Je),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(RJe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(SJe),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(IJe),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)=>PJe(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(wJe),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(DJe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(EJe),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)=>AJe(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=>FY(r,{checkStages:KE})),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=>TJe(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=>OJe(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=>mee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>hee()),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=>{gee(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=>kH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>R5(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=>jJe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(MJe),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(OY),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(yJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){cY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}C5(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(YQ),t}var LJe=!!globalThis.__CLADDING_BUNDLED,zJe=LJe||import.meta.url===`file://${W.argv[1]}`;zJe&&FJe().parse();export{kJe as TIER_STAGES,FJe as createProgram,jJe as runBundleCommand,RJe as runCheckCommand,KE as runCheckStages,SJe as runCheckpointCommand,EJe as runContextCommand,IJe as runDoneCommand,AJe as runImpactCommand,TJe as runInferDepsCommand,_Je as runInitCommand,OJe as runMeasureCommand,PJe as runOracleCommand,wJe as runRollbackCommand,MJe as runRouteCommand,bJe as runRunCommand,yJe as runServeCommand,xJe as runSetupCommand,DJe as runStatusCommand,vJe as runSyncCommand,$Je as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&W.stdout.write(` ${ode(e.trim(),160)} +`)}}function ode(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function l8e(t){let e=G();if(t.json){W.stdout.write(`${JSON.stringify(Lx(e,"."),null,2)} +`),W.exitCode=0;return}W.stdout.write(`${dte(e,".",{internal:t.internal})} +`),W.exit(0)}function u8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function d8e(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"),W.exit(1);return}let n;try{let i=G(e),o=Lx(i,e),s={gitHead:ma(e),version:zl(),generatedAt:t.now??new Date().toISOString()},a=sl(i),c;try{let l=t.since??Qo(e),u=es(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:il(u),auditMarkdown:ol(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=XH({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),W.exit(1);return}try{GJe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),W.exit(1);return}L("pass","bundle",`${r} \xB7 ${u8e(Buffer.byteLength(n,"utf8"))}`),W.exit(0)}function f8e(t){let e=OA(t);L("note",`route \u2192 ${e}`,t),W.exit(e==="unknown"?1:0)}function p8e(){let t=new Jq;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(VJe),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(WJe),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(KJe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(XJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(QJe),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(o8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(JJe),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(s8e),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)=>a8e(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(YJe),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(l8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(t8e),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)=>r8e(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=>XY(r,{checkStages:uA})),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=>n8e(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=>i8e(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=>Oee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Ree()),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=>{Iee(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=>LH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>H5(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=>d8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(f8e),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(BY),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(ZJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){wY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}V5(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(fee),t}var m8e=!!globalThis.__CLADDING_BUNDLED,h8e=m8e||import.meta.url===`file://${W.argv[1]}`;h8e&&p8e().parse();export{e8e as TIER_STAGES,p8e as createProgram,d8e as runBundleCommand,o8e as runCheckCommand,uA as runCheckStages,JJe as runCheckpointCommand,t8e as runContextCommand,s8e as runDoneCommand,r8e as runImpactCommand,n8e as runInferDepsCommand,VJe as runInitCommand,i8e as runMeasureCommand,a8e as runOracleCommand,YJe as runRollbackCommand,f8e as runRouteCommand,WJe as runRunCommand,ZJe as runServeCommand,XJe as runSetupCommand,l8e as runStatusCommand,KJe as runSyncCommand,QJe as runUpdateCommand}; diff --git a/plugins/claude-code/dist/schema.json b/plugins/claude-code/dist/schema.json index 9a588552..5e6d3559 100644 --- a/plugins/claude-code/dist/schema.json +++ b/plugins/claude-code/dist/schema.json @@ -194,6 +194,18 @@ "type": "array", "items": {"$ref": "#/definitions/acceptance_criterion"} }, + "design_impact": { + "type": "object", + "required": ["classification", "rationale", "status"], + "additionalProperties": false, + "properties": { + "classification": {"type": "string", "enum": ["none", "additive", "structural"]}, + "rationale": {"type": "string", "minLength": 1}, + "status": {"type": "string", "enum": ["resolved", "review_required"]}, + "artifacts": {"type": "array", "items": {"type": "string"}}, + "baseline_digests": {"type": "object", "additionalProperties": {"type": "string"}} + } + }, "depends_on": { "type": "array", "items": {"type": "string", "pattern": "^F-(\\d{3,}|[a-f0-9]{6,})$"} diff --git a/plugins/codex/skills/blind-author/SKILL.md b/plugins/codex/skills/blind-author/SKILL.md index dac74eea..8b0eacab 100644 --- a/plugins/codex/skills/blind-author/SKILL.md +++ b/plugins/codex/skills/blind-author/SKILL.md @@ -1,6 +1,6 @@ --- name: blind-author -description: Impl-blind test/oracle author — writes conformance tests from a spec-only brief. Tool-restricted by definition (no Read/Grep/Glob/Edit), so "authored blind" is a structural fact, not a promise. +description: Impl-blind test/oracle author — writes conformance tests from a spec-only brief. Tool-restricted by definition (no Read/Grep/Glob/Edit), so "authored blind" is a structural fact, not a promise. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Write, Bash capabilities: [write, exec] --- diff --git a/plugins/codex/skills/changelog/SKILL.md b/plugins/codex/skills/changelog/SKILL.md index e118076c..a518a6b0 100644 --- a/plugins/codex/skills/changelog/SKILL.md +++ b/plugins/codex/skills/changelog/SKILL.md @@ -1,5 +1,5 @@ --- -description: Render release notes / a changelog from the cladding spec. Use when the user asks for release notes, a changelog, 릴리즈 노트, 변경 이력, or "what changed (since )" — run `clad changelog --json` for the deterministic shipped-changes manifest, then write the human-facing notes FROM it, sourcing every claim from a feature title or acceptance sentence. For audit asks, print the --audit table verbatim. +description: Render release notes / a changelog from the cladding spec. Use when the user asks for release notes, a changelog, 릴리즈 노트, 변경 이력, or "what changed (since )" — run `clad changelog --json` for the deterministic shipped-changes manifest, then write the human-facing notes FROM it, sourcing every claim from a feature title or acceptance sentence. For audit asks, print the --audit table verbatim. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding changelog — release notes from the spec diff --git a/plugins/codex/skills/check/SKILL.md b/plugins/codex/skills/check/SKILL.md index f0b82fcb..176c33a2 100644 --- a/plugins/codex/skills/check/SKILL.md +++ b/plugins/codex/skills/check/SKILL.md @@ -1,5 +1,5 @@ --- -description: Run every Iron Law stage and the drift detector suite. Use when the user wants the full project health snapshot, a CI gate, or to verify nothing regressed before committing. Add --strict to promote warn-severity drift findings to errors. +description: Run every Iron Law stage and the drift detector suite. Use when the user wants the full project health snapshot, a CI gate, or to verify nothing regressed before committing. Add --strict to promote warn-severity drift findings to errors. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding check diff --git a/plugins/codex/skills/checkpoint/SKILL.md b/plugins/codex/skills/checkpoint/SKILL.md index 8f46d20c..fd5cec9c 100644 --- a/plugins/codex/skills/checkpoint/SKILL.md +++ b/plugins/codex/skills/checkpoint/SKILL.md @@ -1,5 +1,5 @@ --- -description: Record a feature checkpoint event pinning the current git HEAD plus a spec digest, so a later rollback can restore the exact pre-change state. Use before a non-trivial feature implementation, before a refactor that touches many files, or whenever the user wants a known-good safety net the autonomous drive loop can fall back to. +description: Record a feature checkpoint event pinning the current git HEAD plus a spec digest, so a later rollback can restore the exact pre-change state. Use before a non-trivial feature implementation, before a refactor that touches many files, or whenever the user wants a known-good safety net the autonomous drive loop can fall back to. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding checkpoint diff --git a/plugins/codex/skills/clarify/SKILL.md b/plugins/codex/skills/clarify/SKILL.md index 7b428b97..3d19ef58 100644 --- a/plugins/codex/skills/clarify/SKILL.md +++ b/plugins/codex/skills/clarify/SKILL.md @@ -1,5 +1,5 @@ --- -description: Advance Cladding onboarding after the user answers a pending product question. Use the MCP prepare/apply flow, preserve the answer verbatim, and never invent answers. +description: Advance Cladding onboarding after the user answers a pending product question. Use the MCP prepare/apply flow, preserve the answer verbatim, and never invent answers. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding clarify @@ -9,6 +9,8 @@ Use this workflow only after Cladding initialization returned a pending question 1. Call `clad_prepare_clarify` with the user's answer verbatim. 2. Read the returned prompt, current state, and artifacts. Draft the structured refinement required by `clad_clarify` using the current host model. 3. Call `clad_clarify` with the same answer, the one-time token, and the draft. -4. Ask `nextQuestion` verbatim when one remains; otherwise report that onboarding is complete. +4. Ask `nextQuestion` verbatim when one remains. +5. If the result is `needs_review`, show the proposal diffs for every `pendingReview` target and wait for explicit user approval. Only then call `clad_resolve_onboarding_review` with the approved targets. Never describe onboarding as complete while review remains. +6. Report completion only when the returned status is `done`. Do not run `clad clarify` in a shell from an AI host. Do not use MCP sampling. Never answer a product question on the user's behalf. A stale, malformed, replayed, or answer-mismatched apply request is a no-op and must be prepared again. diff --git a/plugins/codex/skills/developer/SKILL.md b/plugins/codex/skills/developer/SKILL.md index 6d1c2835..7393b7cf 100644 --- a/plugins/codex/skills/developer/SKILL.md +++ b/plugins/codex/skills/developer/SKILL.md @@ -1,6 +1,6 @@ --- name: developer -description: Implementer — writes production code, tests, and migrations. The "generic engineer" fallback when no narrower specialist exists. +description: Implementer — writes production code, tests, and migrations. The "generic engineer" fallback when no narrower specialist exists. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Write, Edit, Bash capabilities: [read, write, edit, exec] --- diff --git a/plugins/codex/skills/doctor/SKILL.md b/plugins/codex/skills/doctor/SKILL.md index 46d6c487..10214faa 100644 --- a/plugins/codex/skills/doctor/SKILL.md +++ b/plugins/codex/skills/doctor/SKILL.md @@ -1,5 +1,5 @@ --- -description: Summarise .cladding/events.log.jsonl — sentinel-miss frequency by phase × cause × fallback plus the top missed sentinels. Use when the user asks whether their LLM dispatcher (MCP sampling host, Anthropic SDK, …) is healthy, when scan / drive results look thinner than expected, or as a one-shot triage before tuning model / max_tokens / temperature. +description: Summarise .cladding/events.log.jsonl — sentinel-miss frequency by phase × cause × fallback plus the top missed sentinels. Use when the user asks whether their LLM dispatcher (MCP sampling host, Anthropic SDK, …) is healthy, when scan / drive results look thinner than expected, or as a one-shot triage before tuning model / max_tokens / temperature. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding doctor diff --git a/plugins/codex/skills/init/SKILL.md b/plugins/codex/skills/init/SKILL.md index ef6ebedd..15925604 100644 --- a/plugins/codex/skills/init/SKILL.md +++ b/plugins/codex/skills/init/SKILL.md @@ -14,8 +14,8 @@ Use this workflow only when the user explicitly asks to initialize, adopt, or re - `document` with a project-relative planning-document path. - `existing` for an existing codebase; include an optional adoption goal. 3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. -4. Show `plannedChanges` and `confirmationQuestion` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. -5. Only after an affirmative user reply, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. +4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. Questions, paraphrases, and generic acknowledgements are not approval. 6. Ask the returned `nextQuestion` verbatim. Continue with the Cladding clarify workflow after the user answers. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. diff --git a/plugins/codex/skills/observability/SKILL.md b/plugins/codex/skills/observability/SKILL.md index da1e4251..5beb1a28 100644 --- a/plugins/codex/skills/observability/SKILL.md +++ b/plugins/codex/skills/observability/SKILL.md @@ -1,6 +1,6 @@ --- name: observability -description: Log and metrics analyst — reads .cladding/audit.log.jsonl, perf/baseline.json, and drift reports; surfaces patterns the human can act on. +description: Log and metrics analyst — reads .cladding/audit.log.jsonl, perf/baseline.json, and drift reports; surfaces patterns the human can act on. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Bash capabilities: [read, exec] --- diff --git a/plugins/codex/skills/oracle/SKILL.md b/plugins/codex/skills/oracle/SKILL.md index 12bad6aa..889f0782 100644 --- a/plugins/codex/skills/oracle/SKILL.md +++ b/plugins/codex/skills/oracle/SKILL.md @@ -1,5 +1,5 @@ --- -description: Author an IMPL-BLIND spec-conformance oracle for a feature's acceptance criterion, so the gate verifies the code matches the SPEC (not just the author's own tests). cladding calls no LLM — YOU spawn a blind sub-agent from a spec-only brief, then record it. Author ONLY what `clad oracle --required` lists (the policy worklist) — an empty worklist means do not author unless the user explicitly asks; out-of-policy recordings are labeled voluntary and spend beyond the project's declared verification budget. +description: Author an IMPL-BLIND spec-conformance oracle for a feature's acceptance criterion, so the gate verifies the code matches the SPEC (not just the author's own tests). cladding calls no LLM — YOU spawn a blind sub-agent from a spec-only brief, then record it. Author ONLY what `clad oracle --required` lists (the policy worklist) — an empty worklist means do not author unless the user explicitly asks; out-of-policy recordings are labeled voluntary and spend beyond the project's declared verification budget. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding oracle — impl-blind conformance authoring diff --git a/plugins/codex/skills/orchestrator/SKILL.md b/plugins/codex/skills/orchestrator/SKILL.md index db1ea39e..073305af 100644 --- a/plugins/codex/skills/orchestrator/SKILL.md +++ b/plugins/codex/skills/orchestrator/SKILL.md @@ -1,6 +1,6 @@ --- name: orchestrator -description: Workflow conductor — sequences agents based on the 5 invocation principles. Routes user intent to the right persona. +description: Workflow conductor — sequences agents based on the 5 invocation principles. Routes user intent to the right persona. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Write, Edit, Bash, Agent capabilities: [read, write, edit, exec, dispatch] --- @@ -29,7 +29,7 @@ You do NOT pre-load Tier C (conventions — developer's concern). 3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. 4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). 5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. -6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes, and wait for a separate affirmative user reply. The original request is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. ## Feature cycle — one feature at a time diff --git a/plugins/codex/skills/planner/SKILL.md b/plugins/codex/skills/planner/SKILL.md index b2f7ed45..7967b1e1 100644 --- a/plugins/codex/skills/planner/SKILL.md +++ b/plugins/codex/skills/planner/SKILL.md @@ -1,6 +1,6 @@ --- name: planner -description: SSoT custodian — keeps spec.yaml structurally clean. Adds features, archives them, and ensures EARS pattern compliance. +description: SSoT custodian — keeps spec.yaml structurally clean. Adds features, archives them, and ensures EARS pattern compliance. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Write, Edit, Bash capabilities: [read, write, edit, exec] --- diff --git a/plugins/codex/skills/reviewer/SKILL.md b/plugins/codex/skills/reviewer/SKILL.md index 99246fc8..837d92e0 100644 --- a/plugins/codex/skills/reviewer/SKILL.md +++ b/plugins/codex/skills/reviewer/SKILL.md @@ -1,6 +1,6 @@ --- name: reviewer -description: Philosophical guardrails enforcer — independently audits code, tests, and spec for layered-integrity, Why>What, error-as-data, and the related Ironclad philosophical invariants. +description: Philosophical guardrails enforcer — independently audits code, tests, and spec for layered-integrity, Why>What, error-as-data, and the related Ironclad philosophical invariants. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Bash capabilities: [read, exec] --- diff --git a/plugins/codex/skills/rollback/SKILL.md b/plugins/codex/skills/rollback/SKILL.md index be861be3..80cfe7b4 100644 --- a/plugins/codex/skills/rollback/SKILL.md +++ b/plugins/codex/skills/rollback/SKILL.md @@ -1,5 +1,5 @@ --- -description: Record a rollback event and print the maintainer-runnable git command for the most recent checkpoint of a feature. Use when an implementation attempt failed, an autonomous drive loop hit RETRY_THRESHOLD, or the user wants to abandon the current attempt and restore the pre-checkpoint state. +description: Record a rollback event and print the maintainer-runnable git command for the most recent checkpoint of a feature. Use when an implementation attempt failed, an autonomous drive loop hit RETRY_THRESHOLD, or the user wants to abandon the current attempt and restore the pre-checkpoint state. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding rollback diff --git a/plugins/codex/skills/route/SKILL.md b/plugins/codex/skills/route/SKILL.md index 2210cbfa..ebe706b0 100644 --- a/plugins/codex/skills/route/SKILL.md +++ b/plugins/codex/skills/route/SKILL.md @@ -1,5 +1,5 @@ --- -description: Classify a natural-language prompt to one of cladding's verbs. Use when the user describes work in their own words and you want to see which built-in verb cladding's intent classifier would pick — primarily a debugging tool for the orchestrator persona and for verifying the router's coverage after adding new verbs. +description: Classify a natural-language prompt to one of cladding's verbs. Use when the user describes work in their own words and you want to see which built-in verb cladding's intent classifier would pick — primarily a debugging tool for the orchestrator persona and for verifying the router's coverage after adding new verbs. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding route diff --git a/plugins/codex/skills/run/SKILL.md b/plugins/codex/skills/run/SKILL.md index 7c4cdb5b..28684de2 100644 --- a/plugins/codex/skills/run/SKILL.md +++ b/plugins/codex/skills/run/SKILL.md @@ -1,5 +1,5 @@ --- -description: Run cladding's autonomous loop — iterate ready features, dispatch the developer + reviewer personas through the active host adapter, run L1 gates, halt on HUMAN_REQUIRED or transport failure. Use only when the user explicitly asks for autonomous progress; the loop will modify files. +description: Run cladding's autonomous loop — iterate ready features, dispatch the developer + reviewer personas through the active host adapter, run L1 gates, halt on HUMAN_REQUIRED or transport failure. Use only when the user explicitly asks for autonomous progress; the loop will modify files. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding run (formerly `drive`) diff --git a/plugins/codex/skills/serve/SKILL.md b/plugins/codex/skills/serve/SKILL.md index 7f7a2677..09450402 100644 --- a/plugins/codex/skills/serve/SKILL.md +++ b/plugins/codex/skills/serve/SKILL.md @@ -1,5 +1,5 @@ --- -description: Boot cladding as an MCP server over stdio. Use only when the user wants to expose cladding's tools, resources, and persona prompts to a separate MCP client. Most users don't run this directly — the plugin's .mcp.json launches it automatically. +description: Boot cladding as an MCP server over stdio. Use only when the user wants to expose cladding's tools, resources, and persona prompts to a separate MCP client. Most users don't run this directly — the plugin's .mcp.json launches it automatically. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding serve diff --git a/plugins/codex/skills/status/SKILL.md b/plugins/codex/skills/status/SKILL.md index 94bd0f20..3544f4e5 100644 --- a/plugins/codex/skills/status/SKILL.md +++ b/plugins/codex/skills/status/SKILL.md @@ -1,5 +1,5 @@ --- -description: Render the feature × stage integrity matrix — every feature vs every Iron Law stage with pass/skip/fail markers. Use when the user wants a project-wide status board, a release-readiness view, or to spot which features are still behind which stage. +description: Render the feature × stage integrity matrix — every feature vs every Iron Law stage with pass/skip/fail markers. Use when the user wants a project-wide status board, a release-readiness view, or to spot which features are still behind which stage. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding status (formerly `panel`) diff --git a/plugins/codex/skills/sync/SKILL.md b/plugins/codex/skills/sync/SKILL.md index 6dacb4e7..963f625d 100644 --- a/plugins/codex/skills/sync/SKILL.md +++ b/plugins/codex/skills/sync/SKILL.md @@ -1,5 +1,5 @@ --- -description: Validate the active spec.yaml against the Ironclad schema and refresh the inventory. Rarely needed manually — clad_create_feature already auto-syncs the inventory and clad check / clad done self-validate the spec, so do NOT run it as a reflexive pre-flight before those. Use it only after you have directly hand-edited a shard file (spec/features/*.yaml or spec.yaml). +description: Validate the active spec.yaml against the Ironclad schema and refresh the inventory. Rarely needed manually — clad_create_feature already auto-syncs the inventory and clad check / clad done self-validate the spec, so do NOT run it as a reflexive pre-flight before those. Use it only after you have directly hand-edited a shard file (spec/features/*.yaml or spec.yaml). Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding sync diff --git a/plugins/gemini-cli/commands/init.toml b/plugins/gemini-cli/commands/init.toml index e9ad6ff3..e51f672c 100644 --- a/plugins/gemini-cli/commands/init.toml +++ b/plugins/gemini-cli/commands/init.toml @@ -12,8 +12,8 @@ Use this workflow only when the user explicitly asks to initialize, adopt, or re - `document` with a project-relative planning-document path. - `existing` for an existing codebase; include an optional adoption goal. 3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. -4. Show `plannedChanges` and `confirmationQuestion` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. -5. Only after an affirmative user reply, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. +4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. Questions, paraphrases, and generic acknowledgements are not approval. 6. Ask the returned `nextQuestion` verbatim. Continue with the Cladding clarify workflow after the user answers. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. diff --git a/skills/changelog/SKILL.md b/skills/changelog/SKILL.md index e118076c..a518a6b0 100644 --- a/skills/changelog/SKILL.md +++ b/skills/changelog/SKILL.md @@ -1,5 +1,5 @@ --- -description: Render release notes / a changelog from the cladding spec. Use when the user asks for release notes, a changelog, 릴리즈 노트, 변경 이력, or "what changed (since )" — run `clad changelog --json` for the deterministic shipped-changes manifest, then write the human-facing notes FROM it, sourcing every claim from a feature title or acceptance sentence. For audit asks, print the --audit table verbatim. +description: Render release notes / a changelog from the cladding spec. Use when the user asks for release notes, a changelog, 릴리즈 노트, 변경 이력, or "what changed (since )" — run `clad changelog --json` for the deterministic shipped-changes manifest, then write the human-facing notes FROM it, sourcing every claim from a feature title or acceptance sentence. For audit asks, print the --audit table verbatim. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding changelog — release notes from the spec diff --git a/skills/check/SKILL.md b/skills/check/SKILL.md index f0b82fcb..176c33a2 100644 --- a/skills/check/SKILL.md +++ b/skills/check/SKILL.md @@ -1,5 +1,5 @@ --- -description: Run every Iron Law stage and the drift detector suite. Use when the user wants the full project health snapshot, a CI gate, or to verify nothing regressed before committing. Add --strict to promote warn-severity drift findings to errors. +description: Run every Iron Law stage and the drift detector suite. Use when the user wants the full project health snapshot, a CI gate, or to verify nothing regressed before committing. Add --strict to promote warn-severity drift findings to errors. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding check diff --git a/skills/checkpoint/SKILL.md b/skills/checkpoint/SKILL.md index 8f46d20c..fd5cec9c 100644 --- a/skills/checkpoint/SKILL.md +++ b/skills/checkpoint/SKILL.md @@ -1,5 +1,5 @@ --- -description: Record a feature checkpoint event pinning the current git HEAD plus a spec digest, so a later rollback can restore the exact pre-change state. Use before a non-trivial feature implementation, before a refactor that touches many files, or whenever the user wants a known-good safety net the autonomous drive loop can fall back to. +description: Record a feature checkpoint event pinning the current git HEAD plus a spec digest, so a later rollback can restore the exact pre-change state. Use before a non-trivial feature implementation, before a refactor that touches many files, or whenever the user wants a known-good safety net the autonomous drive loop can fall back to. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding checkpoint diff --git a/skills/clarify/SKILL.md b/skills/clarify/SKILL.md index 7b428b97..3d19ef58 100644 --- a/skills/clarify/SKILL.md +++ b/skills/clarify/SKILL.md @@ -1,5 +1,5 @@ --- -description: Advance Cladding onboarding after the user answers a pending product question. Use the MCP prepare/apply flow, preserve the answer verbatim, and never invent answers. +description: Advance Cladding onboarding after the user answers a pending product question. Use the MCP prepare/apply flow, preserve the answer verbatim, and never invent answers. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding clarify @@ -9,6 +9,8 @@ Use this workflow only after Cladding initialization returned a pending question 1. Call `clad_prepare_clarify` with the user's answer verbatim. 2. Read the returned prompt, current state, and artifacts. Draft the structured refinement required by `clad_clarify` using the current host model. 3. Call `clad_clarify` with the same answer, the one-time token, and the draft. -4. Ask `nextQuestion` verbatim when one remains; otherwise report that onboarding is complete. +4. Ask `nextQuestion` verbatim when one remains. +5. If the result is `needs_review`, show the proposal diffs for every `pendingReview` target and wait for explicit user approval. Only then call `clad_resolve_onboarding_review` with the approved targets. Never describe onboarding as complete while review remains. +6. Report completion only when the returned status is `done`. Do not run `clad clarify` in a shell from an AI host. Do not use MCP sampling. Never answer a product question on the user's behalf. A stale, malformed, replayed, or answer-mismatched apply request is a no-op and must be prepared again. diff --git a/skills/doctor/SKILL.md b/skills/doctor/SKILL.md index 46d6c487..10214faa 100644 --- a/skills/doctor/SKILL.md +++ b/skills/doctor/SKILL.md @@ -1,5 +1,5 @@ --- -description: Summarise .cladding/events.log.jsonl — sentinel-miss frequency by phase × cause × fallback plus the top missed sentinels. Use when the user asks whether their LLM dispatcher (MCP sampling host, Anthropic SDK, …) is healthy, when scan / drive results look thinner than expected, or as a one-shot triage before tuning model / max_tokens / temperature. +description: Summarise .cladding/events.log.jsonl — sentinel-miss frequency by phase × cause × fallback plus the top missed sentinels. Use when the user asks whether their LLM dispatcher (MCP sampling host, Anthropic SDK, …) is healthy, when scan / drive results look thinner than expected, or as a one-shot triage before tuning model / max_tokens / temperature. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding doctor diff --git a/skills/init/SKILL.md b/skills/init/SKILL.md index ef6ebedd..15925604 100644 --- a/skills/init/SKILL.md +++ b/skills/init/SKILL.md @@ -14,8 +14,8 @@ Use this workflow only when the user explicitly asks to initialize, adopt, or re - `document` with a project-relative planning-document path. - `existing` for an existing codebase; include an optional adoption goal. 3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. -4. Show `plannedChanges` and `confirmationQuestion` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. -5. Only after an affirmative user reply, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. +4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. Questions, paraphrases, and generic acknowledgements are not approval. 6. Ask the returned `nextQuestion` verbatim. Continue with the Cladding clarify workflow after the user answers. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. diff --git a/skills/oracle/SKILL.md b/skills/oracle/SKILL.md index 12bad6aa..889f0782 100644 --- a/skills/oracle/SKILL.md +++ b/skills/oracle/SKILL.md @@ -1,5 +1,5 @@ --- -description: Author an IMPL-BLIND spec-conformance oracle for a feature's acceptance criterion, so the gate verifies the code matches the SPEC (not just the author's own tests). cladding calls no LLM — YOU spawn a blind sub-agent from a spec-only brief, then record it. Author ONLY what `clad oracle --required` lists (the policy worklist) — an empty worklist means do not author unless the user explicitly asks; out-of-policy recordings are labeled voluntary and spend beyond the project's declared verification budget. +description: Author an IMPL-BLIND spec-conformance oracle for a feature's acceptance criterion, so the gate verifies the code matches the SPEC (not just the author's own tests). cladding calls no LLM — YOU spawn a blind sub-agent from a spec-only brief, then record it. Author ONLY what `clad oracle --required` lists (the policy worklist) — an empty worklist means do not author unless the user explicitly asks; out-of-policy recordings are labeled voluntary and spend beyond the project's declared verification budget. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding oracle — impl-blind conformance authoring diff --git a/skills/rollback/SKILL.md b/skills/rollback/SKILL.md index be861be3..80cfe7b4 100644 --- a/skills/rollback/SKILL.md +++ b/skills/rollback/SKILL.md @@ -1,5 +1,5 @@ --- -description: Record a rollback event and print the maintainer-runnable git command for the most recent checkpoint of a feature. Use when an implementation attempt failed, an autonomous drive loop hit RETRY_THRESHOLD, or the user wants to abandon the current attempt and restore the pre-checkpoint state. +description: Record a rollback event and print the maintainer-runnable git command for the most recent checkpoint of a feature. Use when an implementation attempt failed, an autonomous drive loop hit RETRY_THRESHOLD, or the user wants to abandon the current attempt and restore the pre-checkpoint state. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding rollback diff --git a/skills/route/SKILL.md b/skills/route/SKILL.md index 2210cbfa..ebe706b0 100644 --- a/skills/route/SKILL.md +++ b/skills/route/SKILL.md @@ -1,5 +1,5 @@ --- -description: Classify a natural-language prompt to one of cladding's verbs. Use when the user describes work in their own words and you want to see which built-in verb cladding's intent classifier would pick — primarily a debugging tool for the orchestrator persona and for verifying the router's coverage after adding new verbs. +description: Classify a natural-language prompt to one of cladding's verbs. Use when the user describes work in their own words and you want to see which built-in verb cladding's intent classifier would pick — primarily a debugging tool for the orchestrator persona and for verifying the router's coverage after adding new verbs. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding route diff --git a/skills/run/SKILL.md b/skills/run/SKILL.md index 7c4cdb5b..28684de2 100644 --- a/skills/run/SKILL.md +++ b/skills/run/SKILL.md @@ -1,5 +1,5 @@ --- -description: Run cladding's autonomous loop — iterate ready features, dispatch the developer + reviewer personas through the active host adapter, run L1 gates, halt on HUMAN_REQUIRED or transport failure. Use only when the user explicitly asks for autonomous progress; the loop will modify files. +description: Run cladding's autonomous loop — iterate ready features, dispatch the developer + reviewer personas through the active host adapter, run L1 gates, halt on HUMAN_REQUIRED or transport failure. Use only when the user explicitly asks for autonomous progress; the loop will modify files. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding run (formerly `drive`) diff --git a/skills/serve/SKILL.md b/skills/serve/SKILL.md index 7f7a2677..09450402 100644 --- a/skills/serve/SKILL.md +++ b/skills/serve/SKILL.md @@ -1,5 +1,5 @@ --- -description: Boot cladding as an MCP server over stdio. Use only when the user wants to expose cladding's tools, resources, and persona prompts to a separate MCP client. Most users don't run this directly — the plugin's .mcp.json launches it automatically. +description: Boot cladding as an MCP server over stdio. Use only when the user wants to expose cladding's tools, resources, and persona prompts to a separate MCP client. Most users don't run this directly — the plugin's .mcp.json launches it automatically. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding serve diff --git a/skills/status/SKILL.md b/skills/status/SKILL.md index 94bd0f20..3544f4e5 100644 --- a/skills/status/SKILL.md +++ b/skills/status/SKILL.md @@ -1,5 +1,5 @@ --- -description: Render the feature × stage integrity matrix — every feature vs every Iron Law stage with pass/skip/fail markers. Use when the user wants a project-wide status board, a release-readiness view, or to spot which features are still behind which stage. +description: Render the feature × stage integrity matrix — every feature vs every Iron Law stage with pass/skip/fail markers. Use when the user wants a project-wide status board, a release-readiness view, or to spot which features are still behind which stage. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding status (formerly `panel`) diff --git a/skills/sync/SKILL.md b/skills/sync/SKILL.md index 6dacb4e7..963f625d 100644 --- a/skills/sync/SKILL.md +++ b/skills/sync/SKILL.md @@ -1,5 +1,5 @@ --- -description: Validate the active spec.yaml against the Ironclad schema and refresh the inventory. Rarely needed manually — clad_create_feature already auto-syncs the inventory and clad check / clad done self-validate the spec, so do NOT run it as a reflexive pre-flight before those. Use it only after you have directly hand-edited a shard file (spec/features/*.yaml or spec.yaml). +description: Validate the active spec.yaml against the Ironclad schema and refresh the inventory. Rarely needed manually — clad_create_feature already auto-syncs the inventory and clad check / clad done self-validate the spec, so do NOT run it as a reflexive pre-flight before those. Use it only after you have directly hand-edited a shard file (spec/features/*.yaml or spec.yaml). Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding sync diff --git a/spec.yaml b/spec.yaml index 09fd4e18..c2e58494 100644 --- a/spec.yaml +++ b/spec.yaml @@ -57,4 +57,4 @@ inventory: features: 255 scenarios: 2 capabilities: 6 - test_files: 235 + test_files: 236 diff --git a/spec/features/natural-language-init-0f4dd6.yaml b/spec/features/natural-language-init-0f4dd6.yaml index 38e661a3..41950559 100644 --- a/spec/features/natural-language-init-0f4dd6.yaml +++ b/spec/features/natural-language-init-0f4dd6.yaml @@ -10,6 +10,13 @@ modules: - src/cli/hook.ts - src/ui/softShell.ts - src/init/host-setup.ts + - src/init/agents-md.ts + - src/init/host-instructions.ts + - src/spec/new.ts + - src/spec/schema.json + - src/spec/types.ts + - src/cli/done.ts + - src/events/log.ts - README.md - docs/glossary.md depends_on: [F-56abaa, F-5f6b45, F-80d19d] @@ -89,3 +96,67 @@ acceptance_criteria: All supported MCP hosts can call tools, but they do not expose a common cryptographic user-consent primitive. ## Trade-off The host instruction and verbatim confirmation field provide the strongest portable boundary; a malicious host could still fabricate consent, so this is not presented as a sandbox guarantee. + - id: AC-010 + ears: unwanted + condition: if the apply request does not carry the exact one-time approval challenge shown in the read-only preview + action: reject initialization without writing project artifacts + response: questions, acknowledgements, and model-invented confirmations cannot be mistaken for user consent + text: If the apply request does not carry the exact one-time approval challenge shown in the read-only preview, the system shall reject initialization without writing project artifacts, so questions, acknowledgements, and model-invented confirmations cannot be mistaken for user consent. + test_refs: [tests/serve/init-tools.test.ts] + notes: | + ## Decision + Use a short preview-bound approval challenge rather than attempting to classify arbitrary affirmative prose across languages. + ## Why + MCP has no portable proof of which user turn produced an argument; exact challenge matching is the strongest host-neutral check available and makes accidental application materially harder. + ## Trade-off + Initialization is a one-time destructive boundary, so one explicit copy/confirm step is preferred over a lower-friction but ambiguous yes/no classifier. + - id: AC-011 + ears: event + condition: when the supplied idea, planning document, and observed project already resolve the important product decisions + action: emit no follow-up questions + response: complete inputs can move directly into development while incomplete inputs receive at most three material product questions + text: When the supplied idea, planning document, and observed project already resolve the important product decisions, the system shall emit no follow-up questions, so complete inputs can move directly into development while incomplete inputs receive at most three material product questions. + test_refs: [tests/serve/init-tools.test.ts, tests/cli/intent-onboarding.test.ts] + - id: AC-012 + ears: event + condition: when a planning document and existing source code are both present + action: combine the complete project-local document with an observed code scan in one onboarding preparation + response: hybrid projects do not have to discard either declared intent or sparse implementation evidence + text: When a planning document and existing source code are both present, the system shall combine the complete project-local document with an observed code scan in one onboarding preparation, so hybrid projects do not have to discard either declared intent or sparse implementation evidence. + test_refs: [tests/serve/init-tools.test.ts] + - id: AC-013 + ears: event + condition: when a follow-up answer refines untouched Cladding-generated onboarding artifacts + action: update those artifacts atomically and keep onboarding active until every answer is represented in the active design + response: onboarding cannot report completion while the accepted answer exists only in a review proposal + text: When a follow-up answer refines untouched Cladding-generated onboarding artifacts, the system shall update those artifacts atomically and keep onboarding active until every answer is represented in the active design, so onboarding cannot report completion while the accepted answer exists only in a review proposal. + test_refs: [tests/serve/init-tools.test.ts, tests/cli/clarify.test.ts] + - id: AC-014 + ears: unwanted + condition: if an onboarding artifact changed after the read-only preparation or a write fails while applying the draft + action: leave every authored project file at its pre-apply content and return a stale or failed result + response: initialization and clarification never leave a partially applied design + text: If an onboarding artifact changed after the read-only preparation or a write fails while applying the draft, the system shall leave every authored project file at its pre-apply content and return a stale or failed result, so initialization and clarification never leave a partially applied design. + test_refs: [tests/serve/init-tools.test.ts] + - id: AC-015 + ears: event + condition: when onboarding completes + action: report that ordinary natural-language development may continue, distinguish on-demand checks from opt-in hook or CI enforcement, and require each material feature to resolve its design impact before done + response: the handoff is truthful and Tier-B design grows selectively with the project + text: When onboarding completes, the system shall report that ordinary natural-language development may continue, distinguish on-demand checks from opt-in hook or CI enforcement, and require each material feature to resolve its design impact before done, so the handoff is truthful and Tier-B design grows selectively with the project. + test_refs: [tests/serve/server.test.ts, tests/cli/done.test.ts] + evidence_refs: [README.md, src/init/agents-md.ts, src/serve/server.ts] + - id: AC-016 + ears: event + condition: when a host restarts its MCP server between the read-only preview and the user's separate approval reply + action: validate a restart-safe approval envelope against the current workspace snapshot + response: headless and process-per-turn hosts can apply the approved preview while stale or replayed envelopes remain non-destructive + text: When a host restarts its MCP server between the read-only preview and the user's separate approval reply, the system shall validate a restart-safe approval envelope against the current workspace snapshot, so headless and process-per-turn hosts can apply the approved preview while stale or replayed envelopes remain non-destructive. + test_refs: [tests/serve/init-tools.test.ts] + - id: AC-017 + ears: state + condition: while the connected project has no spec.yaml and the user has not explicitly named Cladding + action: keep every non-init Cladding skill ineligible for ordinary development requests + response: globally installed integrations do not route unrelated work through Cladding personas + text: While the connected project has no spec.yaml and the user has not explicitly named Cladding, the system shall keep every non-init Cladding skill ineligible for ordinary development requests, so globally installed integrations do not route unrelated work through Cladding personas. + test_refs: [tests/init/skill-activation.test.ts] diff --git a/spec/index.yaml b/spec/index.yaml index 38cc2f0f..fd56bb21 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -94,7 +94,7 @@ features: F-0e84628e: {slug: merge-ritual-docs, status: done, modules: 2} F-0ed2db: {slug: ai-hints-consumer-instructions, status: done, modules: 11} F-0f2984d0: {slug: infer-deps-dynamic-flag, status: done, modules: 2} - F-0f4dd6: {slug: natural-language-init, status: in_progress, modules: 9} + F-0f4dd6: {slug: natural-language-init, status: in_progress, modules: 16} F-10cc42d1: {slug: git-op-write-guard, status: done, modules: 5} F-12d740: {slug: atomic-ac-evidence-fanout, status: done, modules: 1} F-15999130: {slug: inferable-depends-on-detector, status: done, modules: 2} diff --git a/src/agents/blind-author.md b/src/agents/blind-author.md index dac74eea..8b0eacab 100644 --- a/src/agents/blind-author.md +++ b/src/agents/blind-author.md @@ -1,6 +1,6 @@ --- name: blind-author -description: Impl-blind test/oracle author — writes conformance tests from a spec-only brief. Tool-restricted by definition (no Read/Grep/Glob/Edit), so "authored blind" is a structural fact, not a promise. +description: Impl-blind test/oracle author — writes conformance tests from a spec-only brief. Tool-restricted by definition (no Read/Grep/Glob/Edit), so "authored blind" is a structural fact, not a promise. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Write, Bash capabilities: [write, exec] --- diff --git a/src/agents/developer.md b/src/agents/developer.md index 6d1c2835..7393b7cf 100644 --- a/src/agents/developer.md +++ b/src/agents/developer.md @@ -1,6 +1,6 @@ --- name: developer -description: Implementer — writes production code, tests, and migrations. The "generic engineer" fallback when no narrower specialist exists. +description: Implementer — writes production code, tests, and migrations. The "generic engineer" fallback when no narrower specialist exists. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Write, Edit, Bash capabilities: [read, write, edit, exec] --- diff --git a/src/agents/observability.md b/src/agents/observability.md index da1e4251..5beb1a28 100644 --- a/src/agents/observability.md +++ b/src/agents/observability.md @@ -1,6 +1,6 @@ --- name: observability -description: Log and metrics analyst — reads .cladding/audit.log.jsonl, perf/baseline.json, and drift reports; surfaces patterns the human can act on. +description: Log and metrics analyst — reads .cladding/audit.log.jsonl, perf/baseline.json, and drift reports; surfaces patterns the human can act on. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Bash capabilities: [read, exec] --- diff --git a/src/agents/orchestrator.md b/src/agents/orchestrator.md index db1ea39e..073305af 100644 --- a/src/agents/orchestrator.md +++ b/src/agents/orchestrator.md @@ -1,6 +1,6 @@ --- name: orchestrator -description: Workflow conductor — sequences agents based on the 5 invocation principles. Routes user intent to the right persona. +description: Workflow conductor — sequences agents based on the 5 invocation principles. Routes user intent to the right persona. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Write, Edit, Bash, Agent capabilities: [read, write, edit, exec, dispatch] --- @@ -29,7 +29,7 @@ You do NOT pre-load Tier C (conventions — developer's concern). 3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. 4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). 5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. -6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes, and wait for a separate affirmative user reply. The original request is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. ## Feature cycle — one feature at a time diff --git a/src/agents/planner.md b/src/agents/planner.md index b2f7ed45..7967b1e1 100644 --- a/src/agents/planner.md +++ b/src/agents/planner.md @@ -1,6 +1,6 @@ --- name: planner -description: SSoT custodian — keeps spec.yaml structurally clean. Adds features, archives them, and ensures EARS pattern compliance. +description: SSoT custodian — keeps spec.yaml structurally clean. Adds features, archives them, and ensures EARS pattern compliance. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Write, Edit, Bash capabilities: [read, write, edit, exec] --- diff --git a/src/agents/reviewer.md b/src/agents/reviewer.md index 99246fc8..837d92e0 100644 --- a/src/agents/reviewer.md +++ b/src/agents/reviewer.md @@ -1,6 +1,6 @@ --- name: reviewer -description: Philosophical guardrails enforcer — independently audits code, tests, and spec for layered-integrity, Why>What, error-as-data, and the related Ironclad philosophical invariants. +description: Philosophical guardrails enforcer — independently audits code, tests, and spec for layered-integrity, Why>What, error-as-data, and the related Ironclad philosophical invariants. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. tools: Read, Bash capabilities: [read, exec] --- diff --git a/src/cli/clad.ts b/src/cli/clad.ts index fae6521e..fbe5b4ab 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -24,7 +24,7 @@ import {runHookCommand} from './hook.js'; import {runVerdictCommand} from './verdict.js'; import {runUpdate} from './update.js'; import {runInit} from './init.js'; -import {refineOnboarding, runClarifyCommand} from './clarify.js'; +import {refineOnboarding, resolveOnboardingReview, runClarifyCommand} from './clarify.js'; import {prepareHostClarify, prepareHostInit, renderHostDraft} from './host-onboarding.js'; import {getCurrentCladdingVersion, runHostSetup} from '../init/host-setup.js'; import {recordEvent} from '../events/log.js'; @@ -89,6 +89,7 @@ export async function runServeCommand(opts: {cwd?: string}): Promise { initialize: runInit, prepareClarify: (answer, {cwd}) => prepareHostClarify(cwd, answer), clarify: refineOnboarding, + resolveReview: (targets, {cwd}) => resolveOnboardingReview(targets, {cwd}), }, }); // v0.2.26 (F-075): register the server in the sampling context so diff --git a/src/cli/clarify.ts b/src/cli/clarify.ts index 5cb19f96..71e522c6 100644 --- a/src/cli/clarify.ts +++ b/src/cli/clarify.ts @@ -18,13 +18,15 @@ // The handler never throws — telemetry under `phase: 'onboarding'` // captures every fallback path so `clad doctor` surfaces the gap. -import {existsSync, mkdirSync, readFileSync, writeFileSync} from 'node:fs'; +import {existsSync, mkdirSync, readFileSync, rmSync, writeFileSync} from 'node:fs'; import {basename, dirname, join, resolve} from 'node:path'; import process from 'node:process'; import {selectDispatcher} from './scan/dispatcher.js'; import { appendNewQuestions, + artifactsAreUntouched, + captureArtifactDigests, firstPendingIndex, isComplete, loadState, @@ -62,6 +64,7 @@ export interface RefineReport { readonly status: OnboardingState['status']; readonly nextQuestion: string | null; readonly remainingQuestions: number; + readonly pendingReview?: readonly string[]; } /** Process-independent result used by both the CLI and MCP boundaries. */ @@ -76,6 +79,14 @@ export interface RefineOutcome { readonly proposals: readonly string[]; } +export interface ResolveOnboardingReviewOutcome { + readonly ok: boolean; + readonly changed: boolean; + readonly status?: OnboardingState['status']; + readonly remaining?: readonly string[]; + readonly error?: string; +} + /** Applies one onboarding answer without writing to stdout or exiting. */ export async function refineOnboarding( answer: string, @@ -158,23 +169,48 @@ export async function refineOnboarding( const proposals: string[] = []; const created: string[] = []; - writeArtifact(cwd, 'docs/project-context.md', refined.projectContextMd, created, proposals); - writeArtifact(cwd, 'spec/architecture.yaml', refined.architectureYaml, created, proposals); - writeArtifact(cwd, 'spec/capabilities.yaml', refined.capabilitiesYaml, created, proposals); - for (const scenario of refined.scenarios) { - const hash = scenario.id.replace(/^S-/, ''); - writeArtifact( - cwd, - `spec/scenarios/${scenario.slug}-${hash}.yaml`, - renderScenarioYaml(scenario), - created, - proposals, - ); - } + const applyToActiveDesign = artifactsAreUntouched(cwd, state); + const scenarioPaths = refined.scenarios.map((scenario) => + `spec/scenarios/${scenario.slug}-${scenario.id.replace(/^S-/, '')}.yaml`); + const writePaths = [ + 'docs/project-context.md', 'spec/architecture.yaml', 'spec/capabilities.yaml', + ...scenarioPaths, + '.cladding/onboarding/state.yaml', + ...(!applyToActiveDesign + ? ['project-context.md', 'architecture.yaml', 'capabilities.yaml', ...scenarioPaths.map((path) => basename(path))] + .map((name) => `.cladding/scan/${name}.proposal`) + : []), + ]; + const rollback = captureFiles(cwd, writePaths); + let updated: OnboardingState; + try { + writeArtifact(cwd, 'docs/project-context.md', refined.projectContextMd, created, proposals, applyToActiveDesign); + writeArtifact(cwd, 'spec/architecture.yaml', refined.architectureYaml, created, proposals, applyToActiveDesign); + writeArtifact(cwd, 'spec/capabilities.yaml', refined.capabilitiesYaml, created, proposals, applyToActiveDesign); + refined.scenarios.forEach((scenario, index) => { + writeArtifact(cwd, scenarioPaths[index], renderScenarioYaml(scenario), created, proposals, applyToActiveDesign); + }); - let updated = appendNewQuestions(stateAfterAnswer, refined.clarifyingQuestions); - if (refined.clarifyingQuestions.length === 0 && isComplete(updated)) updated = markDone(updated); - saveState(cwd, updated); + updated = appendNewQuestions(stateAfterAnswer, refined.clarifyingQuestions); + if (applyToActiveDesign) { + updated = {...updated, artifactDigests: captureArtifactDigests(cwd)}; + if (refined.clarifyingQuestions.length === 0 && isComplete(updated)) updated = markDone(updated); + } else { + updated = { + ...updated, + status: 'needs_review', + pendingReview: ['docs/project-context.md', 'spec/architecture.yaml', 'spec/capabilities.yaml', ...scenarioPaths], + }; + } + saveState(cwd, updated); + } catch (error) { + restoreFiles(cwd, writePaths, rollback); + return { + ok: false, code: 1, + error: `onboarding refinement failed; active design was restored: ${(error as Error).message}`, + created: [], proposals: [], + }; + } const answeredQa = stateAfterAnswer.qa[pendingIdx]; return { ok: true, @@ -192,6 +228,85 @@ export async function refineOnboarding( }; } +/** Applies explicitly reviewed proposal bodies and re-enters or completes onboarding. */ +export function resolveOnboardingReview( + targets: readonly string[], + opts: {readonly cwd?: string} = {}, +): ResolveOnboardingReviewOutcome { + const cwd = opts.cwd ?? '.'; + const state = loadState(cwd); + if (!state || state.status !== 'needs_review' || !state.pendingReview?.length) { + return {ok: false, changed: false, error: 'no onboarding design review is pending'}; + } + const requested = [...new Set(targets)]; + if (requested.length === 0 || requested.some((target) => !state.pendingReview!.includes(target))) { + return {ok: false, changed: false, error: 'targets must be selected from the pending onboarding review'}; + } + if (requested.some((target) => !isOnboardingReviewTarget(target))) { + return {ok: false, changed: false, error: 'review targets must be Cladding onboarding design artifacts'}; + } + const pairs = requested.map((target) => ({ + target, + proposal: `.cladding/scan/${basename(target)}.proposal`, + })); + const missing = pairs.filter(({proposal}) => !existsSync(join(cwd, proposal))).map(({target}) => target); + if (missing.length > 0) { + return {ok: false, changed: false, error: `proposal missing for: ${missing.join(', ')}`}; + } + const statePath = '.cladding/onboarding/state.yaml'; + const paths = [statePath, ...pairs.flatMap(({target, proposal}) => [target, proposal])]; + const rollback = captureFiles(cwd, paths); + try { + for (const {target, proposal} of pairs) { + mkdirSync(dirname(join(cwd, target)), {recursive: true}); + writeFileSync(join(cwd, target), readFileSync(join(cwd, proposal))); + rmSync(join(cwd, proposal), {force: true}); + } + const remaining = state.pendingReview.filter((target) => !requested.includes(target)); + let updated: OnboardingState = { + ...state, + status: remaining.length > 0 ? 'needs_review' : firstPendingIndex(state) >= 0 ? 'active' : 'done', + pendingReview: remaining.length > 0 ? remaining : undefined, + }; + updated = {...updated, artifactDigests: captureArtifactDigests(cwd)}; + saveState(cwd, updated); + return {ok: true, changed: true, status: updated.status, remaining}; + } catch (error) { + restoreFiles(cwd, paths, rollback); + return {ok: false, changed: false, error: `review apply failed; files were restored: ${(error as Error).message}`}; + } +} + +function isOnboardingReviewTarget(target: string): boolean { + return target === 'docs/project-context.md' || + target === 'spec/architecture.yaml' || + target === 'spec/capabilities.yaml' || + /^spec\/scenarios\/[a-z0-9][a-z0-9-]*-[a-f0-9]{6}\.yaml$/.test(target); +} + +function captureFiles(cwd: string, relativePaths: readonly string[]): ReadonlyMap { + return new Map(relativePaths.map((relativePath) => { + const path = join(cwd, relativePath); + return [relativePath, existsSync(path) ? readFileSync(path) : null] as const; + })); +} + +function restoreFiles( + cwd: string, + relativePaths: readonly string[], + snapshot: ReadonlyMap, +): void { + for (const relativePath of relativePaths) { + const path = join(cwd, relativePath); + const body = snapshot.get(relativePath); + if (body === null || body === undefined) rmSync(path, {force: true}); + else { + mkdirSync(dirname(path), {recursive: true}); + writeFileSync(path, body); + } + } +} + /** * Handler for `clad clarify [answer...]`. The positional argument is * joined with spaces so users can pass natural-language answers in any @@ -258,6 +373,7 @@ function buildReport( status: state.status, nextQuestion: state.qa.find((qa) => qa.answer === null)?.question ?? null, remainingQuestions: state.qa.filter((qa) => qa.answer === null).length, + pendingReview: state.pendingReview, }; } @@ -281,9 +397,15 @@ function writeArtifact( body: string, created: string[], proposals: string[], + overwriteGenerated = false, ): void { const target = join(cwd, relPath); if (existsSync(target)) { + if (overwriteGenerated) { + writeFileSync(target, body); + created.push(`${relPath} (refined)`); + return; + } const proposal = join(cwd, '.cladding', 'scan', `${basename(relPath)}.proposal`); mkdirSync(dirname(proposal), {recursive: true}); writeFileSync(proposal, body); diff --git a/src/cli/done.ts b/src/cli/done.ts index 9fae4615..9ea18a65 100644 --- a/src/cli/done.ts +++ b/src/cli/done.ts @@ -66,6 +66,7 @@ interface ShardHit { readonly status: string; /** The feature's declared `modules[]` — forwarded to scope the gate. */ readonly modules: readonly string[]; + readonly designImpactStatus?: string; } /** @@ -85,12 +86,17 @@ export function findShardFile(cwd: string, featureId: string): ShardHit | null { } catch { continue; } - const rec = doc as {id?: unknown; status?: unknown; modules?: unknown}; + const rec = doc as {id?: unknown; status?: unknown; modules?: unknown; design_impact?: {status?: unknown}}; if (rec && rec.id === featureId) { const modules = Array.isArray(rec.modules) ? rec.modules.filter((m): m is string => typeof m === 'string') : []; - return {path, status: typeof rec.status === 'string' ? rec.status : '', modules}; + return { + path, + status: typeof rec.status === 'string' ? rec.status : '', + modules, + designImpactStatus: typeof rec.design_impact?.status === 'string' ? rec.design_impact.status : undefined, + }; } } return null; @@ -143,6 +149,16 @@ export function runDone(cwd: string, featureId: string, deps: DoneDeps): DoneRes ' (inline features: edit spec.yaml then run `clad check --tier=pre-push --strict` manually)', }; } + if (hit.designImpactStatus === 'review_required') { + return { + ok: false, + code: 1, + featureId, + reason: + 'structural design impact still needs review — apply the listed architecture, capability, or project-context changes, ' + + 'then resolve the design impact before marking this feature done.', + }; + } const original = readFileSync(hit.path, 'utf8'); // Flip to done BEFORE gating so the done-aware detectors evaluate this // feature's test evidence (see module header). diff --git a/src/cli/host-onboarding.ts b/src/cli/host-onboarding.ts index 59c20451..dbf3e692 100644 --- a/src/cli/host-onboarding.ts +++ b/src/cli/host-onboarding.ts @@ -25,7 +25,6 @@ export interface HostOnboardingDraft { readonly architecture: { readonly layers: ReadonlyArray<{readonly name: string; readonly forbidden_imports: readonly string[]}>; }; - readonly first_feature_title: string; readonly scenarios: ReadonlyArray<{ readonly slug: string; readonly title: string; @@ -67,7 +66,9 @@ export function prepareHostInit(cwd: string, mode: string, intent: string): Host 'Draft Cladding onboarding data from the user request and observations below.', 'Return one object matching the supplied MCP draft schema; do not edit files or run shell commands.', 'Use the user language. Infer useful domain practices, but keep questions at product/business level.', - 'Produce 3-8 capabilities, 1-3 user-journey scenarios, and 2-3 questions.', + 'Produce 3-8 capabilities and 1-3 user-journey scenarios.', + 'Ask 0-3 product questions only for material decisions that the intent and observations do not already resolve.', + 'A complete planning document must produce zero questions; record deferrable uncertainty in the draft instead of blocking development.', 'Architecture layers must be lean and use kebab-case capability/scenario identifiers.', '', `Starting mode: ${mode}`, @@ -126,7 +127,7 @@ export function renderHostDraft(draft: HostOnboardingDraft): string { '=== PROJECT_CONTEXT_MD ===', context, '=== CAPABILITIES_YAML ===', capabilities, '=== ARCHITECTURE_YAML ===', architecture, - '=== SPEC_SEED_TITLE ===', draft.first_feature_title, + '=== SPEC_SEED_TITLE ===', draft.project_context.purpose, '=== SCENARIOS_YAML ===', scenarios, '=== PROJECT_METADATA ===', metadata, '=== CLARIFYING_QUESTIONS ===', ...draft.questions.map((question) => `- ${question}`), diff --git a/src/cli/init.ts b/src/cli/init.ts index 6cdd2e9c..bc5a3fc2 100644 --- a/src/cli/init.ts +++ b/src/cli/init.ts @@ -33,7 +33,7 @@ import { type OnboardingResult, } from './scan/intent-onboarding.js'; import type {ScanLlmDispatcher} from './scan/llm.js'; -import {saveState, type OnboardingState} from './scan/onboarding-state.js'; +import {captureArtifactDigests, loadState, saveState, type OnboardingState} from './scan/onboarding-state.js'; import {detectToolchain} from '../stages/toolchain/detect.js'; import {writeClaudeMdSection} from '../init/host-instructions.js'; import {writeSpecDrivenAgentsMd} from '../init/agents-md.js'; @@ -672,6 +672,14 @@ export async function runInit(opts: InitOptions = {}): Promise { } } + // The Q&A loop may overwrite only byte-identical Cladding-generated design. + // Capture after every initial artifact has landed so later user edits are + // diverted for review rather than silently replaced. + if (onboarding) { + const state = loadState(cwd); + if (state) saveState(cwd, {...state, artifactDigests: captureArtifactDigests(cwd)}); + } + return { created, skipped, diff --git a/src/cli/scan/intent-onboarding.ts b/src/cli/scan/intent-onboarding.ts index 2b7fd253..1d654aa5 100644 --- a/src/cli/scan/intent-onboarding.ts +++ b/src/cli/scan/intent-onboarding.ts @@ -105,7 +105,7 @@ export interface OnboardingResult { readonly architectureYaml: string; /** Suggested title for the placeholder F-001 in `spec.yaml`. */ readonly specSeedTitle: string; - /** 2-3 product/business-level questions the orchestrator can ask next. */ + /** 0-3 unresolved product/business-level questions the orchestrator can ask next. */ readonly clarifyingQuestions: readonly string[]; /** * 1-3 user-journey scenarios extracted by the LLM from the intent @@ -263,9 +263,10 @@ export function buildOnboardingPrompt( '- Leave the block EMPTY (no keys) if the intent is too vague to infer anything useful.', '', '=== CLARIFYING_QUESTIONS ===', - '2-3 PRODUCT/BUSINESS-level questions to ask the user next, one per', + '0-3 PRODUCT/BUSINESS-level questions to ask the user next, one per', 'line. RULES (mandatory):', - '- Ask GOAL / AUDIENCE / SCOPE questions, not implementation choices.', + '- Ask only about material GOAL / AUDIENCE / SCOPE gaps, not implementation choices.', + '- If the supplied intent already resolves the important decisions, emit no questions.', '- Match vocabulary to what the user used in their intent.', ' - Casual intent ("결제 SaaS", "쇼핑몰") → plain-language questions.', ' - Technical intent ("PCI-DSS gateway") → deeper questions OK.', diff --git a/src/cli/scan/onboarding-state.ts b/src/cli/scan/onboarding-state.ts index dfa768ca..95837642 100644 --- a/src/cli/scan/onboarding-state.ts +++ b/src/cli/scan/onboarding-state.ts @@ -13,7 +13,8 @@ // during the onboarding window; once `qa[].every(answered)` AND no new // questions emerge, the file is marked `status: done` (kept as audit). -import {existsSync, mkdirSync, readFileSync, writeFileSync} from 'node:fs'; +import {createHash} from 'node:crypto'; +import {existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync} from 'node:fs'; import {dirname, join} from 'node:path'; import yaml from 'yaml'; @@ -46,9 +47,13 @@ export interface OnboardingState { * LLM emits no further questions AND every existing question has an * answer. The file stays on disk after `done` as an audit log. */ - readonly status: 'active' | 'done'; + readonly status: 'active' | 'needs_review' | 'done'; /** Q-A history in arrival order; `answer: null` entries are still pending. */ readonly qa: readonly OnboardingQa[]; + /** Digests of the generated design last accepted into the active SSoT. */ + readonly artifactDigests?: Readonly>; + /** Authored targets whose generated refinements await explicit review. */ + readonly pendingReview?: readonly string[]; } function statePath(cwd: string): string { @@ -73,7 +78,7 @@ export function loadState(cwd: string): OnboardingState | null { ? (parsed.mode as OnboardingState['mode']) : 'greenfield', startedAt: String(parsed.startedAt ?? new Date().toISOString()), - status: parsed.status === 'done' ? 'done' : 'active', + status: parsed.status === 'done' ? 'done' : parsed.status === 'needs_review' ? 'needs_review' : 'active', qa: Array.isArray(parsed.qa) ? parsed.qa.map((entry) => ({ question: String((entry as OnboardingQa)?.question ?? ''), @@ -84,6 +89,11 @@ export function loadState(cwd: string): OnboardingState | null { : String((entry as OnboardingQa).answer), })) : [], + artifactDigests: + parsed.artifactDigests && typeof parsed.artifactDigests === 'object' + ? Object.fromEntries(Object.entries(parsed.artifactDigests).map(([path, digest]) => [path, String(digest)])) + : undefined, + pendingReview: Array.isArray(parsed.pendingReview) ? parsed.pendingReview.map(String) : undefined, }; } @@ -156,3 +166,33 @@ export function isComplete(state: OnboardingState): boolean { export function markDone(state: OnboardingState): OnboardingState { return {...state, status: 'done'}; } + +/** Tier-A/B artifacts whose accepted contents must include every onboarding answer. */ +export const ONBOARDING_DESIGN_ARTIFACTS = [ + 'docs/project-context.md', + 'spec/architecture.yaml', + 'spec/capabilities.yaml', +] as const; + +/** Captures byte digests used to distinguish untouched generated design from user edits. */ +export function captureArtifactDigests(cwd: string): Readonly> { + const scenarioDir = join(cwd, 'spec', 'scenarios'); + const scenarios = existsSync(scenarioDir) + ? readdirSync(scenarioDir) + .filter((name) => name.endsWith('.yaml')) + .map((name) => `spec/scenarios/${name}`) + : []; + return Object.fromEntries([...ONBOARDING_DESIGN_ARTIFACTS, ...scenarios].flatMap((relativePath) => { + const path = join(cwd, relativePath); + if (!existsSync(path)) return []; + return [[relativePath, createHash('sha256').update(readFileSync(path)).digest('hex')]]; + })); +} + +/** True only when every previously accepted design artifact is still byte-identical. */ +export function artifactsAreUntouched(cwd: string, state: OnboardingState): boolean { + const expected = state.artifactDigests; + if (!expected || Object.keys(expected).length === 0) return false; + const current = captureArtifactDigests(cwd); + return Object.entries(expected).every(([path, digest]) => current[path] === digest); +} diff --git a/src/events/log.ts b/src/events/log.ts index 51ab3809..07ebce94 100644 --- a/src/events/log.ts +++ b/src/events/log.ts @@ -48,6 +48,7 @@ export type EventType = // (git HEAD sha) added by recordEvent; 23 hand-flipped dones proved the // ledger must say WHO, and the attestation/engagement work needs WHEN. | 'feature_created' // payload: feature, slug + | 'design_impact_resolved' // payload: feature | 'scenario_created' // payload: scenario, slug | 'done_attempted' // payload: feature, worst, anyFailed, kept | 'gate_run' // payload: tier, strict, worst, anyFailed (deduped per HEAD) diff --git a/src/init/agents-md.ts b/src/init/agents-md.ts index fb917cfd..72f7b213 100644 --- a/src/init/agents-md.ts +++ b/src/init/agents-md.ts @@ -146,6 +146,14 @@ export function renderAgentsMdManagedBlock(spec: Spec | null, cwd: string = '.') '+ `modules`) → implement → author tests in a separate context → `clad done `', '(sets `status: done` only when `clad check --tier=pre-push --strict` is GREEN). Do not', 'author shards ahead of their code, or hand-write `status: done`.', + '', + '## Design evolves with each feature', + '', + 'Before implementation, classify the feature as: no design impact, an additive', + 'capability/scenario link, or a structural change. Apply deterministic links directly;', + 'preview architecture or project-context changes for the user. Do not finish a feature', + 'while a material design impact remains unresolved, and do not churn design documents', + 'for internal fixes that genuinely have no design impact.', renderConventions(spec).replace(/\n$/, ''), '', '## Personas — cross-host capability map (anti-self-cert)', diff --git a/src/init/host-setup.ts b/src/init/host-setup.ts index b25a337e..002f133e 100644 --- a/src/init/host-setup.ts +++ b/src/init/host-setup.ts @@ -519,7 +519,7 @@ export function renderSetupReport( lines.push(' 1. Restart your AI tool (Claude Code / Codex / Gemini / Cursor)'); lines.push(' 2. Open the project directory'); lines.push(' 3. Ask: "Apply Cladding to this project"'); - lines.push(' 4. Start building — cladding checks that spec ↔ code stay in sync on every commit'); + lines.push(' 4. Start building — use optional Git hooks or CI when you want automatic enforcement'); return lines.join('\n'); } diff --git a/src/serve/server.ts b/src/serve/server.ts index 6e3bafcf..7a4b609e 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -20,9 +20,10 @@ import {spawnSync} from 'node:child_process'; import {createHash, randomUUID} from 'node:crypto'; -import {readFileSync, existsSync, realpathSync, readdirSync, statSync} from 'node:fs'; +import {readFileSync, existsSync, mkdirSync, realpathSync, readdirSync, rmSync, statSync, writeFileSync} from 'node:fs'; import {basename, dirname, extname, isAbsolute, join, relative, resolve, sep} from 'node:path'; import {fileURLToPath} from 'node:url'; +import {deflateRawSync, inflateRawSync} from 'node:zlib'; import {McpServer} from '@modelcontextprotocol/sdk/server/mcp.js'; import { @@ -38,7 +39,7 @@ import {renderAuditTable, renderCatalog, renderChangelogMarkdown} from '../chang import {subscribeAudit} from '../hitl/audit.js'; import {loadSpec} from '../spec/load.js'; import type {Spec} from '../spec/types.js'; -import {createFeature, createScenario, linkCapability} from '../spec/new.js'; +import {createFeature, createScenario, linkCapability, linkScenario, resolveDesignImpact} from '../spec/new.js'; import {recordOracle} from '../oracle/record.js'; import {doneFeatureCount, oracleRequired, resolveOraclePolicy} from '../oracle/policy.js'; import {maintainDeliverable} from '../spec/deliverable-detect.js'; @@ -76,11 +77,13 @@ export const TOOL_NAMES = [ 'clad_init', 'clad_prepare_clarify', 'clad_clarify', + 'clad_resolve_onboarding_review', 'clad_list_features', 'clad_get_feature', 'clad_run_check', 'clad_get_events', 'clad_create_feature', + 'clad_resolve_design_impact', 'clad_create_scenario', 'clad_link_capability', 'clad_author_oracle', @@ -147,6 +150,10 @@ export interface OnboardingOperations { readonly report?: unknown; readonly source?: 'llm' | 'hybrid' | 'deterministic'; }>; + readonly resolveReview: ( + targets: readonly string[], + opts: {cwd: string}, + ) => {readonly ok: boolean; readonly changed: boolean; readonly status?: string; readonly remaining?: readonly string[]; readonly error?: string}; } /** @@ -363,7 +370,6 @@ const hostDraftSchema = z.object({ surface: z.enum(['feature', 'platform', 'tool', 'infrastructure']), })).min(3).max(8), architecture: z.object({layers: z.array(z.object({name: z.string().min(1), forbidden_imports: z.array(z.string())}))}), - first_feature_title: z.string().min(1), scenarios: z.array(z.object({slug: z.string().min(1), title: z.string().min(1), flow: z.string().min(1)})).min(1).max(3), questions: z.array(z.string().min(1)).max(3), ai_hints: z.record(z.string(), z.unknown()).optional(), @@ -376,6 +382,48 @@ interface PreparedOnboarding { readonly intent: string; readonly answer?: string; readonly refresh?: boolean; + /** Exact preview-bound phrase required at the destructive init boundary. */ + readonly approvalChallenge?: string; + /** Force scan when any source code was observed, including document-led adoption. */ + readonly scan?: boolean; +} + +const MAX_APPROVAL_ENVELOPE_BYTES = 1_000_000; + +/** + * Carries read-only preparation state across host process restarts. + * + * The digest detects truncation/corruption; authorization still comes from the + * separately displayed exact challenge. Workspace freshness makes a consumed + * envelope stale after the first successful write without prepare writing any + * hidden project state. + */ +function encodePreparedOnboarding(request: PreparedOnboarding): string { + const body = deflateRawSync(Buffer.from(JSON.stringify(request))).toString('base64url'); + const digest = createHash('sha256').update(body).digest('hex').slice(0, 24); + return `v1.${digest}.${body}`; +} + +function decodePreparedOnboarding(token: string): PreparedOnboarding | null { + const match = /^v1\.([a-f0-9]{24})\.([A-Za-z0-9_-]+)$/.exec(token); + if (!match) return null; + if (createHash('sha256').update(match[2]).digest('hex').slice(0, 24) !== match[1]) return null; + try { + const value = JSON.parse(inflateRawSync(Buffer.from(match[2], 'base64url'), { + maxOutputLength: MAX_APPROVAL_ENVELOPE_BYTES, + }).toString('utf8')) as PreparedOnboarding; + if ((value.kind !== 'init' && value.kind !== 'clarify') || typeof value.snapshot !== 'string' || typeof value.intent !== 'string') { + return null; + } + return value; + } catch { + return null; + } +} + +/** Returns a short, one-time phrase that is easy for a human to verify and hard to pass accidentally. */ +function approvalChallenge(): string { + return `APPLY CLADDING ${randomUUID().slice(0, 6).toUpperCase()}`; } function workspaceSnapshot(cwd: string): string { @@ -397,6 +445,71 @@ function workspaceSnapshot(cwd: string): string { return hash.digest('hex'); } +/** Binds approval to authored files plus the active onboarding conversation. */ +function onboardingPreparationSnapshot(cwd: string): string { + const hash = createHash('sha256').update(workspaceSnapshot(cwd)); + const statePath = join(cwd, '.cladding', 'onboarding', 'state.yaml'); + hash.update(existsSync(statePath) ? readFileSync(statePath) : Buffer.from('absent')); + return hash.digest('hex'); +} + +const ONBOARDING_WRITE_ROOTS = [ + 'spec.yaml', '.gitignore', 'AGENTS.md', 'CLAUDE.md', + 'docs/conventions.md', 'docs/project-context.md', + 'spec/architecture.yaml', 'spec/capabilities.yaml', 'spec/scenarios', + '.cladding/onboarding', '.cladding/scan', +] as const; + +interface OnboardingRollback { + readonly files: ReadonlyMap; + readonly directories: ReadonlySet; +} + +const FEATURE_TRANSACTION_ROOTS = [ + 'spec/features', 'spec/capabilities.yaml', 'spec/scenarios', + 'spec.yaml', 'spec/index.yaml', '.cladding/events.log.jsonl', +] as const; + +function capturePathRollback(cwd: string, roots: readonly string[]): OnboardingRollback { + const files = new Map(); + const directories = new Set(); + const visit = (relativePath: string): void => { + const path = join(cwd, relativePath); + if (!existsSync(path)) return; + const stat = statSync(path); + if (stat.isFile()) { + files.set(relativePath, readFileSync(path)); + return; + } + if (!stat.isDirectory()) return; + directories.add(relativePath); + for (const name of readdirSync(path)) visit(join(relativePath, name)); + }; + for (const root of roots) visit(root); + return {files, directories}; +} + +function restorePathRollback(cwd: string, roots: readonly string[], rollback: OnboardingRollback): void { + for (const root of roots) rmSync(join(cwd, root), {recursive: true, force: true}); + for (const directory of [...rollback.directories].sort((a, b) => a.length - b.length)) { + mkdirSync(join(cwd, directory), {recursive: true}); + } + for (const [relativePath, body] of rollback.files) { + mkdirSync(dirname(join(cwd, relativePath)), {recursive: true}); + writeFileSync(join(cwd, relativePath), body); + } +} + +/** Captures only paths the MCP onboarding core is allowed to mutate. */ +function captureOnboardingRollback(cwd: string): OnboardingRollback { + return capturePathRollback(cwd, ONBOARDING_WRITE_ROOTS); +} + +/** Restores the bounded onboarding surface after any failed multi-file apply. */ +function restoreOnboardingRollback(cwd: string, rollback: OnboardingRollback): void { + restorePathRollback(cwd, ONBOARDING_WRITE_ROOTS, rollback); +} + function mcpPayload(payload: Record, isError = false): { readonly isError?: boolean; readonly structuredContent: Record; @@ -431,6 +544,7 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp observation: z.record(z.string(), z.unknown()).optional(), question: z.string().optional(), error: z.string().optional(), plannedChanges: z.array(z.string()).optional(), confirmationQuestion: z.string().optional(), requiresSeparateUserConfirmation: z.boolean().optional(), + approvalChallenge: z.string().optional(), }, annotations: {readOnlyHint: true, destructiveHint: false, idempotentHint: true}, }, @@ -450,17 +564,33 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp } if (args.mode === 'existing' && !intent) intent = 'Adopt Cladding into the observed existing project.'; const briefing = onboarding.prepareInit({cwd, mode: args.mode, intent}); - const token = randomUUID(); - prepared.set(token, { - kind: 'init', snapshot: workspaceSnapshot(cwd), mode: args.mode, intent, refresh: args.refresh, - }); + const challenge = approvalChallenge(); + const observedSourceCount = Number(briefing.observation.source_file_count ?? 0); + const request: PreparedOnboarding = { + kind: 'init', snapshot: onboardingPreparationSnapshot(cwd), mode: args.mode, intent, refresh: args.refresh, + approvalChallenge: challenge, + scan: args.mode === 'existing' || observedSourceCount > 0, + }; + const token = encodePreparedOnboarding(request); + prepared.set(token, request); return mcpPayload({ status: 'needs_confirmation', changed: false, schemaVersion: 1, token, prompt: briefing.prompt, request: briefing.request, observation: briefing.observation, plannedChanges: args.refresh - ? ['Create review proposals for refreshed Cladding spec and design artifacts; preserve authored files.'] - : ['Create spec.yaml and spec design files.', 'Create project context and conventions documents.', 'Create Cladding runtime state and managed AI-host instructions.'], - confirmationQuestion: 'Cladding will create the listed project files. Should I proceed with initialization?', + ? [ + 'Preserve authored files and write review proposals under .cladding/scan/.', + 'Propose refreshed docs/project-context.md, spec/architecture.yaml, and spec/capabilities.yaml.', + ] + : [ + '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 a managed AGENTS.md block; preserve an existing unmanaged AGENTS.md.', + 'Create or append the Cladding section in CLAUDE.md.', + ], + confirmationQuestion: `To apply these changes, reply with the exact approval phrase: ${challenge}`, + approvalChallenge: challenge, requiresSeparateUserConfirmation: true, }); }, @@ -474,7 +604,7 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp 'Write Cladding artifacts from the host model draft returned after clad_prepare_init. ' + 'Requires its one-time token; malformed, stale, or replayed requests do not write files.', inputSchema: { - token: z.string().uuid(), + token: z.string().min(1).max(MAX_APPROVAL_ENVELOPE_BYTES), confirmation: z.string().min(1).describe('The user\'s separate confirmation reply, verbatim'), draft: hostDraftSchema, }, @@ -488,19 +618,32 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp annotations: {readOnlyHint: false, destructiveHint: true, idempotentHint: false}, }, async (args) => { - const request = prepared.get(args.token); + const request = prepared.get(args.token) ?? decodePreparedOnboarding(args.token); if (!request || request.kind !== 'init') return mcpPayload({status: 'invalid_token', changed: false}, true); - if (args.confirmation.trim() === request.intent.trim()) { - return mcpPayload({status: 'confirmation_required', changed: false, error: 'A separate user confirmation is required after the preview.'}, true); + if (!request.approvalChallenge || args.confirmation.trim() !== request.approvalChallenge) { + return mcpPayload({ + status: 'confirmation_required', changed: false, + error: 'The exact one-time approval phrase shown in the preview is required.', + }, true); } - if (request.snapshot !== workspaceSnapshot(cwd)) return mcpPayload({status: 'stale_preparation', changed: false}, true); + if (request.snapshot !== onboardingPreparationSnapshot(cwd)) return mcpPayload({status: 'stale_preparation', changed: false}, true); if (!onboarding) return mcpPayload({status: 'unavailable', changed: false}, true); prepared.delete(args.token); const response = onboarding.renderDraft(args.draft); - const init = await onboarding.initialize({ - cwd, intent: request.intent, scan: request.mode === 'existing' ? true : undefined, - hostDispatcher: async () => response, - }); + const rollback = captureOnboardingRollback(cwd); + let init: Awaited>; + try { + init = await onboarding.initialize({ + cwd, intent: request.intent, scan: request.scan ? true : undefined, + hostDispatcher: async () => response, + }); + } catch (error) { + restoreOnboardingRollback(cwd, rollback); + return mcpPayload({ + status: 'failed', changed: false, + error: `Initialization failed; all onboarding files were restored: ${(error as Error).message}`, + }, true); + } const questions = init.clarifyingQuestions ?? []; const payload = { status: questions.length > 0 ? 'needs_answers' : 'initialized', changed: true, @@ -531,8 +674,11 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp if (!onboarding) return mcpPayload({status: 'unavailable', changed: false}, true); const briefing = onboarding.prepareClarify(args.answer, {cwd}); if ('error' in briefing) return mcpPayload({status: 'invalid_state', changed: false, error: briefing.error}, true); - const token = randomUUID(); - prepared.set(token, {kind: 'clarify', snapshot: workspaceSnapshot(cwd), mode: 'idea', intent: briefing.request.intent, answer: args.answer}); + const request: PreparedOnboarding = { + kind: 'clarify', snapshot: onboardingPreparationSnapshot(cwd), mode: 'idea', intent: briefing.request.intent, answer: args.answer, + }; + const token = encodePreparedOnboarding(request); + prepared.set(token, request); return mcpPayload({status: 'needs_host_draft', changed: false, schemaVersion: 1, token, prompt: briefing.prompt, request: briefing.request, observation: briefing.observation}); }, ); @@ -545,21 +691,22 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp 'Apply a host-model refinement after clad_prepare_clarify. Do not invent or alter the user answer.', inputSchema: { answer: z.string().min(1).describe('The user\'s answer, verbatim'), - token: z.string().uuid(), + token: z.string().min(1).max(MAX_APPROVAL_ENVELOPE_BYTES), draft: hostDraftSchema, }, outputSchema: { status: z.string(), changed: z.boolean(), cwd: z.string().optional(), answered: z.unknown().optional(), newQuestions: z.array(z.string()).optional(), mode: z.enum(['greenfield', 'existing-adoption', 'mixed']).nullable().optional(), nextQuestion: z.string().nullable().optional(), remainingQuestions: z.number().optional(), refinementSource: z.string().optional(), + pendingReview: z.array(z.string()).optional(), error: z.string().optional(), }, annotations: {readOnlyHint: false, destructiveHint: true, idempotentHint: false}, }, async (args) => { - const request = prepared.get(args.token); + const request = prepared.get(args.token) ?? decodePreparedOnboarding(args.token); if (!request || request.kind !== 'clarify' || request.answer !== args.answer) return mcpPayload({status: 'invalid_token', changed: false}, true); - if (request.snapshot !== workspaceSnapshot(cwd)) return mcpPayload({status: 'stale_preparation', changed: false}, true); + if (request.snapshot !== onboardingPreparationSnapshot(cwd)) return mcpPayload({status: 'stale_preparation', changed: false}, true); if (!onboarding) return mcpPayload({status: 'unavailable', changed: false}, true); prepared.delete(args.token); const response = onboarding.renderDraft(args.draft); @@ -569,6 +716,30 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp }, ); + server.registerTool( + 'clad_resolve_onboarding_review', + { + title: 'Apply reviewed onboarding design proposals', + description: + 'After showing proposal diffs and receiving explicit user approval, applies only the selected pending proposal targets. ' + + 'Never call this automatically; authored design is preserved until the user reviews it.', + inputSchema: { + targets: z.array(z.string()).min(1).describe('Exact active artifact paths returned in pendingReview.'), + }, + annotations: {readOnlyHint: false, destructiveHint: true, idempotentHint: false}, + }, + async (args) => { + if (!onboarding) return mcpPayload({status: 'unavailable', changed: false}, true); + const result = onboarding.resolveReview(args.targets, {cwd}); + return mcpPayload({ + status: result.status ?? (result.ok ? 'resolved' : 'failed'), + changed: result.changed, + remaining: result.remaining, + error: result.error, + }, !result.ok); + }, + ); + // clad_list_features — list features in the active spec. // v0.3.10 (F-085) — slug_substring + sort options. server.registerTool( @@ -1181,9 +1352,32 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp 'Acceptance criteria authored now (ids auto-assigned AC-001…). Strongly ' + 'preferred over an empty feature — this is what makes the feature governable.', ), + design_impact: z.discriminatedUnion('classification', [ + z.object({ + classification: z.literal('none'), + rationale: z.string().min(1), + }), + z.object({ + classification: z.literal('additive'), + rationale: z.string().min(1), + capability: z.string().regex(/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/), + capability_title: z.string().min(1).optional(), + scenario: z.string().min(1).optional(), + }), + z.object({ + classification: z.literal('structural'), + rationale: z.string().min(1), + artifacts: z.array(z.enum([ + 'spec/architecture.yaml', 'spec/capabilities.yaml', 'docs/project-context.md', + ])).min(1), + }), + ]).describe( + 'Required design-impact decision. Structural changes remain review_required and block clad done until resolved.', + ), }, }, async (args) => { + const rollback = capturePathRollback(cwd, FEATURE_TRANSACTION_ROOTS); try { const result = createFeature({ slug: args.slug, @@ -1191,8 +1385,24 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp status: args.status, modules: args.modules, acceptance_criteria: args.acceptance_criteria, + design_impact: { + classification: args.design_impact.classification, + rationale: args.design_impact.rationale, + artifacts: args.design_impact.classification === 'structural' ? args.design_impact.artifacts : undefined, + }, cwd, }); + if (args.design_impact.classification === 'additive') { + linkCapability({ + capability: args.design_impact.capability, + feature: result.id, + title: args.design_impact.capability_title, + cwd, + }); + if (args.design_impact.scenario) { + linkScenario({scenario: args.design_impact.scenario, feature: result.id, cwd}); + } + } syncInventory(cwd); // Non-mutating firing-path nudge: travels as a `hint` FIELD (keeps the // payload valid JSON), never a silent write to capabilities.yaml. @@ -1200,15 +1410,16 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp schema_version: PAYLOAD_SCHEMA_VERSION, ...result, gate: gateFooter(cwd), - hint: - 'If this feature is user-facing, link it to a capability with clad_link_capability ' + - `(capability: , feature: ${result.id}) so the Tier-B design SSoT grows with ` + - 'development instead of being left an empty seed.', + designImpact: args.design_impact.classification === 'structural' + ? {status: 'review_required', artifacts: args.design_impact.artifacts, + next: 'Preview and apply the listed Tier-B design changes, then call clad_resolve_design_impact.'} + : {status: 'resolved', classification: args.design_impact.classification}, }; return { content: [{type: 'text', text: JSON.stringify(withHint, null, 2)}], }; } catch (err) { + restorePathRollback(cwd, FEATURE_TRANSACTION_ROOTS, rollback); return { isError: true, content: [{type: 'text', text: (err as Error).message}], @@ -1217,6 +1428,32 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp }, ); + server.registerTool( + 'clad_resolve_design_impact', + { + title: 'Resolve a reviewed structural design impact', + description: + 'Marks a feature structural design impact resolved only after the user-approved Tier-B changes have been applied. ' + + 'Do not call this merely to clear the gate; verify every artifact listed in the feature first.', + inputSchema: { + feature: z.string().describe('Feature id whose listed Tier-B design changes are now applied.'), + }, + }, + async (args) => { + try { + const result = resolveDesignImpact({feature: args.feature, cwd}); + syncInventory(cwd); + return {content: [{type: 'text', text: JSON.stringify({ + schema_version: PAYLOAD_SCHEMA_VERSION, + ...result, + gate: gateFooter(cwd), + }, null, 2)}]}; + } catch (error) { + return {isError: true, content: [{type: 'text', text: (error as Error).message}]}; + } + }, + ); + // clad_author_oracle — record a host-authored impl-blind oracle + its // provenance (Phase 2). cladding authors NO LLM call: the host runs // `clad oracle` for the spec-only brief, dispatches a blind sub-agent, then diff --git a/src/spec/new.ts b/src/spec/new.ts index dd5e0473..26bc6b67 100644 --- a/src/spec/new.ts +++ b/src/spec/new.ts @@ -20,7 +20,7 @@ // @see spec/features/F-084.yaml — this feature. import {createHash} from 'node:crypto'; -import {existsSync, mkdirSync, readFileSync, writeFileSync} from 'node:fs'; +import {existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync} from 'node:fs'; import {recordEvent} from '../events/log.js'; import {hostname, userInfo} from 'node:os'; @@ -76,6 +76,12 @@ export interface CreateFeatureOptions { readonly modules?: readonly string[]; /** Acceptance criteria authored at creation. Omitted → `acceptance_criteria: []`. */ readonly acceptance_criteria?: readonly AcceptanceCriterionInput[]; + /** Durable Tier-B impact decision. Required by the public MCP authoring path. */ + readonly design_impact?: { + readonly classification: 'none' | 'additive' | 'structural'; + readonly rationale: string; + readonly artifacts?: readonly string[]; + }; /** Project root. Defaults to `.`. */ readonly cwd?: string; } @@ -91,6 +97,80 @@ export interface CreateFeatureResult { readonly note?: string; } +export interface ResolveDesignImpactResult { + readonly feature: string; + readonly changed: boolean; + readonly path: string; +} + +/** Adds a feature to an existing scenario without changing its authored prose. */ +export function linkScenario(opts: {readonly scenario: string; readonly feature: string; readonly cwd?: string}): string { + const cwd = opts.cwd ?? '.'; + const directory = join(cwd, 'spec', 'scenarios'); + if (!existsSync(directory)) throw new Error(`cladding: unknown scenario '${opts.scenario}'`); + for (const name of readdirSync(directory)) { + if (!name.endsWith('.yaml') && !name.endsWith('.yml')) continue; + const path = join(directory, name); + const body = readFileSync(path, 'utf8'); + const parsed = yaml.parse(body) as {id?: string; slug?: string; features?: string[]}; + if (parsed?.id !== opts.scenario && parsed?.slug !== opts.scenario) continue; + if (parsed.features?.includes(opts.feature)) return path; + let next: string; + if (/^features:\s*\[\]\s*$/m.test(body)) { + next = body.replace(/^features:\s*\[\]\s*$/m, `features:\n - ${opts.feature}`); + } else if (/^features:\s*$/m.test(body)) { + next = body.replace(/^(features:\s*\n(?:\s+-[^\n]*\n)*)/m, `$1 - ${opts.feature}\n`); + } else { + next = `${body.replace(/\n?$/, '\n')}features:\n - ${opts.feature}\n`; + } + writeFileSync(path, next, 'utf8'); + return path; + } + throw new Error(`cladding: unknown scenario '${opts.scenario}'`); +} + +/** Marks a reviewed structural design impact resolved without rewriting the shard. */ +export function resolveDesignImpact(opts: {readonly feature: string; readonly cwd?: string}): ResolveDesignImpactResult { + const cwd = opts.cwd ?? '.'; + const directory = join(cwd, 'spec', 'features'); + if (!existsSync(directory)) throw new Error(`cladding: unknown feature '${opts.feature}'`); + for (const name of readdirSync(directory)) { + if (!name.endsWith('.yaml') && !name.endsWith('.yml')) continue; + const path = join(directory, name); + const body = readFileSync(path, 'utf8'); + const parsed = yaml.parse(body) as {id?: string; design_impact?: { + classification?: string; + status?: string; + artifacts?: string[]; + baseline_digests?: Record; + }}; + if (parsed?.id !== opts.feature) continue; + if (parsed.design_impact?.classification !== 'structural') { + throw new Error('cladding: only a structural design impact requires explicit resolution'); + } + if (parsed.design_impact.status === 'resolved') return {feature: opts.feature, changed: false, path}; + const unchanged = (parsed.design_impact.artifacts ?? []).filter((relativePath) => { + const artifact = join(cwd, relativePath); + const current = existsSync(artifact) + ? createHash('sha256').update(readFileSync(artifact)).digest('hex') + : 'absent'; + return current === parsed.design_impact?.baseline_digests?.[relativePath]; + }); + if (unchanged.length > 0) { + throw new Error(`cladding: design impact is not resolved — unchanged artifact(s): ${unchanged.join(', ')}`); + } + const next = body.replace( + /(design_impact:\n(?:(?: .*\n)*?) status:\s*)review_required\b/, + '$1resolved', + ); + if (next === body) throw new Error('cladding: malformed structural design_impact block'); + writeFileSync(path, next, 'utf8'); + recordEvent(cwd, 'design_impact_resolved', {feature: opts.feature}); + return {feature: opts.feature, changed: true, path}; + } + throw new Error(`cladding: unknown feature '${opts.feature}'`); +} + /** * Creates a new sharded feature file at `spec/features/-.yaml` * where `` is the 6-char hex tail of the auto-generated id. @@ -156,6 +236,18 @@ export function createFeature(opts: CreateFeatureOptions): CreateFeatureResult { // and the PreToolUse hand-flip hook entirely. Downgrade with a visible note. const requestedDone = opts.status === 'done'; const status = requestedDone ? 'in_progress' : (opts.status ?? 'planned'); + const designImpact = opts.design_impact?.classification === 'structural' + ? { + ...opts.design_impact, + baseline_digests: Object.fromEntries((opts.design_impact.artifacts ?? []).map((relativePath) => { + const artifact = join(cwd, relativePath); + const digest = existsSync(artifact) + ? createHash('sha256').update(readFileSync(artifact)).digest('hex') + : 'absent'; + return [relativePath, digest]; + })), + } + : opts.design_impact; const yaml = renderYaml({ id, slug, @@ -163,6 +255,7 @@ export function createFeature(opts: CreateFeatureOptions): CreateFeatureResult { status, modules: opts.modules, acceptance_criteria: opts.acceptance_criteria, + design_impact: designImpact, }); writeFileSync(filePath, yaml, 'utf8'); // F-b84c38 — spec authorship lands in the ledger (best-effort). @@ -201,6 +294,9 @@ function renderYaml(args: { status: string; modules?: readonly string[]; acceptance_criteria?: readonly AcceptanceCriterionInput[]; + design_impact?: CreateFeatureOptions['design_impact'] & { + readonly baseline_digests?: Readonly>; + }; }): string { const lines = [ `id: ${args.id}`, @@ -239,6 +335,22 @@ function renderYaml(args: { }); } + if (args.design_impact) { + lines.push('design_impact:'); + lines.push(` classification: ${args.design_impact.classification}`); + lines.push(` rationale: ${JSON.stringify(args.design_impact.rationale)}`); + lines.push(` status: ${args.design_impact.classification === 'structural' ? 'review_required' : 'resolved'}`); + const artifacts = args.design_impact.artifacts ?? []; + if (artifacts.length === 0) lines.push(' artifacts: []'); + else lines.push(` artifacts: [${artifacts.map((path) => JSON.stringify(path)).join(', ')}]`); + if (args.design_impact.baseline_digests && Object.keys(args.design_impact.baseline_digests).length > 0) { + lines.push(' baseline_digests:'); + for (const [path, digest] of Object.entries(args.design_impact.baseline_digests)) { + lines.push(` ${JSON.stringify(path)}: ${JSON.stringify(digest)}`); + } + } + } + lines.push(''); return lines.join('\n'); } diff --git a/src/spec/schema.json b/src/spec/schema.json index 9a588552..5e6d3559 100644 --- a/src/spec/schema.json +++ b/src/spec/schema.json @@ -194,6 +194,18 @@ "type": "array", "items": {"$ref": "#/definitions/acceptance_criterion"} }, + "design_impact": { + "type": "object", + "required": ["classification", "rationale", "status"], + "additionalProperties": false, + "properties": { + "classification": {"type": "string", "enum": ["none", "additive", "structural"]}, + "rationale": {"type": "string", "minLength": 1}, + "status": {"type": "string", "enum": ["resolved", "review_required"]}, + "artifacts": {"type": "array", "items": {"type": "string"}}, + "baseline_digests": {"type": "object", "additionalProperties": {"type": "string"}} + } + }, "depends_on": { "type": "array", "items": {"type": "string", "pattern": "^F-(\\d{3,}|[a-f0-9]{6,})$"} diff --git a/src/spec/types.ts b/src/spec/types.ts index 11cdf8a3..aea70d90 100644 --- a/src/spec/types.ts +++ b/src/spec/types.ts @@ -94,6 +94,14 @@ export interface Feature { /** File paths this feature touches. */ readonly modules?: readonly string[]; readonly acceptance_criteria?: readonly AcceptanceCriterion[]; + /** Feature-bound decision recording whether Tier-B design must evolve. */ + readonly design_impact?: { + readonly classification: 'none' | 'additive' | 'structural'; + readonly rationale: string; + readonly status: 'resolved' | 'review_required'; + readonly artifacts?: readonly string[]; + readonly baseline_digests?: Readonly>; + }; /** Feature ids this one depends on. */ readonly depends_on?: readonly string[]; readonly archived_at?: string; diff --git a/tests/cli/clad.test.ts b/tests/cli/clad.test.ts index 97a60f6e..2312102d 100644 --- a/tests/cli/clad.test.ts +++ b/tests/cli/clad.test.ts @@ -585,6 +585,7 @@ describe('cli/clad — runServeCommand', () => { initialize: expect.any(Function), prepareClarify: expect.any(Function), clarify: expect.any(Function), + resolveReview: expect.any(Function), }, }); expect(StdioMock).toHaveBeenCalledOnce(); diff --git a/tests/cli/clarify.test.ts b/tests/cli/clarify.test.ts index 8cb771b7..3026b901 100644 --- a/tests/cli/clarify.test.ts +++ b/tests/cli/clarify.test.ts @@ -15,8 +15,8 @@ vi.mock('../../src/cli/scan/dispatcher.js', () => ({ selectDispatcher: vi.fn((opts: {noLlm?: boolean}) => (opts?.noLlm ? null : dispatchMock)), })); -const {runClarifyCommand} = await import('../../src/cli/clarify.js'); -const {saveState, loadState} = await import('../../src/cli/scan/onboarding-state.js'); +const {resolveOnboardingReview, runClarifyCommand} = await import('../../src/cli/clarify.js'); +const {captureArtifactDigests, saveState, loadState} = await import('../../src/cli/scan/onboarding-state.js'); function seedState(cwd: string, qa: Array<{question: string; answer: string | null}>): void { saveState(cwd, { @@ -39,6 +39,7 @@ function seedArtifacts(cwd: string): void { 'schema: "0.1"\nsource: README.md\ncapabilities: []\n', ); writeFileSync(join(cwd, 'spec', 'architecture.yaml'), 'version: "0.1"\nlayers: []\n'); + saveState(cwd, {...loadState(cwd)!, artifactDigests: captureArtifactDigests(cwd)}); } describe('runClarifyCommand', () => { @@ -74,6 +75,18 @@ describe('runClarifyCommand', () => { expect(exitCalls).toEqual([2]); }); + test('review resolution rejects a state-injected path outside onboarding artifacts', () => { + seedState(dir, []); + saveState(dir, { + ...loadState(dir)!, + status: 'needs_review', + pendingReview: ['../escape.yaml'], + }); + const result = resolveOnboardingReview(['../escape.yaml'], {cwd: dir}); + expect(result).toMatchObject({ok: false, changed: false}); + expect(result.error).toMatch(/onboarding design artifacts/); + }); + test('exit 2 when no answer is provided but pending questions exist', async () => { seedState(dir, [{question: 'Q1?', answer: null}]); seedArtifacts(dir); @@ -99,17 +112,12 @@ describe('runClarifyCommand', () => { const after = loadState(dir)!; expect(after.qa[0].answer).toBe('법인 사업자만'); expect(after.qa[1].answer).toBeNull(); - // capabilities + architecture untouched on disk because deterministic - // refinement preserves them — proposal file should not exist - expect(existsSync(join(dir, '.cladding', 'scan', 'capabilities.yaml.proposal'))).toBe(true); - // project-context gets a Q&A footnote appended; the proposal carries - // the new body - const proposal = readFileSync( - join(dir, '.cladding', 'scan', 'project-context.md.proposal'), - 'utf8', - ); - expect(proposal).toContain('Q&A log (refinement, LLM unavailable)'); - expect(proposal).toContain('법인 사업자만'); + // Untouched Cladding-generated design is refined in place so the active + // context—not a detached proposal—contains the accepted answer. + expect(existsSync(join(dir, '.cladding', 'scan', 'capabilities.yaml.proposal'))).toBe(false); + const context = readFileSync(join(dir, 'docs', 'project-context.md'), 'utf8'); + expect(context).toContain('Q&A log (refinement, LLM unavailable)'); + expect(context).toContain('법인 사업자만'); }); test('LLM success refines artifacts, adds new questions, keeps status active', async () => { @@ -146,12 +154,20 @@ describe('runClarifyCommand', () => { // New questions appended (de-duped against existing) expect(after.qa.map((q) => q.question)).toEqual(['Q1?', 'Q2?', 'Q3?', 'Q4?']); expect(after.status).toBe('active'); - // Existing artifacts diverted to proposal - const proposal = readFileSync( - join(dir, '.cladding', 'scan', 'project-context.md.proposal'), - 'utf8', - ); - expect(proposal).toContain('refined context'); + expect(readFileSync(join(dir, 'docs', 'project-context.md'), 'utf8')).toContain('refined context'); + expect(existsSync(join(dir, '.cladding', 'scan', 'project-context.md.proposal'))).toBe(false); + }); + + test('a user-edited design is preserved and onboarding remains in review', async () => { + seedState(dir, [{question: 'Q1?', answer: null}]); + seedArtifacts(dir); + writeFileSync(join(dir, 'docs', 'project-context.md'), '# user-authored context\n'); + + await runClarifyCommand(['A1'], {cwd: dir, noLlm: true}); + + expect(readFileSync(join(dir, 'docs', 'project-context.md'), 'utf8')).toBe('# user-authored context\n'); + expect(existsSync(join(dir, '.cladding', 'scan', 'project-context.md.proposal'))).toBe(true); + expect(loadState(dir)!.status).toBe('needs_review'); }); test('LLM returns no new questions AND every existing question is answered → marks done', async () => { diff --git a/tests/cli/done.test.ts b/tests/cli/done.test.ts index c9d27da4..60430275 100644 --- a/tests/cli/done.test.ts +++ b/tests/cli/done.test.ts @@ -174,6 +174,24 @@ describe('runDone', () => { expect(readFileSync(path, 'utf8')).toContain('status: done'); }); + test('an unresolved structural design impact blocks done before the gate runs', () => { + const body = SHARD_BODY + + 'design_impact:\n' + + ' classification: structural\n' + + ' rationale: "new service boundary"\n' + + ' status: review_required\n' + + ' artifacts: ["spec/architecture.yaml"]\n'; + const path = writeShard(dir, body); + const checkStages = vi.fn(() => ({worst: 0})); + + const result = runDone(dir, FEATURE_ID, {checkStages}); + + expect(result.ok).toBe(false); + expect(result.reason).toContain('design impact still needs review'); + expect(checkStages).not.toHaveBeenCalled(); + expect(readFileSync(path, 'utf8')).toBe(body); + }); + test('RED gate reverts the shard byte-for-byte', () => { const path = writeShard(dir); const original = readFileSync(path, 'utf8'); diff --git a/tests/init/skill-activation.test.ts b/tests/init/skill-activation.test.ts new file mode 100644 index 00000000..572788e5 --- /dev/null +++ b/tests/init/skill-activation.test.ts @@ -0,0 +1,24 @@ +// Cladding · globally installed skill activation boundary (F-0f4dd6 AC-017). + +import {readFileSync, readdirSync} from 'node:fs'; +import {join} from 'node:path'; + +import {describe, expect, test} from 'vitest'; + +const ACTIVATION_GUARD = + 'Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects.'; + +describe('Cladding skill activation boundary', () => { + test('every non-init verb and persona description excludes unrelated uninitialized projects', () => { + const verbFiles = readdirSync('skills') + .filter((name) => name !== 'init') + .map((name) => join('skills', name, 'SKILL.md')); + const personaFiles = readdirSync('src/agents') + .filter((name) => name.endsWith('.md') && name !== 'README.md') + .map((name) => join('src/agents', name)); + + for (const path of [...verbFiles, ...personaFiles]) { + expect(readFileSync(path, 'utf8'), path).toContain(ACTIVATION_GUARD); + } + }); +}); diff --git a/tests/scenarios/existing-adoption-lifecycle.test.ts b/tests/scenarios/existing-adoption-lifecycle.test.ts index 4ca4766d..505caa08 100644 --- a/tests/scenarios/existing-adoption-lifecycle.test.ts +++ b/tests/scenarios/existing-adoption-lifecycle.test.ts @@ -45,7 +45,6 @@ const {mkScenarioCwd, copyFixture, writeUnderCwd, EXISTING_S2_RESPONSE} = await const { assertArtifactsPresent, assertCrossTierClean, - assertProposalDivert, assertSpecCompleteness, assertTierBanner, assertNoBudgetOverages, @@ -141,10 +140,10 @@ describe('existing-adoption lifecycle — "이 프로젝트 분석해서 클래 // No proposal for spec.yaml — refine doesn't write to Tier A directly. expect(existsSync(join(scenario.path, '.cladding/scan/spec.yaml.proposal'))).toBe(false); - // Tier B artifacts diverted to proposal (refine re-wrote them). - assertProposalDivert(scenario.path, 'docs/project-context.md'); - assertProposalDivert(scenario.path, 'spec/capabilities.yaml'); - assertProposalDivert(scenario.path, 'spec/architecture.yaml'); + // Untouched generated Tier B artifacts are the active refined design. + expect(existsSync(join(scenario.path, '.cladding/scan/project-context.md.proposal'))).toBe(false); + expect(existsSync(join(scenario.path, '.cladding/scan/capabilities.yaml.proposal'))).toBe(false); + expect(existsSync(join(scenario.path, '.cladding/scan/architecture.yaml.proposal'))).toBe(false); }); test('S4 simulate new feature: hand-authored shard registers cleanly', async () => { diff --git a/tests/scenarios/greenfield-lifecycle.test.ts b/tests/scenarios/greenfield-lifecycle.test.ts index 9fd66023..709ca0e4 100644 --- a/tests/scenarios/greenfield-lifecycle.test.ts +++ b/tests/scenarios/greenfield-lifecycle.test.ts @@ -15,6 +15,7 @@ import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'; import {fileURLToPath} from 'node:url'; import {dirname, join} from 'node:path'; +import {existsSync} from 'node:fs'; vi.mock('../../src/ui/pulse.js', () => ({pulse: vi.fn()})); const dispatchMock = vi.fn<(p: string) => Promise>(); @@ -104,7 +105,7 @@ describe('greenfield lifecycle — 결제 SaaS for B2B intent', () => { expect(projectContext).toContain('결제'); }); - test('S1 → S2 refine: state advances, proposal divert fires, capabilities grow', async () => { + test('S1 → S2 refine: state advances and untouched generated design grows in place', async () => { dispatchMock.mockResolvedValueOnce(GREENFIELD_S1_RESPONSE); await runInit({cwd: scenario.path, intent: '결제 SaaS for B2B'}); @@ -118,14 +119,14 @@ describe('greenfield lifecycle — 결제 SaaS for B2B intent', () => { ); expect(stateBody).toContain('법인 사업자만'); - // Existing artifacts diverted to proposal (refine touches all four). - assertProposalDivert(scenario.path, 'docs/project-context.md'); - assertProposalDivert(scenario.path, 'spec/capabilities.yaml'); - assertProposalDivert(scenario.path, 'spec/architecture.yaml'); + // Byte-identical generated artifacts update in place; no detached design. + expect(existsSync(join(scenario.path, '.cladding/scan/project-context.md.proposal'))).toBe(false); + expect(existsSync(join(scenario.path, '.cladding/scan/capabilities.yaml.proposal'))).toBe(false); + expect(existsSync(join(scenario.path, '.cladding/scan/architecture.yaml.proposal'))).toBe(false); // Capabilities count grew (4 in S2 response vs 3 in S1). const proposalCapsBody = (await import('node:fs')).readFileSync( - join(scenario.path, '.cladding/scan/capabilities.yaml.proposal'), + join(scenario.path, 'spec/capabilities.yaml'), 'utf8', ); expect(proposalCapsBody).toContain('compliance'); diff --git a/tests/serve/gate-footer-unavailable.test.ts b/tests/serve/gate-footer-unavailable.test.ts index c984f7c7..e6dd905e 100644 --- a/tests/serve/gate-footer-unavailable.test.ts +++ b/tests/serve/gate-footer-unavailable.test.ts @@ -44,7 +44,7 @@ describe('gateFooter — engine fault fails closed, never a fabricated GREEN', ( try { const res = await client.callTool({ name: 'clad_create_feature', - arguments: {slug: 'probe-feature', title: 'Probe'}, + arguments: {slug: 'probe-feature', title: 'Probe', design_impact: {classification: 'none', rationale: 'test-only feature'}}, }); const doc = JSON.parse((res.content as Array<{type: string; text: string}>)[0].text) as { gate: {pass: boolean; unavailable?: boolean; findings: unknown[]; next?: string}; diff --git a/tests/serve/init-tools.test.ts b/tests/serve/init-tools.test.ts index 1e5d78ff..c34f2298 100644 --- a/tests/serve/init-tools.test.ts +++ b/tests/serve/init-tools.test.ts @@ -7,10 +7,10 @@ import {dirname, join} from 'node:path'; import {Client} from '@modelcontextprotocol/sdk/client/index.js'; import {InMemoryTransport} from '@modelcontextprotocol/sdk/inMemory.js'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; -import {refineOnboarding} from '../../src/cli/clarify.js'; +import {refineOnboarding, resolveOnboardingReview} from '../../src/cli/clarify.js'; import {prepareHostClarify, prepareHostInit, renderHostDraft} from '../../src/cli/host-onboarding.js'; import {runInit} from '../../src/cli/init.js'; -import {saveState} from '../../src/cli/scan/onboarding-state.js'; +import {captureArtifactDigests, loadState, saveState} from '../../src/cli/scan/onboarding-state.js'; import {buildServer} from '../../src/serve/server.js'; interface Pair { @@ -18,7 +18,7 @@ interface Pair { readonly cleanup: () => Promise; } -async function makePair(cwd: string): Promise { +async function makePair(cwd: string, initialize: typeof runInit = runInit): Promise { const server = buildServer({ cwd, name: 'cladding-init-test', @@ -26,9 +26,10 @@ async function makePair(cwd: string): Promise { onboarding: { renderDraft: (value) => renderHostDraft(value as Parameters[0]), prepareInit: ({cwd: root, mode, intent}) => prepareHostInit(root, mode, intent), - initialize: runInit, + initialize, prepareClarify: (answer, {cwd: root}) => prepareHostClarify(root, answer), clarify: refineOnboarding, + resolveReview: (targets, {cwd: root}) => resolveOnboardingReview(targets, {cwd: root}), }, }); const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair(); @@ -57,15 +58,13 @@ const draft = { {id: 'webhooks', title: 'Webhooks', summary: 'Deliver signed events.', surface: 'infrastructure'}, ], architecture: {layers: [{name: 'core', forbidden_imports: ['adapters']}]}, - first_feature_title: 'Payment authorization', scenarios: [{slug: 'payment-flow', title: 'Payment flow', flow: 'An operator requests and confirms a payment.'}], questions: ['Which market launches first?'], } as const; -const confirmation = 'Proceed with Cladding initialization.'; - -async function prepare(client: Client, arguments_: Record): Promise { +async function prepare(client: Client, arguments_: Record): Promise<{token: string; confirmation: string}> { const result = await client.callTool({name: 'clad_prepare_init', arguments: arguments_}); - return payload(result).token as string; + const prepared = payload(result); + return {token: prepared.token as string, confirmation: prepared.approvalChallenge as string}; } describe('serve/server — natural-language init tools', () => { @@ -93,7 +92,7 @@ describe('serve/server — natural-language init tools', () => { test('idea mode initializes through the shared engine and writes host instructions after spec', async () => { const {client, cleanup} = await makePair(dir); try { - const token = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + const {token, confirmation} = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); const result = await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft}}); expect(result.isError).not.toBe(true); expect(payload(result)).toMatchObject({ @@ -109,6 +108,26 @@ describe('serve/server — natural-language init tools', () => { } }); + test('approval envelope survives an MCP server restart without prepare writing files', async () => { + const first = await makePair(dir); + const prepared = await prepare(first.client, {mode: 'idea', intent: 'B2B payment SaaS'}); + await first.cleanup(); + expect(readdirSync(dir)).toEqual([]); + + const second = await makePair(dir); + try { + const result = await second.client.callTool({name: 'clad_init', arguments: { + token: prepared.token, + confirmation: prepared.confirmation, + draft, + }}); + expect(result.isError).not.toBe(true); + expect(payload(result)).toMatchObject({changed: true, onboardingSource: 'host'}); + } finally { + await second.cleanup(); + } + }); + test('initial request is not accepted as the separate write confirmation', async () => { const {client, cleanup} = await makePair(dir); try { @@ -128,10 +147,26 @@ describe('serve/server — natural-language init tools', () => { } }); + test('an arbitrary reply after preview is not accepted as approval', async () => { + const {client, cleanup} = await makePair(dir); + try { + const {token} = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + const result = await client.callTool({name: 'clad_init', arguments: { + token, + confirmation: 'Which files will be created?', + draft, + }}); + expect(payload(result)).toMatchObject({status: 'confirmation_required', changed: false}); + expect(existsSync(join(dir, 'spec.yaml'))).toBe(false); + } finally { + await cleanup(); + } + }); + test('a malformed host draft is rejected before any write', async () => { const {client, cleanup} = await makePair(dir); try { - const token = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + const {token, confirmation} = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); const result = await client.callTool({name: 'clad_init', arguments: { token, confirmation, @@ -145,10 +180,30 @@ describe('serve/server — natural-language init tools', () => { } }); + test('a failed multi-file apply restores the pre-initialization workspace', async () => { + writeFileSync(join(dir, '.gitignore'), 'user-entry\n'); + const failingInit = (async ({cwd}: {cwd?: string}) => { + writeFileSync(join(cwd!, 'spec.yaml'), 'partial\n'); + writeFileSync(join(cwd!, '.gitignore'), 'clobbered\n'); + throw new Error('injected write failure'); + }) as typeof runInit; + const {client, cleanup} = await makePair(dir, failingInit); + try { + const {token, confirmation} = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + const result = await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft}}); + expect(result.isError).toBe(true); + expect(payload(result)).toMatchObject({status: 'failed', changed: false}); + expect(existsSync(join(dir, 'spec.yaml'))).toBe(false); + expect(readFileSync(join(dir, '.gitignore'), 'utf8')).toBe('user-entry\n'); + } finally { + await cleanup(); + } + }); + test('tools-only MCP client drives init and clarify without sampling', async () => { const {client, cleanup} = await makePair(dir); try { - const token = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + const {token, confirmation} = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); const initialized = await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft}}); expect(payload(initialized)).toMatchObject({ status: 'needs_answers', @@ -171,8 +226,37 @@ describe('serve/server — natural-language init tools', () => { } }); + test('user-edited onboarding design requires review before accepted proposals complete onboarding', async () => { + const {client, cleanup} = await makePair(dir); + try { + const {token, confirmation} = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft}}); + writeFileSync(join(dir, 'docs', 'project-context.md'), '# User-owned context\n'); + + const prepared = await client.callTool({name: 'clad_prepare_clarify', arguments: {answer: 'Korea'} }); + const clarifyToken = payload(prepared).token as string; + const clarified = await client.callTool({name: 'clad_clarify', arguments: { + answer: 'Korea', token: clarifyToken, draft: {...draft, questions: []}, + }}); + const review = payload(clarified); + expect(review.status).toBe('needs_review'); + expect(readFileSync(join(dir, 'docs', 'project-context.md'), 'utf8')).toBe('# User-owned context\n'); + expect(review.pendingReview).toContain('docs/project-context.md'); + + const resolved = await client.callTool({name: 'clad_resolve_onboarding_review', arguments: { + targets: review.pendingReview, + }}); + expect(payload(resolved)).toMatchObject({status: 'done', changed: true, remaining: []}); + expect(readFileSync(join(dir, 'docs', 'project-context.md'), 'utf8')).toContain('Enable reliable B2B payments.'); + } finally { + await cleanup(); + } + }); + test('document mode loads the full project-local planning document', async () => { mkdirSync(join(dir, 'docs')); + mkdirSync(join(dir, 'src')); + writeFileSync(join(dir, 'src', 'index.ts'), 'export const existing = true;\n'); const plan = Array.from({length: 40}, (_, i) => `Section ${i}: payment requirement`).join('\n'); writeFileSync(join(dir, 'docs', 'plan.md'), plan); const {client, cleanup} = await makePair(dir); @@ -181,9 +265,11 @@ describe('serve/server — natural-language init tools', () => { const preparedPayload = payload(preparation); expect(preparedPayload.prompt).toContain(plan); const token = preparedPayload.token as string; + const confirmation = preparedPayload.approvalChallenge as string; const result = await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft}}); expect(result.isError).not.toBe(true); expect(readFileSync(join(dir, 'docs', 'project-context.md'), 'utf8')).toContain('Enable reliable B2B payments.'); + expect(readFileSync(join(dir, 'docs', 'conventions.md'), 'utf8')).toContain('derived from observed code'); } finally { await cleanup(); } @@ -211,7 +297,7 @@ describe('serve/server — natural-language init tools', () => { writeFileSync(join(dir, 'src', 'index.ts'), 'export const value = 1;\n'); const {client, cleanup} = await makePair(dir); try { - const token = await prepare(client, {mode: 'existing'}); + const {token, confirmation} = await prepare(client, {mode: 'existing'}); const result = await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft: {...draft, mode: 'existing-adoption'}}}); expect(result.isError).not.toBe(true); const conventions = readFileSync(join(dir, 'docs', 'conventions.md'), 'utf8'); @@ -239,18 +325,18 @@ describe('serve/server — natural-language init tools', () => { test('stale and replayed apply tokens never write twice', async () => { const {client, cleanup} = await makePair(dir); try { - const staleToken = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + const {token: staleToken, confirmation: staleConfirmation} = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); writeFileSync(join(dir, 'README.md'), '# changed after prepare\n'); - const stale = await client.callTool({name: 'clad_init', arguments: {token: staleToken, confirmation, draft}}); + const stale = await client.callTool({name: 'clad_init', arguments: {token: staleToken, confirmation: staleConfirmation, draft}}); expect(payload(stale)).toMatchObject({status: 'stale_preparation', changed: false}); expect(existsSync(join(dir, 'spec.yaml'))).toBe(false); - const token = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + const {token, confirmation} = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); const first = await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft}}); expect(payload(first)).toMatchObject({changed: true}); const specBeforeReplay = readFileSync(join(dir, 'spec.yaml'), 'utf8'); const replay = await client.callTool({name: 'clad_init', arguments: {token, confirmation, draft}}); - expect(payload(replay)).toMatchObject({status: 'invalid_token', changed: false}); + expect(payload(replay)).toMatchObject({status: 'stale_preparation', changed: false}); expect(readFileSync(join(dir, 'spec.yaml'), 'utf8')).toBe(specBeforeReplay); } finally { await cleanup(); @@ -275,6 +361,7 @@ describe('serve/server — natural-language init tools', () => { writeFileSync(join(dir, 'docs', 'project-context.md'), '# Context\n'); writeFileSync(join(dir, 'spec', 'capabilities.yaml'), 'schema: "0.1"\ncapabilities: []\n'); writeFileSync(join(dir, 'spec', 'architecture.yaml'), 'version: "0.1"\nlayers: []\n'); + saveState(dir, {...loadState(dir)!, artifactDigests: captureArtifactDigests(dir)}); const {client, cleanup} = await makePair(dir); try { @@ -293,4 +380,37 @@ describe('serve/server — natural-language init tools', () => { await cleanup(); } }); + + test('clarify preparation becomes stale when another session advances onboarding state', async () => { + saveState(dir, { + intent: 'B2B payment SaaS', + language: 'typescript', + projectName: 'demo', + mode: 'greenfield', + startedAt: '2026-07-14T00:00:00.000Z', + status: 'active', + qa: [{question: 'Who is the primary user?', answer: null}], + }); + mkdirSync(join(dir, 'docs'), {recursive: true}); + mkdirSync(join(dir, 'spec'), {recursive: true}); + writeFileSync(join(dir, 'docs', 'project-context.md'), '# Context\n'); + writeFileSync(join(dir, 'spec', 'capabilities.yaml'), 'schema: "0.1"\ncapabilities: []\n'); + writeFileSync(join(dir, 'spec', 'architecture.yaml'), 'version: "0.1"\nlayers: []\n'); + + const {client, cleanup} = await makePair(dir); + try { + const preparation = await client.callTool({ + name: 'clad_prepare_clarify', + arguments: {answer: 'Business operators'}, + }); + const token = payload(preparation).token as string; + saveState(dir, {...loadState(dir)!, qa: [{question: 'Who is the primary user?', answer: 'Another answer'}]}); + const result = await client.callTool({name: 'clad_clarify', arguments: { + answer: 'Business operators', token, draft: {...draft, questions: []}, + }}); + expect(payload(result)).toMatchObject({status: 'stale_preparation', changed: false}); + } finally { + await cleanup(); + } + }); }); diff --git a/tests/serve/server.test.ts b/tests/serve/server.test.ts index 092237a5..37b90dd2 100644 --- a/tests/serve/server.test.ts +++ b/tests/serve/server.test.ts @@ -47,6 +47,8 @@ features: text: probe AC two `; +const NO_DESIGN_IMPACT = {classification: 'none', rationale: 'test-only internal feature'} as const; + interface Pair { client: Client; cleanup: () => Promise; @@ -381,7 +383,7 @@ describe('serve/server — MCP read surface', () => { try { const result = await client.callTool({ name: 'clad_create_feature', - arguments: {slug: 'new-login-flow', title: 'New login flow', status: 'planned'}, + arguments: {slug: 'new-login-flow', title: 'New login flow', status: 'planned', design_impact: NO_DESIGN_IMPACT}, }); const text = (result.content as Array<{type: string; text: string}>)[0].text; const parsed = JSON.parse(text); @@ -396,6 +398,97 @@ describe('serve/server — MCP read surface', () => { } }); + test('feature creation resolves additive design and gates structural design until review', async () => { + const {client, cleanup} = await makePair(dir); + try { + mkdirSync(join(dir, 'spec', 'scenarios'), {recursive: true}); + writeFileSync( + join(dir, 'spec', 'scenarios', 'reporting-flow-a1b2c3.yaml'), + 'id: S-a1b2c3\nslug: reporting-flow\ntitle: Reporting flow\nfeatures: []\n', + ); + const additive = await client.callTool({ + name: 'clad_create_feature', + arguments: { + slug: 'payment-export', + design_impact: { + classification: 'additive', + rationale: 'Extends the existing reporting surface.', + capability: 'reporting', + capability_title: 'Reporting', + scenario: 'reporting-flow', + }, + }, + }); + const additivePayload = JSON.parse((additive.content as Array<{type: string; text: string}>)[0].text); + expect(additivePayload.designImpact.status).toBe('resolved'); + expect(readFileSync(join(dir, 'spec', 'capabilities.yaml'), 'utf8')).toContain(additivePayload.id); + expect(readFileSync(join(dir, 'spec', 'scenarios', 'reporting-flow-a1b2c3.yaml'), 'utf8')).toContain(additivePayload.id); + + const structural = await client.callTool({ + name: 'clad_create_feature', + arguments: { + slug: 'payment-service-boundary', + design_impact: { + classification: 'structural', + rationale: 'Introduces a separately deployed payment service.', + artifacts: ['spec/architecture.yaml', 'docs/project-context.md'], + }, + }, + }); + const structuralPayload = JSON.parse((structural.content as Array<{type: string; text: string}>)[0].text); + expect(structuralPayload.designImpact.status).toBe('review_required'); + expect(readFileSync(structuralPayload.path, 'utf8')).toContain('status: review_required'); + + const premature = await client.callTool({ + name: 'clad_resolve_design_impact', + arguments: {feature: structuralPayload.id}, + }); + expect(premature.isError).toBe(true); + + mkdirSync(join(dir, 'docs'), {recursive: true}); + writeFileSync(join(dir, 'spec', 'architecture.yaml'), 'layers: []\n'); + writeFileSync(join(dir, 'docs', 'project-context.md'), '# Approved service boundary\n'); + + const resolved = await client.callTool({ + name: 'clad_resolve_design_impact', + arguments: {feature: structuralPayload.id}, + }); + expect(resolved.isError).not.toBe(true); + expect(readFileSync(structuralPayload.path, 'utf8')).toContain('status: resolved'); + } finally { + await cleanup(); + } + }); + + test('feature creation rolls back every write when an additive design link fails', async () => { + const {client, cleanup} = await makePair(dir); + try { + const capabilitiesPath = join(dir, 'spec', 'capabilities.yaml'); + const beforeCapabilities = existsSync(capabilitiesPath) + ? readFileSync(capabilitiesPath, 'utf8') + : null; + const featuresPath = join(dir, 'spec', 'features'); + const beforeFeatures = existsSync(featuresPath) ? readdirSync(featuresPath).sort() : null; + const result = await client.callTool({ + name: 'clad_create_feature', + arguments: { + slug: 'atomic-additive-feature', + design_impact: { + classification: 'additive', + rationale: 'Must connect to the declared journey atomically.', + capability: 'atomic-capability', + scenario: 'missing-scenario', + }, + }, + }); + expect(result.isError).toBe(true); + expect(existsSync(featuresPath) ? readdirSync(featuresPath).sort() : null).toEqual(beforeFeatures); + expect(existsSync(capabilitiesPath) ? readFileSync(capabilitiesPath, 'utf8') : null).toBe(beforeCapabilities); + } finally { + await cleanup(); + } + }); + // Lever ① — clad_create_feature surfaces a malformed-EARS AC as an MCP error // AT CREATION (the end-to-end path that makes the shift-left lever actually // reach the agent), and writes no shard. @@ -407,6 +500,7 @@ describe('serve/server — MCP read surface', () => { arguments: { slug: 'bad-ears-flow', title: 'x', + design_impact: NO_DESIGN_IMPACT, acceptance_criteria: [{ears: 'ubiquitous', condition: 'when the user logs in', text: 't'}], }, }); @@ -430,7 +524,7 @@ describe('serve/server — MCP read surface', () => { try { const created = await client.callTool({ name: 'clad_create_feature', - arguments: {slug: 'widget', title: 'Widget', status: 'done', acceptance_criteria: [{text: 'does the thing'}]}, + arguments: {slug: 'widget', title: 'Widget', status: 'done', design_impact: NO_DESIGN_IMPACT, acceptance_criteria: [{text: 'does the thing'}]}, }); const createdParsed = JSON.parse((created.content as Array<{type: string; text: string}>)[0].text); const featureId = createdParsed.id as string; @@ -583,7 +677,7 @@ describe('MCP structural channel (F-570a3f)', () => { try { const res = await client.callTool({ name: 'clad_create_feature', - arguments: {slug: 'gate-footer-probe', acceptance_criteria: [{ears: 'ubiquitous', text: 'probe'}]}, + arguments: {slug: 'gate-footer-probe', design_impact: NO_DESIGN_IMPACT, acceptance_criteria: [{ears: 'ubiquitous', text: 'probe'}]}, }); const text = (res.content as Array<{type: string; text: string}>)[0].text; const parsed = JSON.parse(text) as {schema_version?: number; gate?: {pass: boolean; findings: unknown[]}}; @@ -623,7 +717,7 @@ describe('voluntary oracle labeling (F-551a1c)', () => { try { const created = await client.callTool({ name: 'clad_create_feature', - arguments: {slug: 'vol-probe', status: 'done', acceptance_criteria: [{ears: 'ubiquitous', text: 'probe', test_refs: ['spec.yaml']}]}, + arguments: {slug: 'vol-probe', status: 'done', design_impact: NO_DESIGN_IMPACT, acceptance_criteria: [{ears: 'ubiquitous', text: 'probe', test_refs: ['spec.yaml']}]}, }); const feature = JSON.parse((created.content as Array<{type: string; text: string}>)[0].text) as {id: string; path: string}; const shard = readFileSync(feature.path, 'utf8'); // result path is already absolute @@ -823,7 +917,7 @@ describe('MCP syncInventory git-operation write guard (F-10cc42d1 · AC-28d60113 try { const res = await client.callTool({ name: 'clad_create_feature', - arguments: {slug: 'mid-merge-feature', title: 'Mid merge', status: 'planned'}, + arguments: {slug: 'mid-merge-feature', title: 'Mid merge', status: 'planned', design_impact: NO_DESIGN_IMPACT}, }); // The create itself succeeds — only the DERIVED inventory sync is guarded. expect(res.isError).not.toBe(true); @@ -846,7 +940,7 @@ describe('MCP syncInventory git-operation write guard (F-10cc42d1 · AC-28d60113 try { const res = await client.callTool({ name: 'clad_create_feature', - arguments: {slug: 'settled-feature', title: 'Settled', status: 'planned'}, + arguments: {slug: 'settled-feature', title: 'Settled', status: 'planned', design_impact: NO_DESIGN_IMPACT}, }); expect(res.isError).not.toBe(true); expect(readFileSync(join(dir, 'spec.yaml'), 'utf8')).toContain('inventory:'); From 013772d37efde583f2ad88ef475c2870031d109d Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 14 Jul 2026 22:50:23 +0900 Subject: [PATCH 07/28] chore(spec): refresh onboarding verification attestation --- spec/attestation.yaml | 122 +++++++++++++++++++++--------------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/spec/attestation.yaml b/spec/attestation.yaml index b619ba26..0e17e1b2 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -23,8 +23,8 @@ attested_modules: GOVERNANCE.md: 21cc28eaaf637a20 README.html: 1a020a2174f7e1a6 README.ko.html: 90b6c2c123e863fa - README.ko.md: abf66779d7a314d8 - README.md: 8f7137aec82a278a + README.ko.md: b885576f23db80e0 + README.md: 3d3891138a9a9d08 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -37,10 +37,10 @@ attested_modules: docs/ab-evaluation/README.md: 2467808b9871dcf0 docs/ab-evaluation/case-doverunner-scale.md: 2a435b6855823d41 docs/ab-evaluation/case-efficiency-measurement.md: 348aca146a7b2faa - docs/ab-evaluation/case-existing-adoption.md: 8e86e9a3e60c64fe + docs/ab-evaluation/case-existing-adoption.md: ba73162bf6f43a34 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: 0ecb089a576de638 + docs/ab-evaluation/case-payment-saas.md: a19608f25d0cf807 docs/ab-evaluation/case-working-set-landmine.md: b4f44dc463e99722 docs/ab-evaluation/summary.md: 59e527a531f13209 docs/b1-adoption-protocol.md: a041d8ad5ba1447f @@ -51,8 +51,8 @@ attested_modules: docs/code-style.md: f1fd100fa0d11c5e docs/dogfood/claude-code-2026-05-20.md: 04870d41e75576d6 docs/dogfood/gemini-cli-2026-05-20.md: 2da1ba66c4f108f0 - docs/feature-cycle.md: 6af4ff8fe15db28a - docs/glossary.md: 56619c81c8bfb424 + docs/feature-cycle.md: b8c48c86d1f1e093 + docs/glossary.md: 5c2d8f6a0837e3c9 docs/img/en/ecosystem.svg: ed14d1d17f088b00 docs/img/en/relationship.svg: c7a24203925b4664 docs/img/ko/ecosystem.svg: 2b7341576c2af0a8 @@ -60,52 +60,52 @@ attested_modules: docs/multi-provider-roadmap.md: 1e5cf27ea1b18d06 docs/refinement-backlog.md: 3e38d60bf987eef1 docs/spec-ids-multi-dev.md: 28d58e84879f58b1 - docs/ssot-model.md: 2ecedd961ce4f721 - docs/ssot-testing.md: a067d2b99852db9a + docs/ssot-model.md: 35b911d1138b725e + docs/ssot-testing.md: abf3b2bd5acb29a1 package.json: 0bb13c2629d681a4 plugins/claude-code/.claude-plugin/plugin.json: 7493e69dee9ae24d - plugins/claude-code/agents/developer.md: b0ef3775132d159a - plugins/claude-code/agents/observability.md: 81f73e284ee9b3ba - plugins/claude-code/agents/orchestrator.md: 56b335a91e818e40 - plugins/claude-code/agents/planner.md: 9514f785ba65a58c - plugins/claude-code/agents/reviewer.md: 91922293457a3d6a - plugins/claude-code/commands/init.md: 32b2bd25fbbc9a5a + plugins/claude-code/agents/developer.md: 40af2943253f6c72 + plugins/claude-code/agents/observability.md: 5ea8f14b1c9b4a61 + plugins/claude-code/agents/orchestrator.md: 18f41e1dbfe6d95b + plugins/claude-code/agents/planner.md: 934753c28d5f1287 + plugins/claude-code/agents/reviewer.md: 9c4e095e60040473 + plugins/claude-code/commands/init.md: 5003335bed70cc98 plugins/claude-code/hooks/hooks.json: 42321ead26fb1da8 plugins/codex/.codex-plugin/plugin.json: e2898491a8fd62b8 plugins/codex/.mcp.json: 43e3f4b2af24aa18 - plugins/codex/skills/check/SKILL.md: 355826df90846d2f - plugins/codex/skills/developer/SKILL.md: b0ef3775132d159a - plugins/codex/skills/init/SKILL.md: 32b2bd25fbbc9a5a - plugins/codex/skills/observability/SKILL.md: 81f73e284ee9b3ba - plugins/codex/skills/orchestrator/SKILL.md: 56b335a91e818e40 - plugins/codex/skills/planner/SKILL.md: 9514f785ba65a58c - plugins/codex/skills/reviewer/SKILL.md: 91922293457a3d6a - plugins/codex/skills/run/SKILL.md: 43683062ac062846 - plugins/codex/skills/serve/SKILL.md: 4cee65dfb691e3b0 - plugins/codex/skills/status/SKILL.md: b3cb6e7a12bf4023 - plugins/codex/skills/sync/SKILL.md: 709c20212aa5627e + plugins/codex/skills/check/SKILL.md: 455d912ce1d47b5a + plugins/codex/skills/developer/SKILL.md: 40af2943253f6c72 + plugins/codex/skills/init/SKILL.md: 5003335bed70cc98 + plugins/codex/skills/observability/SKILL.md: 5ea8f14b1c9b4a61 + plugins/codex/skills/orchestrator/SKILL.md: 18f41e1dbfe6d95b + plugins/codex/skills/planner/SKILL.md: 934753c28d5f1287 + plugins/codex/skills/reviewer/SKILL.md: 9c4e095e60040473 + plugins/codex/skills/run/SKILL.md: 9f95ff17d70c8dd1 + plugins/codex/skills/serve/SKILL.md: d65778260c663fbb + plugins/codex/skills/status/SKILL.md: 09faadc50b3449da + plugins/codex/skills/sync/SKILL.md: 775c0f990a52a3d9 plugins/gemini-cli/GEMINI.md: ba08eaf2cd557a65 plugins/gemini-cli/commands/README.md: 3527d771578431bd - plugins/gemini-cli/commands/init.toml: 6a0a5b7570f754d5 + plugins/gemini-cli/commands/init.toml: 708f110989531f36 plugins/gemini-cli/gemini-extension.json: 47685e98f1f67e11 scripts/build-plugin.mjs: 57ffa3f0e6317a6b scripts/build.mjs: 3a4b204063024ef1 scripts/migrate-dogfood-v0.3.16.mjs: 1e265fb370019996 scripts/shard-spec.ts: 0c728bbc1e869421 scripts/version-bump.mjs: 05a3aa76667ed9ce - skills/check/SKILL.md: 355826df90846d2f - skills/checkpoint/SKILL.md: 97bde8bd4553d38f - skills/clarify/SKILL.md: 4cfc870233a356b2 - skills/doctor/SKILL.md: 5363d3b34e69c516 - skills/init/SKILL.md: 32b2bd25fbbc9a5a - skills/oracle/SKILL.md: 3fc7f21e0309dad3 - skills/rollback/SKILL.md: 2597ab798e61ded8 - skills/route/SKILL.md: 624a6cf60db7960d - skills/run/SKILL.md: 43683062ac062846 - skills/serve/SKILL.md: 4cee65dfb691e3b0 - skills/status/SKILL.md: b3cb6e7a12bf4023 - skills/sync/SKILL.md: 709c20212aa5627e - spec.yaml: bc97738633904690 + skills/check/SKILL.md: 455d912ce1d47b5a + skills/checkpoint/SKILL.md: f723e8cfb8286a64 + skills/clarify/SKILL.md: 060d5312de840370 + skills/doctor/SKILL.md: 6581c6c900c72d68 + skills/init/SKILL.md: 5003335bed70cc98 + skills/oracle/SKILL.md: 0986572a0a5604f6 + skills/rollback/SKILL.md: d472dc3a562b347b + skills/route/SKILL.md: 5958830fef280c67 + skills/run/SKILL.md: 9f95ff17d70c8dd1 + skills/serve/SKILL.md: d65778260c663fbb + skills/status/SKILL.md: 09faadc50b3449da + skills/sync/SKILL.md: 775c0f990a52a3d9 + spec.yaml: 1ff1636cb3da324b spec/README.md: 7c257426396d435c spec/architecture.yaml: f0888480405a13a8 spec/features/: a4d0f0eb87fed960 @@ -126,27 +126,27 @@ attested_modules: src/adapters/types.ts: f8e5643231a13e8d src/agents: a4d0f0eb87fed960 src/agents/README.md: 9f41809958439db2 - src/agents/blind-author.md: c4c89882adce01ce - src/agents/developer.md: b0ef3775132d159a + src/agents/blind-author.md: e9d2977f9879d3f9 + src/agents/developer.md: 40af2943253f6c72 src/agents/loader.ts: 6d35560c47f9ae85 - src/agents/observability.md: 81f73e284ee9b3ba - src/agents/orchestrator.md: 56b335a91e818e40 - src/agents/planner.md: 9514f785ba65a58c - src/agents/reviewer.md: 91922293457a3d6a + src/agents/observability.md: 5ea8f14b1c9b4a61 + src/agents/orchestrator.md: 18f41e1dbfe6d95b + src/agents/planner.md: 934753c28d5f1287 + src/agents/reviewer.md: 9c4e095e60040473 src/changelog/collect.ts: a6c936a7b8c34e2a src/changelog/render.ts: 83dd2d95f24ca68c src/cli: a4d0f0eb87fed960 src/cli/benchmark.ts: 77f84d2a898d724f src/cli/changelog.ts: 2de1adb009b89ab4 - src/cli/clad.ts: cb33063566a9e86a - src/cli/clarify.ts: 21fd375caa5586ab + src/cli/clad.ts: e75a16da5809a319 + src/cli/clarify.ts: 393cc93a6feb698a src/cli/doctor-hosts.ts: 1ad79105b47fd8e5 src/cli/doctor.ts: b98b955fe75e7f7e - src/cli/done.ts: ad2b2d49034296bd + src/cli/done.ts: 02bd4397eaf34fa1 src/cli/graph-serve.ts: 23e6e389225d0f98 src/cli/graph.ts: bab410061b8c746a src/cli/hook.ts: 201f82f4c89e173f - src/cli/init.ts: 54c33d905644c4c1 + src/cli/init.ts: f4aef7a828a8cfda src/cli/intent-from-path.ts: e69862821d979f22 src/cli/measure.ts: 3a562f16589e26c2 src/cli/report.ts: 911f859b2446834b @@ -158,9 +158,9 @@ attested_modules: src/cli/scan/greenfield-seeds.ts: ff462b4a19f081f3 src/cli/scan/helpers.ts: 396c73992ded0e22 src/cli/scan/index.ts: c23f21c487c8abcb - src/cli/scan/intent-onboarding.ts: bfc6960b621e0966 + src/cli/scan/intent-onboarding.ts: 2172608a4df3b866 src/cli/scan/llm.ts: e6a91e97f9873531 - src/cli/scan/onboarding-state.ts: a5e8513fc8355e6e + src/cli/scan/onboarding-state.ts: 2353e89f3c64c563 src/cli/scan/roots.ts: 7475eed8c9836531 src/cli/scan/scenarios.ts: 6c2a4ce3b469a668 src/cli/scan/stats.ts: 00c737b7b7acad97 @@ -178,7 +178,7 @@ attested_modules: src/drive/halt.ts: 386dd57f84f8e297 src/drive/loop.ts: c37e15ece8e2ae41 src/events: a4d0f0eb87fed960 - src/events/log.ts: dcef5c4cccd5ed9c + src/events/log.ts: ed70cf9bfeb2eaf0 src/events/session-report.ts: d0b34f848c360334 src/graph/layout3d.ts: fdbf08bacad2c049 src/graph/model.ts: 9dfae1cb48bfe3d5 @@ -192,10 +192,10 @@ attested_modules: src/hitl/anti-self-cert.ts: 53a714d8e489d00a src/hitl/audit.ts: 79b06e904815469a src/hitl/identity.ts: 52ff84aa666f1dab - src/init/agents-md.ts: c411aaa8b724d496 + src/init/agents-md.ts: cb15264f0a0f2f8c src/init/git-hook.ts: 4e02f177b3764ae8 src/init/host-instructions.ts: f6d10695ef0c4763 - src/init/host-setup.ts: ffc4007d97049900 + src/init/host-setup.ts: 9de81d8243ef93f7 src/optimizer: a4d0f0eb87fed960 src/optimizer/code-excerpt.ts: e2c4598efcd28d2a src/optimizer/context-slice.ts: b5864aaed1e7ae48 @@ -218,7 +218,7 @@ attested_modules: src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 - src/serve/server.ts: 7f44fae8da80fb14 + src/serve/server.ts: bc085ce656060248 src/spec: a4d0f0eb87fed960 src/spec/attestation.ts: 294a1e99c42d4aef src/spec/cli.ts: 7a9bcd0f66677810 @@ -228,12 +228,12 @@ attested_modules: src/spec/feature-id.ts: 2b6335aac848a3de src/spec/inventory.ts: 2cd34dfb665f422f src/spec/load.ts: 9fe2fe74053bf7e3 - src/spec/new.ts: ae698bb51309c05e + src/spec/new.ts: f9aa4466a8ce1dfd src/spec/parse.ts: 1eab9a28c9359a45 src/spec/reverse-index.ts: d8b003eb8f1918c8 - src/spec/schema.json: 7e26bc66cb0fc359 + src/spec/schema.json: 7cc4674eb37ebea9 src/spec/test-ref-repair.ts: 5ce823b479aaaca3 - src/spec/types.ts: 8279f66aed33d569 + src/spec/types.ts: b97d69db856c78a5 src/spec/validate.ts: db88ca6512ab363a src/stages: a4d0f0eb87fed960 src/stages/arch.ts: 268422e53c6d20bb @@ -324,7 +324,7 @@ attested_modules: tests/adapters/transport.test.ts: 68f22e9e8df7b813 tests/agents/loader.test.ts: a7df7b1c9a95d37d tests/cli/benchmark.test.ts: b4a87289605ee75f - tests/cli/clad.test.ts: 85bd0782fc8e10c0 + tests/cli/clad.test.ts: c1c58f2581507eab tests/cli/gate-golden-matrix.test.ts: 39cf615407a55abe tests/cli/init.test.ts: 3428a89708fc9330 tests/cli/intent-onboarding.test.ts: 0681b98ce2e74c22 @@ -361,8 +361,8 @@ attested_modules: tests/scenarios/ab/_vanilla-sim.ts: 1d7407f97cfc5e48 tests/scenarios/ab/case-existing-adoption.test.ts: 430e095a4f08fec6 tests/scenarios/ab/case-payment-saas.test.ts: 280404fbbfd0e6a3 - tests/scenarios/existing-adoption-lifecycle.test.ts: 23011bf2cf1e1bfb - tests/scenarios/greenfield-lifecycle.test.ts: a3f3cefd204f03cf + tests/scenarios/existing-adoption-lifecycle.test.ts: c1641cbe818087df + tests/scenarios/greenfield-lifecycle.test.ts: 434b58e6722aad1e tests/self-consistency.test.ts: e7fbd651f0c60c4a tests/serve/description-budget.test.ts: e1501907eff9b923 tests/spec/ears.test.ts: e7385918da1d8c7a From dac5b92b3999e8fc5ec623a8845696a396b8c926 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 14 Jul 2026 23:18:22 +0900 Subject: [PATCH 08/28] feat: verify Antigravity onboarding --- README.html | 8 +- README.ja.md | 8 +- README.ko.html | 8 +- README.ko.md | 8 +- README.md | 10 +- README.zh.md | 8 +- docs/dogfood/antigravity-cli-2026-07-14.md | 19 + docs/dogfood/matrix.md | 6 +- docs/setup.md | 14 +- package.json | 4 +- plugins/antigravity/mcp_config.json | 8 + plugins/antigravity/plugin.json | 5 + .../antigravity/skills/blind-author/SKILL.md | 40 ++ plugins/antigravity/skills/changelog/SKILL.md | 38 + plugins/antigravity/skills/check/SKILL.md | 32 + .../antigravity/skills/checkpoint/SKILL.md | 31 + plugins/antigravity/skills/clarify/SKILL.md | 18 + plugins/antigravity/skills/developer/SKILL.md | 85 +++ plugins/antigravity/skills/doctor/SKILL.md | 40 ++ plugins/antigravity/skills/init/SKILL.md | 25 + .../antigravity/skills/observability/SKILL.md | 50 ++ plugins/antigravity/skills/oracle/SKILL.md | 69 ++ .../antigravity/skills/orchestrator/SKILL.md | 89 +++ plugins/antigravity/skills/planner/SKILL.md | 73 ++ plugins/antigravity/skills/reviewer/SKILL.md | 81 +++ plugins/antigravity/skills/rollback/SKILL.md | 39 + plugins/antigravity/skills/route/SKILL.md | 28 + plugins/antigravity/skills/run/SKILL.md | 34 + plugins/antigravity/skills/serve/SKILL.md | 20 + plugins/antigravity/skills/status/SKILL.md | 18 + plugins/antigravity/skills/sync/SKILL.md | 33 + plugins/claude-code/commands/init.md | 4 +- plugins/claude-code/dist/clad.js | 678 +++++++++--------- plugins/codex/skills/clarify/SKILL.md | 2 + plugins/codex/skills/init/SKILL.md | 4 +- plugins/gemini-cli/commands/init.toml | 4 +- scripts/build-plugin.mjs | 21 + skills/clarify/SKILL.md | 2 + skills/init/SKILL.md | 4 +- src/init/host-setup.ts | 101 +-- src/serve/server.ts | 79 +- .../init-onboarding-english-source.test.ts | 6 +- tests/cli/setup.test.ts | 23 +- tests/docs-prune.test.ts | 10 +- tests/serve/init-tools.test.ts | 19 + 45 files changed, 1426 insertions(+), 480 deletions(-) create mode 100644 docs/dogfood/antigravity-cli-2026-07-14.md create mode 100644 plugins/antigravity/mcp_config.json create mode 100644 plugins/antigravity/plugin.json create mode 100644 plugins/antigravity/skills/blind-author/SKILL.md create mode 100644 plugins/antigravity/skills/changelog/SKILL.md create mode 100644 plugins/antigravity/skills/check/SKILL.md create mode 100644 plugins/antigravity/skills/checkpoint/SKILL.md create mode 100644 plugins/antigravity/skills/clarify/SKILL.md create mode 100644 plugins/antigravity/skills/developer/SKILL.md create mode 100644 plugins/antigravity/skills/doctor/SKILL.md create mode 100644 plugins/antigravity/skills/init/SKILL.md create mode 100644 plugins/antigravity/skills/observability/SKILL.md create mode 100644 plugins/antigravity/skills/oracle/SKILL.md create mode 100644 plugins/antigravity/skills/orchestrator/SKILL.md create mode 100644 plugins/antigravity/skills/planner/SKILL.md create mode 100644 plugins/antigravity/skills/reviewer/SKILL.md create mode 100644 plugins/antigravity/skills/rollback/SKILL.md create mode 100644 plugins/antigravity/skills/route/SKILL.md create mode 100644 plugins/antigravity/skills/run/SKILL.md create mode 100644 plugins/antigravity/skills/serve/SKILL.md create mode 100644 plugins/antigravity/skills/status/SKILL.md create mode 100644 plugins/antigravity/skills/sync/SKILL.md diff --git a/README.html b/README.html index 5448da05..6c14e2e4 100644 --- a/README.html +++ b/README.html @@ -227,7 +227,7 @@

cladding

To trust AI with coding, an organization needs three things — that the code can be trusted, that it's traced, and that it holds up as you scale. cladding builds those three.
- True to its name (cladding = the outer layer), it wraps your host LLM (Claude Code · Codex · Gemini · Cursor): before it starts, cladding feeds it the project's intent; after it finishes, cladding verifies the result with 41 detectors and a 15-stage gate. + True to its name (cladding = the outer layer), it wraps your host LLM (Claude Code · Codex · Antigravity · Cursor): before it starts, cladding feeds it the project's intent; after it finishes, cladding verifies the result with 41 detectors and a 15-stage gate.

@@ -315,7 +315,7 @@

How cladding wraps your host LLM

After — verify the result: the 15-stage gate, 41 drift detectors, and an implementation-blind grader — an agent that checks the work against the spec with no tool to read the implementation, so it can't rubber-stamp what it wrote.

Real-time intervention (map injection · instant block · stop block) runs fully on Claude Code. - On Codex · Gemini · Cursor the same verification runs through in-conversation tool calls plus the git · CI gate. + On Codex · Antigravity · Cursor the same verification runs through in-conversation tool calls plus the git · CI gate.

@@ -483,13 +483,13 @@

Ecosystem

Install

1. Install and connect your AI tools

npm install -g cladding   # the cladding CLI
-clad setup                # auto-wire your AI tools (Claude · Codex · Gemini · Cursor)
+clad setup # auto-wire your AI tools (Claude · Codex · Antigravity · Cursor)

Run these once on your machine, from any directory. clad setup connects supported AI tools globally; it does not create or modify project files.

2. Start your AI tool from the project

cd <project>
-

Next step: Start your AI tool with this project as its workspace. Run Codex, Claude Code, or Gemini CLI from this directory, or open this folder in Cursor. The connection created by clad setup takes effect in the new session.

+

Next step: Start your AI tool with this project as its workspace. Run Codex, Claude Code, or Antigravity (agy) from this directory, or open this folder in Cursor. The connection created by clad setup takes effect in the new session.

3. Apply Cladding once

Choose the starting point that fits and say it naturally in your AI tool.

diff --git a/README.ja.md b/README.ja.md index 984a1fa3..6f67b3f0 100644 --- a/README.ja.md +++ b/README.ja.md @@ -6,7 +6,7 @@

AI にコーディングを任せるには、組織に三つの条件が要る —
コードを信頼でき、その足跡をたどれ、規模が大きくなっても揺るがないこと。cladding はその三つを築く。

- その名(外装材)のとおりホスト LLM(Claude Code · Codex · Gemini · Cursor)を包み込む — 作業を 始める前 に、cladding がプロジェクトの意図を渡し、作業を 終えた後 に、41 個の検出器と 15 段階のゲートで結果を検証する。 + その名(外装材)のとおりホスト LLM(Claude Code · Codex · Antigravity · Cursor)を包み込む — 作業を 始める前 に、cladding がプロジェクトの意図を渡し、作業を 終えた後 に、41 個の検出器と 15 段階のゲートで結果を検証する。

@@ -66,7 +66,7 @@ cladding は **自分自身も cladding で作っている** — 254 個の feat **後 — 検証する:** 15 段階のゲート、41 個の乖離検出器、そして **実装を見ない採点者** — spec に照らして作業を検査するエージェントで、*実装を読む手段を一切持たない* ため、自分が書いたものにお墨付きを与えることはできない。 -リアルタイム介入(マップ注入 · 即時ブロック · 終了ブロック)は Claude Code ですべて動作する。Codex · Gemini · Cursor では同じ検証を、会話中のツール呼び出しと git · CI のゲートで通す。 +リアルタイム介入(マップ注入 · 即時ブロック · 終了ブロック)は Claude Code ですべて動作する。Codex · Antigravity · Cursor では同じ検証を、会話中のツール呼び出しと git · CI のゲートで通す。 @@ -245,7 +245,7 @@ cladding の差別化点は *組み合わせ* にある — 上のカテゴリ ```bash npm install -g cladding # cladding CLI をインストール -clad setup # AI ツールを自動配線(Claude · Codex · Gemini · Cursor) +clad setup # AI ツールを自動配線(Claude · Codex · Antigravity · Cursor) ``` 上のコマンドはどのディレクトリからでも実行でき、マシンごとに一度だけでよい。`clad setup` は対応する AI ツールをグローバルに接続するだけで、プロジェクトファイルは作成・変更しない。 @@ -256,7 +256,7 @@ clad setup # AI ツールを自動配線(Claude · Codex · Gem cd ``` -> **次のステップ:** このプロジェクトをワークスペースとして AI ツールを新しく起動する。Codex・Claude Code・Gemini CLI はこのディレクトリから実行し、Cursor ではこのフォルダを開く。`clad setup` の接続は新しいセッションから有効になる。 +> **次のステップ:** このプロジェクトをワークスペースとして AI ツールを新しく起動する。Codex・Claude Code・Antigravity(`agy`)はこのディレクトリから実行し、Cursor ではこのフォルダを開く。`clad setup` の接続は新しいセッションから有効になる。 ### 3. Cladding を一度適用する diff --git a/README.ko.html b/README.ko.html index 824e4a1d..e5407729 100644 --- a/README.ko.html +++ b/README.ko.html @@ -269,7 +269,7 @@

cladding

기업이 AI에게 코딩을 맡기려면 세 가지가 필요하다 —
믿을 수 있고, 추적되고, 규모가 커져도 흔들리지 않아야 한다. cladding이 그 셋을 만든다.

- cladding(외장재)이라는 이름 그대로, 호스트 LLM(Claude Code · Codex · Gemini · Cursor)을 감싼다: 일을 시작하기 전엔 프로젝트의 의도를 넣어 주고, 마친 후엔 41개 검출기와 15단계 게이트로 결과를 검증한다. + cladding(외장재)이라는 이름 그대로, 호스트 LLM(Claude Code · Codex · Antigravity · Cursor)을 감싼다: 일을 시작하기 전엔 프로젝트의 의도를 넣어 주고, 마친 후엔 41개 검출기와 15단계 게이트로 결과를 검증한다.

@@ -349,7 +349,7 @@

cladding이 호스트 LLM을 감싸는 방식

실시간 개입(지도 주입 · 즉시 차단 · 종료 차단)은 Claude Code에서 전부 동작한다. - Codex · Gemini · Cursor에서는 같은 검증을 대화 속 도구 호출과 git·CI 관문으로 수행한다. + Codex · Antigravity · Cursor에서는 같은 검증을 대화 속 도구 호출과 git·CI 관문으로 수행한다.

@@ -519,13 +519,13 @@

인접 도구와의 차이

Install

1. 설치하고 AI 도구 연결하기

npm install -g cladding   # cladding CLI 설치
-clad setup                # AI 도구 자동 연결 (Claude · Codex · Gemini · Cursor)
+clad setup # AI 도구 자동 연결 (Claude · Codex · Antigravity · Cursor)

위 명령은 어느 디렉터리에서든 실행할 수 있으며, 컴퓨터마다 한 번이면 된다. clad setup은 지원하는 AI 도구를 전역으로 연결할 뿐 프로젝트 파일을 만들거나 수정하지 않는다.

2. 프로젝트에서 AI 도구 실행하기

cd <project>
-

다음 단계: 이 프로젝트 폴더에서 사용하는 AI 도구를 새로 시작한다. Codex · Claude Code · Gemini CLI는 이 디렉터리에서 실행하고, Cursor는 이 폴더를 연다. clad setup의 연결은 새 세션부터 적용된다.

+

다음 단계: 이 프로젝트 폴더에서 사용하는 AI 도구를 새로 시작한다. Codex · Claude Code · Antigravity(agy)는 이 디렉터리에서 실행하고, Cursor는 이 폴더를 연다. clad setup의 연결은 새 세션부터 적용된다.

3. 프로젝트에 Cladding 한 번 적용하기

자신의 시작 상황에 맞는 요청을 AI 도구에 자연스럽게 말한다.

diff --git a/README.ko.md b/README.ko.md index 4ff268a7..f2b0893d 100644 --- a/README.ko.md +++ b/README.ko.md @@ -6,7 +6,7 @@

기업이 AI에게 코딩을 맡기려면 세 가지가 필요하다 —
믿을 수 있고, 추적되고, 규모가 커져도 흔들리지 않아야 한다. cladding이 그 셋을 만든다.

- cladding(외장재)이라는 이름 그대로, 호스트 LLM(Claude Code · Codex · Gemini · Cursor)을 감싼다: 일을 시작하기 전엔 프로젝트의 의도를 넣어 주고, 마친 후엔 41개 검출기와 15단계 게이트로 결과를 검증한다. + cladding(외장재)이라는 이름 그대로, 호스트 LLM(Claude Code · Codex · Antigravity · Cursor)을 감싼다: 일을 시작하기 전엔 프로젝트의 의도를 넣어 주고, 마친 후엔 41개 검출기와 15단계 게이트로 결과를 검증한다.

@@ -66,7 +66,7 @@ cladding은 **자기 자신도 cladding으로 만든다** — 기능 254개 중 **후 — 결과를 검증한다:** 15단계 게이트 · 41개 어긋남 검출기 · 그리고 **구현을 못 보는 채점자** — 구현을 읽을 도구 없이 산출물을 스펙과 대조하는 에이전트라, 자기가 쓴 것에 도장을 찍어 줄 수 없다. -실시간 개입(지도 주입 · 즉시 차단 · 종료 차단)은 Claude Code에서 전부 동작한다. Codex · Gemini · Cursor에서는 같은 검증을 대화 속 도구 호출과 git · CI 관문으로 수행한다. +실시간 개입(지도 주입 · 즉시 차단 · 종료 차단)은 Claude Code에서 전부 동작한다. Codex · Antigravity · Cursor에서는 같은 검증을 대화 속 도구 호출과 git · CI 관문으로 수행한다. @@ -244,7 +244,7 @@ cladding의 차별점은 *결합* — 위 카테고리의 핵심을 *하나의 ```bash npm install -g cladding # cladding CLI 설치 -clad setup # AI 도구 자동 연결 (Claude · Codex · Gemini · Cursor) +clad setup # AI 도구 자동 연결 (Claude · Codex · Antigravity · Cursor) ``` 위 명령은 어느 디렉터리에서든 실행할 수 있으며, 컴퓨터마다 한 번이면 된다. `clad setup`은 지원하는 AI 도구를 전역으로 연결할 뿐 프로젝트 파일을 만들거나 수정하지 않는다. @@ -255,7 +255,7 @@ clad setup # AI 도구 자동 연결 (Claude · Codex · Gemini cd ``` -> **다음 단계:** 이 프로젝트 폴더에서 사용하는 AI 도구를 새로 시작한다. Codex · Claude Code · Gemini CLI는 이 디렉터리에서 실행하고, Cursor는 이 폴더를 연다. `clad setup`의 연결은 새 세션부터 적용된다. +> **다음 단계:** 이 프로젝트 폴더에서 사용하는 AI 도구를 새로 시작한다. Codex · Claude Code · Antigravity(`agy`)는 이 디렉터리에서 실행하고, Cursor는 이 폴더를 연다. `clad setup`의 연결은 새 세션부터 적용된다. ### 3. 프로젝트에 Cladding 한 번 적용하기 diff --git a/README.md b/README.md index 6a4986dc..ee8c21ee 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@

To trust AI with coding, an organization needs three things — that the code can be trusted,
that it's traced, and that it holds up as you scale. cladding builds those three.

- True to its name (cladding = the outer layer), it wraps your host LLM (Claude Code · Codex · Gemini · Cursor): before it starts, cladding feeds it the project's intent; after it finishes, cladding verifies the result with 41 detectors and a 15-stage gate. + True to its name (cladding = the outer layer), it wraps your host LLM (Claude Code · Codex · Antigravity · Cursor): before it starts, cladding feeds it the project's intent; after it finishes, cladding verifies the result with 41 detectors and a 15-stage gate.

@@ -66,7 +66,7 @@ The same situation, in a *vanilla AI setup* and in cladding. **After — verify the result:** the 15-stage gate, 41 drift detectors, and an **implementation-blind grader** — an agent that checks the work against the spec *with no tool to read the implementation*, so it can't rubber-stamp what it wrote. -Real-time intervention (map injection · instant block · stop-block) runs fully on Claude Code. On Codex · Gemini · Cursor the same verification runs through in-conversation tool calls plus the git · CI gate. +Real-time intervention (map injection · instant block · stop-block) runs fully on Claude Code. On Codex · Antigravity · Cursor the same verification runs through in-conversation tool calls plus the git · CI gate. @@ -241,7 +241,7 @@ The distinction is the *combination* — binding those cores into *one verificat ```bash npm install -g cladding # the cladding CLI -clad setup # auto-wire your AI tools (Claude · Codex · Gemini · Cursor) +clad setup # auto-wire your AI tools (Claude · Codex · Antigravity · Cursor) ``` Run these once on your machine, from any directory. `clad setup` connects supported AI tools globally; it does not create or modify project files. @@ -252,7 +252,7 @@ Run these once on your machine, from any directory. `clad setup` connects suppor cd ``` -> **Next step:** Start your AI tool with this project as its workspace. Run Codex, Claude Code, or Gemini CLI from this directory, or open this folder in Cursor. The connection created by `clad setup` takes effect in the new session. +> **Next step:** Start your AI tool with this project as its workspace. Run Codex, Claude Code, or Antigravity (`agy`) from this directory, or open this folder in Cursor. The connection created by `clad setup` takes effect in the new session. ### 3. Apply Cladding once @@ -295,7 +295,7 @@ Implement email sign-in, including tests. There is nothing new to memorize. For host-specific invocation, stricter Git/CI enforcement, and verified host status, see [setup details](docs/setup.md). - + diff --git a/README.zh.md b/README.zh.md index ebf71f61..ff6769d9 100644 --- a/README.zh.md +++ b/README.zh.md @@ -6,7 +6,7 @@

要放心把编码交给 AI,一个组织需要三样东西 ——
代码可信、过程可追溯、规模扩张时依然稳固。cladding 把这三样一手做齐。

- 正如其名(cladding = 外覆层),它包裹住你的宿主 LLM(Claude Code · Codex · Gemini · Cursor):在它动手之前,cladding 先把项目的意图喂给它;在它收尾之后,cladding 用 41 个检测器和 15 阶段门禁验证结果。 + 正如其名(cladding = 外覆层),它包裹住你的宿主 LLM(Claude Code · Codex · Antigravity · Cursor):在它动手之前,cladding 先把项目的意图喂给它;在它收尾之后,cladding 用 41 个检测器和 15 阶段门禁验证结果。

@@ -66,7 +66,7 @@ cladding 连**自己**也是用 cladding 造的 —— 254 个 feature 里有 25 **之后 —— 验证结果:** 15 阶段门禁、41 个漂移检测器,外加一个**看不到实现的评分者** —— 这个智能体对照 spec 核查成果,却*没有任何读取实现的工具*,因此无法给自己写下的东西盖章放行。 -实时干预(注入地图 · 当场拦截 · 退出拦截)在 Claude Code 上全部可用。在 Codex · Gemini · Cursor 上,同样的验证通过对话中的工具调用,再加 git · CI 门禁来完成。 +实时干预(注入地图 · 当场拦截 · 退出拦截)在 Claude Code 上全部可用。在 Codex · Antigravity · Cursor 上,同样的验证通过对话中的工具调用,再加 git · CI 门禁来完成。 @@ -241,7 +241,7 @@ cladding 的独到之处在于*组合* —— 把上述品类的内核,绑进* ```bash npm install -g cladding # 安装 cladding CLI -clad setup # 自动接通你的 AI 工具(Claude · Codex · Gemini · Cursor) +clad setup # 自动接通你的 AI 工具(Claude · Codex · Antigravity · Cursor) ``` 以上命令可以在任何目录运行,每台电脑只需执行一次。`clad setup` 只会全局连接支持的 AI 工具,不会创建或修改项目文件。 @@ -252,7 +252,7 @@ clad setup # 自动接通你的 AI 工具(Claude · Codex · Ge cd ``` -> **下一步:** 以此项目文件夹作为工作区,重新启动所使用的 AI 工具。在该目录中运行 Codex、Claude Code 或 Gemini CLI;如果使用 Cursor,则打开此文件夹。`clad setup` 创建的连接会从新会话开始生效。 +> **下一步:** 以此项目文件夹作为工作区,重新启动所使用的 AI 工具。在该目录中运行 Codex、Claude Code 或 Antigravity(`agy`);如果使用 Cursor,则打开此文件夹。`clad setup` 创建的连接会从新会话开始生效。 ### 3. 为项目应用一次 Cladding diff --git a/docs/dogfood/antigravity-cli-2026-07-14.md b/docs/dogfood/antigravity-cli-2026-07-14.md new file mode 100644 index 00000000..c26e83dd --- /dev/null +++ b/docs/dogfood/antigravity-cli-2026-07-14.md @@ -0,0 +1,19 @@ +# Antigravity CLI onboarding campaign — 2026-07-14 + +- Host: Antigravity CLI (`agy`) 1.1.0 +- Plugin: `plugins/antigravity` (19 skills, one MCP server) +- Transport: stdio MCP through `clad serve` +- Result: verified + +## Live cases + +| Case | Preview before writes | Separate exact approval | Result | +|---|---:|---:|---| +| Idea only | pass | pass | initialized; unresolved KYB/KYC choice returned to the user without inventing an answer | +| Planning document | pass | pass | initialized from `plan.md` with no unnecessary follow-up | +| Existing project | pass | pass | observed ES modules, two-space indentation, JSDoc, and the Node test runner before adoption | +| Uninitialized control | n/a | n/a | ordinary file request created only the requested file; no Cladding artifacts or intervention | + +AGY runs each printed turn in a separate process. The campaign therefore also verifies the +machine-local, short-lived approval cache used when a host does not retain the opaque preparation +token between turns. The approval phrase remains exact, single-use, and expires after 30 minutes. diff --git a/docs/dogfood/matrix.md b/docs/dogfood/matrix.md index dbc1bda0..1b524db8 100644 --- a/docs/dogfood/matrix.md +++ b/docs/dogfood/matrix.md @@ -1,7 +1,7 @@ # Host support matrix - + - Cladding version: `0.7.1` - Generated: 2026-07-03T02:42:22.205Z @@ -9,7 +9,7 @@ | Host | list-features | get-feature | run-check | wiring | Grade | |---|---|---|---|---|---| | claude | pass | pass | pass | — | verified | -| gemini | fail | fail | fail | — | fail | +| antigravity | pass | pass | pass | pass | verified | | codex | not-run | not-run | not-run | — | not-run | | cursor | — | — | — | — | not-run | @@ -21,7 +21,7 @@ **Why not-run / fail** -- `gemini`: list-features, get-feature, run-check failed — e:///opt/homebrew/Cellar/gemini-cli/0.42.0/libexec/lib/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:273233:5) at process.processTicksAndRejections (node:internal/process/task_queues:104:5) +- `antigravity`: live onboarding campaign passed; see `antigravity-cli-2026-07-14.md`. - `codex`: binary not on PATH - `cursor`: Cursor not detected (~/.cursor absent) — run `clad setup` to wire diff --git a/docs/setup.md b/docs/setup.md index cfd1ae42..23c2447e 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -12,16 +12,18 @@ the detail behind them: where each host is wired, how the MCP server works, and | Claude Code (`~/.claude/`) | `~/.claude/plugins/cladding` | `claude plugin marketplace add` + `install` | | Codex CLI skills (`~/.agents/`) | `~/.agents/skills/cladding-*` | (auto on Codex restart) | | Codex CLI MCP server (`~/.codex/`) | `[mcp_servers.cladding]` in `~/.codex/config.toml` | (TOML entry itself) | -| Gemini CLI (`~/.gemini/`) | `~/.gemini/extensions/cladding` | `gemini extensions link` | +| Antigravity (`agy`) | `~/.gemini/config/plugins/cladding` | (auto on AGY restart) | | Cursor (`~/.cursor/`) | `mcpServers.cladding` in `~/.cursor/mcp.json` | (JSON entry itself) | -`clad setup` invokes each host's activation command automatically when the `claude` / `gemini` -binaries are on PATH. It is safe to re-run after an upgrade or after installing a new AI tool. +`clad setup` invokes Claude Code's activation command when `claude` is on PATH. Antigravity +auto-discovers its wired plugin directory after restart. It is safe to re-run after an upgrade or +after installing a new AI tool. **Verification level (honesty note).** Claude Code is fully verified through real-usage campaigns (including real-time intervention). Codex onboarding is live-verified for idea, -planning-document, existing-project, and uninitialized control cases. Gemini CLI and Cursor wire -automatically, but their real-usage onboarding verification is still pending. (The machine-readable claim lives in the README's `clad:host-claims` +planning-document, existing-project, and uninitialized control cases. Antigravity 1.1.0 is also +live-verified for all three onboarding cases plus the uninitialized control case. Cursor wires +automatically, but its real-usage onboarding verification is still pending. (The machine-readable claim lives in the README's `clad:host-claims` fence, which `HOST_CLAIM_DRIFT` polices against `docs/dogfood/matrix.md`.) ## About the MCP server @@ -45,7 +47,7 @@ project, asking about Cladding, or running `clad setup` are not consent. |---|---|---| | Claude Code | `Apply Cladding to this project` | `/cladding:init` | | Codex | `Apply Cladding to this project` | Type `$cladding`, then choose `init (cladding)` | -| Gemini CLI | `Apply Cladding to this project` | `/cladding:init` | +| Antigravity | `Apply Cladding to this project` | `/cladding:init` from the installed plugin | | Cursor | `Apply Cladding to this project` | Natural language routes through the connected onboarding tool | ## Upgrading diff --git a/package.json b/package.json index da9960da..053c67bc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cladding", "version": "0.8.3", - "description": "Spec-driven verification layer for AI coding agents — Claude Code · Codex · Gemini · Cursor. Intent in before it writes, result verified against your spec after. Reference implementation of the Ironclad standard.", + "description": "Spec-driven verification layer for AI coding agents — Claude Code · Codex · Antigravity · Cursor. Intent in before it writes, result verified against your spec after. Reference implementation of the Ironclad standard.", "type": "module", "license": "MIT", "author": "qwerfunch", @@ -18,7 +18,7 @@ "spec-driven-development", "governance", "ironclad", "drift-detection", "multi-agent", "loop-engineering", "verification", "ai-coding", "compliance", "architecture-enforcement", - "claude-code", "codex-cli", "gemini-cli", "cursor", + "claude-code", "codex-cli", "antigravity-cli", "cursor", "mcp-server", "claude-code-plugin" ], "bin": { diff --git a/plugins/antigravity/mcp_config.json b/plugins/antigravity/mcp_config.json new file mode 100644 index 00000000..ba7f7845 --- /dev/null +++ b/plugins/antigravity/mcp_config.json @@ -0,0 +1,8 @@ +{ + "mcpServers": { + "cladding": { + "command": "clad", + "args": ["serve"] + } + } +} diff --git a/plugins/antigravity/plugin.json b/plugins/antigravity/plugin.json new file mode 100644 index 00000000..7d67e331 --- /dev/null +++ b/plugins/antigravity/plugin.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://antigravity.google/schemas/v1/plugin.json", + "name": "cladding", + "description": "Spec-driven verification and onboarding for Antigravity CLI." +} diff --git a/plugins/antigravity/skills/blind-author/SKILL.md b/plugins/antigravity/skills/blind-author/SKILL.md new file mode 100644 index 00000000..8b0eacab --- /dev/null +++ b/plugins/antigravity/skills/blind-author/SKILL.md @@ -0,0 +1,40 @@ +--- +name: blind-author +description: Impl-blind test/oracle author — writes conformance tests from a spec-only brief. Tool-restricted by definition (no Read/Grep/Glob/Edit), so "authored blind" is a structural fact, not a promise. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +tools: Write, Bash +capabilities: [write, exec] +--- + +# Blind Author + +You are the **Blind Author**. You write a conformance test for ONE acceptance +criterion from the spec-only brief pasted into your prompt — and from nothing +else. Your tool set has no Read, Grep, Glob, or Edit **on purpose**: you +*cannot* look at the implementation, so a test you write proves "matches the +spec," never "matches the code." (Prompt-level blindness leaked 4/4 in the +A/B that motivated this agent; your tool restriction is the fix.) + +## Contract + +1. **Input** — the brief from `clad oracle --ac `: the AC's + EARS text, the module paths' *declared signatures* (never bodies), and the + target path under `tests/oracle/`. If the brief is missing or names files + for you to open, STOP and say so — opening files is outside your charter. +2. **Output** — exactly one test file, written with Write to the target path + the brief names (`tests/oracle/..test.ts`). Import the + module under test by its declared path; exercise the BEHAVIOR the AC + states, including the failure direction for `unwanted` ACs. +3. **Verify** — run only your own file: `npx --no-install vitest run `. + A failing oracle on a done feature is a FINDING, not your bug — report the + failure verbatim; do not weaken the test to make it pass. +4. **No Edit** — to revise, Write the whole file again. + +## What you never do + +- Open, list, or search any file (you can't — by design). +- Test internal helpers or private shapes the brief doesn't declare. +- Soften an assertion because the run fails — the gate exists to catch that. + +After you finish, the dispatcher records provenance via `clad_author_oracle` +with `blind: true` and your manifest = the brief you were given. That record +is auditable; your restricted toolset is what makes it true. diff --git a/plugins/antigravity/skills/changelog/SKILL.md b/plugins/antigravity/skills/changelog/SKILL.md new file mode 100644 index 00000000..a518a6b0 --- /dev/null +++ b/plugins/antigravity/skills/changelog/SKILL.md @@ -0,0 +1,38 @@ +--- +description: Render release notes / a changelog from the cladding spec. Use when the user asks for release notes, a changelog, 릴리즈 노트, 변경 이력, or "what changed (since )" — run `clad changelog --json` for the deterministic shipped-changes manifest, then write the human-facing notes FROM it, sourcing every claim from a feature title or acceptance sentence. For audit asks, print the --audit table verbatim. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +--- + +# Cladding changelog — release notes from the spec + +The spec is the SSoT, so "what shipped?" is *collected*, never recalled. `clad changelog` turns +`..HEAD` into a deterministic manifest: feature shards classified (`added-as-done` / +`flipped-to-done` / `modified-while-done` / `archived`), grouped by capability (plus an +`uncategorized` bucket — itself a drift signal), the spec inventory diff, and conventional +`feat:`/`fix:` commits that name no feature id (work that shipped *outside* the spec — report it +honestly, don't hide it). + +## Protocol + +1. **Collect.** Run `clad changelog --json --since ` (omit `--since` to use the latest tag; + if the repo has no tags the command says so — ask the user for a ref). +2. **Render EN + KO release notes from the manifest, in the CHANGELOG.md house style:** + - Open with a `**In one line:**` abstract (what a user gains, one breath). + - Group by the manifest's capability groups; use **user-impact verbs** ("the gate now runs + your entry point"), not implementation verbs ("refactored stage runner"). + - **No `F-…`/`AC-…` ids in prose** (Soft Shell policy) — ids belong to the audit surface only. + - **Source every claim from the manifest** — a feature `title` or an `acceptance[]` sentence. + Never invent a change, never embellish beyond what an AC states. If the manifest is empty, + say "no shipped changes since " — that line is the honest deliverable. + - Put `unsharded_commits` under an "Also changed" section, marked as not yet spec-tracked. +3. **Audit asks** ("show verification", "어디까지 검증됐어?") → print + `clad changelog --audit --since ` **verbatim** — that table keeps ids and marks every + verification ref resolved ✓ / unresolved ✗ (a ✗ is spec-annotation drift worth reporting). +4. **Catalog asks** ("what does this project do, in full?") → `clad changelog --catalog` prints + the whole capability → feature → acceptance listing of the living spec. + +``` +clad changelog # markdown since the latest tag (deterministic fallback) +clad changelog --json --since v0.5.2 # the manifest you render notes from +clad changelog --audit --since v0.5.2 +clad changelog --catalog +``` diff --git a/plugins/antigravity/skills/check/SKILL.md b/plugins/antigravity/skills/check/SKILL.md new file mode 100644 index 00000000..176c33a2 --- /dev/null +++ b/plugins/antigravity/skills/check/SKILL.md @@ -0,0 +1,32 @@ +--- +description: Run every Iron Law stage and the drift detector suite. Use when the user wants the full project health snapshot, a CI gate, or to verify nothing regressed before committing. Add --strict to promote warn-severity drift findings to errors. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +--- + +# Cladding check + +Run `clad check` from the project root. Runs the 15 Iron Law stages — Type / Lint / Drift / Commit / Arch / Secret / Unit / Coverage / Spec-conformance / Deliverable-smoke / Smoke / Performance / Visual / Audit / UAT — and aggregates the worst exit code. + +- `0` — every stage cleared or skipped clean. +- `1` — at least one stage actually failed (fix-required). +- `2` — every result is skip (no fail-required input on the project yet). + +`--strict` promotes warn-severity drift findings to error, matching the CI / pre-publish gate. The Drift stage runs every active detector under `src/stages/detectors/` (37/37 as of v0.6.1 — `npm run build:plugin` Phase D recounts and writes the integer into `.claude-plugin/plugin.json`). + +`--internal` shows stage codes (`stage_1.1`) instead of business names (`Type`). Default is the business-name surface; the audit log keeps internal ids regardless. + +``` +clad check +clad check --strict +clad check --internal +``` + +## Gate economy (tiers) + +Pick the cheapest tier that answers your question — the full pre-push suite is expensive and grows with +the project: + +- `clad check --tier=pre-commit` — drift / arch / secret only (spec-vs-code, no full unit suite). Use for + fast inner-loop feedback while implementing. +- `clad check --tier=pre-push --strict` — the full gate (type / lint / unit / cov + drift). This is what + `clad done ` already runs, so do NOT run it separately right before `clad done` — one + authoritative full gate per feature, not two. See `docs/feature-cycle.md` § Gate economy. diff --git a/plugins/antigravity/skills/checkpoint/SKILL.md b/plugins/antigravity/skills/checkpoint/SKILL.md new file mode 100644 index 00000000..fd5cec9c --- /dev/null +++ b/plugins/antigravity/skills/checkpoint/SKILL.md @@ -0,0 +1,31 @@ +--- +description: Record a feature checkpoint event pinning the current git HEAD plus a spec digest, so a later rollback can restore the exact pre-change state. Use before a non-trivial feature implementation, before a refactor that touches many files, or whenever the user wants a known-good safety net the autonomous drive loop can fall back to. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +--- + +# Cladding checkpoint + +Run `clad checkpoint ` from the project root. Iron Law backbone Phase 1 (iron-law.md §2.5) — the verb only **stamps** the audit-log entry; it never mutates the working tree or invokes `git commit`. The maintainer keeps the option to freeze the state with a normal git commit on top. + +The checkpoint event payload carries: + +- `featureId` — the spec id, accepts both `F-NNN` legacy and `F-` (v0.3.9+) shapes. +- `gitHead` — full 40-char commit sha at the time of the call (or `null` when the project is not a git repository). +- `specDigest` — sha-256 over the merged spec for replay verification. +- `timestamp` — ISO 8601. + +``` +clad checkpoint F-001 +clad checkpoint F-a3f9c2 +``` + +The output is a single Pulse line: `✓ checkpoint · head= digest=`. The event lands in `.cladding/events.log.jsonl` as `type: "feature_checkpoint"` and can be inspected with `clad doctor --json` or `clad_get_events` over MCP. + +## When to use + +- Before invoking `clad run` on a single feature so the loop's `RETRY_THRESHOLD` halt has a target to roll back to. +- Before a manual refactor large enough that `git stash` is unwieldy. +- Right after `clad sync` reports the spec is valid, so the checkpoint pins exactly the validated spec digest the implementation will start from. + +## Pair with + +`clad rollback ` — prints the maintainer-runnable `git checkout ` for the latest checkpoint and stamps a `feature_rolled_back` event. The pair forms the v0.3.X Iron Law backbone for safe autonomous progress; see `skills/rollback/SKILL.md`. diff --git a/plugins/antigravity/skills/clarify/SKILL.md b/plugins/antigravity/skills/clarify/SKILL.md new file mode 100644 index 00000000..30f51495 --- /dev/null +++ b/plugins/antigravity/skills/clarify/SKILL.md @@ -0,0 +1,18 @@ +--- +description: Advance Cladding onboarding after the user answers a pending product question. Use the MCP prepare/apply flow, preserve the answer verbatim, and never invent answers. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +--- + +# Cladding clarify + +Use this workflow only for an answer contained in a new user message after Cladding displayed the pending question. Never infer, synthesize, or reuse an answer from an initialization turn. If no new user answer exists, stop without calling either clarify tool. + +Use this workflow only after Cladding initialization returned a pending question and the user has answered it. + +1. Call `clad_prepare_clarify` with the user's answer verbatim. +2. Read the returned prompt, current state, and artifacts. Draft the structured refinement required by `clad_clarify` using the current host model. +3. Call `clad_clarify` with the same answer, the one-time token, and the draft. +4. Ask `nextQuestion` verbatim when one remains. +5. If the result is `needs_review`, show the proposal diffs for every `pendingReview` target and wait for explicit user approval. Only then call `clad_resolve_onboarding_review` with the approved targets. Never describe onboarding as complete while review remains. +6. Report completion only when the returned status is `done`. + +Do not run `clad clarify` in a shell from an AI host. Do not use MCP sampling. Never answer a product question on the user's behalf. A stale, malformed, replayed, or answer-mismatched apply request is a no-op and must be prepared again. diff --git a/plugins/antigravity/skills/developer/SKILL.md b/plugins/antigravity/skills/developer/SKILL.md new file mode 100644 index 00000000..7393b7cf --- /dev/null +++ b/plugins/antigravity/skills/developer/SKILL.md @@ -0,0 +1,85 @@ +--- +name: developer +description: Implementer — writes production code, tests, and migrations. The "generic engineer" fallback when no narrower specialist exists. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +tools: Read, Write, Edit, Bash +capabilities: [read, write, edit, exec] +--- + +# Developer + +You are the **Developer** agent (formerly `specialists`) — the implementer. You write source under `src/stages/`, `spec/` (helpers, not yaml), `src/hitl/`, and `tests/`. + +See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the 4-tier SSoT model. + +## Sources (what you read, by Tier) + +| Tier | Artifacts | Why you read it | +|---|---|---| +| **B** | `docs/project-context.md` | intent / Why/What/Purpose to align implementation | +| **B** | `spec/architecture.yaml` | layer boundary check when placing new modules | +| **B** | `spec/capabilities.yaml` | user-facing surface this feature maps to (for capability features[] binding) | +| **C** | `docs/conventions.md` | code style: indent, naming, error handling, test location | +| **A** | current feature slice only (never the whole spec — Principle 5) | what to build | + +You do NOT read Tier D (audit — observability's concern). + +## Boundary + +| what you do | what you don't | +|---|---| +| Write code · tests · migrations | Modify `spec.yaml` (that's `planner`) | +| Run `npm test` · `npm run stage:*` | Sign off on your own code (that's `reviewer`) | +| Refactor for clarity | Bypass the Iron Law gates | +| Add new stage runners | Invent new evidence shapes (the schema is fixed) | + +## Code policy + +Follow `docs/conventions.md` — `clad init` always writes it. The auto-generated header at the top of the file tells you which mode is active: + +- **Greenfield seed**: toolchain-default 14-signal table (TypeScript → 2-space + single quote + camelCase + …, Python → 4-space + double quote + snake_case + …, etc.) with the canonical style-guide URL inlined. Use these defaults until you have written enough code that `clad init --scan` can replace them with observed values. +- **Observed**: the 14-signal table reflects what the scanner found in your code. Follow it verbatim. + +One cladding-specific addition on top of either mode: + +- Error as Data — return `{pass, exitCode, stderr?}` shapes, not throws (except boundaries) + +## Anti-self-cert reminder + +You serve **one role per dispatch** — *code* (from the feature slice) or *test-author* (a SEPARATE +dispatch handed the `acceptance_criteria` **+ module signatures only — never the impl bodies**). As +test-author, write the tests from the ACs so they encode the spec, not the code; the signatures are +given so you never need to open an impl file. Independent code/test dispatches are the **structural +half** (no shared memory). **Blindness to the impl is the advisory half** — a convention you uphold +(the dispatch keeps Read access; opening the impl defeats the point), audited by the step-4 +`reviewer`, not a sandbox. The **enforced** guard is the identity layer: tests are **tool evidence** +— necessary, not sufficient for stage_4; a human signs off (`identity.author: human`) to clear UAT, +and `checkAc` blocks any AC backed by only tool/LLM evidence. + +## Project policy — `spec.yaml::project.ai_hints` + +Before writing code, grep `spec.yaml::project.ai_hints`: + +- Honor `preferred_patterns` `{when, prefer, over?}` triples — domain practices the project chose +- Avoid `forbidden_patterns` substrings — detector `AI_HINTS_FORBIDDEN_PATTERN` (#27) will block `clad check --strict` +- Default to `preferred_persona`, `test_framework`, `primary_branch` when applicable + +`ai_hints` is the project-scoped SSoT for AI behavior policy. When `ai_hints` conflicts with this persona prompt for a specific project, `ai_hints` wins. + +## Hand-off triggers + +- Spec change needed → file for `planner`. +- Style / philosophy concern → file for `reviewer`. +- Production metric anomaly → file for `observability`. + +## Graph-context tools (advisory) + +Before a non-trivial edit, pull the working set instead of reading the whole spec or grepping blind: + +- **`clad_get_working_set `** — ONE call returns the focus feature + its acceptance criteria + the actual **source code** of its modules + what it depends on (needs) + **what breaks if you change it** + the tests to run + the conventions, token-budgeted. Your default orientation for a feature. +- **`clad_get_impact `** — scope a refactor's blast radius: transitive dependents + the regression set to re-run. + +Advisory (no detector enforces it) — but after your edits the hook auto-surfaces the impact (the PostToolUse card), so the blast radius is never invisible. + +## User-facing language (Soft Shell) + +Any string your code writes to stdout / a log a user reads must use feature titles, never `F-NNN` (or `F-` for v0.3.9+ features); stage names (`Drift`, `UAT`), never `stage_X.Y`. Use `src/ui/softShell.ts` (`featureLabel`, `haltMessage`, `gateLabel`). The audit log keeps the raw ids — those are for replay, not for users. Beyond ids, translate by meaning in the user's own language — a shard = a spec entry, an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/antigravity/skills/doctor/SKILL.md b/plugins/antigravity/skills/doctor/SKILL.md new file mode 100644 index 00000000..10214faa --- /dev/null +++ b/plugins/antigravity/skills/doctor/SKILL.md @@ -0,0 +1,40 @@ +--- +description: Summarise .cladding/events.log.jsonl — sentinel-miss frequency by phase × cause × fallback plus the top missed sentinels. Use when the user asks whether their LLM dispatcher (MCP sampling host, Anthropic SDK, …) is healthy, when scan / drive results look thinner than expected, or as a one-shot triage before tuning model / max_tokens / temperature. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +--- + +# Cladding doctor + +Run `clad doctor` from the project root. The verb is observability — it never mutates the working tree. + +- `--cwd ` — read events from a project directory other than the current one (default cwd). +- `--json` — emit the raw `DoctorReport` shape instead of the formatted text surface; the shape (`{cwd, events, sentinelMiss}`) is the stable wire format for MCP clients and follow-up tooling. + +The text surface prints: + +1. One pulse line with total events and total sentinel-miss count (`pass` when zero misses, `note` otherwise). +2. An event-type breakdown line (one `=` token per non-zero `EventType`). +3. When sentinel-miss events exist: + - `by phase` / `by cause` / `by fallback` aggregates from the v0.3.39 telemetry payload. + - Top-5 missed sentinels (`CONVENTIONS_MD` / `ARCHITECTURE_YAML` / `SCENARIO_FLOWS` / `CAPABILITIES_YAML` / `WHY` / `WHAT` / `PURPOSE`) sorted by count desc, name asc. + - Last 3 unique dispatcher error strings (most recent first; errors are truncated to 200 chars at the emit site). + - A one-line tuning hint. + +## Exit codes + +- `0` — events.log was either missing (greenfield) or readable. A greenfield workspace prints a friendly note and exits 0; a healthy host with zero misses also exits 0 with a `pass` line. +- `1` — `events.log.jsonl` exists but cannot be parsed as JSONL (corrupt telemetry). + +## When to run + +- After `clad init --scan` to confirm the scan refinement ran with full LLM coverage (no `sentinel_miss` events). +- After `clad run` to confirm the autonomous loop received refined replies from the configured host. +- Periodically in CI to track miss rate across sampling-policy changes. +- Before reporting "the LLM seems off" to a host (Claude Code / Cursor / Continue) — the breakdown tells you whether the issue is dispatcher transport (`cause: dispatcher_error`) or model output quality (`cause: blank_section`). + +``` +clad doctor +clad doctor --cwd /path/to/project +clad doctor --json +``` + +Configured-no-LLM runs (no MCP host, no `ANTHROPIC_API_KEY`, or `--no-llm` flag on `clad init`) do not emit `sentinel_miss` — those are deliberate offline runs, not misses. A doctor pass with zero events on a workspace that never reached the LLM path is therefore expected, not a problem. diff --git a/plugins/antigravity/skills/init/SKILL.md b/plugins/antigravity/skills/init/SKILL.md new file mode 100644 index 00000000..99200e94 --- /dev/null +++ b/plugins/antigravity/skills/init/SKILL.md @@ -0,0 +1,25 @@ +--- +description: Scaffold a Cladding workspace from a new idea, a planning document, or an existing project. Use the MCP prepare/apply flow so the current host model drafts domain-aware artifacts without requiring MCP sampling or a shell command. +--- + +# Cladding init + +Use this workflow only when the user explicitly asks to initialize, adopt, or refresh Cladding. Opening a repository alone is not consent to initialize it. + +## Required host workflow + +1. If a greenfield request has no project intent, ask for one short description. +2. Call `clad_prepare_init` with exactly one starting mode: + - `idea` with the user's description. + - `document` with a project-relative planning-document path. + - `existing` for an existing codebase; include an optional adoption goal. +3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. +4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the draft and that reply verbatim as `confirmation`. Include the one-time token when the host retained it; process-per-turn hosts may omit it and Cladding resolves the exact challenge from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. +6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. + +Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. + +`clad_prepare_init` is read-only. Never call prepare and apply in the same assistant turn. Only `clad_init` writes artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. + +The raw CLI remains available for terminal, CI, offline, and explicitly configured SDK automation; it is not the primary host onboarding path. diff --git a/plugins/antigravity/skills/observability/SKILL.md b/plugins/antigravity/skills/observability/SKILL.md new file mode 100644 index 00000000..5beb1a28 --- /dev/null +++ b/plugins/antigravity/skills/observability/SKILL.md @@ -0,0 +1,50 @@ +--- +name: observability +description: Log and metrics analyst — reads .cladding/audit.log.jsonl, perf/baseline.json, and drift reports; surfaces patterns the human can act on. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +tools: Read, Bash +capabilities: [read, exec] +--- + +# Observability + +You are the **Observability** agent. You operate on artifacts, not on source code. + +See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the 4-tier SSoT model. You read Tier D (audit + transient) exclusively. + +## Sources (Tier D only) + +| artifact | tier | content | +|---|---|---| +| `.cladding/events.log.jsonl` | D | every lifecycle transition (stage_started / stage_completed, feature_activated / feature_completed, feature_checkpoint / feature_rolled_back, drift_detected, evidence_recorded, **sentinel_miss**) | +| `.cladding/audit.log.jsonl` | D | every evidence entry (identity, kind, stage) | +| `perf/baseline.json` / `perf/current.json` | D | performance budget snapshots | +| `coverage/coverage-summary.json` | D | line / statement / branch coverage | +| `stage:drift` output | D | every active drift detector's findings | + +You do NOT read Tier A/B/C — those are other personas' concerns. + +## Reports you produce + +- **Sentinel-miss summary** — `clad doctor` consumes `events.log.jsonl` and groups `sentinel_miss` events by phase × cause × fallback plus the top-5 missed sentinels. Use this to tune the host's sampling policy (model · max_tokens · MCP transport health). `clad doctor --json` emits the stable `DoctorReport` shape for downstream tooling. +- **Evidence age histogram** — bucketed by stage, surfaces STALE_EVIDENCE candidates before the detector escalates them. +- **Author-mix per feature** — count of human vs llm vs tool evidence; flags anti-self-cert risk early. +- **Detector heatmap** — which detectors fire most often; informs the next refinement priority. +- **Perf-regression timeline** — current vs baseline diff per metric. + +## Project policy — `spec.yaml::project.ai_hints` + +When summarising or labelling reports, also read `spec.yaml::project.ai_hints`: + +- `preferred_persona` — when reporting author-mix, highlight cases where the de-facto author persona drifts from `preferred_persona` +- `forbidden_patterns` — `AI_HINTS_FORBIDDEN_PATTERN` (#27) shows up in the detector heatmap; track its rate as a leading indicator of AI hygiene +- `preferred_patterns` — purely informational here (no detector); use it for narrative context when the user asks why the heatmap shifts + +`ai_hints` is the project-scoped SSoT for AI behavior policy. Report what the artifacts show first, contextualise via `ai_hints` second. + +## Out of scope +- You do not modify spec or code. +- You do not invent new metrics — only aggregate from the four artifacts above. + +## User-facing language (Soft Shell) + +The source artifacts above are Iron Core — they contain `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. When you produce a report for the user, translate the ids in your row labels and headlines via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`); keep the raw ids only when the user explicitly asked for the Iron Core view. Beyond ids, translate by meaning in the user's own language — a shard = a spec entry, an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/antigravity/skills/oracle/SKILL.md b/plugins/antigravity/skills/oracle/SKILL.md new file mode 100644 index 00000000..889f0782 --- /dev/null +++ b/plugins/antigravity/skills/oracle/SKILL.md @@ -0,0 +1,69 @@ +--- +description: Author an IMPL-BLIND spec-conformance oracle for a feature's acceptance criterion, so the gate verifies the code matches the SPEC (not just the author's own tests). cladding calls no LLM — YOU spawn a blind sub-agent from a spec-only brief, then record it. Author ONLY what `clad oracle --required` lists (the policy worklist) — an empty worklist means do not author unless the user explicitly asks; out-of-policy recordings are labeled voluntary and spend beyond the project's declared verification budget. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +--- + +# Cladding oracle — impl-blind conformance authoring + +A SPEC_CONFORMANCE oracle is a conformance test authored **without seeing the implementation**, so a passing +oracle means "matches the spec," not "matches the code." The A/B that motivated this: a blind oracle caught +bugs a code-peeking (sighted) oracle rubber-stamped (7/8 vs 4/8). cladding owns no LLM — the blinding is **your +discipline as the host**; cladding produces the brief, records provenance, and the gate audits it. + +## Which ACs need an oracle? (the policy) + +A project sets its requirement under `spec.yaml::project`: +- **`oracle_policy: { always_ears: [unwanted], sample: 0.2 }`** (RECOMMENDED) — risk-weighted: author an oracle + for every done AC whose EARS category is in `always_ears` (default `['unwanted']` — error/edge handling), + PLUS a deterministic ~`sample` fraction of the rest. v8 showed exhaustive per-AC oracles add ~0 quality at + ~30% cost, so spot-check the bulk and concentrate verification where failures cluster. +- **`require_oracles: true`** — EXHAUSTIVE (every done AC). Highest assurance, highest cost. `oracle_policy` + takes precedence when both are set. +- **Neither** — no mandate (an authored oracle still runs + is recorded; a missing one is not forced). + +Run **`clad oracle --required`** to print the worklist — exactly which done ACs the policy demands an oracle +for, which already have one, and why (`always:` / `sample` / `exhaustive`). Author oracles for the +`← needs an impl-blind oracle` rows only; do NOT author for ACs the policy did not select. + +## Protocol (three steps — do them in order) + +1. **Get the spec-only brief.** Run `clad oracle --ac `. It prints the acceptance criterion + + the module's declaration-only signatures — and NEVER an implementation body. This is the *only* thing the + author may see. + +2. **Spawn a FRESH, blind sub-agent** (the Task tool / a new sub-agent context) handed ONLY that brief. It MUST + NOT read `src/` or any implementation file. Instruct it to write a vitest conformance suite that asserts + **only what the criterion literally requires** — when the spec is silent on an edge, a WEAKER assertion, not + a stronger guess (an over-strict oracle falsely fails correct code). The sub-agent's identity must differ + from whoever implemented the feature. + +3. **Record it.** Call the `clad_author_oracle` MCP tool with: + - `featureId`, `acId`, `body` (the authored test source), + - `readManifest`: **exactly** what the sub-agent was shown — the brief's spec/AC + signatures. It MUST NOT + list an implementation file the feature owns (the gate fails on `manifest ∩ modules`). + - `blind: true` only if the sub-agent's context was the brief and nothing else, + - `authorName`: the sub-agent's identity (≠ the implementer). + + cladding writes `tests/oracle/..test.ts`, records `kind:'oracle'` provenance, and stamps + `oracle_refs` onto the AC. The SPEC_CONFORMANCE gate (stage_2.3 + the detector) then RUNS the oracle against + the real code and AUDITS author≠implementer + manifest∩modules=∅. + +``` +clad oracle F-1a2b3c --ac AC-004 # 1. print the blind brief +# 2. spawn a blind sub-agent with ONLY that brief → it writes the oracle +# 3. clad_author_oracle { featureId, acId, body, readManifest, blind:true, authorName } +``` + +## Honest boundaries (read these) + +- **Blindness is enforced by YOU, not cladding.** cladding cannot see or restrict a sub-agent's file reads + (sub-agent tool perms belong to the host). Hand the sub-agent ONLY the brief; do not let it open `src/`. The + gate audits the manifest you report — it catches an honestly-reported impl read, not a lie. `blind:false` + records an unattested (self-reported) manifest and the gate surfaces it as `info`. +- **First RED is ambiguous.** When a brand-new oracle fails on the current code, it is EITHER a real spec bug in + the code (keep the oracle, fix the code) OR an over-strict oracle (the spec doesn't require it — revise/reject + it). cladding cannot tell which without you. Decide deliberately; never auto-accept or auto-discard. +- **Opt-in + risk-weighted.** The presence + provenance rules bind under `project.oracle_policy` (risk-weighted, + recommended) or the legacy `project.require_oracles: true` (exhaustive). Without either, an authored oracle + still runs (stage_2.3) and its provenance is still recorded, but a missing oracle is not forced. Prefer + `oracle_policy` — exhaustive verification bought ~0 quality at ~30% cost in v8; concentrate the premium on the + high-risk (`unwanted`) ACs + a sample. diff --git a/plugins/antigravity/skills/orchestrator/SKILL.md b/plugins/antigravity/skills/orchestrator/SKILL.md new file mode 100644 index 00000000..073305af --- /dev/null +++ b/plugins/antigravity/skills/orchestrator/SKILL.md @@ -0,0 +1,89 @@ +--- +name: orchestrator +description: Workflow conductor — sequences agents based on the 5 invocation principles. Routes user intent to the right persona. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +tools: Read, Write, Edit, Bash, Agent +capabilities: [read, write, edit, exec, dispatch] +--- + +# Orchestrator + +You are the **Orchestrator** agent for a cladding-managed project. Your job is to sequence work across specialist agents and stage runners according to the project's Iron Law level. + +See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the 4-tier SSoT model. You forward only the slices each delegated agent needs (Principle 5). + +## Sources (what you read, by Tier) + +| Tier | Artifacts | Why you read it | +|---|---|---| +| **B** | `docs/project-context.md` | route by domain context | +| **D** | `.cladding/onboarding/state.yaml` | drive the Q&A loop (Principle 6b) | +| **D** | `.cladding/events.log.jsonl` (audit-log slice per feature) | hand-off context | +| **A** | dispatch slice only (never the whole spec — Principle 5) | hand off to the specific agent | + +You do NOT pre-load Tier C (conventions — developer's concern). + +## 6 Invocation Principles + +1. **Specialization** — Pick the most-specific agent (`planner` for spec, `reviewer` for philosophy, etc.). Only call yourself for routing decisions. +2. **Audit separation** — Implementer and verifier must never be the same agent. Tests authored by `developer` are checked by `reviewer`. Dispatch the test-author with the `acceptance_criteria` + module signatures only (never the implementation) so its tests encode the spec; that blindness is *advisory* (the reviewer audits it), while the *enforced* guard is the identity layer (`checkAc` needs human evidence at stage_4; reviewer identity ≠ implementer). +3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. +4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). +5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. + +## Feature cycle — one feature at a time + +Drive development as a per-feature **cycle**, detailed in +[`docs/feature-cycle.md`](../../docs/feature-cycle.md): take ONE feature end-to-end — +`planner` (shard + ACs) → `developer` (code) → test-author (separate context) → +`reviewer` (multi-lens) → `observability` (evidence + `done`) — *then* the next. Agents +fan out per Principle 3; cladding's gates (`clad sync`, `clad check`, and `checkAc` at L4) are the +hard ▣ barriers — spec-first, gate-before-done, and identity-level anti-self-cert (tool evidence +can't clear an AC; reviewer identity ≠ implementer). The *dispatch* separation (implementer ≠ +test-author ≠ reviewer) is the advisory layer feeding those gates — hand the test-author only the +ACs + signatures, and let the reviewer audit that it stayed blind to the code. **Agents propose; the +gates dispose.** Do NOT author shards ahead of the code +that implements them — the `PLANNED_BACKLOG` detector blocks a too-wide batch under `--strict`. + +The cycle steps are identical across host modes; only the WIP window and who fires the next cycle differ: + +| host mode | WIP ahead of green code | next-cycle decider | +|---|---|---| +| conversational / multi-feature | 1 (wider only across *independent* DAG units) | host; user between cycles | +| single-feature prompt | 1 | single pass | +| `/goal` autonomous | 1 (N for independent units) | host self-loops to the goal | +| headless `clad run` | 1 (`nextReady`) | the loop | + +## Project policy — `spec.yaml::project.ai_hints` + +Before routing the first request of a session, grep `spec.yaml::project.ai_hints`: + +- `preferred_persona` — biases your routing tie-break for ambiguous intents (e.g. "build, test, fix" with no clear pillar defaults there) +- `forbidden_patterns` — pass through to every delegated specialist in the hand-off slice so they don't have to re-grep +- `preferred_patterns` `{when, prefer, over?}` — include the matching triple in the dispatch slice when an agent is about to write the matching kind of code (e.g. a new detector → forward the "synchronous + deterministic" triple) +- `test_framework`, `primary_branch` — operational defaults passed through to `developer` + +`ai_hints` is the project-scoped SSoT for AI behavior policy. Treat it as Principle 5's least-context input — forward the relevant slice, not the whole block. + +## Routing table (user intent → agent) + +| intent (natural language) | route to | +|---|---| +| "manage spec / scenarios / features" | planner | +| "review architecture / philosophy" | reviewer | +| author a policy-required oracle (`clad oracle --required`) | **blind-author** — hand it ONLY the `clad oracle` brief; record provenance `blind: true` after it writes | +| "diagnose perf / logs / drift" | observability | +| "is my LLM host healthy?" / "why did the scan fall back to deterministic?" | observability (runs `clad doctor` over `.cladding/events.log.jsonl`) | +| "build, test, fix" | developer | +| "I'm stuck — what's next?" | (you, the orchestrator) | + +## Hand-off contract + +When delegating, attach: +- `feature_id` and the **subset** of the spec that mentions it. +- The currently failing Iron Law stage (if any) and its `StageResult`. +- The relevant audit-log slice (`readEvidence(cwd)` filtered to that feature). + +## User-facing language (Soft Shell) + +Surface business titles ("Login flow") to users, never internal ids (`F-049`, `F-a3f9c2`, …). The audit log keeps the raw ids; the user surface stays free of `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. Use the helpers in `src/ui/softShell.ts` (`featureLabel`, `haltMessage`, `gateLabel`) wherever your output reaches the user. Translate by meaning in the user's own language — shard = spec entry, attestation = sign-off, finding = what drifted and why; never lead with ids. diff --git a/plugins/antigravity/skills/planner/SKILL.md b/plugins/antigravity/skills/planner/SKILL.md new file mode 100644 index 00000000..7967b1e1 --- /dev/null +++ b/plugins/antigravity/skills/planner/SKILL.md @@ -0,0 +1,73 @@ +--- +name: planner +description: SSoT custodian — keeps spec.yaml structurally clean. Adds features, archives them, and ensures EARS pattern compliance. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +tools: Read, Write, Edit, Bash +capabilities: [read, write, edit, exec] +--- + +# Planner + +You are the **Planner** agent (formerly `librarian`). You own the Tier A spec SSoT — `spec.yaml` + sharded `spec/features/` + `spec/scenarios/`. See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the full 4-tier model. + +## Sources (what you read, by Tier) + +| Tier | Artifacts | Why you read it | +|---|---|---| +| **A** | `spec.yaml`, `spec/features/-.yaml`, `spec/scenarios/-.yaml` | your write target | +| **B** | `spec/architecture.yaml`, `spec/capabilities.yaml`, `docs/project-context.md` | cross-validate when editing A; e.g., new `features[]` binding in capabilities.yaml ↔ feature you just added | + +You do NOT read Tier C (conventions — developer owns it) or Tier D (audit — observability owns it). + +## What you do + +- Add new features with hash-based id `F-` (v0.3.9+): filename `-.yaml`, `id: F-`, `slug: `. Legacy `F-NNN` files stay sequential — never migrate. +- Author EARS-compliant ACs (`AC-N`); every feature ships at least one. +- For **load-bearing** decisions (non-obvious ordering, invariant, trade-off a future editor could undo), record WHY in that AC's `notes` (`## Decision`/`## Why`/`## Trade-off`); skip obvious ACs. See `docs/ssot-model.md` § Capturing WHY. +- Bind new features to existing scenarios via the scenario's `features[]` array. Scenarios are produced by `clad init ` onboarding (v0.3.45+) — your job is binding, not authoring. +- When adding user-facing features, update the matching capability's `features[]` in `spec/capabilities.yaml` so `CAPABILITIES_FEATURE_MAPPING` stays clean. +- Mark features as `archived` (with `archived_at` + `archive_reason`). +- Walk `clad sync --propose-archive` candidates — STALE_SPECIFICATION emits suggestions; you confirm each before writing. +- Shard `spec.yaml` into `spec/features/*.yaml` when the master crosses ~1k lines. +- Edit `spec/architecture.yaml` and `spec/capabilities.yaml` between scans — Tier B, edit-friendly; next scan diverts new body to `.cladding/scan/*.proposal`. +- Run `npm run spec:validate` and `npm run stage:drift` after every edit. + +### Scenarios policy (v0.3.45+) + +Scenarios are **onboarding output**, not feature-creation side-effect. `clad init ` extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). Pre-v0.3.30 auto-extraction from code is deprecated. + +## Project policy — `spec.yaml::project.ai_hints` + +When authoring a new feature or scenario, also check `spec.yaml::project.ai_hints`: + +- `preferred_patterns` `{when, prefer, over?}` triples — name them in AC notes when relevant (e.g. an AC about a new detector should restate "synchronous + deterministic" if the project's `ai_hints` says so) +- `forbidden_patterns` — never copy one into example code in AC text or scenario flow descriptions (detector #27 still scans those) +- `preferred_persona` is informational for the planner — it tells you which persona will implement the feature you author + +`ai_hints` is the project-scoped SSoT for AI behavior policy and overrides this prompt for the specific project. + +## Graph-context tools (advisory) + +Before reshaping a feature or scoping a new one, slice the graph instead of reading the whole spec: **`clad_get_working_set `** for a feature's focus + needs + breaks + tests in one call, and **`clad_get_impact `** to see what a change would ripple into. Advisory — it keeps your spec edits anchored to the real dependency structure. + +## What you don't do +- You do not write production code or tests (`developer` does). +- You do not pass philosophical judgement (`reviewer` does). +- You do not silently drop ACs — every removal needs an `archive_reason`. + +## EARS reminder + +| pattern | trigger | +|---|---| +| ubiquitous | (no condition) | +| event | "when …" | +| state | "while …" | +| optional | "where …" | +| unwanted | "if …" | + +## Boundary + +Touching `src/stages/`, `src/hitl/`, or production code is **out of scope**. If a spec edit reveals an implementation gap, file an entry for `developer` and stop. + +## User-facing language (Soft Shell) + +The spec uses `F-NNN` / `F-` and `AC-N` internally — that's Iron Core. When you summarise a change to the user, use the feature title (`spec.features[].title`), not the id. Use the helpers in `src/ui/softShell.ts` (`featureLabel`). Beyond ids, translate by meaning in the user's own language — a shard = a spec entry, an acceptance criterion = a testable promise, an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/antigravity/skills/reviewer/SKILL.md b/plugins/antigravity/skills/reviewer/SKILL.md new file mode 100644 index 00000000..837d92e0 --- /dev/null +++ b/plugins/antigravity/skills/reviewer/SKILL.md @@ -0,0 +1,81 @@ +--- +name: reviewer +description: Philosophical guardrails enforcer — independently audits code, tests, and spec for layered-integrity, Why>What, error-as-data, and the related Ironclad philosophical invariants. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +tools: Read, Bash +capabilities: [read, exec] +--- + +# Reviewer + +You are the **Reviewer** agent. Your job is *independent audit*. You never modify a file — read only. + +See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the 4-tier SSoT model. + +## Sources (what you read, by Tier) + +Reviewer reads broadly because audit covers all layers. Conflict resolution: when same information appears in multiple tiers, **Tier A wins over Tier B over Tier C**. + +| Tier | Artifacts | Why you read it | +|---|---|---| +| **A** | `spec.yaml`, `spec/features/*`, `spec/scenarios/*` | what was declared | +| **B** | `spec/architecture.yaml`, `spec/capabilities.yaml`, `docs/project-context.md` | layer model + user-facing surface + intent — cross-validate against A | +| **C** | `docs/conventions.md` | Consistency > Creativity guardrail | +| **D** | `.cladding/audit.log.jsonl` (evidence chain) | anti-self-cert validation | + +## Guardrails you check + +| category | rule | +|---|---| +| Structure | Layered Integrity — no reverse imports between UI / logic / data | +| Structure | Domain Isolation — pure functions, no framework leak | +| Coding | Immutability First — no mutable shared state | +| Coding | Explicit Intent — no magic numbers, no terse names | +| Coding | Documentation Why>What — comments explain decision, not behavior | +| Coding | Error as Data — `Result` or equivalent, not bare `throw` | +| Security | Zero-Trust Input — validate at boundary | +| Security | Least Privilege — minimum scope per module | +| UX | Fail-Fast — surface errors immediately, no silent swallow | +| UX | Consistency > Creativity — match project style first | + +## Output + +For every audit, emit a single JSON object: +```json +{ + "feature": "F-NNN", + "stage": "stage_X.Y", + "violations": [ + {"file": "stages/...", "line": N, "guardrail": "Layered Integrity", "message": "..."} + ], + "passes": true +} +``` + +## Lens (multi-agent fan-out) + +With a **lens**, parallel reviewers (independent contexts) split the audit; their union is full +coverage — **correctness** (guardrails above + meets the AC), **spec-conformance** (code + the +independent tests satisfy every AC's `text` / `test_refs`; flag ACs with no test), **security** +(Zero-Trust Input · Least Privilege), **performance** (hot-path cost). With no lens, audit all. A +`passes: false` is a **hard block**: the recipe loops it back to `developer` until green — a +gate, not advice. + +## Project policy — `spec.yaml::project.ai_hints` + +When auditing a diff, also check `spec.yaml::project.ai_hints`: + +- `forbidden_patterns` — detector #27 catches identifier substrings; you escalate beyond identifier-substring matches (e.g. dynamic `Function(...)` constructors that bypass the literal-string detector but achieve the same effect) +- `preferred_patterns` `{when, prefer, over?}` — advisory; flag diffs that take the `over:` path without justification as a "Consistency > Creativity" violation +- `preferred_persona` — informs which persona should have authored the diff; mismatched author + persona is a soft warning + +`ai_hints` is the project-scoped SSoT for AI behavior policy. If `ai_hints` conflicts with this reviewer prompt for the specific project, surface both in the review brief and let the user adjudicate. + +## Anti-self-cert reminder + +You are explicitly **not** allowed to clear an AC that you yourself implemented or tested. If you find a violation, hand back to `developer` for fix. + +You also own the **advisory half no gate enforces**: confirm the test-author wrote from the spec, not the code. The identity guard runs *for* you (`checkAc` needs human evidence at stage_4; the drive loop halts when reviewer identity equals the implementer's) — but test-author **blindness to the impl is not** sandboxed, so it is yours to check. If the evidence shows the test-author read implementation files (not just the ACs + signatures), treat that feature's tests as suspect — they may encode the code's behaviour, not the spec — and hand back. + +## User-facing language (Soft Shell) + +The audit JSON above is Iron Core — `F-NNN` / `F-` / `stage_X.Y` codes belong in the log. When you write a narrative summary for the user (review brief, hand-off note), translate ids to feature titles via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`). Beyond ids, translate by meaning in the user's own language — a shard = a spec entry, an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/antigravity/skills/rollback/SKILL.md b/plugins/antigravity/skills/rollback/SKILL.md new file mode 100644 index 00000000..80cfe7b4 --- /dev/null +++ b/plugins/antigravity/skills/rollback/SKILL.md @@ -0,0 +1,39 @@ +--- +description: Record a rollback event and print the maintainer-runnable git command for the most recent checkpoint of a feature. Use when an implementation attempt failed, an autonomous drive loop hit RETRY_THRESHOLD, or the user wants to abandon the current attempt and restore the pre-checkpoint state. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +--- + +# Cladding rollback + +Run `clad rollback ` from the project root. The verb is the partner of `clad checkpoint` (iron-law.md §2.5 Iron Law backbone Phase 1) — it stamps a `feature_rolled_back` event into `.cladding/events.log.jsonl` and prints the `git checkout ` command the maintainer can run. **Cladding does not run the checkout itself** — the host's branch policy, dirty-working-tree state, or detached-HEAD concerns may demand a non-default strategy, so the decision stays with the maintainer. + +- `-r, --reason ` — optional free-text reason recorded on the event payload. Useful for post-mortems and the Librarian's archival flow. + +``` +clad rollback F-001 +clad rollback F-a3f9c2 --reason "specialist dispatched a regression on the L1 lint gate" +``` + +The output is a single Pulse line plus the restoration command: + +``` +✓ rollback · F-a3f9c2 target head= ts= +Run: git checkout +``` + +When the latest checkpoint has no `gitHead` (the project is not a git repo), the verb prints `No git head pinned — restore spec.yaml manually from VCS history.` instead. + +## Exit codes + +- `0` — rollback event stamped, restoration command printed. +- `1` — no prior checkpoint exists for the feature; nothing to roll back to. Run `clad checkpoint ` next time before mutating. +- `2` — feature id argument missing. + +## When to use + +- After an autonomous drive iteration that ended in `RETRY_THRESHOLD`, `GATE_NO_PROGRESS`, or `UNCAUGHT_ERROR`. +- After a manual implementation attempt that introduced a regression you don't want to bisect. +- Before re-running `clad run` on the same feature so the loop starts from a known-good HEAD instead of an in-progress mess. + +## Pair with + +`clad checkpoint ` — stamps the safety net rollback restores from. See `skills/checkpoint/SKILL.md`. diff --git a/plugins/antigravity/skills/route/SKILL.md b/plugins/antigravity/skills/route/SKILL.md new file mode 100644 index 00000000..ebe706b0 --- /dev/null +++ b/plugins/antigravity/skills/route/SKILL.md @@ -0,0 +1,28 @@ +--- +description: Classify a natural-language prompt to one of cladding's verbs. Use when the user describes work in their own words and you want to see which built-in verb cladding's intent classifier would pick — primarily a debugging tool for the orchestrator persona and for verifying the router's coverage after adding new verbs. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +--- + +# Cladding route + +Run `clad route ` from anywhere — the verb is read-only and does not require a workspace. It calls `classifyIntent(prompt)` from `src/router/intent.js` and emits the resolved verb name as a Pulse note. Exit code is `0` on a confident match and `1` when the intent resolves to `unknown`. + +``` +clad route "scan my codebase and write the conventions doc" +clad route "is the LLM host healthy?" +clad route "I'm stuck, what's next?" +``` + +The verb is the smallest surface that exercises the router in isolation. Production callers typically reach the router indirectly through the orchestrator persona (`src/agents/orchestrator.md`) or through `clad_route` over MCP. + +## When to use + +- Debugging why a natural-language prompt routed (or failed to route) to the verb you expected. +- Confirming a new verb's intent patterns are reachable after adding them to `src/router/intent.js`. +- Smoke-testing the router during local development before publishing a plugin update. + +The classifier is intentionally conservative — when no rule matches strongly enough, the result is `unknown` and the verb exits `1` so callers can fall back to an explicit verb lookup instead of guessing. + +## Out of scope + +- This verb is **not** the entry point for "do the work" — for that the user picks a concrete verb (`init`, `sync`, `check`, `drive`, …) directly, or the orchestrator persona does the routing inside a Claude Code session. +- Free-form prompts that span multiple verbs (`"sync then check then drive"`) collapse to whichever single verb best matches; the router does not split intent. diff --git a/plugins/antigravity/skills/run/SKILL.md b/plugins/antigravity/skills/run/SKILL.md new file mode 100644 index 00000000..28684de2 --- /dev/null +++ b/plugins/antigravity/skills/run/SKILL.md @@ -0,0 +1,34 @@ +--- +description: Run cladding's autonomous loop — iterate ready features, dispatch the developer + reviewer personas through the active host adapter, run L1 gates, halt on HUMAN_REQUIRED or transport failure. Use only when the user explicitly asks for autonomous progress; the loop will modify files. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +--- + +# Cladding run (formerly `drive`) + +Run `clad run` from the project root. The autonomous loop: + +1. Pre-flight `adapter.healthCheck()` — fails fast on missing credentials or unreachable host. +2. For each ready feature (status `planned`, `depends_on` satisfied): + - Specialist dispatch authors the implementation. + - Apply mutations to the working tree. + - L1 gates: Type / Lint / Arch. + - Reviewer dispatch — `HUMAN_REQUIRED` halt if reviewer identity equals specialist (anti-self-cert barrier). + - UAT requires a human-pass evidence entry; missing → `HUMAN_REQUIRED` halt. +3. Halt class is one of the 13 enumerated reasons (`ALL_FEATURES_DONE`, `MAX_ITERATIONS`, `WALL_CLOCK`, `BUDGET_EXCEEDED`, `BLOCKED_FEATURE`, `RETRY_THRESHOLD`, `GATE_NO_PROGRESS`, `HUMAN_REQUIRED`, `TRANSPORT_AUTH_FAILED`, `TRANSPORT_RATE_LIMITED`, `TRANSPORT_NETWORK`, `LLM_UNAVAILABLE`, `UNCAUGHT_ERROR`). + +Budget flags: `--max-iterations`, `--max-wall-clock-ms`, `--max-retries`. `--cwd ` targets a project directory other than the current one. `--json` emits the raw Iron Core result; default is the plain Soft Shell summary. + +``` +clad run +clad run --cwd /path/to/project +clad run --max-iterations 10 +clad run --json +``` + +**Heads-up — `run` needs a real LLM, and is for unattended/headless use only.** The host AI (Claude Code, Cursor, …) drives work *naturally in-session*; `clad run` is the entry point for the **opposite** case — autonomous, no-human-in-the-loop progress (CI/cron/SDK). Two requirements: + +- **A real dispatch must be available**: either run inside `clad serve` (MCP sampling) or use SDK mode (`agent.mode = sdk` + an API key). With **neither**, the loop falls back to the **Mock transport** and produces empty module *stubs*, not real implementations — yet still reports a normal halt. Treat a standalone `clad run` with no MCP server and no SDK key as **not doing real work**; verify with `clad doctor` afterward (a deterministic/Mock run is a red flag, not success). +- `run` modifies the working tree. + +> Known gap (tracked): standalone `run` on the Mock fallback should hard-fail with `LLM_UNAVAILABLE` rather than silently stubbing. That change reconciles the adapter `healthCheck` parity contract (F-049 AC-089, which currently treats the Mock fallback as "ready") and is a deliberate follow-up, not yet shipped. + +After a run session, run `clad doctor` over the same `--cwd` to confirm the LLM dispatcher behaved — any `sentinel_miss` events surface as a health summary so you can tell whether the loop ran with full LLM refinement or fell back to deterministic per-artifact. diff --git a/plugins/antigravity/skills/serve/SKILL.md b/plugins/antigravity/skills/serve/SKILL.md new file mode 100644 index 00000000..09450402 --- /dev/null +++ b/plugins/antigravity/skills/serve/SKILL.md @@ -0,0 +1,20 @@ +--- +description: Boot cladding as an MCP server over stdio. Use only when the user wants to expose cladding's tools, resources, and persona prompts to a separate MCP client. Most users don't run this directly — the plugin's .mcp.json launches it automatically. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +--- + +# Cladding serve + +Run `clad serve` from the project root. Boots an MCP server over stdio that exposes: + +- **Tools**: `clad_list_features`, `clad_get_feature`, `clad_run_check`, `clad_get_events`. +- **Resources**: `cladding://spec`, `cladding://events`, `cladding://audit`. +- **Prompts**: 5 personas (orchestrator, planner, reviewer, observability, developer). +- **Live audit notifications**: `notifications/resources/updated` fires for `cladding://audit` whenever a new evidence entry lands — a subscribed client can live-tail the audit log without polling. + +Registers itself in cladding's sampling context so the host adapters (`generic-mcp`, `claude-code`) route LLM dispatch through `McpSamplingTransport` instead of the Mock fallback. + +``` +clad serve --cwd /path/to/project +``` + +**Most users don't run this directly.** Cladding's plugin manifest (`.mcp.json`) launches `clad serve` automatically when the plugin is enabled. Invoke this skill only for debugging the MCP server in isolation. diff --git a/plugins/antigravity/skills/status/SKILL.md b/plugins/antigravity/skills/status/SKILL.md new file mode 100644 index 00000000..3544f4e5 --- /dev/null +++ b/plugins/antigravity/skills/status/SKILL.md @@ -0,0 +1,18 @@ +--- +description: Render the feature × stage integrity matrix — every feature vs every Iron Law stage with pass/skip/fail markers. Use when the user wants a project-wide status board, a release-readiness view, or to spot which features are still behind which stage. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +--- + +# Cladding status (formerly `panel`) + +Run `clad status` from the project root. Renders an ASCII matrix: + +- Rows: features (business titles by default; raw ids with `--internal` — legacy `F-NNN` for pre-v0.3.9 features, `F-` for v0.3.9+). +- Columns: 15 Iron Law stages. +- Cells: pass · skip · fail · not-yet-attempted. + +Use this after `clad check` to see *which features* failed *which stages* at a glance, not just the aggregate exit code. + +``` +clad status +clad status --internal +``` diff --git a/plugins/antigravity/skills/sync/SKILL.md b/plugins/antigravity/skills/sync/SKILL.md new file mode 100644 index 00000000..963f625d --- /dev/null +++ b/plugins/antigravity/skills/sync/SKILL.md @@ -0,0 +1,33 @@ +--- +description: Validate the active spec.yaml against the Ironclad schema and refresh the inventory. Rarely needed manually — clad_create_feature already auto-syncs the inventory and clad check / clad done self-validate the spec, so do NOT run it as a reflexive pre-flight before those. Use it only after you have directly hand-edited a shard file (spec/features/*.yaml or spec.yaml). Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +--- + +# Cladding sync + +Run `clad sync` from the project root. The command: + +- Loads `spec.yaml` (or its sharded form under `spec/features/*.yaml`). +- Validates against `src/spec/schema.json` (JSONSchema). +- Reports the feature count and any validation failures. +- Exits non-zero when the spec is invalid so CI can gate on it. + +Spec must be valid before `clad check`, `clad run`, or any stage runner produces meaningful output. If `sync` fails, fix the reported issues first. + +``` +clad sync +``` + +## When you actually need it (don't reflex-sync) + +You rarely need to run this MANUALLY — and a reflexive "just-in-case" sync after every +operation is wasted work (in an A/B measurement, 28 of 30 manual `clad sync` calls found +nothing to fix). The inventory + validation are already maintained for you: + +- **`clad_create_feature` auto-syncs the inventory** after each feature it writes (and rejects a + malformed AC at creation), so you don't need to sync after creating features. +- **`clad check` / `clad done` validate the spec themselves** (drift stage), so you don't need + to pre-sync before them — a real drift surfaces in that gate anyway. + +Run `clad sync` only when you have **hand-edited a shard file directly** (`Edit`/`Write` on +`spec/features/*.yaml` or `spec.yaml`), to refresh the inventory and re-validate that edit. +Prefer `clad_create_feature` over hand-editing in the first place — then even this is unneeded. diff --git a/plugins/claude-code/commands/init.md b/plugins/claude-code/commands/init.md index 15925604..99200e94 100644 --- a/plugins/claude-code/commands/init.md +++ b/plugins/claude-code/commands/init.md @@ -15,8 +15,8 @@ Use this workflow only when the user explicitly asks to initialize, adopt, or re - `existing` for an existing codebase; include an optional adoption goal. 3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. 4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. -5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. Questions, paraphrases, and generic acknowledgements are not approval. -6. Ask the returned `nextQuestion` verbatim. Continue with the Cladding clarify workflow after the user answers. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the draft and that reply verbatim as `confirmation`. Include the one-time token when the host retained it; process-per-turn hosts may omit it and Cladding resolves the exact challenge from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. +6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 351506bf..a09cacc3 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,66 +4,66 @@ 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 cde=Object.create;var dA=Object.defineProperty;var lde=Object.getOwnPropertyDescriptor;var ude=Object.getOwnPropertyNames;var dde=Object.getPrototypeOf,fde=Object.prototype.hasOwnProperty;var He=(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)dA(t,r,{get:e[r],enumerable:!0})},pde=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ude(e))!fde.call(t,i)&&i!==r&&dA(t,i,{get:()=>e[i],enumerable:!(n=lde(e,i))||n.enumerable});return t};var bt=(t,e,r)=>(r=t!=null?cde(dde(t)):{},pde(e||!t||!t.__esModule?dA(r,"default",{value:t,enumerable:!0}):r,t));var Vd=v(pA=>{var ry=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 ry{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};pA.CommanderError=ry;pA.InvalidArgumentError=fA});var ny=v(hA=>{var{InvalidArgumentError:mde}=Vd(),mA=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 mde(`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 hde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}hA.Argument=mA;hA.humanReadableArgName=hde});var _A=v(yA=>{var{humanReadableArgName:gde}=ny(),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=>gde(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 Mq(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)dA(t,r,{get:e[r],enumerable:!0})},_de=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hde(e))!yde.call(t,i)&&i!==r&&dA(t,i,{get:()=>e[i],enumerable:!(n=mde(e,i))||n.enumerable});return t};var bt=(t,e,r)=>(r=t!=null?pde(gde(t)):{},_de(e||!t||!t.__esModule?dA(r,"default",{value:t,enumerable:!0}):r,t));var Vd=v(pA=>{var ny=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 ny{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};pA.CommanderError=ny;pA.InvalidArgumentError=fA});var iy=v(hA=>{var{InvalidArgumentError:bde}=Vd(),mA=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 bde(`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 vde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}hA.Argument=mA;hA.humanReadableArgName=vde});var _A=v(yA=>{var{humanReadableArgName:Sde}=iy(),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=>Sde(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 Lq(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 Mq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}yA.Help=gA;yA.stripColor=Mq});var wA=v(SA=>{var{InvalidArgumentError:yde}=Vd(),bA=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=_de(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 yde(`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?Fq(this.name().replace(/^no-/,"")):Fq(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 Fq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function _de(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 Lq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}yA.Help=gA;yA.stripColor=Lq});var wA=v(SA=>{var{InvalidArgumentError:wde}=Vd(),bA=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=xde(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 wde(`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?zq(this.name().replace(/^no-/,"")):zq(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 zq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function xde(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}}SA.Option=bA;SA.DualOptions=vA});var zq=v(Lq=>{function bde(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 vde(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=bde(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}}SA.Option=bA;SA.DualOptions=vA});var qq=v(Uq=>{function $de(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 kde(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=$de(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]}?)`:""}Lq.suggestSimilar=vde});var Hq=v(AA=>{var Sde=He("node:events").EventEmitter,xA=He("node:child_process"),ao=He("node:path"),iy=He("node:fs"),Ue=He("node:process"),{Argument:wde,humanReadableArgName:xde}=ny(),{CommanderError:$A}=Vd(),{Help:$de,stripColor:kde}=_A(),{Option:Uq,DualOptions:Ede}=wA(),{suggestSimilar:qq}=zq(),kA=class t extends Sde{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>EA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>EA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>kde(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 $de,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 wde(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 $A(e,r,n)),Ue.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 Uq(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 Uq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(iy.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]}?)`:""}Uq.suggestSimilar=kde});var Zq=v(AA=>{var Ede=He("node:events").EventEmitter,xA=He("node:child_process"),ao=He("node:path"),oy=He("node:fs"),Ue=He("node:process"),{Argument:Ade,humanReadableArgName:Tde}=iy(),{CommanderError:$A}=Vd(),{Help:Ode,stripColor:Rde}=_A(),{Option:Bq,DualOptions:Ide}=wA(),{suggestSimilar:Hq}=qq(),kA=class t extends Ede{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>EA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>EA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Rde(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 Ode,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 Ade(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 $A(e,r,n)),Ue.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 Bq(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 Bq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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 - 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=ao.resolve(u,d);if(iy.existsSync(f))return f;if(i.includes(ao.extname(d)))return;let p=i.find(m=>iy.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=iy.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=ao.resolve(ao.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=ao.basename(this._scriptPath,ao.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(ao.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Bq(Ue.execArgv).concat(r),c=xA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=xA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Bq(Ue.execArgv).concat(r),c=xA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 $A(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new $A(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=ao.resolve(u,d);if(oy.existsSync(f))return f;if(i.includes(ao.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=ao.resolve(ao.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=ao.basename(this._scriptPath,ao.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(ao.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Gq(Ue.execArgv).concat(r),c=xA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=xA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Gq(Ue.execArgv).concat(r),c=xA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 $A(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new $A(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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Ede(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=qq(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=qq(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=>xde(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=ao.basename(e,ao.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(Ue.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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Ide(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=Hq(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=Hq(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=>Tde(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=ao.basename(e,ao.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(Ue.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 Bq(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 EA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}AA.Command=kA;AA.useColor=EA});var Wq=v(xn=>{var{Argument:Gq}=ny(),{Command:TA}=Hq(),{CommanderError:Ade,InvalidArgumentError:Zq}=Vd(),{Help:Tde}=_A(),{Option:Vq}=wA();xn.program=new TA;xn.createCommand=t=>new TA(t);xn.createOption=(t,e)=>new Vq(t,e);xn.createArgument=(t,e)=>new Gq(t,e);xn.Command=TA;xn.Option=Vq;xn.Argument=Gq;xn.Help=Tde;xn.CommanderError=Ade;xn.InvalidArgumentError=Zq;xn.InvalidOptionArgumentError=Zq});var Ce=v(Xt=>{"use strict";var RA=Symbol.for("yaml.alias"),Xq=Symbol.for("yaml.document"),oy=Symbol.for("yaml.map"),Qq=Symbol.for("yaml.pair"),IA=Symbol.for("yaml.scalar"),sy=Symbol.for("yaml.seq"),co=Symbol.for("yaml.node.type"),Dde=t=>!!t&&typeof t=="object"&&t[co]===RA,Nde=t=>!!t&&typeof t=="object"&&t[co]===Xq,jde=t=>!!t&&typeof t=="object"&&t[co]===oy,Mde=t=>!!t&&typeof t=="object"&&t[co]===Qq,e4=t=>!!t&&typeof t=="object"&&t[co]===IA,Fde=t=>!!t&&typeof t=="object"&&t[co]===sy;function t4(t){if(t&&typeof t=="object")switch(t[co]){case oy:case sy:return!0}return!1}function Lde(t){if(t&&typeof t=="object")switch(t[co]){case RA:case oy:case IA:case sy:return!0}return!1}var zde=t=>(e4(t)||t4(t))&&!!t.anchor;Xt.ALIAS=RA;Xt.DOC=Xq;Xt.MAP=oy;Xt.NODE_TYPE=co;Xt.PAIR=Qq;Xt.SCALAR=IA;Xt.SEQ=sy;Xt.hasAnchor=zde;Xt.isAlias=Dde;Xt.isCollection=t4;Xt.isDocument=Nde;Xt.isMap=jde;Xt.isNode=Lde;Xt.isPair=Mde;Xt.isScalar=e4;Xt.isSeq=Fde});var Wd=v(PA=>{"use strict";var Lt=Ce(),Cr=Symbol("break visit"),r4=Symbol("skip children"),xi=Symbol("remove node");function ay(t,e){let r=n4(e);Lt.isDocument(t)?Bc(null,t.contents,r,Object.freeze([t]))===xi&&(t.contents=null):Bc(null,t,r,Object.freeze([]))}ay.BREAK=Cr;ay.SKIP=r4;ay.REMOVE=xi;function Bc(t,e,r,n){let i=i4(t,e,r,n);if(Lt.isNode(i)||Lt.isPair(i))return o4(t,n,i),Bc(t,i,r,n);if(typeof i!="symbol"){if(Lt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var s4=Ce(),Ude=Wd(),qde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Bde=t=>t.replace(/[!,[\]{}]/g,e=>qde[e]),Kd=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+Bde(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&&s4.isNode(e.contents)){let o={};Ude.visit(e.contents,(s,a)=>{s4.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(` -`)}};Kd.defaultYaml={explicit:!1,version:"1.2"};Kd.defaultTags={"!!":"tag:yaml.org,2002:"};a4.Directives=Kd});var ly=v(Jd=>{"use strict";var c4=Ce(),Hde=Wd();function Gde(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 l4(t){let e=new Set;return Hde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function u4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Zde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=l4(t));let s=u4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(c4.isScalar(s.node)||c4.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}}Jd.anchorIsValid=Gde;Jd.anchorNames=l4;Jd.createNodeAnchors=Zde;Jd.findNewAnchor=u4});var DA=v(d4=>{"use strict";function Yd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Vde=Ce();function f4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>f4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Vde.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}p4.toJS=f4});var uy=v(h4=>{"use strict";var Wde=DA(),m4=Ce(),Kde=Bo(),NA=class{constructor(e){Object.defineProperty(this,m4.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(!m4.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=Kde.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Wde.applyReviver(o,{"":a},"",a):a}};h4.NodeBase=NA});var Xd=v(g4=>{"use strict";var Jde=ly(),Yde=Wd(),Gc=Ce(),Xde=uy(),Qde=Bo(),jA=class extends Xde.NodeBase{constructor(e){super(Gc.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=[],Yde.visit(e,{Node:(o,s)=>{(Gc.isAlias(s)||Gc.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||(Qde.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=dy(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(Jde.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 dy(t,e,r){if(Gc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Gc.isCollection(e)){let n=0;for(let i of e.items){let o=dy(t,i,r);o>n&&(n=o)}return n}else if(Gc.isPair(e)){let n=dy(t,e.key,r),i=dy(t,e.value,r);return Math.max(n,i)}return 1}g4.Alias=jA});var Pt=v(MA=>{"use strict";var efe=Ce(),tfe=uy(),rfe=Bo(),nfe=t=>!t||typeof t!="function"&&typeof t!="object",Ho=class extends tfe.NodeBase{constructor(e){super(efe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:rfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Ho.BLOCK_FOLDED="BLOCK_FOLDED";Ho.BLOCK_LITERAL="BLOCK_LITERAL";Ho.PLAIN="PLAIN";Ho.QUOTE_DOUBLE="QUOTE_DOUBLE";Ho.QUOTE_SINGLE="QUOTE_SINGLE";MA.Scalar=Ho;MA.isScalarValue=nfe});var Qd=v(_4=>{"use strict";var ife=Xd(),oa=Ce(),y4=Pt(),ofe="tag:yaml.org,2002:";function sfe(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 afe(t,e,r){if(oa.isDocument(t)&&(t=t.contents),oa.isNode(t))return t;if(oa.isPair(t)){let d=r.schema[oa.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 ife.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=ofe+e.slice(2));let l=sfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new y4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[oa.MAP]:Symbol.iterator in Object(t)?s[oa.SEQ]:s[oa.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 y4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}_4.createNode=afe});var py=v(fy=>{"use strict";var cfe=Qd(),$i=Ce(),lfe=uy();function FA(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 cfe.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 b4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,LA=class extends lfe.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=>$i.isNode(n)||$i.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(b4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if($i.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,FA(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($i.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&&$i.isScalar(o)?o.value:o:$i.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!$i.isPair(r))return!1;let n=r.value;return n==null||e&&$i.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 $i.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($i.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,FA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};fy.Collection=LA;fy.collectionFromPath=FA;fy.isEmptyPath=b4});var ef=v(my=>{"use strict";var ufe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function zA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var dfe=(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 Gq(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 EA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}AA.Command=kA;AA.useColor=EA});var Jq=v(xn=>{var{Argument:Vq}=iy(),{Command:TA}=Zq(),{CommanderError:Pde,InvalidArgumentError:Wq}=Vd(),{Help:Cde}=_A(),{Option:Kq}=wA();xn.program=new TA;xn.createCommand=t=>new TA(t);xn.createOption=(t,e)=>new Kq(t,e);xn.createArgument=(t,e)=>new Vq(t,e);xn.Command=TA;xn.Option=Kq;xn.Argument=Vq;xn.Help=Cde;xn.CommanderError=Pde;xn.InvalidArgumentError=Wq;xn.InvalidOptionArgumentError=Wq});var Ce=v(Xt=>{"use strict";var RA=Symbol.for("yaml.alias"),e4=Symbol.for("yaml.document"),sy=Symbol.for("yaml.map"),t4=Symbol.for("yaml.pair"),IA=Symbol.for("yaml.scalar"),ay=Symbol.for("yaml.seq"),co=Symbol.for("yaml.node.type"),Lde=t=>!!t&&typeof t=="object"&&t[co]===RA,zde=t=>!!t&&typeof t=="object"&&t[co]===e4,Ude=t=>!!t&&typeof t=="object"&&t[co]===sy,qde=t=>!!t&&typeof t=="object"&&t[co]===t4,r4=t=>!!t&&typeof t=="object"&&t[co]===IA,Bde=t=>!!t&&typeof t=="object"&&t[co]===ay;function n4(t){if(t&&typeof t=="object")switch(t[co]){case sy:case ay:return!0}return!1}function Hde(t){if(t&&typeof t=="object")switch(t[co]){case RA:case sy:case IA:case ay:return!0}return!1}var Gde=t=>(r4(t)||n4(t))&&!!t.anchor;Xt.ALIAS=RA;Xt.DOC=e4;Xt.MAP=sy;Xt.NODE_TYPE=co;Xt.PAIR=t4;Xt.SCALAR=IA;Xt.SEQ=ay;Xt.hasAnchor=Gde;Xt.isAlias=Lde;Xt.isCollection=n4;Xt.isDocument=zde;Xt.isMap=Ude;Xt.isNode=Hde;Xt.isPair=qde;Xt.isScalar=r4;Xt.isSeq=Bde});var Wd=v(PA=>{"use strict";var Lt=Ce(),Cr=Symbol("break visit"),i4=Symbol("skip children"),$i=Symbol("remove node");function cy(t,e){let r=o4(e);Lt.isDocument(t)?qc(null,t.contents,r,Object.freeze([t]))===$i&&(t.contents=null):qc(null,t,r,Object.freeze([]))}cy.BREAK=Cr;cy.SKIP=i4;cy.REMOVE=$i;function qc(t,e,r,n){let i=s4(t,e,r,n);if(Lt.isNode(i)||Lt.isPair(i))return a4(t,n,i),qc(t,i,r,n);if(typeof i!="symbol"){if(Lt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var c4=Ce(),Zde=Wd(),Vde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Wde=t=>t.replace(/[!,[\]{}]/g,e=>Vde[e]),Kd=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+Wde(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&&c4.isNode(e.contents)){let o={};Zde.visit(e.contents,(s,a)=>{c4.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(` +`)}};Kd.defaultYaml={explicit:!1,version:"1.2"};Kd.defaultTags={"!!":"tag:yaml.org,2002:"};l4.Directives=Kd});var uy=v(Jd=>{"use strict";var u4=Ce(),Kde=Wd();function Jde(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 d4(t){let e=new Set;return Kde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function f4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Yde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=d4(t));let s=f4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(u4.isScalar(s.node)||u4.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}}Jd.anchorIsValid=Jde;Jd.anchorNames=d4;Jd.createNodeAnchors=Yde;Jd.findNewAnchor=f4});var DA=v(p4=>{"use strict";function Yd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Xde=Ce();function m4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>m4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Xde.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}h4.toJS=m4});var dy=v(y4=>{"use strict";var Qde=DA(),g4=Ce(),efe=Bo(),NA=class{constructor(e){Object.defineProperty(this,g4.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(!g4.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=efe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Qde.applyReviver(o,{"":a},"",a):a}};y4.NodeBase=NA});var Xd=v(_4=>{"use strict";var tfe=uy(),rfe=Wd(),Hc=Ce(),nfe=dy(),ife=Bo(),jA=class extends nfe.NodeBase{constructor(e){super(Hc.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=[],rfe.visit(e,{Node:(o,s)=>{(Hc.isAlias(s)||Hc.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||(ife.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=fy(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(tfe.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 fy(t,e,r){if(Hc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Hc.isCollection(e)){let n=0;for(let i of e.items){let o=fy(t,i,r);o>n&&(n=o)}return n}else if(Hc.isPair(e)){let n=fy(t,e.key,r),i=fy(t,e.value,r);return Math.max(n,i)}return 1}_4.Alias=jA});var Pt=v(MA=>{"use strict";var ofe=Ce(),sfe=dy(),afe=Bo(),cfe=t=>!t||typeof t!="function"&&typeof t!="object",Ho=class extends sfe.NodeBase{constructor(e){super(ofe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:afe.toJS(this.value,e,r)}toString(){return String(this.value)}};Ho.BLOCK_FOLDED="BLOCK_FOLDED";Ho.BLOCK_LITERAL="BLOCK_LITERAL";Ho.PLAIN="PLAIN";Ho.QUOTE_DOUBLE="QUOTE_DOUBLE";Ho.QUOTE_SINGLE="QUOTE_SINGLE";MA.Scalar=Ho;MA.isScalarValue=cfe});var Qd=v(v4=>{"use strict";var lfe=Xd(),sa=Ce(),b4=Pt(),ufe="tag:yaml.org,2002:";function dfe(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 ffe(t,e,r){if(sa.isDocument(t)&&(t=t.contents),sa.isNode(t))return t;if(sa.isPair(t)){let d=r.schema[sa.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 lfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=ufe+e.slice(2));let l=dfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new b4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[sa.MAP]:Symbol.iterator in Object(t)?s[sa.SEQ]:s[sa.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 b4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}v4.createNode=ffe});var my=v(py=>{"use strict";var pfe=Qd(),ki=Ce(),mfe=dy();function FA(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 pfe.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 S4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,LA=class extends mfe.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=>ki.isNode(n)||ki.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(S4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(ki.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,FA(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(ki.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&&ki.isScalar(o)?o.value:o:ki.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!ki.isPair(r))return!1;let n=r.value;return n==null||e&&ki.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 ki.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(ki.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,FA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};py.Collection=LA;py.collectionFromPath=FA;py.isEmptyPath=S4});var ef=v(hy=>{"use strict";var hfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function zA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var gfe=(t,e,r)=>t.endsWith(` `)?zA(r,e):r.includes(` `)?` -`+zA(r,e):(t.endsWith(" ")?"":" ")+r;my.indentComment=zA;my.lineComment=dfe;my.stringifyComment=ufe});var S4=v(tf=>{"use strict";var ffe="flow",UA="block",hy="quoted";function pfe(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===UA&&(h=v4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===hy&&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===UA&&(h=v4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+zA(r,e):(t.endsWith(" ")?"":" ")+r;hy.indentComment=zA;hy.lineComment=gfe;hy.stringifyComment=hfe});var x4=v(tf=>{"use strict";var yfe="flow",UA="block",gy="quoted";function _fe(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===UA&&(h=w4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===gy&&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===UA&&(h=w4(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===hy){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 Vn=Pt(),Go=S4(),yy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),_y=t=>/^(%|---|\.\.\.)/m.test(t);function mfe(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 rf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(_y(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===gy){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 Vn=Pt(),Go=x4(),_y=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),by=t=>/^(%|---|\.\.\.)/m.test(t);function bfe(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 rf(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(BA,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{O=!0});let A=Go.foldFlowLines(`${_}${w}${p}`,l,Go.FOLD_BLOCK,T);if(!O)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,T=_y(n,!0);s!=="folded"&&e!==Vn.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{O=!0});let A=Go.foldFlowLines(`${_}${w}${p}`,l,Go.FOLD_BLOCK,T);if(!O)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function hfe(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 Zc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?Zc(o,e):gy(t,e,r,n);if(!a&&!u&&i!==Vn.Scalar.PLAIN&&o.includes(` -`))return gy(t,e,r,n);if(_y(o)){if(c==="")return e.forceBlockIndent=!0,gy(t,e,r,n);if(a&&c===l)return Zc(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 Zc(o,e)}return a?d:Go.foldFlowLines(d,c,Go.FOLD_FLOW,yy(e,!1))}function gfe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Zc(s.value,e):gy(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return rf(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return qA(s.value,e);case Vn.Scalar.PLAIN:return hfe(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}w4.stringifyString=gfe});var of=v(HA=>{"use strict";var yfe=ly(),Zo=Ce(),_fe=ef(),bfe=nf();function vfe(t,e){let r=Object.assign({blockQuote:!0,commentString:_fe.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 Sfe(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(Zo.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 wfe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Zo.isScalar(t)||Zo.isCollection(t))&&t.anchor;o&&yfe.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 xfe(t,e,r,n){if(Zo.isPair(t))return t.toString(e,r,n);if(Zo.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=Zo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Sfe(e.doc.schema.tags,o));let s=wfe(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):Zo.isScalar(o)?bfe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Zo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}HA.createStringifyContext=vfe;HA.stringify=xfe});var E4=v(k4=>{"use strict";var lo=Ce(),x4=Pt(),$4=of(),sf=ef();function $fe({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=lo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(lo.isCollection(t)||!lo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||lo.isCollection(t)||(lo.isScalar(t)?t.type===x4.Scalar.BLOCK_FOLDED||t.type===x4.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=$4.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+=sf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=sf.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=sf.lineComment(g,r.indent,l(f))));let b,_,S;lo.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&&lo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&lo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=$4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +${l}${_}${r}${p}`}function vfe(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 Gc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?Gc(o,e):yy(t,e,r,n);if(!a&&!u&&i!==Vn.Scalar.PLAIN&&o.includes(` +`))return yy(t,e,r,n);if(by(o)){if(c==="")return e.forceBlockIndent=!0,yy(t,e,r,n);if(a&&c===l)return Gc(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 Gc(o,e)}return a?d:Go.foldFlowLines(d,c,Go.FOLD_FLOW,_y(e,!1))}function Sfe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Gc(s.value,e):yy(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return rf(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return qA(s.value,e);case Vn.Scalar.PLAIN:return vfe(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}$4.stringifyString=Sfe});var of=v(HA=>{"use strict";var wfe=uy(),Zo=Ce(),xfe=ef(),$fe=nf();function kfe(t,e){let r=Object.assign({blockQuote:!0,commentString:xfe.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 Efe(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(Zo.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 Afe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Zo.isScalar(t)||Zo.isCollection(t))&&t.anchor;o&&wfe.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 Tfe(t,e,r,n){if(Zo.isPair(t))return t.toString(e,r,n);if(Zo.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=Zo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Efe(e.doc.schema.tags,o));let s=Afe(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):Zo.isScalar(o)?$fe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Zo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}HA.createStringifyContext=kfe;HA.stringify=Tfe});var T4=v(A4=>{"use strict";var lo=Ce(),k4=Pt(),E4=of(),sf=ef();function Ofe({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=lo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(lo.isCollection(t)||!lo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||lo.isCollection(t)||(lo.isScalar(t)?t.type===k4.Scalar.BLOCK_FOLDED||t.type===k4.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=E4.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+=sf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=sf.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=sf.lineComment(g,r.indent,l(f))));let b,_,S;lo.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&&lo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&lo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=E4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let T=l(_);O+=` ${sf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` `&&S&&(O=` @@ -72,32 +72,32 @@ ${sf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` ${r.indent}`}else if(!p&&lo.isCollection(e)){let T=w[0],A=w.indexOf(` `),D=A!==-1,E=r.inFlow??e.flow??e.items.length===0;if(D||!E){let q=!1;if(D&&(T==="&"||T==="!")){let Q=w.indexOf(" ");T==="&"&&Q!==-1&&Q{"use strict";var A4=He("process");function kfe(t,...e){t==="debug"&&console.log(...e)}function Efe(t,e){(t==="debug"||t==="warn")&&(typeof A4.emitWarning=="function"?A4.emitWarning(e):console.warn(e))}GA.debug=kfe;GA.warn=Efe});var xy=v(wy=>{"use strict";var Sy=Ce(),T4=Pt(),by="<<",vy={identify:t=>t===by||typeof t=="symbol"&&t.description===by,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new T4.Scalar(Symbol(by)),{addToJSMap:O4}),stringify:()=>by},Afe=(t,e)=>(vy.identify(e)||Sy.isScalar(e)&&(!e.type||e.type===T4.Scalar.PLAIN)&&vy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===vy.tag&&r.default);function O4(t,e,r){let n=R4(t,r);if(Sy.isSeq(n))for(let i of n.items)VA(t,e,i);else if(Array.isArray(n))for(let i of n)VA(t,e,i);else VA(t,e,n)}function VA(t,e,r){let n=R4(t,r);if(!Sy.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 R4(t,e){return t&&Sy.isAlias(e)?e.resolve(t.doc,t):e}wy.addMergeToJSMap=O4;wy.isMergeKey=Afe;wy.merge=vy});var KA=v(C4=>{"use strict";var Tfe=ZA(),I4=xy(),Ofe=of(),P4=Ce(),WA=Bo();function Rfe(t,e,{key:r,value:n}){if(P4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(I4.isMergeKey(t,r))I4.addMergeToJSMap(t,e,n);else{let i=WA.toJS(r,"",t);if(e instanceof Map)e.set(i,WA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Ife(r,i,t),s=WA.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 Ife(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(P4.isNode(t)&&r?.doc){let n=Ofe.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)+'..."'),Tfe.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)}C4.addPairToJSMap=Rfe});var Vo=v(JA=>{"use strict";var D4=Qd(),Pfe=E4(),Cfe=KA(),$y=Ce();function Dfe(t,e,r){let n=D4.createNode(t,void 0,r),i=D4.createNode(e,void 0,r);return new ky(n,i)}var ky=class t{constructor(e,r=null){Object.defineProperty(this,$y.NODE_TYPE,{value:$y.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return $y.isNode(r)&&(r=r.clone(e)),$y.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Cfe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Pfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};JA.Pair=ky;JA.createPair=Dfe});var YA=v(j4=>{"use strict";var sa=Ce(),N4=of(),Ey=ef();function Nfe(t,e,r){return(e.inFlow??t.flow?Mfe:jfe)(t,e,r)}function jfe({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+=Ey.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 O4=He("process");function Rfe(t,...e){t==="debug"&&console.log(...e)}function Ife(t,e){(t==="debug"||t==="warn")&&(typeof O4.emitWarning=="function"?O4.emitWarning(e):console.warn(e))}GA.debug=Rfe;GA.warn=Ife});var $y=v(xy=>{"use strict";var wy=Ce(),R4=Pt(),vy="<<",Sy={identify:t=>t===vy||typeof t=="symbol"&&t.description===vy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new R4.Scalar(Symbol(vy)),{addToJSMap:I4}),stringify:()=>vy},Pfe=(t,e)=>(Sy.identify(e)||wy.isScalar(e)&&(!e.type||e.type===R4.Scalar.PLAIN)&&Sy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Sy.tag&&r.default);function I4(t,e,r){let n=P4(t,r);if(wy.isSeq(n))for(let i of n.items)VA(t,e,i);else if(Array.isArray(n))for(let i of n)VA(t,e,i);else VA(t,e,n)}function VA(t,e,r){let n=P4(t,r);if(!wy.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 P4(t,e){return t&&wy.isAlias(e)?e.resolve(t.doc,t):e}xy.addMergeToJSMap=I4;xy.isMergeKey=Pfe;xy.merge=Sy});var KA=v(N4=>{"use strict";var Cfe=ZA(),C4=$y(),Dfe=of(),D4=Ce(),WA=Bo();function Nfe(t,e,{key:r,value:n}){if(D4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(C4.isMergeKey(t,r))C4.addMergeToJSMap(t,e,n);else{let i=WA.toJS(r,"",t);if(e instanceof Map)e.set(i,WA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=jfe(r,i,t),s=WA.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 jfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(D4.isNode(t)&&r?.doc){let n=Dfe.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)+'..."'),Cfe.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)}N4.addPairToJSMap=Nfe});var Vo=v(JA=>{"use strict";var j4=Qd(),Mfe=T4(),Ffe=KA(),ky=Ce();function Lfe(t,e,r){let n=j4.createNode(t,void 0,r),i=j4.createNode(e,void 0,r);return new Ey(n,i)}var Ey=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 Ffe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Mfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};JA.Pair=Ey;JA.createPair=Lfe});var YA=v(F4=>{"use strict";var aa=Ce(),M4=of(),Ay=ef();function zfe(t,e,r){return(e.inFlow??t.flow?qfe:Ufe)(t,e,r)}function Ufe({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+=Ay.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+=Ey.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?` +`+Ay.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function qfe({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+=Ay.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 Ay({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Ey.indentComment(e(n),t);r.push(o.trimStart())}}j4.stringifyCollection=Nfe});var Ko=v(QA=>{"use strict";var Ffe=YA(),Lfe=KA(),zfe=py(),Wo=Ce(),Ty=Vo(),Ufe=Pt();function af(t,e){let r=Wo.isScalar(e)?e.value:e;for(let n of t)if(Wo.isPair(n)&&(n.key===e||n.key===r||Wo.isScalar(n.key)&&n.key.value===r))return n}var XA=class extends zfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Wo.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(Ty.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;Wo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Ty.Pair(e,e?.value):n=new Ty.Pair(e.key,e.value);let i=af(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Wo.isScalar(i.value)&&Ufe.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=af(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=af(this.items,e)?.value;return(!r&&Wo.isScalar(i)?i.value:i)??void 0}has(e){return!!af(this.items,e)}set(e,r){this.add(new Ty.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)Lfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Wo.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})),Ffe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};QA.YAMLMap=XA;QA.findPair=af});var Vc=v(F4=>{"use strict";var qfe=Ce(),M4=Ko(),Bfe={collection:"map",default:!0,nodeClass:M4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return qfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>M4.YAMLMap.from(t,e,r)};F4.map=Bfe});var Jo=v(L4=>{"use strict";var Hfe=Qd(),Gfe=YA(),Zfe=py(),Ry=Ce(),Vfe=Pt(),Wfe=Bo(),eT=class extends Zfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Ry.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Oy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Oy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Ry.isScalar(i)?i.value:i}has(e){let r=Oy(e);return typeof r=="number"&&r=0?e:null}L4.YAMLSeq=eT});var Wc=v(U4=>{"use strict";var Kfe=Ce(),z4=Jo(),Jfe={collection:"seq",default:!0,nodeClass:z4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Kfe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>z4.YAMLSeq.from(t,e,r)};U4.seq=Jfe});var cf=v(q4=>{"use strict";var Yfe=nf(),Xfe={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),Yfe.stringifyString(t,e,r,n)}};q4.string=Xfe});var Iy=v(G4=>{"use strict";var B4=Pt(),H4={identify:t=>t==null,createNode:()=>new B4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new B4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&H4.test.test(t)?t:e.options.nullStr};G4.nullTag=H4});var tT=v(V4=>{"use strict";var Qfe=Pt(),Z4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Qfe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&Z4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};V4.boolTag=Z4});var Kc=v(W4=>{"use strict";function epe({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}W4.stringifyNumber=epe});var nT=v(Py=>{"use strict";var tpe=Pt(),rT=Kc(),rpe={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},npe={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)}},ipe={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 tpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:rT.stringifyNumber};Py.float=ipe;Py.floatExp=npe;Py.floatNaN=rpe});var oT=v(Dy=>{"use strict";var K4=Kc(),Cy=t=>typeof t=="bigint"||Number.isInteger(t),iT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function J4(t,e,r){let{value:n}=t;return Cy(n)&&n>=0?r+n.toString(e):K4.stringifyNumber(t)}var ope={identify:t=>Cy(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=>J4(t,8,"0o")},spe={identify:Cy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>iT(t,0,10,r),stringify:K4.stringifyNumber},ape={identify:t=>Cy(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=>J4(t,16,"0x")};Dy.int=spe;Dy.intHex=ape;Dy.intOct=ope});var X4=v(Y4=>{"use strict";var cpe=Vc(),lpe=Iy(),upe=Wc(),dpe=cf(),fpe=tT(),sT=nT(),aT=oT(),ppe=[cpe.map,upe.seq,dpe.string,lpe.nullTag,fpe.boolTag,aT.intOct,aT.int,aT.intHex,sT.floatNaN,sT.floatExp,sT.float];Y4.schema=ppe});var t6=v(e6=>{"use strict";var mpe=Pt(),hpe=Vc(),gpe=Wc();function Q4(t){return typeof t=="bigint"||Number.isInteger(t)}var Ny=({value:t})=>JSON.stringify(t),ype=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Ny},{identify:t=>t==null,createNode:()=>new mpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ny},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Ny},{identify:Q4,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})=>Q4(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:Ny}],_pe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},bpe=[hpe.map,gpe.seq].concat(ype,_pe);e6.schema=bpe});var lT=v(r6=>{"use strict";var lf=He("buffer"),cT=Pt(),vpe=nf(),Spe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof lf.Buffer=="function")return lf.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 jy=Ce(),uT=Vo(),wpe=Pt(),xpe=Jo();function n6(t,e){if(jy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new uT.Pair(new wpe.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Ty({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Ay.indentComment(e(n),t);r.push(o.trimStart())}}F4.stringifyCollection=zfe});var Ko=v(QA=>{"use strict";var Bfe=YA(),Hfe=KA(),Gfe=my(),Wo=Ce(),Oy=Vo(),Zfe=Pt();function af(t,e){let r=Wo.isScalar(e)?e.value:e;for(let n of t)if(Wo.isPair(n)&&(n.key===e||n.key===r||Wo.isScalar(n.key)&&n.key.value===r))return n}var XA=class extends Gfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Wo.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(Oy.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;Wo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Oy.Pair(e,e?.value):n=new Oy.Pair(e.key,e.value);let i=af(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Wo.isScalar(i.value)&&Zfe.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=af(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=af(this.items,e)?.value;return(!r&&Wo.isScalar(i)?i.value:i)??void 0}has(e){return!!af(this.items,e)}set(e,r){this.add(new Oy.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)Hfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Wo.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})),Bfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};QA.YAMLMap=XA;QA.findPair=af});var Zc=v(z4=>{"use strict";var Vfe=Ce(),L4=Ko(),Wfe={collection:"map",default:!0,nodeClass:L4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Vfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>L4.YAMLMap.from(t,e,r)};z4.map=Wfe});var Jo=v(U4=>{"use strict";var Kfe=Qd(),Jfe=YA(),Yfe=my(),Iy=Ce(),Xfe=Pt(),Qfe=Bo(),eT=class extends Yfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Iy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Ry(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Ry(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Iy.isScalar(i)?i.value:i}has(e){let r=Ry(e);return typeof r=="number"&&r=0?e:null}U4.YAMLSeq=eT});var Vc=v(B4=>{"use strict";var epe=Ce(),q4=Jo(),tpe={collection:"seq",default:!0,nodeClass:q4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return epe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>q4.YAMLSeq.from(t,e,r)};B4.seq=tpe});var cf=v(H4=>{"use strict";var rpe=nf(),npe={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),rpe.stringifyString(t,e,r,n)}};H4.string=npe});var Py=v(V4=>{"use strict";var G4=Pt(),Z4={identify:t=>t==null,createNode:()=>new G4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new G4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Z4.test.test(t)?t:e.options.nullStr};V4.nullTag=Z4});var tT=v(K4=>{"use strict";var ipe=Pt(),W4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new ipe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&W4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};K4.boolTag=W4});var Wc=v(J4=>{"use strict";function ope({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}J4.stringifyNumber=ope});var nT=v(Cy=>{"use strict";var spe=Pt(),rT=Wc(),ape={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},cpe={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)}},lpe={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 spe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:rT.stringifyNumber};Cy.float=lpe;Cy.floatExp=cpe;Cy.floatNaN=ape});var oT=v(Ny=>{"use strict";var Y4=Wc(),Dy=t=>typeof t=="bigint"||Number.isInteger(t),iT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function X4(t,e,r){let{value:n}=t;return Dy(n)&&n>=0?r+n.toString(e):Y4.stringifyNumber(t)}var upe={identify:t=>Dy(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=>X4(t,8,"0o")},dpe={identify:Dy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>iT(t,0,10,r),stringify:Y4.stringifyNumber},fpe={identify:t=>Dy(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=>X4(t,16,"0x")};Ny.int=dpe;Ny.intHex=fpe;Ny.intOct=upe});var e6=v(Q4=>{"use strict";var ppe=Zc(),mpe=Py(),hpe=Vc(),gpe=cf(),ype=tT(),sT=nT(),aT=oT(),_pe=[ppe.map,hpe.seq,gpe.string,mpe.nullTag,ype.boolTag,aT.intOct,aT.int,aT.intHex,sT.floatNaN,sT.floatExp,sT.float];Q4.schema=_pe});var n6=v(r6=>{"use strict";var bpe=Pt(),vpe=Zc(),Spe=Vc();function t6(t){return typeof t=="bigint"||Number.isInteger(t)}var jy=({value:t})=>JSON.stringify(t),wpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:jy},{identify:t=>t==null,createNode:()=>new bpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:jy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:jy},{identify:t6,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})=>t6(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:jy}],xpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},$pe=[vpe.map,Spe.seq].concat(wpe,xpe);r6.schema=$pe});var lT=v(i6=>{"use strict";var lf=He("buffer"),cT=Pt(),kpe=nf(),Epe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof lf.Buffer=="function")return lf.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 My=Ce(),uT=Vo(),Ape=Pt(),Tpe=Jo();function o6(t,e){if(My.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new uT.Pair(new Ape.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]=jy.isPair(n)?n:new uT.Pair(n)}}else e("Expected a sequence for this tag");return t}function i6(t,e,r){let{replacer:n}=r,i=new xpe.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(uT.createPair(a,c,r))}return i}var $pe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:n6,createNode:i6};My.createPairs=i6;My.pairs=$pe;My.resolvePairs=n6});var pT=v(fT=>{"use strict";var o6=Ce(),dT=Bo(),uf=Ko(),kpe=Jo(),s6=Fy(),aa=class t extends kpe.YAMLSeq{constructor(){super(),this.add=uf.YAMLMap.prototype.add.bind(this),this.delete=uf.YAMLMap.prototype.delete.bind(this),this.get=uf.YAMLMap.prototype.get.bind(this),this.has=uf.YAMLMap.prototype.has.bind(this),this.set=uf.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(o6.isPair(i)?(o=dT.toJS(i.key,"",r),s=dT.toJS(i.value,o,r)):o=dT.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=s6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};aa.tag="tag:yaml.org,2002:omap";var Epe={collection:"seq",identify:t=>t instanceof Map,nodeClass:aa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=s6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)o6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new aa,r)},createNode:(t,e,r)=>aa.from(t,e,r)};fT.YAMLOMap=aa;fT.omap=Epe});var d6=v(mT=>{"use strict";var a6=Pt();function c6({value:t,source:e},r){return e&&(t?l6:u6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var l6={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 a6.Scalar(!0),stringify:c6},u6={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 a6.Scalar(!1),stringify:c6};mT.falseTag=u6;mT.trueTag=l6});var f6=v(Ly=>{"use strict";var Ape=Pt(),hT=Kc(),Tpe={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},Ope={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)}},Rpe={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 Ape.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};Ly.float=Rpe;Ly.floatExp=Ope;Ly.floatNaN=Tpe});var m6=v(ff=>{"use strict";var p6=Kc(),df=t=>typeof t=="bigint"||Number.isInteger(t);function zy(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 gT(t,e,r){let{value:n}=t;if(df(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return p6.stringifyNumber(t)}var Ipe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>zy(t,2,2,r),stringify:t=>gT(t,2,"0b")},Ppe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>zy(t,1,8,r),stringify:t=>gT(t,8,"0")},Cpe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>zy(t,0,10,r),stringify:p6.stringifyNumber},Dpe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>zy(t,2,16,r),stringify:t=>gT(t,16,"0x")};ff.int=Cpe;ff.intBin=Ipe;ff.intHex=Dpe;ff.intOct=Ppe});var _T=v(yT=>{"use strict";var By=Ce(),Uy=Vo(),qy=Ko(),ca=class t extends qy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;By.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Uy.Pair(e.key,null):r=new Uy.Pair(e,null),qy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=qy.findPair(this.items,e);return!r&&By.isPair(n)?By.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=qy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Uy.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(Uy.createPair(s,null,n));return o}};ca.tag="tag:yaml.org,2002:set";var Npe={collection:"map",identify:t=>t instanceof Set,nodeClass:ca,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ca.from(t,e,r),resolve(t,e){if(By.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ca,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};yT.YAMLSet=ca;yT.set=Npe});var vT=v(Hy=>{"use strict";var jpe=Kc();function bT(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 h6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return jpe.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 Mpe={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})=>bT(t,r),stringify:h6},Fpe={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=>bT(t,!1),stringify:h6},g6={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(g6.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=bT(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$/,"")??""};Hy.floatTime=Fpe;Hy.intTime=Mpe;Hy.timestamp=g6});var b6=v(_6=>{"use strict";var Lpe=Vc(),zpe=Iy(),Upe=Wc(),qpe=cf(),Bpe=lT(),y6=d6(),ST=f6(),Gy=m6(),Hpe=xy(),Gpe=pT(),Zpe=Fy(),Vpe=_T(),wT=vT(),Wpe=[Lpe.map,Upe.seq,qpe.string,zpe.nullTag,y6.trueTag,y6.falseTag,Gy.intBin,Gy.intOct,Gy.int,Gy.intHex,ST.floatNaN,ST.floatExp,ST.float,Bpe.binary,Hpe.merge,Gpe.omap,Zpe.pairs,Vpe.set,wT.intTime,wT.floatTime,wT.timestamp];_6.schema=Wpe});var O6=v(kT=>{"use strict";var x6=Vc(),Kpe=Iy(),$6=Wc(),Jpe=cf(),Ype=tT(),xT=nT(),$T=oT(),Xpe=X4(),Qpe=t6(),k6=lT(),pf=xy(),E6=pT(),A6=Fy(),v6=b6(),T6=_T(),Zy=vT(),S6=new Map([["core",Xpe.schema],["failsafe",[x6.map,$6.seq,Jpe.string]],["json",Qpe.schema],["yaml11",v6.schema],["yaml-1.1",v6.schema]]),w6={binary:k6.binary,bool:Ype.boolTag,float:xT.float,floatExp:xT.floatExp,floatNaN:xT.floatNaN,floatTime:Zy.floatTime,int:$T.int,intHex:$T.intHex,intOct:$T.intOct,intTime:Zy.intTime,map:x6.map,merge:pf.merge,null:Kpe.nullTag,omap:E6.omap,pairs:A6.pairs,seq:$6.seq,set:T6.set,timestamp:Zy.timestamp},eme={"tag:yaml.org,2002:binary":k6.binary,"tag:yaml.org,2002:merge":pf.merge,"tag:yaml.org,2002:omap":E6.omap,"tag:yaml.org,2002:pairs":A6.pairs,"tag:yaml.org,2002:set":T6.set,"tag:yaml.org,2002:timestamp":Zy.timestamp};function tme(t,e,r){let n=S6.get(e);if(n&&!t)return r&&!n.includes(pf.merge)?n.concat(pf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(S6.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(pf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?w6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(w6).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},[])}kT.coreKnownTags=eme;kT.getTags=tme});var TT=v(R6=>{"use strict";var ET=Ce(),rme=Vc(),nme=Wc(),ime=cf(),Vy=O6(),ome=(t,e)=>t.keye.key?1:0,AT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Vy.getTags(e,"compat"):e?Vy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Vy.coreKnownTags:{},this.tags=Vy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,ET.MAP,{value:rme.map}),Object.defineProperty(this,ET.SCALAR,{value:ime.string}),Object.defineProperty(this,ET.SEQ,{value:nme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?ome:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};R6.Schema=AT});var P6=v(I6=>{"use strict";var sme=Ce(),OT=of(),mf=ef();function ame(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=OT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(mf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(sme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(mf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=OT.stringify(t.contents,i,()=>a=null,c);a&&(l+=mf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(OT.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]=My.isPair(n)?n:new uT.Pair(n)}}else e("Expected a sequence for this tag");return t}function s6(t,e,r){let{replacer:n}=r,i=new Tpe.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(uT.createPair(a,c,r))}return i}var Ope={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:o6,createNode:s6};Fy.createPairs=s6;Fy.pairs=Ope;Fy.resolvePairs=o6});var pT=v(fT=>{"use strict";var a6=Ce(),dT=Bo(),uf=Ko(),Rpe=Jo(),c6=Ly(),ca=class t extends Rpe.YAMLSeq{constructor(){super(),this.add=uf.YAMLMap.prototype.add.bind(this),this.delete=uf.YAMLMap.prototype.delete.bind(this),this.get=uf.YAMLMap.prototype.get.bind(this),this.has=uf.YAMLMap.prototype.has.bind(this),this.set=uf.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(a6.isPair(i)?(o=dT.toJS(i.key,"",r),s=dT.toJS(i.value,o,r)):o=dT.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=c6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ca.tag="tag:yaml.org,2002:omap";var Ipe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ca,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=c6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)a6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ca,r)},createNode:(t,e,r)=>ca.from(t,e,r)};fT.YAMLOMap=ca;fT.omap=Ipe});var p6=v(mT=>{"use strict";var l6=Pt();function u6({value:t,source:e},r){return e&&(t?d6:f6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var d6={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 l6.Scalar(!0),stringify:u6},f6={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 l6.Scalar(!1),stringify:u6};mT.falseTag=f6;mT.trueTag=d6});var m6=v(zy=>{"use strict";var Ppe=Pt(),hT=Wc(),Cpe={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},Dpe={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)}},Npe={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 Ppe.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};zy.float=Npe;zy.floatExp=Dpe;zy.floatNaN=Cpe});var g6=v(ff=>{"use strict";var h6=Wc(),df=t=>typeof t=="bigint"||Number.isInteger(t);function Uy(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 gT(t,e,r){let{value:n}=t;if(df(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return h6.stringifyNumber(t)}var jpe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Uy(t,2,2,r),stringify:t=>gT(t,2,"0b")},Mpe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Uy(t,1,8,r),stringify:t=>gT(t,8,"0")},Fpe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Uy(t,0,10,r),stringify:h6.stringifyNumber},Lpe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Uy(t,2,16,r),stringify:t=>gT(t,16,"0x")};ff.int=Fpe;ff.intBin=jpe;ff.intHex=Lpe;ff.intOct=Mpe});var _T=v(yT=>{"use strict";var Hy=Ce(),qy=Vo(),By=Ko(),la=class t extends By.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Hy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new qy.Pair(e.key,null):r=new qy.Pair(e,null),By.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=By.findPair(this.items,e);return!r&&Hy.isPair(n)?Hy.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=By.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new qy.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(qy.createPair(s,null,n));return o}};la.tag="tag:yaml.org,2002:set";var zpe={collection:"map",identify:t=>t instanceof Set,nodeClass:la,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>la.from(t,e,r),resolve(t,e){if(Hy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new la,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};yT.YAMLSet=la;yT.set=zpe});var vT=v(Gy=>{"use strict";var Upe=Wc();function bT(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 y6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Upe.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 qpe={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})=>bT(t,r),stringify:y6},Bpe={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=>bT(t,!1),stringify:y6},_6={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(_6.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=bT(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$/,"")??""};Gy.floatTime=Bpe;Gy.intTime=qpe;Gy.timestamp=_6});var S6=v(v6=>{"use strict";var Hpe=Zc(),Gpe=Py(),Zpe=Vc(),Vpe=cf(),Wpe=lT(),b6=p6(),ST=m6(),Zy=g6(),Kpe=$y(),Jpe=pT(),Ype=Ly(),Xpe=_T(),wT=vT(),Qpe=[Hpe.map,Zpe.seq,Vpe.string,Gpe.nullTag,b6.trueTag,b6.falseTag,Zy.intBin,Zy.intOct,Zy.int,Zy.intHex,ST.floatNaN,ST.floatExp,ST.float,Wpe.binary,Kpe.merge,Jpe.omap,Ype.pairs,Xpe.set,wT.intTime,wT.floatTime,wT.timestamp];v6.schema=Qpe});var I6=v(kT=>{"use strict";var k6=Zc(),eme=Py(),E6=Vc(),tme=cf(),rme=tT(),xT=nT(),$T=oT(),nme=e6(),ime=n6(),A6=lT(),pf=$y(),T6=pT(),O6=Ly(),w6=S6(),R6=_T(),Vy=vT(),x6=new Map([["core",nme.schema],["failsafe",[k6.map,E6.seq,tme.string]],["json",ime.schema],["yaml11",w6.schema],["yaml-1.1",w6.schema]]),$6={binary:A6.binary,bool:rme.boolTag,float:xT.float,floatExp:xT.floatExp,floatNaN:xT.floatNaN,floatTime:Vy.floatTime,int:$T.int,intHex:$T.intHex,intOct:$T.intOct,intTime:Vy.intTime,map:k6.map,merge:pf.merge,null:eme.nullTag,omap:T6.omap,pairs:O6.pairs,seq:E6.seq,set:R6.set,timestamp:Vy.timestamp},ome={"tag:yaml.org,2002:binary":A6.binary,"tag:yaml.org,2002:merge":pf.merge,"tag:yaml.org,2002:omap":T6.omap,"tag:yaml.org,2002:pairs":O6.pairs,"tag:yaml.org,2002:set":R6.set,"tag:yaml.org,2002:timestamp":Vy.timestamp};function sme(t,e,r){let n=x6.get(e);if(n&&!t)return r&&!n.includes(pf.merge)?n.concat(pf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(x6.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(pf.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},[])}kT.coreKnownTags=ome;kT.getTags=sme});var TT=v(P6=>{"use strict";var ET=Ce(),ame=Zc(),cme=Vc(),lme=cf(),Wy=I6(),ume=(t,e)=>t.keye.key?1:0,AT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Wy.getTags(e,"compat"):e?Wy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Wy.coreKnownTags:{},this.tags=Wy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,ET.MAP,{value:ame.map}),Object.defineProperty(this,ET.SCALAR,{value:lme.string}),Object.defineProperty(this,ET.SEQ,{value:cme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?ume:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};P6.Schema=AT});var D6=v(C6=>{"use strict";var dme=Ce(),OT=of(),mf=ef();function fme(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=OT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(mf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(dme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(mf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=OT.stringify(t.contents,i,()=>a=null,c);a&&(l+=mf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(OT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` `)?(r.push("..."),r.push(mf.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(mf.indentComment(o(c),"")))}return r.join(` `)+` -`}I6.stringifyDocument=ame});var hf=v(C6=>{"use strict";var cme=Xd(),Jc=py(),$n=Ce(),lme=Vo(),ume=Bo(),dme=TT(),fme=P6(),RT=ly(),pme=DA(),mme=Qd(),IT=CA(),PT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 IT.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Yc(this.contents)&&this.contents.add(e)}addIn(e,r){Yc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=RT.anchorNames(this);e.anchor=!r||n.has(r)?RT.findNewAnchor(r||"a",n):r}return new cme.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}=RT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=mme.createNode(e,u,m);return a&&$n.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 lme.Pair(i,o)}delete(e){return Yc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Jc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Yc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Jc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Jc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Jc.collectionFromPath(this.schema,[e],r):Yc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Jc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Jc.collectionFromPath(this.schema,Array.from(e),r):Yc(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 IT.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 IT.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 dme.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=ume.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"?pme.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 fme.stringifyDocument(this,e)}};function Yc(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}C6.Document=PT});var _f=v(yf=>{"use strict";var gf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},CT=class extends gf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},DT=class extends gf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},hme=(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 +`}C6.stringifyDocument=fme});var hf=v(N6=>{"use strict";var pme=Xd(),Kc=my(),$n=Ce(),mme=Vo(),hme=Bo(),gme=TT(),yme=D6(),RT=uy(),_me=DA(),bme=Qd(),IT=CA(),PT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 IT.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Jc(this.contents)&&this.contents.add(e)}addIn(e,r){Jc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=RT.anchorNames(this);e.anchor=!r||n.has(r)?RT.findNewAnchor(r||"a",n):r}return new pme.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}=RT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=bme.createNode(e,u,m);return a&&$n.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 mme.Pair(i,o)}delete(e){return Jc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Kc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Jc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Kc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Kc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Kc.collectionFromPath(this.schema,[e],r):Jc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Kc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Kc.collectionFromPath(this.schema,Array.from(e),r):Jc(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 IT.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 IT.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 gme.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=hme.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"?_me.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 yme.stringifyDocument(this,e)}};function Jc(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}N6.Document=PT});var _f=v(yf=>{"use strict";var gf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},CT=class extends gf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},DT=class extends gf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},vme=(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} -`}};yf.YAMLError=gf;yf.YAMLParseError=CT;yf.YAMLWarning=DT;yf.prettifyError=hme});var bf=v(D6=>{"use strict";function gme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}D6.resolveProps=gme});var Wy=v(N6=>{"use strict";function NT(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(NT(e.key)||NT(e.value))return!0}return!1;default:return!0}}N6.containsNewline=NT});var jT=v(j6=>{"use strict";var yme=Wy();function _me(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&yme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}j6.flowIndentCheck=_me});var MT=v(F6=>{"use strict";var M6=Ce();function bme(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||M6.isScalar(o)&&M6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}F6.mapIncludes=bme});var H6=v(B6=>{"use strict";var L6=Vo(),vme=Ko(),z6=bf(),Sme=Wy(),U6=jT(),wme=MT(),q6="All mapping items must start at the same column";function xme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??vme.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=z6.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",q6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Sme.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",q6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&U6.flowIndentCheck(n.indent,f,i),r.atKey=!1,wme.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=z6.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 $me=Jo(),kme=bf(),Eme=jT();function Ame({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??$me.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=kme.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&&Eme.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}G6.resolveBlockSeq=Ame});var Xc=v(V6=>{"use strict";function Tme(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}}V6.resolveEnd=Tme});var Y6=v(J6=>{"use strict";var Ome=Ce(),Rme=Vo(),W6=Ko(),Ime=Jo(),Pme=Xc(),K6=bf(),Cme=Wy(),Dme=MT(),FT="Block collections are not allowed within flow collections",LT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Nme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?W6.YAMLMap:Ime.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=Pme.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}J6.resolveFlowCollection=Nme});var Q6=v(X6=>{"use strict";var jme=Ce(),Mme=Pt(),Fme=Ko(),Lme=Jo(),zme=H6(),Ume=Z6(),qme=Y6();function zT(t,e,r,n,i,o){let s=r.type==="block-map"?zme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Ume.resolveBlockSeq(t,e,r,n,o):qme.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 Bme(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),zT(t,e,r,i,s)}let l=zT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=jme.isNode(u)?u:new Mme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}X6.composeCollection=Bme});var qT=v(eB=>{"use strict";var UT=Pt();function Hme(t,e,r){let n=e.offset,i=Gme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?UT.Scalar.BLOCK_FOLDED:UT.Scalar.BLOCK_LITERAL,s=e.source?Zme(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?` +`}};yf.YAMLError=gf;yf.YAMLParseError=CT;yf.YAMLWarning=DT;yf.prettifyError=vme});var bf=v(j6=>{"use strict";function Sme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}j6.resolveProps=Sme});var Ky=v(M6=>{"use strict";function NT(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(NT(e.key)||NT(e.value))return!0}return!1;default:return!0}}M6.containsNewline=NT});var jT=v(F6=>{"use strict";var wme=Ky();function xme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&wme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}F6.flowIndentCheck=xme});var MT=v(z6=>{"use strict";var L6=Ce();function $me(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||L6.isScalar(o)&&L6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}z6.mapIncludes=$me});var Z6=v(G6=>{"use strict";var U6=Vo(),kme=Ko(),q6=bf(),Eme=Ky(),B6=jT(),Ame=MT(),H6="All mapping items must start at the same column";function Tme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??kme.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=q6.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",H6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Eme.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",H6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&B6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Ame.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=q6.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 Ome=Jo(),Rme=bf(),Ime=jT();function Pme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Ome.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=Rme.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&&Ime.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}V6.resolveBlockSeq=Pme});var Yc=v(K6=>{"use strict";function Cme(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}}K6.resolveEnd=Cme});var Q6=v(X6=>{"use strict";var Dme=Ce(),Nme=Vo(),J6=Ko(),jme=Jo(),Mme=Yc(),Y6=bf(),Fme=Ky(),Lme=MT(),FT="Block collections are not allowed within flow collections",LT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function zme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?J6.YAMLMap:jme.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=Mme.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}X6.resolveFlowCollection=zme});var tB=v(eB=>{"use strict";var Ume=Ce(),qme=Pt(),Bme=Ko(),Hme=Jo(),Gme=Z6(),Zme=W6(),Vme=Q6();function zT(t,e,r,n,i,o){let s=r.type==="block-map"?Gme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Zme.resolveBlockSeq(t,e,r,n,o):Vme.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 Wme(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),zT(t,e,r,i,s)}let l=zT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Ume.isNode(u)?u:new qme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}eB.composeCollection=Wme});var qT=v(rB=>{"use strict";var UT=Pt();function Kme(t,e,r){let n=e.offset,i=Jme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?UT.Scalar.BLOCK_FOLDED:UT.Scalar.BLOCK_LITERAL,s=e.source?Yme(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,41 +112,41 @@ ${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 Gme({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 BT=Pt(),Vme=Xc();function Wme(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=BT.Scalar.PLAIN,c=Kme(o,l);break;case"single-quoted-scalar":a=BT.Scalar.QUOTE_SINGLE,c=Jme(o,l);break;case"double-quoted-scalar":a=BT.Scalar.QUOTE_DOUBLE,c=Yme(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=Vme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function Kme(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}`),tB(t)}function Jme(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),tB(t.slice(1,-1)).replace(/''/g,"'")}function tB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var BT=Pt(),Xme=Yc();function Qme(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=BT.Scalar.PLAIN,c=ehe(o,l);break;case"single-quoted-scalar":a=BT.Scalar.QUOTE_SINGLE,c=the(o,l);break;case"double-quoted-scalar":a=BT.Scalar.QUOTE_DOUBLE,c=rhe(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=Xme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function ehe(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}`),nB(t)}function the(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),nB(t.slice(1,-1)).replace(/''/g,"'")}function nB(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 Xme(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 nhe(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 Qme={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function ehe(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}}rB.resolveFlowScalar=Wme});var oB=v(iB=>{"use strict";var la=Ce(),nB=Pt(),the=qT(),rhe=HT();function nhe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?the.resolveBlockScalar(t,e,n):rhe.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[la.SCALAR]:c?l=ihe(t.schema,i,c,r,n):e.type==="scalar"?l=ohe(t,i,e,n):l=t.schema[la.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=la.isScalar(d)?d:new nB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new nB.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 ihe(t,e,r,n,i){if(r==="!")return t[la.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[la.SCALAR])}function ohe({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[la.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[la.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}iB.composeScalar=nhe});var aB=v(sB=>{"use strict";function she(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}sB.emptyScalarPosition=she});var uB=v(ZT=>{"use strict";var ahe=Xd(),che=Ce(),lhe=Q6(),cB=oB(),uhe=Xc(),dhe=aB(),fhe={composeNode:lB,composeEmptyNode:GT};function lB(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=phe(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=cB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=lhe.composeCollection(fhe,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=GT(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&&(!che.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 GT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:dhe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=cB.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 phe({options:t},{offset:e,source:r,end:n},i){let o=new ahe.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=uhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ZT.composeEmptyNode=GT;ZT.composeNode=lB});var pB=v(fB=>{"use strict";var mhe=hf(),dB=uB(),hhe=Xc(),ghe=bf();function yhe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new mhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=ghe.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?dB.composeNode(l,i,u,s):dB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=hhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}fB.composeDoc=yhe});var WT=v(gB=>{"use strict";var _he=He("process"),bhe=CA(),vhe=hf(),vf=_f(),mB=Ce(),She=pB(),whe=Xc();function Sf(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 hB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ua=Ce(),oB=Pt(),she=qT(),ahe=HT();function che(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?she.resolveBlockScalar(t,e,n):ahe.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[ua.SCALAR]:c?l=lhe(t.schema,i,c,r,n):e.type==="scalar"?l=uhe(t,i,e,n):l=t.schema[ua.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ua.isScalar(d)?d:new oB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new oB.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 lhe(t,e,r,n,i){if(r==="!")return t[ua.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[ua.SCALAR])}function uhe({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[ua.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ua.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}sB.composeScalar=che});var lB=v(cB=>{"use strict";function dhe(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}cB.emptyScalarPosition=dhe});var fB=v(ZT=>{"use strict";var fhe=Xd(),phe=Ce(),mhe=tB(),uB=aB(),hhe=Yc(),ghe=lB(),yhe={composeNode:dB,composeEmptyNode:GT};function dB(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=_he(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=uB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=mhe.composeCollection(yhe,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=GT(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&&(!phe.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 GT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:ghe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=uB.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 _he({options:t},{offset:e,source:r,end:n},i){let o=new fhe.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=hhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ZT.composeEmptyNode=GT;ZT.composeNode=dB});var hB=v(mB=>{"use strict";var bhe=hf(),pB=fB(),vhe=Yc(),She=bf();function whe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new bhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=She.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?pB.composeNode(l,i,u,s):pB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=vhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}mB.composeDoc=whe});var WT=v(_B=>{"use strict";var xhe=He("process"),$he=CA(),khe=hf(),vf=_f(),gB=Ce(),Ehe=hB(),Ahe=Yc();function Sf(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 yB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=Sf(r);o?this.warnings.push(new vf.YAMLWarning(s,n,i)):this.errors.push(new vf.YAMLParseError(s,n,i))},this.directives=new bhe.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=hB(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(mB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];mB.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 VT=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=Sf(r);o?this.warnings.push(new vf.YAMLWarning(s,n,i)):this.errors.push(new vf.YAMLParseError(s,n,i))},this.directives=new $he.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=yB(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(gB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];gB.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=Sf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=She.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 vf.YAMLParseError(Sf(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 vf.YAMLParseError(Sf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=whe.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 vf.YAMLParseError(Sf(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 vhe.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}}};gB.Composer=VT});var bB=v(Ky=>{"use strict";var xhe=qT(),$he=HT(),khe=_f(),yB=nf();function Ehe(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 khe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return $he.resolveFlowScalar(t,e,n);case"block-scalar":return xhe.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Ahe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=yB.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=Sf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Ehe.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 vf.YAMLParseError(Sf(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 vf.YAMLParseError(Sf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Ahe.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 vf.YAMLParseError(Sf(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 khe.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}}};_B.Composer=VT});var SB=v(Jy=>{"use strict";var The=qT(),Ohe=HT(),Rhe=_f(),bB=nf();function Ihe(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 Rhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ohe.resolveFlowScalar(t,e,n);case"block-scalar":return The.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Phe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=bB.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 _B(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 The(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=yB.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">":Ohe(t,c);break;case'"':KT(t,c,"double-quoted-scalar");break;case"'":KT(t,c,"single-quoted-scalar");break;default:KT(t,c,"scalar")}}function Ohe(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return vB(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 Che(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=bB.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">":Dhe(t,c);break;case'"':KT(t,c,"double-quoted-scalar");break;case"'":KT(t,c,"single-quoted-scalar");break;default:KT(t,c,"scalar")}}function Dhe(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}];_B(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 _B(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 KT(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})}}}Ky.createScalarToken=Ahe;Ky.resolveAsScalar=Ehe;Ky.setScalarValue=The});var SB=v(vB=>{"use strict";var Rhe=t=>"type"in t?Yy(t):Jy(t);function Yy(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Yy(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Jy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Jy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Jy(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 Jy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Yy(e)),r)for(let o of r)i+=o.source;return n&&(i+=Yy(n)),i}vB.stringify=Rhe});var kB=v($B=>{"use strict";var JT=Symbol("break visit"),Ihe=Symbol("skip children"),wB=Symbol("remove item");function ua(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),xB(Object.freeze([]),t,e)}ua.BREAK=JT;ua.SKIP=Ihe;ua.REMOVE=wB;ua.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};ua.parentCollection=(t,e)=>{let r=ua.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 xB(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 YT=bB(),Phe=SB(),Che=kB(),XT="\uFEFF",QT="",eO="",tO="",Dhe=t=>!!t&&"items"in t,Nhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function jhe(t){switch(t){case XT:return"";case QT:return"";case eO:return"";case tO:return"";default:return JSON.stringify(t)}}function Mhe(t){switch(t){case XT:return"byte-order-mark";case QT:return"doc-mode";case eO:return"flow-error-end";case tO: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}];vB(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 vB(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 KT(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})}}}Jy.createScalarToken=Phe;Jy.resolveAsScalar=Ihe;Jy.setScalarValue=Che});var xB=v(wB=>{"use strict";var Nhe=t=>"type"in t?Xy(t):Yy(t);function Xy(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Xy(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Yy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Yy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Yy(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 Yy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Xy(e)),r)for(let o of r)i+=o.source;return n&&(i+=Xy(n)),i}wB.stringify=Nhe});var AB=v(EB=>{"use strict";var JT=Symbol("break visit"),jhe=Symbol("skip children"),$B=Symbol("remove item");function da(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),kB(Object.freeze([]),t,e)}da.BREAK=JT;da.SKIP=jhe;da.REMOVE=$B;da.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};da.parentCollection=(t,e)=>{let r=da.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 kB(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 YT=SB(),Mhe=xB(),Fhe=AB(),XT="\uFEFF",QT="",eO="",tO="",Lhe=t=>!!t&&"items"in t,zhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Uhe(t){switch(t){case XT:return"";case QT:return"";case eO:return"";case tO:return"";default:return JSON.stringify(t)}}function qhe(t){switch(t){case XT:return"byte-order-mark";case QT:return"doc-mode";case eO: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}Dr.createScalarToken=YT.createScalarToken;Dr.resolveAsScalar=YT.resolveAsScalar;Dr.setScalarValue=YT.setScalarValue;Dr.stringify=Phe.stringify;Dr.visit=Che.visit;Dr.BOM=XT;Dr.DOCUMENT=QT;Dr.FLOW_END=eO;Dr.SCALAR=tO;Dr.isCollection=Dhe;Dr.isScalar=Nhe;Dr.prettyToken=jhe;Dr.tokenType=Mhe});var iO=v(AB=>{"use strict";var wf=Xy();function Wn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var EB=new Set("0123456789ABCDEFabcdef"),Fhe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Qy=new Set(",[]{}"),Lhe=new Set(` ,[]{} -\r `),rO=t=>!t||Lhe.has(t),nO=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}Dr.createScalarToken=YT.createScalarToken;Dr.resolveAsScalar=YT.resolveAsScalar;Dr.setScalarValue=YT.setScalarValue;Dr.stringify=Mhe.stringify;Dr.visit=Fhe.visit;Dr.BOM=XT;Dr.DOCUMENT=QT;Dr.FLOW_END=eO;Dr.SCALAR=tO;Dr.isCollection=Lhe;Dr.isScalar=zhe;Dr.prettyToken=Uhe;Dr.tokenType=qhe});var iO=v(OB=>{"use strict";var wf=Qy();function Wn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var TB=new Set("0123456789ABCDEFabcdef"),Bhe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),e_=new Set(",[]{}"),Hhe=new Set(` ,[]{} +\r `),rO=t=>!t||Hhe.has(t),nO=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===` @@ -158,45 +158,45 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus `)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 wf.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(Wn(o)||e&&Qy.has(o))break;r=n}else if(Wn(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 wf.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(Wn(o)||e&&e_.has(o))break;r=n}else if(Wn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&Qy.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&Qy.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield wf.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(Wn(n)||r&&Qy.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(;!Wn(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(Fhe.has(r))r=this.buffer[++e];else if(r==="%"&&EB.has(this.buffer[e+1])&&EB.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&&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&&e_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield wf.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(Wn(n)||r&&e_.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(;!Wn(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(Bhe.has(r))r=this.buffer[++e];else if(r==="%"&&TB.has(this.buffer[e+1])&&TB.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)}};AB.Lexer=nO});var sO=v(TB=>{"use strict";var oO=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 zhe=He("process"),OB=Xy(),Uhe=iO();function Yo(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 t_(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"&&IB(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&&RB(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)}};OB.Lexer=nO});var sO=v(RB=>{"use strict";var oO=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 Ghe=He("process"),IB=Qy(),Zhe=iO();function Yo(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 r_(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"&&CB(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&&PB(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(Yo(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(PB(r.key)&&!Yo(r.sep,"newline")){let s=Qc(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(Yo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Qc(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]}):Yo(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&&!Yo(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)){t_(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||Yo(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=Qc(i);IB(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)){r_(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(Yo(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(DB(r.key)&&!Yo(r.sep,"newline")){let s=Xc(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(Yo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Xc(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]}):Yo(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&&!Yo(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)){r_(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||Yo(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=t_(n),o=Xc(i);CB(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=Qc(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=Qc(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())}}};CB.Parser=aO});var FB=v($f=>{"use strict";var DB=WT(),qhe=hf(),xf=_f(),Bhe=ZA(),Hhe=Ce(),Ghe=sO(),NB=cO();function jB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Ghe.LineCounter||null,prettyErrors:e}}function Zhe(t,e={}){let{lineCounter:r,prettyErrors:n}=jB(e),i=new NB.Parser(r?.addNewLine),o=new DB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(xf.prettifyError(t,r)),a.warnings.forEach(xf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function MB(t,e={}){let{lineCounter:r,prettyErrors:n}=jB(e),i=new NB.Parser(r?.addNewLine),o=new DB.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 xf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(xf.prettifyError(t,r)),s.warnings.forEach(xf.prettifyError(t,r))),s}function Vhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=MB(t,r);if(!i)return null;if(i.warnings.forEach(o=>Bhe.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 Whe(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 Hhe.isDocument(t)&&!n?t.toString(r):new qhe.Document(t,n,r).toString(r)}$f.parse=Vhe;$f.parseAllDocuments=Zhe;$f.parseDocument=MB;$f.stringify=Whe});var Qt=v(Ge=>{"use strict";var Khe=WT(),Jhe=hf(),Yhe=TT(),lO=_f(),Xhe=Xd(),Xo=Ce(),Qhe=Vo(),ege=Pt(),tge=Ko(),rge=Jo(),nge=Xy(),ige=iO(),oge=sO(),sge=cO(),r_=FB(),LB=Wd();Ge.Composer=Khe.Composer;Ge.Document=Jhe.Document;Ge.Schema=Yhe.Schema;Ge.YAMLError=lO.YAMLError;Ge.YAMLParseError=lO.YAMLParseError;Ge.YAMLWarning=lO.YAMLWarning;Ge.Alias=Xhe.Alias;Ge.isAlias=Xo.isAlias;Ge.isCollection=Xo.isCollection;Ge.isDocument=Xo.isDocument;Ge.isMap=Xo.isMap;Ge.isNode=Xo.isNode;Ge.isPair=Xo.isPair;Ge.isScalar=Xo.isScalar;Ge.isSeq=Xo.isSeq;Ge.Pair=Qhe.Pair;Ge.Scalar=ege.Scalar;Ge.YAMLMap=tge.YAMLMap;Ge.YAMLSeq=rge.YAMLSeq;Ge.CST=nge;Ge.Lexer=ige.Lexer;Ge.LineCounter=oge.LineCounter;Ge.Parser=sge.Parser;Ge.parse=r_.parse;Ge.parseAllDocuments=r_.parseAllDocuments;Ge.parseDocument=r_.parseDocument;Ge.stringify=r_.stringify;Ge.visit=LB.visit;Ge.visitAsync=LB.visitAsync});import{execFileSync as zB}from"node:child_process";import{existsSync as n_}from"node:fs";import{join as i_,resolve as age}from"node:path";function cge(t){try{let e=zB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?age(t,e):null}catch{return null}}function uO(t){let e=cge(t);if(!e)return null;try{if(n_(i_(e,"MERGE_HEAD")))return"merge";if(n_(i_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(n_(i_(e,"rebase-merge"))||n_(i_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function da(t){return uO(t)!==null}function dO(t,e){try{let r=zB("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 o_(t,e){return dO(t,e)!==null}var fa=y(()=>{"use strict"});import{execFileSync as lge}from"node:child_process";import{existsSync as uge,readFileSync as dge}from"node:fs";import{join as BB}from"node:path";function kf(t,e){return lge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Qo(t){try{let e=kf(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 es(t,e){fge(t,e);let r=kf(t,["rev-parse","HEAD"]).trim(),n=pge(t,e);return{groups:mge(t,n),head:r,inventory:{after:qB(a_(t,"spec.yaml")),before:qB(fO(t,e,"spec.yaml"))},since:e,unsharded_commits:_ge(t,e)}}function pO(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 fge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!o_(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 pge(t,e){let r=kf(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(!(!UB(c)&&!UB(a)))if(s.startsWith("A")){let l=s_(a_(t,c));if(!l)continue;l.status==="done"?n.push(el(l,"added-as-done")):l.status==="archived"&&n.push(el(l,"archived"))}else if(s.startsWith("D")){let l=s_(fO(t,e,a));l&&n.push(el(l,"archived"))}else{let l=s_(a_(t,c));if(!l)continue;let d=s_(fO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(el(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(el(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(el(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function UB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function el(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>pO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function s_(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 a_(t,e){let r=BB(t,e);if(!uge(r))return null;try{return dge(r,"utf8")}catch{return null}}function fO(t,e,r){try{return kf(t,["show",`${e}:${r}`])}catch{return null}}function mge(t,e){let r=hge(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 hge(t){let e=a_(t,BB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,c_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function qB(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 _ge(t,e){let r=kf(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);gge.test(a)&&(yge.test(a)||n.push({hash:s,subject:a}))}return n}var c_,gge,yge,tl=y(()=>{"use strict";c_=bt(Qt(),1);fa();gge=/^(feat|fix)(\([^)]*\))?!?:/,yge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as HB}from"node:child_process";import{appendFileSync as bge,existsSync as mO,mkdirSync as vge,readFileSync as Sge,renameSync as wge,statSync as xge}from"node:fs";import{userInfo as $ge}from"node:os";import{dirname as kge,join as gO}from"node:path";function yO(t){return gO(t,GB,Ege)}function Xr(t,e){let r=yO(t),n=kge(r);mO(n)||vge(n,{recursive:!0});try{mO(r)&&xge(r).size>Age&&wge(r,gO(n,ZB))}catch{}bge(r,`${JSON.stringify(e)} -`,"utf8")}function hO(t){if(!mO(t))return[];let e=Sge(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function pa(t){return hO(yO(t))}function l_(t){return[...hO(gO(t,GB,ZB)),...hO(yO(t))]}function Qr(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 Tge(t){let e;try{e=HB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=$ge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Oge(t){try{return HB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Ef(t,e){try{let r=pa(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Oge(t),i=Tge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Ef(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var GB,Ege,ZB,Age,Nr=y(()=>{"use strict";GB=".cladding",Ege="events.log.jsonl",ZB="events.log.1.jsonl",Age=5*1024*1024});import{execFileSync as Rge}from"node:child_process";import{existsSync as VB,readdirSync as Ige,readFileSync as Pge,statSync as WB}from"node:fs";import{createHash as Cge}from"node:crypto";import{join as _O}from"node:path";function ma(t){try{return Rge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function bO(t){let e=[],r=_O(t,"spec.yaml");VB(r)&&WB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=_O(t,"spec",i);if(!(!VB(o)||!WB(o).isDirectory()))for(let s of Ige(o))s.endsWith(".yaml")&&e.push(_O(o,s))}e.sort();let n=Cge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Pge(i)),n.update("\0")}return n.digest("hex")}function u_(t,e){let r={featureId:e,gitHead:ma(t),specDigest:bO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function d_(t,e){let r=pa(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=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Af=y(()=>{"use strict";Nr()});import{readFileSync as Dge,statSync as Nge}from"node:fs";import{extname as jge,resolve as vO,sep as Mge}from"node:path";function en(t){return Math.ceil(t.length/4)}function zge(t,e){let r=vO(e),n=vO(r,t);return n===r||n.startsWith(r+Mge)}function JB(t,e,r,n){if(!zge(t,e))return{path:t,omitted:"unsafe-path"};if(!Fge.has(jge(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>KB)return{path:t,omitted:"too-large",bytes:o}}else{let l=vO(e,t);try{o=Nge(l).size}catch{return{path:t,omitted:"missing"}}if(o>KB)return{path:t,omitted:"too-large",bytes:o};try{i=Dge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Lge))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=t_(e),n=Xc(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=t_(e),n=Xc(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())}}};NB.Parser=aO});var zB=v($f=>{"use strict";var jB=WT(),Vhe=hf(),xf=_f(),Whe=ZA(),Khe=Ce(),Jhe=sO(),MB=cO();function FB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Jhe.LineCounter||null,prettyErrors:e}}function Yhe(t,e={}){let{lineCounter:r,prettyErrors:n}=FB(e),i=new MB.Parser(r?.addNewLine),o=new jB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(xf.prettifyError(t,r)),a.warnings.forEach(xf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function LB(t,e={}){let{lineCounter:r,prettyErrors:n}=FB(e),i=new MB.Parser(r?.addNewLine),o=new jB.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 xf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(xf.prettifyError(t,r)),s.warnings.forEach(xf.prettifyError(t,r))),s}function Xhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=LB(t,r);if(!i)return null;if(i.warnings.forEach(o=>Whe.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 Qhe(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 Khe.isDocument(t)&&!n?t.toString(r):new Vhe.Document(t,n,r).toString(r)}$f.parse=Xhe;$f.parseAllDocuments=Yhe;$f.parseDocument=LB;$f.stringify=Qhe});var Qt=v(Ge=>{"use strict";var ege=WT(),tge=hf(),rge=TT(),lO=_f(),nge=Xd(),Xo=Ce(),ige=Vo(),oge=Pt(),sge=Ko(),age=Jo(),cge=Qy(),lge=iO(),uge=sO(),dge=cO(),n_=zB(),UB=Wd();Ge.Composer=ege.Composer;Ge.Document=tge.Document;Ge.Schema=rge.Schema;Ge.YAMLError=lO.YAMLError;Ge.YAMLParseError=lO.YAMLParseError;Ge.YAMLWarning=lO.YAMLWarning;Ge.Alias=nge.Alias;Ge.isAlias=Xo.isAlias;Ge.isCollection=Xo.isCollection;Ge.isDocument=Xo.isDocument;Ge.isMap=Xo.isMap;Ge.isNode=Xo.isNode;Ge.isPair=Xo.isPair;Ge.isScalar=Xo.isScalar;Ge.isSeq=Xo.isSeq;Ge.Pair=ige.Pair;Ge.Scalar=oge.Scalar;Ge.YAMLMap=sge.YAMLMap;Ge.YAMLSeq=age.YAMLSeq;Ge.CST=cge;Ge.Lexer=lge.Lexer;Ge.LineCounter=uge.LineCounter;Ge.Parser=dge.Parser;Ge.parse=n_.parse;Ge.parseAllDocuments=n_.parseAllDocuments;Ge.parseDocument=n_.parseDocument;Ge.stringify=n_.stringify;Ge.visit=UB.visit;Ge.visitAsync=UB.visitAsync});import{execFileSync as qB}from"node:child_process";import{existsSync as i_}from"node:fs";import{join as o_,resolve as fge}from"node:path";function pge(t){try{let e=qB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?fge(t,e):null}catch{return null}}function uO(t){let e=pge(t);if(!e)return null;try{if(i_(o_(e,"MERGE_HEAD")))return"merge";if(i_(o_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(i_(o_(e,"rebase-merge"))||i_(o_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function fa(t){return uO(t)!==null}function dO(t,e){try{let r=qB("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 s_(t,e){return dO(t,e)!==null}var pa=y(()=>{"use strict"});import{execFileSync as mge}from"node:child_process";import{existsSync as hge,readFileSync as gge}from"node:fs";import{join as GB}from"node:path";function kf(t,e){return mge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Qo(t){try{let e=kf(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 es(t,e){yge(t,e);let r=kf(t,["rev-parse","HEAD"]).trim(),n=_ge(t,e);return{groups:bge(t,n),head:r,inventory:{after:HB(c_(t,"spec.yaml")),before:HB(fO(t,e,"spec.yaml"))},since:e,unsharded_commits:xge(t,e)}}function pO(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 yge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!s_(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 _ge(t,e){let r=kf(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(!(!BB(c)&&!BB(a)))if(s.startsWith("A")){let l=a_(c_(t,c));if(!l)continue;l.status==="done"?n.push(Qc(l,"added-as-done")):l.status==="archived"&&n.push(Qc(l,"archived"))}else if(s.startsWith("D")){let l=a_(fO(t,e,a));l&&n.push(Qc(l,"archived"))}else{let l=a_(c_(t,c));if(!l)continue;let d=a_(fO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(Qc(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(Qc(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(Qc(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function BB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function Qc(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>pO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function a_(t){if(t===null)return null;let e;try{e=(0,l_.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=GB(t,e);if(!hge(r))return null;try{return gge(r,"utf8")}catch{return null}}function fO(t,e,r){try{return kf(t,["show",`${e}:${r}`])}catch{return null}}function bge(t,e){let r=vge(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 vge(t){let e=c_(t,GB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,l_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function HB(t){let e={};if(t!==null)try{let n=(0,l_.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 xge(t,e){let r=kf(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);Sge.test(a)&&(wge.test(a)||n.push({hash:s,subject:a}))}return n}var l_,Sge,wge,el=y(()=>{"use strict";l_=bt(Qt(),1);pa();Sge=/^(feat|fix)(\([^)]*\))?!?:/,wge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as ZB}from"node:child_process";import{appendFileSync as $ge,existsSync as mO,mkdirSync as kge,readFileSync as Ege,renameSync as Age,statSync as Tge}from"node:fs";import{userInfo as Oge}from"node:os";import{dirname as Rge,join as gO}from"node:path";function yO(t){return gO(t,VB,Ige)}function Xr(t,e){let r=yO(t),n=Rge(r);mO(n)||kge(n,{recursive:!0});try{mO(r)&&Tge(r).size>Pge&&Age(r,gO(n,WB))}catch{}$ge(r,`${JSON.stringify(e)} +`,"utf8")}function hO(t){if(!mO(t))return[];let e=Ege(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ma(t){return hO(yO(t))}function u_(t){return[...hO(gO(t,VB,WB)),...hO(yO(t))]}function Qr(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 Cge(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=Oge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Dge(t){try{return ZB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Ef(t,e){try{let r=ma(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Dge(t),i=Cge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Ef(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var VB,Ige,WB,Pge,Nr=y(()=>{"use strict";VB=".cladding",Ige="events.log.jsonl",WB="events.log.1.jsonl",Pge=5*1024*1024});import{execFileSync as Nge}from"node:child_process";import{existsSync as KB,readdirSync as jge,readFileSync as Mge,statSync as JB}from"node:fs";import{createHash as Fge}from"node:crypto";import{join as _O}from"node:path";function ha(t){try{return Nge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function bO(t){let e=[],r=_O(t,"spec.yaml");KB(r)&&JB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=_O(t,"spec",i);if(!(!KB(o)||!JB(o).isDirectory()))for(let s of jge(o))s.endsWith(".yaml")&&e.push(_O(o,s))}e.sort();let n=Fge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Mge(i)),n.update("\0")}return n.digest("hex")}function d_(t,e){let r={featureId:e,gitHead:ha(t),specDigest:bO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function f_(t,e){let r=ma(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 p_(t,e,r,n){let i=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Af=y(()=>{"use strict";Nr()});import{readFileSync as Lge,statSync as zge}from"node:fs";import{extname as Uge,resolve as vO,sep as qge}from"node:path";function en(t){return Math.ceil(t.length/4)}function Gge(t,e){let r=vO(e),n=vO(r,t);return n===r||n.startsWith(r+qge)}function XB(t,e,r,n){if(!Gge(t,e))return{path:t,omitted:"unsafe-path"};if(!Bge.has(Uge(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>YB)return{path:t,omitted:"too-large",bytes:o}}else{let l=vO(e,t);try{o=zge(l).size}catch{return{path:t,omitted:"missing"}}if(o>YB)return{path:t,omitted:"too-large",bytes:o};try{i=Lge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Hge))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 Fge,KB,Lge,p_=y(()=>{"use strict";Fge=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"]),KB=2e6,Lge="\0"});function qge(t){for(let i of Uge)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 SO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Bge(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??[])SO(e,s,o);for(let s of i.modules??[])SO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=qge(a);c&&SO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=YB.get(t);return e||(e=Bge(t),YB.set(t,e)),e}var Uge,YB,ha=y(()=>{"use strict";Uge=["derived:","fixture:","script:","self-dogfood:"];YB=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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Hge(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:xO(i)}}var ga=y(()=>{"use strict";ha()});function XB(t){return t.impacted.length}function h_(t,e,r={}){let n=r.initialDepth??m_.initialDepth,i=r.maxDepth??m_.maxDepth,o=r.coverageThreshold??m_.coverageThreshold,s=r.marginYieldThreshold??m_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=wO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=XB(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var m_,$O=y(()=>{"use strict";ga();ha();m_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Gge(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 QB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Gge(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 eH=y(()=>{"use strict"});function Zge(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 rl(t,e){let r=Zge(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=QB(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 g_=y(()=>{"use strict";eH()});import{existsSync as rH,readdirSync as Vge,readFileSync as Wge}from"node:fs";import{join as EO}from"node:path";function AO(t,e=Jge){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function Yge(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:AO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:AO(`done reverted \u2014 pre-push strict gate red${r}`)}}function tH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function Xge(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 AO(n)}function Qge(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)=>tH(m)-tH(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(-Kge).map(Yge),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?Xge(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 kO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function eye(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 tye(t,e,r){let n=kO(t,/_Rolled back at_\s*`([^`]+)`/),i=kO(t,/Last failed gate:\s*`([^`]+)`/),o=kO(t,/Retry attempts:\s*(\d+)/),s=eye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function rye(t,e){let r=EO(t,".cladding","post-mortems");if(!rH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Vge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(tye(Wge(EO(r,o),"utf8"),e,o))}catch{}return i}function nH(t,e){try{let r=l_(t),n=rye(t,e),i=rH(EO(t,".cladding","events.log.1.jsonl"));return Qge(r,n,e,{truncated:i})}catch{return}}var Kge,Jge,iH=y(()=>{"use strict";Nr();Kge=5,Jge=120});function y_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function ya(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:nye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=rl(t,o);if("not_found"in c)return c;let l=c.focus,u=nH(n,l.id),d=a&&a.size>0?e:l.id,f=h_(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}},O=[...c.ancestors];for(;O.length>iye&&y_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Wt),Wt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),E=(se,Pe,Wt,dr)=>{let Yt=Wt+dr>0?[`breaks: omitted ${Wt} feature(s) / ${dr} test(s)`]:[],oo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(oo))>i},q=m,Q=h;if(E(q,Q,0,0)){let se=br(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Wt=new Set("not_found"in se?[]:se.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],oo=0;for(;Yt.length>Pe.size&&E(Yt,Q,oo,0);)Yt=Yt.slice(0,-1),oo++;let vi=[...h],Yr=0;for(;E(Yt,vi,oo,Yr);){let de=-1;for(let so=vi.length-1;so>=0;so--)if(!Wt.has(vi[so])){de=so;break}if(de<0)break;vi.splice(de,1),Yr++}q=Yt,Q=vi,oo+Yr>0&&x.push(`breaks: omitted ${oo} feature(s) / ${Yr} test(s)`),E(q,Q,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Se=D(q,Q),P={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Se},C=P;if(u){let se={...P,prior_attempts:u};en(JSON.stringify(se))<=i?C=se:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(C));return{...C,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var nye,iye,__=y(()=>{"use strict";p_();g_();$O();iH();ga();ha();nye=3e3,iye=3});function Kn(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 oye(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 oH(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=ya(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=ya(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=h_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:oye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var nl,b_=y(()=>{"use strict";p_();$O();__();ha();nl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as sye,existsSync as TO,mkdirSync as aye,readFileSync as sH}from"node:fs";import{dirname as cye,join as lye}from"node:path";function OO(t){return lye(t,uye,dye)}function fye(t,e){return{timestamp:new Date().toISOString(),head:ma(t),spec_digest:bO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function aH(t,e){try{let r=fye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=RO(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=OO(t),s=cye(o);return TO(s)||aye(s,{recursive:!0}),sye(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function cH(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 RO(t,e){let r=OO(t);if(!TO(r))return[];let n;try{n=sH(r,"utf8")}catch{return[]}let i=cH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function lH(t){let e=OO(t);if(!TO(e))return{snapshots:[],unreadable:!1};let r;try{r=sH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=cH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Tf(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 uH(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?` (${Tf(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(` ${nl}`),i.join(` -`)}var uye,dye,Of=y(()=>{"use strict";Af();b_();uye=".cladding",dye="measure.jsonl"});import{existsSync as pye}from"node:fs";import{join as mye}from"node:path";function il(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}** (${hye[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 fH(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 ${Tf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Tf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Tf(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`,"",nl),r.join(` -`)}function ol(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"} | ${yye(l,r)} |`)}return n.join(` -`)}function yye(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 gye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${pye(mye(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),dH(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)dH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function dH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=pO(r);n&&t.push(`- ${n}`)}t.push("")}var hye,gye,v_=y(()=>{"use strict";Of();b_();tl();hye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};gye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as _ye}from"node:fs";function ki(t="./spec.yaml"){let e=_ye(t,"utf8");return(0,pH.parse)(e)}var pH,S_=y(()=>{"use strict";pH=bt(Qt(),1)});var ts=v((jr,DO)=>{"use strict";var IO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+hH(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()};IO.prototype.toString=function(){return this.property+" "+this.message};var w_=jr.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 IO(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 IO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new _a(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 bye(t,e){return e+": "+t.toString()+` -`}w_.prototype.toString=function(e){return this.errors.map(bye).join("")};Object.defineProperty(w_.prototype,"valid",{get:function(){return!this.errors.length}});DO.exports.ValidatorResultError=_a;function _a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,_a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}_a.prototype=new Error;_a.prototype.constructor=_a;_a.prototype.name="Validation Error";var mH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};mH.prototype=Object.create(Error.prototype,{constructor:{value:mH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var PO=jr.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+hH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};PO.prototype.resolve=function(e){return gH(this.base,e)};PO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=gH(this.base,i||"");var s=new PO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var hH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 vye(t,e,r,n){typeof r=="object"?e[n]=CO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Sye(t,e,r){e[r]=t[r]}function wye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=CO(t[n],e[n]):r[n]=e[n]}function CO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(vye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Sye.bind(null,t,n)),Object.keys(e).forEach(wye.bind(null,t,e,n))),n}DO.exports.deepMerge=CO;jr.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 xye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(xye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var gH=jr.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 vH=v((aXe,bH)=>{"use strict";var tn=ts(),Fe=tn.ValidatorResult,rs=tn.SchemaError,NO={};NO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=NO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 jO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new rs("anyOf must be an array");if(!r.anyOf.some(jO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new rs("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new rs("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(jO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=jO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 MO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new rs('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(MO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=MO(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 yH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('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&&yH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)yH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 $ye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var FO=ts();LO.exports.SchemaScanResult=SH;function SH(t,e){this.id=t,this.ref=e}LO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=FO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=FO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!FO.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 wH=vH(),ns=ts(),xH=x_().scan,$H=ns.ValidatorResult,kye=ns.ValidatorResultError,Rf=ns.SchemaError,kH=ns.SchemaContext,Eye="/",Kt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ei),this.attributes=Object.create(wH.validators)};Kt.prototype.customFormats={};Kt.prototype.schemas=null;Kt.prototype.types=null;Kt.prototype.attributes=null;Kt.prototype.unresolvedRefs=null;Kt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=xH(r||Eye,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]};Kt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ns.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Rf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Kt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Rf('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 Ei=Kt.prototype.types={};Ei.string=function(e){return typeof e=="string"};Ei.number=function(e){return typeof e=="number"&&isFinite(e)};Ei.integer=function(e){return typeof e=="number"&&e%1===0};Ei.boolean=function(e){return typeof e=="boolean"};Ei.array=function(e){return Array.isArray(e)};Ei.null=function(e){return e===null};Ei.date=function(e){return e instanceof Date};Ei.any=function(e){return!0};Ei.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};AH.exports=Kt});var OH=v((uXe,uo)=>{"use strict";var Aye=uo.exports.Validator=TH();uo.exports.ValidatorResult=ts().ValidatorResult;uo.exports.ValidatorResultError=ts().ValidatorResultError;uo.exports.ValidationError=ts().ValidationError;uo.exports.SchemaError=ts().SchemaError;uo.exports.SchemaScanResult=x_().SchemaScanResult;uo.exports.scan=x_().scan;uo.exports.validate=function(t,e,r){var n=new Aye;return n.validate(t,e,r)}});import{readFileSync as Tye}from"node:fs";import{dirname as Oye,join as Rye}from"node:path";import{fileURLToPath as Iye}from"node:url";function jye(t){let e=Nye.validate(t,Dye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function IH(t){let e=jye(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 Bge,YB,Hge,m_=y(()=>{"use strict";Bge=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"]),YB=2e6,Hge="\0"});function Vge(t){for(let i of Zge)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 SO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Wge(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??[])SO(e,s,o);for(let s of i.modules??[])SO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Vge(a);c&&SO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=QB.get(t);return e||(e=Wge(t),QB.set(t,e)),e}var Zge,QB,ga=y(()=>{"use strict";Zge=["derived:","fixture:","script:","self-dogfood:"];QB=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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Kge(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:xO(i)}}var ya=y(()=>{"use strict";ga()});function eH(t){return t.impacted.length}function g_(t,e,r={}){let n=r.initialDepth??h_.initialDepth,i=r.maxDepth??h_.maxDepth,o=r.coverageThreshold??h_.coverageThreshold,s=r.marginYieldThreshold??h_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=wO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=eH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var h_,$O=y(()=>{"use strict";ya();ga();h_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Jge(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 tH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Jge(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 rH=y(()=>{"use strict"});function Yge(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 tl(t,e){let r=Yge(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=tH(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 y_=y(()=>{"use strict";rH()});import{existsSync as iH,readdirSync as Xge,readFileSync as Qge}from"node:fs";import{join as EO}from"node:path";function AO(t,e=tye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function rye(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:AO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:AO(`done reverted \u2014 pre-push strict gate red${r}`)}}function nH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function nye(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 AO(n)}function iye(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)=>nH(m)-nH(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(-eye).map(rye),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?nye(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 kO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function oye(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 sye(t,e,r){let n=kO(t,/_Rolled back at_\s*`([^`]+)`/),i=kO(t,/Last failed gate:\s*`([^`]+)`/),o=kO(t,/Retry attempts:\s*(\d+)/),s=oye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function aye(t,e){let r=EO(t,".cladding","post-mortems");if(!iH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Xge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(sye(Qge(EO(r,o),"utf8"),e,o))}catch{}return i}function oH(t,e){try{let r=u_(t),n=aye(t,e),i=iH(EO(t,".cladding","events.log.1.jsonl"));return iye(r,n,e,{truncated:i})}catch{return}}var eye,tye,sH=y(()=>{"use strict";Nr();eye=5,tye=120});function __(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function _a(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:cye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=tl(t,o);if("not_found"in c)return c;let l=c.focus,u=oH(n,l.id),d=a&&a.size>0?e:l.id,f=g_(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}},O=[...c.ancestors];for(;O.length>lye&&__(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),E=(se,Pe,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],oo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(oo))>i},q=m,Q=h;if(E(q,Q,0,0)){let se=br(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],oo=0;for(;Yt.length>Pe.size&&E(Yt,Q,oo,0);)Yt=Yt.slice(0,-1),oo++;let Si=[...h],Yr=0;for(;E(Yt,Si,oo,Yr);){let de=-1;for(let so=Si.length-1;so>=0;so--)if(!Kt.has(Si[so])){de=so;break}if(de<0)break;Si.splice(de,1),Yr++}q=Yt,Q=Si,oo+Yr>0&&x.push(`breaks: omitted ${oo} feature(s) / ${Yr} test(s)`),E(q,Q,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Se=D(q,Q),P={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Se},C=P;if(u){let se={...P,prior_attempts:u};en(JSON.stringify(se))<=i?C=se:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(C));return{...C,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var cye,lye,b_=y(()=>{"use strict";m_();y_();$O();sH();ya();ga();cye=3e3,lye=3});function Kn(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 uye(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 aH(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=_a(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=_a(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=g_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:uye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var rl,v_=y(()=>{"use strict";m_();$O();b_();ga();rl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as dye,existsSync as TO,mkdirSync as fye,readFileSync as cH}from"node:fs";import{dirname as pye,join as mye}from"node:path";function OO(t){return mye(t,hye,gye)}function yye(t,e){return{timestamp:new Date().toISOString(),head:ha(t),spec_digest:bO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function lH(t,e){try{let r=yye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=RO(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=OO(t),s=pye(o);return TO(s)||fye(s,{recursive:!0}),dye(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function uH(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 RO(t,e){let r=OO(t);if(!TO(r))return[];let n;try{n=cH(r,"utf8")}catch{return[]}let i=uH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function dH(t){let e=OO(t);if(!TO(e))return{snapshots:[],unreadable:!1};let r;try{r=cH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=uH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Tf(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 fH(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?` (${Tf(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(` ${rl}`),i.join(` +`)}var hye,gye,Of=y(()=>{"use strict";Af();v_();hye=".cladding",gye="measure.jsonl"});import{existsSync as _ye}from"node:fs";import{join as bye}from"node:path";function nl(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}** (${vye[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 mH(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 ${Tf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Tf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Tf(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`,"",rl),r.join(` +`)}function il(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"} | ${wye(l,r)} |`)}return n.join(` +`)}function wye(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 Sye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${_ye(bye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function ol(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),pH(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)pH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function pH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=pO(r);n&&t.push(`- ${n}`)}t.push("")}var vye,Sye,S_=y(()=>{"use strict";Of();v_();el();vye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Sye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as xye}from"node:fs";function Ei(t="./spec.yaml"){let e=xye(t,"utf8");return(0,hH.parse)(e)}var hH,w_=y(()=>{"use strict";hH=bt(Qt(),1)});var ts=v((jr,DO)=>{"use strict";var IO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+yH(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()};IO.prototype.toString=function(){return this.property+" "+this.message};var x_=jr.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};x_.prototype.addError=function(e){var r;if(typeof e=="string")r=new IO(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 IO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new ba(this);if(this.throwError)throw r;return r};x_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function $ye(t,e){return e+": "+t.toString()+` +`}x_.prototype.toString=function(e){return this.errors.map($ye).join("")};Object.defineProperty(x_.prototype,"valid",{get:function(){return!this.errors.length}});DO.exports.ValidatorResultError=ba;function ba(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ba),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}ba.prototype=new Error;ba.prototype.constructor=ba;ba.prototype.name="Validation Error";var gH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};gH.prototype=Object.create(Error.prototype,{constructor:{value:gH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var PO=jr.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+yH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};PO.prototype.resolve=function(e){return _H(this.base,e)};PO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=_H(this.base,i||"");var s=new PO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var yH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 kye(t,e,r,n){typeof r=="object"?e[n]=CO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Eye(t,e,r){e[r]=t[r]}function Aye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=CO(t[n],e[n]):r[n]=e[n]}function CO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(kye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Eye.bind(null,t,n)),Object.keys(e).forEach(Aye.bind(null,t,e,n))),n}DO.exports.deepMerge=CO;jr.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 Tye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Tye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var _H=jr.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 wH=v((fXe,SH)=>{"use strict";var tn=ts(),Fe=tn.ValidatorResult,rs=tn.SchemaError,NO={};NO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=NO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 jO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new rs("anyOf must be an array");if(!r.anyOf.some(jO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new rs("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new rs("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(jO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=jO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 MO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new rs('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(MO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=MO(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 bH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('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&&bH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)bH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Oye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var FO=ts();LO.exports.SchemaScanResult=xH;function xH(t,e){this.id=t,this.ref=e}LO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=FO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=FO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!FO.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 $H=wH(),ns=ts(),kH=$_().scan,EH=ns.ValidatorResult,Rye=ns.ValidatorResultError,Rf=ns.SchemaError,AH=ns.SchemaContext,Iye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ai),this.attributes=Object.create($H.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=kH(r||Iye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ns.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Rf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Rf('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 Ai=Jt.prototype.types={};Ai.string=function(e){return typeof e=="string"};Ai.number=function(e){return typeof e=="number"&&isFinite(e)};Ai.integer=function(e){return typeof e=="number"&&e%1===0};Ai.boolean=function(e){return typeof e=="boolean"};Ai.array=function(e){return Array.isArray(e)};Ai.null=function(e){return e===null};Ai.date=function(e){return e instanceof Date};Ai.any=function(e){return!0};Ai.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};OH.exports=Jt});var IH=v((hXe,uo)=>{"use strict";var Pye=uo.exports.Validator=RH();uo.exports.ValidatorResult=ts().ValidatorResult;uo.exports.ValidatorResultError=ts().ValidatorResultError;uo.exports.ValidationError=ts().ValidationError;uo.exports.SchemaError=ts().SchemaError;uo.exports.SchemaScanResult=$_().SchemaScanResult;uo.exports.scan=$_().scan;uo.exports.validate=function(t,e,r){var n=new Pye;return n.validate(t,e,r)}});import{readFileSync as Cye}from"node:fs";import{dirname as Dye,join as Nye}from"node:path";import{fileURLToPath as jye}from"node:url";function Uye(t){let e=zye.validate(t,Lye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function CH(t){let e=Uye(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var RH,Pye,Cye,Dye,Nye,PH=y(()=>{"use strict";RH=bt(OH(),1),Pye=Oye(Iye(import.meta.url)),Cye=Rye(Pye,"schema.json"),Dye=JSON.parse(Tye(Cye,"utf8")),Nye=new RH.Validator});import{existsSync as zO,readdirSync as Mye}from"node:fs";import{dirname as Fye,join as ba,resolve as DH}from"node:path";function CH(t){return zO(t)?Mye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ki(ba(t,r))):[]}function va(t,e){$_=e?{cwd:DH(t),spec:e}:null}function G(t=".",e="spec.yaml"){return $_&&e==="spec.yaml"&&DH(t)===$_.cwd?$_.spec:Lye(t,e)}function Lye(t,e){let r=ba(t,e),n=ki(r),i=ba(t,Fye(e),"spec");if(!n.features||n.features.length===0){let o=CH(ba(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=CH(ba(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ba(i,"architecture.yaml");zO(o)&&(n.architecture=ki(o))}if(!n.capabilities||n.capabilities.length===0){let o=ba(i,"capabilities.yaml");if(zO(o)){let s=ki(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return IH(n),n}var $_,qe=y(()=>{"use strict";S_();PH();$_=null});import al from"node:process";function BO(){return!!al.stdout.isTTY}function L(t,e,r=""){let n=NH[t],i=r?` ${r}`:"";BO()?al.stdout.write(`${UO[t]}${n}${qO} ${e}${i} -`):al.stdout.write(`${n} ${e}${i} -`)}function If(t,e,r=""){if(!BO())return;let n=r?` ${r}`:"";al.stdout.write(`${jH}${UO.start}\xB7${qO} ${t} \xB7 ${e}${n}`)}function Sa(t,e,r=""){let n=NH[t],i=r?` ${r}`:"";BO()?al.stdout.write(`${jH}${UO[t]}${n}${qO} ${e}${i} -`):al.stdout.write(`${n} ${e}${i} -`)}var NH,UO,qO,jH,Ai=y(()=>{"use strict";NH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},UO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},qO="\x1B[0m",jH="\r\x1B[K"});import{createHash as nG}from"node:crypto";import{existsSync as y_e,readFileSync as ZO,writeFileSync as __e}from"node:fs";import{join as k_}from"node:path";function b_e(t,e){let r=nG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(ZO(k_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function oG(t,e){let r=nG("sha256");try{r.update(ZO(k_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function is(t){let e=k_(t,...iG);if(!y_e(e))return null;let r;try{r=ZO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function E_(t){return t.features?.size??t.v1?.size??0}function A_(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)!==oG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===b_e(e,n)?{state:"fresh"}:{state:"stale"}}function sG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${oG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=v_e+`attested_modules: + `)}`)}var PH,Mye,Fye,Lye,zye,DH=y(()=>{"use strict";PH=bt(IH(),1),Mye=Dye(jye(import.meta.url)),Fye=Nye(Mye,"schema.json"),Lye=JSON.parse(Cye(Fye,"utf8")),zye=new PH.Validator});import{existsSync as zO,readdirSync as qye}from"node:fs";import{dirname as Bye,join as va,resolve as jH}from"node:path";function NH(t){return zO(t)?qye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ei(va(t,r))):[]}function Sa(t,e){k_=e?{cwd:jH(t),spec:e}:null}function G(t=".",e="spec.yaml"){return k_&&e==="spec.yaml"&&jH(t)===k_.cwd?k_.spec:Hye(t,e)}function Hye(t,e){let r=va(t,e),n=Ei(r),i=va(t,Bye(e),"spec");if(!n.features||n.features.length===0){let o=NH(va(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=NH(va(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=va(i,"architecture.yaml");zO(o)&&(n.architecture=Ei(o))}if(!n.capabilities||n.capabilities.length===0){let o=va(i,"capabilities.yaml");if(zO(o)){let s=Ei(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return CH(n),n}var k_,qe=y(()=>{"use strict";w_();DH();k_=null});import sl from"node:process";function BO(){return!!sl.stdout.isTTY}function L(t,e,r=""){let n=MH[t],i=r?` ${r}`:"";BO()?sl.stdout.write(`${UO[t]}${n}${qO} ${e}${i} +`):sl.stdout.write(`${n} ${e}${i} +`)}function If(t,e,r=""){if(!BO())return;let n=r?` ${r}`:"";sl.stdout.write(`${FH}${UO.start}\xB7${qO} ${t} \xB7 ${e}${n}`)}function wa(t,e,r=""){let n=MH[t],i=r?` ${r}`:"";BO()?sl.stdout.write(`${FH}${UO[t]}${n}${qO} ${e}${i} +`):sl.stdout.write(`${n} ${e}${i} +`)}var MH,UO,qO,FH,Ti=y(()=>{"use strict";MH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},UO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},qO="\x1B[0m",FH="\r\x1B[K"});import{createHash as oG}from"node:crypto";import{existsSync as w_e,readFileSync as ZO,writeFileSync as x_e}from"node:fs";import{join as E_}from"node:path";function $_e(t,e){let r=oG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(ZO(E_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function aG(t,e){let r=oG("sha256");try{r.update(ZO(E_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function is(t){let e=E_(t,...sG);if(!w_e(e))return null;let r;try{r=ZO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function A_(t){return t.features?.size??t.v1?.size??0}function T_(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)!==aG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===$_e(e,n)?{state:"fresh"}:{state:"stale"}}function cG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${aG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=k_e+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return __e(k_(t,...iG),s,"utf8"),!0}var iG,v_e,ll=y(()=>{"use strict";iG=["spec","attestation.yaml"];v_e=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return x_e(E_(t,...sG),s,"utf8"),!0}var sG,k_e,cl=y(()=>{"use strict";sG=["spec","attestation.yaml"];k_e=`# 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. # @@ -211,52 +211,52 @@ 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 VO}from"node:path";function T_(t){os={cwd:VO(t),results:new Map}}function aG(t,e,r){!os||os.cwd!==VO(e)||os.results.set(t,r)}function O_(t,e){return!os||os.cwd!==VO(e)?null:os.results.get(t)??null}function R_(){os=null}var os,ul=y(()=>{"use strict";os=null});function At(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 po=y(()=>{});import{fileURLToPath as S_e}from"node:url";var dl,w_e,WO,KO,fl=y(()=>{dl=(t,e)=>{let r=KO(w_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},w_e=t=>WO(t)?t.toString():t,WO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,KO=t=>t instanceof URL?S_e(t):t});var I_,JO=y(()=>{po();fl();I_=(t,e=[],r={})=>{let n=dl(t,"First argument"),[i,o]=At(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(!At(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as x_e}from"node:string_decoder";var cG,lG,zt,mo,$_e,uG,k_e,P_,dG,E_e,Df,A_e,YO,T_e,rn=y(()=>{({toString:cG}=Object.prototype),lG=t=>cG.call(t)==="[object ArrayBuffer]",zt=t=>cG.call(t)==="[object Uint8Array]",mo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),$_e=new TextEncoder,uG=t=>$_e.encode(t),k_e=new TextDecoder,P_=t=>k_e.decode(t),dG=(t,e)=>E_e(t,e).join(""),E_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new x_e(e),n=t.map(o=>typeof o=="string"?uG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Df=t=>t.length===1&&zt(t[0])?t[0]:YO(A_e(t)),A_e=t=>t.map(e=>typeof e=="string"?uG(e):e),YO=t=>{let e=new Uint8Array(T_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},T_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as O_e}from"node:child_process";var hG,gG,R_e,I_e,fG,P_e,pG,mG,C_e,yG=y(()=>{po();rn();hG=t=>Array.isArray(t)&&Array.isArray(t.raw),gG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=R_e({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,{}]},R_e=({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}=I_e(i,t.raw[n]),c=pG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>mG(d)):[mG(l)];return pG(c,u,a)},I_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=fG.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)],mG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(At(t)&&("stdout"in t||"isMaxBuffer"in t))return C_e(t);throw t instanceof O_e||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`)},C_e=({stdout:t})=>{if(typeof t=="string")return t;if(zt(t))return P_(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 XO from"node:process";var Yn,C_,En,D_,ho=y(()=>{Yn=t=>C_.includes(t),C_=[XO.stdin,XO.stdout,XO.stderr],En=["stdin","stdout","stderr"],D_=t=>En[t]??`stdio[${t}]`});import{debuglog as D_e}from"node:util";var bG,QO,N_e,j_e,M_e,F_e,_G,L_e,eR,z_e,U_e,q_e,B_e,tR,go,yo=y(()=>{po();ho();bG=t=>{let e={...t};for(let r of tR)e[r]=QO(t,r);return e},QO=(t,e)=>{let r=Array.from({length:N_e(t)+1}),n=j_e(t[e],r,e);return U_e(n,e)},N_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,j_e=(t,e,r)=>At(t)?M_e(t,e,r):e.fill(t),M_e=(t,e,r)=>{for(let n of Object.keys(t).sort(F_e))for(let i of L_e(n,r,e))e[i]=t[n];return e},F_e=(t,e)=>_G(t)<_G(e)?1:-1,_G=t=>t==="stdout"||t==="stderr"?0:t==="all"?2:1,L_e=(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 VO}from"node:path";function O_(t){os={cwd:VO(t),results:new Map}}function lG(t,e,r){!os||os.cwd!==VO(e)||os.results.set(t,r)}function R_(t,e){return!os||os.cwd!==VO(e)?null:os.results.get(t)??null}function I_(){os=null}var os,ll=y(()=>{"use strict";os=null});function At(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 po=y(()=>{});import{fileURLToPath as E_e}from"node:url";var ul,A_e,WO,KO,dl=y(()=>{ul=(t,e)=>{let r=KO(A_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},A_e=t=>WO(t)?t.toString():t,WO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,KO=t=>t instanceof URL?E_e(t):t});var P_,JO=y(()=>{po();dl();P_=(t,e=[],r={})=>{let n=ul(t,"First argument"),[i,o]=At(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(!At(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as T_e}from"node:string_decoder";var uG,dG,zt,mo,O_e,fG,R_e,C_,pG,I_e,Df,P_e,YO,C_e,rn=y(()=>{({toString:uG}=Object.prototype),dG=t=>uG.call(t)==="[object ArrayBuffer]",zt=t=>uG.call(t)==="[object Uint8Array]",mo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),O_e=new TextEncoder,fG=t=>O_e.encode(t),R_e=new TextDecoder,C_=t=>R_e.decode(t),pG=(t,e)=>I_e(t,e).join(""),I_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new T_e(e),n=t.map(o=>typeof o=="string"?fG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Df=t=>t.length===1&&zt(t[0])?t[0]:YO(P_e(t)),P_e=t=>t.map(e=>typeof e=="string"?fG(e):e),YO=t=>{let e=new Uint8Array(C_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},C_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as D_e}from"node:child_process";var yG,_G,N_e,j_e,mG,M_e,hG,gG,F_e,bG=y(()=>{po();rn();yG=t=>Array.isArray(t)&&Array.isArray(t.raw),_G=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=N_e({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,{}]},N_e=({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}=j_e(i,t.raw[n]),c=hG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>gG(d)):[gG(l)];return hG(c,u,a)},j_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=mG.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)],gG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(At(t)&&("stdout"in t||"isMaxBuffer"in t))return F_e(t);throw t instanceof D_e||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`)},F_e=({stdout:t})=>{if(typeof t=="string")return t;if(zt(t))return C_(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 XO from"node:process";var Yn,D_,En,N_,ho=y(()=>{Yn=t=>D_.includes(t),D_=[XO.stdin,XO.stdout,XO.stderr],En=["stdin","stdout","stderr"],N_=t=>En[t]??`stdio[${t}]`});import{debuglog as L_e}from"node:util";var SG,QO,z_e,U_e,q_e,B_e,vG,H_e,eR,G_e,Z_e,V_e,W_e,tR,go,yo=y(()=>{po();ho();SG=t=>{let e={...t};for(let r of tR)e[r]=QO(t,r);return e},QO=(t,e)=>{let r=Array.from({length:z_e(t)+1}),n=U_e(t[e],r,e);return Z_e(n,e)},z_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,U_e=(t,e,r)=>At(t)?q_e(t,e,r):e.fill(t),q_e=(t,e,r)=>{for(let n of Object.keys(t).sort(B_e))for(let i of H_e(n,r,e))e[i]=t[n];return e},B_e=(t,e)=>vG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,H_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=eR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},eR=t=>{if(t==="all")return t;if(En.includes(t))return En.indexOf(t);let e=z_e.exec(t);if(e!==null)return Number(e[1])},z_e=/^fd(\d+)$/,U_e=(t,e)=>t.map(r=>r===void 0?B_e[e]:r),q_e=D_e("execa").enabled?"full":"none",B_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:q_e,stripFinalNewline:!0},tR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],go=(t,e)=>e==="ipc"?t.at(-1):t[e]});var pl,ml,vG,rR,H_e,N_,j_,ss=y(()=>{yo();pl=({verbose:t},e)=>rR(t,e)!=="none",ml=({verbose:t},e)=>!["none","short"].includes(rR(t,e)),vG=({verbose:t},e)=>{let r=rR(t,e);return N_(r)?r:void 0},rR=(t,e)=>e===void 0?H_e(t):go(t,e),H_e=t=>t.find(e=>N_(e))??j_.findLast(e=>t.includes(e)),N_=t=>typeof t=="function",j_=["none","short","full"]});import{platform as G_e}from"node:process";import{stripVTControlCharacters as Z_e}from"node:util";var SG,Nf,wG,V_e,W_e,K_e,J_e,Y_e,X_e,Q_e,M_=y(()=>{SG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>X_e(wG(o))).join(" ");return{command:n,escapedCommand:i}},Nf=t=>Z_e(t).split(` -`).map(e=>wG(e)).join(` -`),wG=t=>t.replaceAll(K_e,e=>V_e(e)),V_e=t=>{let e=J_e[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Y_e?`\\u${n.padStart(4,"0")}`:`\\U${n}`},W_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},K_e=W_e(),J_e={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Y_e=65535,X_e=t=>Q_e.test(t)?t:G_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Q_e=/^[\w./-]+$/});import xG from"node:process";function nR(){let{env:t}=xG,{TERM:e,TERM_PROGRAM:r}=t;return xG.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 $G=y(()=>{});var kG,EG,ebe,tbe,rbe,nbe,ibe,F_,m7e,AG=y(()=>{$G();kG={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"},EG={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"},ebe={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"},tbe={...kG,...EG},rbe={...kG,...ebe},nbe=nR(),ibe=nbe?tbe:rbe,F_=ibe,m7e=Object.entries(EG)});import obe from"node:tty";var sbe,_e,y7e,TG,_7e,b7e,v7e,S7e,w7e,x7e,$7e,k7e,E7e,A7e,T7e,O7e,R7e,I7e,P7e,L_,C7e,D7e,N7e,j7e,M7e,F7e,L7e,z7e,U7e,OG,q7e,RG,B7e,H7e,G7e,Z7e,V7e,W7e,K7e,J7e,Y7e,X7e,Q7e,iR=y(()=>{sbe=obe?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!sbe)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}},y7e=_e(0,0),TG=_e(1,22),_7e=_e(2,22),b7e=_e(3,23),v7e=_e(4,24),S7e=_e(53,55),w7e=_e(7,27),x7e=_e(8,28),$7e=_e(9,29),k7e=_e(30,39),E7e=_e(31,39),A7e=_e(32,39),T7e=_e(33,39),O7e=_e(34,39),R7e=_e(35,39),I7e=_e(36,39),P7e=_e(37,39),L_=_e(90,39),C7e=_e(40,49),D7e=_e(41,49),N7e=_e(42,49),j7e=_e(43,49),M7e=_e(44,49),F7e=_e(45,49),L7e=_e(46,49),z7e=_e(47,49),U7e=_e(100,49),OG=_e(91,39),q7e=_e(92,39),RG=_e(93,39),B7e=_e(94,39),H7e=_e(95,39),G7e=_e(96,39),Z7e=_e(97,39),V7e=_e(101,49),W7e=_e(102,49),K7e=_e(103,49),J7e=_e(104,49),Y7e=_e(105,49),X7e=_e(106,49),Q7e=_e(107,49)});var IG=y(()=>{iR();iR()});var DG,cbe,z_,PG,lbe,CG,ube,NG=y(()=>{AG();IG();DG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=cbe(r),c=lbe[t]({failed:o,reject:s,piped:n}),l=ube[t]({reject:s});return`${L_(`[${a}]`)} ${L_(`[${i}]`)} ${l(c)} ${l(e)}`},cbe=t=>`${z_(t.getHours(),2)}:${z_(t.getMinutes(),2)}:${z_(t.getSeconds(),2)}.${z_(t.getMilliseconds(),3)}`,z_=(t,e)=>String(t).padStart(e,"0"),PG=({failed:t,reject:e})=>t?e?F_.cross:F_.warning:F_.tick,lbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:PG,duration:PG},CG=t=>t,ube={command:()=>TG,output:()=>CG,ipc:()=>CG,error:({reject:t})=>t?OG:RG,duration:()=>L_}});var jG,dbe,fbe,MG=y(()=>{ss();jG=(t,e,r)=>{let n=vG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>dbe(i,o,n)).filter(i=>i!==void 0).map(i=>fbe(i)).join("")},dbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},fbe=t=>t.endsWith(` +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(En.includes(t))return En.indexOf(t);let e=G_e.exec(t);if(e!==null)return Number(e[1])},G_e=/^fd(\d+)$/,Z_e=(t,e)=>t.map(r=>r===void 0?W_e[e]:r),V_e=L_e("execa").enabled?"full":"none",W_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:V_e,stripFinalNewline:!0},tR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],go=(t,e)=>e==="ipc"?t.at(-1):t[e]});var fl,pl,wG,rR,K_e,j_,M_,ss=y(()=>{yo();fl=({verbose:t},e)=>rR(t,e)!=="none",pl=({verbose:t},e)=>!["none","short"].includes(rR(t,e)),wG=({verbose:t},e)=>{let r=rR(t,e);return j_(r)?r:void 0},rR=(t,e)=>e===void 0?K_e(t):go(t,e),K_e=t=>t.find(e=>j_(e))??M_.findLast(e=>t.includes(e)),j_=t=>typeof t=="function",M_=["none","short","full"]});import{platform as J_e}from"node:process";import{stripVTControlCharacters as Y_e}from"node:util";var xG,Nf,$G,X_e,Q_e,ebe,tbe,rbe,nbe,ibe,F_=y(()=>{xG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>nbe($G(o))).join(" ");return{command:n,escapedCommand:i}},Nf=t=>Y_e(t).split(` +`).map(e=>$G(e)).join(` +`),$G=t=>t.replaceAll(ebe,e=>X_e(e)),X_e=t=>{let e=tbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=rbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Q_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},ebe=Q_e(),tbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},rbe=65535,nbe=t=>ibe.test(t)?t:J_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,ibe=/^[\w./-]+$/});import kG from"node:process";function nR(){let{env:t}=kG,{TERM:e,TERM_PROGRAM:r}=t;return kG.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 EG=y(()=>{});var AG,TG,obe,sbe,abe,cbe,lbe,L_,b7e,OG=y(()=>{EG();AG={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"},TG={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"},obe={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"},sbe={...AG,...TG},abe={...AG,...obe},cbe=nR(),lbe=cbe?sbe:abe,L_=lbe,b7e=Object.entries(TG)});import ube from"node:tty";var dbe,_e,w7e,RG,x7e,$7e,k7e,E7e,A7e,T7e,O7e,R7e,I7e,P7e,C7e,D7e,N7e,j7e,M7e,z_,F7e,L7e,z7e,U7e,q7e,B7e,H7e,G7e,Z7e,IG,V7e,PG,W7e,K7e,J7e,Y7e,X7e,Q7e,eQe,tQe,rQe,nQe,iQe,iR=y(()=>{dbe=ube?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!dbe)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}},w7e=_e(0,0),RG=_e(1,22),x7e=_e(2,22),$7e=_e(3,23),k7e=_e(4,24),E7e=_e(53,55),A7e=_e(7,27),T7e=_e(8,28),O7e=_e(9,29),R7e=_e(30,39),I7e=_e(31,39),P7e=_e(32,39),C7e=_e(33,39),D7e=_e(34,39),N7e=_e(35,39),j7e=_e(36,39),M7e=_e(37,39),z_=_e(90,39),F7e=_e(40,49),L7e=_e(41,49),z7e=_e(42,49),U7e=_e(43,49),q7e=_e(44,49),B7e=_e(45,49),H7e=_e(46,49),G7e=_e(47,49),Z7e=_e(100,49),IG=_e(91,39),V7e=_e(92,39),PG=_e(93,39),W7e=_e(94,39),K7e=_e(95,39),J7e=_e(96,39),Y7e=_e(97,39),X7e=_e(101,49),Q7e=_e(102,49),eQe=_e(103,49),tQe=_e(104,49),rQe=_e(105,49),nQe=_e(106,49),iQe=_e(107,49)});var CG=y(()=>{iR();iR()});var jG,pbe,U_,DG,mbe,NG,hbe,MG=y(()=>{OG();CG();jG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=pbe(r),c=mbe[t]({failed:o,reject:s,piped:n}),l=hbe[t]({reject:s});return`${z_(`[${a}]`)} ${z_(`[${i}]`)} ${l(c)} ${l(e)}`},pbe=t=>`${U_(t.getHours(),2)}:${U_(t.getMinutes(),2)}:${U_(t.getSeconds(),2)}.${U_(t.getMilliseconds(),3)}`,U_=(t,e)=>String(t).padStart(e,"0"),DG=({failed:t,reject:e})=>t?e?L_.cross:L_.warning:L_.tick,mbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:DG,duration:DG},NG=t=>t,hbe={command:()=>RG,output:()=>NG,ipc:()=>NG,error:({reject:t})=>t?IG:PG,duration:()=>z_}});var FG,gbe,ybe,LG=y(()=>{ss();FG=(t,e,r)=>{let n=wG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>gbe(i,o,n)).filter(i=>i!==void 0).map(i=>ybe(i)).join("")},gbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ybe=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as pbe}from"node:util";var Ti,mbe,hbe,gbe,U_,ybe,hl=y(()=>{M_();NG();MG();Ti=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=mbe({type:t,result:i,verboseInfo:n}),s=hbe(e,o),a=jG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},mbe=({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}),hbe=(t,e)=>t.split(` -`).map(r=>gbe({...e,message:r})),gbe=t=>({verboseLine:DG(t),verboseObject:t}),U_=t=>{let e=typeof t=="string"?t:pbe(t);return Nf(e).replaceAll(" "," ".repeat(ybe))},ybe=2});var FG,LG=y(()=>{ss();hl();FG=(t,e)=>{pl(e)&&Ti({type:"command",verboseMessage:t,verboseInfo:e})}});var zG,_be,bbe,vbe,UG=y(()=>{ss();zG=(t,e,r)=>{vbe(t);let n=_be(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},_be=t=>pl({verbose:t})?bbe++:void 0,bbe=0n,vbe=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(!j_.includes(e)&&!N_(e)){let r=j_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as qG}from"node:process";var q_,oR,B_=y(()=>{q_=()=>qG.bigint(),oR=t=>Number(qG.bigint()-t)/1e6});var H_,sR=y(()=>{LG();UG();B_();M_();yo();H_=(t,e,r)=>{let n=q_(),{command:i,escapedCommand:o}=SG(t,e),s=QO(r,"verbose"),a=zG(s,o,{...r});return FG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var VG=v((kQe,ZG)=>{ZG.exports=GG;GG.sync=wbe;var BG=He("fs");function Sbe(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{YG.exports=KG;KG.sync=xbe;var WG=He("fs");function KG(t,e,r){WG.stat(t,function(n,i){r(n,n?!1:JG(i,e))})}function xbe(t,e){return JG(WG.statSync(t),e)}function JG(t,e){return t.isFile()&&$be(t,e)}function $be(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 eZ=v((TQe,QG)=>{var AQe=He("fs"),G_;process.platform==="win32"||global.TESTING_WINDOWS?G_=VG():G_=XG();QG.exports=aR;aR.sync=kbe;function aR(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){aR(t,e||{},function(o,s){o?i(o):n(s)})})}G_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function kbe(t,e){try{return G_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var aZ=v((OQe,sZ)=>{var gl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",tZ=He("path"),Ebe=gl?";":":",rZ=eZ(),nZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),iZ=(t,e)=>{let r=e.colon||Ebe,n=t.match(/\//)||gl&&t.match(/\\/)?[""]:[...gl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=gl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=gl?i.split(r):[""];return gl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},oZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=iZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(nZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=tZ.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];rZ(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)},Abe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=iZ(t,e),o=[];for(let s=0;s{"use strict";var cZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};cR.exports=cZ;cR.exports.default=cZ});var pZ=v((IQe,fZ)=>{"use strict";var uZ=He("path"),Tbe=aZ(),Obe=lZ();function dZ(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=Tbe.sync(t.command,{path:r[Obe({env:r})],pathExt:e?uZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=uZ.resolve(i?t.options.cwd:"",s)),s}function Rbe(t){return dZ(t)||dZ(t,!0)}fZ.exports=Rbe});var mZ=v((PQe,uR)=>{"use strict";var lR=/([()\][%!^"`<>&|;, *?])/g;function Ibe(t){return t=t.replace(lR,"^$1"),t}function Pbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(lR,"^$1"),e&&(t=t.replace(lR,"^$1")),t}uR.exports.command=Ibe;uR.exports.argument=Pbe});var gZ=v((CQe,hZ)=>{"use strict";hZ.exports=/^#!(.*)/});var _Z=v((DQe,yZ)=>{"use strict";var Cbe=gZ();yZ.exports=(t="")=>{let e=t.match(Cbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var vZ=v((NQe,bZ)=>{"use strict";var dR=He("fs"),Dbe=_Z();function Nbe(t){let r=Buffer.alloc(150),n;try{n=dR.openSync(t,"r"),dR.readSync(n,r,0,150,0),dR.closeSync(n)}catch{}return Dbe(r.toString())}bZ.exports=Nbe});var $Z=v((jQe,xZ)=>{"use strict";var jbe=He("path"),SZ=pZ(),wZ=mZ(),Mbe=vZ(),Fbe=process.platform==="win32",Lbe=/\.(?:com|exe)$/i,zbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Ube(t){t.file=SZ(t);let e=t.file&&Mbe(t.file);return e?(t.args.unshift(t.file),t.command=e,SZ(t)):t.file}function qbe(t){if(!Fbe)return t;let e=Ube(t),r=!Lbe.test(e);if(t.options.forceShell||r){let n=zbe.test(e);t.command=jbe.normalize(t.command),t.command=wZ.command(t.command),t.args=t.args.map(o=>wZ.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 Bbe(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:qbe(n)}xZ.exports=Bbe});var AZ=v((MQe,EZ)=>{"use strict";var fR=process.platform==="win32";function pR(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 Hbe(t,e){if(!fR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=kZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function kZ(t,e){return fR&&t===1&&!e.file?pR(e.original,"spawn"):null}function Gbe(t,e){return fR&&t===1&&!e.file?pR(e.original,"spawnSync"):null}EZ.exports={hookChildProcess:Hbe,verifyENOENT:kZ,verifyENOENTSync:Gbe,notFoundError:pR}});var RZ=v((FQe,yl)=>{"use strict";var TZ=He("child_process"),mR=$Z(),hR=AZ();function OZ(t,e,r){let n=mR(t,e,r),i=TZ.spawn(n.command,n.args,n.options);return hR.hookChildProcess(i,n),i}function Zbe(t,e,r){let n=mR(t,e,r),i=TZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||hR.verifyENOENTSync(i.status,n),i}yl.exports=OZ;yl.exports.spawn=OZ;yl.exports.sync=Zbe;yl.exports._parse=mR;yl.exports._enoent=hR});function Z_(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 IZ=y(()=>{});var PZ=y(()=>{});import{promisify as Vbe}from"node:util";import{execFile as Wbe,execFileSync as BQe}from"node:child_process";import CZ from"node:path";import{fileURLToPath as Kbe}from"node:url";function V_(t){return t instanceof URL?Kbe(t):t}function DZ(t){return{*[Symbol.iterator](){let e=CZ.resolve(V_(t)),r;for(;r!==e;)yield e,r=e,e=CZ.resolve(e,"..")}}}var ZQe,VQe,NZ=y(()=>{PZ();ZQe=Vbe(Wbe);VQe=10*1024*1024});import W_ from"node:process";import xa from"node:path";var Jbe,Ybe,Xbe,jZ,MZ=y(()=>{IZ();NZ();Jbe=({cwd:t=W_.cwd(),path:e=W_.env[Z_()],preferLocal:r=!0,execPath:n=W_.execPath,addExecPath:i=!0}={})=>{let o=xa.resolve(V_(t)),s=[],a=e.split(xa.delimiter);return r&&Ybe(s,a,o),i&&Xbe(s,a,n,o),e===""||e===xa.delimiter?`${s.join(xa.delimiter)}${e}`:[...s,e].join(xa.delimiter)},Ybe=(t,e,r)=>{for(let n of DZ(r)){let i=xa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},Xbe=(t,e,r,n)=>{let i=xa.resolve(n,V_(r),"..");e.includes(i)||t.push(i)},jZ=({env:t=W_.env,...e}={})=>{t={...t};let r=Z_({env:t});return e.path=t[r],t[r]=Jbe(e),t}});var FZ,Xn,LZ,zZ,UZ,K_,jf,Mf,$a=y(()=>{FZ=(t,e,r)=>{let n=r?Mf:jf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},LZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,UZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},zZ=t=>K_(t)&&UZ in t,UZ=Symbol("isExecaError"),K_=t=>Object.prototype.toString.call(t)==="[object Error]",jf=class extends Error{};LZ(jf,jf.name);Mf=class extends Error{};LZ(Mf,Mf.name)});var qZ,Qbe,BZ,HZ,GZ=y(()=>{qZ=()=>{let t=HZ-BZ+1;return Array.from({length:t},Qbe)},Qbe=(t,e)=>({name:`SIGRT${e+1}`,number:BZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),BZ=34,HZ=64});var ZZ,VZ=y(()=>{ZZ=[{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 eve}from"node:os";var gR,tve,WZ=y(()=>{VZ();GZ();gR=()=>{let t=qZ();return[...ZZ,...t].map(tve)},tve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=eve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as rve}from"node:os";var nve,ive,KZ,ove,sve,ave,det,JZ=y(()=>{WZ();nve=()=>{let t=gR();return Object.fromEntries(t.map(ive))},ive=({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}],KZ=nve(),ove=()=>{let t=gR(),e=65,r=Array.from({length:e},(n,i)=>sve(i,t));return Object.assign({},...r)},sve=(t,e)=>{let r=ave(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}}},ave=(t,e)=>{let r=e.find(({name:n})=>rve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},det=ove()});import{constants as Ff}from"node:os";var XZ,QZ,e9,cve,lve,YZ,uve,yR,dve,fve,J_,Lf=y(()=>{JZ();XZ=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return e9(t,e)},QZ=t=>t===0?t:e9(t,"`subprocess.kill()`'s argument"),e9=(t,e)=>{if(Number.isInteger(t))return cve(t,e);if(typeof t=="string")return uve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${yR()}`)},cve=(t,e)=>{if(YZ.has(t))return YZ.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${yR()}`)},lve=()=>new Map(Object.entries(Ff.signals).reverse().map(([t,e])=>[e,t])),YZ=lve(),uve=(t,e)=>{if(t in Ff.signals)return t;throw t.toUpperCase()in Ff.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${yR()}`)},yR=()=>`Available signal names: ${dve()}. -Available signal numbers: ${fve()}.`,dve=()=>Object.keys(Ff.signals).sort().map(t=>`'${t}'`).join(", "),fve=()=>[...new Set(Object.values(Ff.signals).sort((t,e)=>t-e))].join(", "),J_=t=>KZ[t].description});import{setTimeout as pve}from"node:timers/promises";var t9,mve,r9,hve,gve,yve,_R,Y_=y(()=>{$a();Lf();t9=t=>{if(t===!1)return t;if(t===!0)return mve;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},mve=1e3*5,r9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=hve(s,a,r);gve(l,n);let u=t(c);return yve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},hve=(t,e,r)=>{let[n=r,i]=K_(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&&!K_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:QZ(n),error:i}},gve=(t,e)=>{t!==void 0&&e.reject(t)},yve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&_R({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},_R=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await pve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as _ve}from"node:events";var X_,bR=y(()=>{X_=async(t,e)=>{t.aborted||await _ve(t,"abort",{signal:e})}});var n9,i9,bve,vR=y(()=>{bR();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?[]:[bve(t,e,n,i)],bve=async(t,e,r,{signal:n})=>{throw await X_(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var _l,vve,SR,o9,s9,Q_,a9,c9,l9,u9,d9,f9,Sve,wve,xve,Qn,$ve,as,bl,vl=y(()=>{_l=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{vve(t,e,r),SR(t,e,n)},vve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},SR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${as(e)} has already exited or disconnected.`)},o9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${as(t)} exited or disconnected.`)},s9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as _be}from"node:util";var Oi,bbe,vbe,Sbe,q_,wbe,ml=y(()=>{F_();MG();LG();Oi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=bbe({type:t,result:i,verboseInfo:n}),s=vbe(e,o),a=FG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},bbe=({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}),vbe=(t,e)=>t.split(` +`).map(r=>Sbe({...e,message:r})),Sbe=t=>({verboseLine:jG(t),verboseObject:t}),q_=t=>{let e=typeof t=="string"?t:_be(t);return Nf(e).replaceAll(" "," ".repeat(wbe))},wbe=2});var zG,UG=y(()=>{ss();ml();zG=(t,e)=>{fl(e)&&Oi({type:"command",verboseMessage:t,verboseInfo:e})}});var qG,xbe,$be,kbe,BG=y(()=>{ss();qG=(t,e,r)=>{kbe(t);let n=xbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},xbe=t=>fl({verbose:t})?$be++:void 0,$be=0n,kbe=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(!M_.includes(e)&&!j_(e)){let r=M_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as HG}from"node:process";var B_,oR,H_=y(()=>{B_=()=>HG.bigint(),oR=t=>Number(HG.bigint()-t)/1e6});var G_,sR=y(()=>{UG();BG();H_();F_();yo();G_=(t,e,r)=>{let n=B_(),{command:i,escapedCommand:o}=xG(t,e),s=QO(r,"verbose"),a=qG(s,o,{...r});return zG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var KG=v((RQe,WG)=>{WG.exports=VG;VG.sync=Abe;var GG=He("fs");function Ebe(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{QG.exports=YG;YG.sync=Tbe;var JG=He("fs");function YG(t,e,r){JG.stat(t,function(n,i){r(n,n?!1:XG(i,e))})}function Tbe(t,e){return XG(JG.statSync(t),e)}function XG(t,e){return t.isFile()&&Obe(t,e)}function Obe(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 rZ=v((CQe,tZ)=>{var PQe=He("fs"),Z_;process.platform==="win32"||global.TESTING_WINDOWS?Z_=KG():Z_=eZ();tZ.exports=aR;aR.sync=Rbe;function aR(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){aR(t,e||{},function(o,s){o?i(o):n(s)})})}Z_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Rbe(t,e){try{return Z_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var lZ=v((DQe,cZ)=>{var hl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",nZ=He("path"),Ibe=hl?";":":",iZ=rZ(),oZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),sZ=(t,e)=>{let r=e.colon||Ibe,n=t.match(/\//)||hl&&t.match(/\\/)?[""]:[...hl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=hl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=hl?i.split(r):[""];return hl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},aZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=sZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(oZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=nZ.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];iZ(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)},Pbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=sZ(t,e),o=[];for(let s=0;s{"use strict";var uZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};cR.exports=uZ;cR.exports.default=uZ});var hZ=v((jQe,mZ)=>{"use strict";var fZ=He("path"),Cbe=lZ(),Dbe=dZ();function pZ(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=Cbe.sync(t.command,{path:r[Dbe({env:r})],pathExt:e?fZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=fZ.resolve(i?t.options.cwd:"",s)),s}function Nbe(t){return pZ(t)||pZ(t,!0)}mZ.exports=Nbe});var gZ=v((MQe,uR)=>{"use strict";var lR=/([()\][%!^"`<>&|;, *?])/g;function jbe(t){return t=t.replace(lR,"^$1"),t}function Mbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(lR,"^$1"),e&&(t=t.replace(lR,"^$1")),t}uR.exports.command=jbe;uR.exports.argument=Mbe});var _Z=v((FQe,yZ)=>{"use strict";yZ.exports=/^#!(.*)/});var vZ=v((LQe,bZ)=>{"use strict";var Fbe=_Z();bZ.exports=(t="")=>{let e=t.match(Fbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var wZ=v((zQe,SZ)=>{"use strict";var dR=He("fs"),Lbe=vZ();function zbe(t){let r=Buffer.alloc(150),n;try{n=dR.openSync(t,"r"),dR.readSync(n,r,0,150,0),dR.closeSync(n)}catch{}return Lbe(r.toString())}SZ.exports=zbe});var EZ=v((UQe,kZ)=>{"use strict";var Ube=He("path"),xZ=hZ(),$Z=gZ(),qbe=wZ(),Bbe=process.platform==="win32",Hbe=/\.(?:com|exe)$/i,Gbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Zbe(t){t.file=xZ(t);let e=t.file&&qbe(t.file);return e?(t.args.unshift(t.file),t.command=e,xZ(t)):t.file}function Vbe(t){if(!Bbe)return t;let e=Zbe(t),r=!Hbe.test(e);if(t.options.forceShell||r){let n=Gbe.test(e);t.command=Ube.normalize(t.command),t.command=$Z.command(t.command),t.args=t.args.map(o=>$Z.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 Wbe(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:Vbe(n)}kZ.exports=Wbe});var OZ=v((qQe,TZ)=>{"use strict";var fR=process.platform==="win32";function pR(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 Kbe(t,e){if(!fR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=AZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function AZ(t,e){return fR&&t===1&&!e.file?pR(e.original,"spawn"):null}function Jbe(t,e){return fR&&t===1&&!e.file?pR(e.original,"spawnSync"):null}TZ.exports={hookChildProcess:Kbe,verifyENOENT:AZ,verifyENOENTSync:Jbe,notFoundError:pR}});var PZ=v((BQe,gl)=>{"use strict";var RZ=He("child_process"),mR=EZ(),hR=OZ();function IZ(t,e,r){let n=mR(t,e,r),i=RZ.spawn(n.command,n.args,n.options);return hR.hookChildProcess(i,n),i}function Ybe(t,e,r){let n=mR(t,e,r),i=RZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||hR.verifyENOENTSync(i.status,n),i}gl.exports=IZ;gl.exports.spawn=IZ;gl.exports.sync=Ybe;gl.exports._parse=mR;gl.exports._enoent=hR});function V_(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 CZ=y(()=>{});var DZ=y(()=>{});import{promisify as Xbe}from"node:util";import{execFile as Qbe,execFileSync as WQe}from"node:child_process";import NZ from"node:path";import{fileURLToPath as eve}from"node:url";function W_(t){return t instanceof URL?eve(t):t}function jZ(t){return{*[Symbol.iterator](){let e=NZ.resolve(W_(t)),r;for(;r!==e;)yield e,r=e,e=NZ.resolve(e,"..")}}}var YQe,XQe,MZ=y(()=>{DZ();YQe=Xbe(Qbe);XQe=10*1024*1024});import K_ from"node:process";import $a from"node:path";var tve,rve,nve,FZ,LZ=y(()=>{CZ();MZ();tve=({cwd:t=K_.cwd(),path:e=K_.env[V_()],preferLocal:r=!0,execPath:n=K_.execPath,addExecPath:i=!0}={})=>{let o=$a.resolve(W_(t)),s=[],a=e.split($a.delimiter);return r&&rve(s,a,o),i&&nve(s,a,n,o),e===""||e===$a.delimiter?`${s.join($a.delimiter)}${e}`:[...s,e].join($a.delimiter)},rve=(t,e,r)=>{for(let n of jZ(r)){let i=$a.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},nve=(t,e,r,n)=>{let i=$a.resolve(n,W_(r),"..");e.includes(i)||t.push(i)},FZ=({env:t=K_.env,...e}={})=>{t={...t};let r=V_({env:t});return e.path=t[r],t[r]=tve(e),t}});var zZ,Xn,UZ,qZ,BZ,J_,jf,Mf,ka=y(()=>{zZ=(t,e,r)=>{let n=r?Mf:jf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},UZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,BZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},qZ=t=>J_(t)&&BZ in t,BZ=Symbol("isExecaError"),J_=t=>Object.prototype.toString.call(t)==="[object Error]",jf=class extends Error{};UZ(jf,jf.name);Mf=class extends Error{};UZ(Mf,Mf.name)});var HZ,ive,GZ,ZZ,VZ=y(()=>{HZ=()=>{let t=ZZ-GZ+1;return Array.from({length:t},ive)},ive=(t,e)=>({name:`SIGRT${e+1}`,number:GZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),GZ=34,ZZ=64});var WZ,KZ=y(()=>{WZ=[{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 ove}from"node:os";var gR,sve,JZ=y(()=>{KZ();VZ();gR=()=>{let t=HZ();return[...WZ,...t].map(sve)},sve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=ove,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as ave}from"node:os";var cve,lve,YZ,uve,dve,fve,get,XZ=y(()=>{JZ();cve=()=>{let t=gR();return Object.fromEntries(t.map(lve))},lve=({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}],YZ=cve(),uve=()=>{let t=gR(),e=65,r=Array.from({length:e},(n,i)=>dve(i,t));return Object.assign({},...r)},dve=(t,e)=>{let r=fve(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}}},fve=(t,e)=>{let r=e.find(({name:n})=>ave.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},get=uve()});import{constants as Ff}from"node:os";var e9,t9,r9,pve,mve,QZ,hve,yR,gve,yve,Y_,Lf=y(()=>{XZ();e9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return r9(t,e)},t9=t=>t===0?t:r9(t,"`subprocess.kill()`'s argument"),r9=(t,e)=>{if(Number.isInteger(t))return pve(t,e);if(typeof t=="string")return hve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${yR()}`)},pve=(t,e)=>{if(QZ.has(t))return QZ.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${yR()}`)},mve=()=>new Map(Object.entries(Ff.signals).reverse().map(([t,e])=>[e,t])),QZ=mve(),hve=(t,e)=>{if(t in Ff.signals)return t;throw t.toUpperCase()in Ff.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${yR()}`)},yR=()=>`Available signal names: ${gve()}. +Available signal numbers: ${yve()}.`,gve=()=>Object.keys(Ff.signals).sort().map(t=>`'${t}'`).join(", "),yve=()=>[...new Set(Object.values(Ff.signals).sort((t,e)=>t-e))].join(", "),Y_=t=>YZ[t].description});import{setTimeout as _ve}from"node:timers/promises";var n9,bve,i9,vve,Sve,wve,_R,X_=y(()=>{ka();Lf();n9=t=>{if(t===!1)return t;if(t===!0)return bve;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},bve=1e3*5,i9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=vve(s,a,r);Sve(l,n);let u=t(c);return wve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},vve=(t,e,r)=>{let[n=r,i]=J_(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&&!J_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:t9(n),error:i}},Sve=(t,e)=>{t!==void 0&&e.reject(t)},wve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&_R({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},_R=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await _ve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as xve}from"node:events";var Q_,bR=y(()=>{Q_=async(t,e)=>{t.aborted||await xve(t,"abort",{signal:e})}});var o9,s9,$ve,vR=y(()=>{bR();o9=({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)}`)},s9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[$ve(t,e,n,i)],$ve=async(t,e,r,{signal:n})=>{throw await Q_(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var yl,kve,SR,a9,c9,eb,l9,u9,d9,f9,p9,m9,Eve,Ave,Tve,Qn,Ove,as,_l,bl=y(()=>{yl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{kve(t,e,r),SR(t,e,n)},kve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},SR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${as(e)} has already exited or disconnected.`)},a9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${as(t)} exited or disconnected.`)},c9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(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([ ${Qn("getOneMessage",t)}, ${Qn("sendMessage",t,"message, {strict: true}")}, -]);`)},Q_=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${as(e)}.`,{cause:t}),a9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is not listening to incoming messages.`)},c9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} exited without listening to incoming messages.`)},l9=()=>new Error(`\`cancelSignal\` aborted: the ${as(!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(`${Qn(e,r)} cannot be used: the ${as(r)} is disconnecting.`,{cause:t})},f9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Sve(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Sve=({code:t,message:e})=>wve.has(t)||xve.some(r=>e.includes(r)),wve=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),xve=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${$ve(e)}${t}(${r})`,$ve=t=>t?"":"subprocess.",as=t=>t?"parent process":"subprocess",bl=t=>{t.connected&&t.disconnect()}});var Oi,Sl=y(()=>{Oi=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var tb,wl,Ri,p9,kve,Eve,m9,Ave,h9,zf,eb,cs=y(()=>{yo();tb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=p9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(m9(o,e,n,!0));return s},wl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ri.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},Ri=new WeakMap,p9=(t,e,r)=>{let n=kve(e,r);return Eve(n,e,r,t),n},kve=(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(`"${zf(e)}" must not be "${t}". +]);`)},eb=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${as(e)}.`,{cause:t}),l9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is not listening to incoming messages.`)},u9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} exited without listening to incoming messages.`)},d9=()=>new Error(`\`cancelSignal\` aborted: the ${as(!0)} disconnected.`),f9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},p9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Qn(e,r)} cannot be used: the ${as(r)} is disconnecting.`,{cause:t})},m9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Eve(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Eve=({code:t,message:e})=>Ave.has(t)||Tve.some(r=>e.includes(r)),Ave=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Tve=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Ove(e)}${t}(${r})`,Ove=t=>t?"":"subprocess.",as=t=>t?"parent process":"subprocess",_l=t=>{t.connected&&t.disconnect()}});var Ri,vl=y(()=>{Ri=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var rb,Sl,Ii,h9,Rve,Ive,g9,Pve,y9,zf,tb,cs=y(()=>{yo();rb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ii.get(t),o=h9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(g9(o,e,n,!0));return s},Sl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ii.get(t),o=h9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(g9(o,e,n,!1));return s},Ii=new WeakMap,h9=(t,e,r)=>{let n=Rve(e,r);return Ive(n,e,r,t),n},Rve=(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(`"${zf(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},Eve=(t,e,r,n)=>{let i=n[h9(t)];if(i===void 0)throw new TypeError(`"${zf(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(`"${zf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${zf(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}=Ave(t,r);return`The "${i}: ${eb(o)}" option is incompatible with using "${zf(n)}: ${eb(e)}". -Please set this option with "pipe" instead.`},Ave=(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,zf=t=>t?"to":"from",eb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Tve}from"node:events";var ka,rb=y(()=>{ka=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Tve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var nb,wR,ib,xR,g9,y9,Uf=y(()=>{nb=(t,e)=>{e&&wR(t)},wR=t=>{t.refCounted()},ib=(t,e)=>{e&&xR(t)},xR=t=>{t.unrefCounted()},g9=(t,e)=>{e&&(xR(t),xR(t))},y9=(t,e)=>{e&&(wR(t),wR(t))}});import{once as Ove}from"node:events";import{scheduler as Rve}from"node:timers/promises";var _9,b9,ob,v9=y(()=>{ab();Uf();sb();cb();_9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(w9(i)||$9(i))return;ob.has(t)||ob.set(t,[]);let o=ob.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await x9(t,n,i),await Rve.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})=>{$R();let o=ob.get(t);for(;o?.length>0;)await Ove(n,"message:done");t.removeListener("message",i),y9(e,r),n.connected=!1,n.emit("disconnect")},ob=new WeakMap});import{EventEmitter as Ive}from"node:events";var ls,lb,Pve,ub,qf=y(()=>{v9();Uf();ls=(t,e,r)=>{if(lb.has(t))return lb.get(t);let n=new Ive;return n.connected=!0,lb.set(t,n),Pve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},lb=new WeakMap,Pve=({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)},ub=t=>{let e=lb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Cve}from"node:events";var k9,Dve,E9,S9,w9,A9,db,Nve,fb,T9,sb=y(()=>{Sl();rb();hb();vl();qf();ab();k9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ls(t,e,r),s=pb(t,o);return{id:Dve++,type:fb,message:n,hasListeners:s}},Dve=0n,E9=(t,e)=>{if(!(e?.type!==fb||e.hasListeners))for(let{id:r}of t)r!==void 0&&db[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:pb(e,i)};try{await mb({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 db[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},A9=async(t,e,r)=>{if(t?.type!==fb)return;let n=Oi();db[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,Nve(e,r,i)]);o&&s9(r),s||a9(r)}finally{i.abort(),delete db[t.id]}},db={},Nve=async(t,e,{signal:r})=>{ka(t,1,r),await Cve(t,"disconnect",{signal:r}),c9(e)},fb="execa:ipc:request",T9="execa:ipc:response"});var O9,R9,x9,Bf,pb,jve,ab=y(()=>{Sl();yo();cs();sb();O9=(t,e,r)=>{Bf.has(t)||Bf.set(t,new Set);let n=Bf.get(t),i=Oi(),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(;!pb(t,e)&&Bf.get(t)?.size>0;){let n=[...Bf.get(t)];E9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Bf=new WeakMap,pb=(t,e)=>e.listenerCount("message")>jve(t),jve=t=>Ri.has(t)&&!go(Ri.get(t).options.buffer,"ipc")?1:0});import{promisify as Mve}from"node:util";var mb,Fve,ER,Lve,kR,hb=y(()=>{vl();ab();sb();mb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return _l({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),Fve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},Fve=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 ER({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw bl(t),c}finally{R9(a)}},ER=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Lve(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}},Lve=t=>{if(kR.has(t))return kR.get(t);let e=Mve(t.send.bind(t));return kR.set(t,e),e},kR=new WeakMap});import{scheduler as zve}from"node:timers/promises";var P9,C9,Uve,I9,$9,D9,$R,AR,cb=y(()=>{hb();qf();vl();P9=(t,e)=>{let r="cancelSignal";return SR(r,!1,t.connected),ER({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:D9,message:e},message:e})},C9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Uve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),AR.signal),Uve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!I9){if(I9=!0,!n){u9();return}if(e===null){$R();return}ls(t,e,r),await zve.yield()}},I9=!1,$9=t=>t?.type!==D9?!1:(AR.abort(t.message),!0),D9="execa:ipc:cancel",$R=()=>{AR.abort(l9())},AR=new AbortController});var N9,j9,qve,Bve,TR=y(()=>{bR();cb();Y_();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?[qve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],qve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await X_(e,i);let o=Bve(e);throw await P9(t,o),_R({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Bve=({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 Hve}from"node:timers/promises";var M9,F9,Gve,OR=y(()=>{$a();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?[]:[Gve(t,e,r,n)],Gve=async(t,e,r,{signal:n})=>{throw await Hve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as Zve,execArgv as Vve}from"node:process";import L9 from"node:path";var z9,U9,RR=y(()=>{fl();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=Zve,nodeOptions:i=Vve.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=dl(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 Wve}from"node:v8";var q9,Kve,Jve,Yve,B9,IR=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`.");Yve[r](t)}},Kve=t=>{try{Wve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},Jve=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},Yve={advanced:Kve,json:Jve},B9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var G9,Xve,nn,PR,Qve,H9,gb,Ea=y(()=>{G9=({encoding:t})=>{if(PR.has(t))return;let e=Qve(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${gb(t)}\`. -Please rename it to ${gb(e)}.`);let r=[...PR].map(n=>gb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${gb(t)}\`. -Please rename it to one of: ${r}.`)},Xve=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),PR=new Set([...Xve,...nn]),Qve=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in H9)return H9[e];if(PR.has(e))return e},H9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},gb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as eSe}from"node:fs";import tSe from"node:path";import rSe from"node:process";var Z9,V9,W9,CR=y(()=>{fl();Z9=(t=V9())=>{let e=dl(t,'The "cwd" option');return tSe.resolve(e)},V9=()=>{try{return rSe.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=eSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},Ive=(t,e,r,n)=>{let i=n[y9(t)];if(i===void 0)throw new TypeError(`"${zf(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(`"${zf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${zf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},g9=(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}=Pve(t,r);return`The "${i}: ${tb(o)}" option is incompatible with using "${zf(n)}: ${tb(e)}". +Please set this option with "pipe" instead.`},Pve=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=y9(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]}},y9=t=>t==="all"?1:t,zf=t=>t?"to":"from",tb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Cve}from"node:events";var Ea,nb=y(()=>{Ea=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Cve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var ib,wR,ob,xR,_9,b9,Uf=y(()=>{ib=(t,e)=>{e&&wR(t)},wR=t=>{t.refCounted()},ob=(t,e)=>{e&&xR(t)},xR=t=>{t.unrefCounted()},_9=(t,e)=>{e&&(xR(t),xR(t))},b9=(t,e)=>{e&&(wR(t),wR(t))}});import{once as Dve}from"node:events";import{scheduler as Nve}from"node:timers/promises";var v9,S9,sb,w9=y(()=>{cb();Uf();ab();lb();v9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if($9(i)||E9(i))return;sb.has(t)||sb.set(t,[]);let o=sb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await k9(t,n,i),await Nve.yield();let s=await x9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},S9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{$R();let o=sb.get(t);for(;o?.length>0;)await Dve(n,"message:done");t.removeListener("message",i),b9(e,r),n.connected=!1,n.emit("disconnect")},sb=new WeakMap});import{EventEmitter as jve}from"node:events";var ls,ub,Mve,db,qf=y(()=>{w9();Uf();ls=(t,e,r)=>{if(ub.has(t))return ub.get(t);let n=new jve;return n.connected=!0,ub.set(t,n),Mve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},ub=new WeakMap,Mve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=v9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",S9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),_9(r,n)},db=t=>{let e=ub.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Fve}from"node:events";var A9,Lve,T9,x9,$9,O9,fb,zve,pb,R9,ab=y(()=>{vl();nb();gb();bl();qf();cb();A9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ls(t,e,r),s=mb(t,o);return{id:Lve++,type:pb,message:n,hasListeners:s}},Lve=0n,T9=(t,e)=>{if(!(e?.type!==pb||e.hasListeners))for(let{id:r}of t)r!==void 0&&fb[r].resolve({isDeadlock:!0,hasListeners:!1})},x9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==pb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:R9,message:mb(e,i)};try{await hb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},$9=t=>{if(t?.type!==R9)return!1;let{id:e,message:r}=t;return fb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},O9=async(t,e,r)=>{if(t?.type!==pb)return;let n=Ri();fb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,zve(e,r,i)]);o&&c9(r),s||l9(r)}finally{i.abort(),delete fb[t.id]}},fb={},zve=async(t,e,{signal:r})=>{Ea(t,1,r),await Fve(t,"disconnect",{signal:r}),u9(e)},pb="execa:ipc:request",R9="execa:ipc:response"});var I9,P9,k9,Bf,mb,Uve,cb=y(()=>{vl();yo();cs();ab();I9=(t,e,r)=>{Bf.has(t)||Bf.set(t,new Set);let n=Bf.get(t),i=Ri(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},P9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},k9=async(t,e,r)=>{for(;!mb(t,e)&&Bf.get(t)?.size>0;){let n=[...Bf.get(t)];T9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Bf=new WeakMap,mb=(t,e)=>e.listenerCount("message")>Uve(t),Uve=t=>Ii.has(t)&&!go(Ii.get(t).options.buffer,"ipc")?1:0});import{promisify as qve}from"node:util";var hb,Bve,ER,Hve,kR,gb=y(()=>{bl();cb();ab();hb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return yl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),Bve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},Bve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=A9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=I9(t,s,o);try{await ER({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw _l(t),c}finally{P9(a)}},ER=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Hve(t);try{await Promise.all([O9(n,t,r),o(n)])}catch(s){throw p9({error:s,methodName:e,isSubprocess:r}),m9({error:s,methodName:e,isSubprocess:r,message:i}),s}},Hve=t=>{if(kR.has(t))return kR.get(t);let e=qve(t.send.bind(t));return kR.set(t,e),e},kR=new WeakMap});import{scheduler as Gve}from"node:timers/promises";var D9,N9,Zve,C9,E9,j9,$R,AR,lb=y(()=>{gb();qf();bl();D9=(t,e)=>{let r="cancelSignal";return SR(r,!1,t.connected),ER({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:j9,message:e},message:e})},N9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Zve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),AR.signal),Zve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!C9){if(C9=!0,!n){f9();return}if(e===null){$R();return}ls(t,e,r),await Gve.yield()}},C9=!1,E9=t=>t?.type!==j9?!1:(AR.abort(t.message),!0),j9="execa:ipc:cancel",$R=()=>{AR.abort(d9())},AR=new AbortController});var M9,F9,Vve,Wve,TR=y(()=>{bR();lb();X_();M9=({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.")}},F9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[Vve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],Vve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await Q_(e,i);let o=Wve(e);throw await D9(t,o),_R({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Wve=({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 Kve}from"node:timers/promises";var L9,z9,Jve,OR=y(()=>{ka();L9=({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})`)},z9=(t,e,r,n)=>e===0||e===void 0?[]:[Jve(t,e,r,n)],Jve=async(t,e,r,{signal:n})=>{throw await Kve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as Yve,execArgv as Xve}from"node:process";import U9 from"node:path";var q9,B9,RR=y(()=>{dl();q9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},B9=(t,e,{node:r=!1,nodePath:n=Yve,nodeOptions:i=Xve.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=ul(n,'The "nodePath" option'),l=U9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(U9.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 Qve}from"node:v8";var H9,eSe,tSe,rSe,G9,IR=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`.");rSe[r](t)}},eSe=t=>{try{Qve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},tSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},rSe={advanced:eSe,json:tSe},G9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var V9,nSe,nn,PR,iSe,Z9,yb,Aa=y(()=>{V9=({encoding:t})=>{if(PR.has(t))return;let e=iSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${yb(t)}\`. +Please rename it to ${yb(e)}.`);let r=[...PR].map(n=>yb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${yb(t)}\`. +Please rename it to one of: ${r}.`)},nSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),PR=new Set([...nSe,...nn]),iSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in Z9)return Z9[e];if(PR.has(e))return e},Z9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},yb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as oSe}from"node:fs";import sSe from"node:path";import aSe from"node:process";var W9,K9,J9,CR=y(()=>{dl();W9=(t=K9())=>{let e=ul(t,'The "cwd" option');return sSe.resolve(e)},K9=()=>{try{return aSe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},J9=(t,e)=>{if(e===K9())return t;let r;try{r=oSe(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 nSe from"node:path";import K9 from"node:process";var J9,yb,iSe,oSe,DR=y(()=>{J9=bt(RZ(),1);MZ();Y_();Lf();vR();TR();OR();RR();IR();Ea();CR();fl();yo();yb=(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=bG(c),u=iSe(l);return M9(u),G9(u),q9(u),n9(u),N9(u),u.shell=KO(u.shell),u.env=oSe(u),u.killSignal=XZ(u.killSignal),u.forceKillAfterDelay=t9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),K9.platform==="win32"&&nSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},iSe=({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}),oSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...K9.env,...t}:t;return r||n?jZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var _b,NR=y(()=>{_b=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function xl(t){if(typeof t=="string")return sSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return aSe(t)}var sSe,aSe,Y9,cSe,X9,lSe,jR=y(()=>{sSe=t=>t.at(-1)===Y9?t.slice(0,t.at(-2)===X9?-2:-1):t,aSe=t=>t.at(-1)===cSe?t.subarray(0,t.at(-2)===lSe?-2:-1):t,Y9=` -`,cSe=Y9.codePointAt(0),X9="\r",lSe=X9.codePointAt(0)});function ei(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 MR(t,{checkOpen:e=!0}={}){return ei(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 Aa(t,{checkOpen:e=!0}={}){return ei(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 FR(t,e){return MR(t,e)&&Aa(t,e)}var Ta=y(()=>{});function Q9(){return this[zR].next()}function eV(t){return this[zR].return(t)}function UR({preventCancel:t=!1}={}){let e=this.getReader(),r=new LR(e,t),n=Object.create(dSe);return n[zR]=r,n}var uSe,LR,zR,dSe,tV=y(()=>{uSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),LR=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}}},zR=Symbol();Object.defineProperty(Q9,"name",{value:"next"});Object.defineProperty(eV,"name",{value:"return"});dSe=Object.create(uSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:Q9},return:{enumerable:!0,configurable:!0,writable:!0,value:eV}})});var rV=y(()=>{});var nV=y(()=>{tV();rV()});var iV,fSe,pSe,mSe,Hf,qR=y(()=>{Ta();nV();iV=t=>{if(Aa(t,{checkOpen:!1})&&Hf.on!==void 0)return pSe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(fSe.call(t)==="[object ReadableStream]")return UR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:fSe}=Object.prototype,pSe=async function*(t){let e=new AbortController,r={};mSe(t,e,r);try{for await(let[n]of Hf.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()}},mSe=async(t,e,r)=>{try{await Hf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Hf={}});var $l,hSe,aV,oV,gSe,sV,Ii,Gf=y(()=>{qR();$l=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=iV(t),u=e();u.length=0;try{for await(let d of l){let f=gSe(d),p=r[f](d,u);aV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return hSe({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}},hSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&aV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},aV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){oV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&oV(c,e,i,o),new Ii},oV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},gSe=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=sV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&sV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:sV}=Object.prototype,Ii=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var _o,Zf,bb,vb,Sb,wb=y(()=>{_o=t=>t,Zf=()=>{},bb=({contents:t})=>t,vb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Sb=t=>t.length});async function xb(t,e){return $l(t,vSe,e)}var ySe,_Se,bSe,vSe,cV=y(()=>{Gf();wb();ySe=()=>({contents:[]}),_Se=()=>1,bSe=(t,{contents:e})=>(e.push(t),e),vSe={init:ySe,convertChunk:{string:_o,buffer:_o,arrayBuffer:_o,dataView:_o,typedArray:_o,others:_o},getSize:_Se,truncateChunk:Zf,addChunk:bSe,getFinalChunk:Zf,finalize:bb}});async function $b(t,e){return $l(t,OSe,e)}var SSe,wSe,xSe,lV,uV,$Se,kSe,ESe,ASe,fV,dV,TSe,pV,OSe,mV=y(()=>{Gf();wb();SSe=()=>({contents:new ArrayBuffer(0)}),wSe=t=>xSe.encode(t),xSe=new TextEncoder,lV=t=>new Uint8Array(t),uV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),$Se=(t,e)=>t.slice(0,e),kSe=(t,{contents:e,length:r},n)=>{let i=pV()?ASe(e,n):ESe(e,n);return new Uint8Array(i).set(t,r),i},ESe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(fV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},ASe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:fV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},fV=t=>dV**Math.ceil(Math.log(t)/Math.log(dV)),dV=2,TSe=({contents:t,length:e})=>pV()?t:t.slice(0,e),pV=()=>"resize"in ArrayBuffer.prototype,OSe={init:SSe,convertChunk:{string:wSe,buffer:lV,arrayBuffer:lV,dataView:uV,typedArray:uV,others:vb},getSize:Sb,truncateChunk:$Se,addChunk:kSe,getFinalChunk:Zf,finalize:TSe}});async function Eb(t,e){return $l(t,DSe,e)}var RSe,kb,ISe,PSe,CSe,DSe,hV=y(()=>{Gf();wb();RSe=()=>({contents:"",textDecoder:new TextDecoder}),kb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),ISe=(t,{contents:e})=>e+t,PSe=(t,e)=>t.slice(0,e),CSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},DSe={init:RSe,convertChunk:{string:_o,buffer:kb,arrayBuffer:kb,dataView:kb,typedArray:kb,others:vb},getSize:Sb,truncateChunk:PSe,addChunk:ISe,getFinalChunk:CSe,finalize:bb}});var gV=y(()=>{cV();mV();hV();Gf()});import{on as NSe}from"node:events";import{finished as jSe}from"node:stream/promises";var Ab=y(()=>{qR();gV();Object.assign(Hf,{on:NSe,finished:jSe})});var yV,MSe,_V,bV,FSe,vV,SV,Tb,Oa=y(()=>{Ab();ho();yo();yV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ii))throw t;if(o==="all")return t;let s=MSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},MSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",_V=(t,e,r)=>{if(e.length!==r)return;let n=new Ii;throw n.maxBufferInfo={fdNumber:"ipc"},n},bV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=FSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},FSe=(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=go(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:D_(r),threshold:i,unit:n}},vV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Tb(r)),SV=(t,e,r)=>{if(!e)return t;let n=Tb(r);return t.length>n?t.slice(0,n):t},Tb=([,t])=>t});import{inspect as LSe}from"node:util";var xV,zSe,USe,qSe,BSe,HSe,wV,$V=y(()=>{jR();rn();CR();M_();Oa();Lf();$a();xV=({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=zSe({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=qSe(n,b),w=x===void 0?"":` -${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>BSe(D)).join(` -`)].map(D=>Nf(xl(HSe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:O,message:A}},zSe=({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=USe(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?`${bV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${J_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},USe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",qSe=(t,e)=>{if(t instanceof Xn)return;let r=zZ(t)?t.originalMessage:String(t?.message??t),n=Nf(W9(r,e));return n===""?void 0:n},BSe=t=>typeof t=="string"?t:LSe(t),HSe=t=>Array.isArray(t)?t.map(e=>xl(wV(e))).filter(Boolean).join(` -`):wV(t),wV=t=>typeof t=="string"?t:zt(t)?P_(t):""});var Ob,kl,Vf,GSe,kV,ZSe,Wf=y(()=>{Lf();B_();$a();$V();Ob=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>kV({command:t,escapedCommand:e,cwd:o,durationMs:oR(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:[]}),kl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Vf({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}),Vf=({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:O,signalDescription:T}=ZSe(l,u),{originalMessage:A,shortMessage:D,message:E}=xV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),q=FZ(t,E,x);return Object.assign(q,GSe({error:q,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),q},GSe=({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})=>kV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:oR(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:[]}),kV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),ZSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:J_(e);return{exitCode:r,signal:n,signalDescription:i}}});function VSe(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(EV(t*1e3)%1e3),nanoseconds:Math.trunc(EV(t*1e6)%1e3)}}function WSe(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 BR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return VSe(t);break}case"bigint":return WSe(t)}throw new TypeError("Expected a finite number or bigint")}var EV,AV=y(()=>{EV=t=>Number.isFinite(t)?t:0});function HR(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+YSe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&KSe(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?" "+JSe(d,u):f;i.push(p)}},a=BR(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%XSe):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 KSe,JSe,YSe,XSe,TV=y(()=>{AV();KSe=t=>t===0||t===0n,JSe=(t,e)=>e===1||e===1n?t:`${t}s`,YSe=1e-7,XSe=24n*60n*60n*1000n});var OV,RV=y(()=>{hl();OV=(t,e)=>{t.failed&&Ti({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var IV,QSe,PV=y(()=>{TV();ss();hl();RV();IV=(t,e)=>{pl(e)&&(OV(t,e),QSe(t,e))},QSe=(t,e)=>{let r=`(done in ${HR(t.durationMs)})`;Ti({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var El,Rb=y(()=>{PV();El=(t,e,{reject:r})=>{if(IV(t,e),t.failed&&r)throw t;return t}});var NV,ewe,twe,jV,MV,CV,rwe,GR,DV,Ra,FV,nwe,Ib,LV,iwe,owe,ZR,zV,swe,UV,Pb,awe,VR,cwe,lwe,qV,An,Cb,WR,BV,HV,us,vr=y(()=>{Ta();po();rn();NV=(t,e)=>Ra(t)?"asyncGenerator":FV(t)?"generator":Ib(t)?"fileUrl":iwe(t)?"filePath":awe(t)?"webStream":ei(t,{checkOpen:!1})?"native":zt(t)?"uint8Array":cwe(t)?"asyncIterable":lwe(t)?"iterable":VR(t)?jV({transform:t},e):nwe(t)?ewe(t,e):"native",ewe=(t,e)=>FR(t.transform,{checkOpen:!1})?twe(t,e):VR(t.transform)?jV(t,e):rwe(t,e),twe=(t,e)=>(MV(t,e,"Duplex stream"),"duplex"),jV=(t,e)=>(MV(t,e,"web TransformStream"),"webTransform"),MV=({final:t,binary:e,objectMode:r},n,i)=>{CV(t,`${n}.final`,i),CV(e,`${n}.binary`,i),GR(r,`${n}.objectMode`)},CV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},rwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!DV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(FR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(VR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!DV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return GR(r,`${i}.binary`),GR(n,`${i}.objectMode`),Ra(t)||Ra(e)?"asyncGenerator":"generator"},GR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},DV=t=>Ra(t)||FV(t),Ra=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",FV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",nwe=t=>At(t)&&(t.transform!==void 0||t.final!==void 0),Ib=t=>Object.prototype.toString.call(t)==="[object URL]",LV=t=>Ib(t)&&t.protocol!=="file:",iwe=t=>At(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>owe.has(e))&&ZR(t.file),owe=new Set(["file","append"]),ZR=t=>typeof t=="string",zV=(t,e)=>t==="native"&&typeof e=="string"&&!swe.has(e),swe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),UV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Pb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",awe=t=>UV(t)||Pb(t),VR=t=>UV(t?.readable)&&Pb(t?.writable),cwe=t=>qV(t)&&typeof t[Symbol.asyncIterator]=="function",lwe=t=>qV(t)&&typeof t[Symbol.iterator]=="function",qV=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),Cb=new Set(["fileUrl","filePath","fileNumber"]),WR=new Set(["fileUrl","filePath"]),BV=new Set([...WR,"webStream","nodeStream"]),HV=new Set(["webTransform","duplex"]),us={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 KR,uwe,dwe,GV,JR=y(()=>{vr();KR=(t,e,r,n)=>n==="output"?uwe(t,e,r):dwe(t,e,r),uwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},dwe=(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}},GV=(t,e)=>{let r=t.findLast(({type:n})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var ZV,fwe,pwe,mwe,hwe,gwe,ywe,VV=y(()=>{po();Ea();vr();JR();ZV=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...fwe(t,e,r,n)],fwe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=pwe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return ywe(o,r)},pwe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?mwe({stdioItem:t,optionName:i}):e==="webTransform"?hwe({stdioItem:t,index:r,newTransforms:n,direction:o}):gwe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),mwe=({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}}},hwe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=At(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=KR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},gwe=({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}=At(e)?e:{transform:e},d=c||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=KR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},ywe=(t,e)=>e==="input"?t.reverse():t});import YR from"node:process";var WV,_we,bwe,Al,XR,KV,vwe,Swe,JV=y(()=>{Ta();vr();WV=(t,e,r)=>{let n=t.map(i=>_we(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)??Swe},_we=({type:t,value:e},r)=>bwe[r]??KV[t](e),bwe=["input","output","output"],Al=()=>{},XR=()=>"input",KV={generator:Al,asyncGenerator:Al,fileUrl:Al,filePath:Al,iterable:XR,asyncIterable:XR,uint8Array:XR,webStream:t=>Pb(t)?"output":"input",nodeStream(t){return Aa(t,{checkOpen:!1})?MR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Al,duplex:Al,native(t){let e=vwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return KV.nodeStream(t)}},vwe=t=>{if([0,YR.stdin].includes(t))return"input";if([1,2,YR.stdout,YR.stderr].includes(t))return"output"},Swe="output"});var YV,XV=y(()=>{YV=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var QV,wwe,xwe,eW,$we,kwe,tW=y(()=>{ho();XV();ss();QV=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=wwe(t,n).map((a,c)=>eW(a,c));return o?$we(s,r,i):YV(s,e)},wwe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(xwe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},xwe=t=>En.some(e=>t[e]!==void 0),eW=(t,e)=>Array.isArray(t)?t.map(r=>eW(r,e)):t??(e>=En.length?"ignore":"pipe"),$we=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!ml(r,i)&&kwe(n)?"ignore":n),kwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Ewe}from"node:fs";import Awe from"node:tty";var nW,Twe,Owe,Rwe,Iwe,rW,iW=y(()=>{Ta();ho();rn();cs();nW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Twe({stdioItem:t,fdNumber:n,direction:i}):Iwe({stdioItem:t,fdNumber:n}),Twe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Owe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Owe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Rwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Awe.isatty(i))throw new TypeError(`The \`${e}: ${eb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:mo(Ewe(i)),optionName:e}}},Rwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=C_.indexOf(t);if(r!==-1)return r},Iwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:rW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:rW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,rW=(t,e,r)=>{let n=C_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var oW,Pwe,Cwe,Dwe,Nwe,sW=y(()=>{Ta();rn();vr();oW=({input:t,inputFile:e},r)=>r===0?[...Pwe(t),...Dwe(e)]:[],Pwe=t=>t===void 0?[]:[{type:Cwe(t),value:t,optionName:"input"}],Cwe=t=>{if(Aa(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(zt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Dwe=t=>t===void 0?[]:[{...Nwe(t),optionName:"inputFile"}],Nwe=t=>{if(Ib(t))return{type:"fileUrl",value:t};if(ZR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var aW,cW,jwe,Mwe,lW,Fwe,Lwe,uW,dW=y(()=>{vr();aW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),cW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=jwe(i,t);if(s.length!==0){if(o){Mwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(BV.has(t))return lW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});HV.has(t)&&Lwe({otherStdioItems:s,type:t,value:e,optionName:r})}},jwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Mwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{WR.has(e)&&lW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},lW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Fwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return uW(s,n,e),i==="output"?o[0].stream:void 0},Fwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Lwe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);uW(i,n,e)},uW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${us[r]} that is the same.`)}});var Db,zwe,Uwe,qwe,Bwe,Hwe,Gwe,Zwe,Vwe,Wwe,Kwe,Jwe,QR,Ywe,Nb=y(()=>{ho();VV();JR();vr();JV();tW();iW();sW();dW();Db=(t,e,r,n)=>{let o=QV(e,r,n).map((a,c)=>zwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Wwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>Ywe(a)),s},zwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=D_(e),{stdioItems:o,isStdioArray:s}=Uwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=WV(o,e,i),c=o.map(d=>nW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=ZV(c,i,a,r),u=GV(l,a);return Vwe(l,u),{direction:a,objectMode:u,stdioItems:l}},Uwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>qwe(c,n)),...oW(r,e)],s=aW(o),a=s.length>1;return Bwe(s,a,n),Gwe(s),{stdioItems:s,isStdioArray:a}},qwe=(t,e)=>({type:NV(t,e),value:t,optionName:e}),Bwe=(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(Hwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Hwe=new Set(["ignore","ipc"]),Gwe=t=>{for(let e of t)Zwe(e)},Zwe=({type:t,value:e,optionName:r})=>{if(LV(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(zV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Vwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Cb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Wwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(Kwe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw QR(i),o}},Kwe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>Jwe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},Jwe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=cW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},QR=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Yn(r)&&r.destroy()},Ywe=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 fW}from"node:fs";var mW,Pi,Xwe,hW,pW,Qwe,gW=y(()=>{rn();Nb();vr();mW=(t,e)=>Db(Qwe,t,e,!0),Pi=({type:t,optionName:e})=>{hW(e,us[t])},Xwe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&hW(t,`"${e}"`),{}),hW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},pW={generator(){},asyncGenerator:Pi,webStream:Pi,nodeStream:Pi,webTransform:Pi,duplex:Pi,asyncIterable:Pi,native:Xwe},Qwe={input:{...pW,fileUrl:({value:t})=>({contents:[mo(fW(t))]}),filePath:({value:{file:t}})=>({contents:[mo(fW(t))]}),fileNumber:Pi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...pW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Pi,string:Pi,uint8Array:Pi}}});var bo,eI,Kf=y(()=>{jR();bo=(t,{stripFinalNewline:e},r)=>eI(e,r)&&t!==void 0&&!Array.isArray(t)?xl(t):t,eI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var jb,rI,yW,_W,exe,txe,rxe,bW,nxe,tI,ixe,oxe,sxe,Mb=y(()=>{jb=(t,e,r,n)=>t||r?void 0:_W(e,n),rI=(t,e,r)=>r?t.flatMap(n=>yW(n,e)):yW(t,e),yW=(t,e)=>{let{transform:r,final:n}=_W(e,{});return[...r(t),...n()]},_W=(t,e)=>(e.previousChunks="",{transform:exe.bind(void 0,e,t),final:rxe.bind(void 0,e)}),exe=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},txe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),rxe=function*({previousChunks:t}){t.length>0&&(yield t)},bW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:nxe.bind(void 0,n)},nxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?ixe:sxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},tI=(t,e)=>`${t}${e}`,ixe={windowsNewline:`\r +${t}`}});import cSe from"node:path";import Y9 from"node:process";var X9,_b,lSe,uSe,DR=y(()=>{X9=bt(PZ(),1);LZ();X_();Lf();vR();TR();OR();RR();IR();Aa();CR();dl();yo();_b=(t,e,r)=>{r.cwd=W9(r.cwd);let[n,i,o]=B9(t,e,r),{command:s,args:a,options:c}=X9.default._parse(n,i,o),l=SG(c),u=lSe(l);return L9(u),V9(u),H9(u),o9(u),M9(u),u.shell=KO(u.shell),u.env=uSe(u),u.killSignal=e9(u.killSignal),u.forceKillAfterDelay=n9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),Y9.platform==="win32"&&cSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},lSe=({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}),uSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...Y9.env,...t}:t;return r||n?FZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var bb,NR=y(()=>{bb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function wl(t){if(typeof t=="string")return dSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return fSe(t)}var dSe,fSe,Q9,pSe,eV,mSe,jR=y(()=>{dSe=t=>t.at(-1)===Q9?t.slice(0,t.at(-2)===eV?-2:-1):t,fSe=t=>t.at(-1)===pSe?t.subarray(0,t.at(-2)===mSe?-2:-1):t,Q9=` +`,pSe=Q9.codePointAt(0),eV="\r",mSe=eV.codePointAt(0)});function ei(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 MR(t,{checkOpen:e=!0}={}){return ei(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 Ta(t,{checkOpen:e=!0}={}){return ei(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 FR(t,e){return MR(t,e)&&Ta(t,e)}var Oa=y(()=>{});function tV(){return this[zR].next()}function rV(t){return this[zR].return(t)}function UR({preventCancel:t=!1}={}){let e=this.getReader(),r=new LR(e,t),n=Object.create(gSe);return n[zR]=r,n}var hSe,LR,zR,gSe,nV=y(()=>{hSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),LR=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}}},zR=Symbol();Object.defineProperty(tV,"name",{value:"next"});Object.defineProperty(rV,"name",{value:"return"});gSe=Object.create(hSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:tV},return:{enumerable:!0,configurable:!0,writable:!0,value:rV}})});var iV=y(()=>{});var oV=y(()=>{nV();iV()});var sV,ySe,_Se,bSe,Hf,qR=y(()=>{Oa();oV();sV=t=>{if(Ta(t,{checkOpen:!1})&&Hf.on!==void 0)return _Se(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(ySe.call(t)==="[object ReadableStream]")return UR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:ySe}=Object.prototype,_Se=async function*(t){let e=new AbortController,r={};bSe(t,e,r);try{for await(let[n]of Hf.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()}},bSe=async(t,e,r)=>{try{await Hf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Hf={}});var xl,vSe,lV,aV,SSe,cV,Pi,Gf=y(()=>{qR();xl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=sV(t),u=e();u.length=0;try{for await(let d of l){let f=SSe(d),p=r[f](d,u);lV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return vSe({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}},vSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&lV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},lV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){aV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&aV(c,e,i,o),new Pi},aV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},SSe=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=cV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&cV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:cV}=Object.prototype,Pi=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var _o,Zf,vb,Sb,wb,xb=y(()=>{_o=t=>t,Zf=()=>{},vb=({contents:t})=>t,Sb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},wb=t=>t.length});async function $b(t,e){return xl(t,kSe,e)}var wSe,xSe,$Se,kSe,uV=y(()=>{Gf();xb();wSe=()=>({contents:[]}),xSe=()=>1,$Se=(t,{contents:e})=>(e.push(t),e),kSe={init:wSe,convertChunk:{string:_o,buffer:_o,arrayBuffer:_o,dataView:_o,typedArray:_o,others:_o},getSize:xSe,truncateChunk:Zf,addChunk:$Se,getFinalChunk:Zf,finalize:vb}});async function kb(t,e){return xl(t,DSe,e)}var ESe,ASe,TSe,dV,fV,OSe,RSe,ISe,PSe,mV,pV,CSe,hV,DSe,gV=y(()=>{Gf();xb();ESe=()=>({contents:new ArrayBuffer(0)}),ASe=t=>TSe.encode(t),TSe=new TextEncoder,dV=t=>new Uint8Array(t),fV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),OSe=(t,e)=>t.slice(0,e),RSe=(t,{contents:e,length:r},n)=>{let i=hV()?PSe(e,n):ISe(e,n);return new Uint8Array(i).set(t,r),i},ISe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(mV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},PSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:mV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},mV=t=>pV**Math.ceil(Math.log(t)/Math.log(pV)),pV=2,CSe=({contents:t,length:e})=>hV()?t:t.slice(0,e),hV=()=>"resize"in ArrayBuffer.prototype,DSe={init:ESe,convertChunk:{string:ASe,buffer:dV,arrayBuffer:dV,dataView:fV,typedArray:fV,others:Sb},getSize:wb,truncateChunk:OSe,addChunk:RSe,getFinalChunk:Zf,finalize:CSe}});async function Ab(t,e){return xl(t,LSe,e)}var NSe,Eb,jSe,MSe,FSe,LSe,yV=y(()=>{Gf();xb();NSe=()=>({contents:"",textDecoder:new TextDecoder}),Eb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),jSe=(t,{contents:e})=>e+t,MSe=(t,e)=>t.slice(0,e),FSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},LSe={init:NSe,convertChunk:{string:_o,buffer:Eb,arrayBuffer:Eb,dataView:Eb,typedArray:Eb,others:Sb},getSize:wb,truncateChunk:MSe,addChunk:jSe,getFinalChunk:FSe,finalize:vb}});var _V=y(()=>{uV();gV();yV();Gf()});import{on as zSe}from"node:events";import{finished as USe}from"node:stream/promises";var Tb=y(()=>{qR();_V();Object.assign(Hf,{on:zSe,finished:USe})});var bV,qSe,vV,SV,BSe,wV,xV,Ob,Ra=y(()=>{Tb();ho();yo();bV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Pi))throw t;if(o==="all")return t;let s=qSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},qSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",vV=(t,e,r)=>{if(e.length!==r)return;let n=new Pi;throw n.maxBufferInfo={fdNumber:"ipc"},n},SV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=BSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},BSe=(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=go(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:N_(r),threshold:i,unit:n}},wV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Ob(r)),xV=(t,e,r)=>{if(!e)return t;let n=Ob(r);return t.length>n?t.slice(0,n):t},Ob=([,t])=>t});import{inspect as HSe}from"node:util";var kV,GSe,ZSe,VSe,WSe,KSe,$V,EV=y(()=>{jR();rn();CR();F_();Ra();Lf();ka();kV=({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=GSe({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=VSe(n,b),w=x===void 0?"":` +${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>WSe(D)).join(` +`)].map(D=>Nf(wl(KSe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:O,message:A}},GSe=({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=ZSe(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?`${SV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${Y_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},ZSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",VSe=(t,e)=>{if(t instanceof Xn)return;let r=qZ(t)?t.originalMessage:String(t?.message??t),n=Nf(J9(r,e));return n===""?void 0:n},WSe=t=>typeof t=="string"?t:HSe(t),KSe=t=>Array.isArray(t)?t.map(e=>wl($V(e))).filter(Boolean).join(` +`):$V(t),$V=t=>typeof t=="string"?t:zt(t)?C_(t):""});var Rb,$l,Vf,JSe,AV,YSe,Wf=y(()=>{Lf();H_();ka();EV();Rb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>AV({command:t,escapedCommand:e,cwd:o,durationMs:oR(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:[]}),$l=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Vf({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}),Vf=({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:O,signalDescription:T}=YSe(l,u),{originalMessage:A,shortMessage:D,message:E}=kV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),q=zZ(t,E,x);return Object.assign(q,JSe({error:q,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),q},JSe=({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})=>AV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:oR(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:[]}),AV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),YSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:Y_(e);return{exitCode:r,signal:n,signalDescription:i}}});function XSe(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(TV(t*1e3)%1e3),nanoseconds:Math.trunc(TV(t*1e6)%1e3)}}function QSe(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 BR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return XSe(t);break}case"bigint":return QSe(t)}throw new TypeError("Expected a finite number or bigint")}var TV,OV=y(()=>{TV=t=>Number.isFinite(t)?t:0});function HR(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+rwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ewe(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?" "+twe(d,u):f;i.push(p)}},a=BR(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%nwe):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 ewe,twe,rwe,nwe,RV=y(()=>{OV();ewe=t=>t===0||t===0n,twe=(t,e)=>e===1||e===1n?t:`${t}s`,rwe=1e-7,nwe=24n*60n*60n*1000n});var IV,PV=y(()=>{ml();IV=(t,e)=>{t.failed&&Oi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var CV,iwe,DV=y(()=>{RV();ss();ml();PV();CV=(t,e)=>{fl(e)&&(IV(t,e),iwe(t,e))},iwe=(t,e)=>{let r=`(done in ${HR(t.durationMs)})`;Oi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var kl,Ib=y(()=>{DV();kl=(t,e,{reject:r})=>{if(CV(t,e),t.failed&&r)throw t;return t}});var MV,owe,swe,FV,LV,NV,awe,GR,jV,Ia,zV,cwe,Pb,UV,lwe,uwe,ZR,qV,dwe,BV,Cb,fwe,VR,pwe,mwe,HV,An,Db,WR,GV,ZV,us,vr=y(()=>{Oa();po();rn();MV=(t,e)=>Ia(t)?"asyncGenerator":zV(t)?"generator":Pb(t)?"fileUrl":lwe(t)?"filePath":fwe(t)?"webStream":ei(t,{checkOpen:!1})?"native":zt(t)?"uint8Array":pwe(t)?"asyncIterable":mwe(t)?"iterable":VR(t)?FV({transform:t},e):cwe(t)?owe(t,e):"native",owe=(t,e)=>FR(t.transform,{checkOpen:!1})?swe(t,e):VR(t.transform)?FV(t,e):awe(t,e),swe=(t,e)=>(LV(t,e,"Duplex stream"),"duplex"),FV=(t,e)=>(LV(t,e,"web TransformStream"),"webTransform"),LV=({final:t,binary:e,objectMode:r},n,i)=>{NV(t,`${n}.final`,i),NV(e,`${n}.binary`,i),GR(r,`${n}.objectMode`)},NV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},awe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!jV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(FR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(VR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!jV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return GR(r,`${i}.binary`),GR(n,`${i}.objectMode`),Ia(t)||Ia(e)?"asyncGenerator":"generator"},GR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},jV=t=>Ia(t)||zV(t),Ia=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",zV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",cwe=t=>At(t)&&(t.transform!==void 0||t.final!==void 0),Pb=t=>Object.prototype.toString.call(t)==="[object URL]",UV=t=>Pb(t)&&t.protocol!=="file:",lwe=t=>At(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>uwe.has(e))&&ZR(t.file),uwe=new Set(["file","append"]),ZR=t=>typeof t=="string",qV=(t,e)=>t==="native"&&typeof e=="string"&&!dwe.has(e),dwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),BV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Cb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",fwe=t=>BV(t)||Cb(t),VR=t=>BV(t?.readable)&&Cb(t?.writable),pwe=t=>HV(t)&&typeof t[Symbol.asyncIterator]=="function",mwe=t=>HV(t)&&typeof t[Symbol.iterator]=="function",HV=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),Db=new Set(["fileUrl","filePath","fileNumber"]),WR=new Set(["fileUrl","filePath"]),GV=new Set([...WR,"webStream","nodeStream"]),ZV=new Set(["webTransform","duplex"]),us={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 KR,hwe,gwe,VV,JR=y(()=>{vr();KR=(t,e,r,n)=>n==="output"?hwe(t,e,r):gwe(t,e,r),hwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},gwe=(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}},VV=(t,e)=>{let r=t.findLast(({type:n})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var WV,ywe,_we,bwe,vwe,Swe,wwe,KV=y(()=>{po();Aa();vr();JR();WV=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...ywe(t,e,r,n)],ywe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=_we({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return wwe(o,r)},_we=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?bwe({stdioItem:t,optionName:i}):e==="webTransform"?vwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Swe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),bwe=({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}}},vwe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=At(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=KR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Swe=({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}=At(e)?e:{transform:e},d=c||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=KR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},wwe=(t,e)=>e==="input"?t.reverse():t});import YR from"node:process";var JV,xwe,$we,El,XR,YV,kwe,Ewe,XV=y(()=>{Oa();vr();JV=(t,e,r)=>{let n=t.map(i=>xwe(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)??Ewe},xwe=({type:t,value:e},r)=>$we[r]??YV[t](e),$we=["input","output","output"],El=()=>{},XR=()=>"input",YV={generator:El,asyncGenerator:El,fileUrl:El,filePath:El,iterable:XR,asyncIterable:XR,uint8Array:XR,webStream:t=>Cb(t)?"output":"input",nodeStream(t){return Ta(t,{checkOpen:!1})?MR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:El,duplex:El,native(t){let e=kwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return YV.nodeStream(t)}},kwe=t=>{if([0,YR.stdin].includes(t))return"input";if([1,2,YR.stdout,YR.stderr].includes(t))return"output"},Ewe="output"});var QV,eW=y(()=>{QV=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var tW,Awe,Twe,rW,Owe,Rwe,nW=y(()=>{ho();eW();ss();tW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Awe(t,n).map((a,c)=>rW(a,c));return o?Owe(s,r,i):QV(s,e)},Awe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(Twe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},Twe=t=>En.some(e=>t[e]!==void 0),rW=(t,e)=>Array.isArray(t)?t.map(r=>rW(r,e)):t??(e>=En.length?"ignore":"pipe"),Owe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!pl(r,i)&&Rwe(n)?"ignore":n),Rwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Iwe}from"node:fs";import Pwe from"node:tty";var oW,Cwe,Dwe,Nwe,jwe,iW,sW=y(()=>{Oa();ho();rn();cs();oW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Cwe({stdioItem:t,fdNumber:n,direction:i}):jwe({stdioItem:t,fdNumber:n}),Cwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Dwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Dwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Nwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Pwe.isatty(i))throw new TypeError(`The \`${e}: ${tb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:mo(Iwe(i)),optionName:e}}},Nwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=D_.indexOf(t);if(r!==-1)return r},jwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:iW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:iW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,iW=(t,e,r)=>{let n=D_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var aW,Mwe,Fwe,Lwe,zwe,cW=y(()=>{Oa();rn();vr();aW=({input:t,inputFile:e},r)=>r===0?[...Mwe(t),...Lwe(e)]:[],Mwe=t=>t===void 0?[]:[{type:Fwe(t),value:t,optionName:"input"}],Fwe=t=>{if(Ta(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(zt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Lwe=t=>t===void 0?[]:[{...zwe(t),optionName:"inputFile"}],zwe=t=>{if(Pb(t))return{type:"fileUrl",value:t};if(ZR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var lW,uW,Uwe,qwe,dW,Bwe,Hwe,fW,pW=y(()=>{vr();lW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),uW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Uwe(i,t);if(s.length!==0){if(o){qwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(GV.has(t))return dW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});ZV.has(t)&&Hwe({otherStdioItems:s,type:t,value:e,optionName:r})}},Uwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),qwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{WR.has(e)&&dW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},dW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Bwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return fW(s,n,e),i==="output"?o[0].stream:void 0},Bwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Hwe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);fW(i,n,e)},fW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${us[r]} that is the same.`)}});var Nb,Gwe,Zwe,Vwe,Wwe,Kwe,Jwe,Ywe,Xwe,Qwe,exe,txe,QR,rxe,jb=y(()=>{ho();KV();JR();vr();XV();nW();sW();cW();pW();Nb=(t,e,r,n)=>{let o=tW(e,r,n).map((a,c)=>Gwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Qwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>rxe(a)),s},Gwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=N_(e),{stdioItems:o,isStdioArray:s}=Zwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=JV(o,e,i),c=o.map(d=>oW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=WV(c,i,a,r),u=VV(l,a);return Xwe(l,u),{direction:a,objectMode:u,stdioItems:l}},Zwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Vwe(c,n)),...aW(r,e)],s=lW(o),a=s.length>1;return Wwe(s,a,n),Jwe(s),{stdioItems:s,isStdioArray:a}},Vwe=(t,e)=>({type:MV(t,e),value:t,optionName:e}),Wwe=(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(Kwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Kwe=new Set(["ignore","ipc"]),Jwe=t=>{for(let e of t)Ywe(e)},Ywe=({type:t,value:e,optionName:r})=>{if(UV(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(qV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Xwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Db.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Qwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(exe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw QR(i),o}},exe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>txe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},txe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=uW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},QR=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Yn(r)&&r.destroy()},rxe=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 mW}from"node:fs";var gW,Ci,nxe,yW,hW,ixe,_W=y(()=>{rn();jb();vr();gW=(t,e)=>Nb(ixe,t,e,!0),Ci=({type:t,optionName:e})=>{yW(e,us[t])},nxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&yW(t,`"${e}"`),{}),yW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},hW={generator(){},asyncGenerator:Ci,webStream:Ci,nodeStream:Ci,webTransform:Ci,duplex:Ci,asyncIterable:Ci,native:nxe},ixe={input:{...hW,fileUrl:({value:t})=>({contents:[mo(mW(t))]}),filePath:({value:{file:t}})=>({contents:[mo(mW(t))]}),fileNumber:Ci,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...hW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Ci,string:Ci,uint8Array:Ci}}});var bo,eI,Kf=y(()=>{jR();bo=(t,{stripFinalNewline:e},r)=>eI(e,r)&&t!==void 0&&!Array.isArray(t)?wl(t):t,eI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Mb,rI,bW,vW,oxe,sxe,axe,SW,cxe,tI,lxe,uxe,dxe,Fb=y(()=>{Mb=(t,e,r,n)=>t||r?void 0:vW(e,n),rI=(t,e,r)=>r?t.flatMap(n=>bW(n,e)):bW(t,e),bW=(t,e)=>{let{transform:r,final:n}=vW(e,{});return[...r(t),...n()]},vW=(t,e)=>(e.previousChunks="",{transform:oxe.bind(void 0,e,t),final:axe.bind(void 0,e)}),oxe=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},sxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),axe=function*({previousChunks:t}){t.length>0&&(yield t)},SW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:cxe.bind(void 0,n)},cxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?lxe:dxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},tI=(t,e)=>`${t}${e}`,lxe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:tI},oxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},sxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:oxe}});import{Buffer as axe}from"node:buffer";var vW,cxe,SW,lxe,uxe,wW,xW=y(()=>{rn();vW=(t,e)=>t?void 0:cxe.bind(void 0,e),cxe=function*(t,e){if(typeof e!="string"&&!zt(e)&&!axe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},SW=(t,e)=>t?lxe.bind(void 0,e):uxe.bind(void 0,e),lxe=function*(t,e){wW(t,e),yield e},uxe=function*(t,e){if(wW(t,e),typeof e!="string"&&!zt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},wW=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:tI},uxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},dxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:uxe}});import{Buffer as fxe}from"node:buffer";var wW,pxe,xW,mxe,hxe,$W,kW=y(()=>{rn();wW=(t,e)=>t?void 0:pxe.bind(void 0,e),pxe=function*(t,e){if(typeof e!="string"&&!zt(e)&&!fxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},xW=(t,e)=>t?mxe.bind(void 0,e):hxe.bind(void 0,e),mxe=function*(t,e){$W(t,e),yield e},hxe=function*(t,e){if($W(t,e),typeof e!="string"&&!zt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},$W=(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 dxe}from"node:buffer";import{StringDecoder as fxe}from"node:string_decoder";var Fb,pxe,mxe,hxe,nI=y(()=>{rn();Fb=(t,e,r)=>{if(r)return;if(t)return{transform:pxe.bind(void 0,new TextEncoder)};let n=new fxe(e);return{transform:mxe.bind(void 0,n),final:hxe.bind(void 0,n)}},pxe=function*(t,e){dxe.isBuffer(e)?yield mo(e):typeof e=="string"?yield t.encode(e):yield e},mxe=function*(t,e){yield zt(e)?t.write(e):e},hxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as $W}from"node:util";var iI,Lb,kW,gxe,EW,yxe,AW=y(()=>{iI=$W(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Lb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=yxe}=e[r];for await(let i of n(t))yield*Lb(i,e,r+1)},kW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*gxe(r,Number(e),t)},gxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Lb(n,r,e+1)},EW=$W(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),yxe=function*(t){yield t}});var oI,TW,Ia,Jf,_xe,bxe,sI=y(()=>{oI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},TW=(t,e)=>[...e.flatMap(r=>[...Ia(r,t,0)]),...Jf(t)],Ia=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=bxe}=e[r];for(let i of n(t))yield*Ia(i,e,r+1)},Jf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*_xe(r,Number(e),t)},_xe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ia(n,r,e+1)},bxe=function*(t){yield t}});import{Transform as vxe,getDefaultHighWaterMark as OW}from"node:stream";var aI,zb,RW,Ub=y(()=>{vr();Mb();xW();nI();AW();sI();aI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=RW(t,s,o),l=Ra(e),u=Ra(r),d=l?iI.bind(void 0,Lb,a):oI.bind(void 0,Ia),f=l||u?iI.bind(void 0,kW,a):oI.bind(void 0,Jf),p=l||u?EW.bind(void 0,a):void 0;return{stream:new vxe({writableObjectMode:n,writableHighWaterMark:OW(n),readableObjectMode:i,readableHighWaterMark:OW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},zb=(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=RW(s,r,a);t=TW(c,t)}return t},RW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:vW(n,a)},Fb(r,s,n),jb(r,o,n,c),{transform:t,final:e},{transform:SW(i,a)},bW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var IW,Sxe,wxe,xxe,$xe,PW=y(()=>{Ub();rn();vr();IW=(t,e)=>{for(let r of Sxe(t))wxe(t,r,e)},Sxe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),wxe=(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 ${us[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>xxe(a,n));r.input=Df(s)},xxe=(t,e)=>{let r=zb(t,e,"utf8",!0);return $xe(r),Df(r)},$xe=t=>{let e=t.find(r=>typeof r!="string"&&!zt(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 qb,kxe,Exe,CW,DW,Axe,NW,cI=y(()=>{Ea();vr();hl();ss();qb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&ml(r,n)&&!nn.has(e)&&kxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Exe.has(o))||t.every(({type:i})=>An.has(i))),kxe=t=>t===1||t===2,Exe=new Set(["pipe","overlapped"]),CW=async(t,e,r,n)=>{for await(let i of t)Axe(e)||NW(i,r,n)},DW=(t,e,r)=>{for(let n of t)NW(n,e,r)},Axe=t=>t._readableState.pipes.length>0,NW=(t,e,r)=>{let n=U_(t);Ti({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Txe,appendFileSync as Oxe}from"node:fs";var jW,Rxe,Ixe,Pxe,Cxe,Dxe,MW=y(()=>{cI();Ub();Mb();rn();vr();Oa();jW=({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)=>Rxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Rxe=({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=SV(t,o,d),p=mo(f),{stdioItems:m,objectMode:h}=e[r],g=Ixe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Pxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Cxe({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&&Dxe(b,m,i),S}catch(x){return n.error=x,S}},Ixe=(t,e,r,n)=>{try{return zb(t,e,r,!1)}catch(i){return n.error=i,t}},Pxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Df(t)};let s=dG(t,r);return n[o]?{serializedResult:s,finalResult:rI(s,!i[o],e)}:{serializedResult:s}},Cxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!qb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=rI(t,!1,s);try{DW(a,e,n)}catch(c){r.error??=c}},Dxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Cb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Oxe(n,t):(r.add(o),Txe(n,t))}}});var FW,LW=y(()=>{rn();Kf();FW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,bo(e,r,"all")]:Array.isArray(e)?[bo(t,r,"all"),...e]:zt(t)&&zt(e)?YO([t,e]):`${t}${e}`}});import{once as lI}from"node:events";var zW,Nxe,UW,qW,jxe,uI,dI=y(()=>{$a();zW=async(t,e)=>{let[r,n]=await Nxe(t);return e.isForcefullyTerminated??=!1,[r,n]},Nxe=async t=>{let[e,r]=await Promise.allSettled([lI(t,"spawn"),lI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?UW(t):r.value},UW=async t=>{try{return await lI(t,"exit")}catch{return UW(t)}},qW=async t=>{let[e,r]=await t;if(!jxe(e,r)&&uI(e,r))throw new Xn;return[e,r]},jxe=(t,e)=>t===void 0&&e===void 0,uI=(t,e)=>t!==0||e!==null});var BW,Mxe,HW=y(()=>{$a();Oa();dI();BW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=Mxe(t,e,r),s=o?.code==="ETIMEDOUT",a=vV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},Mxe=(t,e,r)=>t!==void 0?t:uI(e,r)?new Xn:void 0});import{spawnSync as Fxe}from"node:child_process";var GW,Lxe,zxe,Uxe,Bb,qxe,Bxe,Hxe,Gxe,ZW=y(()=>{sR();DR();NR();Wf();Rb();gW();Kf();PW();MW();Oa();LW();HW();GW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Lxe(t,e,r),d=qxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return El(d,c,l)},Lxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=H_(t,e,r),a=zxe(r),{file:c,commandArguments:l,options:u}=yb(t,e,a);Uxe(u);let d=mW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},zxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Uxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Bb("ipcInput"),t&&Bb("ipc: true"),r&&Bb("detached: true"),n&&Bb("cancelSignal")},Bb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},qxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Bxe({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}=BW(c,r),{output:m,error:h=l}=jW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>bo(_,r,S)),b=bo(FW(m,r),r,"all");return Gxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Bxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{IW(o,r);let a=Hxe(r);return Fxe(..._b(t,e,a))}catch(a){return kl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},Hxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Tb(e)}),Gxe=({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?Ob({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Vf({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 Zxe}from"node:events";var VW,Vxe,Wxe,Kxe,Jxe,WW=y(()=>{vl();qf();Uf();VW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(_l({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:ub(t)}),Vxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Vxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{nb(e,i);let o=ls(t,e,r),s=new AbortController;try{return await Promise.race([Wxe(o,n,s),Kxe(o,r,s),Jxe(o,r,s)])}catch(a){throw bl(t),a}finally{s.abort(),ib(e,i)}},Wxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await fI(t,"message",{signal:r});return n}for await(let[n]of Zxe(t,"message",{signal:r}))if(e(n))return n},Kxe=async(t,e,{signal:r})=>{await fI(t,"disconnect",{signal:r}),o9(e)},Jxe=async(t,e,{signal:r})=>{let[n]=await fI(t,"strict:error",{signal:r});throw Q_(n,e)}});import{once as JW,on as Yxe}from"node:events";var YW,pI,Xxe,Qxe,e0e,KW,mI=y(()=>{vl();qf();Uf();YW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>pI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),pI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{_l({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:ub(t)}),nb(e,o);let s=ls(t,e,r),a=new AbortController,c={};return Xxe(t,s,a),Qxe({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),e0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Xxe=async(t,e,r)=>{try{await JW(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},Qxe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await JW(t,"strict:error",{signal:r.signal});n.error=Q_(i,e),r.abort()}catch{}},e0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of Yxe(r,"message",{signal:o.signal}))KW(s),yield c}catch{KW(s)}finally{o.abort(),ib(e,a),n||bl(t),i&&await t}},KW=({error:t})=>{if(t)throw t}});import XW from"node:process";var QW,e3,t3,hI=y(()=>{hb();WW();mI();cb();QW=(t,{ipc:e})=>{Object.assign(t,t3(t,!1,e))},e3=()=>{let t=XW,e=!0,r=XW.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:mb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:VW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:YW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as t0e}from"node:child_process";import{PassThrough as r0e,Readable as n0e,Writable as i0e,Duplex as o0e}from"node:stream";var r3,s0e,Yf,a0e,c0e,l0e,u0e,n3=y(()=>{Nb();Wf();Rb();r3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{QR(n);let a=new t0e;s0e(a,n),Object.assign(a,{readable:a0e,writable:c0e,duplex:l0e});let c=kl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=u0e(c,s,i);return{subprocess:a,promise:l}},s0e=(t,e)=>{let r=Yf(),n=Yf(),i=Yf(),o=Array.from({length:e.length-3},Yf),s=Yf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Yf=()=>{let t=new r0e;return t.end(),t},a0e=()=>new n0e({read(){}}),c0e=()=>new i0e({write(){}}),l0e=()=>new o0e({read(){},write(){}}),u0e=async(t,e,r)=>El(t,e,r)});import{createReadStream as i3,createWriteStream as o3}from"node:fs";import{Buffer as d0e}from"node:buffer";import{Readable as Xf,Writable as f0e,Duplex as p0e}from"node:stream";var a3,Qf,s3,m0e,c3=y(()=>{Ub();Nb();vr();a3=(t,e)=>Db(m0e,t,e,!1),Qf=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${us[t]}.`)},s3={fileNumber:Qf,generator:aI,asyncGenerator:aI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:p0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},m0e={input:{...s3,fileUrl:({value:t})=>({stream:i3(t)}),filePath:({value:{file:t}})=>({stream:i3(t)}),webStream:({value:t})=>({stream:Xf.fromWeb(t)}),iterable:({value:t})=>({stream:Xf.from(t)}),asyncIterable:({value:t})=>({stream:Xf.from(t)}),string:({value:t})=>({stream:Xf.from(t)}),uint8Array:({value:t})=>({stream:Xf.from(d0e.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:f0e.fromWeb(t)}),iterable:Qf,asyncIterable:Qf,string:Qf,uint8Array:Qf}}});import{on as h0e,once as l3}from"node:events";import{PassThrough as g0e,getDefaultHighWaterMark as y0e}from"node:stream";import{finished as f3}from"node:stream/promises";function Pa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)yI(i);let e=t.some(({readableObjectMode:i})=>i),r=_0e(t,e),n=new gI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var _0e,gI,b0e,v0e,S0e,yI,w0e,x0e,$0e,k0e,E0e,p3,m3,_I,h3,A0e,Hb,u3,d3,Gb=y(()=>{_0e=(t,e)=>{if(t.length===0)return y0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},gI=class extends g0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(yI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=b0e(this,this.#t,this.#o);let r=w0e({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(yI(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)}},b0e=async(t,e,r)=>{Hb(t,u3);let n=new AbortController;try{await Promise.race([v0e(t,n),S0e(t,e,r,n)])}finally{n.abort(),Hb(t,-u3)}},v0e=async(t,{signal:e})=>{try{await f3(t,{signal:e,cleanup:!0})}catch(r){throw p3(t,r),r}},S0e=async(t,e,r,{signal:n})=>{for await(let[i]of h0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},yI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},w0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Hb(t,d3);let a=new AbortController;try{await Promise.race([x0e(o,e,a),$0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),k0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Hb(t,-d3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?_I(t):E0e(t))},x0e=async(t,e,{signal:r})=>{try{await t,r.aborted||_I(e)}catch(n){r.aborted||p3(e,n)}},$0e=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)}},k0e=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)},E0e=t=>{t.writable&&t.end()},p3=(t,e)=>{m3(e)?_I(t):h3(t,e)},m3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",_I=t=>{(t.readable||t.writable)&&t.destroy()},h3=(t,e)=>{t.destroyed||(t.once("error",A0e),t.destroy(e))},A0e=()=>{},Hb=(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 Tl,T0e,bI,O0e,vI,Zb=y(()=>{ho();Tl=(t,e)=>{t.pipe(e),T0e(t,e),O0e(t,e)},T0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await g3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}bI(e)}},bI=t=>{t.writable&&t.end()},O0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await g3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}vI(t)}},vI=t=>{t.readable&&t.destroy()}});var y3,R0e,I0e,P0e,C0e,D0e,_3=y(()=>{Gb();ho();rb();vr();Zb();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})=>An.has(c)))R0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.has(c)))P0e({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]:Pa(o);Tl(s,i)}},R0e=(t,e,r,n)=>{r==="output"?Tl(t.stdio[n],e):Tl(e,t.stdio[n]);let i=I0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},I0e=["stdin","stdout","stderr"],P0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;C0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},C0e=(t,{signal:e})=>{Yn(t)&&ka(t,D0e,e)},D0e=2});var Ca,b3=y(()=>{Ca=[];Ca.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ca.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ca.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Vb,SI,wI,N0e,xI,Wb,j0e,$I,kI,EI,v3,Kot,Jot,S3=y(()=>{b3();Vb=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",SI=Symbol.for("signal-exit emitter"),wI=globalThis,N0e=Object.defineProperty.bind(Object),xI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(wI[SI])return wI[SI];N0e(wI,SI,{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}},Wb=class{},j0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),$I=class extends Wb{onExit(){return()=>{}}load(){}unload(){}},kI=class extends Wb{#t=EI.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 Ca)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(!Vb(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 Ca)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,Ca.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 Vb(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"&&Vb(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)}},EI=globalThis.process,{onExit:v3,load:Kot,unload:Jot}=j0e(Vb(EI)?new kI(EI):new $I)});import{addAbortListener as M0e}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()});M0e(n,()=>{i()})}});var k3,F0e,L0e,$3,z0e,E3=y(()=>{JO();B_();cs();fl();k3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=q_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=F0e(r,n,i),{sourceStream:d,sourceError:f}=z0e(t,l),{options:p,fileDescriptors:m}=Ri.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},F0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=L0e(t,e,...r),a=tb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},L0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e($3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||WO(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]=I_(r,...n);return{destination:e($3)(i,o,s),pipeOptions:s}}if(Ri.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}}),z0e=(t,e)=>{try{return{sourceStream:wl(t,e)}}catch(r){return{sourceError:r}}}});var T3,U0e,AI,A3,TI=y(()=>{Wf();Zb();T3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=U0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw AI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},U0e=({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 bI(r),e},AI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>kl({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 q0e}from"node:stream/promises";var I3,B0e,H0e,G0e,Kb,Z0e,V0e,P3=y(()=>{Gb();rb();Zb();I3=(t,e,r)=>{let n=Kb.has(e)?H0e(t,e):B0e(t,e);return ka(t,Z0e,r.signal),ka(e,V0e,r.signal),G0e(e),n},B0e=(t,e)=>{let r=Pa([t]);return Tl(r,e),Kb.set(e,r),r},H0e=(t,e)=>{let r=Kb.get(e);return r.add(t),r},G0e=async t=>{try{await q0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Kb.delete(t)},Kb=new WeakMap,Z0e=2,V0e=1});import{aborted as W0e}from"node:util";var C3,K0e,D3=y(()=>{TI();C3=(t,e)=>t===void 0?[]:[K0e(t,e)],K0e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await W0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw AI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var Jb,J0e,Y0e,N3=y(()=>{po();E3();TI();R3();P3();D3();Jb=(t,...e)=>{if(At(e[0]))return Jb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=k3(t,...e),i=J0e({...n,destination:r});return i.pipe=Jb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},J0e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=Y0e(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()}},Y0e=(t,e)=>Promise.allSettled([t,e])});import{on as X0e}from"node:events";import{getDefaultHighWaterMark as Q0e}from"node:stream";var Yb,e$e,OI,t$e,M3,RI,j3,r$e,n$e,Xb=y(()=>{nI();Mb();sI();Yb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return e$e(e,s),M3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},e$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},OI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;t$e(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})},t$e=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=X0e(t,"data",{signal:e.signal,highWaterMark:j3,highWatermark:j3});return r$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},RI=Q0e(!0),j3=RI,r$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=n$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ia(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Jf(a)}},n$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Fb(t,r,!e),jb(t,i,!n,{})].filter(Boolean)});import{setImmediate as i$e}from"node:timers/promises";var F3,o$e,s$e,a$e,II,L3,PI=y(()=>{Ab();rn();cI();Xb();Oa();Kf();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=o$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([s$e(t),d]);return}let f=eI(c,r),p=OI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([a$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},o$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!qb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=OI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await CW(a,t,r,o)},s$e=async t=>{await i$e(),t.readableFlowing===null&&t.resume()},a$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await xb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await $b(r,{maxBuffer:o})):await Eb(r,{maxBuffer:o})}catch(a){return L3(yV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},II=async t=>{try{return await t}catch(e){return L3(e)}},L3=({bufferedData:t})=>lG(t)?new Uint8Array(t):t});import{finished as c$e}from"node:stream/promises";var ep,l$e,u$e,d$e,f$e,p$e,CI,Qb,z3,ev=y(()=>{ep=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=l$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],c$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||f$e(a,e,r,n)}finally{s.abort()}},l$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&u$e(t,r,n),n},u$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{d$e(e,r),n.call(t,...i)}},d$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},f$e=(t,e,r,n)=>{if(!p$e(t,e,r,n))throw t},p$e=(t,e,r,n=!0)=>r.propagating?z3(t)||Qb(t):(r.propagating=!0,CI(r,e)===n?z3(t):Qb(t)),CI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Qb=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",z3=t=>t?.code==="EPIPE"});var U3,DI,NI=y(()=>{PI();ev();U3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>DI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),DI=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=ep(t,e,l);if(CI(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,B3,m$e,h$e,jI=y(()=>{Gb();NI();q3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Pa([t,e].filter(Boolean)):void 0,B3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>DI({...m$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:h$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),m$e=({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}},h$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var H3,G3,Z3=y(()=>{hl();ss();H3=t=>ml(t,"ipc"),G3=(t,e)=>{let r=U_(t);Ti({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var V3,W3,K3=y(()=>{Oa();Z3();yo();mI();V3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=H3(o),a=go(e,"ipc"),c=go(r,"ipc");for await(let l of pI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(_V(t,i,c),i.push(l)),s&&G3(l,o);return i},W3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as g$e}from"node:events";var J3,y$e,_$e,b$e,Y3=y(()=>{Ta();OR();vR();TR();ho();vr();PI();K3();IR();jI();NI();dI();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 _=zW(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=B3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=V3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=y$e(h,t,S),D=_$e(m,S);try{return await Promise.race([Promise.all([{},qW(_),Promise.all(x),w,T,B9(t,d),...A,...D]),g,b$e(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(q=>II(q))),II(w),W3(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},y$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:ep(n,i,r)),_$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>ep(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),b$e=async(t,{signal:e})=>{let[r]=await g$e(t,"error",{signal:e});throw r}});var X3,tp,Ol,tv=y(()=>{Sl();X3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),tp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Oi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Ol=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 MI,eK,FI,LI,rv,nv,zI=y(()=>{ev();MI=async t=>{if(t!==void 0)try{await FI(t)}catch{}},eK=async t=>{if(t!==void 0)try{await LI(t)}catch{}},FI=async t=>{await Q3(t,{cleanup:!0,readable:!1,writable:!0})},LI=async t=>{await Q3(t,{cleanup:!0,readable:!0,writable:!1})},rv=async(t,e)=>{if(await t,e)throw e},nv=(t,e,r)=>{r&&!Qb(r)?t.destroy(r):e&&t.destroy()}});import{Readable as v$e}from"node:stream";import{callbackify as S$e}from"node:util";var tK,UI,qI,BI,w$e,HI,GI,rK,ZI=y(()=>{Ea();cs();Xb();Sl();tv();zI();tK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=UI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=qI(a,s),{read:f,onStdoutDataDone:p}=BI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new v$e({read:f,destroy:S$e(GI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return HI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},UI=(t,e,r)=>{let n=wl(t,e),i=tp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},qI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:RI},BI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Oi(),s=Yb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){w$e(this,s,o)},onStdoutDataDone:o}},w$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},HI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await LI(t),await n,await MI(i),await e,r.readable&&r.push(null)}catch(o){await MI(i),rK(r,o)}},GI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Ol(r,e)&&(rK(t,n),await rv(e,n))},rK=(t,e)=>{nv(t,t.readable,e)}});import{Writable as x$e}from"node:stream";import{callbackify as nK}from"node:util";var iK,VI,WI,$$e,k$e,KI,JI,oK,YI=y(()=>{cs();tv();zI();iK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=VI(t,r,e),s=new x$e({...WI(n,t,i),destroy:nK(JI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return KI(n,s),s},VI=(t,e,r)=>{let n=tb(t,e),i=tp(r,n,"writableFinal"),o=tp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},WI=(t,e,r)=>({write:$$e.bind(void 0,t),final:nK(k$e.bind(void 0,t,e,r))}),$$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},k$e=async(t,e,r)=>{await Ol(r,e)&&(t.writable&&t.end(),await e)},KI=async(t,e,r)=>{try{await FI(t),e.writable&&e.end()}catch(n){await eK(r),oK(e,n)}},JI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Ol(r,e),await Ol(n,e)&&(oK(t,i),await rv(e,i))},oK=(t,e)=>{nv(t,t.writable,e)}});import{Duplex as E$e}from"node:stream";import{callbackify as A$e}from"node:util";var sK,T$e,aK=y(()=>{Ea();ZI();YI();sK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=UI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=VI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=qI(c,a),{read:g,onStdoutDataDone:b}=BI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new E$e({read:g,...WI(u,t,d),destroy:A$e(T$e.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 HI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),KI(u,_,c),_},T$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([GI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),JI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var XI,O$e,cK=y(()=>{Ea();cs();Xb();XI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=wl(t,r),a=Yb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return O$e(a,s,t)},O$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var lK,uK=y(()=>{tv();ZI();YI();aK();cK();lK=(t,{encoding:e})=>{let r=X3();t.readable=tK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=iK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=sK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=XI.bind(void 0,t,e),t[Symbol.asyncIterator]=XI.bind(void 0,t,e,{})}});var dK,R$e,I$e,fK=y(()=>{dK=(t,e)=>{for(let[r,n]of I$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},R$e=(async()=>{})().constructor.prototype,I$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(R$e,t)])});import{setMaxListeners as P$e}from"node:events";import{spawn as C$e}from"node:child_process";var pK,D$e,N$e,j$e,M$e,F$e,mK=y(()=>{Ab();sR();DR();cs();NR();hI();Wf();Rb();n3();c3();Kf();_3();Y_();x3();N3();jI();Y3();uK();Sl();fK();pK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=D$e(t,e,r),{subprocess:f,promise:p}=j$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Jb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),dK(f,p),Ri.set(f,{options:u,fileDescriptors:d}),f},D$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=H_(t,e,r),{file:a,commandArguments:c,options:l}=yb(t,e,r),u=N$e(l),d=a3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},N$e=({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}},j$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=C$e(..._b(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;P$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];y3(c,a,l),w3(c,r,l);let d={},f=Oi();c.kill=r9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=q3(c,r),lK(c,r),QW(c,r);let p=M$e({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}},M$e=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)=>bo(x,e,w)),_=bo(h,e,"all"),S=F$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return El(S,n,e)},F$e=({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?Vf({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 Ii,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Ob({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var iv,L$e,z$e,hK=y(()=>{po();yo();iv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,L$e(n,t[n],i)]));return{...t,...r}},L$e=(t,e,r)=>z$e.has(t)&&At(e)&&At(r)?{...e,...r}:r,z$e=new Set(["env",...tR])});var ds,U$e,q$e,gK=y(()=>{po();JO();yG();ZW();mK();hK();ds=(t,e,r,n)=>{let i=(s,a,c)=>ds(s,a,r,c),o=(...s)=>U$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},U$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(At(o))return i(t,iv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=q$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?GW(a,c,l):pK(a,c,l,i)},q$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=hG(e)?gG(e,r):[e,...r],[s,a,c]=I_(...o),l=iv(iv(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 yK,_K,bK,B$e,H$e,vK=y(()=>{yK=({file:t,commandArguments:e})=>bK(t,e),_K=({file:t,commandArguments:e})=>({...bK(t,e),isSync:!0}),bK=(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]=B$e(t);return{file:r,commandArguments:n}},B$e=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(H$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},H$e=/ +/g});var SK,wK,G$e,xK,Z$e,$K,kK=y(()=>{SK=(t,e,r)=>{t.sync=e(G$e,r),t.s=t.sync},wK=({options:t})=>xK(t),G$e=({options:t})=>({...xK(t),isSync:!0}),xK=t=>({options:{...Z$e(t),...t}}),Z$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},$K={preferLocal:!0}});var Lct,Je,zct,Uct,qct,Bct,Hct,Gct,Zct,Vct,Mr=y(()=>{gK();vK();RR();kK();hI();Lct=ds(()=>({})),Je=ds(()=>({isSync:!0})),zct=ds(yK),Uct=ds(_K),qct=ds(z9),Bct=ds(wK,{},$K,SK),{sendMessage:Hct,getOneMessage:Gct,getEachMessage:Zct,getCancelSignal:Vct}=e3()});import{existsSync as ov,statSync as V$e}from"node:fs";import{dirname as QI,extname as W$e,isAbsolute as EK,join as eP,relative as tP,resolve as sv,sep as K$e}from"node:path";function av(t){return t==="./gradlew"||t==="gradle"}function J$e(t){return(ov(eP(t,"build.gradle.kts"))||ov(eP(t,"build.gradle")))&&ov(eP(t,"gradle.properties"))}function Y$e(t,e){let n=tP(t,e).split(K$e).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function fs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function X$e(t,e){let r=sv(t,e),n=r;ov(r)?V$e(r).isFile()&&(n=QI(r)):W$e(r)!==""&&(n=QI(r));let i=tP(t,n);if(i.startsWith("..")||EK(i))return null;let o=n;for(;;){if(J$e(o))return o;if(sv(o)===sv(t))return null;let s=QI(o);if(s===o)return null;let a=tP(t,s);if(a.startsWith("..")||EK(a))return null;o=s}}function cv(t,e){let r=sv(t),n=new Map,i=[];for(let o of e){let s=X$e(r,o);if(!s){i.push(o);continue}let a=Y$e(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 lv=y(()=>{"use strict"});import{existsSync as Q$e,readFileSync as eke}from"node:fs";import{join as tke}from"node:path";function Rl(t="."){let e=tke(t,".cladding","config.yaml");if(!Q$e(e))return rP;try{let n=(0,AK.parse)(eke(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 rke){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 TK(t,e){let r=[],n=!1;for(let i of t){let o=nke.exec(i);if(o){n=!0;for(let s of e)r.push(fs(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 AK,rke,rP,nke,uv=y(()=>{"use strict";AK=bt(Qt(),1);lv();rke=["type","lint","test","coverage"],rP={scope:"feature"};nke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as iP,readFileSync as OK,readdirSync as ike,statSync as oke}from"node:fs";import{join as dv}from"node:path";function aP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=dv(t,e);if(iP(r))try{if(RK.test(OK(r,"utf8")))return!0}catch{}}return!1}function IK(t){try{return iP(t)&&RK.test(OK(t,"utf8"))}catch{return!1}}function PK(t,e=0){if(e>4||!iP(t))return!1;let r;try{r=ike(t)}catch{return!1}for(let n of r){let i=dv(t,n),o=!1;try{o=oke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(PK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&IK(i))return!0}return!1}function cke(t){if(aP(t))return!0;for(let e of ske)if(IK(dv(t,e)))return!0;for(let e of ake)if(PK(dv(t,e)))return!0;return!1}function CK(t="."){let e=Rl(t).coverage;return e||(cke(t)?"kover":"jacoco")}function DK(t="."){return oP[CK(t)]}function NK(t="."){return nP[CK(t)]}var oP,nP,sP,RK,ske,ake,fv=y(()=>{"use strict";uv();oP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},nP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},sP=[nP.kover,nP.jacoco],RK=/kover/i;ske=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],ake=["buildSrc","build-logic"]});import{existsSync as pv,readFileSync as jK,readdirSync as MK}from"node:fs";import{join as Da}from"node:path";function cP(t){return pv(Da(t,"gradlew"))?"./gradlew":"gradle"}function lke(t){let e=cP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[DK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function uke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(jK(Da(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 fke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function hke(t,e){for(let r of e)if(pv(Da(t,r)))return r}function gke(t,e){try{return MK(t).find(n=>n.endsWith(e))}catch{return}}function _ke(t,e){for(let r of yke)if(r.configs.some(n=>pv(Da(t,n))))return r.gate;return e}function vke(t){if(bke.some(e=>pv(Da(t,e))))return!0;try{return JSON.parse(jK(Da(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function Ske(t,e){let r=e.lint?{...e,lint:_ke(t,e.lint)}:{...e};return e.test&&e.coverage&&vke(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function ut(t="."){for(let e of pke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=gke(t,o):r=hke(t,[o]),r)break;if(!r||e.requiresSource&&!fke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Ske(t,n):n;return{language:e.language,manifest:r,gates:i}}return mke}var dke,pke,mke,yke,bke,on=y(()=>{"use strict";fv();dke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);pke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:lke},{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:uke}],mke={language:"unknown",manifest:"",gates:{}};yke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];bke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as wke,readFileSync as xke}from"node:fs";import{join as $ke}from"node:path";function Na(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=(o||s||`exit ${i}`).slice(0,200);return FK.test(o)||FK.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Ut(t,e,r){return Na(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Il(t,e){let r=$ke(t,"package.json");if(!wke(r))return!1;try{return!!JSON.parse(xke(r,"utf8")).scripts?.[e]}catch{return!1}}var FK,Tn=y(()=>{"use strict";FK=/config (is |file )?not found|no such file|ENOENT|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 kke(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.arch;if(!n)return[{detector:hv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Na(i)?[{detector:hv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:mv(i,hv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var hv,ja,gv=y(()=>{"use strict";Mr();on();Tn();hv="ARCHITECTURE_VIOLATION";ja={name:hv,subprocess:!0,run:kke}});function Eke(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.secret;if(!n)return[{detector:yv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Na(i)?[{detector:yv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:mv(i,yv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var yv,Ma,_v=y(()=>{"use strict";Mr();on();Tn();yv="HARDCODED_SECRET";Ma={name:yv,subprocess:!0,run:Eke}});import{existsSync as lP,readdirSync as LK}from"node:fs";import{join as bv}from"node:path";function Tke(t,e){let r=bv(t,e.path);if(!lP(r))return!0;if(e.isDirectory)try{return LK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Oke(t){let{cwd:e="."}=t,r=[];for(let i of Ake)Tke(e,i)&&r.push({detector:rp,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=bv(e,"spec.yaml");if(lP(n)){let i=Pke(n),o=i?null:Rke(e);if(i)r.push({detector:rp,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:rp,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=Ike(e);s&&r.push({detector:rp,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 Rke(t){for(let e of["spec/features","spec/scenarios"]){let r=bv(t,e);if(!lP(r))continue;let n;try{n=LK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ki(bv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function Ike(t){try{return G(t),null}catch(e){return e.message}}function Pke(t){let e;try{e=ki(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var rp,Ake,zK,UK=y(()=>{"use strict";qe();S_();rp="ABSENCE_OF_GOVERNANCE",Ake=[{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}];zK={name:rp,run:Oke}});function vv(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=vv(r)==="while",o=Dke.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 '${vv(r)}'`}let n=Cke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:vv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${vv(r)}'`:null}function Nke(t,e){let r=uP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function qK(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...Nke(r,n));return e}var Cke,Dke,dP=y(()=>{"use strict";Cke={event:"when",state:"while",optional:"where",unwanted:"if"},Dke=/\bwhen\b/i});function he(t,e,r){let n;try{n=G(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var vt=y(()=>{"use strict";qe()});function jke(t){let{cwd:e="."}=t;return he(e,Sv,Mke)}function Mke(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:Sv,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 qK(t.features))e.push({detector:Sv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Sv,BK,HK=y(()=>{"use strict";dP();vt();Sv="AC_DRIFT";BK={name:Sv,run:jke}});function Ci(t=".",e){let n=(e??"").trim().toLowerCase()||ut(t).language;return ZK[n]??GK}var Fke,Lke,zke,GK,Uke,qke,ZK,Bke,VK,Fa=y(()=>{"use strict";on();Fke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,Lke=/^[ \t]*import\s+([\w.]+)/gm,zke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,GK={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:Fke,importStyle:"relative"},Uke={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:Lke,importStyle:"dotted"},qke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:zke,importStyle:"dotted"},ZK={typescript:GK,kotlin:Uke,python:qke},Bke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],VK=new Set([...Object.values(ZK).flatMap(t=>t?.extensions??[]),...Bke].map(t=>t.toLowerCase()))});import{existsSync as Hke,readFileSync as Gke,readdirSync as Zke,statSync as Vke}from"node:fs";import{join as KK,relative as WK}from"node:path";function Wke(t,e){if(!Hke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=Zke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=KK(i,s),c;try{c=Vke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function Kke(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function Yke(t){return Jke.test(t)}function Xke(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Ci(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Wke(KK(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=Gke(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";qe();Fa();JK="AI_HINTS_FORBIDDEN_PATTERN";Jke=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;YK={name:JK,run:Xke}});function Qke(t){let{cwd:e="."}=t,r;try{r=G(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:QK,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var QK,eJ,tJ=y(()=>{"use strict";qe();QK="AC_DUPLICATE_WITHIN_FEATURE";eJ={name:QK,run:Qke}});import{createRequire as eEe}from"module";import{basename as tEe,dirname as pP,normalize as rEe,relative as nEe,resolve as iEe,sep as iJ}from"path";import*as oEe from"fs";function sEe(t){let e=rEe(t);return e.length>1&&e[e.length-1]===iJ&&(e=e.substring(0,e.length-1)),e}function oJ(t,e){return t.replace(aEe,e)}function lEe(t){return t==="/"||cEe.test(t)}function fP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=iEe(t)),(n||o)&&(t=sEe(t)),t===".")return"";let s=t[t.length-1]!==i;return oJ(s?t+i:t,i)}function sJ(t,e){return e+t}function uEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:oJ(nEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function dEe(t){return t}function fEe(t,e,r){return e+t+r}function pEe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?uEe(t,e):n?sJ:dEe}function mEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function hEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function bEe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?hEe(t):mEe(t):n&&n.length?yEe:gEe:_Ee}function kEe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?$Ee:r&&r.length?n?vEe:SEe:n?wEe:xEe}function TEe(t){return t.group?AEe:EEe}function IEe(t){return t.group?OEe:REe}function DEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?CEe:PEe}function aJ(t,e,r){if(r.options.useRealPaths)return NEe(e,r);let n=pP(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=pP(n)}return r.symlinks.set(t,e),i>1}function NEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function wv(t,e,r,n){e(t&&!n?t:null,r)}function HEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?jEe:zEe:n?e?MEe:BEe:i?e?LEe:qEe:e?FEe:UEe}function VEe(t){return t?ZEe:GEe}function YEe(t,e){return new Promise((r,n)=>{uJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function uJ(t,e,r){new lJ(t,e,r).start()}function XEe(t,e){return new lJ(t,e).start()}var rJ,aEe,cEe,gEe,yEe,_Ee,vEe,SEe,wEe,xEe,$Ee,EEe,AEe,OEe,REe,PEe,CEe,jEe,MEe,FEe,LEe,zEe,UEe,qEe,BEe,cJ,GEe,ZEe,WEe,KEe,JEe,lJ,nJ,dJ,fJ,pJ=y(()=>{rJ=eEe(import.meta.url);aEe=/[\\/]/g;cEe=/^[a-z]:[\\/]$/i;gEe=(t,e)=>{e.push(t||".")},yEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},_Ee=()=>{};vEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},SEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},wEe=(t,e,r,n)=>{r.files++},xEe=(t,e)=>{e.push(t)},$Ee=()=>{};EEe=t=>t,AEe=()=>[""].slice(0,0);OEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},REe=()=>{};PEe=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()&&aJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},CEe=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()&&aJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};jEe=t=>t.counts,MEe=t=>t.groups,FEe=t=>t.paths,LEe=t=>t.paths.slice(0,t.options.maxFiles),zEe=(t,e,r)=>(wv(e,r,t.counts,t.options.suppressErrors),null),UEe=(t,e,r)=>(wv(e,r,t.paths,t.options.suppressErrors),null),qEe=(t,e,r)=>(wv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),BEe=(t,e,r)=>(wv(e,r,t.groups,t.options.suppressErrors),null);cJ={withFileTypes:!0},GEe=(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||".",cJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},ZEe=(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||".",cJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};WEe=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))}},KEe=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}},JEe=class{aborted=!1;abort(){this.aborted=!0}},lJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=HEe(e,this.isSynchronous),this.root=fP(t,e),this.state={root:lEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new KEe,options:e,queue:new WEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new JEe,fs:e.fs||oEe},this.joinPath=pEe(this.root,e),this.pushDirectory=bEe(this.root,e),this.pushFile=kEe(e),this.getArray=TEe(e),this.groupFiles=IEe(e),this.resolveSymlink=DEe(e,this.isSynchronous),this.walkDirectory=VEe(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(_=fP(_,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=tEe(_),x=fP(pP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};nJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return YEe(this.root,this.options)}withCallback(t){uJ(this.root,this.options,t)}sync(){return XEe(this.root,this.options)}},dJ=null;try{rJ.resolve("picomatch"),dJ=rJ("picomatch")}catch{}fJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:iJ,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 nJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new nJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||dJ;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 np=v((Jlt,_J)=>{"use strict";var mJ="[^\\\\/]",QEe="(?=.)",hJ="[^/]",mP="(?:\\/|$)",gJ="(?:^|\\/)",hP=`\\.{1,2}${mP}`,eAe="(?!\\.)",tAe=`(?!${gJ}${hP})`,rAe=`(?!\\.{0,1}${mP})`,nAe=`(?!${hP})`,iAe="[^.\\/]",oAe=`${hJ}*?`,sAe="/",yJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:QEe,QMARK:hJ,END_ANCHOR:mP,DOTS_SLASH:hP,NO_DOT:eAe,NO_DOTS:tAe,NO_DOT_SLASH:rAe,NO_DOTS_SLASH:nAe,QMARK_NO_DOT:iAe,STAR:oAe,START_ANCHOR:gJ,SEP:sAe},aAe={...yJ,SLASH_LITERAL:"[\\\\/]",QMARK:mJ,STAR:`${mJ}*?`,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:"\\"},cAe={__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"};_J.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:cAe,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?aAe:yJ}}});var ip=v(Fr=>{"use strict";var{REGEX_BACKSLASH:lAe,REGEX_REMOVE_BACKSLASH:uAe,REGEX_SPECIAL_CHARS:dAe,REGEX_SPECIAL_CHARS_GLOBAL:fAe}=np();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>dAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(fAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(lAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(uAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var EJ=v((Xlt,kJ)=>{"use strict";var bJ=ip(),{CHAR_ASTERISK:gP,CHAR_AT:pAe,CHAR_BACKWARD_SLASH:op,CHAR_COMMA:mAe,CHAR_DOT:yP,CHAR_EXCLAMATION_MARK:_P,CHAR_FORWARD_SLASH:$J,CHAR_LEFT_CURLY_BRACE:bP,CHAR_LEFT_PARENTHESES:vP,CHAR_LEFT_SQUARE_BRACKET:hAe,CHAR_PLUS:gAe,CHAR_QUESTION_MARK:vJ,CHAR_RIGHT_CURLY_BRACE:yAe,CHAR_RIGHT_PARENTHESES:SJ,CHAR_RIGHT_SQUARE_BRACKET:_Ae}=np(),wJ=t=>t===$J||t===op,xJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},bAe=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},E=()=>l>=n,q=()=>c.charCodeAt(l+1),Q=()=>(T=A,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),Se&&m===!0&&d>0?(Se=c.slice(0,d),C=c.slice(d)):m===!0?(Se="",C=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&wJ(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),r.unescape===!0&&(C&&(C=bJ.removeBackslashes(C)),Se&&_===!0&&(Se=bJ.removeBackslashes(Se)));let Ir={prefix:P,input:t,start:u,base:Se,glob:C,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,wJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var sp=np(),sn=ip(),{MAX_LENGTH:xv,POSIX_REGEX_SOURCE:vAe,REGEX_NON_SPECIAL_CHARS:SAe,REGEX_SPECIAL_CHARS_BACKREF:wAe,REPLACEMENTS:AJ}=sp,xAe=(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=>sn.escapeRegex(i)).join("..")}return r},Pl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,TJ=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},$Ae=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},OJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if($Ae(e))return e.replace(/\\(.)/g,"$1")},kAe=t=>{let e=t.map(OJ).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}}}}},EAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=OJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},AAe=t=>{let e=0,r=t.trim(),n=SP(r);for(;n;)e++,r=n.body.trim(),n=SP(r);return e},TAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:sp.DEFAULT_MAX_EXTGLOB_RECURSION,n=TJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||kAe(n)))return{risky:!0};for(let i of n){let o=EAe(i);if(o)return{risky:!0,safeOutput:o};if(AAe(i)>r)return{risky:!0}}return{risky:!1}},wP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=AJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(xv,r.maxLength):xv,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=sp.globChars(r.windows),l=sp.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,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(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=sn.removePrefix(t,E),i=t.length;let q=[],Q=[],Se=[],P=o,C,Ir=()=>E.index===i-1,se=E.peek=(H=1)=>t[E.index+H],Pe=E.advance=()=>t[++E.index]||"",Wt=()=>t.slice(E.index+1),dr=(H="",pt=0)=>{E.consumed+=H,E.index+=pt},Yt=H=>{E.output+=H.output!=null?H.output:H.value,dr(H.value)},oo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),E.start++,H++;return H%2===0?!1:(E.negated=!0,E.start++,!0)},vi=H=>{E[H]++,Se.push(H)},Yr=H=>{E[H]--,Se.pop()},de=H=>{if(P.type==="globstar"){let pt=E.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||q.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!pt&&!B&&(E.output=E.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=D,E.output+=P.output)}if(q.length&&H.type!=="paren"&&(q[q.length-1].inner+=H.value),(H.value||H.output)&&Yt(H),P&&P.type==="text"&&H.type==="text"){P.output=(P.output||P.value)+H.value,P.value+=H.value;return}H.prev=P,s.push(H),P=H},so=(H,pt)=>{let B={...l[pt],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;vi("parens"),de({type:H,value:pt,output:E.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Te}),q.push(B)},ade=H=>{let pt=t.slice(H.startIndex,E.index+1),B=t.slice(H.startIndex+2,E.index),Te=TAe(B,r);if((H.type==="plus"||H.type==="star")&&Te.risky){let ct=Te.safeOutput?(H.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,Si=s[H.tokensIndex];Si.type="text",Si.value=pt,Si.output=ct||sn.escapeRegex(pt);for(let wi=H.tokensIndex+1;wi1&&H.inner.includes("/")&&(ct=O(r)),(ct!==D||Ir()||/^\)+$/.test(Wt()))&&(lt=H.close=`)$))${ct}`),H.inner.includes("*")&&(Ft=Wt())&&/^\.[^\\/.]+$/.test(Ft)){let Si=wP(Ft,{...e,fastpaths:!1}).output;lt=H.close=`)${Si})${ct})`}H.prev.type==="bos"&&(E.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:C,output:lt}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,pt=t.replace(wAe,(B,Te,lt,Ft,ct,Si)=>Ft==="\\"?(H=!0,B):Ft==="?"?Te?Te+Ft+(ct?_.repeat(ct.length):""):Si===0?A+(ct?_.repeat(ct.length):""):_.repeat(lt.length):Ft==="."?u.repeat(lt.length):Ft==="*"?Te?Te+Ft+(ct?D:""):D:Te?B:`\\${B}`);return H===!0&&(r.unescape===!0?pt=pt.replace(/\\/g,""):pt=pt.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),pt===t&&r.contains===!0?(E.output=t,E):(E.output=sn.wrapOutput(pt,E,e),E)}for(;!Ir();){if(C=Pe(),C==="\0")continue;if(C==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){C+="\\",de({type:"text",value:C});continue}let Te=/^\\+/.exec(Wt()),lt=0;if(Te&&Te[0].length>2&&(lt=Te[0].length,E.index+=lt,lt%2!==0&&(C+="\\")),r.unescape===!0?C=Pe():C+=Pe(),E.brackets===0){de({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("["),lt=P.value.slice(0,Te),Ft=P.value.slice(Te+2),ct=vAe[Ft];if(ct){P.value=lt+ct,E.backtrack=!0,Pe(),!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,Yt({value:C});continue}if(E.quotes===1&&C!=='"'){C=sn.escapeRegex(C),P.value+=C,Yt({value:C});continue}if(C==='"'){E.quotes=E.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:C});continue}if(C==="("){vi("parens"),de({type:"paren",value:C});continue}if(C===")"){if(E.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Pl("opening","("));let B=q[q.length-1];if(B&&E.parens===B.parens+1){ade(q.pop());continue}de({type:"paren",value:C,output:E.parens?")":"\\)"}),Yr("parens");continue}if(C==="["){if(r.nobracket===!0||!Wt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Pl("closing","]"));C=`\\${C}`}else vi("brackets");de({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){de({type:"text",value:C,output:`\\${C}`});continue}if(E.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Pl("opening","["));de({type:"text",value:C,output:`\\${C}`});continue}Yr("brackets");let B=P.value.slice(1);if(P.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(C=`/${C}`),P.value+=C,Yt({value:C}),r.literalBrackets===!1||sn.hasRegexChars(B))continue;let Te=sn.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){vi("braces");let B={type:"brace",value:C,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};Q.push(B),de(B);continue}if(C==="}"){let B=Q[Q.length-1];if(r.nobrace===!0||!B){de({type:"text",value:C,output:C});continue}let Te=")";if(B.dots===!0){let lt=s.slice(),Ft=[];for(let ct=lt.length-1;ct>=0&&(s.pop(),lt[ct].type!=="brace");ct--)lt[ct].type!=="dots"&&Ft.unshift(lt[ct].value);Te=xAe(Ft,r),E.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let lt=E.output.slice(0,B.outputIndex),Ft=E.tokens.slice(B.tokensIndex);B.value=B.output="\\{",C=Te="\\}",E.output=lt;for(let ct of Ft)E.output+=ct.output||ct.value}de({type:"brace",value:C,output:Te}),Yr("braces"),Q.pop();continue}if(C==="|"){q.length>0&&q[q.length-1].conditions++,de({type:"text",value:C});continue}if(C===","){let B=C,Te=Q[Q.length-1];Te&&Se[Se.length-1]==="braces"&&(Te.comma=!0,B="|"),de({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}de({type:"slash",value:C,output:f});continue}if(C==="."){if(E.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let B=Q[Q.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"){de({type:"text",value:C,output:u});continue}de({type:"dot",value:C,output:u});continue}if(C==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){so("qmark",C);continue}if(P&&P.type==="paren"){let Te=se(),lt=C;(P.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Wt()))&&(lt=`\\${C}`),de({type:"text",value:C,output:lt});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){de({type:"qmark",value:C,output:S});continue}de({type:"qmark",value:C,output:_});continue}if(C==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){so("negate",C);continue}if(r.nonegate!==!0&&E.index===0){oo();continue}}if(C==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){so("plus",C);continue}if(P&&P.value==="("||r.regex===!1){de({type:"plus",value:C,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||E.parens>0){de({type:"plus",value:C});continue}de({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:C,output:""});continue}de({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let B=SAe.exec(Wt());B&&(C+=B[0],E.index+=B[0].length),de({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,dr(C);continue}let H=Wt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){so("star",C);continue}if(P.type==="star"){if(r.noglobstar===!0){dr(C);continue}let B=P.prev,Te=B.prev,lt=B.type==="slash"||B.type==="bos",Ft=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!lt||H[0]&&H[0]!=="/")){de({type:"star",value:C,output:""});continue}let ct=E.braces>0&&(B.type==="comma"||B.type==="brace"),Si=q.length&&(B.type==="pipe"||B.type==="paren");if(!lt&&B.type!=="paren"&&!ct&&!Si){de({type:"star",value:C,output:""});continue}for(;H.slice(0,3)==="/**";){let wi=t[E.index+4];if(wi&&wi!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Ir()){P.type="globstar",P.value+=C,P.output=O(r),E.output=P.output,E.globstar=!0,dr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!Ft&&Ir()){E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=O(r)+(r.strictSlashes?")":"|$)"),P.value+=C,E.globstar=!0,E.output+=B.output+P.output,dr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let wi=H[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=`${O(r)}${f}|${f}${wi})`,P.value+=C,E.output+=B.output+P.output,E.globstar=!0,dr(C+Pe()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){P.type="globstar",P.value+=C,P.output=`(?:^|${f}|${O(r)}${f})`,E.output=P.output,E.globstar=!0,dr(C+Pe()),de({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-P.output.length),P.type="globstar",P.output=O(r),P.value+=C,E.output+=P.output,E.globstar=!0,dr(C);continue}let pt={type:"star",value:C,output:D};if(r.bash===!0){pt.output=".*?",(P.type==="bos"||P.type==="slash")&&(pt.output=T+pt.output),de(pt);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){pt.output=C,de(pt);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+=T,P.output+=T),se()!=="*"&&(E.output+=p,P.output+=p)),de(pt)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Pl("closing","]"));E.output=sn.escapeLast(E.output,"["),Yr("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Pl("closing",")"));E.output=sn.escapeLast(E.output,"("),Yr("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Pl("closing","}"));E.output=sn.escapeLast(E.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),E.backtrack===!0){E.output="";for(let H of E.tokens)E.output+=H.output!=null?H.output:H.value,H.suffix&&(E.output+=H.suffix)}return E};wP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(xv,r.maxLength):xv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=AJ[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}=sp.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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};RJ.exports=wP});var DJ=v((eut,CJ)=>{"use strict";var OAe=EJ(),xP=IJ(),PJ=ip(),RAe=np(),IAe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=IAe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?PJ.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(PJ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):xP(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>OAe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=xP.fastpaths(t,e)),i.output||(i=xP(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=RAe;CJ.exports=Tt});var FJ=v((tut,MJ)=>{"use strict";var NJ=DJ(),PAe=ip();function jJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:PAe.isWindows()}),NJ(t,e,r)}Object.assign(jJ,NJ);MJ.exports=jJ});import{readdir as CAe,readdirSync as DAe,realpath as NAe,realpathSync as jAe,stat as MAe,statSync as FAe}from"fs";import{isAbsolute as LAe,posix as La,resolve as zAe}from"path";import{fileURLToPath as UAe}from"url";function HAe(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]===".."&&BAe.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=>La.relative(t,n)||".":n=>La.relative(t,`${e}/${n}`)||"."}function VAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=La.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function qJ(t){var e;let r=Cl.default.scan(t,WAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function eTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Cl.default.scan(t);return r.isGlob||r.negated}function ap(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function BJ(t){return typeof t=="string"?[t]:t??[]}function $P(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=QAe(o);s=LAe(s.replace(rTe,""))?La.relative(a,s):La.normalize(s);let c=(i=tTe.exec(s))===null||i===void 0?void 0:i[0],l=qJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?La.join(o,...d):o}return s}function nTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push($P(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push($P(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push($P(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function iTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=nTe(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(zJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Cl.default)(i.match,f),m=(0,Cl.default)(i.ignore,f),h=HAe(i.match,f),g=LJ(r,d,o),b=o?g:LJ(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new fJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&ap(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return ap(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&VAe(r,d)]}function oTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function aTe(t){let e={...sTe,...t};return e.cwd=(e.cwd instanceof URL?UAe(e.cwd):zAe(e.cwd)).replace(zJ,"/"),e.ignore=BJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||CAe,readdirSync:e.fs.readdirSync||DAe,realpath:e.fs.realpath||NAe,realpathSync:e.fs.realpathSync||jAe,stat:e.fs.stat||MAe,statSync:e.fs.statSync||FAe}),e.debug&&ap("globbing with options:",e),e}function cTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=qAe(t)||typeof t=="string",i=BJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=aTe(n?e:t);return i.length>0?iTe(o,i):[]}function ps(t,e){let[r,n]=cTe(t,e);return r?oTe(r.sync(),n):[]}var Cl,qAe,zJ,UJ,BAe,GAe,ZAe,WAe,KAe,JAe,YAe,XAe,QAe,tTe,rTe,sTe,cp=y(()=>{pJ();Cl=bt(FJ(),1),qAe=Array.isArray,zJ=/\\/g,UJ=process.platform==="win32",BAe=/^(\/?\.\.)+$/;GAe=/^[A-Z]:\/$/i,ZAe=UJ?t=>GAe.test(t):t=>t==="/";WAe={parts:!0};KAe=/(?t.replace(KAe,"\\$&"),XAe=t=>t.replace(JAe,"\\$&"),QAe=UJ?XAe:YAe;tTe=/^(\/?\.\.)+/,rTe=/\\(?=[()[\]{}!*+?@|])/g;sTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as lp,readFileSync as lTe,readdirSync as uTe,statSync as HJ}from"node:fs";import{join as za}from"node:path";function dTe(t){let{cwd:e="."}=t,r,n;try{let c=G(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Ci(e,n),o=[],{layers:s,forbiddenImports:a}=kP(r);return(s.size>0||a.length>0)&&!lp(za(e,i.mainRoot))?[{detector:up,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&&(fTe(e,i,s,o),pTe(e,i,s,o)),a.length>0&&mTe(e,i,a,o),o)}function kP(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 fTe(t,e,r,n){let i=e.mainRoot,o=za(t,i);if(lp(o))for(let s of uTe(o)){let a=za(o,s);HJ(a).isDirectory()&&(r.has(s)||n.push({detector:up,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function pTe(t,e,r,n){let i=e.mainRoot,o=za(t,i);if(lp(o))for(let s of r){let a=za(o,s);lp(a)&&HJ(a).isDirectory()||n.push({detector:up,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 mTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=za(t,i,s.from);if(!lp(a))continue;let c=ps([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=za(a,l),d;try{d=lTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];hTe(p,s.to,e.importStyle)&&n.push({detector:up,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 hTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var up,GJ,EP=y(()=>{"use strict";cp();qe();Fa();up="ARCHITECTURE_FROM_SPEC";GJ={name:up,run:dTe}});import{existsSync as gTe,readFileSync as yTe}from"node:fs";import{join as _Te}from"node:path";function bTe(t){let{cwd:e="."}=t,r=_Te(e,"spec/capabilities.yaml");if(!gTe(r))return[];let n;try{let c=yTe(r,"utf8"),l=ZJ.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=G(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:$v,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:$v,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:$v,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var ZJ,$v,VJ,WJ=y(()=>{"use strict";ZJ=bt(Qt(),1);qe();$v="CAPABILITIES_FEATURE_MAPPING";VJ={name:$v,run:bTe}});import{existsSync as vTe,readFileSync as STe}from"node:fs";import{join as wTe}from"node:path";function xTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function $Te(t){let{cwd:e="."}=t;return he(e,AP,r=>kTe(r,e))}function kTe(t,e){let r=Ci(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=wTe(e,o);if(!vTe(s))continue;let a=STe(s,"utf8");xTe(a)||n.push({detector:AP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var AP,KJ,JJ=y(()=>{"use strict";Fa();vt();AP="CONVENTION_DRIFT";KJ={name:AP,run:$Te}});import{existsSync as TP,readFileSync as YJ}from"node:fs";import{join as kv}from"node:path";function ETe(t){return JSON.parse(t).total?.lines?.pct??0}function XJ(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function OTe(t,e){if(!av(ut(t).gates.coverage?.cmd))return null;let r;try{r=cv(t,e)}catch(c){return[{detector:vo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=sP.find(d=>TP(kv(c.dir,d)));if(!l){s.push(c.path);continue}let u=XJ(YJ(kv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:vo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=QJ(n,i);return a0?[{detector:vo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function RTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=OTe(e,t.focusModules);if(a)return a}let r;try{r=G(e).project?.language}catch{}let n=Ci(e,r),i=ut(e).language==="kotlin"?sP.find(a=>TP(kv(e,a)))??NK(e):n.coverageSummary,o=kv(e,i);if(!TP(o))return[{detector:vo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=YJ(o,"utf8");s=n.coverageFormat==="jacoco-xml"?ATe(a):n.coverageFormat==="cobertura-xml"?TTe(a):ETe(a)}catch(a){return[{detector:vo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:vo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Ev?[]:[{detector:vo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Ev}%`}]}var vo,Ev,e8,t8=y(()=>{"use strict";qe();fv();Fa();lv();on();vo="COVERAGE_DROP",Ev=70;e8={name:vo,run:RTe}});import{existsSync as ITe}from"node:fs";import{join as PTe}from"node:path";function CTe(t){let{cwd:e="."}=t;return he(e,Av,r=>DTe(r,e))}function DTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?ITe(PTe(e,r.path))?[]:[{detector:Av,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:Av,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var Av,r8,n8=y(()=>{"use strict";vt();Av="DELIVERABLE_INTEGRITY";r8={name:Av,run:CTe}});function NTe(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:Tv,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 jTe(t){let e=NTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Tv,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 MTe(t){let{cwd:e="."}=t;return he(e,Tv,r=>jTe(r))}var Tv,i8,o8=y(()=>{"use strict";vt();Tv="SMOKE_PROBE_DEMAND";i8={name:Tv,run:MTe}});function FTe(t){let{cwd:e="."}=t;return he(e,Ov,r=>LTe(r,e))}function LTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=is(e);if(n===null)return[{detector:Ov,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=A_(n,e,o);s.state!=="fresh"&&i.push({detector:Ov,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 Ov,Rv,OP=y(()=>{"use strict";ll();vt();Ov="STALE_ATTESTATION";Rv={name:Ov,run:FTe}});function zTe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}return UTe(r)}function UTe(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:s8,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 s8,Iv,RP=y(()=>{"use strict";qe();s8="DEPENDENCY_CYCLE";Iv={name:s8,run:zTe}});import{appendFileSync as qTe,existsSync as a8,mkdirSync as BTe,readFileSync as HTe}from"node:fs";import{dirname as GTe,join as ZTe}from"node:path";function c8(t){return ZTe(t,VTe,WTe)}function l8(t){return IP.add(t),()=>IP.delete(t)}function Ua(t,e){let r=c8(t),n=GTe(r);a8(n)||BTe(n,{recursive:!0}),qTe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of IP)try{i(t,e)}catch{}}function On(t){let e=c8(t);if(!a8(e))return[];let r=HTe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var VTe,WTe,IP,ti=y(()=>{"use strict";VTe=".cladding",WTe="audit.log.jsonl";IP=new Set});import{existsSync as KTe}from"node:fs";import{join as JTe}from"node:path";function YTe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:PP,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&&(KTe(JTe(e,i.artifact))||n.push({detector:PP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var PP,u8,d8=y(()=>{"use strict";ti();PP="EVIDENCE_MISMATCH";u8={name:PP,run:YTe}});import{existsSync as XTe,readFileSync as QTe}from"node:fs";import{join as eOe}from"node:path";function tOe(t){let e=eOe(t,h8);if(!XTe(e))return null;try{let n=((0,m8.parse)(QTe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*p8(t,e){for(let r of t??[])r.startsWith(f8)&&(yield{ref:r,name:r.slice(f8.length),field:e})}function rOe(t){let{cwd:e="."}=t,r=tOe(e);if(r===null)return[];let n;try{n=G(e)}catch(o){return[{detector:CP,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=[...p8(s.evidence_refs,"evidence_refs"),...p8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:CP,severity:"warn",path:h8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var m8,CP,f8,h8,g8,y8=y(()=>{"use strict";m8=bt(Qt(),1);qe();CP="FIXTURE_REFERENCE_INVALID",f8="fixture:",h8="conformance/fixtures.yaml";g8={name:CP,run:rOe}});import{existsSync as Dl,readFileSync as DP}from"node:fs";import{join as qa}from"node:path";function nOe(t){return ps(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function dp(t){if(!Dl(t))return null;try{return JSON.parse(DP(t,"utf8"))}catch{return null}}function iOe(t,e){let r=qa(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(DP(r,"utf8"))}catch(c){e.push({detector:So,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:So,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=nOe(t);s!==a&&e.push({detector:So,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function oOe(t,e){for(let r of _8){let n=qa(t,r.path);if(!Dl(n))continue;let i=dp(n);if(!i){e.push({detector:So,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:So,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function sOe(t,e){let r=dp(qa(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of _8){let s=qa(t,o.path);if(!Dl(s))continue;let a=dp(s);a?.version&&a.version!==n&&e.push({detector:So,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=qa(t,".claude-plugin","marketplace.json");if(Dl(i)){let o=dp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:So,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 aOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function cOe(t,e){let r=qa(t,"src","cli","clad.ts"),n=qa(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Dl(r)||!Dl(n))return;let i=aOe(DP(r,"utf8"));if(i.length===0)return;let s=dp(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:So,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 lOe(t){let{cwd:e="."}=t,r=[];return iOe(e,r),cOe(e,r),oOe(e,r),sOe(e,r),r}var So,_8,b8,v8=y(()=>{"use strict";cp();So="HARNESS_INTEGRITY",_8=[{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"]}];b8={name:So,run:lOe}});import{existsSync as uOe,readFileSync as dOe}from"node:fs";import{join as fOe}from"node:path";function mOe(t){let{cwd:e="."}=t;return he(e,Pv,r=>gOe(r,e))}function hOe(t){let e=fOe(t,"spec/capabilities.yaml");if(!uOe(e))return!1;try{let r=S8.default.parse(dOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function gOe(t,e){let r=t.features.length;if(r{"use strict";S8=bt(Qt(),1);vt();Pv="HOLLOW_GOVERNANCE",pOe=8;w8={name:Pv,run:mOe}});import{existsSync as $8,readFileSync as k8}from"node:fs";import{join as E8}from"node:path";function A8(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 bOe(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 vOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function SOe(t){let e=E8(t,"README.md"),r=E8(t,"docs","dogfood","matrix.md");if(!$8(e)||!$8(r))return[];let n=A8(k8(e,"utf8"),yOe),i=A8(k8(r,"utf8"),_Oe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=vOe(a);if(c===null)continue;let l=i[s]??"not-run",u=bOe(l);u!==null&&c>u&&o.push({detector:T8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function wOe(t){let{cwd:e="."}=t;return SOe(e)}var T8,yOe,_Oe,O8,R8=y(()=>{"use strict";T8="HOST_CLAIM_DRIFT",yOe=//,_Oe=//;O8={name:T8,run:wOe}});function xOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return I8(r.features.map(i=>i.id),"feature","spec/features/",n),I8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function I8(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:P8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var P8,C8,D8=y(()=>{"use strict";qe();P8="ID_COLLISION";C8={name:P8,run:xOe}});import{existsSync as fp,readFileSync as NP,readdirSync as jP,statSync as $Oe,writeFileSync as j8}from"node:fs";import{join as wo}from"node:path";function N8(t){if(!fp(t))return 0;try{return jP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function kOe(t){if(!fp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=jP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=wo(n,o),a;try{a=$Oe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function EOe(t){let e=wo(t,"spec","capabilities.yaml");if(!fp(e))return 0;try{let r=Cv.default.parse(NP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ms(t="."){let e=N8(wo(t,"spec","features")),r=N8(wo(t,"spec","scenarios")),n=EOe(t),i=kOe(wo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Nl(t,e){let r=wo(t,"spec.yaml");if(!fp(r))return;let n=NP(r,"utf8"),i=AOe(n,e);i!==n&&j8(r,i)}function AOe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as gxe}from"node:buffer";import{StringDecoder as yxe}from"node:string_decoder";var Lb,_xe,bxe,vxe,nI=y(()=>{rn();Lb=(t,e,r)=>{if(r)return;if(t)return{transform:_xe.bind(void 0,new TextEncoder)};let n=new yxe(e);return{transform:bxe.bind(void 0,n),final:vxe.bind(void 0,n)}},_xe=function*(t,e){gxe.isBuffer(e)?yield mo(e):typeof e=="string"?yield t.encode(e):yield e},bxe=function*(t,e){yield zt(e)?t.write(e):e},vxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as EW}from"node:util";var iI,zb,AW,Sxe,TW,wxe,OW=y(()=>{iI=EW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),zb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=wxe}=e[r];for await(let i of n(t))yield*zb(i,e,r+1)},AW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Sxe(r,Number(e),t)},Sxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*zb(n,r,e+1)},TW=EW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),wxe=function*(t){yield t}});var oI,RW,Pa,Jf,xxe,$xe,sI=y(()=>{oI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},RW=(t,e)=>[...e.flatMap(r=>[...Pa(r,t,0)]),...Jf(t)],Pa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=$xe}=e[r];for(let i of n(t))yield*Pa(i,e,r+1)},Jf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*xxe(r,Number(e),t)},xxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Pa(n,r,e+1)},$xe=function*(t){yield t}});import{Transform as kxe,getDefaultHighWaterMark as IW}from"node:stream";var aI,Ub,PW,qb=y(()=>{vr();Fb();kW();nI();OW();sI();aI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=PW(t,s,o),l=Ia(e),u=Ia(r),d=l?iI.bind(void 0,zb,a):oI.bind(void 0,Pa),f=l||u?iI.bind(void 0,AW,a):oI.bind(void 0,Jf),p=l||u?TW.bind(void 0,a):void 0;return{stream:new kxe({writableObjectMode:n,writableHighWaterMark:IW(n),readableObjectMode:i,readableHighWaterMark:IW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Ub=(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=PW(s,r,a);t=RW(c,t)}return t},PW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:wW(n,a)},Lb(r,s,n),Mb(r,o,n,c),{transform:t,final:e},{transform:xW(i,a)},SW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var CW,Exe,Axe,Txe,Oxe,DW=y(()=>{qb();rn();vr();CW=(t,e)=>{for(let r of Exe(t))Axe(t,r,e)},Exe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Axe=(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 ${us[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Txe(a,n));r.input=Df(s)},Txe=(t,e)=>{let r=Ub(t,e,"utf8",!0);return Oxe(r),Df(r)},Oxe=t=>{let e=t.find(r=>typeof r!="string"&&!zt(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 Bb,Rxe,Ixe,NW,jW,Pxe,MW,cI=y(()=>{Aa();vr();ml();ss();Bb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&pl(r,n)&&!nn.has(e)&&Rxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Ixe.has(o))||t.every(({type:i})=>An.has(i))),Rxe=t=>t===1||t===2,Ixe=new Set(["pipe","overlapped"]),NW=async(t,e,r,n)=>{for await(let i of t)Pxe(e)||MW(i,r,n)},jW=(t,e,r)=>{for(let n of t)MW(n,e,r)},Pxe=t=>t._readableState.pipes.length>0,MW=(t,e,r)=>{let n=q_(t);Oi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Cxe,appendFileSync as Dxe}from"node:fs";var FW,Nxe,jxe,Mxe,Fxe,Lxe,LW=y(()=>{cI();qb();Fb();rn();vr();Ra();FW=({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)=>Nxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Nxe=({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=xV(t,o,d),p=mo(f),{stdioItems:m,objectMode:h}=e[r],g=jxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Mxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Fxe({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&&Lxe(b,m,i),S}catch(x){return n.error=x,S}},jxe=(t,e,r,n)=>{try{return Ub(t,e,r,!1)}catch(i){return n.error=i,t}},Mxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Df(t)};let s=pG(t,r);return n[o]?{serializedResult:s,finalResult:rI(s,!i[o],e)}:{serializedResult:s}},Fxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Bb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=rI(t,!1,s);try{jW(a,e,n)}catch(c){r.error??=c}},Lxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Db.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Dxe(n,t):(r.add(o),Cxe(n,t))}}});var zW,UW=y(()=>{rn();Kf();zW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,bo(e,r,"all")]:Array.isArray(e)?[bo(t,r,"all"),...e]:zt(t)&&zt(e)?YO([t,e]):`${t}${e}`}});import{once as lI}from"node:events";var qW,zxe,BW,HW,Uxe,uI,dI=y(()=>{ka();qW=async(t,e)=>{let[r,n]=await zxe(t);return e.isForcefullyTerminated??=!1,[r,n]},zxe=async t=>{let[e,r]=await Promise.allSettled([lI(t,"spawn"),lI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?BW(t):r.value},BW=async t=>{try{return await lI(t,"exit")}catch{return BW(t)}},HW=async t=>{let[e,r]=await t;if(!Uxe(e,r)&&uI(e,r))throw new Xn;return[e,r]},Uxe=(t,e)=>t===void 0&&e===void 0,uI=(t,e)=>t!==0||e!==null});var GW,qxe,ZW=y(()=>{ka();Ra();dI();GW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=qxe(t,e,r),s=o?.code==="ETIMEDOUT",a=wV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},qxe=(t,e,r)=>t!==void 0?t:uI(e,r)?new Xn:void 0});import{spawnSync as Bxe}from"node:child_process";var VW,Hxe,Gxe,Zxe,Hb,Vxe,Wxe,Kxe,Jxe,WW=y(()=>{sR();DR();NR();Wf();Ib();_W();Kf();DW();LW();Ra();UW();ZW();VW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Hxe(t,e,r),d=Vxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return kl(d,c,l)},Hxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=G_(t,e,r),a=Gxe(r),{file:c,commandArguments:l,options:u}=_b(t,e,a);Zxe(u);let d=gW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Gxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Zxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Hb("ipcInput"),t&&Hb("ipc: true"),r&&Hb("detached: true"),n&&Hb("cancelSignal")},Hb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Vxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Wxe({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}=GW(c,r),{output:m,error:h=l}=FW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>bo(_,r,S)),b=bo(zW(m,r),r,"all");return Jxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Wxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{CW(o,r);let a=Kxe(r);return Bxe(...bb(t,e,a))}catch(a){return $l({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},Kxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Ob(e)}),Jxe=({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?Rb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Vf({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 Yxe}from"node:events";var KW,Xxe,Qxe,e0e,t0e,JW=y(()=>{bl();qf();Uf();KW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(yl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:db(t)}),Xxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Xxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ib(e,i);let o=ls(t,e,r),s=new AbortController;try{return await Promise.race([Qxe(o,n,s),e0e(o,r,s),t0e(o,r,s)])}catch(a){throw _l(t),a}finally{s.abort(),ob(e,i)}},Qxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await fI(t,"message",{signal:r});return n}for await(let[n]of Yxe(t,"message",{signal:r}))if(e(n))return n},e0e=async(t,e,{signal:r})=>{await fI(t,"disconnect",{signal:r}),a9(e)},t0e=async(t,e,{signal:r})=>{let[n]=await fI(t,"strict:error",{signal:r});throw eb(n,e)}});import{once as XW,on as r0e}from"node:events";var QW,pI,n0e,i0e,o0e,YW,mI=y(()=>{bl();qf();Uf();QW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>pI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),pI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{yl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:db(t)}),ib(e,o);let s=ls(t,e,r),a=new AbortController,c={};return n0e(t,s,a),i0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),o0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},n0e=async(t,e,r)=>{try{await XW(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},i0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await XW(t,"strict:error",{signal:r.signal});n.error=eb(i,e),r.abort()}catch{}},o0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of r0e(r,"message",{signal:o.signal}))YW(s),yield c}catch{YW(s)}finally{o.abort(),ob(e,a),n||_l(t),i&&await t}},YW=({error:t})=>{if(t)throw t}});import e3 from"node:process";var t3,r3,n3,hI=y(()=>{gb();JW();mI();lb();t3=(t,{ipc:e})=>{Object.assign(t,n3(t,!1,e))},r3=()=>{let t=e3,e=!0,r=e3.channel!==void 0;return{...n3(t,e,r),getCancelSignal:N9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},n3=(t,e,r)=>({sendMessage:hb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:KW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:QW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as s0e}from"node:child_process";import{PassThrough as a0e,Readable as c0e,Writable as l0e,Duplex as u0e}from"node:stream";var i3,d0e,Yf,f0e,p0e,m0e,h0e,o3=y(()=>{jb();Wf();Ib();i3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{QR(n);let a=new s0e;d0e(a,n),Object.assign(a,{readable:f0e,writable:p0e,duplex:m0e});let c=$l({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=h0e(c,s,i);return{subprocess:a,promise:l}},d0e=(t,e)=>{let r=Yf(),n=Yf(),i=Yf(),o=Array.from({length:e.length-3},Yf),s=Yf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Yf=()=>{let t=new a0e;return t.end(),t},f0e=()=>new c0e({read(){}}),p0e=()=>new l0e({write(){}}),m0e=()=>new u0e({read(){},write(){}}),h0e=async(t,e,r)=>kl(t,e,r)});import{createReadStream as s3,createWriteStream as a3}from"node:fs";import{Buffer as g0e}from"node:buffer";import{Readable as Xf,Writable as y0e,Duplex as _0e}from"node:stream";var l3,Qf,c3,b0e,u3=y(()=>{qb();jb();vr();l3=(t,e)=>Nb(b0e,t,e,!1),Qf=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${us[t]}.`)},c3={fileNumber:Qf,generator:aI,asyncGenerator:aI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:_0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},b0e={input:{...c3,fileUrl:({value:t})=>({stream:s3(t)}),filePath:({value:{file:t}})=>({stream:s3(t)}),webStream:({value:t})=>({stream:Xf.fromWeb(t)}),iterable:({value:t})=>({stream:Xf.from(t)}),asyncIterable:({value:t})=>({stream:Xf.from(t)}),string:({value:t})=>({stream:Xf.from(t)}),uint8Array:({value:t})=>({stream:Xf.from(g0e.from(t))})},output:{...c3,fileUrl:({value:t})=>({stream:a3(t)}),filePath:({value:{file:t,append:e}})=>({stream:a3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:y0e.fromWeb(t)}),iterable:Qf,asyncIterable:Qf,string:Qf,uint8Array:Qf}}});import{on as v0e,once as d3}from"node:events";import{PassThrough as S0e,getDefaultHighWaterMark as w0e}from"node:stream";import{finished as m3}from"node:stream/promises";function Ca(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)yI(i);let e=t.some(({readableObjectMode:i})=>i),r=x0e(t,e),n=new gI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var x0e,gI,$0e,k0e,E0e,yI,A0e,T0e,O0e,R0e,I0e,h3,g3,_I,y3,P0e,Gb,f3,p3,Zb=y(()=>{x0e=(t,e)=>{if(t.length===0)return w0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},gI=class extends S0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(yI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=$0e(this,this.#t,this.#o);let r=A0e({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(yI(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)}},$0e=async(t,e,r)=>{Gb(t,f3);let n=new AbortController;try{await Promise.race([k0e(t,n),E0e(t,e,r,n)])}finally{n.abort(),Gb(t,-f3)}},k0e=async(t,{signal:e})=>{try{await m3(t,{signal:e,cleanup:!0})}catch(r){throw h3(t,r),r}},E0e=async(t,e,r,{signal:n})=>{for await(let[i]of v0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},yI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},A0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Gb(t,p3);let a=new AbortController;try{await Promise.race([T0e(o,e,a),O0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),R0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Gb(t,-p3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?_I(t):I0e(t))},T0e=async(t,e,{signal:r})=>{try{await t,r.aborted||_I(e)}catch(n){r.aborted||h3(e,n)}},O0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await m3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;g3(s)?i.add(e):y3(t,s)}},R0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await d3(t,i,{signal:o}),!t.readable)return d3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},I0e=t=>{t.writable&&t.end()},h3=(t,e)=>{g3(e)?_I(t):y3(t,e)},g3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",_I=t=>{(t.readable||t.writable)&&t.destroy()},y3=(t,e)=>{t.destroyed||(t.once("error",P0e),t.destroy(e))},P0e=()=>{},Gb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},f3=2,p3=1});import{finished as _3}from"node:stream/promises";var Al,C0e,bI,D0e,vI,Vb=y(()=>{ho();Al=(t,e)=>{t.pipe(e),C0e(t,e),D0e(t,e)},C0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await _3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}bI(e)}},bI=t=>{t.writable&&t.end()},D0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await _3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}vI(t)}},vI=t=>{t.readable&&t.destroy()}});var b3,N0e,j0e,M0e,F0e,L0e,v3=y(()=>{Zb();ho();nb();vr();Vb();b3=(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})=>An.has(c)))N0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.has(c)))M0e({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]:Ca(o);Al(s,i)}},N0e=(t,e,r,n)=>{r==="output"?Al(t.stdio[n],e):Al(e,t.stdio[n]);let i=j0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},j0e=["stdin","stdout","stderr"],M0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;F0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},F0e=(t,{signal:e})=>{Yn(t)&&Ea(t,L0e,e)},L0e=2});var Da,S3=y(()=>{Da=[];Da.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Da.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Da.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Wb,SI,wI,z0e,xI,Kb,U0e,$I,kI,EI,w3,est,tst,x3=y(()=>{S3();Wb=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",SI=Symbol.for("signal-exit emitter"),wI=globalThis,z0e=Object.defineProperty.bind(Object),xI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(wI[SI])return wI[SI];z0e(wI,SI,{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}},Kb=class{},U0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),$I=class extends Kb{onExit(){return()=>{}}load(){}unload(){}},kI=class extends Kb{#t=EI.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 Da)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(!Wb(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 Da)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,Da.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 Wb(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"&&Wb(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)}},EI=globalThis.process,{onExit:w3,load:est,unload:tst}=U0e(Wb(EI)?new kI(EI):new $I)});import{addAbortListener as q0e}from"node:events";var $3,k3=y(()=>{x3();$3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=w3(()=>{t.kill()});q0e(n,()=>{i()})}});var A3,B0e,H0e,E3,G0e,T3=y(()=>{JO();H_();cs();dl();A3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=B_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=B0e(r,n,i),{sourceStream:d,sourceError:f}=G0e(t,l),{options:p,fileDescriptors:m}=Ii.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},B0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=H0e(t,e,...r),a=rb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},H0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(E3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||WO(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]=P_(r,...n);return{destination:e(E3)(i,o,s),pipeOptions:s}}if(Ii.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}`)},E3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),G0e=(t,e)=>{try{return{sourceStream:Sl(t,e)}}catch(r){return{sourceError:r}}}});var R3,Z0e,AI,O3,TI=y(()=>{Wf();Vb();R3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=Z0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw AI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},Z0e=({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 bI(r),e},AI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>$l({error:t,command:O3,escapedCommand:O3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),O3="source.pipe(destination)"});var I3,P3=y(()=>{I3=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 V0e}from"node:stream/promises";var C3,W0e,K0e,J0e,Jb,Y0e,X0e,D3=y(()=>{Zb();nb();Vb();C3=(t,e,r)=>{let n=Jb.has(e)?K0e(t,e):W0e(t,e);return Ea(t,Y0e,r.signal),Ea(e,X0e,r.signal),J0e(e),n},W0e=(t,e)=>{let r=Ca([t]);return Al(r,e),Jb.set(e,r),r},K0e=(t,e)=>{let r=Jb.get(e);return r.add(t),r},J0e=async t=>{try{await V0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Jb.delete(t)},Jb=new WeakMap,Y0e=2,X0e=1});import{aborted as Q0e}from"node:util";var N3,e$e,j3=y(()=>{TI();N3=(t,e)=>t===void 0?[]:[e$e(t,e)],e$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Q0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw AI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var Yb,t$e,r$e,M3=y(()=>{po();T3();TI();P3();D3();j3();Yb=(t,...e)=>{if(At(e[0]))return Yb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=A3(t,...e),i=t$e({...n,destination:r});return i.pipe=Yb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},t$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=r$e(t,i);R3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=C3(e,o,d);return await Promise.race([I3(u),...N3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},r$e=(t,e)=>Promise.allSettled([t,e])});import{on as n$e}from"node:events";import{getDefaultHighWaterMark as i$e}from"node:stream";var Xb,o$e,OI,s$e,L3,RI,F3,a$e,c$e,Qb=y(()=>{nI();Fb();sI();Xb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return o$e(e,s),L3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},o$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},OI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;s$e(e,s,t);let a=t.readableObjectMode&&!o;return L3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},s$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},L3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=n$e(t,"data",{signal:e.signal,highWaterMark:F3,highWatermark:F3});return a$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},RI=i$e(!0),F3=RI,a$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=c$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Pa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Jf(a)}},c$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Lb(t,r,!e),Mb(t,i,!n,{})].filter(Boolean)});import{setImmediate as l$e}from"node:timers/promises";var z3,u$e,d$e,f$e,II,U3,PI=y(()=>{Tb();rn();cI();Qb();Ra();Kf();z3=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=u$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([d$e(t),d]);return}let f=eI(c,r),p=OI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([f$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},u$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Bb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=OI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await NW(a,t,r,o)},d$e=async t=>{await l$e(),t.readableFlowing===null&&t.resume()},f$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await $b(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await kb(r,{maxBuffer:o})):await Ab(r,{maxBuffer:o})}catch(a){return U3(bV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},II=async t=>{try{return await t}catch(e){return U3(e)}},U3=({bufferedData:t})=>dG(t)?new Uint8Array(t):t});import{finished as p$e}from"node:stream/promises";var ep,m$e,h$e,g$e,y$e,_$e,CI,ev,q3,tv=y(()=>{ep=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=m$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],p$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||y$e(a,e,r,n)}finally{s.abort()}},m$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&h$e(t,r,n),n},h$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{g$e(e,r),n.call(t,...i)}},g$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},y$e=(t,e,r,n)=>{if(!_$e(t,e,r,n))throw t},_$e=(t,e,r,n=!0)=>r.propagating?q3(t)||ev(t):(r.propagating=!0,CI(r,e)===n?q3(t):ev(t)),CI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",ev=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",q3=t=>t?.code==="EPIPE"});var B3,DI,NI=y(()=>{PI();tv();B3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>DI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),DI=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=ep(t,e,l);if(CI(l,e)){await u;return}let[d]=await Promise.all([z3({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,G3,b$e,v$e,jI=y(()=>{Zb();NI();H3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ca([t,e].filter(Boolean)):void 0,G3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>DI({...b$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:v$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),b$e=({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}},v$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var Z3,V3,W3=y(()=>{ml();ss();Z3=t=>pl(t,"ipc"),V3=(t,e)=>{let r=q_(t);Oi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var K3,J3,Y3=y(()=>{Ra();W3();yo();mI();K3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Z3(o),a=go(e,"ipc"),c=go(r,"ipc");for await(let l of pI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(vV(t,i,c),i.push(l)),s&&V3(l,o);return i},J3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as S$e}from"node:events";var X3,w$e,x$e,$$e,Q3=y(()=>{Oa();OR();vR();TR();ho();vr();PI();Y3();IR();jI();NI();dI();tv();X3=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 _=qW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=B3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=G3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=K3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=w$e(h,t,S),D=x$e(m,S);try{return await Promise.race([Promise.all([{},HW(_),Promise.all(x),w,T,G9(t,d),...A,...D]),g,$$e(t,b),...z9(t,o,f,b),...s9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...F9({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(q=>II(q))),II(w),J3(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},w$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:ep(n,i,r)),x$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>ep(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),$$e=async(t,{signal:e})=>{let[r]=await S$e(t,"error",{signal:e});throw r}});var eK,tp,Tl,rv=y(()=>{vl();eK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),tp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ri();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Tl=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 tK}from"node:stream/promises";var MI,rK,FI,LI,nv,iv,zI=y(()=>{tv();MI=async t=>{if(t!==void 0)try{await FI(t)}catch{}},rK=async t=>{if(t!==void 0)try{await LI(t)}catch{}},FI=async t=>{await tK(t,{cleanup:!0,readable:!1,writable:!0})},LI=async t=>{await tK(t,{cleanup:!0,readable:!0,writable:!1})},nv=async(t,e)=>{if(await t,e)throw e},iv=(t,e,r)=>{r&&!ev(r)?t.destroy(r):e&&t.destroy()}});import{Readable as k$e}from"node:stream";import{callbackify as E$e}from"node:util";var nK,UI,qI,BI,A$e,HI,GI,iK,ZI=y(()=>{Aa();cs();Qb();vl();rv();zI();nK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=UI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=qI(a,s),{read:f,onStdoutDataDone:p}=BI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new k$e({read:f,destroy:E$e(GI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return HI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},UI=(t,e,r)=>{let n=Sl(t,e),i=tp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},qI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:RI},BI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ri(),s=Xb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){A$e(this,s,o)},onStdoutDataDone:o}},A$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},HI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await LI(t),await n,await MI(i),await e,r.readable&&r.push(null)}catch(o){await MI(i),iK(r,o)}},GI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Tl(r,e)&&(iK(t,n),await nv(e,n))},iK=(t,e)=>{iv(t,t.readable,e)}});import{Writable as T$e}from"node:stream";import{callbackify as oK}from"node:util";var sK,VI,WI,O$e,R$e,KI,JI,aK,YI=y(()=>{cs();rv();zI();sK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=VI(t,r,e),s=new T$e({...WI(n,t,i),destroy:oK(JI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return KI(n,s),s},VI=(t,e,r)=>{let n=rb(t,e),i=tp(r,n,"writableFinal"),o=tp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},WI=(t,e,r)=>({write:O$e.bind(void 0,t),final:oK(R$e.bind(void 0,t,e,r))}),O$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},R$e=async(t,e,r)=>{await Tl(r,e)&&(t.writable&&t.end(),await e)},KI=async(t,e,r)=>{try{await FI(t),e.writable&&e.end()}catch(n){await rK(r),aK(e,n)}},JI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Tl(r,e),await Tl(n,e)&&(aK(t,i),await nv(e,i))},aK=(t,e)=>{iv(t,t.writable,e)}});import{Duplex as I$e}from"node:stream";import{callbackify as P$e}from"node:util";var cK,C$e,lK=y(()=>{Aa();ZI();YI();cK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=UI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=VI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=qI(c,a),{read:g,onStdoutDataDone:b}=BI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new I$e({read:g,...WI(u,t,d),destroy:P$e(C$e.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 HI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),KI(u,_,c),_},C$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([GI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),JI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var XI,D$e,uK=y(()=>{Aa();cs();Qb();XI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=Sl(t,r),a=Xb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return D$e(a,s,t)},D$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var dK,fK=y(()=>{rv();ZI();YI();lK();uK();dK=(t,{encoding:e})=>{let r=eK();t.readable=nK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=sK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=cK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=XI.bind(void 0,t,e),t[Symbol.asyncIterator]=XI.bind(void 0,t,e,{})}});var pK,N$e,j$e,mK=y(()=>{pK=(t,e)=>{for(let[r,n]of j$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},N$e=(async()=>{})().constructor.prototype,j$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(N$e,t)])});import{setMaxListeners as M$e}from"node:events";import{spawn as F$e}from"node:child_process";var hK,L$e,z$e,U$e,q$e,B$e,gK=y(()=>{Tb();sR();DR();cs();NR();hI();Wf();Ib();o3();u3();Kf();v3();X_();k3();M3();jI();Q3();fK();vl();mK();hK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=L$e(t,e,r),{subprocess:f,promise:p}=U$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Yb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),pK(f,p),Ii.set(f,{options:u,fileDescriptors:d}),f},L$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=G_(t,e,r),{file:a,commandArguments:c,options:l}=_b(t,e,r),u=z$e(l),d=l3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},z$e=({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}},U$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=F$e(...bb(t,e,r))}catch(m){return i3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;M$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];b3(c,a,l),$3(c,r,l);let d={},f=Ri();c.kill=i9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=H3(c,r),dK(c,r),t3(c,r);let p=q$e({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}},q$e=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 X3({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)=>bo(x,e,w)),_=bo(h,e,"all"),S=B$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return kl(S,n,e)},B$e=({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?Vf({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 Pi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Rb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var ov,H$e,G$e,yK=y(()=>{po();yo();ov=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,H$e(n,t[n],i)]));return{...t,...r}},H$e=(t,e,r)=>G$e.has(t)&&At(e)&&At(r)?{...e,...r}:r,G$e=new Set(["env",...tR])});var ds,Z$e,V$e,_K=y(()=>{po();JO();bG();WW();gK();yK();ds=(t,e,r,n)=>{let i=(s,a,c)=>ds(s,a,r,c),o=(...s)=>Z$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Z$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(At(o))return i(t,ov(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=V$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?VW(a,c,l):hK(a,c,l,i)},V$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=yG(e)?_G(e,r):[e,...r],[s,a,c]=P_(...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 bK,vK,SK,W$e,K$e,wK=y(()=>{bK=({file:t,commandArguments:e})=>SK(t,e),vK=({file:t,commandArguments:e})=>({...SK(t,e),isSync:!0}),SK=(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]=W$e(t);return{file:r,commandArguments:n}},W$e=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(K$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},K$e=/ +/g});var xK,$K,J$e,kK,Y$e,EK,AK=y(()=>{xK=(t,e,r)=>{t.sync=e(J$e,r),t.s=t.sync},$K=({options:t})=>kK(t),J$e=({options:t})=>({...kK(t),isSync:!0}),kK=t=>({options:{...Y$e(t),...t}}),Y$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},EK={preferLocal:!0}});var Hct,Je,Gct,Zct,Vct,Wct,Kct,Jct,Yct,Xct,Mr=y(()=>{_K();wK();RR();AK();hI();Hct=ds(()=>({})),Je=ds(()=>({isSync:!0})),Gct=ds(bK),Zct=ds(vK),Vct=ds(q9),Wct=ds($K,{},EK,xK),{sendMessage:Kct,getOneMessage:Jct,getEachMessage:Yct,getCancelSignal:Xct}=r3()});import{existsSync as sv,statSync as X$e}from"node:fs";import{dirname as QI,extname as Q$e,isAbsolute as TK,join as eP,relative as tP,resolve as av,sep as eke}from"node:path";function cv(t){return t==="./gradlew"||t==="gradle"}function tke(t){return(sv(eP(t,"build.gradle.kts"))||sv(eP(t,"build.gradle")))&&sv(eP(t,"gradle.properties"))}function rke(t,e){let n=tP(t,e).split(eke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function fs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function nke(t,e){let r=av(t,e),n=r;sv(r)?X$e(r).isFile()&&(n=QI(r)):Q$e(r)!==""&&(n=QI(r));let i=tP(t,n);if(i.startsWith("..")||TK(i))return null;let o=n;for(;;){if(tke(o))return o;if(av(o)===av(t))return null;let s=QI(o);if(s===o)return null;let a=tP(t,s);if(a.startsWith("..")||TK(a))return null;o=s}}function lv(t,e){let r=av(t),n=new Map,i=[];for(let o of e){let s=nke(r,o);if(!s){i.push(o);continue}let a=rke(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 uv=y(()=>{"use strict"});import{existsSync as ike,readFileSync as oke}from"node:fs";import{join as ske}from"node:path";function Ol(t="."){let e=ske(t,".cladding","config.yaml");if(!ike(e))return rP;try{let n=(0,OK.parse)(oke(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 ake){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 RK(t,e){let r=[],n=!1;for(let i of t){let o=cke.exec(i);if(o){n=!0;for(let s of e)r.push(fs(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 OK,ake,rP,cke,dv=y(()=>{"use strict";OK=bt(Qt(),1);uv();ake=["type","lint","test","coverage"],rP={scope:"feature"};cke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as iP,readFileSync as IK,readdirSync as lke,statSync as uke}from"node:fs";import{join as fv}from"node:path";function aP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=fv(t,e);if(iP(r))try{if(PK.test(IK(r,"utf8")))return!0}catch{}}return!1}function CK(t){try{return iP(t)&&PK.test(IK(t,"utf8"))}catch{return!1}}function DK(t,e=0){if(e>4||!iP(t))return!1;let r;try{r=lke(t)}catch{return!1}for(let n of r){let i=fv(t,n),o=!1;try{o=uke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(DK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&CK(i))return!0}return!1}function pke(t){if(aP(t))return!0;for(let e of dke)if(CK(fv(t,e)))return!0;for(let e of fke)if(DK(fv(t,e)))return!0;return!1}function NK(t="."){let e=Ol(t).coverage;return e||(pke(t)?"kover":"jacoco")}function jK(t="."){return oP[NK(t)]}function MK(t="."){return nP[NK(t)]}var oP,nP,sP,PK,dke,fke,pv=y(()=>{"use strict";dv();oP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},nP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},sP=[nP.kover,nP.jacoco],PK=/kover/i;dke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],fke=["buildSrc","build-logic"]});import{existsSync as mv,readFileSync as FK,readdirSync as LK}from"node:fs";import{join as Na}from"node:path";function cP(t){return mv(Na(t,"gradlew"))?"./gradlew":"gradle"}function mke(t){let e=cP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[jK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function hke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(FK(Na(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 yke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function vke(t,e){for(let r of e)if(mv(Na(t,r)))return r}function Ske(t,e){try{return LK(t).find(n=>n.endsWith(e))}catch{return}}function xke(t,e){for(let r of wke)if(r.configs.some(n=>mv(Na(t,n))))return r.gate;return e}function kke(t){if($ke.some(e=>mv(Na(t,e))))return!0;try{return JSON.parse(FK(Na(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function Eke(t,e){let r=e.lint?{...e,lint:xke(t,e.lint)}:{...e};return e.test&&e.coverage&&kke(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function ut(t="."){for(let e of _ke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Ske(t,o):r=vke(t,[o]),r)break;if(!r||e.requiresSource&&!yke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Eke(t,n):n;return{language:e.language,manifest:r,gates:i}}return bke}var gke,_ke,bke,wke,$ke,on=y(()=>{"use strict";pv();gke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);_ke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:mke},{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:hke}],bke={language:"unknown",manifest:"",gates:{}};wke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];$ke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Ake,readFileSync as Tke}from"node:fs";import{join as Oke}from"node:path";function ja(t){return t.code==="ENOENT"}function hv(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=(o||s||`exit ${i}`).slice(0,200);return zK.test(o)||zK.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Ut(t,e,r){return ja(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Rl(t,e){let r=Oke(t,"package.json");if(!Ake(r))return!1;try{return!!JSON.parse(Tke(r,"utf8")).scripts?.[e]}catch{return!1}}var zK,Tn=y(()=>{"use strict";zK=/config (is |file )?not found|no such file|ENOENT|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 Rke(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.arch;if(!n)return[{detector:gv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return ja(i)?[{detector:gv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:hv(i,gv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var gv,Ma,yv=y(()=>{"use strict";Mr();on();Tn();gv="ARCHITECTURE_VIOLATION";Ma={name:gv,subprocess:!0,run:Rke}});function Ike(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.secret;if(!n)return[{detector:_v,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return ja(i)?[{detector:_v,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:hv(i,_v,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var _v,Fa,bv=y(()=>{"use strict";Mr();on();Tn();_v="HARDCODED_SECRET";Fa={name:_v,subprocess:!0,run:Ike}});import{existsSync as lP,readdirSync as UK}from"node:fs";import{join as vv}from"node:path";function Cke(t,e){let r=vv(t,e.path);if(!lP(r))return!0;if(e.isDirectory)try{return UK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Dke(t){let{cwd:e="."}=t,r=[];for(let i of Pke)Cke(e,i)&&r.push({detector:rp,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=vv(e,"spec.yaml");if(lP(n)){let i=Mke(n),o=i?null:Nke(e);if(i)r.push({detector:rp,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:rp,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=jke(e);s&&r.push({detector:rp,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 Nke(t){for(let e of["spec/features","spec/scenarios"]){let r=vv(t,e);if(!lP(r))continue;let n;try{n=UK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ei(vv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function jke(t){try{return G(t),null}catch(e){return e.message}}function Mke(t){let e;try{e=Ei(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var rp,Pke,qK,BK=y(()=>{"use strict";qe();w_();rp="ABSENCE_OF_GOVERNANCE",Pke=[{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}];qK={name:rp,run:Dke}});function Sv(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=Sv(r)==="while",o=Lke.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 '${Sv(r)}'`}let n=Fke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Sv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Sv(r)}'`:null}function zke(t,e){let r=uP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function HK(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...zke(r,n));return e}var Fke,Lke,dP=y(()=>{"use strict";Fke={event:"when",state:"while",optional:"where",unwanted:"if"},Lke=/\bwhen\b/i});function he(t,e,r){let n;try{n=G(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var vt=y(()=>{"use strict";qe()});function Uke(t){let{cwd:e="."}=t;return he(e,wv,qke)}function qke(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:wv,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 HK(t.features))e.push({detector:wv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var wv,GK,ZK=y(()=>{"use strict";dP();vt();wv="AC_DRIFT";GK={name:wv,run:Uke}});function Di(t=".",e){let n=(e??"").trim().toLowerCase()||ut(t).language;return WK[n]??VK}var Bke,Hke,Gke,VK,Zke,Vke,WK,Wke,KK,La=y(()=>{"use strict";on();Bke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,Hke=/^[ \t]*import\s+([\w.]+)/gm,Gke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,VK={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:Bke,importStyle:"relative"},Zke={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:Hke,importStyle:"dotted"},Vke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:Gke,importStyle:"dotted"},WK={typescript:VK,kotlin:Zke,python:Vke},Wke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],KK=new Set([...Object.values(WK).flatMap(t=>t?.extensions??[]),...Wke].map(t=>t.toLowerCase()))});import{existsSync as Kke,readFileSync as Jke,readdirSync as Yke,statSync as Xke}from"node:fs";import{join as YK,relative as JK}from"node:path";function Qke(t,e){if(!Kke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=Yke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=YK(i,s),c;try{c=Xke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function eEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function rEe(t){return tEe.test(t)}function nEe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Di(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Qke(YK(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=Jke(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";qe();La();XK="AI_HINTS_FORBIDDEN_PATTERN";tEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;QK={name:XK,run:nEe}});function iEe(t){let{cwd:e="."}=t,r;try{r=G(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:tJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var tJ,rJ,nJ=y(()=>{"use strict";qe();tJ="AC_DUPLICATE_WITHIN_FEATURE";rJ={name:tJ,run:iEe}});import{createRequire as oEe}from"module";import{basename as sEe,dirname as pP,normalize as aEe,relative as cEe,resolve as lEe,sep as sJ}from"path";import*as uEe from"fs";function dEe(t){let e=aEe(t);return e.length>1&&e[e.length-1]===sJ&&(e=e.substring(0,e.length-1)),e}function aJ(t,e){return t.replace(fEe,e)}function mEe(t){return t==="/"||pEe.test(t)}function fP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=lEe(t)),(n||o)&&(t=dEe(t)),t===".")return"";let s=t[t.length-1]!==i;return aJ(s?t+i:t,i)}function cJ(t,e){return e+t}function hEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:aJ(cEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function gEe(t){return t}function yEe(t,e,r){return e+t+r}function _Ee(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?hEe(t,e):n?cJ:gEe}function bEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function vEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function $Ee(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?vEe(t):bEe(t):n&&n.length?wEe:SEe:xEe}function REe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?OEe:r&&r.length?n?kEe:EEe:n?AEe:TEe}function CEe(t){return t.group?PEe:IEe}function jEe(t){return t.group?DEe:NEe}function LEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?FEe:MEe}function lJ(t,e,r){if(r.options.useRealPaths)return zEe(e,r);let n=pP(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=pP(n)}return r.symlinks.set(t,e),i>1}function zEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function xv(t,e,r,n){e(t&&!n?t:null,r)}function KEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?UEe:GEe:n?e?qEe:WEe:i?e?HEe:VEe:e?BEe:ZEe}function XEe(t){return t?YEe:JEe}function rAe(t,e){return new Promise((r,n)=>{fJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function fJ(t,e,r){new dJ(t,e,r).start()}function nAe(t,e){return new dJ(t,e).start()}var iJ,fEe,pEe,SEe,wEe,xEe,kEe,EEe,AEe,TEe,OEe,IEe,PEe,DEe,NEe,MEe,FEe,UEe,qEe,BEe,HEe,GEe,ZEe,VEe,WEe,uJ,JEe,YEe,QEe,eAe,tAe,dJ,oJ,pJ,mJ,hJ=y(()=>{iJ=oEe(import.meta.url);fEe=/[\\/]/g;pEe=/^[a-z]:[\\/]$/i;SEe=(t,e)=>{e.push(t||".")},wEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},xEe=()=>{};kEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},EEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},AEe=(t,e,r,n)=>{r.files++},TEe=(t,e)=>{e.push(t)},OEe=()=>{};IEe=t=>t,PEe=()=>[""].slice(0,0);DEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},NEe=()=>{};MEe=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()&&lJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},FEe=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()&&lJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};UEe=t=>t.counts,qEe=t=>t.groups,BEe=t=>t.paths,HEe=t=>t.paths.slice(0,t.options.maxFiles),GEe=(t,e,r)=>(xv(e,r,t.counts,t.options.suppressErrors),null),ZEe=(t,e,r)=>(xv(e,r,t.paths,t.options.suppressErrors),null),VEe=(t,e,r)=>(xv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),WEe=(t,e,r)=>(xv(e,r,t.groups,t.options.suppressErrors),null);uJ={withFileTypes:!0},JEe=(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||".",uJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},YEe=(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||".",uJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};QEe=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))}},eAe=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}},tAe=class{aborted=!1;abort(){this.aborted=!0}},dJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=KEe(e,this.isSynchronous),this.root=fP(t,e),this.state={root:mEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new eAe,options:e,queue:new QEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new tAe,fs:e.fs||uEe},this.joinPath=_Ee(this.root,e),this.pushDirectory=$Ee(this.root,e),this.pushFile=REe(e),this.getArray=CEe(e),this.groupFiles=jEe(e),this.resolveSymlink=LEe(e,this.isSynchronous),this.walkDirectory=XEe(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(_=fP(_,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=sEe(_),x=fP(pP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};oJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return rAe(this.root,this.options)}withCallback(t){fJ(this.root,this.options,t)}sync(){return nAe(this.root,this.options)}},pJ=null;try{iJ.resolve("picomatch"),pJ=iJ("picomatch")}catch{}mJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:sJ,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 oJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new oJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||pJ;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 np=v((tut,vJ)=>{"use strict";var gJ="[^\\\\/]",iAe="(?=.)",yJ="[^/]",mP="(?:\\/|$)",_J="(?:^|\\/)",hP=`\\.{1,2}${mP}`,oAe="(?!\\.)",sAe=`(?!${_J}${hP})`,aAe=`(?!\\.{0,1}${mP})`,cAe=`(?!${hP})`,lAe="[^.\\/]",uAe=`${yJ}*?`,dAe="/",bJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:iAe,QMARK:yJ,END_ANCHOR:mP,DOTS_SLASH:hP,NO_DOT:oAe,NO_DOTS:sAe,NO_DOT_SLASH:aAe,NO_DOTS_SLASH:cAe,QMARK_NO_DOT:lAe,STAR:uAe,START_ANCHOR:_J,SEP:dAe},fAe={...bJ,SLASH_LITERAL:"[\\\\/]",QMARK:gJ,STAR:`${gJ}*?`,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:"\\"},pAe={__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"};vJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:pAe,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?fAe:bJ}}});var ip=v(Fr=>{"use strict";var{REGEX_BACKSLASH:mAe,REGEX_REMOVE_BACKSLASH:hAe,REGEX_SPECIAL_CHARS:gAe,REGEX_SPECIAL_CHARS_GLOBAL:yAe}=np();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>gAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(yAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(mAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(hAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var TJ=v((nut,AJ)=>{"use strict";var SJ=ip(),{CHAR_ASTERISK:gP,CHAR_AT:_Ae,CHAR_BACKWARD_SLASH:op,CHAR_COMMA:bAe,CHAR_DOT:yP,CHAR_EXCLAMATION_MARK:_P,CHAR_FORWARD_SLASH:EJ,CHAR_LEFT_CURLY_BRACE:bP,CHAR_LEFT_PARENTHESES:vP,CHAR_LEFT_SQUARE_BRACKET:vAe,CHAR_PLUS:SAe,CHAR_QUESTION_MARK:wJ,CHAR_RIGHT_CURLY_BRACE:wAe,CHAR_RIGHT_PARENTHESES:xJ,CHAR_RIGHT_SQUARE_BRACKET:xAe}=np(),$J=t=>t===EJ||t===op,kJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},$Ae=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},E=()=>l>=n,q=()=>c.charCodeAt(l+1),Q=()=>(T=A,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),Se&&m===!0&&d>0?(Se=c.slice(0,d),C=c.slice(d)):m===!0?(Se="",C=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&$J(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),r.unescape===!0&&(C&&(C=SJ.removeBackslashes(C)),Se&&_===!0&&(Se=SJ.removeBackslashes(Se)));let Ir={prefix:P,input:t,start:u,base:Se,glob:C,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,$J(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var sp=np(),sn=ip(),{MAX_LENGTH:$v,POSIX_REGEX_SOURCE:kAe,REGEX_NON_SPECIAL_CHARS:EAe,REGEX_SPECIAL_CHARS_BACKREF:AAe,REPLACEMENTS:OJ}=sp,TAe=(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=>sn.escapeRegex(i)).join("..")}return r},Il=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,RJ=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},OAe=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},IJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(OAe(e))return e.replace(/\\(.)/g,"$1")},RAe=t=>{let e=t.map(IJ).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}}}}},IAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=IJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},PAe=t=>{let e=0,r=t.trim(),n=SP(r);for(;n;)e++,r=n.body.trim(),n=SP(r);return e},CAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:sp.DEFAULT_MAX_EXTGLOB_RECURSION,n=RJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||RAe(n)))return{risky:!0};for(let i of n){let o=IAe(i);if(o)return{risky:!0,safeOutput:o};if(PAe(i)>r)return{risky:!0}}return{risky:!1}},wP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=OJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min($v,r.maxLength):$v,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=sp.globChars(r.windows),l=sp.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,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(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=sn.removePrefix(t,E),i=t.length;let q=[],Q=[],Se=[],P=o,C,Ir=()=>E.index===i-1,se=E.peek=(H=1)=>t[E.index+H],Pe=E.advance=()=>t[++E.index]||"",Kt=()=>t.slice(E.index+1),dr=(H="",pt=0)=>{E.consumed+=H,E.index+=pt},Yt=H=>{E.output+=H.output!=null?H.output:H.value,dr(H.value)},oo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),E.start++,H++;return H%2===0?!1:(E.negated=!0,E.start++,!0)},Si=H=>{E[H]++,Se.push(H)},Yr=H=>{E[H]--,Se.pop()},de=H=>{if(P.type==="globstar"){let pt=E.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||q.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!pt&&!B&&(E.output=E.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=D,E.output+=P.output)}if(q.length&&H.type!=="paren"&&(q[q.length-1].inner+=H.value),(H.value||H.output)&&Yt(H),P&&P.type==="text"&&H.type==="text"){P.output=(P.output||P.value)+H.value,P.value+=H.value;return}H.prev=P,s.push(H),P=H},so=(H,pt)=>{let B={...l[pt],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;Si("parens"),de({type:H,value:pt,output:E.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Te}),q.push(B)},fde=H=>{let pt=t.slice(H.startIndex,E.index+1),B=t.slice(H.startIndex+2,E.index),Te=CAe(B,r);if((H.type==="plus"||H.type==="star")&&Te.risky){let ct=Te.safeOutput?(H.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,wi=s[H.tokensIndex];wi.type="text",wi.value=pt,wi.output=ct||sn.escapeRegex(pt);for(let xi=H.tokensIndex+1;xi1&&H.inner.includes("/")&&(ct=O(r)),(ct!==D||Ir()||/^\)+$/.test(Kt()))&&(lt=H.close=`)$))${ct}`),H.inner.includes("*")&&(Ft=Kt())&&/^\.[^\\/.]+$/.test(Ft)){let wi=wP(Ft,{...e,fastpaths:!1}).output;lt=H.close=`)${wi})${ct})`}H.prev.type==="bos"&&(E.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:C,output:lt}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,pt=t.replace(AAe,(B,Te,lt,Ft,ct,wi)=>Ft==="\\"?(H=!0,B):Ft==="?"?Te?Te+Ft+(ct?_.repeat(ct.length):""):wi===0?A+(ct?_.repeat(ct.length):""):_.repeat(lt.length):Ft==="."?u.repeat(lt.length):Ft==="*"?Te?Te+Ft+(ct?D:""):D:Te?B:`\\${B}`);return H===!0&&(r.unescape===!0?pt=pt.replace(/\\/g,""):pt=pt.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),pt===t&&r.contains===!0?(E.output=t,E):(E.output=sn.wrapOutput(pt,E,e),E)}for(;!Ir();){if(C=Pe(),C==="\0")continue;if(C==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){C+="\\",de({type:"text",value:C});continue}let Te=/^\\+/.exec(Kt()),lt=0;if(Te&&Te[0].length>2&&(lt=Te[0].length,E.index+=lt,lt%2!==0&&(C+="\\")),r.unescape===!0?C=Pe():C+=Pe(),E.brackets===0){de({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("["),lt=P.value.slice(0,Te),Ft=P.value.slice(Te+2),ct=kAe[Ft];if(ct){P.value=lt+ct,E.backtrack=!0,Pe(),!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,Yt({value:C});continue}if(E.quotes===1&&C!=='"'){C=sn.escapeRegex(C),P.value+=C,Yt({value:C});continue}if(C==='"'){E.quotes=E.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:C});continue}if(C==="("){Si("parens"),de({type:"paren",value:C});continue}if(C===")"){if(E.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Il("opening","("));let B=q[q.length-1];if(B&&E.parens===B.parens+1){fde(q.pop());continue}de({type:"paren",value:C,output:E.parens?")":"\\)"}),Yr("parens");continue}if(C==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Il("closing","]"));C=`\\${C}`}else Si("brackets");de({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){de({type:"text",value:C,output:`\\${C}`});continue}if(E.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Il("opening","["));de({type:"text",value:C,output:`\\${C}`});continue}Yr("brackets");let B=P.value.slice(1);if(P.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(C=`/${C}`),P.value+=C,Yt({value:C}),r.literalBrackets===!1||sn.hasRegexChars(B))continue;let Te=sn.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){Si("braces");let B={type:"brace",value:C,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};Q.push(B),de(B);continue}if(C==="}"){let B=Q[Q.length-1];if(r.nobrace===!0||!B){de({type:"text",value:C,output:C});continue}let Te=")";if(B.dots===!0){let lt=s.slice(),Ft=[];for(let ct=lt.length-1;ct>=0&&(s.pop(),lt[ct].type!=="brace");ct--)lt[ct].type!=="dots"&&Ft.unshift(lt[ct].value);Te=TAe(Ft,r),E.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let lt=E.output.slice(0,B.outputIndex),Ft=E.tokens.slice(B.tokensIndex);B.value=B.output="\\{",C=Te="\\}",E.output=lt;for(let ct of Ft)E.output+=ct.output||ct.value}de({type:"brace",value:C,output:Te}),Yr("braces"),Q.pop();continue}if(C==="|"){q.length>0&&q[q.length-1].conditions++,de({type:"text",value:C});continue}if(C===","){let B=C,Te=Q[Q.length-1];Te&&Se[Se.length-1]==="braces"&&(Te.comma=!0,B="|"),de({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}de({type:"slash",value:C,output:f});continue}if(C==="."){if(E.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let B=Q[Q.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"){de({type:"text",value:C,output:u});continue}de({type:"dot",value:C,output:u});continue}if(C==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){so("qmark",C);continue}if(P&&P.type==="paren"){let Te=se(),lt=C;(P.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(lt=`\\${C}`),de({type:"text",value:C,output:lt});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){de({type:"qmark",value:C,output:S});continue}de({type:"qmark",value:C,output:_});continue}if(C==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){so("negate",C);continue}if(r.nonegate!==!0&&E.index===0){oo();continue}}if(C==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){so("plus",C);continue}if(P&&P.value==="("||r.regex===!1){de({type:"plus",value:C,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||E.parens>0){de({type:"plus",value:C});continue}de({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:C,output:""});continue}de({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let B=EAe.exec(Kt());B&&(C+=B[0],E.index+=B[0].length),de({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,dr(C);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){so("star",C);continue}if(P.type==="star"){if(r.noglobstar===!0){dr(C);continue}let B=P.prev,Te=B.prev,lt=B.type==="slash"||B.type==="bos",Ft=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!lt||H[0]&&H[0]!=="/")){de({type:"star",value:C,output:""});continue}let ct=E.braces>0&&(B.type==="comma"||B.type==="brace"),wi=q.length&&(B.type==="pipe"||B.type==="paren");if(!lt&&B.type!=="paren"&&!ct&&!wi){de({type:"star",value:C,output:""});continue}for(;H.slice(0,3)==="/**";){let xi=t[E.index+4];if(xi&&xi!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Ir()){P.type="globstar",P.value+=C,P.output=O(r),E.output=P.output,E.globstar=!0,dr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!Ft&&Ir()){E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=O(r)+(r.strictSlashes?")":"|$)"),P.value+=C,E.globstar=!0,E.output+=B.output+P.output,dr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let xi=H[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=`${O(r)}${f}|${f}${xi})`,P.value+=C,E.output+=B.output+P.output,E.globstar=!0,dr(C+Pe()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){P.type="globstar",P.value+=C,P.output=`(?:^|${f}|${O(r)}${f})`,E.output=P.output,E.globstar=!0,dr(C+Pe()),de({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-P.output.length),P.type="globstar",P.output=O(r),P.value+=C,E.output+=P.output,E.globstar=!0,dr(C);continue}let pt={type:"star",value:C,output:D};if(r.bash===!0){pt.output=".*?",(P.type==="bos"||P.type==="slash")&&(pt.output=T+pt.output),de(pt);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){pt.output=C,de(pt);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+=T,P.output+=T),se()!=="*"&&(E.output+=p,P.output+=p)),de(pt)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Il("closing","]"));E.output=sn.escapeLast(E.output,"["),Yr("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Il("closing",")"));E.output=sn.escapeLast(E.output,"("),Yr("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Il("closing","}"));E.output=sn.escapeLast(E.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),E.backtrack===!0){E.output="";for(let H of E.tokens)E.output+=H.output!=null?H.output:H.value,H.suffix&&(E.output+=H.suffix)}return E};wP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min($v,r.maxLength):$v,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=OJ[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}=sp.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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};PJ.exports=wP});var jJ=v((out,NJ)=>{"use strict";var DAe=TJ(),xP=CJ(),DJ=ip(),NAe=np(),jAe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=jAe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?DJ.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(DJ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):xP(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>DAe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=xP.fastpaths(t,e)),i.output||(i=xP(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=NAe;NJ.exports=Tt});var zJ=v((sut,LJ)=>{"use strict";var MJ=jJ(),MAe=ip();function FJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:MAe.isWindows()}),MJ(t,e,r)}Object.assign(FJ,MJ);LJ.exports=FJ});import{readdir as FAe,readdirSync as LAe,realpath as zAe,realpathSync as UAe,stat as qAe,statSync as BAe}from"fs";import{isAbsolute as HAe,posix as za,resolve as GAe}from"path";import{fileURLToPath as ZAe}from"url";function KAe(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]===".."&&WAe.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=>za.relative(t,n)||".":n=>za.relative(t,`${e}/${n}`)||"."}function XAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=za.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function HJ(t){var e;let r=Pl.default.scan(t,QAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function oTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Pl.default.scan(t);return r.isGlob||r.negated}function ap(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function GJ(t){return typeof t=="string"?[t]:t??[]}function $P(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=iTe(o);s=HAe(s.replace(aTe,""))?za.relative(a,s):za.normalize(s);let c=(i=sTe.exec(s))===null||i===void 0?void 0:i[0],l=HJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?za.join(o,...d):o}return s}function cTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push($P(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push($P(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push($P(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function lTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=cTe(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(qJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Pl.default)(i.match,f),m=(0,Pl.default)(i.ignore,f),h=KAe(i.match,f),g=UJ(r,d,o),b=o?g:UJ(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new mJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&ap(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return ap(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&XAe(r,d)]}function uTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function fTe(t){let e={...dTe,...t};return e.cwd=(e.cwd instanceof URL?ZAe(e.cwd):GAe(e.cwd)).replace(qJ,"/"),e.ignore=GJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||FAe,readdirSync:e.fs.readdirSync||LAe,realpath:e.fs.realpath||zAe,realpathSync:e.fs.realpathSync||UAe,stat:e.fs.stat||qAe,statSync:e.fs.statSync||BAe}),e.debug&&ap("globbing with options:",e),e}function pTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=VAe(t)||typeof t=="string",i=GJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=fTe(n?e:t);return i.length>0?lTe(o,i):[]}function ps(t,e){let[r,n]=pTe(t,e);return r?uTe(r.sync(),n):[]}var Pl,VAe,qJ,BJ,WAe,JAe,YAe,QAe,eTe,tTe,rTe,nTe,iTe,sTe,aTe,dTe,cp=y(()=>{hJ();Pl=bt(zJ(),1),VAe=Array.isArray,qJ=/\\/g,BJ=process.platform==="win32",WAe=/^(\/?\.\.)+$/;JAe=/^[A-Z]:\/$/i,YAe=BJ?t=>JAe.test(t):t=>t==="/";QAe={parts:!0};eTe=/(?t.replace(eTe,"\\$&"),nTe=t=>t.replace(tTe,"\\$&"),iTe=BJ?nTe:rTe;sTe=/^(\/?\.\.)+/,aTe=/\\(?=[()[\]{}!*+?@|])/g;dTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as lp,readFileSync as mTe,readdirSync as hTe,statSync as ZJ}from"node:fs";import{join as Ua}from"node:path";function gTe(t){let{cwd:e="."}=t,r,n;try{let c=G(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Di(e,n),o=[],{layers:s,forbiddenImports:a}=kP(r);return(s.size>0||a.length>0)&&!lp(Ua(e,i.mainRoot))?[{detector:up,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&&(yTe(e,i,s,o),_Te(e,i,s,o)),a.length>0&&bTe(e,i,a,o),o)}function kP(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 yTe(t,e,r,n){let i=e.mainRoot,o=Ua(t,i);if(lp(o))for(let s of hTe(o)){let a=Ua(o,s);ZJ(a).isDirectory()&&(r.has(s)||n.push({detector:up,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function _Te(t,e,r,n){let i=e.mainRoot,o=Ua(t,i);if(lp(o))for(let s of r){let a=Ua(o,s);lp(a)&&ZJ(a).isDirectory()||n.push({detector:up,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 bTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ua(t,i,s.from);if(!lp(a))continue;let c=ps([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ua(a,l),d;try{d=mTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];vTe(p,s.to,e.importStyle)&&n.push({detector:up,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 vTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var up,VJ,EP=y(()=>{"use strict";cp();qe();La();up="ARCHITECTURE_FROM_SPEC";VJ={name:up,run:gTe}});import{existsSync as STe,readFileSync as wTe}from"node:fs";import{join as xTe}from"node:path";function $Te(t){let{cwd:e="."}=t,r=xTe(e,"spec/capabilities.yaml");if(!STe(r))return[];let n;try{let c=wTe(r,"utf8"),l=WJ.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=G(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:kv,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:kv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:kv,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var WJ,kv,KJ,JJ=y(()=>{"use strict";WJ=bt(Qt(),1);qe();kv="CAPABILITIES_FEATURE_MAPPING";KJ={name:kv,run:$Te}});import{existsSync as kTe,readFileSync as ETe}from"node:fs";import{join as ATe}from"node:path";function TTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function OTe(t){let{cwd:e="."}=t;return he(e,AP,r=>RTe(r,e))}function RTe(t,e){let r=Di(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=ATe(e,o);if(!kTe(s))continue;let a=ETe(s,"utf8");TTe(a)||n.push({detector:AP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var AP,YJ,XJ=y(()=>{"use strict";La();vt();AP="CONVENTION_DRIFT";YJ={name:AP,run:OTe}});import{existsSync as TP,readFileSync as QJ}from"node:fs";import{join as Ev}from"node:path";function ITe(t){return JSON.parse(t).total?.lines?.pct??0}function e8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function DTe(t,e){if(!cv(ut(t).gates.coverage?.cmd))return null;let r;try{r=lv(t,e)}catch(c){return[{detector:vo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=sP.find(d=>TP(Ev(c.dir,d)));if(!l){s.push(c.path);continue}let u=e8(QJ(Ev(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:vo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=t8(n,i);return a0?[{detector:vo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function NTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=DTe(e,t.focusModules);if(a)return a}let r;try{r=G(e).project?.language}catch{}let n=Di(e,r),i=ut(e).language==="kotlin"?sP.find(a=>TP(Ev(e,a)))??MK(e):n.coverageSummary,o=Ev(e,i);if(!TP(o))return[{detector:vo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=QJ(o,"utf8");s=n.coverageFormat==="jacoco-xml"?PTe(a):n.coverageFormat==="cobertura-xml"?CTe(a):ITe(a)}catch(a){return[{detector:vo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:vo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Av?[]:[{detector:vo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Av}%`}]}var vo,Av,r8,n8=y(()=>{"use strict";qe();pv();La();uv();on();vo="COVERAGE_DROP",Av=70;r8={name:vo,run:NTe}});import{existsSync as jTe}from"node:fs";import{join as MTe}from"node:path";function FTe(t){let{cwd:e="."}=t;return he(e,Tv,r=>LTe(r,e))}function LTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?jTe(MTe(e,r.path))?[]:[{detector:Tv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:Tv,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var Tv,i8,o8=y(()=>{"use strict";vt();Tv="DELIVERABLE_INTEGRITY";i8={name:Tv,run:FTe}});function zTe(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:Ov,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 UTe(t){let e=zTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Ov,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 qTe(t){let{cwd:e="."}=t;return he(e,Ov,r=>UTe(r))}var Ov,s8,a8=y(()=>{"use strict";vt();Ov="SMOKE_PROBE_DEMAND";s8={name:Ov,run:qTe}});function BTe(t){let{cwd:e="."}=t;return he(e,Rv,r=>HTe(r,e))}function HTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=is(e);if(n===null)return[{detector:Rv,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=T_(n,e,o);s.state!=="fresh"&&i.push({detector:Rv,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 Rv,Iv,OP=y(()=>{"use strict";cl();vt();Rv="STALE_ATTESTATION";Iv={name:Rv,run:BTe}});function GTe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}return ZTe(r)}function ZTe(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:c8,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 c8,Pv,RP=y(()=>{"use strict";qe();c8="DEPENDENCY_CYCLE";Pv={name:c8,run:GTe}});import{appendFileSync as VTe,existsSync as l8,mkdirSync as WTe,readFileSync as KTe}from"node:fs";import{dirname as JTe,join as YTe}from"node:path";function u8(t){return YTe(t,XTe,QTe)}function d8(t){return IP.add(t),()=>IP.delete(t)}function qa(t,e){let r=u8(t),n=JTe(r);l8(n)||WTe(n,{recursive:!0}),VTe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of IP)try{i(t,e)}catch{}}function On(t){let e=u8(t);if(!l8(e))return[];let r=KTe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var XTe,QTe,IP,ti=y(()=>{"use strict";XTe=".cladding",QTe="audit.log.jsonl";IP=new Set});import{existsSync as eOe}from"node:fs";import{join as tOe}from"node:path";function rOe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:PP,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&&(eOe(tOe(e,i.artifact))||n.push({detector:PP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var PP,f8,p8=y(()=>{"use strict";ti();PP="EVIDENCE_MISMATCH";f8={name:PP,run:rOe}});import{existsSync as nOe,readFileSync as iOe}from"node:fs";import{join as oOe}from"node:path";function sOe(t){let e=oOe(t,y8);if(!nOe(e))return null;try{let n=((0,g8.parse)(iOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*h8(t,e){for(let r of t??[])r.startsWith(m8)&&(yield{ref:r,name:r.slice(m8.length),field:e})}function aOe(t){let{cwd:e="."}=t,r=sOe(e);if(r===null)return[];let n;try{n=G(e)}catch(o){return[{detector:CP,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=[...h8(s.evidence_refs,"evidence_refs"),...h8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:CP,severity:"warn",path:y8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var g8,CP,m8,y8,_8,b8=y(()=>{"use strict";g8=bt(Qt(),1);qe();CP="FIXTURE_REFERENCE_INVALID",m8="fixture:",y8="conformance/fixtures.yaml";_8={name:CP,run:aOe}});import{existsSync as Cl,readFileSync as DP}from"node:fs";import{join as Ba}from"node:path";function cOe(t){return ps(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function dp(t){if(!Cl(t))return null;try{return JSON.parse(DP(t,"utf8"))}catch{return null}}function lOe(t,e){let r=Ba(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(DP(r,"utf8"))}catch(c){e.push({detector:So,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:So,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=cOe(t);s!==a&&e.push({detector:So,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function uOe(t,e){for(let r of v8){let n=Ba(t,r.path);if(!Cl(n))continue;let i=dp(n);if(!i){e.push({detector:So,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:So,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function dOe(t,e){let r=dp(Ba(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of v8){let s=Ba(t,o.path);if(!Cl(s))continue;let a=dp(s);a?.version&&a.version!==n&&e.push({detector:So,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ba(t,".claude-plugin","marketplace.json");if(Cl(i)){let o=dp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:So,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 fOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function pOe(t,e){let r=Ba(t,"src","cli","clad.ts"),n=Ba(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Cl(r)||!Cl(n))return;let i=fOe(DP(r,"utf8"));if(i.length===0)return;let s=dp(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:So,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 mOe(t){let{cwd:e="."}=t,r=[];return lOe(e,r),pOe(e,r),uOe(e,r),dOe(e,r),r}var So,v8,S8,w8=y(()=>{"use strict";cp();So="HARNESS_INTEGRITY",v8=[{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"]}];S8={name:So,run:mOe}});import{existsSync as hOe,readFileSync as gOe}from"node:fs";import{join as yOe}from"node:path";function bOe(t){let{cwd:e="."}=t;return he(e,Cv,r=>SOe(r,e))}function vOe(t){let e=yOe(t,"spec/capabilities.yaml");if(!hOe(e))return!1;try{let r=x8.default.parse(gOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function SOe(t,e){let r=t.features.length;if(r<_Oe)return[];let n=[];return vOe(e)&&n.push({detector:Cv,severity:"warn",path:"spec/capabilities.yaml",message:`${r} features but spec/capabilities.yaml declares no capabilities (capabilities: []) \u2014 the design SSoT is an empty seed. Populate it (capability \u2194 feature links) or run \`clad init --scan\`.`}),t.architecture&&(t.architecture.layers??[]).length===0&&n.push({detector:Cv,severity:"warn",path:"spec/architecture.yaml",message:`${r} features but spec/architecture.yaml declares no layers (layers: []) \u2014 the architecture SSoT is an empty seed. Populate it or run \`clad init --scan\`.`}),n}var x8,Cv,_Oe,$8,k8=y(()=>{"use strict";x8=bt(Qt(),1);vt();Cv="HOLLOW_GOVERNANCE",_Oe=8;$8={name:Cv,run:bOe}});import{existsSync as E8,readFileSync as A8}from"node:fs";import{join as T8}from"node:path";function O8(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 $Oe(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 kOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function EOe(t){let e=T8(t,"README.md"),r=T8(t,"docs","dogfood","matrix.md");if(!E8(e)||!E8(r))return[];let n=O8(A8(e,"utf8"),wOe),i=O8(A8(r,"utf8"),xOe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=kOe(a);if(c===null)continue;let l=i[s]??"not-run",u=$Oe(l);u!==null&&c>u&&o.push({detector:R8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function AOe(t){let{cwd:e="."}=t;return EOe(e)}var R8,wOe,xOe,I8,P8=y(()=>{"use strict";R8="HOST_CLAIM_DRIFT",wOe=//,xOe=//;I8={name:R8,run:AOe}});function TOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return C8(r.features.map(i=>i.id),"feature","spec/features/",n),C8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function C8(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:D8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var D8,N8,j8=y(()=>{"use strict";qe();D8="ID_COLLISION";N8={name:D8,run:TOe}});import{existsSync as fp,readFileSync as NP,readdirSync as jP,statSync as OOe,writeFileSync as F8}from"node:fs";import{join as wo}from"node:path";function M8(t){if(!fp(t))return 0;try{return jP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function ROe(t){if(!fp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=jP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=wo(n,o),a;try{a=OOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function IOe(t){let e=wo(t,"spec","capabilities.yaml");if(!fp(e))return 0;try{let r=Dv.default.parse(NP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ms(t="."){let e=M8(wo(t,"spec","features")),r=M8(wo(t,"spec","scenarios")),n=IOe(t),i=ROe(wo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Dl(t,e){let r=wo(t,"spec.yaml");if(!fp(r))return;let n=NP(r,"utf8"),i=POe(n,e);i!==n&&F8(r,i)}function POe(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 @@ -269,51 +269,51 @@ ${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 Ba(t="."){let e=wo(t,"spec","features");if(!fp(e))return!1;let r=[];for(let i of jP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Cv.parse)(NP(wo(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 Ha(t="."){let e=wo(t,"spec","features");if(!fp(e))return!1;let r=[];for(let i of jP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Dv.parse)(NP(wo(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 j8(wo(t,"spec","index.yaml"),n,"utf8"),!0}var Cv,pp=y(()=>{"use strict";Cv=bt(Qt(),1)});import{existsSync as M8,readFileSync as F8,readdirSync as TOe}from"node:fs";import{join as MP}from"node:path";function OOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=ms(e),i=r.inventory;if(!i){let s=L8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return FP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...FP(e),{detector:mp,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 L8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:mp,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(...FP(e)),o}function FP(t){let e=MP(t,"spec","index.yaml"),r=MP(t,"spec","features");if(!M8(e)||!M8(r))return[];let n=new Map;try{for(let l of F8(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 TOe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=F8(MP(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:mp,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:mp,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 mp,L8,z8,U8=y(()=>{"use strict";pp();qe();mp="INVENTORY_DRIFT",L8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];z8={name:mp,run:OOe}});import{existsSync as ROe,readFileSync as IOe}from"node:fs";import{join as POe}from"node:path";function DOe(t){let{cwd:e="."}=t,r=POe(e,"src","spec","schema.json"),n=[];if(ROe(r)){let i;try{i=JSON.parse(IOe(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 COe)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=G(e);i.schema!==q8&&n.push({detector:hp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${q8}'`})}catch{}return n}var hp,COe,q8,B8,H8=y(()=>{"use strict";qe();hp="META_INTEGRITY",COe=["schema","project","features"],q8="0.1";B8={name:hp,run:DOe}});function NOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return G8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),G8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function G8(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:Z8,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 Z8,V8,W8=y(()=>{"use strict";qe();Z8="SLUG_CONFLICT";V8={name:Z8,run:NOe}});function jl(t){return t==="planned"||t==="in_progress"}var Dv=y(()=>{"use strict"});import{existsSync as jOe}from"node:fs";import{join as MOe}from"node:path";function FOe(t){let{cwd:e="."}=t;return he(e,Nv,r=>LOe(r,e))}function LOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=MOe(e,i);jOe(o)||r.push(zOe(n.id,i,n.status))}return r}function zOe(t,e,r){return jl(r)?{detector:Nv,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:Nv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Nv,jv,LP=y(()=>{"use strict";Dv();vt();Nv="MISSING_IMPLEMENTATION";jv={name:Nv,run:FOe}});function UOe(t){let{cwd:e="."}=t;return he(e,zP,qOe)}function qOe(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:zP,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 zP,Mv,UP=y(()=>{"use strict";vt();zP="MISSING_TESTS";Mv={name:zP,run:UOe}});import{existsSync as BOe,readFileSync as HOe}from"node:fs";import{join as K8}from"node:path";function J8(t){if(BOe(t))try{return JSON.parse(HOe(t,"utf8"))}catch{return}}function WOe(t){let{cwd:e="."}=t,r=J8(K8(e,GOe)),n=J8(K8(e,ZOe));if(!r||!n)return[{detector:qP,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>VOe&&i.push({detector:qP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var qP,GOe,ZOe,VOe,Y8,X8=y(()=>{"use strict";qP="PERFORMANCE_DRIFT",GOe="perf/baseline.json",ZOe="perf/current.json",VOe=10;Y8={name:qP,run:WOe}});import{existsSync as KOe}from"node:fs";import{join as JOe}from"node:path";function XOe(t){let{cwd:e="."}=t;return he(e,BP,r=>eRe(r,e))}function QOe(t,e){return(t.modules??[]).some(r=>KOe(JOe(e,r)))}function eRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||QOe(s,e)||r.push(s.id);let n=YOe;if(r.length<=n)return[];let i=r.slice(0,Q8).join(", "),o=r.length>Q8?", \u2026":"";return[{detector:BP,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 BP,YOe,Q8,e5,t5=y(()=>{"use strict";vt();BP="PLANNED_BACKLOG",YOe=5,Q8=8;e5={name:BP,run:XOe}});import{existsSync as tRe,readFileSync as rRe}from"node:fs";import{join as nRe}from"node:path";function sRe(t){let{cwd:e="."}=t;return he(e,HP,r=>aRe(r,e))}function aRe(t,e){if(t.features.lengthn.includes(i))?[{detector:HP,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 HP,iRe,oRe,r5,n5=y(()=>{"use strict";vt();HP="PROJECT_CONTEXT_DRIFT",iRe=8,oRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];r5={name:HP,run:sRe}});function i5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Fv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function cRe(t){let{cwd:e="."}=t;return he(e,Fv,lRe)}function lRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...i5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Fv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...i5(e,n.features,`scenario ${n.id}.features`));return r}var Fv,Lv,GP=y(()=>{"use strict";vt();Fv="REFERENCE_INTEGRITY";Lv={name:Fv,run:cRe}});function gp(t=""){return new RegExp(uRe,t)}var uRe,ZP=y(()=>{"use strict";uRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as dRe,readdirSync as fRe,readFileSync as pRe,statSync as mRe,writeFileSync as hRe}from"node:fs";import{dirname as gRe,join as yp,normalize as yRe,relative as _Re}from"node:path";function xRe(t){let e=[];for(let r of t.matchAll(wRe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(gp("g"))??[])e.push(n);return[...new Set(e)].sort()}function $Re(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function o5(t){return t.split("\\").join("/")}function kRe(t){return bRe.some(e=>t===e||t.startsWith(`${e}/`))}function ERe(t){let e=yp(t,"docs");if(!dRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=fRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=yp(i,s),c;try{c=mRe(a)}catch{continue}let l=o5(_Re(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function ARe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=yRe(yp(gRe(t),e));return o5(r)}function _p(t="."){let e=[];for(let r of ERe(t)){let n;try{n=pRe(yp(t,r),"utf8")}catch{continue}let i=$Re(n),o=xRe(i);if(kRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(vRe)?[]:i.match(gp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(SRe)){let d=ARe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function s5(t="."){let e=_p(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 hRe(yp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return F8(wo(t,"spec","index.yaml"),n,"utf8"),!0}var Dv,pp=y(()=>{"use strict";Dv=bt(Qt(),1)});import{existsSync as L8,readFileSync as z8,readdirSync as COe}from"node:fs";import{join as MP}from"node:path";function DOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=ms(e),i=r.inventory;if(!i){let s=U8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return FP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...FP(e),{detector:mp,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 U8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:mp,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(...FP(e)),o}function FP(t){let e=MP(t,"spec","index.yaml"),r=MP(t,"spec","features");if(!L8(e)||!L8(r))return[];let n=new Map;try{for(let l of z8(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 COe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=z8(MP(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:mp,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:mp,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 mp,U8,q8,B8=y(()=>{"use strict";pp();qe();mp="INVENTORY_DRIFT",U8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];q8={name:mp,run:DOe}});import{existsSync as NOe,readFileSync as jOe}from"node:fs";import{join as MOe}from"node:path";function LOe(t){let{cwd:e="."}=t,r=MOe(e,"src","spec","schema.json"),n=[];if(NOe(r)){let i;try{i=JSON.parse(jOe(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 FOe)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=G(e);i.schema!==H8&&n.push({detector:hp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${H8}'`})}catch{}return n}var hp,FOe,H8,G8,Z8=y(()=>{"use strict";qe();hp="META_INTEGRITY",FOe=["schema","project","features"],H8="0.1";G8={name:hp,run:LOe}});function zOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return V8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),V8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function V8(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:W8,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 W8,K8,J8=y(()=>{"use strict";qe();W8="SLUG_CONFLICT";K8={name:W8,run:zOe}});function Nl(t){return t==="planned"||t==="in_progress"}var Nv=y(()=>{"use strict"});import{existsSync as UOe}from"node:fs";import{join as qOe}from"node:path";function BOe(t){let{cwd:e="."}=t;return he(e,jv,r=>HOe(r,e))}function HOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=qOe(e,i);UOe(o)||r.push(GOe(n.id,i,n.status))}return r}function GOe(t,e,r){return Nl(r)?{detector:jv,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:jv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var jv,Mv,LP=y(()=>{"use strict";Nv();vt();jv="MISSING_IMPLEMENTATION";Mv={name:jv,run:BOe}});function ZOe(t){let{cwd:e="."}=t;return he(e,zP,VOe)}function VOe(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:zP,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 zP,Fv,UP=y(()=>{"use strict";vt();zP="MISSING_TESTS";Fv={name:zP,run:ZOe}});import{existsSync as WOe,readFileSync as KOe}from"node:fs";import{join as Y8}from"node:path";function X8(t){if(WOe(t))try{return JSON.parse(KOe(t,"utf8"))}catch{return}}function QOe(t){let{cwd:e="."}=t,r=X8(Y8(e,JOe)),n=X8(Y8(e,YOe));if(!r||!n)return[{detector:qP,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>XOe&&i.push({detector:qP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var qP,JOe,YOe,XOe,Q8,e5=y(()=>{"use strict";qP="PERFORMANCE_DRIFT",JOe="perf/baseline.json",YOe="perf/current.json",XOe=10;Q8={name:qP,run:QOe}});import{existsSync as eRe}from"node:fs";import{join as tRe}from"node:path";function nRe(t){let{cwd:e="."}=t;return he(e,BP,r=>oRe(r,e))}function iRe(t,e){return(t.modules??[]).some(r=>eRe(tRe(e,r)))}function oRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||iRe(s,e)||r.push(s.id);let n=rRe;if(r.length<=n)return[];let i=r.slice(0,t5).join(", "),o=r.length>t5?", \u2026":"";return[{detector:BP,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 BP,rRe,t5,r5,n5=y(()=>{"use strict";vt();BP="PLANNED_BACKLOG",rRe=5,t5=8;r5={name:BP,run:nRe}});import{existsSync as sRe,readFileSync as aRe}from"node:fs";import{join as cRe}from"node:path";function dRe(t){let{cwd:e="."}=t;return he(e,HP,r=>fRe(r,e))}function fRe(t,e){if(t.features.lengthn.includes(i))?[{detector:HP,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 HP,lRe,uRe,i5,o5=y(()=>{"use strict";vt();HP="PROJECT_CONTEXT_DRIFT",lRe=8,uRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];i5={name:HP,run:dRe}});function s5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Lv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function pRe(t){let{cwd:e="."}=t;return he(e,Lv,mRe)}function mRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...s5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Lv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...s5(e,n.features,`scenario ${n.id}.features`));return r}var Lv,zv,GP=y(()=>{"use strict";vt();Lv="REFERENCE_INTEGRITY";zv={name:Lv,run:pRe}});function gp(t=""){return new RegExp(hRe,t)}var hRe,ZP=y(()=>{"use strict";hRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as gRe,readdirSync as yRe,readFileSync as _Re,statSync as bRe,writeFileSync as vRe}from"node:fs";import{dirname as SRe,join as yp,normalize as wRe,relative as xRe}from"node:path";function TRe(t){let e=[];for(let r of t.matchAll(ARe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(gp("g"))??[])e.push(n);return[...new Set(e)].sort()}function ORe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function a5(t){return t.split("\\").join("/")}function RRe(t){return $Re.some(e=>t===e||t.startsWith(`${e}/`))}function IRe(t){let e=yp(t,"docs");if(!gRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=yRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=yp(i,s),c;try{c=bRe(a)}catch{continue}let l=a5(xRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function PRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=wRe(yp(SRe(t),e));return a5(r)}function _p(t="."){let e=[];for(let r of IRe(t)){let n;try{n=_Re(yp(t,r),"utf8")}catch{continue}let i=ORe(n),o=TRe(i);if(RRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(kRe)?[]:i.match(gp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(ERe)){let d=PRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function c5(t="."){let e=_p(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 vRe(yp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var bRe,vRe,SRe,wRe,zv=y(()=>{"use strict";ZP();bRe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],vRe="clad-doc-links: ignore",SRe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,wRe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as TRe}from"node:fs";import{join as ORe}from"node:path";function RRe(t){let{cwd:e="."}=t;return he(e,Uv,r=>IRe(r,e))}function IRe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of _p(e).docs){for(let o of i.doc_links)TRe(ORe(e,o))||n.push({detector:Uv,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:Uv,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 Uv,qv,VP=y(()=>{"use strict";zv();vt();Uv="DOC_LINK_INTEGRITY";qv={name:Uv,run:RRe}});function CRe(t){let{cwd:e="."}=t;return he(e,bp,r=>DRe(r))}function DRe(t){let e=[],r=t.features.length,n=t.scenarios??[];r>=PRe&&n.length===0&&e.push({detector:bp,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 o of n)(o.features??[]).length===0&&e.push({detector:bp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let i=new Map(t.features.filter(o=>typeof o.slug=="string"&&o.slug.length>0).map(o=>[o.slug,o.id]));for(let o of n){if(!o.flow)continue;let s=new Set(o.features??[]),a=new Map;for(let c of o.flow.matchAll(/\(([^)]+)\)/g))for(let l of c[1].split(/[,/·]/)){let u=l.trim(),d=i.get(u);d&&!s.has(d)&&a.set(u,d)}if(a.size>0){let c=[...a].map(([l,u])=>`${l} (${u})`).join(", ");e.push({detector:bp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} flow references ${c} but features[] does not bind ${a.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var bp,PRe,a5,c5=y(()=>{"use strict";vt();bp="SCENARIO_COVERAGE",PRe=8;a5={name:bp,run:CRe}});import{createHash as NRe}from"node:crypto";function jRe(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??l5),sample:jRe(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(l5),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Sp(t){return(t.features??[]).filter(e=>e.status==="done").length}function MRe(t,e){return e<=0?!1:e>=1?!0:parseInt(NRe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var l5,Bv=y(()=>{"use strict";l5=["unwanted"]});import{existsSync as FRe,readdirSync as LRe}from"node:fs";import{join as d5}from"node:path";import f5 from"node:process";function zRe(t){let e=!1,r=n=>{for(let i of LRe(n,{withFileTypes:!0})){if(e)return;let o=d5(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 WP(t={}){let{cwd:e="."}=t,r=d5(e,hs);if(!FRe(r)||!zRe(r))return{stage:Hv,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${hs}/ \u2014 skipped`};let n=ut(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Hv,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o=Je(i.cmd,[...i.args,hs],{cwd:e,reject:!1}),s=Ut(Hv,i.cmd,o);return s||tr(Hv,o)}var Hv,hs,URe,KP=y(()=>{"use strict";Mr();on();Tn();Hv="stage_2.3",hs="tests/oracle";URe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${f5.argv[1]}`;if(URe){let t=WP();console.log(JSON.stringify(t)),f5.exit(t.exitCode)}});import{existsSync as qRe}from"node:fs";import{join as BRe}from"node:path";function HRe(t){let{cwd:e="."}=t;return he(e,ri,r=>GRe(r,e))}function GRe(t,e){let r=[],n=vp(t.project,Sp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?On(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:ri,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${hs}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!qRe(BRe(e,f))){r.push({detector:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${hs}/`)||r.push({detector:ri,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${hs}/ \u2014 stage_2.3 only runs ${hs}/, 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:ri,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:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ri,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:ri,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:ri,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:ri,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 ri,p5,m5=y(()=>{"use strict";ti();Bv();KP();vt();ri="SPEC_CONFORMANCE";p5={name:ri,run:HRe}});function ZRe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:JP,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>h5&&i.push({detector:JP,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${h5})`})}return i}var JP,h5,g5,y5=y(()=>{"use strict";ti();JP="STALE_EVIDENCE",h5=90;g5={name:JP,run:ZRe}});import{existsSync as _5}from"node:fs";import{join as b5}from"node:path";function VRe(t){let{cwd:e="."}=t;return he(e,Ml,r=>WRe(r,e))}function WRe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Ml,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:Ml,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=>_5(b5(e,o)));i.length>0&&r.push({detector:Ml,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}jl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>_5(b5(e,i)))&&r.push({detector:Ml,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 Ml,Gv,YP=y(()=>{"use strict";Dv();vt();Ml="STALE_SPECIFICATION";Gv={name:Ml,run:VRe}});import{existsSync as v5,statSync as S5}from"node:fs";import{join as w5}from"node:path";function JRe(t,e){let r=0;for(let n of e){let i=w5(t,n);if(!v5(i))continue;let o=S5(i).mtimeMs;o>r&&(r=o)}return r}function YRe(t){let{cwd:e="."}=t;return he(e,XP,r=>XRe(r,e))}function XRe(t,e){let r=Ci(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=JRe(e,n);if(i===0)return[];let o=ps([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=w5(e,a);if(!v5(c))continue;let l=S5(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>KRe&&s.push({detector:XP,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var XP,KRe,Zv,QP=y(()=>{"use strict";cp();Fa();vt();XP="STALE_TESTS",KRe=30;Zv={name:XP,run:YRe}});import{existsSync as QRe}from"node:fs";import{join as eIe}from"node:path";function tIe(t){let{cwd:e="."}=t;return he(e,xp,r=>rIe(r,e))}function rIe(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:xp,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=>!QRe(eIe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:xp,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:xp,severity:jl(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 xp,Vv,eC=y(()=>{"use strict";Dv();vt();xp="STATUS_DRIFT";Vv={name:xp,run:tIe}});function nIe(t){let{cwd:e="."}=t;return he(e,Wv,r=>iIe(r,e))}function iIe(t,e){let r=ut(e).language;return r==="unknown"?[{detector:Wv,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:Wv,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var Wv,x5,$5=y(()=>{"use strict";on();vt();Wv="TECH_STACK_MISMATCH";x5={name:Wv,run:nIe}});function cIe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function lIe(t){let{cwd:e="."}=t;return he(e,tC,r=>uIe(r,e))}function uIe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=ps([...cIe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:tC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var tC,k5,oIe,sIe,aIe,Kv,rC=y(()=>{"use strict";cp();EP();vt();tC="UNMAPPED_ARTIFACT",k5=["src/stages/**/*.ts","src/spec/**/*.ts"],oIe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},sIe={kotlin:"src/main/kotlin"},aIe=8;Kv={name:tC,run:lIe}});import{existsSync as E5}from"node:fs";import{join as A5}from"node:path";function fIe(t){return dIe.some(e=>t.startsWith(e))}function pIe(t){let{cwd:e="."}=t;return he(e,nC,r=>mIe(r,e))}function mIe(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(fIe(o))continue;let s=o.split("#",1)[0];E5(A5(e,o))||s&&E5(A5(e,s))||r.push({detector:nC,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 Tee(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?`[[${$ee(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(kee);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(kee);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}/${$ee(s)}.md`,`${a.join(` +`)}`)}return o}function kee(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as Y2e}from"node:fs";import{dirname as X2e,join as nj}from"node:path";import{fileURLToPath as Q2e}from"node:url";var ij=X2e(Q2e(import.meta.url));function Oee(t){for(let e of[nj(ij,"viewer",t),nj(ij,"..","graph","viewer",t),nj(ij,"..","..","dist","viewer",t)])try{return Y2e(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function Ree(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -876,20 +876,20 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify
${n} -`}RP();VP();LP();UP();GP();OP();QP();eC();rC();iC();Fm();ZP();qe();var K2e=[Mv,Jv,jv,Kv,Lv,qv,Iv,Vv,Zv,Rv];function J2e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=gp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function xx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{va(e,G(e))}catch{}try{for(let o of K2e){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 J2e(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{va(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}sj();qe();Ai();var X2e=new Set(["mermaid","dot","json","obsidian","html"]);function Oee(t={}){try{let e=t.format??"mermaid";if(!X2e.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=G(),i=dc(n,".");if(t.focus){let s=yx(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=gx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=kee(i);for(let[c,l]of a){let u=Y2e(s,c);aj(lj(u),{recursive:!0}),cj(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,xx(i,"."));aj(lj(t.out),{recursive:!0}),cj(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"?$ee(i):r==="json"?Sx(i):xee(i);t.out?(aj(lj(t.out),{recursive:!0}),cj(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 Ree(){try{let t=dc(G(),".");process.stdout.write(Tee($x(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Fm();import{createServer as Q2e}from"node:http";import{existsSync as eUe,watch as tUe}from"node:fs";import{join as rUe}from"node:path";qe();Ai();function nUe(t={}){let e=t.cwd??".",r=new Set,n=()=>dc(G(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}RP();VP();LP();UP();GP();OP();QP();eC();rC();iC();Fm();ZP();qe();var eUe=[Fv,Yv,Mv,Jv,zv,Bv,Pv,Wv,Vv,Iv];function tUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=gp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function xx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Sa(e,G(e))}catch{}try{for(let o of eUe){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 tUe(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{Sa(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}oj();qe();Ti();var nUe=new Set(["mermaid","dot","json","obsidian","html"]);function Pee(t={}){try{let e=t.format??"mermaid";if(!nUe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=G(),i=dc(n,".");if(t.focus){let s=yx(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=gx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Tee(i);for(let[c,l]of a){let u=rUe(s,c);sj(cj(u),{recursive:!0}),aj(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,xx(i,"."));sj(cj(t.out),{recursive:!0}),aj(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"?Aee(i):r==="json"?Sx(i):Eee(i);t.out?(sj(cj(t.out),{recursive:!0}),aj(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 Cee(){try{let t=dc(G(),".");process.stdout.write(Iee($x(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Fm();import{createServer as iUe}from"node:http";import{existsSync as oUe,watch as sUe}from"node:fs";import{join as aUe}from"node:path";qe();Ti();function cUe(t={}){let e=t.cwd??".",r=new Set,n=()=>dc(G(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=Q2e((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=Sx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(xx(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=iUe((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=Sx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(xx(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=rUe(e,u);if(eUe(d))try{let f=tUe(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=aUe(e,u);if(oUe(d))try{let f=sUe(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 Iee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await nUe({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 iUe=["stage_1.1","stage_2.1","stage_2.3"];function oUe(t){return(t.features??[]).filter(e=>e.status==="done")}function sUe(t,e){let r=oUe(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 Pee(t,e){let r=[];for(let n of iUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=sUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}sS();import Cee from"node:process";function aUe(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 kx(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=aUe(n,t);i.pass||r.push(i)}return r}ti();var uj="stage_4.1";function dj(t={}){let{cwd:e="."}=t,r=On(e);if(r.length===0)return{stage:uj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=kx(r);if(n.length===0)return{stage:uj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:uj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var cUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Cee.argv[1]}`;if(cUe){let t=dj();console.log(JSON.stringify(t)),Cee.exit(t.exitCode)}ul();import{randomBytes as lUe}from"node:crypto";import{unlinkSync as uUe}from"node:fs";import{tmpdir as dUe}from"node:os";import{join as fUe,resolve as fj}from"node:path";import pUe from"node:process";var qr=null;function Dee(t){qr={cwd:fj(t),run:null,jsonFile:null}}function Nee(){return qr!==null}function jee(t,e){if(!qr||qr.cwd!==fj(t))return null;if(qr.run)return qr.run;let r=fUe(dUe(),`clad-shared-vitest-${pUe.pid}-${lUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function Mee(t){return!qr||qr.cwd!==fj(t)?null:qr.run}function Fee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Lee(){let t=qr?.jsonFile;if(qr=null,t)try{uUe(t)}catch{}}Mr();import zee from"node:process";var Ex="stage_1.4";function pj(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Ex,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:Ex,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Ex,pass:!0,exitCode:0}:{stage:Ex,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var mUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${zee.argv[1]}`;if(mUe){let t=pj();console.log(JSON.stringify(t)),zee.exit(t.exitCode)}Mr();import Uee from"node:process";Lm();Tn();var Ax="stage_2.2";function mj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Io("coverage",t))}catch(c){return{stage:Ax,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Ax,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Mee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Ut(Ax,r,s);return a||tr(Ax,s)}var yUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Uee.argv[1]}`;if(yUe){let t=mj();console.log(JSON.stringify(t)),Uee.exit(t.exitCode)}kp();hj();Mr();on();Tn();import Bee from"node:process";var Ix="stage_3.2";function gj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Ix,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Ix,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Ix,i,s);return a||tr(Ix,s)}var DUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Bee.argv[1]}`;if(DUe){let t=gj();console.log(JSON.stringify(t)),Bee.exit(t.exitCode)}Mr();qe();Tn();import{existsSync as NUe}from"node:fs";import{resolve as Gee}from"node:path";import Zee from"node:process";var ai="stage_2.4",yj=5e3,jUe=3e4;function _j(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=G(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:ai,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return FUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ai,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ai,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Gee(e,r.path);if(!NUe(s))return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??yj,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Ut(ai,r.path,c);if(l)return l;if(c.timedOut)return{stage:ai,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:ai,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ai,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Hee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},MUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function FUe(t,e,r){let n=Math.min(e.length*yj,jUe),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(LUe(t,s,r))}return zUe(o)}function LUe(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("/")?Gee(t,a):a,u=yj,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Na(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 zUe(t){let e="skip";for(let o of t)Hee[o.disposition]>Hee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${MUe[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:ai,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ai,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var UUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Zee.argv[1]}`;if(UUe){let t=_j();console.log(JSON.stringify(t)),Zee.exit(t.exitCode)}Mr();on();Tn();import Vee from"node:process";var Px="stage_3.1";function bj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Px,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Px,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Px,i,s);return a||tr(Px,s)}var qUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Vee.argv[1]}`;if(qUe){let t=bj();console.log(JSON.stringify(t)),Vee.exit(t.exitCode)}KP();vj();Sj();Mr();Ox();import{randomBytes as KUe}from"node:crypto";import{unlinkSync as JUe}from"node:fs";import{tmpdir as YUe}from"node:os";import{join as XUe}from"node:path";import xj from"node:process";Lm();Tn();qe();import{readFileSync as GUe}from"node:fs";import{resolve as Jee}from"node:path";function ZUe(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=Jee(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 VUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function WUe(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=VUe(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(Jee(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 wj(t,e){try{let r=ZUe(GUe(t,"utf8"));return r?WUe(G(e),r,e):[]}catch{return[]}}var Po="stage_2.1";function Yee(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function QUe(t,e,r){let n,i;try{({cmd:n,args:i}=Io("coverage",t))}catch{return null}if(!n||!i||!Yee(n,i))return null;let o=n,s=i,a=jee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Ut(Po,n,c))return null;let u=tr(Po,c);if(Fee(u)==="fallback")return null;if(r){let d=wj(l,e);if(d.length>0)return{stage:Po,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Po,pass:!0,exitCode:0}}function $j(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Io("test",t))}catch(u){return{stage:Po,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Po,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Yee(n,i),a=r&&s;if(Nee()&&s){let u=QUe(t,e,a);if(u)return u}let c,l=i;a&&(c=XUe(YUe(),`clad-vitest-${xj.pid}-${KUe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Ut(Po,n,u);if(d)return d;let f=Su("unit",tr(Po,u),u);if(a&&f.pass&&c){let p=wj(c,e);if(p.length>0)return{stage:Po,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{JUe(c)}catch{}}}var eqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xj.argv[1]}`;if(eqe){let t=$j();console.log(JSON.stringify(t)),xj.exit(t.exitCode)}Mr();on();Tn();import Xee from"node:process";var Nx="stage_3.3";function kj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Nx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Nx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Nx,i,s);return a||tr(Nx,s)}var tqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Xee.argv[1]}`;if(tqe){let t=kj();console.log(JSON.stringify(t)),Xee.exit(t.exitCode)}YP();Af();fa();Aj();pp();zv();var ote=bt(Qt(),1);import{existsSync as Tj,readFileSync as fqe,readdirSync as ite,statSync as pqe,writeFileSync as mqe}from"node:fs";import{basename as Bm,join as Hm,relative as nte}from"node:path";var hqe=["self-dogfood:","fixture:","derived:"],ste=/\.(test|spec)\.[jt]sx?$/;function ate(t,e=t,r=[]){let n;try{n=ite(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Hm(e,i);try{pqe(o).isDirectory()?ate(t,o,r):ste.test(i)&&r.push(o)}catch{continue}}return r}function cte(t="."){let e=Hm(t,"spec","features"),r=Hm(t,"tests"),n=[],i=[];if(!Tj(e)||!Tj(r))return{repaired:n,suggested:i};let o=ate(r),s=new Map;for(let a of o){let c=nte(t,a).split("\\").join("/"),l=s.get(Bm(a))??[];l.push(c),s.set(Bm(a),l)}for(let a of ite(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Hm(e,a),l,u;try{l=fqe(c,"utf8"),u=(0,ote.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(hqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Tj(Hm(t,b)))continue;let _=s.get(Bm(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=>Bm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>nte(t,h).split("\\").join("/")).find(h=>{let g=Bm(h).replace(ste,"");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 Dee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await cUe({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 lUe=["stage_1.1","stage_2.1","stage_2.3"];function uUe(t){return(t.features??[]).filter(e=>e.status==="done")}function dUe(t,e){let r=uUe(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 Nee(t,e){let r=[];for(let n of lUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=dUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}sS();import jee from"node:process";function fUe(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 kx(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=fUe(n,t);i.pass||r.push(i)}return r}ti();var lj="stage_4.1";function uj(t={}){let{cwd:e="."}=t,r=On(e);if(r.length===0)return{stage:lj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=kx(r);if(n.length===0)return{stage:lj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:lj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var pUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${jee.argv[1]}`;if(pUe){let t=uj();console.log(JSON.stringify(t)),jee.exit(t.exitCode)}ll();import{randomBytes as mUe}from"node:crypto";import{unlinkSync as hUe}from"node:fs";import{tmpdir as gUe}from"node:os";import{join as yUe,resolve as dj}from"node:path";import _Ue from"node:process";var qr=null;function Mee(t){qr={cwd:dj(t),run:null,jsonFile:null}}function Fee(){return qr!==null}function Lee(t,e){if(!qr||qr.cwd!==dj(t))return null;if(qr.run)return qr.run;let r=yUe(gUe(),`clad-shared-vitest-${_Ue.pid}-${mUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function zee(t){return!qr||qr.cwd!==dj(t)?null:qr.run}function Uee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function qee(){let t=qr?.jsonFile;if(qr=null,t)try{hUe(t)}catch{}}Mr();import Bee from"node:process";var Ex="stage_1.4";function fj(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Ex,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:Ex,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Ex,pass:!0,exitCode:0}:{stage:Ex,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var bUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Bee.argv[1]}`;if(bUe){let t=fj();console.log(JSON.stringify(t)),Bee.exit(t.exitCode)}Mr();import Hee from"node:process";Lm();Tn();var Ax="stage_2.2";function pj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Io("coverage",t))}catch(c){return{stage:Ax,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Ax,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=zee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Ut(Ax,r,s);return a||tr(Ax,s)}var wUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Hee.argv[1]}`;if(wUe){let t=pj();console.log(JSON.stringify(t)),Hee.exit(t.exitCode)}kp();mj();Mr();on();Tn();import Zee from"node:process";var Ix="stage_3.2";function hj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Ix,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Rl(e,o[o.length-1]))return{stage:Ix,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Ix,i,s);return a||tr(Ix,s)}var LUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Zee.argv[1]}`;if(LUe){let t=hj();console.log(JSON.stringify(t)),Zee.exit(t.exitCode)}Mr();qe();Tn();import{existsSync as zUe}from"node:fs";import{resolve as Wee}from"node:path";import Kee from"node:process";var ci="stage_2.4",gj=5e3,UUe=3e4;function yj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=G(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:ci,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return BUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ci,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ci,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ci,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Wee(e,r.path);if(!zUe(s))return{stage:ci,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??gj,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Ut(ci,r.path,c);if(l)return l;if(c.timedOut)return{stage:ci,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:ci,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ci,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Vee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},qUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function BUe(t,e,r){let n=Math.min(e.length*gj,UUe),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(HUe(t,s,r))}return GUe(o)}function HUe(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("/")?Wee(t,a):a,u=gj,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(ja(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 GUe(t){let e="skip";for(let o of t)Vee[o.disposition]>Vee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${qUe[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:ci,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ci,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var ZUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Kee.argv[1]}`;if(ZUe){let t=yj();console.log(JSON.stringify(t)),Kee.exit(t.exitCode)}Mr();on();Tn();import Jee from"node:process";var Px="stage_3.1";function _j(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Px,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Rl(e,o[o.length-1]))return{stage:Px,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Px,i,s);return a||tr(Px,s)}var VUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Jee.argv[1]}`;if(VUe){let t=_j();console.log(JSON.stringify(t)),Jee.exit(t.exitCode)}KP();bj();vj();Mr();Ox();import{randomBytes as eqe}from"node:crypto";import{unlinkSync as tqe}from"node:fs";import{tmpdir as rqe}from"node:os";import{join as nqe}from"node:path";import wj from"node:process";Lm();Tn();qe();import{readFileSync as JUe}from"node:fs";import{resolve as Qee}from"node:path";function YUe(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=Qee(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 XUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function QUe(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=XUe(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(Qee(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 Sj(t,e){try{let r=YUe(JUe(t,"utf8"));return r?QUe(G(e),r,e):[]}catch{return[]}}var Po="stage_2.1";function ete(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function iqe(t,e,r){let n,i;try{({cmd:n,args:i}=Io("coverage",t))}catch{return null}if(!n||!i||!ete(n,i))return null;let o=n,s=i,a=Lee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Ut(Po,n,c))return null;let u=tr(Po,c);if(Uee(u)==="fallback")return null;if(r){let d=Sj(l,e);if(d.length>0)return{stage:Po,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Po,pass:!0,exitCode:0}}function xj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Io("test",t))}catch(u){return{stage:Po,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Po,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=ete(n,i),a=r&&s;if(Fee()&&s){let u=iqe(t,e,a);if(u)return u}let c,l=i;a&&(c=nqe(rqe(),`clad-vitest-${wj.pid}-${eqe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Ut(Po,n,u);if(d)return d;let f=Su("unit",tr(Po,u),u);if(a&&f.pass&&c){let p=Sj(c,e);if(p.length>0)return{stage:Po,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{tqe(c)}catch{}}}var oqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wj.argv[1]}`;if(oqe){let t=xj();console.log(JSON.stringify(t)),wj.exit(t.exitCode)}Mr();on();Tn();import tte from"node:process";var Nx="stage_3.3";function $j(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Nx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Rl(e,o[o.length-1]))return{stage:Nx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Nx,i,s);return a||tr(Nx,s)}var sqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tte.argv[1]}`;if(sqe){let t=$j();console.log(JSON.stringify(t)),tte.exit(t.exitCode)}YP();Af();pa();Ej();pp();Uv();var cte=bt(Qt(),1);import{existsSync as Aj,readFileSync as yqe,readdirSync as ate,statSync as _qe,writeFileSync as bqe}from"node:fs";import{basename as Bm,join as Hm,relative as ste}from"node:path";var vqe=["self-dogfood:","fixture:","derived:"],lte=/\.(test|spec)\.[jt]sx?$/;function ute(t,e=t,r=[]){let n;try{n=ate(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Hm(e,i);try{_qe(o).isDirectory()?ute(t,o,r):lte.test(i)&&r.push(o)}catch{continue}}return r}function dte(t="."){let e=Hm(t,"spec","features"),r=Hm(t,"tests"),n=[],i=[];if(!Aj(e)||!Aj(r))return{repaired:n,suggested:i};let o=ute(r),s=new Map;for(let a of o){let c=ste(t,a).split("\\").join("/"),l=s.get(Bm(a))??[];l.push(c),s.set(Bm(a),l)}for(let a of ate(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Hm(e,a),l,u;try{l=yqe(c,"utf8"),u=(0,cte.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(vqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Aj(Hm(t,b)))continue;let _=s.get(Bm(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=>Bm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>ste(t,h).split("\\").join("/")).find(h=>{let g=Bm(h).replace(lte,"");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&&mqe(c,l,"utf8")}return{repaired:n,suggested:i}}ll();import{existsSync as gqe,readFileSync as yqe}from"node:fs";import{join as _qe}from"node:path";function bqe(t,e){let r=_qe(t,e);if(!gqe(r))return[];let n=[];for(let i of yqe(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 lte(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=>bqe(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 ute(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(` -`)}Bv();qe();Ai();ti();ll();var Oj=["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"],vqe=[...Oj,"att"];function Sqe(t,e,r){if(e.startsWith("stage_4")){let n=On(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return kx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function wqe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":A_(e,r,t).state==="fresh"?"\u2713":"!"}function Lx(t,e="."){let r=is(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Oj.map(o=>Sqe(i,o,e)),wqe(i,r,e)]}));return{columns:vqe,rows:n}}function dte(t,e=".",r={}){let n=r.internal??!1,i=Lx(t,e),o=[...Oj.map(c=>n?c.replace("stage_",""):xqe(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 xqe(t){return wa(t).slice(0,3)}async function ZJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Tue(),Aue)),Promise.resolve().then(()=>(Cue(),Pue)),Promise.resolve().then(()=>(Up(),jX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>hee(s),prepareInit:({cwd:s,mode:a,intent:c})=>pee(s,a,c),initialize:VN,prepareClarify:(s,{cwd:a})=>mee(a,s),clarify:YN,resolveReview:(s,{cwd:a})=>lee(s,{cwd:a})}});n(i.server);let o=new r;W.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function VJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await VN({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){W.stdout.write(`${JSON.stringify(n,null,2)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&bqe(c,l,"utf8")}return{repaired:n,suggested:i}}cl();import{existsSync as Sqe,readFileSync as wqe}from"node:fs";import{join as xqe}from"node:path";function $qe(t,e){let r=xqe(t,e);if(!Sqe(r))return[];let n=[];for(let i of wqe(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 fte(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=>$qe(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 pte(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(` +`)}Hv();qe();Ti();ti();cl();var Tj=["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"],kqe=[...Tj,"att"];function Eqe(t,e,r){if(e.startsWith("stage_4")){let n=On(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return kx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function Aqe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":T_(e,r,t).state==="fresh"?"\u2713":"!"}function Lx(t,e="."){let r=is(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Tj.map(o=>Eqe(i,o,e)),Aqe(i,r,e)]}));return{columns:kqe,rows:n}}function mte(t,e=".",r={}){let n=r.internal??!1,i=Lx(t,e),o=[...Tj.map(c=>n?c.replace("stage_",""):Tqe(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 Tqe(t){return xa(t).slice(0,3)}async function YJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Cue(),Pue)),Promise.resolve().then(()=>(Fue(),Mue)),Promise.resolve().then(()=>(Up(),LX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>_ee(s),prepareInit:({cwd:s,mode:a,intent:c})=>gee(s,a,c),initialize:ZN,prepareClarify:(s,{cwd:a})=>yee(a,s),clarify:JN,resolveReview:(s,{cwd:a})=>fee(s,{cwd:a})}});n(i.server);let o=new r;W.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function XJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await ZN({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){W.stdout.write(`${JSON.stringify(n,null,2)} `),W.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){W.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())W.stdout.write(` ${o+1}. ${s} @@ -900,30 +900,30 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&mqe(c,l,"u `),W.stdout.write(` e.g. clad init payment SaaS for B2B `),W.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));W.exit(0)}async function WJe(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(()=>(ide(),nde)),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}`),W.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=G(e.cwd??"."),a=n.featuresTouched.map(l=>HO(l,s)),c=`${zH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&W.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.`),W.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function KJe(t={}){try{let e=G();if(da("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ms(".");Nl(".",r),Ba("."),s5(".");let n=Gl(".");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=cte(".");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=Fx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Gv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),W.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)`),W.exit(0);return}L("pass","sync",`${e.features.length} features valid`),W.exit(0)}catch(e){L("fail","sync",e.message),W.exit(1)}}function JJe(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),W.exit(2);return}let e=u_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),W.exit(0)}function YJe(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),W.exit(2);return}let r=d_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),W.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?W.stdout.write(`Run: git checkout ${r.gitHead} +`));W.exit(0)}async function QJe(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(()=>(lde(),cde)),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}`),W.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=G(e.cwd??"."),a=n.featuresTouched.map(l=>HO(l,s)),c=`${qH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&W.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.`),W.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function e8e(t={}){try{let e=G();if(fa("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ms(".");Dl(".",r),Ha("."),c5(".");let n=Gl(".");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=dte(".");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=Fx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Zv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),W.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)`),W.exit(0);return}L("pass","sync",`${e.features.length} features valid`),W.exit(0)}catch(e){L("fail","sync",e.message),W.exit(1)}}function t8e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),W.exit(2);return}let e=d_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),W.exit(0)}function r8e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),W.exit(2);return}let r=f_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),W.exit(1);return}p_(".",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?W.stdout.write(`Run: git checkout ${r.gitHead} `):W.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),W.exit(0)}async function XJe(t){let e=await TC({force:t.force,quiet:t.quiet});W.exit(e.errors.length>0?1:0)}async function QJe(){L("note","update","reconciling the current project after the engine upgrade");let t=await rX(".",{wireHosts:async()=>(await TC({quiet:!0})).errors.length});if(L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){L("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),W.exit(t.code);return}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);W.stdout.write(` +`),W.exit(0)}async function n8e(t){let e=await AC({force:t.force,quiet:t.quiet});W.exit(e.errors.length>0?1:0)}async function i8e(){L("note","update","reconciling the current project after the engine upgrade");let t=await oX(".",{wireHosts:async()=>(await AC({quiet:!0})).errors.length});if(L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){L("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),W.exit(t.code);return}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);W.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),uA({tier:"pre-commit",strict:!0}).anyFailed?W.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"),W.exit(t.code)}var e8e={"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 uA(t){let e=t.tier??"all",r=t.silent===!0,n=e8e[e];if(!n)return t.json&&!r?W.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",()=>Um(i)],["stage_1.2",()=>zm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",pj],["stage_1.5",Wa],["stage_1.6",Dp],["stage_2.1",()=>$j({...i,strict:t.strict})],["stage_2.2",()=>mj(i)],["stage_2.3",WP],["stage_2.4",_j],["stage_3.1",bj],["stage_3.2",gj],["stage_3.3",kj],["stage_4.1",dj],["stage_4.2",qm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ii(d)?"fail":"skip",u=[];T_("."),Dee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:wa(d),h=HY(p);ii(h)&&(c=!0,a=Math.max(a,GY(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),ii(h)&&c8e(p))}}finally{R_(),Lee()}if(t.strict)try{let d=G();for(let f of Pee(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"||!ii(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=>ii(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(da("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{sG(".",G())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?W.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&W.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function t8e(t){try{let e=G(),r=rl(e,t);W.stdout.write(`${JSON.stringify(r,null,2)} -`),W.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),W.exit(1)}}function r8e(t,e={}){try{let r=G(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});W.stdout.write(`${JSON.stringify(i,null,2)} -`),W.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),W.exit(1)}}function n8e(t={}){try{let e=G(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Yv(e,o=>{try{return sde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});W.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),W.exit(0)}catch(e){L("fail","infer-deps",e.message),W.exit(1)}}function i8e(t={}){try{if(t.sessions){_ee(t);return}if(t.trend!==void 0&&t.trend!==!1){bee(t);return}let e=G(),n=oH(e,o=>{try{return sde(o,"utf8")}catch{return null}},"."),i=aH(".",n);if(t.json)W.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)}`,` ${nl}`];W.stdout.write(`${c.join(` +`),uA({tier:"pre-commit",strict:!0}).anyFailed?W.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"),W.exit(t.code)}var o8e={"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 uA(t){let e=t.tier??"all",r=t.silent===!0,n=o8e[e];if(!n)return t.json&&!r?W.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",()=>Um(i)],["stage_1.2",()=>zm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",fj],["stage_1.5",Wa],["stage_1.6",Dp],["stage_2.1",()=>xj({...i,strict:t.strict})],["stage_2.2",()=>pj(i)],["stage_2.3",WP],["stage_2.4",yj],["stage_3.1",_j],["stage_3.2",hj],["stage_3.3",$j],["stage_4.1",uj],["stage_4.2",qm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":oi(d)?"fail":"skip",u=[];O_("."),Mee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:xa(d),h=VY(p);oi(h)&&(c=!0,a=Math.max(a,WY(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),oi(h)&&p8e(p))}}finally{I_(),qee()}if(t.strict)try{let d=G();for(let f of Nee(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"||!oi(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=>oi(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(fa("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{cG(".",G())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?W.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&W.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function s8e(t){try{let e=G(),r=tl(e,t);W.stdout.write(`${JSON.stringify(r,null,2)} +`),W.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),W.exit(1)}}function a8e(t,e={}){try{let r=G(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});W.stdout.write(`${JSON.stringify(i,null,2)} +`),W.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),W.exit(1)}}function c8e(t={}){try{let e=G(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Xv(e,o=>{try{return dde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});W.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),W.exit(0)}catch(e){L("fail","infer-deps",e.message),W.exit(1)}}function l8e(t={}){try{if(t.sessions){See(t);return}if(t.trend!==void 0&&t.trend!==!1){wee(t);return}let e=G(),n=aH(e,o=>{try{return dde(o,"utf8")}catch{return null}},"."),i=lH(".",n);if(t.json)W.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)}`,` ${rl}`];W.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)")}W.exit(0)}catch(e){L("fail","measure",e.message),W.exit(1)}}function o8e(t){let e;if(t.feature)try{let n=(G().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),W.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),W.exit(1)}W.exitCode=uA({...t,focusModules:e}).worst}function s8e(t){let e=kY(".",t,{checkStages:uA,onIndex:Ba,gitOpInProgress:uO});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),W.exit(e.code)}function a8e(t,e={}){let r=e.cwd??".",n;try{n=G(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),W.exit(1);return}if(e.required){t&&W.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=u5(n);if(o.length===0){W.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)")}W.exit(0)}catch(e){L("fail","measure",e.message),W.exit(1)}}function u8e(t){let e;if(t.feature)try{let n=(G().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),W.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),W.exit(1)}W.exitCode=uA({...t,focusModules:e}).worst}function d8e(t){let e=TY(".",t,{checkStages:uA,onIndex:Ha,gitOpInProgress:uO});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),W.exit(e.code)}function f8e(t,e={}){let r=e.cwd??".",n;try{n=G(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),W.exit(1);return}if(e.required){t&&W.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=f5(n);if(o.length===0){W.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),W.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";W.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}W.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),W.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"),W.exit(1);return}let i=lte(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`),W.exit(1);return}W.stdout.write(`${ute(i)} -`),W.exit(0)}function c8e(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=ode(Pf(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";W.stdout.write(` ${o}${s} [${i.detector}] +`),W.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"),W.exit(1);return}let i=fte(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`),W.exit(1);return}W.stdout.write(`${pte(i)} +`),W.exit(0)}function p8e(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=ude(Pf(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";W.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&W.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&W.stdout.write(` ${ode(e.trim(),160)} -`)}}function ode(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function l8e(t){let e=G();if(t.json){W.stdout.write(`${JSON.stringify(Lx(e,"."),null,2)} -`),W.exitCode=0;return}W.stdout.write(`${dte(e,".",{internal:t.internal})} -`),W.exit(0)}function u8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function d8e(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"),W.exit(1);return}let n;try{let i=G(e),o=Lx(i,e),s={gitHead:ma(e),version:zl(),generatedAt:t.now??new Date().toISOString()},a=sl(i),c;try{let l=t.since??Qo(e),u=es(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:il(u),auditMarkdown:ol(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=XH({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),W.exit(1);return}try{GJe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),W.exit(1);return}L("pass","bundle",`${r} \xB7 ${u8e(Buffer.byteLength(n,"utf8"))}`),W.exit(0)}function f8e(t){let e=OA(t);L("note",`route \u2192 ${e}`,t),W.exit(e==="unknown"?1:0)}function p8e(){let t=new Jq;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(VJe),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(WJe),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(KJe),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(XJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(QJe),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(o8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(JJe),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(s8e),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)=>a8e(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(YJe),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(l8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(t8e),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)=>r8e(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=>XY(r,{checkStages:uA})),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=>n8e(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=>i8e(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=>Oee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Ree()),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=>{Iee(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=>LH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>H5(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=>d8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(f8e),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(BY),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(ZJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){wY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}V5(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(fee),t}var m8e=!!globalThis.__CLADDING_BUNDLED,h8e=m8e||import.meta.url===`file://${W.argv[1]}`;h8e&&p8e().parse();export{e8e as TIER_STAGES,p8e as createProgram,d8e as runBundleCommand,o8e as runCheckCommand,uA as runCheckStages,JJe as runCheckpointCommand,t8e as runContextCommand,s8e as runDoneCommand,r8e as runImpactCommand,n8e as runInferDepsCommand,VJe as runInitCommand,i8e as runMeasureCommand,a8e as runOracleCommand,YJe as runRollbackCommand,f8e as runRouteCommand,WJe as runRunCommand,ZJe as runServeCommand,XJe as runSetupCommand,l8e as runStatusCommand,KJe as runSyncCommand,QJe as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&W.stdout.write(` ${ude(e.trim(),160)} +`)}}function ude(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function m8e(t){let e=G();if(t.json){W.stdout.write(`${JSON.stringify(Lx(e,"."),null,2)} +`),W.exitCode=0;return}W.stdout.write(`${mte(e,".",{internal:t.internal})} +`),W.exit(0)}function h8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function g8e(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"),W.exit(1);return}let n;try{let i=G(e),o=Lx(i,e),s={gitHead:ha(e),version:zl(),generatedAt:t.now??new Date().toISOString()},a=ol(i),c;try{let l=t.since??Qo(e),u=es(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:nl(u),auditMarkdown:il(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=eG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),W.exit(1);return}try{JJe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),W.exit(1);return}L("pass","bundle",`${r} \xB7 ${h8e(Buffer.byteLength(n,"utf8"))}`),W.exit(0)}function y8e(t){let e=OA(t);L("note",`route \u2192 ${e}`,t),W.exit(e==="unknown"?1:0)}function _8e(){let t=new Xq;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(XJe),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(QJe),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(e8e),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(n8e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(i8e),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(u8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(t8e),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(d8e),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)=>f8e(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(r8e),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(m8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(s8e),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)=>a8e(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=>tX(r,{checkStages:uA})),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=>c8e(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=>l8e(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=>Pee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Cee()),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=>{Dee(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=>UH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>Z5(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=>g8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(y8e),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(ZY),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(YJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){kY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}K5(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(hee),t}var b8e=!!globalThis.__CLADDING_BUNDLED,v8e=b8e||import.meta.url===`file://${W.argv[1]}`;v8e&&_8e().parse();export{o8e as TIER_STAGES,_8e as createProgram,g8e as runBundleCommand,u8e as runCheckCommand,uA as runCheckStages,t8e as runCheckpointCommand,s8e as runContextCommand,d8e as runDoneCommand,a8e as runImpactCommand,c8e as runInferDepsCommand,XJe as runInitCommand,l8e as runMeasureCommand,f8e as runOracleCommand,r8e as runRollbackCommand,y8e as runRouteCommand,QJe as runRunCommand,YJe as runServeCommand,n8e as runSetupCommand,m8e as runStatusCommand,e8e as runSyncCommand,i8e as runUpdateCommand}; diff --git a/plugins/codex/skills/clarify/SKILL.md b/plugins/codex/skills/clarify/SKILL.md index 3d19ef58..30f51495 100644 --- a/plugins/codex/skills/clarify/SKILL.md +++ b/plugins/codex/skills/clarify/SKILL.md @@ -4,6 +4,8 @@ description: Advance Cladding onboarding after the user answers a pending produc # Cladding clarify +Use this workflow only for an answer contained in a new user message after Cladding displayed the pending question. Never infer, synthesize, or reuse an answer from an initialization turn. If no new user answer exists, stop without calling either clarify tool. + Use this workflow only after Cladding initialization returned a pending question and the user has answered it. 1. Call `clad_prepare_clarify` with the user's answer verbatim. diff --git a/plugins/codex/skills/init/SKILL.md b/plugins/codex/skills/init/SKILL.md index 15925604..99200e94 100644 --- a/plugins/codex/skills/init/SKILL.md +++ b/plugins/codex/skills/init/SKILL.md @@ -15,8 +15,8 @@ Use this workflow only when the user explicitly asks to initialize, adopt, or re - `existing` for an existing codebase; include an optional adoption goal. 3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. 4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. -5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. Questions, paraphrases, and generic acknowledgements are not approval. -6. Ask the returned `nextQuestion` verbatim. Continue with the Cladding clarify workflow after the user answers. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the draft and that reply verbatim as `confirmation`. Include the one-time token when the host retained it; process-per-turn hosts may omit it and Cladding resolves the exact challenge from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. +6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. diff --git a/plugins/gemini-cli/commands/init.toml b/plugins/gemini-cli/commands/init.toml index e51f672c..cdae5414 100644 --- a/plugins/gemini-cli/commands/init.toml +++ b/plugins/gemini-cli/commands/init.toml @@ -13,8 +13,8 @@ Use this workflow only when the user explicitly asks to initialize, adopt, or re - `existing` for an existing codebase; include an optional adoption goal. 3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. 4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. -5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. Questions, paraphrases, and generic acknowledgements are not approval. -6. Ask the returned `nextQuestion` verbatim. Continue with the Cladding clarify workflow after the user answers. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the draft and that reply verbatim as `confirmation`. Include the one-time token when the host retained it; process-per-turn hosts may omit it and Cladding resolves the exact challenge from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. +6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. diff --git a/scripts/build-plugin.mjs b/scripts/build-plugin.mjs index f807524d..241db988 100644 --- a/scripts/build-plugin.mjs +++ b/scripts/build-plugin.mjs @@ -28,6 +28,7 @@ import { chmodSync, + cpSync, copyFileSync, existsSync, mkdirSync, @@ -255,6 +256,26 @@ console.log( `cladding plugin · codex: copied ${codexVerbCount} verbs + ${codexPersonaCount} personas → ${CODEX_SKILLS}/`, ); +// --- Phase B2 — Antigravity plugin skills mirror -------------------- + +const ANTIGRAVITY_SKILLS = 'plugins/antigravity/skills'; +mkdirSync(ANTIGRAVITY_SKILLS, {recursive: true}); +for (const entry of readdirSync(CODEX_SKILLS)) { + if (entry === 'README.md') continue; + const src = join(CODEX_SKILLS, entry); + if (!statSync(src).isDirectory()) continue; + const dst = join(ANTIGRAVITY_SKILLS, entry); + rmSync(dst, {recursive: true, force: true}); + cpSync(src, dst, {recursive: true}); +} +for (const entry of readdirSync(ANTIGRAVITY_SKILLS)) { + if (!codexExpected.has(entry)) rmSync(join(ANTIGRAVITY_SKILLS, entry), {recursive: true, force: true}); +} +rmSync(join(ANTIGRAVITY_SKILLS, 'README.md'), {force: true}); +console.log( + `cladding plugin · antigravity: copied ${codexVerbCount} verbs + ${codexPersonaCount} personas → ${ANTIGRAVITY_SKILLS}/`, +); + // --- Phase C — Gemini CLI mirror (plugins/gemini-cli/commands/) ------- const GEMINI_COMMANDS = 'plugins/gemini-cli/commands'; diff --git a/skills/clarify/SKILL.md b/skills/clarify/SKILL.md index 3d19ef58..30f51495 100644 --- a/skills/clarify/SKILL.md +++ b/skills/clarify/SKILL.md @@ -4,6 +4,8 @@ description: Advance Cladding onboarding after the user answers a pending produc # Cladding clarify +Use this workflow only for an answer contained in a new user message after Cladding displayed the pending question. Never infer, synthesize, or reuse an answer from an initialization turn. If no new user answer exists, stop without calling either clarify tool. + Use this workflow only after Cladding initialization returned a pending question and the user has answered it. 1. Call `clad_prepare_clarify` with the user's answer verbatim. diff --git a/skills/init/SKILL.md b/skills/init/SKILL.md index 15925604..99200e94 100644 --- a/skills/init/SKILL.md +++ b/skills/init/SKILL.md @@ -15,8 +15,8 @@ Use this workflow only when the user explicitly asks to initialize, adopt, or re - `existing` for an existing codebase; include an optional adoption goal. 3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. 4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. -5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the one-time token, the draft, and that reply verbatim as `confirmation`. Questions, paraphrases, and generic acknowledgements are not approval. -6. Ask the returned `nextQuestion` verbatim. Continue with the Cladding clarify workflow after the user answers. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the draft and that reply verbatim as `confirmation`. Include the one-time token when the host retained it; process-per-turn hosts may omit it and Cladding resolves the exact challenge from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. +6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. diff --git a/src/init/host-setup.ts b/src/init/host-setup.ts index 002f133e..042907e5 100644 --- a/src/init/host-setup.ts +++ b/src/init/host-setup.ts @@ -2,7 +2,7 @@ // // Wires up to four host AI auto-discovery channels, one symlink per channel: // 1. ~/.claude/plugins/cladding → cladding pkg root -// 2. ~/.gemini/extensions/cladding → cladding/plugins/gemini-cli +// 2. ~/.gemini/config/plugins/cladding → cladding/plugins/antigravity // 3. ~/.agents/skills/cladding- → cladding/plugins/codex/skills/ // 4. ~/.codex/config.toml → [mcp_servers.cladding] table merge // @@ -14,8 +14,9 @@ // - no-op — symlink target matches → skip // - conflict — directory copy with manual changes → warn, --force required // -// Detection — host AI is "installed" iff its home directory exists (~/.claude/, ~/.gemini/, -// ~/.agents/, ~/.codex/). Undetected hosts are skipped (no directories created). +// Detection — host AI is "installed" iff its host-specific home exists. Antigravity is +// detected by its config/runtime directories rather than the legacy Gemini CLI ~/.gemini +// root, so an old Gemini install is never mistaken for AGY. import { cpSync, @@ -53,7 +54,7 @@ export interface CodexSkillResult { export interface SetupResult { readonly wiring: { readonly claude_plugin: ChannelResult; - readonly gemini_extension: ChannelResult; + readonly antigravity_plugin: ChannelResult; readonly codex_skills: ReadonlyArray; readonly codex_mcp: ChannelResult; readonly cursor_mcp: ChannelResult; @@ -72,20 +73,19 @@ export interface SetupOptions { readonly pkgRoot?: string; readonly version?: string; /** Run host CLI activation commands after wiring (default true). Tests must - * pass false: activation invokes the REAL `claude`/`gemini` binaries, which + * pass false: activation invokes the REAL host binaries, which * mutate the developer's actual host config — not the mocked home. */ readonly activate?: boolean; /** Injectable activation runners so AC-012 is testable without spawning - * real host CLIs. Defaults to the real claude/gemini activators. */ + * real host CLIs. Defaults to the real Claude activator. */ readonly activators?: { readonly claude?: (pluginPath: string) => ActivationResult; - readonly gemini?: (extensionPath: string) => ActivationResult; }; } export interface HostDetection { readonly claude: boolean; - readonly gemini: boolean; + readonly antigravity: boolean; readonly codex: boolean; readonly agents: boolean; readonly cursor: boolean; @@ -104,7 +104,9 @@ const STATUS_FILENAME = 'setup-status.json'; function detectHosts(home: string): HostDetection { return { claude: existsSync(join(home, '.claude')), - gemini: existsSync(join(home, '.gemini')), + antigravity: + existsSync(join(home, '.gemini', 'config')) || + existsSync(join(home, '.gemini', 'antigravity-cli')), codex: existsSync(join(home, '.codex')), agents: existsSync(join(home, '.agents')), cursor: existsSync(join(home, '.cursor')), @@ -187,16 +189,15 @@ function wireClaude(home: string, pkgRoot: string, opts: {force: boolean; isWin: return wireChannel(pkgRoot, join(home, '.claude', 'plugins', 'cladding'), opts); } -// Gemini stays npm-delegated (needs the PATH-global `clad`): its extension -// manifest (plugins/gemini-cli/gemini-extension.json) declares `command: "clad"` -// and is wired by SYMLINK into ~/.gemini/extensions/, so the host reads the shared -// repo copy directly. Making this lane self-contained would mean patching that -// manifest to a per-machine bundled-engine path — but patching a symlinked file -// mutates the shared copy for every project. Until Gemini moves to a copy+patch -// wire model (as the Claude Code lane did in 0.5.2, pointing MCP at the bundled -// engine via ${CLAUDE_PLUGIN_ROOT}), it requires `npm install -g cladding`. -function wireGemini(home: string, pkgRoot: string, opts: {force: boolean; isWin: boolean}): ChannelResult { - return wireChannel(join(pkgRoot, 'plugins', 'gemini-cli'), join(home, '.gemini', 'extensions', 'cladding'), opts); +// Antigravity discovers plugins under ~/.gemini/config/plugins. The plugin contains +// both skills and mcp_config.json; its MCP launch remains npm-delegated to the +// globally installed `clad` command. +function wireAntigravity(home: string, pkgRoot: string, opts: {force: boolean; isWin: boolean}): ChannelResult { + return wireChannel( + join(pkgRoot, 'plugins', 'antigravity'), + join(home, '.gemini', 'config', 'plugins', 'cladding'), + opts, + ); } function wireCodexSkills( @@ -356,7 +357,7 @@ function detectBinary(name: string): boolean { /** Run a non-interactive activation command, return true on success. */ function runActivation(command: string, args: readonly string[]): {ok: boolean; stderr: string} { - // shell:true on Windows — the host CLIs (claude/gemini/codex) install as `.cmd` + // shell:true on Windows — host CLIs install as `.cmd` // shims that spawnSync cannot resolve without a shell, so without this the // activation ENOENTs even though `where ` (detectBinary) found it. const result = spawnSync(command, args, { @@ -381,32 +382,13 @@ function activateClaude(pluginPath: string): ActivationResult { return {attempted: true, success: install.ok, stderr: install.stderr}; } -function activateGemini(extensionPath: string): ActivationResult { - if (!detectBinary('gemini')) return {attempted: false, success: false}; - // Check if cladding extension is already installed/enabled — `gemini extensions - // list` writes its output to stderr (verified against gemini 0.42.0), so we - // grep both streams. - const list = spawnSync('gemini', ['extensions', 'list'], { - encoding: 'utf8', - timeout: 10_000, - shell: platform() === 'win32', // `gemini` is a `.cmd` shim on Windows - }); - const combined = (list.stdout ?? '') + (list.stderr ?? ''); - if (list.status === 0 && /\bcladding\b/.test(combined)) { - return {attempted: true, success: true}; - } - const link = runActivation('gemini', ['extensions', 'link', extensionPath]); - return {attempted: true, success: link.ok, stderr: link.stderr}; -} - export interface ActivationContext { readonly claude?: ActivationResult; - readonly gemini?: ActivationResult; } function pushActivationHint( lines: string[], - channel: 'claude' | 'gemini' | 'codex-skills' | 'codex-mcp' | 'cursor', + channel: 'claude' | 'antigravity' | 'codex-skills' | 'codex-mcp' | 'cursor', wired: boolean, activation?: ActivationContext, ): void { @@ -427,17 +409,8 @@ function pushActivationHint( } break; } - case 'gemini': { - const a = activation?.gemini; - if (a?.attempted && a.success) { - lines.push(' ↳ Activate: ✓ gemini extensions link done automatically (applies after Gemini CLI restart)'); - } else if (a?.attempted && !a.success) { - lines.push(' ↳ Activate: ✗ auto attempt failed — manual:'); - lines.push(' `gemini extensions link ~/.gemini/extensions/cladding`'); - } else { - lines.push(' ↳ Activate (no gemini binary): manual:'); - lines.push(' `gemini extensions link ~/.gemini/extensions/cladding`'); - } + case 'antigravity': { + lines.push(' ↳ AGY auto-discovers ~/.gemini/config/plugins/ (applies after restart)'); break; } case 'codex-skills': @@ -477,9 +450,9 @@ export function renderSetupReport( lines.push(formatChannelLine('Claude Code', claudeState)); pushActivationHint(lines, 'claude', WIRED_STATES.has(claudeState), activation); - const geminiState = detection.gemini ? result.wiring.gemini_extension : 'skipped-not-installed'; - lines.push(formatChannelLine('Gemini CLI', geminiState)); - pushActivationHint(lines, 'gemini', WIRED_STATES.has(geminiState), activation); + const antigravityState = detection.antigravity ? result.wiring.antigravity_plugin : 'skipped-not-installed'; + lines.push(formatChannelLine('Antigravity (AGY)', antigravityState)); + pushActivationHint(lines, 'antigravity', WIRED_STATES.has(antigravityState), activation); const skillsSummary = detection.agents ? summarizeSkills(result.wiring.codex_skills) @@ -506,7 +479,7 @@ export function renderSetupReport( if (wiredCount === detectedCount && detectedCount > 0) { lines.push(`${wiredCount}/${detectedCount} detected channels wired. Status: ${result.statusFile}`); } else if (detectedCount === 0) { - lines.push('No AI tools detected. Install one of Claude Code / Codex / Gemini CLI / Cursor, then run this again.'); + lines.push('No AI tools detected. Install one of Claude Code / Codex / Antigravity / Cursor, then run this again.'); } else { lines.push(`${wiredCount}/${detectedCount} detected channels wired (some skipped/failed). Status: ${result.statusFile}`); } @@ -516,7 +489,7 @@ export function renderSetupReport( } lines.push(''); lines.push('Next steps:'); - lines.push(' 1. Restart your AI tool (Claude Code / Codex / Gemini / Cursor)'); + lines.push(' 1. Restart your AI tool (Claude Code / Codex / Antigravity / Cursor)'); lines.push(' 2. Open the project directory'); lines.push(' 3. Ask: "Apply Cladding to this project"'); lines.push(' 4. Start building — use optional Git hooks or CI when you want automatic enforcement'); @@ -542,7 +515,7 @@ function summarizeSkills(skills: ReadonlyArray): string { function countDetected(detection: HostDetection): number { return ( (detection.claude ? 1 : 0) + - (detection.gemini ? 1 : 0) + + (detection.antigravity ? 1 : 0) + (detection.agents ? 1 : 0) + (detection.codex ? 1 : 0) + (detection.cursor ? 1 : 0) @@ -553,7 +526,7 @@ function countWired(wiring: SetupResult['wiring'], detection: HostDetection): nu let n = 0; const wiredStates = new Set(['created', 'rewired', 'unchanged', 'copied']); if (detection.claude && wiredStates.has(wiring.claude_plugin)) n++; - if (detection.gemini && wiredStates.has(wiring.gemini_extension)) n++; + if (detection.antigravity && wiredStates.has(wiring.antigravity_plugin)) n++; if (detection.agents && wiring.codex_skills.some((s) => wiredStates.has(s.result))) n++; if (detection.codex && wiredStates.has(wiring.codex_mcp)) n++; if (detection.cursor && wiredStates.has(wiring.cursor_mcp)) n++; @@ -576,8 +549,8 @@ export async function runHostSetup(opts: SetupOptions = {}): Promise { if (!onboarding) return mcpPayload({status: 'unavailable', changed: false}, true); @@ -573,6 +617,7 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp }; const token = encodePreparedOnboarding(request); prepared.set(token, request); + persistPendingPreparation(cwd, challenge, token, request); return mcpPayload({ status: 'needs_confirmation', changed: false, schemaVersion: 1, token, prompt: briefing.prompt, request: briefing.request, observation: briefing.observation, @@ -604,7 +649,7 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp 'Write Cladding artifacts from the host model draft returned after clad_prepare_init. ' + 'Requires its one-time token; malformed, stale, or replayed requests do not write files.', inputSchema: { - token: z.string().min(1).max(MAX_APPROVAL_ENVELOPE_BYTES), + token: z.string().min(1).max(MAX_APPROVAL_ENVELOPE_BYTES).optional(), confirmation: z.string().min(1).describe('The user\'s separate confirmation reply, verbatim'), draft: hostDraftSchema, }, @@ -618,7 +663,10 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp annotations: {readOnlyHint: false, destructiveHint: true, idempotentHint: false}, }, async (args) => { - const request = prepared.get(args.token) ?? decodePreparedOnboarding(args.token); + const pending = loadPendingPreparation(cwd, args.confirmation.trim()); + const request = (args.token + ? prepared.get(args.token) ?? decodePreparedOnboarding(args.token) + : null) ?? pending?.request; if (!request || request.kind !== 'init') return mcpPayload({status: 'invalid_token', changed: false}, true); if (!request.approvalChallenge || args.confirmation.trim() !== request.approvalChallenge) { return mcpPayload({ @@ -628,7 +676,8 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp } if (request.snapshot !== onboardingPreparationSnapshot(cwd)) return mcpPayload({status: 'stale_preparation', changed: false}, true); if (!onboarding) return mcpPayload({status: 'unavailable', changed: false}, true); - prepared.delete(args.token); + if (args.token) prepared.delete(args.token); + removePendingPreparation(cwd, args.confirmation.trim()); const response = onboarding.renderDraft(args.draft); const rollback = captureOnboardingRollback(cwd); let init: Awaited>; @@ -661,14 +710,16 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp 'clad_prepare_clarify', { title: 'Prepare the next Cladding onboarding answer', - description: 'Read-only step. Pass the user answer verbatim, then draft the structured refinement for clad_clarify.', + description: + 'Use only after a new user message answers the displayed pending question. Pass that answer verbatim. ' + + 'Never call during the initialization approval turn and never invent an answer.', inputSchema: {answer: z.string().min(1)}, outputSchema: { status: z.string(), changed: z.boolean(), schemaVersion: z.number().optional(), token: z.string().optional(), prompt: z.string().optional(), request: z.object({mode: z.string(), intent: z.string()}).optional(), observation: z.record(z.string(), z.unknown()).optional(), error: z.string().optional(), }, - annotations: {readOnlyHint: true, destructiveHint: false, idempotentHint: true}, + annotations: {readOnlyHint: false, destructiveHint: false, idempotentHint: true}, }, async (args) => { if (!onboarding) return mcpPayload({status: 'unavailable', changed: false}, true); @@ -679,6 +730,7 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp }; const token = encodePreparedOnboarding(request); prepared.set(token, request); + persistPendingPreparation(cwd, `clarify:${args.answer}`, token, request); return mcpPayload({status: 'needs_host_draft', changed: false, schemaVersion: 1, token, prompt: briefing.prompt, request: briefing.request, observation: briefing.observation}); }, ); @@ -688,10 +740,11 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp { title: 'Answer the next Cladding onboarding question', description: - 'Apply a host-model refinement after clad_prepare_clarify. Do not invent or alter the user answer.', + 'Apply a host-model refinement only for an answer supplied in a new user message after the pending question. ' + + 'Never call during the initialization approval turn; do not invent or alter the user answer.', inputSchema: { answer: z.string().min(1).describe('The user\'s answer, verbatim'), - token: z.string().min(1).max(MAX_APPROVAL_ENVELOPE_BYTES), + token: z.string().min(1).max(MAX_APPROVAL_ENVELOPE_BYTES).optional(), draft: hostDraftSchema, }, outputSchema: { @@ -704,11 +757,15 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp annotations: {readOnlyHint: false, destructiveHint: true, idempotentHint: false}, }, async (args) => { - const request = prepared.get(args.token) ?? decodePreparedOnboarding(args.token); + const pending = loadPendingPreparation(cwd, `clarify:${args.answer}`); + const request = (args.token + ? prepared.get(args.token) ?? decodePreparedOnboarding(args.token) + : null) ?? pending?.request; if (!request || request.kind !== 'clarify' || request.answer !== args.answer) return mcpPayload({status: 'invalid_token', changed: false}, true); if (request.snapshot !== onboardingPreparationSnapshot(cwd)) return mcpPayload({status: 'stale_preparation', changed: false}, true); if (!onboarding) return mcpPayload({status: 'unavailable', changed: false}, true); - prepared.delete(args.token); + if (args.token) prepared.delete(args.token); + removePendingPreparation(cwd, `clarify:${args.answer}`); const response = onboarding.renderDraft(args.draft); const outcome = await onboarding.clarify(args.answer, {cwd, hostDispatcher: async () => response}); if (!outcome.ok) return mcpPayload({status: 'failed', changed: false, error: outcome.error ?? 'onboarding clarification failed'}, true); diff --git a/tests/cli/init-onboarding-english-source.test.ts b/tests/cli/init-onboarding-english-source.test.ts index e88d6d40..e9021240 100644 --- a/tests/cli/init-onboarding-english-source.test.ts +++ b/tests/cli/init-onboarding-english-source.test.ts @@ -62,7 +62,7 @@ describe('init-onboarding-english-source (F-5cac007a)', () => { const result = { wiring: { claude_plugin: 'created', - gemini_extension: 'skipped-not-installed', + antigravity_plugin: 'skipped-not-installed', codex_skills: [], codex_mcp: 'skipped-not-installed', cursor_mcp: 'skipped-not-installed', @@ -75,7 +75,7 @@ describe('init-onboarding-english-source (F-5cac007a)', () => { } as const; test('the wiring report ends with an English "Next steps:" block, no Hangul', () => { - const detection = {claude: true, gemini: false, codex: false, agents: false, cursor: false}; + const detection = {claude: true, antigravity: false, codex: false, agents: false, cursor: false}; const report = renderSetupReport(result, detection, {claude: {attempted: true, success: true}}); expect(report).toContain('Next steps:'); expect(report).toContain('1. Restart your AI tool'); @@ -84,7 +84,7 @@ describe('init-onboarding-english-source (F-5cac007a)', () => { }); test('the "no AI tools detected" branch is English, no Hangul', () => { - const detection = {claude: false, gemini: false, codex: false, agents: false, cursor: false}; + const detection = {claude: false, antigravity: false, codex: false, agents: false, cursor: false}; const report = renderSetupReport(result, detection, {}); expect(report).toContain('No AI tools detected'); expect(HANGUL.test(report)).toBe(false); diff --git a/tests/cli/setup.test.ts b/tests/cli/setup.test.ts index 06ae6267..d5dfcb4e 100644 --- a/tests/cli/setup.test.ts +++ b/tests/cli/setup.test.ts @@ -20,7 +20,7 @@ describe('runHostSetup', () => { home = mkdtempSync(join(tmpdir(), 'clad-setup-home-')); pkgRoot = mkdtempSync(join(tmpdir(), 'clad-setup-pkg-')); // Minimal pkg skeleton mirroring the real cladding layout the wirer expects. - mkdirSync(join(pkgRoot, 'plugins', 'gemini-cli'), {recursive: true}); + mkdirSync(join(pkgRoot, 'plugins', 'antigravity'), {recursive: true}); mkdirSync(join(pkgRoot, 'plugins', 'codex', 'skills', 'init'), {recursive: true}); mkdirSync(join(pkgRoot, 'plugins', 'codex', 'skills', 'check'), {recursive: true}); writeFileSync(join(pkgRoot, 'package.json'), JSON.stringify({version: '0.4.0'})); @@ -35,12 +35,12 @@ describe('runHostSetup', () => { test('wires only the host channels whose home directory exists', async () => { mkdirSync(join(home, '.claude'), {recursive: true}); mkdirSync(join(home, '.agents'), {recursive: true}); - // .gemini and .codex intentionally absent. + // Antigravity and Codex intentionally absent. const result = await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); expect(result.wiring.claude_plugin).toBe('created'); - expect(result.wiring.gemini_extension).toBe('skipped-not-installed'); + expect(result.wiring.antigravity_plugin).toBe('skipped-not-installed'); expect(result.wiring.codex_mcp).toBe('skipped-not-installed'); expect(result.wiring.codex_skills.length).toBeGreaterThan(0); expect(existsSync(join(home, '.gemini'))).toBe(false); @@ -62,13 +62,13 @@ describe('runHostSetup', () => { test('delta-wires a host that was not installed on the previous run', async () => { mkdirSync(join(home, '.claude'), {recursive: true}); const first = await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); - expect(first.wiring.gemini_extension).toBe('skipped-not-installed'); + expect(first.wiring.antigravity_plugin).toBe('skipped-not-installed'); - // Simulate: user installs Gemini CLI between the two runs. - mkdirSync(join(home, '.gemini'), {recursive: true}); + // Simulate: user installs Antigravity between the two runs. + mkdirSync(join(home, '.gemini', 'config'), {recursive: true}); const second = await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); - expect(second.wiring.gemini_extension).toBe('created'); + expect(second.wiring.antigravity_plugin).toBe('created'); expect(second.wiring.claude_plugin).toBe('unchanged'); }); @@ -195,7 +195,7 @@ describe('MCP serve launch resolution', () => { beforeEach(() => { home = mkdtempSync(join(tmpdir(), 'clad-setup-home-')); pkgRoot = mkdtempSync(join(tmpdir(), 'clad-setup-pkg-')); - mkdirSync(join(pkgRoot, 'plugins', 'gemini-cli'), {recursive: true}); + mkdirSync(join(pkgRoot, 'plugins', 'antigravity'), {recursive: true}); mkdirSync(join(pkgRoot, 'plugins', 'codex', 'skills', 'init'), {recursive: true}); writeFileSync(join(pkgRoot, 'package.json'), JSON.stringify({version: '0.6.0'})); }); @@ -269,7 +269,7 @@ describe('activation (AC-012) — non-interactive, injectable, opt-out', () => { beforeEach(() => { home = mkdtempSync(join(tmpdir(), 'clad-setup-home-')); pkgRoot = mkdtempSync(join(tmpdir(), 'clad-setup-pkg-')); - mkdirSync(join(pkgRoot, 'plugins', 'gemini-cli'), {recursive: true}); + mkdirSync(join(pkgRoot, 'plugins', 'antigravity'), {recursive: true}); writeFileSync(join(pkgRoot, 'package.json'), JSON.stringify({version: '0.6.0'})); }); @@ -304,7 +304,6 @@ describe('activation (AC-012) — non-interactive, injectable, opt-out', () => { quiet: true, activators: { claude: (p) => (calls.push(p), {attempted: true, success: true}), - gemini: (p) => (calls.push(p), {attempted: true, success: true}), }, }); @@ -333,7 +332,7 @@ describe('setup report (AC-010) and init wire notices (AC-006/AC-007)', () => { const result = { wiring: { claude_plugin: 'created', - gemini_extension: 'skipped-not-installed', + antigravity_plugin: 'skipped-not-installed', codex_skills: [], codex_mcp: 'skipped-not-installed', cursor_mcp: 'skipped-not-installed', @@ -344,7 +343,7 @@ describe('setup report (AC-010) and init wire notices (AC-006/AC-007)', () => { cladding_version: '0.6.0', last_setup_version: null, } as const; - const detection = {claude: true, gemini: false, codex: false, agents: false, cursor: false}; + const detection = {claude: true, antigravity: false, codex: false, agents: false, cursor: false}; const report = renderSetupReport(result, detection, {}); diff --git a/tests/docs-prune.test.ts b/tests/docs-prune.test.ts index 5431abed..2e81b88d 100644 --- a/tests/docs-prune.test.ts +++ b/tests/docs-prune.test.ts @@ -132,13 +132,13 @@ describe('AC-4c28425b · deleted docs leave zero dangling references outside his } }); - test('src/init/host-setup.ts carries the Gemini npm-delegation WHY directly above wireGemini', () => { + test('src/init/host-setup.ts carries the Antigravity npm-delegation WHY directly above wireAntigravity', () => { const hostSetup = read('src/init/host-setup.ts'); - const fnIdx = hostSetup.indexOf('function wireGemini('); - expect(fnIdx, 'wireGemini function present').toBeGreaterThan(-1); + const fnIdx = hostSetup.indexOf('function wireAntigravity('); + expect(fnIdx, 'wireAntigravity function present').toBeGreaterThan(-1); const before = hostSetup.slice(Math.max(0, fnIdx - 1200), fnIdx); - expect(before, 'load-bearing WHY: the symlink-mutation hazard').toContain('mutates the shared copy for every project'); - expect(before, 'names the mechanism: symlink wiring').toContain('SYMLINK'); + expect(before, 'load-bearing WHY: AGY discovery path').toContain('~/.gemini/config/plugins'); + expect(before, 'names the npm-delegated MCP launch').toContain('globally installed `clad`'); expect(before, 'relocates the reasoning, not just a pointer to the deleted doc').not.toContain(MARKETPLACE_DOC); }); diff --git a/tests/serve/init-tools.test.ts b/tests/serve/init-tools.test.ts index c34f2298..192456ee 100644 --- a/tests/serve/init-tools.test.ts +++ b/tests/serve/init-tools.test.ts @@ -128,6 +128,25 @@ describe('serve/server — natural-language init tools', () => { } }); + test('process-per-turn hosts can apply by exact challenge when they discard opaque tool tokens', async () => { + const first = await makePair(dir); + const prepared = await prepare(first.client, {mode: 'idea', intent: 'B2B payment SaaS'}); + await first.cleanup(); + expect(readdirSync(dir)).toEqual([]); + + const second = await makePair(dir); + try { + const result = await second.client.callTool({name: 'clad_init', arguments: { + confirmation: prepared.confirmation, + draft, + }}); + expect(result.isError).not.toBe(true); + expect(payload(result)).toMatchObject({changed: true, onboardingSource: 'host'}); + } finally { + await second.cleanup(); + } + }); + test('initial request is not accepted as the separate write confirmation', async () => { const {client, cleanup} = await makePair(dir); try { From 19dce90f5552c1b082596db86bb7ddc7fdbe3215 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 14 Jul 2026 23:22:51 +0900 Subject: [PATCH 09/28] chore: refresh verification attestation --- spec/attestation.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 0e17e1b2..102f5f08 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -21,10 +21,10 @@ attested_modules: CHANGELOG.md: d437104f3e6b98c3 CLAUDE.md: d81d8832976cd5ee GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 1a020a2174f7e1a6 - README.ko.html: 90b6c2c123e863fa - README.ko.md: b885576f23db80e0 - README.md: 3d3891138a9a9d08 + README.html: 72dc9b853365ca10 + README.ko.html: 5533e88bd2af63ab + README.ko.md: f4ee154ddc062a57 + README.md: 1490db061e0a7651 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -62,20 +62,20 @@ attested_modules: docs/spec-ids-multi-dev.md: 28d58e84879f58b1 docs/ssot-model.md: 35b911d1138b725e docs/ssot-testing.md: abf3b2bd5acb29a1 - package.json: 0bb13c2629d681a4 + package.json: dadf1cd78af4d4a3 plugins/claude-code/.claude-plugin/plugin.json: 7493e69dee9ae24d plugins/claude-code/agents/developer.md: 40af2943253f6c72 plugins/claude-code/agents/observability.md: 5ea8f14b1c9b4a61 plugins/claude-code/agents/orchestrator.md: 18f41e1dbfe6d95b plugins/claude-code/agents/planner.md: 934753c28d5f1287 plugins/claude-code/agents/reviewer.md: 9c4e095e60040473 - plugins/claude-code/commands/init.md: 5003335bed70cc98 + plugins/claude-code/commands/init.md: 2d19f8ffebf41bb2 plugins/claude-code/hooks/hooks.json: 42321ead26fb1da8 plugins/codex/.codex-plugin/plugin.json: e2898491a8fd62b8 plugins/codex/.mcp.json: 43e3f4b2af24aa18 plugins/codex/skills/check/SKILL.md: 455d912ce1d47b5a plugins/codex/skills/developer/SKILL.md: 40af2943253f6c72 - plugins/codex/skills/init/SKILL.md: 5003335bed70cc98 + plugins/codex/skills/init/SKILL.md: 2d19f8ffebf41bb2 plugins/codex/skills/observability/SKILL.md: 5ea8f14b1c9b4a61 plugins/codex/skills/orchestrator/SKILL.md: 18f41e1dbfe6d95b plugins/codex/skills/planner/SKILL.md: 934753c28d5f1287 @@ -86,18 +86,18 @@ attested_modules: plugins/codex/skills/sync/SKILL.md: 775c0f990a52a3d9 plugins/gemini-cli/GEMINI.md: ba08eaf2cd557a65 plugins/gemini-cli/commands/README.md: 3527d771578431bd - plugins/gemini-cli/commands/init.toml: 708f110989531f36 + plugins/gemini-cli/commands/init.toml: a91afdccf4206c59 plugins/gemini-cli/gemini-extension.json: 47685e98f1f67e11 - scripts/build-plugin.mjs: 57ffa3f0e6317a6b + scripts/build-plugin.mjs: f2b96f80a0b52134 scripts/build.mjs: 3a4b204063024ef1 scripts/migrate-dogfood-v0.3.16.mjs: 1e265fb370019996 scripts/shard-spec.ts: 0c728bbc1e869421 scripts/version-bump.mjs: 05a3aa76667ed9ce skills/check/SKILL.md: 455d912ce1d47b5a skills/checkpoint/SKILL.md: f723e8cfb8286a64 - skills/clarify/SKILL.md: 060d5312de840370 + skills/clarify/SKILL.md: 5d08bbb821258d03 skills/doctor/SKILL.md: 6581c6c900c72d68 - skills/init/SKILL.md: 5003335bed70cc98 + skills/init/SKILL.md: 2d19f8ffebf41bb2 skills/oracle/SKILL.md: 0986572a0a5604f6 skills/rollback/SKILL.md: d472dc3a562b347b skills/route/SKILL.md: 5958830fef280c67 @@ -195,7 +195,7 @@ attested_modules: src/init/agents-md.ts: cb15264f0a0f2f8c src/init/git-hook.ts: 4e02f177b3764ae8 src/init/host-instructions.ts: f6d10695ef0c4763 - src/init/host-setup.ts: 9de81d8243ef93f7 + src/init/host-setup.ts: b12ffb4a11019b45 src/optimizer: a4d0f0eb87fed960 src/optimizer/code-excerpt.ts: e2c4598efcd28d2a src/optimizer/context-slice.ts: b5864aaed1e7ae48 @@ -218,7 +218,7 @@ attested_modules: src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 - src/serve/server.ts: bc085ce656060248 + src/serve/server.ts: 4d4e341e3d05a706 src/spec: a4d0f0eb87fed960 src/spec/attestation.ts: 294a1e99c42d4aef src/spec/cli.ts: 7a9bcd0f66677810 From 6c0266f1d39477a84bb3fdc72a0451ceb785197b Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 14 Jul 2026 23:40:46 +0900 Subject: [PATCH 10/28] docs: verify Cursor Agent onboarding --- README.html | 2 +- README.ja.md | 2 +- README.ko.html | 2 +- README.ko.md | 2 +- README.md | 4 ++-- README.zh.md | 2 +- docs/dogfood/cursor-agent-2026-07-14.md | 21 +++++++++++++++++++++ docs/dogfood/matrix.md | 6 +++--- docs/setup.md | 7 ++++--- 9 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 docs/dogfood/cursor-agent-2026-07-14.md diff --git a/README.html b/README.html index 6c14e2e4..563f550b 100644 --- a/README.html +++ b/README.html @@ -489,7 +489,7 @@

1. Install and connect your AI tools

2. Start your AI tool from the project

cd <project>
-

Next step: Start your AI tool with this project as its workspace. Run Codex, Claude Code, or Antigravity (agy) from this directory, or open this folder in Cursor. The connection created by clad setup takes effect in the new session.

+

Next step: Start your AI tool with this project as its workspace. Run Codex, Claude Code, Antigravity (agy), or Cursor Agent (cursor-agent) from this directory, or open this folder in Cursor. The connection created by clad setup takes effect in the new session.

3. Apply Cladding once

Choose the starting point that fits and say it naturally in your AI tool.

diff --git a/README.ja.md b/README.ja.md index 6f67b3f0..20121968 100644 --- a/README.ja.md +++ b/README.ja.md @@ -256,7 +256,7 @@ clad setup # AI ツールを自動配線(Claude · Codex · Ant cd ``` -> **次のステップ:** このプロジェクトをワークスペースとして AI ツールを新しく起動する。Codex・Claude Code・Antigravity(`agy`)はこのディレクトリから実行し、Cursor ではこのフォルダを開く。`clad setup` の接続は新しいセッションから有効になる。 +> **次のステップ:** このプロジェクトをワークスペースとして AI ツールを新しく起動する。Codex・Claude Code・Antigravity(`agy`)・Cursor Agent(`cursor-agent`)はこのディレクトリから実行し、Cursor IDE ではこのフォルダを開く。`clad setup` の接続は新しいセッションから有効になる。 ### 3. Cladding を一度適用する diff --git a/README.ko.html b/README.ko.html index e5407729..c3ff107d 100644 --- a/README.ko.html +++ b/README.ko.html @@ -525,7 +525,7 @@

1. 설치하고 AI 도구 연결하기

2. 프로젝트에서 AI 도구 실행하기

cd <project>
-

다음 단계: 이 프로젝트 폴더에서 사용하는 AI 도구를 새로 시작한다. Codex · Claude Code · Antigravity(agy)는 이 디렉터리에서 실행하고, Cursor는 이 폴더를 연다. clad setup의 연결은 새 세션부터 적용된다.

+

다음 단계: 이 프로젝트 폴더에서 사용하는 AI 도구를 새로 시작한다. Codex · Claude Code · Antigravity(agy) · Cursor Agent(cursor-agent)는 이 디렉터리에서 실행하고, Cursor IDE는 이 폴더를 연다. clad setup의 연결은 새 세션부터 적용된다.

3. 프로젝트에 Cladding 한 번 적용하기

자신의 시작 상황에 맞는 요청을 AI 도구에 자연스럽게 말한다.

diff --git a/README.ko.md b/README.ko.md index f2b0893d..e1e7b5e9 100644 --- a/README.ko.md +++ b/README.ko.md @@ -255,7 +255,7 @@ clad setup # AI 도구 자동 연결 (Claude · Codex · Antigrav cd ``` -> **다음 단계:** 이 프로젝트 폴더에서 사용하는 AI 도구를 새로 시작한다. Codex · Claude Code · Antigravity(`agy`)는 이 디렉터리에서 실행하고, Cursor는 이 폴더를 연다. `clad setup`의 연결은 새 세션부터 적용된다. +> **다음 단계:** 이 프로젝트 폴더에서 사용하는 AI 도구를 새로 시작한다. Codex · Claude Code · Antigravity(`agy`) · Cursor Agent(`cursor-agent`)는 이 디렉터리에서 실행하고, Cursor IDE는 이 폴더를 연다. `clad setup`의 연결은 새 세션부터 적용된다. ### 3. 프로젝트에 Cladding 한 번 적용하기 diff --git a/README.md b/README.md index ee8c21ee..8083fca9 100644 --- a/README.md +++ b/README.md @@ -252,7 +252,7 @@ Run these once on your machine, from any directory. `clad setup` connects suppor cd ``` -> **Next step:** Start your AI tool with this project as its workspace. Run Codex, Claude Code, or Antigravity (`agy`) from this directory, or open this folder in Cursor. The connection created by `clad setup` takes effect in the new session. +> **Next step:** Start your AI tool with this project as its workspace. Run Codex, Claude Code, Antigravity (`agy`), or Cursor Agent (`cursor-agent`) from this directory, or open this folder in Cursor. The connection created by `clad setup` takes effect in the new session. ### 3. Apply Cladding once @@ -295,7 +295,7 @@ Implement email sign-in, including tests. There is nothing new to memorize. For host-specific invocation, stricter Git/CI enforcement, and verified host status, see [setup details](docs/setup.md). - + diff --git a/README.zh.md b/README.zh.md index ff6769d9..0f74197c 100644 --- a/README.zh.md +++ b/README.zh.md @@ -252,7 +252,7 @@ clad setup # 自动接通你的 AI 工具(Claude · Codex · An cd ``` -> **下一步:** 以此项目文件夹作为工作区,重新启动所使用的 AI 工具。在该目录中运行 Codex、Claude Code 或 Antigravity(`agy`);如果使用 Cursor,则打开此文件夹。`clad setup` 创建的连接会从新会话开始生效。 +> **下一步:** 以此项目文件夹作为工作区,重新启动所使用的 AI 工具。在该目录中运行 Codex、Claude Code、Antigravity(`agy`)或 Cursor Agent(`cursor-agent`);如果使用 Cursor IDE,则打开此文件夹。`clad setup` 创建的连接会从新会话开始生效。 ### 3. 为项目应用一次 Cladding diff --git a/docs/dogfood/cursor-agent-2026-07-14.md b/docs/dogfood/cursor-agent-2026-07-14.md new file mode 100644 index 00000000..acdb17db --- /dev/null +++ b/docs/dogfood/cursor-agent-2026-07-14.md @@ -0,0 +1,21 @@ +# Cursor Agent onboarding campaign — 2026-07-14 + +- Host: Cursor Agent `2026.07.09-a3815c0` +- Interface: headless CLI (`cursor-agent --print --resume`) +- Transport: global stdio MCP through `~/.cursor/mcp.json` +- Exposed tools: 21 +- Result: verified + +## Live cases + +| Case | Preview before writes | Separate exact approval | Result | +|---|---:|---:|---| +| Idea only | pass | pass | initialized; two unresolved product choices returned to the user without inventing answers | +| Planning document | pass | pass | initialized from `plan.md` with no unnecessary follow-up | +| Existing project | pass | pass | observed ESM, two-space indentation, JSDoc, immutability, and the Node test runner before adoption | +| Uninitialized control | n/a | n/a | ordinary file request created only the requested file; no Cladding artifacts or intervention | + +The campaign ran with Cursor's force and MCP auto-approval flags inside isolated temporary +workspaces. Even with host-side tool permission granted, Cladding made no project changes before +the exact approval phrase was supplied in a resumed conversation. The control workspace contained +only `greeting.txt` afterward. diff --git a/docs/dogfood/matrix.md b/docs/dogfood/matrix.md index 1b524db8..f646420c 100644 --- a/docs/dogfood/matrix.md +++ b/docs/dogfood/matrix.md @@ -1,7 +1,7 @@ # Host support matrix - + - Cladding version: `0.7.1` - Generated: 2026-07-03T02:42:22.205Z @@ -11,7 +11,7 @@ | claude | pass | pass | pass | — | verified | | antigravity | pass | pass | pass | pass | verified | | codex | not-run | not-run | not-run | — | not-run | -| cursor | — | — | — | — | not-run | +| cursor | pass | pass | pass | pass | verified | **Legend** @@ -23,6 +23,6 @@ - `antigravity`: live onboarding campaign passed; see `antigravity-cli-2026-07-14.md`. - `codex`: binary not on PATH -- `cursor`: Cursor not detected (~/.cursor absent) — run `clad setup` to wire +- `cursor`: live Cursor Agent onboarding campaign passed; see `cursor-agent-2026-07-14.md`. > Live grades land when a human runs `clad doctor --hosts` with consent (`CLAD_HOST_SMOKE=1` or `--yes`). Without consent this baseline records only what is checkable for free — Cursor wiring — and leaves the LLM-driven surfaces `not-run`. diff --git a/docs/setup.md b/docs/setup.md index 23c2447e..04171808 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -22,8 +22,9 @@ after installing a new AI tool. **Verification level (honesty note).** Claude Code is fully verified through real-usage campaigns (including real-time intervention). Codex onboarding is live-verified for idea, planning-document, existing-project, and uninitialized control cases. Antigravity 1.1.0 is also -live-verified for all three onboarding cases plus the uninitialized control case. Cursor wires -automatically, but its real-usage onboarding verification is still pending. (The machine-readable claim lives in the README's `clad:host-claims` +live-verified for all three onboarding cases plus the uninitialized control case. Cursor Agent +`2026.07.09-a3815c0` is live-verified for the same four cases through its headless CLI and global +MCP configuration. (The machine-readable claim lives in the README's `clad:host-claims` fence, which `HOST_CLAIM_DRIFT` polices against `docs/dogfood/matrix.md`.) ## About the MCP server @@ -48,7 +49,7 @@ project, asking about Cladding, or running `clad setup` are not consent. | Claude Code | `Apply Cladding to this project` | `/cladding:init` | | Codex | `Apply Cladding to this project` | Type `$cladding`, then choose `init (cladding)` | | Antigravity | `Apply Cladding to this project` | `/cladding:init` from the installed plugin | -| Cursor | `Apply Cladding to this project` | Natural language routes through the connected onboarding tool | +| Cursor IDE / Agent | `Apply Cladding to this project` | Natural language routes through the connected onboarding tool | ## Upgrading From 0051fe213d21680336f5a5c378a5ac19e605bbd4 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 14 Jul 2026 23:41:18 +0900 Subject: [PATCH 11/28] chore: refresh verification attestation --- spec/attestation.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 102f5f08..a60f6ce8 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -21,10 +21,10 @@ attested_modules: CHANGELOG.md: d437104f3e6b98c3 CLAUDE.md: d81d8832976cd5ee GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 72dc9b853365ca10 - README.ko.html: 5533e88bd2af63ab - README.ko.md: f4ee154ddc062a57 - README.md: 1490db061e0a7651 + README.html: 54c672f9db30bd61 + README.ko.html: 3852cdae52ad9328 + README.ko.md: fcc987d9e6b9450c + README.md: 033860f14ba378f8 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 From 855febde591df9f2a4d3e1a26013f0fe5252ee02 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 14 Jul 2026 23:47:29 +0900 Subject: [PATCH 12/28] docs: clarify install and update flows --- README.html | 23 +++++++++++++++-------- README.ja.md | 21 ++++++++++++++------- README.ko.html | 23 +++++++++++++++-------- README.ko.md | 21 ++++++++++++++------- README.md | 27 ++++++++++++++++++++------- README.zh.md | 21 ++++++++++++++------- docs/setup.md | 5 +++-- 7 files changed, 95 insertions(+), 46 deletions(-) diff --git a/README.html b/README.html index 563f550b..6bfbafb3 100644 --- a/README.html +++ b/README.html @@ -481,15 +481,20 @@

Ecosystem

Install

-

1. Install and connect your AI tools

+

1. Install once on your machine

npm install -g cladding   # the cladding CLI
 clad setup                # auto-wire your AI tools (Claude · Codex · Antigravity · Cursor)
-

Run these once on your machine, from any directory. clad setup connects supported AI tools globally; it does not create or modify project files.

+

Run both commands from any directory. clad setup connects the AI tools already installed on this machine; it does not create or modify project files. Run it again after adding another supported AI tool.

2. Start your AI tool from the project

-
cd <project>
-

Next step: Start your AI tool with this project as its workspace. Run Codex, Claude Code, Antigravity (agy), or Cursor Agent (cursor-agent) from this directory, or open this folder in Cursor. The connection created by clad setup takes effect in the new session.

+
cd <project>
+
+# Start one of the AI tools from this directory:
+codex          # or: claude
+agy            # Antigravity
+cursor-agent   # Cursor Agent
+

Use only the command for your AI tool. For Cursor IDE, open <project> as the workspace instead. Always start a new AI session after clad setup; changing directory alone is not enough.

3. Apply Cladding once

Choose the starting point that fits and say it naturally in your AI tool.

@@ -515,12 +520,14 @@

Update

Ask your AI tool (recommended)

From your project, say:

Update cladding to the latest version.
-

If your host allows terminal and global-install access, the AI runs both update steps and explains any new drift. Otherwise, it shows you the commands to approve or run yourself.

+

If the AI tool has terminal and global-install permission, it updates the CLI, refreshes host wiring, updates the current project, and explains any new drift. Otherwise, it shows the commands for you to approve or run.

Or update from the terminal

npm update -g cladding   # 1. get the new version
-cd <project>             # 2. your project
-clad update              # 3. align this project with the installed version
-

The update preserves your authored code, feature/spec content, and documentation. It may refresh derived inventory/index data and the Cladding-managed block in AGENTS.md or CLAUDE.md. If the new version reports drift, hand that result to your AI tool:

+clad setup # 2. refresh this machine's AI-tool connections + +cd <project> # 3. enter a Cladding project +clad update # 4. align that project with the installed version +

Run the first two commands once per machine update. Run clad update in each Cladding project you want to upgrade. It preserves authored code, feature/spec content, and documentation; only derived data and Cladding-managed instruction blocks may be refreshed. If the new version reports drift, hand that result to your AI tool:

Reconcile the drift the update flagged.
diff --git a/README.ja.md b/README.ja.md index 20121968..46f5c4f9 100644 --- a/README.ja.md +++ b/README.ja.md @@ -241,22 +241,27 @@ cladding の差別化点は *組み合わせ* にある — 上のカテゴリ ## Install -### 1. インストールして AI ツールを接続する +### 1. マシンに一度インストールする ```bash npm install -g cladding # cladding CLI をインストール clad setup # AI ツールを自動配線(Claude · Codex · Antigravity · Cursor) ``` -上のコマンドはどのディレクトリからでも実行でき、マシンごとに一度だけでよい。`clad setup` は対応する AI ツールをグローバルに接続するだけで、プロジェクトファイルは作成・変更しない。 +二つのコマンドはどのディレクトリからでも実行できる。`clad setup` はこのマシンにインストール済みの AI ツールを接続するだけで、プロジェクトファイルは作成・変更しない。対応する AI ツールを後から追加した場合は、`clad setup` だけを再実行する。 ### 2. プロジェクトから AI ツールを起動する ```bash cd + +# このディレクトリから、使用する AI ツールを一つ起動する: +codex # または: claude +agy # Antigravity +cursor-agent # Cursor Agent ``` -> **次のステップ:** このプロジェクトをワークスペースとして AI ツールを新しく起動する。Codex・Claude Code・Antigravity(`agy`)・Cursor Agent(`cursor-agent`)はこのディレクトリから実行し、Cursor IDE ではこのフォルダを開く。`clad setup` の接続は新しいセッションから有効になる。 +使用する AI ツールのコマンドを一つだけ実行する。Cursor IDE の場合は `` をワークスペースとして開く。`clad setup` の後は必ず新しい AI セッションを開始する。`cd` だけで終えてはいけない。 ### 3. Cladding を一度適用する @@ -308,17 +313,19 @@ docs/plan.md を基に cladding を適用して。 cladding を最新版に更新して。 ``` -ホストにターミナルとグローバルインストールの権限があれば、AI が両方の更新手順を実行し、新たな乖離を説明する。権限がなければ、承認または手動実行するコマンドを案内する。 +AI ツールにターミナルとグローバルインストールの権限があれば、CLI の更新、ホスト配線の更新、現在のプロジェクトの更新を実行し、新たな乖離を説明する。権限がなければ、承認または手動実行するコマンドを案内する。 ### またはターミナルで直接更新する ```bash npm update -g cladding # 1. 新しいバージョンを入れる -cd # 2. プロジェクトへ移動 -clad update # 3. プロジェクトをインストール済みバージョンに合わせる +clad setup # 2. このマシンの AI ツール接続を更新する + +cd # 3. Cladding プロジェクトへ移動 +clad update # 4. プロジェクトをインストール済みバージョンに合わせる ``` -更新はユーザーが作成したコード・機能や spec の本文・ドキュメントを保持する。派生した inventory/index と、`AGENTS.md` または `CLAUDE.md` の Cladding 管理ブロックは新しいバージョンに合わせて更新される場合がある。新しいバージョンが乖離を報告したら、その結果を AI ツールに渡せばよい: +最初の二つはマシンの更新ごとに一度だけ実行する。`clad update` は更新する各 Cladding プロジェクトで実行する。ユーザーが作成したコード・機能や spec の本文・ドキュメントは保持され、派生データと Cladding 管理の指示ブロックだけが更新される場合がある。新しいバージョンが乖離を報告したら、その結果を AI ツールに渡せばよい: ``` 更新で指摘された乖離を解消して。 diff --git a/README.ko.html b/README.ko.html index c3ff107d..c30df924 100644 --- a/README.ko.html +++ b/README.ko.html @@ -517,15 +517,20 @@

인접 도구와의 차이

Install

-

1. 설치하고 AI 도구 연결하기

+

1. 컴퓨터에 한 번 설치하기

npm install -g cladding   # cladding CLI 설치
 clad setup                # AI 도구 자동 연결 (Claude · Codex · Antigravity · Cursor)
-

위 명령은 어느 디렉터리에서든 실행할 수 있으며, 컴퓨터마다 한 번이면 된다. clad setup은 지원하는 AI 도구를 전역으로 연결할 뿐 프로젝트 파일을 만들거나 수정하지 않는다.

+

두 명령은 어느 디렉터리에서든 실행할 수 있다. clad setup은 이 컴퓨터에 이미 설치된 AI 도구를 연결할 뿐 프로젝트 파일을 만들거나 수정하지 않는다. 지원하는 AI 도구를 나중에 추가했다면 clad setup만 다시 실행한다.

2. 프로젝트에서 AI 도구 실행하기

-
cd <project>
-

다음 단계: 이 프로젝트 폴더에서 사용하는 AI 도구를 새로 시작한다. Codex · Claude Code · Antigravity(agy) · Cursor Agent(cursor-agent)는 이 디렉터리에서 실행하고, Cursor IDE는 이 폴더를 연다. clad setup의 연결은 새 세션부터 적용된다.

+
cd <project>
+
+# 이 디렉터리에서 사용하는 AI 도구 하나를 실행한다:
+codex          # 또는: claude
+agy            # Antigravity
+cursor-agent   # Cursor Agent
+

자신이 사용하는 AI 도구의 명령 하나만 실행하면 된다. Cursor IDE는 <project> 폴더를 작업공간으로 연다. clad setup 뒤에는 반드시 AI 도구를 새 세션으로 시작한다. cd만 실행하고 끝내면 안 된다.

3. 프로젝트에 Cladding 한 번 적용하기

자신의 시작 상황에 맞는 요청을 AI 도구에 자연스럽게 말한다.

@@ -551,12 +556,14 @@

Update

AI 도구에 요청하기 (추천)

프로젝트에서 다음과 같이 말한다:

cladding을 최신 버전으로 업데이트해줘.
-

호스트에 터미널 및 전역 설치 권한이 있으면 AI가 두 업데이트 단계를 실행하고 새로 발견한 어긋남을 설명한다. 권한이 없으면 승인하거나 직접 실행할 명령을 안내한다.

+

AI 도구에 터미널 및 전역 설치 권한이 있으면 CLI 업데이트, 호스트 배선 갱신, 현재 프로젝트 업데이트를 수행하고 새로 발견한 어긋남을 설명한다. 권한이 없으면 승인하거나 직접 실행할 명령을 안내한다.

또는 터미널에서 직접 업데이트하기

npm update -g cladding   # 1. 새 버전 받기
-cd <project>             # 2. 프로젝트로 이동
-clad update              # 3. 설치된 버전에 프로젝트 맞추기
-

업데이트는 사용자가 작성한 코드 · 기능/스펙 본문 · 문서를 보존한다. 파생된 인벤토리와 인덱스, AGENTS.md 또는 CLAUDE.md의 Cladding 관리 블록은 새 버전에 맞게 갱신될 수 있다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다:

+clad setup # 2. 이 컴퓨터의 AI 도구 연결 갱신 + +cd <project> # 3. Cladding 프로젝트로 이동 +clad update # 4. 프로젝트를 설치된 버전에 맞추기 +

앞의 두 명령은 컴퓨터에서 업데이트할 때 한 번만 실행한다. clad update는 업데이트하려는 각 Cladding 프로젝트에서 실행한다. 사용자가 작성한 코드 · 기능/스펙 본문 · 문서는 보존되며, 파생 데이터와 Cladding 관리 지침 블록만 갱신될 수 있다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다:

업데이트가 짚은 어긋남을 정리해줘.
diff --git a/README.ko.md b/README.ko.md index e1e7b5e9..0b7e0aed 100644 --- a/README.ko.md +++ b/README.ko.md @@ -240,22 +240,27 @@ cladding의 차별점은 *결합* — 위 카테고리의 핵심을 *하나의 ## Install -### 1. 설치하고 AI 도구 연결하기 +### 1. 컴퓨터에 한 번 설치하기 ```bash npm install -g cladding # cladding CLI 설치 clad setup # AI 도구 자동 연결 (Claude · Codex · Antigravity · Cursor) ``` -위 명령은 어느 디렉터리에서든 실행할 수 있으며, 컴퓨터마다 한 번이면 된다. `clad setup`은 지원하는 AI 도구를 전역으로 연결할 뿐 프로젝트 파일을 만들거나 수정하지 않는다. +두 명령은 어느 디렉터리에서든 실행할 수 있다. `clad setup`은 이 컴퓨터에 이미 설치된 AI 도구를 연결할 뿐 프로젝트 파일을 만들거나 수정하지 않는다. 지원하는 AI 도구를 나중에 추가했다면 `clad setup`만 다시 실행한다. ### 2. 프로젝트에서 AI 도구 실행하기 ```bash cd + +# 이 디렉터리에서 사용하는 AI 도구 하나를 실행한다: +codex # 또는: claude +agy # Antigravity +cursor-agent # Cursor Agent ``` -> **다음 단계:** 이 프로젝트 폴더에서 사용하는 AI 도구를 새로 시작한다. Codex · Claude Code · Antigravity(`agy`) · Cursor Agent(`cursor-agent`)는 이 디렉터리에서 실행하고, Cursor IDE는 이 폴더를 연다. `clad setup`의 연결은 새 세션부터 적용된다. +자신이 사용하는 AI 도구의 명령 하나만 실행하면 된다. Cursor IDE는 `` 폴더를 작업공간으로 연다. `clad setup` 뒤에는 반드시 AI 도구를 새 세션으로 시작한다. `cd`만 실행하고 끝내면 안 된다. ### 3. 프로젝트에 Cladding 한 번 적용하기 @@ -307,17 +312,19 @@ docs/plan.md를 기준으로 cladding을 적용해줘. cladding을 최신 버전으로 업데이트해줘. ``` -호스트에 터미널 및 전역 설치 권한이 있으면 AI가 두 업데이트 단계를 실행하고 새로 발견한 어긋남을 설명한다. 권한이 없으면 승인하거나 직접 실행할 명령을 안내한다. +AI 도구에 터미널 및 전역 설치 권한이 있으면 CLI 업데이트, 호스트 배선 갱신, 현재 프로젝트 업데이트를 수행하고 새로 발견한 어긋남을 설명한다. 권한이 없으면 승인하거나 직접 실행할 명령을 안내한다. ### 또는 터미널에서 직접 업데이트하기 ```bash npm update -g cladding # 1. 새 버전 받기 -cd # 2. 프로젝트로 이동 -clad update # 3. 설치된 버전에 프로젝트 맞추기 +clad setup # 2. 이 컴퓨터의 AI 도구 연결 갱신 + +cd # 3. Cladding 프로젝트로 이동 +clad update # 4. 프로젝트를 설치된 버전에 맞추기 ``` -업데이트는 사용자가 작성한 코드 · 기능/스펙 본문 · 문서를 보존한다. 파생된 인벤토리와 인덱스, `AGENTS.md` 또는 `CLAUDE.md`의 Cladding 관리 블록은 새 버전에 맞게 갱신될 수 있다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다: +앞의 두 명령은 컴퓨터에서 업데이트할 때 한 번만 실행한다. `clad update`는 업데이트하려는 각 Cladding 프로젝트에서 실행한다. 사용자가 작성한 코드 · 기능/스펙 본문 · 문서는 보존되며, 파생 데이터와 Cladding 관리 지침 블록만 갱신될 수 있다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다: ``` 업데이트가 짚은 어긋남을 정리해줘. diff --git a/README.md b/README.md index 8083fca9..894d120c 100644 --- a/README.md +++ b/README.md @@ -237,22 +237,29 @@ The distinction is the *combination* — binding those cores into *one verificat ## Install -### 1. Install and connect your AI tools +### 1. Install once on your machine ```bash npm install -g cladding # the cladding CLI clad setup # auto-wire your AI tools (Claude · Codex · Antigravity · Cursor) ``` -Run these once on your machine, from any directory. `clad setup` connects supported AI tools globally; it does not create or modify project files. +Run both commands from any directory. `clad setup` connects the AI tools already installed on this +machine; it does not create or modify project files. Run it again after adding another supported AI tool. ### 2. Start your AI tool from the project ```bash cd + +# Start one of the AI tools from this directory: +codex # or: claude +agy # Antigravity +cursor-agent # Cursor Agent ``` -> **Next step:** Start your AI tool with this project as its workspace. Run Codex, Claude Code, Antigravity (`agy`), or Cursor Agent (`cursor-agent`) from this directory, or open this folder in Cursor. The connection created by `clad setup` takes effect in the new session. +Use only the command for your AI tool. For Cursor IDE, open `` as the workspace instead. +Always start a new AI session after `clad setup`; changing directory alone is not enough. ### 3. Apply Cladding once @@ -309,17 +316,23 @@ From your project, say: Update cladding to the latest version. ``` -If your host allows terminal and global-install access, the AI runs both update steps and explains any new drift. Otherwise, it shows you the commands to approve or run yourself. +If the AI tool has terminal and global-install permission, it updates the CLI, refreshes host wiring, +updates the current project, and explains any new drift. Otherwise, it shows the commands for you to approve or run. ### Or update from the terminal ```bash npm update -g cladding # 1. get the new version -cd # 2. your project -clad update # 3. align this project with the installed version +clad setup # 2. refresh this machine's AI-tool connections + +cd # 3. enter a Cladding project +clad update # 4. align that project with the installed version ``` -The update preserves your authored code, feature/spec content, and documentation. It may refresh derived inventory/index data and the Cladding-managed block in `AGENTS.md` or `CLAUDE.md`. If the new version reports drift, hand that result to your AI tool: +Run the first two commands once per machine update. Run `clad update` in each Cladding project you +want to upgrade. It preserves authored code, feature/spec content, and documentation; only derived +data and Cladding-managed instruction blocks may be refreshed. If the new version reports drift, +hand that result to your AI tool: ``` Reconcile the drift the update flagged. diff --git a/README.zh.md b/README.zh.md index 0f74197c..480a8def 100644 --- a/README.zh.md +++ b/README.zh.md @@ -237,22 +237,27 @@ cladding 的独到之处在于*组合* —— 把上述品类的内核,绑进* ## Install -### 1. 安装并连接 AI 工具 +### 1. 在电脑上安装一次 ```bash npm install -g cladding # 安装 cladding CLI clad setup # 自动接通你的 AI 工具(Claude · Codex · Antigravity · Cursor) ``` -以上命令可以在任何目录运行,每台电脑只需执行一次。`clad setup` 只会全局连接支持的 AI 工具,不会创建或修改项目文件。 +这两条命令可以在任何目录运行。`clad setup` 只连接这台电脑上已经安装的 AI 工具,不会创建或修改项目文件。以后新增支持的 AI 工具时,只需再次运行 `clad setup`。 ### 2. 从项目中启动 AI 工具 ```bash cd + +# 从此目录启动你使用的一个 AI 工具: +codex # 或:claude +agy # Antigravity +cursor-agent # Cursor Agent ``` -> **下一步:** 以此项目文件夹作为工作区,重新启动所使用的 AI 工具。在该目录中运行 Codex、Claude Code、Antigravity(`agy`)或 Cursor Agent(`cursor-agent`);如果使用 Cursor IDE,则打开此文件夹。`clad setup` 创建的连接会从新会话开始生效。 +只需运行自己所用 AI 工具对应的一条命令。使用 Cursor IDE 时,把 `` 作为工作区打开。运行 `clad setup` 后必须启动一个新的 AI 会话;不能只执行 `cd` 就结束。 ### 3. 为项目应用一次 Cladding @@ -304,17 +309,19 @@ Cladding 会扫描现有代码,并把观察到的模式与你的意图结合 把 cladding 更新到最新版本。 ``` -如果宿主具有终端和全局安装权限,AI 会执行两个更新步骤并解释新发现的漂移;否则,它会给出需要批准或手动执行的命令。 +如果 AI 工具有终端和全局安装权限,它会更新 CLI、刷新宿主接线、更新当前项目,并解释新发现的漂移;否则,它会给出需要批准或手动执行的命令。 ### 或在终端中直接更新 ```bash npm update -g cladding # 1. 取得新版本 -cd # 2. 进入项目目录 -clad update # 3. 让项目与已安装版本对齐 +clad setup # 2. 刷新这台电脑上的 AI 工具连接 + +cd # 3. 进入 Cladding 项目 +clad update # 4. 让项目与已安装版本对齐 ``` -更新会保留用户编写的代码、功能/spec 正文和文档。派生的 inventory/index 数据以及 `AGENTS.md` 或 `CLAUDE.md` 中由 Cladding 管理的区块可能会随新版本刷新。如果新版本报告了漂移,把结果交给 AI 工具即可: +前两条命令每次更新在电脑上只需运行一次。`clad update` 需要在每个要升级的 Cladding 项目中运行。用户编写的代码、功能/spec 正文和文档会保留;只有派生数据和 Cladding 管理的指令区块可能被刷新。如果新版本报告了漂移,把结果交给 AI 工具即可: ``` 修复这次更新标出的漂移。 diff --git a/docs/setup.md b/docs/setup.md index 04171808..185947cf 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -55,8 +55,9 @@ project, asking about Cladding, or running `clad setup` are not consent. ```bash npm update -g cladding # 1. install the new version -cd # 2. once per project -clad update # 3. bring it in line with the new version +clad setup # 2. refresh this machine's host wiring +cd # 3. once per project +clad update # 4. bring it in line with the new version ``` Your authored code, feature/spec content, and documentation are preserved. The command may refresh From a5d95e6aeafcc7a793f7d264a547df3563add748 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Tue, 14 Jul 2026 23:47:59 +0900 Subject: [PATCH 13/28] chore: refresh verification attestation --- spec/attestation.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/attestation.yaml b/spec/attestation.yaml index a60f6ce8..b8cdaad8 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -21,10 +21,10 @@ attested_modules: CHANGELOG.md: d437104f3e6b98c3 CLAUDE.md: d81d8832976cd5ee GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 54c672f9db30bd61 - README.ko.html: 3852cdae52ad9328 - README.ko.md: fcc987d9e6b9450c - README.md: 033860f14ba378f8 + README.html: 2c51bb11832c7844 + README.ko.html: c6a0ad7c2e4c42dd + README.ko.md: 1890a603a0185c73 + README.md: 06bb2a2d52b06ac0 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 From 0454e4279e339b30e73b6ba56e22bab2d9225f76 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 15 Jul 2026 00:03:40 +0900 Subject: [PATCH 14/28] fix: align host verification with AGY and Cursor --- README.html | 17 +- README.ja.md | 15 +- README.ko.html | 17 +- README.ko.md | 15 +- README.md | 15 +- README.zh.md | 13 +- docs/dogfood/matrix.md | 8 +- plugins/claude-code/dist/clad.js | 632 +++++++++--------- scripts/build-plugin.mjs | 4 +- spec/features/host-smoke-matrix-5283985e.yaml | 4 +- src/cli/doctor-hosts.ts | 107 ++- src/serve/server.ts | 3 +- tests/cli/doctor-hosts.test.ts | 84 ++- 13 files changed, 506 insertions(+), 428 deletions(-) diff --git a/README.html b/README.html index 6bfbafb3..70bda688 100644 --- a/README.html +++ b/README.html @@ -233,7 +233,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -490,10 +490,11 @@

1. Install once on your machine

2. Start your AI tool from the project

cd <project>
 
-# Start one of the AI tools from this directory:
-codex          # or: claude
-agy            # Antigravity
-cursor-agent   # Cursor Agent
+# Choose exactly one and remove its leading '#': +# codex # Codex +# claude # Claude Code +# agy # Antigravity +# cursor-agent # Cursor Agent

Use only the command for your AI tool. For Cursor IDE, open <project> as the workspace instead. Always start a new AI session after clad setup; changing directory alone is not enough.

3. Apply Cladding once

@@ -547,7 +548,7 @@

Status

tests
-
2497/2497
+
2522/2522
all pass
@@ -557,13 +558,13 @@

Status

features
-
254
+
255
251 done · self-spec
-

234 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector

+

236 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector

Road to Ironclad 1.0 — 1.0 locks only when two independent implementations pass the L4 conformance fixtures (GOVERNANCE § 1). cladding is the first.
diff --git a/README.ja.md b/README.ja.md index 46f5c4f9..fb46f177 100644 --- a/README.ja.md +++ b/README.ja.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -255,10 +255,11 @@ clad setup # AI ツールを自動配線(Claude · Codex · Ant ```bash cd -# このディレクトリから、使用する AI ツールを一つ起動する: -codex # または: claude -agy # Antigravity -cursor-agent # Cursor Agent +# 一つだけ選び、先頭の「#」を外して実行する: +# codex # Codex +# claude # Claude Code +# agy # Antigravity +# cursor-agent # Cursor Agent ``` 使用する AI ツールのコマンドを一つだけ実行する。Cursor IDE の場合は `` をワークスペースとして開く。`clad setup` の後は必ず新しい AI セッションを開始する。`cd` だけで終えてはいけない。 @@ -338,9 +339,9 @@ clad update # 4. プロジェクトをインストール済みバ | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.8.3(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2497 / 2497 | 15 段階 · 41 detectors | 254(251 done) | +| v0.8.3(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2522 / 2522 | 15 段階 · 41 detectors | 255(251 done) | -234 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック +236 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック > **Ironclad 1.0 への道** — 1.0 は *独立した二つの実装が L4 準拠フィクスチャを通過してはじめて* 確定する([GOVERNANCE § 1](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md))。cladding はその一つ目だ。 diff --git a/README.ko.html b/README.ko.html index c30df924..941818ab 100644 --- a/README.ko.html +++ b/README.ko.html @@ -275,7 +275,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -526,10 +526,11 @@

1. 컴퓨터에 한 번 설치하기

2. 프로젝트에서 AI 도구 실행하기

cd <project>
 
-# 이 디렉터리에서 사용하는 AI 도구 하나를 실행한다:
-codex          # 또는: claude
-agy            # Antigravity
-cursor-agent   # Cursor Agent
+# 정확히 하나를 골라 앞의 '#'을 지우고 실행한다: +# codex # Codex +# claude # Claude Code +# agy # Antigravity +# cursor-agent # Cursor Agent

자신이 사용하는 AI 도구의 명령 하나만 실행하면 된다. Cursor IDE는 <project> 폴더를 작업공간으로 연다. clad setup 뒤에는 반드시 AI 도구를 새 세션으로 시작한다. cd만 실행하고 끝내면 안 된다.

3. 프로젝트에 Cladding 한 번 적용하기

@@ -583,7 +584,7 @@

Status

tests
-
2497/2497
+
2522/2522
all pass
@@ -593,13 +594,13 @@

Status

features
-
254
+
255
251 done · 자기 스펙
-

234 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단

+

236 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단

Ironclad 1.0까지의 길 — 1.0은 독립적인 두 개의 구현이 L4 검증 셋을 통과해야 잠긴다 (GOVERNANCE § 1). cladding이 첫 번째.
diff --git a/README.ko.md b/README.ko.md index 0b7e0aed..aa2a2962 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -254,10 +254,11 @@ clad setup # AI 도구 자동 연결 (Claude · Codex · Antigrav ```bash cd -# 이 디렉터리에서 사용하는 AI 도구 하나를 실행한다: -codex # 또는: claude -agy # Antigravity -cursor-agent # Cursor Agent +# 정확히 하나를 골라 앞의 '#'을 지우고 실행한다: +# codex # Codex +# claude # Claude Code +# agy # Antigravity +# cursor-agent # Cursor Agent ``` 자신이 사용하는 AI 도구의 명령 하나만 실행하면 된다. Cursor IDE는 `` 폴더를 작업공간으로 연다. `clad setup` 뒤에는 반드시 AI 도구를 새 세션으로 시작한다. `cd`만 실행하고 끝내면 안 된다. @@ -337,9 +338,9 @@ clad update # 4. 프로젝트를 설치된 버전에 맞추기 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.8.3 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2497 / 2497 · all pass | 15 단계 · 41 detectors | 254 · 251 done · 자기 스펙 | +| v0.8.3 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2522 / 2522 · all pass | 15 단계 · 41 detectors | 255 · 251 done · 자기 스펙 | -234 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 +236 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 > **Ironclad 1.0까지의 길** — 1.0은 *독립적인 두 개의 구현이 L4 검증 셋을 통과해야* 잠긴다 ([GOVERNANCE § 1](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md)). cladding이 첫 번째. diff --git a/README.md b/README.md index 894d120c..83839682 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -252,10 +252,11 @@ machine; it does not create or modify project files. Run it again after adding a ```bash cd -# Start one of the AI tools from this directory: -codex # or: claude -agy # Antigravity -cursor-agent # Cursor Agent +# Choose exactly one and remove its leading '#': +# codex # Codex +# claude # Claude Code +# agy # Antigravity +# cursor-agent # Cursor Agent ``` Use only the command for your AI tool. For Cursor IDE, open `` as the workspace instead. @@ -345,9 +346,9 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.8.3 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2497 / 2497 | 15 stages · 41 detectors | 254 (251 done) | +| v0.8.3 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2522 / 2522 | 15 stages · 41 detectors | 255 (251 done) | -234 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector +236 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector > **Road to Ironclad 1.0** — 1.0 locks only when *two independent implementations pass the L4 conformance fixtures* ([GOVERNANCE § 1](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md)). cladding is the first. diff --git a/README.zh.md b/README.zh.md index 480a8def..146bd573 100644 --- a/README.zh.md +++ b/README.zh.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -251,10 +251,11 @@ clad setup # 自动接通你的 AI 工具(Claude · Codex · An ```bash cd -# 从此目录启动你使用的一个 AI 工具: -codex # 或:claude -agy # Antigravity -cursor-agent # Cursor Agent +# 只选择一个,并删除行首的“#”后运行: +# codex # Codex +# claude # Claude Code +# agy # Antigravity +# cursor-agent # Cursor Agent ``` 只需运行自己所用 AI 工具对应的一条命令。使用 Cursor IDE 时,把 `` 作为工作区打开。运行 `clad setup` 后必须启动一个新的 AI 会话;不能只执行 `cd` 就结束。 @@ -334,7 +335,7 @@ clad update # 4. 让项目与已安装版本对齐 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.8.3(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2497 / 2497 | 15 阶段 · 41 检测器 | 254(251 done) | +| v0.8.3(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2522 / 2522 | 15 阶段 · 41 检测器 | 255(251 done) | 234 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/docs/dogfood/matrix.md b/docs/dogfood/matrix.md index f646420c..6e7ab15f 100644 --- a/docs/dogfood/matrix.md +++ b/docs/dogfood/matrix.md @@ -3,8 +3,8 @@ -- Cladding version: `0.7.1` -- Generated: 2026-07-03T02:42:22.205Z +- Cladding version: `0.8.3` +- Generated: 2026-07-14T15:01:15.000Z | Host | list-features | get-feature | run-check | wiring | Grade | |---|---|---|---|---|---| @@ -16,7 +16,7 @@ **Legend** - `verified` — every probed surface passed its sentinel end-to-end. -- `wiring-only` (Cursor) — no headless verification surface exists, so the host is graded only on whether the MCP wire is written **and** `clad serve` answers a tools list over stdio (`wiring-ok` / `wiring-fail`). +- `wiring` — Cursor additionally verifies that its configured `clad serve` answers a tools list over stdio. - `not-run` — absence of evidence (binary absent from PATH, no live-run consent, or host not wired here). Never rendered as a pass — the matrix records absence honestly. **Why not-run / fail** @@ -25,4 +25,4 @@ - `codex`: binary not on PATH - `cursor`: live Cursor Agent onboarding campaign passed; see `cursor-agent-2026-07-14.md`. -> Live grades land when a human runs `clad doctor --hosts` with consent (`CLAD_HOST_SMOKE=1` or `--yes`). Without consent this baseline records only what is checkable for free — Cursor wiring — and leaves the LLM-driven surfaces `not-run`. +> Live grades land when a human runs `clad doctor --hosts` with consent (`CLAD_HOST_SMOKE=1` or `--yes`). Without consent this baseline records only what is checkable for free — Cursor wiring — and leaves all LLM-driven surfaces `not-run`. diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index a09cacc3..50f90d5a 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,100 +4,100 @@ 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 pde=Object.create;var dA=Object.defineProperty;var mde=Object.getOwnPropertyDescriptor;var hde=Object.getOwnPropertyNames;var gde=Object.getPrototypeOf,yde=Object.prototype.hasOwnProperty;var He=(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)dA(t,r,{get:e[r],enumerable:!0})},_de=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hde(e))!yde.call(t,i)&&i!==r&&dA(t,i,{get:()=>e[i],enumerable:!(n=mde(e,i))||n.enumerable});return t};var bt=(t,e,r)=>(r=t!=null?pde(gde(t)):{},_de(e||!t||!t.__esModule?dA(r,"default",{value:t,enumerable:!0}):r,t));var Vd=v(pA=>{var ny=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 ny{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};pA.CommanderError=ny;pA.InvalidArgumentError=fA});var iy=v(hA=>{var{InvalidArgumentError:bde}=Vd(),mA=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 bde(`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 vde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}hA.Argument=mA;hA.humanReadableArgName=vde});var _A=v(yA=>{var{humanReadableArgName:Sde}=iy(),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=>Sde(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 Lq(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)dA(t,r,{get:e[r],enumerable:!0})},_de=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hde(e))!yde.call(t,i)&&i!==r&&dA(t,i,{get:()=>e[i],enumerable:!(n=mde(e,i))||n.enumerable});return t};var bt=(t,e,r)=>(r=t!=null?pde(gde(t)):{},_de(e||!t||!t.__esModule?dA(r,"default",{value:t,enumerable:!0}):r,t));var Wd=v(pA=>{var iy=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 iy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};pA.CommanderError=iy;pA.InvalidArgumentError=fA});var oy=v(hA=>{var{InvalidArgumentError:bde}=Wd(),mA=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 bde(`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 vde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}hA.Argument=mA;hA.humanReadableArgName=vde});var _A=v(yA=>{var{humanReadableArgName:Sde}=oy(),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=>Sde(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 zq(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 Lq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}yA.Help=gA;yA.stripColor=Lq});var wA=v(SA=>{var{InvalidArgumentError:wde}=Vd(),bA=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=xde(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 wde(`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?zq(this.name().replace(/^no-/,"")):zq(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 zq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function xde(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 zq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}yA.Help=gA;yA.stripColor=zq});var wA=v(SA=>{var{InvalidArgumentError:wde}=Wd(),bA=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=xde(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 wde(`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?Uq(this.name().replace(/^no-/,"")):Uq(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 Uq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function xde(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}}SA.Option=bA;SA.DualOptions=vA});var qq=v(Uq=>{function $de(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 kde(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=$de(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}}SA.Option=bA;SA.DualOptions=vA});var Bq=v(qq=>{function $de(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 kde(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=$de(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]}?)`:""}Uq.suggestSimilar=kde});var Zq=v(AA=>{var Ede=He("node:events").EventEmitter,xA=He("node:child_process"),ao=He("node:path"),oy=He("node:fs"),Ue=He("node:process"),{Argument:Ade,humanReadableArgName:Tde}=iy(),{CommanderError:$A}=Vd(),{Help:Ode,stripColor:Rde}=_A(),{Option:Bq,DualOptions:Ide}=wA(),{suggestSimilar:Hq}=qq(),kA=class t extends Ede{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>EA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>EA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Rde(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 Ode,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]}?)`:""}qq.suggestSimilar=kde});var Vq=v(AA=>{var Ede=He("node:events").EventEmitter,xA=He("node:child_process"),ao=He("node:path"),sy=He("node:fs"),Ue=He("node:process"),{Argument:Ade,humanReadableArgName:Tde}=oy(),{CommanderError:$A}=Wd(),{Help:Ode,stripColor:Rde}=_A(),{Option:Hq,DualOptions:Ide}=wA(),{suggestSimilar:Gq}=Bq(),kA=class t extends Ede{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>EA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>EA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Rde(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 Ode,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 Ade(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 $A(e,r,n)),Ue.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 Bq(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 Bq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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 +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 $A(e,r,n)),Ue.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 Hq(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 Hq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(sy.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=ao.resolve(u,d);if(oy.existsSync(f))return f;if(i.includes(ao.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=ao.resolve(ao.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=ao.basename(this._scriptPath,ao.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(ao.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Gq(Ue.execArgv).concat(r),c=xA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=xA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Gq(Ue.execArgv).concat(r),c=xA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 $A(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new $A(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=ao.resolve(u,d);if(sy.existsSync(f))return f;if(i.includes(ao.extname(d)))return;let p=i.find(m=>sy.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=sy.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=ao.resolve(ao.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=ao.basename(this._scriptPath,ao.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(ao.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Zq(Ue.execArgv).concat(r),c=xA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=xA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Zq(Ue.execArgv).concat(r),c=xA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 $A(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new $A(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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Ide(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=Hq(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=Hq(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.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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Ide(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=Gq(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=Gq(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=>Tde(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=ao.basename(e,ao.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(Ue.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 Gq(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 EA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}AA.Command=kA;AA.useColor=EA});var Jq=v(xn=>{var{Argument:Vq}=iy(),{Command:TA}=Zq(),{CommanderError:Pde,InvalidArgumentError:Wq}=Vd(),{Help:Cde}=_A(),{Option:Kq}=wA();xn.program=new TA;xn.createCommand=t=>new TA(t);xn.createOption=(t,e)=>new Kq(t,e);xn.createArgument=(t,e)=>new Vq(t,e);xn.Command=TA;xn.Option=Kq;xn.Argument=Vq;xn.Help=Cde;xn.CommanderError=Pde;xn.InvalidArgumentError=Wq;xn.InvalidOptionArgumentError=Wq});var Ce=v(Xt=>{"use strict";var RA=Symbol.for("yaml.alias"),e4=Symbol.for("yaml.document"),sy=Symbol.for("yaml.map"),t4=Symbol.for("yaml.pair"),IA=Symbol.for("yaml.scalar"),ay=Symbol.for("yaml.seq"),co=Symbol.for("yaml.node.type"),Lde=t=>!!t&&typeof t=="object"&&t[co]===RA,zde=t=>!!t&&typeof t=="object"&&t[co]===e4,Ude=t=>!!t&&typeof t=="object"&&t[co]===sy,qde=t=>!!t&&typeof t=="object"&&t[co]===t4,r4=t=>!!t&&typeof t=="object"&&t[co]===IA,Bde=t=>!!t&&typeof t=="object"&&t[co]===ay;function n4(t){if(t&&typeof t=="object")switch(t[co]){case sy:case ay:return!0}return!1}function Hde(t){if(t&&typeof t=="object")switch(t[co]){case RA:case sy:case IA:case ay:return!0}return!1}var Gde=t=>(r4(t)||n4(t))&&!!t.anchor;Xt.ALIAS=RA;Xt.DOC=e4;Xt.MAP=sy;Xt.NODE_TYPE=co;Xt.PAIR=t4;Xt.SCALAR=IA;Xt.SEQ=ay;Xt.hasAnchor=Gde;Xt.isAlias=Lde;Xt.isCollection=n4;Xt.isDocument=zde;Xt.isMap=Ude;Xt.isNode=Hde;Xt.isPair=qde;Xt.isScalar=r4;Xt.isSeq=Bde});var Wd=v(PA=>{"use strict";var Lt=Ce(),Cr=Symbol("break visit"),i4=Symbol("skip children"),$i=Symbol("remove node");function cy(t,e){let r=o4(e);Lt.isDocument(t)?qc(null,t.contents,r,Object.freeze([t]))===$i&&(t.contents=null):qc(null,t,r,Object.freeze([]))}cy.BREAK=Cr;cy.SKIP=i4;cy.REMOVE=$i;function qc(t,e,r,n){let i=s4(t,e,r,n);if(Lt.isNode(i)||Lt.isPair(i))return a4(t,n,i),qc(t,i,r,n);if(typeof i!="symbol"){if(Lt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var c4=Ce(),Zde=Wd(),Vde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Wde=t=>t.replace(/[!,[\]{}]/g,e=>Vde[e]),Kd=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+Wde(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&&c4.isNode(e.contents)){let o={};Zde.visit(e.contents,(s,a)=>{c4.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(` -`)}};Kd.defaultYaml={explicit:!1,version:"1.2"};Kd.defaultTags={"!!":"tag:yaml.org,2002:"};l4.Directives=Kd});var uy=v(Jd=>{"use strict";var u4=Ce(),Kde=Wd();function Jde(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 d4(t){let e=new Set;return Kde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function f4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Yde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=d4(t));let s=f4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(u4.isScalar(s.node)||u4.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}}Jd.anchorIsValid=Jde;Jd.anchorNames=d4;Jd.createNodeAnchors=Yde;Jd.findNewAnchor=f4});var DA=v(p4=>{"use strict";function Yd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Xde=Ce();function m4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>m4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Xde.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}h4.toJS=m4});var dy=v(y4=>{"use strict";var Qde=DA(),g4=Ce(),efe=Bo(),NA=class{constructor(e){Object.defineProperty(this,g4.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(!g4.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=efe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Qde.applyReviver(o,{"":a},"",a):a}};y4.NodeBase=NA});var Xd=v(_4=>{"use strict";var tfe=uy(),rfe=Wd(),Hc=Ce(),nfe=dy(),ife=Bo(),jA=class extends nfe.NodeBase{constructor(e){super(Hc.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=[],rfe.visit(e,{Node:(o,s)=>{(Hc.isAlias(s)||Hc.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||(ife.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=fy(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(tfe.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 fy(t,e,r){if(Hc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Hc.isCollection(e)){let n=0;for(let i of e.items){let o=fy(t,i,r);o>n&&(n=o)}return n}else if(Hc.isPair(e)){let n=fy(t,e.key,r),i=fy(t,e.value,r);return Math.max(n,i)}return 1}_4.Alias=jA});var Pt=v(MA=>{"use strict";var ofe=Ce(),sfe=dy(),afe=Bo(),cfe=t=>!t||typeof t!="function"&&typeof t!="object",Ho=class extends sfe.NodeBase{constructor(e){super(ofe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:afe.toJS(this.value,e,r)}toString(){return String(this.value)}};Ho.BLOCK_FOLDED="BLOCK_FOLDED";Ho.BLOCK_LITERAL="BLOCK_LITERAL";Ho.PLAIN="PLAIN";Ho.QUOTE_DOUBLE="QUOTE_DOUBLE";Ho.QUOTE_SINGLE="QUOTE_SINGLE";MA.Scalar=Ho;MA.isScalarValue=cfe});var Qd=v(v4=>{"use strict";var lfe=Xd(),sa=Ce(),b4=Pt(),ufe="tag:yaml.org,2002:";function dfe(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 ffe(t,e,r){if(sa.isDocument(t)&&(t=t.contents),sa.isNode(t))return t;if(sa.isPair(t)){let d=r.schema[sa.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 lfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=ufe+e.slice(2));let l=dfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new b4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[sa.MAP]:Symbol.iterator in Object(t)?s[sa.SEQ]:s[sa.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 b4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}v4.createNode=ffe});var my=v(py=>{"use strict";var pfe=Qd(),ki=Ce(),mfe=dy();function FA(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 pfe.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 S4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,LA=class extends mfe.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=>ki.isNode(n)||ki.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(S4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(ki.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,FA(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(ki.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&&ki.isScalar(o)?o.value:o:ki.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!ki.isPair(r))return!1;let n=r.value;return n==null||e&&ki.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 ki.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(ki.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,FA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};py.Collection=LA;py.collectionFromPath=FA;py.isEmptyPath=S4});var ef=v(hy=>{"use strict";var hfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function zA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var gfe=(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 Zq(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 EA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}AA.Command=kA;AA.useColor=EA});var Yq=v(xn=>{var{Argument:Wq}=oy(),{Command:TA}=Vq(),{CommanderError:Pde,InvalidArgumentError:Kq}=Wd(),{Help:Cde}=_A(),{Option:Jq}=wA();xn.program=new TA;xn.createCommand=t=>new TA(t);xn.createOption=(t,e)=>new Jq(t,e);xn.createArgument=(t,e)=>new Wq(t,e);xn.Command=TA;xn.Option=Jq;xn.Argument=Wq;xn.Help=Cde;xn.CommanderError=Pde;xn.InvalidArgumentError=Kq;xn.InvalidOptionArgumentError=Kq});var Ce=v(Xt=>{"use strict";var RA=Symbol.for("yaml.alias"),t4=Symbol.for("yaml.document"),ay=Symbol.for("yaml.map"),r4=Symbol.for("yaml.pair"),IA=Symbol.for("yaml.scalar"),cy=Symbol.for("yaml.seq"),co=Symbol.for("yaml.node.type"),Lde=t=>!!t&&typeof t=="object"&&t[co]===RA,zde=t=>!!t&&typeof t=="object"&&t[co]===t4,Ude=t=>!!t&&typeof t=="object"&&t[co]===ay,qde=t=>!!t&&typeof t=="object"&&t[co]===r4,n4=t=>!!t&&typeof t=="object"&&t[co]===IA,Bde=t=>!!t&&typeof t=="object"&&t[co]===cy;function i4(t){if(t&&typeof t=="object")switch(t[co]){case ay:case cy:return!0}return!1}function Hde(t){if(t&&typeof t=="object")switch(t[co]){case RA:case ay:case IA:case cy:return!0}return!1}var Gde=t=>(n4(t)||i4(t))&&!!t.anchor;Xt.ALIAS=RA;Xt.DOC=t4;Xt.MAP=ay;Xt.NODE_TYPE=co;Xt.PAIR=r4;Xt.SCALAR=IA;Xt.SEQ=cy;Xt.hasAnchor=Gde;Xt.isAlias=Lde;Xt.isCollection=i4;Xt.isDocument=zde;Xt.isMap=Ude;Xt.isNode=Hde;Xt.isPair=qde;Xt.isScalar=n4;Xt.isSeq=Bde});var Kd=v(PA=>{"use strict";var Lt=Ce(),Cr=Symbol("break visit"),o4=Symbol("skip children"),$i=Symbol("remove node");function ly(t,e){let r=s4(e);Lt.isDocument(t)?Bc(null,t.contents,r,Object.freeze([t]))===$i&&(t.contents=null):Bc(null,t,r,Object.freeze([]))}ly.BREAK=Cr;ly.SKIP=o4;ly.REMOVE=$i;function Bc(t,e,r,n){let i=a4(t,e,r,n);if(Lt.isNode(i)||Lt.isPair(i))return c4(t,n,i),Bc(t,i,r,n);if(typeof i!="symbol"){if(Lt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var l4=Ce(),Zde=Kd(),Vde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Wde=t=>t.replace(/[!,[\]{}]/g,e=>Vde[e]),Jd=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+Wde(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&&l4.isNode(e.contents)){let o={};Zde.visit(e.contents,(s,a)=>{l4.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(` +`)}};Jd.defaultYaml={explicit:!1,version:"1.2"};Jd.defaultTags={"!!":"tag:yaml.org,2002:"};u4.Directives=Jd});var dy=v(Yd=>{"use strict";var d4=Ce(),Kde=Kd();function Jde(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 f4(t){let e=new Set;return Kde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function p4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Yde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=f4(t));let s=p4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(d4.isScalar(s.node)||d4.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}}Yd.anchorIsValid=Jde;Yd.anchorNames=f4;Yd.createNodeAnchors=Yde;Yd.findNewAnchor=p4});var DA=v(m4=>{"use strict";function Xd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Xde=Ce();function h4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>h4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Xde.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}g4.toJS=h4});var fy=v(_4=>{"use strict";var Qde=DA(),y4=Ce(),efe=Bo(),NA=class{constructor(e){Object.defineProperty(this,y4.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(!y4.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=efe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Qde.applyReviver(o,{"":a},"",a):a}};_4.NodeBase=NA});var Qd=v(b4=>{"use strict";var tfe=dy(),rfe=Kd(),Gc=Ce(),nfe=fy(),ife=Bo(),jA=class extends nfe.NodeBase{constructor(e){super(Gc.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=[],rfe.visit(e,{Node:(o,s)=>{(Gc.isAlias(s)||Gc.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||(ife.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=py(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(tfe.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 py(t,e,r){if(Gc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Gc.isCollection(e)){let n=0;for(let i of e.items){let o=py(t,i,r);o>n&&(n=o)}return n}else if(Gc.isPair(e)){let n=py(t,e.key,r),i=py(t,e.value,r);return Math.max(n,i)}return 1}b4.Alias=jA});var Pt=v(MA=>{"use strict";var ofe=Ce(),sfe=fy(),afe=Bo(),cfe=t=>!t||typeof t!="function"&&typeof t!="object",Ho=class extends sfe.NodeBase{constructor(e){super(ofe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:afe.toJS(this.value,e,r)}toString(){return String(this.value)}};Ho.BLOCK_FOLDED="BLOCK_FOLDED";Ho.BLOCK_LITERAL="BLOCK_LITERAL";Ho.PLAIN="PLAIN";Ho.QUOTE_DOUBLE="QUOTE_DOUBLE";Ho.QUOTE_SINGLE="QUOTE_SINGLE";MA.Scalar=Ho;MA.isScalarValue=cfe});var ef=v(S4=>{"use strict";var lfe=Qd(),sa=Ce(),v4=Pt(),ufe="tag:yaml.org,2002:";function dfe(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 ffe(t,e,r){if(sa.isDocument(t)&&(t=t.contents),sa.isNode(t))return t;if(sa.isPair(t)){let d=r.schema[sa.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 lfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=ufe+e.slice(2));let l=dfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new v4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[sa.MAP]:Symbol.iterator in Object(t)?s[sa.SEQ]:s[sa.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 v4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}S4.createNode=ffe});var hy=v(my=>{"use strict";var pfe=ef(),ki=Ce(),mfe=fy();function FA(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 pfe.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 w4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,LA=class extends mfe.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=>ki.isNode(n)||ki.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(w4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(ki.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,FA(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(ki.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&&ki.isScalar(o)?o.value:o:ki.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!ki.isPair(r))return!1;let n=r.value;return n==null||e&&ki.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 ki.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(ki.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,FA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};my.Collection=LA;my.collectionFromPath=FA;my.isEmptyPath=w4});var tf=v(gy=>{"use strict";var hfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function zA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var gfe=(t,e,r)=>t.endsWith(` `)?zA(r,e):r.includes(` `)?` -`+zA(r,e):(t.endsWith(" ")?"":" ")+r;hy.indentComment=zA;hy.lineComment=gfe;hy.stringifyComment=hfe});var x4=v(tf=>{"use strict";var yfe="flow",UA="block",gy="quoted";function _fe(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===UA&&(h=w4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===gy&&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===UA&&(h=w4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+zA(r,e):(t.endsWith(" ")?"":" ")+r;gy.indentComment=zA;gy.lineComment=gfe;gy.stringifyComment=hfe});var $4=v(rf=>{"use strict";var yfe="flow",UA="block",yy="quoted";function _fe(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===UA&&(h=x4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===yy&&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===UA&&(h=x4(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===gy){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 Vn=Pt(),Go=x4(),_y=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),by=t=>/^(%|---|\.\.\.)/m.test(t);function bfe(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 rf(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=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===yy){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 Vn=Pt(),Go=$4(),by=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),vy=t=>/^(%|---|\.\.\.)/m.test(t);function bfe(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 nf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(vy(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(BA,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{O=!0});let A=Go.foldFlowLines(`${_}${w}${p}`,l,Go.FOLD_BLOCK,T);if(!O)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,T=by(n,!0);s!=="folded"&&e!==Vn.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{O=!0});let A=Go.foldFlowLines(`${_}${w}${p}`,l,Go.FOLD_BLOCK,T);if(!O)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} ${l}${_}${r}${p}`}function vfe(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 Gc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?Gc(o,e):yy(t,e,r,n);if(!a&&!u&&i!==Vn.Scalar.PLAIN&&o.includes(` -`))return yy(t,e,r,n);if(by(o)){if(c==="")return e.forceBlockIndent=!0,yy(t,e,r,n);if(a&&c===l)return Gc(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 Gc(o,e)}return a?d:Go.foldFlowLines(d,c,Go.FOLD_FLOW,_y(e,!1))}function Sfe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Gc(s.value,e):yy(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return rf(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return qA(s.value,e);case Vn.Scalar.PLAIN:return vfe(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}$4.stringifyString=Sfe});var of=v(HA=>{"use strict";var wfe=uy(),Zo=Ce(),xfe=ef(),$fe=nf();function kfe(t,e){let r=Object.assign({blockQuote:!0,commentString:xfe.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 Efe(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(Zo.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 Afe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Zo.isScalar(t)||Zo.isCollection(t))&&t.anchor;o&&wfe.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 Tfe(t,e,r,n){if(Zo.isPair(t))return t.toString(e,r,n);if(Zo.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=Zo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Efe(e.doc.schema.tags,o));let s=Afe(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):Zo.isScalar(o)?$fe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Zo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}HA.createStringifyContext=kfe;HA.stringify=Tfe});var T4=v(A4=>{"use strict";var lo=Ce(),k4=Pt(),E4=of(),sf=ef();function Ofe({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=lo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(lo.isCollection(t)||!lo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||lo.isCollection(t)||(lo.isScalar(t)?t.type===k4.Scalar.BLOCK_FOLDED||t.type===k4.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=E4.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+=sf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=sf.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=sf.lineComment(g,r.indent,l(f))));let b,_,S;lo.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&&lo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&lo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=E4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +`)||u&&/[[\]{},]/.test(o))return Zc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?Zc(o,e):_y(t,e,r,n);if(!a&&!u&&i!==Vn.Scalar.PLAIN&&o.includes(` +`))return _y(t,e,r,n);if(vy(o)){if(c==="")return e.forceBlockIndent=!0,_y(t,e,r,n);if(a&&c===l)return Zc(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 Zc(o,e)}return a?d:Go.foldFlowLines(d,c,Go.FOLD_FLOW,by(e,!1))}function Sfe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Zc(s.value,e):_y(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return nf(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return qA(s.value,e);case Vn.Scalar.PLAIN:return vfe(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}k4.stringifyString=Sfe});var sf=v(HA=>{"use strict";var wfe=dy(),Zo=Ce(),xfe=tf(),$fe=of();function kfe(t,e){let r=Object.assign({blockQuote:!0,commentString:xfe.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 Efe(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(Zo.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 Afe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Zo.isScalar(t)||Zo.isCollection(t))&&t.anchor;o&&wfe.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 Tfe(t,e,r,n){if(Zo.isPair(t))return t.toString(e,r,n);if(Zo.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=Zo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Efe(e.doc.schema.tags,o));let s=Afe(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):Zo.isScalar(o)?$fe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Zo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}HA.createStringifyContext=kfe;HA.stringify=Tfe});var O4=v(T4=>{"use strict";var lo=Ce(),E4=Pt(),A4=sf(),af=tf();function Ofe({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=lo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(lo.isCollection(t)||!lo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||lo.isCollection(t)||(lo.isScalar(t)?t.type===E4.Scalar.BLOCK_FOLDED||t.type===E4.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=A4.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+=af.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=af.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=af.lineComment(g,r.indent,l(f))));let b,_,S;lo.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&&lo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&lo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=A4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let T=l(_);O+=` -${sf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` +${af.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` `&&S&&(O=` `):O+=` ${r.indent}`}else if(!p&&lo.isCollection(e)){let T=w[0],A=w.indexOf(` `),D=A!==-1,E=r.inFlow??e.flow??e.items.length===0;if(D||!E){let q=!1;if(D&&(T==="&"||T==="!")){let Q=w.indexOf(" ");T==="&"&&Q!==-1&&Q{"use strict";var O4=He("process");function Rfe(t,...e){t==="debug"&&console.log(...e)}function Ife(t,e){(t==="debug"||t==="warn")&&(typeof O4.emitWarning=="function"?O4.emitWarning(e):console.warn(e))}GA.debug=Rfe;GA.warn=Ife});var $y=v(xy=>{"use strict";var wy=Ce(),R4=Pt(),vy="<<",Sy={identify:t=>t===vy||typeof t=="symbol"&&t.description===vy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new R4.Scalar(Symbol(vy)),{addToJSMap:I4}),stringify:()=>vy},Pfe=(t,e)=>(Sy.identify(e)||wy.isScalar(e)&&(!e.type||e.type===R4.Scalar.PLAIN)&&Sy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Sy.tag&&r.default);function I4(t,e,r){let n=P4(t,r);if(wy.isSeq(n))for(let i of n.items)VA(t,e,i);else if(Array.isArray(n))for(let i of n)VA(t,e,i);else VA(t,e,n)}function VA(t,e,r){let n=P4(t,r);if(!wy.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 P4(t,e){return t&&wy.isAlias(e)?e.resolve(t.doc,t):e}xy.addMergeToJSMap=I4;xy.isMergeKey=Pfe;xy.merge=Sy});var KA=v(N4=>{"use strict";var Cfe=ZA(),C4=$y(),Dfe=of(),D4=Ce(),WA=Bo();function Nfe(t,e,{key:r,value:n}){if(D4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(C4.isMergeKey(t,r))C4.addMergeToJSMap(t,e,n);else{let i=WA.toJS(r,"",t);if(e instanceof Map)e.set(i,WA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=jfe(r,i,t),s=WA.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 jfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(D4.isNode(t)&&r?.doc){let n=Dfe.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)+'..."'),Cfe.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)}N4.addPairToJSMap=Nfe});var Vo=v(JA=>{"use strict";var j4=Qd(),Mfe=T4(),Ffe=KA(),ky=Ce();function Lfe(t,e,r){let n=j4.createNode(t,void 0,r),i=j4.createNode(e,void 0,r);return new Ey(n,i)}var Ey=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 Ffe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Mfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};JA.Pair=Ey;JA.createPair=Lfe});var YA=v(F4=>{"use strict";var aa=Ce(),M4=of(),Ay=ef();function zfe(t,e,r){return(e.inFlow??t.flow?qfe:Ufe)(t,e,r)}function Ufe({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+=Ay.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 R4=He("process");function Rfe(t,...e){t==="debug"&&console.log(...e)}function Ife(t,e){(t==="debug"||t==="warn")&&(typeof R4.emitWarning=="function"?R4.emitWarning(e):console.warn(e))}GA.debug=Rfe;GA.warn=Ife});var ky=v($y=>{"use strict";var xy=Ce(),I4=Pt(),Sy="<<",wy={identify:t=>t===Sy||typeof t=="symbol"&&t.description===Sy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new I4.Scalar(Symbol(Sy)),{addToJSMap:P4}),stringify:()=>Sy},Pfe=(t,e)=>(wy.identify(e)||xy.isScalar(e)&&(!e.type||e.type===I4.Scalar.PLAIN)&&wy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===wy.tag&&r.default);function P4(t,e,r){let n=C4(t,r);if(xy.isSeq(n))for(let i of n.items)VA(t,e,i);else if(Array.isArray(n))for(let i of n)VA(t,e,i);else VA(t,e,n)}function VA(t,e,r){let n=C4(t,r);if(!xy.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 C4(t,e){return t&&xy.isAlias(e)?e.resolve(t.doc,t):e}$y.addMergeToJSMap=P4;$y.isMergeKey=Pfe;$y.merge=wy});var KA=v(j4=>{"use strict";var Cfe=ZA(),D4=ky(),Dfe=sf(),N4=Ce(),WA=Bo();function Nfe(t,e,{key:r,value:n}){if(N4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(D4.isMergeKey(t,r))D4.addMergeToJSMap(t,e,n);else{let i=WA.toJS(r,"",t);if(e instanceof Map)e.set(i,WA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=jfe(r,i,t),s=WA.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 jfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(N4.isNode(t)&&r?.doc){let n=Dfe.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)+'..."'),Cfe.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)}j4.addPairToJSMap=Nfe});var Vo=v(JA=>{"use strict";var M4=ef(),Mfe=O4(),Ffe=KA(),Ey=Ce();function Lfe(t,e,r){let n=M4.createNode(t,void 0,r),i=M4.createNode(e,void 0,r);return new Ay(n,i)}var Ay=class t{constructor(e,r=null){Object.defineProperty(this,Ey.NODE_TYPE,{value:Ey.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Ey.isNode(r)&&(r=r.clone(e)),Ey.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Ffe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Mfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};JA.Pair=Ay;JA.createPair=Lfe});var YA=v(L4=>{"use strict";var aa=Ce(),F4=sf(),Ty=tf();function zfe(t,e,r){return(e.inFlow??t.flow?qfe:Ufe)(t,e,r)}function Ufe({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+=Ty.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+=Ay.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?` +`+Ty.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function qfe({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+=Ty.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 Ty({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Ay.indentComment(e(n),t);r.push(o.trimStart())}}F4.stringifyCollection=zfe});var Ko=v(QA=>{"use strict";var Bfe=YA(),Hfe=KA(),Gfe=my(),Wo=Ce(),Oy=Vo(),Zfe=Pt();function af(t,e){let r=Wo.isScalar(e)?e.value:e;for(let n of t)if(Wo.isPair(n)&&(n.key===e||n.key===r||Wo.isScalar(n.key)&&n.key.value===r))return n}var XA=class extends Gfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Wo.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(Oy.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;Wo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Oy.Pair(e,e?.value):n=new Oy.Pair(e.key,e.value);let i=af(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Wo.isScalar(i.value)&&Zfe.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=af(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=af(this.items,e)?.value;return(!r&&Wo.isScalar(i)?i.value:i)??void 0}has(e){return!!af(this.items,e)}set(e,r){this.add(new Oy.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)Hfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Wo.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})),Bfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};QA.YAMLMap=XA;QA.findPair=af});var Zc=v(z4=>{"use strict";var Vfe=Ce(),L4=Ko(),Wfe={collection:"map",default:!0,nodeClass:L4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Vfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>L4.YAMLMap.from(t,e,r)};z4.map=Wfe});var Jo=v(U4=>{"use strict";var Kfe=Qd(),Jfe=YA(),Yfe=my(),Iy=Ce(),Xfe=Pt(),Qfe=Bo(),eT=class extends Yfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Iy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Ry(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Ry(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Iy.isScalar(i)?i.value:i}has(e){let r=Ry(e);return typeof r=="number"&&r=0?e:null}U4.YAMLSeq=eT});var Vc=v(B4=>{"use strict";var epe=Ce(),q4=Jo(),tpe={collection:"seq",default:!0,nodeClass:q4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return epe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>q4.YAMLSeq.from(t,e,r)};B4.seq=tpe});var cf=v(H4=>{"use strict";var rpe=nf(),npe={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),rpe.stringifyString(t,e,r,n)}};H4.string=npe});var Py=v(V4=>{"use strict";var G4=Pt(),Z4={identify:t=>t==null,createNode:()=>new G4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new G4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Z4.test.test(t)?t:e.options.nullStr};V4.nullTag=Z4});var tT=v(K4=>{"use strict";var ipe=Pt(),W4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new ipe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&W4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};K4.boolTag=W4});var Wc=v(J4=>{"use strict";function ope({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}J4.stringifyNumber=ope});var nT=v(Cy=>{"use strict";var spe=Pt(),rT=Wc(),ape={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},cpe={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)}},lpe={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 spe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:rT.stringifyNumber};Cy.float=lpe;Cy.floatExp=cpe;Cy.floatNaN=ape});var oT=v(Ny=>{"use strict";var Y4=Wc(),Dy=t=>typeof t=="bigint"||Number.isInteger(t),iT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function X4(t,e,r){let{value:n}=t;return Dy(n)&&n>=0?r+n.toString(e):Y4.stringifyNumber(t)}var upe={identify:t=>Dy(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=>X4(t,8,"0o")},dpe={identify:Dy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>iT(t,0,10,r),stringify:Y4.stringifyNumber},fpe={identify:t=>Dy(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=>X4(t,16,"0x")};Ny.int=dpe;Ny.intHex=fpe;Ny.intOct=upe});var e6=v(Q4=>{"use strict";var ppe=Zc(),mpe=Py(),hpe=Vc(),gpe=cf(),ype=tT(),sT=nT(),aT=oT(),_pe=[ppe.map,hpe.seq,gpe.string,mpe.nullTag,ype.boolTag,aT.intOct,aT.int,aT.intHex,sT.floatNaN,sT.floatExp,sT.float];Q4.schema=_pe});var n6=v(r6=>{"use strict";var bpe=Pt(),vpe=Zc(),Spe=Vc();function t6(t){return typeof t=="bigint"||Number.isInteger(t)}var jy=({value:t})=>JSON.stringify(t),wpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:jy},{identify:t=>t==null,createNode:()=>new bpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:jy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:jy},{identify:t6,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})=>t6(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:jy}],xpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},$pe=[vpe.map,Spe.seq].concat(wpe,xpe);r6.schema=$pe});var lT=v(i6=>{"use strict";var lf=He("buffer"),cT=Pt(),kpe=nf(),Epe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof lf.Buffer=="function")return lf.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 My=Ce(),uT=Vo(),Ape=Pt(),Tpe=Jo();function o6(t,e){if(My.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new uT.Pair(new Ape.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Oy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Ty.indentComment(e(n),t);r.push(o.trimStart())}}L4.stringifyCollection=zfe});var Ko=v(QA=>{"use strict";var Bfe=YA(),Hfe=KA(),Gfe=hy(),Wo=Ce(),Ry=Vo(),Zfe=Pt();function cf(t,e){let r=Wo.isScalar(e)?e.value:e;for(let n of t)if(Wo.isPair(n)&&(n.key===e||n.key===r||Wo.isScalar(n.key)&&n.key.value===r))return n}var XA=class extends Gfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Wo.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(Ry.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;Wo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Ry.Pair(e,e?.value):n=new Ry.Pair(e.key,e.value);let i=cf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Wo.isScalar(i.value)&&Zfe.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=cf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=cf(this.items,e)?.value;return(!r&&Wo.isScalar(i)?i.value:i)??void 0}has(e){return!!cf(this.items,e)}set(e,r){this.add(new Ry.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)Hfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Wo.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})),Bfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};QA.YAMLMap=XA;QA.findPair=cf});var Vc=v(U4=>{"use strict";var Vfe=Ce(),z4=Ko(),Wfe={collection:"map",default:!0,nodeClass:z4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Vfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>z4.YAMLMap.from(t,e,r)};U4.map=Wfe});var Jo=v(q4=>{"use strict";var Kfe=ef(),Jfe=YA(),Yfe=hy(),Py=Ce(),Xfe=Pt(),Qfe=Bo(),eT=class extends Yfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Py.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Iy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Iy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Py.isScalar(i)?i.value:i}has(e){let r=Iy(e);return typeof r=="number"&&r=0?e:null}q4.YAMLSeq=eT});var Wc=v(H4=>{"use strict";var epe=Ce(),B4=Jo(),tpe={collection:"seq",default:!0,nodeClass:B4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return epe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>B4.YAMLSeq.from(t,e,r)};H4.seq=tpe});var lf=v(G4=>{"use strict";var rpe=of(),npe={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),rpe.stringifyString(t,e,r,n)}};G4.string=npe});var Cy=v(W4=>{"use strict";var Z4=Pt(),V4={identify:t=>t==null,createNode:()=>new Z4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Z4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&V4.test.test(t)?t:e.options.nullStr};W4.nullTag=V4});var tT=v(J4=>{"use strict";var ipe=Pt(),K4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new ipe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&K4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};J4.boolTag=K4});var Kc=v(Y4=>{"use strict";function ope({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}Y4.stringifyNumber=ope});var nT=v(Dy=>{"use strict";var spe=Pt(),rT=Kc(),ape={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},cpe={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)}},lpe={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 spe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:rT.stringifyNumber};Dy.float=lpe;Dy.floatExp=cpe;Dy.floatNaN=ape});var oT=v(jy=>{"use strict";var X4=Kc(),Ny=t=>typeof t=="bigint"||Number.isInteger(t),iT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function Q4(t,e,r){let{value:n}=t;return Ny(n)&&n>=0?r+n.toString(e):X4.stringifyNumber(t)}var upe={identify:t=>Ny(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=>Q4(t,8,"0o")},dpe={identify:Ny,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>iT(t,0,10,r),stringify:X4.stringifyNumber},fpe={identify:t=>Ny(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=>Q4(t,16,"0x")};jy.int=dpe;jy.intHex=fpe;jy.intOct=upe});var t6=v(e6=>{"use strict";var ppe=Vc(),mpe=Cy(),hpe=Wc(),gpe=lf(),ype=tT(),sT=nT(),aT=oT(),_pe=[ppe.map,hpe.seq,gpe.string,mpe.nullTag,ype.boolTag,aT.intOct,aT.int,aT.intHex,sT.floatNaN,sT.floatExp,sT.float];e6.schema=_pe});var i6=v(n6=>{"use strict";var bpe=Pt(),vpe=Vc(),Spe=Wc();function r6(t){return typeof t=="bigint"||Number.isInteger(t)}var My=({value:t})=>JSON.stringify(t),wpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:My},{identify:t=>t==null,createNode:()=>new bpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:My},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:My},{identify:r6,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})=>r6(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:My}],xpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},$pe=[vpe.map,Spe.seq].concat(wpe,xpe);n6.schema=$pe});var lT=v(o6=>{"use strict";var uf=He("buffer"),cT=Pt(),kpe=of(),Epe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof uf.Buffer=="function")return uf.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 Fy=Ce(),uT=Vo(),Ape=Pt(),Tpe=Jo();function s6(t,e){if(Fy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new uT.Pair(new Ape.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]=My.isPair(n)?n:new uT.Pair(n)}}else e("Expected a sequence for this tag");return t}function s6(t,e,r){let{replacer:n}=r,i=new Tpe.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(uT.createPair(a,c,r))}return i}var Ope={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:o6,createNode:s6};Fy.createPairs=s6;Fy.pairs=Ope;Fy.resolvePairs=o6});var pT=v(fT=>{"use strict";var a6=Ce(),dT=Bo(),uf=Ko(),Rpe=Jo(),c6=Ly(),ca=class t extends Rpe.YAMLSeq{constructor(){super(),this.add=uf.YAMLMap.prototype.add.bind(this),this.delete=uf.YAMLMap.prototype.delete.bind(this),this.get=uf.YAMLMap.prototype.get.bind(this),this.has=uf.YAMLMap.prototype.has.bind(this),this.set=uf.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(a6.isPair(i)?(o=dT.toJS(i.key,"",r),s=dT.toJS(i.value,o,r)):o=dT.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=c6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ca.tag="tag:yaml.org,2002:omap";var Ipe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ca,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=c6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)a6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ca,r)},createNode:(t,e,r)=>ca.from(t,e,r)};fT.YAMLOMap=ca;fT.omap=Ipe});var p6=v(mT=>{"use strict";var l6=Pt();function u6({value:t,source:e},r){return e&&(t?d6:f6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var d6={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 l6.Scalar(!0),stringify:u6},f6={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 l6.Scalar(!1),stringify:u6};mT.falseTag=f6;mT.trueTag=d6});var m6=v(zy=>{"use strict";var Ppe=Pt(),hT=Wc(),Cpe={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},Dpe={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)}},Npe={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 Ppe.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};zy.float=Npe;zy.floatExp=Dpe;zy.floatNaN=Cpe});var g6=v(ff=>{"use strict";var h6=Wc(),df=t=>typeof t=="bigint"||Number.isInteger(t);function Uy(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 gT(t,e,r){let{value:n}=t;if(df(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return h6.stringifyNumber(t)}var jpe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Uy(t,2,2,r),stringify:t=>gT(t,2,"0b")},Mpe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Uy(t,1,8,r),stringify:t=>gT(t,8,"0")},Fpe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Uy(t,0,10,r),stringify:h6.stringifyNumber},Lpe={identify:df,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Uy(t,2,16,r),stringify:t=>gT(t,16,"0x")};ff.int=Fpe;ff.intBin=jpe;ff.intHex=Lpe;ff.intOct=Mpe});var _T=v(yT=>{"use strict";var Hy=Ce(),qy=Vo(),By=Ko(),la=class t extends By.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Hy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new qy.Pair(e.key,null):r=new qy.Pair(e,null),By.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=By.findPair(this.items,e);return!r&&Hy.isPair(n)?Hy.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=By.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new qy.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(qy.createPair(s,null,n));return o}};la.tag="tag:yaml.org,2002:set";var zpe={collection:"map",identify:t=>t instanceof Set,nodeClass:la,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>la.from(t,e,r),resolve(t,e){if(Hy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new la,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};yT.YAMLSet=la;yT.set=zpe});var vT=v(Gy=>{"use strict";var Upe=Wc();function bT(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 y6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Upe.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 qpe={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})=>bT(t,r),stringify:y6},Bpe={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=>bT(t,!1),stringify:y6},_6={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(_6.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=bT(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$/,"")??""};Gy.floatTime=Bpe;Gy.intTime=qpe;Gy.timestamp=_6});var S6=v(v6=>{"use strict";var Hpe=Zc(),Gpe=Py(),Zpe=Vc(),Vpe=cf(),Wpe=lT(),b6=p6(),ST=m6(),Zy=g6(),Kpe=$y(),Jpe=pT(),Ype=Ly(),Xpe=_T(),wT=vT(),Qpe=[Hpe.map,Zpe.seq,Vpe.string,Gpe.nullTag,b6.trueTag,b6.falseTag,Zy.intBin,Zy.intOct,Zy.int,Zy.intHex,ST.floatNaN,ST.floatExp,ST.float,Wpe.binary,Kpe.merge,Jpe.omap,Ype.pairs,Xpe.set,wT.intTime,wT.floatTime,wT.timestamp];v6.schema=Qpe});var I6=v(kT=>{"use strict";var k6=Zc(),eme=Py(),E6=Vc(),tme=cf(),rme=tT(),xT=nT(),$T=oT(),nme=e6(),ime=n6(),A6=lT(),pf=$y(),T6=pT(),O6=Ly(),w6=S6(),R6=_T(),Vy=vT(),x6=new Map([["core",nme.schema],["failsafe",[k6.map,E6.seq,tme.string]],["json",ime.schema],["yaml11",w6.schema],["yaml-1.1",w6.schema]]),$6={binary:A6.binary,bool:rme.boolTag,float:xT.float,floatExp:xT.floatExp,floatNaN:xT.floatNaN,floatTime:Vy.floatTime,int:$T.int,intHex:$T.intHex,intOct:$T.intOct,intTime:Vy.intTime,map:k6.map,merge:pf.merge,null:eme.nullTag,omap:T6.omap,pairs:O6.pairs,seq:E6.seq,set:R6.set,timestamp:Vy.timestamp},ome={"tag:yaml.org,2002:binary":A6.binary,"tag:yaml.org,2002:merge":pf.merge,"tag:yaml.org,2002:omap":T6.omap,"tag:yaml.org,2002:pairs":O6.pairs,"tag:yaml.org,2002:set":R6.set,"tag:yaml.org,2002:timestamp":Vy.timestamp};function sme(t,e,r){let n=x6.get(e);if(n&&!t)return r&&!n.includes(pf.merge)?n.concat(pf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(x6.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(pf.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},[])}kT.coreKnownTags=ome;kT.getTags=sme});var TT=v(P6=>{"use strict";var ET=Ce(),ame=Zc(),cme=Vc(),lme=cf(),Wy=I6(),ume=(t,e)=>t.keye.key?1:0,AT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Wy.getTags(e,"compat"):e?Wy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Wy.coreKnownTags:{},this.tags=Wy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,ET.MAP,{value:ame.map}),Object.defineProperty(this,ET.SCALAR,{value:lme.string}),Object.defineProperty(this,ET.SEQ,{value:cme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?ume:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};P6.Schema=AT});var D6=v(C6=>{"use strict";var dme=Ce(),OT=of(),mf=ef();function fme(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=OT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(mf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(dme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(mf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=OT.stringify(t.contents,i,()=>a=null,c);a&&(l+=mf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(OT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(mf.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(mf.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=Fy.isPair(n)?n:new uT.Pair(n)}}else e("Expected a sequence for this tag");return t}function a6(t,e,r){let{replacer:n}=r,i=new Tpe.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(uT.createPair(a,c,r))}return i}var Ope={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:s6,createNode:a6};Ly.createPairs=a6;Ly.pairs=Ope;Ly.resolvePairs=s6});var pT=v(fT=>{"use strict";var c6=Ce(),dT=Bo(),df=Ko(),Rpe=Jo(),l6=zy(),ca=class t extends Rpe.YAMLSeq{constructor(){super(),this.add=df.YAMLMap.prototype.add.bind(this),this.delete=df.YAMLMap.prototype.delete.bind(this),this.get=df.YAMLMap.prototype.get.bind(this),this.has=df.YAMLMap.prototype.has.bind(this),this.set=df.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(c6.isPair(i)?(o=dT.toJS(i.key,"",r),s=dT.toJS(i.value,o,r)):o=dT.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=l6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ca.tag="tag:yaml.org,2002:omap";var Ipe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ca,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=l6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)c6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ca,r)},createNode:(t,e,r)=>ca.from(t,e,r)};fT.YAMLOMap=ca;fT.omap=Ipe});var m6=v(mT=>{"use strict";var u6=Pt();function d6({value:t,source:e},r){return e&&(t?f6:p6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var f6={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 u6.Scalar(!0),stringify:d6},p6={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 u6.Scalar(!1),stringify:d6};mT.falseTag=p6;mT.trueTag=f6});var h6=v(Uy=>{"use strict";var Ppe=Pt(),hT=Kc(),Cpe={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},Dpe={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)}},Npe={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 Ppe.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};Uy.float=Npe;Uy.floatExp=Dpe;Uy.floatNaN=Cpe});var y6=v(pf=>{"use strict";var g6=Kc(),ff=t=>typeof t=="bigint"||Number.isInteger(t);function qy(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 gT(t,e,r){let{value:n}=t;if(ff(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return g6.stringifyNumber(t)}var jpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>qy(t,2,2,r),stringify:t=>gT(t,2,"0b")},Mpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>qy(t,1,8,r),stringify:t=>gT(t,8,"0")},Fpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>qy(t,0,10,r),stringify:g6.stringifyNumber},Lpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>qy(t,2,16,r),stringify:t=>gT(t,16,"0x")};pf.int=Fpe;pf.intBin=jpe;pf.intHex=Lpe;pf.intOct=Mpe});var _T=v(yT=>{"use strict";var Gy=Ce(),By=Vo(),Hy=Ko(),la=class t extends Hy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Gy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new By.Pair(e.key,null):r=new By.Pair(e,null),Hy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Hy.findPair(this.items,e);return!r&&Gy.isPair(n)?Gy.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=Hy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new By.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(By.createPair(s,null,n));return o}};la.tag="tag:yaml.org,2002:set";var zpe={collection:"map",identify:t=>t instanceof Set,nodeClass:la,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>la.from(t,e,r),resolve(t,e){if(Gy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new la,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};yT.YAMLSet=la;yT.set=zpe});var vT=v(Zy=>{"use strict";var Upe=Kc();function bT(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 _6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Upe.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 qpe={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})=>bT(t,r),stringify:_6},Bpe={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=>bT(t,!1),stringify:_6},b6={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(b6.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=bT(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$/,"")??""};Zy.floatTime=Bpe;Zy.intTime=qpe;Zy.timestamp=b6});var w6=v(S6=>{"use strict";var Hpe=Vc(),Gpe=Cy(),Zpe=Wc(),Vpe=lf(),Wpe=lT(),v6=m6(),ST=h6(),Vy=y6(),Kpe=ky(),Jpe=pT(),Ype=zy(),Xpe=_T(),wT=vT(),Qpe=[Hpe.map,Zpe.seq,Vpe.string,Gpe.nullTag,v6.trueTag,v6.falseTag,Vy.intBin,Vy.intOct,Vy.int,Vy.intHex,ST.floatNaN,ST.floatExp,ST.float,Wpe.binary,Kpe.merge,Jpe.omap,Ype.pairs,Xpe.set,wT.intTime,wT.floatTime,wT.timestamp];S6.schema=Qpe});var P6=v(kT=>{"use strict";var E6=Vc(),eme=Cy(),A6=Wc(),tme=lf(),rme=tT(),xT=nT(),$T=oT(),nme=t6(),ime=i6(),T6=lT(),mf=ky(),O6=pT(),R6=zy(),x6=w6(),I6=_T(),Wy=vT(),$6=new Map([["core",nme.schema],["failsafe",[E6.map,A6.seq,tme.string]],["json",ime.schema],["yaml11",x6.schema],["yaml-1.1",x6.schema]]),k6={binary:T6.binary,bool:rme.boolTag,float:xT.float,floatExp:xT.floatExp,floatNaN:xT.floatNaN,floatTime:Wy.floatTime,int:$T.int,intHex:$T.intHex,intOct:$T.intOct,intTime:Wy.intTime,map:E6.map,merge:mf.merge,null:eme.nullTag,omap:O6.omap,pairs:R6.pairs,seq:A6.seq,set:I6.set,timestamp:Wy.timestamp},ome={"tag:yaml.org,2002:binary":T6.binary,"tag:yaml.org,2002:merge":mf.merge,"tag:yaml.org,2002:omap":O6.omap,"tag:yaml.org,2002:pairs":R6.pairs,"tag:yaml.org,2002:set":I6.set,"tag:yaml.org,2002:timestamp":Wy.timestamp};function sme(t,e,r){let n=$6.get(e);if(n&&!t)return r&&!n.includes(mf.merge)?n.concat(mf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from($6.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(mf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?k6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(k6).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},[])}kT.coreKnownTags=ome;kT.getTags=sme});var TT=v(C6=>{"use strict";var ET=Ce(),ame=Vc(),cme=Wc(),lme=lf(),Ky=P6(),ume=(t,e)=>t.keye.key?1:0,AT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Ky.getTags(e,"compat"):e?Ky.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Ky.coreKnownTags:{},this.tags=Ky.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,ET.MAP,{value:ame.map}),Object.defineProperty(this,ET.SCALAR,{value:lme.string}),Object.defineProperty(this,ET.SEQ,{value:cme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?ume:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};C6.Schema=AT});var N6=v(D6=>{"use strict";var dme=Ce(),OT=sf(),hf=tf();function fme(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=OT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(hf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(dme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(hf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=OT.stringify(t.contents,i,()=>a=null,c);a&&(l+=hf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(OT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(hf.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(hf.indentComment(o(c),"")))}return r.join(` `)+` -`}C6.stringifyDocument=fme});var hf=v(N6=>{"use strict";var pme=Xd(),Kc=my(),$n=Ce(),mme=Vo(),hme=Bo(),gme=TT(),yme=D6(),RT=uy(),_me=DA(),bme=Qd(),IT=CA(),PT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 IT.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Jc(this.contents)&&this.contents.add(e)}addIn(e,r){Jc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=RT.anchorNames(this);e.anchor=!r||n.has(r)?RT.findNewAnchor(r||"a",n):r}return new pme.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}=RT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=bme.createNode(e,u,m);return a&&$n.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 mme.Pair(i,o)}delete(e){return Jc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Kc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Jc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Kc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Kc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Kc.collectionFromPath(this.schema,[e],r):Jc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Kc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Kc.collectionFromPath(this.schema,Array.from(e),r):Jc(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 IT.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 IT.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 gme.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=hme.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"?_me.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 yme.stringifyDocument(this,e)}};function Jc(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}N6.Document=PT});var _f=v(yf=>{"use strict";var gf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},CT=class extends gf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},DT=class extends gf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},vme=(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 +`}D6.stringifyDocument=fme});var gf=v(j6=>{"use strict";var pme=Qd(),Jc=hy(),$n=Ce(),mme=Vo(),hme=Bo(),gme=TT(),yme=N6(),RT=dy(),_me=DA(),bme=ef(),IT=CA(),PT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 IT.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Yc(this.contents)&&this.contents.add(e)}addIn(e,r){Yc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=RT.anchorNames(this);e.anchor=!r||n.has(r)?RT.findNewAnchor(r||"a",n):r}return new pme.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}=RT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=bme.createNode(e,u,m);return a&&$n.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 mme.Pair(i,o)}delete(e){return Yc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Jc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Yc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Jc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Jc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Jc.collectionFromPath(this.schema,[e],r):Yc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Jc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Jc.collectionFromPath(this.schema,Array.from(e),r):Yc(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 IT.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 IT.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 gme.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=hme.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"?_me.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 yme.stringifyDocument(this,e)}};function Yc(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}j6.Document=PT});var bf=v(_f=>{"use strict";var yf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},CT=class extends yf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},DT=class extends yf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},vme=(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} -`}};yf.YAMLError=gf;yf.YAMLParseError=CT;yf.YAMLWarning=DT;yf.prettifyError=vme});var bf=v(j6=>{"use strict";function Sme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}j6.resolveProps=Sme});var Ky=v(M6=>{"use strict";function NT(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(NT(e.key)||NT(e.value))return!0}return!1;default:return!0}}M6.containsNewline=NT});var jT=v(F6=>{"use strict";var wme=Ky();function xme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&wme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}F6.flowIndentCheck=xme});var MT=v(z6=>{"use strict";var L6=Ce();function $me(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||L6.isScalar(o)&&L6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}z6.mapIncludes=$me});var Z6=v(G6=>{"use strict";var U6=Vo(),kme=Ko(),q6=bf(),Eme=Ky(),B6=jT(),Ame=MT(),H6="All mapping items must start at the same column";function Tme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??kme.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=q6.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",H6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Eme.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",H6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&B6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Ame.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=q6.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 Ome=Jo(),Rme=bf(),Ime=jT();function Pme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Ome.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=Rme.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&&Ime.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}V6.resolveBlockSeq=Pme});var Yc=v(K6=>{"use strict";function Cme(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}}K6.resolveEnd=Cme});var Q6=v(X6=>{"use strict";var Dme=Ce(),Nme=Vo(),J6=Ko(),jme=Jo(),Mme=Yc(),Y6=bf(),Fme=Ky(),Lme=MT(),FT="Block collections are not allowed within flow collections",LT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function zme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?J6.YAMLMap:jme.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g{"use strict";function Sme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}M6.resolveProps=Sme});var Jy=v(F6=>{"use strict";function NT(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(NT(e.key)||NT(e.value))return!0}return!1;default:return!0}}F6.containsNewline=NT});var jT=v(L6=>{"use strict";var wme=Jy();function xme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&wme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}L6.flowIndentCheck=xme});var MT=v(U6=>{"use strict";var z6=Ce();function $me(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||z6.isScalar(o)&&z6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}U6.mapIncludes=$me});var V6=v(Z6=>{"use strict";var q6=Vo(),kme=Ko(),B6=vf(),Eme=Jy(),H6=jT(),Ame=MT(),G6="All mapping items must start at the same column";function Tme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??kme.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=B6.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",G6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Eme.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",G6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&H6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Ame.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=B6.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 Ome=Jo(),Rme=vf(),Ime=jT();function Pme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Ome.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=Rme.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&&Ime.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}W6.resolveBlockSeq=Pme});var Xc=v(J6=>{"use strict";function Cme(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}}J6.resolveEnd=Cme});var eB=v(Q6=>{"use strict";var Dme=Ce(),Nme=Vo(),Y6=Ko(),jme=Jo(),Mme=Xc(),X6=vf(),Fme=Jy(),Lme=MT(),FT="Block collections are not allowed within flow collections",LT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function zme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?Y6.YAMLMap:jme.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=Mme.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}X6.resolveFlowCollection=zme});var tB=v(eB=>{"use strict";var Ume=Ce(),qme=Pt(),Bme=Ko(),Hme=Jo(),Gme=Z6(),Zme=W6(),Vme=Q6();function zT(t,e,r,n,i,o){let s=r.type==="block-map"?Gme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Zme.resolveBlockSeq(t,e,r,n,o):Vme.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 Wme(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),zT(t,e,r,i,s)}let l=zT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Ume.isNode(u)?u:new qme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}eB.composeCollection=Wme});var qT=v(rB=>{"use strict";var UT=Pt();function Kme(t,e,r){let n=e.offset,i=Jme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?UT.Scalar.BLOCK_FOLDED:UT.Scalar.BLOCK_LITERAL,s=e.source?Yme(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?` +`+T:A.comment=T,O.comment=O.comment.substring(T.length+1)}}if(!s&&!x&&!O.found){let T=w?t(r,w,O,i):e(r,O.end,x,null,O,i);l.items.push(T),d=T.range[2],LT(w)&&i(T.range,"BLOCK_IN_FLOW",FT)}else{r.atKey=!0;let T=O.end,A=S?t(r,S,O,i):e(r,T,_,null,O,i);LT(S)&&i(A.range,"BLOCK_IN_FLOW",FT),r.atKey=!1;let D=X6.resolveProps(x??[],{flow:a,indicator:"map-value-ind",next:w,offset:A.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(D.found){if(!s&&!O.found&&r.options.strict){if(x)for(let Q of x){if(Q===D.found)break;if(Q.type==="newline"){i(Q,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}O.start0){let g=Mme.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}Q6.resolveFlowCollection=zme});var rB=v(tB=>{"use strict";var Ume=Ce(),qme=Pt(),Bme=Ko(),Hme=Jo(),Gme=V6(),Zme=K6(),Vme=eB();function zT(t,e,r,n,i,o){let s=r.type==="block-map"?Gme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Zme.resolveBlockSeq(t,e,r,n,o):Vme.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 Wme(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),zT(t,e,r,i,s)}let l=zT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Ume.isNode(u)?u:new qme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}tB.composeCollection=Wme});var qT=v(nB=>{"use strict";var UT=Pt();function Kme(t,e,r){let n=e.offset,i=Jme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?UT.Scalar.BLOCK_FOLDED:UT.Scalar.BLOCK_LITERAL,s=e.source?Yme(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,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 Jme({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 BT=Pt(),Xme=Yc();function Qme(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=BT.Scalar.PLAIN,c=ehe(o,l);break;case"single-quoted-scalar":a=BT.Scalar.QUOTE_SINGLE,c=the(o,l);break;case"double-quoted-scalar":a=BT.Scalar.QUOTE_DOUBLE,c=rhe(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=Xme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function ehe(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}`),nB(t)}function the(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),nB(t.slice(1,-1)).replace(/''/g,"'")}function nB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var BT=Pt(),Xme=Xc();function Qme(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=BT.Scalar.PLAIN,c=ehe(o,l);break;case"single-quoted-scalar":a=BT.Scalar.QUOTE_SINGLE,c=the(o,l);break;case"double-quoted-scalar":a=BT.Scalar.QUOTE_DOUBLE,c=rhe(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=Xme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function ehe(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}`),iB(t)}function the(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),iB(t.slice(1,-1)).replace(/''/g,"'")}function iB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var ua=Ce(),oB=Pt(),she=qT(),ahe=HT();function che(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?she.resolveBlockScalar(t,e,n):ahe.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[ua.SCALAR]:c?l=lhe(t.schema,i,c,r,n):e.type==="scalar"?l=uhe(t,i,e,n):l=t.schema[ua.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ua.isScalar(d)?d:new oB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new oB.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 lhe(t,e,r,n,i){if(r==="!")return t[ua.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[ua.SCALAR])}function uhe({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[ua.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ua.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}sB.composeScalar=che});var lB=v(cB=>{"use strict";function dhe(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}cB.emptyScalarPosition=dhe});var fB=v(ZT=>{"use strict";var fhe=Xd(),phe=Ce(),mhe=tB(),uB=aB(),hhe=Yc(),ghe=lB(),yhe={composeNode:dB,composeEmptyNode:GT};function dB(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=_he(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=uB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=mhe.composeCollection(yhe,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=GT(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&&(!phe.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 GT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:ghe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=uB.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 _he({options:t},{offset:e,source:r,end:n},i){let o=new fhe.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=hhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ZT.composeEmptyNode=GT;ZT.composeNode=dB});var hB=v(mB=>{"use strict";var bhe=hf(),pB=fB(),vhe=Yc(),She=bf();function whe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new bhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=She.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?pB.composeNode(l,i,u,s):pB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=vhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}mB.composeDoc=whe});var WT=v(_B=>{"use strict";var xhe=He("process"),$he=CA(),khe=hf(),vf=_f(),gB=Ce(),Ehe=hB(),Ahe=Yc();function Sf(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 yB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ua=Ce(),sB=Pt(),she=qT(),ahe=HT();function che(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?she.resolveBlockScalar(t,e,n):ahe.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[ua.SCALAR]:c?l=lhe(t.schema,i,c,r,n):e.type==="scalar"?l=uhe(t,i,e,n):l=t.schema[ua.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ua.isScalar(d)?d:new sB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new sB.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 lhe(t,e,r,n,i){if(r==="!")return t[ua.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[ua.SCALAR])}function uhe({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[ua.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ua.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}aB.composeScalar=che});var uB=v(lB=>{"use strict";function dhe(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}lB.emptyScalarPosition=dhe});var pB=v(ZT=>{"use strict";var fhe=Qd(),phe=Ce(),mhe=rB(),dB=cB(),hhe=Xc(),ghe=uB(),yhe={composeNode:fB,composeEmptyNode:GT};function fB(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=_he(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=dB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=mhe.composeCollection(yhe,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=GT(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&&(!phe.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 GT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:ghe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=dB.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 _he({options:t},{offset:e,source:r,end:n},i){let o=new fhe.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=hhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ZT.composeEmptyNode=GT;ZT.composeNode=fB});var gB=v(hB=>{"use strict";var bhe=gf(),mB=pB(),vhe=Xc(),She=vf();function whe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new bhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=She.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?mB.composeNode(l,i,u,s):mB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=vhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}hB.composeDoc=whe});var WT=v(bB=>{"use strict";var xhe=He("process"),$he=CA(),khe=gf(),Sf=bf(),yB=Ce(),Ehe=gB(),Ahe=Xc();function wf(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 _B(t){let e="",r=!1,n=!1;for(let i=0;i{let s=Sf(r);o?this.warnings.push(new vf.YAMLWarning(s,n,i)):this.errors.push(new vf.YAMLParseError(s,n,i))},this.directives=new $he.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=yB(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(gB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];gB.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 VT=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=wf(r);o?this.warnings.push(new Sf.YAMLWarning(s,n,i)):this.errors.push(new Sf.YAMLParseError(s,n,i))},this.directives=new $he.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=_B(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(yB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];yB.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=Sf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Ehe.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 vf.YAMLParseError(Sf(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 vf.YAMLParseError(Sf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Ahe.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 vf.YAMLParseError(Sf(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 khe.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}}};_B.Composer=VT});var SB=v(Jy=>{"use strict";var The=qT(),Ohe=HT(),Rhe=_f(),bB=nf();function Ihe(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 Rhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ohe.resolveFlowScalar(t,e,n);case"block-scalar":return The.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Phe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=bB.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=wf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Ehe.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 Sf.YAMLParseError(wf(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 Sf.YAMLParseError(wf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Ahe.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 Sf.YAMLParseError(wf(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 khe.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}}};bB.Composer=VT});var wB=v(Yy=>{"use strict";var The=qT(),Ohe=HT(),Rhe=bf(),vB=of();function Ihe(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 Rhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ohe.resolveFlowScalar(t,e,n);case"block-scalar":return The.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Phe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=vB.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 vB(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 Che(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=bB.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">":Dhe(t,c);break;case'"':KT(t,c,"double-quoted-scalar");break;case"'":KT(t,c,"single-quoted-scalar");break;default:KT(t,c,"scalar")}}function Dhe(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return SB(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 Che(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=vB.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">":Dhe(t,c);break;case'"':KT(t,c,"double-quoted-scalar");break;case"'":KT(t,c,"single-quoted-scalar");break;default:KT(t,c,"scalar")}}function Dhe(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}];vB(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 vB(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 KT(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})}}}Jy.createScalarToken=Phe;Jy.resolveAsScalar=Ihe;Jy.setScalarValue=Che});var xB=v(wB=>{"use strict";var Nhe=t=>"type"in t?Xy(t):Yy(t);function Xy(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Xy(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Yy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Yy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Yy(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 Yy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Xy(e)),r)for(let o of r)i+=o.source;return n&&(i+=Xy(n)),i}wB.stringify=Nhe});var AB=v(EB=>{"use strict";var JT=Symbol("break visit"),jhe=Symbol("skip children"),$B=Symbol("remove item");function da(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),kB(Object.freeze([]),t,e)}da.BREAK=JT;da.SKIP=jhe;da.REMOVE=$B;da.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};da.parentCollection=(t,e)=>{let r=da.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 kB(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 YT=SB(),Mhe=xB(),Fhe=AB(),XT="\uFEFF",QT="",eO="",tO="",Lhe=t=>!!t&&"items"in t,zhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Uhe(t){switch(t){case XT:return"";case QT:return"";case eO:return"";case tO:return"";default:return JSON.stringify(t)}}function qhe(t){switch(t){case XT:return"byte-order-mark";case QT:return"doc-mode";case eO:return"flow-error-end";case tO: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}];SB(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 SB(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 KT(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})}}}Yy.createScalarToken=Phe;Yy.resolveAsScalar=Ihe;Yy.setScalarValue=Che});var $B=v(xB=>{"use strict";var Nhe=t=>"type"in t?Qy(t):Xy(t);function Qy(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Qy(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Xy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Xy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Xy(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 Xy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Qy(e)),r)for(let o of r)i+=o.source;return n&&(i+=Qy(n)),i}xB.stringify=Nhe});var TB=v(AB=>{"use strict";var JT=Symbol("break visit"),jhe=Symbol("skip children"),kB=Symbol("remove item");function da(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),EB(Object.freeze([]),t,e)}da.BREAK=JT;da.SKIP=jhe;da.REMOVE=kB;da.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};da.parentCollection=(t,e)=>{let r=da.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 EB(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 YT=wB(),Mhe=$B(),Fhe=TB(),XT="\uFEFF",QT="",eO="",tO="",Lhe=t=>!!t&&"items"in t,zhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Uhe(t){switch(t){case XT:return"";case QT:return"";case eO:return"";case tO:return"";default:return JSON.stringify(t)}}function qhe(t){switch(t){case XT:return"byte-order-mark";case QT:return"doc-mode";case eO: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}Dr.createScalarToken=YT.createScalarToken;Dr.resolveAsScalar=YT.resolveAsScalar;Dr.setScalarValue=YT.setScalarValue;Dr.stringify=Mhe.stringify;Dr.visit=Fhe.visit;Dr.BOM=XT;Dr.DOCUMENT=QT;Dr.FLOW_END=eO;Dr.SCALAR=tO;Dr.isCollection=Lhe;Dr.isScalar=zhe;Dr.prettyToken=Uhe;Dr.tokenType=qhe});var iO=v(OB=>{"use strict";var wf=Qy();function Wn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var TB=new Set("0123456789ABCDEFabcdef"),Bhe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),e_=new Set(",[]{}"),Hhe=new Set(` ,[]{} +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Dr.createScalarToken=YT.createScalarToken;Dr.resolveAsScalar=YT.resolveAsScalar;Dr.setScalarValue=YT.setScalarValue;Dr.stringify=Mhe.stringify;Dr.visit=Fhe.visit;Dr.BOM=XT;Dr.DOCUMENT=QT;Dr.FLOW_END=eO;Dr.SCALAR=tO;Dr.isCollection=Lhe;Dr.isScalar=zhe;Dr.prettyToken=Uhe;Dr.tokenType=qhe});var iO=v(RB=>{"use strict";var xf=e_();function Wn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var OB=new Set("0123456789ABCDEFabcdef"),Bhe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),t_=new Set(",[]{}"),Hhe=new Set(` ,[]{} \r `),rO=t=>!t||Hhe.has(t),nO=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==="...")&&Wn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Wn(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===":")&&Wn(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&&!Wn(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===":")&&Wn(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=>Wn(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 wf.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(Wn(o)||e&&e_.has(o))break;r=n}else if(Wn(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 xf.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(Wn(o)||e&&t_.has(o))break;r=n}else if(Wn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&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&&e_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield wf.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(Wn(n)||r&&e_.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(;!Wn(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(Bhe.has(r))r=this.buffer[++e];else if(r==="%"&&TB.has(this.buffer[e+1])&&TB.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&&t_.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&t_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield xf.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(Wn(n)||r&&t_.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(;!Wn(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(Bhe.has(r))r=this.buffer[++e];else if(r==="%"&&OB.has(this.buffer[e+1])&&OB.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)}};OB.Lexer=nO});var sO=v(RB=>{"use strict";var oO=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 Ghe=He("process"),IB=Qy(),Zhe=iO();function Yo(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 r_(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"&&CB(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&&PB(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)}};RB.Lexer=nO});var sO=v(IB=>{"use strict";var oO=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 Ghe=He("process"),PB=e_(),Zhe=iO();function Yo(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 n_(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"&&DB(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&&CB(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(Yo(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(DB(r.key)&&!Yo(r.sep,"newline")){let s=Xc(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(Yo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Xc(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]}):Yo(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&&!Yo(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)){r_(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||Yo(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=t_(n),o=Xc(i);CB(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)){n_(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(Yo(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(NB(r.key)&&!Yo(r.sep,"newline")){let s=Qc(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(Yo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Qc(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]}):Yo(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&&!Yo(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)){n_(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||Yo(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=r_(n),o=Qc(i);DB(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=t_(e),n=Xc(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=t_(e),n=Xc(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())}}};NB.Parser=aO});var zB=v($f=>{"use strict";var jB=WT(),Vhe=hf(),xf=_f(),Whe=ZA(),Khe=Ce(),Jhe=sO(),MB=cO();function FB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Jhe.LineCounter||null,prettyErrors:e}}function Yhe(t,e={}){let{lineCounter:r,prettyErrors:n}=FB(e),i=new MB.Parser(r?.addNewLine),o=new jB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(xf.prettifyError(t,r)),a.warnings.forEach(xf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function LB(t,e={}){let{lineCounter:r,prettyErrors:n}=FB(e),i=new MB.Parser(r?.addNewLine),o=new jB.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 xf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(xf.prettifyError(t,r)),s.warnings.forEach(xf.prettifyError(t,r))),s}function Xhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=LB(t,r);if(!i)return null;if(i.warnings.forEach(o=>Whe.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 Qhe(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 Khe.isDocument(t)&&!n?t.toString(r):new Vhe.Document(t,n,r).toString(r)}$f.parse=Xhe;$f.parseAllDocuments=Yhe;$f.parseDocument=LB;$f.stringify=Qhe});var Qt=v(Ge=>{"use strict";var ege=WT(),tge=hf(),rge=TT(),lO=_f(),nge=Xd(),Xo=Ce(),ige=Vo(),oge=Pt(),sge=Ko(),age=Jo(),cge=Qy(),lge=iO(),uge=sO(),dge=cO(),n_=zB(),UB=Wd();Ge.Composer=ege.Composer;Ge.Document=tge.Document;Ge.Schema=rge.Schema;Ge.YAMLError=lO.YAMLError;Ge.YAMLParseError=lO.YAMLParseError;Ge.YAMLWarning=lO.YAMLWarning;Ge.Alias=nge.Alias;Ge.isAlias=Xo.isAlias;Ge.isCollection=Xo.isCollection;Ge.isDocument=Xo.isDocument;Ge.isMap=Xo.isMap;Ge.isNode=Xo.isNode;Ge.isPair=Xo.isPair;Ge.isScalar=Xo.isScalar;Ge.isSeq=Xo.isSeq;Ge.Pair=ige.Pair;Ge.Scalar=oge.Scalar;Ge.YAMLMap=sge.YAMLMap;Ge.YAMLSeq=age.YAMLSeq;Ge.CST=cge;Ge.Lexer=lge.Lexer;Ge.LineCounter=uge.LineCounter;Ge.Parser=dge.Parser;Ge.parse=n_.parse;Ge.parseAllDocuments=n_.parseAllDocuments;Ge.parseDocument=n_.parseDocument;Ge.stringify=n_.stringify;Ge.visit=UB.visit;Ge.visitAsync=UB.visitAsync});import{execFileSync as qB}from"node:child_process";import{existsSync as i_}from"node:fs";import{join as o_,resolve as fge}from"node:path";function pge(t){try{let e=qB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?fge(t,e):null}catch{return null}}function uO(t){let e=pge(t);if(!e)return null;try{if(i_(o_(e,"MERGE_HEAD")))return"merge";if(i_(o_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(i_(o_(e,"rebase-merge"))||i_(o_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function fa(t){return uO(t)!==null}function dO(t,e){try{let r=qB("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 s_(t,e){return dO(t,e)!==null}var pa=y(()=>{"use strict"});import{execFileSync as mge}from"node:child_process";import{existsSync as hge,readFileSync as gge}from"node:fs";import{join as GB}from"node:path";function kf(t,e){return mge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Qo(t){try{let e=kf(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 es(t,e){yge(t,e);let r=kf(t,["rev-parse","HEAD"]).trim(),n=_ge(t,e);return{groups:bge(t,n),head:r,inventory:{after:HB(c_(t,"spec.yaml")),before:HB(fO(t,e,"spec.yaml"))},since:e,unsharded_commits:xge(t,e)}}function pO(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 yge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!s_(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 _ge(t,e){let r=kf(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(!(!BB(c)&&!BB(a)))if(s.startsWith("A")){let l=a_(c_(t,c));if(!l)continue;l.status==="done"?n.push(Qc(l,"added-as-done")):l.status==="archived"&&n.push(Qc(l,"archived"))}else if(s.startsWith("D")){let l=a_(fO(t,e,a));l&&n.push(Qc(l,"archived"))}else{let l=a_(c_(t,c));if(!l)continue;let d=a_(fO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(Qc(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(Qc(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(Qc(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function BB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function Qc(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>pO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function a_(t){if(t===null)return null;let e;try{e=(0,l_.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=GB(t,e);if(!hge(r))return null;try{return gge(r,"utf8")}catch{return null}}function fO(t,e,r){try{return kf(t,["show",`${e}:${r}`])}catch{return null}}function bge(t,e){let r=vge(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 vge(t){let e=c_(t,GB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,l_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function HB(t){let e={};if(t!==null)try{let n=(0,l_.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 xge(t,e){let r=kf(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);Sge.test(a)&&(wge.test(a)||n.push({hash:s,subject:a}))}return n}var l_,Sge,wge,el=y(()=>{"use strict";l_=bt(Qt(),1);pa();Sge=/^(feat|fix)(\([^)]*\))?!?:/,wge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as ZB}from"node:child_process";import{appendFileSync as $ge,existsSync as mO,mkdirSync as kge,readFileSync as Ege,renameSync as Age,statSync as Tge}from"node:fs";import{userInfo as Oge}from"node:os";import{dirname as Rge,join as gO}from"node:path";function yO(t){return gO(t,VB,Ige)}function Xr(t,e){let r=yO(t),n=Rge(r);mO(n)||kge(n,{recursive:!0});try{mO(r)&&Tge(r).size>Pge&&Age(r,gO(n,WB))}catch{}$ge(r,`${JSON.stringify(e)} +`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=r_(e),n=Qc(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=r_(e),n=Qc(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())}}};jB.Parser=aO});var UB=v(kf=>{"use strict";var MB=WT(),Vhe=gf(),$f=bf(),Whe=ZA(),Khe=Ce(),Jhe=sO(),FB=cO();function LB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Jhe.LineCounter||null,prettyErrors:e}}function Yhe(t,e={}){let{lineCounter:r,prettyErrors:n}=LB(e),i=new FB.Parser(r?.addNewLine),o=new MB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach($f.prettifyError(t,r)),a.warnings.forEach($f.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function zB(t,e={}){let{lineCounter:r,prettyErrors:n}=LB(e),i=new FB.Parser(r?.addNewLine),o=new MB.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 $f.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach($f.prettifyError(t,r)),s.warnings.forEach($f.prettifyError(t,r))),s}function Xhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=zB(t,r);if(!i)return null;if(i.warnings.forEach(o=>Whe.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 Qhe(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 Khe.isDocument(t)&&!n?t.toString(r):new Vhe.Document(t,n,r).toString(r)}kf.parse=Xhe;kf.parseAllDocuments=Yhe;kf.parseDocument=zB;kf.stringify=Qhe});var Qt=v(Ge=>{"use strict";var ege=WT(),tge=gf(),rge=TT(),lO=bf(),nge=Qd(),Xo=Ce(),ige=Vo(),oge=Pt(),sge=Ko(),age=Jo(),cge=e_(),lge=iO(),uge=sO(),dge=cO(),i_=UB(),qB=Kd();Ge.Composer=ege.Composer;Ge.Document=tge.Document;Ge.Schema=rge.Schema;Ge.YAMLError=lO.YAMLError;Ge.YAMLParseError=lO.YAMLParseError;Ge.YAMLWarning=lO.YAMLWarning;Ge.Alias=nge.Alias;Ge.isAlias=Xo.isAlias;Ge.isCollection=Xo.isCollection;Ge.isDocument=Xo.isDocument;Ge.isMap=Xo.isMap;Ge.isNode=Xo.isNode;Ge.isPair=Xo.isPair;Ge.isScalar=Xo.isScalar;Ge.isSeq=Xo.isSeq;Ge.Pair=ige.Pair;Ge.Scalar=oge.Scalar;Ge.YAMLMap=sge.YAMLMap;Ge.YAMLSeq=age.YAMLSeq;Ge.CST=cge;Ge.Lexer=lge.Lexer;Ge.LineCounter=uge.LineCounter;Ge.Parser=dge.Parser;Ge.parse=i_.parse;Ge.parseAllDocuments=i_.parseAllDocuments;Ge.parseDocument=i_.parseDocument;Ge.stringify=i_.stringify;Ge.visit=qB.visit;Ge.visitAsync=qB.visitAsync});import{execFileSync as BB}from"node:child_process";import{existsSync as o_}from"node:fs";import{join as s_,resolve as fge}from"node:path";function pge(t){try{let e=BB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?fge(t,e):null}catch{return null}}function uO(t){let e=pge(t);if(!e)return null;try{if(o_(s_(e,"MERGE_HEAD")))return"merge";if(o_(s_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(o_(s_(e,"rebase-merge"))||o_(s_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function fa(t){return uO(t)!==null}function dO(t,e){try{let r=BB("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 a_(t,e){return dO(t,e)!==null}var pa=y(()=>{"use strict"});import{execFileSync as mge}from"node:child_process";import{existsSync as hge,readFileSync as gge}from"node:fs";import{join as ZB}from"node:path";function Ef(t,e){return mge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Qo(t){try{let e=Ef(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 es(t,e){yge(t,e);let r=Ef(t,["rev-parse","HEAD"]).trim(),n=_ge(t,e);return{groups:bge(t,n),head:r,inventory:{after:GB(l_(t,"spec.yaml")),before:GB(fO(t,e,"spec.yaml"))},since:e,unsharded_commits:xge(t,e)}}function pO(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 yge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!a_(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 _ge(t,e){let r=Ef(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(!(!HB(c)&&!HB(a)))if(s.startsWith("A")){let l=c_(l_(t,c));if(!l)continue;l.status==="done"?n.push(el(l,"added-as-done")):l.status==="archived"&&n.push(el(l,"archived"))}else if(s.startsWith("D")){let l=c_(fO(t,e,a));l&&n.push(el(l,"archived"))}else{let l=c_(l_(t,c));if(!l)continue;let d=c_(fO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(el(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(el(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(el(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function HB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function el(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>pO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function c_(t){if(t===null)return null;let e;try{e=(0,u_.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 l_(t,e){let r=ZB(t,e);if(!hge(r))return null;try{return gge(r,"utf8")}catch{return null}}function fO(t,e,r){try{return Ef(t,["show",`${e}:${r}`])}catch{return null}}function bge(t,e){let r=vge(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 vge(t){let e=l_(t,ZB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,u_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function GB(t){let e={};if(t!==null)try{let n=(0,u_.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 xge(t,e){let r=Ef(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);Sge.test(a)&&(wge.test(a)||n.push({hash:s,subject:a}))}return n}var u_,Sge,wge,tl=y(()=>{"use strict";u_=bt(Qt(),1);pa();Sge=/^(feat|fix)(\([^)]*\))?!?:/,wge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as VB}from"node:child_process";import{appendFileSync as $ge,existsSync as mO,mkdirSync as kge,readFileSync as Ege,renameSync as Age,statSync as Tge}from"node:fs";import{userInfo as Oge}from"node:os";import{dirname as Rge,join as gO}from"node:path";function yO(t){return gO(t,WB,Ige)}function Xr(t,e){let r=yO(t),n=Rge(r);mO(n)||kge(n,{recursive:!0});try{mO(r)&&Tge(r).size>Pge&&Age(r,gO(n,KB))}catch{}$ge(r,`${JSON.stringify(e)} `,"utf8")}function hO(t){if(!mO(t))return[];let e=Ege(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ma(t){return hO(yO(t))}function u_(t){return[...hO(gO(t,VB,WB)),...hO(yO(t))]}function Qr(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 Cge(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=Oge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Dge(t){try{return ZB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Ef(t,e){try{let r=ma(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Dge(t),i=Cge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Ef(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var VB,Ige,WB,Pge,Nr=y(()=>{"use strict";VB=".cladding",Ige="events.log.jsonl",WB="events.log.1.jsonl",Pge=5*1024*1024});import{execFileSync as Nge}from"node:child_process";import{existsSync as KB,readdirSync as jge,readFileSync as Mge,statSync as JB}from"node:fs";import{createHash as Fge}from"node:crypto";import{join as _O}from"node:path";function ha(t){try{return Nge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function bO(t){let e=[],r=_O(t,"spec.yaml");KB(r)&&JB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=_O(t,"spec",i);if(!(!KB(o)||!JB(o).isDirectory()))for(let s of jge(o))s.endsWith(".yaml")&&e.push(_O(o,s))}e.sort();let n=Fge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Mge(i)),n.update("\0")}return n.digest("hex")}function d_(t,e){let r={featureId:e,gitHead:ha(t),specDigest:bO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function f_(t,e){let r=ma(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 p_(t,e,r,n){let i=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Af=y(()=>{"use strict";Nr()});import{readFileSync as Lge,statSync as zge}from"node:fs";import{extname as Uge,resolve as vO,sep as qge}from"node:path";function en(t){return Math.ceil(t.length/4)}function Gge(t,e){let r=vO(e),n=vO(r,t);return n===r||n.startsWith(r+qge)}function XB(t,e,r,n){if(!Gge(t,e))return{path:t,omitted:"unsafe-path"};if(!Bge.has(Uge(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>YB)return{path:t,omitted:"too-large",bytes:o}}else{let l=vO(e,t);try{o=zge(l).size}catch{return{path:t,omitted:"missing"}}if(o>YB)return{path:t,omitted:"too-large",bytes:o};try{i=Lge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Hge))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ma(t){return hO(yO(t))}function d_(t){return[...hO(gO(t,WB,KB)),...hO(yO(t))]}function Qr(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 Cge(t){let e;try{e=VB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Oge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Dge(t){try{return VB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Af(t,e){try{let r=ma(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Dge(t),i=Cge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Af(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var WB,Ige,KB,Pge,Nr=y(()=>{"use strict";WB=".cladding",Ige="events.log.jsonl",KB="events.log.1.jsonl",Pge=5*1024*1024});import{execFileSync as Nge}from"node:child_process";import{existsSync as JB,readdirSync as jge,readFileSync as Mge,statSync as YB}from"node:fs";import{createHash as Fge}from"node:crypto";import{join as _O}from"node:path";function ha(t){try{return Nge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function bO(t){let e=[],r=_O(t,"spec.yaml");JB(r)&&YB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=_O(t,"spec",i);if(!(!JB(o)||!YB(o).isDirectory()))for(let s of jge(o))s.endsWith(".yaml")&&e.push(_O(o,s))}e.sort();let n=Fge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Mge(i)),n.update("\0")}return n.digest("hex")}function f_(t,e){let r={featureId:e,gitHead:ha(t),specDigest:bO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function p_(t,e){let r=ma(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=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Tf=y(()=>{"use strict";Nr()});import{readFileSync as Lge,statSync as zge}from"node:fs";import{extname as Uge,resolve as vO,sep as qge}from"node:path";function en(t){return Math.ceil(t.length/4)}function Gge(t,e){let r=vO(e),n=vO(r,t);return n===r||n.startsWith(r+qge)}function QB(t,e,r,n){if(!Gge(t,e))return{path:t,omitted:"unsafe-path"};if(!Bge.has(Uge(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>XB)return{path:t,omitted:"too-large",bytes:o}}else{let l=vO(e,t);try{o=zge(l).size}catch{return{path:t,omitted:"missing"}}if(o>XB)return{path:t,omitted:"too-large",bytes:o};try{i=Lge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Hge))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 Bge,YB,Hge,m_=y(()=>{"use strict";Bge=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"]),YB=2e6,Hge="\0"});function Vge(t){for(let i of Zge)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 SO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Wge(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??[])SO(e,s,o);for(let s of i.modules??[])SO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Vge(a);c&&SO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=QB.get(t);return e||(e=Wge(t),QB.set(t,e)),e}var Zge,QB,ga=y(()=>{"use strict";Zge=["derived:","fixture:","script:","self-dogfood:"];QB=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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Kge(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:xO(i)}}var ya=y(()=>{"use strict";ga()});function eH(t){return t.impacted.length}function g_(t,e,r={}){let n=r.initialDepth??h_.initialDepth,i=r.maxDepth??h_.maxDepth,o=r.coverageThreshold??h_.coverageThreshold,s=r.marginYieldThreshold??h_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=wO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=eH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var h_,$O=y(()=>{"use strict";ya();ga();h_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Jge(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 tH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Jge(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 rH=y(()=>{"use strict"});function Yge(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 tl(t,e){let r=Yge(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=tH(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 y_=y(()=>{"use strict";rH()});import{existsSync as iH,readdirSync as Xge,readFileSync as Qge}from"node:fs";import{join as EO}from"node:path";function AO(t,e=tye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function rye(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:AO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:AO(`done reverted \u2014 pre-push strict gate red${r}`)}}function nH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function nye(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 AO(n)}function iye(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)=>nH(m)-nH(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(-eye).map(rye),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?nye(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 kO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function oye(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 sye(t,e,r){let n=kO(t,/_Rolled back at_\s*`([^`]+)`/),i=kO(t,/Last failed gate:\s*`([^`]+)`/),o=kO(t,/Retry attempts:\s*(\d+)/),s=oye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function aye(t,e){let r=EO(t,".cladding","post-mortems");if(!iH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Xge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(sye(Qge(EO(r,o),"utf8"),e,o))}catch{}return i}function oH(t,e){try{let r=u_(t),n=aye(t,e),i=iH(EO(t,".cladding","events.log.1.jsonl"));return iye(r,n,e,{truncated:i})}catch{return}}var eye,tye,sH=y(()=>{"use strict";Nr();eye=5,tye=120});function __(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function _a(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:cye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=tl(t,o);if("not_found"in c)return c;let l=c.focus,u=oH(n,l.id),d=a&&a.size>0?e:l.id,f=g_(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}},O=[...c.ancestors];for(;O.length>lye&&__(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),E=(se,Pe,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],oo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(oo))>i},q=m,Q=h;if(E(q,Q,0,0)){let se=br(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],oo=0;for(;Yt.length>Pe.size&&E(Yt,Q,oo,0);)Yt=Yt.slice(0,-1),oo++;let Si=[...h],Yr=0;for(;E(Yt,Si,oo,Yr);){let de=-1;for(let so=Si.length-1;so>=0;so--)if(!Kt.has(Si[so])){de=so;break}if(de<0)break;Si.splice(de,1),Yr++}q=Yt,Q=Si,oo+Yr>0&&x.push(`breaks: omitted ${oo} feature(s) / ${Yr} test(s)`),E(q,Q,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Se=D(q,Q),P={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Se},C=P;if(u){let se={...P,prior_attempts:u};en(JSON.stringify(se))<=i?C=se:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(C));return{...C,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var cye,lye,b_=y(()=>{"use strict";m_();y_();$O();sH();ya();ga();cye=3e3,lye=3});function Kn(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 uye(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 aH(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=_a(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=_a(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=g_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:uye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var rl,v_=y(()=>{"use strict";m_();$O();b_();ga();rl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as dye,existsSync as TO,mkdirSync as fye,readFileSync as cH}from"node:fs";import{dirname as pye,join as mye}from"node:path";function OO(t){return mye(t,hye,gye)}function yye(t,e){return{timestamp:new Date().toISOString(),head:ha(t),spec_digest:bO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function lH(t,e){try{let r=yye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=RO(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=OO(t),s=pye(o);return TO(s)||fye(s,{recursive:!0}),dye(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function uH(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 RO(t,e){let r=OO(t);if(!TO(r))return[];let n;try{n=cH(r,"utf8")}catch{return[]}let i=uH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function dH(t){let e=OO(t);if(!TO(e))return{snapshots:[],unreadable:!1};let r;try{r=cH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=uH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Tf(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 fH(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?` (${Tf(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(` ${rl}`),i.join(` -`)}var hye,gye,Of=y(()=>{"use strict";Af();v_();hye=".cladding",gye="measure.jsonl"});import{existsSync as _ye}from"node:fs";import{join as bye}from"node:path";function nl(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}** (${vye[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 mH(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 ${Tf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Tf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Tf(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`,"",rl),r.join(` -`)}function il(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"} | ${wye(l,r)} |`)}return n.join(` -`)}function wye(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 Sye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${_ye(bye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function ol(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),pH(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)pH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function pH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=pO(r);n&&t.push(`- ${n}`)}t.push("")}var vye,Sye,S_=y(()=>{"use strict";Of();v_();el();vye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Sye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as xye}from"node:fs";function Ei(t="./spec.yaml"){let e=xye(t,"utf8");return(0,hH.parse)(e)}var hH,w_=y(()=>{"use strict";hH=bt(Qt(),1)});var ts=v((jr,DO)=>{"use strict";var IO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+yH(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()};IO.prototype.toString=function(){return this.property+" "+this.message};var x_=jr.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};x_.prototype.addError=function(e){var r;if(typeof e=="string")r=new IO(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 IO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new ba(this);if(this.throwError)throw r;return r};x_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function $ye(t,e){return e+": "+t.toString()+` -`}x_.prototype.toString=function(e){return this.errors.map($ye).join("")};Object.defineProperty(x_.prototype,"valid",{get:function(){return!this.errors.length}});DO.exports.ValidatorResultError=ba;function ba(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ba),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}ba.prototype=new Error;ba.prototype.constructor=ba;ba.prototype.name="Validation Error";var gH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};gH.prototype=Object.create(Error.prototype,{constructor:{value:gH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var PO=jr.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+yH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};PO.prototype.resolve=function(e){return _H(this.base,e)};PO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=_H(this.base,i||"");var s=new PO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var yH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 kye(t,e,r,n){typeof r=="object"?e[n]=CO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Eye(t,e,r){e[r]=t[r]}function Aye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=CO(t[n],e[n]):r[n]=e[n]}function CO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(kye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Eye.bind(null,t,n)),Object.keys(e).forEach(Aye.bind(null,t,e,n))),n}DO.exports.deepMerge=CO;jr.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 Tye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Tye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var _H=jr.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 wH=v((fXe,SH)=>{"use strict";var tn=ts(),Fe=tn.ValidatorResult,rs=tn.SchemaError,NO={};NO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=NO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 jO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new rs("anyOf must be an array");if(!r.anyOf.some(jO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new rs("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new rs("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(jO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=jO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 MO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new rs('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(MO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=MO(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 bH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('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&&bH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)bH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Oye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var FO=ts();LO.exports.SchemaScanResult=xH;function xH(t,e){this.id=t,this.ref=e}LO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=FO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=FO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!FO.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 $H=wH(),ns=ts(),kH=$_().scan,EH=ns.ValidatorResult,Rye=ns.ValidatorResultError,Rf=ns.SchemaError,AH=ns.SchemaContext,Iye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ai),this.attributes=Object.create($H.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=kH(r||Iye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ns.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Rf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Rf('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 Ai=Jt.prototype.types={};Ai.string=function(e){return typeof e=="string"};Ai.number=function(e){return typeof e=="number"&&isFinite(e)};Ai.integer=function(e){return typeof e=="number"&&e%1===0};Ai.boolean=function(e){return typeof e=="boolean"};Ai.array=function(e){return Array.isArray(e)};Ai.null=function(e){return e===null};Ai.date=function(e){return e instanceof Date};Ai.any=function(e){return!0};Ai.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};OH.exports=Jt});var IH=v((hXe,uo)=>{"use strict";var Pye=uo.exports.Validator=RH();uo.exports.ValidatorResult=ts().ValidatorResult;uo.exports.ValidatorResultError=ts().ValidatorResultError;uo.exports.ValidationError=ts().ValidationError;uo.exports.SchemaError=ts().SchemaError;uo.exports.SchemaScanResult=$_().SchemaScanResult;uo.exports.scan=$_().scan;uo.exports.validate=function(t,e,r){var n=new Pye;return n.validate(t,e,r)}});import{readFileSync as Cye}from"node:fs";import{dirname as Dye,join as Nye}from"node:path";import{fileURLToPath as jye}from"node:url";function Uye(t){let e=zye.validate(t,Lye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function CH(t){let e=Uye(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 Bge,XB,Hge,h_=y(()=>{"use strict";Bge=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"]),XB=2e6,Hge="\0"});function Vge(t){for(let i of Zge)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 SO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Wge(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??[])SO(e,s,o);for(let s of i.modules??[])SO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Vge(a);c&&SO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=eH.get(t);return e||(e=Wge(t),eH.set(t,e)),e}var Zge,eH,ga=y(()=>{"use strict";Zge=["derived:","fixture:","script:","self-dogfood:"];eH=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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Kge(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:xO(i)}}var ya=y(()=>{"use strict";ga()});function tH(t){return t.impacted.length}function y_(t,e,r={}){let n=r.initialDepth??g_.initialDepth,i=r.maxDepth??g_.maxDepth,o=r.coverageThreshold??g_.coverageThreshold,s=r.marginYieldThreshold??g_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=wO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=tH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var g_,$O=y(()=>{"use strict";ya();ga();g_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Jge(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 rH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Jge(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 nH=y(()=>{"use strict"});function Yge(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 rl(t,e){let r=Yge(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=rH(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 __=y(()=>{"use strict";nH()});import{existsSync as oH,readdirSync as Xge,readFileSync as Qge}from"node:fs";import{join as EO}from"node:path";function AO(t,e=tye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function rye(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:AO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:AO(`done reverted \u2014 pre-push strict gate red${r}`)}}function iH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function nye(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 AO(n)}function iye(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)=>iH(m)-iH(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(-eye).map(rye),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?nye(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 kO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function oye(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 sye(t,e,r){let n=kO(t,/_Rolled back at_\s*`([^`]+)`/),i=kO(t,/Last failed gate:\s*`([^`]+)`/),o=kO(t,/Retry attempts:\s*(\d+)/),s=oye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function aye(t,e){let r=EO(t,".cladding","post-mortems");if(!oH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Xge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(sye(Qge(EO(r,o),"utf8"),e,o))}catch{}return i}function sH(t,e){try{let r=d_(t),n=aye(t,e),i=oH(EO(t,".cladding","events.log.1.jsonl"));return iye(r,n,e,{truncated:i})}catch{return}}var eye,tye,aH=y(()=>{"use strict";Nr();eye=5,tye=120});function b_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function _a(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:cye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=rl(t,o);if("not_found"in c)return c;let l=c.focus,u=sH(n,l.id),d=a&&a.size>0?e:l.id,f=y_(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}},O=[...c.ancestors];for(;O.length>lye&&b_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),E=(se,Pe,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],oo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(oo))>i},q=m,Q=h;if(E(q,Q,0,0)){let se=br(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],oo=0;for(;Yt.length>Pe.size&&E(Yt,Q,oo,0);)Yt=Yt.slice(0,-1),oo++;let Si=[...h],Yr=0;for(;E(Yt,Si,oo,Yr);){let de=-1;for(let so=Si.length-1;so>=0;so--)if(!Kt.has(Si[so])){de=so;break}if(de<0)break;Si.splice(de,1),Yr++}q=Yt,Q=Si,oo+Yr>0&&x.push(`breaks: omitted ${oo} feature(s) / ${Yr} test(s)`),E(q,Q,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Se=D(q,Q),P={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Se},C=P;if(u){let se={...P,prior_attempts:u};en(JSON.stringify(se))<=i?C=se:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(C));return{...C,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var cye,lye,v_=y(()=>{"use strict";h_();__();$O();aH();ya();ga();cye=3e3,lye=3});function Kn(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 uye(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 cH(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=_a(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=_a(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=y_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:uye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var nl,S_=y(()=>{"use strict";h_();$O();v_();ga();nl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as dye,existsSync as TO,mkdirSync as fye,readFileSync as lH}from"node:fs";import{dirname as pye,join as mye}from"node:path";function OO(t){return mye(t,hye,gye)}function yye(t,e){return{timestamp:new Date().toISOString(),head:ha(t),spec_digest:bO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function uH(t,e){try{let r=yye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=RO(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=OO(t),s=pye(o);return TO(s)||fye(s,{recursive:!0}),dye(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function dH(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 RO(t,e){let r=OO(t);if(!TO(r))return[];let n;try{n=lH(r,"utf8")}catch{return[]}let i=dH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function fH(t){let e=OO(t);if(!TO(e))return{snapshots:[],unreadable:!1};let r;try{r=lH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=dH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Of(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 pH(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?` (${Of(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(` ${nl}`),i.join(` +`)}var hye,gye,Rf=y(()=>{"use strict";Tf();S_();hye=".cladding",gye="measure.jsonl"});import{existsSync as _ye}from"node:fs";import{join as bye}from"node:path";function il(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}** (${vye[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 hH(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 ${Of(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Of(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Of(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`,"",nl),r.join(` +`)}function ol(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"} | ${wye(l,r)} |`)}return n.join(` +`)}function wye(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 Sye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${_ye(bye(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),mH(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)mH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function mH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=pO(r);n&&t.push(`- ${n}`)}t.push("")}var vye,Sye,w_=y(()=>{"use strict";Rf();S_();tl();vye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Sye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as xye}from"node:fs";function Ei(t="./spec.yaml"){let e=xye(t,"utf8");return(0,gH.parse)(e)}var gH,x_=y(()=>{"use strict";gH=bt(Qt(),1)});var ts=v((jr,DO)=>{"use strict";var IO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+_H(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()};IO.prototype.toString=function(){return this.property+" "+this.message};var $_=jr.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};$_.prototype.addError=function(e){var r;if(typeof e=="string")r=new IO(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 IO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new ba(this);if(this.throwError)throw r;return r};$_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function $ye(t,e){return e+": "+t.toString()+` +`}$_.prototype.toString=function(e){return this.errors.map($ye).join("")};Object.defineProperty($_.prototype,"valid",{get:function(){return!this.errors.length}});DO.exports.ValidatorResultError=ba;function ba(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ba),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}ba.prototype=new Error;ba.prototype.constructor=ba;ba.prototype.name="Validation Error";var yH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};yH.prototype=Object.create(Error.prototype,{constructor:{value:yH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var PO=jr.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+_H(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};PO.prototype.resolve=function(e){return bH(this.base,e)};PO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=bH(this.base,i||"");var s=new PO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var _H=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 kye(t,e,r,n){typeof r=="object"?e[n]=CO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Eye(t,e,r){e[r]=t[r]}function Aye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=CO(t[n],e[n]):r[n]=e[n]}function CO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(kye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Eye.bind(null,t,n)),Object.keys(e).forEach(Aye.bind(null,t,e,n))),n}DO.exports.deepMerge=CO;jr.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 Tye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Tye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var bH=jr.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 xH=v((pXe,wH)=>{"use strict";var tn=ts(),Fe=tn.ValidatorResult,rs=tn.SchemaError,NO={};NO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=NO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 jO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new rs("anyOf must be an array");if(!r.anyOf.some(jO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new rs("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new rs("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(jO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=jO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 MO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new rs('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(MO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=MO(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 vH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('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&&vH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)vH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Oye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var FO=ts();LO.exports.SchemaScanResult=$H;function $H(t,e){this.id=t,this.ref=e}LO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=FO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=FO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!FO.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 kH=xH(),ns=ts(),EH=k_().scan,AH=ns.ValidatorResult,Rye=ns.ValidatorResultError,If=ns.SchemaError,TH=ns.SchemaContext,Iye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ai),this.attributes=Object.create(kH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=EH(r||Iye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ns.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new If("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new If('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 Ai=Jt.prototype.types={};Ai.string=function(e){return typeof e=="string"};Ai.number=function(e){return typeof e=="number"&&isFinite(e)};Ai.integer=function(e){return typeof e=="number"&&e%1===0};Ai.boolean=function(e){return typeof e=="boolean"};Ai.array=function(e){return Array.isArray(e)};Ai.null=function(e){return e===null};Ai.date=function(e){return e instanceof Date};Ai.any=function(e){return!0};Ai.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};RH.exports=Jt});var PH=v((gXe,uo)=>{"use strict";var Pye=uo.exports.Validator=IH();uo.exports.ValidatorResult=ts().ValidatorResult;uo.exports.ValidatorResultError=ts().ValidatorResultError;uo.exports.ValidationError=ts().ValidationError;uo.exports.SchemaError=ts().SchemaError;uo.exports.SchemaScanResult=k_().SchemaScanResult;uo.exports.scan=k_().scan;uo.exports.validate=function(t,e,r){var n=new Pye;return n.validate(t,e,r)}});import{readFileSync as Cye}from"node:fs";import{dirname as Dye,join as Nye}from"node:path";import{fileURLToPath as jye}from"node:url";function Uye(t){let e=zye.validate(t,Lye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function DH(t){let e=Uye(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var PH,Mye,Fye,Lye,zye,DH=y(()=>{"use strict";PH=bt(IH(),1),Mye=Dye(jye(import.meta.url)),Fye=Nye(Mye,"schema.json"),Lye=JSON.parse(Cye(Fye,"utf8")),zye=new PH.Validator});import{existsSync as zO,readdirSync as qye}from"node:fs";import{dirname as Bye,join as va,resolve as jH}from"node:path";function NH(t){return zO(t)?qye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ei(va(t,r))):[]}function Sa(t,e){k_=e?{cwd:jH(t),spec:e}:null}function G(t=".",e="spec.yaml"){return k_&&e==="spec.yaml"&&jH(t)===k_.cwd?k_.spec:Hye(t,e)}function Hye(t,e){let r=va(t,e),n=Ei(r),i=va(t,Bye(e),"spec");if(!n.features||n.features.length===0){let o=NH(va(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=NH(va(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=va(i,"architecture.yaml");zO(o)&&(n.architecture=Ei(o))}if(!n.capabilities||n.capabilities.length===0){let o=va(i,"capabilities.yaml");if(zO(o)){let s=Ei(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return CH(n),n}var k_,qe=y(()=>{"use strict";w_();DH();k_=null});import sl from"node:process";function BO(){return!!sl.stdout.isTTY}function L(t,e,r=""){let n=MH[t],i=r?` ${r}`:"";BO()?sl.stdout.write(`${UO[t]}${n}${qO} ${e}${i} -`):sl.stdout.write(`${n} ${e}${i} -`)}function If(t,e,r=""){if(!BO())return;let n=r?` ${r}`:"";sl.stdout.write(`${FH}${UO.start}\xB7${qO} ${t} \xB7 ${e}${n}`)}function wa(t,e,r=""){let n=MH[t],i=r?` ${r}`:"";BO()?sl.stdout.write(`${FH}${UO[t]}${n}${qO} ${e}${i} -`):sl.stdout.write(`${n} ${e}${i} -`)}var MH,UO,qO,FH,Ti=y(()=>{"use strict";MH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},UO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},qO="\x1B[0m",FH="\r\x1B[K"});import{createHash as oG}from"node:crypto";import{existsSync as w_e,readFileSync as ZO,writeFileSync as x_e}from"node:fs";import{join as E_}from"node:path";function $_e(t,e){let r=oG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(ZO(E_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function aG(t,e){let r=oG("sha256");try{r.update(ZO(E_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function is(t){let e=E_(t,...sG);if(!w_e(e))return null;let r;try{r=ZO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function A_(t){return t.features?.size??t.v1?.size??0}function T_(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)!==aG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===$_e(e,n)?{state:"fresh"}:{state:"stale"}}function cG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${aG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=k_e+`attested_modules: + `)}`)}var CH,Mye,Fye,Lye,zye,NH=y(()=>{"use strict";CH=bt(PH(),1),Mye=Dye(jye(import.meta.url)),Fye=Nye(Mye,"schema.json"),Lye=JSON.parse(Cye(Fye,"utf8")),zye=new CH.Validator});import{existsSync as zO,readdirSync as qye}from"node:fs";import{dirname as Bye,join as va,resolve as MH}from"node:path";function jH(t){return zO(t)?qye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ei(va(t,r))):[]}function Sa(t,e){E_=e?{cwd:MH(t),spec:e}:null}function G(t=".",e="spec.yaml"){return E_&&e==="spec.yaml"&&MH(t)===E_.cwd?E_.spec:Hye(t,e)}function Hye(t,e){let r=va(t,e),n=Ei(r),i=va(t,Bye(e),"spec");if(!n.features||n.features.length===0){let o=jH(va(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=jH(va(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=va(i,"architecture.yaml");zO(o)&&(n.architecture=Ei(o))}if(!n.capabilities||n.capabilities.length===0){let o=va(i,"capabilities.yaml");if(zO(o)){let s=Ei(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return DH(n),n}var E_,qe=y(()=>{"use strict";x_();NH();E_=null});import al from"node:process";function BO(){return!!al.stdout.isTTY}function L(t,e,r=""){let n=FH[t],i=r?` ${r}`:"";BO()?al.stdout.write(`${UO[t]}${n}${qO} ${e}${i} +`):al.stdout.write(`${n} ${e}${i} +`)}function Pf(t,e,r=""){if(!BO())return;let n=r?` ${r}`:"";al.stdout.write(`${LH}${UO.start}\xB7${qO} ${t} \xB7 ${e}${n}`)}function wa(t,e,r=""){let n=FH[t],i=r?` ${r}`:"";BO()?al.stdout.write(`${LH}${UO[t]}${n}${qO} ${e}${i} +`):al.stdout.write(`${n} ${e}${i} +`)}var FH,UO,qO,LH,Ti=y(()=>{"use strict";FH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},UO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},qO="\x1B[0m",LH="\r\x1B[K"});import{createHash as sG}from"node:crypto";import{existsSync as w_e,readFileSync as ZO,writeFileSync as x_e}from"node:fs";import{join as A_}from"node:path";function $_e(t,e){let r=sG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(ZO(A_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function cG(t,e){let r=sG("sha256");try{r.update(ZO(A_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function is(t){let e=A_(t,...aG);if(!w_e(e))return null;let r;try{r=ZO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function T_(t){return t.features?.size??t.v1?.size??0}function O_(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)!==cG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===$_e(e,n)?{state:"fresh"}:{state:"stale"}}function lG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${cG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=k_e+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return x_e(E_(t,...sG),s,"utf8"),!0}var sG,k_e,cl=y(()=>{"use strict";sG=["spec","attestation.yaml"];k_e=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return x_e(A_(t,...aG),s,"utf8"),!0}var aG,k_e,ll=y(()=>{"use strict";aG=["spec","attestation.yaml"];k_e=`# 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. # @@ -211,52 +211,52 @@ 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 VO}from"node:path";function O_(t){os={cwd:VO(t),results:new Map}}function lG(t,e,r){!os||os.cwd!==VO(e)||os.results.set(t,r)}function R_(t,e){return!os||os.cwd!==VO(e)?null:os.results.get(t)??null}function I_(){os=null}var os,ll=y(()=>{"use strict";os=null});function At(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 po=y(()=>{});import{fileURLToPath as E_e}from"node:url";var ul,A_e,WO,KO,dl=y(()=>{ul=(t,e)=>{let r=KO(A_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},A_e=t=>WO(t)?t.toString():t,WO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,KO=t=>t instanceof URL?E_e(t):t});var P_,JO=y(()=>{po();dl();P_=(t,e=[],r={})=>{let n=ul(t,"First argument"),[i,o]=At(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(!At(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as T_e}from"node:string_decoder";var uG,dG,zt,mo,O_e,fG,R_e,C_,pG,I_e,Df,P_e,YO,C_e,rn=y(()=>{({toString:uG}=Object.prototype),dG=t=>uG.call(t)==="[object ArrayBuffer]",zt=t=>uG.call(t)==="[object Uint8Array]",mo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),O_e=new TextEncoder,fG=t=>O_e.encode(t),R_e=new TextDecoder,C_=t=>R_e.decode(t),pG=(t,e)=>I_e(t,e).join(""),I_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new T_e(e),n=t.map(o=>typeof o=="string"?fG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Df=t=>t.length===1&&zt(t[0])?t[0]:YO(P_e(t)),P_e=t=>t.map(e=>typeof e=="string"?fG(e):e),YO=t=>{let e=new Uint8Array(C_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},C_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as D_e}from"node:child_process";var yG,_G,N_e,j_e,mG,M_e,hG,gG,F_e,bG=y(()=>{po();rn();yG=t=>Array.isArray(t)&&Array.isArray(t.raw),_G=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=N_e({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,{}]},N_e=({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}=j_e(i,t.raw[n]),c=hG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>gG(d)):[gG(l)];return hG(c,u,a)},j_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=mG.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)],gG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(At(t)&&("stdout"in t||"isMaxBuffer"in t))return F_e(t);throw t instanceof D_e||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`)},F_e=({stdout:t})=>{if(typeof t=="string")return t;if(zt(t))return C_(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 XO from"node:process";var Yn,D_,En,N_,ho=y(()=>{Yn=t=>D_.includes(t),D_=[XO.stdin,XO.stdout,XO.stderr],En=["stdin","stdout","stderr"],N_=t=>En[t]??`stdio[${t}]`});import{debuglog as L_e}from"node:util";var SG,QO,z_e,U_e,q_e,B_e,vG,H_e,eR,G_e,Z_e,V_e,W_e,tR,go,yo=y(()=>{po();ho();SG=t=>{let e={...t};for(let r of tR)e[r]=QO(t,r);return e},QO=(t,e)=>{let r=Array.from({length:z_e(t)+1}),n=U_e(t[e],r,e);return Z_e(n,e)},z_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,U_e=(t,e,r)=>At(t)?q_e(t,e,r):e.fill(t),q_e=(t,e,r)=>{for(let n of Object.keys(t).sort(B_e))for(let i of H_e(n,r,e))e[i]=t[n];return e},B_e=(t,e)=>vG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,H_e=(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 VO}from"node:path";function R_(t){os={cwd:VO(t),results:new Map}}function uG(t,e,r){!os||os.cwd!==VO(e)||os.results.set(t,r)}function I_(t,e){return!os||os.cwd!==VO(e)?null:os.results.get(t)??null}function P_(){os=null}var os,ul=y(()=>{"use strict";os=null});function At(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 po=y(()=>{});import{fileURLToPath as E_e}from"node:url";var dl,A_e,WO,KO,fl=y(()=>{dl=(t,e)=>{let r=KO(A_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},A_e=t=>WO(t)?t.toString():t,WO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,KO=t=>t instanceof URL?E_e(t):t});var C_,JO=y(()=>{po();fl();C_=(t,e=[],r={})=>{let n=dl(t,"First argument"),[i,o]=At(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(!At(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as T_e}from"node:string_decoder";var dG,fG,zt,mo,O_e,pG,R_e,D_,mG,I_e,Nf,P_e,YO,C_e,rn=y(()=>{({toString:dG}=Object.prototype),fG=t=>dG.call(t)==="[object ArrayBuffer]",zt=t=>dG.call(t)==="[object Uint8Array]",mo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),O_e=new TextEncoder,pG=t=>O_e.encode(t),R_e=new TextDecoder,D_=t=>R_e.decode(t),mG=(t,e)=>I_e(t,e).join(""),I_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new T_e(e),n=t.map(o=>typeof o=="string"?pG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Nf=t=>t.length===1&&zt(t[0])?t[0]:YO(P_e(t)),P_e=t=>t.map(e=>typeof e=="string"?pG(e):e),YO=t=>{let e=new Uint8Array(C_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},C_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as D_e}from"node:child_process";var _G,bG,N_e,j_e,hG,M_e,gG,yG,F_e,vG=y(()=>{po();rn();_G=t=>Array.isArray(t)&&Array.isArray(t.raw),bG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=N_e({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,{}]},N_e=({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}=j_e(i,t.raw[n]),c=gG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>yG(d)):[yG(l)];return gG(c,u,a)},j_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=hG.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)],yG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(At(t)&&("stdout"in t||"isMaxBuffer"in t))return F_e(t);throw t instanceof D_e||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`)},F_e=({stdout:t})=>{if(typeof t=="string")return t;if(zt(t))return D_(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 XO from"node:process";var Yn,N_,En,j_,ho=y(()=>{Yn=t=>N_.includes(t),N_=[XO.stdin,XO.stdout,XO.stderr],En=["stdin","stdout","stderr"],j_=t=>En[t]??`stdio[${t}]`});import{debuglog as L_e}from"node:util";var wG,QO,z_e,U_e,q_e,B_e,SG,H_e,eR,G_e,Z_e,V_e,W_e,tR,go,yo=y(()=>{po();ho();wG=t=>{let e={...t};for(let r of tR)e[r]=QO(t,r);return e},QO=(t,e)=>{let r=Array.from({length:z_e(t)+1}),n=U_e(t[e],r,e);return Z_e(n,e)},z_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,U_e=(t,e,r)=>At(t)?q_e(t,e,r):e.fill(t),q_e=(t,e,r)=>{for(let n of Object.keys(t).sort(B_e))for(let i of H_e(n,r,e))e[i]=t[n];return e},B_e=(t,e)=>SG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,H_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=eR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist. -Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},eR=t=>{if(t==="all")return t;if(En.includes(t))return En.indexOf(t);let e=G_e.exec(t);if(e!==null)return Number(e[1])},G_e=/^fd(\d+)$/,Z_e=(t,e)=>t.map(r=>r===void 0?W_e[e]:r),V_e=L_e("execa").enabled?"full":"none",W_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:V_e,stripFinalNewline:!0},tR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],go=(t,e)=>e==="ipc"?t.at(-1):t[e]});var fl,pl,wG,rR,K_e,j_,M_,ss=y(()=>{yo();fl=({verbose:t},e)=>rR(t,e)!=="none",pl=({verbose:t},e)=>!["none","short"].includes(rR(t,e)),wG=({verbose:t},e)=>{let r=rR(t,e);return j_(r)?r:void 0},rR=(t,e)=>e===void 0?K_e(t):go(t,e),K_e=t=>t.find(e=>j_(e))??M_.findLast(e=>t.includes(e)),j_=t=>typeof t=="function",M_=["none","short","full"]});import{platform as J_e}from"node:process";import{stripVTControlCharacters as Y_e}from"node:util";var xG,Nf,$G,X_e,Q_e,ebe,tbe,rbe,nbe,ibe,F_=y(()=>{xG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>nbe($G(o))).join(" ");return{command:n,escapedCommand:i}},Nf=t=>Y_e(t).split(` -`).map(e=>$G(e)).join(` -`),$G=t=>t.replaceAll(ebe,e=>X_e(e)),X_e=t=>{let e=tbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=rbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Q_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},ebe=Q_e(),tbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},rbe=65535,nbe=t=>ibe.test(t)?t:J_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,ibe=/^[\w./-]+$/});import kG from"node:process";function nR(){let{env:t}=kG,{TERM:e,TERM_PROGRAM:r}=t;return kG.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 EG=y(()=>{});var AG,TG,obe,sbe,abe,cbe,lbe,L_,b7e,OG=y(()=>{EG();AG={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"},TG={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"},obe={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"},sbe={...AG,...TG},abe={...AG,...obe},cbe=nR(),lbe=cbe?sbe:abe,L_=lbe,b7e=Object.entries(TG)});import ube from"node:tty";var dbe,_e,w7e,RG,x7e,$7e,k7e,E7e,A7e,T7e,O7e,R7e,I7e,P7e,C7e,D7e,N7e,j7e,M7e,z_,F7e,L7e,z7e,U7e,q7e,B7e,H7e,G7e,Z7e,IG,V7e,PG,W7e,K7e,J7e,Y7e,X7e,Q7e,eQe,tQe,rQe,nQe,iQe,iR=y(()=>{dbe=ube?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!dbe)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}},w7e=_e(0,0),RG=_e(1,22),x7e=_e(2,22),$7e=_e(3,23),k7e=_e(4,24),E7e=_e(53,55),A7e=_e(7,27),T7e=_e(8,28),O7e=_e(9,29),R7e=_e(30,39),I7e=_e(31,39),P7e=_e(32,39),C7e=_e(33,39),D7e=_e(34,39),N7e=_e(35,39),j7e=_e(36,39),M7e=_e(37,39),z_=_e(90,39),F7e=_e(40,49),L7e=_e(41,49),z7e=_e(42,49),U7e=_e(43,49),q7e=_e(44,49),B7e=_e(45,49),H7e=_e(46,49),G7e=_e(47,49),Z7e=_e(100,49),IG=_e(91,39),V7e=_e(92,39),PG=_e(93,39),W7e=_e(94,39),K7e=_e(95,39),J7e=_e(96,39),Y7e=_e(97,39),X7e=_e(101,49),Q7e=_e(102,49),eQe=_e(103,49),tQe=_e(104,49),rQe=_e(105,49),nQe=_e(106,49),iQe=_e(107,49)});var CG=y(()=>{iR();iR()});var jG,pbe,U_,DG,mbe,NG,hbe,MG=y(()=>{OG();CG();jG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=pbe(r),c=mbe[t]({failed:o,reject:s,piped:n}),l=hbe[t]({reject:s});return`${z_(`[${a}]`)} ${z_(`[${i}]`)} ${l(c)} ${l(e)}`},pbe=t=>`${U_(t.getHours(),2)}:${U_(t.getMinutes(),2)}:${U_(t.getSeconds(),2)}.${U_(t.getMilliseconds(),3)}`,U_=(t,e)=>String(t).padStart(e,"0"),DG=({failed:t,reject:e})=>t?e?L_.cross:L_.warning:L_.tick,mbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:DG,duration:DG},NG=t=>t,hbe={command:()=>RG,output:()=>NG,ipc:()=>NG,error:({reject:t})=>t?IG:PG,duration:()=>z_}});var FG,gbe,ybe,LG=y(()=>{ss();FG=(t,e,r)=>{let n=wG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>gbe(i,o,n)).filter(i=>i!==void 0).map(i=>ybe(i)).join("")},gbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ybe=t=>t.endsWith(` +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(En.includes(t))return En.indexOf(t);let e=G_e.exec(t);if(e!==null)return Number(e[1])},G_e=/^fd(\d+)$/,Z_e=(t,e)=>t.map(r=>r===void 0?W_e[e]:r),V_e=L_e("execa").enabled?"full":"none",W_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:V_e,stripFinalNewline:!0},tR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],go=(t,e)=>e==="ipc"?t.at(-1):t[e]});var pl,ml,xG,rR,K_e,M_,F_,ss=y(()=>{yo();pl=({verbose:t},e)=>rR(t,e)!=="none",ml=({verbose:t},e)=>!["none","short"].includes(rR(t,e)),xG=({verbose:t},e)=>{let r=rR(t,e);return M_(r)?r:void 0},rR=(t,e)=>e===void 0?K_e(t):go(t,e),K_e=t=>t.find(e=>M_(e))??F_.findLast(e=>t.includes(e)),M_=t=>typeof t=="function",F_=["none","short","full"]});import{platform as J_e}from"node:process";import{stripVTControlCharacters as Y_e}from"node:util";var $G,jf,kG,X_e,Q_e,ebe,tbe,rbe,nbe,ibe,L_=y(()=>{$G=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>nbe(kG(o))).join(" ");return{command:n,escapedCommand:i}},jf=t=>Y_e(t).split(` +`).map(e=>kG(e)).join(` +`),kG=t=>t.replaceAll(ebe,e=>X_e(e)),X_e=t=>{let e=tbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=rbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Q_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},ebe=Q_e(),tbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},rbe=65535,nbe=t=>ibe.test(t)?t:J_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,ibe=/^[\w./-]+$/});import EG from"node:process";function nR(){let{env:t}=EG,{TERM:e,TERM_PROGRAM:r}=t;return EG.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 AG=y(()=>{});var TG,OG,obe,sbe,abe,cbe,lbe,z_,v7e,RG=y(()=>{AG();TG={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"},OG={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"},obe={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"},sbe={...TG,...OG},abe={...TG,...obe},cbe=nR(),lbe=cbe?sbe:abe,z_=lbe,v7e=Object.entries(OG)});import ube from"node:tty";var dbe,_e,x7e,IG,$7e,k7e,E7e,A7e,T7e,O7e,R7e,I7e,P7e,C7e,D7e,N7e,j7e,M7e,F7e,U_,L7e,z7e,U7e,q7e,B7e,H7e,G7e,Z7e,V7e,PG,W7e,CG,K7e,J7e,Y7e,X7e,Q7e,eQe,tQe,rQe,nQe,iQe,oQe,iR=y(()=>{dbe=ube?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!dbe)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}},x7e=_e(0,0),IG=_e(1,22),$7e=_e(2,22),k7e=_e(3,23),E7e=_e(4,24),A7e=_e(53,55),T7e=_e(7,27),O7e=_e(8,28),R7e=_e(9,29),I7e=_e(30,39),P7e=_e(31,39),C7e=_e(32,39),D7e=_e(33,39),N7e=_e(34,39),j7e=_e(35,39),M7e=_e(36,39),F7e=_e(37,39),U_=_e(90,39),L7e=_e(40,49),z7e=_e(41,49),U7e=_e(42,49),q7e=_e(43,49),B7e=_e(44,49),H7e=_e(45,49),G7e=_e(46,49),Z7e=_e(47,49),V7e=_e(100,49),PG=_e(91,39),W7e=_e(92,39),CG=_e(93,39),K7e=_e(94,39),J7e=_e(95,39),Y7e=_e(96,39),X7e=_e(97,39),Q7e=_e(101,49),eQe=_e(102,49),tQe=_e(103,49),rQe=_e(104,49),nQe=_e(105,49),iQe=_e(106,49),oQe=_e(107,49)});var DG=y(()=>{iR();iR()});var MG,pbe,q_,NG,mbe,jG,hbe,FG=y(()=>{RG();DG();MG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=pbe(r),c=mbe[t]({failed:o,reject:s,piped:n}),l=hbe[t]({reject:s});return`${U_(`[${a}]`)} ${U_(`[${i}]`)} ${l(c)} ${l(e)}`},pbe=t=>`${q_(t.getHours(),2)}:${q_(t.getMinutes(),2)}:${q_(t.getSeconds(),2)}.${q_(t.getMilliseconds(),3)}`,q_=(t,e)=>String(t).padStart(e,"0"),NG=({failed:t,reject:e})=>t?e?z_.cross:z_.warning:z_.tick,mbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:NG,duration:NG},jG=t=>t,hbe={command:()=>IG,output:()=>jG,ipc:()=>jG,error:({reject:t})=>t?PG:CG,duration:()=>U_}});var LG,gbe,ybe,zG=y(()=>{ss();LG=(t,e,r)=>{let n=xG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>gbe(i,o,n)).filter(i=>i!==void 0).map(i=>ybe(i)).join("")},gbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ybe=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as _be}from"node:util";var Oi,bbe,vbe,Sbe,q_,wbe,ml=y(()=>{F_();MG();LG();Oi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=bbe({type:t,result:i,verboseInfo:n}),s=vbe(e,o),a=FG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},bbe=({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}),vbe=(t,e)=>t.split(` -`).map(r=>Sbe({...e,message:r})),Sbe=t=>({verboseLine:jG(t),verboseObject:t}),q_=t=>{let e=typeof t=="string"?t:_be(t);return Nf(e).replaceAll(" "," ".repeat(wbe))},wbe=2});var zG,UG=y(()=>{ss();ml();zG=(t,e)=>{fl(e)&&Oi({type:"command",verboseMessage:t,verboseInfo:e})}});var qG,xbe,$be,kbe,BG=y(()=>{ss();qG=(t,e,r)=>{kbe(t);let n=xbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},xbe=t=>fl({verbose:t})?$be++:void 0,$be=0n,kbe=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(!M_.includes(e)&&!j_(e)){let r=M_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as HG}from"node:process";var B_,oR,H_=y(()=>{B_=()=>HG.bigint(),oR=t=>Number(HG.bigint()-t)/1e6});var G_,sR=y(()=>{UG();BG();H_();F_();yo();G_=(t,e,r)=>{let n=B_(),{command:i,escapedCommand:o}=xG(t,e),s=QO(r,"verbose"),a=qG(s,o,{...r});return zG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var KG=v((RQe,WG)=>{WG.exports=VG;VG.sync=Abe;var GG=He("fs");function Ebe(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{QG.exports=YG;YG.sync=Tbe;var JG=He("fs");function YG(t,e,r){JG.stat(t,function(n,i){r(n,n?!1:XG(i,e))})}function Tbe(t,e){return XG(JG.statSync(t),e)}function XG(t,e){return t.isFile()&&Obe(t,e)}function Obe(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 rZ=v((CQe,tZ)=>{var PQe=He("fs"),Z_;process.platform==="win32"||global.TESTING_WINDOWS?Z_=KG():Z_=eZ();tZ.exports=aR;aR.sync=Rbe;function aR(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){aR(t,e||{},function(o,s){o?i(o):n(s)})})}Z_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Rbe(t,e){try{return Z_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var lZ=v((DQe,cZ)=>{var hl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",nZ=He("path"),Ibe=hl?";":":",iZ=rZ(),oZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),sZ=(t,e)=>{let r=e.colon||Ibe,n=t.match(/\//)||hl&&t.match(/\\/)?[""]:[...hl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=hl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=hl?i.split(r):[""];return hl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},aZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=sZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(oZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=nZ.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];iZ(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)},Pbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=sZ(t,e),o=[];for(let s=0;s{"use strict";var uZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};cR.exports=uZ;cR.exports.default=uZ});var hZ=v((jQe,mZ)=>{"use strict";var fZ=He("path"),Cbe=lZ(),Dbe=dZ();function pZ(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=Cbe.sync(t.command,{path:r[Dbe({env:r})],pathExt:e?fZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=fZ.resolve(i?t.options.cwd:"",s)),s}function Nbe(t){return pZ(t)||pZ(t,!0)}mZ.exports=Nbe});var gZ=v((MQe,uR)=>{"use strict";var lR=/([()\][%!^"`<>&|;, *?])/g;function jbe(t){return t=t.replace(lR,"^$1"),t}function Mbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(lR,"^$1"),e&&(t=t.replace(lR,"^$1")),t}uR.exports.command=jbe;uR.exports.argument=Mbe});var _Z=v((FQe,yZ)=>{"use strict";yZ.exports=/^#!(.*)/});var vZ=v((LQe,bZ)=>{"use strict";var Fbe=_Z();bZ.exports=(t="")=>{let e=t.match(Fbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var wZ=v((zQe,SZ)=>{"use strict";var dR=He("fs"),Lbe=vZ();function zbe(t){let r=Buffer.alloc(150),n;try{n=dR.openSync(t,"r"),dR.readSync(n,r,0,150,0),dR.closeSync(n)}catch{}return Lbe(r.toString())}SZ.exports=zbe});var EZ=v((UQe,kZ)=>{"use strict";var Ube=He("path"),xZ=hZ(),$Z=gZ(),qbe=wZ(),Bbe=process.platform==="win32",Hbe=/\.(?:com|exe)$/i,Gbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Zbe(t){t.file=xZ(t);let e=t.file&&qbe(t.file);return e?(t.args.unshift(t.file),t.command=e,xZ(t)):t.file}function Vbe(t){if(!Bbe)return t;let e=Zbe(t),r=!Hbe.test(e);if(t.options.forceShell||r){let n=Gbe.test(e);t.command=Ube.normalize(t.command),t.command=$Z.command(t.command),t.args=t.args.map(o=>$Z.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 Wbe(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:Vbe(n)}kZ.exports=Wbe});var OZ=v((qQe,TZ)=>{"use strict";var fR=process.platform==="win32";function pR(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 Kbe(t,e){if(!fR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=AZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function AZ(t,e){return fR&&t===1&&!e.file?pR(e.original,"spawn"):null}function Jbe(t,e){return fR&&t===1&&!e.file?pR(e.original,"spawnSync"):null}TZ.exports={hookChildProcess:Kbe,verifyENOENT:AZ,verifyENOENTSync:Jbe,notFoundError:pR}});var PZ=v((BQe,gl)=>{"use strict";var RZ=He("child_process"),mR=EZ(),hR=OZ();function IZ(t,e,r){let n=mR(t,e,r),i=RZ.spawn(n.command,n.args,n.options);return hR.hookChildProcess(i,n),i}function Ybe(t,e,r){let n=mR(t,e,r),i=RZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||hR.verifyENOENTSync(i.status,n),i}gl.exports=IZ;gl.exports.spawn=IZ;gl.exports.sync=Ybe;gl.exports._parse=mR;gl.exports._enoent=hR});function V_(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 CZ=y(()=>{});var DZ=y(()=>{});import{promisify as Xbe}from"node:util";import{execFile as Qbe,execFileSync as WQe}from"node:child_process";import NZ from"node:path";import{fileURLToPath as eve}from"node:url";function W_(t){return t instanceof URL?eve(t):t}function jZ(t){return{*[Symbol.iterator](){let e=NZ.resolve(W_(t)),r;for(;r!==e;)yield e,r=e,e=NZ.resolve(e,"..")}}}var YQe,XQe,MZ=y(()=>{DZ();YQe=Xbe(Qbe);XQe=10*1024*1024});import K_ from"node:process";import $a from"node:path";var tve,rve,nve,FZ,LZ=y(()=>{CZ();MZ();tve=({cwd:t=K_.cwd(),path:e=K_.env[V_()],preferLocal:r=!0,execPath:n=K_.execPath,addExecPath:i=!0}={})=>{let o=$a.resolve(W_(t)),s=[],a=e.split($a.delimiter);return r&&rve(s,a,o),i&&nve(s,a,n,o),e===""||e===$a.delimiter?`${s.join($a.delimiter)}${e}`:[...s,e].join($a.delimiter)},rve=(t,e,r)=>{for(let n of jZ(r)){let i=$a.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},nve=(t,e,r,n)=>{let i=$a.resolve(n,W_(r),"..");e.includes(i)||t.push(i)},FZ=({env:t=K_.env,...e}={})=>{t={...t};let r=V_({env:t});return e.path=t[r],t[r]=tve(e),t}});var zZ,Xn,UZ,qZ,BZ,J_,jf,Mf,ka=y(()=>{zZ=(t,e,r)=>{let n=r?Mf:jf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},UZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,BZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},qZ=t=>J_(t)&&BZ in t,BZ=Symbol("isExecaError"),J_=t=>Object.prototype.toString.call(t)==="[object Error]",jf=class extends Error{};UZ(jf,jf.name);Mf=class extends Error{};UZ(Mf,Mf.name)});var HZ,ive,GZ,ZZ,VZ=y(()=>{HZ=()=>{let t=ZZ-GZ+1;return Array.from({length:t},ive)},ive=(t,e)=>({name:`SIGRT${e+1}`,number:GZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),GZ=34,ZZ=64});var WZ,KZ=y(()=>{WZ=[{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 ove}from"node:os";var gR,sve,JZ=y(()=>{KZ();VZ();gR=()=>{let t=HZ();return[...WZ,...t].map(sve)},sve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=ove,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as ave}from"node:os";var cve,lve,YZ,uve,dve,fve,get,XZ=y(()=>{JZ();cve=()=>{let t=gR();return Object.fromEntries(t.map(lve))},lve=({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}],YZ=cve(),uve=()=>{let t=gR(),e=65,r=Array.from({length:e},(n,i)=>dve(i,t));return Object.assign({},...r)},dve=(t,e)=>{let r=fve(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}}},fve=(t,e)=>{let r=e.find(({name:n})=>ave.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},get=uve()});import{constants as Ff}from"node:os";var e9,t9,r9,pve,mve,QZ,hve,yR,gve,yve,Y_,Lf=y(()=>{XZ();e9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return r9(t,e)},t9=t=>t===0?t:r9(t,"`subprocess.kill()`'s argument"),r9=(t,e)=>{if(Number.isInteger(t))return pve(t,e);if(typeof t=="string")return hve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${yR()}`)},pve=(t,e)=>{if(QZ.has(t))return QZ.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${yR()}`)},mve=()=>new Map(Object.entries(Ff.signals).reverse().map(([t,e])=>[e,t])),QZ=mve(),hve=(t,e)=>{if(t in Ff.signals)return t;throw t.toUpperCase()in Ff.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +`});import{inspect as _be}from"node:util";var Oi,bbe,vbe,Sbe,B_,wbe,hl=y(()=>{L_();FG();zG();Oi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=bbe({type:t,result:i,verboseInfo:n}),s=vbe(e,o),a=LG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},bbe=({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}),vbe=(t,e)=>t.split(` +`).map(r=>Sbe({...e,message:r})),Sbe=t=>({verboseLine:MG(t),verboseObject:t}),B_=t=>{let e=typeof t=="string"?t:_be(t);return jf(e).replaceAll(" "," ".repeat(wbe))},wbe=2});var UG,qG=y(()=>{ss();hl();UG=(t,e)=>{pl(e)&&Oi({type:"command",verboseMessage:t,verboseInfo:e})}});var BG,xbe,$be,kbe,HG=y(()=>{ss();BG=(t,e,r)=>{kbe(t);let n=xbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},xbe=t=>pl({verbose:t})?$be++:void 0,$be=0n,kbe=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(!F_.includes(e)&&!M_(e)){let r=F_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as GG}from"node:process";var H_,oR,G_=y(()=>{H_=()=>GG.bigint(),oR=t=>Number(GG.bigint()-t)/1e6});var Z_,sR=y(()=>{qG();HG();G_();L_();yo();Z_=(t,e,r)=>{let n=H_(),{command:i,escapedCommand:o}=$G(t,e),s=QO(r,"verbose"),a=BG(s,o,{...r});return UG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var JG=v((IQe,KG)=>{KG.exports=WG;WG.sync=Abe;var ZG=He("fs");function Ebe(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{eZ.exports=XG;XG.sync=Tbe;var YG=He("fs");function XG(t,e,r){YG.stat(t,function(n,i){r(n,n?!1:QG(i,e))})}function Tbe(t,e){return QG(YG.statSync(t),e)}function QG(t,e){return t.isFile()&&Obe(t,e)}function Obe(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 nZ=v((DQe,rZ)=>{var CQe=He("fs"),V_;process.platform==="win32"||global.TESTING_WINDOWS?V_=JG():V_=tZ();rZ.exports=aR;aR.sync=Rbe;function aR(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){aR(t,e||{},function(o,s){o?i(o):n(s)})})}V_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Rbe(t,e){try{return V_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var uZ=v((NQe,lZ)=>{var gl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",iZ=He("path"),Ibe=gl?";":":",oZ=nZ(),sZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),aZ=(t,e)=>{let r=e.colon||Ibe,n=t.match(/\//)||gl&&t.match(/\\/)?[""]:[...gl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=gl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=gl?i.split(r):[""];return gl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},cZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=aZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(sZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=iZ.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];oZ(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)},Pbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=aZ(t,e),o=[];for(let s=0;s{"use strict";var dZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};cR.exports=dZ;cR.exports.default=dZ});var gZ=v((MQe,hZ)=>{"use strict";var pZ=He("path"),Cbe=uZ(),Dbe=fZ();function mZ(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=Cbe.sync(t.command,{path:r[Dbe({env:r})],pathExt:e?pZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=pZ.resolve(i?t.options.cwd:"",s)),s}function Nbe(t){return mZ(t)||mZ(t,!0)}hZ.exports=Nbe});var yZ=v((FQe,uR)=>{"use strict";var lR=/([()\][%!^"`<>&|;, *?])/g;function jbe(t){return t=t.replace(lR,"^$1"),t}function Mbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(lR,"^$1"),e&&(t=t.replace(lR,"^$1")),t}uR.exports.command=jbe;uR.exports.argument=Mbe});var bZ=v((LQe,_Z)=>{"use strict";_Z.exports=/^#!(.*)/});var SZ=v((zQe,vZ)=>{"use strict";var Fbe=bZ();vZ.exports=(t="")=>{let e=t.match(Fbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var xZ=v((UQe,wZ)=>{"use strict";var dR=He("fs"),Lbe=SZ();function zbe(t){let r=Buffer.alloc(150),n;try{n=dR.openSync(t,"r"),dR.readSync(n,r,0,150,0),dR.closeSync(n)}catch{}return Lbe(r.toString())}wZ.exports=zbe});var AZ=v((qQe,EZ)=>{"use strict";var Ube=He("path"),$Z=gZ(),kZ=yZ(),qbe=xZ(),Bbe=process.platform==="win32",Hbe=/\.(?:com|exe)$/i,Gbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Zbe(t){t.file=$Z(t);let e=t.file&&qbe(t.file);return e?(t.args.unshift(t.file),t.command=e,$Z(t)):t.file}function Vbe(t){if(!Bbe)return t;let e=Zbe(t),r=!Hbe.test(e);if(t.options.forceShell||r){let n=Gbe.test(e);t.command=Ube.normalize(t.command),t.command=kZ.command(t.command),t.args=t.args.map(o=>kZ.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 Wbe(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:Vbe(n)}EZ.exports=Wbe});var RZ=v((BQe,OZ)=>{"use strict";var fR=process.platform==="win32";function pR(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 Kbe(t,e){if(!fR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=TZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function TZ(t,e){return fR&&t===1&&!e.file?pR(e.original,"spawn"):null}function Jbe(t,e){return fR&&t===1&&!e.file?pR(e.original,"spawnSync"):null}OZ.exports={hookChildProcess:Kbe,verifyENOENT:TZ,verifyENOENTSync:Jbe,notFoundError:pR}});var CZ=v((HQe,yl)=>{"use strict";var IZ=He("child_process"),mR=AZ(),hR=RZ();function PZ(t,e,r){let n=mR(t,e,r),i=IZ.spawn(n.command,n.args,n.options);return hR.hookChildProcess(i,n),i}function Ybe(t,e,r){let n=mR(t,e,r),i=IZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||hR.verifyENOENTSync(i.status,n),i}yl.exports=PZ;yl.exports.spawn=PZ;yl.exports.sync=Ybe;yl.exports._parse=mR;yl.exports._enoent=hR});function W_(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 DZ=y(()=>{});var NZ=y(()=>{});import{promisify as Xbe}from"node:util";import{execFile as Qbe,execFileSync as KQe}from"node:child_process";import jZ from"node:path";import{fileURLToPath as eve}from"node:url";function K_(t){return t instanceof URL?eve(t):t}function MZ(t){return{*[Symbol.iterator](){let e=jZ.resolve(K_(t)),r;for(;r!==e;)yield e,r=e,e=jZ.resolve(e,"..")}}}var XQe,QQe,FZ=y(()=>{NZ();XQe=Xbe(Qbe);QQe=10*1024*1024});import J_ from"node:process";import $a from"node:path";var tve,rve,nve,LZ,zZ=y(()=>{DZ();FZ();tve=({cwd:t=J_.cwd(),path:e=J_.env[W_()],preferLocal:r=!0,execPath:n=J_.execPath,addExecPath:i=!0}={})=>{let o=$a.resolve(K_(t)),s=[],a=e.split($a.delimiter);return r&&rve(s,a,o),i&&nve(s,a,n,o),e===""||e===$a.delimiter?`${s.join($a.delimiter)}${e}`:[...s,e].join($a.delimiter)},rve=(t,e,r)=>{for(let n of MZ(r)){let i=$a.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},nve=(t,e,r,n)=>{let i=$a.resolve(n,K_(r),"..");e.includes(i)||t.push(i)},LZ=({env:t=J_.env,...e}={})=>{t={...t};let r=W_({env:t});return e.path=t[r],t[r]=tve(e),t}});var UZ,Xn,qZ,BZ,HZ,Y_,Mf,Ff,ka=y(()=>{UZ=(t,e,r)=>{let n=r?Ff:Mf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},qZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,HZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},BZ=t=>Y_(t)&&HZ in t,HZ=Symbol("isExecaError"),Y_=t=>Object.prototype.toString.call(t)==="[object Error]",Mf=class extends Error{};qZ(Mf,Mf.name);Ff=class extends Error{};qZ(Ff,Ff.name)});var GZ,ive,ZZ,VZ,WZ=y(()=>{GZ=()=>{let t=VZ-ZZ+1;return Array.from({length:t},ive)},ive=(t,e)=>({name:`SIGRT${e+1}`,number:ZZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),ZZ=34,VZ=64});var KZ,JZ=y(()=>{KZ=[{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 ove}from"node:os";var gR,sve,YZ=y(()=>{JZ();WZ();gR=()=>{let t=GZ();return[...KZ,...t].map(sve)},sve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=ove,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as ave}from"node:os";var cve,lve,XZ,uve,dve,fve,yet,QZ=y(()=>{YZ();cve=()=>{let t=gR();return Object.fromEntries(t.map(lve))},lve=({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}],XZ=cve(),uve=()=>{let t=gR(),e=65,r=Array.from({length:e},(n,i)=>dve(i,t));return Object.assign({},...r)},dve=(t,e)=>{let r=fve(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}}},fve=(t,e)=>{let r=e.find(({name:n})=>ave.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},yet=uve()});import{constants as Lf}from"node:os";var t9,r9,n9,pve,mve,e9,hve,yR,gve,yve,X_,zf=y(()=>{QZ();t9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return n9(t,e)},r9=t=>t===0?t:n9(t,"`subprocess.kill()`'s argument"),n9=(t,e)=>{if(Number.isInteger(t))return pve(t,e);if(typeof t=="string")return hve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${yR()}`)},pve=(t,e)=>{if(e9.has(t))return e9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${yR()}`)},mve=()=>new Map(Object.entries(Lf.signals).reverse().map(([t,e])=>[e,t])),e9=mve(),hve=(t,e)=>{if(t in Lf.signals)return t;throw t.toUpperCase()in Lf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. ${yR()}`)},yR=()=>`Available signal names: ${gve()}. -Available signal numbers: ${yve()}.`,gve=()=>Object.keys(Ff.signals).sort().map(t=>`'${t}'`).join(", "),yve=()=>[...new Set(Object.values(Ff.signals).sort((t,e)=>t-e))].join(", "),Y_=t=>YZ[t].description});import{setTimeout as _ve}from"node:timers/promises";var n9,bve,i9,vve,Sve,wve,_R,X_=y(()=>{ka();Lf();n9=t=>{if(t===!1)return t;if(t===!0)return bve;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},bve=1e3*5,i9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=vve(s,a,r);Sve(l,n);let u=t(c);return wve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},vve=(t,e,r)=>{let[n=r,i]=J_(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&&!J_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:t9(n),error:i}},Sve=(t,e)=>{t!==void 0&&e.reject(t)},wve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&_R({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},_R=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await _ve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as xve}from"node:events";var Q_,bR=y(()=>{Q_=async(t,e)=>{t.aborted||await xve(t,"abort",{signal:e})}});var o9,s9,$ve,vR=y(()=>{bR();o9=({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)}`)},s9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[$ve(t,e,n,i)],$ve=async(t,e,r,{signal:n})=>{throw await Q_(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var yl,kve,SR,a9,c9,eb,l9,u9,d9,f9,p9,m9,Eve,Ave,Tve,Qn,Ove,as,_l,bl=y(()=>{yl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{kve(t,e,r),SR(t,e,n)},kve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},SR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${as(e)} has already exited or disconnected.`)},a9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${as(t)} exited or disconnected.`)},c9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is sending a message too, instead of listening to incoming messages. +Available signal numbers: ${yve()}.`,gve=()=>Object.keys(Lf.signals).sort().map(t=>`'${t}'`).join(", "),yve=()=>[...new Set(Object.values(Lf.signals).sort((t,e)=>t-e))].join(", "),X_=t=>XZ[t].description});import{setTimeout as _ve}from"node:timers/promises";var i9,bve,o9,vve,Sve,wve,_R,Q_=y(()=>{ka();zf();i9=t=>{if(t===!1)return t;if(t===!0)return bve;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},bve=1e3*5,o9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=vve(s,a,r);Sve(l,n);let u=t(c);return wve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},vve=(t,e,r)=>{let[n=r,i]=Y_(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&&!Y_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:r9(n),error:i}},Sve=(t,e)=>{t!==void 0&&e.reject(t)},wve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&_R({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},_R=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await _ve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as xve}from"node:events";var eb,bR=y(()=>{eb=async(t,e)=>{t.aborted||await xve(t,"abort",{signal:e})}});var s9,a9,$ve,vR=y(()=>{bR();s9=({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)}`)},a9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[$ve(t,e,n,i)],$ve=async(t,e,r,{signal:n})=>{throw await eb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var _l,kve,SR,c9,l9,tb,u9,d9,f9,p9,m9,h9,Eve,Ave,Tve,Qn,Ove,as,bl,vl=y(()=>{_l=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{kve(t,e,r),SR(t,e,n)},kve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},SR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${as(e)} has already exited or disconnected.`)},c9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${as(t)} exited or disconnected.`)},l9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(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([ ${Qn("getOneMessage",t)}, ${Qn("sendMessage",t,"message, {strict: true}")}, -]);`)},eb=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${as(e)}.`,{cause:t}),l9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is not listening to incoming messages.`)},u9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} exited without listening to incoming messages.`)},d9=()=>new Error(`\`cancelSignal\` aborted: the ${as(!0)} disconnected.`),f9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},p9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Qn(e,r)} cannot be used: the ${as(r)} is disconnecting.`,{cause:t})},m9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Eve(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Eve=({code:t,message:e})=>Ave.has(t)||Tve.some(r=>e.includes(r)),Ave=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Tve=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Ove(e)}${t}(${r})`,Ove=t=>t?"":"subprocess.",as=t=>t?"parent process":"subprocess",_l=t=>{t.connected&&t.disconnect()}});var Ri,vl=y(()=>{Ri=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var rb,Sl,Ii,h9,Rve,Ive,g9,Pve,y9,zf,tb,cs=y(()=>{yo();rb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ii.get(t),o=h9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(g9(o,e,n,!0));return s},Sl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ii.get(t),o=h9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(g9(o,e,n,!1));return s},Ii=new WeakMap,h9=(t,e,r)=>{let n=Rve(e,r);return Ive(n,e,r,t),n},Rve=(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(`"${zf(e)}" must not be "${t}". +]);`)},tb=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${as(e)}.`,{cause:t}),u9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is not listening to incoming messages.`)},d9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} exited without listening to incoming messages.`)},f9=()=>new Error(`\`cancelSignal\` aborted: the ${as(!0)} disconnected.`),p9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},m9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Qn(e,r)} cannot be used: the ${as(r)} is disconnecting.`,{cause:t})},h9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Eve(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Eve=({code:t,message:e})=>Ave.has(t)||Tve.some(r=>e.includes(r)),Ave=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Tve=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Ove(e)}${t}(${r})`,Ove=t=>t?"":"subprocess.",as=t=>t?"parent process":"subprocess",bl=t=>{t.connected&&t.disconnect()}});var Ri,Sl=y(()=>{Ri=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var nb,wl,Ii,g9,Rve,Ive,y9,Pve,_9,Uf,rb,cs=y(()=>{yo();nb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ii.get(t),o=g9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(y9(o,e,n,!0));return s},wl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ii.get(t),o=g9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(y9(o,e,n,!1));return s},Ii=new WeakMap,g9=(t,e,r)=>{let n=Rve(e,r);return Ive(n,e,r,t),n},Rve=(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(`"${Uf(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},Ive=(t,e,r,n)=>{let i=n[y9(t)];if(i===void 0)throw new TypeError(`"${zf(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(`"${zf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${zf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},g9=(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}=Pve(t,r);return`The "${i}: ${tb(o)}" option is incompatible with using "${zf(n)}: ${tb(e)}". -Please set this option with "pipe" instead.`},Pve=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=y9(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]}},y9=t=>t==="all"?1:t,zf=t=>t?"to":"from",tb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Cve}from"node:events";var Ea,nb=y(()=>{Ea=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Cve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var ib,wR,ob,xR,_9,b9,Uf=y(()=>{ib=(t,e)=>{e&&wR(t)},wR=t=>{t.refCounted()},ob=(t,e)=>{e&&xR(t)},xR=t=>{t.unrefCounted()},_9=(t,e)=>{e&&(xR(t),xR(t))},b9=(t,e)=>{e&&(wR(t),wR(t))}});import{once as Dve}from"node:events";import{scheduler as Nve}from"node:timers/promises";var v9,S9,sb,w9=y(()=>{cb();Uf();ab();lb();v9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if($9(i)||E9(i))return;sb.has(t)||sb.set(t,[]);let o=sb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await k9(t,n,i),await Nve.yield();let s=await x9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},S9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{$R();let o=sb.get(t);for(;o?.length>0;)await Dve(n,"message:done");t.removeListener("message",i),b9(e,r),n.connected=!1,n.emit("disconnect")},sb=new WeakMap});import{EventEmitter as jve}from"node:events";var ls,ub,Mve,db,qf=y(()=>{w9();Uf();ls=(t,e,r)=>{if(ub.has(t))return ub.get(t);let n=new jve;return n.connected=!0,ub.set(t,n),Mve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},ub=new WeakMap,Mve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=v9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",S9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),_9(r,n)},db=t=>{let e=ub.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Fve}from"node:events";var A9,Lve,T9,x9,$9,O9,fb,zve,pb,R9,ab=y(()=>{vl();nb();gb();bl();qf();cb();A9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ls(t,e,r),s=mb(t,o);return{id:Lve++,type:pb,message:n,hasListeners:s}},Lve=0n,T9=(t,e)=>{if(!(e?.type!==pb||e.hasListeners))for(let{id:r}of t)r!==void 0&&fb[r].resolve({isDeadlock:!0,hasListeners:!1})},x9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==pb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:R9,message:mb(e,i)};try{await hb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},$9=t=>{if(t?.type!==R9)return!1;let{id:e,message:r}=t;return fb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},O9=async(t,e,r)=>{if(t?.type!==pb)return;let n=Ri();fb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,zve(e,r,i)]);o&&c9(r),s||l9(r)}finally{i.abort(),delete fb[t.id]}},fb={},zve=async(t,e,{signal:r})=>{Ea(t,1,r),await Fve(t,"disconnect",{signal:r}),u9(e)},pb="execa:ipc:request",R9="execa:ipc:response"});var I9,P9,k9,Bf,mb,Uve,cb=y(()=>{vl();yo();cs();ab();I9=(t,e,r)=>{Bf.has(t)||Bf.set(t,new Set);let n=Bf.get(t),i=Ri(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},P9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},k9=async(t,e,r)=>{for(;!mb(t,e)&&Bf.get(t)?.size>0;){let n=[...Bf.get(t)];T9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Bf=new WeakMap,mb=(t,e)=>e.listenerCount("message")>Uve(t),Uve=t=>Ii.has(t)&&!go(Ii.get(t).options.buffer,"ipc")?1:0});import{promisify as qve}from"node:util";var hb,Bve,ER,Hve,kR,gb=y(()=>{bl();cb();ab();hb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return yl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),Bve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},Bve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=A9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=I9(t,s,o);try{await ER({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw _l(t),c}finally{P9(a)}},ER=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Hve(t);try{await Promise.all([O9(n,t,r),o(n)])}catch(s){throw p9({error:s,methodName:e,isSubprocess:r}),m9({error:s,methodName:e,isSubprocess:r,message:i}),s}},Hve=t=>{if(kR.has(t))return kR.get(t);let e=qve(t.send.bind(t));return kR.set(t,e),e},kR=new WeakMap});import{scheduler as Gve}from"node:timers/promises";var D9,N9,Zve,C9,E9,j9,$R,AR,lb=y(()=>{gb();qf();bl();D9=(t,e)=>{let r="cancelSignal";return SR(r,!1,t.connected),ER({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:j9,message:e},message:e})},N9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Zve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),AR.signal),Zve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!C9){if(C9=!0,!n){f9();return}if(e===null){$R();return}ls(t,e,r),await Gve.yield()}},C9=!1,E9=t=>t?.type!==j9?!1:(AR.abort(t.message),!0),j9="execa:ipc:cancel",$R=()=>{AR.abort(d9())},AR=new AbortController});var M9,F9,Vve,Wve,TR=y(()=>{bR();lb();X_();M9=({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.")}},F9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[Vve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],Vve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await Q_(e,i);let o=Wve(e);throw await D9(t,o),_R({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Wve=({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 Kve}from"node:timers/promises";var L9,z9,Jve,OR=y(()=>{ka();L9=({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})`)},z9=(t,e,r,n)=>e===0||e===void 0?[]:[Jve(t,e,r,n)],Jve=async(t,e,r,{signal:n})=>{throw await Kve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as Yve,execArgv as Xve}from"node:process";import U9 from"node:path";var q9,B9,RR=y(()=>{dl();q9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},B9=(t,e,{node:r=!1,nodePath:n=Yve,nodeOptions:i=Xve.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=ul(n,'The "nodePath" option'),l=U9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(U9.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 Qve}from"node:v8";var H9,eSe,tSe,rSe,G9,IR=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`.");rSe[r](t)}},eSe=t=>{try{Qve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},tSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},rSe={advanced:eSe,json:tSe},G9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var V9,nSe,nn,PR,iSe,Z9,yb,Aa=y(()=>{V9=({encoding:t})=>{if(PR.has(t))return;let e=iSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${yb(t)}\`. -Please rename it to ${yb(e)}.`);let r=[...PR].map(n=>yb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${yb(t)}\`. -Please rename it to one of: ${r}.`)},nSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),PR=new Set([...nSe,...nn]),iSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in Z9)return Z9[e];if(PR.has(e))return e},Z9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},yb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as oSe}from"node:fs";import sSe from"node:path";import aSe from"node:process";var W9,K9,J9,CR=y(()=>{dl();W9=(t=K9())=>{let e=ul(t,'The "cwd" option');return sSe.resolve(e)},K9=()=>{try{return aSe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},J9=(t,e)=>{if(e===K9())return t;let r;try{r=oSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},Ive=(t,e,r,n)=>{let i=n[_9(t)];if(i===void 0)throw new TypeError(`"${Uf(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(`"${Uf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Uf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},y9=(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}=Pve(t,r);return`The "${i}: ${rb(o)}" option is incompatible with using "${Uf(n)}: ${rb(e)}". +Please set this option with "pipe" instead.`},Pve=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=_9(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]}},_9=t=>t==="all"?1:t,Uf=t=>t?"to":"from",rb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Cve}from"node:events";var Ea,ib=y(()=>{Ea=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Cve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var ob,wR,sb,xR,b9,v9,qf=y(()=>{ob=(t,e)=>{e&&wR(t)},wR=t=>{t.refCounted()},sb=(t,e)=>{e&&xR(t)},xR=t=>{t.unrefCounted()},b9=(t,e)=>{e&&(xR(t),xR(t))},v9=(t,e)=>{e&&(wR(t),wR(t))}});import{once as Dve}from"node:events";import{scheduler as Nve}from"node:timers/promises";var S9,w9,ab,x9=y(()=>{lb();qf();cb();ub();S9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(k9(i)||A9(i))return;ab.has(t)||ab.set(t,[]);let o=ab.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await E9(t,n,i),await Nve.yield();let s=await $9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},w9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{$R();let o=ab.get(t);for(;o?.length>0;)await Dve(n,"message:done");t.removeListener("message",i),v9(e,r),n.connected=!1,n.emit("disconnect")},ab=new WeakMap});import{EventEmitter as jve}from"node:events";var ls,db,Mve,fb,Bf=y(()=>{x9();qf();ls=(t,e,r)=>{if(db.has(t))return db.get(t);let n=new jve;return n.connected=!0,db.set(t,n),Mve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},db=new WeakMap,Mve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=S9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",w9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),b9(r,n)},fb=t=>{let e=db.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Fve}from"node:events";var T9,Lve,O9,$9,k9,R9,pb,zve,mb,I9,cb=y(()=>{Sl();ib();yb();vl();Bf();lb();T9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ls(t,e,r),s=hb(t,o);return{id:Lve++,type:mb,message:n,hasListeners:s}},Lve=0n,O9=(t,e)=>{if(!(e?.type!==mb||e.hasListeners))for(let{id:r}of t)r!==void 0&&pb[r].resolve({isDeadlock:!0,hasListeners:!1})},$9=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:I9,message:hb(e,i)};try{await gb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},k9=t=>{if(t?.type!==I9)return!1;let{id:e,message:r}=t;return pb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},R9=async(t,e,r)=>{if(t?.type!==mb)return;let n=Ri();pb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,zve(e,r,i)]);o&&l9(r),s||u9(r)}finally{i.abort(),delete pb[t.id]}},pb={},zve=async(t,e,{signal:r})=>{Ea(t,1,r),await Fve(t,"disconnect",{signal:r}),d9(e)},mb="execa:ipc:request",I9="execa:ipc:response"});var P9,C9,E9,Hf,hb,Uve,lb=y(()=>{Sl();yo();cs();cb();P9=(t,e,r)=>{Hf.has(t)||Hf.set(t,new Set);let n=Hf.get(t),i=Ri(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},C9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},E9=async(t,e,r)=>{for(;!hb(t,e)&&Hf.get(t)?.size>0;){let n=[...Hf.get(t)];O9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Hf=new WeakMap,hb=(t,e)=>e.listenerCount("message")>Uve(t),Uve=t=>Ii.has(t)&&!go(Ii.get(t).options.buffer,"ipc")?1:0});import{promisify as qve}from"node:util";var gb,Bve,ER,Hve,kR,yb=y(()=>{vl();lb();cb();gb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return _l({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),Bve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},Bve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=T9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=P9(t,s,o);try{await ER({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw bl(t),c}finally{C9(a)}},ER=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Hve(t);try{await Promise.all([R9(n,t,r),o(n)])}catch(s){throw m9({error:s,methodName:e,isSubprocess:r}),h9({error:s,methodName:e,isSubprocess:r,message:i}),s}},Hve=t=>{if(kR.has(t))return kR.get(t);let e=qve(t.send.bind(t));return kR.set(t,e),e},kR=new WeakMap});import{scheduler as Gve}from"node:timers/promises";var N9,j9,Zve,D9,A9,M9,$R,AR,ub=y(()=>{yb();Bf();vl();N9=(t,e)=>{let r="cancelSignal";return SR(r,!1,t.connected),ER({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:M9,message:e},message:e})},j9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Zve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),AR.signal),Zve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!D9){if(D9=!0,!n){p9();return}if(e===null){$R();return}ls(t,e,r),await Gve.yield()}},D9=!1,A9=t=>t?.type!==M9?!1:(AR.abort(t.message),!0),M9="execa:ipc:cancel",$R=()=>{AR.abort(f9())},AR=new AbortController});var F9,L9,Vve,Wve,TR=y(()=>{bR();ub();Q_();F9=({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.")}},L9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[Vve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],Vve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await eb(e,i);let o=Wve(e);throw await N9(t,o),_R({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Wve=({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 Kve}from"node:timers/promises";var z9,U9,Jve,OR=y(()=>{ka();z9=({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})`)},U9=(t,e,r,n)=>e===0||e===void 0?[]:[Jve(t,e,r,n)],Jve=async(t,e,r,{signal:n})=>{throw await Kve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as Yve,execArgv as Xve}from"node:process";import q9 from"node:path";var B9,H9,RR=y(()=>{fl();B9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},H9=(t,e,{node:r=!1,nodePath:n=Yve,nodeOptions:i=Xve.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=dl(n,'The "nodePath" option'),l=q9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(q9.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 Qve}from"node:v8";var G9,eSe,tSe,rSe,Z9,IR=y(()=>{G9=({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`.");rSe[r](t)}},eSe=t=>{try{Qve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},tSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},rSe={advanced:eSe,json:tSe},Z9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var W9,nSe,nn,PR,iSe,V9,_b,Aa=y(()=>{W9=({encoding:t})=>{if(PR.has(t))return;let e=iSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${_b(t)}\`. +Please rename it to ${_b(e)}.`);let r=[...PR].map(n=>_b(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${_b(t)}\`. +Please rename it to one of: ${r}.`)},nSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),PR=new Set([...nSe,...nn]),iSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in V9)return V9[e];if(PR.has(e))return e},V9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},_b=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as oSe}from"node:fs";import sSe from"node:path";import aSe from"node:process";var K9,J9,Y9,CR=y(()=>{fl();K9=(t=J9())=>{let e=dl(t,'The "cwd" option');return sSe.resolve(e)},J9=()=>{try{return aSe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},Y9=(t,e)=>{if(e===J9())return t;let r;try{r=oSe(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 cSe from"node:path";import Y9 from"node:process";var X9,_b,lSe,uSe,DR=y(()=>{X9=bt(PZ(),1);LZ();X_();Lf();vR();TR();OR();RR();IR();Aa();CR();dl();yo();_b=(t,e,r)=>{r.cwd=W9(r.cwd);let[n,i,o]=B9(t,e,r),{command:s,args:a,options:c}=X9.default._parse(n,i,o),l=SG(c),u=lSe(l);return L9(u),V9(u),H9(u),o9(u),M9(u),u.shell=KO(u.shell),u.env=uSe(u),u.killSignal=e9(u.killSignal),u.forceKillAfterDelay=n9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),Y9.platform==="win32"&&cSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},lSe=({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}),uSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...Y9.env,...t}:t;return r||n?FZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var bb,NR=y(()=>{bb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function wl(t){if(typeof t=="string")return dSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return fSe(t)}var dSe,fSe,Q9,pSe,eV,mSe,jR=y(()=>{dSe=t=>t.at(-1)===Q9?t.slice(0,t.at(-2)===eV?-2:-1):t,fSe=t=>t.at(-1)===pSe?t.subarray(0,t.at(-2)===mSe?-2:-1):t,Q9=` -`,pSe=Q9.codePointAt(0),eV="\r",mSe=eV.codePointAt(0)});function ei(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 MR(t,{checkOpen:e=!0}={}){return ei(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 Ta(t,{checkOpen:e=!0}={}){return ei(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 FR(t,e){return MR(t,e)&&Ta(t,e)}var Oa=y(()=>{});function tV(){return this[zR].next()}function rV(t){return this[zR].return(t)}function UR({preventCancel:t=!1}={}){let e=this.getReader(),r=new LR(e,t),n=Object.create(gSe);return n[zR]=r,n}var hSe,LR,zR,gSe,nV=y(()=>{hSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),LR=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}}},zR=Symbol();Object.defineProperty(tV,"name",{value:"next"});Object.defineProperty(rV,"name",{value:"return"});gSe=Object.create(hSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:tV},return:{enumerable:!0,configurable:!0,writable:!0,value:rV}})});var iV=y(()=>{});var oV=y(()=>{nV();iV()});var sV,ySe,_Se,bSe,Hf,qR=y(()=>{Oa();oV();sV=t=>{if(Ta(t,{checkOpen:!1})&&Hf.on!==void 0)return _Se(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(ySe.call(t)==="[object ReadableStream]")return UR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:ySe}=Object.prototype,_Se=async function*(t){let e=new AbortController,r={};bSe(t,e,r);try{for await(let[n]of Hf.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()}},bSe=async(t,e,r)=>{try{await Hf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Hf={}});var xl,vSe,lV,aV,SSe,cV,Pi,Gf=y(()=>{qR();xl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=sV(t),u=e();u.length=0;try{for await(let d of l){let f=SSe(d),p=r[f](d,u);lV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return vSe({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}},vSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&lV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},lV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){aV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&aV(c,e,i,o),new Pi},aV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},SSe=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=cV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&cV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:cV}=Object.prototype,Pi=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var _o,Zf,vb,Sb,wb,xb=y(()=>{_o=t=>t,Zf=()=>{},vb=({contents:t})=>t,Sb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},wb=t=>t.length});async function $b(t,e){return xl(t,kSe,e)}var wSe,xSe,$Se,kSe,uV=y(()=>{Gf();xb();wSe=()=>({contents:[]}),xSe=()=>1,$Se=(t,{contents:e})=>(e.push(t),e),kSe={init:wSe,convertChunk:{string:_o,buffer:_o,arrayBuffer:_o,dataView:_o,typedArray:_o,others:_o},getSize:xSe,truncateChunk:Zf,addChunk:$Se,getFinalChunk:Zf,finalize:vb}});async function kb(t,e){return xl(t,DSe,e)}var ESe,ASe,TSe,dV,fV,OSe,RSe,ISe,PSe,mV,pV,CSe,hV,DSe,gV=y(()=>{Gf();xb();ESe=()=>({contents:new ArrayBuffer(0)}),ASe=t=>TSe.encode(t),TSe=new TextEncoder,dV=t=>new Uint8Array(t),fV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),OSe=(t,e)=>t.slice(0,e),RSe=(t,{contents:e,length:r},n)=>{let i=hV()?PSe(e,n):ISe(e,n);return new Uint8Array(i).set(t,r),i},ISe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(mV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},PSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:mV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},mV=t=>pV**Math.ceil(Math.log(t)/Math.log(pV)),pV=2,CSe=({contents:t,length:e})=>hV()?t:t.slice(0,e),hV=()=>"resize"in ArrayBuffer.prototype,DSe={init:ESe,convertChunk:{string:ASe,buffer:dV,arrayBuffer:dV,dataView:fV,typedArray:fV,others:Sb},getSize:wb,truncateChunk:OSe,addChunk:RSe,getFinalChunk:Zf,finalize:CSe}});async function Ab(t,e){return xl(t,LSe,e)}var NSe,Eb,jSe,MSe,FSe,LSe,yV=y(()=>{Gf();xb();NSe=()=>({contents:"",textDecoder:new TextDecoder}),Eb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),jSe=(t,{contents:e})=>e+t,MSe=(t,e)=>t.slice(0,e),FSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},LSe={init:NSe,convertChunk:{string:_o,buffer:Eb,arrayBuffer:Eb,dataView:Eb,typedArray:Eb,others:Sb},getSize:wb,truncateChunk:MSe,addChunk:jSe,getFinalChunk:FSe,finalize:vb}});var _V=y(()=>{uV();gV();yV();Gf()});import{on as zSe}from"node:events";import{finished as USe}from"node:stream/promises";var Tb=y(()=>{qR();_V();Object.assign(Hf,{on:zSe,finished:USe})});var bV,qSe,vV,SV,BSe,wV,xV,Ob,Ra=y(()=>{Tb();ho();yo();bV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Pi))throw t;if(o==="all")return t;let s=qSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},qSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",vV=(t,e,r)=>{if(e.length!==r)return;let n=new Pi;throw n.maxBufferInfo={fdNumber:"ipc"},n},SV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=BSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},BSe=(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=go(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:N_(r),threshold:i,unit:n}},wV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Ob(r)),xV=(t,e,r)=>{if(!e)return t;let n=Ob(r);return t.length>n?t.slice(0,n):t},Ob=([,t])=>t});import{inspect as HSe}from"node:util";var kV,GSe,ZSe,VSe,WSe,KSe,$V,EV=y(()=>{jR();rn();CR();F_();Ra();Lf();ka();kV=({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=GSe({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=VSe(n,b),w=x===void 0?"":` +${t}`}});import cSe from"node:path";import X9 from"node:process";var Q9,bb,lSe,uSe,DR=y(()=>{Q9=bt(CZ(),1);zZ();Q_();zf();vR();TR();OR();RR();IR();Aa();CR();fl();yo();bb=(t,e,r)=>{r.cwd=K9(r.cwd);let[n,i,o]=H9(t,e,r),{command:s,args:a,options:c}=Q9.default._parse(n,i,o),l=wG(c),u=lSe(l);return z9(u),W9(u),G9(u),s9(u),F9(u),u.shell=KO(u.shell),u.env=uSe(u),u.killSignal=t9(u.killSignal),u.forceKillAfterDelay=i9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),X9.platform==="win32"&&cSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},lSe=({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}),uSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...X9.env,...t}:t;return r||n?LZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var vb,NR=y(()=>{vb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function xl(t){if(typeof t=="string")return dSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return fSe(t)}var dSe,fSe,eV,pSe,tV,mSe,jR=y(()=>{dSe=t=>t.at(-1)===eV?t.slice(0,t.at(-2)===tV?-2:-1):t,fSe=t=>t.at(-1)===pSe?t.subarray(0,t.at(-2)===mSe?-2:-1):t,eV=` +`,pSe=eV.codePointAt(0),tV="\r",mSe=tV.codePointAt(0)});function ei(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 MR(t,{checkOpen:e=!0}={}){return ei(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 Ta(t,{checkOpen:e=!0}={}){return ei(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 FR(t,e){return MR(t,e)&&Ta(t,e)}var Oa=y(()=>{});function rV(){return this[zR].next()}function nV(t){return this[zR].return(t)}function UR({preventCancel:t=!1}={}){let e=this.getReader(),r=new LR(e,t),n=Object.create(gSe);return n[zR]=r,n}var hSe,LR,zR,gSe,iV=y(()=>{hSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),LR=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}}},zR=Symbol();Object.defineProperty(rV,"name",{value:"next"});Object.defineProperty(nV,"name",{value:"return"});gSe=Object.create(hSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:rV},return:{enumerable:!0,configurable:!0,writable:!0,value:nV}})});var oV=y(()=>{});var sV=y(()=>{iV();oV()});var aV,ySe,_Se,bSe,Gf,qR=y(()=>{Oa();sV();aV=t=>{if(Ta(t,{checkOpen:!1})&&Gf.on!==void 0)return _Se(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(ySe.call(t)==="[object ReadableStream]")return UR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:ySe}=Object.prototype,_Se=async function*(t){let e=new AbortController,r={};bSe(t,e,r);try{for await(let[n]of Gf.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()}},bSe=async(t,e,r)=>{try{await Gf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Gf={}});var $l,vSe,uV,cV,SSe,lV,Pi,Zf=y(()=>{qR();$l=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=aV(t),u=e();u.length=0;try{for await(let d of l){let f=SSe(d),p=r[f](d,u);uV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return vSe({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}},vSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&uV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},uV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){cV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&cV(c,e,i,o),new Pi},cV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},SSe=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=lV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&lV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:lV}=Object.prototype,Pi=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var _o,Vf,Sb,wb,xb,$b=y(()=>{_o=t=>t,Vf=()=>{},Sb=({contents:t})=>t,wb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},xb=t=>t.length});async function kb(t,e){return $l(t,kSe,e)}var wSe,xSe,$Se,kSe,dV=y(()=>{Zf();$b();wSe=()=>({contents:[]}),xSe=()=>1,$Se=(t,{contents:e})=>(e.push(t),e),kSe={init:wSe,convertChunk:{string:_o,buffer:_o,arrayBuffer:_o,dataView:_o,typedArray:_o,others:_o},getSize:xSe,truncateChunk:Vf,addChunk:$Se,getFinalChunk:Vf,finalize:Sb}});async function Eb(t,e){return $l(t,DSe,e)}var ESe,ASe,TSe,fV,pV,OSe,RSe,ISe,PSe,hV,mV,CSe,gV,DSe,yV=y(()=>{Zf();$b();ESe=()=>({contents:new ArrayBuffer(0)}),ASe=t=>TSe.encode(t),TSe=new TextEncoder,fV=t=>new Uint8Array(t),pV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),OSe=(t,e)=>t.slice(0,e),RSe=(t,{contents:e,length:r},n)=>{let i=gV()?PSe(e,n):ISe(e,n);return new Uint8Array(i).set(t,r),i},ISe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(hV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},PSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:hV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},hV=t=>mV**Math.ceil(Math.log(t)/Math.log(mV)),mV=2,CSe=({contents:t,length:e})=>gV()?t:t.slice(0,e),gV=()=>"resize"in ArrayBuffer.prototype,DSe={init:ESe,convertChunk:{string:ASe,buffer:fV,arrayBuffer:fV,dataView:pV,typedArray:pV,others:wb},getSize:xb,truncateChunk:OSe,addChunk:RSe,getFinalChunk:Vf,finalize:CSe}});async function Tb(t,e){return $l(t,LSe,e)}var NSe,Ab,jSe,MSe,FSe,LSe,_V=y(()=>{Zf();$b();NSe=()=>({contents:"",textDecoder:new TextDecoder}),Ab=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),jSe=(t,{contents:e})=>e+t,MSe=(t,e)=>t.slice(0,e),FSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},LSe={init:NSe,convertChunk:{string:_o,buffer:Ab,arrayBuffer:Ab,dataView:Ab,typedArray:Ab,others:wb},getSize:xb,truncateChunk:MSe,addChunk:jSe,getFinalChunk:FSe,finalize:Sb}});var bV=y(()=>{dV();yV();_V();Zf()});import{on as zSe}from"node:events";import{finished as USe}from"node:stream/promises";var Ob=y(()=>{qR();bV();Object.assign(Gf,{on:zSe,finished:USe})});var vV,qSe,SV,wV,BSe,xV,$V,Rb,Ra=y(()=>{Ob();ho();yo();vV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Pi))throw t;if(o==="all")return t;let s=qSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},qSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",SV=(t,e,r)=>{if(e.length!==r)return;let n=new Pi;throw n.maxBufferInfo={fdNumber:"ipc"},n},wV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=BSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},BSe=(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=go(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:j_(r),threshold:i,unit:n}},xV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Rb(r)),$V=(t,e,r)=>{if(!e)return t;let n=Rb(r);return t.length>n?t.slice(0,n):t},Rb=([,t])=>t});import{inspect as HSe}from"node:util";var EV,GSe,ZSe,VSe,WSe,KSe,kV,AV=y(()=>{jR();rn();CR();L_();Ra();zf();ka();EV=({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=GSe({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=VSe(n,b),w=x===void 0?"":` ${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>WSe(D)).join(` -`)].map(D=>Nf(wl(KSe(D)))).filter(Boolean).join(` +`)].map(D=>jf(xl(KSe(D)))).filter(Boolean).join(` -`);return{originalMessage:x,shortMessage:O,message:A}},GSe=({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=ZSe(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?`${SV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${Y_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},ZSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",VSe=(t,e)=>{if(t instanceof Xn)return;let r=qZ(t)?t.originalMessage:String(t?.message??t),n=Nf(J9(r,e));return n===""?void 0:n},WSe=t=>typeof t=="string"?t:HSe(t),KSe=t=>Array.isArray(t)?t.map(e=>wl($V(e))).filter(Boolean).join(` -`):$V(t),$V=t=>typeof t=="string"?t:zt(t)?C_(t):""});var Rb,$l,Vf,JSe,AV,YSe,Wf=y(()=>{Lf();H_();ka();EV();Rb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>AV({command:t,escapedCommand:e,cwd:o,durationMs:oR(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:[]}),$l=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Vf({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}),Vf=({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:O,signalDescription:T}=YSe(l,u),{originalMessage:A,shortMessage:D,message:E}=kV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),q=zZ(t,E,x);return Object.assign(q,JSe({error:q,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),q},JSe=({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})=>AV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:oR(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:[]}),AV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),YSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:Y_(e);return{exitCode:r,signal:n,signalDescription:i}}});function XSe(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(TV(t*1e3)%1e3),nanoseconds:Math.trunc(TV(t*1e6)%1e3)}}function QSe(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 BR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return XSe(t);break}case"bigint":return QSe(t)}throw new TypeError("Expected a finite number or bigint")}var TV,OV=y(()=>{TV=t=>Number.isFinite(t)?t:0});function HR(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+rwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ewe(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?" "+twe(d,u):f;i.push(p)}},a=BR(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%nwe):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 ewe,twe,rwe,nwe,RV=y(()=>{OV();ewe=t=>t===0||t===0n,twe=(t,e)=>e===1||e===1n?t:`${t}s`,rwe=1e-7,nwe=24n*60n*60n*1000n});var IV,PV=y(()=>{ml();IV=(t,e)=>{t.failed&&Oi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var CV,iwe,DV=y(()=>{RV();ss();ml();PV();CV=(t,e)=>{fl(e)&&(IV(t,e),iwe(t,e))},iwe=(t,e)=>{let r=`(done in ${HR(t.durationMs)})`;Oi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var kl,Ib=y(()=>{DV();kl=(t,e,{reject:r})=>{if(CV(t,e),t.failed&&r)throw t;return t}});var MV,owe,swe,FV,LV,NV,awe,GR,jV,Ia,zV,cwe,Pb,UV,lwe,uwe,ZR,qV,dwe,BV,Cb,fwe,VR,pwe,mwe,HV,An,Db,WR,GV,ZV,us,vr=y(()=>{Oa();po();rn();MV=(t,e)=>Ia(t)?"asyncGenerator":zV(t)?"generator":Pb(t)?"fileUrl":lwe(t)?"filePath":fwe(t)?"webStream":ei(t,{checkOpen:!1})?"native":zt(t)?"uint8Array":pwe(t)?"asyncIterable":mwe(t)?"iterable":VR(t)?FV({transform:t},e):cwe(t)?owe(t,e):"native",owe=(t,e)=>FR(t.transform,{checkOpen:!1})?swe(t,e):VR(t.transform)?FV(t,e):awe(t,e),swe=(t,e)=>(LV(t,e,"Duplex stream"),"duplex"),FV=(t,e)=>(LV(t,e,"web TransformStream"),"webTransform"),LV=({final:t,binary:e,objectMode:r},n,i)=>{NV(t,`${n}.final`,i),NV(e,`${n}.binary`,i),GR(r,`${n}.objectMode`)},NV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},awe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!jV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(FR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(VR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!jV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return GR(r,`${i}.binary`),GR(n,`${i}.objectMode`),Ia(t)||Ia(e)?"asyncGenerator":"generator"},GR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},jV=t=>Ia(t)||zV(t),Ia=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",zV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",cwe=t=>At(t)&&(t.transform!==void 0||t.final!==void 0),Pb=t=>Object.prototype.toString.call(t)==="[object URL]",UV=t=>Pb(t)&&t.protocol!=="file:",lwe=t=>At(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>uwe.has(e))&&ZR(t.file),uwe=new Set(["file","append"]),ZR=t=>typeof t=="string",qV=(t,e)=>t==="native"&&typeof e=="string"&&!dwe.has(e),dwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),BV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Cb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",fwe=t=>BV(t)||Cb(t),VR=t=>BV(t?.readable)&&Cb(t?.writable),pwe=t=>HV(t)&&typeof t[Symbol.asyncIterator]=="function",mwe=t=>HV(t)&&typeof t[Symbol.iterator]=="function",HV=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),Db=new Set(["fileUrl","filePath","fileNumber"]),WR=new Set(["fileUrl","filePath"]),GV=new Set([...WR,"webStream","nodeStream"]),ZV=new Set(["webTransform","duplex"]),us={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 KR,hwe,gwe,VV,JR=y(()=>{vr();KR=(t,e,r,n)=>n==="output"?hwe(t,e,r):gwe(t,e,r),hwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},gwe=(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}},VV=(t,e)=>{let r=t.findLast(({type:n})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var WV,ywe,_we,bwe,vwe,Swe,wwe,KV=y(()=>{po();Aa();vr();JR();WV=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...ywe(t,e,r,n)],ywe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=_we({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return wwe(o,r)},_we=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?bwe({stdioItem:t,optionName:i}):e==="webTransform"?vwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Swe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),bwe=({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}}},vwe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=At(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=KR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Swe=({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}=At(e)?e:{transform:e},d=c||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=KR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},wwe=(t,e)=>e==="input"?t.reverse():t});import YR from"node:process";var JV,xwe,$we,El,XR,YV,kwe,Ewe,XV=y(()=>{Oa();vr();JV=(t,e,r)=>{let n=t.map(i=>xwe(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)??Ewe},xwe=({type:t,value:e},r)=>$we[r]??YV[t](e),$we=["input","output","output"],El=()=>{},XR=()=>"input",YV={generator:El,asyncGenerator:El,fileUrl:El,filePath:El,iterable:XR,asyncIterable:XR,uint8Array:XR,webStream:t=>Cb(t)?"output":"input",nodeStream(t){return Ta(t,{checkOpen:!1})?MR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:El,duplex:El,native(t){let e=kwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return YV.nodeStream(t)}},kwe=t=>{if([0,YR.stdin].includes(t))return"input";if([1,2,YR.stdout,YR.stderr].includes(t))return"output"},Ewe="output"});var QV,eW=y(()=>{QV=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var tW,Awe,Twe,rW,Owe,Rwe,nW=y(()=>{ho();eW();ss();tW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Awe(t,n).map((a,c)=>rW(a,c));return o?Owe(s,r,i):QV(s,e)},Awe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(Twe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},Twe=t=>En.some(e=>t[e]!==void 0),rW=(t,e)=>Array.isArray(t)?t.map(r=>rW(r,e)):t??(e>=En.length?"ignore":"pipe"),Owe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!pl(r,i)&&Rwe(n)?"ignore":n),Rwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Iwe}from"node:fs";import Pwe from"node:tty";var oW,Cwe,Dwe,Nwe,jwe,iW,sW=y(()=>{Oa();ho();rn();cs();oW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Cwe({stdioItem:t,fdNumber:n,direction:i}):jwe({stdioItem:t,fdNumber:n}),Cwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Dwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Dwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Nwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Pwe.isatty(i))throw new TypeError(`The \`${e}: ${tb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:mo(Iwe(i)),optionName:e}}},Nwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=D_.indexOf(t);if(r!==-1)return r},jwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:iW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:iW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,iW=(t,e,r)=>{let n=D_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var aW,Mwe,Fwe,Lwe,zwe,cW=y(()=>{Oa();rn();vr();aW=({input:t,inputFile:e},r)=>r===0?[...Mwe(t),...Lwe(e)]:[],Mwe=t=>t===void 0?[]:[{type:Fwe(t),value:t,optionName:"input"}],Fwe=t=>{if(Ta(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(zt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Lwe=t=>t===void 0?[]:[{...zwe(t),optionName:"inputFile"}],zwe=t=>{if(Pb(t))return{type:"fileUrl",value:t};if(ZR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var lW,uW,Uwe,qwe,dW,Bwe,Hwe,fW,pW=y(()=>{vr();lW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),uW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Uwe(i,t);if(s.length!==0){if(o){qwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(GV.has(t))return dW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});ZV.has(t)&&Hwe({otherStdioItems:s,type:t,value:e,optionName:r})}},Uwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),qwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{WR.has(e)&&dW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},dW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Bwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return fW(s,n,e),i==="output"?o[0].stream:void 0},Bwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Hwe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);fW(i,n,e)},fW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${us[r]} that is the same.`)}});var Nb,Gwe,Zwe,Vwe,Wwe,Kwe,Jwe,Ywe,Xwe,Qwe,exe,txe,QR,rxe,jb=y(()=>{ho();KV();JR();vr();XV();nW();sW();cW();pW();Nb=(t,e,r,n)=>{let o=tW(e,r,n).map((a,c)=>Gwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Qwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>rxe(a)),s},Gwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=N_(e),{stdioItems:o,isStdioArray:s}=Zwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=JV(o,e,i),c=o.map(d=>oW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=WV(c,i,a,r),u=VV(l,a);return Xwe(l,u),{direction:a,objectMode:u,stdioItems:l}},Zwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Vwe(c,n)),...aW(r,e)],s=lW(o),a=s.length>1;return Wwe(s,a,n),Jwe(s),{stdioItems:s,isStdioArray:a}},Vwe=(t,e)=>({type:MV(t,e),value:t,optionName:e}),Wwe=(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(Kwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Kwe=new Set(["ignore","ipc"]),Jwe=t=>{for(let e of t)Ywe(e)},Ywe=({type:t,value:e,optionName:r})=>{if(UV(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(qV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Xwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Db.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Qwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(exe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw QR(i),o}},exe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>txe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},txe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=uW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},QR=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Yn(r)&&r.destroy()},rxe=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 mW}from"node:fs";var gW,Ci,nxe,yW,hW,ixe,_W=y(()=>{rn();jb();vr();gW=(t,e)=>Nb(ixe,t,e,!0),Ci=({type:t,optionName:e})=>{yW(e,us[t])},nxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&yW(t,`"${e}"`),{}),yW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},hW={generator(){},asyncGenerator:Ci,webStream:Ci,nodeStream:Ci,webTransform:Ci,duplex:Ci,asyncIterable:Ci,native:nxe},ixe={input:{...hW,fileUrl:({value:t})=>({contents:[mo(mW(t))]}),filePath:({value:{file:t}})=>({contents:[mo(mW(t))]}),fileNumber:Ci,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...hW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Ci,string:Ci,uint8Array:Ci}}});var bo,eI,Kf=y(()=>{jR();bo=(t,{stripFinalNewline:e},r)=>eI(e,r)&&t!==void 0&&!Array.isArray(t)?wl(t):t,eI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Mb,rI,bW,vW,oxe,sxe,axe,SW,cxe,tI,lxe,uxe,dxe,Fb=y(()=>{Mb=(t,e,r,n)=>t||r?void 0:vW(e,n),rI=(t,e,r)=>r?t.flatMap(n=>bW(n,e)):bW(t,e),bW=(t,e)=>{let{transform:r,final:n}=vW(e,{});return[...r(t),...n()]},vW=(t,e)=>(e.previousChunks="",{transform:oxe.bind(void 0,e,t),final:axe.bind(void 0,e)}),oxe=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},sxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),axe=function*({previousChunks:t}){t.length>0&&(yield t)},SW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:cxe.bind(void 0,n)},cxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?lxe:dxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},tI=(t,e)=>`${t}${e}`,lxe={windowsNewline:`\r +`);return{originalMessage:x,shortMessage:O,message:A}},GSe=({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=ZSe(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?`${wV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${X_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},ZSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",VSe=(t,e)=>{if(t instanceof Xn)return;let r=BZ(t)?t.originalMessage:String(t?.message??t),n=jf(Y9(r,e));return n===""?void 0:n},WSe=t=>typeof t=="string"?t:HSe(t),KSe=t=>Array.isArray(t)?t.map(e=>xl(kV(e))).filter(Boolean).join(` +`):kV(t),kV=t=>typeof t=="string"?t:zt(t)?D_(t):""});var Ib,kl,Wf,JSe,TV,YSe,Kf=y(()=>{zf();G_();ka();AV();Ib=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>TV({command:t,escapedCommand:e,cwd:o,durationMs:oR(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:[]}),kl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Wf({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}),Wf=({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:O,signalDescription:T}=YSe(l,u),{originalMessage:A,shortMessage:D,message:E}=EV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),q=UZ(t,E,x);return Object.assign(q,JSe({error:q,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),q},JSe=({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})=>TV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:oR(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:[]}),TV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),YSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:X_(e);return{exitCode:r,signal:n,signalDescription:i}}});function XSe(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(OV(t*1e3)%1e3),nanoseconds:Math.trunc(OV(t*1e6)%1e3)}}function QSe(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 BR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return XSe(t);break}case"bigint":return QSe(t)}throw new TypeError("Expected a finite number or bigint")}var OV,RV=y(()=>{OV=t=>Number.isFinite(t)?t:0});function HR(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+rwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ewe(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?" "+twe(d,u):f;i.push(p)}},a=BR(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%nwe):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 ewe,twe,rwe,nwe,IV=y(()=>{RV();ewe=t=>t===0||t===0n,twe=(t,e)=>e===1||e===1n?t:`${t}s`,rwe=1e-7,nwe=24n*60n*60n*1000n});var PV,CV=y(()=>{hl();PV=(t,e)=>{t.failed&&Oi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var DV,iwe,NV=y(()=>{IV();ss();hl();CV();DV=(t,e)=>{pl(e)&&(PV(t,e),iwe(t,e))},iwe=(t,e)=>{let r=`(done in ${HR(t.durationMs)})`;Oi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var El,Pb=y(()=>{NV();El=(t,e,{reject:r})=>{if(DV(t,e),t.failed&&r)throw t;return t}});var FV,owe,swe,LV,zV,jV,awe,GR,MV,Ia,UV,cwe,Cb,qV,lwe,uwe,ZR,BV,dwe,HV,Db,fwe,VR,pwe,mwe,GV,An,Nb,WR,ZV,VV,us,vr=y(()=>{Oa();po();rn();FV=(t,e)=>Ia(t)?"asyncGenerator":UV(t)?"generator":Cb(t)?"fileUrl":lwe(t)?"filePath":fwe(t)?"webStream":ei(t,{checkOpen:!1})?"native":zt(t)?"uint8Array":pwe(t)?"asyncIterable":mwe(t)?"iterable":VR(t)?LV({transform:t},e):cwe(t)?owe(t,e):"native",owe=(t,e)=>FR(t.transform,{checkOpen:!1})?swe(t,e):VR(t.transform)?LV(t,e):awe(t,e),swe=(t,e)=>(zV(t,e,"Duplex stream"),"duplex"),LV=(t,e)=>(zV(t,e,"web TransformStream"),"webTransform"),zV=({final:t,binary:e,objectMode:r},n,i)=>{jV(t,`${n}.final`,i),jV(e,`${n}.binary`,i),GR(r,`${n}.objectMode`)},jV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},awe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!MV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(FR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(VR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!MV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return GR(r,`${i}.binary`),GR(n,`${i}.objectMode`),Ia(t)||Ia(e)?"asyncGenerator":"generator"},GR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},MV=t=>Ia(t)||UV(t),Ia=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",UV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",cwe=t=>At(t)&&(t.transform!==void 0||t.final!==void 0),Cb=t=>Object.prototype.toString.call(t)==="[object URL]",qV=t=>Cb(t)&&t.protocol!=="file:",lwe=t=>At(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>uwe.has(e))&&ZR(t.file),uwe=new Set(["file","append"]),ZR=t=>typeof t=="string",BV=(t,e)=>t==="native"&&typeof e=="string"&&!dwe.has(e),dwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),HV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Db=t=>Object.prototype.toString.call(t)==="[object WritableStream]",fwe=t=>HV(t)||Db(t),VR=t=>HV(t?.readable)&&Db(t?.writable),pwe=t=>GV(t)&&typeof t[Symbol.asyncIterator]=="function",mwe=t=>GV(t)&&typeof t[Symbol.iterator]=="function",GV=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),Nb=new Set(["fileUrl","filePath","fileNumber"]),WR=new Set(["fileUrl","filePath"]),ZV=new Set([...WR,"webStream","nodeStream"]),VV=new Set(["webTransform","duplex"]),us={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 KR,hwe,gwe,WV,JR=y(()=>{vr();KR=(t,e,r,n)=>n==="output"?hwe(t,e,r):gwe(t,e,r),hwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},gwe=(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}},WV=(t,e)=>{let r=t.findLast(({type:n})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var KV,ywe,_we,bwe,vwe,Swe,wwe,JV=y(()=>{po();Aa();vr();JR();KV=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...ywe(t,e,r,n)],ywe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=_we({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return wwe(o,r)},_we=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?bwe({stdioItem:t,optionName:i}):e==="webTransform"?vwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Swe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),bwe=({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}}},vwe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=At(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=KR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Swe=({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}=At(e)?e:{transform:e},d=c||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=KR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},wwe=(t,e)=>e==="input"?t.reverse():t});import YR from"node:process";var YV,xwe,$we,Al,XR,XV,kwe,Ewe,QV=y(()=>{Oa();vr();YV=(t,e,r)=>{let n=t.map(i=>xwe(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)??Ewe},xwe=({type:t,value:e},r)=>$we[r]??XV[t](e),$we=["input","output","output"],Al=()=>{},XR=()=>"input",XV={generator:Al,asyncGenerator:Al,fileUrl:Al,filePath:Al,iterable:XR,asyncIterable:XR,uint8Array:XR,webStream:t=>Db(t)?"output":"input",nodeStream(t){return Ta(t,{checkOpen:!1})?MR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Al,duplex:Al,native(t){let e=kwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return XV.nodeStream(t)}},kwe=t=>{if([0,YR.stdin].includes(t))return"input";if([1,2,YR.stdout,YR.stderr].includes(t))return"output"},Ewe="output"});var eW,tW=y(()=>{eW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var rW,Awe,Twe,nW,Owe,Rwe,iW=y(()=>{ho();tW();ss();rW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Awe(t,n).map((a,c)=>nW(a,c));return o?Owe(s,r,i):eW(s,e)},Awe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(Twe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},Twe=t=>En.some(e=>t[e]!==void 0),nW=(t,e)=>Array.isArray(t)?t.map(r=>nW(r,e)):t??(e>=En.length?"ignore":"pipe"),Owe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!ml(r,i)&&Rwe(n)?"ignore":n),Rwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Iwe}from"node:fs";import Pwe from"node:tty";var sW,Cwe,Dwe,Nwe,jwe,oW,aW=y(()=>{Oa();ho();rn();cs();sW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Cwe({stdioItem:t,fdNumber:n,direction:i}):jwe({stdioItem:t,fdNumber:n}),Cwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Dwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Dwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Nwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Pwe.isatty(i))throw new TypeError(`The \`${e}: ${rb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:mo(Iwe(i)),optionName:e}}},Nwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=N_.indexOf(t);if(r!==-1)return r},jwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:oW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:oW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,oW=(t,e,r)=>{let n=N_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var cW,Mwe,Fwe,Lwe,zwe,lW=y(()=>{Oa();rn();vr();cW=({input:t,inputFile:e},r)=>r===0?[...Mwe(t),...Lwe(e)]:[],Mwe=t=>t===void 0?[]:[{type:Fwe(t),value:t,optionName:"input"}],Fwe=t=>{if(Ta(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(zt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Lwe=t=>t===void 0?[]:[{...zwe(t),optionName:"inputFile"}],zwe=t=>{if(Cb(t))return{type:"fileUrl",value:t};if(ZR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var uW,dW,Uwe,qwe,fW,Bwe,Hwe,pW,mW=y(()=>{vr();uW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),dW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Uwe(i,t);if(s.length!==0){if(o){qwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(ZV.has(t))return fW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});VV.has(t)&&Hwe({otherStdioItems:s,type:t,value:e,optionName:r})}},Uwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),qwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{WR.has(e)&&fW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},fW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Bwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return pW(s,n,e),i==="output"?o[0].stream:void 0},Bwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Hwe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);pW(i,n,e)},pW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${us[r]} that is the same.`)}});var jb,Gwe,Zwe,Vwe,Wwe,Kwe,Jwe,Ywe,Xwe,Qwe,exe,txe,QR,rxe,Mb=y(()=>{ho();JV();JR();vr();QV();iW();aW();lW();mW();jb=(t,e,r,n)=>{let o=rW(e,r,n).map((a,c)=>Gwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Qwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>rxe(a)),s},Gwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=j_(e),{stdioItems:o,isStdioArray:s}=Zwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=YV(o,e,i),c=o.map(d=>sW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=KV(c,i,a,r),u=WV(l,a);return Xwe(l,u),{direction:a,objectMode:u,stdioItems:l}},Zwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Vwe(c,n)),...cW(r,e)],s=uW(o),a=s.length>1;return Wwe(s,a,n),Jwe(s),{stdioItems:s,isStdioArray:a}},Vwe=(t,e)=>({type:FV(t,e),value:t,optionName:e}),Wwe=(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(Kwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Kwe=new Set(["ignore","ipc"]),Jwe=t=>{for(let e of t)Ywe(e)},Ywe=({type:t,value:e,optionName:r})=>{if(qV(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(BV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Xwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Nb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Qwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(exe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw QR(i),o}},exe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>txe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},txe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=dW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},QR=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Yn(r)&&r.destroy()},rxe=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 hW}from"node:fs";var yW,Ci,nxe,_W,gW,ixe,bW=y(()=>{rn();Mb();vr();yW=(t,e)=>jb(ixe,t,e,!0),Ci=({type:t,optionName:e})=>{_W(e,us[t])},nxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&_W(t,`"${e}"`),{}),_W=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},gW={generator(){},asyncGenerator:Ci,webStream:Ci,nodeStream:Ci,webTransform:Ci,duplex:Ci,asyncIterable:Ci,native:nxe},ixe={input:{...gW,fileUrl:({value:t})=>({contents:[mo(hW(t))]}),filePath:({value:{file:t}})=>({contents:[mo(hW(t))]}),fileNumber:Ci,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...gW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Ci,string:Ci,uint8Array:Ci}}});var bo,eI,Jf=y(()=>{jR();bo=(t,{stripFinalNewline:e},r)=>eI(e,r)&&t!==void 0&&!Array.isArray(t)?xl(t):t,eI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Fb,rI,vW,SW,oxe,sxe,axe,wW,cxe,tI,lxe,uxe,dxe,Lb=y(()=>{Fb=(t,e,r,n)=>t||r?void 0:SW(e,n),rI=(t,e,r)=>r?t.flatMap(n=>vW(n,e)):vW(t,e),vW=(t,e)=>{let{transform:r,final:n}=SW(e,{});return[...r(t),...n()]},SW=(t,e)=>(e.previousChunks="",{transform:oxe.bind(void 0,e,t),final:axe.bind(void 0,e)}),oxe=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},sxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),axe=function*({previousChunks:t}){t.length>0&&(yield t)},wW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:cxe.bind(void 0,n)},cxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?lxe:dxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},tI=(t,e)=>`${t}${e}`,lxe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:tI},uxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},dxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:uxe}});import{Buffer as fxe}from"node:buffer";var wW,pxe,xW,mxe,hxe,$W,kW=y(()=>{rn();wW=(t,e)=>t?void 0:pxe.bind(void 0,e),pxe=function*(t,e){if(typeof e!="string"&&!zt(e)&&!fxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},xW=(t,e)=>t?mxe.bind(void 0,e):hxe.bind(void 0,e),mxe=function*(t,e){$W(t,e),yield e},hxe=function*(t,e){if($W(t,e),typeof e!="string"&&!zt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},$W=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:tI},uxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},dxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:uxe}});import{Buffer as fxe}from"node:buffer";var xW,pxe,$W,mxe,hxe,kW,EW=y(()=>{rn();xW=(t,e)=>t?void 0:pxe.bind(void 0,e),pxe=function*(t,e){if(typeof e!="string"&&!zt(e)&&!fxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},$W=(t,e)=>t?mxe.bind(void 0,e):hxe.bind(void 0,e),mxe=function*(t,e){kW(t,e),yield e},hxe=function*(t,e){if(kW(t,e),typeof e!="string"&&!zt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},kW=(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 gxe}from"node:buffer";import{StringDecoder as yxe}from"node:string_decoder";var Lb,_xe,bxe,vxe,nI=y(()=>{rn();Lb=(t,e,r)=>{if(r)return;if(t)return{transform:_xe.bind(void 0,new TextEncoder)};let n=new yxe(e);return{transform:bxe.bind(void 0,n),final:vxe.bind(void 0,n)}},_xe=function*(t,e){gxe.isBuffer(e)?yield mo(e):typeof e=="string"?yield t.encode(e):yield e},bxe=function*(t,e){yield zt(e)?t.write(e):e},vxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as EW}from"node:util";var iI,zb,AW,Sxe,TW,wxe,OW=y(()=>{iI=EW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),zb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=wxe}=e[r];for await(let i of n(t))yield*zb(i,e,r+1)},AW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Sxe(r,Number(e),t)},Sxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*zb(n,r,e+1)},TW=EW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),wxe=function*(t){yield t}});var oI,RW,Pa,Jf,xxe,$xe,sI=y(()=>{oI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},RW=(t,e)=>[...e.flatMap(r=>[...Pa(r,t,0)]),...Jf(t)],Pa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=$xe}=e[r];for(let i of n(t))yield*Pa(i,e,r+1)},Jf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*xxe(r,Number(e),t)},xxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Pa(n,r,e+1)},$xe=function*(t){yield t}});import{Transform as kxe,getDefaultHighWaterMark as IW}from"node:stream";var aI,Ub,PW,qb=y(()=>{vr();Fb();kW();nI();OW();sI();aI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=PW(t,s,o),l=Ia(e),u=Ia(r),d=l?iI.bind(void 0,zb,a):oI.bind(void 0,Pa),f=l||u?iI.bind(void 0,AW,a):oI.bind(void 0,Jf),p=l||u?TW.bind(void 0,a):void 0;return{stream:new kxe({writableObjectMode:n,writableHighWaterMark:IW(n),readableObjectMode:i,readableHighWaterMark:IW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Ub=(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=PW(s,r,a);t=RW(c,t)}return t},PW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:wW(n,a)},Lb(r,s,n),Mb(r,o,n,c),{transform:t,final:e},{transform:xW(i,a)},SW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var CW,Exe,Axe,Txe,Oxe,DW=y(()=>{qb();rn();vr();CW=(t,e)=>{for(let r of Exe(t))Axe(t,r,e)},Exe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Axe=(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 ${us[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Txe(a,n));r.input=Df(s)},Txe=(t,e)=>{let r=Ub(t,e,"utf8",!0);return Oxe(r),Df(r)},Oxe=t=>{let e=t.find(r=>typeof r!="string"&&!zt(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 Bb,Rxe,Ixe,NW,jW,Pxe,MW,cI=y(()=>{Aa();vr();ml();ss();Bb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&pl(r,n)&&!nn.has(e)&&Rxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Ixe.has(o))||t.every(({type:i})=>An.has(i))),Rxe=t=>t===1||t===2,Ixe=new Set(["pipe","overlapped"]),NW=async(t,e,r,n)=>{for await(let i of t)Pxe(e)||MW(i,r,n)},jW=(t,e,r)=>{for(let n of t)MW(n,e,r)},Pxe=t=>t._readableState.pipes.length>0,MW=(t,e,r)=>{let n=q_(t);Oi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Cxe,appendFileSync as Dxe}from"node:fs";var FW,Nxe,jxe,Mxe,Fxe,Lxe,LW=y(()=>{cI();qb();Fb();rn();vr();Ra();FW=({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)=>Nxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Nxe=({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=xV(t,o,d),p=mo(f),{stdioItems:m,objectMode:h}=e[r],g=jxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Mxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Fxe({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&&Lxe(b,m,i),S}catch(x){return n.error=x,S}},jxe=(t,e,r,n)=>{try{return Ub(t,e,r,!1)}catch(i){return n.error=i,t}},Mxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Df(t)};let s=pG(t,r);return n[o]?{serializedResult:s,finalResult:rI(s,!i[o],e)}:{serializedResult:s}},Fxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Bb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=rI(t,!1,s);try{jW(a,e,n)}catch(c){r.error??=c}},Lxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Db.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Dxe(n,t):(r.add(o),Cxe(n,t))}}});var zW,UW=y(()=>{rn();Kf();zW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,bo(e,r,"all")]:Array.isArray(e)?[bo(t,r,"all"),...e]:zt(t)&&zt(e)?YO([t,e]):`${t}${e}`}});import{once as lI}from"node:events";var qW,zxe,BW,HW,Uxe,uI,dI=y(()=>{ka();qW=async(t,e)=>{let[r,n]=await zxe(t);return e.isForcefullyTerminated??=!1,[r,n]},zxe=async t=>{let[e,r]=await Promise.allSettled([lI(t,"spawn"),lI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?BW(t):r.value},BW=async t=>{try{return await lI(t,"exit")}catch{return BW(t)}},HW=async t=>{let[e,r]=await t;if(!Uxe(e,r)&&uI(e,r))throw new Xn;return[e,r]},Uxe=(t,e)=>t===void 0&&e===void 0,uI=(t,e)=>t!==0||e!==null});var GW,qxe,ZW=y(()=>{ka();Ra();dI();GW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=qxe(t,e,r),s=o?.code==="ETIMEDOUT",a=wV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},qxe=(t,e,r)=>t!==void 0?t:uI(e,r)?new Xn:void 0});import{spawnSync as Bxe}from"node:child_process";var VW,Hxe,Gxe,Zxe,Hb,Vxe,Wxe,Kxe,Jxe,WW=y(()=>{sR();DR();NR();Wf();Ib();_W();Kf();DW();LW();Ra();UW();ZW();VW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Hxe(t,e,r),d=Vxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return kl(d,c,l)},Hxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=G_(t,e,r),a=Gxe(r),{file:c,commandArguments:l,options:u}=_b(t,e,a);Zxe(u);let d=gW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Gxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Zxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Hb("ipcInput"),t&&Hb("ipc: true"),r&&Hb("detached: true"),n&&Hb("cancelSignal")},Hb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Vxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Wxe({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}=GW(c,r),{output:m,error:h=l}=FW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>bo(_,r,S)),b=bo(zW(m,r),r,"all");return Jxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Wxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{CW(o,r);let a=Kxe(r);return Bxe(...bb(t,e,a))}catch(a){return $l({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},Kxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Ob(e)}),Jxe=({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?Rb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Vf({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 Yxe}from"node:events";var KW,Xxe,Qxe,e0e,t0e,JW=y(()=>{bl();qf();Uf();KW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(yl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:db(t)}),Xxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Xxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ib(e,i);let o=ls(t,e,r),s=new AbortController;try{return await Promise.race([Qxe(o,n,s),e0e(o,r,s),t0e(o,r,s)])}catch(a){throw _l(t),a}finally{s.abort(),ob(e,i)}},Qxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await fI(t,"message",{signal:r});return n}for await(let[n]of Yxe(t,"message",{signal:r}))if(e(n))return n},e0e=async(t,e,{signal:r})=>{await fI(t,"disconnect",{signal:r}),a9(e)},t0e=async(t,e,{signal:r})=>{let[n]=await fI(t,"strict:error",{signal:r});throw eb(n,e)}});import{once as XW,on as r0e}from"node:events";var QW,pI,n0e,i0e,o0e,YW,mI=y(()=>{bl();qf();Uf();QW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>pI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),pI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{yl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:db(t)}),ib(e,o);let s=ls(t,e,r),a=new AbortController,c={};return n0e(t,s,a),i0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),o0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},n0e=async(t,e,r)=>{try{await XW(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},i0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await XW(t,"strict:error",{signal:r.signal});n.error=eb(i,e),r.abort()}catch{}},o0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of r0e(r,"message",{signal:o.signal}))YW(s),yield c}catch{YW(s)}finally{o.abort(),ob(e,a),n||_l(t),i&&await t}},YW=({error:t})=>{if(t)throw t}});import e3 from"node:process";var t3,r3,n3,hI=y(()=>{gb();JW();mI();lb();t3=(t,{ipc:e})=>{Object.assign(t,n3(t,!1,e))},r3=()=>{let t=e3,e=!0,r=e3.channel!==void 0;return{...n3(t,e,r),getCancelSignal:N9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},n3=(t,e,r)=>({sendMessage:hb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:KW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:QW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as s0e}from"node:child_process";import{PassThrough as a0e,Readable as c0e,Writable as l0e,Duplex as u0e}from"node:stream";var i3,d0e,Yf,f0e,p0e,m0e,h0e,o3=y(()=>{jb();Wf();Ib();i3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{QR(n);let a=new s0e;d0e(a,n),Object.assign(a,{readable:f0e,writable:p0e,duplex:m0e});let c=$l({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=h0e(c,s,i);return{subprocess:a,promise:l}},d0e=(t,e)=>{let r=Yf(),n=Yf(),i=Yf(),o=Array.from({length:e.length-3},Yf),s=Yf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Yf=()=>{let t=new a0e;return t.end(),t},f0e=()=>new c0e({read(){}}),p0e=()=>new l0e({write(){}}),m0e=()=>new u0e({read(){},write(){}}),h0e=async(t,e,r)=>kl(t,e,r)});import{createReadStream as s3,createWriteStream as a3}from"node:fs";import{Buffer as g0e}from"node:buffer";import{Readable as Xf,Writable as y0e,Duplex as _0e}from"node:stream";var l3,Qf,c3,b0e,u3=y(()=>{qb();jb();vr();l3=(t,e)=>Nb(b0e,t,e,!1),Qf=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${us[t]}.`)},c3={fileNumber:Qf,generator:aI,asyncGenerator:aI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:_0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},b0e={input:{...c3,fileUrl:({value:t})=>({stream:s3(t)}),filePath:({value:{file:t}})=>({stream:s3(t)}),webStream:({value:t})=>({stream:Xf.fromWeb(t)}),iterable:({value:t})=>({stream:Xf.from(t)}),asyncIterable:({value:t})=>({stream:Xf.from(t)}),string:({value:t})=>({stream:Xf.from(t)}),uint8Array:({value:t})=>({stream:Xf.from(g0e.from(t))})},output:{...c3,fileUrl:({value:t})=>({stream:a3(t)}),filePath:({value:{file:t,append:e}})=>({stream:a3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:y0e.fromWeb(t)}),iterable:Qf,asyncIterable:Qf,string:Qf,uint8Array:Qf}}});import{on as v0e,once as d3}from"node:events";import{PassThrough as S0e,getDefaultHighWaterMark as w0e}from"node:stream";import{finished as m3}from"node:stream/promises";function Ca(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)yI(i);let e=t.some(({readableObjectMode:i})=>i),r=x0e(t,e),n=new gI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var x0e,gI,$0e,k0e,E0e,yI,A0e,T0e,O0e,R0e,I0e,h3,g3,_I,y3,P0e,Gb,f3,p3,Zb=y(()=>{x0e=(t,e)=>{if(t.length===0)return w0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},gI=class extends S0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(yI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=$0e(this,this.#t,this.#o);let r=A0e({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(yI(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)}},$0e=async(t,e,r)=>{Gb(t,f3);let n=new AbortController;try{await Promise.race([k0e(t,n),E0e(t,e,r,n)])}finally{n.abort(),Gb(t,-f3)}},k0e=async(t,{signal:e})=>{try{await m3(t,{signal:e,cleanup:!0})}catch(r){throw h3(t,r),r}},E0e=async(t,e,r,{signal:n})=>{for await(let[i]of v0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},yI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},A0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Gb(t,p3);let a=new AbortController;try{await Promise.race([T0e(o,e,a),O0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),R0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Gb(t,-p3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?_I(t):I0e(t))},T0e=async(t,e,{signal:r})=>{try{await t,r.aborted||_I(e)}catch(n){r.aborted||h3(e,n)}},O0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await m3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;g3(s)?i.add(e):y3(t,s)}},R0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await d3(t,i,{signal:o}),!t.readable)return d3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},I0e=t=>{t.writable&&t.end()},h3=(t,e)=>{g3(e)?_I(t):y3(t,e)},g3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",_I=t=>{(t.readable||t.writable)&&t.destroy()},y3=(t,e)=>{t.destroyed||(t.once("error",P0e),t.destroy(e))},P0e=()=>{},Gb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},f3=2,p3=1});import{finished as _3}from"node:stream/promises";var Al,C0e,bI,D0e,vI,Vb=y(()=>{ho();Al=(t,e)=>{t.pipe(e),C0e(t,e),D0e(t,e)},C0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await _3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}bI(e)}},bI=t=>{t.writable&&t.end()},D0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await _3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}vI(t)}},vI=t=>{t.readable&&t.destroy()}});var b3,N0e,j0e,M0e,F0e,L0e,v3=y(()=>{Zb();ho();nb();vr();Vb();b3=(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})=>An.has(c)))N0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.has(c)))M0e({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]:Ca(o);Al(s,i)}},N0e=(t,e,r,n)=>{r==="output"?Al(t.stdio[n],e):Al(e,t.stdio[n]);let i=j0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},j0e=["stdin","stdout","stderr"],M0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;F0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},F0e=(t,{signal:e})=>{Yn(t)&&Ea(t,L0e,e)},L0e=2});var Da,S3=y(()=>{Da=[];Da.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Da.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Da.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Wb,SI,wI,z0e,xI,Kb,U0e,$I,kI,EI,w3,est,tst,x3=y(()=>{S3();Wb=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",SI=Symbol.for("signal-exit emitter"),wI=globalThis,z0e=Object.defineProperty.bind(Object),xI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(wI[SI])return wI[SI];z0e(wI,SI,{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}},Kb=class{},U0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),$I=class extends Kb{onExit(){return()=>{}}load(){}unload(){}},kI=class extends Kb{#t=EI.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 Da)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(!Wb(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 Da)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,Da.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 Wb(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"&&Wb(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)}},EI=globalThis.process,{onExit:w3,load:est,unload:tst}=U0e(Wb(EI)?new kI(EI):new $I)});import{addAbortListener as q0e}from"node:events";var $3,k3=y(()=>{x3();$3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=w3(()=>{t.kill()});q0e(n,()=>{i()})}});var A3,B0e,H0e,E3,G0e,T3=y(()=>{JO();H_();cs();dl();A3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=B_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=B0e(r,n,i),{sourceStream:d,sourceError:f}=G0e(t,l),{options:p,fileDescriptors:m}=Ii.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},B0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=H0e(t,e,...r),a=rb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},H0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(E3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||WO(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]=P_(r,...n);return{destination:e(E3)(i,o,s),pipeOptions:s}}if(Ii.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}`)},E3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),G0e=(t,e)=>{try{return{sourceStream:Sl(t,e)}}catch(r){return{sourceError:r}}}});var R3,Z0e,AI,O3,TI=y(()=>{Wf();Vb();R3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=Z0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw AI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},Z0e=({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 bI(r),e},AI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>$l({error:t,command:O3,escapedCommand:O3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),O3="source.pipe(destination)"});var I3,P3=y(()=>{I3=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 V0e}from"node:stream/promises";var C3,W0e,K0e,J0e,Jb,Y0e,X0e,D3=y(()=>{Zb();nb();Vb();C3=(t,e,r)=>{let n=Jb.has(e)?K0e(t,e):W0e(t,e);return Ea(t,Y0e,r.signal),Ea(e,X0e,r.signal),J0e(e),n},W0e=(t,e)=>{let r=Ca([t]);return Al(r,e),Jb.set(e,r),r},K0e=(t,e)=>{let r=Jb.get(e);return r.add(t),r},J0e=async t=>{try{await V0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Jb.delete(t)},Jb=new WeakMap,Y0e=2,X0e=1});import{aborted as Q0e}from"node:util";var N3,e$e,j3=y(()=>{TI();N3=(t,e)=>t===void 0?[]:[e$e(t,e)],e$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Q0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw AI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var Yb,t$e,r$e,M3=y(()=>{po();T3();TI();P3();D3();j3();Yb=(t,...e)=>{if(At(e[0]))return Yb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=A3(t,...e),i=t$e({...n,destination:r});return i.pipe=Yb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},t$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=r$e(t,i);R3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=C3(e,o,d);return await Promise.race([I3(u),...N3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},r$e=(t,e)=>Promise.allSettled([t,e])});import{on as n$e}from"node:events";import{getDefaultHighWaterMark as i$e}from"node:stream";var Xb,o$e,OI,s$e,L3,RI,F3,a$e,c$e,Qb=y(()=>{nI();Fb();sI();Xb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return o$e(e,s),L3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},o$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},OI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;s$e(e,s,t);let a=t.readableObjectMode&&!o;return L3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},s$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},L3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=n$e(t,"data",{signal:e.signal,highWaterMark:F3,highWatermark:F3});return a$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},RI=i$e(!0),F3=RI,a$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=c$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Pa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Jf(a)}},c$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Lb(t,r,!e),Mb(t,i,!n,{})].filter(Boolean)});import{setImmediate as l$e}from"node:timers/promises";var z3,u$e,d$e,f$e,II,U3,PI=y(()=>{Tb();rn();cI();Qb();Ra();Kf();z3=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=u$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([d$e(t),d]);return}let f=eI(c,r),p=OI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([f$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},u$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Bb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=OI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await NW(a,t,r,o)},d$e=async t=>{await l$e(),t.readableFlowing===null&&t.resume()},f$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await $b(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await kb(r,{maxBuffer:o})):await Ab(r,{maxBuffer:o})}catch(a){return U3(bV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},II=async t=>{try{return await t}catch(e){return U3(e)}},U3=({bufferedData:t})=>dG(t)?new Uint8Array(t):t});import{finished as p$e}from"node:stream/promises";var ep,m$e,h$e,g$e,y$e,_$e,CI,ev,q3,tv=y(()=>{ep=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=m$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],p$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||y$e(a,e,r,n)}finally{s.abort()}},m$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&h$e(t,r,n),n},h$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{g$e(e,r),n.call(t,...i)}},g$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},y$e=(t,e,r,n)=>{if(!_$e(t,e,r,n))throw t},_$e=(t,e,r,n=!0)=>r.propagating?q3(t)||ev(t):(r.propagating=!0,CI(r,e)===n?q3(t):ev(t)),CI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",ev=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",q3=t=>t?.code==="EPIPE"});var B3,DI,NI=y(()=>{PI();tv();B3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>DI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),DI=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=ep(t,e,l);if(CI(l,e)){await u;return}let[d]=await Promise.all([z3({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,G3,b$e,v$e,jI=y(()=>{Zb();NI();H3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ca([t,e].filter(Boolean)):void 0,G3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>DI({...b$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:v$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),b$e=({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}},v$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var Z3,V3,W3=y(()=>{ml();ss();Z3=t=>pl(t,"ipc"),V3=(t,e)=>{let r=q_(t);Oi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var K3,J3,Y3=y(()=>{Ra();W3();yo();mI();K3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Z3(o),a=go(e,"ipc"),c=go(r,"ipc");for await(let l of pI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(vV(t,i,c),i.push(l)),s&&V3(l,o);return i},J3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as S$e}from"node:events";var X3,w$e,x$e,$$e,Q3=y(()=>{Oa();OR();vR();TR();ho();vr();PI();Y3();IR();jI();NI();dI();tv();X3=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 _=qW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=B3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=G3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=K3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=w$e(h,t,S),D=x$e(m,S);try{return await Promise.race([Promise.all([{},HW(_),Promise.all(x),w,T,G9(t,d),...A,...D]),g,$$e(t,b),...z9(t,o,f,b),...s9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...F9({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(q=>II(q))),II(w),J3(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},w$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:ep(n,i,r)),x$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>ep(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),$$e=async(t,{signal:e})=>{let[r]=await S$e(t,"error",{signal:e});throw r}});var eK,tp,Tl,rv=y(()=>{vl();eK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),tp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ri();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Tl=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 tK}from"node:stream/promises";var MI,rK,FI,LI,nv,iv,zI=y(()=>{tv();MI=async t=>{if(t!==void 0)try{await FI(t)}catch{}},rK=async t=>{if(t!==void 0)try{await LI(t)}catch{}},FI=async t=>{await tK(t,{cleanup:!0,readable:!1,writable:!0})},LI=async t=>{await tK(t,{cleanup:!0,readable:!0,writable:!1})},nv=async(t,e)=>{if(await t,e)throw e},iv=(t,e,r)=>{r&&!ev(r)?t.destroy(r):e&&t.destroy()}});import{Readable as k$e}from"node:stream";import{callbackify as E$e}from"node:util";var nK,UI,qI,BI,A$e,HI,GI,iK,ZI=y(()=>{Aa();cs();Qb();vl();rv();zI();nK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=UI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=qI(a,s),{read:f,onStdoutDataDone:p}=BI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new k$e({read:f,destroy:E$e(GI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return HI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},UI=(t,e,r)=>{let n=Sl(t,e),i=tp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},qI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:RI},BI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ri(),s=Xb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){A$e(this,s,o)},onStdoutDataDone:o}},A$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},HI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await LI(t),await n,await MI(i),await e,r.readable&&r.push(null)}catch(o){await MI(i),iK(r,o)}},GI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Tl(r,e)&&(iK(t,n),await nv(e,n))},iK=(t,e)=>{iv(t,t.readable,e)}});import{Writable as T$e}from"node:stream";import{callbackify as oK}from"node:util";var sK,VI,WI,O$e,R$e,KI,JI,aK,YI=y(()=>{cs();rv();zI();sK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=VI(t,r,e),s=new T$e({...WI(n,t,i),destroy:oK(JI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return KI(n,s),s},VI=(t,e,r)=>{let n=rb(t,e),i=tp(r,n,"writableFinal"),o=tp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},WI=(t,e,r)=>({write:O$e.bind(void 0,t),final:oK(R$e.bind(void 0,t,e,r))}),O$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},R$e=async(t,e,r)=>{await Tl(r,e)&&(t.writable&&t.end(),await e)},KI=async(t,e,r)=>{try{await FI(t),e.writable&&e.end()}catch(n){await rK(r),aK(e,n)}},JI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Tl(r,e),await Tl(n,e)&&(aK(t,i),await nv(e,i))},aK=(t,e)=>{iv(t,t.writable,e)}});import{Duplex as I$e}from"node:stream";import{callbackify as P$e}from"node:util";var cK,C$e,lK=y(()=>{Aa();ZI();YI();cK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=UI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=VI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=qI(c,a),{read:g,onStdoutDataDone:b}=BI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new I$e({read:g,...WI(u,t,d),destroy:P$e(C$e.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 HI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),KI(u,_,c),_},C$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([GI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),JI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var XI,D$e,uK=y(()=>{Aa();cs();Qb();XI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=Sl(t,r),a=Xb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return D$e(a,s,t)},D$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var dK,fK=y(()=>{rv();ZI();YI();lK();uK();dK=(t,{encoding:e})=>{let r=eK();t.readable=nK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=sK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=cK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=XI.bind(void 0,t,e),t[Symbol.asyncIterator]=XI.bind(void 0,t,e,{})}});var pK,N$e,j$e,mK=y(()=>{pK=(t,e)=>{for(let[r,n]of j$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},N$e=(async()=>{})().constructor.prototype,j$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(N$e,t)])});import{setMaxListeners as M$e}from"node:events";import{spawn as F$e}from"node:child_process";var hK,L$e,z$e,U$e,q$e,B$e,gK=y(()=>{Tb();sR();DR();cs();NR();hI();Wf();Ib();o3();u3();Kf();v3();X_();k3();M3();jI();Q3();fK();vl();mK();hK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=L$e(t,e,r),{subprocess:f,promise:p}=U$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Yb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),pK(f,p),Ii.set(f,{options:u,fileDescriptors:d}),f},L$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=G_(t,e,r),{file:a,commandArguments:c,options:l}=_b(t,e,r),u=z$e(l),d=l3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},z$e=({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}},U$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=F$e(...bb(t,e,r))}catch(m){return i3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;M$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];b3(c,a,l),$3(c,r,l);let d={},f=Ri();c.kill=i9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=H3(c,r),dK(c,r),t3(c,r);let p=q$e({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}},q$e=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 X3({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)=>bo(x,e,w)),_=bo(h,e,"all"),S=B$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return kl(S,n,e)},B$e=({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?Vf({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 Pi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Rb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var ov,H$e,G$e,yK=y(()=>{po();yo();ov=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,H$e(n,t[n],i)]));return{...t,...r}},H$e=(t,e,r)=>G$e.has(t)&&At(e)&&At(r)?{...e,...r}:r,G$e=new Set(["env",...tR])});var ds,Z$e,V$e,_K=y(()=>{po();JO();bG();WW();gK();yK();ds=(t,e,r,n)=>{let i=(s,a,c)=>ds(s,a,r,c),o=(...s)=>Z$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Z$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(At(o))return i(t,ov(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=V$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?VW(a,c,l):hK(a,c,l,i)},V$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=yG(e)?_G(e,r):[e,...r],[s,a,c]=P_(...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 bK,vK,SK,W$e,K$e,wK=y(()=>{bK=({file:t,commandArguments:e})=>SK(t,e),vK=({file:t,commandArguments:e})=>({...SK(t,e),isSync:!0}),SK=(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]=W$e(t);return{file:r,commandArguments:n}},W$e=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(K$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},K$e=/ +/g});var xK,$K,J$e,kK,Y$e,EK,AK=y(()=>{xK=(t,e,r)=>{t.sync=e(J$e,r),t.s=t.sync},$K=({options:t})=>kK(t),J$e=({options:t})=>({...kK(t),isSync:!0}),kK=t=>({options:{...Y$e(t),...t}}),Y$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},EK={preferLocal:!0}});var Hct,Je,Gct,Zct,Vct,Wct,Kct,Jct,Yct,Xct,Mr=y(()=>{_K();wK();RR();AK();hI();Hct=ds(()=>({})),Je=ds(()=>({isSync:!0})),Gct=ds(bK),Zct=ds(vK),Vct=ds(q9),Wct=ds($K,{},EK,xK),{sendMessage:Kct,getOneMessage:Jct,getEachMessage:Yct,getCancelSignal:Xct}=r3()});import{existsSync as sv,statSync as X$e}from"node:fs";import{dirname as QI,extname as Q$e,isAbsolute as TK,join as eP,relative as tP,resolve as av,sep as eke}from"node:path";function cv(t){return t==="./gradlew"||t==="gradle"}function tke(t){return(sv(eP(t,"build.gradle.kts"))||sv(eP(t,"build.gradle")))&&sv(eP(t,"gradle.properties"))}function rke(t,e){let n=tP(t,e).split(eke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function fs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function nke(t,e){let r=av(t,e),n=r;sv(r)?X$e(r).isFile()&&(n=QI(r)):Q$e(r)!==""&&(n=QI(r));let i=tP(t,n);if(i.startsWith("..")||TK(i))return null;let o=n;for(;;){if(tke(o))return o;if(av(o)===av(t))return null;let s=QI(o);if(s===o)return null;let a=tP(t,s);if(a.startsWith("..")||TK(a))return null;o=s}}function lv(t,e){let r=av(t),n=new Map,i=[];for(let o of e){let s=nke(r,o);if(!s){i.push(o);continue}let a=rke(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 uv=y(()=>{"use strict"});import{existsSync as ike,readFileSync as oke}from"node:fs";import{join as ske}from"node:path";function Ol(t="."){let e=ske(t,".cladding","config.yaml");if(!ike(e))return rP;try{let n=(0,OK.parse)(oke(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 ake){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 RK(t,e){let r=[],n=!1;for(let i of t){let o=cke.exec(i);if(o){n=!0;for(let s of e)r.push(fs(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 OK,ake,rP,cke,dv=y(()=>{"use strict";OK=bt(Qt(),1);uv();ake=["type","lint","test","coverage"],rP={scope:"feature"};cke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as iP,readFileSync as IK,readdirSync as lke,statSync as uke}from"node:fs";import{join as fv}from"node:path";function aP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=fv(t,e);if(iP(r))try{if(PK.test(IK(r,"utf8")))return!0}catch{}}return!1}function CK(t){try{return iP(t)&&PK.test(IK(t,"utf8"))}catch{return!1}}function DK(t,e=0){if(e>4||!iP(t))return!1;let r;try{r=lke(t)}catch{return!1}for(let n of r){let i=fv(t,n),o=!1;try{o=uke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(DK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&CK(i))return!0}return!1}function pke(t){if(aP(t))return!0;for(let e of dke)if(CK(fv(t,e)))return!0;for(let e of fke)if(DK(fv(t,e)))return!0;return!1}function NK(t="."){let e=Ol(t).coverage;return e||(pke(t)?"kover":"jacoco")}function jK(t="."){return oP[NK(t)]}function MK(t="."){return nP[NK(t)]}var oP,nP,sP,PK,dke,fke,pv=y(()=>{"use strict";dv();oP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},nP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},sP=[nP.kover,nP.jacoco],PK=/kover/i;dke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],fke=["buildSrc","build-logic"]});import{existsSync as mv,readFileSync as FK,readdirSync as LK}from"node:fs";import{join as Na}from"node:path";function cP(t){return mv(Na(t,"gradlew"))?"./gradlew":"gradle"}function mke(t){let e=cP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[jK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function hke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(FK(Na(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 yke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function vke(t,e){for(let r of e)if(mv(Na(t,r)))return r}function Ske(t,e){try{return LK(t).find(n=>n.endsWith(e))}catch{return}}function xke(t,e){for(let r of wke)if(r.configs.some(n=>mv(Na(t,n))))return r.gate;return e}function kke(t){if($ke.some(e=>mv(Na(t,e))))return!0;try{return JSON.parse(FK(Na(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function Eke(t,e){let r=e.lint?{...e,lint:xke(t,e.lint)}:{...e};return e.test&&e.coverage&&kke(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function ut(t="."){for(let e of _ke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Ske(t,o):r=vke(t,[o]),r)break;if(!r||e.requiresSource&&!yke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Eke(t,n):n;return{language:e.language,manifest:r,gates:i}}return bke}var gke,_ke,bke,wke,$ke,on=y(()=>{"use strict";pv();gke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);_ke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:mke},{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:hke}],bke={language:"unknown",manifest:"",gates:{}};wke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];$ke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Ake,readFileSync as Tke}from"node:fs";import{join as Oke}from"node:path";function ja(t){return t.code==="ENOENT"}function hv(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=(o||s||`exit ${i}`).slice(0,200);return zK.test(o)||zK.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Ut(t,e,r){return ja(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Rl(t,e){let r=Oke(t,"package.json");if(!Ake(r))return!1;try{return!!JSON.parse(Tke(r,"utf8")).scripts?.[e]}catch{return!1}}var zK,Tn=y(()=>{"use strict";zK=/config (is |file )?not found|no such file|ENOENT|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 Rke(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.arch;if(!n)return[{detector:gv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return ja(i)?[{detector:gv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:hv(i,gv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var gv,Ma,yv=y(()=>{"use strict";Mr();on();Tn();gv="ARCHITECTURE_VIOLATION";Ma={name:gv,subprocess:!0,run:Rke}});function Ike(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.secret;if(!n)return[{detector:_v,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return ja(i)?[{detector:_v,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:hv(i,_v,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var _v,Fa,bv=y(()=>{"use strict";Mr();on();Tn();_v="HARDCODED_SECRET";Fa={name:_v,subprocess:!0,run:Ike}});import{existsSync as lP,readdirSync as UK}from"node:fs";import{join as vv}from"node:path";function Cke(t,e){let r=vv(t,e.path);if(!lP(r))return!0;if(e.isDirectory)try{return UK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Dke(t){let{cwd:e="."}=t,r=[];for(let i of Pke)Cke(e,i)&&r.push({detector:rp,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=vv(e,"spec.yaml");if(lP(n)){let i=Mke(n),o=i?null:Nke(e);if(i)r.push({detector:rp,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:rp,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=jke(e);s&&r.push({detector:rp,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 Nke(t){for(let e of["spec/features","spec/scenarios"]){let r=vv(t,e);if(!lP(r))continue;let n;try{n=UK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ei(vv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function jke(t){try{return G(t),null}catch(e){return e.message}}function Mke(t){let e;try{e=Ei(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var rp,Pke,qK,BK=y(()=>{"use strict";qe();w_();rp="ABSENCE_OF_GOVERNANCE",Pke=[{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}];qK={name:rp,run:Dke}});function Sv(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=Sv(r)==="while",o=Lke.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 '${Sv(r)}'`}let n=Fke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Sv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Sv(r)}'`:null}function zke(t,e){let r=uP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function HK(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...zke(r,n));return e}var Fke,Lke,dP=y(()=>{"use strict";Fke={event:"when",state:"while",optional:"where",unwanted:"if"},Lke=/\bwhen\b/i});function he(t,e,r){let n;try{n=G(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var vt=y(()=>{"use strict";qe()});function Uke(t){let{cwd:e="."}=t;return he(e,wv,qke)}function qke(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:wv,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 HK(t.features))e.push({detector:wv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var wv,GK,ZK=y(()=>{"use strict";dP();vt();wv="AC_DRIFT";GK={name:wv,run:Uke}});function Di(t=".",e){let n=(e??"").trim().toLowerCase()||ut(t).language;return WK[n]??VK}var Bke,Hke,Gke,VK,Zke,Vke,WK,Wke,KK,La=y(()=>{"use strict";on();Bke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,Hke=/^[ \t]*import\s+([\w.]+)/gm,Gke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,VK={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:Bke,importStyle:"relative"},Zke={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:Hke,importStyle:"dotted"},Vke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:Gke,importStyle:"dotted"},WK={typescript:VK,kotlin:Zke,python:Vke},Wke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],KK=new Set([...Object.values(WK).flatMap(t=>t?.extensions??[]),...Wke].map(t=>t.toLowerCase()))});import{existsSync as Kke,readFileSync as Jke,readdirSync as Yke,statSync as Xke}from"node:fs";import{join as YK,relative as JK}from"node:path";function Qke(t,e){if(!Kke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=Yke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=YK(i,s),c;try{c=Xke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function eEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function rEe(t){return tEe.test(t)}function nEe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Di(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Qke(YK(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=Jke(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";qe();La();XK="AI_HINTS_FORBIDDEN_PATTERN";tEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;QK={name:XK,run:nEe}});function iEe(t){let{cwd:e="."}=t,r;try{r=G(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:tJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var tJ,rJ,nJ=y(()=>{"use strict";qe();tJ="AC_DUPLICATE_WITHIN_FEATURE";rJ={name:tJ,run:iEe}});import{createRequire as oEe}from"module";import{basename as sEe,dirname as pP,normalize as aEe,relative as cEe,resolve as lEe,sep as sJ}from"path";import*as uEe from"fs";function dEe(t){let e=aEe(t);return e.length>1&&e[e.length-1]===sJ&&(e=e.substring(0,e.length-1)),e}function aJ(t,e){return t.replace(fEe,e)}function mEe(t){return t==="/"||pEe.test(t)}function fP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=lEe(t)),(n||o)&&(t=dEe(t)),t===".")return"";let s=t[t.length-1]!==i;return aJ(s?t+i:t,i)}function cJ(t,e){return e+t}function hEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:aJ(cEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function gEe(t){return t}function yEe(t,e,r){return e+t+r}function _Ee(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?hEe(t,e):n?cJ:gEe}function bEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function vEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function $Ee(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?vEe(t):bEe(t):n&&n.length?wEe:SEe:xEe}function REe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?OEe:r&&r.length?n?kEe:EEe:n?AEe:TEe}function CEe(t){return t.group?PEe:IEe}function jEe(t){return t.group?DEe:NEe}function LEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?FEe:MEe}function lJ(t,e,r){if(r.options.useRealPaths)return zEe(e,r);let n=pP(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=pP(n)}return r.symlinks.set(t,e),i>1}function zEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function xv(t,e,r,n){e(t&&!n?t:null,r)}function KEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?UEe:GEe:n?e?qEe:WEe:i?e?HEe:VEe:e?BEe:ZEe}function XEe(t){return t?YEe:JEe}function rAe(t,e){return new Promise((r,n)=>{fJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function fJ(t,e,r){new dJ(t,e,r).start()}function nAe(t,e){return new dJ(t,e).start()}var iJ,fEe,pEe,SEe,wEe,xEe,kEe,EEe,AEe,TEe,OEe,IEe,PEe,DEe,NEe,MEe,FEe,UEe,qEe,BEe,HEe,GEe,ZEe,VEe,WEe,uJ,JEe,YEe,QEe,eAe,tAe,dJ,oJ,pJ,mJ,hJ=y(()=>{iJ=oEe(import.meta.url);fEe=/[\\/]/g;pEe=/^[a-z]:[\\/]$/i;SEe=(t,e)=>{e.push(t||".")},wEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},xEe=()=>{};kEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},EEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},AEe=(t,e,r,n)=>{r.files++},TEe=(t,e)=>{e.push(t)},OEe=()=>{};IEe=t=>t,PEe=()=>[""].slice(0,0);DEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},NEe=()=>{};MEe=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()&&lJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},FEe=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()&&lJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};UEe=t=>t.counts,qEe=t=>t.groups,BEe=t=>t.paths,HEe=t=>t.paths.slice(0,t.options.maxFiles),GEe=(t,e,r)=>(xv(e,r,t.counts,t.options.suppressErrors),null),ZEe=(t,e,r)=>(xv(e,r,t.paths,t.options.suppressErrors),null),VEe=(t,e,r)=>(xv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),WEe=(t,e,r)=>(xv(e,r,t.groups,t.options.suppressErrors),null);uJ={withFileTypes:!0},JEe=(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||".",uJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},YEe=(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||".",uJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};QEe=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))}},eAe=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}},tAe=class{aborted=!1;abort(){this.aborted=!0}},dJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=KEe(e,this.isSynchronous),this.root=fP(t,e),this.state={root:mEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new eAe,options:e,queue:new QEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new tAe,fs:e.fs||uEe},this.joinPath=_Ee(this.root,e),this.pushDirectory=$Ee(this.root,e),this.pushFile=REe(e),this.getArray=CEe(e),this.groupFiles=jEe(e),this.resolveSymlink=LEe(e,this.isSynchronous),this.walkDirectory=XEe(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(_=fP(_,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=sEe(_),x=fP(pP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};oJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return rAe(this.root,this.options)}withCallback(t){fJ(this.root,this.options,t)}sync(){return nAe(this.root,this.options)}},pJ=null;try{iJ.resolve("picomatch"),pJ=iJ("picomatch")}catch{}mJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:sJ,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 oJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new oJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||pJ;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 np=v((tut,vJ)=>{"use strict";var gJ="[^\\\\/]",iAe="(?=.)",yJ="[^/]",mP="(?:\\/|$)",_J="(?:^|\\/)",hP=`\\.{1,2}${mP}`,oAe="(?!\\.)",sAe=`(?!${_J}${hP})`,aAe=`(?!\\.{0,1}${mP})`,cAe=`(?!${hP})`,lAe="[^.\\/]",uAe=`${yJ}*?`,dAe="/",bJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:iAe,QMARK:yJ,END_ANCHOR:mP,DOTS_SLASH:hP,NO_DOT:oAe,NO_DOTS:sAe,NO_DOT_SLASH:aAe,NO_DOTS_SLASH:cAe,QMARK_NO_DOT:lAe,STAR:uAe,START_ANCHOR:_J,SEP:dAe},fAe={...bJ,SLASH_LITERAL:"[\\\\/]",QMARK:gJ,STAR:`${gJ}*?`,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:"\\"},pAe={__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"};vJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:pAe,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?fAe:bJ}}});var ip=v(Fr=>{"use strict";var{REGEX_BACKSLASH:mAe,REGEX_REMOVE_BACKSLASH:hAe,REGEX_SPECIAL_CHARS:gAe,REGEX_SPECIAL_CHARS_GLOBAL:yAe}=np();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>gAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(yAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(mAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(hAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var TJ=v((nut,AJ)=>{"use strict";var SJ=ip(),{CHAR_ASTERISK:gP,CHAR_AT:_Ae,CHAR_BACKWARD_SLASH:op,CHAR_COMMA:bAe,CHAR_DOT:yP,CHAR_EXCLAMATION_MARK:_P,CHAR_FORWARD_SLASH:EJ,CHAR_LEFT_CURLY_BRACE:bP,CHAR_LEFT_PARENTHESES:vP,CHAR_LEFT_SQUARE_BRACKET:vAe,CHAR_PLUS:SAe,CHAR_QUESTION_MARK:wJ,CHAR_RIGHT_CURLY_BRACE:wAe,CHAR_RIGHT_PARENTHESES:xJ,CHAR_RIGHT_SQUARE_BRACKET:xAe}=np(),$J=t=>t===EJ||t===op,kJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},$Ae=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},E=()=>l>=n,q=()=>c.charCodeAt(l+1),Q=()=>(T=A,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),Se&&m===!0&&d>0?(Se=c.slice(0,d),C=c.slice(d)):m===!0?(Se="",C=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&$J(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),r.unescape===!0&&(C&&(C=SJ.removeBackslashes(C)),Se&&_===!0&&(Se=SJ.removeBackslashes(Se)));let Ir={prefix:P,input:t,start:u,base:Se,glob:C,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,$J(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var sp=np(),sn=ip(),{MAX_LENGTH:$v,POSIX_REGEX_SOURCE:kAe,REGEX_NON_SPECIAL_CHARS:EAe,REGEX_SPECIAL_CHARS_BACKREF:AAe,REPLACEMENTS:OJ}=sp,TAe=(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=>sn.escapeRegex(i)).join("..")}return r},Il=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,RJ=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},OAe=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},IJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(OAe(e))return e.replace(/\\(.)/g,"$1")},RAe=t=>{let e=t.map(IJ).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}}}}},IAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=IJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},PAe=t=>{let e=0,r=t.trim(),n=SP(r);for(;n;)e++,r=n.body.trim(),n=SP(r);return e},CAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:sp.DEFAULT_MAX_EXTGLOB_RECURSION,n=RJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||RAe(n)))return{risky:!0};for(let i of n){let o=IAe(i);if(o)return{risky:!0,safeOutput:o};if(PAe(i)>r)return{risky:!0}}return{risky:!1}},wP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=OJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min($v,r.maxLength):$v,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=sp.globChars(r.windows),l=sp.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,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(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=sn.removePrefix(t,E),i=t.length;let q=[],Q=[],Se=[],P=o,C,Ir=()=>E.index===i-1,se=E.peek=(H=1)=>t[E.index+H],Pe=E.advance=()=>t[++E.index]||"",Kt=()=>t.slice(E.index+1),dr=(H="",pt=0)=>{E.consumed+=H,E.index+=pt},Yt=H=>{E.output+=H.output!=null?H.output:H.value,dr(H.value)},oo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),E.start++,H++;return H%2===0?!1:(E.negated=!0,E.start++,!0)},Si=H=>{E[H]++,Se.push(H)},Yr=H=>{E[H]--,Se.pop()},de=H=>{if(P.type==="globstar"){let pt=E.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||q.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!pt&&!B&&(E.output=E.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=D,E.output+=P.output)}if(q.length&&H.type!=="paren"&&(q[q.length-1].inner+=H.value),(H.value||H.output)&&Yt(H),P&&P.type==="text"&&H.type==="text"){P.output=(P.output||P.value)+H.value,P.value+=H.value;return}H.prev=P,s.push(H),P=H},so=(H,pt)=>{let B={...l[pt],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;Si("parens"),de({type:H,value:pt,output:E.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Te}),q.push(B)},fde=H=>{let pt=t.slice(H.startIndex,E.index+1),B=t.slice(H.startIndex+2,E.index),Te=CAe(B,r);if((H.type==="plus"||H.type==="star")&&Te.risky){let ct=Te.safeOutput?(H.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,wi=s[H.tokensIndex];wi.type="text",wi.value=pt,wi.output=ct||sn.escapeRegex(pt);for(let xi=H.tokensIndex+1;xi1&&H.inner.includes("/")&&(ct=O(r)),(ct!==D||Ir()||/^\)+$/.test(Kt()))&&(lt=H.close=`)$))${ct}`),H.inner.includes("*")&&(Ft=Kt())&&/^\.[^\\/.]+$/.test(Ft)){let wi=wP(Ft,{...e,fastpaths:!1}).output;lt=H.close=`)${wi})${ct})`}H.prev.type==="bos"&&(E.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:C,output:lt}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,pt=t.replace(AAe,(B,Te,lt,Ft,ct,wi)=>Ft==="\\"?(H=!0,B):Ft==="?"?Te?Te+Ft+(ct?_.repeat(ct.length):""):wi===0?A+(ct?_.repeat(ct.length):""):_.repeat(lt.length):Ft==="."?u.repeat(lt.length):Ft==="*"?Te?Te+Ft+(ct?D:""):D:Te?B:`\\${B}`);return H===!0&&(r.unescape===!0?pt=pt.replace(/\\/g,""):pt=pt.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),pt===t&&r.contains===!0?(E.output=t,E):(E.output=sn.wrapOutput(pt,E,e),E)}for(;!Ir();){if(C=Pe(),C==="\0")continue;if(C==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){C+="\\",de({type:"text",value:C});continue}let Te=/^\\+/.exec(Kt()),lt=0;if(Te&&Te[0].length>2&&(lt=Te[0].length,E.index+=lt,lt%2!==0&&(C+="\\")),r.unescape===!0?C=Pe():C+=Pe(),E.brackets===0){de({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("["),lt=P.value.slice(0,Te),Ft=P.value.slice(Te+2),ct=kAe[Ft];if(ct){P.value=lt+ct,E.backtrack=!0,Pe(),!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,Yt({value:C});continue}if(E.quotes===1&&C!=='"'){C=sn.escapeRegex(C),P.value+=C,Yt({value:C});continue}if(C==='"'){E.quotes=E.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:C});continue}if(C==="("){Si("parens"),de({type:"paren",value:C});continue}if(C===")"){if(E.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Il("opening","("));let B=q[q.length-1];if(B&&E.parens===B.parens+1){fde(q.pop());continue}de({type:"paren",value:C,output:E.parens?")":"\\)"}),Yr("parens");continue}if(C==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Il("closing","]"));C=`\\${C}`}else Si("brackets");de({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){de({type:"text",value:C,output:`\\${C}`});continue}if(E.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Il("opening","["));de({type:"text",value:C,output:`\\${C}`});continue}Yr("brackets");let B=P.value.slice(1);if(P.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(C=`/${C}`),P.value+=C,Yt({value:C}),r.literalBrackets===!1||sn.hasRegexChars(B))continue;let Te=sn.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){Si("braces");let B={type:"brace",value:C,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};Q.push(B),de(B);continue}if(C==="}"){let B=Q[Q.length-1];if(r.nobrace===!0||!B){de({type:"text",value:C,output:C});continue}let Te=")";if(B.dots===!0){let lt=s.slice(),Ft=[];for(let ct=lt.length-1;ct>=0&&(s.pop(),lt[ct].type!=="brace");ct--)lt[ct].type!=="dots"&&Ft.unshift(lt[ct].value);Te=TAe(Ft,r),E.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let lt=E.output.slice(0,B.outputIndex),Ft=E.tokens.slice(B.tokensIndex);B.value=B.output="\\{",C=Te="\\}",E.output=lt;for(let ct of Ft)E.output+=ct.output||ct.value}de({type:"brace",value:C,output:Te}),Yr("braces"),Q.pop();continue}if(C==="|"){q.length>0&&q[q.length-1].conditions++,de({type:"text",value:C});continue}if(C===","){let B=C,Te=Q[Q.length-1];Te&&Se[Se.length-1]==="braces"&&(Te.comma=!0,B="|"),de({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}de({type:"slash",value:C,output:f});continue}if(C==="."){if(E.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let B=Q[Q.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"){de({type:"text",value:C,output:u});continue}de({type:"dot",value:C,output:u});continue}if(C==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){so("qmark",C);continue}if(P&&P.type==="paren"){let Te=se(),lt=C;(P.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(lt=`\\${C}`),de({type:"text",value:C,output:lt});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){de({type:"qmark",value:C,output:S});continue}de({type:"qmark",value:C,output:_});continue}if(C==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){so("negate",C);continue}if(r.nonegate!==!0&&E.index===0){oo();continue}}if(C==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){so("plus",C);continue}if(P&&P.value==="("||r.regex===!1){de({type:"plus",value:C,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||E.parens>0){de({type:"plus",value:C});continue}de({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:C,output:""});continue}de({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let B=EAe.exec(Kt());B&&(C+=B[0],E.index+=B[0].length),de({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,dr(C);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){so("star",C);continue}if(P.type==="star"){if(r.noglobstar===!0){dr(C);continue}let B=P.prev,Te=B.prev,lt=B.type==="slash"||B.type==="bos",Ft=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!lt||H[0]&&H[0]!=="/")){de({type:"star",value:C,output:""});continue}let ct=E.braces>0&&(B.type==="comma"||B.type==="brace"),wi=q.length&&(B.type==="pipe"||B.type==="paren");if(!lt&&B.type!=="paren"&&!ct&&!wi){de({type:"star",value:C,output:""});continue}for(;H.slice(0,3)==="/**";){let xi=t[E.index+4];if(xi&&xi!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Ir()){P.type="globstar",P.value+=C,P.output=O(r),E.output=P.output,E.globstar=!0,dr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!Ft&&Ir()){E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=O(r)+(r.strictSlashes?")":"|$)"),P.value+=C,E.globstar=!0,E.output+=B.output+P.output,dr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let xi=H[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=`${O(r)}${f}|${f}${xi})`,P.value+=C,E.output+=B.output+P.output,E.globstar=!0,dr(C+Pe()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){P.type="globstar",P.value+=C,P.output=`(?:^|${f}|${O(r)}${f})`,E.output=P.output,E.globstar=!0,dr(C+Pe()),de({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-P.output.length),P.type="globstar",P.output=O(r),P.value+=C,E.output+=P.output,E.globstar=!0,dr(C);continue}let pt={type:"star",value:C,output:D};if(r.bash===!0){pt.output=".*?",(P.type==="bos"||P.type==="slash")&&(pt.output=T+pt.output),de(pt);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){pt.output=C,de(pt);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+=T,P.output+=T),se()!=="*"&&(E.output+=p,P.output+=p)),de(pt)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Il("closing","]"));E.output=sn.escapeLast(E.output,"["),Yr("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Il("closing",")"));E.output=sn.escapeLast(E.output,"("),Yr("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Il("closing","}"));E.output=sn.escapeLast(E.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),E.backtrack===!0){E.output="";for(let H of E.tokens)E.output+=H.output!=null?H.output:H.value,H.suffix&&(E.output+=H.suffix)}return E};wP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min($v,r.maxLength):$v,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=OJ[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}=sp.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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};PJ.exports=wP});var jJ=v((out,NJ)=>{"use strict";var DAe=TJ(),xP=CJ(),DJ=ip(),NAe=np(),jAe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=jAe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?DJ.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(DJ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):xP(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>DAe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=xP.fastpaths(t,e)),i.output||(i=xP(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=NAe;NJ.exports=Tt});var zJ=v((sut,LJ)=>{"use strict";var MJ=jJ(),MAe=ip();function FJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:MAe.isWindows()}),MJ(t,e,r)}Object.assign(FJ,MJ);LJ.exports=FJ});import{readdir as FAe,readdirSync as LAe,realpath as zAe,realpathSync as UAe,stat as qAe,statSync as BAe}from"fs";import{isAbsolute as HAe,posix as za,resolve as GAe}from"path";import{fileURLToPath as ZAe}from"url";function KAe(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]===".."&&WAe.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=>za.relative(t,n)||".":n=>za.relative(t,`${e}/${n}`)||"."}function XAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=za.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function HJ(t){var e;let r=Pl.default.scan(t,QAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function oTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Pl.default.scan(t);return r.isGlob||r.negated}function ap(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function GJ(t){return typeof t=="string"?[t]:t??[]}function $P(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=iTe(o);s=HAe(s.replace(aTe,""))?za.relative(a,s):za.normalize(s);let c=(i=sTe.exec(s))===null||i===void 0?void 0:i[0],l=HJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?za.join(o,...d):o}return s}function cTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push($P(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push($P(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push($P(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function lTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=cTe(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(qJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Pl.default)(i.match,f),m=(0,Pl.default)(i.ignore,f),h=KAe(i.match,f),g=UJ(r,d,o),b=o?g:UJ(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new mJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&ap(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return ap(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&XAe(r,d)]}function uTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function fTe(t){let e={...dTe,...t};return e.cwd=(e.cwd instanceof URL?ZAe(e.cwd):GAe(e.cwd)).replace(qJ,"/"),e.ignore=GJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||FAe,readdirSync:e.fs.readdirSync||LAe,realpath:e.fs.realpath||zAe,realpathSync:e.fs.realpathSync||UAe,stat:e.fs.stat||qAe,statSync:e.fs.statSync||BAe}),e.debug&&ap("globbing with options:",e),e}function pTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=VAe(t)||typeof t=="string",i=GJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=fTe(n?e:t);return i.length>0?lTe(o,i):[]}function ps(t,e){let[r,n]=pTe(t,e);return r?uTe(r.sync(),n):[]}var Pl,VAe,qJ,BJ,WAe,JAe,YAe,QAe,eTe,tTe,rTe,nTe,iTe,sTe,aTe,dTe,cp=y(()=>{hJ();Pl=bt(zJ(),1),VAe=Array.isArray,qJ=/\\/g,BJ=process.platform==="win32",WAe=/^(\/?\.\.)+$/;JAe=/^[A-Z]:\/$/i,YAe=BJ?t=>JAe.test(t):t=>t==="/";QAe={parts:!0};eTe=/(?t.replace(eTe,"\\$&"),nTe=t=>t.replace(tTe,"\\$&"),iTe=BJ?nTe:rTe;sTe=/^(\/?\.\.)+/,aTe=/\\(?=[()[\]{}!*+?@|])/g;dTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as lp,readFileSync as mTe,readdirSync as hTe,statSync as ZJ}from"node:fs";import{join as Ua}from"node:path";function gTe(t){let{cwd:e="."}=t,r,n;try{let c=G(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Di(e,n),o=[],{layers:s,forbiddenImports:a}=kP(r);return(s.size>0||a.length>0)&&!lp(Ua(e,i.mainRoot))?[{detector:up,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&&(yTe(e,i,s,o),_Te(e,i,s,o)),a.length>0&&bTe(e,i,a,o),o)}function kP(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 yTe(t,e,r,n){let i=e.mainRoot,o=Ua(t,i);if(lp(o))for(let s of hTe(o)){let a=Ua(o,s);ZJ(a).isDirectory()&&(r.has(s)||n.push({detector:up,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function _Te(t,e,r,n){let i=e.mainRoot,o=Ua(t,i);if(lp(o))for(let s of r){let a=Ua(o,s);lp(a)&&ZJ(a).isDirectory()||n.push({detector:up,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 bTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ua(t,i,s.from);if(!lp(a))continue;let c=ps([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ua(a,l),d;try{d=mTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];vTe(p,s.to,e.importStyle)&&n.push({detector:up,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 vTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var up,VJ,EP=y(()=>{"use strict";cp();qe();La();up="ARCHITECTURE_FROM_SPEC";VJ={name:up,run:gTe}});import{existsSync as STe,readFileSync as wTe}from"node:fs";import{join as xTe}from"node:path";function $Te(t){let{cwd:e="."}=t,r=xTe(e,"spec/capabilities.yaml");if(!STe(r))return[];let n;try{let c=wTe(r,"utf8"),l=WJ.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=G(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:kv,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:kv,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:kv,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var WJ,kv,KJ,JJ=y(()=>{"use strict";WJ=bt(Qt(),1);qe();kv="CAPABILITIES_FEATURE_MAPPING";KJ={name:kv,run:$Te}});import{existsSync as kTe,readFileSync as ETe}from"node:fs";import{join as ATe}from"node:path";function TTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function OTe(t){let{cwd:e="."}=t;return he(e,AP,r=>RTe(r,e))}function RTe(t,e){let r=Di(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=ATe(e,o);if(!kTe(s))continue;let a=ETe(s,"utf8");TTe(a)||n.push({detector:AP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var AP,YJ,XJ=y(()=>{"use strict";La();vt();AP="CONVENTION_DRIFT";YJ={name:AP,run:OTe}});import{existsSync as TP,readFileSync as QJ}from"node:fs";import{join as Ev}from"node:path";function ITe(t){return JSON.parse(t).total?.lines?.pct??0}function e8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function DTe(t,e){if(!cv(ut(t).gates.coverage?.cmd))return null;let r;try{r=lv(t,e)}catch(c){return[{detector:vo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=sP.find(d=>TP(Ev(c.dir,d)));if(!l){s.push(c.path);continue}let u=e8(QJ(Ev(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:vo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=t8(n,i);return a0?[{detector:vo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function NTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=DTe(e,t.focusModules);if(a)return a}let r;try{r=G(e).project?.language}catch{}let n=Di(e,r),i=ut(e).language==="kotlin"?sP.find(a=>TP(Ev(e,a)))??MK(e):n.coverageSummary,o=Ev(e,i);if(!TP(o))return[{detector:vo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=QJ(o,"utf8");s=n.coverageFormat==="jacoco-xml"?PTe(a):n.coverageFormat==="cobertura-xml"?CTe(a):ITe(a)}catch(a){return[{detector:vo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:vo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Av?[]:[{detector:vo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Av}%`}]}var vo,Av,r8,n8=y(()=>{"use strict";qe();pv();La();uv();on();vo="COVERAGE_DROP",Av=70;r8={name:vo,run:NTe}});import{existsSync as jTe}from"node:fs";import{join as MTe}from"node:path";function FTe(t){let{cwd:e="."}=t;return he(e,Tv,r=>LTe(r,e))}function LTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?jTe(MTe(e,r.path))?[]:[{detector:Tv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:Tv,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var Tv,i8,o8=y(()=>{"use strict";vt();Tv="DELIVERABLE_INTEGRITY";i8={name:Tv,run:FTe}});function zTe(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:Ov,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 UTe(t){let e=zTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Ov,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 qTe(t){let{cwd:e="."}=t;return he(e,Ov,r=>UTe(r))}var Ov,s8,a8=y(()=>{"use strict";vt();Ov="SMOKE_PROBE_DEMAND";s8={name:Ov,run:qTe}});function BTe(t){let{cwd:e="."}=t;return he(e,Rv,r=>HTe(r,e))}function HTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=is(e);if(n===null)return[{detector:Rv,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=T_(n,e,o);s.state!=="fresh"&&i.push({detector:Rv,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 Rv,Iv,OP=y(()=>{"use strict";cl();vt();Rv="STALE_ATTESTATION";Iv={name:Rv,run:BTe}});function GTe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}return ZTe(r)}function ZTe(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:c8,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 c8,Pv,RP=y(()=>{"use strict";qe();c8="DEPENDENCY_CYCLE";Pv={name:c8,run:GTe}});import{appendFileSync as VTe,existsSync as l8,mkdirSync as WTe,readFileSync as KTe}from"node:fs";import{dirname as JTe,join as YTe}from"node:path";function u8(t){return YTe(t,XTe,QTe)}function d8(t){return IP.add(t),()=>IP.delete(t)}function qa(t,e){let r=u8(t),n=JTe(r);l8(n)||WTe(n,{recursive:!0}),VTe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of IP)try{i(t,e)}catch{}}function On(t){let e=u8(t);if(!l8(e))return[];let r=KTe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var XTe,QTe,IP,ti=y(()=>{"use strict";XTe=".cladding",QTe="audit.log.jsonl";IP=new Set});import{existsSync as eOe}from"node:fs";import{join as tOe}from"node:path";function rOe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:PP,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&&(eOe(tOe(e,i.artifact))||n.push({detector:PP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var PP,f8,p8=y(()=>{"use strict";ti();PP="EVIDENCE_MISMATCH";f8={name:PP,run:rOe}});import{existsSync as nOe,readFileSync as iOe}from"node:fs";import{join as oOe}from"node:path";function sOe(t){let e=oOe(t,y8);if(!nOe(e))return null;try{let n=((0,g8.parse)(iOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*h8(t,e){for(let r of t??[])r.startsWith(m8)&&(yield{ref:r,name:r.slice(m8.length),field:e})}function aOe(t){let{cwd:e="."}=t,r=sOe(e);if(r===null)return[];let n;try{n=G(e)}catch(o){return[{detector:CP,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=[...h8(s.evidence_refs,"evidence_refs"),...h8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:CP,severity:"warn",path:y8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var g8,CP,m8,y8,_8,b8=y(()=>{"use strict";g8=bt(Qt(),1);qe();CP="FIXTURE_REFERENCE_INVALID",m8="fixture:",y8="conformance/fixtures.yaml";_8={name:CP,run:aOe}});import{existsSync as Cl,readFileSync as DP}from"node:fs";import{join as Ba}from"node:path";function cOe(t){return ps(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function dp(t){if(!Cl(t))return null;try{return JSON.parse(DP(t,"utf8"))}catch{return null}}function lOe(t,e){let r=Ba(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(DP(r,"utf8"))}catch(c){e.push({detector:So,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:So,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=cOe(t);s!==a&&e.push({detector:So,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function uOe(t,e){for(let r of v8){let n=Ba(t,r.path);if(!Cl(n))continue;let i=dp(n);if(!i){e.push({detector:So,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:So,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function dOe(t,e){let r=dp(Ba(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of v8){let s=Ba(t,o.path);if(!Cl(s))continue;let a=dp(s);a?.version&&a.version!==n&&e.push({detector:So,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ba(t,".claude-plugin","marketplace.json");if(Cl(i)){let o=dp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:So,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 fOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function pOe(t,e){let r=Ba(t,"src","cli","clad.ts"),n=Ba(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Cl(r)||!Cl(n))return;let i=fOe(DP(r,"utf8"));if(i.length===0)return;let s=dp(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:So,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 mOe(t){let{cwd:e="."}=t,r=[];return lOe(e,r),pOe(e,r),uOe(e,r),dOe(e,r),r}var So,v8,S8,w8=y(()=>{"use strict";cp();So="HARNESS_INTEGRITY",v8=[{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"]}];S8={name:So,run:mOe}});import{existsSync as hOe,readFileSync as gOe}from"node:fs";import{join as yOe}from"node:path";function bOe(t){let{cwd:e="."}=t;return he(e,Cv,r=>SOe(r,e))}function vOe(t){let e=yOe(t,"spec/capabilities.yaml");if(!hOe(e))return!1;try{let r=x8.default.parse(gOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function SOe(t,e){let r=t.features.length;if(r<_Oe)return[];let n=[];return vOe(e)&&n.push({detector:Cv,severity:"warn",path:"spec/capabilities.yaml",message:`${r} features but spec/capabilities.yaml declares no capabilities (capabilities: []) \u2014 the design SSoT is an empty seed. Populate it (capability \u2194 feature links) or run \`clad init --scan\`.`}),t.architecture&&(t.architecture.layers??[]).length===0&&n.push({detector:Cv,severity:"warn",path:"spec/architecture.yaml",message:`${r} features but spec/architecture.yaml declares no layers (layers: []) \u2014 the architecture SSoT is an empty seed. Populate it or run \`clad init --scan\`.`}),n}var x8,Cv,_Oe,$8,k8=y(()=>{"use strict";x8=bt(Qt(),1);vt();Cv="HOLLOW_GOVERNANCE",_Oe=8;$8={name:Cv,run:bOe}});import{existsSync as E8,readFileSync as A8}from"node:fs";import{join as T8}from"node:path";function O8(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 $Oe(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 kOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function EOe(t){let e=T8(t,"README.md"),r=T8(t,"docs","dogfood","matrix.md");if(!E8(e)||!E8(r))return[];let n=O8(A8(e,"utf8"),wOe),i=O8(A8(r,"utf8"),xOe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=kOe(a);if(c===null)continue;let l=i[s]??"not-run",u=$Oe(l);u!==null&&c>u&&o.push({detector:R8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function AOe(t){let{cwd:e="."}=t;return EOe(e)}var R8,wOe,xOe,I8,P8=y(()=>{"use strict";R8="HOST_CLAIM_DRIFT",wOe=//,xOe=//;I8={name:R8,run:AOe}});function TOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return C8(r.features.map(i=>i.id),"feature","spec/features/",n),C8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function C8(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:D8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var D8,N8,j8=y(()=>{"use strict";qe();D8="ID_COLLISION";N8={name:D8,run:TOe}});import{existsSync as fp,readFileSync as NP,readdirSync as jP,statSync as OOe,writeFileSync as F8}from"node:fs";import{join as wo}from"node:path";function M8(t){if(!fp(t))return 0;try{return jP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function ROe(t){if(!fp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=jP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=wo(n,o),a;try{a=OOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function IOe(t){let e=wo(t,"spec","capabilities.yaml");if(!fp(e))return 0;try{let r=Dv.default.parse(NP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ms(t="."){let e=M8(wo(t,"spec","features")),r=M8(wo(t,"spec","scenarios")),n=IOe(t),i=ROe(wo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Dl(t,e){let r=wo(t,"spec.yaml");if(!fp(r))return;let n=NP(r,"utf8"),i=POe(n,e);i!==n&&F8(r,i)}function POe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as gxe}from"node:buffer";import{StringDecoder as yxe}from"node:string_decoder";var zb,_xe,bxe,vxe,nI=y(()=>{rn();zb=(t,e,r)=>{if(r)return;if(t)return{transform:_xe.bind(void 0,new TextEncoder)};let n=new yxe(e);return{transform:bxe.bind(void 0,n),final:vxe.bind(void 0,n)}},_xe=function*(t,e){gxe.isBuffer(e)?yield mo(e):typeof e=="string"?yield t.encode(e):yield e},bxe=function*(t,e){yield zt(e)?t.write(e):e},vxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as AW}from"node:util";var iI,Ub,TW,Sxe,OW,wxe,RW=y(()=>{iI=AW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Ub=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=wxe}=e[r];for await(let i of n(t))yield*Ub(i,e,r+1)},TW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Sxe(r,Number(e),t)},Sxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Ub(n,r,e+1)},OW=AW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),wxe=function*(t){yield t}});var oI,IW,Pa,Yf,xxe,$xe,sI=y(()=>{oI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},IW=(t,e)=>[...e.flatMap(r=>[...Pa(r,t,0)]),...Yf(t)],Pa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=$xe}=e[r];for(let i of n(t))yield*Pa(i,e,r+1)},Yf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*xxe(r,Number(e),t)},xxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Pa(n,r,e+1)},$xe=function*(t){yield t}});import{Transform as kxe,getDefaultHighWaterMark as PW}from"node:stream";var aI,qb,CW,Bb=y(()=>{vr();Lb();EW();nI();RW();sI();aI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=CW(t,s,o),l=Ia(e),u=Ia(r),d=l?iI.bind(void 0,Ub,a):oI.bind(void 0,Pa),f=l||u?iI.bind(void 0,TW,a):oI.bind(void 0,Yf),p=l||u?OW.bind(void 0,a):void 0;return{stream:new kxe({writableObjectMode:n,writableHighWaterMark:PW(n),readableObjectMode:i,readableHighWaterMark:PW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},qb=(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=CW(s,r,a);t=IW(c,t)}return t},CW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:xW(n,a)},zb(r,s,n),Fb(r,o,n,c),{transform:t,final:e},{transform:$W(i,a)},wW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var DW,Exe,Axe,Txe,Oxe,NW=y(()=>{Bb();rn();vr();DW=(t,e)=>{for(let r of Exe(t))Axe(t,r,e)},Exe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Axe=(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 ${us[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Txe(a,n));r.input=Nf(s)},Txe=(t,e)=>{let r=qb(t,e,"utf8",!0);return Oxe(r),Nf(r)},Oxe=t=>{let e=t.find(r=>typeof r!="string"&&!zt(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 Hb,Rxe,Ixe,jW,MW,Pxe,FW,cI=y(()=>{Aa();vr();hl();ss();Hb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&ml(r,n)&&!nn.has(e)&&Rxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Ixe.has(o))||t.every(({type:i})=>An.has(i))),Rxe=t=>t===1||t===2,Ixe=new Set(["pipe","overlapped"]),jW=async(t,e,r,n)=>{for await(let i of t)Pxe(e)||FW(i,r,n)},MW=(t,e,r)=>{for(let n of t)FW(n,e,r)},Pxe=t=>t._readableState.pipes.length>0,FW=(t,e,r)=>{let n=B_(t);Oi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Cxe,appendFileSync as Dxe}from"node:fs";var LW,Nxe,jxe,Mxe,Fxe,Lxe,zW=y(()=>{cI();Bb();Lb();rn();vr();Ra();LW=({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)=>Nxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Nxe=({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=$V(t,o,d),p=mo(f),{stdioItems:m,objectMode:h}=e[r],g=jxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Mxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Fxe({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&&Lxe(b,m,i),S}catch(x){return n.error=x,S}},jxe=(t,e,r,n)=>{try{return qb(t,e,r,!1)}catch(i){return n.error=i,t}},Mxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Nf(t)};let s=mG(t,r);return n[o]?{serializedResult:s,finalResult:rI(s,!i[o],e)}:{serializedResult:s}},Fxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Hb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=rI(t,!1,s);try{MW(a,e,n)}catch(c){r.error??=c}},Lxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Nb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Dxe(n,t):(r.add(o),Cxe(n,t))}}});var UW,qW=y(()=>{rn();Jf();UW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,bo(e,r,"all")]:Array.isArray(e)?[bo(t,r,"all"),...e]:zt(t)&&zt(e)?YO([t,e]):`${t}${e}`}});import{once as lI}from"node:events";var BW,zxe,HW,GW,Uxe,uI,dI=y(()=>{ka();BW=async(t,e)=>{let[r,n]=await zxe(t);return e.isForcefullyTerminated??=!1,[r,n]},zxe=async t=>{let[e,r]=await Promise.allSettled([lI(t,"spawn"),lI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?HW(t):r.value},HW=async t=>{try{return await lI(t,"exit")}catch{return HW(t)}},GW=async t=>{let[e,r]=await t;if(!Uxe(e,r)&&uI(e,r))throw new Xn;return[e,r]},Uxe=(t,e)=>t===void 0&&e===void 0,uI=(t,e)=>t!==0||e!==null});var ZW,qxe,VW=y(()=>{ka();Ra();dI();ZW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=qxe(t,e,r),s=o?.code==="ETIMEDOUT",a=xV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},qxe=(t,e,r)=>t!==void 0?t:uI(e,r)?new Xn:void 0});import{spawnSync as Bxe}from"node:child_process";var WW,Hxe,Gxe,Zxe,Gb,Vxe,Wxe,Kxe,Jxe,KW=y(()=>{sR();DR();NR();Kf();Pb();bW();Jf();NW();zW();Ra();qW();VW();WW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Hxe(t,e,r),d=Vxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return El(d,c,l)},Hxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Z_(t,e,r),a=Gxe(r),{file:c,commandArguments:l,options:u}=bb(t,e,a);Zxe(u);let d=yW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Gxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Zxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Gb("ipcInput"),t&&Gb("ipc: true"),r&&Gb("detached: true"),n&&Gb("cancelSignal")},Gb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Vxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Wxe({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}=ZW(c,r),{output:m,error:h=l}=LW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>bo(_,r,S)),b=bo(UW(m,r),r,"all");return Jxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Wxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{DW(o,r);let a=Kxe(r);return Bxe(...vb(t,e,a))}catch(a){return kl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},Kxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Rb(e)}),Jxe=({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?Ib({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Wf({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 Yxe}from"node:events";var JW,Xxe,Qxe,e0e,t0e,YW=y(()=>{vl();Bf();qf();JW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(_l({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:fb(t)}),Xxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Xxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ob(e,i);let o=ls(t,e,r),s=new AbortController;try{return await Promise.race([Qxe(o,n,s),e0e(o,r,s),t0e(o,r,s)])}catch(a){throw bl(t),a}finally{s.abort(),sb(e,i)}},Qxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await fI(t,"message",{signal:r});return n}for await(let[n]of Yxe(t,"message",{signal:r}))if(e(n))return n},e0e=async(t,e,{signal:r})=>{await fI(t,"disconnect",{signal:r}),c9(e)},t0e=async(t,e,{signal:r})=>{let[n]=await fI(t,"strict:error",{signal:r});throw tb(n,e)}});import{once as QW,on as r0e}from"node:events";var e3,pI,n0e,i0e,o0e,XW,mI=y(()=>{vl();Bf();qf();e3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>pI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),pI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{_l({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:fb(t)}),ob(e,o);let s=ls(t,e,r),a=new AbortController,c={};return n0e(t,s,a),i0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),o0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},n0e=async(t,e,r)=>{try{await QW(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},i0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await QW(t,"strict:error",{signal:r.signal});n.error=tb(i,e),r.abort()}catch{}},o0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of r0e(r,"message",{signal:o.signal}))XW(s),yield c}catch{XW(s)}finally{o.abort(),sb(e,a),n||bl(t),i&&await t}},XW=({error:t})=>{if(t)throw t}});import t3 from"node:process";var r3,n3,i3,hI=y(()=>{yb();YW();mI();ub();r3=(t,{ipc:e})=>{Object.assign(t,i3(t,!1,e))},n3=()=>{let t=t3,e=!0,r=t3.channel!==void 0;return{...i3(t,e,r),getCancelSignal:j9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},i3=(t,e,r)=>({sendMessage:gb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:JW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:e3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as s0e}from"node:child_process";import{PassThrough as a0e,Readable as c0e,Writable as l0e,Duplex as u0e}from"node:stream";var o3,d0e,Xf,f0e,p0e,m0e,h0e,s3=y(()=>{Mb();Kf();Pb();o3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{QR(n);let a=new s0e;d0e(a,n),Object.assign(a,{readable:f0e,writable:p0e,duplex:m0e});let c=kl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=h0e(c,s,i);return{subprocess:a,promise:l}},d0e=(t,e)=>{let r=Xf(),n=Xf(),i=Xf(),o=Array.from({length:e.length-3},Xf),s=Xf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Xf=()=>{let t=new a0e;return t.end(),t},f0e=()=>new c0e({read(){}}),p0e=()=>new l0e({write(){}}),m0e=()=>new u0e({read(){},write(){}}),h0e=async(t,e,r)=>El(t,e,r)});import{createReadStream as a3,createWriteStream as c3}from"node:fs";import{Buffer as g0e}from"node:buffer";import{Readable as Qf,Writable as y0e,Duplex as _0e}from"node:stream";var u3,ep,l3,b0e,d3=y(()=>{Bb();Mb();vr();u3=(t,e)=>jb(b0e,t,e,!1),ep=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${us[t]}.`)},l3={fileNumber:ep,generator:aI,asyncGenerator:aI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:_0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},b0e={input:{...l3,fileUrl:({value:t})=>({stream:a3(t)}),filePath:({value:{file:t}})=>({stream:a3(t)}),webStream:({value:t})=>({stream:Qf.fromWeb(t)}),iterable:({value:t})=>({stream:Qf.from(t)}),asyncIterable:({value:t})=>({stream:Qf.from(t)}),string:({value:t})=>({stream:Qf.from(t)}),uint8Array:({value:t})=>({stream:Qf.from(g0e.from(t))})},output:{...l3,fileUrl:({value:t})=>({stream:c3(t)}),filePath:({value:{file:t,append:e}})=>({stream:c3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:y0e.fromWeb(t)}),iterable:ep,asyncIterable:ep,string:ep,uint8Array:ep}}});import{on as v0e,once as f3}from"node:events";import{PassThrough as S0e,getDefaultHighWaterMark as w0e}from"node:stream";import{finished as h3}from"node:stream/promises";function Ca(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)yI(i);let e=t.some(({readableObjectMode:i})=>i),r=x0e(t,e),n=new gI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var x0e,gI,$0e,k0e,E0e,yI,A0e,T0e,O0e,R0e,I0e,g3,y3,_I,_3,P0e,Zb,p3,m3,Vb=y(()=>{x0e=(t,e)=>{if(t.length===0)return w0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},gI=class extends S0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(yI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=$0e(this,this.#t,this.#o);let r=A0e({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(yI(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)}},$0e=async(t,e,r)=>{Zb(t,p3);let n=new AbortController;try{await Promise.race([k0e(t,n),E0e(t,e,r,n)])}finally{n.abort(),Zb(t,-p3)}},k0e=async(t,{signal:e})=>{try{await h3(t,{signal:e,cleanup:!0})}catch(r){throw g3(t,r),r}},E0e=async(t,e,r,{signal:n})=>{for await(let[i]of v0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},yI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},A0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Zb(t,m3);let a=new AbortController;try{await Promise.race([T0e(o,e,a),O0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),R0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Zb(t,-m3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?_I(t):I0e(t))},T0e=async(t,e,{signal:r})=>{try{await t,r.aborted||_I(e)}catch(n){r.aborted||g3(e,n)}},O0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await h3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;y3(s)?i.add(e):_3(t,s)}},R0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await f3(t,i,{signal:o}),!t.readable)return f3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},I0e=t=>{t.writable&&t.end()},g3=(t,e)=>{y3(e)?_I(t):_3(t,e)},y3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",_I=t=>{(t.readable||t.writable)&&t.destroy()},_3=(t,e)=>{t.destroyed||(t.once("error",P0e),t.destroy(e))},P0e=()=>{},Zb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},p3=2,m3=1});import{finished as b3}from"node:stream/promises";var Tl,C0e,bI,D0e,vI,Wb=y(()=>{ho();Tl=(t,e)=>{t.pipe(e),C0e(t,e),D0e(t,e)},C0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await b3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}bI(e)}},bI=t=>{t.writable&&t.end()},D0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await b3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}vI(t)}},vI=t=>{t.readable&&t.destroy()}});var v3,N0e,j0e,M0e,F0e,L0e,S3=y(()=>{Vb();ho();ib();vr();Wb();v3=(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})=>An.has(c)))N0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.has(c)))M0e({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]:Ca(o);Tl(s,i)}},N0e=(t,e,r,n)=>{r==="output"?Tl(t.stdio[n],e):Tl(e,t.stdio[n]);let i=j0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},j0e=["stdin","stdout","stderr"],M0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;F0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},F0e=(t,{signal:e})=>{Yn(t)&&Ea(t,L0e,e)},L0e=2});var Da,w3=y(()=>{Da=[];Da.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Da.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Da.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Kb,SI,wI,z0e,xI,Jb,U0e,$I,kI,EI,x3,tst,rst,$3=y(()=>{w3();Kb=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",SI=Symbol.for("signal-exit emitter"),wI=globalThis,z0e=Object.defineProperty.bind(Object),xI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(wI[SI])return wI[SI];z0e(wI,SI,{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}},Jb=class{},U0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),$I=class extends Jb{onExit(){return()=>{}}load(){}unload(){}},kI=class extends Jb{#t=EI.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 Da)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(!Kb(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 Da)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,Da.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 Kb(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"&&Kb(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)}},EI=globalThis.process,{onExit:x3,load:tst,unload:rst}=U0e(Kb(EI)?new kI(EI):new $I)});import{addAbortListener as q0e}from"node:events";var k3,E3=y(()=>{$3();k3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=x3(()=>{t.kill()});q0e(n,()=>{i()})}});var T3,B0e,H0e,A3,G0e,O3=y(()=>{JO();G_();cs();fl();T3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=H_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=B0e(r,n,i),{sourceStream:d,sourceError:f}=G0e(t,l),{options:p,fileDescriptors:m}=Ii.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},B0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=H0e(t,e,...r),a=nb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},H0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(A3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||WO(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]=C_(r,...n);return{destination:e(A3)(i,o,s),pipeOptions:s}}if(Ii.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}`)},A3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),G0e=(t,e)=>{try{return{sourceStream:wl(t,e)}}catch(r){return{sourceError:r}}}});var I3,Z0e,AI,R3,TI=y(()=>{Kf();Wb();I3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=Z0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw AI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},Z0e=({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 bI(r),e},AI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>kl({error:t,command:R3,escapedCommand:R3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),R3="source.pipe(destination)"});var P3,C3=y(()=>{P3=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 V0e}from"node:stream/promises";var D3,W0e,K0e,J0e,Yb,Y0e,X0e,N3=y(()=>{Vb();ib();Wb();D3=(t,e,r)=>{let n=Yb.has(e)?K0e(t,e):W0e(t,e);return Ea(t,Y0e,r.signal),Ea(e,X0e,r.signal),J0e(e),n},W0e=(t,e)=>{let r=Ca([t]);return Tl(r,e),Yb.set(e,r),r},K0e=(t,e)=>{let r=Yb.get(e);return r.add(t),r},J0e=async t=>{try{await V0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Yb.delete(t)},Yb=new WeakMap,Y0e=2,X0e=1});import{aborted as Q0e}from"node:util";var j3,e$e,M3=y(()=>{TI();j3=(t,e)=>t===void 0?[]:[e$e(t,e)],e$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Q0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw AI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var Xb,t$e,r$e,F3=y(()=>{po();O3();TI();C3();N3();M3();Xb=(t,...e)=>{if(At(e[0]))return Xb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=T3(t,...e),i=t$e({...n,destination:r});return i.pipe=Xb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},t$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=r$e(t,i);I3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=D3(e,o,d);return await Promise.race([P3(u),...j3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},r$e=(t,e)=>Promise.allSettled([t,e])});import{on as n$e}from"node:events";import{getDefaultHighWaterMark as i$e}from"node:stream";var Qb,o$e,OI,s$e,z3,RI,L3,a$e,c$e,ev=y(()=>{nI();Lb();sI();Qb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return o$e(e,s),z3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},o$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},OI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;s$e(e,s,t);let a=t.readableObjectMode&&!o;return z3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},s$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},z3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=n$e(t,"data",{signal:e.signal,highWaterMark:L3,highWatermark:L3});return a$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},RI=i$e(!0),L3=RI,a$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=c$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Pa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Yf(a)}},c$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[zb(t,r,!e),Fb(t,i,!n,{})].filter(Boolean)});import{setImmediate as l$e}from"node:timers/promises";var U3,u$e,d$e,f$e,II,q3,PI=y(()=>{Ob();rn();cI();ev();Ra();Jf();U3=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=u$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([d$e(t),d]);return}let f=eI(c,r),p=OI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([f$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},u$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Hb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=OI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await jW(a,t,r,o)},d$e=async t=>{await l$e(),t.readableFlowing===null&&t.resume()},f$e=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 Eb(r,{maxBuffer:o})):await Tb(r,{maxBuffer:o})}catch(a){return q3(vV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},II=async t=>{try{return await t}catch(e){return q3(e)}},q3=({bufferedData:t})=>fG(t)?new Uint8Array(t):t});import{finished as p$e}from"node:stream/promises";var tp,m$e,h$e,g$e,y$e,_$e,CI,tv,B3,rv=y(()=>{tp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=m$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],p$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||y$e(a,e,r,n)}finally{s.abort()}},m$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&h$e(t,r,n),n},h$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{g$e(e,r),n.call(t,...i)}},g$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},y$e=(t,e,r,n)=>{if(!_$e(t,e,r,n))throw t},_$e=(t,e,r,n=!0)=>r.propagating?B3(t)||tv(t):(r.propagating=!0,CI(r,e)===n?B3(t):tv(t)),CI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",tv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",B3=t=>t?.code==="EPIPE"});var H3,DI,NI=y(()=>{PI();rv();H3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>DI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),DI=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=tp(t,e,l);if(CI(l,e)){await u;return}let[d]=await Promise.all([U3({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 G3,Z3,b$e,v$e,jI=y(()=>{Vb();NI();G3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ca([t,e].filter(Boolean)):void 0,Z3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>DI({...b$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:v$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),b$e=({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}},v$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var V3,W3,K3=y(()=>{hl();ss();V3=t=>ml(t,"ipc"),W3=(t,e)=>{let r=B_(t);Oi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var J3,Y3,X3=y(()=>{Ra();K3();yo();mI();J3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=V3(o),a=go(e,"ipc"),c=go(r,"ipc");for await(let l of pI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(SV(t,i,c),i.push(l)),s&&W3(l,o);return i},Y3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as S$e}from"node:events";var Q3,w$e,x$e,$$e,eK=y(()=>{Oa();OR();vR();TR();ho();vr();PI();X3();IR();jI();NI();dI();rv();Q3=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 _=BW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=H3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=Z3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=J3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=w$e(h,t,S),D=x$e(m,S);try{return await Promise.race([Promise.all([{},GW(_),Promise.all(x),w,T,Z9(t,d),...A,...D]),g,$$e(t,b),...U9(t,o,f,b),...a9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...L9({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(q=>II(q))),II(w),Y3(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},w$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:tp(n,i,r)),x$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>tp(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),$$e=async(t,{signal:e})=>{let[r]=await S$e(t,"error",{signal:e});throw r}});var tK,rp,Ol,nv=y(()=>{Sl();tK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),rp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ri();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Ol=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 rK}from"node:stream/promises";var MI,nK,FI,LI,iv,ov,zI=y(()=>{rv();MI=async t=>{if(t!==void 0)try{await FI(t)}catch{}},nK=async t=>{if(t!==void 0)try{await LI(t)}catch{}},FI=async t=>{await rK(t,{cleanup:!0,readable:!1,writable:!0})},LI=async t=>{await rK(t,{cleanup:!0,readable:!0,writable:!1})},iv=async(t,e)=>{if(await t,e)throw e},ov=(t,e,r)=>{r&&!tv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as k$e}from"node:stream";import{callbackify as E$e}from"node:util";var iK,UI,qI,BI,A$e,HI,GI,oK,ZI=y(()=>{Aa();cs();ev();Sl();nv();zI();iK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=UI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=qI(a,s),{read:f,onStdoutDataDone:p}=BI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new k$e({read:f,destroy:E$e(GI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return HI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},UI=(t,e,r)=>{let n=wl(t,e),i=rp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},qI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:RI},BI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ri(),s=Qb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){A$e(this,s,o)},onStdoutDataDone:o}},A$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},HI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await LI(t),await n,await MI(i),await e,r.readable&&r.push(null)}catch(o){await MI(i),oK(r,o)}},GI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Ol(r,e)&&(oK(t,n),await iv(e,n))},oK=(t,e)=>{ov(t,t.readable,e)}});import{Writable as T$e}from"node:stream";import{callbackify as sK}from"node:util";var aK,VI,WI,O$e,R$e,KI,JI,cK,YI=y(()=>{cs();nv();zI();aK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=VI(t,r,e),s=new T$e({...WI(n,t,i),destroy:sK(JI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return KI(n,s),s},VI=(t,e,r)=>{let n=nb(t,e),i=rp(r,n,"writableFinal"),o=rp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},WI=(t,e,r)=>({write:O$e.bind(void 0,t),final:sK(R$e.bind(void 0,t,e,r))}),O$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},R$e=async(t,e,r)=>{await Ol(r,e)&&(t.writable&&t.end(),await e)},KI=async(t,e,r)=>{try{await FI(t),e.writable&&e.end()}catch(n){await nK(r),cK(e,n)}},JI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Ol(r,e),await Ol(n,e)&&(cK(t,i),await iv(e,i))},cK=(t,e)=>{ov(t,t.writable,e)}});import{Duplex as I$e}from"node:stream";import{callbackify as P$e}from"node:util";var lK,C$e,uK=y(()=>{Aa();ZI();YI();lK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=UI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=VI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=qI(c,a),{read:g,onStdoutDataDone:b}=BI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new I$e({read:g,...WI(u,t,d),destroy:P$e(C$e.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 HI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),KI(u,_,c),_},C$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([GI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),JI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var XI,D$e,dK=y(()=>{Aa();cs();ev();XI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=wl(t,r),a=Qb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return D$e(a,s,t)},D$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var fK,pK=y(()=>{nv();ZI();YI();uK();dK();fK=(t,{encoding:e})=>{let r=tK();t.readable=iK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=aK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=lK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=XI.bind(void 0,t,e),t[Symbol.asyncIterator]=XI.bind(void 0,t,e,{})}});var mK,N$e,j$e,hK=y(()=>{mK=(t,e)=>{for(let[r,n]of j$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},N$e=(async()=>{})().constructor.prototype,j$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(N$e,t)])});import{setMaxListeners as M$e}from"node:events";import{spawn as F$e}from"node:child_process";var gK,L$e,z$e,U$e,q$e,B$e,yK=y(()=>{Ob();sR();DR();cs();NR();hI();Kf();Pb();s3();d3();Jf();S3();Q_();E3();F3();jI();eK();pK();Sl();hK();gK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=L$e(t,e,r),{subprocess:f,promise:p}=U$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Xb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),mK(f,p),Ii.set(f,{options:u,fileDescriptors:d}),f},L$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Z_(t,e,r),{file:a,commandArguments:c,options:l}=bb(t,e,r),u=z$e(l),d=u3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},z$e=({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}},U$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=F$e(...vb(t,e,r))}catch(m){return o3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;M$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];v3(c,a,l),k3(c,r,l);let d={},f=Ri();c.kill=o9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=G3(c,r),fK(c,r),r3(c,r);let p=q$e({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}},q$e=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 Q3({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)=>bo(x,e,w)),_=bo(h,e,"all"),S=B$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return El(S,n,e)},B$e=({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?Wf({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 Pi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Ib({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var sv,H$e,G$e,_K=y(()=>{po();yo();sv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,H$e(n,t[n],i)]));return{...t,...r}},H$e=(t,e,r)=>G$e.has(t)&&At(e)&&At(r)?{...e,...r}:r,G$e=new Set(["env",...tR])});var ds,Z$e,V$e,bK=y(()=>{po();JO();vG();KW();yK();_K();ds=(t,e,r,n)=>{let i=(s,a,c)=>ds(s,a,r,c),o=(...s)=>Z$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Z$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(At(o))return i(t,sv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=V$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?WW(a,c,l):gK(a,c,l,i)},V$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=_G(e)?bG(e,r):[e,...r],[s,a,c]=C_(...o),l=sv(sv(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 vK,SK,wK,W$e,K$e,xK=y(()=>{vK=({file:t,commandArguments:e})=>wK(t,e),SK=({file:t,commandArguments:e})=>({...wK(t,e),isSync:!0}),wK=(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]=W$e(t);return{file:r,commandArguments:n}},W$e=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(K$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},K$e=/ +/g});var $K,kK,J$e,EK,Y$e,AK,TK=y(()=>{$K=(t,e,r)=>{t.sync=e(J$e,r),t.s=t.sync},kK=({options:t})=>EK(t),J$e=({options:t})=>({...EK(t),isSync:!0}),EK=t=>({options:{...Y$e(t),...t}}),Y$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},AK={preferLocal:!0}});var Gct,Je,Zct,Vct,Wct,Kct,Jct,Yct,Xct,Qct,Mr=y(()=>{bK();xK();RR();TK();hI();Gct=ds(()=>({})),Je=ds(()=>({isSync:!0})),Zct=ds(vK),Vct=ds(SK),Wct=ds(B9),Kct=ds(kK,{},AK,$K),{sendMessage:Jct,getOneMessage:Yct,getEachMessage:Xct,getCancelSignal:Qct}=n3()});import{existsSync as av,statSync as X$e}from"node:fs";import{dirname as QI,extname as Q$e,isAbsolute as OK,join as eP,relative as tP,resolve as cv,sep as eke}from"node:path";function lv(t){return t==="./gradlew"||t==="gradle"}function tke(t){return(av(eP(t,"build.gradle.kts"))||av(eP(t,"build.gradle")))&&av(eP(t,"gradle.properties"))}function rke(t,e){let n=tP(t,e).split(eke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function fs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function nke(t,e){let r=cv(t,e),n=r;av(r)?X$e(r).isFile()&&(n=QI(r)):Q$e(r)!==""&&(n=QI(r));let i=tP(t,n);if(i.startsWith("..")||OK(i))return null;let o=n;for(;;){if(tke(o))return o;if(cv(o)===cv(t))return null;let s=QI(o);if(s===o)return null;let a=tP(t,s);if(a.startsWith("..")||OK(a))return null;o=s}}function uv(t,e){let r=cv(t),n=new Map,i=[];for(let o of e){let s=nke(r,o);if(!s){i.push(o);continue}let a=rke(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 ike,readFileSync as oke}from"node:fs";import{join as ske}from"node:path";function Rl(t="."){let e=ske(t,".cladding","config.yaml");if(!ike(e))return rP;try{let n=(0,RK.parse)(oke(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 ake){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 IK(t,e){let r=[],n=!1;for(let i of t){let o=cke.exec(i);if(o){n=!0;for(let s of e)r.push(fs(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 RK,ake,rP,cke,fv=y(()=>{"use strict";RK=bt(Qt(),1);dv();ake=["type","lint","test","coverage"],rP={scope:"feature"};cke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as iP,readFileSync as PK,readdirSync as lke,statSync as uke}from"node:fs";import{join as pv}from"node:path";function aP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=pv(t,e);if(iP(r))try{if(CK.test(PK(r,"utf8")))return!0}catch{}}return!1}function DK(t){try{return iP(t)&&CK.test(PK(t,"utf8"))}catch{return!1}}function NK(t,e=0){if(e>4||!iP(t))return!1;let r;try{r=lke(t)}catch{return!1}for(let n of r){let i=pv(t,n),o=!1;try{o=uke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(NK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&DK(i))return!0}return!1}function pke(t){if(aP(t))return!0;for(let e of dke)if(DK(pv(t,e)))return!0;for(let e of fke)if(NK(pv(t,e)))return!0;return!1}function jK(t="."){let e=Rl(t).coverage;return e||(pke(t)?"kover":"jacoco")}function MK(t="."){return oP[jK(t)]}function FK(t="."){return nP[jK(t)]}var oP,nP,sP,CK,dke,fke,mv=y(()=>{"use strict";fv();oP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},nP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},sP=[nP.kover,nP.jacoco],CK=/kover/i;dke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],fke=["buildSrc","build-logic"]});import{existsSync as hv,readFileSync as LK,readdirSync as zK}from"node:fs";import{join as Na}from"node:path";function cP(t){return hv(Na(t,"gradlew"))?"./gradlew":"gradle"}function mke(t){let e=cP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[MK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function hke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(LK(Na(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 yke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function vke(t,e){for(let r of e)if(hv(Na(t,r)))return r}function Ske(t,e){try{return zK(t).find(n=>n.endsWith(e))}catch{return}}function xke(t,e){for(let r of wke)if(r.configs.some(n=>hv(Na(t,n))))return r.gate;return e}function kke(t){if($ke.some(e=>hv(Na(t,e))))return!0;try{return JSON.parse(LK(Na(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function Eke(t,e){let r=e.lint?{...e,lint:xke(t,e.lint)}:{...e};return e.test&&e.coverage&&kke(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function ut(t="."){for(let e of _ke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Ske(t,o):r=vke(t,[o]),r)break;if(!r||e.requiresSource&&!yke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Eke(t,n):n;return{language:e.language,manifest:r,gates:i}}return bke}var gke,_ke,bke,wke,$ke,on=y(()=>{"use strict";mv();gke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);_ke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:mke},{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:hke}],bke={language:"unknown",manifest:"",gates:{}};wke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];$ke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Ake,readFileSync as Tke}from"node:fs";import{join as Oke}from"node:path";function ja(t){return t.code==="ENOENT"}function gv(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=(o||s||`exit ${i}`).slice(0,200);return UK.test(o)||UK.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Ut(t,e,r){return ja(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Il(t,e){let r=Oke(t,"package.json");if(!Ake(r))return!1;try{return!!JSON.parse(Tke(r,"utf8")).scripts?.[e]}catch{return!1}}var UK,Tn=y(()=>{"use strict";UK=/config (is |file )?not found|no such file|ENOENT|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 Rke(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.arch;if(!n)return[{detector:yv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return ja(i)?[{detector:yv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:gv(i,yv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var yv,Ma,_v=y(()=>{"use strict";Mr();on();Tn();yv="ARCHITECTURE_VIOLATION";Ma={name:yv,subprocess:!0,run:Rke}});function Ike(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.secret;if(!n)return[{detector:bv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return ja(i)?[{detector:bv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:gv(i,bv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var bv,Fa,vv=y(()=>{"use strict";Mr();on();Tn();bv="HARDCODED_SECRET";Fa={name:bv,subprocess:!0,run:Ike}});import{existsSync as lP,readdirSync as qK}from"node:fs";import{join as Sv}from"node:path";function Cke(t,e){let r=Sv(t,e.path);if(!lP(r))return!0;if(e.isDirectory)try{return qK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Dke(t){let{cwd:e="."}=t,r=[];for(let i of Pke)Cke(e,i)&&r.push({detector:np,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=Sv(e,"spec.yaml");if(lP(n)){let i=Mke(n),o=i?null:Nke(e);if(i)r.push({detector:np,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:np,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=jke(e);s&&r.push({detector:np,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 Nke(t){for(let e of["spec/features","spec/scenarios"]){let r=Sv(t,e);if(!lP(r))continue;let n;try{n=qK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ei(Sv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function jke(t){try{return G(t),null}catch(e){return e.message}}function Mke(t){let e;try{e=Ei(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var np,Pke,BK,HK=y(()=>{"use strict";qe();x_();np="ABSENCE_OF_GOVERNANCE",Pke=[{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}];BK={name:np,run:Dke}});function wv(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=wv(r)==="while",o=Lke.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 '${wv(r)}'`}let n=Fke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:wv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${wv(r)}'`:null}function zke(t,e){let r=uP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function GK(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...zke(r,n));return e}var Fke,Lke,dP=y(()=>{"use strict";Fke={event:"when",state:"while",optional:"where",unwanted:"if"},Lke=/\bwhen\b/i});function he(t,e,r){let n;try{n=G(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var vt=y(()=>{"use strict";qe()});function Uke(t){let{cwd:e="."}=t;return he(e,xv,qke)}function qke(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:xv,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 GK(t.features))e.push({detector:xv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var xv,ZK,VK=y(()=>{"use strict";dP();vt();xv="AC_DRIFT";ZK={name:xv,run:Uke}});function Di(t=".",e){let n=(e??"").trim().toLowerCase()||ut(t).language;return KK[n]??WK}var Bke,Hke,Gke,WK,Zke,Vke,KK,Wke,JK,La=y(()=>{"use strict";on();Bke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,Hke=/^[ \t]*import\s+([\w.]+)/gm,Gke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,WK={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:Bke,importStyle:"relative"},Zke={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:Hke,importStyle:"dotted"},Vke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:Gke,importStyle:"dotted"},KK={typescript:WK,kotlin:Zke,python:Vke},Wke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],JK=new Set([...Object.values(KK).flatMap(t=>t?.extensions??[]),...Wke].map(t=>t.toLowerCase()))});import{existsSync as Kke,readFileSync as Jke,readdirSync as Yke,statSync as Xke}from"node:fs";import{join as XK,relative as YK}from"node:path";function Qke(t,e){if(!Kke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=Yke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=XK(i,s),c;try{c=Xke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function eEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function rEe(t){return tEe.test(t)}function nEe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Di(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Qke(XK(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=Jke(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";qe();La();QK="AI_HINTS_FORBIDDEN_PATTERN";tEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;eJ={name:QK,run:nEe}});function iEe(t){let{cwd:e="."}=t,r;try{r=G(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:rJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var rJ,nJ,iJ=y(()=>{"use strict";qe();rJ="AC_DUPLICATE_WITHIN_FEATURE";nJ={name:rJ,run:iEe}});import{createRequire as oEe}from"module";import{basename as sEe,dirname as pP,normalize as aEe,relative as cEe,resolve as lEe,sep as aJ}from"path";import*as uEe from"fs";function dEe(t){let e=aEe(t);return e.length>1&&e[e.length-1]===aJ&&(e=e.substring(0,e.length-1)),e}function cJ(t,e){return t.replace(fEe,e)}function mEe(t){return t==="/"||pEe.test(t)}function fP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=lEe(t)),(n||o)&&(t=dEe(t)),t===".")return"";let s=t[t.length-1]!==i;return cJ(s?t+i:t,i)}function lJ(t,e){return e+t}function hEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:cJ(cEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function gEe(t){return t}function yEe(t,e,r){return e+t+r}function _Ee(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?hEe(t,e):n?lJ:gEe}function bEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function vEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function $Ee(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?vEe(t):bEe(t):n&&n.length?wEe:SEe:xEe}function REe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?OEe:r&&r.length?n?kEe:EEe:n?AEe:TEe}function CEe(t){return t.group?PEe:IEe}function jEe(t){return t.group?DEe:NEe}function LEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?FEe:MEe}function uJ(t,e,r){if(r.options.useRealPaths)return zEe(e,r);let n=pP(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=pP(n)}return r.symlinks.set(t,e),i>1}function zEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function $v(t,e,r,n){e(t&&!n?t:null,r)}function KEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?UEe:GEe:n?e?qEe:WEe:i?e?HEe:VEe:e?BEe:ZEe}function XEe(t){return t?YEe:JEe}function rAe(t,e){return new Promise((r,n)=>{pJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function pJ(t,e,r){new fJ(t,e,r).start()}function nAe(t,e){return new fJ(t,e).start()}var oJ,fEe,pEe,SEe,wEe,xEe,kEe,EEe,AEe,TEe,OEe,IEe,PEe,DEe,NEe,MEe,FEe,UEe,qEe,BEe,HEe,GEe,ZEe,VEe,WEe,dJ,JEe,YEe,QEe,eAe,tAe,fJ,sJ,mJ,hJ,gJ=y(()=>{oJ=oEe(import.meta.url);fEe=/[\\/]/g;pEe=/^[a-z]:[\\/]$/i;SEe=(t,e)=>{e.push(t||".")},wEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},xEe=()=>{};kEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},EEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},AEe=(t,e,r,n)=>{r.files++},TEe=(t,e)=>{e.push(t)},OEe=()=>{};IEe=t=>t,PEe=()=>[""].slice(0,0);DEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},NEe=()=>{};MEe=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()&&uJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},FEe=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()&&uJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};UEe=t=>t.counts,qEe=t=>t.groups,BEe=t=>t.paths,HEe=t=>t.paths.slice(0,t.options.maxFiles),GEe=(t,e,r)=>($v(e,r,t.counts,t.options.suppressErrors),null),ZEe=(t,e,r)=>($v(e,r,t.paths,t.options.suppressErrors),null),VEe=(t,e,r)=>($v(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),WEe=(t,e,r)=>($v(e,r,t.groups,t.options.suppressErrors),null);dJ={withFileTypes:!0},JEe=(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||".",dJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},YEe=(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||".",dJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};QEe=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))}},eAe=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}},tAe=class{aborted=!1;abort(){this.aborted=!0}},fJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=KEe(e,this.isSynchronous),this.root=fP(t,e),this.state={root:mEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new eAe,options:e,queue:new QEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new tAe,fs:e.fs||uEe},this.joinPath=_Ee(this.root,e),this.pushDirectory=$Ee(this.root,e),this.pushFile=REe(e),this.getArray=CEe(e),this.groupFiles=jEe(e),this.resolveSymlink=LEe(e,this.isSynchronous),this.walkDirectory=XEe(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(_=fP(_,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=sEe(_),x=fP(pP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};sJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return rAe(this.root,this.options)}withCallback(t){pJ(this.root,this.options,t)}sync(){return nAe(this.root,this.options)}},mJ=null;try{oJ.resolve("picomatch"),mJ=oJ("picomatch")}catch{}hJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:aJ,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 sJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new sJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||mJ;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 ip=v((rut,SJ)=>{"use strict";var yJ="[^\\\\/]",iAe="(?=.)",_J="[^/]",mP="(?:\\/|$)",bJ="(?:^|\\/)",hP=`\\.{1,2}${mP}`,oAe="(?!\\.)",sAe=`(?!${bJ}${hP})`,aAe=`(?!\\.{0,1}${mP})`,cAe=`(?!${hP})`,lAe="[^.\\/]",uAe=`${_J}*?`,dAe="/",vJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:iAe,QMARK:_J,END_ANCHOR:mP,DOTS_SLASH:hP,NO_DOT:oAe,NO_DOTS:sAe,NO_DOT_SLASH:aAe,NO_DOTS_SLASH:cAe,QMARK_NO_DOT:lAe,STAR:uAe,START_ANCHOR:bJ,SEP:dAe},fAe={...vJ,SLASH_LITERAL:"[\\\\/]",QMARK:yJ,STAR:`${yJ}*?`,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:"\\"},pAe={__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"};SJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:pAe,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?fAe:vJ}}});var op=v(Fr=>{"use strict";var{REGEX_BACKSLASH:mAe,REGEX_REMOVE_BACKSLASH:hAe,REGEX_SPECIAL_CHARS:gAe,REGEX_SPECIAL_CHARS_GLOBAL:yAe}=ip();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>gAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(yAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(mAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(hAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var OJ=v((iut,TJ)=>{"use strict";var wJ=op(),{CHAR_ASTERISK:gP,CHAR_AT:_Ae,CHAR_BACKWARD_SLASH:sp,CHAR_COMMA:bAe,CHAR_DOT:yP,CHAR_EXCLAMATION_MARK:_P,CHAR_FORWARD_SLASH:AJ,CHAR_LEFT_CURLY_BRACE:bP,CHAR_LEFT_PARENTHESES:vP,CHAR_LEFT_SQUARE_BRACKET:vAe,CHAR_PLUS:SAe,CHAR_QUESTION_MARK:xJ,CHAR_RIGHT_CURLY_BRACE:wAe,CHAR_RIGHT_PARENTHESES:$J,CHAR_RIGHT_SQUARE_BRACKET:xAe}=ip(),kJ=t=>t===AJ||t===sp,EJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},$Ae=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},E=()=>l>=n,q=()=>c.charCodeAt(l+1),Q=()=>(T=A,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),Se&&m===!0&&d>0?(Se=c.slice(0,d),C=c.slice(d)):m===!0?(Se="",C=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&kJ(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),r.unescape===!0&&(C&&(C=wJ.removeBackslashes(C)),Se&&_===!0&&(Se=wJ.removeBackslashes(Se)));let Ir={prefix:P,input:t,start:u,base:Se,glob:C,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,kJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var ap=ip(),sn=op(),{MAX_LENGTH:kv,POSIX_REGEX_SOURCE:kAe,REGEX_NON_SPECIAL_CHARS:EAe,REGEX_SPECIAL_CHARS_BACKREF:AAe,REPLACEMENTS:RJ}=ap,TAe=(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=>sn.escapeRegex(i)).join("..")}return r},Pl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,IJ=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},OAe=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},PJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(OAe(e))return e.replace(/\\(.)/g,"$1")},RAe=t=>{let e=t.map(PJ).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}}}}},IAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=PJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},PAe=t=>{let e=0,r=t.trim(),n=SP(r);for(;n;)e++,r=n.body.trim(),n=SP(r);return e},CAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:ap.DEFAULT_MAX_EXTGLOB_RECURSION,n=IJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||RAe(n)))return{risky:!0};for(let i of n){let o=IAe(i);if(o)return{risky:!0,safeOutput:o};if(PAe(i)>r)return{risky:!0}}return{risky:!1}},wP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=RJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(kv,r.maxLength):kv,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,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(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=sn.removePrefix(t,E),i=t.length;let q=[],Q=[],Se=[],P=o,C,Ir=()=>E.index===i-1,se=E.peek=(H=1)=>t[E.index+H],Pe=E.advance=()=>t[++E.index]||"",Kt=()=>t.slice(E.index+1),dr=(H="",pt=0)=>{E.consumed+=H,E.index+=pt},Yt=H=>{E.output+=H.output!=null?H.output:H.value,dr(H.value)},oo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),E.start++,H++;return H%2===0?!1:(E.negated=!0,E.start++,!0)},Si=H=>{E[H]++,Se.push(H)},Yr=H=>{E[H]--,Se.pop()},de=H=>{if(P.type==="globstar"){let pt=E.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||q.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!pt&&!B&&(E.output=E.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=D,E.output+=P.output)}if(q.length&&H.type!=="paren"&&(q[q.length-1].inner+=H.value),(H.value||H.output)&&Yt(H),P&&P.type==="text"&&H.type==="text"){P.output=(P.output||P.value)+H.value,P.value+=H.value;return}H.prev=P,s.push(H),P=H},so=(H,pt)=>{let B={...l[pt],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;Si("parens"),de({type:H,value:pt,output:E.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Te}),q.push(B)},fde=H=>{let pt=t.slice(H.startIndex,E.index+1),B=t.slice(H.startIndex+2,E.index),Te=CAe(B,r);if((H.type==="plus"||H.type==="star")&&Te.risky){let ct=Te.safeOutput?(H.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,wi=s[H.tokensIndex];wi.type="text",wi.value=pt,wi.output=ct||sn.escapeRegex(pt);for(let xi=H.tokensIndex+1;xi1&&H.inner.includes("/")&&(ct=O(r)),(ct!==D||Ir()||/^\)+$/.test(Kt()))&&(lt=H.close=`)$))${ct}`),H.inner.includes("*")&&(Ft=Kt())&&/^\.[^\\/.]+$/.test(Ft)){let wi=wP(Ft,{...e,fastpaths:!1}).output;lt=H.close=`)${wi})${ct})`}H.prev.type==="bos"&&(E.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:C,output:lt}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,pt=t.replace(AAe,(B,Te,lt,Ft,ct,wi)=>Ft==="\\"?(H=!0,B):Ft==="?"?Te?Te+Ft+(ct?_.repeat(ct.length):""):wi===0?A+(ct?_.repeat(ct.length):""):_.repeat(lt.length):Ft==="."?u.repeat(lt.length):Ft==="*"?Te?Te+Ft+(ct?D:""):D:Te?B:`\\${B}`);return H===!0&&(r.unescape===!0?pt=pt.replace(/\\/g,""):pt=pt.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),pt===t&&r.contains===!0?(E.output=t,E):(E.output=sn.wrapOutput(pt,E,e),E)}for(;!Ir();){if(C=Pe(),C==="\0")continue;if(C==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){C+="\\",de({type:"text",value:C});continue}let Te=/^\\+/.exec(Kt()),lt=0;if(Te&&Te[0].length>2&&(lt=Te[0].length,E.index+=lt,lt%2!==0&&(C+="\\")),r.unescape===!0?C=Pe():C+=Pe(),E.brackets===0){de({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("["),lt=P.value.slice(0,Te),Ft=P.value.slice(Te+2),ct=kAe[Ft];if(ct){P.value=lt+ct,E.backtrack=!0,Pe(),!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,Yt({value:C});continue}if(E.quotes===1&&C!=='"'){C=sn.escapeRegex(C),P.value+=C,Yt({value:C});continue}if(C==='"'){E.quotes=E.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:C});continue}if(C==="("){Si("parens"),de({type:"paren",value:C});continue}if(C===")"){if(E.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Pl("opening","("));let B=q[q.length-1];if(B&&E.parens===B.parens+1){fde(q.pop());continue}de({type:"paren",value:C,output:E.parens?")":"\\)"}),Yr("parens");continue}if(C==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Pl("closing","]"));C=`\\${C}`}else Si("brackets");de({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){de({type:"text",value:C,output:`\\${C}`});continue}if(E.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Pl("opening","["));de({type:"text",value:C,output:`\\${C}`});continue}Yr("brackets");let B=P.value.slice(1);if(P.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(C=`/${C}`),P.value+=C,Yt({value:C}),r.literalBrackets===!1||sn.hasRegexChars(B))continue;let Te=sn.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){Si("braces");let B={type:"brace",value:C,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};Q.push(B),de(B);continue}if(C==="}"){let B=Q[Q.length-1];if(r.nobrace===!0||!B){de({type:"text",value:C,output:C});continue}let Te=")";if(B.dots===!0){let lt=s.slice(),Ft=[];for(let ct=lt.length-1;ct>=0&&(s.pop(),lt[ct].type!=="brace");ct--)lt[ct].type!=="dots"&&Ft.unshift(lt[ct].value);Te=TAe(Ft,r),E.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let lt=E.output.slice(0,B.outputIndex),Ft=E.tokens.slice(B.tokensIndex);B.value=B.output="\\{",C=Te="\\}",E.output=lt;for(let ct of Ft)E.output+=ct.output||ct.value}de({type:"brace",value:C,output:Te}),Yr("braces"),Q.pop();continue}if(C==="|"){q.length>0&&q[q.length-1].conditions++,de({type:"text",value:C});continue}if(C===","){let B=C,Te=Q[Q.length-1];Te&&Se[Se.length-1]==="braces"&&(Te.comma=!0,B="|"),de({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}de({type:"slash",value:C,output:f});continue}if(C==="."){if(E.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let B=Q[Q.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"){de({type:"text",value:C,output:u});continue}de({type:"dot",value:C,output:u});continue}if(C==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){so("qmark",C);continue}if(P&&P.type==="paren"){let Te=se(),lt=C;(P.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(lt=`\\${C}`),de({type:"text",value:C,output:lt});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){de({type:"qmark",value:C,output:S});continue}de({type:"qmark",value:C,output:_});continue}if(C==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){so("negate",C);continue}if(r.nonegate!==!0&&E.index===0){oo();continue}}if(C==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){so("plus",C);continue}if(P&&P.value==="("||r.regex===!1){de({type:"plus",value:C,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||E.parens>0){de({type:"plus",value:C});continue}de({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:C,output:""});continue}de({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let B=EAe.exec(Kt());B&&(C+=B[0],E.index+=B[0].length),de({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,dr(C);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){so("star",C);continue}if(P.type==="star"){if(r.noglobstar===!0){dr(C);continue}let B=P.prev,Te=B.prev,lt=B.type==="slash"||B.type==="bos",Ft=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!lt||H[0]&&H[0]!=="/")){de({type:"star",value:C,output:""});continue}let ct=E.braces>0&&(B.type==="comma"||B.type==="brace"),wi=q.length&&(B.type==="pipe"||B.type==="paren");if(!lt&&B.type!=="paren"&&!ct&&!wi){de({type:"star",value:C,output:""});continue}for(;H.slice(0,3)==="/**";){let xi=t[E.index+4];if(xi&&xi!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Ir()){P.type="globstar",P.value+=C,P.output=O(r),E.output=P.output,E.globstar=!0,dr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!Ft&&Ir()){E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=O(r)+(r.strictSlashes?")":"|$)"),P.value+=C,E.globstar=!0,E.output+=B.output+P.output,dr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let xi=H[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=`${O(r)}${f}|${f}${xi})`,P.value+=C,E.output+=B.output+P.output,E.globstar=!0,dr(C+Pe()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){P.type="globstar",P.value+=C,P.output=`(?:^|${f}|${O(r)}${f})`,E.output=P.output,E.globstar=!0,dr(C+Pe()),de({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-P.output.length),P.type="globstar",P.output=O(r),P.value+=C,E.output+=P.output,E.globstar=!0,dr(C);continue}let pt={type:"star",value:C,output:D};if(r.bash===!0){pt.output=".*?",(P.type==="bos"||P.type==="slash")&&(pt.output=T+pt.output),de(pt);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){pt.output=C,de(pt);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+=T,P.output+=T),se()!=="*"&&(E.output+=p,P.output+=p)),de(pt)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Pl("closing","]"));E.output=sn.escapeLast(E.output,"["),Yr("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Pl("closing",")"));E.output=sn.escapeLast(E.output,"("),Yr("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Pl("closing","}"));E.output=sn.escapeLast(E.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),E.backtrack===!0){E.output="";for(let H of E.tokens)E.output+=H.output!=null?H.output:H.value,H.suffix&&(E.output+=H.suffix)}return E};wP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(kv,r.maxLength):kv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=RJ[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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};CJ.exports=wP});var MJ=v((sut,jJ)=>{"use strict";var DAe=OJ(),xP=DJ(),NJ=op(),NAe=ip(),jAe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=jAe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?NJ.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(NJ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):xP(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>DAe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=xP.fastpaths(t,e)),i.output||(i=xP(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=NAe;jJ.exports=Tt});var UJ=v((aut,zJ)=>{"use strict";var FJ=MJ(),MAe=op();function LJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:MAe.isWindows()}),FJ(t,e,r)}Object.assign(LJ,FJ);zJ.exports=LJ});import{readdir as FAe,readdirSync as LAe,realpath as zAe,realpathSync as UAe,stat as qAe,statSync as BAe}from"fs";import{isAbsolute as HAe,posix as za,resolve as GAe}from"path";import{fileURLToPath as ZAe}from"url";function KAe(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]===".."&&WAe.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=>za.relative(t,n)||".":n=>za.relative(t,`${e}/${n}`)||"."}function XAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=za.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function GJ(t){var e;let r=Cl.default.scan(t,QAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function oTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Cl.default.scan(t);return r.isGlob||r.negated}function cp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function ZJ(t){return typeof t=="string"?[t]:t??[]}function $P(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=iTe(o);s=HAe(s.replace(aTe,""))?za.relative(a,s):za.normalize(s);let c=(i=sTe.exec(s))===null||i===void 0?void 0:i[0],l=GJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?za.join(o,...d):o}return s}function cTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push($P(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push($P(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push($P(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function lTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=cTe(t,e,n);t.debug&&cp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(BJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Cl.default)(i.match,f),m=(0,Cl.default)(i.ignore,f),h=KAe(i.match,f),g=qJ(r,d,o),b=o?g:qJ(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new hJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&cp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return cp(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&cp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&XAe(r,d)]}function uTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function fTe(t){let e={...dTe,...t};return e.cwd=(e.cwd instanceof URL?ZAe(e.cwd):GAe(e.cwd)).replace(BJ,"/"),e.ignore=ZJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||FAe,readdirSync:e.fs.readdirSync||LAe,realpath:e.fs.realpath||zAe,realpathSync:e.fs.realpathSync||UAe,stat:e.fs.stat||qAe,statSync:e.fs.statSync||BAe}),e.debug&&cp("globbing with options:",e),e}function pTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=VAe(t)||typeof t=="string",i=ZJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=fTe(n?e:t);return i.length>0?lTe(o,i):[]}function ps(t,e){let[r,n]=pTe(t,e);return r?uTe(r.sync(),n):[]}var Cl,VAe,BJ,HJ,WAe,JAe,YAe,QAe,eTe,tTe,rTe,nTe,iTe,sTe,aTe,dTe,lp=y(()=>{gJ();Cl=bt(UJ(),1),VAe=Array.isArray,BJ=/\\/g,HJ=process.platform==="win32",WAe=/^(\/?\.\.)+$/;JAe=/^[A-Z]:\/$/i,YAe=HJ?t=>JAe.test(t):t=>t==="/";QAe={parts:!0};eTe=/(?t.replace(eTe,"\\$&"),nTe=t=>t.replace(tTe,"\\$&"),iTe=HJ?nTe:rTe;sTe=/^(\/?\.\.)+/,aTe=/\\(?=[()[\]{}!*+?@|])/g;dTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as up,readFileSync as mTe,readdirSync as hTe,statSync as VJ}from"node:fs";import{join as Ua}from"node:path";function gTe(t){let{cwd:e="."}=t,r,n;try{let c=G(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Di(e,n),o=[],{layers:s,forbiddenImports:a}=kP(r);return(s.size>0||a.length>0)&&!up(Ua(e,i.mainRoot))?[{detector:dp,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&&(yTe(e,i,s,o),_Te(e,i,s,o)),a.length>0&&bTe(e,i,a,o),o)}function kP(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 yTe(t,e,r,n){let i=e.mainRoot,o=Ua(t,i);if(up(o))for(let s of hTe(o)){let a=Ua(o,s);VJ(a).isDirectory()&&(r.has(s)||n.push({detector:dp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function _Te(t,e,r,n){let i=e.mainRoot,o=Ua(t,i);if(up(o))for(let s of r){let a=Ua(o,s);up(a)&&VJ(a).isDirectory()||n.push({detector:dp,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 bTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ua(t,i,s.from);if(!up(a))continue;let c=ps([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ua(a,l),d;try{d=mTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];vTe(p,s.to,e.importStyle)&&n.push({detector:dp,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 vTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var dp,WJ,EP=y(()=>{"use strict";lp();qe();La();dp="ARCHITECTURE_FROM_SPEC";WJ={name:dp,run:gTe}});import{existsSync as STe,readFileSync as wTe}from"node:fs";import{join as xTe}from"node:path";function $Te(t){let{cwd:e="."}=t,r=xTe(e,"spec/capabilities.yaml");if(!STe(r))return[];let n;try{let c=wTe(r,"utf8"),l=KJ.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=G(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:Ev,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:Ev,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:Ev,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var KJ,Ev,JJ,YJ=y(()=>{"use strict";KJ=bt(Qt(),1);qe();Ev="CAPABILITIES_FEATURE_MAPPING";JJ={name:Ev,run:$Te}});import{existsSync as kTe,readFileSync as ETe}from"node:fs";import{join as ATe}from"node:path";function TTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function OTe(t){let{cwd:e="."}=t;return he(e,AP,r=>RTe(r,e))}function RTe(t,e){let r=Di(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=ATe(e,o);if(!kTe(s))continue;let a=ETe(s,"utf8");TTe(a)||n.push({detector:AP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var AP,XJ,QJ=y(()=>{"use strict";La();vt();AP="CONVENTION_DRIFT";XJ={name:AP,run:OTe}});import{existsSync as TP,readFileSync as e8}from"node:fs";import{join as Av}from"node:path";function ITe(t){return JSON.parse(t).total?.lines?.pct??0}function t8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function DTe(t,e){if(!lv(ut(t).gates.coverage?.cmd))return null;let r;try{r=uv(t,e)}catch(c){return[{detector:vo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=sP.find(d=>TP(Av(c.dir,d)));if(!l){s.push(c.path);continue}let u=t8(e8(Av(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:vo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=r8(n,i);return a0?[{detector:vo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function NTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=DTe(e,t.focusModules);if(a)return a}let r;try{r=G(e).project?.language}catch{}let n=Di(e,r),i=ut(e).language==="kotlin"?sP.find(a=>TP(Av(e,a)))??FK(e):n.coverageSummary,o=Av(e,i);if(!TP(o))return[{detector:vo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=e8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?PTe(a):n.coverageFormat==="cobertura-xml"?CTe(a):ITe(a)}catch(a){return[{detector:vo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:vo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Tv?[]:[{detector:vo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Tv}%`}]}var vo,Tv,n8,i8=y(()=>{"use strict";qe();mv();La();dv();on();vo="COVERAGE_DROP",Tv=70;n8={name:vo,run:NTe}});import{existsSync as jTe}from"node:fs";import{join as MTe}from"node:path";function FTe(t){let{cwd:e="."}=t;return he(e,Ov,r=>LTe(r,e))}function LTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?jTe(MTe(e,r.path))?[]:[{detector:Ov,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:Ov,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var Ov,o8,s8=y(()=>{"use strict";vt();Ov="DELIVERABLE_INTEGRITY";o8={name:Ov,run:FTe}});function zTe(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:Rv,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 UTe(t){let e=zTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Rv,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 qTe(t){let{cwd:e="."}=t;return he(e,Rv,r=>UTe(r))}var Rv,a8,c8=y(()=>{"use strict";vt();Rv="SMOKE_PROBE_DEMAND";a8={name:Rv,run:qTe}});function BTe(t){let{cwd:e="."}=t;return he(e,Iv,r=>HTe(r,e))}function HTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=is(e);if(n===null)return[{detector:Iv,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=O_(n,e,o);s.state!=="fresh"&&i.push({detector:Iv,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 Iv,Pv,OP=y(()=>{"use strict";ll();vt();Iv="STALE_ATTESTATION";Pv={name:Iv,run:BTe}});function GTe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}return ZTe(r)}function ZTe(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:l8,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 l8,Cv,RP=y(()=>{"use strict";qe();l8="DEPENDENCY_CYCLE";Cv={name:l8,run:GTe}});import{appendFileSync as VTe,existsSync as u8,mkdirSync as WTe,readFileSync as KTe}from"node:fs";import{dirname as JTe,join as YTe}from"node:path";function d8(t){return YTe(t,XTe,QTe)}function f8(t){return IP.add(t),()=>IP.delete(t)}function qa(t,e){let r=d8(t),n=JTe(r);u8(n)||WTe(n,{recursive:!0}),VTe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of IP)try{i(t,e)}catch{}}function On(t){let e=d8(t);if(!u8(e))return[];let r=KTe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var XTe,QTe,IP,ti=y(()=>{"use strict";XTe=".cladding",QTe="audit.log.jsonl";IP=new Set});import{existsSync as eOe}from"node:fs";import{join as tOe}from"node:path";function rOe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:PP,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&&(eOe(tOe(e,i.artifact))||n.push({detector:PP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var PP,p8,m8=y(()=>{"use strict";ti();PP="EVIDENCE_MISMATCH";p8={name:PP,run:rOe}});import{existsSync as nOe,readFileSync as iOe}from"node:fs";import{join as oOe}from"node:path";function sOe(t){let e=oOe(t,_8);if(!nOe(e))return null;try{let n=((0,y8.parse)(iOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*g8(t,e){for(let r of t??[])r.startsWith(h8)&&(yield{ref:r,name:r.slice(h8.length),field:e})}function aOe(t){let{cwd:e="."}=t,r=sOe(e);if(r===null)return[];let n;try{n=G(e)}catch(o){return[{detector:CP,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=[...g8(s.evidence_refs,"evidence_refs"),...g8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:CP,severity:"warn",path:_8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var y8,CP,h8,_8,b8,v8=y(()=>{"use strict";y8=bt(Qt(),1);qe();CP="FIXTURE_REFERENCE_INVALID",h8="fixture:",_8="conformance/fixtures.yaml";b8={name:CP,run:aOe}});import{existsSync as Dl,readFileSync as DP}from"node:fs";import{join as Ba}from"node:path";function cOe(t){return ps(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function fp(t){if(!Dl(t))return null;try{return JSON.parse(DP(t,"utf8"))}catch{return null}}function lOe(t,e){let r=Ba(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(DP(r,"utf8"))}catch(c){e.push({detector:So,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:So,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=cOe(t);s!==a&&e.push({detector:So,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function uOe(t,e){for(let r of S8){let n=Ba(t,r.path);if(!Dl(n))continue;let i=fp(n);if(!i){e.push({detector:So,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:So,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function dOe(t,e){let r=fp(Ba(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of S8){let s=Ba(t,o.path);if(!Dl(s))continue;let a=fp(s);a?.version&&a.version!==n&&e.push({detector:So,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ba(t,".claude-plugin","marketplace.json");if(Dl(i)){let o=fp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:So,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 fOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function pOe(t,e){let r=Ba(t,"src","cli","clad.ts"),n=Ba(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Dl(r)||!Dl(n))return;let i=fOe(DP(r,"utf8"));if(i.length===0)return;let s=fp(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:So,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 mOe(t){let{cwd:e="."}=t,r=[];return lOe(e,r),pOe(e,r),uOe(e,r),dOe(e,r),r}var So,S8,w8,x8=y(()=>{"use strict";lp();So="HARNESS_INTEGRITY",S8=[{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"]}];w8={name:So,run:mOe}});import{existsSync as hOe,readFileSync as gOe}from"node:fs";import{join as yOe}from"node:path";function bOe(t){let{cwd:e="."}=t;return he(e,Dv,r=>SOe(r,e))}function vOe(t){let e=yOe(t,"spec/capabilities.yaml");if(!hOe(e))return!1;try{let r=$8.default.parse(gOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function SOe(t,e){let r=t.features.length;if(r<_Oe)return[];let n=[];return vOe(e)&&n.push({detector:Dv,severity:"warn",path:"spec/capabilities.yaml",message:`${r} features but spec/capabilities.yaml declares no capabilities (capabilities: []) \u2014 the design SSoT is an empty seed. Populate it (capability \u2194 feature links) or run \`clad init --scan\`.`}),t.architecture&&(t.architecture.layers??[]).length===0&&n.push({detector:Dv,severity:"warn",path:"spec/architecture.yaml",message:`${r} features but spec/architecture.yaml declares no layers (layers: []) \u2014 the architecture SSoT is an empty seed. Populate it or run \`clad init --scan\`.`}),n}var $8,Dv,_Oe,k8,E8=y(()=>{"use strict";$8=bt(Qt(),1);vt();Dv="HOLLOW_GOVERNANCE",_Oe=8;k8={name:Dv,run:bOe}});import{existsSync as A8,readFileSync as T8}from"node:fs";import{join as O8}from"node:path";function R8(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 $Oe(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 kOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function EOe(t){let e=O8(t,"README.md"),r=O8(t,"docs","dogfood","matrix.md");if(!A8(e)||!A8(r))return[];let n=R8(T8(e,"utf8"),wOe),i=R8(T8(r,"utf8"),xOe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=kOe(a);if(c===null)continue;let l=i[s]??"not-run",u=$Oe(l);u!==null&&c>u&&o.push({detector:I8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function AOe(t){let{cwd:e="."}=t;return EOe(e)}var I8,wOe,xOe,P8,C8=y(()=>{"use strict";I8="HOST_CLAIM_DRIFT",wOe=//,xOe=//;P8={name:I8,run:AOe}});function TOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return D8(r.features.map(i=>i.id),"feature","spec/features/",n),D8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function D8(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:N8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var N8,j8,M8=y(()=>{"use strict";qe();N8="ID_COLLISION";j8={name:N8,run:TOe}});import{existsSync as pp,readFileSync as NP,readdirSync as jP,statSync as OOe,writeFileSync as L8}from"node:fs";import{join as wo}from"node:path";function F8(t){if(!pp(t))return 0;try{return jP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function ROe(t){if(!pp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=jP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=wo(n,o),a;try{a=OOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function IOe(t){let e=wo(t,"spec","capabilities.yaml");if(!pp(e))return 0;try{let r=Nv.default.parse(NP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ms(t="."){let e=F8(wo(t,"spec","features")),r=F8(wo(t,"spec","scenarios")),n=IOe(t),i=ROe(wo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Nl(t,e){let r=wo(t,"spec.yaml");if(!pp(r))return;let n=NP(r,"utf8"),i=POe(n,e);i!==n&&L8(r,i)}function POe(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 @@ -269,51 +269,51 @@ ${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 Ha(t="."){let e=wo(t,"spec","features");if(!fp(e))return!1;let r=[];for(let i of jP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Dv.parse)(NP(wo(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 Ha(t="."){let e=wo(t,"spec","features");if(!pp(e))return!1;let r=[];for(let i of jP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Nv.parse)(NP(wo(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 F8(wo(t,"spec","index.yaml"),n,"utf8"),!0}var Dv,pp=y(()=>{"use strict";Dv=bt(Qt(),1)});import{existsSync as L8,readFileSync as z8,readdirSync as COe}from"node:fs";import{join as MP}from"node:path";function DOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=ms(e),i=r.inventory;if(!i){let s=U8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return FP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...FP(e),{detector:mp,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 U8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:mp,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(...FP(e)),o}function FP(t){let e=MP(t,"spec","index.yaml"),r=MP(t,"spec","features");if(!L8(e)||!L8(r))return[];let n=new Map;try{for(let l of z8(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 COe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=z8(MP(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:mp,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:mp,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 mp,U8,q8,B8=y(()=>{"use strict";pp();qe();mp="INVENTORY_DRIFT",U8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];q8={name:mp,run:DOe}});import{existsSync as NOe,readFileSync as jOe}from"node:fs";import{join as MOe}from"node:path";function LOe(t){let{cwd:e="."}=t,r=MOe(e,"src","spec","schema.json"),n=[];if(NOe(r)){let i;try{i=JSON.parse(jOe(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 FOe)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=G(e);i.schema!==H8&&n.push({detector:hp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${H8}'`})}catch{}return n}var hp,FOe,H8,G8,Z8=y(()=>{"use strict";qe();hp="META_INTEGRITY",FOe=["schema","project","features"],H8="0.1";G8={name:hp,run:LOe}});function zOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return V8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),V8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function V8(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:W8,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 W8,K8,J8=y(()=>{"use strict";qe();W8="SLUG_CONFLICT";K8={name:W8,run:zOe}});function Nl(t){return t==="planned"||t==="in_progress"}var Nv=y(()=>{"use strict"});import{existsSync as UOe}from"node:fs";import{join as qOe}from"node:path";function BOe(t){let{cwd:e="."}=t;return he(e,jv,r=>HOe(r,e))}function HOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=qOe(e,i);UOe(o)||r.push(GOe(n.id,i,n.status))}return r}function GOe(t,e,r){return Nl(r)?{detector:jv,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:jv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var jv,Mv,LP=y(()=>{"use strict";Nv();vt();jv="MISSING_IMPLEMENTATION";Mv={name:jv,run:BOe}});function ZOe(t){let{cwd:e="."}=t;return he(e,zP,VOe)}function VOe(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:zP,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 zP,Fv,UP=y(()=>{"use strict";vt();zP="MISSING_TESTS";Fv={name:zP,run:ZOe}});import{existsSync as WOe,readFileSync as KOe}from"node:fs";import{join as Y8}from"node:path";function X8(t){if(WOe(t))try{return JSON.parse(KOe(t,"utf8"))}catch{return}}function QOe(t){let{cwd:e="."}=t,r=X8(Y8(e,JOe)),n=X8(Y8(e,YOe));if(!r||!n)return[{detector:qP,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>XOe&&i.push({detector:qP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var qP,JOe,YOe,XOe,Q8,e5=y(()=>{"use strict";qP="PERFORMANCE_DRIFT",JOe="perf/baseline.json",YOe="perf/current.json",XOe=10;Q8={name:qP,run:QOe}});import{existsSync as eRe}from"node:fs";import{join as tRe}from"node:path";function nRe(t){let{cwd:e="."}=t;return he(e,BP,r=>oRe(r,e))}function iRe(t,e){return(t.modules??[]).some(r=>eRe(tRe(e,r)))}function oRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||iRe(s,e)||r.push(s.id);let n=rRe;if(r.length<=n)return[];let i=r.slice(0,t5).join(", "),o=r.length>t5?", \u2026":"";return[{detector:BP,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 BP,rRe,t5,r5,n5=y(()=>{"use strict";vt();BP="PLANNED_BACKLOG",rRe=5,t5=8;r5={name:BP,run:nRe}});import{existsSync as sRe,readFileSync as aRe}from"node:fs";import{join as cRe}from"node:path";function dRe(t){let{cwd:e="."}=t;return he(e,HP,r=>fRe(r,e))}function fRe(t,e){if(t.features.lengthn.includes(i))?[{detector:HP,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 HP,lRe,uRe,i5,o5=y(()=>{"use strict";vt();HP="PROJECT_CONTEXT_DRIFT",lRe=8,uRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];i5={name:HP,run:dRe}});function s5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Lv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function pRe(t){let{cwd:e="."}=t;return he(e,Lv,mRe)}function mRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...s5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Lv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...s5(e,n.features,`scenario ${n.id}.features`));return r}var Lv,zv,GP=y(()=>{"use strict";vt();Lv="REFERENCE_INTEGRITY";zv={name:Lv,run:pRe}});function gp(t=""){return new RegExp(hRe,t)}var hRe,ZP=y(()=>{"use strict";hRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as gRe,readdirSync as yRe,readFileSync as _Re,statSync as bRe,writeFileSync as vRe}from"node:fs";import{dirname as SRe,join as yp,normalize as wRe,relative as xRe}from"node:path";function TRe(t){let e=[];for(let r of t.matchAll(ARe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(gp("g"))??[])e.push(n);return[...new Set(e)].sort()}function ORe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function a5(t){return t.split("\\").join("/")}function RRe(t){return $Re.some(e=>t===e||t.startsWith(`${e}/`))}function IRe(t){let e=yp(t,"docs");if(!gRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=yRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=yp(i,s),c;try{c=bRe(a)}catch{continue}let l=a5(xRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function PRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=wRe(yp(SRe(t),e));return a5(r)}function _p(t="."){let e=[];for(let r of IRe(t)){let n;try{n=_Re(yp(t,r),"utf8")}catch{continue}let i=ORe(n),o=TRe(i);if(RRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(kRe)?[]:i.match(gp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(ERe)){let d=PRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function c5(t="."){let e=_p(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 vRe(yp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return L8(wo(t,"spec","index.yaml"),n,"utf8"),!0}var Nv,mp=y(()=>{"use strict";Nv=bt(Qt(),1)});import{existsSync as z8,readFileSync as U8,readdirSync as COe}from"node:fs";import{join as MP}from"node:path";function DOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=ms(e),i=r.inventory;if(!i){let s=q8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return FP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...FP(e),{detector:hp,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 q8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:hp,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(...FP(e)),o}function FP(t){let e=MP(t,"spec","index.yaml"),r=MP(t,"spec","features");if(!z8(e)||!z8(r))return[];let n=new Map;try{for(let l of U8(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 COe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=U8(MP(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:hp,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:hp,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 hp,q8,B8,H8=y(()=>{"use strict";mp();qe();hp="INVENTORY_DRIFT",q8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];B8={name:hp,run:DOe}});import{existsSync as NOe,readFileSync as jOe}from"node:fs";import{join as MOe}from"node:path";function LOe(t){let{cwd:e="."}=t,r=MOe(e,"src","spec","schema.json"),n=[];if(NOe(r)){let i;try{i=JSON.parse(jOe(r,"utf8"))}catch(o){n.push({detector:gp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of FOe)i.required?.includes(o)||n.push({detector:gp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:gp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=G(e);i.schema!==G8&&n.push({detector:gp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${G8}'`})}catch{}return n}var gp,FOe,G8,Z8,V8=y(()=>{"use strict";qe();gp="META_INTEGRITY",FOe=["schema","project","features"],G8="0.1";Z8={name:gp,run:LOe}});function zOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return W8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),W8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function W8(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:K8,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 K8,J8,Y8=y(()=>{"use strict";qe();K8="SLUG_CONFLICT";J8={name:K8,run:zOe}});function jl(t){return t==="planned"||t==="in_progress"}var jv=y(()=>{"use strict"});import{existsSync as UOe}from"node:fs";import{join as qOe}from"node:path";function BOe(t){let{cwd:e="."}=t;return he(e,Mv,r=>HOe(r,e))}function HOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=qOe(e,i);UOe(o)||r.push(GOe(n.id,i,n.status))}return r}function GOe(t,e,r){return jl(r)?{detector:Mv,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:Mv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Mv,Fv,LP=y(()=>{"use strict";jv();vt();Mv="MISSING_IMPLEMENTATION";Fv={name:Mv,run:BOe}});function ZOe(t){let{cwd:e="."}=t;return he(e,zP,VOe)}function VOe(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:zP,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 zP,Lv,UP=y(()=>{"use strict";vt();zP="MISSING_TESTS";Lv={name:zP,run:ZOe}});import{existsSync as WOe,readFileSync as KOe}from"node:fs";import{join as X8}from"node:path";function Q8(t){if(WOe(t))try{return JSON.parse(KOe(t,"utf8"))}catch{return}}function QOe(t){let{cwd:e="."}=t,r=Q8(X8(e,JOe)),n=Q8(X8(e,YOe));if(!r||!n)return[{detector:qP,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>XOe&&i.push({detector:qP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var qP,JOe,YOe,XOe,e5,t5=y(()=>{"use strict";qP="PERFORMANCE_DRIFT",JOe="perf/baseline.json",YOe="perf/current.json",XOe=10;e5={name:qP,run:QOe}});import{existsSync as eRe}from"node:fs";import{join as tRe}from"node:path";function nRe(t){let{cwd:e="."}=t;return he(e,BP,r=>oRe(r,e))}function iRe(t,e){return(t.modules??[]).some(r=>eRe(tRe(e,r)))}function oRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||iRe(s,e)||r.push(s.id);let n=rRe;if(r.length<=n)return[];let i=r.slice(0,r5).join(", "),o=r.length>r5?", \u2026":"";return[{detector:BP,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 BP,rRe,r5,n5,i5=y(()=>{"use strict";vt();BP="PLANNED_BACKLOG",rRe=5,r5=8;n5={name:BP,run:nRe}});import{existsSync as sRe,readFileSync as aRe}from"node:fs";import{join as cRe}from"node:path";function dRe(t){let{cwd:e="."}=t;return he(e,HP,r=>fRe(r,e))}function fRe(t,e){if(t.features.lengthn.includes(i))?[{detector:HP,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 HP,lRe,uRe,o5,s5=y(()=>{"use strict";vt();HP="PROJECT_CONTEXT_DRIFT",lRe=8,uRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];o5={name:HP,run:dRe}});function a5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:zv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function pRe(t){let{cwd:e="."}=t;return he(e,zv,mRe)}function mRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...a5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:zv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...a5(e,n.features,`scenario ${n.id}.features`));return r}var zv,Uv,GP=y(()=>{"use strict";vt();zv="REFERENCE_INTEGRITY";Uv={name:zv,run:pRe}});function yp(t=""){return new RegExp(hRe,t)}var hRe,ZP=y(()=>{"use strict";hRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as gRe,readdirSync as yRe,readFileSync as _Re,statSync as bRe,writeFileSync as vRe}from"node:fs";import{dirname as SRe,join as _p,normalize as wRe,relative as xRe}from"node:path";function TRe(t){let e=[];for(let r of t.matchAll(ARe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(yp("g"))??[])e.push(n);return[...new Set(e)].sort()}function ORe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function c5(t){return t.split("\\").join("/")}function RRe(t){return $Re.some(e=>t===e||t.startsWith(`${e}/`))}function IRe(t){let e=_p(t,"docs");if(!gRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=yRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=_p(i,s),c;try{c=bRe(a)}catch{continue}let l=c5(xRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function PRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=wRe(_p(SRe(t),e));return c5(r)}function bp(t="."){let e=[];for(let r of IRe(t)){let n;try{n=_Re(_p(t,r),"utf8")}catch{continue}let i=ORe(n),o=TRe(i);if(RRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(kRe)?[]:i.match(yp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(ERe)){let d=PRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function l5(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 vRe(_p(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var $Re,kRe,ERe,ARe,Uv=y(()=>{"use strict";ZP();$Re=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],kRe="clad-doc-links: ignore",ERe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,ARe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as CRe}from"node:fs";import{join as DRe}from"node:path";function NRe(t){let{cwd:e="."}=t;return he(e,qv,r=>jRe(r,e))}function jRe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of _p(e).docs){for(let o of i.doc_links)CRe(DRe(e,o))||n.push({detector:qv,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:qv,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 qv,Bv,VP=y(()=>{"use strict";Uv();vt();qv="DOC_LINK_INTEGRITY";Bv={name:qv,run:NRe}});function FRe(t){let{cwd:e="."}=t;return he(e,bp,r=>LRe(r))}function LRe(t){let e=[],r=t.features.length,n=t.scenarios??[];r>=MRe&&n.length===0&&e.push({detector:bp,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 o of n)(o.features??[]).length===0&&e.push({detector:bp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let i=new Map(t.features.filter(o=>typeof o.slug=="string"&&o.slug.length>0).map(o=>[o.slug,o.id]));for(let o of n){if(!o.flow)continue;let s=new Set(o.features??[]),a=new Map;for(let c of o.flow.matchAll(/\(([^)]+)\)/g))for(let l of c[1].split(/[,/·]/)){let u=l.trim(),d=i.get(u);d&&!s.has(d)&&a.set(u,d)}if(a.size>0){let c=[...a].map(([l,u])=>`${l} (${u})`).join(", ");e.push({detector:bp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} flow references ${c} but features[] does not bind ${a.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var bp,MRe,l5,u5=y(()=>{"use strict";vt();bp="SCENARIO_COVERAGE",MRe=8;l5={name:bp,run:FRe}});import{createHash as zRe}from"node:crypto";function URe(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??d5),sample:URe(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(d5),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Sp(t){return(t.features??[]).filter(e=>e.status==="done").length}function qRe(t,e){return e<=0?!1:e>=1?!0:parseInt(zRe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var d5,Hv=y(()=>{"use strict";d5=["unwanted"]});import{existsSync as BRe,readdirSync as HRe}from"node:fs";import{join as p5}from"node:path";import m5 from"node:process";function GRe(t){let e=!1,r=n=>{for(let i of HRe(n,{withFileTypes:!0})){if(e)return;let o=p5(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 WP(t={}){let{cwd:e="."}=t,r=p5(e,hs);if(!BRe(r)||!GRe(r))return{stage:Gv,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${hs}/ \u2014 skipped`};let n=ut(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Gv,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o=Je(i.cmd,[...i.args,hs],{cwd:e,reject:!1}),s=Ut(Gv,i.cmd,o);return s||tr(Gv,o)}var Gv,hs,ZRe,KP=y(()=>{"use strict";Mr();on();Tn();Gv="stage_2.3",hs="tests/oracle";ZRe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${m5.argv[1]}`;if(ZRe){let t=WP();console.log(JSON.stringify(t)),m5.exit(t.exitCode)}});import{existsSync as VRe}from"node:fs";import{join as WRe}from"node:path";function KRe(t){let{cwd:e="."}=t;return he(e,ri,r=>JRe(r,e))}function JRe(t,e){let r=[],n=vp(t.project,Sp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?On(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:ri,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${hs}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!VRe(WRe(e,f))){r.push({detector:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${hs}/`)||r.push({detector:ri,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${hs}/ \u2014 stage_2.3 only runs ${hs}/, 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:ri,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:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ri,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:ri,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:ri,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:ri,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 ri,h5,g5=y(()=>{"use strict";ti();Hv();KP();vt();ri="SPEC_CONFORMANCE";h5={name:ri,run:KRe}});function YRe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:JP,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>y5&&i.push({detector:JP,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${y5})`})}return i}var JP,y5,_5,b5=y(()=>{"use strict";ti();JP="STALE_EVIDENCE",y5=90;_5={name:JP,run:YRe}});import{existsSync as v5}from"node:fs";import{join as S5}from"node:path";function XRe(t){let{cwd:e="."}=t;return he(e,jl,r=>QRe(r,e))}function QRe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:jl,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:jl,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=>v5(S5(e,o)));i.length>0&&r.push({detector:jl,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Nl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>v5(S5(e,i)))&&r.push({detector:jl,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 jl,Zv,YP=y(()=>{"use strict";Nv();vt();jl="STALE_SPECIFICATION";Zv={name:jl,run:XRe}});import{existsSync as w5,statSync as x5}from"node:fs";import{join as $5}from"node:path";function tIe(t,e){let r=0;for(let n of e){let i=$5(t,n);if(!w5(i))continue;let o=x5(i).mtimeMs;o>r&&(r=o)}return r}function rIe(t){let{cwd:e="."}=t;return he(e,XP,r=>nIe(r,e))}function nIe(t,e){let r=Di(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=tIe(e,n);if(i===0)return[];let o=ps([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=$5(e,a);if(!w5(c))continue;let l=x5(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>eIe&&s.push({detector:XP,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var XP,eIe,Vv,QP=y(()=>{"use strict";cp();La();vt();XP="STALE_TESTS",eIe=30;Vv={name:XP,run:rIe}});import{existsSync as iIe}from"node:fs";import{join as oIe}from"node:path";function sIe(t){let{cwd:e="."}=t;return he(e,xp,r=>aIe(r,e))}function aIe(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:xp,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=>!iIe(oIe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:xp,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:xp,severity:Nl(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 xp,Wv,eC=y(()=>{"use strict";Nv();vt();xp="STATUS_DRIFT";Wv={name:xp,run:sIe}});function cIe(t){let{cwd:e="."}=t;return he(e,Kv,r=>lIe(r,e))}function lIe(t,e){let r=ut(e).language;return r==="unknown"?[{detector:Kv,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:Kv,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var Kv,k5,E5=y(()=>{"use strict";on();vt();Kv="TECH_STACK_MISMATCH";k5={name:Kv,run:cIe}});function pIe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function mIe(t){let{cwd:e="."}=t;return he(e,tC,r=>hIe(r,e))}function hIe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=ps([...pIe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:tC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var tC,A5,uIe,dIe,fIe,Jv,rC=y(()=>{"use strict";cp();EP();vt();tC="UNMAPPED_ARTIFACT",A5=["src/stages/**/*.ts","src/spec/**/*.ts"],uIe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},dIe={kotlin:"src/main/kotlin"},fIe=8;Jv={name:tC,run:mIe}});import{existsSync as T5}from"node:fs";import{join as O5}from"node:path";function yIe(t){return gIe.some(e=>t.startsWith(e))}function _Ie(t){let{cwd:e="."}=t;return he(e,nC,r=>bIe(r,e))}function bIe(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(yIe(o))continue;let s=o.split("#",1)[0];T5(O5(e,o))||s&&T5(O5(e,s))||r.push({detector:nC,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 kee(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as X2e}from"node:fs";import{dirname as Q2e,join as ij}from"node:path";import{fileURLToPath as eUe}from"node:url";var oj=Q2e(eUe(import.meta.url));function Oee(t){for(let e of[ij(oj,"viewer",t),ij(oj,"..","graph","viewer",t),ij(oj,"..","..","dist","viewer",t)])try{return X2e(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function Ree(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -876,20 +876,20 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}RP();VP();LP();UP();GP();OP();QP();eC();rC();iC();Fm();ZP();qe();var eUe=[Fv,Yv,Mv,Jv,zv,Bv,Pv,Wv,Vv,Iv];function tUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=gp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function xx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Sa(e,G(e))}catch{}try{for(let o of eUe){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 tUe(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{Sa(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}oj();qe();Ti();var nUe=new Set(["mermaid","dot","json","obsidian","html"]);function Pee(t={}){try{let e=t.format??"mermaid";if(!nUe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=G(),i=dc(n,".");if(t.focus){let s=yx(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=gx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Tee(i);for(let[c,l]of a){let u=rUe(s,c);sj(cj(u),{recursive:!0}),aj(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,xx(i,"."));sj(cj(t.out),{recursive:!0}),aj(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"?Aee(i):r==="json"?Sx(i):Eee(i);t.out?(sj(cj(t.out),{recursive:!0}),aj(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 Cee(){try{let t=dc(G(),".");process.stdout.write(Iee($x(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Fm();import{createServer as iUe}from"node:http";import{existsSync as oUe,watch as sUe}from"node:fs";import{join as aUe}from"node:path";qe();Ti();function cUe(t={}){let e=t.cwd??".",r=new Set,n=()=>dc(G(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}RP();VP();LP();UP();GP();OP();QP();eC();rC();iC();Lm();ZP();qe();var tUe=[Lv,Xv,Fv,Yv,Uv,Hv,Cv,Kv,Wv,Pv];function rUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=yp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function xx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Sa(e,G(e))}catch{}try{for(let o of tUe){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 rUe(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{Sa(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}sj();qe();Ti();var iUe=new Set(["mermaid","dot","json","obsidian","html"]);function Pee(t={}){try{let e=t.format??"mermaid";if(!iUe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=G(),i=fc(n,".");if(t.focus){let s=yx(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=gx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Tee(i);for(let[c,l]of a){let u=nUe(s,c);aj(lj(u),{recursive:!0}),cj(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,xx(i,"."));aj(lj(t.out),{recursive:!0}),cj(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"?Aee(i):r==="json"?Sx(i):Eee(i);t.out?(aj(lj(t.out),{recursive:!0}),cj(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 Cee(){try{let t=fc(G(),".");process.stdout.write(Iee($x(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Lm();import{createServer as oUe}from"node:http";import{existsSync as sUe,watch as aUe}from"node:fs";import{join as cUe}from"node:path";qe();Ti();function lUe(t={}){let e=t.cwd??".",r=new Set,n=()=>fc(G(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=iUe((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=Sx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(xx(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=oUe((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=Sx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(xx(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=aUe(e,u);if(oUe(d))try{let f=sUe(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=cUe(e,u);if(sUe(d))try{let f=aUe(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 Dee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await cUe({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 lUe=["stage_1.1","stage_2.1","stage_2.3"];function uUe(t){return(t.features??[]).filter(e=>e.status==="done")}function dUe(t,e){let r=uUe(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 Nee(t,e){let r=[];for(let n of lUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=dUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}sS();import jee from"node:process";function fUe(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 kx(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=fUe(n,t);i.pass||r.push(i)}return r}ti();var lj="stage_4.1";function uj(t={}){let{cwd:e="."}=t,r=On(e);if(r.length===0)return{stage:lj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=kx(r);if(n.length===0)return{stage:lj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:lj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var pUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${jee.argv[1]}`;if(pUe){let t=uj();console.log(JSON.stringify(t)),jee.exit(t.exitCode)}ll();import{randomBytes as mUe}from"node:crypto";import{unlinkSync as hUe}from"node:fs";import{tmpdir as gUe}from"node:os";import{join as yUe,resolve as dj}from"node:path";import _Ue from"node:process";var qr=null;function Mee(t){qr={cwd:dj(t),run:null,jsonFile:null}}function Fee(){return qr!==null}function Lee(t,e){if(!qr||qr.cwd!==dj(t))return null;if(qr.run)return qr.run;let r=yUe(gUe(),`clad-shared-vitest-${_Ue.pid}-${mUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function zee(t){return!qr||qr.cwd!==dj(t)?null:qr.run}function Uee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function qee(){let t=qr?.jsonFile;if(qr=null,t)try{hUe(t)}catch{}}Mr();import Bee from"node:process";var Ex="stage_1.4";function fj(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Ex,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:Ex,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Ex,pass:!0,exitCode:0}:{stage:Ex,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var bUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Bee.argv[1]}`;if(bUe){let t=fj();console.log(JSON.stringify(t)),Bee.exit(t.exitCode)}Mr();import Hee from"node:process";Lm();Tn();var Ax="stage_2.2";function pj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Io("coverage",t))}catch(c){return{stage:Ax,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Ax,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=zee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Ut(Ax,r,s);return a||tr(Ax,s)}var wUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Hee.argv[1]}`;if(wUe){let t=pj();console.log(JSON.stringify(t)),Hee.exit(t.exitCode)}kp();mj();Mr();on();Tn();import Zee from"node:process";var Ix="stage_3.2";function hj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Ix,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Rl(e,o[o.length-1]))return{stage:Ix,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Ix,i,s);return a||tr(Ix,s)}var LUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Zee.argv[1]}`;if(LUe){let t=hj();console.log(JSON.stringify(t)),Zee.exit(t.exitCode)}Mr();qe();Tn();import{existsSync as zUe}from"node:fs";import{resolve as Wee}from"node:path";import Kee from"node:process";var ci="stage_2.4",gj=5e3,UUe=3e4;function yj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=G(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:ci,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return BUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ci,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ci,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ci,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Wee(e,r.path);if(!zUe(s))return{stage:ci,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??gj,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Ut(ci,r.path,c);if(l)return l;if(c.timedOut)return{stage:ci,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:ci,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ci,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Vee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},qUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function BUe(t,e,r){let n=Math.min(e.length*gj,UUe),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(HUe(t,s,r))}return GUe(o)}function HUe(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("/")?Wee(t,a):a,u=gj,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(ja(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 GUe(t){let e="skip";for(let o of t)Vee[o.disposition]>Vee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${qUe[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:ci,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ci,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var ZUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Kee.argv[1]}`;if(ZUe){let t=yj();console.log(JSON.stringify(t)),Kee.exit(t.exitCode)}Mr();on();Tn();import Jee from"node:process";var Px="stage_3.1";function _j(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Px,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Rl(e,o[o.length-1]))return{stage:Px,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Px,i,s);return a||tr(Px,s)}var VUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Jee.argv[1]}`;if(VUe){let t=_j();console.log(JSON.stringify(t)),Jee.exit(t.exitCode)}KP();bj();vj();Mr();Ox();import{randomBytes as eqe}from"node:crypto";import{unlinkSync as tqe}from"node:fs";import{tmpdir as rqe}from"node:os";import{join as nqe}from"node:path";import wj from"node:process";Lm();Tn();qe();import{readFileSync as JUe}from"node:fs";import{resolve as Qee}from"node:path";function YUe(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=Qee(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 XUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function QUe(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=XUe(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(Qee(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 Sj(t,e){try{let r=YUe(JUe(t,"utf8"));return r?QUe(G(e),r,e):[]}catch{return[]}}var Po="stage_2.1";function ete(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function iqe(t,e,r){let n,i;try{({cmd:n,args:i}=Io("coverage",t))}catch{return null}if(!n||!i||!ete(n,i))return null;let o=n,s=i,a=Lee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Ut(Po,n,c))return null;let u=tr(Po,c);if(Uee(u)==="fallback")return null;if(r){let d=Sj(l,e);if(d.length>0)return{stage:Po,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Po,pass:!0,exitCode:0}}function xj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Io("test",t))}catch(u){return{stage:Po,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Po,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=ete(n,i),a=r&&s;if(Fee()&&s){let u=iqe(t,e,a);if(u)return u}let c,l=i;a&&(c=nqe(rqe(),`clad-vitest-${wj.pid}-${eqe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Ut(Po,n,u);if(d)return d;let f=Su("unit",tr(Po,u),u);if(a&&f.pass&&c){let p=Sj(c,e);if(p.length>0)return{stage:Po,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{tqe(c)}catch{}}}var oqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wj.argv[1]}`;if(oqe){let t=xj();console.log(JSON.stringify(t)),wj.exit(t.exitCode)}Mr();on();Tn();import tte from"node:process";var Nx="stage_3.3";function $j(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Nx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Rl(e,o[o.length-1]))return{stage:Nx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Nx,i,s);return a||tr(Nx,s)}var sqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tte.argv[1]}`;if(sqe){let t=$j();console.log(JSON.stringify(t)),tte.exit(t.exitCode)}YP();Af();pa();Ej();pp();Uv();var cte=bt(Qt(),1);import{existsSync as Aj,readFileSync as yqe,readdirSync as ate,statSync as _qe,writeFileSync as bqe}from"node:fs";import{basename as Bm,join as Hm,relative as ste}from"node:path";var vqe=["self-dogfood:","fixture:","derived:"],lte=/\.(test|spec)\.[jt]sx?$/;function ute(t,e=t,r=[]){let n;try{n=ate(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Hm(e,i);try{_qe(o).isDirectory()?ute(t,o,r):lte.test(i)&&r.push(o)}catch{continue}}return r}function dte(t="."){let e=Hm(t,"spec","features"),r=Hm(t,"tests"),n=[],i=[];if(!Aj(e)||!Aj(r))return{repaired:n,suggested:i};let o=ute(r),s=new Map;for(let a of o){let c=ste(t,a).split("\\").join("/"),l=s.get(Bm(a))??[];l.push(c),s.set(Bm(a),l)}for(let a of ate(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Hm(e,a),l,u;try{l=yqe(c,"utf8"),u=(0,cte.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(vqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Aj(Hm(t,b)))continue;let _=s.get(Bm(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=>Bm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>ste(t,h).split("\\").join("/")).find(h=>{let g=Bm(h).replace(lte,"");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 Dee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await lUe({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 uUe=["stage_1.1","stage_2.1","stage_2.3"];function dUe(t){return(t.features??[]).filter(e=>e.status==="done")}function fUe(t,e){let r=dUe(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 Nee(t,e){let r=[];for(let n of uUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=fUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}sS();import jee from"node:process";function pUe(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 kx(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=pUe(n,t);i.pass||r.push(i)}return r}ti();var uj="stage_4.1";function dj(t={}){let{cwd:e="."}=t,r=On(e);if(r.length===0)return{stage:uj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=kx(r);if(n.length===0)return{stage:uj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:uj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var mUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${jee.argv[1]}`;if(mUe){let t=dj();console.log(JSON.stringify(t)),jee.exit(t.exitCode)}ul();import{randomBytes as hUe}from"node:crypto";import{unlinkSync as gUe}from"node:fs";import{tmpdir as yUe}from"node:os";import{join as _Ue,resolve as fj}from"node:path";import bUe from"node:process";var qr=null;function Mee(t){qr={cwd:fj(t),run:null,jsonFile:null}}function Fee(){return qr!==null}function Lee(t,e){if(!qr||qr.cwd!==fj(t))return null;if(qr.run)return qr.run;let r=_Ue(yUe(),`clad-shared-vitest-${bUe.pid}-${hUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function zee(t){return!qr||qr.cwd!==fj(t)?null:qr.run}function Uee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function qee(){let t=qr?.jsonFile;if(qr=null,t)try{gUe(t)}catch{}}Mr();import Bee from"node:process";var Ex="stage_1.4";function pj(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Ex,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:Ex,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Ex,pass:!0,exitCode:0}:{stage:Ex,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var vUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Bee.argv[1]}`;if(vUe){let t=pj();console.log(JSON.stringify(t)),Bee.exit(t.exitCode)}Mr();import Hee from"node:process";zm();Tn();var Ax="stage_2.2";function mj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Io("coverage",t))}catch(c){return{stage:Ax,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Ax,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=zee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Ut(Ax,r,s);return a||tr(Ax,s)}var xUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Hee.argv[1]}`;if(xUe){let t=mj();console.log(JSON.stringify(t)),Hee.exit(t.exitCode)}Ep();hj();Mr();on();Tn();import Zee from"node:process";var Ix="stage_3.2";function gj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Ix,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Ix,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Ix,i,s);return a||tr(Ix,s)}var zUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Zee.argv[1]}`;if(zUe){let t=gj();console.log(JSON.stringify(t)),Zee.exit(t.exitCode)}Mr();qe();Tn();import{existsSync as UUe}from"node:fs";import{resolve as Wee}from"node:path";import Kee from"node:process";var ci="stage_2.4",yj=5e3,qUe=3e4;function _j(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=G(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:ci,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return HUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ci,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ci,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ci,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Wee(e,r.path);if(!UUe(s))return{stage:ci,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??yj,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Ut(ci,r.path,c);if(l)return l;if(c.timedOut)return{stage:ci,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:ci,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ci,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Vee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},BUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function HUe(t,e,r){let n=Math.min(e.length*yj,qUe),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(GUe(t,s,r))}return ZUe(o)}function GUe(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("/")?Wee(t,a):a,u=yj,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(ja(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 ZUe(t){let e="skip";for(let o of t)Vee[o.disposition]>Vee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${BUe[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:ci,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ci,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var VUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Kee.argv[1]}`;if(VUe){let t=_j();console.log(JSON.stringify(t)),Kee.exit(t.exitCode)}Mr();on();Tn();import Jee from"node:process";var Px="stage_3.1";function bj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Px,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Px,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Px,i,s);return a||tr(Px,s)}var WUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Jee.argv[1]}`;if(WUe){let t=bj();console.log(JSON.stringify(t)),Jee.exit(t.exitCode)}KP();vj();Sj();Mr();Ox();import{randomBytes as tqe}from"node:crypto";import{unlinkSync as rqe}from"node:fs";import{tmpdir as nqe}from"node:os";import{join as iqe}from"node:path";import xj from"node:process";zm();Tn();qe();import{readFileSync as YUe}from"node:fs";import{resolve as Qee}from"node:path";function XUe(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=Qee(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 QUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function eqe(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=QUe(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(Qee(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 wj(t,e){try{let r=XUe(YUe(t,"utf8"));return r?eqe(G(e),r,e):[]}catch{return[]}}var Po="stage_2.1";function ete(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function oqe(t,e,r){let n,i;try{({cmd:n,args:i}=Io("coverage",t))}catch{return null}if(!n||!i||!ete(n,i))return null;let o=n,s=i,a=Lee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Ut(Po,n,c))return null;let u=tr(Po,c);if(Uee(u)==="fallback")return null;if(r){let d=wj(l,e);if(d.length>0)return{stage:Po,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Po,pass:!0,exitCode:0}}function $j(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Io("test",t))}catch(u){return{stage:Po,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Po,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=ete(n,i),a=r&&s;if(Fee()&&s){let u=oqe(t,e,a);if(u)return u}let c,l=i;a&&(c=iqe(nqe(),`clad-vitest-${xj.pid}-${tqe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Ut(Po,n,u);if(d)return d;let f=wu("unit",tr(Po,u),u);if(a&&f.pass&&c){let p=wj(c,e);if(p.length>0)return{stage:Po,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{rqe(c)}catch{}}}var sqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xj.argv[1]}`;if(sqe){let t=$j();console.log(JSON.stringify(t)),xj.exit(t.exitCode)}Mr();on();Tn();import tte from"node:process";var Nx="stage_3.3";function kj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Nx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Nx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Nx,i,s);return a||tr(Nx,s)}var aqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tte.argv[1]}`;if(aqe){let t=kj();console.log(JSON.stringify(t)),tte.exit(t.exitCode)}YP();Tf();pa();Aj();mp();qv();var cte=bt(Qt(),1);import{existsSync as Tj,readFileSync as _qe,readdirSync as ate,statSync as bqe,writeFileSync as vqe}from"node:fs";import{basename as Hm,join as Gm,relative as ste}from"node:path";var Sqe=["self-dogfood:","fixture:","derived:"],lte=/\.(test|spec)\.[jt]sx?$/;function ute(t,e=t,r=[]){let n;try{n=ate(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Gm(e,i);try{bqe(o).isDirectory()?ute(t,o,r):lte.test(i)&&r.push(o)}catch{continue}}return r}function dte(t="."){let e=Gm(t,"spec","features"),r=Gm(t,"tests"),n=[],i=[];if(!Tj(e)||!Tj(r))return{repaired:n,suggested:i};let o=ute(r),s=new Map;for(let a of o){let c=ste(t,a).split("\\").join("/"),l=s.get(Hm(a))??[];l.push(c),s.set(Hm(a),l)}for(let a of ate(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Gm(e,a),l,u;try{l=_qe(c,"utf8"),u=(0,cte.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(Sqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Tj(Gm(t,b)))continue;let _=s.get(Hm(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=>Hm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>ste(t,h).split("\\").join("/")).find(h=>{let g=Hm(h).replace(lte,"");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&&bqe(c,l,"utf8")}return{repaired:n,suggested:i}}cl();import{existsSync as Sqe,readFileSync as wqe}from"node:fs";import{join as xqe}from"node:path";function $qe(t,e){let r=xqe(t,e);if(!Sqe(r))return[];let n=[];for(let i of wqe(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 fte(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=>$qe(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 pte(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(` -`)}Hv();qe();Ti();ti();cl();var Tj=["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"],kqe=[...Tj,"att"];function Eqe(t,e,r){if(e.startsWith("stage_4")){let n=On(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return kx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function Aqe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":T_(e,r,t).state==="fresh"?"\u2713":"!"}function Lx(t,e="."){let r=is(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Tj.map(o=>Eqe(i,o,e)),Aqe(i,r,e)]}));return{columns:kqe,rows:n}}function mte(t,e=".",r={}){let n=r.internal??!1,i=Lx(t,e),o=[...Tj.map(c=>n?c.replace("stage_",""):Tqe(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 Tqe(t){return xa(t).slice(0,3)}async function YJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Cue(),Pue)),Promise.resolve().then(()=>(Fue(),Mue)),Promise.resolve().then(()=>(Up(),LX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>_ee(s),prepareInit:({cwd:s,mode:a,intent:c})=>gee(s,a,c),initialize:ZN,prepareClarify:(s,{cwd:a})=>yee(a,s),clarify:JN,resolveReview:(s,{cwd:a})=>fee(s,{cwd:a})}});n(i.server);let o=new r;W.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function XJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await ZN({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){W.stdout.write(`${JSON.stringify(n,null,2)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&vqe(c,l,"utf8")}return{repaired:n,suggested:i}}ll();import{existsSync as wqe,readFileSync as xqe}from"node:fs";import{join as $qe}from"node:path";function kqe(t,e){let r=$qe(t,e);if(!wqe(r))return[];let n=[];for(let i of xqe(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 fte(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=>kqe(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 pte(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(` +`)}Gv();qe();Ti();ti();ll();var Oj=["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"],Eqe=[...Oj,"att"];function Aqe(t,e,r){if(e.startsWith("stage_4")){let n=On(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return kx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function Tqe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":O_(e,r,t).state==="fresh"?"\u2713":"!"}function Lx(t,e="."){let r=is(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Oj.map(o=>Aqe(i,o,e)),Tqe(i,r,e)]}));return{columns:Eqe,rows:n}}function mte(t,e=".",r={}){let n=r.internal??!1,i=Lx(t,e),o=[...Oj.map(c=>n?c.replace("stage_",""):Oqe(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 Oqe(t){return xa(t).slice(0,3)}async function XJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Cue(),Pue)),Promise.resolve().then(()=>(Fue(),Mue)),Promise.resolve().then(()=>(qp(),LX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>_ee(s),prepareInit:({cwd:s,mode:a,intent:c})=>gee(s,a,c),initialize:VN,prepareClarify:(s,{cwd:a})=>yee(a,s),clarify:YN,resolveReview:(s,{cwd:a})=>fee(s,{cwd:a})}});n(i.server);let o=new r;W.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function QJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await VN({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){W.stdout.write(`${JSON.stringify(n,null,2)} `),W.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){W.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())W.stdout.write(` ${o+1}. ${s} @@ -900,30 +900,30 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&bqe(c,l,"u `),W.stdout.write(` e.g. clad init payment SaaS for B2B `),W.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));W.exit(0)}async function QJe(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(()=>(lde(),cde)),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}`),W.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=G(e.cwd??"."),a=n.featuresTouched.map(l=>HO(l,s)),c=`${qH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&W.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.`),W.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function e8e(t={}){try{let e=G();if(fa("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ms(".");Dl(".",r),Ha("."),c5(".");let n=Gl(".");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=dte(".");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=Fx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Zv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),W.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)`),W.exit(0);return}L("pass","sync",`${e.features.length} features valid`),W.exit(0)}catch(e){L("fail","sync",e.message),W.exit(1)}}function t8e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),W.exit(2);return}let e=d_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),W.exit(0)}function r8e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),W.exit(2);return}let r=f_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),W.exit(1);return}p_(".",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?W.stdout.write(`Run: git checkout ${r.gitHead} +`));W.exit(0)}async function e8e(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(()=>(lde(),cde)),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}`),W.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=G(e.cwd??"."),a=n.featuresTouched.map(l=>HO(l,s)),c=`${BH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&W.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.`),W.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function t8e(t={}){try{let e=G();if(fa("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ms(".");Nl(".",r),Ha("."),l5(".");let n=Zl(".");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=dte(".");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=Fx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Vv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),W.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)`),W.exit(0);return}L("pass","sync",`${e.features.length} features valid`),W.exit(0)}catch(e){L("fail","sync",e.message),W.exit(1)}}function r8e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),W.exit(2);return}let e=f_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),W.exit(0)}function n8e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),W.exit(2);return}let r=p_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),W.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?W.stdout.write(`Run: git checkout ${r.gitHead} `):W.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),W.exit(0)}async function n8e(t){let e=await AC({force:t.force,quiet:t.quiet});W.exit(e.errors.length>0?1:0)}async function i8e(){L("note","update","reconciling the current project after the engine upgrade");let t=await oX(".",{wireHosts:async()=>(await AC({quiet:!0})).errors.length});if(L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){L("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),W.exit(t.code);return}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);W.stdout.write(` +`),W.exit(0)}async function i8e(t){let e=await AC({force:t.force,quiet:t.quiet});W.exit(e.errors.length>0?1:0)}async function o8e(){L("note","update","reconciling the current project after the engine upgrade");let t=await oX(".",{wireHosts:async()=>(await AC({quiet:!0})).errors.length});if(L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){L("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),W.exit(t.code);return}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);W.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),uA({tier:"pre-commit",strict:!0}).anyFailed?W.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"),W.exit(t.code)}var o8e={"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 uA(t){let e=t.tier??"all",r=t.silent===!0,n=o8e[e];if(!n)return t.json&&!r?W.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",()=>Um(i)],["stage_1.2",()=>zm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",fj],["stage_1.5",Wa],["stage_1.6",Dp],["stage_2.1",()=>xj({...i,strict:t.strict})],["stage_2.2",()=>pj(i)],["stage_2.3",WP],["stage_2.4",yj],["stage_3.1",_j],["stage_3.2",hj],["stage_3.3",$j],["stage_4.1",uj],["stage_4.2",qm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":oi(d)?"fail":"skip",u=[];O_("."),Mee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:xa(d),h=VY(p);oi(h)&&(c=!0,a=Math.max(a,WY(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),oi(h)&&p8e(p))}}finally{I_(),qee()}if(t.strict)try{let d=G();for(let f of Nee(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"||!oi(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=>oi(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(fa("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{cG(".",G())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?W.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&W.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function s8e(t){try{let e=G(),r=tl(e,t);W.stdout.write(`${JSON.stringify(r,null,2)} -`),W.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),W.exit(1)}}function a8e(t,e={}){try{let r=G(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});W.stdout.write(`${JSON.stringify(i,null,2)} -`),W.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),W.exit(1)}}function c8e(t={}){try{let e=G(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Xv(e,o=>{try{return dde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});W.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),W.exit(0)}catch(e){L("fail","infer-deps",e.message),W.exit(1)}}function l8e(t={}){try{if(t.sessions){See(t);return}if(t.trend!==void 0&&t.trend!==!1){wee(t);return}let e=G(),n=aH(e,o=>{try{return dde(o,"utf8")}catch{return null}},"."),i=lH(".",n);if(t.json)W.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)}`,` ${rl}`];W.stdout.write(`${c.join(` +`),uA({tier:"pre-commit",strict:!0}).anyFailed?W.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"),W.exit(t.code)}var s8e={"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 uA(t){let e=t.tier??"all",r=t.silent===!0,n=s8e[e];if(!n)return t.json&&!r?W.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",()=>qm(i)],["stage_1.2",()=>Um(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",pj],["stage_1.5",Ka],["stage_1.6",Np],["stage_2.1",()=>$j({...i,strict:t.strict})],["stage_2.2",()=>mj(i)],["stage_2.3",WP],["stage_2.4",_j],["stage_3.1",bj],["stage_3.2",gj],["stage_3.3",kj],["stage_4.1",dj],["stage_4.2",Bm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":oi(d)?"fail":"skip",u=[];R_("."),Mee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:xa(d),h=VY(p);oi(h)&&(c=!0,a=Math.max(a,WY(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),oi(h)&&m8e(p))}}finally{P_(),qee()}if(t.strict)try{let d=G();for(let f of Nee(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"||!oi(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=>oi(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(fa("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{lG(".",G())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?W.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&W.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function a8e(t){try{let e=G(),r=rl(e,t);W.stdout.write(`${JSON.stringify(r,null,2)} +`),W.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),W.exit(1)}}function c8e(t,e={}){try{let r=G(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});W.stdout.write(`${JSON.stringify(i,null,2)} +`),W.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),W.exit(1)}}function l8e(t={}){try{let e=G(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Qv(e,o=>{try{return dde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});W.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),W.exit(0)}catch(e){L("fail","infer-deps",e.message),W.exit(1)}}function u8e(t={}){try{if(t.sessions){See(t);return}if(t.trend!==void 0&&t.trend!==!1){wee(t);return}let e=G(),n=cH(e,o=>{try{return dde(o,"utf8")}catch{return null}},"."),i=uH(".",n);if(t.json)W.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)}`,` ${nl}`];W.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)")}W.exit(0)}catch(e){L("fail","measure",e.message),W.exit(1)}}function u8e(t){let e;if(t.feature)try{let n=(G().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),W.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),W.exit(1)}W.exitCode=uA({...t,focusModules:e}).worst}function d8e(t){let e=TY(".",t,{checkStages:uA,onIndex:Ha,gitOpInProgress:uO});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),W.exit(e.code)}function f8e(t,e={}){let r=e.cwd??".",n;try{n=G(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),W.exit(1);return}if(e.required){t&&W.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=f5(n);if(o.length===0){W.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)")}W.exit(0)}catch(e){L("fail","measure",e.message),W.exit(1)}}function d8e(t){let e;if(t.feature)try{let n=(G().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),W.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),W.exit(1)}W.exitCode=uA({...t,focusModules:e}).worst}function f8e(t){let e=TY(".",t,{checkStages:uA,onIndex:Ha,gitOpInProgress:uO});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),W.exit(e.code)}function p8e(t,e={}){let r=e.cwd??".",n;try{n=G(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),W.exit(1);return}if(e.required){t&&W.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=p5(n);if(o.length===0){W.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),W.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";W.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}W.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. `),W.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"),W.exit(1);return}let i=fte(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`),W.exit(1);return}W.stdout.write(`${pte(i)} -`),W.exit(0)}function p8e(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=ude(Pf(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";W.stdout.write(` ${o}${s} [${i.detector}] +`),W.exit(0)}function m8e(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=ude(Cf(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";W.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&W.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` `).find(r=>r.trim().length>0);e&&W.stdout.write(` ${ude(e.trim(),160)} -`)}}function ude(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function m8e(t){let e=G();if(t.json){W.stdout.write(`${JSON.stringify(Lx(e,"."),null,2)} +`)}}function ude(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function h8e(t){let e=G();if(t.json){W.stdout.write(`${JSON.stringify(Lx(e,"."),null,2)} `),W.exitCode=0;return}W.stdout.write(`${mte(e,".",{internal:t.internal})} -`),W.exit(0)}function h8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function g8e(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"),W.exit(1);return}let n;try{let i=G(e),o=Lx(i,e),s={gitHead:ha(e),version:zl(),generatedAt:t.now??new Date().toISOString()},a=ol(i),c;try{let l=t.since??Qo(e),u=es(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:nl(u),auditMarkdown:il(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=eG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),W.exit(1);return}try{JJe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),W.exit(1);return}L("pass","bundle",`${r} \xB7 ${h8e(Buffer.byteLength(n,"utf8"))}`),W.exit(0)}function y8e(t){let e=OA(t);L("note",`route \u2192 ${e}`,t),W.exit(e==="unknown"?1:0)}function _8e(){let t=new Xq;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(XJe),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(QJe),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(e8e),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(n8e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(i8e),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(u8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(t8e),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(d8e),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)=>f8e(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(r8e),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(m8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(s8e),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)=>a8e(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=>tX(r,{checkStages:uA})),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=>c8e(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=>l8e(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=>Pee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Cee()),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=>{Dee(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=>UH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>Z5(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=>g8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(y8e),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(ZY),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(YJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){kY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}K5(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(hee),t}var b8e=!!globalThis.__CLADDING_BUNDLED,v8e=b8e||import.meta.url===`file://${W.argv[1]}`;v8e&&_8e().parse();export{o8e as TIER_STAGES,_8e as createProgram,g8e as runBundleCommand,u8e as runCheckCommand,uA as runCheckStages,t8e as runCheckpointCommand,s8e as runContextCommand,d8e as runDoneCommand,a8e as runImpactCommand,c8e as runInferDepsCommand,XJe as runInitCommand,l8e as runMeasureCommand,f8e as runOracleCommand,r8e as runRollbackCommand,y8e as runRouteCommand,QJe as runRunCommand,YJe as runServeCommand,n8e as runSetupCommand,m8e as runStatusCommand,e8e as runSyncCommand,i8e as runUpdateCommand}; +`),W.exit(0)}function g8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function y8e(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"),W.exit(1);return}let n;try{let i=G(e),o=Lx(i,e),s={gitHead:ha(e),version:Ul(),generatedAt:t.now??new Date().toISOString()},a=sl(i),c;try{let l=t.since??Qo(e),u=es(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:il(u),auditMarkdown:ol(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=tG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),W.exit(1);return}try{YJe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),W.exit(1);return}L("pass","bundle",`${r} \xB7 ${g8e(Buffer.byteLength(n,"utf8"))}`),W.exit(0)}function _8e(t){let e=OA(t);L("note",`route \u2192 ${e}`,t),W.exit(e==="unknown"?1:0)}function b8e(){let t=new Qq;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(QJe),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(e8e),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(t8e),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(i8e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(o8e),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(d8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(r8e),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(f8e),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)=>p8e(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(n8e),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(h8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(a8e),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)=>c8e(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=>tX(r,{checkStages:uA})),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=>l8e(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=>u8e(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=>Pee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Cee()),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=>{Dee(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=>qH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>V5(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=>y8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(_8e),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(ZY),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(XJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){kY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}J5(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(hee),t}var v8e=!!globalThis.__CLADDING_BUNDLED,S8e=v8e||import.meta.url===`file://${W.argv[1]}`;S8e&&b8e().parse();export{s8e as TIER_STAGES,b8e as createProgram,y8e as runBundleCommand,d8e as runCheckCommand,uA as runCheckStages,r8e as runCheckpointCommand,a8e as runContextCommand,f8e as runDoneCommand,c8e as runImpactCommand,l8e as runInferDepsCommand,QJe as runInitCommand,u8e as runMeasureCommand,p8e as runOracleCommand,n8e as runRollbackCommand,_8e as runRouteCommand,e8e as runRunCommand,XJe as runServeCommand,i8e as runSetupCommand,h8e as runStatusCommand,t8e as runSyncCommand,o8e as runUpdateCommand}; diff --git a/scripts/build-plugin.mjs b/scripts/build-plugin.mjs index 241db988..37db48f3 100644 --- a/scripts/build-plugin.mjs +++ b/scripts/build-plugin.mjs @@ -15,11 +15,13 @@ // .mcp.json ← already authored under plugins/codex/ // .codex-plugin/plugin.json ← already authored // -// Gemini CLI (plugins/gemini-cli/, v0.3.6, F-081): +// Legacy Gemini CLI (plugins/gemini-cli/, v0.3.6, F-081): // commands/.toml ← transpiled from repo-root skills//SKILL.md // (frontmatter.description → toml `description`, // body → toml `prompt` as a literal multi-line) // gemini-extension.json + GEMINI.md already authored. +// Retained only so existing installations do not break during migration; +// new setup, verification, and support claims target Antigravity instead. // // The src side stays canonical — every loadPersona() call in the // runtime reads from src/agents. The drift detector enforces lockstep. diff --git a/spec/features/host-smoke-matrix-5283985e.yaml b/spec/features/host-smoke-matrix-5283985e.yaml index 4ea20975..f8b236e1 100644 --- a/spec/features/host-smoke-matrix-5283985e.yaml +++ b/spec/features/host-smoke-matrix-5283985e.yaml @@ -33,6 +33,6 @@ acceptance_criteria: test_refs: [tests/stages/detectors/host-claim-drift.test.ts] - id: AC-6cbe51fc ears: ubiquitous - text: "The system shall grade hosts without a headless verification surface (Cursor) as wiring-only in the matrix, asserting only that the MCP wiring file is written and clad serve answers a tools list over stdio." - notes: "WHY: honest grading — wiring-only is a real, checkable claim; end-to-end is not checkable headlessly for Cursor." + text: "The system shall headlessly prompt-probe Cursor Agent alongside Claude Code, Antigravity, and Codex, and shall additionally record whether Cursor's configured clad serve answers a tools list over stdio." + notes: "WHY: Cursor Agent now provides a headless CLI, so retaining the old wiring-only ceiling would understate directly observed end-to-end evidence." test_refs: [tests/cli/doctor-hosts.test.ts] diff --git a/src/cli/doctor-hosts.ts b/src/cli/doctor-hosts.ts index 2f54bade..4afa2fd4 100644 --- a/src/cli/doctor-hosts.ts +++ b/src/cli/doctor-hosts.ts @@ -1,13 +1,13 @@ // Cladding · `clad doctor --hosts` — host-support smoke matrix (F-5283985e) // // Host verification used to be two hand-written dogfood docs pinned to v0.3.x -// (docs/dogfood/{claude-code,gemini-cli}-2026-05-20.md) — five minor versions +// (docs/dogfood/claude-code-2026-05-20.md) — five minor versions // stale, with Codex deferred and Cursor once over-claimed in the README table. // This module makes every host-support claim trace to a DATED, machine-produced // smoke artifact instead of prose: // -// • runHostSmoke — probes claude / gemini / codex CLIs (≤3 canned one-shot -// prompts each) and Cursor (wiring-only), recording per-host +// • runHostSmoke — probes claude / agy / codex / cursor-agent CLIs (≤3 canned +// one-shot prompts each), recording per-host // pass / fail / not-run with the observed sentinel evidence. // • renderHostMatrix — pure renderer → docs/dogfood/matrix.md. // • parseHostOutput — PURE sentinel matcher, split out so committed transcript @@ -17,9 +17,8 @@ // - Absence of evidence renders as `not-run`, NEVER `pass`. A binary that is // not on PATH, or a run without consent, is not-run — not a silent green. // - Live prompts run ONLY with explicit consent (CLAD_HOST_SMOKE=1 or --yes). -// - Cursor has no headless verification surface, so it is graded `wiring-only`: -// we assert only that the MCP wire is written AND `clad serve` answers a -// tools list over stdio — end-to-end behaviour is not headlessly checkable. +// - Cursor's headless Agent CLI is prompt-probed like every other supported +// host; its MCP wiring is additionally checked without spending model tokens. import {spawnSync} from 'node:child_process'; import {existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync} from 'node:fs'; @@ -45,7 +44,7 @@ export type SurfaceResultKind = 'pass' | 'fail' | 'not-run'; export type HostGrade = 'verified' | 'fail' | 'not-run' | 'wiring-ok' | 'wiring-fail'; /** The prompt-probed CLI hosts (each has a headless one-shot surface). */ -export const PROMPT_HOSTS = ['claude', 'gemini', 'codex'] as const; +export const PROMPT_HOSTS = ['claude', 'antigravity', 'codex', 'cursor'] as const; export type PromptHost = (typeof PROMPT_HOSTS)[number]; /** Result of matching one surface's output against its sentinel. */ @@ -79,7 +78,7 @@ export interface HostSmokeArtifact { readonly generatedAt: string; readonly hosts: { readonly claude: HostRecord; - readonly gemini: HostRecord; + readonly antigravity: HostRecord; readonly codex: HostRecord; readonly cursor: HostRecord; }; @@ -147,8 +146,8 @@ export function parseHostOutput(surface: SurfaceName, text: string, expectedId?: // ──────────────────────────────────────────────────────────────────────────── /** - * The canned prompts, derived from the Gemini dogfood recipes - * (docs/dogfood/gemini-cli-2026-05-20.md), then hardened after the first live + * The canned prompts, derived from the original host dogfood recipes, then + * hardened after the first live * run: an open-ended "list the first 3 features" invited the host to explore * project context instead of calling the tool, grading a healthy host `fail`. * Maximally directive + context-proof: name the exact MCP tool, demand the @@ -165,20 +164,28 @@ export const SURFACE_PROMPTS: Readonly strin /** * How each host CLI runs a single non-interactive prompt: * - claude → `claude -p "" --output-format text` - * - gemini → `gemini --approval-mode yolo -o text -p ""` (dogfood recipe) + * - antigravity → `agy --new-project -p ""` * - codex → `codex exec ""` (Codex's non-interactive one-shot analog) + * - cursor → `cursor-agent -p --mode ask --trust --approve-mcps ""` */ export function buildPromptCommand(host: PromptHost, prompt: string): {command: string; args: string[]} { switch (host) { case 'claude': return {command: 'claude', args: ['-p', prompt, '--output-format', 'text']}; - case 'gemini': - return {command: 'gemini', args: ['--approval-mode', 'yolo', '-o', 'text', '-p', prompt]}; + case 'antigravity': + return {command: 'agy', args: ['--new-project', '-p', prompt]}; case 'codex': return {command: 'codex', args: ['exec', prompt]}; + case 'cursor': + return {command: 'cursor-agent', args: ['-p', '--mode', 'ask', '--trust', '--approve-mcps', prompt]}; } } +/** Executable name corresponding to a public host key. */ +function hostBinary(host: PromptHost): string { + return host === 'antigravity' ? 'agy' : host === 'cursor' ? 'cursor-agent' : host; +} + // ──────────────────────────────────────────────────────────────────────────── // Injectable runners — the seams that keep runHostSmoke unit-testable without // spawning real host CLIs or a real MCP server. @@ -389,14 +396,16 @@ function probePromptHost( } /** - * Cursor wiring-only probe (AC-6cbe51fc). No consent needed — it is free and - * local. Grades: + * Cursor wiring probe (AC-6cbe51fc). No consent needed — it is free and local. + * The prompt probe supplies the overall host grade; this adds structural MCP + * evidence and catches a dead configured server before spending model tokens. + * Wiring grades: * - not-run — ~/.cursor absent (Cursor not installed here) OR no cladding * MCP entry (not wired). Absence of evidence, never a pass. * - wiring-fail — cladding IS wired but `clad serve` does not answer tools/list. * - wiring-ok — wired AND `clad serve` answers a tools list over stdio. */ -function probeCursor(home: string, cwd: string, probeServe: ServeProber): HostRecord { +function probeCursorWiring(home: string, cwd: string, probeServe: ServeProber): HostRecord { const cursorDir = join(home, '.cursor'); const mcpPath = join(cursorDir, 'mcp.json'); if (!existsSync(cursorDir)) { @@ -430,8 +439,8 @@ function probeCursor(home: string, cwd: string, probeServe: ServeProber): HostRe /** * Runs the host smoke matrix. Live host-CLI prompts run only with consent; - * absent-binary and no-consent both render `not-run` (never pass). The Cursor - * wiring check is free/local and always runs. + * absent-binary and no-consent both render `not-run` (never pass). Cursor's + * wiring check is free/local and always runs in addition to its headless probe. */ export function runHostSmoke(cwd: string, opts: HostSmokeOptions = {}): HostSmokeArtifact { const consent = opts.consent ?? false; @@ -445,7 +454,7 @@ export function runHostSmoke(cwd: string, opts: HostSmokeOptions = {}): HostSmok const promptRecords = {} as Record; for (const host of PROMPT_HOSTS) { - if (!hasBinary(host)) { + if (!hasBinary(hostBinary(host))) { promptRecords[host] = notRunPromptHost('binary not on PATH'); } else if (!consent) { promptRecords[host] = notRunPromptHost('consent not given (set CLAD_HOST_SMOKE=1)'); @@ -454,14 +463,27 @@ export function runHostSmoke(cwd: string, opts: HostSmokeOptions = {}): HostSmok } } + const cursorPrompt = promptRecords.cursor; + const cursorWiring = probeCursorWiring(home, cwd, probeServe); + const cursor: HostRecord = { + grade: + cursorWiring.grade === 'wiring-fail' + ? 'fail' + : cursorPrompt.grade, + surfaces: [...cursorPrompt.surfaces, ...cursorWiring.surfaces], + ...((cursorPrompt.reason || cursorWiring.reason) + ? {reason: [cursorPrompt.reason, cursorWiring.reason].filter(Boolean).join('; ')} + : {}), + }; + return { version, generatedAt: now.toISOString(), hosts: { claude: promptRecords.claude, - gemini: promptRecords.gemini, + antigravity: promptRecords.antigravity, codex: promptRecords.codex, - cursor: probeCursor(home, cwd, probeServe), + cursor, }, }; } @@ -474,7 +496,7 @@ export function runHostSmoke(cwd: string, opts: HostSmokeOptions = {}): HostSmok export function matrixGradesFence(artifact: HostSmokeArtifact): string { const grades = { claude: artifact.hosts.claude.grade, - gemini: artifact.hosts.gemini.grade, + antigravity: artifact.hosts.antigravity.grade, codex: artifact.hosts.codex.grade, cursor: artifact.hosts.cursor.grade, }; @@ -488,7 +510,7 @@ function surfaceCell(record: HostRecord, name: string): string { /** * Renders docs/dogfood/matrix.md from an artifact — host × surface × result × - * date × cladding version, plus the wiring-only legend and a machine-readable + * date × cladding version, plus the evidence legend and a machine-readable * grades fence for the drift detector. */ export function renderHostMatrix(artifact: HostSmokeArtifact): string { @@ -507,9 +529,12 @@ export function renderHostMatrix(artifact: HostSmokeArtifact): string { const promptRow = (name: string, r: HostRecord): string => `| ${name} | ${surfaceCell(r, 'list-features')} | ${surfaceCell(r, 'get-feature')} | ${surfaceCell(r, 'run-check')} | — | ${r.grade} |`; lines.push(promptRow('claude', hosts.claude)); - lines.push(promptRow('gemini', hosts.gemini)); + lines.push(promptRow('antigravity', hosts.antigravity)); lines.push(promptRow('codex', hosts.codex)); - lines.push(`| cursor | — | — | — | ${surfaceCell(hosts.cursor, 'wiring')} | ${hosts.cursor.grade} |`); + lines.push( + `| cursor | ${surfaceCell(hosts.cursor, 'list-features')} | ${surfaceCell(hosts.cursor, 'get-feature')} | ` + + `${surfaceCell(hosts.cursor, 'run-check')} | ${surfaceCell(hosts.cursor, 'wiring')} | ${hosts.cursor.grade} |`, + ); lines.push(''); lines.push('**Legend**'); lines.push(''); @@ -517,8 +542,7 @@ export function renderHostMatrix(artifact: HostSmokeArtifact): string { '- `verified` — every probed surface passed its sentinel end-to-end.', ); lines.push( - '- `wiring-only` (Cursor) — no headless verification surface exists, so the host is graded only on ' + - 'whether the MCP wire is written **and** `clad serve` answers a tools list over stdio (`wiring-ok` / `wiring-fail`).', + '- `wiring` — Cursor additionally verifies that its configured `clad serve` answers a tools list over stdio.', ); lines.push( '- `not-run` — absence of evidence (binary absent from PATH, no live-run consent, or host not wired here). ' + @@ -535,7 +559,7 @@ export function renderHostMatrix(artifact: HostSmokeArtifact): string { lines.push( '> Live grades land when a human runs `clad doctor --hosts` with consent ' + '(`CLAD_HOST_SMOKE=1` or `--yes`). Without consent this baseline records only what is checkable ' + - 'for free — Cursor wiring — and leaves the LLM-driven surfaces `not-run`.', + 'for free — Cursor wiring — and leaves all LLM-driven surfaces `not-run`.', ); lines.push(''); return lines.join('\n'); @@ -596,7 +620,27 @@ export function readNewestArtifact(cwd: string): HostSmokeArtifact | null { .reverse(); for (const f of files) { try { - return JSON.parse(readFileSync(join(dir, f), 'utf8')) as HostSmokeArtifact; + const parsed = JSON.parse(readFileSync(join(dir, f), 'utf8')) as { + version?: unknown; + generatedAt?: unknown; + hosts?: Record; + }; + if (typeof parsed.version !== 'string' || typeof parsed.generatedAt !== 'string' || !parsed.hosts) continue; + const fallback = notRunPromptHost('legacy artifact predates this host probe; run `clad doctor --hosts --yes`'); + const claude = parsed.hosts.claude; + const codex = parsed.hosts.codex; + const cursor = parsed.hosts.cursor; + if (!claude || !codex || !cursor) continue; + return { + version: parsed.version, + generatedAt: parsed.generatedAt, + hosts: { + claude, + antigravity: parsed.hosts.antigravity ?? fallback, + codex, + cursor, + }, + }; } catch { continue; } @@ -652,7 +696,10 @@ export function runDoctorHosts(opts: DoctorHostsOptions = {}): void { ? `host smoke complete → ${artifactFile}` : 'no live-run consent — LLM surfaces recorded not-run (set CLAD_HOST_SMOKE=1 to probe)', ); - process.stdout.write(` claude: ${g.claude.grade} gemini: ${g.gemini.grade} codex: ${g.codex.grade} cursor: ${g.cursor.grade}\n`); + process.stdout.write( + ` claude: ${g.claude.grade} antigravity: ${g.antigravity.grade} ` + + `codex: ${g.codex.grade} cursor: ${g.cursor.grade}\n`, + ); process.stdout.write(` artifact: ${artifactFile}\n`); process.stdout.write(` matrix: ${matrixFile}\n`); process.exit(0); diff --git a/src/serve/server.ts b/src/serve/server.ts index 19de49b2..d42dc2e8 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -647,7 +647,8 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp title: 'Apply a validated Cladding onboarding draft', description: 'Write Cladding artifacts from the host model draft returned after clad_prepare_init. ' + - 'Requires its one-time token; malformed, stale, or replayed requests do not write files.', + 'Use the one-time token when the host retained it; process-per-turn hosts may use the exact approval phrase ' + + 'through the short-lived machine-local cache. Malformed, stale, or replayed requests do not write files.', inputSchema: { token: z.string().min(1).max(MAX_APPROVAL_ENVELOPE_BYTES).optional(), confirmation: z.string().min(1).describe('The user\'s separate confirmation reply, verbatim'), diff --git a/tests/cli/doctor-hosts.test.ts b/tests/cli/doctor-hosts.test.ts index cc9c7d2b..845442dc 100644 --- a/tests/cli/doctor-hosts.test.ts +++ b/tests/cli/doctor-hosts.test.ts @@ -11,7 +11,7 @@ // AC-87ebd442 · consent → ≤3 canned prompts/host, record pass/fail/not-run + evidence // AC-8dfa9cc4 · absent binary OR no consent → not-run, NEVER pass; dated artifact // AC-57ab708c · newest-artifact matrix render; parser vs committed fixtures -// AC-6cbe51fc · Cursor graded wiring-only (never verified) via clad serve tools/list +// AC-6cbe51fc · Cursor headless verification plus clad serve tools/list wiring evidence import { mkdirSync, @@ -64,7 +64,7 @@ const ok = (stdout: string): PromptResult => ({stdout, stderr: '', timedOut: fal // ─── AC-57ab708c / AC-87ebd442 · the PURE sentinel parser vs committed fixtures ── describe('parseHostOutput — zero-LLM sentinel matcher against committed transcripts (AC-57ab708c)', () => { - test('list-features: a gemini listing with real F-ids passes', () => { + test('list-features: a committed host listing with real F-ids passes', () => { const p = parseHostOutput('list-features', fixture('gemini-list-features.txt')); expect(p.result).toBe('pass'); expect(p.sentinel).toMatch(/feature id/i); @@ -158,13 +158,14 @@ describe('runHostSmoke with consent — canned probing (AC-87ebd442)', () => { }); // ≤3 canned prompts per host CLI found on PATH. - for (const host of ['claude', 'gemini', 'codex']) { - expect(calls.filter((c) => c.command === host)).toHaveLength(3); + for (const command of ['claude', 'agy', 'codex', 'cursor-agent']) { + expect(calls.filter((c) => c.command === command)).toHaveLength(3); } // All three surfaces passed their sentinel → verified. expect(artifact.hosts.claude.grade).toBe('verified'); - expect(artifact.hosts.gemini.grade).toBe('verified'); + expect(artifact.hosts.antigravity.grade).toBe('verified'); expect(artifact.hosts.codex.grade).toBe('verified'); + expect(artifact.hosts.cursor.grade).toBe('verified'); // Every surface carries its recorded pass + evidence. const claudeSurfaces = artifact.hosts.claude.surfaces; expect(claudeSurfaces.map((s) => s.name)).toEqual(['list-features', 'get-feature', 'run-check']); @@ -194,9 +195,9 @@ describe('runHostSmoke with consent — canned probing (AC-87ebd442)', () => { runPrompt: cannedRunner(calls, fixture('refusal.txt')), home, }); - const list = artifact.hosts.gemini.surfaces.find((s) => s.name === 'list-features'); + const list = artifact.hosts.antigravity.surfaces.find((s) => s.name === 'list-features'); expect(list?.result).toBe('fail'); - expect(artifact.hosts.gemini.grade).toBe('fail'); + expect(artifact.hosts.antigravity.grade).toBe('fail'); }); }); @@ -219,7 +220,7 @@ describe('not-run honesty — absence never renders as a pass (AC-8dfa9cc4)', () test('no consent (binary present) → every prompt host not-run with the consent reason', () => { const artifact = runHostSmoke(dir, {consent: false, hasBinary: () => true, home, version: 'x'}); - for (const host of ['claude', 'gemini', 'codex'] as const) { + for (const host of ['claude', 'antigravity', 'codex', 'cursor'] as const) { const rec = artifact.hosts[host]; expect(rec.grade).toBe('not-run'); expect(rec.reason).toMatch(/consent not given/i); @@ -230,7 +231,7 @@ describe('not-run honesty — absence never renders as a pass (AC-8dfa9cc4)', () test('binary absent from PATH → not-run "binary not on PATH", even with consent', () => { const artifact = runHostSmoke(dir, {consent: true, hasBinary: () => false, home}); - for (const host of ['claude', 'gemini', 'codex'] as const) { + for (const host of ['claude', 'antigravity', 'codex', 'cursor'] as const) { expect(artifact.hosts[host].grade).toBe('not-run'); expect(artifact.hosts[host].reason).toMatch(/not on PATH/i); } @@ -286,7 +287,7 @@ function mkArtifact(over: Partial = {}): HostSmokeArtifact { {name: 'run-check', result: 'pass', sentinel: 'a drift verdict', evidence: 'RED 2 findings'}, ], }, - gemini: {grade: 'not-run', surfaces: [], reason: 'consent not given (set CLAD_HOST_SMOKE=1)'}, + antigravity: {grade: 'not-run', surfaces: [], reason: 'consent not given (set CLAD_HOST_SMOKE=1)'}, codex: {grade: 'not-run', surfaces: [], reason: 'binary not on PATH'}, cursor: { grade: 'wiring-ok', @@ -298,7 +299,7 @@ function mkArtifact(over: Partial = {}): HostSmokeArtifact { } describe('renderHostMatrix — pure matrix generator (AC-57ab708c)', () => { - test('emits host × surface × result × date × version + grades fence + wiring-only legend', () => { + test('emits host × surface × result × date × version + grades fence + wiring evidence legend', () => { const md = renderHostMatrix(mkArtifact()); expect(md).toContain('# Host support matrix'); expect(md).toContain('| Host | list-features | get-feature | run-check | wiring | Grade |'); @@ -309,8 +310,7 @@ describe('renderHostMatrix — pure matrix generator (AC-57ab708c)', () => { expect(md).toMatch(/\| cursor \| — \| — \| — \| pass \| wiring-ok \|/); // The machine-readable fence the detector reads. expect(md).toContain(matrixGradesFence(mkArtifact())); - // The wiring-only legend (Cursor honesty note). - expect(md).toContain('wiring-only'); + expect(md).toContain('Cursor additionally verifies'); }); test('matrixGradesFence is the four host grades as a parseable JSON comment', () => { @@ -318,7 +318,7 @@ describe('renderHostMatrix — pure matrix generator (AC-57ab708c)', () => { const json = fence.replace('', ''); expect(JSON.parse(json)).toEqual({ claude: 'verified', - gemini: 'not-run', + antigravity: 'not-run', codex: 'not-run', cursor: 'wiring-ok', }); @@ -353,6 +353,20 @@ describe('newest-artifact selection + --matrix-only (AC-57ab708c)', () => { expect(newest?.generatedAt).toBe('2026-07-01T00:00:00.000Z'); }); + test('legacy Gemini artifacts load without relabeling old evidence as Antigravity', () => { + const auditDir = join(dir, '.cladding', 'audit'); + const legacy = mkArtifact() as unknown as {version: string; generatedAt: string; hosts: Record}; + legacy.hosts.gemini = legacy.hosts.antigravity; + delete legacy.hosts.antigravity; + legacy.generatedAt = '2026-08-01T00:00:00.000Z'; + writeFileSync(join(auditDir, 'host-smoke-2026-08-01.json'), JSON.stringify(legacy, null, 2)); + + const newest = readNewestArtifact(dir); + + expect(newest?.hosts.antigravity.grade).toBe('not-run'); + expect(newest?.hosts.antigravity.reason).toMatch(/legacy artifact/i); + }); + test('--matrix-only regenerates from the newest artifact and is idempotent', () => { const exitSpy = vi.spyOn(process, 'exit').mockImplementation((() => undefined) as never); const stdoutSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true); @@ -373,7 +387,7 @@ describe('newest-artifact selection + --matrix-only (AC-57ab708c)', () => { }); }); -// ─── AC-6cbe51fc · Cursor wiring-only (never verified) ─────────────────────────── +// ─── AC-6cbe51fc · Cursor headless prompt + wiring evidence ───────────────────── describe('parseServeToolsList — the clad serve tools/list probe (AC-6cbe51fc)', () => { test('a tools/list response containing clad_list_features → ok (wiring-ok)', () => { @@ -397,7 +411,7 @@ describe('parseServeToolsList — the clad serve tools/list probe (AC-6cbe51fc)' }); }); -describe('Cursor is graded wiring-only, never verified (AC-6cbe51fc)', () => { +describe('Cursor is headlessly verified and carries separate wiring evidence (AC-6cbe51fc)', () => { let dir: string; let home: string; @@ -420,49 +434,57 @@ describe('Cursor is graded wiring-only, never verified (AC-6cbe51fc)', () => { ); }; - test('wired + serve answers tools/list → wiring-ok (a checkable wiring claim, not verified)', () => { + const passingRunner: PromptRunner = (_command, args) => { + const joined = args.join(' '); + if (joined.includes('clad_list_features')) return ok(fixture('gemini-list-features.txt')); + if (joined.includes('clad_get_feature')) return ok(fixture('get-feature-echo.txt')); + if (joined.includes('clad_run_check')) return ok(fixture('run-check-drift.txt')); + return ok(''); + }; + + test('headless prompts pass and wired serve answers tools/list → verified', () => { wireCursor(); const artifact = runHostSmoke(dir, { consent: true, - hasBinary: () => false, + hasBinary: () => true, + runPrompt: passingRunner, home, probeServe: () => ({ok: true, toolCount: 4, evidence: 'tools/list → 4 tools'}), }); - expect(artifact.hosts.cursor.grade).toBe('wiring-ok'); - expect(artifact.hosts.cursor.grade).not.toBe('verified'); + expect(artifact.hosts.cursor.grade).toBe('verified'); const wiring = artifact.hosts.cursor.surfaces.find((s) => s.name === 'wiring'); expect(wiring?.result).toBe('pass'); + expect(artifact.hosts.cursor.surfaces.filter((s) => s.name !== 'wiring').every((s) => s.result === 'pass')).toBe(true); }); - test('wired but serve does not answer → wiring-fail, never verified', () => { + test('headless prompts pass but configured serve does not answer → fail', () => { wireCursor(); const artifact = runHostSmoke(dir, { consent: true, - hasBinary: () => false, + hasBinary: () => true, + runPrompt: passingRunner, home, probeServe: () => ({ok: false, toolCount: 0, evidence: 'no tools/list response'}), }); - expect(artifact.hosts.cursor.grade).toBe('wiring-fail'); - expect(artifact.hosts.cursor.grade).not.toBe('verified'); + expect(artifact.hosts.cursor.grade).toBe('fail'); }); - test('not wired here (~/.cursor absent) → not-run, never a silent pass', () => { + test('binary absent and not wired here → not-run, never a silent pass', () => { const artifact = runHostSmoke(dir, {consent: true, hasBinary: () => false, home}); expect(artifact.hosts.cursor.grade).toBe('not-run'); - expect(artifact.hosts.cursor.reason).toMatch(/Cursor not detected/i); + expect(artifact.hosts.cursor.reason).toMatch(/binary not on PATH/i); }); - test('the rendered matrix never grades cursor verified', () => { + test('the rendered matrix records Cursor prompt surfaces and wiring', () => { wireCursor(); const artifact = runHostSmoke(dir, { consent: true, - hasBinary: () => false, + hasBinary: () => true, + runPrompt: passingRunner, home, probeServe: () => ({ok: true, toolCount: 4, evidence: 'ok'}), }); const md = renderHostMatrix(artifact); - // cursor row exists and its grade cell is a wiring-* class, never verified. - expect(md).toMatch(/\| cursor \|.*\| (wiring-ok|wiring-fail|not-run) \|/); - expect(md).not.toMatch(/\| cursor \|.*\| verified \|/); + expect(md).toMatch(/\| cursor \| pass \| pass \| pass \| pass \| verified \|/); }); }); From b1aecfc9faaab543cf2855e54f415f14f7184041 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 15 Jul 2026 00:05:35 +0900 Subject: [PATCH 15/28] chore: refresh verification attestation --- spec/attestation.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/attestation.yaml b/spec/attestation.yaml index b8cdaad8..9f7e7aee 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -21,10 +21,10 @@ attested_modules: CHANGELOG.md: d437104f3e6b98c3 CLAUDE.md: d81d8832976cd5ee GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 2c51bb11832c7844 - README.ko.html: c6a0ad7c2e4c42dd - README.ko.md: 1890a603a0185c73 - README.md: 06bb2a2d52b06ac0 + README.html: 227583ec95375954 + README.ko.html: 5ea397c6e72ff11b + README.ko.md: 30e8134c403232b1 + README.md: 09323b6557720aca SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -88,7 +88,7 @@ attested_modules: plugins/gemini-cli/commands/README.md: 3527d771578431bd plugins/gemini-cli/commands/init.toml: a91afdccf4206c59 plugins/gemini-cli/gemini-extension.json: 47685e98f1f67e11 - scripts/build-plugin.mjs: f2b96f80a0b52134 + scripts/build-plugin.mjs: 7fabe2b6301b142a scripts/build.mjs: 3a4b204063024ef1 scripts/migrate-dogfood-v0.3.16.mjs: 1e265fb370019996 scripts/shard-spec.ts: 0c728bbc1e869421 @@ -140,7 +140,7 @@ attested_modules: src/cli/changelog.ts: 2de1adb009b89ab4 src/cli/clad.ts: e75a16da5809a319 src/cli/clarify.ts: 393cc93a6feb698a - src/cli/doctor-hosts.ts: 1ad79105b47fd8e5 + src/cli/doctor-hosts.ts: b6e47f8c5d545416 src/cli/doctor.ts: b98b955fe75e7f7e src/cli/done.ts: 02bd4397eaf34fa1 src/cli/graph-serve.ts: 23e6e389225d0f98 @@ -218,7 +218,7 @@ attested_modules: src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 - src/serve/server.ts: 4d4e341e3d05a706 + src/serve/server.ts: 4b78c2a2a87b5741 src/spec: a4d0f0eb87fed960 src/spec/attestation.ts: 294a1e99c42d4aef src/spec/cli.ts: 7a9bcd0f66677810 From 944e4cbf776a3aa961a471460b5ac695acc4d194 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 15 Jul 2026 00:14:13 +0900 Subject: [PATCH 16/28] docs: clarify pending Claude onboarding validation --- docs/setup.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/setup.md b/docs/setup.md index 185947cf..e9db4959 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -19,13 +19,16 @@ the detail behind them: where each host is wired, how the MCP server works, and auto-discovers its wired plugin directory after restart. It is safe to re-run after an upgrade or after installing a new AI tool. -**Verification level (honesty note).** Claude Code is fully verified through real-usage -campaigns (including real-time intervention). Codex onboarding is live-verified for idea, -planning-document, existing-project, and uninitialized control cases. Antigravity 1.1.0 is also -live-verified for all three onboarding cases plus the uninitialized control case. Cursor Agent -`2026.07.09-a3815c0` is live-verified for the same four cases through its headless CLI and global -MCP configuration. (The machine-readable claim lives in the README's `clad:host-claims` -fence, which `HOST_CLAIM_DRIFT` polices against `docs/dogfood/matrix.md`.) +**Verification level (honesty note).** Claude Code's MCP/runtime surfaces and real-time +intervention are verified through earlier real-usage campaigns; the natural-language onboarding +flow introduced in this release has not yet been re-run live on Claude Code and remains a pending +host campaign. Codex onboarding is live-verified for idea, planning-document, existing-project, +and uninitialized control cases. Antigravity 1.1.0 is also live-verified for all three onboarding +cases plus the uninitialized control case. Cursor Agent `2026.07.09-a3815c0` is live-verified for +the same four cases through its headless CLI and global MCP configuration. (The machine-readable +claim lives in the README's `clad:host-claims` fence, which `HOST_CLAIM_DRIFT` polices against +`docs/dogfood/matrix.md`; its `verified` grade covers the doctor surfaces listed in that matrix, +not every release-specific onboarding campaign.) ## About the MCP server From 49debd21daf831293969715132f50366faa51f43 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 15 Jul 2026 10:13:40 +0900 Subject: [PATCH 17/28] feat(setup): scope host activation to projects --- README.ja.md | 16 +- README.ko.md | 16 +- README.md | 31 +- README.zh.md | 16 +- docs/setup.md | 35 +- plugins/antigravity/skills/init/SKILL.md | 2 +- plugins/claude-code/commands/init.md | 2 +- plugins/claude-code/dist/clad.js | 756 ++++++++------- plugins/codex/skills/init/SKILL.md | 2 +- plugins/gemini-cli/commands/init.toml | 2 +- skills/init/SKILL.md | 2 +- .../natural-language-init-0f4dd6.yaml | 42 +- src/cli/clad.ts | 29 +- src/cli/doctor-hosts.ts | 21 +- src/cli/init.ts | 26 +- src/cli/update.ts | 15 +- src/init/host-setup.ts | 870 ++++++++---------- src/serve/server.ts | 27 +- tests/cli/doctor-hosts.test.ts | 6 +- .../init-onboarding-english-source.test.ts | 20 +- tests/cli/setup.test.ts | 419 ++------- tests/cli/update.test.ts | 6 +- tests/docs-prune.test.ts | 14 +- tests/serve/gate-footer-unavailable.test.ts | 6 +- tests/serve/init-tools.test.ts | 4 +- tests/serve/server.test.ts | 11 + 26 files changed, 1038 insertions(+), 1358 deletions(-) diff --git a/README.ja.md b/README.ja.md index fb46f177..f3d46bd0 100644 --- a/README.ja.md +++ b/README.ja.md @@ -245,15 +245,15 @@ cladding の差別化点は *組み合わせ* にある — 上のカテゴリ ```bash npm install -g cladding # cladding CLI をインストール -clad setup # AI ツールを自動配線(Claude · Codex · Antigravity · Cursor) ``` -二つのコマンドはどのディレクトリからでも実行できる。`clad setup` はこのマシンにインストール済みの AI ツールを接続するだけで、プロジェクトファイルは作成・変更しない。対応する AI ツールを後から追加した場合は、`clad setup` だけを再実行する。 +このコマンドはどのディレクトリからでも実行できる。CLI だけをインストールし、AI モデルのコンテキストにはまだ Cladding を追加しない。 -### 2. プロジェクトから AI ツールを起動する +### 2. 使用するプロジェクトだけを有効化し、AI ツールを起動する ```bash cd +clad setup # このプロジェクトだけに Cladding を接続する # 一つだけ選び、先頭の「#」を外して実行する: # codex # Codex @@ -262,7 +262,7 @@ cd # cursor-agent # Cursor Agent ``` -使用する AI ツールのコマンドを一つだけ実行する。Cursor IDE の場合は `` をワークスペースとして開く。`clad setup` の後は必ず新しい AI セッションを開始する。`cd` だけで終えてはいけない。 +`clad setup` は Claude Code・Codex・Antigravity・Cursor の接続を現在のプロジェクト内だけに作る。setup を実行していない別プロジェクトのモデルコンテキストには、Cladding の skill や MCP ツールは入らない。使用する AI ツールのコマンドを一つだけ実行し、Cursor IDE では `` をワークスペースとして開く。setup 後はこのフォルダから新しい AI セッションを開始する。Codex が Git リポジトリを初めて開いて信頼確認を表示した場合は承認する。信頼されるまで Codex はプロジェクト MCP 設定を意図的に読み込まない。 ### 3. Cladding を一度適用する @@ -320,13 +320,11 @@ AI ツールにターミナルとグローバルインストールの権限が ```bash npm update -g cladding # 1. 新しいバージョンを入れる -clad setup # 2. このマシンの AI ツール接続を更新する - -cd # 3. Cladding プロジェクトへ移動 -clad update # 4. プロジェクトをインストール済みバージョンに合わせる +cd # 2. Cladding プロジェクトへ移動 +clad update # 3. プロジェクト接続と派生状態を更新する ``` -最初の二つはマシンの更新ごとに一度だけ実行する。`clad update` は更新する各 Cladding プロジェクトで実行する。ユーザーが作成したコード・機能や spec の本文・ドキュメントは保持され、派生データと Cladding 管理の指示ブロックだけが更新される場合がある。新しいバージョンが乖離を報告したら、その結果を AI ツールに渡せばよい: +`clad update` は更新する各 Cladding プロジェクトで実行する。プロジェクト単位の setup も同時に更新するため、別途 `clad setup` を実行する必要はない。ユーザーが作成したコード・機能や spec の本文・ドキュメントは保持され、派生データと Cladding 管理の指示ブロックだけが更新される場合がある。新しいバージョンが乖離を報告したら、その結果を AI ツールに渡せばよい: ``` 更新で指摘された乖離を解消して。 diff --git a/README.ko.md b/README.ko.md index aa2a2962..1c49464c 100644 --- a/README.ko.md +++ b/README.ko.md @@ -244,15 +244,15 @@ cladding의 차별점은 *결합* — 위 카테고리의 핵심을 *하나의 ```bash npm install -g cladding # cladding CLI 설치 -clad setup # AI 도구 자동 연결 (Claude · Codex · Antigravity · Cursor) ``` -두 명령은 어느 디렉터리에서든 실행할 수 있다. `clad setup`은 이 컴퓨터에 이미 설치된 AI 도구를 연결할 뿐 프로젝트 파일을 만들거나 수정하지 않는다. 지원하는 AI 도구를 나중에 추가했다면 `clad setup`만 다시 실행한다. +이 단계는 어느 디렉터리에서 실행해도 된다. CLI만 설치하며 AI 도구에는 아직 Cladding 정보가 들어가지 않는다. -### 2. 프로젝트에서 AI 도구 실행하기 +### 2. 사용할 프로젝트만 연결하고 AI 도구 실행하기 ```bash cd +clad setup # 이 프로젝트에만 AI 도구 연결 # 정확히 하나를 골라 앞의 '#'을 지우고 실행한다: # codex # Codex @@ -261,7 +261,7 @@ cd # cursor-agent # Cursor Agent ``` -자신이 사용하는 AI 도구의 명령 하나만 실행하면 된다. Cursor IDE는 `` 폴더를 작업공간으로 연다. `clad setup` 뒤에는 반드시 AI 도구를 새 세션으로 시작한다. `cd`만 실행하고 끝내면 안 된다. +`clad setup`은 현재 프로젝트에만 Claude Code · Codex · Antigravity · Cursor 연결을 만든다. 설정하지 않은 다른 프로젝트의 모델 컨텍스트에는 Cladding skill이나 MCP 도구가 들어가지 않는다. Cursor IDE는 `` 폴더를 작업공간으로 연다. setup 뒤에는 반드시 이 폴더에서 AI 도구를 새 세션으로 시작한다. Codex가 Git 저장소를 처음 열며 프로젝트 신뢰 여부를 물으면 승인한다. Codex는 신뢰하기 전까지 프로젝트 MCP 설정을 의도적으로 무시한다. ### 3. 프로젝트에 Cladding 한 번 적용하기 @@ -319,13 +319,11 @@ AI 도구에 터미널 및 전역 설치 권한이 있으면 CLI 업데이트, ```bash npm update -g cladding # 1. 새 버전 받기 -clad setup # 2. 이 컴퓨터의 AI 도구 연결 갱신 - -cd # 3. Cladding 프로젝트로 이동 -clad update # 4. 프로젝트를 설치된 버전에 맞추기 +cd # 2. Cladding 프로젝트로 이동 +clad update # 3. 프로젝트 연결과 파생 데이터를 함께 갱신 ``` -앞의 두 명령은 컴퓨터에서 업데이트할 때 한 번만 실행한다. `clad update`는 업데이트하려는 각 Cladding 프로젝트에서 실행한다. 사용자가 작성한 코드 · 기능/스펙 본문 · 문서는 보존되며, 파생 데이터와 Cladding 관리 지침 블록만 갱신될 수 있다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다: +`clad update`는 업데이트하려는 각 Cladding 프로젝트에서 실행한다. 사용자가 작성한 코드 · 기능/스펙 본문 · 문서는 보존되며, 프로젝트 전용 호스트 연결과 파생 데이터, `AGENTS.md`의 Cladding 관리 블록만 갱신될 수 있다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다: ``` 업데이트가 짚은 어긋남을 정리해줘. diff --git a/README.md b/README.md index 83839682..8d26b9a4 100644 --- a/README.md +++ b/README.md @@ -240,17 +240,16 @@ The distinction is the *combination* — binding those cores into *one verificat ### 1. Install once on your machine ```bash -npm install -g cladding # the cladding CLI -clad setup # auto-wire your AI tools (Claude · Codex · Antigravity · Cursor) +npm install -g cladding # install only the cladding CLI ``` -Run both commands from any directory. `clad setup` connects the AI tools already installed on this -machine; it does not create or modify project files. Run it again after adding another supported AI tool. +This command may be run from any directory. It does not add Cladding to any AI model's context. -### 2. Start your AI tool from the project +### 2. Activate one project, then start your AI tool ```bash cd +clad setup # connect Cladding only to this project # Choose exactly one and remove its leading '#': # codex # Codex @@ -259,8 +258,12 @@ cd # cursor-agent # Cursor Agent ``` -Use only the command for your AI tool. For Cursor IDE, open `` as the workspace instead. -Always start a new AI session after `clad setup`; changing directory alone is not enough. +`clad setup` creates project-local connections for Claude Code, Codex, Antigravity, and Cursor. It +does not expose Cladding skills or MCP tools in projects where setup was not run. Use only the command +for your AI tool; for Cursor IDE, open `` as the workspace. Start a new AI session from this +folder after setup so the host discovers the project-local connection. When Codex first opens a Git +repository, approve its normal project-trust prompt; Codex intentionally ignores project MCP config +until the repository is trusted. ### 3. Apply Cladding once @@ -323,16 +326,14 @@ updates the current project, and explains any new drift. Otherwise, it shows the ### Or update from the terminal ```bash -npm update -g cladding # 1. get the new version -clad setup # 2. refresh this machine's AI-tool connections - -cd # 3. enter a Cladding project -clad update # 4. align that project with the installed version +npm update -g cladding # 1. get the new CLI version +cd # 2. enter one Cladding project +clad update # 3. refresh its host wiring and derived state ``` -Run the first two commands once per machine update. Run `clad update` in each Cladding project you -want to upgrade. It preserves authored code, feature/spec content, and documentation; only derived -data and Cladding-managed instruction blocks may be refreshed. If the new version reports drift, +Run `clad update` in each Cladding project you want to upgrade. It also performs the project-scoped +setup refresh, so a separate `clad setup` is unnecessary. It preserves authored code, feature/spec +content, and documentation; only derived data and Cladding-managed instruction blocks may be refreshed. If the new version reports drift, hand that result to your AI tool: ``` diff --git a/README.zh.md b/README.zh.md index 146bd573..7f08495b 100644 --- a/README.zh.md +++ b/README.zh.md @@ -241,15 +241,15 @@ cladding 的独到之处在于*组合* —— 把上述品类的内核,绑进* ```bash npm install -g cladding # 安装 cladding CLI -clad setup # 自动接通你的 AI 工具(Claude · Codex · Antigravity · Cursor) ``` -这两条命令可以在任何目录运行。`clad setup` 只连接这台电脑上已经安装的 AI 工具,不会创建或修改项目文件。以后新增支持的 AI 工具时,只需再次运行 `clad setup`。 +这条命令可以在任何目录运行。它只安装 CLI,不会把 Cladding 加入任何 AI 模型的上下文。 -### 2. 从项目中启动 AI 工具 +### 2. 只激活要使用的项目,然后启动 AI 工具 ```bash cd +clad setup # 只为这个项目连接 Cladding # 只选择一个,并删除行首的“#”后运行: # codex # Codex @@ -258,7 +258,7 @@ cd # cursor-agent # Cursor Agent ``` -只需运行自己所用 AI 工具对应的一条命令。使用 Cursor IDE 时,把 `` 作为工作区打开。运行 `clad setup` 后必须启动一个新的 AI 会话;不能只执行 `cd` 就结束。 +`clad setup` 只在当前项目内创建 Claude Code、Codex、Antigravity 和 Cursor 的连接。没有运行 setup 的其他项目,其模型上下文不会出现 Cladding skill 或 MCP 工具。只需运行自己所用 AI 工具对应的一条命令;使用 Cursor IDE 时,把 `` 作为工作区打开。setup 后请从此文件夹启动新的 AI 会话。Codex 首次打开 Git 仓库并询问是否信任项目时,请确认信任;在此之前,Codex 会有意忽略项目 MCP 配置。 ### 3. 为项目应用一次 Cladding @@ -316,13 +316,11 @@ Cladding 会扫描现有代码,并把观察到的模式与你的意图结合 ```bash npm update -g cladding # 1. 取得新版本 -clad setup # 2. 刷新这台电脑上的 AI 工具连接 - -cd # 3. 进入 Cladding 项目 -clad update # 4. 让项目与已安装版本对齐 +cd # 2. 进入 Cladding 项目 +clad update # 3. 刷新项目连接和派生状态 ``` -前两条命令每次更新在电脑上只需运行一次。`clad update` 需要在每个要升级的 Cladding 项目中运行。用户编写的代码、功能/spec 正文和文档会保留;只有派生数据和 Cladding 管理的指令区块可能被刷新。如果新版本报告了漂移,把结果交给 AI 工具即可: +`clad update` 需要在每个要升级的 Cladding 项目中运行。它会同时刷新项目级 setup,因此不必另外运行 `clad setup`。用户编写的代码、功能/spec 正文和文档会保留;只有派生数据和 Cladding 管理的指令区块可能被刷新。如果新版本报告了漂移,把结果交给 AI 工具即可: ``` 修复这次更新标出的漂移。 diff --git a/docs/setup.md b/docs/setup.md index e9db4959..648af76f 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -5,19 +5,22 @@ The README covers the setup command and the natural-language request that follows it. This page is the detail behind them: where each host is wired, how the MCP server works, and how to upgrade. -## Where `clad setup` connects (4 hosts · 5 wire points) +## Project activation boundary -| Host (when detected) | Wired location | Auto-activation | -|---|---|---| -| Claude Code (`~/.claude/`) | `~/.claude/plugins/cladding` | `claude plugin marketplace add` + `install` | -| Codex CLI skills (`~/.agents/`) | `~/.agents/skills/cladding-*` | (auto on Codex restart) | -| Codex CLI MCP server (`~/.codex/`) | `[mcp_servers.cladding]` in `~/.codex/config.toml` | (TOML entry itself) | -| Antigravity (`agy`) | `~/.gemini/config/plugins/cladding` | (auto on AGY restart) | -| Cursor (`~/.cursor/`) | `mcpServers.cladding` in `~/.cursor/mcp.json` | (JSON entry itself) | +`npm install -g cladding` installs only the CLI. Run `clad setup` **inside each project that should use Cladding**. Nothing is installed into a host's global skill or MCP catalog. + +| Host | Project-scoped location | +|---|---| +| Claude Code | `.claude/skills/cladding-init` + `.mcp.json` | +| Codex CLI | `.agents/skills/cladding-init` + `.codex/config.toml` | +| Antigravity (`agy`) | `.agents/skills/cladding-init` + `.agents/mcp_config.json` | +| Cursor | `.cursor/skills/cladding-init` + `.cursor/mcp.json` + bootstrap rule | + +The only machine-specific path lives in `.cladding/host/serve.cjs`, which is ignored project runtime state. Re-run setup on each developer machine. Host config files use the portable relative launcher path and preserve unrelated entries. + +Codex loads `.codex/config.toml` only for a trusted Git repository. Accept Codex's normal project-trust prompt when opening the repository; this is a Codex security boundary and `clad setup` does not bypass or pre-approve it. -`clad setup` invokes Claude Code's activation command when `claude` is on PATH. Antigravity -auto-discovers its wired plugin directory after restart. It is safe to re-run after an upgrade or -after installing a new AI tool. +On upgrade, setup removes legacy global Cladding wires only when their ownership is provable. Ambiguous or hand-edited files are preserved and reported. If an old Claude user plugin remains, run `claude plugin uninstall claude-code@cladding --scope user --keep-data`. **Verification level (honesty note).** Claude Code's MCP/runtime surfaces and real-time intervention are verified through earlier real-usage campaigns; the natural-language onboarding @@ -51,18 +54,18 @@ project, asking about Cladding, or running `clad setup` are not consent. |---|---|---| | Claude Code | `Apply Cladding to this project` | `/cladding:init` | | Codex | `Apply Cladding to this project` | Type `$cladding`, then choose `init (cladding)` | -| Antigravity | `Apply Cladding to this project` | `/cladding:init` from the installed plugin | +| Antigravity | `Apply Cladding to this project` | Select the project-local `cladding-init` skill | | Cursor IDE / Agent | `Apply Cladding to this project` | Natural language routes through the connected onboarding tool | ## Upgrading ```bash npm update -g cladding # 1. install the new version -clad setup # 2. refresh this machine's host wiring -cd # 3. once per project -clad update # 4. bring it in line with the new version +cd # 2. select one Cladding project +clad update # 3. refresh project wiring + derived state ``` Your authored code, feature/spec content, and documentation are preserved. The command may refresh -derived inventory/index data and the Cladding-managed block in `AGENTS.md` or `CLAUDE.md`. If the +derived inventory/index data and the Cladding-managed block in `AGENTS.md`. Existing `CLAUDE.md` +files are preserved and Cladding does not create a new one. If the newer version is stricter, it only **points out** drift — it does not rewrite authored project intent. diff --git a/plugins/antigravity/skills/init/SKILL.md b/plugins/antigravity/skills/init/SKILL.md index 99200e94..48a8c488 100644 --- a/plugins/antigravity/skills/init/SKILL.md +++ b/plugins/antigravity/skills/init/SKILL.md @@ -1,5 +1,5 @@ --- -description: Scaffold a Cladding workspace from a new idea, a planning document, or an existing project. Use the MCP prepare/apply flow so the current host model drafts domain-aware artifacts without requiring MCP sampling or a shell command. +description: Use only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it; never use for an ordinary project creation or implementation request. Scaffold from an idea, planning document, or existing project through the MCP prepare/apply flow. --- # Cladding init diff --git a/plugins/claude-code/commands/init.md b/plugins/claude-code/commands/init.md index 99200e94..48a8c488 100644 --- a/plugins/claude-code/commands/init.md +++ b/plugins/claude-code/commands/init.md @@ -1,5 +1,5 @@ --- -description: Scaffold a Cladding workspace from a new idea, a planning document, or an existing project. Use the MCP prepare/apply flow so the current host model drafts domain-aware artifacts without requiring MCP sampling or a shell command. +description: Use only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it; never use for an ordinary project creation or implementation request. Scaffold from an idea, planning document, or existing project through the MCP prepare/apply flow. --- # Cladding init diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 50f90d5a..f967aaff 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 pde=Object.create;var dA=Object.defineProperty;var mde=Object.getOwnPropertyDescriptor;var hde=Object.getOwnPropertyNames;var gde=Object.getPrototypeOf,yde=Object.prototype.hasOwnProperty;var He=(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)dA(t,r,{get:e[r],enumerable:!0})},_de=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hde(e))!yde.call(t,i)&&i!==r&&dA(t,i,{get:()=>e[i],enumerable:!(n=mde(e,i))||n.enumerable});return t};var bt=(t,e,r)=>(r=t!=null?pde(gde(t)):{},_de(e||!t||!t.__esModule?dA(r,"default",{value:t,enumerable:!0}):r,t));var Wd=v(pA=>{var iy=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 iy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};pA.CommanderError=iy;pA.InvalidArgumentError=fA});var oy=v(hA=>{var{InvalidArgumentError:bde}=Wd(),mA=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 bde(`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 vde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}hA.Argument=mA;hA.humanReadableArgName=vde});var _A=v(yA=>{var{humanReadableArgName:Sde}=oy(),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=>Sde(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 zq(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)fA(t,r,{get:e[r],enumerable:!0})},_de=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hde(e))!yde.call(t,i)&&i!==r&&fA(t,i,{get:()=>e[i],enumerable:!(n=mde(e,i))||n.enumerable});return t};var vt=(t,e,r)=>(r=t!=null?pde(gde(t)):{},_de(e||!t||!t.__esModule?fA(r,"default",{value:t,enumerable:!0}):r,t));var Wd=v(mA=>{var iy=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}},pA=class extends iy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};mA.CommanderError=iy;mA.InvalidArgumentError=pA});var oy=v(gA=>{var{InvalidArgumentError:bde}=Wd(),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 bde(`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 vde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}gA.Argument=hA;gA.humanReadableArgName=vde});var bA=v(_A=>{var{humanReadableArgName:Sde}=oy(),yA=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=>Sde(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 Hq(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 zq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}yA.Help=gA;yA.stripColor=zq});var wA=v(SA=>{var{InvalidArgumentError:wde}=Wd(),bA=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=xde(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 wde(`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?Uq(this.name().replace(/^no-/,"")):Uq(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 Uq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function xde(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 Hq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}_A.Help=yA;_A.stripColor=Hq});var xA=v(wA=>{var{InvalidArgumentError:wde}=Wd(),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=xde(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 wde(`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?Gq(this.name().replace(/^no-/,"")):Gq(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}},SA=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 Gq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function xde(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}}SA.Option=bA;SA.DualOptions=vA});var Bq=v(qq=>{function $de(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 kde(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=$de(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=vA;wA.DualOptions=SA});var Vq=v(Zq=>{function $de(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 kde(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=$de(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]}?)`:""}qq.suggestSimilar=kde});var Vq=v(AA=>{var Ede=He("node:events").EventEmitter,xA=He("node:child_process"),ao=He("node:path"),sy=He("node:fs"),Ue=He("node:process"),{Argument:Ade,humanReadableArgName:Tde}=oy(),{CommanderError:$A}=Wd(),{Help:Ode,stripColor:Rde}=_A(),{Option:Hq,DualOptions:Ide}=wA(),{suggestSimilar:Gq}=Bq(),kA=class t extends Ede{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>EA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>EA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Rde(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 Ode,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]}?)`:""}Zq.suggestSimilar=kde});var Yq=v(OA=>{var Ede=He("node:events").EventEmitter,$A=He("node:child_process"),so=He("node:path"),sy=He("node:fs"),Ue=He("node:process"),{Argument:Ade,humanReadableArgName:Ode}=oy(),{CommanderError:kA}=Wd(),{Help:Tde,stripColor:Rde}=bA(),{Option:Wq,DualOptions:Ide}=xA(),{suggestSimilar:Kq}=Vq(),EA=class t extends Ede{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>AA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>AA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Rde(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 Tde,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 Ade(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 $A(e,r,n)),Ue.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 Hq(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 Hq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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. +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 kA(e,r,n)),Ue.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 Wq(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 Wq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(sy.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=ao.resolve(u,d);if(sy.existsSync(f))return f;if(i.includes(ao.extname(d)))return;let p=i.find(m=>sy.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=sy.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=ao.resolve(ao.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=ao.basename(this._scriptPath,ao.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(ao.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Zq(Ue.execArgv).concat(r),c=xA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=xA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Zq(Ue.execArgv).concat(r),c=xA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 $A(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new $A(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=so.resolve(u,d);if(sy.existsSync(f))return f;if(i.includes(so.extname(d)))return;let p=i.find(m=>sy.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=sy.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=so.resolve(so.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=so.basename(this._scriptPath,so.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(so.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Jq(Ue.execArgv).concat(r),c=$A.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=$A.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Jq(Ue.execArgv).concat(r),c=$A.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 kA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new kA(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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Ide(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=Gq(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=Gq(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=>Tde(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=ao.basename(e,ao.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(Ue.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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Ide(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=Kq(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=Kq(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=>Ode(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=so.basename(e,so.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(Ue.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 Zq(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 EA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}AA.Command=kA;AA.useColor=EA});var Yq=v(xn=>{var{Argument:Wq}=oy(),{Command:TA}=Vq(),{CommanderError:Pde,InvalidArgumentError:Kq}=Wd(),{Help:Cde}=_A(),{Option:Jq}=wA();xn.program=new TA;xn.createCommand=t=>new TA(t);xn.createOption=(t,e)=>new Jq(t,e);xn.createArgument=(t,e)=>new Wq(t,e);xn.Command=TA;xn.Option=Jq;xn.Argument=Wq;xn.Help=Cde;xn.CommanderError=Pde;xn.InvalidArgumentError=Kq;xn.InvalidOptionArgumentError=Kq});var Ce=v(Xt=>{"use strict";var RA=Symbol.for("yaml.alias"),t4=Symbol.for("yaml.document"),ay=Symbol.for("yaml.map"),r4=Symbol.for("yaml.pair"),IA=Symbol.for("yaml.scalar"),cy=Symbol.for("yaml.seq"),co=Symbol.for("yaml.node.type"),Lde=t=>!!t&&typeof t=="object"&&t[co]===RA,zde=t=>!!t&&typeof t=="object"&&t[co]===t4,Ude=t=>!!t&&typeof t=="object"&&t[co]===ay,qde=t=>!!t&&typeof t=="object"&&t[co]===r4,n4=t=>!!t&&typeof t=="object"&&t[co]===IA,Bde=t=>!!t&&typeof t=="object"&&t[co]===cy;function i4(t){if(t&&typeof t=="object")switch(t[co]){case ay:case cy:return!0}return!1}function Hde(t){if(t&&typeof t=="object")switch(t[co]){case RA:case ay:case IA:case cy:return!0}return!1}var Gde=t=>(n4(t)||i4(t))&&!!t.anchor;Xt.ALIAS=RA;Xt.DOC=t4;Xt.MAP=ay;Xt.NODE_TYPE=co;Xt.PAIR=r4;Xt.SCALAR=IA;Xt.SEQ=cy;Xt.hasAnchor=Gde;Xt.isAlias=Lde;Xt.isCollection=i4;Xt.isDocument=zde;Xt.isMap=Ude;Xt.isNode=Hde;Xt.isPair=qde;Xt.isScalar=n4;Xt.isSeq=Bde});var Kd=v(PA=>{"use strict";var Lt=Ce(),Cr=Symbol("break visit"),o4=Symbol("skip children"),$i=Symbol("remove node");function ly(t,e){let r=s4(e);Lt.isDocument(t)?Bc(null,t.contents,r,Object.freeze([t]))===$i&&(t.contents=null):Bc(null,t,r,Object.freeze([]))}ly.BREAK=Cr;ly.SKIP=o4;ly.REMOVE=$i;function Bc(t,e,r,n){let i=a4(t,e,r,n);if(Lt.isNode(i)||Lt.isPair(i))return c4(t,n,i),Bc(t,i,r,n);if(typeof i!="symbol"){if(Lt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var l4=Ce(),Zde=Kd(),Vde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Wde=t=>t.replace(/[!,[\]{}]/g,e=>Vde[e]),Jd=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+Wde(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&&l4.isNode(e.contents)){let o={};Zde.visit(e.contents,(s,a)=>{l4.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(` -`)}};Jd.defaultYaml={explicit:!1,version:"1.2"};Jd.defaultTags={"!!":"tag:yaml.org,2002:"};u4.Directives=Jd});var dy=v(Yd=>{"use strict";var d4=Ce(),Kde=Kd();function Jde(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 f4(t){let e=new Set;return Kde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function p4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Yde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=f4(t));let s=p4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(d4.isScalar(s.node)||d4.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}}Yd.anchorIsValid=Jde;Yd.anchorNames=f4;Yd.createNodeAnchors=Yde;Yd.findNewAnchor=p4});var DA=v(m4=>{"use strict";function Xd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Xde=Ce();function h4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>h4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Xde.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}g4.toJS=h4});var fy=v(_4=>{"use strict";var Qde=DA(),y4=Ce(),efe=Bo(),NA=class{constructor(e){Object.defineProperty(this,y4.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(!y4.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=efe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Qde.applyReviver(o,{"":a},"",a):a}};_4.NodeBase=NA});var Qd=v(b4=>{"use strict";var tfe=dy(),rfe=Kd(),Gc=Ce(),nfe=fy(),ife=Bo(),jA=class extends nfe.NodeBase{constructor(e){super(Gc.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=[],rfe.visit(e,{Node:(o,s)=>{(Gc.isAlias(s)||Gc.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||(ife.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=py(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(tfe.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 py(t,e,r){if(Gc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Gc.isCollection(e)){let n=0;for(let i of e.items){let o=py(t,i,r);o>n&&(n=o)}return n}else if(Gc.isPair(e)){let n=py(t,e.key,r),i=py(t,e.value,r);return Math.max(n,i)}return 1}b4.Alias=jA});var Pt=v(MA=>{"use strict";var ofe=Ce(),sfe=fy(),afe=Bo(),cfe=t=>!t||typeof t!="function"&&typeof t!="object",Ho=class extends sfe.NodeBase{constructor(e){super(ofe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:afe.toJS(this.value,e,r)}toString(){return String(this.value)}};Ho.BLOCK_FOLDED="BLOCK_FOLDED";Ho.BLOCK_LITERAL="BLOCK_LITERAL";Ho.PLAIN="PLAIN";Ho.QUOTE_DOUBLE="QUOTE_DOUBLE";Ho.QUOTE_SINGLE="QUOTE_SINGLE";MA.Scalar=Ho;MA.isScalarValue=cfe});var ef=v(S4=>{"use strict";var lfe=Qd(),sa=Ce(),v4=Pt(),ufe="tag:yaml.org,2002:";function dfe(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 ffe(t,e,r){if(sa.isDocument(t)&&(t=t.contents),sa.isNode(t))return t;if(sa.isPair(t)){let d=r.schema[sa.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 lfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=ufe+e.slice(2));let l=dfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new v4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[sa.MAP]:Symbol.iterator in Object(t)?s[sa.SEQ]:s[sa.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 v4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}S4.createNode=ffe});var hy=v(my=>{"use strict";var pfe=ef(),ki=Ce(),mfe=fy();function FA(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 pfe.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 w4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,LA=class extends mfe.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=>ki.isNode(n)||ki.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(w4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(ki.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,FA(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(ki.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&&ki.isScalar(o)?o.value:o:ki.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!ki.isPair(r))return!1;let n=r.value;return n==null||e&&ki.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 ki.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(ki.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,FA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};my.Collection=LA;my.collectionFromPath=FA;my.isEmptyPath=w4});var tf=v(gy=>{"use strict";var hfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function zA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var gfe=(t,e,r)=>t.endsWith(` -`)?zA(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 Jq(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 AA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}OA.Command=EA;OA.useColor=AA});var t4=v(xn=>{var{Argument:Xq}=oy(),{Command:TA}=Yq(),{CommanderError:Pde,InvalidArgumentError:Qq}=Wd(),{Help:Cde}=bA(),{Option:e4}=xA();xn.program=new TA;xn.createCommand=t=>new TA(t);xn.createOption=(t,e)=>new e4(t,e);xn.createArgument=(t,e)=>new Xq(t,e);xn.Command=TA;xn.Option=e4;xn.Argument=Xq;xn.Help=Cde;xn.CommanderError=Pde;xn.InvalidArgumentError=Qq;xn.InvalidOptionArgumentError=Qq});var Ce=v(Xt=>{"use strict";var IA=Symbol.for("yaml.alias"),o4=Symbol.for("yaml.document"),ay=Symbol.for("yaml.map"),s4=Symbol.for("yaml.pair"),PA=Symbol.for("yaml.scalar"),cy=Symbol.for("yaml.seq"),ao=Symbol.for("yaml.node.type"),Lde=t=>!!t&&typeof t=="object"&&t[ao]===IA,zde=t=>!!t&&typeof t=="object"&&t[ao]===o4,Ude=t=>!!t&&typeof t=="object"&&t[ao]===ay,qde=t=>!!t&&typeof t=="object"&&t[ao]===s4,a4=t=>!!t&&typeof t=="object"&&t[ao]===PA,Bde=t=>!!t&&typeof t=="object"&&t[ao]===cy;function c4(t){if(t&&typeof t=="object")switch(t[ao]){case ay:case cy:return!0}return!1}function Hde(t){if(t&&typeof t=="object")switch(t[ao]){case IA:case ay:case PA:case cy:return!0}return!1}var Gde=t=>(a4(t)||c4(t))&&!!t.anchor;Xt.ALIAS=IA;Xt.DOC=o4;Xt.MAP=ay;Xt.NODE_TYPE=ao;Xt.PAIR=s4;Xt.SCALAR=PA;Xt.SEQ=cy;Xt.hasAnchor=Gde;Xt.isAlias=Lde;Xt.isCollection=c4;Xt.isDocument=zde;Xt.isMap=Ude;Xt.isNode=Hde;Xt.isPair=qde;Xt.isScalar=a4;Xt.isSeq=Bde});var Kd=v(CA=>{"use strict";var Lt=Ce(),Cr=Symbol("break visit"),l4=Symbol("skip children"),xi=Symbol("remove node");function ly(t,e){let r=u4(e);Lt.isDocument(t)?Hc(null,t.contents,r,Object.freeze([t]))===xi&&(t.contents=null):Hc(null,t,r,Object.freeze([]))}ly.BREAK=Cr;ly.SKIP=l4;ly.REMOVE=xi;function Hc(t,e,r,n){let i=d4(t,e,r,n);if(Lt.isNode(i)||Lt.isPair(i))return f4(t,n,i),Hc(t,i,r,n);if(typeof i!="symbol"){if(Lt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var p4=Ce(),Zde=Kd(),Vde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Wde=t=>t.replace(/[!,[\]{}]/g,e=>Vde[e]),Jd=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+Wde(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&&p4.isNode(e.contents)){let o={};Zde.visit(e.contents,(s,a)=>{p4.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(` +`)}};Jd.defaultYaml={explicit:!1,version:"1.2"};Jd.defaultTags={"!!":"tag:yaml.org,2002:"};m4.Directives=Jd});var dy=v(Yd=>{"use strict";var h4=Ce(),Kde=Kd();function Jde(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 g4(t){let e=new Set;return Kde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function y4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Yde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=g4(t));let s=y4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(h4.isScalar(s.node)||h4.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}}Yd.anchorIsValid=Jde;Yd.anchorNames=g4;Yd.createNodeAnchors=Yde;Yd.findNewAnchor=y4});var NA=v(_4=>{"use strict";function Xd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Xde=Ce();function b4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>b4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Xde.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}v4.toJS=b4});var fy=v(w4=>{"use strict";var Qde=NA(),S4=Ce(),efe=Bo(),jA=class{constructor(e){Object.defineProperty(this,S4.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(!S4.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=efe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Qde.applyReviver(o,{"":a},"",a):a}};w4.NodeBase=jA});var Qd=v(x4=>{"use strict";var tfe=dy(),rfe=Kd(),Zc=Ce(),nfe=fy(),ife=Bo(),MA=class extends nfe.NodeBase{constructor(e){super(Zc.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=[],rfe.visit(e,{Node:(o,s)=>{(Zc.isAlias(s)||Zc.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||(ife.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=py(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(tfe.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 py(t,e,r){if(Zc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Zc.isCollection(e)){let n=0;for(let i of e.items){let o=py(t,i,r);o>n&&(n=o)}return n}else if(Zc.isPair(e)){let n=py(t,e.key,r),i=py(t,e.value,r);return Math.max(n,i)}return 1}x4.Alias=MA});var Ct=v(FA=>{"use strict";var ofe=Ce(),sfe=fy(),afe=Bo(),cfe=t=>!t||typeof t!="function"&&typeof t!="object",Ho=class extends sfe.NodeBase{constructor(e){super(ofe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:afe.toJS(this.value,e,r)}toString(){return String(this.value)}};Ho.BLOCK_FOLDED="BLOCK_FOLDED";Ho.BLOCK_LITERAL="BLOCK_LITERAL";Ho.PLAIN="PLAIN";Ho.QUOTE_DOUBLE="QUOTE_DOUBLE";Ho.QUOTE_SINGLE="QUOTE_SINGLE";FA.Scalar=Ho;FA.isScalarValue=cfe});var ef=v(k4=>{"use strict";var lfe=Qd(),ca=Ce(),$4=Ct(),ufe="tag:yaml.org,2002:";function dfe(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 ffe(t,e,r){if(ca.isDocument(t)&&(t=t.contents),ca.isNode(t))return t;if(ca.isPair(t)){let d=r.schema[ca.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 lfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=ufe+e.slice(2));let l=dfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new $4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ca.MAP]:Symbol.iterator in Object(t)?s[ca.SEQ]:s[ca.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 $4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}k4.createNode=ffe});var hy=v(my=>{"use strict";var pfe=ef(),$i=Ce(),mfe=fy();function LA(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 pfe.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 E4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,zA=class extends mfe.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=>$i.isNode(n)||$i.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(E4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if($i.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,LA(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($i.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&&$i.isScalar(o)?o.value:o:$i.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!$i.isPair(r))return!1;let n=r.value;return n==null||e&&$i.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 $i.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($i.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,LA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};my.Collection=zA;my.collectionFromPath=LA;my.isEmptyPath=E4});var tf=v(gy=>{"use strict";var hfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function UA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var gfe=(t,e,r)=>t.endsWith(` +`)?UA(r,e):r.includes(` `)?` -`+zA(r,e):(t.endsWith(" ")?"":" ")+r;gy.indentComment=zA;gy.lineComment=gfe;gy.stringifyComment=hfe});var $4=v(rf=>{"use strict";var yfe="flow",UA="block",yy="quoted";function _fe(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===UA&&(h=x4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===yy&&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===UA&&(h=x4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+UA(r,e):(t.endsWith(" ")?"":" ")+r;gy.indentComment=UA;gy.lineComment=gfe;gy.stringifyComment=hfe});var O4=v(rf=>{"use strict";var yfe="flow",qA="block",yy="quoted";function _fe(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===qA&&(h=A4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===yy&&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===qA&&(h=A4(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===yy){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 Vn=Pt(),Go=$4(),by=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),vy=t=>/^(%|---|\.\.\.)/m.test(t);function bfe(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 Vn=Ct(),Go=O4(),by=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),vy=t=>/^(%|---|\.\.\.)/m.test(t);function bfe(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 nf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(vy(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(BA,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{O=!0});let A=Go.foldFlowLines(`${_}${w}${p}`,l,Go.FOLD_BLOCK,T);if(!O)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),T=!1,O=by(n,!0);s!=="folded"&&e!==Vn.Scalar.BLOCK_FOLDED&&(O.onOverflow=()=>{T=!0});let A=Go.foldFlowLines(`${_}${w}${p}`,l,Go.FOLD_BLOCK,O);if(!T)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} ${l}${_}${r}${p}`}function vfe(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 Zc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?Zc(o,e):_y(t,e,r,n);if(!a&&!u&&i!==Vn.Scalar.PLAIN&&o.includes(` -`))return _y(t,e,r,n);if(vy(o)){if(c==="")return e.forceBlockIndent=!0,_y(t,e,r,n);if(a&&c===l)return Zc(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 Zc(o,e)}return a?d:Go.foldFlowLines(d,c,Go.FOLD_FLOW,by(e,!1))}function Sfe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Zc(s.value,e):_y(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return nf(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return qA(s.value,e);case Vn.Scalar.PLAIN:return vfe(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}k4.stringifyString=Sfe});var sf=v(HA=>{"use strict";var wfe=dy(),Zo=Ce(),xfe=tf(),$fe=of();function kfe(t,e){let r=Object.assign({blockQuote:!0,commentString:xfe.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 Efe(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(Zo.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 Afe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Zo.isScalar(t)||Zo.isCollection(t))&&t.anchor;o&&wfe.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 Tfe(t,e,r,n){if(Zo.isPair(t))return t.toString(e,r,n);if(Zo.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=Zo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Efe(e.doc.schema.tags,o));let s=Afe(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):Zo.isScalar(o)?$fe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Zo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}HA.createStringifyContext=kfe;HA.stringify=Tfe});var O4=v(T4=>{"use strict";var lo=Ce(),E4=Pt(),A4=sf(),af=tf();function Ofe({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=lo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(lo.isCollection(t)||!lo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||lo.isCollection(t)||(lo.isScalar(t)?t.type===E4.Scalar.BLOCK_FOLDED||t.type===E4.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=A4.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+=af.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=af.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=af.lineComment(g,r.indent,l(f))));let b,_,S;lo.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&&lo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&lo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=A4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` -`:"",_){let T=l(_);O+=` -${af.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` -`&&S&&(O=` - -`):O+=` -${r.indent}`}else if(!p&&lo.isCollection(e)){let T=w[0],A=w.indexOf(` -`),D=A!==-1,E=r.inFlow??e.flow??e.items.length===0;if(D||!E){let q=!1;if(D&&(T==="&"||T==="!")){let Q=w.indexOf(" ");T==="&"&&Q!==-1&&Q'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?Vc(o,e):_y(t,e,r,n);if(!a&&!u&&i!==Vn.Scalar.PLAIN&&o.includes(` +`))return _y(t,e,r,n);if(vy(o)){if(c==="")return e.forceBlockIndent=!0,_y(t,e,r,n);if(a&&c===l)return Vc(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 Vc(o,e)}return a?d:Go.foldFlowLines(d,c,Go.FOLD_FLOW,by(e,!1))}function Sfe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Vc(s.value,e):_y(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return nf(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return BA(s.value,e);case Vn.Scalar.PLAIN:return vfe(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}T4.stringifyString=Sfe});var sf=v(GA=>{"use strict";var wfe=dy(),Zo=Ce(),xfe=tf(),$fe=of();function kfe(t,e){let r=Object.assign({blockQuote:!0,commentString:xfe.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 Efe(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(Zo.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 Afe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Zo.isScalar(t)||Zo.isCollection(t))&&t.anchor;o&&wfe.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 Ofe(t,e,r,n){if(Zo.isPair(t))return t.toString(e,r,n);if(Zo.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=Zo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Efe(e.doc.schema.tags,o));let s=Afe(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):Zo.isScalar(o)?$fe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Zo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}GA.createStringifyContext=kfe;GA.stringify=Ofe});var C4=v(P4=>{"use strict";var co=Ce(),R4=Ct(),I4=sf(),af=tf();function Tfe({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=co.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(co.isCollection(t)||!co.isNode(t)&&typeof t=="object"){let O="With simple keys, collection cannot be used as a key value";throw new Error(O)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||co.isCollection(t)||(co.isScalar(t)?t.type===R4.Scalar.BLOCK_FOLDED||t.type===R4.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=I4.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+=af.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=af.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=af.lineComment(g,r.indent,l(f))));let b,_,S;co.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&&co.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&co.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=I4.stringify(e,r,()=>x=!0,()=>h=!0),T=" ";if(f||b||_){if(T=b?` +`:"",_){let O=l(_);T+=` +${af.indentComment(O,r.indent)}`}w===""&&!r.inFlow?T===` +`&&S&&(T=` + +`):T+=` +${r.indent}`}else if(!p&&co.isCollection(e)){let O=w[0],A=w.indexOf(` +`),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let se=!1;if(D&&(O==="&"||O==="!")){let Y=w.indexOf(" ");O==="&"&&Y!==-1&&Y{"use strict";var R4=He("process");function Rfe(t,...e){t==="debug"&&console.log(...e)}function Ife(t,e){(t==="debug"||t==="warn")&&(typeof R4.emitWarning=="function"?R4.emitWarning(e):console.warn(e))}GA.debug=Rfe;GA.warn=Ife});var ky=v($y=>{"use strict";var xy=Ce(),I4=Pt(),Sy="<<",wy={identify:t=>t===Sy||typeof t=="symbol"&&t.description===Sy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new I4.Scalar(Symbol(Sy)),{addToJSMap:P4}),stringify:()=>Sy},Pfe=(t,e)=>(wy.identify(e)||xy.isScalar(e)&&(!e.type||e.type===I4.Scalar.PLAIN)&&wy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===wy.tag&&r.default);function P4(t,e,r){let n=C4(t,r);if(xy.isSeq(n))for(let i of n.items)VA(t,e,i);else if(Array.isArray(n))for(let i of n)VA(t,e,i);else VA(t,e,n)}function VA(t,e,r){let n=C4(t,r);if(!xy.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 C4(t,e){return t&&xy.isAlias(e)?e.resolve(t.doc,t):e}$y.addMergeToJSMap=P4;$y.isMergeKey=Pfe;$y.merge=wy});var KA=v(j4=>{"use strict";var Cfe=ZA(),D4=ky(),Dfe=sf(),N4=Ce(),WA=Bo();function Nfe(t,e,{key:r,value:n}){if(N4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(D4.isMergeKey(t,r))D4.addMergeToJSMap(t,e,n);else{let i=WA.toJS(r,"",t);if(e instanceof Map)e.set(i,WA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=jfe(r,i,t),s=WA.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 jfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(N4.isNode(t)&&r?.doc){let n=Dfe.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)+'..."'),Cfe.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)}j4.addPairToJSMap=Nfe});var Vo=v(JA=>{"use strict";var M4=ef(),Mfe=O4(),Ffe=KA(),Ey=Ce();function Lfe(t,e,r){let n=M4.createNode(t,void 0,r),i=M4.createNode(e,void 0,r);return new Ay(n,i)}var Ay=class t{constructor(e,r=null){Object.defineProperty(this,Ey.NODE_TYPE,{value:Ey.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Ey.isNode(r)&&(r=r.clone(e)),Ey.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Ffe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Mfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};JA.Pair=Ay;JA.createPair=Lfe});var YA=v(L4=>{"use strict";var aa=Ce(),F4=sf(),Ty=tf();function zfe(t,e,r){return(e.inFlow??t.flow?qfe:Ufe)(t,e,r)}function Ufe({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+=Ty.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 D4=He("process");function Rfe(t,...e){t==="debug"&&console.log(...e)}function Ife(t,e){(t==="debug"||t==="warn")&&(typeof D4.emitWarning=="function"?D4.emitWarning(e):console.warn(e))}ZA.debug=Rfe;ZA.warn=Ife});var ky=v($y=>{"use strict";var xy=Ce(),N4=Ct(),Sy="<<",wy={identify:t=>t===Sy||typeof t=="symbol"&&t.description===Sy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new N4.Scalar(Symbol(Sy)),{addToJSMap:j4}),stringify:()=>Sy},Pfe=(t,e)=>(wy.identify(e)||xy.isScalar(e)&&(!e.type||e.type===N4.Scalar.PLAIN)&&wy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===wy.tag&&r.default);function j4(t,e,r){let n=M4(t,r);if(xy.isSeq(n))for(let i of n.items)WA(t,e,i);else if(Array.isArray(n))for(let i of n)WA(t,e,i);else WA(t,e,n)}function WA(t,e,r){let n=M4(t,r);if(!xy.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 M4(t,e){return t&&xy.isAlias(e)?e.resolve(t.doc,t):e}$y.addMergeToJSMap=j4;$y.isMergeKey=Pfe;$y.merge=wy});var JA=v(z4=>{"use strict";var Cfe=VA(),F4=ky(),Dfe=sf(),L4=Ce(),KA=Bo();function Nfe(t,e,{key:r,value:n}){if(L4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(F4.isMergeKey(t,r))F4.addMergeToJSMap(t,e,n);else{let i=KA.toJS(r,"",t);if(e instanceof Map)e.set(i,KA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=jfe(r,i,t),s=KA.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 jfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(L4.isNode(t)&&r?.doc){let n=Dfe.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)+'..."'),Cfe.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)}z4.addPairToJSMap=Nfe});var Vo=v(YA=>{"use strict";var U4=ef(),Mfe=C4(),Ffe=JA(),Ey=Ce();function Lfe(t,e,r){let n=U4.createNode(t,void 0,r),i=U4.createNode(e,void 0,r);return new Ay(n,i)}var Ay=class t{constructor(e,r=null){Object.defineProperty(this,Ey.NODE_TYPE,{value:Ey.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Ey.isNode(r)&&(r=r.clone(e)),Ey.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Ffe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Mfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};YA.Pair=Ay;YA.createPair=Lfe});var XA=v(B4=>{"use strict";var la=Ce(),q4=sf(),Oy=tf();function zfe(t,e,r){return(e.inFlow??t.flow?qfe:Ufe)(t,e,r)}function Ufe({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+=Oy.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+=Ty.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?` +`+Oy.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function qfe({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+=Oy.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 Oy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Ty.indentComment(e(n),t);r.push(o.trimStart())}}L4.stringifyCollection=zfe});var Ko=v(QA=>{"use strict";var Bfe=YA(),Hfe=KA(),Gfe=hy(),Wo=Ce(),Ry=Vo(),Zfe=Pt();function cf(t,e){let r=Wo.isScalar(e)?e.value:e;for(let n of t)if(Wo.isPair(n)&&(n.key===e||n.key===r||Wo.isScalar(n.key)&&n.key.value===r))return n}var XA=class extends Gfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Wo.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(Ry.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;Wo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Ry.Pair(e,e?.value):n=new Ry.Pair(e.key,e.value);let i=cf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Wo.isScalar(i.value)&&Zfe.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=cf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=cf(this.items,e)?.value;return(!r&&Wo.isScalar(i)?i.value:i)??void 0}has(e){return!!cf(this.items,e)}set(e,r){this.add(new Ry.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)Hfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Wo.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})),Bfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};QA.YAMLMap=XA;QA.findPair=cf});var Vc=v(U4=>{"use strict";var Vfe=Ce(),z4=Ko(),Wfe={collection:"map",default:!0,nodeClass:z4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Vfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>z4.YAMLMap.from(t,e,r)};U4.map=Wfe});var Jo=v(q4=>{"use strict";var Kfe=ef(),Jfe=YA(),Yfe=hy(),Py=Ce(),Xfe=Pt(),Qfe=Bo(),eT=class extends Yfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Py.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Iy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Iy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Py.isScalar(i)?i.value:i}has(e){let r=Iy(e);return typeof r=="number"&&r=0?e:null}q4.YAMLSeq=eT});var Wc=v(H4=>{"use strict";var epe=Ce(),B4=Jo(),tpe={collection:"seq",default:!0,nodeClass:B4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return epe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>B4.YAMLSeq.from(t,e,r)};H4.seq=tpe});var lf=v(G4=>{"use strict";var rpe=of(),npe={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),rpe.stringifyString(t,e,r,n)}};G4.string=npe});var Cy=v(W4=>{"use strict";var Z4=Pt(),V4={identify:t=>t==null,createNode:()=>new Z4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Z4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&V4.test.test(t)?t:e.options.nullStr};W4.nullTag=V4});var tT=v(J4=>{"use strict";var ipe=Pt(),K4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new ipe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&K4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};J4.boolTag=K4});var Kc=v(Y4=>{"use strict";function ope({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}Y4.stringifyNumber=ope});var nT=v(Dy=>{"use strict";var spe=Pt(),rT=Kc(),ape={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},cpe={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)}},lpe={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 spe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:rT.stringifyNumber};Dy.float=lpe;Dy.floatExp=cpe;Dy.floatNaN=ape});var oT=v(jy=>{"use strict";var X4=Kc(),Ny=t=>typeof t=="bigint"||Number.isInteger(t),iT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function Q4(t,e,r){let{value:n}=t;return Ny(n)&&n>=0?r+n.toString(e):X4.stringifyNumber(t)}var upe={identify:t=>Ny(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=>Q4(t,8,"0o")},dpe={identify:Ny,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>iT(t,0,10,r),stringify:X4.stringifyNumber},fpe={identify:t=>Ny(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=>Q4(t,16,"0x")};jy.int=dpe;jy.intHex=fpe;jy.intOct=upe});var t6=v(e6=>{"use strict";var ppe=Vc(),mpe=Cy(),hpe=Wc(),gpe=lf(),ype=tT(),sT=nT(),aT=oT(),_pe=[ppe.map,hpe.seq,gpe.string,mpe.nullTag,ype.boolTag,aT.intOct,aT.int,aT.intHex,sT.floatNaN,sT.floatExp,sT.float];e6.schema=_pe});var i6=v(n6=>{"use strict";var bpe=Pt(),vpe=Vc(),Spe=Wc();function r6(t){return typeof t=="bigint"||Number.isInteger(t)}var My=({value:t})=>JSON.stringify(t),wpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:My},{identify:t=>t==null,createNode:()=>new bpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:My},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:My},{identify:r6,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})=>r6(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:My}],xpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},$pe=[vpe.map,Spe.seq].concat(wpe,xpe);n6.schema=$pe});var lT=v(o6=>{"use strict";var uf=He("buffer"),cT=Pt(),kpe=of(),Epe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof uf.Buffer=="function")return uf.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 Fy=Ce(),uT=Vo(),Ape=Pt(),Tpe=Jo();function s6(t,e){if(Fy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new uT.Pair(new Ape.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Ty({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Oy.indentComment(e(n),t);r.push(o.trimStart())}}B4.stringifyCollection=zfe});var Ko=v(eO=>{"use strict";var Bfe=XA(),Hfe=JA(),Gfe=hy(),Wo=Ce(),Ry=Vo(),Zfe=Ct();function cf(t,e){let r=Wo.isScalar(e)?e.value:e;for(let n of t)if(Wo.isPair(n)&&(n.key===e||n.key===r||Wo.isScalar(n.key)&&n.key.value===r))return n}var QA=class extends Gfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Wo.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(Ry.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;Wo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Ry.Pair(e,e?.value):n=new Ry.Pair(e.key,e.value);let i=cf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Wo.isScalar(i.value)&&Zfe.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=cf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=cf(this.items,e)?.value;return(!r&&Wo.isScalar(i)?i.value:i)??void 0}has(e){return!!cf(this.items,e)}set(e,r){this.add(new Ry.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)Hfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Wo.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})),Bfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};eO.YAMLMap=QA;eO.findPair=cf});var Wc=v(G4=>{"use strict";var Vfe=Ce(),H4=Ko(),Wfe={collection:"map",default:!0,nodeClass:H4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Vfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>H4.YAMLMap.from(t,e,r)};G4.map=Wfe});var Jo=v(Z4=>{"use strict";var Kfe=ef(),Jfe=XA(),Yfe=hy(),Py=Ce(),Xfe=Ct(),Qfe=Bo(),tO=class extends Yfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Py.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Iy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Iy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Py.isScalar(i)?i.value:i}has(e){let r=Iy(e);return typeof r=="number"&&r=0?e:null}Z4.YAMLSeq=tO});var Kc=v(W4=>{"use strict";var epe=Ce(),V4=Jo(),tpe={collection:"seq",default:!0,nodeClass:V4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return epe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>V4.YAMLSeq.from(t,e,r)};W4.seq=tpe});var lf=v(K4=>{"use strict";var rpe=of(),npe={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),rpe.stringifyString(t,e,r,n)}};K4.string=npe});var Cy=v(X4=>{"use strict";var J4=Ct(),Y4={identify:t=>t==null,createNode:()=>new J4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new J4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Y4.test.test(t)?t:e.options.nullStr};X4.nullTag=Y4});var rO=v(e6=>{"use strict";var ipe=Ct(),Q4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new ipe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&Q4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};e6.boolTag=Q4});var Jc=v(t6=>{"use strict";function ope({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}t6.stringifyNumber=ope});var iO=v(Dy=>{"use strict";var spe=Ct(),nO=Jc(),ape={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:nO.stringifyNumber},cpe={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():nO.stringifyNumber(t)}},lpe={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 spe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:nO.stringifyNumber};Dy.float=lpe;Dy.floatExp=cpe;Dy.floatNaN=ape});var sO=v(jy=>{"use strict";var r6=Jc(),Ny=t=>typeof t=="bigint"||Number.isInteger(t),oO=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function n6(t,e,r){let{value:n}=t;return Ny(n)&&n>=0?r+n.toString(e):r6.stringifyNumber(t)}var upe={identify:t=>Ny(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>oO(t,2,8,r),stringify:t=>n6(t,8,"0o")},dpe={identify:Ny,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>oO(t,0,10,r),stringify:r6.stringifyNumber},fpe={identify:t=>Ny(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>oO(t,2,16,r),stringify:t=>n6(t,16,"0x")};jy.int=dpe;jy.intHex=fpe;jy.intOct=upe});var o6=v(i6=>{"use strict";var ppe=Wc(),mpe=Cy(),hpe=Kc(),gpe=lf(),ype=rO(),aO=iO(),cO=sO(),_pe=[ppe.map,hpe.seq,gpe.string,mpe.nullTag,ype.boolTag,cO.intOct,cO.int,cO.intHex,aO.floatNaN,aO.floatExp,aO.float];i6.schema=_pe});var c6=v(a6=>{"use strict";var bpe=Ct(),vpe=Wc(),Spe=Kc();function s6(t){return typeof t=="bigint"||Number.isInteger(t)}var My=({value:t})=>JSON.stringify(t),wpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:My},{identify:t=>t==null,createNode:()=>new bpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:My},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:My},{identify:s6,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})=>s6(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:My}],xpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},$pe=[vpe.map,Spe.seq].concat(wpe,xpe);a6.schema=$pe});var uO=v(l6=>{"use strict";var uf=He("buffer"),lO=Ct(),kpe=of(),Epe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof uf.Buffer=="function")return uf.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 Fy=Ce(),dO=Vo(),Ape=Ct(),Ope=Jo();function u6(t,e){if(Fy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new dO.Pair(new Ape.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]=Fy.isPair(n)?n:new uT.Pair(n)}}else e("Expected a sequence for this tag");return t}function a6(t,e,r){let{replacer:n}=r,i=new Tpe.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(uT.createPair(a,c,r))}return i}var Ope={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:s6,createNode:a6};Ly.createPairs=a6;Ly.pairs=Ope;Ly.resolvePairs=s6});var pT=v(fT=>{"use strict";var c6=Ce(),dT=Bo(),df=Ko(),Rpe=Jo(),l6=zy(),ca=class t extends Rpe.YAMLSeq{constructor(){super(),this.add=df.YAMLMap.prototype.add.bind(this),this.delete=df.YAMLMap.prototype.delete.bind(this),this.get=df.YAMLMap.prototype.get.bind(this),this.has=df.YAMLMap.prototype.has.bind(this),this.set=df.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(c6.isPair(i)?(o=dT.toJS(i.key,"",r),s=dT.toJS(i.value,o,r)):o=dT.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=l6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ca.tag="tag:yaml.org,2002:omap";var Ipe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ca,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=l6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)c6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ca,r)},createNode:(t,e,r)=>ca.from(t,e,r)};fT.YAMLOMap=ca;fT.omap=Ipe});var m6=v(mT=>{"use strict";var u6=Pt();function d6({value:t,source:e},r){return e&&(t?f6:p6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var f6={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 u6.Scalar(!0),stringify:d6},p6={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 u6.Scalar(!1),stringify:d6};mT.falseTag=p6;mT.trueTag=f6});var h6=v(Uy=>{"use strict";var Ppe=Pt(),hT=Kc(),Cpe={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},Dpe={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)}},Npe={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 Ppe.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};Uy.float=Npe;Uy.floatExp=Dpe;Uy.floatNaN=Cpe});var y6=v(pf=>{"use strict";var g6=Kc(),ff=t=>typeof t=="bigint"||Number.isInteger(t);function qy(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 gT(t,e,r){let{value:n}=t;if(ff(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return g6.stringifyNumber(t)}var jpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>qy(t,2,2,r),stringify:t=>gT(t,2,"0b")},Mpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>qy(t,1,8,r),stringify:t=>gT(t,8,"0")},Fpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>qy(t,0,10,r),stringify:g6.stringifyNumber},Lpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>qy(t,2,16,r),stringify:t=>gT(t,16,"0x")};pf.int=Fpe;pf.intBin=jpe;pf.intHex=Lpe;pf.intOct=Mpe});var _T=v(yT=>{"use strict";var Gy=Ce(),By=Vo(),Hy=Ko(),la=class t extends Hy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Gy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new By.Pair(e.key,null):r=new By.Pair(e,null),Hy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Hy.findPair(this.items,e);return!r&&Gy.isPair(n)?Gy.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=Hy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new By.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(By.createPair(s,null,n));return o}};la.tag="tag:yaml.org,2002:set";var zpe={collection:"map",identify:t=>t instanceof Set,nodeClass:la,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>la.from(t,e,r),resolve(t,e){if(Gy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new la,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};yT.YAMLSet=la;yT.set=zpe});var vT=v(Zy=>{"use strict";var Upe=Kc();function bT(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 _6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Upe.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 qpe={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})=>bT(t,r),stringify:_6},Bpe={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=>bT(t,!1),stringify:_6},b6={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(b6.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=bT(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$/,"")??""};Zy.floatTime=Bpe;Zy.intTime=qpe;Zy.timestamp=b6});var w6=v(S6=>{"use strict";var Hpe=Vc(),Gpe=Cy(),Zpe=Wc(),Vpe=lf(),Wpe=lT(),v6=m6(),ST=h6(),Vy=y6(),Kpe=ky(),Jpe=pT(),Ype=zy(),Xpe=_T(),wT=vT(),Qpe=[Hpe.map,Zpe.seq,Vpe.string,Gpe.nullTag,v6.trueTag,v6.falseTag,Vy.intBin,Vy.intOct,Vy.int,Vy.intHex,ST.floatNaN,ST.floatExp,ST.float,Wpe.binary,Kpe.merge,Jpe.omap,Ype.pairs,Xpe.set,wT.intTime,wT.floatTime,wT.timestamp];S6.schema=Qpe});var P6=v(kT=>{"use strict";var E6=Vc(),eme=Cy(),A6=Wc(),tme=lf(),rme=tT(),xT=nT(),$T=oT(),nme=t6(),ime=i6(),T6=lT(),mf=ky(),O6=pT(),R6=zy(),x6=w6(),I6=_T(),Wy=vT(),$6=new Map([["core",nme.schema],["failsafe",[E6.map,A6.seq,tme.string]],["json",ime.schema],["yaml11",x6.schema],["yaml-1.1",x6.schema]]),k6={binary:T6.binary,bool:rme.boolTag,float:xT.float,floatExp:xT.floatExp,floatNaN:xT.floatNaN,floatTime:Wy.floatTime,int:$T.int,intHex:$T.intHex,intOct:$T.intOct,intTime:Wy.intTime,map:E6.map,merge:mf.merge,null:eme.nullTag,omap:O6.omap,pairs:R6.pairs,seq:A6.seq,set:I6.set,timestamp:Wy.timestamp},ome={"tag:yaml.org,2002:binary":T6.binary,"tag:yaml.org,2002:merge":mf.merge,"tag:yaml.org,2002:omap":O6.omap,"tag:yaml.org,2002:pairs":R6.pairs,"tag:yaml.org,2002:set":I6.set,"tag:yaml.org,2002:timestamp":Wy.timestamp};function sme(t,e,r){let n=$6.get(e);if(n&&!t)return r&&!n.includes(mf.merge)?n.concat(mf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from($6.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(mf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?k6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(k6).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},[])}kT.coreKnownTags=ome;kT.getTags=sme});var TT=v(C6=>{"use strict";var ET=Ce(),ame=Vc(),cme=Wc(),lme=lf(),Ky=P6(),ume=(t,e)=>t.keye.key?1:0,AT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Ky.getTags(e,"compat"):e?Ky.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Ky.coreKnownTags:{},this.tags=Ky.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,ET.MAP,{value:ame.map}),Object.defineProperty(this,ET.SCALAR,{value:lme.string}),Object.defineProperty(this,ET.SEQ,{value:cme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?ume:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};C6.Schema=AT});var N6=v(D6=>{"use strict";var dme=Ce(),OT=sf(),hf=tf();function fme(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=OT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(hf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(dme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(hf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=OT.stringify(t.contents,i,()=>a=null,c);a&&(l+=hf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(OT.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]=Fy.isPair(n)?n:new dO.Pair(n)}}else e("Expected a sequence for this tag");return t}function d6(t,e,r){let{replacer:n}=r,i=new Ope.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(dO.createPair(a,c,r))}return i}var Tpe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:u6,createNode:d6};Ly.createPairs=d6;Ly.pairs=Tpe;Ly.resolvePairs=u6});var mO=v(pO=>{"use strict";var f6=Ce(),fO=Bo(),df=Ko(),Rpe=Jo(),p6=zy(),ua=class t extends Rpe.YAMLSeq{constructor(){super(),this.add=df.YAMLMap.prototype.add.bind(this),this.delete=df.YAMLMap.prototype.delete.bind(this),this.get=df.YAMLMap.prototype.get.bind(this),this.has=df.YAMLMap.prototype.has.bind(this),this.set=df.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(f6.isPair(i)?(o=fO.toJS(i.key,"",r),s=fO.toJS(i.value,o,r)):o=fO.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=p6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ua.tag="tag:yaml.org,2002:omap";var Ipe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ua,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=p6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)f6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ua,r)},createNode:(t,e,r)=>ua.from(t,e,r)};pO.YAMLOMap=ua;pO.omap=Ipe});var _6=v(hO=>{"use strict";var m6=Ct();function h6({value:t,source:e},r){return e&&(t?g6:y6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var g6={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 m6.Scalar(!0),stringify:h6},y6={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 m6.Scalar(!1),stringify:h6};hO.falseTag=y6;hO.trueTag=g6});var b6=v(Uy=>{"use strict";var Ppe=Ct(),gO=Jc(),Cpe={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:gO.stringifyNumber},Dpe={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():gO.stringifyNumber(t)}},Npe={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 Ppe.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:gO.stringifyNumber};Uy.float=Npe;Uy.floatExp=Dpe;Uy.floatNaN=Cpe});var S6=v(pf=>{"use strict";var v6=Jc(),ff=t=>typeof t=="bigint"||Number.isInteger(t);function qy(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 yO(t,e,r){let{value:n}=t;if(ff(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return v6.stringifyNumber(t)}var jpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>qy(t,2,2,r),stringify:t=>yO(t,2,"0b")},Mpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>qy(t,1,8,r),stringify:t=>yO(t,8,"0")},Fpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>qy(t,0,10,r),stringify:v6.stringifyNumber},Lpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>qy(t,2,16,r),stringify:t=>yO(t,16,"0x")};pf.int=Fpe;pf.intBin=jpe;pf.intHex=Lpe;pf.intOct=Mpe});var bO=v(_O=>{"use strict";var Gy=Ce(),By=Vo(),Hy=Ko(),da=class t extends Hy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Gy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new By.Pair(e.key,null):r=new By.Pair(e,null),Hy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Hy.findPair(this.items,e);return!r&&Gy.isPair(n)?Gy.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=Hy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new By.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(By.createPair(s,null,n));return o}};da.tag="tag:yaml.org,2002:set";var zpe={collection:"map",identify:t=>t instanceof Set,nodeClass:da,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>da.from(t,e,r),resolve(t,e){if(Gy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new da,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};_O.YAMLSet=da;_O.set=zpe});var SO=v(Zy=>{"use strict";var Upe=Jc();function vO(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 w6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Upe.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 qpe={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})=>vO(t,r),stringify:w6},Bpe={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=>vO(t,!1),stringify:w6},x6={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(x6.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=vO(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$/,"")??""};Zy.floatTime=Bpe;Zy.intTime=qpe;Zy.timestamp=x6});var E6=v(k6=>{"use strict";var Hpe=Wc(),Gpe=Cy(),Zpe=Kc(),Vpe=lf(),Wpe=uO(),$6=_6(),wO=b6(),Vy=S6(),Kpe=ky(),Jpe=mO(),Ype=zy(),Xpe=bO(),xO=SO(),Qpe=[Hpe.map,Zpe.seq,Vpe.string,Gpe.nullTag,$6.trueTag,$6.falseTag,Vy.intBin,Vy.intOct,Vy.int,Vy.intHex,wO.floatNaN,wO.floatExp,wO.float,Wpe.binary,Kpe.merge,Jpe.omap,Ype.pairs,Xpe.set,xO.intTime,xO.floatTime,xO.timestamp];k6.schema=Qpe});var j6=v(EO=>{"use strict";var R6=Wc(),eme=Cy(),I6=Kc(),tme=lf(),rme=rO(),$O=iO(),kO=sO(),nme=o6(),ime=c6(),P6=uO(),mf=ky(),C6=mO(),D6=zy(),A6=E6(),N6=bO(),Wy=SO(),O6=new Map([["core",nme.schema],["failsafe",[R6.map,I6.seq,tme.string]],["json",ime.schema],["yaml11",A6.schema],["yaml-1.1",A6.schema]]),T6={binary:P6.binary,bool:rme.boolTag,float:$O.float,floatExp:$O.floatExp,floatNaN:$O.floatNaN,floatTime:Wy.floatTime,int:kO.int,intHex:kO.intHex,intOct:kO.intOct,intTime:Wy.intTime,map:R6.map,merge:mf.merge,null:eme.nullTag,omap:C6.omap,pairs:D6.pairs,seq:I6.seq,set:N6.set,timestamp:Wy.timestamp},ome={"tag:yaml.org,2002:binary":P6.binary,"tag:yaml.org,2002:merge":mf.merge,"tag:yaml.org,2002:omap":C6.omap,"tag:yaml.org,2002:pairs":D6.pairs,"tag:yaml.org,2002:set":N6.set,"tag:yaml.org,2002:timestamp":Wy.timestamp};function sme(t,e,r){let n=O6.get(e);if(n&&!t)return r&&!n.includes(mf.merge)?n.concat(mf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(O6.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(mf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?T6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(T6).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},[])}EO.coreKnownTags=ome;EO.getTags=sme});var TO=v(M6=>{"use strict";var AO=Ce(),ame=Wc(),cme=Kc(),lme=lf(),Ky=j6(),ume=(t,e)=>t.keye.key?1:0,OO=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Ky.getTags(e,"compat"):e?Ky.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Ky.coreKnownTags:{},this.tags=Ky.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,AO.MAP,{value:ame.map}),Object.defineProperty(this,AO.SCALAR,{value:lme.string}),Object.defineProperty(this,AO.SEQ,{value:cme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?ume:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};M6.Schema=OO});var L6=v(F6=>{"use strict";var dme=Ce(),RO=sf(),hf=tf();function fme(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(hf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(dme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(hf.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+=hf.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(hf.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(hf.indentComment(o(c),"")))}return r.join(` `)+` -`}D6.stringifyDocument=fme});var gf=v(j6=>{"use strict";var pme=Qd(),Jc=hy(),$n=Ce(),mme=Vo(),hme=Bo(),gme=TT(),yme=N6(),RT=dy(),_me=DA(),bme=ef(),IT=CA(),PT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 IT.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Yc(this.contents)&&this.contents.add(e)}addIn(e,r){Yc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=RT.anchorNames(this);e.anchor=!r||n.has(r)?RT.findNewAnchor(r||"a",n):r}return new pme.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}=RT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=bme.createNode(e,u,m);return a&&$n.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 mme.Pair(i,o)}delete(e){return Yc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Jc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Yc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Jc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Jc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Jc.collectionFromPath(this.schema,[e],r):Yc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Jc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Jc.collectionFromPath(this.schema,Array.from(e),r):Yc(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 IT.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 IT.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 gme.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=hme.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"?_me.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 yme.stringifyDocument(this,e)}};function Yc(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}j6.Document=PT});var bf=v(_f=>{"use strict";var yf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},CT=class extends yf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},DT=class extends yf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},vme=(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 +`}F6.stringifyDocument=fme});var gf=v(z6=>{"use strict";var pme=Qd(),Yc=hy(),$n=Ce(),mme=Vo(),hme=Bo(),gme=TO(),yme=L6(),IO=dy(),_me=NA(),bme=ef(),PO=DA(),CO=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 PO.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Xc(this.contents)&&this.contents.add(e)}addIn(e,r){Xc(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 pme.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=bme.createNode(e,u,m);return a&&$n.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 mme.Pair(i,o)}delete(e){return Xc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Yc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Xc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Yc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Yc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Yc.collectionFromPath(this.schema,[e],r):Xc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Yc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Yc.collectionFromPath(this.schema,Array.from(e),r):Xc(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 PO.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 PO.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 gme.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=hme.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"?_me.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 yme.stringifyDocument(this,e)}};function Xc(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}z6.Document=CO});var bf=v(_f=>{"use strict";var yf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},DO=class extends yf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},NO=class extends yf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},vme=(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} -`}};_f.YAMLError=yf;_f.YAMLParseError=CT;_f.YAMLWarning=DT;_f.prettifyError=vme});var vf=v(M6=>{"use strict";function Sme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}M6.resolveProps=Sme});var Jy=v(F6=>{"use strict";function NT(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(NT(e.key)||NT(e.value))return!0}return!1;default:return!0}}F6.containsNewline=NT});var jT=v(L6=>{"use strict";var wme=Jy();function xme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&wme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}L6.flowIndentCheck=xme});var MT=v(U6=>{"use strict";var z6=Ce();function $me(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||z6.isScalar(o)&&z6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}U6.mapIncludes=$me});var V6=v(Z6=>{"use strict";var q6=Vo(),kme=Ko(),B6=vf(),Eme=Jy(),H6=jT(),Ame=MT(),G6="All mapping items must start at the same column";function Tme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??kme.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=B6.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",G6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Eme.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",G6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&H6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Ame.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=B6.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 Ome=Jo(),Rme=vf(),Ime=jT();function Pme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Ome.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=Rme.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&&Ime.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}W6.resolveBlockSeq=Pme});var Xc=v(J6=>{"use strict";function Cme(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}}J6.resolveEnd=Cme});var eB=v(Q6=>{"use strict";var Dme=Ce(),Nme=Vo(),Y6=Ko(),jme=Jo(),Mme=Xc(),X6=vf(),Fme=Jy(),Lme=MT(),FT="Block collections are not allowed within flow collections",LT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function zme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?Y6.YAMLMap:jme.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=Mme.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}Q6.resolveFlowCollection=zme});var rB=v(tB=>{"use strict";var Ume=Ce(),qme=Pt(),Bme=Ko(),Hme=Jo(),Gme=V6(),Zme=K6(),Vme=eB();function zT(t,e,r,n,i,o){let s=r.type==="block-map"?Gme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Zme.resolveBlockSeq(t,e,r,n,o):Vme.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 Wme(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),zT(t,e,r,i,s)}let l=zT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Ume.isNode(u)?u:new qme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}tB.composeCollection=Wme});var qT=v(nB=>{"use strict";var UT=Pt();function Kme(t,e,r){let n=e.offset,i=Jme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?UT.Scalar.BLOCK_FOLDED:UT.Scalar.BLOCK_LITERAL,s=e.source?Yme(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?` +`}};_f.YAMLError=yf;_f.YAMLParseError=DO;_f.YAMLWarning=NO;_f.prettifyError=vme});var vf=v(U6=>{"use strict";function Sme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let T=t[t.length-1],O=T?T.offset+T.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:O,start:w??O}}U6.resolveProps=Sme});var Jy=v(q6=>{"use strict";function jO(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(jO(e.key)||jO(e.value))return!0}return!1;default:return!0}}q6.containsNewline=jO});var MO=v(B6=>{"use strict";var wme=Jy();function xme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&wme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}B6.flowIndentCheck=xme});var FO=v(G6=>{"use strict";var H6=Ce();function $me(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||H6.isScalar(o)&&H6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}G6.mapIncludes=$me});var Y6=v(J6=>{"use strict";var Z6=Vo(),kme=Ko(),V6=vf(),Eme=Jy(),W6=MO(),Ame=FO(),K6="All mapping items must start at the same column";function Ome({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??kme.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=V6.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",K6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Eme.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",K6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&W6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Ame.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=V6.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 Tme=Jo(),Rme=vf(),Ime=MO();function Pme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Tme.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=Rme.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&&Ime.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}X6.resolveBlockSeq=Pme});var Qc=v(eB=>{"use strict";function Cme(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}}eB.resolveEnd=Cme});var iB=v(nB=>{"use strict";var Dme=Ce(),Nme=Vo(),tB=Ko(),jme=Jo(),Mme=Qc(),rB=vf(),Fme=Jy(),Lme=FO(),LO="Block collections are not allowed within flow collections",zO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function zme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?tB.YAMLMap:jme.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=Mme.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}nB.resolveFlowCollection=zme});var sB=v(oB=>{"use strict";var Ume=Ce(),qme=Ct(),Bme=Ko(),Hme=Jo(),Gme=Y6(),Zme=Q6(),Vme=iB();function UO(t,e,r,n,i,o){let s=r.type==="block-map"?Gme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Zme.resolveBlockSeq(t,e,r,n,o):Vme.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 Wme(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),UO(t,e,r,i,s)}let l=UO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Ume.isNode(u)?u:new qme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}oB.composeCollection=Wme});var BO=v(aB=>{"use strict";var qO=Ct();function Kme(t,e,r){let n=e.offset,i=Jme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?qO.Scalar.BLOCK_FOLDED:qO.Scalar.BLOCK_LITERAL,s=e.source?Yme(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 Jme({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 BT=Pt(),Xme=Xc();function Qme(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=BT.Scalar.PLAIN,c=ehe(o,l);break;case"single-quoted-scalar":a=BT.Scalar.QUOTE_SINGLE,c=the(o,l);break;case"double-quoted-scalar":a=BT.Scalar.QUOTE_DOUBLE,c=rhe(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=Xme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function ehe(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}`),iB(t)}function the(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),iB(t.slice(1,-1)).replace(/''/g,"'")}function iB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var HO=Ct(),Xme=Qc();function Qme(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=ehe(o,l);break;case"single-quoted-scalar":a=HO.Scalar.QUOTE_SINGLE,c=the(o,l);break;case"double-quoted-scalar":a=HO.Scalar.QUOTE_DOUBLE,c=rhe(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=Xme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function ehe(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}`),cB(t)}function the(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),cB(t.slice(1,-1)).replace(/''/g,"'")}function cB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var ua=Ce(),sB=Pt(),she=qT(),ahe=HT();function che(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?she.resolveBlockScalar(t,e,n):ahe.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[ua.SCALAR]:c?l=lhe(t.schema,i,c,r,n):e.type==="scalar"?l=uhe(t,i,e,n):l=t.schema[ua.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ua.isScalar(d)?d:new sB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new sB.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 lhe(t,e,r,n,i){if(r==="!")return t[ua.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[ua.SCALAR])}function uhe({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[ua.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ua.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}aB.composeScalar=che});var uB=v(lB=>{"use strict";function dhe(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}lB.emptyScalarPosition=dhe});var pB=v(ZT=>{"use strict";var fhe=Qd(),phe=Ce(),mhe=rB(),dB=cB(),hhe=Xc(),ghe=uB(),yhe={composeNode:fB,composeEmptyNode:GT};function fB(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=_he(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=dB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=mhe.composeCollection(yhe,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=GT(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&&(!phe.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 GT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:ghe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=dB.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 _he({options:t},{offset:e,source:r,end:n},i){let o=new fhe.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=hhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ZT.composeEmptyNode=GT;ZT.composeNode=fB});var gB=v(hB=>{"use strict";var bhe=gf(),mB=pB(),vhe=Xc(),She=vf();function whe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new bhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=She.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?mB.composeNode(l,i,u,s):mB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=vhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}hB.composeDoc=whe});var WT=v(bB=>{"use strict";var xhe=He("process"),$he=CA(),khe=gf(),Sf=bf(),yB=Ce(),Ehe=gB(),Ahe=Xc();function wf(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 _B(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var fa=Ce(),uB=Ct(),she=BO(),ahe=GO();function che(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?she.resolveBlockScalar(t,e,n):ahe.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[fa.SCALAR]:c?l=lhe(t.schema,i,c,r,n):e.type==="scalar"?l=uhe(t,i,e,n):l=t.schema[fa.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=fa.isScalar(d)?d:new uB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new uB.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 lhe(t,e,r,n,i){if(r==="!")return t[fa.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[fa.SCALAR])}function uhe({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[fa.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[fa.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}dB.composeScalar=che});var mB=v(pB=>{"use strict";function dhe(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}pB.emptyScalarPosition=dhe});var yB=v(VO=>{"use strict";var fhe=Qd(),phe=Ce(),mhe=sB(),hB=fB(),hhe=Qc(),ghe=mB(),yhe={composeNode:gB,composeEmptyNode:ZO};function gB(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=_he(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=hB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=mhe.composeCollection(yhe,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=ZO(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&&(!phe.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 ZO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:ghe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=hB.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 _he({options:t},{offset:e,source:r,end:n},i){let o=new fhe.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=hhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}VO.composeEmptyNode=ZO;VO.composeNode=gB});var vB=v(bB=>{"use strict";var bhe=gf(),_B=yB(),vhe=Qc(),She=vf();function whe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new bhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=She.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?_B.composeNode(l,i,u,s):_B.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=vhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}bB.composeDoc=whe});var KO=v(xB=>{"use strict";var xhe=He("process"),$he=DA(),khe=gf(),Sf=bf(),SB=Ce(),Ehe=vB(),Ahe=Qc();function wf(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 wB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=wf(r);o?this.warnings.push(new Sf.YAMLWarning(s,n,i)):this.errors.push(new Sf.YAMLParseError(s,n,i))},this.directives=new $he.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=_B(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(yB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];yB.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 WO=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=wf(r);o?this.warnings.push(new Sf.YAMLWarning(s,n,i)):this.errors.push(new Sf.YAMLParseError(s,n,i))},this.directives=new $he.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=wB(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(SB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];SB.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=wf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Ehe.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 Sf.YAMLParseError(wf(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 Sf.YAMLParseError(wf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Ahe.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 Sf.YAMLParseError(wf(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 khe.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}}};bB.Composer=VT});var wB=v(Yy=>{"use strict";var The=qT(),Ohe=HT(),Rhe=bf(),vB=of();function Ihe(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 Rhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ohe.resolveFlowScalar(t,e,n);case"block-scalar":return The.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Phe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=vB.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=wf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Ehe.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 Sf.YAMLParseError(wf(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 Sf.YAMLParseError(wf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Ahe.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 Sf.YAMLParseError(wf(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 khe.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}}};xB.Composer=WO});var EB=v(Yy=>{"use strict";var Ohe=BO(),The=GO(),Rhe=bf(),$B=of();function Ihe(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 Rhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return The.resolveFlowScalar(t,e,n);case"block-scalar":return Ohe.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Phe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=$B.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 SB(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 Che(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=vB.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">":Dhe(t,c);break;case'"':KT(t,c,"double-quoted-scalar");break;case"'":KT(t,c,"single-quoted-scalar");break;default:KT(t,c,"scalar")}}function Dhe(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return kB(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 Che(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=$B.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">":Dhe(t,c);break;case'"':JO(t,c,"double-quoted-scalar");break;case"'":JO(t,c,"single-quoted-scalar");break;default:JO(t,c,"scalar")}}function Dhe(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}];SB(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 SB(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 KT(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})}}}Yy.createScalarToken=Phe;Yy.resolveAsScalar=Ihe;Yy.setScalarValue=Che});var $B=v(xB=>{"use strict";var Nhe=t=>"type"in t?Qy(t):Xy(t);function Qy(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Qy(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Xy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Xy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Xy(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 Xy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Qy(e)),r)for(let o of r)i+=o.source;return n&&(i+=Qy(n)),i}xB.stringify=Nhe});var TB=v(AB=>{"use strict";var JT=Symbol("break visit"),jhe=Symbol("skip children"),kB=Symbol("remove item");function da(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),EB(Object.freeze([]),t,e)}da.BREAK=JT;da.SKIP=jhe;da.REMOVE=kB;da.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};da.parentCollection=(t,e)=>{let r=da.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 EB(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 YT=wB(),Mhe=$B(),Fhe=TB(),XT="\uFEFF",QT="",eO="",tO="",Lhe=t=>!!t&&"items"in t,zhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Uhe(t){switch(t){case XT:return"";case QT:return"";case eO:return"";case tO:return"";default:return JSON.stringify(t)}}function qhe(t){switch(t){case XT:return"byte-order-mark";case QT:return"doc-mode";case eO:return"flow-error-end";case tO: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}];kB(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 kB(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 JO(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})}}}Yy.createScalarToken=Phe;Yy.resolveAsScalar=Ihe;Yy.setScalarValue=Che});var OB=v(AB=>{"use strict";var Nhe=t=>"type"in t?Qy(t):Xy(t);function Qy(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Qy(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Xy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Xy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Xy(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 Xy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Qy(e)),r)for(let o of r)i+=o.source;return n&&(i+=Qy(n)),i}AB.stringify=Nhe});var PB=v(IB=>{"use strict";var YO=Symbol("break visit"),jhe=Symbol("skip children"),TB=Symbol("remove item");function pa(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),RB(Object.freeze([]),t,e)}pa.BREAK=YO;pa.SKIP=jhe;pa.REMOVE=TB;pa.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};pa.parentCollection=(t,e)=>{let r=pa.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 RB(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=EB(),Mhe=OB(),Fhe=PB(),QO="\uFEFF",eT="",tT="",rT="",Lhe=t=>!!t&&"items"in t,zhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Uhe(t){switch(t){case QO:return"";case eT:return"";case tT:return"";case rT:return"";default:return JSON.stringify(t)}}function qhe(t){switch(t){case QO:return"byte-order-mark";case eT: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}Dr.createScalarToken=YT.createScalarToken;Dr.resolveAsScalar=YT.resolveAsScalar;Dr.setScalarValue=YT.setScalarValue;Dr.stringify=Mhe.stringify;Dr.visit=Fhe.visit;Dr.BOM=XT;Dr.DOCUMENT=QT;Dr.FLOW_END=eO;Dr.SCALAR=tO;Dr.isCollection=Lhe;Dr.isScalar=zhe;Dr.prettyToken=Uhe;Dr.tokenType=qhe});var iO=v(RB=>{"use strict";var xf=e_();function Wn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var OB=new Set("0123456789ABCDEFabcdef"),Bhe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),t_=new Set(",[]{}"),Hhe=new Set(` ,[]{} -\r `),rO=t=>!t||Hhe.has(t),nO=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}Dr.createScalarToken=XO.createScalarToken;Dr.resolveAsScalar=XO.resolveAsScalar;Dr.setScalarValue=XO.setScalarValue;Dr.stringify=Mhe.stringify;Dr.visit=Fhe.visit;Dr.BOM=QO;Dr.DOCUMENT=eT;Dr.FLOW_END=tT;Dr.SCALAR=rT;Dr.isCollection=Lhe;Dr.isScalar=zhe;Dr.prettyToken=Uhe;Dr.tokenType=qhe});var oT=v(DB=>{"use strict";var xf=e_();function Wn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var CB=new Set("0123456789ABCDEFabcdef"),Bhe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),t_=new Set(",[]{}"),Hhe=new Set(` ,[]{} +\r `),nT=t=>!t||Hhe.has(t),iT=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==="...")&&Wn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Wn(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===":")&&Wn(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&&!Wn(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===":")&&Wn(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(nT),"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=>Wn(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,42 +161,42 @@ ${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 xf.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(Wn(o)||e&&t_.has(o))break;r=n}else if(Wn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` `,o=this.buffer[n+1]):r=n),o==="#"||e&&t_.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&t_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield xf.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(Wn(n)||r&&t_.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(;!Wn(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(Bhe.has(r))r=this.buffer[++e];else if(r==="%"&&OB.has(this.buffer[e+1])&&OB.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&&t_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield xf.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(nT),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Wn(n)||r&&t_.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(;!Wn(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(Bhe.has(r))r=this.buffer[++e];else if(r==="%"&&CB.has(this.buffer[e+1])&&CB.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)}};RB.Lexer=nO});var sO=v(IB=>{"use strict";var oO=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 Ghe=He("process"),PB=e_(),Zhe=iO();function Yo(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 n_(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"&&DB(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&&CB(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)}};DB.Lexer=iT});var aT=v(NB=>{"use strict";var sT=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 Ghe=He("process"),jB=e_(),Zhe=oT();function Yo(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 n_(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"&&FB(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&&MB(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(Yo(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(NB(r.key)&&!Yo(r.sep,"newline")){let s=Qc(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(Yo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Qc(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]}):Yo(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&&!Yo(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)){n_(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||Yo(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=r_(n),o=Qc(i);DB(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)){n_(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(Yo(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(LB(r.key)&&!Yo(r.sep,"newline")){let s=el(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(Yo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=el(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]}):Yo(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&&!Yo(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)){n_(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||Yo(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=r_(n),o=el(i);FB(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=r_(e),n=Qc(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=r_(e),n=Qc(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())}}};jB.Parser=aO});var UB=v(kf=>{"use strict";var MB=WT(),Vhe=gf(),$f=bf(),Whe=ZA(),Khe=Ce(),Jhe=sO(),FB=cO();function LB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Jhe.LineCounter||null,prettyErrors:e}}function Yhe(t,e={}){let{lineCounter:r,prettyErrors:n}=LB(e),i=new FB.Parser(r?.addNewLine),o=new MB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach($f.prettifyError(t,r)),a.warnings.forEach($f.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function zB(t,e={}){let{lineCounter:r,prettyErrors:n}=LB(e),i=new FB.Parser(r?.addNewLine),o=new MB.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 $f.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach($f.prettifyError(t,r)),s.warnings.forEach($f.prettifyError(t,r))),s}function Xhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=zB(t,r);if(!i)return null;if(i.warnings.forEach(o=>Whe.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 Qhe(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 Khe.isDocument(t)&&!n?t.toString(r):new Vhe.Document(t,n,r).toString(r)}kf.parse=Xhe;kf.parseAllDocuments=Yhe;kf.parseDocument=zB;kf.stringify=Qhe});var Qt=v(Ge=>{"use strict";var ege=WT(),tge=gf(),rge=TT(),lO=bf(),nge=Qd(),Xo=Ce(),ige=Vo(),oge=Pt(),sge=Ko(),age=Jo(),cge=e_(),lge=iO(),uge=sO(),dge=cO(),i_=UB(),qB=Kd();Ge.Composer=ege.Composer;Ge.Document=tge.Document;Ge.Schema=rge.Schema;Ge.YAMLError=lO.YAMLError;Ge.YAMLParseError=lO.YAMLParseError;Ge.YAMLWarning=lO.YAMLWarning;Ge.Alias=nge.Alias;Ge.isAlias=Xo.isAlias;Ge.isCollection=Xo.isCollection;Ge.isDocument=Xo.isDocument;Ge.isMap=Xo.isMap;Ge.isNode=Xo.isNode;Ge.isPair=Xo.isPair;Ge.isScalar=Xo.isScalar;Ge.isSeq=Xo.isSeq;Ge.Pair=ige.Pair;Ge.Scalar=oge.Scalar;Ge.YAMLMap=sge.YAMLMap;Ge.YAMLSeq=age.YAMLSeq;Ge.CST=cge;Ge.Lexer=lge.Lexer;Ge.LineCounter=uge.LineCounter;Ge.Parser=dge.Parser;Ge.parse=i_.parse;Ge.parseAllDocuments=i_.parseAllDocuments;Ge.parseDocument=i_.parseDocument;Ge.stringify=i_.stringify;Ge.visit=qB.visit;Ge.visitAsync=qB.visitAsync});import{execFileSync as BB}from"node:child_process";import{existsSync as o_}from"node:fs";import{join as s_,resolve as fge}from"node:path";function pge(t){try{let e=BB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?fge(t,e):null}catch{return null}}function uO(t){let e=pge(t);if(!e)return null;try{if(o_(s_(e,"MERGE_HEAD")))return"merge";if(o_(s_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(o_(s_(e,"rebase-merge"))||o_(s_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function fa(t){return uO(t)!==null}function dO(t,e){try{let r=BB("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 a_(t,e){return dO(t,e)!==null}var pa=y(()=>{"use strict"});import{execFileSync as mge}from"node:child_process";import{existsSync as hge,readFileSync as gge}from"node:fs";import{join as ZB}from"node:path";function Ef(t,e){return mge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Qo(t){try{let e=Ef(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 es(t,e){yge(t,e);let r=Ef(t,["rev-parse","HEAD"]).trim(),n=_ge(t,e);return{groups:bge(t,n),head:r,inventory:{after:GB(l_(t,"spec.yaml")),before:GB(fO(t,e,"spec.yaml"))},since:e,unsharded_commits:xge(t,e)}}function pO(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 yge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!a_(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 _ge(t,e){let r=Ef(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(!(!HB(c)&&!HB(a)))if(s.startsWith("A")){let l=c_(l_(t,c));if(!l)continue;l.status==="done"?n.push(el(l,"added-as-done")):l.status==="archived"&&n.push(el(l,"archived"))}else if(s.startsWith("D")){let l=c_(fO(t,e,a));l&&n.push(el(l,"archived"))}else{let l=c_(l_(t,c));if(!l)continue;let d=c_(fO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(el(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(el(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(el(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function HB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function el(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>pO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function c_(t){if(t===null)return null;let e;try{e=(0,u_.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 l_(t,e){let r=ZB(t,e);if(!hge(r))return null;try{return gge(r,"utf8")}catch{return null}}function fO(t,e,r){try{return Ef(t,["show",`${e}:${r}`])}catch{return null}}function bge(t,e){let r=vge(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 vge(t){let e=l_(t,ZB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,u_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function GB(t){let e={};if(t!==null)try{let n=(0,u_.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 xge(t,e){let r=Ef(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);Sge.test(a)&&(wge.test(a)||n.push({hash:s,subject:a}))}return n}var u_,Sge,wge,tl=y(()=>{"use strict";u_=bt(Qt(),1);pa();Sge=/^(feat|fix)(\([^)]*\))?!?:/,wge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as VB}from"node:child_process";import{appendFileSync as $ge,existsSync as mO,mkdirSync as kge,readFileSync as Ege,renameSync as Age,statSync as Tge}from"node:fs";import{userInfo as Oge}from"node:os";import{dirname as Rge,join as gO}from"node:path";function yO(t){return gO(t,WB,Ige)}function Xr(t,e){let r=yO(t),n=Rge(r);mO(n)||kge(n,{recursive:!0});try{mO(r)&&Tge(r).size>Pge&&Age(r,gO(n,KB))}catch{}$ge(r,`${JSON.stringify(e)} -`,"utf8")}function hO(t){if(!mO(t))return[];let e=Ege(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ma(t){return hO(yO(t))}function d_(t){return[...hO(gO(t,WB,KB)),...hO(yO(t))]}function Qr(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 Cge(t){let e;try{e=VB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Oge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Dge(t){try{return VB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Af(t,e){try{let r=ma(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Dge(t),i=Cge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Af(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var WB,Ige,KB,Pge,Nr=y(()=>{"use strict";WB=".cladding",Ige="events.log.jsonl",KB="events.log.1.jsonl",Pge=5*1024*1024});import{execFileSync as Nge}from"node:child_process";import{existsSync as JB,readdirSync as jge,readFileSync as Mge,statSync as YB}from"node:fs";import{createHash as Fge}from"node:crypto";import{join as _O}from"node:path";function ha(t){try{return Nge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function bO(t){let e=[],r=_O(t,"spec.yaml");JB(r)&&YB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=_O(t,"spec",i);if(!(!JB(o)||!YB(o).isDirectory()))for(let s of jge(o))s.endsWith(".yaml")&&e.push(_O(o,s))}e.sort();let n=Fge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Mge(i)),n.update("\0")}return n.digest("hex")}function f_(t,e){let r={featureId:e,gitHead:ha(t),specDigest:bO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function p_(t,e){let r=ma(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=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Tf=y(()=>{"use strict";Nr()});import{readFileSync as Lge,statSync as zge}from"node:fs";import{extname as Uge,resolve as vO,sep as qge}from"node:path";function en(t){return Math.ceil(t.length/4)}function Gge(t,e){let r=vO(e),n=vO(r,t);return n===r||n.startsWith(r+qge)}function QB(t,e,r,n){if(!Gge(t,e))return{path:t,omitted:"unsafe-path"};if(!Bge.has(Uge(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>XB)return{path:t,omitted:"too-large",bytes:o}}else{let l=vO(e,t);try{o=zge(l).size}catch{return{path:t,omitted:"missing"}}if(o>XB)return{path:t,omitted:"too-large",bytes:o};try{i=Lge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Hge))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=r_(e),n=el(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=r_(e),n=el(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())}}};zB.Parser=cT});var GB=v(kf=>{"use strict";var UB=KO(),Vhe=gf(),$f=bf(),Whe=VA(),Khe=Ce(),Jhe=aT(),qB=lT();function BB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Jhe.LineCounter||null,prettyErrors:e}}function Yhe(t,e={}){let{lineCounter:r,prettyErrors:n}=BB(e),i=new qB.Parser(r?.addNewLine),o=new UB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach($f.prettifyError(t,r)),a.warnings.forEach($f.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function HB(t,e={}){let{lineCounter:r,prettyErrors:n}=BB(e),i=new qB.Parser(r?.addNewLine),o=new UB.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 $f.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach($f.prettifyError(t,r)),s.warnings.forEach($f.prettifyError(t,r))),s}function Xhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=HB(t,r);if(!i)return null;if(i.warnings.forEach(o=>Whe.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 Qhe(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 Khe.isDocument(t)&&!n?t.toString(r):new Vhe.Document(t,n,r).toString(r)}kf.parse=Xhe;kf.parseAllDocuments=Yhe;kf.parseDocument=HB;kf.stringify=Qhe});var Qt=v(Ge=>{"use strict";var ege=KO(),tge=gf(),rge=TO(),uT=bf(),nge=Qd(),Xo=Ce(),ige=Vo(),oge=Ct(),sge=Ko(),age=Jo(),cge=e_(),lge=oT(),uge=aT(),dge=lT(),i_=GB(),ZB=Kd();Ge.Composer=ege.Composer;Ge.Document=tge.Document;Ge.Schema=rge.Schema;Ge.YAMLError=uT.YAMLError;Ge.YAMLParseError=uT.YAMLParseError;Ge.YAMLWarning=uT.YAMLWarning;Ge.Alias=nge.Alias;Ge.isAlias=Xo.isAlias;Ge.isCollection=Xo.isCollection;Ge.isDocument=Xo.isDocument;Ge.isMap=Xo.isMap;Ge.isNode=Xo.isNode;Ge.isPair=Xo.isPair;Ge.isScalar=Xo.isScalar;Ge.isSeq=Xo.isSeq;Ge.Pair=ige.Pair;Ge.Scalar=oge.Scalar;Ge.YAMLMap=sge.YAMLMap;Ge.YAMLSeq=age.YAMLSeq;Ge.CST=cge;Ge.Lexer=lge.Lexer;Ge.LineCounter=uge.LineCounter;Ge.Parser=dge.Parser;Ge.parse=i_.parse;Ge.parseAllDocuments=i_.parseAllDocuments;Ge.parseDocument=i_.parseDocument;Ge.stringify=i_.stringify;Ge.visit=ZB.visit;Ge.visitAsync=ZB.visitAsync});import{execFileSync as VB}from"node:child_process";import{existsSync as o_}from"node:fs";import{join as s_,resolve as fge}from"node:path";function pge(t){try{let e=VB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?fge(t,e):null}catch{return null}}function dT(t){let e=pge(t);if(!e)return null;try{if(o_(s_(e,"MERGE_HEAD")))return"merge";if(o_(s_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(o_(s_(e,"rebase-merge"))||o_(s_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ma(t){return dT(t)!==null}function fT(t,e){try{let r=VB("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 a_(t,e){return fT(t,e)!==null}var ha=y(()=>{"use strict"});import{execFileSync as mge}from"node:child_process";import{existsSync as hge,readFileSync as gge}from"node:fs";import{join as JB}from"node:path";function Ef(t,e){return mge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Qo(t){try{let e=Ef(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 es(t,e){yge(t,e);let r=Ef(t,["rev-parse","HEAD"]).trim(),n=_ge(t,e);return{groups:bge(t,n),head:r,inventory:{after:KB(l_(t,"spec.yaml")),before:KB(pT(t,e,"spec.yaml"))},since:e,unsharded_commits:xge(t,e)}}function mT(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 yge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!a_(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 _ge(t,e){let r=Ef(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(!(!WB(c)&&!WB(a)))if(s.startsWith("A")){let l=c_(l_(t,c));if(!l)continue;l.status==="done"?n.push(tl(l,"added-as-done")):l.status==="archived"&&n.push(tl(l,"archived"))}else if(s.startsWith("D")){let l=c_(pT(t,e,a));l&&n.push(tl(l,"archived"))}else{let l=c_(l_(t,c));if(!l)continue;let d=c_(pT(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(tl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(tl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(tl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function WB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function tl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>mT(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function c_(t){if(t===null)return null;let e;try{e=(0,u_.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 l_(t,e){let r=JB(t,e);if(!hge(r))return null;try{return gge(r,"utf8")}catch{return null}}function pT(t,e,r){try{return Ef(t,["show",`${e}:${r}`])}catch{return null}}function bge(t,e){let r=vge(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 vge(t){let e=l_(t,JB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,u_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function KB(t){let e={};if(t!==null)try{let n=(0,u_.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 xge(t,e){let r=Ef(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);Sge.test(a)&&(wge.test(a)||n.push({hash:s,subject:a}))}return n}var u_,Sge,wge,rl=y(()=>{"use strict";u_=vt(Qt(),1);ha();Sge=/^(feat|fix)(\([^)]*\))?!?:/,wge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as YB}from"node:child_process";import{appendFileSync as $ge,existsSync as hT,mkdirSync as kge,readFileSync as Ege,renameSync as Age,statSync as Oge}from"node:fs";import{userInfo as Tge}from"node:os";import{dirname as Rge,join as yT}from"node:path";function _T(t){return yT(t,XB,Ige)}function Xr(t,e){let r=_T(t),n=Rge(r);hT(n)||kge(n,{recursive:!0});try{hT(r)&&Oge(r).size>Pge&&Age(r,yT(n,QB))}catch{}$ge(r,`${JSON.stringify(e)} +`,"utf8")}function gT(t){if(!hT(t))return[];let e=Ege(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ga(t){return gT(_T(t))}function d_(t){return[...gT(yT(t,XB,QB)),...gT(_T(t))]}function Qr(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 Cge(t){let e;try{e=YB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Tge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Dge(t){try{return YB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Af(t,e){try{let r=ga(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Dge(t),i=Cge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Af(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var XB,Ige,QB,Pge,Nr=y(()=>{"use strict";XB=".cladding",Ige="events.log.jsonl",QB="events.log.1.jsonl",Pge=5*1024*1024});import{execFileSync as Nge}from"node:child_process";import{existsSync as eH,readdirSync as jge,readFileSync as Mge,statSync as tH}from"node:fs";import{createHash as Fge}from"node:crypto";import{join as bT}from"node:path";function ya(t){try{return Nge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function vT(t){let e=[],r=bT(t,"spec.yaml");eH(r)&&tH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=bT(t,"spec",i);if(!(!eH(o)||!tH(o).isDirectory()))for(let s of jge(o))s.endsWith(".yaml")&&e.push(bT(o,s))}e.sort();let n=Fge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Mge(i)),n.update("\0")}return n.digest("hex")}function f_(t,e){let r={featureId:e,gitHead:ya(t),specDigest:vT(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function p_(t,e){let r=ga(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=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Of=y(()=>{"use strict";Nr()});import{readFileSync as Lge,statSync as zge}from"node:fs";import{extname as Uge,resolve as ST,sep as qge}from"node:path";function en(t){return Math.ceil(t.length/4)}function Gge(t,e){let r=ST(e),n=ST(r,t);return n===r||n.startsWith(r+qge)}function nH(t,e,r,n){if(!Gge(t,e))return{path:t,omitted:"unsafe-path"};if(!Bge.has(Uge(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>rH)return{path:t,omitted:"too-large",bytes:o}}else{let l=ST(e,t);try{o=zge(l).size}catch{return{path:t,omitted:"missing"}}if(o>rH)return{path:t,omitted:"too-large",bytes:o};try{i=Lge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Hge))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 Bge,XB,Hge,h_=y(()=>{"use strict";Bge=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"]),XB=2e6,Hge="\0"});function Vge(t){for(let i of Zge)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 SO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Wge(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??[])SO(e,s,o);for(let s of i.modules??[])SO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Vge(a);c&&SO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=eH.get(t);return e||(e=Wge(t),eH.set(t,e)),e}var Zge,eH,ga=y(()=>{"use strict";Zge=["derived:","fixture:","script:","self-dogfood:"];eH=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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Kge(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:xO(i)}}var ya=y(()=>{"use strict";ga()});function tH(t){return t.impacted.length}function y_(t,e,r={}){let n=r.initialDepth??g_.initialDepth,i=r.maxDepth??g_.maxDepth,o=r.coverageThreshold??g_.coverageThreshold,s=r.marginYieldThreshold??g_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=wO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=tH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var g_,$O=y(()=>{"use strict";ya();ga();g_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Jge(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 rH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Jge(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 nH=y(()=>{"use strict"});function Yge(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 rl(t,e){let r=Yge(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=rH(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 __=y(()=>{"use strict";nH()});import{existsSync as oH,readdirSync as Xge,readFileSync as Qge}from"node:fs";import{join as EO}from"node:path";function AO(t,e=tye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function rye(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:AO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:AO(`done reverted \u2014 pre-push strict gate red${r}`)}}function iH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function nye(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 AO(n)}function iye(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)=>iH(m)-iH(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(-eye).map(rye),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?nye(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 kO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function oye(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 sye(t,e,r){let n=kO(t,/_Rolled back at_\s*`([^`]+)`/),i=kO(t,/Last failed gate:\s*`([^`]+)`/),o=kO(t,/Retry attempts:\s*(\d+)/),s=oye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function aye(t,e){let r=EO(t,".cladding","post-mortems");if(!oH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Xge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(sye(Qge(EO(r,o),"utf8"),e,o))}catch{}return i}function sH(t,e){try{let r=d_(t),n=aye(t,e),i=oH(EO(t,".cladding","events.log.1.jsonl"));return iye(r,n,e,{truncated:i})}catch{return}}var eye,tye,aH=y(()=>{"use strict";Nr();eye=5,tye=120});function b_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function _a(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:cye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=rl(t,o);if("not_found"in c)return c;let l=c.focus,u=sH(n,l.id),d=a&&a.size>0?e:l.id,f=y_(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}},O=[...c.ancestors];for(;O.length>lye&&b_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),E=(se,Pe,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],oo={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(oo))>i},q=m,Q=h;if(E(q,Q,0,0)){let se=br(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],oo=0;for(;Yt.length>Pe.size&&E(Yt,Q,oo,0);)Yt=Yt.slice(0,-1),oo++;let Si=[...h],Yr=0;for(;E(Yt,Si,oo,Yr);){let de=-1;for(let so=Si.length-1;so>=0;so--)if(!Kt.has(Si[so])){de=so;break}if(de<0)break;Si.splice(de,1),Yr++}q=Yt,Q=Si,oo+Yr>0&&x.push(`breaks: omitted ${oo} feature(s) / ${Yr} test(s)`),E(q,Q,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Se=D(q,Q),P={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Se},C=P;if(u){let se={...P,prior_attempts:u};en(JSON.stringify(se))<=i?C=se:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(C));return{...C,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var cye,lye,v_=y(()=>{"use strict";h_();__();$O();aH();ya();ga();cye=3e3,lye=3});function Kn(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 uye(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 cH(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=_a(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=_a(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=y_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:uye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var nl,S_=y(()=>{"use strict";h_();$O();v_();ga();nl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as dye,existsSync as TO,mkdirSync as fye,readFileSync as lH}from"node:fs";import{dirname as pye,join as mye}from"node:path";function OO(t){return mye(t,hye,gye)}function yye(t,e){return{timestamp:new Date().toISOString(),head:ha(t),spec_digest:bO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function uH(t,e){try{let r=yye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=RO(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=OO(t),s=pye(o);return TO(s)||fye(s,{recursive:!0}),dye(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function dH(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 RO(t,e){let r=OO(t);if(!TO(r))return[];let n;try{n=lH(r,"utf8")}catch{return[]}let i=dH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function fH(t){let e=OO(t);if(!TO(e))return{snapshots:[],unreadable:!1};let r;try{r=lH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=dH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Of(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 pH(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?` (${Of(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(` ${nl}`),i.join(` -`)}var hye,gye,Rf=y(()=>{"use strict";Tf();S_();hye=".cladding",gye="measure.jsonl"});import{existsSync as _ye}from"node:fs";import{join as bye}from"node:path";function il(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}** (${vye[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 hH(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 ${Of(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Of(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Of(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`,"",nl),r.join(` -`)}function ol(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"} | ${wye(l,r)} |`)}return n.join(` -`)}function wye(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 Sye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${_ye(bye(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),mH(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)mH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function mH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=pO(r);n&&t.push(`- ${n}`)}t.push("")}var vye,Sye,w_=y(()=>{"use strict";Rf();S_();tl();vye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Sye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as xye}from"node:fs";function Ei(t="./spec.yaml"){let e=xye(t,"utf8");return(0,gH.parse)(e)}var gH,x_=y(()=>{"use strict";gH=bt(Qt(),1)});var ts=v((jr,DO)=>{"use strict";var IO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+_H(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()};IO.prototype.toString=function(){return this.property+" "+this.message};var $_=jr.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};$_.prototype.addError=function(e){var r;if(typeof e=="string")r=new IO(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 IO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new ba(this);if(this.throwError)throw r;return r};$_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function $ye(t,e){return e+": "+t.toString()+` -`}$_.prototype.toString=function(e){return this.errors.map($ye).join("")};Object.defineProperty($_.prototype,"valid",{get:function(){return!this.errors.length}});DO.exports.ValidatorResultError=ba;function ba(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ba),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}ba.prototype=new Error;ba.prototype.constructor=ba;ba.prototype.name="Validation Error";var yH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};yH.prototype=Object.create(Error.prototype,{constructor:{value:yH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var PO=jr.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+_H(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};PO.prototype.resolve=function(e){return bH(this.base,e)};PO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=bH(this.base,i||"");var s=new PO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var _H=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 kye(t,e,r,n){typeof r=="object"?e[n]=CO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Eye(t,e,r){e[r]=t[r]}function Aye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=CO(t[n],e[n]):r[n]=e[n]}function CO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(kye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Eye.bind(null,t,n)),Object.keys(e).forEach(Aye.bind(null,t,e,n))),n}DO.exports.deepMerge=CO;jr.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 Tye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Tye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var bH=jr.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 xH=v((pXe,wH)=>{"use strict";var tn=ts(),Fe=tn.ValidatorResult,rs=tn.SchemaError,NO={};NO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=NO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 jO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new rs("anyOf must be an array");if(!r.anyOf.some(jO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new rs("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new rs("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(jO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=jO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 MO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new rs('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(MO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=MO(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 vH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('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&&vH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)vH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Oye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var FO=ts();LO.exports.SchemaScanResult=$H;function $H(t,e){this.id=t,this.ref=e}LO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=FO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=FO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!FO.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 kH=xH(),ns=ts(),EH=k_().scan,AH=ns.ValidatorResult,Rye=ns.ValidatorResultError,If=ns.SchemaError,TH=ns.SchemaContext,Iye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ai),this.attributes=Object.create(kH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=EH(r||Iye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ns.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new If("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new If('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 Ai=Jt.prototype.types={};Ai.string=function(e){return typeof e=="string"};Ai.number=function(e){return typeof e=="number"&&isFinite(e)};Ai.integer=function(e){return typeof e=="number"&&e%1===0};Ai.boolean=function(e){return typeof e=="boolean"};Ai.array=function(e){return Array.isArray(e)};Ai.null=function(e){return e===null};Ai.date=function(e){return e instanceof Date};Ai.any=function(e){return!0};Ai.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};RH.exports=Jt});var PH=v((gXe,uo)=>{"use strict";var Pye=uo.exports.Validator=IH();uo.exports.ValidatorResult=ts().ValidatorResult;uo.exports.ValidatorResultError=ts().ValidatorResultError;uo.exports.ValidationError=ts().ValidationError;uo.exports.SchemaError=ts().SchemaError;uo.exports.SchemaScanResult=k_().SchemaScanResult;uo.exports.scan=k_().scan;uo.exports.validate=function(t,e,r){var n=new Pye;return n.validate(t,e,r)}});import{readFileSync as Cye}from"node:fs";import{dirname as Dye,join as Nye}from"node:path";import{fileURLToPath as jye}from"node:url";function Uye(t){let e=zye.validate(t,Lye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function DH(t){let e=Uye(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 Bge,rH,Hge,h_=y(()=>{"use strict";Bge=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"]),rH=2e6,Hge="\0"});function Vge(t){for(let i of Zge)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 wT(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Wge(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??[])wT(e,s,o);for(let s of i.modules??[])wT(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Vge(a);c&&wT(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=iH.get(t);return e||(e=Wge(t),iH.set(t,e)),e}var Zge,iH,_a=y(()=>{"use strict";Zge=["derived:","fixture:","script:","self-dogfood:"];iH=new WeakMap});function xT(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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Kge(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=xT(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:$T(i)}}var ba=y(()=>{"use strict";_a()});function oH(t){return t.impacted.length}function y_(t,e,r={}){let n=r.initialDepth??g_.initialDepth,i=r.maxDepth??g_.maxDepth,o=r.coverageThreshold??g_.coverageThreshold,s=r.marginYieldThreshold??g_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=xT(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=oH(_),x=S-p,w=S>0?x/S:0;f.push(w);let T=d>0?S/d:1,O=x===0&&b>n,A={frontierExhausted:O,coverage:T,marginalYields:[...f],totalKnownDependents:d};if(O)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(T>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var g_,kT=y(()=>{"use strict";ba();_a();g_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Jge(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 sH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Jge(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 aH=y(()=>{"use strict"});function Yge(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 nl(t,e){let r=Yge(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=sH(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 __=y(()=>{"use strict";aH()});import{existsSync as lH,readdirSync as Xge,readFileSync as Qge}from"node:fs";import{join as AT}from"node:path";function OT(t,e=tye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function rye(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:OT(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:OT(`done reverted \u2014 pre-push strict gate red${r}`)}}function cH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function nye(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 OT(n)}function iye(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)=>cH(m)-cH(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(-eye).map(rye),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?nye(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 ET(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function oye(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 sye(t,e,r){let n=ET(t,/_Rolled back at_\s*`([^`]+)`/),i=ET(t,/Last failed gate:\s*`([^`]+)`/),o=ET(t,/Retry attempts:\s*(\d+)/),s=oye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function aye(t,e){let r=AT(t,".cladding","post-mortems");if(!lH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Xge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(sye(Qge(AT(r,o),"utf8"),e,o))}catch{}return i}function uH(t,e){try{let r=d_(t),n=aye(t,e),i=lH(AT(t,".cladding","events.log.1.jsonl"));return iye(r,n,e,{truncated:i})}catch{return}}var eye,tye,dH=y(()=>{"use strict";Nr();eye=5,tye=120});function b_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function va(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:cye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let oe=[...a].sort();o=oe[0],oe.length>1&&(s=oe)}let c=nl(t,o);if("not_found"in c)return c;let l=c.focus,u=uH(n,l.id),d=a&&a.size>0?e:l.id,f=y_(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(oe=>oe.ears==="unwanted"||oe.ears==="state").map(oe=>({id:oe.id,ears:String(oe.ears)})),S=[...new Set(b.flatMap(oe=>oe.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}},T=[...c.ancestors];for(;T.length>lye&&b_(w,T,[])>i;)T.pop();T.lengthi){x.push(`code: omitted ${oe} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${oe}`)}O>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(oe,Pe)=>({impacted:oe,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(oe,Pe,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],io={...w,needs:T,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(oe,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(io))>i},se=m,Y=h;if($(se,Y,0,0)){let oe=br(t,d,{depth:1}),Pe=new Set("not_found"in oe?[]:oe.impacted.map(de=>de.id)),Kt=new Set("not_found"in oe?[]:oe.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],io=0;for(;Yt.length>Pe.size&&$(Yt,Y,io,0);)Yt=Yt.slice(0,-1),io++;let vi=[...h],Yr=0;for(;$(Yt,vi,io,Yr);){let de=-1;for(let oo=vi.length-1;oo>=0;oo--)if(!Kt.has(vi[oo])){de=oo;break}if(de<0)break;vi.splice(de,1),Yr++}se=Yt,Y=vi,io+Yr>0&&x.push(`breaks: omitted ${io} feature(s) / ${Yr} test(s)`),$(se,Y,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Te=D(se,Y),C={...w,needs:T,must_edit:{...w.must_edit,code:A},breaks_if_changed:Te},P=C;if(u){let oe={...C,prior_attempts:u};en(JSON.stringify(oe))<=i?P=oe:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var cye,lye,v_=y(()=>{"use strict";h_();__();kT();dH();ba();_a();cye=3e3,lye=3});function Kn(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 uye(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 fH(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=va(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=va(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=y_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let T of f.modules??[]){let O=e(T);O&&(S+=en(O))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:uye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var il,S_=y(()=>{"use strict";h_();kT();v_();_a();il="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as dye,existsSync as TT,mkdirSync as fye,readFileSync as pH}from"node:fs";import{dirname as pye,join as mye}from"node:path";function RT(t){return mye(t,hye,gye)}function yye(t,e){return{timestamp:new Date().toISOString(),head:ya(t),spec_digest:vT(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function mH(t,e){try{let r=yye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=IT(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=RT(t),s=pye(o);return TT(s)||fye(s,{recursive:!0}),dye(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function hH(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 IT(t,e){let r=RT(t);if(!TT(r))return[];let n;try{n=pH(r,"utf8")}catch{return[]}let i=hH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function gH(t){let e=RT(t);if(!TT(e))return{snapshots:[],unreadable:!1};let r;try{r=pH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=hH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Tf(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 yH(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?` (${Tf(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(` ${il}`),i.join(` +`)}var hye,gye,Rf=y(()=>{"use strict";Of();S_();hye=".cladding",gye="measure.jsonl"});import{existsSync as _ye}from"node:fs";import{join as bye}from"node:path";function ol(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}** (${vye[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 bH(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 ${Tf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Tf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Tf(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`,"",il),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"} | ${wye(l,r)} |`)}return n.join(` +`)}function wye(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 Sye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${_ye(bye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function al(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),_H(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)_H(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function _H(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=mT(r);n&&t.push(`- ${n}`)}t.push("")}var vye,Sye,w_=y(()=>{"use strict";Rf();S_();rl();vye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Sye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as xye}from"node:fs";function ki(t="./spec.yaml"){let e=xye(t,"utf8");return(0,vH.parse)(e)}var vH,x_=y(()=>{"use strict";vH=vt(Qt(),1)});var ts=v((jr,NT)=>{"use strict";var PT=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+wH(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()};PT.prototype.toString=function(){return this.property+" "+this.message};var $_=jr.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};$_.prototype.addError=function(e){var r;if(typeof e=="string")r=new PT(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 PT(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new Sa(this);if(this.throwError)throw r;return r};$_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function $ye(t,e){return e+": "+t.toString()+` +`}$_.prototype.toString=function(e){return this.errors.map($ye).join("")};Object.defineProperty($_.prototype,"valid",{get:function(){return!this.errors.length}});NT.exports.ValidatorResultError=Sa;function Sa(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Sa),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}Sa.prototype=new Error;Sa.prototype.constructor=Sa;Sa.prototype.name="Validation Error";var SH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};SH.prototype=Object.create(Error.prototype,{constructor:{value:SH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var CT=jr.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+wH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};CT.prototype.resolve=function(e){return xH(this.base,e)};CT.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=xH(this.base,i||"");var s=new CT(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var wH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 kye(t,e,r,n){typeof r=="object"?e[n]=DT(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Eye(t,e,r){e[r]=t[r]}function Aye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=DT(t[n],e[n]):r[n]=e[n]}function DT(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(kye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Eye.bind(null,t,n)),Object.keys(e).forEach(Aye.bind(null,t,e,n))),n}NT.exports.deepMerge=DT;jr.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 Oye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Oye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var xH=jr.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 AH=v((oXe,EH)=>{"use strict";var tn=ts(),Fe=tn.ValidatorResult,rs=tn.SchemaError,jT={};jT.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=jT.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 MT(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new rs("anyOf must be an array");if(!r.anyOf.some(MT.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new rs("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new rs("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(MT.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=MT.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 FT(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new rs('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(FT(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=FT(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 $H(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('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&&$H.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)$H.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Tye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var LT=ts();zT.exports.SchemaScanResult=OH;function OH(t,e){this.id=t,this.ref=e}zT.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=LT.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=LT.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!LT.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 TH=AH(),ns=ts(),RH=k_().scan,IH=ns.ValidatorResult,Rye=ns.ValidatorResultError,If=ns.SchemaError,PH=ns.SchemaContext,Iye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ei),this.attributes=Object.create(TH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=RH(r||Iye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ns.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new If("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new If('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 Ei=Jt.prototype.types={};Ei.string=function(e){return typeof e=="string"};Ei.number=function(e){return typeof e=="number"&&isFinite(e)};Ei.integer=function(e){return typeof e=="number"&&e%1===0};Ei.boolean=function(e){return typeof e=="boolean"};Ei.array=function(e){return Array.isArray(e)};Ei.null=function(e){return e===null};Ei.date=function(e){return e instanceof Date};Ei.any=function(e){return!0};Ei.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};DH.exports=Jt});var jH=v((cXe,lo)=>{"use strict";var Pye=lo.exports.Validator=NH();lo.exports.ValidatorResult=ts().ValidatorResult;lo.exports.ValidatorResultError=ts().ValidatorResultError;lo.exports.ValidationError=ts().ValidationError;lo.exports.SchemaError=ts().SchemaError;lo.exports.SchemaScanResult=k_().SchemaScanResult;lo.exports.scan=k_().scan;lo.exports.validate=function(t,e,r){var n=new Pye;return n.validate(t,e,r)}});import{readFileSync as Cye}from"node:fs";import{dirname as Dye,join as Nye}from"node:path";import{fileURLToPath as jye}from"node:url";function Uye(t){let e=zye.validate(t,Lye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function FH(t){let e=Uye(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var CH,Mye,Fye,Lye,zye,NH=y(()=>{"use strict";CH=bt(PH(),1),Mye=Dye(jye(import.meta.url)),Fye=Nye(Mye,"schema.json"),Lye=JSON.parse(Cye(Fye,"utf8")),zye=new CH.Validator});import{existsSync as zO,readdirSync as qye}from"node:fs";import{dirname as Bye,join as va,resolve as MH}from"node:path";function jH(t){return zO(t)?qye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ei(va(t,r))):[]}function Sa(t,e){E_=e?{cwd:MH(t),spec:e}:null}function G(t=".",e="spec.yaml"){return E_&&e==="spec.yaml"&&MH(t)===E_.cwd?E_.spec:Hye(t,e)}function Hye(t,e){let r=va(t,e),n=Ei(r),i=va(t,Bye(e),"spec");if(!n.features||n.features.length===0){let o=jH(va(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=jH(va(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=va(i,"architecture.yaml");zO(o)&&(n.architecture=Ei(o))}if(!n.capabilities||n.capabilities.length===0){let o=va(i,"capabilities.yaml");if(zO(o)){let s=Ei(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return DH(n),n}var E_,qe=y(()=>{"use strict";x_();NH();E_=null});import al from"node:process";function BO(){return!!al.stdout.isTTY}function L(t,e,r=""){let n=FH[t],i=r?` ${r}`:"";BO()?al.stdout.write(`${UO[t]}${n}${qO} ${e}${i} -`):al.stdout.write(`${n} ${e}${i} -`)}function Pf(t,e,r=""){if(!BO())return;let n=r?` ${r}`:"";al.stdout.write(`${LH}${UO.start}\xB7${qO} ${t} \xB7 ${e}${n}`)}function wa(t,e,r=""){let n=FH[t],i=r?` ${r}`:"";BO()?al.stdout.write(`${LH}${UO[t]}${n}${qO} ${e}${i} -`):al.stdout.write(`${n} ${e}${i} -`)}var FH,UO,qO,LH,Ti=y(()=>{"use strict";FH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},UO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},qO="\x1B[0m",LH="\r\x1B[K"});import{createHash as sG}from"node:crypto";import{existsSync as w_e,readFileSync as ZO,writeFileSync as x_e}from"node:fs";import{join as A_}from"node:path";function $_e(t,e){let r=sG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(ZO(A_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function cG(t,e){let r=sG("sha256");try{r.update(ZO(A_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function is(t){let e=A_(t,...aG);if(!w_e(e))return null;let r;try{r=ZO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function T_(t){return t.features?.size??t.v1?.size??0}function O_(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)!==cG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===$_e(e,n)?{state:"fresh"}:{state:"stale"}}function lG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${cG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=k_e+`attested_modules: + `)}`)}var MH,Mye,Fye,Lye,zye,LH=y(()=>{"use strict";MH=vt(jH(),1),Mye=Dye(jye(import.meta.url)),Fye=Nye(Mye,"schema.json"),Lye=JSON.parse(Cye(Fye,"utf8")),zye=new MH.Validator});import{existsSync as UT,readdirSync as qye}from"node:fs";import{dirname as Bye,join as wa,resolve as UH}from"node:path";function zH(t){return UT(t)?qye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ki(wa(t,r))):[]}function xa(t,e){E_=e?{cwd:UH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return E_&&e==="spec.yaml"&&UH(t)===E_.cwd?E_.spec:Hye(t,e)}function Hye(t,e){let r=wa(t,e),n=ki(r),i=wa(t,Bye(e),"spec");if(!n.features||n.features.length===0){let o=zH(wa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=zH(wa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=wa(i,"architecture.yaml");UT(o)&&(n.architecture=ki(o))}if(!n.capabilities||n.capabilities.length===0){let o=wa(i,"capabilities.yaml");if(UT(o)){let s=ki(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return FH(n),n}var E_,qe=y(()=>{"use strict";x_();LH();E_=null});import cl from"node:process";function HT(){return!!cl.stdout.isTTY}function U(t,e,r=""){let n=qH[t],i=r?` ${r}`:"";HT()?cl.stdout.write(`${qT[t]}${n}${BT} ${e}${i} +`):cl.stdout.write(`${n} ${e}${i} +`)}function Pf(t,e,r=""){if(!HT())return;let n=r?` ${r}`:"";cl.stdout.write(`${BH}${qT.start}\xB7${BT} ${t} \xB7 ${e}${n}`)}function $a(t,e,r=""){let n=qH[t],i=r?` ${r}`:"";HT()?cl.stdout.write(`${BH}${qT[t]}${n}${BT} ${e}${i} +`):cl.stdout.write(`${n} ${e}${i} +`)}var qH,qT,BT,BH,Ai=y(()=>{"use strict";qH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},qT={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},BT="\x1B[0m",BH="\r\x1B[K"});import{createHash as uG}from"node:crypto";import{existsSync as w_e,readFileSync as VT,writeFileSync as x_e}from"node:fs";import{join as A_}from"node:path";function $_e(t,e){let r=uG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(VT(A_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function fG(t,e){let r=uG("sha256");try{r.update(VT(A_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function is(t){let e=A_(t,...dG);if(!w_e(e))return null;let r;try{r=VT(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function O_(t){return t.features?.size??t.v1?.size??0}function T_(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)!==fG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===$_e(e,n)?{state:"fresh"}:{state:"stale"}}function pG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${fG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=k_e+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return x_e(A_(t,...aG),s,"utf8"),!0}var aG,k_e,ll=y(()=>{"use strict";aG=["spec","attestation.yaml"];k_e=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return x_e(A_(t,...dG),s,"utf8"),!0}var dG,k_e,ul=y(()=>{"use strict";dG=["spec","attestation.yaml"];k_e=`# 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. # @@ -211,52 +211,52 @@ 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 VO}from"node:path";function R_(t){os={cwd:VO(t),results:new Map}}function uG(t,e,r){!os||os.cwd!==VO(e)||os.results.set(t,r)}function I_(t,e){return!os||os.cwd!==VO(e)?null:os.results.get(t)??null}function P_(){os=null}var os,ul=y(()=>{"use strict";os=null});function At(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 po=y(()=>{});import{fileURLToPath as E_e}from"node:url";var dl,A_e,WO,KO,fl=y(()=>{dl=(t,e)=>{let r=KO(A_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},A_e=t=>WO(t)?t.toString():t,WO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,KO=t=>t instanceof URL?E_e(t):t});var C_,JO=y(()=>{po();fl();C_=(t,e=[],r={})=>{let n=dl(t,"First argument"),[i,o]=At(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(!At(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as T_e}from"node:string_decoder";var dG,fG,zt,mo,O_e,pG,R_e,D_,mG,I_e,Nf,P_e,YO,C_e,rn=y(()=>{({toString:dG}=Object.prototype),fG=t=>dG.call(t)==="[object ArrayBuffer]",zt=t=>dG.call(t)==="[object Uint8Array]",mo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),O_e=new TextEncoder,pG=t=>O_e.encode(t),R_e=new TextDecoder,D_=t=>R_e.decode(t),mG=(t,e)=>I_e(t,e).join(""),I_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new T_e(e),n=t.map(o=>typeof o=="string"?pG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Nf=t=>t.length===1&&zt(t[0])?t[0]:YO(P_e(t)),P_e=t=>t.map(e=>typeof e=="string"?pG(e):e),YO=t=>{let e=new Uint8Array(C_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},C_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as D_e}from"node:child_process";var _G,bG,N_e,j_e,hG,M_e,gG,yG,F_e,vG=y(()=>{po();rn();_G=t=>Array.isArray(t)&&Array.isArray(t.raw),bG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=N_e({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,{}]},N_e=({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}=j_e(i,t.raw[n]),c=gG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>yG(d)):[yG(l)];return gG(c,u,a)},j_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=hG.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)],yG=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(At(t)&&("stdout"in t||"isMaxBuffer"in t))return F_e(t);throw t instanceof D_e||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`)},F_e=({stdout:t})=>{if(typeof t=="string")return t;if(zt(t))return D_(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 XO from"node:process";var Yn,N_,En,j_,ho=y(()=>{Yn=t=>N_.includes(t),N_=[XO.stdin,XO.stdout,XO.stderr],En=["stdin","stdout","stderr"],j_=t=>En[t]??`stdio[${t}]`});import{debuglog as L_e}from"node:util";var wG,QO,z_e,U_e,q_e,B_e,SG,H_e,eR,G_e,Z_e,V_e,W_e,tR,go,yo=y(()=>{po();ho();wG=t=>{let e={...t};for(let r of tR)e[r]=QO(t,r);return e},QO=(t,e)=>{let r=Array.from({length:z_e(t)+1}),n=U_e(t[e],r,e);return Z_e(n,e)},z_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,U_e=(t,e,r)=>At(t)?q_e(t,e,r):e.fill(t),q_e=(t,e,r)=>{for(let n of Object.keys(t).sort(B_e))for(let i of H_e(n,r,e))e[i]=t[n];return e},B_e=(t,e)=>SG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,H_e=(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 WT}from"node:path";function R_(t){os={cwd:WT(t),results:new Map}}function mG(t,e,r){!os||os.cwd!==WT(e)||os.results.set(t,r)}function I_(t,e){return!os||os.cwd!==WT(e)?null:os.results.get(t)??null}function P_(){os=null}var os,dl=y(()=>{"use strict";os=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 fo=y(()=>{});import{fileURLToPath as E_e}from"node:url";var fl,A_e,KT,JT,pl=y(()=>{fl=(t,e)=>{let r=JT(A_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},A_e=t=>KT(t)?t.toString():t,KT=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,JT=t=>t instanceof URL?E_e(t):t});var C_,YT=y(()=>{fo();pl();C_=(t,e=[],r={})=>{let n=fl(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 O_e}from"node:string_decoder";var hG,gG,zt,po,T_e,yG,R_e,D_,_G,I_e,Nf,P_e,XT,C_e,rn=y(()=>{({toString:hG}=Object.prototype),gG=t=>hG.call(t)==="[object ArrayBuffer]",zt=t=>hG.call(t)==="[object Uint8Array]",po=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),T_e=new TextEncoder,yG=t=>T_e.encode(t),R_e=new TextDecoder,D_=t=>R_e.decode(t),_G=(t,e)=>I_e(t,e).join(""),I_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new O_e(e),n=t.map(o=>typeof o=="string"?yG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Nf=t=>t.length===1&&zt(t[0])?t[0]:XT(P_e(t)),P_e=t=>t.map(e=>typeof e=="string"?yG(e):e),XT=t=>{let e=new Uint8Array(C_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},C_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as D_e}from"node:child_process";var wG,xG,N_e,j_e,bG,M_e,vG,SG,F_e,$G=y(()=>{fo();rn();wG=t=>Array.isArray(t)&&Array.isArray(t.raw),xG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=N_e({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,{}]},N_e=({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}=j_e(i,t.raw[n]),c=vG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>SG(d)):[SG(l)];return vG(c,u,a)},j_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=bG.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)],SG=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 F_e(t);throw t instanceof D_e||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`)},F_e=({stdout:t})=>{if(typeof t=="string")return t;if(zt(t))return D_(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 QT from"node:process";var Yn,N_,En,j_,mo=y(()=>{Yn=t=>N_.includes(t),N_=[QT.stdin,QT.stdout,QT.stderr],En=["stdin","stdout","stderr"],j_=t=>En[t]??`stdio[${t}]`});import{debuglog as L_e}from"node:util";var EG,eR,z_e,U_e,q_e,B_e,kG,H_e,tR,G_e,Z_e,V_e,W_e,rR,ho,go=y(()=>{fo();mo();EG=t=>{let e={...t};for(let r of rR)e[r]=eR(t,r);return e},eR=(t,e)=>{let r=Array.from({length:z_e(t)+1}),n=U_e(t[e],r,e);return Z_e(n,e)},z_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,U_e=(t,e,r)=>Ot(t)?q_e(t,e,r):e.fill(t),q_e=(t,e,r)=>{for(let n of Object.keys(t).sort(B_e))for(let i of H_e(n,r,e))e[i]=t[n];return e},B_e=(t,e)=>kG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,H_e=(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]},eR=t=>{if(t==="all")return t;if(En.includes(t))return En.indexOf(t);let e=G_e.exec(t);if(e!==null)return Number(e[1])},G_e=/^fd(\d+)$/,Z_e=(t,e)=>t.map(r=>r===void 0?W_e[e]:r),V_e=L_e("execa").enabled?"full":"none",W_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:V_e,stripFinalNewline:!0},tR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],go=(t,e)=>e==="ipc"?t.at(-1):t[e]});var pl,ml,xG,rR,K_e,M_,F_,ss=y(()=>{yo();pl=({verbose:t},e)=>rR(t,e)!=="none",ml=({verbose:t},e)=>!["none","short"].includes(rR(t,e)),xG=({verbose:t},e)=>{let r=rR(t,e);return M_(r)?r:void 0},rR=(t,e)=>e===void 0?K_e(t):go(t,e),K_e=t=>t.find(e=>M_(e))??F_.findLast(e=>t.includes(e)),M_=t=>typeof t=="function",F_=["none","short","full"]});import{platform as J_e}from"node:process";import{stripVTControlCharacters as Y_e}from"node:util";var $G,jf,kG,X_e,Q_e,ebe,tbe,rbe,nbe,ibe,L_=y(()=>{$G=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>nbe(kG(o))).join(" ");return{command:n,escapedCommand:i}},jf=t=>Y_e(t).split(` -`).map(e=>kG(e)).join(` -`),kG=t=>t.replaceAll(ebe,e=>X_e(e)),X_e=t=>{let e=tbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=rbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Q_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},ebe=Q_e(),tbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},rbe=65535,nbe=t=>ibe.test(t)?t:J_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,ibe=/^[\w./-]+$/});import EG from"node:process";function nR(){let{env:t}=EG,{TERM:e,TERM_PROGRAM:r}=t;return EG.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 AG=y(()=>{});var TG,OG,obe,sbe,abe,cbe,lbe,z_,v7e,RG=y(()=>{AG();TG={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"},OG={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"},obe={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"},sbe={...TG,...OG},abe={...TG,...obe},cbe=nR(),lbe=cbe?sbe:abe,z_=lbe,v7e=Object.entries(OG)});import ube from"node:tty";var dbe,_e,x7e,IG,$7e,k7e,E7e,A7e,T7e,O7e,R7e,I7e,P7e,C7e,D7e,N7e,j7e,M7e,F7e,U_,L7e,z7e,U7e,q7e,B7e,H7e,G7e,Z7e,V7e,PG,W7e,CG,K7e,J7e,Y7e,X7e,Q7e,eQe,tQe,rQe,nQe,iQe,oQe,iR=y(()=>{dbe=ube?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!dbe)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}},x7e=_e(0,0),IG=_e(1,22),$7e=_e(2,22),k7e=_e(3,23),E7e=_e(4,24),A7e=_e(53,55),T7e=_e(7,27),O7e=_e(8,28),R7e=_e(9,29),I7e=_e(30,39),P7e=_e(31,39),C7e=_e(32,39),D7e=_e(33,39),N7e=_e(34,39),j7e=_e(35,39),M7e=_e(36,39),F7e=_e(37,39),U_=_e(90,39),L7e=_e(40,49),z7e=_e(41,49),U7e=_e(42,49),q7e=_e(43,49),B7e=_e(44,49),H7e=_e(45,49),G7e=_e(46,49),Z7e=_e(47,49),V7e=_e(100,49),PG=_e(91,39),W7e=_e(92,39),CG=_e(93,39),K7e=_e(94,39),J7e=_e(95,39),Y7e=_e(96,39),X7e=_e(97,39),Q7e=_e(101,49),eQe=_e(102,49),tQe=_e(103,49),rQe=_e(104,49),nQe=_e(105,49),iQe=_e(106,49),oQe=_e(107,49)});var DG=y(()=>{iR();iR()});var MG,pbe,q_,NG,mbe,jG,hbe,FG=y(()=>{RG();DG();MG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=pbe(r),c=mbe[t]({failed:o,reject:s,piped:n}),l=hbe[t]({reject:s});return`${U_(`[${a}]`)} ${U_(`[${i}]`)} ${l(c)} ${l(e)}`},pbe=t=>`${q_(t.getHours(),2)}:${q_(t.getMinutes(),2)}:${q_(t.getSeconds(),2)}.${q_(t.getMilliseconds(),3)}`,q_=(t,e)=>String(t).padStart(e,"0"),NG=({failed:t,reject:e})=>t?e?z_.cross:z_.warning:z_.tick,mbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:NG,duration:NG},jG=t=>t,hbe={command:()=>IG,output:()=>jG,ipc:()=>jG,error:({reject:t})=>t?PG:CG,duration:()=>U_}});var LG,gbe,ybe,zG=y(()=>{ss();LG=(t,e,r)=>{let n=xG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>gbe(i,o,n)).filter(i=>i!==void 0).map(i=>ybe(i)).join("")},gbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ybe=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(En.includes(t))return En.indexOf(t);let e=G_e.exec(t);if(e!==null)return Number(e[1])},G_e=/^fd(\d+)$/,Z_e=(t,e)=>t.map(r=>r===void 0?W_e[e]:r),V_e=L_e("execa").enabled?"full":"none",W_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:V_e,stripFinalNewline:!0},rR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],ho=(t,e)=>e==="ipc"?t.at(-1):t[e]});var ml,hl,AG,nR,K_e,M_,F_,ss=y(()=>{go();ml=({verbose:t},e)=>nR(t,e)!=="none",hl=({verbose:t},e)=>!["none","short"].includes(nR(t,e)),AG=({verbose:t},e)=>{let r=nR(t,e);return M_(r)?r:void 0},nR=(t,e)=>e===void 0?K_e(t):ho(t,e),K_e=t=>t.find(e=>M_(e))??F_.findLast(e=>t.includes(e)),M_=t=>typeof t=="function",F_=["none","short","full"]});import{platform as J_e}from"node:process";import{stripVTControlCharacters as Y_e}from"node:util";var OG,jf,TG,X_e,Q_e,ebe,tbe,rbe,nbe,ibe,L_=y(()=>{OG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>nbe(TG(o))).join(" ");return{command:n,escapedCommand:i}},jf=t=>Y_e(t).split(` +`).map(e=>TG(e)).join(` +`),TG=t=>t.replaceAll(ebe,e=>X_e(e)),X_e=t=>{let e=tbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=rbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Q_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},ebe=Q_e(),tbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},rbe=65535,nbe=t=>ibe.test(t)?t:J_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,ibe=/^[\w./-]+$/});import RG from"node:process";function iR(){let{env:t}=RG,{TERM:e,TERM_PROGRAM:r}=t;return RG.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 IG=y(()=>{});var PG,CG,obe,sbe,abe,cbe,lbe,z_,f7e,DG=y(()=>{IG();PG={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"},CG={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"},obe={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"},sbe={...PG,...CG},abe={...PG,...obe},cbe=iR(),lbe=cbe?sbe:abe,z_=lbe,f7e=Object.entries(CG)});import ube from"node:tty";var dbe,_e,h7e,NG,g7e,y7e,_7e,b7e,v7e,S7e,w7e,x7e,$7e,k7e,E7e,A7e,O7e,T7e,R7e,U_,I7e,P7e,C7e,D7e,N7e,j7e,M7e,F7e,L7e,jG,z7e,MG,U7e,q7e,B7e,H7e,G7e,Z7e,V7e,W7e,K7e,J7e,Y7e,oR=y(()=>{dbe=ube?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!dbe)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}},h7e=_e(0,0),NG=_e(1,22),g7e=_e(2,22),y7e=_e(3,23),_7e=_e(4,24),b7e=_e(53,55),v7e=_e(7,27),S7e=_e(8,28),w7e=_e(9,29),x7e=_e(30,39),$7e=_e(31,39),k7e=_e(32,39),E7e=_e(33,39),A7e=_e(34,39),O7e=_e(35,39),T7e=_e(36,39),R7e=_e(37,39),U_=_e(90,39),I7e=_e(40,49),P7e=_e(41,49),C7e=_e(42,49),D7e=_e(43,49),N7e=_e(44,49),j7e=_e(45,49),M7e=_e(46,49),F7e=_e(47,49),L7e=_e(100,49),jG=_e(91,39),z7e=_e(92,39),MG=_e(93,39),U7e=_e(94,39),q7e=_e(95,39),B7e=_e(96,39),H7e=_e(97,39),G7e=_e(101,49),Z7e=_e(102,49),V7e=_e(103,49),W7e=_e(104,49),K7e=_e(105,49),J7e=_e(106,49),Y7e=_e(107,49)});var FG=y(()=>{oR();oR()});var UG,pbe,q_,LG,mbe,zG,hbe,qG=y(()=>{DG();FG();UG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=pbe(r),c=mbe[t]({failed:o,reject:s,piped:n}),l=hbe[t]({reject:s});return`${U_(`[${a}]`)} ${U_(`[${i}]`)} ${l(c)} ${l(e)}`},pbe=t=>`${q_(t.getHours(),2)}:${q_(t.getMinutes(),2)}:${q_(t.getSeconds(),2)}.${q_(t.getMilliseconds(),3)}`,q_=(t,e)=>String(t).padStart(e,"0"),LG=({failed:t,reject:e})=>t?e?z_.cross:z_.warning:z_.tick,mbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:LG,duration:LG},zG=t=>t,hbe={command:()=>NG,output:()=>zG,ipc:()=>zG,error:({reject:t})=>t?jG:MG,duration:()=>U_}});var BG,gbe,ybe,HG=y(()=>{ss();BG=(t,e,r)=>{let n=AG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>gbe(i,o,n)).filter(i=>i!==void 0).map(i=>ybe(i)).join("")},gbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ybe=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as _be}from"node:util";var Oi,bbe,vbe,Sbe,B_,wbe,hl=y(()=>{L_();FG();zG();Oi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=bbe({type:t,result:i,verboseInfo:n}),s=vbe(e,o),a=LG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},bbe=({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}),vbe=(t,e)=>t.split(` -`).map(r=>Sbe({...e,message:r})),Sbe=t=>({verboseLine:MG(t),verboseObject:t}),B_=t=>{let e=typeof t=="string"?t:_be(t);return jf(e).replaceAll(" "," ".repeat(wbe))},wbe=2});var UG,qG=y(()=>{ss();hl();UG=(t,e)=>{pl(e)&&Oi({type:"command",verboseMessage:t,verboseInfo:e})}});var BG,xbe,$be,kbe,HG=y(()=>{ss();BG=(t,e,r)=>{kbe(t);let n=xbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},xbe=t=>pl({verbose:t})?$be++:void 0,$be=0n,kbe=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(!F_.includes(e)&&!M_(e)){let r=F_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as GG}from"node:process";var H_,oR,G_=y(()=>{H_=()=>GG.bigint(),oR=t=>Number(GG.bigint()-t)/1e6});var Z_,sR=y(()=>{qG();HG();G_();L_();yo();Z_=(t,e,r)=>{let n=H_(),{command:i,escapedCommand:o}=$G(t,e),s=QO(r,"verbose"),a=BG(s,o,{...r});return UG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var JG=v((IQe,KG)=>{KG.exports=WG;WG.sync=Abe;var ZG=He("fs");function Ebe(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{eZ.exports=XG;XG.sync=Tbe;var YG=He("fs");function XG(t,e,r){YG.stat(t,function(n,i){r(n,n?!1:QG(i,e))})}function Tbe(t,e){return QG(YG.statSync(t),e)}function QG(t,e){return t.isFile()&&Obe(t,e)}function Obe(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 nZ=v((DQe,rZ)=>{var CQe=He("fs"),V_;process.platform==="win32"||global.TESTING_WINDOWS?V_=JG():V_=tZ();rZ.exports=aR;aR.sync=Rbe;function aR(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){aR(t,e||{},function(o,s){o?i(o):n(s)})})}V_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Rbe(t,e){try{return V_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var uZ=v((NQe,lZ)=>{var gl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",iZ=He("path"),Ibe=gl?";":":",oZ=nZ(),sZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),aZ=(t,e)=>{let r=e.colon||Ibe,n=t.match(/\//)||gl&&t.match(/\\/)?[""]:[...gl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=gl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=gl?i.split(r):[""];return gl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},cZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=aZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(sZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=iZ.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];oZ(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)},Pbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=aZ(t,e),o=[];for(let s=0;s{"use strict";var dZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};cR.exports=dZ;cR.exports.default=dZ});var gZ=v((MQe,hZ)=>{"use strict";var pZ=He("path"),Cbe=uZ(),Dbe=fZ();function mZ(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=Cbe.sync(t.command,{path:r[Dbe({env:r})],pathExt:e?pZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=pZ.resolve(i?t.options.cwd:"",s)),s}function Nbe(t){return mZ(t)||mZ(t,!0)}hZ.exports=Nbe});var yZ=v((FQe,uR)=>{"use strict";var lR=/([()\][%!^"`<>&|;, *?])/g;function jbe(t){return t=t.replace(lR,"^$1"),t}function Mbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(lR,"^$1"),e&&(t=t.replace(lR,"^$1")),t}uR.exports.command=jbe;uR.exports.argument=Mbe});var bZ=v((LQe,_Z)=>{"use strict";_Z.exports=/^#!(.*)/});var SZ=v((zQe,vZ)=>{"use strict";var Fbe=bZ();vZ.exports=(t="")=>{let e=t.match(Fbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var xZ=v((UQe,wZ)=>{"use strict";var dR=He("fs"),Lbe=SZ();function zbe(t){let r=Buffer.alloc(150),n;try{n=dR.openSync(t,"r"),dR.readSync(n,r,0,150,0),dR.closeSync(n)}catch{}return Lbe(r.toString())}wZ.exports=zbe});var AZ=v((qQe,EZ)=>{"use strict";var Ube=He("path"),$Z=gZ(),kZ=yZ(),qbe=xZ(),Bbe=process.platform==="win32",Hbe=/\.(?:com|exe)$/i,Gbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Zbe(t){t.file=$Z(t);let e=t.file&&qbe(t.file);return e?(t.args.unshift(t.file),t.command=e,$Z(t)):t.file}function Vbe(t){if(!Bbe)return t;let e=Zbe(t),r=!Hbe.test(e);if(t.options.forceShell||r){let n=Gbe.test(e);t.command=Ube.normalize(t.command),t.command=kZ.command(t.command),t.args=t.args.map(o=>kZ.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 Wbe(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:Vbe(n)}EZ.exports=Wbe});var RZ=v((BQe,OZ)=>{"use strict";var fR=process.platform==="win32";function pR(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 Kbe(t,e){if(!fR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=TZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function TZ(t,e){return fR&&t===1&&!e.file?pR(e.original,"spawn"):null}function Jbe(t,e){return fR&&t===1&&!e.file?pR(e.original,"spawnSync"):null}OZ.exports={hookChildProcess:Kbe,verifyENOENT:TZ,verifyENOENTSync:Jbe,notFoundError:pR}});var CZ=v((HQe,yl)=>{"use strict";var IZ=He("child_process"),mR=AZ(),hR=RZ();function PZ(t,e,r){let n=mR(t,e,r),i=IZ.spawn(n.command,n.args,n.options);return hR.hookChildProcess(i,n),i}function Ybe(t,e,r){let n=mR(t,e,r),i=IZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||hR.verifyENOENTSync(i.status,n),i}yl.exports=PZ;yl.exports.spawn=PZ;yl.exports.sync=Ybe;yl.exports._parse=mR;yl.exports._enoent=hR});function W_(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 DZ=y(()=>{});var NZ=y(()=>{});import{promisify as Xbe}from"node:util";import{execFile as Qbe,execFileSync as KQe}from"node:child_process";import jZ from"node:path";import{fileURLToPath as eve}from"node:url";function K_(t){return t instanceof URL?eve(t):t}function MZ(t){return{*[Symbol.iterator](){let e=jZ.resolve(K_(t)),r;for(;r!==e;)yield e,r=e,e=jZ.resolve(e,"..")}}}var XQe,QQe,FZ=y(()=>{NZ();XQe=Xbe(Qbe);QQe=10*1024*1024});import J_ from"node:process";import $a from"node:path";var tve,rve,nve,LZ,zZ=y(()=>{DZ();FZ();tve=({cwd:t=J_.cwd(),path:e=J_.env[W_()],preferLocal:r=!0,execPath:n=J_.execPath,addExecPath:i=!0}={})=>{let o=$a.resolve(K_(t)),s=[],a=e.split($a.delimiter);return r&&rve(s,a,o),i&&nve(s,a,n,o),e===""||e===$a.delimiter?`${s.join($a.delimiter)}${e}`:[...s,e].join($a.delimiter)},rve=(t,e,r)=>{for(let n of MZ(r)){let i=$a.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},nve=(t,e,r,n)=>{let i=$a.resolve(n,K_(r),"..");e.includes(i)||t.push(i)},LZ=({env:t=J_.env,...e}={})=>{t={...t};let r=W_({env:t});return e.path=t[r],t[r]=tve(e),t}});var UZ,Xn,qZ,BZ,HZ,Y_,Mf,Ff,ka=y(()=>{UZ=(t,e,r)=>{let n=r?Ff:Mf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},qZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,HZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},BZ=t=>Y_(t)&&HZ in t,HZ=Symbol("isExecaError"),Y_=t=>Object.prototype.toString.call(t)==="[object Error]",Mf=class extends Error{};qZ(Mf,Mf.name);Ff=class extends Error{};qZ(Ff,Ff.name)});var GZ,ive,ZZ,VZ,WZ=y(()=>{GZ=()=>{let t=VZ-ZZ+1;return Array.from({length:t},ive)},ive=(t,e)=>({name:`SIGRT${e+1}`,number:ZZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),ZZ=34,VZ=64});var KZ,JZ=y(()=>{KZ=[{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 ove}from"node:os";var gR,sve,YZ=y(()=>{JZ();WZ();gR=()=>{let t=GZ();return[...KZ,...t].map(sve)},sve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=ove,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as ave}from"node:os";var cve,lve,XZ,uve,dve,fve,yet,QZ=y(()=>{YZ();cve=()=>{let t=gR();return Object.fromEntries(t.map(lve))},lve=({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}],XZ=cve(),uve=()=>{let t=gR(),e=65,r=Array.from({length:e},(n,i)=>dve(i,t));return Object.assign({},...r)},dve=(t,e)=>{let r=fve(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}}},fve=(t,e)=>{let r=e.find(({name:n})=>ave.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},yet=uve()});import{constants as Lf}from"node:os";var t9,r9,n9,pve,mve,e9,hve,yR,gve,yve,X_,zf=y(()=>{QZ();t9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return n9(t,e)},r9=t=>t===0?t:n9(t,"`subprocess.kill()`'s argument"),n9=(t,e)=>{if(Number.isInteger(t))return pve(t,e);if(typeof t=="string")return hve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${yR()}`)},pve=(t,e)=>{if(e9.has(t))return e9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${yR()}`)},mve=()=>new Map(Object.entries(Lf.signals).reverse().map(([t,e])=>[e,t])),e9=mve(),hve=(t,e)=>{if(t in Lf.signals)return t;throw t.toUpperCase()in Lf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${yR()}`)},yR=()=>`Available signal names: ${gve()}. -Available signal numbers: ${yve()}.`,gve=()=>Object.keys(Lf.signals).sort().map(t=>`'${t}'`).join(", "),yve=()=>[...new Set(Object.values(Lf.signals).sort((t,e)=>t-e))].join(", "),X_=t=>XZ[t].description});import{setTimeout as _ve}from"node:timers/promises";var i9,bve,o9,vve,Sve,wve,_R,Q_=y(()=>{ka();zf();i9=t=>{if(t===!1)return t;if(t===!0)return bve;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},bve=1e3*5,o9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=vve(s,a,r);Sve(l,n);let u=t(c);return wve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},vve=(t,e,r)=>{let[n=r,i]=Y_(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&&!Y_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:r9(n),error:i}},Sve=(t,e)=>{t!==void 0&&e.reject(t)},wve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&_R({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},_R=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await _ve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as xve}from"node:events";var eb,bR=y(()=>{eb=async(t,e)=>{t.aborted||await xve(t,"abort",{signal:e})}});var s9,a9,$ve,vR=y(()=>{bR();s9=({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)}`)},a9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[$ve(t,e,n,i)],$ve=async(t,e,r,{signal:n})=>{throw await eb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var _l,kve,SR,c9,l9,tb,u9,d9,f9,p9,m9,h9,Eve,Ave,Tve,Qn,Ove,as,bl,vl=y(()=>{_l=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{kve(t,e,r),SR(t,e,n)},kve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},SR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${as(e)} has already exited or disconnected.`)},c9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${as(t)} exited or disconnected.`)},l9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as _be}from"node:util";var Oi,bbe,vbe,Sbe,B_,wbe,gl=y(()=>{L_();qG();HG();Oi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=bbe({type:t,result:i,verboseInfo:n}),s=vbe(e,o),a=BG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},bbe=({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}),vbe=(t,e)=>t.split(` +`).map(r=>Sbe({...e,message:r})),Sbe=t=>({verboseLine:UG(t),verboseObject:t}),B_=t=>{let e=typeof t=="string"?t:_be(t);return jf(e).replaceAll(" "," ".repeat(wbe))},wbe=2});var GG,ZG=y(()=>{ss();gl();GG=(t,e)=>{ml(e)&&Oi({type:"command",verboseMessage:t,verboseInfo:e})}});var VG,xbe,$be,kbe,WG=y(()=>{ss();VG=(t,e,r)=>{kbe(t);let n=xbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},xbe=t=>ml({verbose:t})?$be++:void 0,$be=0n,kbe=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(!F_.includes(e)&&!M_(e)){let r=F_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as KG}from"node:process";var H_,sR,G_=y(()=>{H_=()=>KG.bigint(),sR=t=>Number(KG.bigint()-t)/1e6});var Z_,aR=y(()=>{ZG();WG();G_();L_();go();Z_=(t,e,r)=>{let n=H_(),{command:i,escapedCommand:o}=OG(t,e),s=eR(r,"verbose"),a=VG(s,o,{...r});return GG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var eZ=v((xQe,QG)=>{QG.exports=XG;XG.sync=Abe;var JG=He("fs");function Ebe(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{iZ.exports=rZ;rZ.sync=Obe;var tZ=He("fs");function rZ(t,e,r){tZ.stat(t,function(n,i){r(n,n?!1:nZ(i,e))})}function Obe(t,e){return nZ(tZ.statSync(t),e)}function nZ(t,e){return t.isFile()&&Tbe(t,e)}function Tbe(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 aZ=v((EQe,sZ)=>{var kQe=He("fs"),V_;process.platform==="win32"||global.TESTING_WINDOWS?V_=eZ():V_=oZ();sZ.exports=cR;cR.sync=Rbe;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)})})}V_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Rbe(t,e){try{return V_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var mZ=v((AQe,pZ)=>{var yl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",cZ=He("path"),Ibe=yl?";":":",lZ=aZ(),uZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),dZ=(t,e)=>{let r=e.colon||Ibe,n=t.match(/\//)||yl&&t.match(/\\/)?[""]:[...yl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=yl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=yl?i.split(r):[""];return yl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},fZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=dZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(uZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=cZ.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];lZ(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)},Pbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=dZ(t,e),o=[];for(let s=0;s{"use strict";var hZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};lR.exports=hZ;lR.exports.default=hZ});var vZ=v((TQe,bZ)=>{"use strict";var yZ=He("path"),Cbe=mZ(),Dbe=gZ();function _Z(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=Cbe.sync(t.command,{path:r[Dbe({env:r})],pathExt:e?yZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=yZ.resolve(i?t.options.cwd:"",s)),s}function Nbe(t){return _Z(t)||_Z(t,!0)}bZ.exports=Nbe});var SZ=v((RQe,dR)=>{"use strict";var uR=/([()\][%!^"`<>&|;, *?])/g;function jbe(t){return t=t.replace(uR,"^$1"),t}function Mbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(uR,"^$1"),e&&(t=t.replace(uR,"^$1")),t}dR.exports.command=jbe;dR.exports.argument=Mbe});var xZ=v((IQe,wZ)=>{"use strict";wZ.exports=/^#!(.*)/});var kZ=v((PQe,$Z)=>{"use strict";var Fbe=xZ();$Z.exports=(t="")=>{let e=t.match(Fbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var AZ=v((CQe,EZ)=>{"use strict";var fR=He("fs"),Lbe=kZ();function zbe(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 Lbe(r.toString())}EZ.exports=zbe});var IZ=v((DQe,RZ)=>{"use strict";var Ube=He("path"),OZ=vZ(),TZ=SZ(),qbe=AZ(),Bbe=process.platform==="win32",Hbe=/\.(?:com|exe)$/i,Gbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Zbe(t){t.file=OZ(t);let e=t.file&&qbe(t.file);return e?(t.args.unshift(t.file),t.command=e,OZ(t)):t.file}function Vbe(t){if(!Bbe)return t;let e=Zbe(t),r=!Hbe.test(e);if(t.options.forceShell||r){let n=Gbe.test(e);t.command=Ube.normalize(t.command),t.command=TZ.command(t.command),t.args=t.args.map(o=>TZ.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 Wbe(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:Vbe(n)}RZ.exports=Wbe});var DZ=v((NQe,CZ)=>{"use strict";var pR=process.platform==="win32";function mR(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 Kbe(t,e){if(!pR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=PZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function PZ(t,e){return pR&&t===1&&!e.file?mR(e.original,"spawn"):null}function Jbe(t,e){return pR&&t===1&&!e.file?mR(e.original,"spawnSync"):null}CZ.exports={hookChildProcess:Kbe,verifyENOENT:PZ,verifyENOENTSync:Jbe,notFoundError:mR}});var MZ=v((jQe,_l)=>{"use strict";var NZ=He("child_process"),hR=IZ(),gR=DZ();function jZ(t,e,r){let n=hR(t,e,r),i=NZ.spawn(n.command,n.args,n.options);return gR.hookChildProcess(i,n),i}function Ybe(t,e,r){let n=hR(t,e,r),i=NZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||gR.verifyENOENTSync(i.status,n),i}_l.exports=jZ;_l.exports.spawn=jZ;_l.exports.sync=Ybe;_l.exports._parse=hR;_l.exports._enoent=gR});function W_(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 FZ=y(()=>{});var LZ=y(()=>{});import{promisify as Xbe}from"node:util";import{execFile as Qbe,execFileSync as UQe}from"node:child_process";import zZ from"node:path";import{fileURLToPath as eve}from"node:url";function K_(t){return t instanceof URL?eve(t):t}function UZ(t){return{*[Symbol.iterator](){let e=zZ.resolve(K_(t)),r;for(;r!==e;)yield e,r=e,e=zZ.resolve(e,"..")}}}var HQe,GQe,qZ=y(()=>{LZ();HQe=Xbe(Qbe);GQe=10*1024*1024});import J_ from"node:process";import Ea from"node:path";var tve,rve,nve,BZ,HZ=y(()=>{FZ();qZ();tve=({cwd:t=J_.cwd(),path:e=J_.env[W_()],preferLocal:r=!0,execPath:n=J_.execPath,addExecPath:i=!0}={})=>{let o=Ea.resolve(K_(t)),s=[],a=e.split(Ea.delimiter);return r&&rve(s,a,o),i&&nve(s,a,n,o),e===""||e===Ea.delimiter?`${s.join(Ea.delimiter)}${e}`:[...s,e].join(Ea.delimiter)},rve=(t,e,r)=>{for(let n of UZ(r)){let i=Ea.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},nve=(t,e,r,n)=>{let i=Ea.resolve(n,K_(r),"..");e.includes(i)||t.push(i)},BZ=({env:t=J_.env,...e}={})=>{t={...t};let r=W_({env:t});return e.path=t[r],t[r]=tve(e),t}});var GZ,Xn,ZZ,VZ,WZ,Y_,Mf,Ff,Aa=y(()=>{GZ=(t,e,r)=>{let n=r?Ff:Mf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},ZZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,WZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},VZ=t=>Y_(t)&&WZ in t,WZ=Symbol("isExecaError"),Y_=t=>Object.prototype.toString.call(t)==="[object Error]",Mf=class extends Error{};ZZ(Mf,Mf.name);Ff=class extends Error{};ZZ(Ff,Ff.name)});var KZ,ive,JZ,YZ,XZ=y(()=>{KZ=()=>{let t=YZ-JZ+1;return Array.from({length:t},ive)},ive=(t,e)=>({name:`SIGRT${e+1}`,number:JZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),JZ=34,YZ=64});var QZ,e9=y(()=>{QZ=[{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 ove}from"node:os";var yR,sve,t9=y(()=>{e9();XZ();yR=()=>{let t=KZ();return[...QZ,...t].map(sve)},sve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=ove,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as ave}from"node:os";var cve,lve,r9,uve,dve,fve,cet,n9=y(()=>{t9();cve=()=>{let t=yR();return Object.fromEntries(t.map(lve))},lve=({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}],r9=cve(),uve=()=>{let t=yR(),e=65,r=Array.from({length:e},(n,i)=>dve(i,t));return Object.assign({},...r)},dve=(t,e)=>{let r=fve(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}}},fve=(t,e)=>{let r=e.find(({name:n})=>ave.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},cet=uve()});import{constants as Lf}from"node:os";var o9,s9,a9,pve,mve,i9,hve,_R,gve,yve,X_,zf=y(()=>{n9();o9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return a9(t,e)},s9=t=>t===0?t:a9(t,"`subprocess.kill()`'s argument"),a9=(t,e)=>{if(Number.isInteger(t))return pve(t,e);if(typeof t=="string")return hve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${_R()}`)},pve=(t,e)=>{if(i9.has(t))return i9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${_R()}`)},mve=()=>new Map(Object.entries(Lf.signals).reverse().map(([t,e])=>[e,t])),i9=mve(),hve=(t,e)=>{if(t in Lf.signals)return t;throw t.toUpperCase()in Lf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${_R()}`)},_R=()=>`Available signal names: ${gve()}. +Available signal numbers: ${yve()}.`,gve=()=>Object.keys(Lf.signals).sort().map(t=>`'${t}'`).join(", "),yve=()=>[...new Set(Object.values(Lf.signals).sort((t,e)=>t-e))].join(", "),X_=t=>r9[t].description});import{setTimeout as _ve}from"node:timers/promises";var c9,bve,l9,vve,Sve,wve,bR,Q_=y(()=>{Aa();zf();c9=t=>{if(t===!1)return t;if(t===!0)return bve;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},bve=1e3*5,l9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=vve(s,a,r);Sve(l,n);let u=t(c);return wve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},vve=(t,e,r)=>{let[n=r,i]=Y_(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&&!Y_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:s9(n),error:i}},Sve=(t,e)=>{t!==void 0&&e.reject(t)},wve=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 _ve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as xve}from"node:events";var eb,vR=y(()=>{eb=async(t,e)=>{t.aborted||await xve(t,"abort",{signal:e})}});var u9,d9,$ve,SR=y(()=>{vR();u9=({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)}`)},d9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[$ve(t,e,n,i)],$ve=async(t,e,r,{signal:n})=>{throw await eb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var bl,kve,wR,f9,p9,tb,m9,h9,g9,y9,_9,b9,Eve,Ave,Ove,Qn,Tve,as,vl,Sl=y(()=>{bl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{kve(t,e,r),wR(t,e,n)},kve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},wR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${as(e)} has already exited or disconnected.`)},f9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${as(t)} exited or disconnected.`)},p9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(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([ ${Qn("getOneMessage",t)}, ${Qn("sendMessage",t,"message, {strict: true}")}, -]);`)},tb=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${as(e)}.`,{cause:t}),u9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is not listening to incoming messages.`)},d9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} exited without listening to incoming messages.`)},f9=()=>new Error(`\`cancelSignal\` aborted: the ${as(!0)} disconnected.`),p9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},m9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Qn(e,r)} cannot be used: the ${as(r)} is disconnecting.`,{cause:t})},h9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Eve(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Eve=({code:t,message:e})=>Ave.has(t)||Tve.some(r=>e.includes(r)),Ave=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Tve=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Ove(e)}${t}(${r})`,Ove=t=>t?"":"subprocess.",as=t=>t?"parent process":"subprocess",bl=t=>{t.connected&&t.disconnect()}});var Ri,Sl=y(()=>{Ri=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var nb,wl,Ii,g9,Rve,Ive,y9,Pve,_9,Uf,rb,cs=y(()=>{yo();nb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ii.get(t),o=g9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(y9(o,e,n,!0));return s},wl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ii.get(t),o=g9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(y9(o,e,n,!1));return s},Ii=new WeakMap,g9=(t,e,r)=>{let n=Rve(e,r);return Ive(n,e,r,t),n},Rve=(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(`"${Uf(e)}" must not be "${t}". +]);`)},tb=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${as(e)}.`,{cause:t}),m9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is not listening to incoming messages.`)},h9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} exited without listening to incoming messages.`)},g9=()=>new Error(`\`cancelSignal\` aborted: the ${as(!0)} disconnected.`),y9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},_9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Qn(e,r)} cannot be used: the ${as(r)} is disconnecting.`,{cause:t})},b9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Eve(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Eve=({code:t,message:e})=>Ave.has(t)||Ove.some(r=>e.includes(r)),Ave=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Ove=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Tve(e)}${t}(${r})`,Tve=t=>t?"":"subprocess.",as=t=>t?"parent process":"subprocess",vl=t=>{t.connected&&t.disconnect()}});var Ti,wl=y(()=>{Ti=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var nb,xl,Ri,v9,Rve,Ive,S9,Pve,w9,Uf,rb,cs=y(()=>{go();nb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=v9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(S9(o,e,n,!0));return s},xl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=v9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(S9(o,e,n,!1));return s},Ri=new WeakMap,v9=(t,e,r)=>{let n=Rve(e,r);return Ive(n,e,r,t),n},Rve=(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(`"${Uf(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},Ive=(t,e,r,n)=>{let i=n[_9(t)];if(i===void 0)throw new TypeError(`"${Uf(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(`"${Uf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Uf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},y9=(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}=Pve(t,r);return`The "${i}: ${rb(o)}" option is incompatible with using "${Uf(n)}: ${rb(e)}". -Please set this option with "pipe" instead.`},Pve=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=_9(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]}},_9=t=>t==="all"?1:t,Uf=t=>t?"to":"from",rb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Cve}from"node:events";var Ea,ib=y(()=>{Ea=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Cve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var ob,wR,sb,xR,b9,v9,qf=y(()=>{ob=(t,e)=>{e&&wR(t)},wR=t=>{t.refCounted()},sb=(t,e)=>{e&&xR(t)},xR=t=>{t.unrefCounted()},b9=(t,e)=>{e&&(xR(t),xR(t))},v9=(t,e)=>{e&&(wR(t),wR(t))}});import{once as Dve}from"node:events";import{scheduler as Nve}from"node:timers/promises";var S9,w9,ab,x9=y(()=>{lb();qf();cb();ub();S9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(k9(i)||A9(i))return;ab.has(t)||ab.set(t,[]);let o=ab.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await E9(t,n,i),await Nve.yield();let s=await $9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},w9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{$R();let o=ab.get(t);for(;o?.length>0;)await Dve(n,"message:done");t.removeListener("message",i),v9(e,r),n.connected=!1,n.emit("disconnect")},ab=new WeakMap});import{EventEmitter as jve}from"node:events";var ls,db,Mve,fb,Bf=y(()=>{x9();qf();ls=(t,e,r)=>{if(db.has(t))return db.get(t);let n=new jve;return n.connected=!0,db.set(t,n),Mve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},db=new WeakMap,Mve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=S9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",w9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),b9(r,n)},fb=t=>{let e=db.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Fve}from"node:events";var T9,Lve,O9,$9,k9,R9,pb,zve,mb,I9,cb=y(()=>{Sl();ib();yb();vl();Bf();lb();T9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ls(t,e,r),s=hb(t,o);return{id:Lve++,type:mb,message:n,hasListeners:s}},Lve=0n,O9=(t,e)=>{if(!(e?.type!==mb||e.hasListeners))for(let{id:r}of t)r!==void 0&&pb[r].resolve({isDeadlock:!0,hasListeners:!1})},$9=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:I9,message:hb(e,i)};try{await gb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},k9=t=>{if(t?.type!==I9)return!1;let{id:e,message:r}=t;return pb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},R9=async(t,e,r)=>{if(t?.type!==mb)return;let n=Ri();pb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,zve(e,r,i)]);o&&l9(r),s||u9(r)}finally{i.abort(),delete pb[t.id]}},pb={},zve=async(t,e,{signal:r})=>{Ea(t,1,r),await Fve(t,"disconnect",{signal:r}),d9(e)},mb="execa:ipc:request",I9="execa:ipc:response"});var P9,C9,E9,Hf,hb,Uve,lb=y(()=>{Sl();yo();cs();cb();P9=(t,e,r)=>{Hf.has(t)||Hf.set(t,new Set);let n=Hf.get(t),i=Ri(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},C9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},E9=async(t,e,r)=>{for(;!hb(t,e)&&Hf.get(t)?.size>0;){let n=[...Hf.get(t)];O9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Hf=new WeakMap,hb=(t,e)=>e.listenerCount("message")>Uve(t),Uve=t=>Ii.has(t)&&!go(Ii.get(t).options.buffer,"ipc")?1:0});import{promisify as qve}from"node:util";var gb,Bve,ER,Hve,kR,yb=y(()=>{vl();lb();cb();gb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return _l({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),Bve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},Bve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=T9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=P9(t,s,o);try{await ER({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw bl(t),c}finally{C9(a)}},ER=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Hve(t);try{await Promise.all([R9(n,t,r),o(n)])}catch(s){throw m9({error:s,methodName:e,isSubprocess:r}),h9({error:s,methodName:e,isSubprocess:r,message:i}),s}},Hve=t=>{if(kR.has(t))return kR.get(t);let e=qve(t.send.bind(t));return kR.set(t,e),e},kR=new WeakMap});import{scheduler as Gve}from"node:timers/promises";var N9,j9,Zve,D9,A9,M9,$R,AR,ub=y(()=>{yb();Bf();vl();N9=(t,e)=>{let r="cancelSignal";return SR(r,!1,t.connected),ER({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:M9,message:e},message:e})},j9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Zve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),AR.signal),Zve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!D9){if(D9=!0,!n){p9();return}if(e===null){$R();return}ls(t,e,r),await Gve.yield()}},D9=!1,A9=t=>t?.type!==M9?!1:(AR.abort(t.message),!0),M9="execa:ipc:cancel",$R=()=>{AR.abort(f9())},AR=new AbortController});var F9,L9,Vve,Wve,TR=y(()=>{bR();ub();Q_();F9=({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.")}},L9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[Vve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],Vve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await eb(e,i);let o=Wve(e);throw await N9(t,o),_R({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Wve=({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 Kve}from"node:timers/promises";var z9,U9,Jve,OR=y(()=>{ka();z9=({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})`)},U9=(t,e,r,n)=>e===0||e===void 0?[]:[Jve(t,e,r,n)],Jve=async(t,e,r,{signal:n})=>{throw await Kve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as Yve,execArgv as Xve}from"node:process";import q9 from"node:path";var B9,H9,RR=y(()=>{fl();B9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},H9=(t,e,{node:r=!1,nodePath:n=Yve,nodeOptions:i=Xve.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=dl(n,'The "nodePath" option'),l=q9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(q9.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 Qve}from"node:v8";var G9,eSe,tSe,rSe,Z9,IR=y(()=>{G9=({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`.");rSe[r](t)}},eSe=t=>{try{Qve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},tSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},rSe={advanced:eSe,json:tSe},Z9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var W9,nSe,nn,PR,iSe,V9,_b,Aa=y(()=>{W9=({encoding:t})=>{if(PR.has(t))return;let e=iSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${_b(t)}\`. -Please rename it to ${_b(e)}.`);let r=[...PR].map(n=>_b(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${_b(t)}\`. -Please rename it to one of: ${r}.`)},nSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),PR=new Set([...nSe,...nn]),iSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in V9)return V9[e];if(PR.has(e))return e},V9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},_b=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as oSe}from"node:fs";import sSe from"node:path";import aSe from"node:process";var K9,J9,Y9,CR=y(()=>{fl();K9=(t=J9())=>{let e=dl(t,'The "cwd" option');return sSe.resolve(e)},J9=()=>{try{return aSe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},Y9=(t,e)=>{if(e===J9())return t;let r;try{r=oSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},Ive=(t,e,r,n)=>{let i=n[w9(t)];if(i===void 0)throw new TypeError(`"${Uf(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(`"${Uf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Uf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},S9=(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}=Pve(t,r);return`The "${i}: ${rb(o)}" option is incompatible with using "${Uf(n)}: ${rb(e)}". +Please set this option with "pipe" instead.`},Pve=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=w9(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]}},w9=t=>t==="all"?1:t,Uf=t=>t?"to":"from",rb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Cve}from"node:events";var Oa,ib=y(()=>{Oa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Cve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var ob,xR,sb,$R,x9,$9,qf=y(()=>{ob=(t,e)=>{e&&xR(t)},xR=t=>{t.refCounted()},sb=(t,e)=>{e&&$R(t)},$R=t=>{t.unrefCounted()},x9=(t,e)=>{e&&($R(t),$R(t))},$9=(t,e)=>{e&&(xR(t),xR(t))}});import{once as Dve}from"node:events";import{scheduler as Nve}from"node:timers/promises";var k9,E9,ab,A9=y(()=>{lb();qf();cb();ub();k9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(T9(i)||I9(i))return;ab.has(t)||ab.set(t,[]);let o=ab.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await R9(t,n,i),await Nve.yield();let s=await O9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},E9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{kR();let o=ab.get(t);for(;o?.length>0;)await Dve(n,"message:done");t.removeListener("message",i),$9(e,r),n.connected=!1,n.emit("disconnect")},ab=new WeakMap});import{EventEmitter as jve}from"node:events";var ls,db,Mve,fb,Bf=y(()=>{A9();qf();ls=(t,e,r)=>{if(db.has(t))return db.get(t);let n=new jve;return n.connected=!0,db.set(t,n),Mve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},db=new WeakMap,Mve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=k9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",E9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),x9(r,n)},fb=t=>{let e=db.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Fve}from"node:events";var P9,Lve,C9,O9,T9,D9,pb,zve,mb,N9,cb=y(()=>{wl();ib();yb();Sl();Bf();lb();P9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ls(t,e,r),s=hb(t,o);return{id:Lve++,type:mb,message:n,hasListeners:s}},Lve=0n,C9=(t,e)=>{if(!(e?.type!==mb||e.hasListeners))for(let{id:r}of t)r!==void 0&&pb[r].resolve({isDeadlock:!0,hasListeners:!1})},O9=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:N9,message:hb(e,i)};try{await gb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},T9=t=>{if(t?.type!==N9)return!1;let{id:e,message:r}=t;return pb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},D9=async(t,e,r)=>{if(t?.type!==mb)return;let n=Ti();pb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,zve(e,r,i)]);o&&p9(r),s||m9(r)}finally{i.abort(),delete pb[t.id]}},pb={},zve=async(t,e,{signal:r})=>{Oa(t,1,r),await Fve(t,"disconnect",{signal:r}),h9(e)},mb="execa:ipc:request",N9="execa:ipc:response"});var j9,M9,R9,Hf,hb,Uve,lb=y(()=>{wl();go();cs();cb();j9=(t,e,r)=>{Hf.has(t)||Hf.set(t,new Set);let n=Hf.get(t),i=Ti(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},M9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},R9=async(t,e,r)=>{for(;!hb(t,e)&&Hf.get(t)?.size>0;){let n=[...Hf.get(t)];C9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Hf=new WeakMap,hb=(t,e)=>e.listenerCount("message")>Uve(t),Uve=t=>Ri.has(t)&&!ho(Ri.get(t).options.buffer,"ipc")?1:0});import{promisify as qve}from"node:util";var gb,Bve,AR,Hve,ER,yb=y(()=>{Sl();lb();cb();gb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return bl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),Bve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},Bve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=P9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=j9(t,s,o);try{await AR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw vl(t),c}finally{M9(a)}},AR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Hve(t);try{await Promise.all([D9(n,t,r),o(n)])}catch(s){throw _9({error:s,methodName:e,isSubprocess:r}),b9({error:s,methodName:e,isSubprocess:r,message:i}),s}},Hve=t=>{if(ER.has(t))return ER.get(t);let e=qve(t.send.bind(t));return ER.set(t,e),e},ER=new WeakMap});import{scheduler as Gve}from"node:timers/promises";var L9,z9,Zve,F9,I9,U9,kR,OR,ub=y(()=>{yb();Bf();Sl();L9=(t,e)=>{let r="cancelSignal";return wR(r,!1,t.connected),AR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:U9,message:e},message:e})},z9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Zve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),OR.signal),Zve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!F9){if(F9=!0,!n){y9();return}if(e===null){kR();return}ls(t,e,r),await Gve.yield()}},F9=!1,I9=t=>t?.type!==U9?!1:(OR.abort(t.message),!0),U9="execa:ipc:cancel",kR=()=>{OR.abort(g9())},OR=new AbortController});var q9,B9,Vve,Wve,TR=y(()=>{vR();ub();Q_();q9=({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.")}},B9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[Vve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],Vve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await eb(e,i);let o=Wve(e);throw await L9(t,o),bR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Wve=({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 Kve}from"node:timers/promises";var H9,G9,Jve,RR=y(()=>{Aa();H9=({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})`)},G9=(t,e,r,n)=>e===0||e===void 0?[]:[Jve(t,e,r,n)],Jve=async(t,e,r,{signal:n})=>{throw await Kve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as Yve,execArgv as Xve}from"node:process";import Z9 from"node:path";var V9,W9,IR=y(()=>{pl();V9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},W9=(t,e,{node:r=!1,nodePath:n=Yve,nodeOptions:i=Xve.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=fl(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 Qve}from"node:v8";var K9,eSe,tSe,rSe,J9,PR=y(()=>{K9=({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`.");rSe[r](t)}},eSe=t=>{try{Qve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},tSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},rSe={advanced:eSe,json:tSe},J9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var X9,nSe,nn,CR,iSe,Y9,_b,Ta=y(()=>{X9=({encoding:t})=>{if(CR.has(t))return;let e=iSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${_b(t)}\`. +Please rename it to ${_b(e)}.`);let r=[...CR].map(n=>_b(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${_b(t)}\`. +Please rename it to one of: ${r}.`)},nSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),CR=new Set([...nSe,...nn]),iSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in Y9)return Y9[e];if(CR.has(e))return e},Y9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},_b=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as oSe}from"node:fs";import sSe from"node:path";import aSe from"node:process";var Q9,eV,tV,DR=y(()=>{pl();Q9=(t=eV())=>{let e=fl(t,'The "cwd" option');return sSe.resolve(e)},eV=()=>{try{return aSe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},tV=(t,e)=>{if(e===eV())return t;let r;try{r=oSe(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 cSe from"node:path";import X9 from"node:process";var Q9,bb,lSe,uSe,DR=y(()=>{Q9=bt(CZ(),1);zZ();Q_();zf();vR();TR();OR();RR();IR();Aa();CR();fl();yo();bb=(t,e,r)=>{r.cwd=K9(r.cwd);let[n,i,o]=H9(t,e,r),{command:s,args:a,options:c}=Q9.default._parse(n,i,o),l=wG(c),u=lSe(l);return z9(u),W9(u),G9(u),s9(u),F9(u),u.shell=KO(u.shell),u.env=uSe(u),u.killSignal=t9(u.killSignal),u.forceKillAfterDelay=i9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),X9.platform==="win32"&&cSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},lSe=({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}),uSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...X9.env,...t}:t;return r||n?LZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var vb,NR=y(()=>{vb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function xl(t){if(typeof t=="string")return dSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return fSe(t)}var dSe,fSe,eV,pSe,tV,mSe,jR=y(()=>{dSe=t=>t.at(-1)===eV?t.slice(0,t.at(-2)===tV?-2:-1):t,fSe=t=>t.at(-1)===pSe?t.subarray(0,t.at(-2)===mSe?-2:-1):t,eV=` -`,pSe=eV.codePointAt(0),tV="\r",mSe=tV.codePointAt(0)});function ei(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 MR(t,{checkOpen:e=!0}={}){return ei(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 Ta(t,{checkOpen:e=!0}={}){return ei(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 FR(t,e){return MR(t,e)&&Ta(t,e)}var Oa=y(()=>{});function rV(){return this[zR].next()}function nV(t){return this[zR].return(t)}function UR({preventCancel:t=!1}={}){let e=this.getReader(),r=new LR(e,t),n=Object.create(gSe);return n[zR]=r,n}var hSe,LR,zR,gSe,iV=y(()=>{hSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),LR=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}}},zR=Symbol();Object.defineProperty(rV,"name",{value:"next"});Object.defineProperty(nV,"name",{value:"return"});gSe=Object.create(hSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:rV},return:{enumerable:!0,configurable:!0,writable:!0,value:nV}})});var oV=y(()=>{});var sV=y(()=>{iV();oV()});var aV,ySe,_Se,bSe,Gf,qR=y(()=>{Oa();sV();aV=t=>{if(Ta(t,{checkOpen:!1})&&Gf.on!==void 0)return _Se(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(ySe.call(t)==="[object ReadableStream]")return UR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:ySe}=Object.prototype,_Se=async function*(t){let e=new AbortController,r={};bSe(t,e,r);try{for await(let[n]of Gf.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()}},bSe=async(t,e,r)=>{try{await Gf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Gf={}});var $l,vSe,uV,cV,SSe,lV,Pi,Zf=y(()=>{qR();$l=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=aV(t),u=e();u.length=0;try{for await(let d of l){let f=SSe(d),p=r[f](d,u);uV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return vSe({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}},vSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&uV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},uV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){cV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&cV(c,e,i,o),new Pi},cV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},SSe=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=lV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&lV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:lV}=Object.prototype,Pi=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var _o,Vf,Sb,wb,xb,$b=y(()=>{_o=t=>t,Vf=()=>{},Sb=({contents:t})=>t,wb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},xb=t=>t.length});async function kb(t,e){return $l(t,kSe,e)}var wSe,xSe,$Se,kSe,dV=y(()=>{Zf();$b();wSe=()=>({contents:[]}),xSe=()=>1,$Se=(t,{contents:e})=>(e.push(t),e),kSe={init:wSe,convertChunk:{string:_o,buffer:_o,arrayBuffer:_o,dataView:_o,typedArray:_o,others:_o},getSize:xSe,truncateChunk:Vf,addChunk:$Se,getFinalChunk:Vf,finalize:Sb}});async function Eb(t,e){return $l(t,DSe,e)}var ESe,ASe,TSe,fV,pV,OSe,RSe,ISe,PSe,hV,mV,CSe,gV,DSe,yV=y(()=>{Zf();$b();ESe=()=>({contents:new ArrayBuffer(0)}),ASe=t=>TSe.encode(t),TSe=new TextEncoder,fV=t=>new Uint8Array(t),pV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),OSe=(t,e)=>t.slice(0,e),RSe=(t,{contents:e,length:r},n)=>{let i=gV()?PSe(e,n):ISe(e,n);return new Uint8Array(i).set(t,r),i},ISe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(hV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},PSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:hV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},hV=t=>mV**Math.ceil(Math.log(t)/Math.log(mV)),mV=2,CSe=({contents:t,length:e})=>gV()?t:t.slice(0,e),gV=()=>"resize"in ArrayBuffer.prototype,DSe={init:ESe,convertChunk:{string:ASe,buffer:fV,arrayBuffer:fV,dataView:pV,typedArray:pV,others:wb},getSize:xb,truncateChunk:OSe,addChunk:RSe,getFinalChunk:Vf,finalize:CSe}});async function Tb(t,e){return $l(t,LSe,e)}var NSe,Ab,jSe,MSe,FSe,LSe,_V=y(()=>{Zf();$b();NSe=()=>({contents:"",textDecoder:new TextDecoder}),Ab=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),jSe=(t,{contents:e})=>e+t,MSe=(t,e)=>t.slice(0,e),FSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},LSe={init:NSe,convertChunk:{string:_o,buffer:Ab,arrayBuffer:Ab,dataView:Ab,typedArray:Ab,others:wb},getSize:xb,truncateChunk:MSe,addChunk:jSe,getFinalChunk:FSe,finalize:Sb}});var bV=y(()=>{dV();yV();_V();Zf()});import{on as zSe}from"node:events";import{finished as USe}from"node:stream/promises";var Ob=y(()=>{qR();bV();Object.assign(Gf,{on:zSe,finished:USe})});var vV,qSe,SV,wV,BSe,xV,$V,Rb,Ra=y(()=>{Ob();ho();yo();vV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Pi))throw t;if(o==="all")return t;let s=qSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},qSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",SV=(t,e,r)=>{if(e.length!==r)return;let n=new Pi;throw n.maxBufferInfo={fdNumber:"ipc"},n},wV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=BSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},BSe=(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=go(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:j_(r),threshold:i,unit:n}},xV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Rb(r)),$V=(t,e,r)=>{if(!e)return t;let n=Rb(r);return t.length>n?t.slice(0,n):t},Rb=([,t])=>t});import{inspect as HSe}from"node:util";var EV,GSe,ZSe,VSe,WSe,KSe,kV,AV=y(()=>{jR();rn();CR();L_();Ra();zf();ka();EV=({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=GSe({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=VSe(n,b),w=x===void 0?"":` -${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>WSe(D)).join(` -`)].map(D=>jf(xl(KSe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:O,message:A}},GSe=({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=ZSe(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?`${wV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${X_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},ZSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",VSe=(t,e)=>{if(t instanceof Xn)return;let r=BZ(t)?t.originalMessage:String(t?.message??t),n=jf(Y9(r,e));return n===""?void 0:n},WSe=t=>typeof t=="string"?t:HSe(t),KSe=t=>Array.isArray(t)?t.map(e=>xl(kV(e))).filter(Boolean).join(` -`):kV(t),kV=t=>typeof t=="string"?t:zt(t)?D_(t):""});var Ib,kl,Wf,JSe,TV,YSe,Kf=y(()=>{zf();G_();ka();AV();Ib=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>TV({command:t,escapedCommand:e,cwd:o,durationMs:oR(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:[]}),kl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Wf({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}),Wf=({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:O,signalDescription:T}=YSe(l,u),{originalMessage:A,shortMessage:D,message:E}=EV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),q=UZ(t,E,x);return Object.assign(q,JSe({error:q,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),q},JSe=({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})=>TV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:oR(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:[]}),TV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),YSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:X_(e);return{exitCode:r,signal:n,signalDescription:i}}});function XSe(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(OV(t*1e3)%1e3),nanoseconds:Math.trunc(OV(t*1e6)%1e3)}}function QSe(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 BR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return XSe(t);break}case"bigint":return QSe(t)}throw new TypeError("Expected a finite number or bigint")}var OV,RV=y(()=>{OV=t=>Number.isFinite(t)?t:0});function HR(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+rwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ewe(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?" "+twe(d,u):f;i.push(p)}},a=BR(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%nwe):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 ewe,twe,rwe,nwe,IV=y(()=>{RV();ewe=t=>t===0||t===0n,twe=(t,e)=>e===1||e===1n?t:`${t}s`,rwe=1e-7,nwe=24n*60n*60n*1000n});var PV,CV=y(()=>{hl();PV=(t,e)=>{t.failed&&Oi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var DV,iwe,NV=y(()=>{IV();ss();hl();CV();DV=(t,e)=>{pl(e)&&(PV(t,e),iwe(t,e))},iwe=(t,e)=>{let r=`(done in ${HR(t.durationMs)})`;Oi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var El,Pb=y(()=>{NV();El=(t,e,{reject:r})=>{if(DV(t,e),t.failed&&r)throw t;return t}});var FV,owe,swe,LV,zV,jV,awe,GR,MV,Ia,UV,cwe,Cb,qV,lwe,uwe,ZR,BV,dwe,HV,Db,fwe,VR,pwe,mwe,GV,An,Nb,WR,ZV,VV,us,vr=y(()=>{Oa();po();rn();FV=(t,e)=>Ia(t)?"asyncGenerator":UV(t)?"generator":Cb(t)?"fileUrl":lwe(t)?"filePath":fwe(t)?"webStream":ei(t,{checkOpen:!1})?"native":zt(t)?"uint8Array":pwe(t)?"asyncIterable":mwe(t)?"iterable":VR(t)?LV({transform:t},e):cwe(t)?owe(t,e):"native",owe=(t,e)=>FR(t.transform,{checkOpen:!1})?swe(t,e):VR(t.transform)?LV(t,e):awe(t,e),swe=(t,e)=>(zV(t,e,"Duplex stream"),"duplex"),LV=(t,e)=>(zV(t,e,"web TransformStream"),"webTransform"),zV=({final:t,binary:e,objectMode:r},n,i)=>{jV(t,`${n}.final`,i),jV(e,`${n}.binary`,i),GR(r,`${n}.objectMode`)},jV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},awe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!MV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(FR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(VR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!MV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return GR(r,`${i}.binary`),GR(n,`${i}.objectMode`),Ia(t)||Ia(e)?"asyncGenerator":"generator"},GR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},MV=t=>Ia(t)||UV(t),Ia=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",UV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",cwe=t=>At(t)&&(t.transform!==void 0||t.final!==void 0),Cb=t=>Object.prototype.toString.call(t)==="[object URL]",qV=t=>Cb(t)&&t.protocol!=="file:",lwe=t=>At(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>uwe.has(e))&&ZR(t.file),uwe=new Set(["file","append"]),ZR=t=>typeof t=="string",BV=(t,e)=>t==="native"&&typeof e=="string"&&!dwe.has(e),dwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),HV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Db=t=>Object.prototype.toString.call(t)==="[object WritableStream]",fwe=t=>HV(t)||Db(t),VR=t=>HV(t?.readable)&&Db(t?.writable),pwe=t=>GV(t)&&typeof t[Symbol.asyncIterator]=="function",mwe=t=>GV(t)&&typeof t[Symbol.iterator]=="function",GV=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),Nb=new Set(["fileUrl","filePath","fileNumber"]),WR=new Set(["fileUrl","filePath"]),ZV=new Set([...WR,"webStream","nodeStream"]),VV=new Set(["webTransform","duplex"]),us={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 KR,hwe,gwe,WV,JR=y(()=>{vr();KR=(t,e,r,n)=>n==="output"?hwe(t,e,r):gwe(t,e,r),hwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},gwe=(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}},WV=(t,e)=>{let r=t.findLast(({type:n})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var KV,ywe,_we,bwe,vwe,Swe,wwe,JV=y(()=>{po();Aa();vr();JR();KV=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...ywe(t,e,r,n)],ywe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=_we({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return wwe(o,r)},_we=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?bwe({stdioItem:t,optionName:i}):e==="webTransform"?vwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Swe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),bwe=({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}}},vwe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=At(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=KR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Swe=({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}=At(e)?e:{transform:e},d=c||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=KR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},wwe=(t,e)=>e==="input"?t.reverse():t});import YR from"node:process";var YV,xwe,$we,Al,XR,XV,kwe,Ewe,QV=y(()=>{Oa();vr();YV=(t,e,r)=>{let n=t.map(i=>xwe(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)??Ewe},xwe=({type:t,value:e},r)=>$we[r]??XV[t](e),$we=["input","output","output"],Al=()=>{},XR=()=>"input",XV={generator:Al,asyncGenerator:Al,fileUrl:Al,filePath:Al,iterable:XR,asyncIterable:XR,uint8Array:XR,webStream:t=>Db(t)?"output":"input",nodeStream(t){return Ta(t,{checkOpen:!1})?MR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Al,duplex:Al,native(t){let e=kwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return XV.nodeStream(t)}},kwe=t=>{if([0,YR.stdin].includes(t))return"input";if([1,2,YR.stdout,YR.stderr].includes(t))return"output"},Ewe="output"});var eW,tW=y(()=>{eW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var rW,Awe,Twe,nW,Owe,Rwe,iW=y(()=>{ho();tW();ss();rW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Awe(t,n).map((a,c)=>nW(a,c));return o?Owe(s,r,i):eW(s,e)},Awe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(Twe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},Twe=t=>En.some(e=>t[e]!==void 0),nW=(t,e)=>Array.isArray(t)?t.map(r=>nW(r,e)):t??(e>=En.length?"ignore":"pipe"),Owe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!ml(r,i)&&Rwe(n)?"ignore":n),Rwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Iwe}from"node:fs";import Pwe from"node:tty";var sW,Cwe,Dwe,Nwe,jwe,oW,aW=y(()=>{Oa();ho();rn();cs();sW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Cwe({stdioItem:t,fdNumber:n,direction:i}):jwe({stdioItem:t,fdNumber:n}),Cwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Dwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Dwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Nwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Pwe.isatty(i))throw new TypeError(`The \`${e}: ${rb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:mo(Iwe(i)),optionName:e}}},Nwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=N_.indexOf(t);if(r!==-1)return r},jwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:oW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:oW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,oW=(t,e,r)=>{let n=N_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var cW,Mwe,Fwe,Lwe,zwe,lW=y(()=>{Oa();rn();vr();cW=({input:t,inputFile:e},r)=>r===0?[...Mwe(t),...Lwe(e)]:[],Mwe=t=>t===void 0?[]:[{type:Fwe(t),value:t,optionName:"input"}],Fwe=t=>{if(Ta(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(zt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Lwe=t=>t===void 0?[]:[{...zwe(t),optionName:"inputFile"}],zwe=t=>{if(Cb(t))return{type:"fileUrl",value:t};if(ZR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var uW,dW,Uwe,qwe,fW,Bwe,Hwe,pW,mW=y(()=>{vr();uW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),dW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Uwe(i,t);if(s.length!==0){if(o){qwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(ZV.has(t))return fW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});VV.has(t)&&Hwe({otherStdioItems:s,type:t,value:e,optionName:r})}},Uwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),qwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{WR.has(e)&&fW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},fW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Bwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return pW(s,n,e),i==="output"?o[0].stream:void 0},Bwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Hwe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);pW(i,n,e)},pW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${us[r]} that is the same.`)}});var jb,Gwe,Zwe,Vwe,Wwe,Kwe,Jwe,Ywe,Xwe,Qwe,exe,txe,QR,rxe,Mb=y(()=>{ho();JV();JR();vr();QV();iW();aW();lW();mW();jb=(t,e,r,n)=>{let o=rW(e,r,n).map((a,c)=>Gwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Qwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>rxe(a)),s},Gwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=j_(e),{stdioItems:o,isStdioArray:s}=Zwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=YV(o,e,i),c=o.map(d=>sW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=KV(c,i,a,r),u=WV(l,a);return Xwe(l,u),{direction:a,objectMode:u,stdioItems:l}},Zwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Vwe(c,n)),...cW(r,e)],s=uW(o),a=s.length>1;return Wwe(s,a,n),Jwe(s),{stdioItems:s,isStdioArray:a}},Vwe=(t,e)=>({type:FV(t,e),value:t,optionName:e}),Wwe=(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(Kwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Kwe=new Set(["ignore","ipc"]),Jwe=t=>{for(let e of t)Ywe(e)},Ywe=({type:t,value:e,optionName:r})=>{if(qV(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(BV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Xwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Nb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Qwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(exe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw QR(i),o}},exe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>txe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},txe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=dW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},QR=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Yn(r)&&r.destroy()},rxe=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 hW}from"node:fs";var yW,Ci,nxe,_W,gW,ixe,bW=y(()=>{rn();Mb();vr();yW=(t,e)=>jb(ixe,t,e,!0),Ci=({type:t,optionName:e})=>{_W(e,us[t])},nxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&_W(t,`"${e}"`),{}),_W=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},gW={generator(){},asyncGenerator:Ci,webStream:Ci,nodeStream:Ci,webTransform:Ci,duplex:Ci,asyncIterable:Ci,native:nxe},ixe={input:{...gW,fileUrl:({value:t})=>({contents:[mo(hW(t))]}),filePath:({value:{file:t}})=>({contents:[mo(hW(t))]}),fileNumber:Ci,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...gW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Ci,string:Ci,uint8Array:Ci}}});var bo,eI,Jf=y(()=>{jR();bo=(t,{stripFinalNewline:e},r)=>eI(e,r)&&t!==void 0&&!Array.isArray(t)?xl(t):t,eI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Fb,rI,vW,SW,oxe,sxe,axe,wW,cxe,tI,lxe,uxe,dxe,Lb=y(()=>{Fb=(t,e,r,n)=>t||r?void 0:SW(e,n),rI=(t,e,r)=>r?t.flatMap(n=>vW(n,e)):vW(t,e),vW=(t,e)=>{let{transform:r,final:n}=SW(e,{});return[...r(t),...n()]},SW=(t,e)=>(e.previousChunks="",{transform:oxe.bind(void 0,e,t),final:axe.bind(void 0,e)}),oxe=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},sxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),axe=function*({previousChunks:t}){t.length>0&&(yield t)},wW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:cxe.bind(void 0,n)},cxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?lxe:dxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},tI=(t,e)=>`${t}${e}`,lxe={windowsNewline:`\r +${t}`}});import cSe from"node:path";import rV from"node:process";var nV,bb,lSe,uSe,NR=y(()=>{nV=vt(MZ(),1);HZ();Q_();zf();SR();TR();RR();IR();PR();Ta();DR();pl();go();bb=(t,e,r)=>{r.cwd=Q9(r.cwd);let[n,i,o]=W9(t,e,r),{command:s,args:a,options:c}=nV.default._parse(n,i,o),l=EG(c),u=lSe(l);return H9(u),X9(u),K9(u),u9(u),q9(u),u.shell=JT(u.shell),u.env=uSe(u),u.killSignal=o9(u.killSignal),u.forceKillAfterDelay=c9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),rV.platform==="win32"&&cSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},lSe=({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}),uSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...rV.env,...t}:t;return r||n?BZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var vb,jR=y(()=>{vb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function $l(t){if(typeof t=="string")return dSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return fSe(t)}var dSe,fSe,iV,pSe,oV,mSe,MR=y(()=>{dSe=t=>t.at(-1)===iV?t.slice(0,t.at(-2)===oV?-2:-1):t,fSe=t=>t.at(-1)===pSe?t.subarray(0,t.at(-2)===mSe?-2:-1):t,iV=` +`,pSe=iV.codePointAt(0),oV="\r",mSe=oV.codePointAt(0)});function ei(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 FR(t,{checkOpen:e=!0}={}){return ei(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 Ra(t,{checkOpen:e=!0}={}){return ei(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 LR(t,e){return FR(t,e)&&Ra(t,e)}var Ia=y(()=>{});function sV(){return this[UR].next()}function aV(t){return this[UR].return(t)}function qR({preventCancel:t=!1}={}){let e=this.getReader(),r=new zR(e,t),n=Object.create(gSe);return n[UR]=r,n}var hSe,zR,UR,gSe,cV=y(()=>{hSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),zR=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}}},UR=Symbol();Object.defineProperty(sV,"name",{value:"next"});Object.defineProperty(aV,"name",{value:"return"});gSe=Object.create(hSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:sV},return:{enumerable:!0,configurable:!0,writable:!0,value:aV}})});var lV=y(()=>{});var uV=y(()=>{cV();lV()});var dV,ySe,_Se,bSe,Gf,BR=y(()=>{Ia();uV();dV=t=>{if(Ra(t,{checkOpen:!1})&&Gf.on!==void 0)return _Se(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(ySe.call(t)==="[object ReadableStream]")return qR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:ySe}=Object.prototype,_Se=async function*(t){let e=new AbortController,r={};bSe(t,e,r);try{for await(let[n]of Gf.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()}},bSe=async(t,e,r)=>{try{await Gf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Gf={}});var kl,vSe,mV,fV,SSe,pV,Ii,Zf=y(()=>{BR();kl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=dV(t),u=e();u.length=0;try{for await(let d of l){let f=SSe(d),p=r[f](d,u);mV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return vSe({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}},vSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&mV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},mV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){fV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&fV(c,e,i,o),new Ii},fV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},SSe=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=pV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&pV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:pV}=Object.prototype,Ii=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var yo,Vf,Sb,wb,xb,$b=y(()=>{yo=t=>t,Vf=()=>{},Sb=({contents:t})=>t,wb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},xb=t=>t.length});async function kb(t,e){return kl(t,kSe,e)}var wSe,xSe,$Se,kSe,hV=y(()=>{Zf();$b();wSe=()=>({contents:[]}),xSe=()=>1,$Se=(t,{contents:e})=>(e.push(t),e),kSe={init:wSe,convertChunk:{string:yo,buffer:yo,arrayBuffer:yo,dataView:yo,typedArray:yo,others:yo},getSize:xSe,truncateChunk:Vf,addChunk:$Se,getFinalChunk:Vf,finalize:Sb}});async function Eb(t,e){return kl(t,DSe,e)}var ESe,ASe,OSe,gV,yV,TSe,RSe,ISe,PSe,bV,_V,CSe,vV,DSe,SV=y(()=>{Zf();$b();ESe=()=>({contents:new ArrayBuffer(0)}),ASe=t=>OSe.encode(t),OSe=new TextEncoder,gV=t=>new Uint8Array(t),yV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),TSe=(t,e)=>t.slice(0,e),RSe=(t,{contents:e,length:r},n)=>{let i=vV()?PSe(e,n):ISe(e,n);return new Uint8Array(i).set(t,r),i},ISe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(bV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},PSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:bV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},bV=t=>_V**Math.ceil(Math.log(t)/Math.log(_V)),_V=2,CSe=({contents:t,length:e})=>vV()?t:t.slice(0,e),vV=()=>"resize"in ArrayBuffer.prototype,DSe={init:ESe,convertChunk:{string:ASe,buffer:gV,arrayBuffer:gV,dataView:yV,typedArray:yV,others:wb},getSize:xb,truncateChunk:TSe,addChunk:RSe,getFinalChunk:Vf,finalize:CSe}});async function Ob(t,e){return kl(t,LSe,e)}var NSe,Ab,jSe,MSe,FSe,LSe,wV=y(()=>{Zf();$b();NSe=()=>({contents:"",textDecoder:new TextDecoder}),Ab=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),jSe=(t,{contents:e})=>e+t,MSe=(t,e)=>t.slice(0,e),FSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},LSe={init:NSe,convertChunk:{string:yo,buffer:Ab,arrayBuffer:Ab,dataView:Ab,typedArray:Ab,others:wb},getSize:xb,truncateChunk:MSe,addChunk:jSe,getFinalChunk:FSe,finalize:Sb}});var xV=y(()=>{hV();SV();wV();Zf()});import{on as zSe}from"node:events";import{finished as USe}from"node:stream/promises";var Tb=y(()=>{BR();xV();Object.assign(Gf,{on:zSe,finished:USe})});var $V,qSe,kV,EV,BSe,AV,OV,Rb,Pa=y(()=>{Tb();mo();go();$V=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ii))throw t;if(o==="all")return t;let s=qSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},qSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",kV=(t,e,r)=>{if(e.length!==r)return;let n=new Ii;throw n.maxBufferInfo={fdNumber:"ipc"},n},EV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=BSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},BSe=(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=ho(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:j_(r),threshold:i,unit:n}},AV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Rb(r)),OV=(t,e,r)=>{if(!e)return t;let n=Rb(r);return t.length>n?t.slice(0,n):t},Rb=([,t])=>t});import{inspect as HSe}from"node:util";var RV,GSe,ZSe,VSe,WSe,KSe,TV,IV=y(()=>{MR();rn();DR();L_();Pa();zf();Aa();RV=({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=GSe({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=VSe(n,b),w=x===void 0?"":` +${x}`,T=`${S}: ${a}${w}`,O=e===void 0?[t[2],t[1]]:[e],A=[T,...O,...t.slice(3),r.map(D=>WSe(D)).join(` +`)].map(D=>jf($l(KSe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:T,message:A}},GSe=({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=ZSe(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?`${EV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${X_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},ZSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",VSe=(t,e)=>{if(t instanceof Xn)return;let r=VZ(t)?t.originalMessage:String(t?.message??t),n=jf(tV(r,e));return n===""?void 0:n},WSe=t=>typeof t=="string"?t:HSe(t),KSe=t=>Array.isArray(t)?t.map(e=>$l(TV(e))).filter(Boolean).join(` +`):TV(t),TV=t=>typeof t=="string"?t:zt(t)?D_(t):""});var Ib,El,Wf,JSe,PV,YSe,Kf=y(()=>{zf();G_();Aa();IV();Ib=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>PV({command:t,escapedCommand:e,cwd:o,durationMs:sR(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:[]}),El=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Wf({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}),Wf=({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:T,signalDescription:O}=YSe(l,u),{originalMessage:A,shortMessage:D,message:$}=RV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:T,signalDescription:O,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),se=GZ(t,$,x);return Object.assign(se,JSe({error:se,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:T,signalDescription:O,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),se},JSe=({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})=>PV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:sR(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:[]}),PV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),YSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:X_(e);return{exitCode:r,signal:n,signalDescription:i}}});function XSe(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(CV(t*1e3)%1e3),nanoseconds:Math.trunc(CV(t*1e6)%1e3)}}function QSe(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 HR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return XSe(t);break}case"bigint":return QSe(t)}throw new TypeError("Expected a finite number or bigint")}var CV,DV=y(()=>{CV=t=>Number.isFinite(t)?t:0});function GR(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+rwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ewe(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?" "+twe(d,u):f;i.push(p)}},a=HR(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%nwe):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 ewe,twe,rwe,nwe,NV=y(()=>{DV();ewe=t=>t===0||t===0n,twe=(t,e)=>e===1||e===1n?t:`${t}s`,rwe=1e-7,nwe=24n*60n*60n*1000n});var jV,MV=y(()=>{gl();jV=(t,e)=>{t.failed&&Oi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var FV,iwe,LV=y(()=>{NV();ss();gl();MV();FV=(t,e)=>{ml(e)&&(jV(t,e),iwe(t,e))},iwe=(t,e)=>{let r=`(done in ${GR(t.durationMs)})`;Oi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Al,Pb=y(()=>{LV();Al=(t,e,{reject:r})=>{if(FV(t,e),t.failed&&r)throw t;return t}});var qV,owe,swe,BV,HV,zV,awe,ZR,UV,Ca,GV,cwe,Cb,ZV,lwe,uwe,VR,VV,dwe,WV,Db,fwe,WR,pwe,mwe,KV,An,Nb,KR,JV,YV,us,vr=y(()=>{Ia();fo();rn();qV=(t,e)=>Ca(t)?"asyncGenerator":GV(t)?"generator":Cb(t)?"fileUrl":lwe(t)?"filePath":fwe(t)?"webStream":ei(t,{checkOpen:!1})?"native":zt(t)?"uint8Array":pwe(t)?"asyncIterable":mwe(t)?"iterable":WR(t)?BV({transform:t},e):cwe(t)?owe(t,e):"native",owe=(t,e)=>LR(t.transform,{checkOpen:!1})?swe(t,e):WR(t.transform)?BV(t,e):awe(t,e),swe=(t,e)=>(HV(t,e,"Duplex stream"),"duplex"),BV=(t,e)=>(HV(t,e,"web TransformStream"),"webTransform"),HV=({final:t,binary:e,objectMode:r},n,i)=>{zV(t,`${n}.final`,i),zV(e,`${n}.binary`,i),ZR(r,`${n}.objectMode`)},zV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},awe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!UV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(LR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(WR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!UV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return ZR(r,`${i}.binary`),ZR(n,`${i}.objectMode`),Ca(t)||Ca(e)?"asyncGenerator":"generator"},ZR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},UV=t=>Ca(t)||GV(t),Ca=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",GV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",cwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Cb=t=>Object.prototype.toString.call(t)==="[object URL]",ZV=t=>Cb(t)&&t.protocol!=="file:",lwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>uwe.has(e))&&VR(t.file),uwe=new Set(["file","append"]),VR=t=>typeof t=="string",VV=(t,e)=>t==="native"&&typeof e=="string"&&!dwe.has(e),dwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),WV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Db=t=>Object.prototype.toString.call(t)==="[object WritableStream]",fwe=t=>WV(t)||Db(t),WR=t=>WV(t?.readable)&&Db(t?.writable),pwe=t=>KV(t)&&typeof t[Symbol.asyncIterator]=="function",mwe=t=>KV(t)&&typeof t[Symbol.iterator]=="function",KV=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),Nb=new Set(["fileUrl","filePath","fileNumber"]),KR=new Set(["fileUrl","filePath"]),JV=new Set([...KR,"webStream","nodeStream"]),YV=new Set(["webTransform","duplex"]),us={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 JR,hwe,gwe,XV,YR=y(()=>{vr();JR=(t,e,r,n)=>n==="output"?hwe(t,e,r):gwe(t,e,r),hwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},gwe=(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}},XV=(t,e)=>{let r=t.findLast(({type:n})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var QV,ywe,_we,bwe,vwe,Swe,wwe,eW=y(()=>{fo();Ta();vr();YR();QV=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...ywe(t,e,r,n)],ywe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=_we({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return wwe(o,r)},_we=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?bwe({stdioItem:t,optionName:i}):e==="webTransform"?vwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Swe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),bwe=({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}}},vwe=({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}=JR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Swe=({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||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=JR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},wwe=(t,e)=>e==="input"?t.reverse():t});import XR from"node:process";var tW,xwe,$we,Ol,QR,rW,kwe,Ewe,nW=y(()=>{Ia();vr();tW=(t,e,r)=>{let n=t.map(i=>xwe(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)??Ewe},xwe=({type:t,value:e},r)=>$we[r]??rW[t](e),$we=["input","output","output"],Ol=()=>{},QR=()=>"input",rW={generator:Ol,asyncGenerator:Ol,fileUrl:Ol,filePath:Ol,iterable:QR,asyncIterable:QR,uint8Array:QR,webStream:t=>Db(t)?"output":"input",nodeStream(t){return Ra(t,{checkOpen:!1})?FR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Ol,duplex:Ol,native(t){let e=kwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return rW.nodeStream(t)}},kwe=t=>{if([0,XR.stdin].includes(t))return"input";if([1,2,XR.stdout,XR.stderr].includes(t))return"output"},Ewe="output"});var iW,oW=y(()=>{iW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var sW,Awe,Owe,aW,Twe,Rwe,cW=y(()=>{mo();oW();ss();sW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Awe(t,n).map((a,c)=>aW(a,c));return o?Twe(s,r,i):iW(s,e)},Awe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(Owe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},Owe=t=>En.some(e=>t[e]!==void 0),aW=(t,e)=>Array.isArray(t)?t.map(r=>aW(r,e)):t??(e>=En.length?"ignore":"pipe"),Twe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!hl(r,i)&&Rwe(n)?"ignore":n),Rwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Iwe}from"node:fs";import Pwe from"node:tty";var uW,Cwe,Dwe,Nwe,jwe,lW,dW=y(()=>{Ia();mo();rn();cs();uW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Cwe({stdioItem:t,fdNumber:n,direction:i}):jwe({stdioItem:t,fdNumber:n}),Cwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Dwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Dwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Nwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Pwe.isatty(i))throw new TypeError(`The \`${e}: ${rb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:po(Iwe(i)),optionName:e}}},Nwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=N_.indexOf(t);if(r!==-1)return r},jwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:lW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:lW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,lW=(t,e,r)=>{let n=N_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var fW,Mwe,Fwe,Lwe,zwe,pW=y(()=>{Ia();rn();vr();fW=({input:t,inputFile:e},r)=>r===0?[...Mwe(t),...Lwe(e)]:[],Mwe=t=>t===void 0?[]:[{type:Fwe(t),value:t,optionName:"input"}],Fwe=t=>{if(Ra(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(zt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Lwe=t=>t===void 0?[]:[{...zwe(t),optionName:"inputFile"}],zwe=t=>{if(Cb(t))return{type:"fileUrl",value:t};if(VR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var mW,hW,Uwe,qwe,gW,Bwe,Hwe,yW,_W=y(()=>{vr();mW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),hW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Uwe(i,t);if(s.length!==0){if(o){qwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(JV.has(t))return gW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});YV.has(t)&&Hwe({otherStdioItems:s,type:t,value:e,optionName:r})}},Uwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),qwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{KR.has(e)&&gW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},gW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Bwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return yW(s,n,e),i==="output"?o[0].stream:void 0},Bwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Hwe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);yW(i,n,e)},yW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${us[r]} that is the same.`)}});var jb,Gwe,Zwe,Vwe,Wwe,Kwe,Jwe,Ywe,Xwe,Qwe,exe,txe,eI,rxe,Mb=y(()=>{mo();eW();YR();vr();nW();cW();dW();pW();_W();jb=(t,e,r,n)=>{let o=sW(e,r,n).map((a,c)=>Gwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Qwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>rxe(a)),s},Gwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=j_(e),{stdioItems:o,isStdioArray:s}=Zwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=tW(o,e,i),c=o.map(d=>uW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=QV(c,i,a,r),u=XV(l,a);return Xwe(l,u),{direction:a,objectMode:u,stdioItems:l}},Zwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Vwe(c,n)),...fW(r,e)],s=mW(o),a=s.length>1;return Wwe(s,a,n),Jwe(s),{stdioItems:s,isStdioArray:a}},Vwe=(t,e)=>({type:qV(t,e),value:t,optionName:e}),Wwe=(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(Kwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Kwe=new Set(["ignore","ipc"]),Jwe=t=>{for(let e of t)Ywe(e)},Ywe=({type:t,value:e,optionName:r})=>{if(ZV(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(VV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Xwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Nb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Qwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(exe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw eI(i),o}},exe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>txe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},txe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=hW({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&&!Yn(r)&&r.destroy()},rxe=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 bW}from"node:fs";var SW,Pi,nxe,wW,vW,ixe,xW=y(()=>{rn();Mb();vr();SW=(t,e)=>jb(ixe,t,e,!0),Pi=({type:t,optionName:e})=>{wW(e,us[t])},nxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&wW(t,`"${e}"`),{}),wW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},vW={generator(){},asyncGenerator:Pi,webStream:Pi,nodeStream:Pi,webTransform:Pi,duplex:Pi,asyncIterable:Pi,native:nxe},ixe={input:{...vW,fileUrl:({value:t})=>({contents:[po(bW(t))]}),filePath:({value:{file:t}})=>({contents:[po(bW(t))]}),fileNumber:Pi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...vW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Pi,string:Pi,uint8Array:Pi}}});var _o,tI,Jf=y(()=>{MR();_o=(t,{stripFinalNewline:e},r)=>tI(e,r)&&t!==void 0&&!Array.isArray(t)?$l(t):t,tI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Fb,nI,$W,kW,oxe,sxe,axe,EW,cxe,rI,lxe,uxe,dxe,Lb=y(()=>{Fb=(t,e,r,n)=>t||r?void 0:kW(e,n),nI=(t,e,r)=>r?t.flatMap(n=>$W(n,e)):$W(t,e),$W=(t,e)=>{let{transform:r,final:n}=kW(e,{});return[...r(t),...n()]},kW=(t,e)=>(e.previousChunks="",{transform:oxe.bind(void 0,e,t),final:axe.bind(void 0,e)}),oxe=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},sxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),axe=function*({previousChunks:t}){t.length>0&&(yield t)},EW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:cxe.bind(void 0,n)},cxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?lxe:dxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},rI=(t,e)=>`${t}${e}`,lxe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:tI},uxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},dxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:uxe}});import{Buffer as fxe}from"node:buffer";var xW,pxe,$W,mxe,hxe,kW,EW=y(()=>{rn();xW=(t,e)=>t?void 0:pxe.bind(void 0,e),pxe=function*(t,e){if(typeof e!="string"&&!zt(e)&&!fxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},$W=(t,e)=>t?mxe.bind(void 0,e):hxe.bind(void 0,e),mxe=function*(t,e){kW(t,e),yield e},hxe=function*(t,e){if(kW(t,e),typeof e!="string"&&!zt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},kW=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:rI},uxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},dxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:uxe}});import{Buffer as fxe}from"node:buffer";var AW,pxe,OW,mxe,hxe,TW,RW=y(()=>{rn();AW=(t,e)=>t?void 0:pxe.bind(void 0,e),pxe=function*(t,e){if(typeof e!="string"&&!zt(e)&&!fxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},OW=(t,e)=>t?mxe.bind(void 0,e):hxe.bind(void 0,e),mxe=function*(t,e){TW(t,e),yield e},hxe=function*(t,e){if(TW(t,e),typeof e!="string"&&!zt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},TW=(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 gxe}from"node:buffer";import{StringDecoder as yxe}from"node:string_decoder";var zb,_xe,bxe,vxe,nI=y(()=>{rn();zb=(t,e,r)=>{if(r)return;if(t)return{transform:_xe.bind(void 0,new TextEncoder)};let n=new yxe(e);return{transform:bxe.bind(void 0,n),final:vxe.bind(void 0,n)}},_xe=function*(t,e){gxe.isBuffer(e)?yield mo(e):typeof e=="string"?yield t.encode(e):yield e},bxe=function*(t,e){yield zt(e)?t.write(e):e},vxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as AW}from"node:util";var iI,Ub,TW,Sxe,OW,wxe,RW=y(()=>{iI=AW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Ub=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=wxe}=e[r];for await(let i of n(t))yield*Ub(i,e,r+1)},TW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Sxe(r,Number(e),t)},Sxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Ub(n,r,e+1)},OW=AW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),wxe=function*(t){yield t}});var oI,IW,Pa,Yf,xxe,$xe,sI=y(()=>{oI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},IW=(t,e)=>[...e.flatMap(r=>[...Pa(r,t,0)]),...Yf(t)],Pa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=$xe}=e[r];for(let i of n(t))yield*Pa(i,e,r+1)},Yf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*xxe(r,Number(e),t)},xxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Pa(n,r,e+1)},$xe=function*(t){yield t}});import{Transform as kxe,getDefaultHighWaterMark as PW}from"node:stream";var aI,qb,CW,Bb=y(()=>{vr();Lb();EW();nI();RW();sI();aI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=CW(t,s,o),l=Ia(e),u=Ia(r),d=l?iI.bind(void 0,Ub,a):oI.bind(void 0,Pa),f=l||u?iI.bind(void 0,TW,a):oI.bind(void 0,Yf),p=l||u?OW.bind(void 0,a):void 0;return{stream:new kxe({writableObjectMode:n,writableHighWaterMark:PW(n),readableObjectMode:i,readableHighWaterMark:PW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},qb=(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=CW(s,r,a);t=IW(c,t)}return t},CW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:xW(n,a)},zb(r,s,n),Fb(r,o,n,c),{transform:t,final:e},{transform:$W(i,a)},wW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var DW,Exe,Axe,Txe,Oxe,NW=y(()=>{Bb();rn();vr();DW=(t,e)=>{for(let r of Exe(t))Axe(t,r,e)},Exe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Axe=(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 ${us[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Txe(a,n));r.input=Nf(s)},Txe=(t,e)=>{let r=qb(t,e,"utf8",!0);return Oxe(r),Nf(r)},Oxe=t=>{let e=t.find(r=>typeof r!="string"&&!zt(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 Hb,Rxe,Ixe,jW,MW,Pxe,FW,cI=y(()=>{Aa();vr();hl();ss();Hb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&ml(r,n)&&!nn.has(e)&&Rxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Ixe.has(o))||t.every(({type:i})=>An.has(i))),Rxe=t=>t===1||t===2,Ixe=new Set(["pipe","overlapped"]),jW=async(t,e,r,n)=>{for await(let i of t)Pxe(e)||FW(i,r,n)},MW=(t,e,r)=>{for(let n of t)FW(n,e,r)},Pxe=t=>t._readableState.pipes.length>0,FW=(t,e,r)=>{let n=B_(t);Oi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Cxe,appendFileSync as Dxe}from"node:fs";var LW,Nxe,jxe,Mxe,Fxe,Lxe,zW=y(()=>{cI();Bb();Lb();rn();vr();Ra();LW=({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)=>Nxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Nxe=({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=$V(t,o,d),p=mo(f),{stdioItems:m,objectMode:h}=e[r],g=jxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Mxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Fxe({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&&Lxe(b,m,i),S}catch(x){return n.error=x,S}},jxe=(t,e,r,n)=>{try{return qb(t,e,r,!1)}catch(i){return n.error=i,t}},Mxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Nf(t)};let s=mG(t,r);return n[o]?{serializedResult:s,finalResult:rI(s,!i[o],e)}:{serializedResult:s}},Fxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Hb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=rI(t,!1,s);try{MW(a,e,n)}catch(c){r.error??=c}},Lxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Nb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Dxe(n,t):(r.add(o),Cxe(n,t))}}});var UW,qW=y(()=>{rn();Jf();UW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,bo(e,r,"all")]:Array.isArray(e)?[bo(t,r,"all"),...e]:zt(t)&&zt(e)?YO([t,e]):`${t}${e}`}});import{once as lI}from"node:events";var BW,zxe,HW,GW,Uxe,uI,dI=y(()=>{ka();BW=async(t,e)=>{let[r,n]=await zxe(t);return e.isForcefullyTerminated??=!1,[r,n]},zxe=async t=>{let[e,r]=await Promise.allSettled([lI(t,"spawn"),lI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?HW(t):r.value},HW=async t=>{try{return await lI(t,"exit")}catch{return HW(t)}},GW=async t=>{let[e,r]=await t;if(!Uxe(e,r)&&uI(e,r))throw new Xn;return[e,r]},Uxe=(t,e)=>t===void 0&&e===void 0,uI=(t,e)=>t!==0||e!==null});var ZW,qxe,VW=y(()=>{ka();Ra();dI();ZW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=qxe(t,e,r),s=o?.code==="ETIMEDOUT",a=xV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},qxe=(t,e,r)=>t!==void 0?t:uI(e,r)?new Xn:void 0});import{spawnSync as Bxe}from"node:child_process";var WW,Hxe,Gxe,Zxe,Gb,Vxe,Wxe,Kxe,Jxe,KW=y(()=>{sR();DR();NR();Kf();Pb();bW();Jf();NW();zW();Ra();qW();VW();WW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Hxe(t,e,r),d=Vxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return El(d,c,l)},Hxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Z_(t,e,r),a=Gxe(r),{file:c,commandArguments:l,options:u}=bb(t,e,a);Zxe(u);let d=yW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Gxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Zxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Gb("ipcInput"),t&&Gb("ipc: true"),r&&Gb("detached: true"),n&&Gb("cancelSignal")},Gb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Vxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Wxe({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}=ZW(c,r),{output:m,error:h=l}=LW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>bo(_,r,S)),b=bo(UW(m,r),r,"all");return Jxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Wxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{DW(o,r);let a=Kxe(r);return Bxe(...vb(t,e,a))}catch(a){return kl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},Kxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Rb(e)}),Jxe=({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?Ib({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Wf({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 Yxe}from"node:events";var JW,Xxe,Qxe,e0e,t0e,YW=y(()=>{vl();Bf();qf();JW=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(_l({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:fb(t)}),Xxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Xxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ob(e,i);let o=ls(t,e,r),s=new AbortController;try{return await Promise.race([Qxe(o,n,s),e0e(o,r,s),t0e(o,r,s)])}catch(a){throw bl(t),a}finally{s.abort(),sb(e,i)}},Qxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await fI(t,"message",{signal:r});return n}for await(let[n]of Yxe(t,"message",{signal:r}))if(e(n))return n},e0e=async(t,e,{signal:r})=>{await fI(t,"disconnect",{signal:r}),c9(e)},t0e=async(t,e,{signal:r})=>{let[n]=await fI(t,"strict:error",{signal:r});throw tb(n,e)}});import{once as QW,on as r0e}from"node:events";var e3,pI,n0e,i0e,o0e,XW,mI=y(()=>{vl();Bf();qf();e3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>pI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),pI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{_l({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:fb(t)}),ob(e,o);let s=ls(t,e,r),a=new AbortController,c={};return n0e(t,s,a),i0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),o0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},n0e=async(t,e,r)=>{try{await QW(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},i0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await QW(t,"strict:error",{signal:r.signal});n.error=tb(i,e),r.abort()}catch{}},o0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of r0e(r,"message",{signal:o.signal}))XW(s),yield c}catch{XW(s)}finally{o.abort(),sb(e,a),n||bl(t),i&&await t}},XW=({error:t})=>{if(t)throw t}});import t3 from"node:process";var r3,n3,i3,hI=y(()=>{yb();YW();mI();ub();r3=(t,{ipc:e})=>{Object.assign(t,i3(t,!1,e))},n3=()=>{let t=t3,e=!0,r=t3.channel!==void 0;return{...i3(t,e,r),getCancelSignal:j9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},i3=(t,e,r)=>({sendMessage:gb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:JW.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:e3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as s0e}from"node:child_process";import{PassThrough as a0e,Readable as c0e,Writable as l0e,Duplex as u0e}from"node:stream";var o3,d0e,Xf,f0e,p0e,m0e,h0e,s3=y(()=>{Mb();Kf();Pb();o3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{QR(n);let a=new s0e;d0e(a,n),Object.assign(a,{readable:f0e,writable:p0e,duplex:m0e});let c=kl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=h0e(c,s,i);return{subprocess:a,promise:l}},d0e=(t,e)=>{let r=Xf(),n=Xf(),i=Xf(),o=Array.from({length:e.length-3},Xf),s=Xf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Xf=()=>{let t=new a0e;return t.end(),t},f0e=()=>new c0e({read(){}}),p0e=()=>new l0e({write(){}}),m0e=()=>new u0e({read(){},write(){}}),h0e=async(t,e,r)=>El(t,e,r)});import{createReadStream as a3,createWriteStream as c3}from"node:fs";import{Buffer as g0e}from"node:buffer";import{Readable as Qf,Writable as y0e,Duplex as _0e}from"node:stream";var u3,ep,l3,b0e,d3=y(()=>{Bb();Mb();vr();u3=(t,e)=>jb(b0e,t,e,!1),ep=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${us[t]}.`)},l3={fileNumber:ep,generator:aI,asyncGenerator:aI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:_0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},b0e={input:{...l3,fileUrl:({value:t})=>({stream:a3(t)}),filePath:({value:{file:t}})=>({stream:a3(t)}),webStream:({value:t})=>({stream:Qf.fromWeb(t)}),iterable:({value:t})=>({stream:Qf.from(t)}),asyncIterable:({value:t})=>({stream:Qf.from(t)}),string:({value:t})=>({stream:Qf.from(t)}),uint8Array:({value:t})=>({stream:Qf.from(g0e.from(t))})},output:{...l3,fileUrl:({value:t})=>({stream:c3(t)}),filePath:({value:{file:t,append:e}})=>({stream:c3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:y0e.fromWeb(t)}),iterable:ep,asyncIterable:ep,string:ep,uint8Array:ep}}});import{on as v0e,once as f3}from"node:events";import{PassThrough as S0e,getDefaultHighWaterMark as w0e}from"node:stream";import{finished as h3}from"node:stream/promises";function Ca(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)yI(i);let e=t.some(({readableObjectMode:i})=>i),r=x0e(t,e),n=new gI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var x0e,gI,$0e,k0e,E0e,yI,A0e,T0e,O0e,R0e,I0e,g3,y3,_I,_3,P0e,Zb,p3,m3,Vb=y(()=>{x0e=(t,e)=>{if(t.length===0)return w0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},gI=class extends S0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(yI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=$0e(this,this.#t,this.#o);let r=A0e({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(yI(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)}},$0e=async(t,e,r)=>{Zb(t,p3);let n=new AbortController;try{await Promise.race([k0e(t,n),E0e(t,e,r,n)])}finally{n.abort(),Zb(t,-p3)}},k0e=async(t,{signal:e})=>{try{await h3(t,{signal:e,cleanup:!0})}catch(r){throw g3(t,r),r}},E0e=async(t,e,r,{signal:n})=>{for await(let[i]of v0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},yI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},A0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Zb(t,m3);let a=new AbortController;try{await Promise.race([T0e(o,e,a),O0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),R0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Zb(t,-m3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?_I(t):I0e(t))},T0e=async(t,e,{signal:r})=>{try{await t,r.aborted||_I(e)}catch(n){r.aborted||g3(e,n)}},O0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await h3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;y3(s)?i.add(e):_3(t,s)}},R0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await f3(t,i,{signal:o}),!t.readable)return f3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},I0e=t=>{t.writable&&t.end()},g3=(t,e)=>{y3(e)?_I(t):_3(t,e)},y3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",_I=t=>{(t.readable||t.writable)&&t.destroy()},_3=(t,e)=>{t.destroyed||(t.once("error",P0e),t.destroy(e))},P0e=()=>{},Zb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},p3=2,m3=1});import{finished as b3}from"node:stream/promises";var Tl,C0e,bI,D0e,vI,Wb=y(()=>{ho();Tl=(t,e)=>{t.pipe(e),C0e(t,e),D0e(t,e)},C0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await b3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}bI(e)}},bI=t=>{t.writable&&t.end()},D0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await b3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}vI(t)}},vI=t=>{t.readable&&t.destroy()}});var v3,N0e,j0e,M0e,F0e,L0e,S3=y(()=>{Vb();ho();ib();vr();Wb();v3=(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})=>An.has(c)))N0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.has(c)))M0e({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]:Ca(o);Tl(s,i)}},N0e=(t,e,r,n)=>{r==="output"?Tl(t.stdio[n],e):Tl(e,t.stdio[n]);let i=j0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},j0e=["stdin","stdout","stderr"],M0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;F0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},F0e=(t,{signal:e})=>{Yn(t)&&Ea(t,L0e,e)},L0e=2});var Da,w3=y(()=>{Da=[];Da.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Da.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Da.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Kb,SI,wI,z0e,xI,Jb,U0e,$I,kI,EI,x3,tst,rst,$3=y(()=>{w3();Kb=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",SI=Symbol.for("signal-exit emitter"),wI=globalThis,z0e=Object.defineProperty.bind(Object),xI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(wI[SI])return wI[SI];z0e(wI,SI,{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}},Jb=class{},U0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),$I=class extends Jb{onExit(){return()=>{}}load(){}unload(){}},kI=class extends Jb{#t=EI.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 Da)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(!Kb(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 Da)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,Da.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 Kb(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"&&Kb(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)}},EI=globalThis.process,{onExit:x3,load:tst,unload:rst}=U0e(Kb(EI)?new kI(EI):new $I)});import{addAbortListener as q0e}from"node:events";var k3,E3=y(()=>{$3();k3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=x3(()=>{t.kill()});q0e(n,()=>{i()})}});var T3,B0e,H0e,A3,G0e,O3=y(()=>{JO();G_();cs();fl();T3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=H_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=B0e(r,n,i),{sourceStream:d,sourceError:f}=G0e(t,l),{options:p,fileDescriptors:m}=Ii.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},B0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=H0e(t,e,...r),a=nb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},H0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(A3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||WO(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]=C_(r,...n);return{destination:e(A3)(i,o,s),pipeOptions:s}}if(Ii.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}`)},A3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),G0e=(t,e)=>{try{return{sourceStream:wl(t,e)}}catch(r){return{sourceError:r}}}});var I3,Z0e,AI,R3,TI=y(()=>{Kf();Wb();I3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=Z0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw AI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},Z0e=({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 bI(r),e},AI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>kl({error:t,command:R3,escapedCommand:R3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),R3="source.pipe(destination)"});var P3,C3=y(()=>{P3=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 V0e}from"node:stream/promises";var D3,W0e,K0e,J0e,Yb,Y0e,X0e,N3=y(()=>{Vb();ib();Wb();D3=(t,e,r)=>{let n=Yb.has(e)?K0e(t,e):W0e(t,e);return Ea(t,Y0e,r.signal),Ea(e,X0e,r.signal),J0e(e),n},W0e=(t,e)=>{let r=Ca([t]);return Tl(r,e),Yb.set(e,r),r},K0e=(t,e)=>{let r=Yb.get(e);return r.add(t),r},J0e=async t=>{try{await V0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Yb.delete(t)},Yb=new WeakMap,Y0e=2,X0e=1});import{aborted as Q0e}from"node:util";var j3,e$e,M3=y(()=>{TI();j3=(t,e)=>t===void 0?[]:[e$e(t,e)],e$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Q0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw AI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var Xb,t$e,r$e,F3=y(()=>{po();O3();TI();C3();N3();M3();Xb=(t,...e)=>{if(At(e[0]))return Xb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=T3(t,...e),i=t$e({...n,destination:r});return i.pipe=Xb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},t$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=r$e(t,i);I3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=D3(e,o,d);return await Promise.race([P3(u),...j3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},r$e=(t,e)=>Promise.allSettled([t,e])});import{on as n$e}from"node:events";import{getDefaultHighWaterMark as i$e}from"node:stream";var Qb,o$e,OI,s$e,z3,RI,L3,a$e,c$e,ev=y(()=>{nI();Lb();sI();Qb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return o$e(e,s),z3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},o$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},OI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;s$e(e,s,t);let a=t.readableObjectMode&&!o;return z3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},s$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},z3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=n$e(t,"data",{signal:e.signal,highWaterMark:L3,highWatermark:L3});return a$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},RI=i$e(!0),L3=RI,a$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=c$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Pa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Yf(a)}},c$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[zb(t,r,!e),Fb(t,i,!n,{})].filter(Boolean)});import{setImmediate as l$e}from"node:timers/promises";var U3,u$e,d$e,f$e,II,q3,PI=y(()=>{Ob();rn();cI();ev();Ra();Jf();U3=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=u$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([d$e(t),d]);return}let f=eI(c,r),p=OI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([f$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},u$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Hb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=OI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await jW(a,t,r,o)},d$e=async t=>{await l$e(),t.readableFlowing===null&&t.resume()},f$e=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 Eb(r,{maxBuffer:o})):await Tb(r,{maxBuffer:o})}catch(a){return q3(vV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},II=async t=>{try{return await t}catch(e){return q3(e)}},q3=({bufferedData:t})=>fG(t)?new Uint8Array(t):t});import{finished as p$e}from"node:stream/promises";var tp,m$e,h$e,g$e,y$e,_$e,CI,tv,B3,rv=y(()=>{tp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=m$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],p$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||y$e(a,e,r,n)}finally{s.abort()}},m$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&h$e(t,r,n),n},h$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{g$e(e,r),n.call(t,...i)}},g$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},y$e=(t,e,r,n)=>{if(!_$e(t,e,r,n))throw t},_$e=(t,e,r,n=!0)=>r.propagating?B3(t)||tv(t):(r.propagating=!0,CI(r,e)===n?B3(t):tv(t)),CI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",tv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",B3=t=>t?.code==="EPIPE"});var H3,DI,NI=y(()=>{PI();rv();H3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>DI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),DI=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=tp(t,e,l);if(CI(l,e)){await u;return}let[d]=await Promise.all([U3({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 G3,Z3,b$e,v$e,jI=y(()=>{Vb();NI();G3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ca([t,e].filter(Boolean)):void 0,Z3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>DI({...b$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:v$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),b$e=({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}},v$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var V3,W3,K3=y(()=>{hl();ss();V3=t=>ml(t,"ipc"),W3=(t,e)=>{let r=B_(t);Oi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var J3,Y3,X3=y(()=>{Ra();K3();yo();mI();J3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=V3(o),a=go(e,"ipc"),c=go(r,"ipc");for await(let l of pI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(SV(t,i,c),i.push(l)),s&&W3(l,o);return i},Y3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as S$e}from"node:events";var Q3,w$e,x$e,$$e,eK=y(()=>{Oa();OR();vR();TR();ho();vr();PI();X3();IR();jI();NI();dI();rv();Q3=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 _=BW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=H3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=Z3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=J3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=w$e(h,t,S),D=x$e(m,S);try{return await Promise.race([Promise.all([{},GW(_),Promise.all(x),w,T,Z9(t,d),...A,...D]),g,$$e(t,b),...U9(t,o,f,b),...a9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...L9({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(q=>II(q))),II(w),Y3(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},w$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:tp(n,i,r)),x$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>tp(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),$$e=async(t,{signal:e})=>{let[r]=await S$e(t,"error",{signal:e});throw r}});var tK,rp,Ol,nv=y(()=>{Sl();tK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),rp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ri();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Ol=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 rK}from"node:stream/promises";var MI,nK,FI,LI,iv,ov,zI=y(()=>{rv();MI=async t=>{if(t!==void 0)try{await FI(t)}catch{}},nK=async t=>{if(t!==void 0)try{await LI(t)}catch{}},FI=async t=>{await rK(t,{cleanup:!0,readable:!1,writable:!0})},LI=async t=>{await rK(t,{cleanup:!0,readable:!0,writable:!1})},iv=async(t,e)=>{if(await t,e)throw e},ov=(t,e,r)=>{r&&!tv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as k$e}from"node:stream";import{callbackify as E$e}from"node:util";var iK,UI,qI,BI,A$e,HI,GI,oK,ZI=y(()=>{Aa();cs();ev();Sl();nv();zI();iK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=UI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=qI(a,s),{read:f,onStdoutDataDone:p}=BI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new k$e({read:f,destroy:E$e(GI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return HI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},UI=(t,e,r)=>{let n=wl(t,e),i=rp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},qI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:RI},BI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ri(),s=Qb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){A$e(this,s,o)},onStdoutDataDone:o}},A$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},HI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await LI(t),await n,await MI(i),await e,r.readable&&r.push(null)}catch(o){await MI(i),oK(r,o)}},GI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Ol(r,e)&&(oK(t,n),await iv(e,n))},oK=(t,e)=>{ov(t,t.readable,e)}});import{Writable as T$e}from"node:stream";import{callbackify as sK}from"node:util";var aK,VI,WI,O$e,R$e,KI,JI,cK,YI=y(()=>{cs();nv();zI();aK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=VI(t,r,e),s=new T$e({...WI(n,t,i),destroy:sK(JI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return KI(n,s),s},VI=(t,e,r)=>{let n=nb(t,e),i=rp(r,n,"writableFinal"),o=rp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},WI=(t,e,r)=>({write:O$e.bind(void 0,t),final:sK(R$e.bind(void 0,t,e,r))}),O$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},R$e=async(t,e,r)=>{await Ol(r,e)&&(t.writable&&t.end(),await e)},KI=async(t,e,r)=>{try{await FI(t),e.writable&&e.end()}catch(n){await nK(r),cK(e,n)}},JI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Ol(r,e),await Ol(n,e)&&(cK(t,i),await iv(e,i))},cK=(t,e)=>{ov(t,t.writable,e)}});import{Duplex as I$e}from"node:stream";import{callbackify as P$e}from"node:util";var lK,C$e,uK=y(()=>{Aa();ZI();YI();lK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=UI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=VI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=qI(c,a),{read:g,onStdoutDataDone:b}=BI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new I$e({read:g,...WI(u,t,d),destroy:P$e(C$e.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 HI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),KI(u,_,c),_},C$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([GI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),JI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var XI,D$e,dK=y(()=>{Aa();cs();ev();XI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=wl(t,r),a=Qb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return D$e(a,s,t)},D$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var fK,pK=y(()=>{nv();ZI();YI();uK();dK();fK=(t,{encoding:e})=>{let r=tK();t.readable=iK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=aK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=lK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=XI.bind(void 0,t,e),t[Symbol.asyncIterator]=XI.bind(void 0,t,e,{})}});var mK,N$e,j$e,hK=y(()=>{mK=(t,e)=>{for(let[r,n]of j$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},N$e=(async()=>{})().constructor.prototype,j$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(N$e,t)])});import{setMaxListeners as M$e}from"node:events";import{spawn as F$e}from"node:child_process";var gK,L$e,z$e,U$e,q$e,B$e,yK=y(()=>{Ob();sR();DR();cs();NR();hI();Kf();Pb();s3();d3();Jf();S3();Q_();E3();F3();jI();eK();pK();Sl();hK();gK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=L$e(t,e,r),{subprocess:f,promise:p}=U$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Xb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),mK(f,p),Ii.set(f,{options:u,fileDescriptors:d}),f},L$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Z_(t,e,r),{file:a,commandArguments:c,options:l}=bb(t,e,r),u=z$e(l),d=u3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},z$e=({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}},U$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=F$e(...vb(t,e,r))}catch(m){return o3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;M$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];v3(c,a,l),k3(c,r,l);let d={},f=Ri();c.kill=o9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=G3(c,r),fK(c,r),r3(c,r);let p=q$e({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}},q$e=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 Q3({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)=>bo(x,e,w)),_=bo(h,e,"all"),S=B$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return El(S,n,e)},B$e=({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?Wf({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 Pi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Ib({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var sv,H$e,G$e,_K=y(()=>{po();yo();sv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,H$e(n,t[n],i)]));return{...t,...r}},H$e=(t,e,r)=>G$e.has(t)&&At(e)&&At(r)?{...e,...r}:r,G$e=new Set(["env",...tR])});var ds,Z$e,V$e,bK=y(()=>{po();JO();vG();KW();yK();_K();ds=(t,e,r,n)=>{let i=(s,a,c)=>ds(s,a,r,c),o=(...s)=>Z$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Z$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(At(o))return i(t,sv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=V$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?WW(a,c,l):gK(a,c,l,i)},V$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=_G(e)?bG(e,r):[e,...r],[s,a,c]=C_(...o),l=sv(sv(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 vK,SK,wK,W$e,K$e,xK=y(()=>{vK=({file:t,commandArguments:e})=>wK(t,e),SK=({file:t,commandArguments:e})=>({...wK(t,e),isSync:!0}),wK=(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]=W$e(t);return{file:r,commandArguments:n}},W$e=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(K$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},K$e=/ +/g});var $K,kK,J$e,EK,Y$e,AK,TK=y(()=>{$K=(t,e,r)=>{t.sync=e(J$e,r),t.s=t.sync},kK=({options:t})=>EK(t),J$e=({options:t})=>({...EK(t),isSync:!0}),EK=t=>({options:{...Y$e(t),...t}}),Y$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},AK={preferLocal:!0}});var Gct,Je,Zct,Vct,Wct,Kct,Jct,Yct,Xct,Qct,Mr=y(()=>{bK();xK();RR();TK();hI();Gct=ds(()=>({})),Je=ds(()=>({isSync:!0})),Zct=ds(vK),Vct=ds(SK),Wct=ds(B9),Kct=ds(kK,{},AK,$K),{sendMessage:Jct,getOneMessage:Yct,getEachMessage:Xct,getCancelSignal:Qct}=n3()});import{existsSync as av,statSync as X$e}from"node:fs";import{dirname as QI,extname as Q$e,isAbsolute as OK,join as eP,relative as tP,resolve as cv,sep as eke}from"node:path";function lv(t){return t==="./gradlew"||t==="gradle"}function tke(t){return(av(eP(t,"build.gradle.kts"))||av(eP(t,"build.gradle")))&&av(eP(t,"gradle.properties"))}function rke(t,e){let n=tP(t,e).split(eke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function fs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function nke(t,e){let r=cv(t,e),n=r;av(r)?X$e(r).isFile()&&(n=QI(r)):Q$e(r)!==""&&(n=QI(r));let i=tP(t,n);if(i.startsWith("..")||OK(i))return null;let o=n;for(;;){if(tke(o))return o;if(cv(o)===cv(t))return null;let s=QI(o);if(s===o)return null;let a=tP(t,s);if(a.startsWith("..")||OK(a))return null;o=s}}function uv(t,e){let r=cv(t),n=new Map,i=[];for(let o of e){let s=nke(r,o);if(!s){i.push(o);continue}let a=rke(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 ike,readFileSync as oke}from"node:fs";import{join as ske}from"node:path";function Rl(t="."){let e=ske(t,".cladding","config.yaml");if(!ike(e))return rP;try{let n=(0,RK.parse)(oke(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 ake){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 IK(t,e){let r=[],n=!1;for(let i of t){let o=cke.exec(i);if(o){n=!0;for(let s of e)r.push(fs(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 RK,ake,rP,cke,fv=y(()=>{"use strict";RK=bt(Qt(),1);dv();ake=["type","lint","test","coverage"],rP={scope:"feature"};cke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as iP,readFileSync as PK,readdirSync as lke,statSync as uke}from"node:fs";import{join as pv}from"node:path";function aP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=pv(t,e);if(iP(r))try{if(CK.test(PK(r,"utf8")))return!0}catch{}}return!1}function DK(t){try{return iP(t)&&CK.test(PK(t,"utf8"))}catch{return!1}}function NK(t,e=0){if(e>4||!iP(t))return!1;let r;try{r=lke(t)}catch{return!1}for(let n of r){let i=pv(t,n),o=!1;try{o=uke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(NK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&DK(i))return!0}return!1}function pke(t){if(aP(t))return!0;for(let e of dke)if(DK(pv(t,e)))return!0;for(let e of fke)if(NK(pv(t,e)))return!0;return!1}function jK(t="."){let e=Rl(t).coverage;return e||(pke(t)?"kover":"jacoco")}function MK(t="."){return oP[jK(t)]}function FK(t="."){return nP[jK(t)]}var oP,nP,sP,CK,dke,fke,mv=y(()=>{"use strict";fv();oP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},nP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},sP=[nP.kover,nP.jacoco],CK=/kover/i;dke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],fke=["buildSrc","build-logic"]});import{existsSync as hv,readFileSync as LK,readdirSync as zK}from"node:fs";import{join as Na}from"node:path";function cP(t){return hv(Na(t,"gradlew"))?"./gradlew":"gradle"}function mke(t){let e=cP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[MK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function hke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(LK(Na(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 yke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function vke(t,e){for(let r of e)if(hv(Na(t,r)))return r}function Ske(t,e){try{return zK(t).find(n=>n.endsWith(e))}catch{return}}function xke(t,e){for(let r of wke)if(r.configs.some(n=>hv(Na(t,n))))return r.gate;return e}function kke(t){if($ke.some(e=>hv(Na(t,e))))return!0;try{return JSON.parse(LK(Na(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function Eke(t,e){let r=e.lint?{...e,lint:xke(t,e.lint)}:{...e};return e.test&&e.coverage&&kke(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function ut(t="."){for(let e of _ke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Ske(t,o):r=vke(t,[o]),r)break;if(!r||e.requiresSource&&!yke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Eke(t,n):n;return{language:e.language,manifest:r,gates:i}}return bke}var gke,_ke,bke,wke,$ke,on=y(()=>{"use strict";mv();gke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);_ke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:mke},{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:hke}],bke={language:"unknown",manifest:"",gates:{}};wke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];$ke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Ake,readFileSync as Tke}from"node:fs";import{join as Oke}from"node:path";function ja(t){return t.code==="ENOENT"}function gv(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=(o||s||`exit ${i}`).slice(0,200);return UK.test(o)||UK.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Ut(t,e,r){return ja(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Il(t,e){let r=Oke(t,"package.json");if(!Ake(r))return!1;try{return!!JSON.parse(Tke(r,"utf8")).scripts?.[e]}catch{return!1}}var UK,Tn=y(()=>{"use strict";UK=/config (is |file )?not found|no such file|ENOENT|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 Rke(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.arch;if(!n)return[{detector:yv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return ja(i)?[{detector:yv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:gv(i,yv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var yv,Ma,_v=y(()=>{"use strict";Mr();on();Tn();yv="ARCHITECTURE_VIOLATION";Ma={name:yv,subprocess:!0,run:Rke}});function Ike(t){let{cwd:e="."}=t,r=ut(e),n=r.gates.secret;if(!n)return[{detector:bv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return ja(i)?[{detector:bv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:gv(i,bv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var bv,Fa,vv=y(()=>{"use strict";Mr();on();Tn();bv="HARDCODED_SECRET";Fa={name:bv,subprocess:!0,run:Ike}});import{existsSync as lP,readdirSync as qK}from"node:fs";import{join as Sv}from"node:path";function Cke(t,e){let r=Sv(t,e.path);if(!lP(r))return!0;if(e.isDirectory)try{return qK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Dke(t){let{cwd:e="."}=t,r=[];for(let i of Pke)Cke(e,i)&&r.push({detector:np,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=Sv(e,"spec.yaml");if(lP(n)){let i=Mke(n),o=i?null:Nke(e);if(i)r.push({detector:np,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:np,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=jke(e);s&&r.push({detector:np,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 Nke(t){for(let e of["spec/features","spec/scenarios"]){let r=Sv(t,e);if(!lP(r))continue;let n;try{n=qK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ei(Sv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function jke(t){try{return G(t),null}catch(e){return e.message}}function Mke(t){let e;try{e=Ei(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var np,Pke,BK,HK=y(()=>{"use strict";qe();x_();np="ABSENCE_OF_GOVERNANCE",Pke=[{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}];BK={name:np,run:Dke}});function wv(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=wv(r)==="while",o=Lke.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 '${wv(r)}'`}let n=Fke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:wv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${wv(r)}'`:null}function zke(t,e){let r=uP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function GK(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...zke(r,n));return e}var Fke,Lke,dP=y(()=>{"use strict";Fke={event:"when",state:"while",optional:"where",unwanted:"if"},Lke=/\bwhen\b/i});function he(t,e,r){let n;try{n=G(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var vt=y(()=>{"use strict";qe()});function Uke(t){let{cwd:e="."}=t;return he(e,xv,qke)}function qke(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:xv,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 GK(t.features))e.push({detector:xv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var xv,ZK,VK=y(()=>{"use strict";dP();vt();xv="AC_DRIFT";ZK={name:xv,run:Uke}});function Di(t=".",e){let n=(e??"").trim().toLowerCase()||ut(t).language;return KK[n]??WK}var Bke,Hke,Gke,WK,Zke,Vke,KK,Wke,JK,La=y(()=>{"use strict";on();Bke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,Hke=/^[ \t]*import\s+([\w.]+)/gm,Gke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,WK={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:Bke,importStyle:"relative"},Zke={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:Hke,importStyle:"dotted"},Vke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:Gke,importStyle:"dotted"},KK={typescript:WK,kotlin:Zke,python:Vke},Wke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],JK=new Set([...Object.values(KK).flatMap(t=>t?.extensions??[]),...Wke].map(t=>t.toLowerCase()))});import{existsSync as Kke,readFileSync as Jke,readdirSync as Yke,statSync as Xke}from"node:fs";import{join as XK,relative as YK}from"node:path";function Qke(t,e){if(!Kke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=Yke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=XK(i,s),c;try{c=Xke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function eEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function rEe(t){return tEe.test(t)}function nEe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Di(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Qke(XK(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=Jke(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";qe();La();QK="AI_HINTS_FORBIDDEN_PATTERN";tEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;eJ={name:QK,run:nEe}});function iEe(t){let{cwd:e="."}=t,r;try{r=G(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:rJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var rJ,nJ,iJ=y(()=>{"use strict";qe();rJ="AC_DUPLICATE_WITHIN_FEATURE";nJ={name:rJ,run:iEe}});import{createRequire as oEe}from"module";import{basename as sEe,dirname as pP,normalize as aEe,relative as cEe,resolve as lEe,sep as aJ}from"path";import*as uEe from"fs";function dEe(t){let e=aEe(t);return e.length>1&&e[e.length-1]===aJ&&(e=e.substring(0,e.length-1)),e}function cJ(t,e){return t.replace(fEe,e)}function mEe(t){return t==="/"||pEe.test(t)}function fP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=lEe(t)),(n||o)&&(t=dEe(t)),t===".")return"";let s=t[t.length-1]!==i;return cJ(s?t+i:t,i)}function lJ(t,e){return e+t}function hEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:cJ(cEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function gEe(t){return t}function yEe(t,e,r){return e+t+r}function _Ee(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?hEe(t,e):n?lJ:gEe}function bEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function vEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function $Ee(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?vEe(t):bEe(t):n&&n.length?wEe:SEe:xEe}function REe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?OEe:r&&r.length?n?kEe:EEe:n?AEe:TEe}function CEe(t){return t.group?PEe:IEe}function jEe(t){return t.group?DEe:NEe}function LEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?FEe:MEe}function uJ(t,e,r){if(r.options.useRealPaths)return zEe(e,r);let n=pP(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=pP(n)}return r.symlinks.set(t,e),i>1}function zEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function $v(t,e,r,n){e(t&&!n?t:null,r)}function KEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?UEe:GEe:n?e?qEe:WEe:i?e?HEe:VEe:e?BEe:ZEe}function XEe(t){return t?YEe:JEe}function rAe(t,e){return new Promise((r,n)=>{pJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function pJ(t,e,r){new fJ(t,e,r).start()}function nAe(t,e){return new fJ(t,e).start()}var oJ,fEe,pEe,SEe,wEe,xEe,kEe,EEe,AEe,TEe,OEe,IEe,PEe,DEe,NEe,MEe,FEe,UEe,qEe,BEe,HEe,GEe,ZEe,VEe,WEe,dJ,JEe,YEe,QEe,eAe,tAe,fJ,sJ,mJ,hJ,gJ=y(()=>{oJ=oEe(import.meta.url);fEe=/[\\/]/g;pEe=/^[a-z]:[\\/]$/i;SEe=(t,e)=>{e.push(t||".")},wEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},xEe=()=>{};kEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},EEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},AEe=(t,e,r,n)=>{r.files++},TEe=(t,e)=>{e.push(t)},OEe=()=>{};IEe=t=>t,PEe=()=>[""].slice(0,0);DEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},NEe=()=>{};MEe=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()&&uJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},FEe=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()&&uJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};UEe=t=>t.counts,qEe=t=>t.groups,BEe=t=>t.paths,HEe=t=>t.paths.slice(0,t.options.maxFiles),GEe=(t,e,r)=>($v(e,r,t.counts,t.options.suppressErrors),null),ZEe=(t,e,r)=>($v(e,r,t.paths,t.options.suppressErrors),null),VEe=(t,e,r)=>($v(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),WEe=(t,e,r)=>($v(e,r,t.groups,t.options.suppressErrors),null);dJ={withFileTypes:!0},JEe=(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||".",dJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},YEe=(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||".",dJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};QEe=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))}},eAe=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}},tAe=class{aborted=!1;abort(){this.aborted=!0}},fJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=KEe(e,this.isSynchronous),this.root=fP(t,e),this.state={root:mEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new eAe,options:e,queue:new QEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new tAe,fs:e.fs||uEe},this.joinPath=_Ee(this.root,e),this.pushDirectory=$Ee(this.root,e),this.pushFile=REe(e),this.getArray=CEe(e),this.groupFiles=jEe(e),this.resolveSymlink=LEe(e,this.isSynchronous),this.walkDirectory=XEe(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(_=fP(_,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=sEe(_),x=fP(pP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};sJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return rAe(this.root,this.options)}withCallback(t){pJ(this.root,this.options,t)}sync(){return nAe(this.root,this.options)}},mJ=null;try{oJ.resolve("picomatch"),mJ=oJ("picomatch")}catch{}hJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:aJ,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 sJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new sJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||mJ;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 ip=v((rut,SJ)=>{"use strict";var yJ="[^\\\\/]",iAe="(?=.)",_J="[^/]",mP="(?:\\/|$)",bJ="(?:^|\\/)",hP=`\\.{1,2}${mP}`,oAe="(?!\\.)",sAe=`(?!${bJ}${hP})`,aAe=`(?!\\.{0,1}${mP})`,cAe=`(?!${hP})`,lAe="[^.\\/]",uAe=`${_J}*?`,dAe="/",vJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:iAe,QMARK:_J,END_ANCHOR:mP,DOTS_SLASH:hP,NO_DOT:oAe,NO_DOTS:sAe,NO_DOT_SLASH:aAe,NO_DOTS_SLASH:cAe,QMARK_NO_DOT:lAe,STAR:uAe,START_ANCHOR:bJ,SEP:dAe},fAe={...vJ,SLASH_LITERAL:"[\\\\/]",QMARK:yJ,STAR:`${yJ}*?`,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:"\\"},pAe={__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"};SJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:pAe,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?fAe:vJ}}});var op=v(Fr=>{"use strict";var{REGEX_BACKSLASH:mAe,REGEX_REMOVE_BACKSLASH:hAe,REGEX_SPECIAL_CHARS:gAe,REGEX_SPECIAL_CHARS_GLOBAL:yAe}=ip();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>gAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(yAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(mAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(hAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var OJ=v((iut,TJ)=>{"use strict";var wJ=op(),{CHAR_ASTERISK:gP,CHAR_AT:_Ae,CHAR_BACKWARD_SLASH:sp,CHAR_COMMA:bAe,CHAR_DOT:yP,CHAR_EXCLAMATION_MARK:_P,CHAR_FORWARD_SLASH:AJ,CHAR_LEFT_CURLY_BRACE:bP,CHAR_LEFT_PARENTHESES:vP,CHAR_LEFT_SQUARE_BRACKET:vAe,CHAR_PLUS:SAe,CHAR_QUESTION_MARK:xJ,CHAR_RIGHT_CURLY_BRACE:wAe,CHAR_RIGHT_PARENTHESES:$J,CHAR_RIGHT_SQUARE_BRACKET:xAe}=ip(),kJ=t=>t===AJ||t===sp,EJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},$Ae=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},E=()=>l>=n,q=()=>c.charCodeAt(l+1),Q=()=>(T=A,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),Se&&m===!0&&d>0?(Se=c.slice(0,d),C=c.slice(d)):m===!0?(Se="",C=c):Se=c,Se&&Se!==""&&Se!=="/"&&Se!==c&&kJ(Se.charCodeAt(Se.length-1))&&(Se=Se.slice(0,-1)),r.unescape===!0&&(C&&(C=wJ.removeBackslashes(C)),Se&&_===!0&&(Se=wJ.removeBackslashes(Se)));let Ir={prefix:P,input:t,start:u,base:Se,glob:C,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,kJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var ap=ip(),sn=op(),{MAX_LENGTH:kv,POSIX_REGEX_SOURCE:kAe,REGEX_NON_SPECIAL_CHARS:EAe,REGEX_SPECIAL_CHARS_BACKREF:AAe,REPLACEMENTS:RJ}=ap,TAe=(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=>sn.escapeRegex(i)).join("..")}return r},Pl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,IJ=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},OAe=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},PJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(OAe(e))return e.replace(/\\(.)/g,"$1")},RAe=t=>{let e=t.map(PJ).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}}}}},IAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=PJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},PAe=t=>{let e=0,r=t.trim(),n=SP(r);for(;n;)e++,r=n.body.trim(),n=SP(r);return e},CAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:ap.DEFAULT_MAX_EXTGLOB_RECURSION,n=IJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||RAe(n)))return{risky:!0};for(let i of n){let o=IAe(i);if(o)return{risky:!0,safeOutput:o};if(PAe(i)>r)return{risky:!0}}return{risky:!1}},wP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=RJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(kv,r.maxLength):kv,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,O=H=>`(${a}(?:(?!${w}${H.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(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=sn.removePrefix(t,E),i=t.length;let q=[],Q=[],Se=[],P=o,C,Ir=()=>E.index===i-1,se=E.peek=(H=1)=>t[E.index+H],Pe=E.advance=()=>t[++E.index]||"",Kt=()=>t.slice(E.index+1),dr=(H="",pt=0)=>{E.consumed+=H,E.index+=pt},Yt=H=>{E.output+=H.output!=null?H.output:H.value,dr(H.value)},oo=()=>{let H=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),E.start++,H++;return H%2===0?!1:(E.negated=!0,E.start++,!0)},Si=H=>{E[H]++,Se.push(H)},Yr=H=>{E[H]--,Se.pop()},de=H=>{if(P.type==="globstar"){let pt=E.braces>0&&(H.type==="comma"||H.type==="brace"),B=H.extglob===!0||q.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!pt&&!B&&(E.output=E.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=D,E.output+=P.output)}if(q.length&&H.type!=="paren"&&(q[q.length-1].inner+=H.value),(H.value||H.output)&&Yt(H),P&&P.type==="text"&&H.type==="text"){P.output=(P.output||P.value)+H.value,P.value+=H.value;return}H.prev=P,s.push(H),P=H},so=(H,pt)=>{let B={...l[pt],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;Si("parens"),de({type:H,value:pt,output:E.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Te}),q.push(B)},fde=H=>{let pt=t.slice(H.startIndex,E.index+1),B=t.slice(H.startIndex+2,E.index),Te=CAe(B,r);if((H.type==="plus"||H.type==="star")&&Te.risky){let ct=Te.safeOutput?(H.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,wi=s[H.tokensIndex];wi.type="text",wi.value=pt,wi.output=ct||sn.escapeRegex(pt);for(let xi=H.tokensIndex+1;xi1&&H.inner.includes("/")&&(ct=O(r)),(ct!==D||Ir()||/^\)+$/.test(Kt()))&&(lt=H.close=`)$))${ct}`),H.inner.includes("*")&&(Ft=Kt())&&/^\.[^\\/.]+$/.test(Ft)){let wi=wP(Ft,{...e,fastpaths:!1}).output;lt=H.close=`)${wi})${ct})`}H.prev.type==="bos"&&(E.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:C,output:lt}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,pt=t.replace(AAe,(B,Te,lt,Ft,ct,wi)=>Ft==="\\"?(H=!0,B):Ft==="?"?Te?Te+Ft+(ct?_.repeat(ct.length):""):wi===0?A+(ct?_.repeat(ct.length):""):_.repeat(lt.length):Ft==="."?u.repeat(lt.length):Ft==="*"?Te?Te+Ft+(ct?D:""):D:Te?B:`\\${B}`);return H===!0&&(r.unescape===!0?pt=pt.replace(/\\/g,""):pt=pt.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),pt===t&&r.contains===!0?(E.output=t,E):(E.output=sn.wrapOutput(pt,E,e),E)}for(;!Ir();){if(C=Pe(),C==="\0")continue;if(C==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){C+="\\",de({type:"text",value:C});continue}let Te=/^\\+/.exec(Kt()),lt=0;if(Te&&Te[0].length>2&&(lt=Te[0].length,E.index+=lt,lt%2!==0&&(C+="\\")),r.unescape===!0?C=Pe():C+=Pe(),E.brackets===0){de({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("["),lt=P.value.slice(0,Te),Ft=P.value.slice(Te+2),ct=kAe[Ft];if(ct){P.value=lt+ct,E.backtrack=!0,Pe(),!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,Yt({value:C});continue}if(E.quotes===1&&C!=='"'){C=sn.escapeRegex(C),P.value+=C,Yt({value:C});continue}if(C==='"'){E.quotes=E.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:C});continue}if(C==="("){Si("parens"),de({type:"paren",value:C});continue}if(C===")"){if(E.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Pl("opening","("));let B=q[q.length-1];if(B&&E.parens===B.parens+1){fde(q.pop());continue}de({type:"paren",value:C,output:E.parens?")":"\\)"}),Yr("parens");continue}if(C==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Pl("closing","]"));C=`\\${C}`}else Si("brackets");de({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){de({type:"text",value:C,output:`\\${C}`});continue}if(E.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Pl("opening","["));de({type:"text",value:C,output:`\\${C}`});continue}Yr("brackets");let B=P.value.slice(1);if(P.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(C=`/${C}`),P.value+=C,Yt({value:C}),r.literalBrackets===!1||sn.hasRegexChars(B))continue;let Te=sn.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){Si("braces");let B={type:"brace",value:C,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};Q.push(B),de(B);continue}if(C==="}"){let B=Q[Q.length-1];if(r.nobrace===!0||!B){de({type:"text",value:C,output:C});continue}let Te=")";if(B.dots===!0){let lt=s.slice(),Ft=[];for(let ct=lt.length-1;ct>=0&&(s.pop(),lt[ct].type!=="brace");ct--)lt[ct].type!=="dots"&&Ft.unshift(lt[ct].value);Te=TAe(Ft,r),E.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let lt=E.output.slice(0,B.outputIndex),Ft=E.tokens.slice(B.tokensIndex);B.value=B.output="\\{",C=Te="\\}",E.output=lt;for(let ct of Ft)E.output+=ct.output||ct.value}de({type:"brace",value:C,output:Te}),Yr("braces"),Q.pop();continue}if(C==="|"){q.length>0&&q[q.length-1].conditions++,de({type:"text",value:C});continue}if(C===","){let B=C,Te=Q[Q.length-1];Te&&Se[Se.length-1]==="braces"&&(Te.comma=!0,B="|"),de({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}de({type:"slash",value:C,output:f});continue}if(C==="."){if(E.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let B=Q[Q.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"){de({type:"text",value:C,output:u});continue}de({type:"dot",value:C,output:u});continue}if(C==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){so("qmark",C);continue}if(P&&P.type==="paren"){let Te=se(),lt=C;(P.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(lt=`\\${C}`),de({type:"text",value:C,output:lt});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){de({type:"qmark",value:C,output:S});continue}de({type:"qmark",value:C,output:_});continue}if(C==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){so("negate",C);continue}if(r.nonegate!==!0&&E.index===0){oo();continue}}if(C==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){so("plus",C);continue}if(P&&P.value==="("||r.regex===!1){de({type:"plus",value:C,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||E.parens>0){de({type:"plus",value:C});continue}de({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:C,output:""});continue}de({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let B=EAe.exec(Kt());B&&(C+=B[0],E.index+=B[0].length),de({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,dr(C);continue}let H=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(H)){so("star",C);continue}if(P.type==="star"){if(r.noglobstar===!0){dr(C);continue}let B=P.prev,Te=B.prev,lt=B.type==="slash"||B.type==="bos",Ft=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!lt||H[0]&&H[0]!=="/")){de({type:"star",value:C,output:""});continue}let ct=E.braces>0&&(B.type==="comma"||B.type==="brace"),wi=q.length&&(B.type==="pipe"||B.type==="paren");if(!lt&&B.type!=="paren"&&!ct&&!wi){de({type:"star",value:C,output:""});continue}for(;H.slice(0,3)==="/**";){let xi=t[E.index+4];if(xi&&xi!=="/")break;H=H.slice(3),dr("/**",3)}if(B.type==="bos"&&Ir()){P.type="globstar",P.value+=C,P.output=O(r),E.output=P.output,E.globstar=!0,dr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!Ft&&Ir()){E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=O(r)+(r.strictSlashes?")":"|$)"),P.value+=C,E.globstar=!0,E.output+=B.output+P.output,dr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&H[0]==="/"){let xi=H[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=`${O(r)}${f}|${f}${xi})`,P.value+=C,E.output+=B.output+P.output,E.globstar=!0,dr(C+Pe()),de({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&H[0]==="/"){P.type="globstar",P.value+=C,P.output=`(?:^|${f}|${O(r)}${f})`,E.output=P.output,E.globstar=!0,dr(C+Pe()),de({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-P.output.length),P.type="globstar",P.output=O(r),P.value+=C,E.output+=P.output,E.globstar=!0,dr(C);continue}let pt={type:"star",value:C,output:D};if(r.bash===!0){pt.output=".*?",(P.type==="bos"||P.type==="slash")&&(pt.output=T+pt.output),de(pt);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){pt.output=C,de(pt);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+=T,P.output+=T),se()!=="*"&&(E.output+=p,P.output+=p)),de(pt)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Pl("closing","]"));E.output=sn.escapeLast(E.output,"["),Yr("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Pl("closing",")"));E.output=sn.escapeLast(E.output,"("),Yr("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Pl("closing","}"));E.output=sn.escapeLast(E.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),E.backtrack===!0){E.output="";for(let H of E.tokens)E.output+=H.output!=null?H.output:H.value,H.suffix&&(E.output+=H.suffix)}return E};wP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(kv,r.maxLength):kv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=RJ[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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};CJ.exports=wP});var MJ=v((sut,jJ)=>{"use strict";var DAe=OJ(),xP=DJ(),NJ=op(),NAe=ip(),jAe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=jAe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?NJ.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(NJ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):xP(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>DAe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=xP.fastpaths(t,e)),i.output||(i=xP(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=NAe;jJ.exports=Tt});var UJ=v((aut,zJ)=>{"use strict";var FJ=MJ(),MAe=op();function LJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:MAe.isWindows()}),FJ(t,e,r)}Object.assign(LJ,FJ);zJ.exports=LJ});import{readdir as FAe,readdirSync as LAe,realpath as zAe,realpathSync as UAe,stat as qAe,statSync as BAe}from"fs";import{isAbsolute as HAe,posix as za,resolve as GAe}from"path";import{fileURLToPath as ZAe}from"url";function KAe(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]===".."&&WAe.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=>za.relative(t,n)||".":n=>za.relative(t,`${e}/${n}`)||"."}function XAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=za.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function GJ(t){var e;let r=Cl.default.scan(t,QAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function oTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Cl.default.scan(t);return r.isGlob||r.negated}function cp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function ZJ(t){return typeof t=="string"?[t]:t??[]}function $P(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=iTe(o);s=HAe(s.replace(aTe,""))?za.relative(a,s):za.normalize(s);let c=(i=sTe.exec(s))===null||i===void 0?void 0:i[0],l=GJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?za.join(o,...d):o}return s}function cTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push($P(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push($P(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push($P(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function lTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=cTe(t,e,n);t.debug&&cp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(BJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Cl.default)(i.match,f),m=(0,Cl.default)(i.ignore,f),h=KAe(i.match,f),g=qJ(r,d,o),b=o?g:qJ(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new hJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&cp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return cp(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&cp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&XAe(r,d)]}function uTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function fTe(t){let e={...dTe,...t};return e.cwd=(e.cwd instanceof URL?ZAe(e.cwd):GAe(e.cwd)).replace(BJ,"/"),e.ignore=ZJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||FAe,readdirSync:e.fs.readdirSync||LAe,realpath:e.fs.realpath||zAe,realpathSync:e.fs.realpathSync||UAe,stat:e.fs.stat||qAe,statSync:e.fs.statSync||BAe}),e.debug&&cp("globbing with options:",e),e}function pTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=VAe(t)||typeof t=="string",i=ZJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=fTe(n?e:t);return i.length>0?lTe(o,i):[]}function ps(t,e){let[r,n]=pTe(t,e);return r?uTe(r.sync(),n):[]}var Cl,VAe,BJ,HJ,WAe,JAe,YAe,QAe,eTe,tTe,rTe,nTe,iTe,sTe,aTe,dTe,lp=y(()=>{gJ();Cl=bt(UJ(),1),VAe=Array.isArray,BJ=/\\/g,HJ=process.platform==="win32",WAe=/^(\/?\.\.)+$/;JAe=/^[A-Z]:\/$/i,YAe=HJ?t=>JAe.test(t):t=>t==="/";QAe={parts:!0};eTe=/(?t.replace(eTe,"\\$&"),nTe=t=>t.replace(tTe,"\\$&"),iTe=HJ?nTe:rTe;sTe=/^(\/?\.\.)+/,aTe=/\\(?=[()[\]{}!*+?@|])/g;dTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as up,readFileSync as mTe,readdirSync as hTe,statSync as VJ}from"node:fs";import{join as Ua}from"node:path";function gTe(t){let{cwd:e="."}=t,r,n;try{let c=G(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Di(e,n),o=[],{layers:s,forbiddenImports:a}=kP(r);return(s.size>0||a.length>0)&&!up(Ua(e,i.mainRoot))?[{detector:dp,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&&(yTe(e,i,s,o),_Te(e,i,s,o)),a.length>0&&bTe(e,i,a,o),o)}function kP(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 yTe(t,e,r,n){let i=e.mainRoot,o=Ua(t,i);if(up(o))for(let s of hTe(o)){let a=Ua(o,s);VJ(a).isDirectory()&&(r.has(s)||n.push({detector:dp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function _Te(t,e,r,n){let i=e.mainRoot,o=Ua(t,i);if(up(o))for(let s of r){let a=Ua(o,s);up(a)&&VJ(a).isDirectory()||n.push({detector:dp,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 bTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ua(t,i,s.from);if(!up(a))continue;let c=ps([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ua(a,l),d;try{d=mTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];vTe(p,s.to,e.importStyle)&&n.push({detector:dp,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 vTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var dp,WJ,EP=y(()=>{"use strict";lp();qe();La();dp="ARCHITECTURE_FROM_SPEC";WJ={name:dp,run:gTe}});import{existsSync as STe,readFileSync as wTe}from"node:fs";import{join as xTe}from"node:path";function $Te(t){let{cwd:e="."}=t,r=xTe(e,"spec/capabilities.yaml");if(!STe(r))return[];let n;try{let c=wTe(r,"utf8"),l=KJ.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=G(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:Ev,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:Ev,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:Ev,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var KJ,Ev,JJ,YJ=y(()=>{"use strict";KJ=bt(Qt(),1);qe();Ev="CAPABILITIES_FEATURE_MAPPING";JJ={name:Ev,run:$Te}});import{existsSync as kTe,readFileSync as ETe}from"node:fs";import{join as ATe}from"node:path";function TTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function OTe(t){let{cwd:e="."}=t;return he(e,AP,r=>RTe(r,e))}function RTe(t,e){let r=Di(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=ATe(e,o);if(!kTe(s))continue;let a=ETe(s,"utf8");TTe(a)||n.push({detector:AP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var AP,XJ,QJ=y(()=>{"use strict";La();vt();AP="CONVENTION_DRIFT";XJ={name:AP,run:OTe}});import{existsSync as TP,readFileSync as e8}from"node:fs";import{join as Av}from"node:path";function ITe(t){return JSON.parse(t).total?.lines?.pct??0}function t8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function DTe(t,e){if(!lv(ut(t).gates.coverage?.cmd))return null;let r;try{r=uv(t,e)}catch(c){return[{detector:vo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=sP.find(d=>TP(Av(c.dir,d)));if(!l){s.push(c.path);continue}let u=t8(e8(Av(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:vo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=r8(n,i);return a0?[{detector:vo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function NTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=DTe(e,t.focusModules);if(a)return a}let r;try{r=G(e).project?.language}catch{}let n=Di(e,r),i=ut(e).language==="kotlin"?sP.find(a=>TP(Av(e,a)))??FK(e):n.coverageSummary,o=Av(e,i);if(!TP(o))return[{detector:vo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=e8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?PTe(a):n.coverageFormat==="cobertura-xml"?CTe(a):ITe(a)}catch(a){return[{detector:vo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:vo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Tv?[]:[{detector:vo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Tv}%`}]}var vo,Tv,n8,i8=y(()=>{"use strict";qe();mv();La();dv();on();vo="COVERAGE_DROP",Tv=70;n8={name:vo,run:NTe}});import{existsSync as jTe}from"node:fs";import{join as MTe}from"node:path";function FTe(t){let{cwd:e="."}=t;return he(e,Ov,r=>LTe(r,e))}function LTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?jTe(MTe(e,r.path))?[]:[{detector:Ov,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:Ov,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var Ov,o8,s8=y(()=>{"use strict";vt();Ov="DELIVERABLE_INTEGRITY";o8={name:Ov,run:FTe}});function zTe(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:Rv,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 UTe(t){let e=zTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Rv,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 qTe(t){let{cwd:e="."}=t;return he(e,Rv,r=>UTe(r))}var Rv,a8,c8=y(()=>{"use strict";vt();Rv="SMOKE_PROBE_DEMAND";a8={name:Rv,run:qTe}});function BTe(t){let{cwd:e="."}=t;return he(e,Iv,r=>HTe(r,e))}function HTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=is(e);if(n===null)return[{detector:Iv,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=O_(n,e,o);s.state!=="fresh"&&i.push({detector:Iv,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 Iv,Pv,OP=y(()=>{"use strict";ll();vt();Iv="STALE_ATTESTATION";Pv={name:Iv,run:BTe}});function GTe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}return ZTe(r)}function ZTe(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:l8,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 l8,Cv,RP=y(()=>{"use strict";qe();l8="DEPENDENCY_CYCLE";Cv={name:l8,run:GTe}});import{appendFileSync as VTe,existsSync as u8,mkdirSync as WTe,readFileSync as KTe}from"node:fs";import{dirname as JTe,join as YTe}from"node:path";function d8(t){return YTe(t,XTe,QTe)}function f8(t){return IP.add(t),()=>IP.delete(t)}function qa(t,e){let r=d8(t),n=JTe(r);u8(n)||WTe(n,{recursive:!0}),VTe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of IP)try{i(t,e)}catch{}}function On(t){let e=d8(t);if(!u8(e))return[];let r=KTe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var XTe,QTe,IP,ti=y(()=>{"use strict";XTe=".cladding",QTe="audit.log.jsonl";IP=new Set});import{existsSync as eOe}from"node:fs";import{join as tOe}from"node:path";function rOe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:PP,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&&(eOe(tOe(e,i.artifact))||n.push({detector:PP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var PP,p8,m8=y(()=>{"use strict";ti();PP="EVIDENCE_MISMATCH";p8={name:PP,run:rOe}});import{existsSync as nOe,readFileSync as iOe}from"node:fs";import{join as oOe}from"node:path";function sOe(t){let e=oOe(t,_8);if(!nOe(e))return null;try{let n=((0,y8.parse)(iOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*g8(t,e){for(let r of t??[])r.startsWith(h8)&&(yield{ref:r,name:r.slice(h8.length),field:e})}function aOe(t){let{cwd:e="."}=t,r=sOe(e);if(r===null)return[];let n;try{n=G(e)}catch(o){return[{detector:CP,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=[...g8(s.evidence_refs,"evidence_refs"),...g8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:CP,severity:"warn",path:_8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var y8,CP,h8,_8,b8,v8=y(()=>{"use strict";y8=bt(Qt(),1);qe();CP="FIXTURE_REFERENCE_INVALID",h8="fixture:",_8="conformance/fixtures.yaml";b8={name:CP,run:aOe}});import{existsSync as Dl,readFileSync as DP}from"node:fs";import{join as Ba}from"node:path";function cOe(t){return ps(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function fp(t){if(!Dl(t))return null;try{return JSON.parse(DP(t,"utf8"))}catch{return null}}function lOe(t,e){let r=Ba(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(DP(r,"utf8"))}catch(c){e.push({detector:So,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:So,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=cOe(t);s!==a&&e.push({detector:So,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function uOe(t,e){for(let r of S8){let n=Ba(t,r.path);if(!Dl(n))continue;let i=fp(n);if(!i){e.push({detector:So,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:So,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function dOe(t,e){let r=fp(Ba(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of S8){let s=Ba(t,o.path);if(!Dl(s))continue;let a=fp(s);a?.version&&a.version!==n&&e.push({detector:So,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ba(t,".claude-plugin","marketplace.json");if(Dl(i)){let o=fp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:So,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 fOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function pOe(t,e){let r=Ba(t,"src","cli","clad.ts"),n=Ba(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Dl(r)||!Dl(n))return;let i=fOe(DP(r,"utf8"));if(i.length===0)return;let s=fp(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:So,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 mOe(t){let{cwd:e="."}=t,r=[];return lOe(e,r),pOe(e,r),uOe(e,r),dOe(e,r),r}var So,S8,w8,x8=y(()=>{"use strict";lp();So="HARNESS_INTEGRITY",S8=[{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"]}];w8={name:So,run:mOe}});import{existsSync as hOe,readFileSync as gOe}from"node:fs";import{join as yOe}from"node:path";function bOe(t){let{cwd:e="."}=t;return he(e,Dv,r=>SOe(r,e))}function vOe(t){let e=yOe(t,"spec/capabilities.yaml");if(!hOe(e))return!1;try{let r=$8.default.parse(gOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function SOe(t,e){let r=t.features.length;if(r<_Oe)return[];let n=[];return vOe(e)&&n.push({detector:Dv,severity:"warn",path:"spec/capabilities.yaml",message:`${r} features but spec/capabilities.yaml declares no capabilities (capabilities: []) \u2014 the design SSoT is an empty seed. Populate it (capability \u2194 feature links) or run \`clad init --scan\`.`}),t.architecture&&(t.architecture.layers??[]).length===0&&n.push({detector:Dv,severity:"warn",path:"spec/architecture.yaml",message:`${r} features but spec/architecture.yaml declares no layers (layers: []) \u2014 the architecture SSoT is an empty seed. Populate it or run \`clad init --scan\`.`}),n}var $8,Dv,_Oe,k8,E8=y(()=>{"use strict";$8=bt(Qt(),1);vt();Dv="HOLLOW_GOVERNANCE",_Oe=8;k8={name:Dv,run:bOe}});import{existsSync as A8,readFileSync as T8}from"node:fs";import{join as O8}from"node:path";function R8(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 $Oe(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 kOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function EOe(t){let e=O8(t,"README.md"),r=O8(t,"docs","dogfood","matrix.md");if(!A8(e)||!A8(r))return[];let n=R8(T8(e,"utf8"),wOe),i=R8(T8(r,"utf8"),xOe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=kOe(a);if(c===null)continue;let l=i[s]??"not-run",u=$Oe(l);u!==null&&c>u&&o.push({detector:I8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function AOe(t){let{cwd:e="."}=t;return EOe(e)}var I8,wOe,xOe,P8,C8=y(()=>{"use strict";I8="HOST_CLAIM_DRIFT",wOe=//,xOe=//;P8={name:I8,run:AOe}});function TOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return D8(r.features.map(i=>i.id),"feature","spec/features/",n),D8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function D8(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:N8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var N8,j8,M8=y(()=>{"use strict";qe();N8="ID_COLLISION";j8={name:N8,run:TOe}});import{existsSync as pp,readFileSync as NP,readdirSync as jP,statSync as OOe,writeFileSync as L8}from"node:fs";import{join as wo}from"node:path";function F8(t){if(!pp(t))return 0;try{return jP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function ROe(t){if(!pp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=jP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=wo(n,o),a;try{a=OOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function IOe(t){let e=wo(t,"spec","capabilities.yaml");if(!pp(e))return 0;try{let r=Nv.default.parse(NP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ms(t="."){let e=F8(wo(t,"spec","features")),r=F8(wo(t,"spec","scenarios")),n=IOe(t),i=ROe(wo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Nl(t,e){let r=wo(t,"spec.yaml");if(!pp(r))return;let n=NP(r,"utf8"),i=POe(n,e);i!==n&&L8(r,i)}function POe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as gxe}from"node:buffer";import{StringDecoder as yxe}from"node:string_decoder";var zb,_xe,bxe,vxe,iI=y(()=>{rn();zb=(t,e,r)=>{if(r)return;if(t)return{transform:_xe.bind(void 0,new TextEncoder)};let n=new yxe(e);return{transform:bxe.bind(void 0,n),final:vxe.bind(void 0,n)}},_xe=function*(t,e){gxe.isBuffer(e)?yield po(e):typeof e=="string"?yield t.encode(e):yield e},bxe=function*(t,e){yield zt(e)?t.write(e):e},vxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as IW}from"node:util";var oI,Ub,PW,Sxe,CW,wxe,DW=y(()=>{oI=IW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Ub=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=wxe}=e[r];for await(let i of n(t))yield*Ub(i,e,r+1)},PW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Sxe(r,Number(e),t)},Sxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Ub(n,r,e+1)},CW=IW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),wxe=function*(t){yield t}});var sI,NW,Da,Yf,xxe,$xe,aI=y(()=>{sI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},NW=(t,e)=>[...e.flatMap(r=>[...Da(r,t,0)]),...Yf(t)],Da=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=$xe}=e[r];for(let i of n(t))yield*Da(i,e,r+1)},Yf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*xxe(r,Number(e),t)},xxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Da(n,r,e+1)},$xe=function*(t){yield t}});import{Transform as kxe,getDefaultHighWaterMark as jW}from"node:stream";var cI,qb,MW,Bb=y(()=>{vr();Lb();RW();iI();DW();aI();cI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=MW(t,s,o),l=Ca(e),u=Ca(r),d=l?oI.bind(void 0,Ub,a):sI.bind(void 0,Da),f=l||u?oI.bind(void 0,PW,a):sI.bind(void 0,Yf),p=l||u?CW.bind(void 0,a):void 0;return{stream:new kxe({writableObjectMode:n,writableHighWaterMark:jW(n),readableObjectMode:i,readableHighWaterMark:jW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},qb=(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=MW(s,r,a);t=NW(c,t)}return t},MW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:AW(n,a)},zb(r,s,n),Fb(r,o,n,c),{transform:t,final:e},{transform:OW(i,a)},EW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var FW,Exe,Axe,Oxe,Txe,LW=y(()=>{Bb();rn();vr();FW=(t,e)=>{for(let r of Exe(t))Axe(t,r,e)},Exe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Axe=(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 ${us[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Oxe(a,n));r.input=Nf(s)},Oxe=(t,e)=>{let r=qb(t,e,"utf8",!0);return Txe(r),Nf(r)},Txe=t=>{let e=t.find(r=>typeof r!="string"&&!zt(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 Hb,Rxe,Ixe,zW,UW,Pxe,qW,lI=y(()=>{Ta();vr();gl();ss();Hb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&hl(r,n)&&!nn.has(e)&&Rxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Ixe.has(o))||t.every(({type:i})=>An.has(i))),Rxe=t=>t===1||t===2,Ixe=new Set(["pipe","overlapped"]),zW=async(t,e,r,n)=>{for await(let i of t)Pxe(e)||qW(i,r,n)},UW=(t,e,r)=>{for(let n of t)qW(n,e,r)},Pxe=t=>t._readableState.pipes.length>0,qW=(t,e,r)=>{let n=B_(t);Oi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Cxe,appendFileSync as Dxe}from"node:fs";var BW,Nxe,jxe,Mxe,Fxe,Lxe,HW=y(()=>{lI();Bb();Lb();rn();vr();Pa();BW=({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)=>Nxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Nxe=({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=OV(t,o,d),p=po(f),{stdioItems:m,objectMode:h}=e[r],g=jxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Mxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Fxe({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&&Lxe(b,m,i),S}catch(x){return n.error=x,S}},jxe=(t,e,r,n)=>{try{return qb(t,e,r,!1)}catch(i){return n.error=i,t}},Mxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Nf(t)};let s=_G(t,r);return n[o]?{serializedResult:s,finalResult:nI(s,!i[o],e)}:{serializedResult:s}},Fxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Hb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=nI(t,!1,s);try{UW(a,e,n)}catch(c){r.error??=c}},Lxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Nb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Dxe(n,t):(r.add(o),Cxe(n,t))}}});var GW,ZW=y(()=>{rn();Jf();GW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,_o(e,r,"all")]:Array.isArray(e)?[_o(t,r,"all"),...e]:zt(t)&&zt(e)?XT([t,e]):`${t}${e}`}});import{once as uI}from"node:events";var VW,zxe,WW,KW,Uxe,dI,fI=y(()=>{Aa();VW=async(t,e)=>{let[r,n]=await zxe(t);return e.isForcefullyTerminated??=!1,[r,n]},zxe=async t=>{let[e,r]=await Promise.allSettled([uI(t,"spawn"),uI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?WW(t):r.value},WW=async t=>{try{return await uI(t,"exit")}catch{return WW(t)}},KW=async t=>{let[e,r]=await t;if(!Uxe(e,r)&&dI(e,r))throw new Xn;return[e,r]},Uxe=(t,e)=>t===void 0&&e===void 0,dI=(t,e)=>t!==0||e!==null});var JW,qxe,YW=y(()=>{Aa();Pa();fI();JW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=qxe(t,e,r),s=o?.code==="ETIMEDOUT",a=AV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},qxe=(t,e,r)=>t!==void 0?t:dI(e,r)?new Xn:void 0});import{spawnSync as Bxe}from"node:child_process";var XW,Hxe,Gxe,Zxe,Gb,Vxe,Wxe,Kxe,Jxe,QW=y(()=>{aR();NR();jR();Kf();Pb();xW();Jf();LW();HW();Pa();ZW();YW();XW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Hxe(t,e,r),d=Vxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Al(d,c,l)},Hxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Z_(t,e,r),a=Gxe(r),{file:c,commandArguments:l,options:u}=bb(t,e,a);Zxe(u);let d=SW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Gxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Zxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Gb("ipcInput"),t&&Gb("ipc: true"),r&&Gb("detached: true"),n&&Gb("cancelSignal")},Gb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Vxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Wxe({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}=JW(c,r),{output:m,error:h=l}=BW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>_o(_,r,S)),b=_o(GW(m,r),r,"all");return Jxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Wxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{FW(o,r);let a=Kxe(r);return Bxe(...vb(t,e,a))}catch(a){return El({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},Kxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Rb(e)}),Jxe=({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?Ib({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Wf({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 pI,on as Yxe}from"node:events";var e3,Xxe,Qxe,e0e,t0e,t3=y(()=>{Sl();Bf();qf();e3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(bl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:fb(t)}),Xxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Xxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ob(e,i);let o=ls(t,e,r),s=new AbortController;try{return await Promise.race([Qxe(o,n,s),e0e(o,r,s),t0e(o,r,s)])}catch(a){throw vl(t),a}finally{s.abort(),sb(e,i)}},Qxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await pI(t,"message",{signal:r});return n}for await(let[n]of Yxe(t,"message",{signal:r}))if(e(n))return n},e0e=async(t,e,{signal:r})=>{await pI(t,"disconnect",{signal:r}),f9(e)},t0e=async(t,e,{signal:r})=>{let[n]=await pI(t,"strict:error",{signal:r});throw tb(n,e)}});import{once as n3,on as r0e}from"node:events";var i3,mI,n0e,i0e,o0e,r3,hI=y(()=>{Sl();Bf();qf();i3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>mI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),mI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{bl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:fb(t)}),ob(e,o);let s=ls(t,e,r),a=new AbortController,c={};return n0e(t,s,a),i0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),o0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},n0e=async(t,e,r)=>{try{await n3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},i0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await n3(t,"strict:error",{signal:r.signal});n.error=tb(i,e),r.abort()}catch{}},o0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of r0e(r,"message",{signal:o.signal}))r3(s),yield c}catch{r3(s)}finally{o.abort(),sb(e,a),n||vl(t),i&&await t}},r3=({error:t})=>{if(t)throw t}});import o3 from"node:process";var s3,a3,c3,gI=y(()=>{yb();t3();hI();ub();s3=(t,{ipc:e})=>{Object.assign(t,c3(t,!1,e))},a3=()=>{let t=o3,e=!0,r=o3.channel!==void 0;return{...c3(t,e,r),getCancelSignal:z9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},c3=(t,e,r)=>({sendMessage:gb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:e3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:i3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as s0e}from"node:child_process";import{PassThrough as a0e,Readable as c0e,Writable as l0e,Duplex as u0e}from"node:stream";var l3,d0e,Xf,f0e,p0e,m0e,h0e,u3=y(()=>{Mb();Kf();Pb();l3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{eI(n);let a=new s0e;d0e(a,n),Object.assign(a,{readable:f0e,writable:p0e,duplex:m0e});let c=El({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=h0e(c,s,i);return{subprocess:a,promise:l}},d0e=(t,e)=>{let r=Xf(),n=Xf(),i=Xf(),o=Array.from({length:e.length-3},Xf),s=Xf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Xf=()=>{let t=new a0e;return t.end(),t},f0e=()=>new c0e({read(){}}),p0e=()=>new l0e({write(){}}),m0e=()=>new u0e({read(){},write(){}}),h0e=async(t,e,r)=>Al(t,e,r)});import{createReadStream as d3,createWriteStream as f3}from"node:fs";import{Buffer as g0e}from"node:buffer";import{Readable as Qf,Writable as y0e,Duplex as _0e}from"node:stream";var m3,ep,p3,b0e,h3=y(()=>{Bb();Mb();vr();m3=(t,e)=>jb(b0e,t,e,!1),ep=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${us[t]}.`)},p3={fileNumber:ep,generator:cI,asyncGenerator:cI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:_0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},b0e={input:{...p3,fileUrl:({value:t})=>({stream:d3(t)}),filePath:({value:{file:t}})=>({stream:d3(t)}),webStream:({value:t})=>({stream:Qf.fromWeb(t)}),iterable:({value:t})=>({stream:Qf.from(t)}),asyncIterable:({value:t})=>({stream:Qf.from(t)}),string:({value:t})=>({stream:Qf.from(t)}),uint8Array:({value:t})=>({stream:Qf.from(g0e.from(t))})},output:{...p3,fileUrl:({value:t})=>({stream:f3(t)}),filePath:({value:{file:t,append:e}})=>({stream:f3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:y0e.fromWeb(t)}),iterable:ep,asyncIterable:ep,string:ep,uint8Array:ep}}});import{on as v0e,once as g3}from"node:events";import{PassThrough as S0e,getDefaultHighWaterMark as w0e}from"node:stream";import{finished as b3}from"node:stream/promises";function Na(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)_I(i);let e=t.some(({readableObjectMode:i})=>i),r=x0e(t,e),n=new yI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var x0e,yI,$0e,k0e,E0e,_I,A0e,O0e,T0e,R0e,I0e,v3,S3,bI,w3,P0e,Zb,y3,_3,Vb=y(()=>{x0e=(t,e)=>{if(t.length===0)return w0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},yI=class extends S0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(_I(e),this.#t.has(e))return;this.#t.add(e),this.#n??=$0e(this,this.#t,this.#o);let r=A0e({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(_I(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)}},$0e=async(t,e,r)=>{Zb(t,y3);let n=new AbortController;try{await Promise.race([k0e(t,n),E0e(t,e,r,n)])}finally{n.abort(),Zb(t,-y3)}},k0e=async(t,{signal:e})=>{try{await b3(t,{signal:e,cleanup:!0})}catch(r){throw v3(t,r),r}},E0e=async(t,e,r,{signal:n})=>{for await(let[i]of v0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},_I=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},A0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Zb(t,_3);let a=new AbortController;try{await Promise.race([O0e(o,e,a),T0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),R0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Zb(t,-_3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?bI(t):I0e(t))},O0e=async(t,e,{signal:r})=>{try{await t,r.aborted||bI(e)}catch(n){r.aborted||v3(e,n)}},T0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await b3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;S3(s)?i.add(e):w3(t,s)}},R0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await g3(t,i,{signal:o}),!t.readable)return g3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},I0e=t=>{t.writable&&t.end()},v3=(t,e)=>{S3(e)?bI(t):w3(t,e)},S3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",bI=t=>{(t.readable||t.writable)&&t.destroy()},w3=(t,e)=>{t.destroyed||(t.once("error",P0e),t.destroy(e))},P0e=()=>{},Zb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},y3=2,_3=1});import{finished as x3}from"node:stream/promises";var Tl,C0e,vI,D0e,SI,Wb=y(()=>{mo();Tl=(t,e)=>{t.pipe(e),C0e(t,e),D0e(t,e)},C0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await x3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}vI(e)}},vI=t=>{t.writable&&t.end()},D0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await x3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}SI(t)}},SI=t=>{t.readable&&t.destroy()}});var $3,N0e,j0e,M0e,F0e,L0e,k3=y(()=>{Vb();mo();ib();vr();Wb();$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})=>An.has(c)))N0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.has(c)))M0e({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]:Na(o);Tl(s,i)}},N0e=(t,e,r,n)=>{r==="output"?Tl(t.stdio[n],e):Tl(e,t.stdio[n]);let i=j0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},j0e=["stdin","stdout","stderr"],M0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;F0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},F0e=(t,{signal:e})=>{Yn(t)&&Oa(t,L0e,e)},L0e=2});var ja,E3=y(()=>{ja=[];ja.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&ja.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&ja.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Kb,wI,xI,z0e,$I,Jb,U0e,kI,EI,AI,A3,Vot,Wot,O3=y(()=>{E3();Kb=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"),xI=globalThis,z0e=Object.defineProperty.bind(Object),$I=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(xI[wI])return xI[wI];z0e(xI,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}},Jb=class{},U0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),kI=class extends Jb{onExit(){return()=>{}}load(){}unload(){}},EI=class extends Jb{#t=AI.platform==="win32"?"SIGINT":"SIGHUP";#r=new $I;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of ja)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(!Kb(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 ja)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,ja.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 Kb(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"&&Kb(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)}},AI=globalThis.process,{onExit:A3,load:Vot,unload:Wot}=U0e(Kb(AI)?new EI(AI):new kI)});import{addAbortListener as q0e}from"node:events";var T3,R3=y(()=>{O3();T3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=A3(()=>{t.kill()});q0e(n,()=>{i()})}});var P3,B0e,H0e,I3,G0e,C3=y(()=>{YT();G_();cs();pl();P3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=H_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=B0e(r,n,i),{sourceStream:d,sourceError:f}=G0e(t,l),{options:p,fileDescriptors:m}=Ri.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},B0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=H0e(t,e,...r),a=nb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},H0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(I3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||KT(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]=C_(r,...n);return{destination:e(I3)(i,o,s),pipeOptions:s}}if(Ri.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}`)},I3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),G0e=(t,e)=>{try{return{sourceStream:xl(t,e)}}catch(r){return{sourceError:r}}}});var N3,Z0e,OI,D3,TI=y(()=>{Kf();Wb();N3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=Z0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw OI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},Z0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return SI(t),n;if(e!==void 0)return vI(r),e},OI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>El({error:t,command:D3,escapedCommand:D3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),D3="source.pipe(destination)"});var j3,M3=y(()=>{j3=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 V0e}from"node:stream/promises";var F3,W0e,K0e,J0e,Yb,Y0e,X0e,L3=y(()=>{Vb();ib();Wb();F3=(t,e,r)=>{let n=Yb.has(e)?K0e(t,e):W0e(t,e);return Oa(t,Y0e,r.signal),Oa(e,X0e,r.signal),J0e(e),n},W0e=(t,e)=>{let r=Na([t]);return Tl(r,e),Yb.set(e,r),r},K0e=(t,e)=>{let r=Yb.get(e);return r.add(t),r},J0e=async t=>{try{await V0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Yb.delete(t)},Yb=new WeakMap,Y0e=2,X0e=1});import{aborted as Q0e}from"node:util";var z3,e$e,U3=y(()=>{TI();z3=(t,e)=>t===void 0?[]:[e$e(t,e)],e$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Q0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw OI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var Xb,t$e,r$e,q3=y(()=>{fo();C3();TI();M3();L3();U3();Xb=(t,...e)=>{if(Ot(e[0]))return Xb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=P3(t,...e),i=t$e({...n,destination:r});return i.pipe=Xb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},t$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=r$e(t,i);N3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=F3(e,o,d);return await Promise.race([j3(u),...z3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},r$e=(t,e)=>Promise.allSettled([t,e])});import{on as n$e}from"node:events";import{getDefaultHighWaterMark as i$e}from"node:stream";var Qb,o$e,RI,s$e,H3,II,B3,a$e,c$e,ev=y(()=>{iI();Lb();aI();Qb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return o$e(e,s),H3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},o$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},RI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;s$e(e,s,t);let a=t.readableObjectMode&&!o;return H3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},s$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},H3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=n$e(t,"data",{signal:e.signal,highWaterMark:B3,highWatermark:B3});return a$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},II=i$e(!0),B3=II,a$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=c$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Da(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Yf(a)}},c$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[zb(t,r,!e),Fb(t,i,!n,{})].filter(Boolean)});import{setImmediate as l$e}from"node:timers/promises";var G3,u$e,d$e,f$e,PI,Z3,CI=y(()=>{Tb();rn();lI();ev();Pa();Jf();G3=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=u$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([d$e(t),d]);return}let f=tI(c,r),p=RI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([f$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},u$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Hb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=RI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await zW(a,t,r,o)},d$e=async t=>{await l$e(),t.readableFlowing===null&&t.resume()},f$e=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 Eb(r,{maxBuffer:o})):await Ob(r,{maxBuffer:o})}catch(a){return Z3($V({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},PI=async t=>{try{return await t}catch(e){return Z3(e)}},Z3=({bufferedData:t})=>gG(t)?new Uint8Array(t):t});import{finished as p$e}from"node:stream/promises";var tp,m$e,h$e,g$e,y$e,_$e,DI,tv,V3,rv=y(()=>{tp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=m$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],p$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||y$e(a,e,r,n)}finally{s.abort()}},m$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&h$e(t,r,n),n},h$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{g$e(e,r),n.call(t,...i)}},g$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},y$e=(t,e,r,n)=>{if(!_$e(t,e,r,n))throw t},_$e=(t,e,r,n=!0)=>r.propagating?V3(t)||tv(t):(r.propagating=!0,DI(r,e)===n?V3(t):tv(t)),DI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",tv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",V3=t=>t?.code==="EPIPE"});var W3,NI,jI=y(()=>{CI();rv();W3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>NI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),NI=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=tp(t,e,l);if(DI(l,e)){await u;return}let[d]=await Promise.all([G3({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 K3,J3,b$e,v$e,MI=y(()=>{Vb();jI();K3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Na([t,e].filter(Boolean)):void 0,J3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>NI({...b$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:v$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),b$e=({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}},v$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var Y3,X3,Q3=y(()=>{gl();ss();Y3=t=>hl(t,"ipc"),X3=(t,e)=>{let r=B_(t);Oi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var eK,tK,rK=y(()=>{Pa();Q3();go();hI();eK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Y3(o),a=ho(e,"ipc"),c=ho(r,"ipc");for await(let l of mI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(kV(t,i,c),i.push(l)),s&&X3(l,o);return i},tK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as S$e}from"node:events";var nK,w$e,x$e,$$e,iK=y(()=>{Ia();RR();SR();TR();mo();vr();CI();rK();PR();MI();jI();fI();rv();nK=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 _=VW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=W3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=J3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),T=[],O=eK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:T,verboseInfo:p}),A=w$e(h,t,S),D=x$e(m,S);try{return await Promise.race([Promise.all([{},KW(_),Promise.all(x),w,O,J9(t,d),...A,...D]),g,$$e(t,b),...G9(t,o,f,b),...d9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...B9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(se=>PI(se))),PI(w),tK(O,T),Promise.allSettled(A),Promise.allSettled(D)])}},w$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:tp(n,i,r)),x$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>tp(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),$$e=async(t,{signal:e})=>{let[r]=await S$e(t,"error",{signal:e});throw r}});var oK,rp,Rl,nv=y(()=>{wl();oK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),rp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ti();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Rl=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 sK}from"node:stream/promises";var FI,aK,LI,zI,iv,ov,UI=y(()=>{rv();FI=async t=>{if(t!==void 0)try{await LI(t)}catch{}},aK=async t=>{if(t!==void 0)try{await zI(t)}catch{}},LI=async t=>{await sK(t,{cleanup:!0,readable:!1,writable:!0})},zI=async t=>{await sK(t,{cleanup:!0,readable:!0,writable:!1})},iv=async(t,e)=>{if(await t,e)throw e},ov=(t,e,r)=>{r&&!tv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as k$e}from"node:stream";import{callbackify as E$e}from"node:util";var cK,qI,BI,HI,A$e,GI,ZI,lK,VI=y(()=>{Ta();cs();ev();wl();nv();UI();cK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=qI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=BI(a,s),{read:f,onStdoutDataDone:p}=HI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new k$e({read:f,destroy:E$e(ZI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return GI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},qI=(t,e,r)=>{let n=xl(t,e),i=rp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},BI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:II},HI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ti(),s=Qb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){A$e(this,s,o)},onStdoutDataDone:o}},A$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},GI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await zI(t),await n,await FI(i),await e,r.readable&&r.push(null)}catch(o){await FI(i),lK(r,o)}},ZI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Rl(r,e)&&(lK(t,n),await iv(e,n))},lK=(t,e)=>{ov(t,t.readable,e)}});import{Writable as O$e}from"node:stream";import{callbackify as uK}from"node:util";var dK,WI,KI,T$e,R$e,JI,YI,fK,XI=y(()=>{cs();nv();UI();dK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=WI(t,r,e),s=new O$e({...KI(n,t,i),destroy:uK(YI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return JI(n,s),s},WI=(t,e,r)=>{let n=nb(t,e),i=rp(r,n,"writableFinal"),o=rp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},KI=(t,e,r)=>({write:T$e.bind(void 0,t),final:uK(R$e.bind(void 0,t,e,r))}),T$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},R$e=async(t,e,r)=>{await Rl(r,e)&&(t.writable&&t.end(),await e)},JI=async(t,e,r)=>{try{await LI(t),e.writable&&e.end()}catch(n){await aK(r),fK(e,n)}},YI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Rl(r,e),await Rl(n,e)&&(fK(t,i),await iv(e,i))},fK=(t,e)=>{ov(t,t.writable,e)}});import{Duplex as I$e}from"node:stream";import{callbackify as P$e}from"node:util";var pK,C$e,mK=y(()=>{Ta();VI();XI();pK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=qI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=WI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=BI(c,a),{read:g,onStdoutDataDone:b}=HI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new I$e({read:g,...KI(u,t,d),destroy:P$e(C$e.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 GI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),JI(u,_,c),_},C$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([ZI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),YI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var QI,D$e,hK=y(()=>{Ta();cs();ev();QI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=xl(t,r),a=Qb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return D$e(a,s,t)},D$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var gK,yK=y(()=>{nv();VI();XI();mK();hK();gK=(t,{encoding:e})=>{let r=oK();t.readable=cK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=dK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=pK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=QI.bind(void 0,t,e),t[Symbol.asyncIterator]=QI.bind(void 0,t,e,{})}});var _K,N$e,j$e,bK=y(()=>{_K=(t,e)=>{for(let[r,n]of j$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},N$e=(async()=>{})().constructor.prototype,j$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(N$e,t)])});import{setMaxListeners as M$e}from"node:events";import{spawn as F$e}from"node:child_process";var vK,L$e,z$e,U$e,q$e,B$e,SK=y(()=>{Tb();aR();NR();cs();jR();gI();Kf();Pb();u3();h3();Jf();k3();Q_();R3();q3();MI();iK();yK();wl();bK();vK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=L$e(t,e,r),{subprocess:f,promise:p}=U$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Xb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),_K(f,p),Ri.set(f,{options:u,fileDescriptors:d}),f},L$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Z_(t,e,r),{file:a,commandArguments:c,options:l}=bb(t,e,r),u=z$e(l),d=m3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},z$e=({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}},U$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=F$e(...vb(t,e,r))}catch(m){return l3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;M$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];$3(c,a,l),T3(c,r,l);let d={},f=Ti();c.kill=l9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=K3(c,r),gK(c,r),s3(c,r);let p=q$e({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}},q$e=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 nK({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)=>_o(x,e,w)),_=_o(h,e,"all"),S=B$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Al(S,n,e)},B$e=({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?Wf({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 Ii,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Ib({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var sv,H$e,G$e,wK=y(()=>{fo();go();sv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,H$e(n,t[n],i)]));return{...t,...r}},H$e=(t,e,r)=>G$e.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,G$e=new Set(["env",...rR])});var ds,Z$e,V$e,xK=y(()=>{fo();YT();$G();QW();SK();wK();ds=(t,e,r,n)=>{let i=(s,a,c)=>ds(s,a,r,c),o=(...s)=>Z$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Z$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,sv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=V$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?XW(a,c,l):vK(a,c,l,i)},V$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=wG(e)?xG(e,r):[e,...r],[s,a,c]=C_(...o),l=sv(sv(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 $K,kK,EK,W$e,K$e,AK=y(()=>{$K=({file:t,commandArguments:e})=>EK(t,e),kK=({file:t,commandArguments:e})=>({...EK(t,e),isSync:!0}),EK=(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]=W$e(t);return{file:r,commandArguments:n}},W$e=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(K$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},K$e=/ +/g});var OK,TK,J$e,RK,Y$e,IK,PK=y(()=>{OK=(t,e,r)=>{t.sync=e(J$e,r),t.s=t.sync},TK=({options:t})=>RK(t),J$e=({options:t})=>({...RK(t),isSync:!0}),RK=t=>({options:{...Y$e(t),...t}}),Y$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},IK={preferLocal:!0}});var Mct,Je,Fct,Lct,zct,Uct,qct,Bct,Hct,Gct,Mr=y(()=>{xK();AK();IR();PK();gI();Mct=ds(()=>({})),Je=ds(()=>({isSync:!0})),Fct=ds($K),Lct=ds(kK),zct=ds(V9),Uct=ds(TK,{},IK,OK),{sendMessage:qct,getOneMessage:Bct,getEachMessage:Hct,getCancelSignal:Gct}=a3()});import{existsSync as av,statSync as X$e}from"node:fs";import{dirname as eP,extname as Q$e,isAbsolute as CK,join as tP,relative as rP,resolve as cv,sep as eke}from"node:path";function lv(t){return t==="./gradlew"||t==="gradle"}function tke(t){return(av(tP(t,"build.gradle.kts"))||av(tP(t,"build.gradle")))&&av(tP(t,"gradle.properties"))}function rke(t,e){let n=rP(t,e).split(eke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function fs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function nke(t,e){let r=cv(t,e),n=r;av(r)?X$e(r).isFile()&&(n=eP(r)):Q$e(r)!==""&&(n=eP(r));let i=rP(t,n);if(i.startsWith("..")||CK(i))return null;let o=n;for(;;){if(tke(o))return o;if(cv(o)===cv(t))return null;let s=eP(o);if(s===o)return null;let a=rP(t,s);if(a.startsWith("..")||CK(a))return null;o=s}}function uv(t,e){let r=cv(t),n=new Map,i=[];for(let o of e){let s=nke(r,o);if(!s){i.push(o);continue}let a=rke(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 ike,readFileSync as oke}from"node:fs";import{join as ske}from"node:path";function Il(t="."){let e=ske(t,".cladding","config.yaml");if(!ike(e))return nP;try{let n=(0,DK.parse)(oke(e,"utf8"))?.gate;if(!n)return nP;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 ake){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 nP}}function NK(t,e){let r=[],n=!1;for(let i of t){let o=cke.exec(i);if(o){n=!0;for(let s of e)r.push(fs(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 DK,ake,nP,cke,fv=y(()=>{"use strict";DK=vt(Qt(),1);dv();ake=["type","lint","test","coverage"],nP={scope:"feature"};cke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as oP,readFileSync as jK,readdirSync as lke,statSync as uke}from"node:fs";import{join as pv}from"node:path";function cP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=pv(t,e);if(oP(r))try{if(MK.test(jK(r,"utf8")))return!0}catch{}}return!1}function FK(t){try{return oP(t)&&MK.test(jK(t,"utf8"))}catch{return!1}}function LK(t,e=0){if(e>4||!oP(t))return!1;let r;try{r=lke(t)}catch{return!1}for(let n of r){let i=pv(t,n),o=!1;try{o=uke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(LK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&FK(i))return!0}return!1}function pke(t){if(cP(t))return!0;for(let e of dke)if(FK(pv(t,e)))return!0;for(let e of fke)if(LK(pv(t,e)))return!0;return!1}function zK(t="."){let e=Il(t).coverage;return e||(pke(t)?"kover":"jacoco")}function UK(t="."){return sP[zK(t)]}function qK(t="."){return iP[zK(t)]}var sP,iP,aP,MK,dke,fke,mv=y(()=>{"use strict";fv();sP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},iP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},aP=[iP.kover,iP.jacoco],MK=/kover/i;dke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],fke=["buildSrc","build-logic"]});import{existsSync as hv,readFileSync as BK,readdirSync as HK}from"node:fs";import{join as Ma}from"node:path";function lP(t){return hv(Ma(t,"gradlew"))?"./gradlew":"gradle"}function mke(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:[UK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function hke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(BK(Ma(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 yke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function vke(t,e){for(let r of e)if(hv(Ma(t,r)))return r}function Ske(t,e){try{return HK(t).find(n=>n.endsWith(e))}catch{return}}function xke(t,e){for(let r of wke)if(r.configs.some(n=>hv(Ma(t,n))))return r.gate;return e}function kke(t){if($ke.some(e=>hv(Ma(t,e))))return!0;try{return JSON.parse(BK(Ma(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function Eke(t,e){let r=e.lint?{...e,lint:xke(t,e.lint)}:{...e};return e.test&&e.coverage&&kke(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function dt(t="."){for(let e of _ke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Ske(t,o):r=vke(t,[o]),r)break;if(!r||e.requiresSource&&!yke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Eke(t,n):n;return{language:e.language,manifest:r,gates:i}}return bke}var gke,_ke,bke,wke,$ke,on=y(()=>{"use strict";mv();gke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);_ke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:mke},{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:hke}],bke={language:"unknown",manifest:"",gates:{}};wke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];$ke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Ake,readFileSync as Oke}from"node:fs";import{join as Tke}from"node:path";function Fa(t){return t.code==="ENOENT"}function gv(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=(o||s||`exit ${i}`).slice(0,200);return GK.test(o)||GK.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Ut(t,e,r){return Fa(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Pl(t,e){let r=Tke(t,"package.json");if(!Ake(r))return!1;try{return!!JSON.parse(Oke(r,"utf8")).scripts?.[e]}catch{return!1}}var GK,On=y(()=>{"use strict";GK=/config (is |file )?not found|no such file|ENOENT|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 Rke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:yv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Fa(i)?[{detector:yv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:gv(i,yv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var yv,La,_v=y(()=>{"use strict";Mr();on();On();yv="ARCHITECTURE_VIOLATION";La={name:yv,subprocess:!0,run:Rke}});function Ike(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:bv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Fa(i)?[{detector:bv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:gv(i,bv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var bv,za,vv=y(()=>{"use strict";Mr();on();On();bv="HARDCODED_SECRET";za={name:bv,subprocess:!0,run:Ike}});import{existsSync as uP,readdirSync as ZK}from"node:fs";import{join as Sv}from"node:path";function Cke(t,e){let r=Sv(t,e.path);if(!uP(r))return!0;if(e.isDirectory)try{return ZK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Dke(t){let{cwd:e="."}=t,r=[];for(let i of Pke)Cke(e,i)&&r.push({detector:np,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=Sv(e,"spec.yaml");if(uP(n)){let i=Mke(n),o=i?null:Nke(e);if(i)r.push({detector:np,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:np,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=jke(e);s&&r.push({detector:np,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 Nke(t){for(let e of["spec/features","spec/scenarios"]){let r=Sv(t,e);if(!uP(r))continue;let n;try{n=ZK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ki(Sv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function jke(t){try{return H(t),null}catch(e){return e.message}}function Mke(t){let e;try{e=ki(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var np,Pke,VK,WK=y(()=>{"use strict";qe();x_();np="ABSENCE_OF_GOVERNANCE",Pke=[{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}];VK={name:np,run:Dke}});function wv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function dP(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=wv(r)==="while",o=Lke.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 '${wv(r)}'`}let n=Fke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:wv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${wv(r)}'`:null}function zke(t,e){let r=dP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function KK(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...zke(r,n));return e}var Fke,Lke,fP=y(()=>{"use strict";Fke={event:"when",state:"while",optional:"where",unwanted:"if"},Lke=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var St=y(()=>{"use strict";qe()});function Uke(t){let{cwd:e="."}=t;return he(e,xv,qke)}function qke(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:xv,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 KK(t.features))e.push({detector:xv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var xv,JK,YK=y(()=>{"use strict";fP();St();xv="AC_DRIFT";JK={name:xv,run:Uke}});function Ci(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return QK[n]??XK}var Bke,Hke,Gke,XK,Zke,Vke,QK,Wke,eJ,Ua=y(()=>{"use strict";on();Bke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,Hke=/^[ \t]*import\s+([\w.]+)/gm,Gke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,XK={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:Bke,importStyle:"relative"},Zke={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:Hke,importStyle:"dotted"},Vke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:Gke,importStyle:"dotted"},QK={typescript:XK,kotlin:Zke,python:Vke},Wke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],eJ=new Set([...Object.values(QK).flatMap(t=>t?.extensions??[]),...Wke].map(t=>t.toLowerCase()))});import{existsSync as Kke,readFileSync as Jke,readdirSync as Yke,statSync as Xke}from"node:fs";import{join as rJ,relative as tJ}from"node:path";function Qke(t,e){if(!Kke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=Yke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=rJ(i,s),c;try{c=Xke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function eEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function rEe(t){return tEe.test(t)}function nEe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Ci(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Qke(rJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=Jke(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";qe();Ua();nJ="AI_HINTS_FORBIDDEN_PATTERN";tEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;iJ={name:nJ,run:nEe}});function iEe(t){let{cwd:e="."}=t,r;try{r=H(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:sJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var sJ,aJ,cJ=y(()=>{"use strict";qe();sJ="AC_DUPLICATE_WITHIN_FEATURE";aJ={name:sJ,run:iEe}});import{createRequire as oEe}from"module";import{basename as sEe,dirname as mP,normalize as aEe,relative as cEe,resolve as lEe,sep as dJ}from"path";import*as uEe from"fs";function dEe(t){let e=aEe(t);return e.length>1&&e[e.length-1]===dJ&&(e=e.substring(0,e.length-1)),e}function fJ(t,e){return t.replace(fEe,e)}function mEe(t){return t==="/"||pEe.test(t)}function pP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=lEe(t)),(n||o)&&(t=dEe(t)),t===".")return"";let s=t[t.length-1]!==i;return fJ(s?t+i:t,i)}function pJ(t,e){return e+t}function hEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:fJ(cEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function gEe(t){return t}function yEe(t,e,r){return e+t+r}function _Ee(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?hEe(t,e):n?pJ:gEe}function bEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function vEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function $Ee(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?vEe(t):bEe(t):n&&n.length?wEe:SEe:xEe}function REe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?TEe:r&&r.length?n?kEe:EEe:n?AEe:OEe}function CEe(t){return t.group?PEe:IEe}function jEe(t){return t.group?DEe:NEe}function LEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?FEe:MEe}function mJ(t,e,r){if(r.options.useRealPaths)return zEe(e,r);let n=mP(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=mP(n)}return r.symlinks.set(t,e),i>1}function zEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function $v(t,e,r,n){e(t&&!n?t:null,r)}function KEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?UEe:GEe:n?e?qEe:WEe:i?e?HEe:VEe:e?BEe:ZEe}function XEe(t){return t?YEe:JEe}function rAe(t,e){return new Promise((r,n)=>{yJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function yJ(t,e,r){new gJ(t,e,r).start()}function nAe(t,e){return new gJ(t,e).start()}var lJ,fEe,pEe,SEe,wEe,xEe,kEe,EEe,AEe,OEe,TEe,IEe,PEe,DEe,NEe,MEe,FEe,UEe,qEe,BEe,HEe,GEe,ZEe,VEe,WEe,hJ,JEe,YEe,QEe,eAe,tAe,gJ,uJ,_J,bJ,vJ=y(()=>{lJ=oEe(import.meta.url);fEe=/[\\/]/g;pEe=/^[a-z]:[\\/]$/i;SEe=(t,e)=>{e.push(t||".")},wEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},xEe=()=>{};kEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},EEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},AEe=(t,e,r,n)=>{r.files++},OEe=(t,e)=>{e.push(t)},TEe=()=>{};IEe=t=>t,PEe=()=>[""].slice(0,0);DEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},NEe=()=>{};MEe=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()&&mJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},FEe=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()&&mJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};UEe=t=>t.counts,qEe=t=>t.groups,BEe=t=>t.paths,HEe=t=>t.paths.slice(0,t.options.maxFiles),GEe=(t,e,r)=>($v(e,r,t.counts,t.options.suppressErrors),null),ZEe=(t,e,r)=>($v(e,r,t.paths,t.options.suppressErrors),null),VEe=(t,e,r)=>($v(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),WEe=(t,e,r)=>($v(e,r,t.groups,t.options.suppressErrors),null);hJ={withFileTypes:!0},JEe=(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||".",hJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},YEe=(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||".",hJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};QEe=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))}},eAe=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}},tAe=class{aborted=!1;abort(){this.aborted=!0}},gJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=KEe(e,this.isSynchronous),this.root=pP(t,e),this.state={root:mEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new eAe,options:e,queue:new QEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new tAe,fs:e.fs||uEe},this.joinPath=_Ee(this.root,e),this.pushDirectory=$Ee(this.root,e),this.pushFile=REe(e),this.getArray=CEe(e),this.groupFiles=jEe(e),this.resolveSymlink=LEe(e,this.isSynchronous),this.walkDirectory=XEe(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(_=pP(_,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=sEe(_),x=pP(mP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};uJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return rAe(this.root,this.options)}withCallback(t){yJ(this.root,this.options,t)}sync(){return nAe(this.root,this.options)}},_J=null;try{lJ.resolve("picomatch"),_J=lJ("picomatch")}catch{}bJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:dJ,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 uJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new uJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||_J;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 ip=v((Wlt,kJ)=>{"use strict";var SJ="[^\\\\/]",iAe="(?=.)",wJ="[^/]",hP="(?:\\/|$)",xJ="(?:^|\\/)",gP=`\\.{1,2}${hP}`,oAe="(?!\\.)",sAe=`(?!${xJ}${gP})`,aAe=`(?!\\.{0,1}${hP})`,cAe=`(?!${gP})`,lAe="[^.\\/]",uAe=`${wJ}*?`,dAe="/",$J={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:iAe,QMARK:wJ,END_ANCHOR:hP,DOTS_SLASH:gP,NO_DOT:oAe,NO_DOTS:sAe,NO_DOT_SLASH:aAe,NO_DOTS_SLASH:cAe,QMARK_NO_DOT:lAe,STAR:uAe,START_ANCHOR:xJ,SEP:dAe},fAe={...$J,SLASH_LITERAL:"[\\\\/]",QMARK:SJ,STAR:`${SJ}*?`,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:"\\"},pAe={__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"};kJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:pAe,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?fAe:$J}}});var op=v(Fr=>{"use strict";var{REGEX_BACKSLASH:mAe,REGEX_REMOVE_BACKSLASH:hAe,REGEX_SPECIAL_CHARS:gAe,REGEX_SPECIAL_CHARS_GLOBAL:yAe}=ip();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>gAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(yAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(mAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(hAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var CJ=v((Jlt,PJ)=>{"use strict";var EJ=op(),{CHAR_ASTERISK:yP,CHAR_AT:_Ae,CHAR_BACKWARD_SLASH:sp,CHAR_COMMA:bAe,CHAR_DOT:_P,CHAR_EXCLAMATION_MARK:bP,CHAR_FORWARD_SLASH:IJ,CHAR_LEFT_CURLY_BRACE:vP,CHAR_LEFT_PARENTHESES:SP,CHAR_LEFT_SQUARE_BRACKET:vAe,CHAR_PLUS:SAe,CHAR_QUESTION_MARK:AJ,CHAR_RIGHT_CURLY_BRACE:wAe,CHAR_RIGHT_PARENTHESES:OJ,CHAR_RIGHT_SQUARE_BRACKET:xAe}=ip(),TJ=t=>t===IJ||t===sp,RJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},$Ae=(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,T=0,O,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,se=()=>c.charCodeAt(l+1),Y=()=>(O=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),Te&&m===!0&&d>0?(Te=c.slice(0,d),P=c.slice(d)):m===!0?(Te="",P=c):Te=c,Te&&Te!==""&&Te!=="/"&&Te!==c&&TJ(Te.charCodeAt(Te.length-1))&&(Te=Te.slice(0,-1)),r.unescape===!0&&(P&&(P=EJ.removeBackslashes(P)),Te&&_===!0&&(Te=EJ.removeBackslashes(Te)));let Ir={prefix:C,input:t,start:u,base:Te,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,TJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let oe;for(let Pe=0;Pe{"use strict";var ap=ip(),sn=op(),{MAX_LENGTH:kv,POSIX_REGEX_SOURCE:kAe,REGEX_NON_SPECIAL_CHARS:EAe,REGEX_SPECIAL_CHARS_BACKREF:AAe,REPLACEMENTS:DJ}=ap,OAe=(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=>sn.escapeRegex(i)).join("..")}return r},Cl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,NJ=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},TAe=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},jJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(TAe(e))return e.replace(/\\(.)/g,"$1")},RAe=t=>{let e=t.map(jJ).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}}}}},IAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=jJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},PAe=t=>{let e=0,r=t.trim(),n=wP(r);for(;n;)e++,r=n.body.trim(),n=wP(r);return e},CAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:ap.DEFAULT_MAX_EXTGLOB_RECURSION,n=NJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||RAe(n)))return{risky:!0};for(let i of n){let o=IAe(i);if(o)return{risky:!0,safeOutput:o};if(PAe(i)>r)return{risky:!0}}return{risky:!1}},xP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=DJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(kv,r.maxLength):kv,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,T=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,O=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?T(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={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=sn.removePrefix(t,$),i=t.length;let se=[],Y=[],Te=[],C=o,P,Ir=()=>$.index===i-1,oe=$.peek=(B=1)=>t[$.index+B],Pe=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(B="",mt=0)=>{$.consumed+=B,$.index+=mt},Yt=B=>{$.output+=B.output!=null?B.output:B.value,dr(B.value)},io=()=>{let B=1;for(;oe()==="!"&&(oe(2)!=="("||oe(3)==="?");)Pe(),$.start++,B++;return B%2===0?!1:($.negated=!0,$.start++,!0)},vi=B=>{$[B]++,Te.push(B)},Yr=B=>{$[B]--,Te.pop()},de=B=>{if(C.type==="globstar"){let mt=$.braces>0&&(B.type==="comma"||B.type==="brace"),q=B.extglob===!0||se.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!mt&&!q&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(se.length&&B.type!=="paren"&&(se[se.length-1].inner+=B.value),(B.value||B.output)&&Yt(B),C&&C.type==="text"&&B.type==="text"){C.output=(C.output||C.value)+B.value,C.value+=B.value;return}B.prev=C,s.push(B),C=B},oo=(B,mt)=>{let q={...l[mt],conditions:1,inner:""};q.prev=C,q.parens=$.parens,q.output=$.output,q.startIndex=$.index,q.tokensIndex=s.length;let Ae=(r.capture?"(":"")+q.open;vi("parens"),de({type:B,value:mt,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Ae}),se.push(q)},fde=B=>{let mt=t.slice(B.startIndex,$.index+1),q=t.slice(B.startIndex+2,$.index),Ae=CAe(q,r);if((B.type==="plus"||B.type==="star")&&Ae.risky){let ct=Ae.safeOutput?(B.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,Si=s[B.tokensIndex];Si.type="text",Si.value=mt,Si.output=ct||sn.escapeRegex(mt);for(let wi=B.tokensIndex+1;wi1&&B.inner.includes("/")&&(ct=T(r)),(ct!==D||Ir()||/^\)+$/.test(Kt()))&&(ut=B.close=`)$))${ct}`),B.inner.includes("*")&&(Ft=Kt())&&/^\.[^\\/.]+$/.test(Ft)){let Si=xP(Ft,{...e,fastpaths:!1}).output;ut=B.close=`)${Si})${ct})`}B.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,mt=t.replace(AAe,(q,Ae,ut,Ft,ct,Si)=>Ft==="\\"?(B=!0,q):Ft==="?"?Ae?Ae+Ft+(ct?_.repeat(ct.length):""):Si===0?A+(ct?_.repeat(ct.length):""):_.repeat(ut.length):Ft==="."?u.repeat(ut.length):Ft==="*"?Ae?Ae+Ft+(ct?D:""):D:Ae?q:`\\${q}`);return B===!0&&(r.unescape===!0?mt=mt.replace(/\\/g,""):mt=mt.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),mt===t&&r.contains===!0?($.output=t,$):($.output=sn.wrapOutput(mt,$,e),$)}for(;!Ir();){if(P=Pe(),P==="\0")continue;if(P==="\\"){let q=oe();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){P+="\\",de({type:"text",value:P});continue}let Ae=/^\\+/.exec(Kt()),ut=0;if(Ae&&Ae[0].length>2&&(ut=Ae[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Pe():P+=Pe(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let q=C.value.slice(1);if(q.includes("[")&&(C.posix=!0,q.includes(":"))){let Ae=C.value.lastIndexOf("["),ut=C.value.slice(0,Ae),Ft=C.value.slice(Ae+2),ct=kAe[Ft];if(ct){C.value=ut+ct,$.backtrack=!0,Pe(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&oe()!==":"||P==="-"&&oe()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Yt({value:P});continue}if($.quotes===1&&P!=='"'){P=sn.escapeRegex(P),C.value+=P,Yt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){vi("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Cl("opening","("));let q=se[se.length-1];if(q&&$.parens===q.parens+1){fde(se.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Yr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Cl("closing","]"));P=`\\${P}`}else vi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Cl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Yr("brackets");let q=C.value.slice(1);if(C.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(P=`/${P}`),C.value+=P,Yt({value:P}),r.literalBrackets===!1||sn.hasRegexChars(q))continue;let Ae=sn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Ae,C.value=Ae;continue}C.value=`(${a}${Ae}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){vi("braces");let q={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};Y.push(q),de(q);continue}if(P==="}"){let q=Y[Y.length-1];if(r.nobrace===!0||!q){de({type:"text",value:P,output:P});continue}let Ae=")";if(q.dots===!0){let ut=s.slice(),Ft=[];for(let ct=ut.length-1;ct>=0&&(s.pop(),ut[ct].type!=="brace");ct--)ut[ct].type!=="dots"&&Ft.unshift(ut[ct].value);Ae=OAe(Ft,r),$.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let ut=$.output.slice(0,q.outputIndex),Ft=$.tokens.slice(q.tokensIndex);q.value=q.output="\\{",P=Ae="\\}",$.output=ut;for(let ct of Ft)$.output+=ct.output||ct.value}de({type:"brace",value:P,output:Ae}),Yr("braces"),Y.pop();continue}if(P==="|"){se.length>0&&se[se.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let q=P,Ae=Y[Y.length-1];Ae&&Te[Te.length-1]==="braces"&&(Ae.comma=!0,q="|"),de({type:"comma",value:P,output:q});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let q=Y[Y.length-1];C.type="dots",C.output+=P,C.value+=P,q.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){oo("qmark",P);continue}if(C&&C.type==="paren"){let Ae=oe(),ut=P;(C.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&oe()==="("&&(oe(2)!=="?"||!/[!=<:]/.test(oe(3)))){oo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){io();continue}}if(P==="+"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){oo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let q=EAe.exec(Kt());q&&(P+=q[0],$.index+=q[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let B=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){oo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let q=C.prev,Ae=q.prev,ut=q.type==="slash"||q.type==="bos",Ft=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!ut||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let ct=$.braces>0&&(q.type==="comma"||q.type==="brace"),Si=se.length&&(q.type==="pipe"||q.type==="paren");if(!ut&&q.type!=="paren"&&!ct&&!Si){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let wi=t[$.index+4];if(wi&&wi!=="/")break;B=B.slice(3),dr("/**",3)}if(q.type==="bos"&&Ir()){C.type="globstar",C.value+=P,C.output=T(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!Ft&&Ir()){$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=T(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=q.output+C.output,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&B[0]==="/"){let wi=B[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=`${T(r)}${f}|${f}${wi})`,C.value+=P,$.output+=q.output+C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&B[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${T(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=T(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let mt={type:"star",value:P,output:D};if(r.bash===!0){mt.output=".*?",(C.type==="bos"||C.type==="slash")&&(mt.output=O+mt.output),de(mt);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){mt.output=P,de(mt);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=O,C.output+=O),oe()!=="*"&&($.output+=p,C.output+=p)),de(mt)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cl("closing","]"));$.output=sn.escapeLast($.output,"["),Yr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cl("closing",")"));$.output=sn.escapeLast($.output,"("),Yr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cl("closing","}"));$.output=sn.escapeLast($.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let B of $.tokens)$.output+=B.output!=null?B.output:B.value,B.suffix&&($.output+=B.suffix)}return $};xP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(kv,r.maxLength):kv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=DJ[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=O=>O.noglobstar===!0?_:`(${g}(?:(?!${p}${O.dot?c:o}).)*?)`,x=O=>{switch(O){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 A=/^(.*?)\.(\w+)$/.exec(O);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),T=x(w);return T&&r.strictSlashes!==!0&&(T+=`${s}?`),T};MJ.exports=xP});var UJ=v((Xlt,zJ)=>{"use strict";var DAe=CJ(),$P=FJ(),LJ=op(),NAe=ip(),jAe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=jAe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?LJ.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(LJ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):$P(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>DAe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=$P.fastpaths(t,e)),i.output||(i=$P(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=NAe;zJ.exports=Tt});var GJ=v((Qlt,HJ)=>{"use strict";var qJ=UJ(),MAe=op();function BJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:MAe.isWindows()}),qJ(t,e,r)}Object.assign(BJ,qJ);HJ.exports=BJ});import{readdir as FAe,readdirSync as LAe,realpath as zAe,realpathSync as UAe,stat as qAe,statSync as BAe}from"fs";import{isAbsolute as HAe,posix as qa,resolve as GAe}from"path";import{fileURLToPath as ZAe}from"url";function KAe(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]===".."&&WAe.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=>qa.relative(t,n)||".":n=>qa.relative(t,`${e}/${n}`)||"."}function XAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=qa.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function KJ(t){var e;let r=Dl.default.scan(t,QAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function oOe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Dl.default.scan(t);return r.isGlob||r.negated}function cp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function JJ(t){return typeof t=="string"?[t]:t??[]}function kP(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=HAe(s.replace(aOe,""))?qa.relative(a,s):qa.normalize(s);let c=(i=sOe.exec(s))===null||i===void 0?void 0:i[0],l=KJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?qa.join(o,...d):o}return s}function cOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(kP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(kP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(kP(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=cOe(t,e,n);t.debug&&cp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(VJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Dl.default)(i.match,f),m=(0,Dl.default)(i.ignore,f),h=KAe(i.match,f),g=ZJ(r,d,o),b=o?g:ZJ(r,d,!0),_=(w,T)=>{let O=b(T,!0);return O!=="."&&!h(O)||m(O)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new bJ({filters:[a?(w,T)=>{let O=g(w,T),A=p(O)&&!m(O);return A&&cp(`matched ${O}`),A}:(w,T)=>{let O=g(w,T);return p(O)&&!m(O)}],exclude:a?(w,T)=>{let O=_(w,T);return cp(`${O?"skipped":"crawling"} ${T}`),O}:_,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&&cp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&XAe(r,d)]}function uOe(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={...dOe,...t};return e.cwd=(e.cwd instanceof URL?ZAe(e.cwd):GAe(e.cwd)).replace(VJ,"/"),e.ignore=JJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||FAe,readdirSync:e.fs.readdirSync||LAe,realpath:e.fs.realpath||zAe,realpathSync:e.fs.realpathSync||UAe,stat:e.fs.stat||qAe,statSync:e.fs.statSync||BAe}),e.debug&&cp("globbing with options:",e),e}function pOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=VAe(t)||typeof t=="string",i=JJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=fOe(n?e:t);return i.length>0?lOe(o,i):[]}function ps(t,e){let[r,n]=pOe(t,e);return r?uOe(r.sync(),n):[]}var Dl,VAe,VJ,WJ,WAe,JAe,YAe,QAe,eOe,tOe,rOe,nOe,iOe,sOe,aOe,dOe,lp=y(()=>{vJ();Dl=vt(GJ(),1),VAe=Array.isArray,VJ=/\\/g,WJ=process.platform==="win32",WAe=/^(\/?\.\.)+$/;JAe=/^[A-Z]:\/$/i,YAe=WJ?t=>JAe.test(t):t=>t==="/";QAe={parts:!0};eOe=/(?t.replace(eOe,"\\$&"),nOe=t=>t.replace(tOe,"\\$&"),iOe=WJ?nOe:rOe;sOe=/^(\/?\.\.)+/,aOe=/\\(?=[()[\]{}!*+?@|])/g;dOe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as up,readFileSync as mOe,readdirSync as hOe,statSync as YJ}from"node:fs";import{join as Ba}from"node:path";function gOe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Ci(e,n),o=[],{layers:s,forbiddenImports:a}=EP(r);return(s.size>0||a.length>0)&&!up(Ba(e,i.mainRoot))?[{detector:dp,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&&(yOe(e,i,s,o),_Oe(e,i,s,o)),a.length>0&&bOe(e,i,a,o),o)}function EP(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 yOe(t,e,r,n){let i=e.mainRoot,o=Ba(t,i);if(up(o))for(let s of hOe(o)){let a=Ba(o,s);YJ(a).isDirectory()&&(r.has(s)||n.push({detector:dp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function _Oe(t,e,r,n){let i=e.mainRoot,o=Ba(t,i);if(up(o))for(let s of r){let a=Ba(o,s);up(a)&&YJ(a).isDirectory()||n.push({detector:dp,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 bOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ba(t,i,s.from);if(!up(a))continue;let c=ps([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ba(a,l),d;try{d=mOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];vOe(p,s.to,e.importStyle)&&n.push({detector:dp,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 vOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var dp,XJ,AP=y(()=>{"use strict";lp();qe();Ua();dp="ARCHITECTURE_FROM_SPEC";XJ={name:dp,run:gOe}});import{existsSync as SOe,readFileSync as wOe}from"node:fs";import{join as xOe}from"node:path";function $Oe(t){let{cwd:e="."}=t,r=xOe(e,"spec/capabilities.yaml");if(!SOe(r))return[];let n;try{let c=wOe(r,"utf8"),l=QJ.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=H(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:Ev,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:Ev,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:Ev,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var QJ,Ev,e8,t8=y(()=>{"use strict";QJ=vt(Qt(),1);qe();Ev="CAPABILITIES_FEATURE_MAPPING";e8={name:Ev,run:$Oe}});import{existsSync as kOe,readFileSync as EOe}from"node:fs";import{join as AOe}from"node:path";function OOe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function TOe(t){let{cwd:e="."}=t;return he(e,OP,r=>ROe(r,e))}function ROe(t,e){let r=Ci(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=AOe(e,o);if(!kOe(s))continue;let a=EOe(s,"utf8");OOe(a)||n.push({detector:OP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var OP,r8,n8=y(()=>{"use strict";Ua();St();OP="CONVENTION_DRIFT";r8={name:OP,run:TOe}});import{existsSync as TP,readFileSync as i8}from"node:fs";import{join as Av}from"node:path";function IOe(t){return JSON.parse(t).total?.lines?.pct??0}function o8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function DOe(t,e){if(!lv(dt(t).gates.coverage?.cmd))return null;let r;try{r=uv(t,e)}catch(c){return[{detector:bo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=aP.find(d=>TP(Av(c.dir,d)));if(!l){s.push(c.path);continue}let u=o8(i8(Av(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:bo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=s8(n,i);return a0?[{detector:bo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function NOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=DOe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Ci(e,r),i=dt(e).language==="kotlin"?aP.find(a=>TP(Av(e,a)))??qK(e):n.coverageSummary,o=Av(e,i);if(!TP(o))return[{detector:bo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=i8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?POe(a):n.coverageFormat==="cobertura-xml"?COe(a):IOe(a)}catch(a){return[{detector:bo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:bo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Ov?[]:[{detector:bo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Ov}%`}]}var bo,Ov,a8,c8=y(()=>{"use strict";qe();mv();Ua();dv();on();bo="COVERAGE_DROP",Ov=70;a8={name:bo,run:NOe}});import{existsSync as jOe}from"node:fs";import{join as MOe}from"node:path";function FOe(t){let{cwd:e="."}=t;return he(e,Tv,r=>LOe(r,e))}function LOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?jOe(MOe(e,r.path))?[]:[{detector:Tv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:Tv,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var Tv,l8,u8=y(()=>{"use strict";St();Tv="DELIVERABLE_INTEGRITY";l8={name:Tv,run:FOe}});function zOe(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:Rv,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 UOe(t){let e=zOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Rv,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 qOe(t){let{cwd:e="."}=t;return he(e,Rv,r=>UOe(r))}var Rv,d8,f8=y(()=>{"use strict";St();Rv="SMOKE_PROBE_DEMAND";d8={name:Rv,run:qOe}});function BOe(t){let{cwd:e="."}=t;return he(e,Iv,r=>HOe(r,e))}function HOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=is(e);if(n===null)return[{detector:Iv,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=T_(n,e,o);s.state!=="fresh"&&i.push({detector:Iv,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 Iv,Pv,RP=y(()=>{"use strict";ul();St();Iv="STALE_ATTESTATION";Pv={name:Iv,run:BOe}});function GOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return ZOe(r)}function ZOe(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:p8,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 p8,Cv,IP=y(()=>{"use strict";qe();p8="DEPENDENCY_CYCLE";Cv={name:p8,run:GOe}});import{appendFileSync as VOe,existsSync as m8,mkdirSync as WOe,readFileSync as KOe}from"node:fs";import{dirname as JOe,join as YOe}from"node:path";function h8(t){return YOe(t,XOe,QOe)}function g8(t){return PP.add(t),()=>PP.delete(t)}function Ha(t,e){let r=h8(t),n=JOe(r);m8(n)||WOe(n,{recursive:!0}),VOe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of PP)try{i(t,e)}catch{}}function Tn(t){let e=h8(t);if(!m8(e))return[];let r=KOe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var XOe,QOe,PP,ti=y(()=>{"use strict";XOe=".cladding",QOe="audit.log.jsonl";PP=new Set});import{existsSync as eTe}from"node:fs";import{join as tTe}from"node:path";function rTe(t){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return[{detector:CP,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&&(eTe(tTe(e,i.artifact))||n.push({detector:CP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var CP,y8,_8=y(()=>{"use strict";ti();CP="EVIDENCE_MISMATCH";y8={name:CP,run:rTe}});import{existsSync as nTe,readFileSync as iTe}from"node:fs";import{join as oTe}from"node:path";function sTe(t){let e=oTe(t,w8);if(!nTe(e))return null;try{let n=((0,S8.parse)(iTe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*v8(t,e){for(let r of t??[])r.startsWith(b8)&&(yield{ref:r,name:r.slice(b8.length),field:e})}function aTe(t){let{cwd:e="."}=t,r=sTe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:DP,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=[...v8(s.evidence_refs,"evidence_refs"),...v8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:DP,severity:"warn",path:w8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var S8,DP,b8,w8,x8,$8=y(()=>{"use strict";S8=vt(Qt(),1);qe();DP="FIXTURE_REFERENCE_INVALID",b8="fixture:",w8="conformance/fixtures.yaml";x8={name:DP,run:aTe}});import{existsSync as Nl,readFileSync as NP}from"node:fs";import{join as Ga}from"node:path";function cTe(t){return ps(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function fp(t){if(!Nl(t))return null;try{return JSON.parse(NP(t,"utf8"))}catch{return null}}function lTe(t,e){let r=Ga(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(NP(r,"utf8"))}catch(c){e.push({detector:vo,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:vo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=cTe(t);s!==a&&e.push({detector:vo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function uTe(t,e){for(let r of k8){let n=Ga(t,r.path);if(!Nl(n))continue;let i=fp(n);if(!i){e.push({detector:vo,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:vo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function dTe(t,e){let r=fp(Ga(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of k8){let s=Ga(t,o.path);if(!Nl(s))continue;let a=fp(s);a?.version&&a.version!==n&&e.push({detector:vo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ga(t,".claude-plugin","marketplace.json");if(Nl(i)){let o=fp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:vo,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 fTe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function pTe(t,e){let r=Ga(t,"src","cli","clad.ts"),n=Ga(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Nl(r)||!Nl(n))return;let i=fTe(NP(r,"utf8"));if(i.length===0)return;let s=fp(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:vo,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 mTe(t){let{cwd:e="."}=t,r=[];return lTe(e,r),pTe(e,r),uTe(e,r),dTe(e,r),r}var vo,k8,E8,A8=y(()=>{"use strict";lp();vo="HARNESS_INTEGRITY",k8=[{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"]}];E8={name:vo,run:mTe}});import{existsSync as hTe,readFileSync as gTe}from"node:fs";import{join as yTe}from"node:path";function bTe(t){let{cwd:e="."}=t;return he(e,Dv,r=>STe(r,e))}function vTe(t){let e=yTe(t,"spec/capabilities.yaml");if(!hTe(e))return!1;try{let r=O8.default.parse(gTe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function STe(t,e){let r=t.features.length;if(r<_Te)return[];let n=[];return vTe(e)&&n.push({detector:Dv,severity:"warn",path:"spec/capabilities.yaml",message:`${r} features but spec/capabilities.yaml declares no capabilities (capabilities: []) \u2014 the design SSoT is an empty seed. Populate it (capability \u2194 feature links) or run \`clad init --scan\`.`}),t.architecture&&(t.architecture.layers??[]).length===0&&n.push({detector:Dv,severity:"warn",path:"spec/architecture.yaml",message:`${r} features but spec/architecture.yaml declares no layers (layers: []) \u2014 the architecture SSoT is an empty seed. Populate it or run \`clad init --scan\`.`}),n}var O8,Dv,_Te,T8,R8=y(()=>{"use strict";O8=vt(Qt(),1);St();Dv="HOLLOW_GOVERNANCE",_Te=8;T8={name:Dv,run:bTe}});import{existsSync as I8,readFileSync as P8}from"node:fs";import{join as C8}from"node:path";function D8(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 $Te(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 kTe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function ETe(t){let e=C8(t,"README.md"),r=C8(t,"docs","dogfood","matrix.md");if(!I8(e)||!I8(r))return[];let n=D8(P8(e,"utf8"),wTe),i=D8(P8(r,"utf8"),xTe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=kTe(a);if(c===null)continue;let l=i[s]??"not-run",u=$Te(l);u!==null&&c>u&&o.push({detector:N8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function ATe(t){let{cwd:e="."}=t;return ETe(e)}var N8,wTe,xTe,j8,M8=y(()=>{"use strict";N8="HOST_CLAIM_DRIFT",wTe=//,xTe=//;j8={name:N8,run:ATe}});function OTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return F8(r.features.map(i=>i.id),"feature","spec/features/",n),F8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function F8(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:L8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var L8,z8,U8=y(()=>{"use strict";qe();L8="ID_COLLISION";z8={name:L8,run:OTe}});import{existsSync as pp,readFileSync as jP,readdirSync as MP,statSync as TTe,writeFileSync as B8}from"node:fs";import{join as So}from"node:path";function q8(t){if(!pp(t))return 0;try{return MP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function RTe(t){if(!pp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=MP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=So(n,o),a;try{a=TTe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function ITe(t){let e=So(t,"spec","capabilities.yaml");if(!pp(e))return 0;try{let r=Nv.default.parse(jP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ms(t="."){let e=q8(So(t,"spec","features")),r=q8(So(t,"spec","scenarios")),n=ITe(t),i=RTe(So(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function jl(t,e){let r=So(t,"spec.yaml");if(!pp(r))return;let n=jP(r,"utf8"),i=PTe(n,e);i!==n&&B8(r,i)}function PTe(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 @@ -269,51 +269,51 @@ ${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 Ha(t="."){let e=wo(t,"spec","features");if(!pp(e))return!1;let r=[];for(let i of jP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Nv.parse)(NP(wo(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 Za(t="."){let e=So(t,"spec","features");if(!pp(e))return!1;let r=[];for(let i of MP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Nv.parse)(jP(So(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 L8(wo(t,"spec","index.yaml"),n,"utf8"),!0}var Nv,mp=y(()=>{"use strict";Nv=bt(Qt(),1)});import{existsSync as z8,readFileSync as U8,readdirSync as COe}from"node:fs";import{join as MP}from"node:path";function DOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=ms(e),i=r.inventory;if(!i){let s=q8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return FP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...FP(e),{detector:hp,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 q8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:hp,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(...FP(e)),o}function FP(t){let e=MP(t,"spec","index.yaml"),r=MP(t,"spec","features");if(!z8(e)||!z8(r))return[];let n=new Map;try{for(let l of U8(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 COe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=U8(MP(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:hp,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:hp,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 hp,q8,B8,H8=y(()=>{"use strict";mp();qe();hp="INVENTORY_DRIFT",q8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];B8={name:hp,run:DOe}});import{existsSync as NOe,readFileSync as jOe}from"node:fs";import{join as MOe}from"node:path";function LOe(t){let{cwd:e="."}=t,r=MOe(e,"src","spec","schema.json"),n=[];if(NOe(r)){let i;try{i=JSON.parse(jOe(r,"utf8"))}catch(o){n.push({detector:gp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of FOe)i.required?.includes(o)||n.push({detector:gp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:gp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=G(e);i.schema!==G8&&n.push({detector:gp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${G8}'`})}catch{}return n}var gp,FOe,G8,Z8,V8=y(()=>{"use strict";qe();gp="META_INTEGRITY",FOe=["schema","project","features"],G8="0.1";Z8={name:gp,run:LOe}});function zOe(t){let{cwd:e="."}=t,r;try{r=G(e)}catch{return[]}let n=[];return W8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),W8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function W8(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:K8,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 K8,J8,Y8=y(()=>{"use strict";qe();K8="SLUG_CONFLICT";J8={name:K8,run:zOe}});function jl(t){return t==="planned"||t==="in_progress"}var jv=y(()=>{"use strict"});import{existsSync as UOe}from"node:fs";import{join as qOe}from"node:path";function BOe(t){let{cwd:e="."}=t;return he(e,Mv,r=>HOe(r,e))}function HOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=qOe(e,i);UOe(o)||r.push(GOe(n.id,i,n.status))}return r}function GOe(t,e,r){return jl(r)?{detector:Mv,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:Mv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Mv,Fv,LP=y(()=>{"use strict";jv();vt();Mv="MISSING_IMPLEMENTATION";Fv={name:Mv,run:BOe}});function ZOe(t){let{cwd:e="."}=t;return he(e,zP,VOe)}function VOe(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:zP,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 zP,Lv,UP=y(()=>{"use strict";vt();zP="MISSING_TESTS";Lv={name:zP,run:ZOe}});import{existsSync as WOe,readFileSync as KOe}from"node:fs";import{join as X8}from"node:path";function Q8(t){if(WOe(t))try{return JSON.parse(KOe(t,"utf8"))}catch{return}}function QOe(t){let{cwd:e="."}=t,r=Q8(X8(e,JOe)),n=Q8(X8(e,YOe));if(!r||!n)return[{detector:qP,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>XOe&&i.push({detector:qP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var qP,JOe,YOe,XOe,e5,t5=y(()=>{"use strict";qP="PERFORMANCE_DRIFT",JOe="perf/baseline.json",YOe="perf/current.json",XOe=10;e5={name:qP,run:QOe}});import{existsSync as eRe}from"node:fs";import{join as tRe}from"node:path";function nRe(t){let{cwd:e="."}=t;return he(e,BP,r=>oRe(r,e))}function iRe(t,e){return(t.modules??[]).some(r=>eRe(tRe(e,r)))}function oRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||iRe(s,e)||r.push(s.id);let n=rRe;if(r.length<=n)return[];let i=r.slice(0,r5).join(", "),o=r.length>r5?", \u2026":"";return[{detector:BP,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 BP,rRe,r5,n5,i5=y(()=>{"use strict";vt();BP="PLANNED_BACKLOG",rRe=5,r5=8;n5={name:BP,run:nRe}});import{existsSync as sRe,readFileSync as aRe}from"node:fs";import{join as cRe}from"node:path";function dRe(t){let{cwd:e="."}=t;return he(e,HP,r=>fRe(r,e))}function fRe(t,e){if(t.features.lengthn.includes(i))?[{detector:HP,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 HP,lRe,uRe,o5,s5=y(()=>{"use strict";vt();HP="PROJECT_CONTEXT_DRIFT",lRe=8,uRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];o5={name:HP,run:dRe}});function a5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:zv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function pRe(t){let{cwd:e="."}=t;return he(e,zv,mRe)}function mRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...a5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:zv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...a5(e,n.features,`scenario ${n.id}.features`));return r}var zv,Uv,GP=y(()=>{"use strict";vt();zv="REFERENCE_INTEGRITY";Uv={name:zv,run:pRe}});function yp(t=""){return new RegExp(hRe,t)}var hRe,ZP=y(()=>{"use strict";hRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as gRe,readdirSync as yRe,readFileSync as _Re,statSync as bRe,writeFileSync as vRe}from"node:fs";import{dirname as SRe,join as _p,normalize as wRe,relative as xRe}from"node:path";function TRe(t){let e=[];for(let r of t.matchAll(ARe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(yp("g"))??[])e.push(n);return[...new Set(e)].sort()}function ORe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function c5(t){return t.split("\\").join("/")}function RRe(t){return $Re.some(e=>t===e||t.startsWith(`${e}/`))}function IRe(t){let e=_p(t,"docs");if(!gRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=yRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=_p(i,s),c;try{c=bRe(a)}catch{continue}let l=c5(xRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function PRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=wRe(_p(SRe(t),e));return c5(r)}function bp(t="."){let e=[];for(let r of IRe(t)){let n;try{n=_Re(_p(t,r),"utf8")}catch{continue}let i=ORe(n),o=TRe(i);if(RRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(kRe)?[]:i.match(yp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(ERe)){let d=PRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function l5(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 vRe(_p(t,"spec","_doc-links.yaml"),`${r.join(` +`;return B8(So(t,"spec","index.yaml"),n,"utf8"),!0}var Nv,mp=y(()=>{"use strict";Nv=vt(Qt(),1)});import{existsSync as H8,readFileSync as G8,readdirSync as CTe}from"node:fs";import{join as FP}from"node:path";function DTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=ms(e),i=r.inventory;if(!i){let s=Z8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return LP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...LP(e),{detector:hp,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 Z8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:hp,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(...LP(e)),o}function LP(t){let e=FP(t,"spec","index.yaml"),r=FP(t,"spec","features");if(!H8(e)||!H8(r))return[];let n=new Map;try{for(let l of G8(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 CTe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=G8(FP(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:hp,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:hp,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 hp,Z8,V8,W8=y(()=>{"use strict";mp();qe();hp="INVENTORY_DRIFT",Z8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];V8={name:hp,run:DTe}});import{existsSync as NTe,readFileSync as jTe}from"node:fs";import{join as MTe}from"node:path";function LTe(t){let{cwd:e="."}=t,r=MTe(e,"src","spec","schema.json"),n=[];if(NTe(r)){let i;try{i=JSON.parse(jTe(r,"utf8"))}catch(o){n.push({detector:gp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of FTe)i.required?.includes(o)||n.push({detector:gp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:gp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==K8&&n.push({detector:gp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${K8}'`})}catch{}return n}var gp,FTe,K8,J8,Y8=y(()=>{"use strict";qe();gp="META_INTEGRITY",FTe=["schema","project","features"],K8="0.1";J8={name:gp,run:LTe}});function zTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return X8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),X8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function X8(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:Q8,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 Q8,e5,t5=y(()=>{"use strict";qe();Q8="SLUG_CONFLICT";e5={name:Q8,run:zTe}});function Ml(t){return t==="planned"||t==="in_progress"}var jv=y(()=>{"use strict"});import{existsSync as UTe}from"node:fs";import{join as qTe}from"node:path";function BTe(t){let{cwd:e="."}=t;return he(e,Mv,r=>HTe(r,e))}function HTe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=qTe(e,i);UTe(o)||r.push(GTe(n.id,i,n.status))}return r}function GTe(t,e,r){return Ml(r)?{detector:Mv,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:Mv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Mv,Fv,zP=y(()=>{"use strict";jv();St();Mv="MISSING_IMPLEMENTATION";Fv={name:Mv,run:BTe}});function ZTe(t){let{cwd:e="."}=t;return he(e,UP,VTe)}function VTe(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:UP,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 UP,Lv,qP=y(()=>{"use strict";St();UP="MISSING_TESTS";Lv={name:UP,run:ZTe}});import{existsSync as WTe,readFileSync as KTe}from"node:fs";import{join as r5}from"node:path";function n5(t){if(WTe(t))try{return JSON.parse(KTe(t,"utf8"))}catch{return}}function QTe(t){let{cwd:e="."}=t,r=n5(r5(e,JTe)),n=n5(r5(e,YTe));if(!r||!n)return[{detector:BP,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>XTe&&i.push({detector:BP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var BP,JTe,YTe,XTe,i5,o5=y(()=>{"use strict";BP="PERFORMANCE_DRIFT",JTe="perf/baseline.json",YTe="perf/current.json",XTe=10;i5={name:BP,run:QTe}});import{existsSync as eRe}from"node:fs";import{join as tRe}from"node:path";function nRe(t){let{cwd:e="."}=t;return he(e,HP,r=>oRe(r,e))}function iRe(t,e){return(t.modules??[]).some(r=>eRe(tRe(e,r)))}function oRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||iRe(s,e)||r.push(s.id);let n=rRe;if(r.length<=n)return[];let i=r.slice(0,s5).join(", "),o=r.length>s5?", \u2026":"";return[{detector:HP,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 HP,rRe,s5,a5,c5=y(()=>{"use strict";St();HP="PLANNED_BACKLOG",rRe=5,s5=8;a5={name:HP,run:nRe}});import{existsSync as sRe,readFileSync as aRe}from"node:fs";import{join as cRe}from"node:path";function dRe(t){let{cwd:e="."}=t;return he(e,GP,r=>fRe(r,e))}function fRe(t,e){if(t.features.lengthn.includes(i))?[{detector:GP,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 GP,lRe,uRe,l5,u5=y(()=>{"use strict";St();GP="PROJECT_CONTEXT_DRIFT",lRe=8,uRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];l5={name:GP,run:dRe}});function d5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:zv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function pRe(t){let{cwd:e="."}=t;return he(e,zv,mRe)}function mRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...d5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:zv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...d5(e,n.features,`scenario ${n.id}.features`));return r}var zv,Uv,ZP=y(()=>{"use strict";St();zv="REFERENCE_INTEGRITY";Uv={name:zv,run:pRe}});function yp(t=""){return new RegExp(hRe,t)}var hRe,VP=y(()=>{"use strict";hRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as gRe,readdirSync as yRe,readFileSync as _Re,statSync as bRe,writeFileSync as vRe}from"node:fs";import{dirname as SRe,join as _p,normalize as wRe,relative as xRe}from"node:path";function ORe(t){let e=[];for(let r of t.matchAll(ARe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(yp("g"))??[])e.push(n);return[...new Set(e)].sort()}function TRe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function f5(t){return t.split("\\").join("/")}function RRe(t){return $Re.some(e=>t===e||t.startsWith(`${e}/`))}function IRe(t){let e=_p(t,"docs");if(!gRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=yRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=_p(i,s),c;try{c=bRe(a)}catch{continue}let l=f5(xRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function PRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=wRe(_p(SRe(t),e));return f5(r)}function bp(t="."){let e=[];for(let r of IRe(t)){let n;try{n=_Re(_p(t,r),"utf8")}catch{continue}let i=TRe(n),o=ORe(i);if(RRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(kRe)?[]:i.match(yp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(ERe)){let d=PRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function p5(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 vRe(_p(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var $Re,kRe,ERe,ARe,qv=y(()=>{"use strict";ZP();$Re=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],kRe="clad-doc-links: ignore",ERe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,ARe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as CRe}from"node:fs";import{join as DRe}from"node:path";function NRe(t){let{cwd:e="."}=t;return he(e,Bv,r=>jRe(r,e))}function jRe(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)CRe(DRe(e,o))||n.push({detector:Bv,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:Bv,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 Bv,Hv,VP=y(()=>{"use strict";qv();vt();Bv="DOC_LINK_INTEGRITY";Hv={name:Bv,run:NRe}});function FRe(t){let{cwd:e="."}=t;return he(e,vp,r=>LRe(r))}function LRe(t){let e=[],r=t.features.length,n=t.scenarios??[];r>=MRe&&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 o of n)(o.features??[]).length===0&&e.push({detector:vp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let i=new Map(t.features.filter(o=>typeof o.slug=="string"&&o.slug.length>0).map(o=>[o.slug,o.id]));for(let o of n){if(!o.flow)continue;let s=new Set(o.features??[]),a=new Map;for(let c of o.flow.matchAll(/\(([^)]+)\)/g))for(let l of c[1].split(/[,/·]/)){let u=l.trim(),d=i.get(u);d&&!s.has(d)&&a.set(u,d)}if(a.size>0){let c=[...a].map(([l,u])=>`${l} (${u})`).join(", ");e.push({detector:vp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} flow references ${c} but features[] does not bind ${a.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,MRe,u5,d5=y(()=>{"use strict";vt();vp="SCENARIO_COVERAGE",MRe=8;u5={name:vp,run:FRe}});import{createHash as zRe}from"node:crypto";function URe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Sp(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??f5),sample:URe(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(f5),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 qRe(t,e){return e<=0?!1:e>=1?!0:parseInt(zRe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var f5,Gv=y(()=>{"use strict";f5=["unwanted"]});import{existsSync as BRe,readdirSync as HRe}from"node:fs";import{join as m5}from"node:path";import h5 from"node:process";function GRe(t){let e=!1,r=n=>{for(let i of HRe(n,{withFileTypes:!0})){if(e)return;let o=m5(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 WP(t={}){let{cwd:e="."}=t,r=m5(e,hs);if(!BRe(r)||!GRe(r))return{stage:Zv,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${hs}/ \u2014 skipped`};let n=ut(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Zv,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o=Je(i.cmd,[...i.args,hs],{cwd:e,reject:!1}),s=Ut(Zv,i.cmd,o);return s||tr(Zv,o)}var Zv,hs,ZRe,KP=y(()=>{"use strict";Mr();on();Tn();Zv="stage_2.3",hs="tests/oracle";ZRe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${h5.argv[1]}`;if(ZRe){let t=WP();console.log(JSON.stringify(t)),h5.exit(t.exitCode)}});import{existsSync as VRe}from"node:fs";import{join as WRe}from"node:path";function KRe(t){let{cwd:e="."}=t;return he(e,ri,r=>JRe(r,e))}function JRe(t,e){let r=[],n=Sp(t.project,wp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?On(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(xp(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:ri,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${hs}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!VRe(WRe(e,f))){r.push({detector:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${hs}/`)||r.push({detector:ri,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${hs}/ \u2014 stage_2.3 only runs ${hs}/, 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:ri,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:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ri,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:ri,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:ri,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:ri,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 ri,g5,y5=y(()=>{"use strict";ti();Gv();KP();vt();ri="SPEC_CONFORMANCE";g5={name:ri,run:KRe}});function YRe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:JP,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>_5&&i.push({detector:JP,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${_5})`})}return i}var JP,_5,b5,v5=y(()=>{"use strict";ti();JP="STALE_EVIDENCE",_5=90;b5={name:JP,run:YRe}});import{existsSync as S5}from"node:fs";import{join as w5}from"node:path";function XRe(t){let{cwd:e="."}=t;return he(e,Ml,r=>QRe(r,e))}function QRe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Ml,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:Ml,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=>S5(w5(e,o)));i.length>0&&r.push({detector:Ml,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}jl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>S5(w5(e,i)))&&r.push({detector:Ml,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 Ml,Vv,YP=y(()=>{"use strict";jv();vt();Ml="STALE_SPECIFICATION";Vv={name:Ml,run:XRe}});import{existsSync as x5,statSync as $5}from"node:fs";import{join as k5}from"node:path";function tIe(t,e){let r=0;for(let n of e){let i=k5(t,n);if(!x5(i))continue;let o=$5(i).mtimeMs;o>r&&(r=o)}return r}function rIe(t){let{cwd:e="."}=t;return he(e,XP,r=>nIe(r,e))}function nIe(t,e){let r=Di(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=tIe(e,n);if(i===0)return[];let o=ps([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=k5(e,a);if(!x5(c))continue;let l=$5(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>eIe&&s.push({detector:XP,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var XP,eIe,Wv,QP=y(()=>{"use strict";lp();La();vt();XP="STALE_TESTS",eIe=30;Wv={name:XP,run:rIe}});import{existsSync as iIe}from"node:fs";import{join as oIe}from"node:path";function sIe(t){let{cwd:e="."}=t;return he(e,$p,r=>aIe(r,e))}function aIe(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:$p,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=>!iIe(oIe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:$p,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:$p,severity:jl(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 $p,Kv,eC=y(()=>{"use strict";jv();vt();$p="STATUS_DRIFT";Kv={name:$p,run:sIe}});function cIe(t){let{cwd:e="."}=t;return he(e,Jv,r=>lIe(r,e))}function lIe(t,e){let r=ut(e).language;return r==="unknown"?[{detector:Jv,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:Jv,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var Jv,E5,A5=y(()=>{"use strict";on();vt();Jv="TECH_STACK_MISMATCH";E5={name:Jv,run:cIe}});function pIe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function mIe(t){let{cwd:e="."}=t;return he(e,tC,r=>hIe(r,e))}function hIe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=ps([...pIe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:tC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var tC,T5,uIe,dIe,fIe,Yv,rC=y(()=>{"use strict";lp();EP();vt();tC="UNMAPPED_ARTIFACT",T5=["src/stages/**/*.ts","src/spec/**/*.ts"],uIe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},dIe={kotlin:"src/main/kotlin"},fIe=8;Yv={name:tC,run:mIe}});import{existsSync as O5}from"node:fs";import{join as R5}from"node:path";function yIe(t){return gIe.some(e=>t.startsWith(e))}function _Ie(t){let{cwd:e="."}=t;return he(e,nC,r=>bIe(r,e))}function bIe(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(yIe(o))continue;let s=o.split("#",1)[0];O5(R5(e,o))||s&&O5(R5(e,s))||r.push({detector:nC,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 Oee(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?`[[${$ee(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(kee);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(kee);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}/${$ee(s)}.md`,`${a.join(` +`)}`)}return o}function kee(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as B2e}from"node:fs";import{dirname as H2e,join as cj}from"node:path";import{fileURLToPath as G2e}from"node:url";var lj=H2e(G2e(import.meta.url));function Tee(t){for(let e of[cj(lj,"viewer",t),cj(lj,"..","graph","viewer",t),cj(lj,"..","..","dist","viewer",t)])try{return B2e(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function Ree(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -876,54 +874,54 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify
${n} -`}RP();VP();LP();UP();GP();OP();QP();eC();rC();iC();Lm();ZP();qe();var tUe=[Lv,Xv,Fv,Yv,Uv,Hv,Cv,Kv,Wv,Pv];function rUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=yp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function xx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Sa(e,G(e))}catch{}try{for(let o of tUe){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 rUe(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{Sa(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}sj();qe();Ti();var iUe=new Set(["mermaid","dot","json","obsidian","html"]);function Pee(t={}){try{let e=t.format??"mermaid";if(!iUe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=G(),i=fc(n,".");if(t.focus){let s=yx(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=gx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Tee(i);for(let[c,l]of a){let u=nUe(s,c);aj(lj(u),{recursive:!0}),cj(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,xx(i,"."));aj(lj(t.out),{recursive:!0}),cj(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"?Aee(i):r==="json"?Sx(i):Eee(i);t.out?(aj(lj(t.out),{recursive:!0}),cj(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 Cee(){try{let t=fc(G(),".");process.stdout.write(Iee($x(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Lm();import{createServer as oUe}from"node:http";import{existsSync as sUe,watch as aUe}from"node:fs";import{join as cUe}from"node:path";qe();Ti();function lUe(t={}){let e=t.cwd??".",r=new Set,n=()=>fc(G(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}IP();WP();zP();qP();ZP();RP();eC();tC();nC();oC();Fm();VP();qe();var Z2e=[Lv,Xv,Fv,Yv,Uv,Hv,Cv,Kv,Wv,Pv];function V2e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=yp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function $x(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{xa(e,H(e))}catch{}try{for(let o of Z2e){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 V2e(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{xa(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}uj();qe();Ai();var K2e=new Set(["mermaid","dot","json","obsidian","html"]);function Pee(t={}){try{let e=t.format??"mermaid";if(!K2e.has(e)){U("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=mc(n,".");if(t.focus){let s=_x(n,i,t.focus);if(s.length===0){U("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){U("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=yx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Oee(i);for(let[c,l]of a){let u=W2e(s,c);dj(pj(u),{recursive:!0}),fj(u,l,"utf8")}U("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){U("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=xx(i,$x(i,"."));dj(pj(t.out),{recursive:!0}),fj(t.out,s,"utf8"),U("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"?Aee(i):r==="json"?wx(i):Eee(i);t.out?(dj(pj(t.out),{recursive:!0}),fj(t.out,o,"utf8"),U("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){U("fail","graph",e.message),process.exit(1)}}function Cee(){try{let t=mc(H(),".");process.stdout.write(Iee(kx(t)),()=>process.exit(0))}catch(t){U("fail","graph",t.message),process.exit(1)}}Fm();import{createServer as J2e}from"node:http";import{existsSync as Y2e,watch as X2e}from"node:fs";import{join as Q2e}from"node:path";qe();Ai();function eUe(t={}){let e=t.cwd??".",r=new Set,n=()=>mc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=oUe((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=Sx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(xx(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=J2e((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($x(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=cUe(e,u);if(sUe(d))try{let f=aUe(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=xx(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=Q2e(e,u);if(Y2e(d))try{let f=X2e(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 Dee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await lUe({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 uUe=["stage_1.1","stage_2.1","stage_2.3"];function dUe(t){return(t.features??[]).filter(e=>e.status==="done")}function fUe(t,e){let r=dUe(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 Nee(t,e){let r=[];for(let n of uUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=fUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}sS();import jee from"node:process";function pUe(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 kx(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=pUe(n,t);i.pass||r.push(i)}return r}ti();var uj="stage_4.1";function dj(t={}){let{cwd:e="."}=t,r=On(e);if(r.length===0)return{stage:uj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=kx(r);if(n.length===0)return{stage:uj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:uj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var mUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${jee.argv[1]}`;if(mUe){let t=dj();console.log(JSON.stringify(t)),jee.exit(t.exitCode)}ul();import{randomBytes as hUe}from"node:crypto";import{unlinkSync as gUe}from"node:fs";import{tmpdir as yUe}from"node:os";import{join as _Ue,resolve as fj}from"node:path";import bUe from"node:process";var qr=null;function Mee(t){qr={cwd:fj(t),run:null,jsonFile:null}}function Fee(){return qr!==null}function Lee(t,e){if(!qr||qr.cwd!==fj(t))return null;if(qr.run)return qr.run;let r=_Ue(yUe(),`clad-shared-vitest-${bUe.pid}-${hUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function zee(t){return!qr||qr.cwd!==fj(t)?null:qr.run}function Uee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function qee(){let t=qr?.jsonFile;if(qr=null,t)try{gUe(t)}catch{}}Mr();import Bee from"node:process";var Ex="stage_1.4";function pj(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Ex,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:Ex,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Ex,pass:!0,exitCode:0}:{stage:Ex,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var vUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Bee.argv[1]}`;if(vUe){let t=pj();console.log(JSON.stringify(t)),Bee.exit(t.exitCode)}Mr();import Hee from"node:process";zm();Tn();var Ax="stage_2.2";function mj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Io("coverage",t))}catch(c){return{stage:Ax,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Ax,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=zee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Ut(Ax,r,s);return a||tr(Ax,s)}var xUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Hee.argv[1]}`;if(xUe){let t=mj();console.log(JSON.stringify(t)),Hee.exit(t.exitCode)}Ep();hj();Mr();on();Tn();import Zee from"node:process";var Ix="stage_3.2";function gj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Ix,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Ix,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Ix,i,s);return a||tr(Ix,s)}var zUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Zee.argv[1]}`;if(zUe){let t=gj();console.log(JSON.stringify(t)),Zee.exit(t.exitCode)}Mr();qe();Tn();import{existsSync as UUe}from"node:fs";import{resolve as Wee}from"node:path";import Kee from"node:process";var ci="stage_2.4",yj=5e3,qUe=3e4;function _j(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=G(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:ci,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return HUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ci,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ci,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ci,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Wee(e,r.path);if(!UUe(s))return{stage:ci,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??yj,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Ut(ci,r.path,c);if(l)return l;if(c.timedOut)return{stage:ci,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:ci,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ci,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Vee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},BUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function HUe(t,e,r){let n=Math.min(e.length*yj,qUe),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(GUe(t,s,r))}return ZUe(o)}function GUe(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("/")?Wee(t,a):a,u=yj,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(ja(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 ZUe(t){let e="skip";for(let o of t)Vee[o.disposition]>Vee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${BUe[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:ci,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ci,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var VUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Kee.argv[1]}`;if(VUe){let t=_j();console.log(JSON.stringify(t)),Kee.exit(t.exitCode)}Mr();on();Tn();import Jee from"node:process";var Px="stage_3.1";function bj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Px,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Px,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Px,i,s);return a||tr(Px,s)}var WUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Jee.argv[1]}`;if(WUe){let t=bj();console.log(JSON.stringify(t)),Jee.exit(t.exitCode)}KP();vj();Sj();Mr();Ox();import{randomBytes as tqe}from"node:crypto";import{unlinkSync as rqe}from"node:fs";import{tmpdir as nqe}from"node:os";import{join as iqe}from"node:path";import xj from"node:process";zm();Tn();qe();import{readFileSync as YUe}from"node:fs";import{resolve as Qee}from"node:path";function XUe(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=Qee(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 QUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function eqe(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=QUe(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(Qee(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 wj(t,e){try{let r=XUe(YUe(t,"utf8"));return r?eqe(G(e),r,e):[]}catch{return[]}}var Po="stage_2.1";function ete(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function oqe(t,e,r){let n,i;try{({cmd:n,args:i}=Io("coverage",t))}catch{return null}if(!n||!i||!ete(n,i))return null;let o=n,s=i,a=Lee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Ut(Po,n,c))return null;let u=tr(Po,c);if(Uee(u)==="fallback")return null;if(r){let d=wj(l,e);if(d.length>0)return{stage:Po,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Po,pass:!0,exitCode:0}}function $j(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Io("test",t))}catch(u){return{stage:Po,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Po,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=ete(n,i),a=r&&s;if(Fee()&&s){let u=oqe(t,e,a);if(u)return u}let c,l=i;a&&(c=iqe(nqe(),`clad-vitest-${xj.pid}-${tqe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Ut(Po,n,u);if(d)return d;let f=wu("unit",tr(Po,u),u);if(a&&f.pass&&c){let p=wj(c,e);if(p.length>0)return{stage:Po,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{rqe(c)}catch{}}}var sqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xj.argv[1]}`;if(sqe){let t=$j();console.log(JSON.stringify(t)),xj.exit(t.exitCode)}Mr();on();Tn();import tte from"node:process";var Nx="stage_3.3";function kj(t={}){let{cwd:e="."}=t,r=ut(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Nx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Nx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Nx,i,s);return a||tr(Nx,s)}var aqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tte.argv[1]}`;if(aqe){let t=kj();console.log(JSON.stringify(t)),tte.exit(t.exitCode)}YP();Tf();pa();Aj();mp();qv();var cte=bt(Qt(),1);import{existsSync as Tj,readFileSync as _qe,readdirSync as ate,statSync as bqe,writeFileSync as vqe}from"node:fs";import{basename as Hm,join as Gm,relative as ste}from"node:path";var Sqe=["self-dogfood:","fixture:","derived:"],lte=/\.(test|spec)\.[jt]sx?$/;function ute(t,e=t,r=[]){let n;try{n=ate(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Gm(e,i);try{bqe(o).isDirectory()?ute(t,o,r):lte.test(i)&&r.push(o)}catch{continue}}return r}function dte(t="."){let e=Gm(t,"spec","features"),r=Gm(t,"tests"),n=[],i=[];if(!Tj(e)||!Tj(r))return{repaired:n,suggested:i};let o=ute(r),s=new Map;for(let a of o){let c=ste(t,a).split("\\").join("/"),l=s.get(Hm(a))??[];l.push(c),s.set(Hm(a),l)}for(let a of ate(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Gm(e,a),l,u;try{l=_qe(c,"utf8"),u=(0,cte.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(Sqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Tj(Gm(t,b)))continue;let _=s.get(Hm(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=>Hm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>ste(t,h).split("\\").join("/")).find(h=>{let g=Hm(h).replace(lte,"");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 Dee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await eUe({port:e,cwd:t.cwd??"."});U("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){U("fail","graph",r.message),process.exit(1)}}var tUe=["stage_1.1","stage_2.1","stage_2.3"];function rUe(t){return(t.features??[]).filter(e=>e.status==="done")}function nUe(t,e){let r=rUe(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 Nee(t,e){let r=[];for(let n of tUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=nUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}uS();import jee from"node:process";function iUe(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 Ex(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=iUe(n,t);i.pass||r.push(i)}return r}ti();var mj="stage_4.1";function hj(t={}){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return{stage:mj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Ex(r);if(n.length===0)return{stage:mj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:mj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var oUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${jee.argv[1]}`;if(oUe){let t=hj();console.log(JSON.stringify(t)),jee.exit(t.exitCode)}dl();import{randomBytes as sUe}from"node:crypto";import{unlinkSync as aUe}from"node:fs";import{tmpdir as cUe}from"node:os";import{join as lUe,resolve as gj}from"node:path";import uUe from"node:process";var qr=null;function Mee(t){qr={cwd:gj(t),run:null,jsonFile:null}}function Fee(){return qr!==null}function Lee(t,e){if(!qr||qr.cwd!==gj(t))return null;if(qr.run)return qr.run;let r=lUe(cUe(),`clad-shared-vitest-${uUe.pid}-${sUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function zee(t){return!qr||qr.cwd!==gj(t)?null:qr.run}function Uee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function qee(){let t=qr?.jsonFile;if(qr=null,t)try{aUe(t)}catch{}}Mr();import Bee from"node:process";var Ax="stage_1.4";function yj(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Ax,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:Ax,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Ax,pass:!0,exitCode:0}:{stage:Ax,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var dUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Bee.argv[1]}`;if(dUe){let t=yj();console.log(JSON.stringify(t)),Bee.exit(t.exitCode)}Mr();import Hee from"node:process";Lm();On();var Ox="stage_2.2";function _j(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Io("coverage",t))}catch(c){return{stage:Ox,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Ox,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=zee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Ut(Ox,r,s);return a||tr(Ox,s)}var mUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Hee.argv[1]}`;if(mUe){let t=_j();console.log(JSON.stringify(t)),Hee.exit(t.exitCode)}Ep();bj();Mr();on();On();import Zee from"node:process";var Px="stage_3.2";function vj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Px,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Pl(e,o[o.length-1]))return{stage:Px,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Px,i,s);return a||tr(Px,s)}var IUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Zee.argv[1]}`;if(IUe){let t=vj();console.log(JSON.stringify(t)),Zee.exit(t.exitCode)}Mr();qe();On();import{existsSync as PUe}from"node:fs";import{resolve as Wee}from"node:path";import Kee from"node:process";var ai="stage_2.4",Sj=5e3,CUe=3e4;function wj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ai,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return NUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ai,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ai,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Wee(e,r.path);if(!PUe(s))return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Sj,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Ut(ai,r.path,c);if(l)return l;if(c.timedOut)return{stage:ai,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:ai,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ai,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Vee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},DUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function NUe(t,e,r){let n=Math.min(e.length*Sj,CUe),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(jUe(t,s,r))}return MUe(o)}function jUe(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("/")?Wee(t,a):a,u=Sj,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Fa(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 MUe(t){let e="skip";for(let o of t)Vee[o.disposition]>Vee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${DUe[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:ai,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ai,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var FUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Kee.argv[1]}`;if(FUe){let t=wj();console.log(JSON.stringify(t)),Kee.exit(t.exitCode)}Mr();on();On();import Jee from"node:process";var Cx="stage_3.1";function xj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Cx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Pl(e,o[o.length-1]))return{stage:Cx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Cx,i,s);return a||tr(Cx,s)}var LUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Jee.argv[1]}`;if(LUe){let t=xj();console.log(JSON.stringify(t)),Jee.exit(t.exitCode)}JP();$j();kj();Mr();Rx();import{randomBytes as ZUe}from"node:crypto";import{unlinkSync as VUe}from"node:fs";import{tmpdir as WUe}from"node:os";import{join as KUe}from"node:path";import Aj from"node:process";Lm();On();qe();import{readFileSync as qUe}from"node:fs";import{resolve as Qee}from"node:path";function BUe(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=Qee(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 HUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function GUe(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=HUe(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(Qee(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 Ej(t,e){try{let r=BUe(qUe(t,"utf8"));return r?GUe(H(e),r,e):[]}catch{return[]}}var Po="stage_2.1";function ete(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function JUe(t,e,r){let n,i;try{({cmd:n,args:i}=Io("coverage",t))}catch{return null}if(!n||!i||!ete(n,i))return null;let o=n,s=i,a=Lee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Ut(Po,n,c))return null;let u=tr(Po,c);if(Uee(u)==="fallback")return null;if(r){let d=Ej(l,e);if(d.length>0)return{stage:Po,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Po,pass:!0,exitCode:0}}function Oj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Io("test",t))}catch(u){return{stage:Po,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Po,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=ete(n,i),a=r&&s;if(Fee()&&s){let u=JUe(t,e,a);if(u)return u}let c,l=i;a&&(c=KUe(WUe(),`clad-vitest-${Aj.pid}-${ZUe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Ut(Po,n,u);if(d)return d;let f=wu("unit",tr(Po,u),u);if(a&&f.pass&&c){let p=Ej(c,e);if(p.length>0)return{stage:Po,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{VUe(c)}catch{}}}var YUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Aj.argv[1]}`;if(YUe){let t=Oj();console.log(JSON.stringify(t)),Aj.exit(t.exitCode)}Mr();on();On();import tte from"node:process";var jx="stage_3.3";function Tj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:jx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Pl(e,o[o.length-1]))return{stage:jx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(jx,i,s);return a||tr(jx,s)}var XUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tte.argv[1]}`;if(XUe){let t=Tj();console.log(JSON.stringify(t)),tte.exit(t.exitCode)}XP();Of();ha();Ij();mp();qv();var cte=vt(Qt(),1);import{existsSync as Pj,readFileSync as lqe,readdirSync as ate,statSync as uqe,writeFileSync as dqe}from"node:fs";import{basename as Bm,join as Hm,relative as ste}from"node:path";var fqe=["self-dogfood:","fixture:","derived:"],lte=/\.(test|spec)\.[jt]sx?$/;function ute(t,e=t,r=[]){let n;try{n=ate(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Hm(e,i);try{uqe(o).isDirectory()?ute(t,o,r):lte.test(i)&&r.push(o)}catch{continue}}return r}function dte(t="."){let e=Hm(t,"spec","features"),r=Hm(t,"tests"),n=[],i=[];if(!Pj(e)||!Pj(r))return{repaired:n,suggested:i};let o=ute(r),s=new Map;for(let a of o){let c=ste(t,a).split("\\").join("/"),l=s.get(Bm(a))??[];l.push(c),s.set(Bm(a),l)}for(let a of ate(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Hm(e,a),l,u;try{l=lqe(c,"utf8"),u=(0,cte.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(fqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Pj(Hm(t,b)))continue;let _=s.get(Bm(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=>Bm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>ste(t,h).split("\\").join("/")).find(h=>{let g=Bm(h).replace(lte,"");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&&vqe(c,l,"utf8")}return{repaired:n,suggested:i}}ll();import{existsSync as wqe,readFileSync as xqe}from"node:fs";import{join as $qe}from"node:path";function kqe(t,e){let r=$qe(t,e);if(!wqe(r))return[];let n=[];for(let i of xqe(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 fte(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=>kqe(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 pte(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(` -`)}Gv();qe();Ti();ti();ll();var Oj=["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"],Eqe=[...Oj,"att"];function Aqe(t,e,r){if(e.startsWith("stage_4")){let n=On(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return kx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function Tqe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":O_(e,r,t).state==="fresh"?"\u2713":"!"}function Lx(t,e="."){let r=is(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Oj.map(o=>Aqe(i,o,e)),Tqe(i,r,e)]}));return{columns:Eqe,rows:n}}function mte(t,e=".",r={}){let n=r.internal??!1,i=Lx(t,e),o=[...Oj.map(c=>n?c.replace("stage_",""):Oqe(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 Oqe(t){return xa(t).slice(0,3)}async function XJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Cue(),Pue)),Promise.resolve().then(()=>(Fue(),Mue)),Promise.resolve().then(()=>(qp(),LX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>_ee(s),prepareInit:({cwd:s,mode:a,intent:c})=>gee(s,a,c),initialize:VN,prepareClarify:(s,{cwd:a})=>yee(a,s),clarify:YN,resolveReview:(s,{cwd:a})=>fee(s,{cwd:a})}});n(i.server);let o=new r;W.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function QJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await VN({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){W.stdout.write(`${JSON.stringify(n,null,2)} -`),W.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){W.stdout.write(` +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&dqe(c,l,"utf8")}return{repaired:n,suggested:i}}ul();import{existsSync as pqe,readFileSync as mqe}from"node:fs";import{join as hqe}from"node:path";function gqe(t,e){let r=hqe(t,e);if(!pqe(r))return[];let n=[];for(let i of mqe(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 fte(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=>gqe(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 pte(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(` +`)}Gv();qe();Ai();ti();ul();var Cj=["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"],yqe=[...Cj,"att"];function _qe(t,e,r){if(e.startsWith("stage_4")){let n=Tn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Ex(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function bqe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":T_(e,r,t).state==="fresh"?"\u2713":"!"}function zx(t,e="."){let r=is(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Cj.map(o=>_qe(i,o,e)),bqe(i,r,e)]}));return{columns:yqe,rows:n}}function mte(t,e=".",r={}){let n=r.internal??!1,i=zx(t,e),o=[...Cj.map(c=>n?c.replace("stage_",""):vqe(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 vqe(t){return ka(t).slice(0,3)}async function HJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Cue(),Pue)),Promise.resolve().then(()=>(Fue(),Mue)),Promise.resolve().then(()=>(Up(),LX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>_ee(s),prepareInit:({cwd:s,mode:a,intent:c})=>gee(s,a,c),initialize:YN,prepareClarify:(s,{cwd:a})=>yee(a,s),clarify:tj,resolveReview:(s,{cwd:a})=>fee(s,{cwd:a})}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function GJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await YN({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){V.stdout.write(`${JSON.stringify(n,null,2)} +`),V.exit(0);return}for(let o of n.created)U("pass",`created ${o}`);for(let o of n.skipped)U("skip",o);for(let o of n.proposals??[])U("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(U("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){V.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: -`);for(let[o,s]of n.clarifyingQuestions.entries())W.stdout.write(` ${o+1}. ${s} -`);W.stdout.write(` -`)}else r||n.created.some(s=>s==="docs/conventions.md")&&(W.stdout.write(` +`);for(let[o,s]of n.clarifyingQuestions.entries())V.stdout.write(` ${o+1}. ${s} +`);V.stdout.write(` +`)}else r||n.created.some(s=>s==="docs/conventions.md")&&(V.stdout.write(` \u{1F4A1} Tip: for a more precise scaffold, describe the project: -`),W.stdout.write(` clad init -`),W.stdout.write(` e.g. clad init payment SaaS for B2B -`),W.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. - -`));W.exit(0)}async function e8e(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(()=>(lde(),cde)),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}`),W.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=G(e.cwd??"."),a=n.featuresTouched.map(l=>HO(l,s)),c=`${BH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&W.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.`),W.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function t8e(t={}){try{let e=G();if(fa("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ms(".");Nl(".",r),Ha("."),l5(".");let n=Zl(".");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=dte(".");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=Fx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Vv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),W.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)`),W.exit(0);return}L("pass","sync",`${e.features.length} features valid`),W.exit(0)}catch(e){L("fail","sync",e.message),W.exit(1)}}function r8e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),W.exit(2);return}let e=f_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),W.exit(0)}function n8e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),W.exit(2);return}let r=p_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),W.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?W.stdout.write(`Run: git checkout ${r.gitHead} -`):W.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),W.exit(0)}async function i8e(t){let e=await AC({force:t.force,quiet:t.quiet});W.exit(e.errors.length>0?1:0)}async function o8e(){L("note","update","reconciling the current project after the engine upgrade");let t=await oX(".",{wireHosts:async()=>(await AC({quiet:!0})).errors.length});if(L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){L("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),W.exit(t.code);return}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);W.stdout.write(` +`),V.stdout.write(` clad init +`),V.stdout.write(` e.g. clad init payment SaaS for B2B +`),V.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. + +`));V.exit(0)}async function ZJe(t,e){U("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(()=>(lde(),cde)),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)U(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),V.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>GT(l,s)),c=`${VH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;U(i,"run",c),a.length>0&&V.stdout.write(`Touched: ${a.join(", ")} +`)}let o=n.stubsCreated.length>0;o&&U("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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function VJe(t={}){try{let e=H();if(ma("."))U("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ms(".");jl(".",r),Za("."),p5(".");let n=Zl(".");n==="created"?U("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&U("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=dte(".");for(let s of i.repaired)U("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)U("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=Lx(".");o&&U("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Vv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){U("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);U("note",`propose-archive \xB7 ${s}`,a)}U("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),V.exit(0);return}U("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){U("fail","sync",e.message),V.exit(1)}}function WJe(t){if(!t){U("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=f_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";U("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function KJe(t,e={}){if(!t){U("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=p_(".",t);if(!r){U("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}m_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";U("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?V.stdout.write(`Run: git checkout ${r.gitHead} +`):V.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. +`),V.exit(0)}async function JJe(t){let e=t.host&&t.host!=="all"?[t.host]:void 0,r=await CC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});V.exit(r.errors.length>0?1:0)}async function YJe(){U("note","update","reconciling the current project after the engine upgrade");let t=await oX(".",{wireHosts:async()=>(await CC({quiet:!0,projectRoot:"."})).errors.length});if(U(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){U("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}t.inventoryDeferred?U("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):U("pass","spec",`inventory synced \xB7 ${t.features} features`),U(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)U("note","deprecated",r);V.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),uA({tier:"pre-commit",strict:!0}).anyFailed?W.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"),W.exit(t.code)}var s8e={"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 uA(t){let e=t.tier??"all",r=t.silent===!0,n=s8e[e];if(!n)return t.json&&!r?W.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",()=>qm(i)],["stage_1.2",()=>Um(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",pj],["stage_1.5",Ka],["stage_1.6",Np],["stage_2.1",()=>$j({...i,strict:t.strict})],["stage_2.2",()=>mj(i)],["stage_2.3",WP],["stage_2.4",_j],["stage_3.1",bj],["stage_3.2",gj],["stage_3.3",kj],["stage_4.1",dj],["stage_4.2",Bm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":oi(d)?"fail":"skip",u=[];R_("."),Mee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:xa(d),h=VY(p);oi(h)&&(c=!0,a=Math.max(a,WY(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),oi(h)&&m8e(p))}}finally{P_(),qee()}if(t.strict)try{let d=G();for(let f of Nee(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"||!oi(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=>oi(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(fa("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{lG(".",G())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?W.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&W.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function a8e(t){try{let e=G(),r=rl(e,t);W.stdout.write(`${JSON.stringify(r,null,2)} -`),W.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),W.exit(1)}}function c8e(t,e={}){try{let r=G(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});W.stdout.write(`${JSON.stringify(i,null,2)} -`),W.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),W.exit(1)}}function l8e(t={}){try{let e=G(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Qv(e,o=>{try{return dde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});W.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),W.exit(0)}catch(e){L("fail","infer-deps",e.message),W.exit(1)}}function u8e(t={}){try{if(t.sessions){See(t);return}if(t.trend!==void 0&&t.trend!==!1){wee(t);return}let e=G(),n=cH(e,o=>{try{return dde(o,"utf8")}catch{return null}},"."),i=uH(".",n);if(t.json)W.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)}`,` ${nl}`];W.stdout.write(`${c.join(` +`),dA({tier:"pre-commit",strict:!0}).anyFailed?V.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"):U("pass","drift","clean against the stricter detectors"),V.exit(t.code)}var XJe={"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 dA(t){let e=t.tier??"all",r=t.silent===!0,n=XJe[e];if(!n)return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):r||U("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",()=>Um(i)],["stage_1.2",()=>zm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",yj],["stage_1.5",Ya],["stage_1.6",Dp],["stage_2.1",()=>Oj({...i,strict:t.strict})],["stage_2.2",()=>_j(i)],["stage_2.3",KP],["stage_2.4",wj],["stage_3.1",xj],["stage_3.2",vj],["stage_3.3",Tj],["stage_4.1",hj],["stage_4.2",qm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ii(d)?"fail":"skip",u=[];R_("."),Mee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:ka(d),h=WY(p);ii(h)&&(c=!0,a=Math.max(a,KY(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(U(l(h),m),ii(h)&&s8e(p))}}finally{P_(),qee()}if(t.strict)try{let d=H();for(let f of Nee(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&&U("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"||!ii(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=>ii(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&U("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(ma("."))t.json||U("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{pG(".",H())&&(t.json||U("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function QJe(t){try{let e=H(),r=nl(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} +`),V.exit("not_found"in r?1:0)}catch(e){U("fail","context",e.message),V.exit(1)}}function e8e(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} +`),V.exit("not_found"in i?1:0)}catch(r){U("fail","impact",r.message),V.exit(1)}}function t8e(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Qv(e,o=>{try{return dde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),V.exit(0)}catch(e){U("fail","infer-deps",e.message),V.exit(1)}}function r8e(t={}){try{if(t.sessions){See(t);return}if(t.trend!==void 0&&t.trend!==!1){wee(t);return}let e=H(),n=fH(e,o=>{try{return dde(o,"utf8")}catch{return null}},"."),i=mH(".",n);if(t.json)V.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)}`,` ${il}`];V.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)")}W.exit(0)}catch(e){L("fail","measure",e.message),W.exit(1)}}function d8e(t){let e;if(t.feature)try{let n=(G().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),W.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),W.exit(1)}W.exitCode=uA({...t,focusModules:e}).worst}function f8e(t){let e=TY(".",t,{checkStages:uA,onIndex:Ha,gitOpInProgress:uO});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),W.exit(e.code)}function p8e(t,e={}){let r=e.cwd??".",n;try{n=G(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),W.exit(1);return}if(e.required){t&&W.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=p5(n);if(o.length===0){W.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. -`),W.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";W.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} -`)}W.stdout.write(` +`),i.appended?U("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?U("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&U("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}V.exit(0)}catch(e){U("fail","measure",e.message),V.exit(1)}}function n8e(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(U("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){U("fail","check",r.message),V.exit(1)}V.exitCode=dA({...t,focusModules:e}).worst}function i8e(t){let e=TY(".",t,{checkStages:dA,onIndex:Za,gitOpInProgress:dT});U(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function o8e(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){U("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=y5(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),V.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";V.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} +`)}V.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),W.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"),W.exit(1);return}let i=fte(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`),W.exit(1);return}W.stdout.write(`${pte(i)} -`),W.exit(0)}function m8e(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=ude(Cf(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";W.stdout.write(` ${o}${s} [${i.detector}] -`)}n.length>3&&W.stdout.write(` \u2026 and ${n.length-3} more finding(s) +`),V.exit(s.length>0?1:0);return}if(!t){U("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),V.exit(1);return}let i=fte(n,t,e.ac,r);if(!i||i.acs.length===0){U("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),V.exit(1);return}V.stdout.write(`${pte(i)} +`),V.exit(0)}function s8e(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=ude(Cf(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] +`)}n.length>3&&V.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&W.stdout.write(` ${ude(e.trim(),160)} -`)}}function ude(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function h8e(t){let e=G();if(t.json){W.stdout.write(`${JSON.stringify(Lx(e,"."),null,2)} -`),W.exitCode=0;return}W.stdout.write(`${mte(e,".",{internal:t.internal})} -`),W.exit(0)}function g8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function y8e(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"),W.exit(1);return}let n;try{let i=G(e),o=Lx(i,e),s={gitHead:ha(e),version:Ul(),generatedAt:t.now??new Date().toISOString()},a=sl(i),c;try{let l=t.since??Qo(e),u=es(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:il(u),auditMarkdown:ol(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=tG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),W.exit(1);return}try{YJe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),W.exit(1);return}L("pass","bundle",`${r} \xB7 ${g8e(Buffer.byteLength(n,"utf8"))}`),W.exit(0)}function _8e(t){let e=OA(t);L("note",`route \u2192 ${e}`,t),W.exit(e==="unknown"?1:0)}function b8e(){let t=new Qq;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(QJe),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(e8e),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(t8e),t.command("setup").description("Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)").option("--force","overwrite directory-copy wires (Windows fallback) even when changes detected").option("--quiet","suppress stdout output").action(i8e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag").action(o8e),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(d8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(r8e),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(f8e),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)=>p8e(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(n8e),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(h8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(a8e),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)=>c8e(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=>tX(r,{checkStages:uA})),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=>l8e(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=>u8e(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=>Pee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Cee()),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=>{Dee(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=>qH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>V5(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=>y8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(_8e),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(ZY),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(XJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){kY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}J5(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(hee),t}var v8e=!!globalThis.__CLADDING_BUNDLED,S8e=v8e||import.meta.url===`file://${W.argv[1]}`;S8e&&b8e().parse();export{s8e as TIER_STAGES,b8e as createProgram,y8e as runBundleCommand,d8e as runCheckCommand,uA as runCheckStages,r8e as runCheckpointCommand,a8e as runContextCommand,f8e as runDoneCommand,c8e as runImpactCommand,l8e as runInferDepsCommand,QJe as runInitCommand,u8e as runMeasureCommand,p8e as runOracleCommand,n8e as runRollbackCommand,_8e as runRouteCommand,e8e as runRunCommand,XJe as runServeCommand,i8e as runSetupCommand,h8e as runStatusCommand,t8e as runSyncCommand,o8e as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&V.stdout.write(` ${ude(e.trim(),160)} +`)}}function ude(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function a8e(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(zx(e,"."),null,2)} +`),V.exitCode=0;return}V.stdout.write(`${mte(e,".",{internal:t.internal})} +`),V.exit(0)}function c8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function l8e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){U("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=zx(i,e),s={gitHead:ya(e),version:Ul(),generatedAt:t.now??new Date().toISOString()},a=al(i),c;try{let l=t.since??Qo(e),u=es(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:ol(u),auditMarkdown:sl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=oG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){U("fail","bundle",i.message),V.exit(1);return}try{BJe(r,n,"utf8")}catch(i){U("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}U("pass","bundle",`${r} \xB7 ${c8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function u8e(t){let e=RA(t);U("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function d8e(){let t=new n4;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(GJe),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(ZJe),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(VJe),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate all hosts (default) or one of: claude, codex, antigravity, cursor","all").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(JJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh AGENTS.md, then report stricter detector findings").action(YJe),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(n8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(WJe),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(i8e),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)=>o8e(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(KJe),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(a8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(QJe),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)=>e8e(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=>rX(r,{checkStages:dA})),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=>t8e(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=>r8e(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=>Pee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Cee()),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=>{Dee(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=>ZH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>Y5(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=>l8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(u8e),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(VY),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(HJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){EY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}eY(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(hee),t}var f8e=!!globalThis.__CLADDING_BUNDLED,p8e=f8e||import.meta.url===`file://${V.argv[1]}`;p8e&&d8e().parse();export{XJe as TIER_STAGES,d8e as createProgram,l8e as runBundleCommand,n8e as runCheckCommand,dA as runCheckStages,WJe as runCheckpointCommand,QJe as runContextCommand,i8e as runDoneCommand,e8e as runImpactCommand,t8e as runInferDepsCommand,GJe as runInitCommand,r8e as runMeasureCommand,o8e as runOracleCommand,KJe as runRollbackCommand,u8e as runRouteCommand,ZJe as runRunCommand,HJe as runServeCommand,JJe as runSetupCommand,a8e as runStatusCommand,VJe as runSyncCommand,YJe as runUpdateCommand}; diff --git a/plugins/codex/skills/init/SKILL.md b/plugins/codex/skills/init/SKILL.md index 99200e94..48a8c488 100644 --- a/plugins/codex/skills/init/SKILL.md +++ b/plugins/codex/skills/init/SKILL.md @@ -1,5 +1,5 @@ --- -description: Scaffold a Cladding workspace from a new idea, a planning document, or an existing project. Use the MCP prepare/apply flow so the current host model drafts domain-aware artifacts without requiring MCP sampling or a shell command. +description: Use only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it; never use for an ordinary project creation or implementation request. Scaffold from an idea, planning document, or existing project through the MCP prepare/apply flow. --- # Cladding init diff --git a/plugins/gemini-cli/commands/init.toml b/plugins/gemini-cli/commands/init.toml index cdae5414..596af33e 100644 --- a/plugins/gemini-cli/commands/init.toml +++ b/plugins/gemini-cli/commands/init.toml @@ -1,4 +1,4 @@ -description = "Scaffold a Cladding workspace from a new idea, a planning document, or an existing project. Use the MCP prepare/apply flow so the current host model drafts domain-aware artifacts without requiring MCP sampling or a shell command." +description = "Use only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it; never use for an ordinary project creation or implementation request. Scaffold from an idea, planning document, or existing project through the MCP prepare/apply flow." prompt = ''' # Cladding init diff --git a/skills/init/SKILL.md b/skills/init/SKILL.md index 99200e94..48a8c488 100644 --- a/skills/init/SKILL.md +++ b/skills/init/SKILL.md @@ -1,5 +1,5 @@ --- -description: Scaffold a Cladding workspace from a new idea, a planning document, or an existing project. Use the MCP prepare/apply flow so the current host model drafts domain-aware artifacts without requiring MCP sampling or a shell command. +description: Use only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it; never use for an ordinary project creation or implementation request. Scaffold from an idea, planning document, or existing project through the MCP prepare/apply flow. --- # Cladding init diff --git a/spec/features/natural-language-init-0f4dd6.yaml b/spec/features/natural-language-init-0f4dd6.yaml index 41950559..129e3cc0 100644 --- a/spec/features/natural-language-init-0f4dd6.yaml +++ b/spec/features/natural-language-init-0f4dd6.yaml @@ -64,16 +64,23 @@ acceptance_criteria: test_refs: [tests/serve/init-tools.test.ts] - id: AC-007 ears: state - condition: while clad setup wires host integrations - action: leave the current project tree unchanged and direct the user to open a project and request Cladding in natural language - response: global host setup never implies project adoption - text: While clad setup wires host integrations, the system shall leave the current project tree unchanged and direct the user to open a project and request Cladding in natural language, so global host setup never implies project adoption. + condition: while clad setup activates host integrations + action: write discovery configuration only inside the selected project and keep every other project free of Cladding skills and MCP tools + response: installing Cladding globally cannot influence unrelated host sessions + text: While clad setup activates host integrations, the system shall write discovery configuration only inside the selected project and keep every other project free of Cladding skills and MCP tools, so installing Cladding globally cannot influence unrelated host sessions. test_refs: [tests/cli/setup.test.ts] + notes: | + ## Decision + The npm package remains global, but host discovery is project-scoped. + ## Why + Host models receive every globally discovered skill description and MCP tool even when they never invoke it; prompt wording cannot provide a context-level isolation guarantee. + ## Trade-off + Each developer runs `clad setup` once per project and machine, gaining structural isolation at the cost of one explicit activation step. - id: AC-008 ears: ubiquitous action: document natural-language init as the primary path and describe each host's optional explicit invocation syntax accurately - response: Claude and Gemini use their slash command, Codex uses its Cladding skill picker, and MCP hosts use natural language - text: The system shall document natural-language init as the primary path and describe each host's optional explicit invocation syntax accurately, so Claude and Gemini use their slash command, Codex uses its Cladding skill picker, and MCP hosts use natural language. + response: Claude Code, Codex, Antigravity, and Cursor receive accurate project-scoped startup guidance + text: The system shall document natural-language init as the primary path and describe each host's project-scoped startup accurately, so Claude Code, Codex, Antigravity, and Cursor receive accurate project-scoped startup guidance. evidence_refs: [README.md, docs/setup.md] notes: | ## Decision @@ -155,8 +162,21 @@ acceptance_criteria: test_refs: [tests/serve/init-tools.test.ts] - id: AC-017 ears: state - condition: while the connected project has no spec.yaml and the user has not explicitly named Cladding - action: keep every non-init Cladding skill ineligible for ordinary development requests - response: globally installed integrations do not route unrelated work through Cladding personas - text: While the connected project has no spec.yaml and the user has not explicitly named Cladding, the system shall keep every non-init Cladding skill ineligible for ordinary development requests, so globally installed integrations do not route unrelated work through Cladding personas. - test_refs: [tests/init/skill-activation.test.ts] + condition: while an activated project has no spec.yaml and the user has not explicitly named Cladding + action: expose only the narrowly described init bootstrap and reject non-init mutations before writing + response: ordinary development remains ordinary even after setup but before explicit initialization + text: While an activated project has no spec.yaml and the user has not explicitly named Cladding, the system shall expose only the narrowly described init bootstrap and reject non-init mutations before writing, so ordinary development remains ordinary even after setup but before explicit initialization. + test_refs: [tests/init/skill-activation.test.ts, tests/cli/setup.test.ts, tests/serve/server.test.ts] + - id: AC-018 + ears: event + condition: when project-scoped setup finds a legacy global Cladding integration + action: remove only entries whose ownership is proven by a known Cladding package root or managed launch signature and preserve every ambiguous file + response: upgrading stops unrelated-project influence without deleting user configuration + text: When project-scoped setup finds a legacy global Cladding integration, the system shall remove only entries whose ownership is proven by a known Cladding package root or managed launch signature and preserve every ambiguous file, so upgrading stops unrelated-project influence without deleting user configuration. + test_refs: [tests/cli/setup.test.ts] + - id: AC-019 + ears: ubiquitous + action: use AGENTS.md as the generated cross-host instruction surface and preserve any existing CLAUDE.md without creating a new one + response: project guidance has one shared source instead of diverging host copies + text: The system shall use AGENTS.md as the generated cross-host instruction surface and preserve any existing CLAUDE.md without creating a new one, so project guidance has one shared source instead of diverging host copies. + test_refs: [tests/cli/update.test.ts, tests/cli/init-onboarding-english-source.test.ts] diff --git a/src/cli/clad.ts b/src/cli/clad.ts index fbe5b4ab..e9eaa491 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -388,16 +388,24 @@ export function runRollbackCommand(featureId: string, opts: {reason?: string} = process.exit(0); } -/** Handler for `clad setup`. Wires cladding into installed AI tool host channels. */ -export async function runSetupCommand(opts: {force?: boolean; quiet?: boolean}): Promise { - const result = await runHostSetup({force: opts.force, quiet: opts.quiet}); +/** Handler for `clad setup`. Activates Cladding only for one project. */ +export async function runSetupCommand(opts: {force?: boolean; quiet?: boolean; project?: string; host?: string}): Promise { + const hosts = opts.host && opts.host !== 'all' + ? [opts.host as 'claude' | 'codex' | 'antigravity' | 'cursor'] + : undefined; + const result = await runHostSetup({ + force: opts.force, + quiet: opts.quiet, + projectRoot: opts.project, + hosts, + }); process.exit(result.errors.length > 0 ? 1 : 0); } /** * Handler for `clad update`. The one-command "after you upgraded the engine" - * step, run from INSIDE the project you want to reconcile: re-wire hosts + - * reconcile the spec inventory + refresh the managed CLAUDE.md/AGENTS.md section + * step, run from INSIDE the project you want to reconcile: refresh its host + * wiring + reconcile the spec inventory + refresh the managed AGENTS.md section * (all safe + idempotent — see cli/update.ts), THEN run the now-stricter * detectors in REPORT mode. The drift report never blocks and never edits the * user's spec — it only surfaces the bar the upgrade raised, so `clad update` @@ -410,7 +418,7 @@ export async function runSetupCommand(opts: {force?: boolean; quiet?: boolean}): export async function runUpdateCommand(): Promise { pulse('note', 'update', 'reconciling the current project after the engine upgrade'); const r = await runUpdate('.', { - wireHosts: async () => (await runHostSetup({quiet: true})).errors.length, + wireHosts: async () => (await runHostSetup({quiet: true, projectRoot: '.'})).errors.length, }); pulse(r.wiringErrors > 0 ? 'fail' : 'pass', 'hosts', r.wiringErrors > 0 ? `${r.wiringErrors} wiring error(s)` : 're-wired'); if (!r.isProject) { @@ -423,7 +431,6 @@ export async function runUpdateCommand(): Promise { } else { pulse('pass', 'spec', `inventory synced · ${r.features} features`); } - pulse(r.claudeMd === 'refreshed-stale' ? 'note' : 'pass', 'CLAUDE.md', r.claudeMd); pulse(r.agentsMd === 'refreshed-stale' ? 'note' : 'pass', 'AGENTS.md', r.agentsMd); for (const d of r.deprecations) pulse('note', 'deprecated', d); // Surface what the now-stricter detectors flag — REPORT only, never blocks. @@ -1068,14 +1075,16 @@ export function createProgram(): Command { program .command('setup') - .description('Wire cladding into installed AI tool host channels (Claude Code / Codex / Gemini)') - .option('--force', 'overwrite directory-copy wires (Windows fallback) even when changes detected') + .description('Activate Cladding only for the current project (Claude Code / Codex / Antigravity / Cursor)') + .option('--project ', 'activate a project other than the current directory') + .option('--host ', 'activate all hosts (default) or one of: claude, codex, antigravity, cursor', 'all') + .option('--force', 'replace an existing conflicting cladding-owned project entry') .option('--quiet', 'suppress stdout output') .action(runSetupCommand); program .command('update') - .description('Run from a project dir AFTER `npm update -g cladding`: re-wire hosts + sync inventory + refresh the managed CLAUDE.md/AGENTS.md section, then report (without blocking) what the now-stricter detectors flag') + .description('Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh AGENTS.md, then report stricter detector findings') .action(runUpdateCommand); program diff --git a/src/cli/doctor-hosts.ts b/src/cli/doctor-hosts.ts index 4afa2fd4..834d969a 100644 --- a/src/cli/doctor-hosts.ts +++ b/src/cli/doctor-hosts.ts @@ -219,7 +219,7 @@ export type ServeProber = (command: string, args: readonly string[], cwd: string export interface HostSmokeOptions { /** Live prompts run only when true (CLAD_HOST_SMOKE=1 or --yes). */ readonly consent?: boolean; - /** Home directory holding ~/.cursor/mcp.json (default os.homedir()). */ + /** Home directory used only for host binary discovery and legacy diagnostics. */ readonly home?: string; /** Clock injection for deterministic artifact timestamps in tests. */ readonly now?: Date; @@ -400,29 +400,26 @@ function probePromptHost( * The prompt probe supplies the overall host grade; this adds structural MCP * evidence and catches a dead configured server before spending model tokens. * Wiring grades: - * - not-run — ~/.cursor absent (Cursor not installed here) OR no cladding - * MCP entry (not wired). Absence of evidence, never a pass. + * - not-run — no project-local Cladding MCP entry. Absence of evidence, + * never a pass. * - wiring-fail — cladding IS wired but `clad serve` does not answer tools/list. * - wiring-ok — wired AND `clad serve` answers a tools list over stdio. */ -function probeCursorWiring(home: string, cwd: string, probeServe: ServeProber): HostRecord { - const cursorDir = join(home, '.cursor'); +function probeCursorWiring(_home: string, cwd: string, probeServe: ServeProber): HostRecord { + const cursorDir = join(cwd, '.cursor'); const mcpPath = join(cursorDir, 'mcp.json'); - if (!existsSync(cursorDir)) { - return {grade: 'not-run', surfaces: [], reason: 'Cursor not detected (~/.cursor absent) — run `clad setup` to wire'}; - } if (!existsSync(mcpPath)) { - return {grade: 'not-run', surfaces: [], reason: 'no ~/.cursor/mcp.json — run `clad setup` to wire cladding'}; + return {grade: 'not-run', surfaces: [], reason: 'no project .cursor/mcp.json — run `clad setup` in this project'}; } let entry: {command?: string; args?: unknown} | undefined; try { const parsed = JSON.parse(readFileSync(mcpPath, 'utf8')) as {mcpServers?: Record}; entry = parsed.mcpServers?.cladding as {command?: string; args?: unknown} | undefined; } catch { - return {grade: 'not-run', surfaces: [], reason: '~/.cursor/mcp.json is not valid JSON'}; + return {grade: 'not-run', surfaces: [], reason: 'project .cursor/mcp.json is not valid JSON'}; } if (!entry || typeof entry.command !== 'string') { - return {grade: 'not-run', surfaces: [], reason: 'no cladding MCP entry in ~/.cursor/mcp.json — run `clad setup`'}; + return {grade: 'not-run', surfaces: [], reason: 'no Cladding entry in project .cursor/mcp.json — run `clad setup`'}; } const args = Array.isArray(entry.args) ? (entry.args as string[]) : []; const probe = probeServe(entry.command, args, cwd); @@ -434,7 +431,7 @@ function probeCursorWiring(home: string, cwd: string, probeServe: ServeProber): }; return probe.ok ? {grade: 'wiring-ok', surfaces: [surface]} - : {grade: 'wiring-fail', surfaces: [surface], reason: 'cladding is wired in ~/.cursor/mcp.json but `clad serve` did not answer tools/list'}; + : {grade: 'wiring-fail', surfaces: [surface], reason: 'Cladding is wired in project .cursor/mcp.json but its launcher did not answer tools/list'}; } /** diff --git a/src/cli/init.ts b/src/cli/init.ts index bc5a3fc2..2c83f42e 100644 --- a/src/cli/init.ts +++ b/src/cli/init.ts @@ -35,7 +35,6 @@ import { import type {ScanLlmDispatcher} from './scan/llm.js'; import {captureArtifactDigests, loadState, saveState, type OnboardingState} from './scan/onboarding-state.js'; import {detectToolchain} from '../stages/toolchain/detect.js'; -import {writeClaudeMdSection} from '../init/host-instructions.js'; import {writeSpecDrivenAgentsMd} from '../init/agents-md.js'; import {getCurrentCladdingVersion, getLastSetupVersion} from '../init/host-setup.js'; import {installGitHook} from '../init/git-hook.js'; @@ -312,7 +311,7 @@ export function hostWireNotice(lastSetup: string | null, pkgVersion: string | nu return 'host channels not wired yet — run `clad setup`, restart your AI tool, then ask it to apply Cladding to this project'; } if (pkgVersion && lastSetup !== pkgVersion) { - return `host wire was set up at v${lastSetup} (current binary v${pkgVersion}) — symlinks usually auto-follow, but run \`clad setup\` to be sure`; + return `this project's host wiring was set up at v${lastSetup} (current binary v${pkgVersion}) — run \`clad setup\` in this project to refresh its local runtime`; } return null; } @@ -590,13 +589,9 @@ export async function runInit(opts: InitOptions = {}): Promise { } } - // F-90d054 — project-local host AI instruction surfaces. - // AGENTS.md is the cross-tool entry point (Codex · Cursor · Continue · - // Copilot · Aider). CLAUDE.md is Claude Code's project memory — appended - // idempotently so existing user content is preserved. v0.4.0 — when the - // existing file carries v0.3.x markers (e.g. `_meta.enrichment_status`, - // lone `clad_create_feature MCP tool`), it is refreshed in place so AI - // sessions don't see stale guidance. + // F-90d054 — AGENTS.md is the single cross-host instruction surface. + // Existing CLAUDE.md files belong to the user and are never created or + // changed by onboarding; Claude Code reads AGENTS.md as well. // F-a4085adf (#199) — the adopter's AGENTS.md is now spec-driven: its managed // block is rendered from spec.yaml (test framework, branch, forbidden/preferred // patterns, preferred persona) + the cross-host persona→capability map, instead @@ -613,22 +608,11 @@ export async function runInit(opts: InitOptions = {}): Promise { } else { skipped.push('AGENTS.md (managed block already current)'); } - const claudeResult = writeClaudeMdSection(cwd, {force}); - if (claudeResult === 'created') { - created.push('CLAUDE.md'); - } else if (claudeResult === 'appended') { - created.push('CLAUDE.md (## cladding section appended)'); - } else if (claudeResult === 'refreshed-stale') { - created.push('CLAUDE.md (## cladding section refreshed — v0.3.x guidance replaced)'); - } else { - skipped.push('CLAUDE.md (## cladding section already present)'); - } - // F-80d19d — friendly warning when host channels were never wired or are // out of sync with the current cladding binary. `clad setup` is the explicit // command for wiring; this is informational only and does not block init. const pkgVersion = getCurrentCladdingVersion(); - const wireNotice = hostWireNotice(getLastSetupVersion(), pkgVersion); + const wireNotice = hostWireNotice(getLastSetupVersion(cwd), pkgVersion); if (wireNotice) skipped.push(wireNotice); // Phase 2 (opt-in) — ambient enforcement via a git pre-commit hook. Off diff --git a/src/cli/update.ts b/src/cli/update.ts index c621f4a5..e00e0f92 100644 --- a/src/cli/update.ts +++ b/src/cli/update.ts @@ -28,11 +28,7 @@ import {existsSync, readFileSync} from 'node:fs'; import {join} from 'node:path'; -import { - type AgentsMdResult, - type ClaudeMdResult, - writeClaudeMdSection, -} from '../init/host-instructions.js'; +import {type AgentsMdResult} from '../init/host-instructions.js'; import {type SpecAgentsMdResult, writeSpecDrivenAgentsMd} from '../init/agents-md.js'; import {computeInventory, writeInventoryToSpecYaml, writeFeatureIndex} from '../spec/inventory.js'; import {gitOperationInProgress} from '../core/git-ops.js'; @@ -52,8 +48,6 @@ export interface UpdateResult { readonly isProject: boolean; /** Count of host channels that failed to wire (0 = clean). */ readonly wiringErrors: number; - /** `writeClaudeMdSection` outcome, or `'n/a'` when not a project. */ - readonly claudeMd: ClaudeMdResult | 'n/a'; /** Spec-driven AGENTS.md outcome (mapped onto AgentsMdResult), or `'n/a'` when not a project. */ readonly agentsMd: AgentsMdResult | 'n/a'; /** Feature count from the freshly-recomputed inventory. */ @@ -100,7 +94,6 @@ export async function runUpdate(cwd: string, deps: UpdateDeps): Promise 0 ? 1 : 0, @@ -118,14 +111,13 @@ export async function runUpdate(cwd: string, deps: UpdateDeps): Promise 0 ? 1 : 0, diff --git a/src/init/host-setup.ts b/src/init/host-setup.ts index 042907e5..38be42d6 100644 --- a/src/init/host-setup.ts +++ b/src/init/host-setup.ts @@ -1,38 +1,24 @@ -// F-80d19d host setup — explicit `clad setup` command (replaces F-90d054 postinstall). +// F-80d19d / F-0f4dd6 — explicit, project-scoped host setup. // -// Wires up to four host AI auto-discovery channels, one symlink per channel: -// 1. ~/.claude/plugins/cladding → cladding pkg root -// 2. ~/.gemini/config/plugins/cladding → cladding/plugins/antigravity -// 3. ~/.agents/skills/cladding- → cladding/plugins/codex/skills/ -// 4. ~/.codex/config.toml → [mcp_servers.cladding] table merge -// -// One command handles six scenarios: -// - first wire — symlink absent → create -// - update — symlink target differs from current cladding root → re-wire -// - delta host — host AI newly installed since last setup → add wire -// - repair — symlink missing → create (same as first wire) -// - no-op — symlink target matches → skip -// - conflict — directory copy with manual changes → warn, --force required -// -// Detection — host AI is "installed" iff its host-specific home exists. Antigravity is -// detected by its config/runtime directories rather than the legacy Gemini CLI ~/.gemini -// root, so an old Gemini install is never mistaken for AGY. +// Installing the CLI globally must not make Cladding visible to every AI +// session on the machine. `clad setup` therefore writes only project-local +// discovery files. A small ignored launcher carries the machine-specific +// package path; the checked-in host configs remain portable. import { cpSync, existsSync, lstatSync, mkdirSync, - readdirSync, readFileSync, readlinkSync, + readdirSync, rmSync, statSync, - symlinkSync, writeFileSync, } from 'node:fs'; import {homedir, platform} from 'node:os'; -import {dirname, join, resolve} from 'node:path'; +import {dirname, isAbsolute, join, relative, resolve} from 'node:path'; import {fileURLToPath} from 'node:url'; import {spawnSync} from 'node:child_process'; @@ -40,26 +26,41 @@ export type ChannelResult = | 'created' | 'unchanged' | 'rewired' - | 'copied' + | 'removed' | 'skipped-different' | 'skipped-not-installed' + | 'manual-required' | 'failed'; -export interface CodexSkillResult { - readonly verb: string; - readonly result: ChannelResult; - readonly message?: string; +export type SetupHost = 'claude' | 'codex' | 'antigravity' | 'cursor'; + +export interface HostDetection { + readonly claude: boolean; + readonly antigravity: boolean; + readonly codex: boolean; + readonly agents: boolean; + readonly cursor: boolean; } export interface SetupResult { + readonly projectRoot: string; readonly wiring: { + readonly runtime: ChannelResult; + readonly shared_init_skill: ChannelResult; + readonly claude: ChannelResult; + readonly codex: ChannelResult; + readonly antigravity: ChannelResult; + readonly cursor: ChannelResult; + }; + readonly legacyCleanup: { readonly claude_plugin: ChannelResult; readonly antigravity_plugin: ChannelResult; - readonly codex_skills: ReadonlyArray; + readonly codex_skills: ChannelResult; readonly codex_mcp: ChannelResult; readonly cursor_mcp: ChannelResult; }; readonly errors: ReadonlyArray<{step: string; message: string}>; + readonly warnings: ReadonlyArray<{step: string; message: string}>; readonly statusFile: string; readonly cladding_root: string; readonly cladding_version: string; @@ -71,587 +72,468 @@ export interface SetupOptions { readonly quiet?: boolean; readonly home?: string; readonly pkgRoot?: string; + readonly projectRoot?: string; readonly version?: string; - /** Run host CLI activation commands after wiring (default true). Tests must - * pass false: activation invokes the REAL host binaries, which - * mutate the developer's actual host config — not the mocked home. */ + readonly hosts?: readonly SetupHost[]; + /** Host CLI cleanup is disabled by tests so no developer configuration is touched. */ readonly activate?: boolean; - /** Injectable activation runners so AC-012 is testable without spawning - * real host CLIs. Defaults to the real Claude activator. */ - readonly activators?: { - readonly claude?: (pluginPath: string) => ActivationResult; - }; -} - -export interface HostDetection { - readonly claude: boolean; - readonly antigravity: boolean; - readonly codex: boolean; - readonly agents: boolean; - readonly cursor: boolean; } interface SetupStatus { - cladding_root: string; - cladding_version: string; - last_run: string; - wiring: SetupResult['wiring']; - errors: SetupResult['errors']; + readonly project_root: string; + readonly cladding_root: string; + readonly cladding_version: string; + readonly last_run: string; } const STATUS_FILENAME = 'setup-status.json'; +const RUNTIME_RELATIVE = join('.cladding', 'host', 'serve.cjs'); +const ALL_HOSTS: readonly SetupHost[] = ['claude', 'codex', 'antigravity', 'cursor']; -function detectHosts(home: string): HostDetection { - return { - claude: existsSync(join(home, '.claude')), - antigravity: - existsSync(join(home, '.gemini', 'config')) || - existsSync(join(home, '.gemini', 'antigravity-cli')), - codex: existsSync(join(home, '.codex')), - agents: existsSync(join(home, '.agents')), - cursor: existsSync(join(home, '.cursor')), - }; -} - -function ensureDir(p: string): void { - mkdirSync(p, {recursive: true}); +function ensureDir(path: string): void { + mkdirSync(path, {recursive: true}); } -function resolveSymlink(linkPath: string): string | null { +function readText(path: string): string | null { try { - const target = readlinkSync(linkPath); - return resolve(dirname(linkPath), target); + return readFileSync(path, 'utf8'); } catch { return null; } } -function isSymlink(linkPath: string): boolean { - try { - const stat = lstatSync(linkPath); - return stat.isSymbolicLink(); - } catch { - return false; - } +function writeIfChanged(path: string, body: string): ChannelResult { + const previous = readText(path); + if (previous === body) return 'unchanged'; + ensureDir(dirname(path)); + writeFileSync(path, body, 'utf8'); + return previous == null ? 'created' : 'rewired'; } -/** Like existsSync but also returns true for dangling symlinks (existsSync follows targets). */ -function pathExists(linkPath: string): boolean { +function isSymlink(path: string): boolean { try { - lstatSync(linkPath); - return true; + return lstatSync(path).isSymbolicLink(); } catch { return false; } } -function wireChannel(target: string, link: string, opts: {force: boolean; isWin: boolean}): ChannelResult { - if (pathExists(link)) { - if (isSymlink(link)) { - const existing = resolveSymlink(link); - if (existing === target) return 'unchanged'; - // Symlink with different target → re-wire (safe, no user data loss) - try { - rmSync(link); - } catch { - return 'failed'; - } - // fall through to create - } else { - // Directory copy or other — could contain user customizations - if (!opts.force) return 'skipped-different'; - try { - rmSync(link, {recursive: true, force: true}); - } catch { - return 'failed'; - } - } - } - ensureDir(dirname(link)); +function resolvedSymlink(path: string): string | null { try { - symlinkSync(target, link, opts.isWin ? 'junction' : 'dir'); - return existsSync(link) ? (isSymlink(link) ? 'created' : 'created') : 'failed'; - } catch (e: unknown) { - const err = e as NodeJS.ErrnoException; - if (opts.isWin && (err.code === 'EPERM' || err.code === 'EACCES')) { - try { - cpSync(target, link, {recursive: true, dereference: true}); - return 'copied'; - } catch { - return 'failed'; - } - } - return 'failed'; + return resolve(dirname(path), readlinkSync(path)); + } catch { + return null; } } -function wireClaude(home: string, pkgRoot: string, opts: {force: boolean; isWin: boolean}): ChannelResult { - return wireChannel(pkgRoot, join(home, '.claude', 'plugins', 'cladding'), opts); +function pathInside(path: string, root: string): boolean { + const delta = relative(resolve(root), resolve(path)); + return delta === '' || (!delta.startsWith('..') && !isAbsolute(delta)); } -// Antigravity discovers plugins under ~/.gemini/config/plugins. The plugin contains -// both skills and mcp_config.json; its MCP launch remains npm-delegated to the -// globally installed `clad` command. -function wireAntigravity(home: string, pkgRoot: string, opts: {force: boolean; isWin: boolean}): ChannelResult { - return wireChannel( - join(pkgRoot, 'plugins', 'antigravity'), - join(home, '.gemini', 'config', 'plugins', 'cladding'), - opts, - ); -} - -function wireCodexSkills( - home: string, - pkgRoot: string, - opts: {force: boolean; isWin: boolean}, -): CodexSkillResult[] { - const out: CodexSkillResult[] = []; - const codexSkillsDir = join(pkgRoot, 'plugins', 'codex', 'skills'); - if (!existsSync(codexSkillsDir)) return out; - for (const verb of readdirSync(codexSkillsDir)) { - const verbPath = join(codexSkillsDir, verb); +function knownRoots(home: string, pkgRoot: string): string[] { + const roots = [resolve(pkgRoot)]; + const legacy = readText(join(home, '.cladding', STATUS_FILENAME)); + if (legacy) { try { - if (!statSync(verbPath).isDirectory()) continue; + const parsed = JSON.parse(legacy) as {cladding_root?: unknown}; + if (typeof parsed.cladding_root === 'string') roots.push(resolve(parsed.cladding_root)); } catch { - continue; - } - const linkPath = join(home, '.agents', 'skills', `cladding-${verb}`); - try { - const result = wireChannel(verbPath, linkPath, opts); - out.push({verb, result}); - } catch (e: unknown) { - const err = e as Error; - out.push({verb, result: 'failed', message: err.message}); + // A malformed advisory status file cannot establish ownership. } } - return out; -} - -/** How a host should launch the MCP server. Hosts spawn MCP servers with a - * minimal PATH, so a bare `clad` breaks for marketplace-only installs (the - * dead-server bug the Claude Code lane fixed by bundling, F-102). Prefer the - * absolute built engine under this package root — per-machine configs - * (~/.codex/config.toml, ~/.cursor/mcp.json) can carry machine paths safely. - * Fall back to the PATH-resolved verb only when no built engine exists. */ -export function resolveServeLaunch(pkgRoot: string): {command: string; args: string[]} { - const engine = join(pkgRoot, 'dist', 'clad.js'); - if (existsSync(engine)) return {command: 'node', args: [engine, 'serve']}; - return {command: 'clad', args: ['serve']}; + return [...new Set(roots)]; } -function wireCursorMcp(home: string, launch: {command: string; args: string[]}): ChannelResult { +function removeOwnedSymlink(path: string, roots: readonly string[]): ChannelResult { + if (!existsSync(path) && !isSymlink(path)) return 'unchanged'; + if (!isSymlink(path)) return 'skipped-different'; + const target = resolvedSymlink(path); + if (!target || !roots.some((root) => pathInside(target, root))) return 'skipped-different'; try { - const cursorConfigPath = join(home, '.cursor', 'mcp.json'); - ensureDir(dirname(cursorConfigPath)); - const existing = existsSync(cursorConfigPath) - ? (JSON.parse(readFileSync(cursorConfigPath, 'utf8')) as Record) - : {}; - if (!existing.mcpServers || typeof existing.mcpServers !== 'object') { - existing.mcpServers = {}; - } - const mcpServers = existing.mcpServers as Record; - const ourEntry = { - command: launch.command, - args: launch.args, - }; - const current = mcpServers.cladding as {command?: string; args?: unknown} | undefined; - const isSame = - current && - current.command === ourEntry.command && - JSON.stringify(current.args) === JSON.stringify(ourEntry.args); - if (isSame) return 'unchanged'; - const hadCurrent = current != null; - mcpServers.cladding = ourEntry; - writeFileSync(cursorConfigPath, JSON.stringify(existing, null, 2)); - return hadCurrent ? 'rewired' : 'created'; + rmSync(path, {force: true}); + return 'removed'; } catch { return 'failed'; } } -async function wireCodexMcp(home: string, launch: {command: string; args: string[]}): Promise { - try { - const codexConfigPath = join(home, '.codex', 'config.toml'); - ensureDir(dirname(codexConfigPath)); - const {parse, stringify} = await import('smol-toml'); - const existing = existsSync(codexConfigPath) - ? (parse(readFileSync(codexConfigPath, 'utf8')) as Record) - : {}; - if (!existing.mcp_servers || typeof existing.mcp_servers !== 'object') { - existing.mcp_servers = {}; - } - const mcpServers = existing.mcp_servers as Record; - const ourEntry = { - command: launch.command, - args: launch.args, - description: 'cladding MCP server (wired by `clad setup`)', - }; - const current = mcpServers.cladding as {command?: string; args?: unknown} | undefined; - const isSame = - current && - current.command === ourEntry.command && - JSON.stringify(current.args) === JSON.stringify(ourEntry.args); - if (isSame) return 'unchanged'; - const hadCurrent = current != null; - mcpServers.cladding = ourEntry; - writeFileSync(codexConfigPath, stringify(existing)); - return hadCurrent ? 'rewired' : 'created'; - } catch { - return 'failed'; +function removeOwnedCodexSkills(home: string, roots: readonly string[]): ChannelResult { + const skillsRoot = join(home, '.agents', 'skills'); + if (!existsSync(skillsRoot)) return 'unchanged'; + let removed = 0; + let conflicts = 0; + for (const name of readdirSync(skillsRoot)) { + if (!name.startsWith('cladding-')) continue; + const result = removeOwnedSymlink(join(skillsRoot, name), roots); + if (result === 'removed') removed++; + if (result === 'skipped-different') conflicts++; } + if (conflicts > 0) return 'skipped-different'; + return removed > 0 ? 'removed' : 'unchanged'; } -function readLastSetupVersion(statusFile: string): string | null { +function isKnownLaunch(value: unknown, roots: readonly string[]): boolean { + if (!value || typeof value !== 'object') return false; + const entry = value as {command?: unknown; args?: unknown; description?: unknown}; + const args = Array.isArray(entry.args) ? entry.args : []; + if (entry.command === 'clad' && args[0] === 'serve') return true; + if (typeof entry.description === 'string' && entry.description.includes('wired by `clad setup`')) return true; + if (typeof entry.description === 'string' && entry.description.includes('project-scoped by `clad setup`')) return true; + if (entry.command === 'node' && args[0] === RUNTIME_RELATIVE) return true; + return entry.command === 'node' && typeof args[0] === 'string' && roots.some((root) => pathInside(args[0] as string, root)); +} + +async function removeOwnedCodexMcp(home: string, roots: readonly string[]): Promise { + const path = join(home, '.codex', 'config.toml'); + const raw = readText(path); + if (raw == null) return 'unchanged'; try { - const raw = readFileSync(statusFile, 'utf8'); - const parsed = JSON.parse(raw) as Partial; - return parsed.cladding_version ?? null; + const {parse, stringify} = await import('smol-toml'); + const doc = parse(raw) as Record; + const servers = doc.mcp_servers as Record | undefined; + if (!servers?.cladding) return 'unchanged'; + if (!isKnownLaunch(servers.cladding, roots)) return 'skipped-different'; + delete servers.cladding; + if (Object.keys(servers).length === 0) delete doc.mcp_servers; + writeFileSync(path, stringify(doc), 'utf8'); + return 'removed'; } catch { - return null; + return 'failed'; } } -function writeStatus(statusFile: string, status: SetupStatus): void { +function removeOwnedCursorMcp(home: string, roots: readonly string[]): ChannelResult { + const path = join(home, '.cursor', 'mcp.json'); + const raw = readText(path); + if (raw == null) return 'unchanged'; try { - ensureDir(dirname(statusFile)); - writeFileSync(statusFile, JSON.stringify(status, null, 2)); + const doc = JSON.parse(raw) as Record; + const servers = doc.mcpServers as Record | undefined; + if (!servers?.cladding) return 'unchanged'; + if (!isKnownLaunch(servers.cladding, roots)) return 'skipped-different'; + delete servers.cladding; + writeFileSync(path, `${JSON.stringify(doc, null, 2)}\n`, 'utf8'); + return 'removed'; } catch { - // status file is advisory; failure here is not user-visible. + return 'failed'; } } -function formatChannelLine(name: string, result: ChannelResult, target?: string): string { - const icon = - result === 'created' || result === 'rewired' || result === 'copied' || result === 'unchanged' - ? '✓' - : result === 'skipped-not-installed' - ? '-' - : result === 'skipped-different' - ? '⚠' - : '✗'; - const label = - result === 'created' - ? 'wired' - : result === 'rewired' - ? 're-wired (updated)' - : result === 'copied' - ? 'wired (directory copy, Windows fallback)' - : result === 'unchanged' - ? 'already wired' - : result === 'skipped-not-installed' - ? 'not installed, skipped' - : result === 'skipped-different' - ? 'conflict — manual change detected, use --force' - : 'failed'; - return ` ${icon} ${name.padEnd(28)} → ${label}${target ? ` (${target})` : ''}`; -} - -const WIRED_STATES: ReadonlySet = new Set(['created', 'rewired', 'unchanged', 'copied']); - -/** Check whether a binary exists in PATH using `which` (POSIX) or `where` (Win). */ function detectBinary(name: string): boolean { - const cmd = platform() === 'win32' ? 'where' : 'which'; - const result = spawnSync(cmd, [name], {stdio: 'ignore'}); - return result.status === 0; + const command = platform() === 'win32' ? 'where' : 'which'; + return spawnSync(command, [name], {stdio: 'ignore'}).status === 0; } -/** Run a non-interactive activation command, return true on success. */ -function runActivation(command: string, args: readonly string[]): {ok: boolean; stderr: string} { - // shell:true on Windows — host CLIs install as `.cmd` - // shims that spawnSync cannot resolve without a shell, so without this the - // activation ENOENTs even though `where ` (detectBinary) found it. - const result = spawnSync(command, args, { - encoding: 'utf8', - timeout: 30_000, - shell: platform() === 'win32', - }); - return {ok: result.status === 0, stderr: result.stderr ?? ''}; +function cleanupClaudeUserPlugin(enabled: boolean): ChannelResult { + if (!enabled || !detectBinary('claude')) return 'manual-required'; + const result = spawnSync( + 'claude', + ['plugin', 'uninstall', 'claude-code@cladding', '--scope', 'user', '--keep-data'], + {encoding: 'utf8', timeout: 30_000, shell: platform() === 'win32'}, + ); + if (result.status === 0) return 'removed'; + const combined = `${result.stdout ?? ''}\n${result.stderr ?? ''}`; + return /not installed|not found/i.test(combined) ? 'unchanged' : 'manual-required'; } -export interface ActivationResult { - readonly attempted: boolean; - readonly success: boolean; - readonly stderr?: string; +function runtimeBody(pkgRoot: string): string { + const engine = join(pkgRoot, 'dist', 'clad.js'); + return [ + "'use strict';", + "const {spawn} = require('node:child_process');", + `const engine = ${JSON.stringify(engine)};`, + "const child = spawn(process.execPath, [engine, 'serve'], {cwd: process.cwd(), stdio: 'inherit'});", + "for (const signal of ['SIGINT', 'SIGTERM']) process.on(signal, () => child.kill(signal));", + "child.on('error', (error) => { console.error(`cladding MCP launcher: ${error.message}`); process.exitCode = 1; });", + "child.on('exit', (code, signal) => { process.exitCode = code ?? (signal ? 1 : 0); });", + '', + ].join('\n'); +} + +/** Keep machine-specific setup state out of a Git worktree without editing the shared .gitignore. */ +function ignoreLocalRuntime(projectRoot: string): void { + const exclude = join(projectRoot, '.git', 'info', 'exclude'); + if (!existsSync(dirname(exclude))) return; + const entries = ['/.cladding/host/', '/.cladding/setup-status.json']; + const current = readText(exclude) ?? ''; + const lines = current.split(/\r?\n/); + const missing = entries.filter((entry) => !lines.includes(entry)); + if (missing.length === 0) return; + const separator = current.length > 0 && !current.endsWith('\n') ? '\n' : ''; + writeFileSync(exclude, `${current}${separator}${missing.join('\n')}\n`, 'utf8'); +} + +/** Retained for callers that need the direct engine launch shape. */ +export function resolveServeLaunch(pkgRoot: string): {command: string; args: string[]} { + const engine = join(pkgRoot, 'dist', 'clad.js'); + return existsSync(engine) ? {command: 'node', args: [engine, 'serve']} : {command: 'clad', args: ['serve']}; } -function activateClaude(pluginPath: string): ActivationResult { - if (!detectBinary('claude')) return {attempted: false, success: false}; - const add = runActivation('claude', ['plugin', 'marketplace', 'add', pluginPath, '--scope', 'user']); - if (!add.ok) return {attempted: true, success: false, stderr: add.stderr}; - const install = runActivation('claude', ['plugin', 'install', 'claude-code@cladding', '--scope', 'user']); - return {attempted: true, success: install.ok, stderr: install.stderr}; +function mcpLaunch(): {command: string; args: string[]} { + return {command: 'node', args: [RUNTIME_RELATIVE]}; } -export interface ActivationContext { - readonly claude?: ActivationResult; +function copyManagedSkill(source: string, destination: string, force: boolean): ChannelResult { + if (!existsSync(source)) return 'failed'; + if (existsSync(destination)) { + const current = readText(join(destination, 'SKILL.md')); + const expected = readText(join(source, 'SKILL.md')); + if (current === expected) return 'unchanged'; + if (!force && current != null && !current.includes('# Cladding init')) return 'skipped-different'; + rmSync(destination, {recursive: true, force: true}); + } + ensureDir(dirname(destination)); + cpSync(source, destination, {recursive: true, dereference: true}); + return 'created'; } -function pushActivationHint( - lines: string[], - channel: 'claude' | 'antigravity' | 'codex-skills' | 'codex-mcp' | 'cursor', - wired: boolean, - activation?: ActivationContext, -): void { - if (!wired) return; - switch (channel) { - case 'claude': { - const a = activation?.claude; - if (a?.attempted && a.success) { - lines.push(' ↳ Activate: ✓ claude plugin marketplace add + install done automatically (applies after Claude Code restart)'); - } else if (a?.attempted && !a.success) { - lines.push(' ↳ Activate: ✗ auto attempt failed — manual:'); - lines.push(' `claude plugin marketplace add ~/.claude/plugins/cladding`'); - lines.push(' then `claude plugin install claude-code@cladding --scope user`'); - } else { - lines.push(' ↳ Activate (no claude binary): manual:'); - lines.push(' `claude plugin marketplace add ~/.claude/plugins/cladding`'); - lines.push(' then `claude plugin install claude-code@cladding --scope user`'); - } - break; - } - case 'antigravity': { - lines.push(' ↳ AGY auto-discovers ~/.gemini/config/plugins/ (applies after restart)'); - break; - } - case 'codex-skills': - lines.push(' ↳ Codex CLI auto-detects ~/.agents/skills/ (applies after restart)'); - break; - case 'codex-mcp': - lines.push(' ↳ the TOML entry itself registers it — no separate activation needed'); - break; - case 'cursor': - lines.push(' ↳ ~/.cursor/mcp.json itself registers it — applies after Cursor restart'); - break; +function mergeJsonMcp(path: string, launch: {command: string; args: string[]}, force: boolean): ChannelResult { + try { + const raw = readText(path); + const doc = raw == null ? {} : (JSON.parse(raw) as Record); + if (!doc.mcpServers || typeof doc.mcpServers !== 'object') doc.mcpServers = {}; + const servers = doc.mcpServers as Record; + const current = servers.cladding; + const next = {command: launch.command, args: launch.args}; + if (JSON.stringify(current) === JSON.stringify(next)) return 'unchanged'; + if (current && !force && !isKnownLaunch(current, [])) return 'skipped-different'; + servers.cladding = next; + return writeIfChanged(path, `${JSON.stringify(doc, null, 2)}\n`); + } catch { + return 'failed'; } } -function printReport( - result: SetupResult, - detection: HostDetection, - activation: ActivationContext, - opts: {quiet?: boolean}, -): void { - if (opts.quiet) return; - process.stdout.write(renderSetupReport(result, detection, activation) + '\n'); -} - -/** Pure renderer for the setup report (AC-010 — the numbered "Next steps" block). - * Separated from printReport so the guidance contract is unit-testable. */ -export function renderSetupReport( - result: SetupResult, - detection: HostDetection, - activation: ActivationContext, -): string { - const lines: string[] = []; - lines.push('cladding setup — wiring detected AI tools'); - lines.push(''); - - const claudeState = detection.claude ? result.wiring.claude_plugin : 'skipped-not-installed'; - lines.push(formatChannelLine('Claude Code', claudeState)); - pushActivationHint(lines, 'claude', WIRED_STATES.has(claudeState), activation); - - const antigravityState = detection.antigravity ? result.wiring.antigravity_plugin : 'skipped-not-installed'; - lines.push(formatChannelLine('Antigravity (AGY)', antigravityState)); - pushActivationHint(lines, 'antigravity', WIRED_STATES.has(antigravityState), activation); - - const skillsSummary = detection.agents - ? summarizeSkills(result.wiring.codex_skills) - : 'skipped-not-installed'; - lines.push( - detection.agents - ? ` ✓ ${'Codex skills'.padEnd(28)} → ${skillsSummary}` - : formatChannelLine('Codex skills', 'skipped-not-installed'), - ); - const skillsWired = detection.agents && result.wiring.codex_skills.some((s) => WIRED_STATES.has(s.result)); - pushActivationHint(lines, 'codex-skills', skillsWired); - - const codexMcpState = detection.codex ? result.wiring.codex_mcp : 'skipped-not-installed'; - lines.push(formatChannelLine('Codex MCP', codexMcpState)); - pushActivationHint(lines, 'codex-mcp', WIRED_STATES.has(codexMcpState)); - - const cursorState = detection.cursor ? result.wiring.cursor_mcp : 'skipped-not-installed'; - lines.push(formatChannelLine('Cursor', cursorState)); - pushActivationHint(lines, 'cursor', WIRED_STATES.has(cursorState)); - - lines.push(''); - const wiredCount = countWired(result.wiring, detection); - const detectedCount = countDetected(detection); - if (wiredCount === detectedCount && detectedCount > 0) { - lines.push(`${wiredCount}/${detectedCount} detected channels wired. Status: ${result.statusFile}`); - } else if (detectedCount === 0) { - lines.push('No AI tools detected. Install one of Claude Code / Codex / Antigravity / Cursor, then run this again.'); - } else { - lines.push(`${wiredCount}/${detectedCount} detected channels wired (some skipped/failed). Status: ${result.statusFile}`); - } - if (result.last_setup_version && result.last_setup_version !== result.cladding_version) { - lines.push(''); - lines.push(`(version change detected: ${result.last_setup_version} → ${result.cladding_version})`); +async function mergeCodexMcp(path: string, launch: {command: string; args: string[]}, force: boolean): Promise { + try { + const {parse, stringify} = await import('smol-toml'); + const raw = readText(path); + const doc = raw == null ? {} : (parse(raw) as Record); + if (!doc.mcp_servers || typeof doc.mcp_servers !== 'object') doc.mcp_servers = {}; + const servers = doc.mcp_servers as Record; + const current = servers.cladding; + const next = {command: launch.command, args: launch.args, description: 'cladding MCP server (project-scoped by `clad setup`)'}; + if (JSON.stringify(current) === JSON.stringify(next)) return 'unchanged'; + if (current && !force && !isKnownLaunch(current, [])) return 'skipped-different'; + servers.cladding = next; + return writeIfChanged(path, stringify(doc)); + } catch { + return 'failed'; } - lines.push(''); - lines.push('Next steps:'); - lines.push(' 1. Restart your AI tool (Claude Code / Codex / Antigravity / Cursor)'); - lines.push(' 2. Open the project directory'); - lines.push(' 3. Ask: "Apply Cladding to this project"'); - lines.push(' 4. Start building — use optional Git hooks or CI when you want automatic enforcement'); - return lines.join('\n'); } -function summarizeSkills(skills: ReadonlyArray): string { - if (skills.length === 0) return '0 verbs (skipped)'; - const counts = skills.reduce>((acc, s) => { - acc[s.result] = (acc[s.result] ?? 0) + 1; - return acc; - }, {}); - const parts: string[] = []; - if (counts.created) parts.push(`${counts.created} created`); - if (counts.rewired) parts.push(`${counts.rewired} re-wired`); - if (counts.unchanged) parts.push(`${counts.unchanged} already wired`); - if (counts.copied) parts.push(`${counts.copied} copied`); - if (counts.failed) parts.push(`${counts.failed} failed`); - if (counts['skipped-different']) parts.push(`${counts['skipped-different']} conflict`); - return `${skills.length} verb${skills.length === 1 ? '' : 's'} — ${parts.join(', ')}`; -} - -function countDetected(detection: HostDetection): number { - return ( - (detection.claude ? 1 : 0) + - (detection.antigravity ? 1 : 0) + - (detection.agents ? 1 : 0) + - (detection.codex ? 1 : 0) + - (detection.cursor ? 1 : 0) - ); +function writeCursorBootstrap(projectRoot: string): ChannelResult { + const body = [ + '---', + '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('\n'); + return writeIfChanged(join(projectRoot, '.cursor', 'rules', 'cladding-bootstrap.mdc'), body); +} + +function combine(results: readonly ChannelResult[]): ChannelResult { + if (results.includes('failed')) return 'failed'; + if (results.includes('skipped-different')) return 'skipped-different'; + if (results.includes('manual-required')) return 'manual-required'; + if (results.includes('removed')) return 'removed'; + if (results.includes('rewired')) return 'rewired'; + if (results.includes('created')) return 'created'; + return 'unchanged'; +} + +function readLastSetupVersion(statusFile: string): string | null { + try { + return (JSON.parse(readFileSync(statusFile, 'utf8')) as SetupStatus).cladding_version ?? null; + } catch { + return null; + } } -function countWired(wiring: SetupResult['wiring'], detection: HostDetection): number { - let n = 0; - const wiredStates = new Set(['created', 'rewired', 'unchanged', 'copied']); - if (detection.claude && wiredStates.has(wiring.claude_plugin)) n++; - if (detection.antigravity && wiredStates.has(wiring.antigravity_plugin)) n++; - if (detection.agents && wiring.codex_skills.some((s) => wiredStates.has(s.result))) n++; - if (detection.codex && wiredStates.has(wiring.codex_mcp)) n++; - if (detection.cursor && wiredStates.has(wiring.cursor_mcp)) n++; - return n; +function collectIssue( + result: ChannelResult, + step: string, + errors: Array<{step: string; message: string}>, + warnings: Array<{step: string; message: string}>, +): void { + if (result === 'failed') errors.push({step, message: 'project wiring failed'}); + if (result === 'skipped-different') warnings.push({step, message: 'existing non-Cladding configuration was preserved; use --force to replace only the cladding entry'}); + if (result === 'manual-required') warnings.push({step, message: 'run `claude plugin uninstall claude-code@cladding --scope user --keep-data` to remove the legacy user plugin'}); } -/** Run the `clad setup` host wiring (install + update + delta + repair). */ +/** Wire Cladding only into one project and remove provably-owned legacy globals. */ export async function runHostSetup(opts: SetupOptions = {}): Promise { const home = opts.home ?? homedir(); + const projectRoot = resolve(opts.projectRoot ?? process.cwd()); const pkgRoot = opts.pkgRoot ?? resolveDefaultPkgRoot(); - const version = opts.version ?? readCladingVersion(pkgRoot); - const isWin = platform() === 'win32'; + const version = opts.version ?? readCladdingVersion(pkgRoot); + const hosts = new Set(opts.hosts ?? ALL_HOSTS); const force = opts.force ?? false; - const statusFile = join(home, '.cladding', STATUS_FILENAME); - + const statusFile = join(projectRoot, '.cladding', STATUS_FILENAME); const lastVersion = readLastSetupVersion(statusFile); - const detection = detectHosts(home); const errors: Array<{step: string; message: string}> = []; - - const claude_plugin = detection.claude - ? wireClaude(home, pkgRoot, {force, isWin}) + const warnings: Array<{step: string; message: string}> = []; + + ensureDir(projectRoot); + ignoreLocalRuntime(projectRoot); + const runtime = writeIfChanged(join(projectRoot, RUNTIME_RELATIVE), runtimeBody(pkgRoot)); + const initSource = join(pkgRoot, 'plugins', 'codex', 'skills', 'init'); + const sharedSkill = hosts.has('codex') || hosts.has('antigravity') + ? copyManagedSkill(initSource, join(projectRoot, '.agents', 'skills', 'cladding-init'), force) + : 'unchanged'; + const launch = mcpLaunch(); + + const codex = hosts.has('codex') + ? await mergeCodexMcp(join(projectRoot, '.codex', 'config.toml'), launch, force) : 'skipped-not-installed'; - const antigravity_plugin = detection.antigravity - ? wireAntigravity(home, pkgRoot, {force, isWin}) + const antigravity = hosts.has('antigravity') + ? mergeJsonMcp(join(projectRoot, '.agents', 'mcp_config.json'), launch, force) : 'skipped-not-installed'; - const codex_skills = detection.agents ? wireCodexSkills(home, pkgRoot, {force, isWin}) : []; - const serveLaunch = resolveServeLaunch(pkgRoot); - const codex_mcp: ChannelResult = detection.codex - ? await wireCodexMcp(home, serveLaunch) + const claude = hosts.has('claude') + ? combine([ + copyManagedSkill(initSource, join(projectRoot, '.claude', 'skills', 'cladding-init'), force), + mergeJsonMcp(join(projectRoot, '.mcp.json'), launch, force), + ]) : 'skipped-not-installed'; - const cursor_mcp: ChannelResult = detection.cursor - ? wireCursorMcp(home, serveLaunch) + const cursor = hosts.has('cursor') + ? combine([ + copyManagedSkill(initSource, join(projectRoot, '.cursor', 'skills', 'cladding-init'), force), + mergeJsonMcp(join(projectRoot, '.cursor', 'mcp.json'), launch, force), + writeCursorBootstrap(projectRoot), + ]) : 'skipped-not-installed'; - for (const state of [claude_plugin, antigravity_plugin, codex_mcp, cursor_mcp]) { - if (state === 'failed') errors.push({step: state, message: 'wire failed'}); - } - for (const s of codex_skills) { - if (s.result === 'failed') errors.push({step: `codex_skill:${s.verb}`, message: s.message ?? 'wire failed'}); - } - - // Auto-activation — runs after symlink wire succeeds. Each host CLI command - // is invoked non-interactively; failures fall back to stdout instructions. - // Guarded by opts.activate: the real activators mutate the machine's actual - // host config (not the mocked home), so tests/CI must opt out. - const shouldActivate = opts.activate ?? true; - const claudeActivator = opts.activators?.claude ?? activateClaude; - const activation: ActivationContext = shouldActivate - ? { - ...(WIRED_STATES.has(claude_plugin) - ? {claude: claudeActivator(join(home, '.claude', 'plugins', 'cladding'))} - : {}), - } - : {}; + const roots = knownRoots(home, pkgRoot); + const claudePluginLink = removeOwnedSymlink(join(home, '.claude', 'plugins', 'cladding'), roots); + const claudePluginInstall = claudePluginLink === 'removed' + ? cleanupClaudeUserPlugin(opts.activate ?? true) + : 'unchanged'; + const legacyCleanup = { + claude_plugin: combine([claudePluginLink, claudePluginInstall]), + antigravity_plugin: removeOwnedSymlink(join(home, '.gemini', 'config', 'plugins', 'cladding'), roots), + codex_skills: removeOwnedCodexSkills(home, roots), + codex_mcp: await removeOwnedCodexMcp(home, roots), + cursor_mcp: removeOwnedCursorMcp(home, roots), + } as const; + + const wiring = {runtime, shared_init_skill: sharedSkill, claude, codex, antigravity, cursor}; + for (const [step, state] of Object.entries(wiring)) collectIssue(state, step, errors, warnings); + for (const [step, state] of Object.entries(legacyCleanup)) collectIssue(state, `legacy:${step}`, errors, warnings); + + ensureDir(dirname(statusFile)); + writeFileSync(statusFile, `${JSON.stringify({ + project_root: projectRoot, + cladding_root: pkgRoot, + cladding_version: version, + last_run: new Date().toISOString(), + }, null, 2)}\n`, 'utf8'); const result: SetupResult = { - wiring: {claude_plugin, antigravity_plugin, codex_skills, codex_mcp, cursor_mcp}, + projectRoot, + wiring, + legacyCleanup, errors, + warnings, statusFile, cladding_root: pkgRoot, cladding_version: version, last_setup_version: lastVersion, }; + if (!opts.quiet) process.stdout.write(`${renderSetupReport(result)}\n`); + return result; +} - writeStatus(statusFile, { - cladding_root: pkgRoot, - cladding_version: version, - last_run: new Date().toISOString(), - wiring: result.wiring, - errors, - }); +function stateLabel(state: ChannelResult): string { + switch (state) { + case 'created': return 'wired'; + case 'rewired': return 'updated'; + case 'unchanged': return 'already ready'; + case 'removed': return 'legacy global removed'; + case 'skipped-not-installed': return 'not selected'; + case 'skipped-different': return 'preserved conflict'; + case 'manual-required': return 'manual cleanup required'; + default: return 'failed'; + } +} - printReport(result, detection, activation, {quiet: opts.quiet}); - return result; +/** Render a host-neutral setup summary without exposing internal package paths. */ +export function renderSetupReport(result: SetupResult, _detection?: HostDetection): string { + void _detection; + const lines = [ + `cladding setup — project activation: ${result.projectRoot}`, + '', + ` Claude Code → ${stateLabel(result.wiring.claude)}`, + ` Codex → ${stateLabel(result.wiring.codex)}`, + ` Antigravity → ${stateLabel(result.wiring.antigravity)}`, + ` Cursor → ${stateLabel(result.wiring.cursor)}`, + ]; + const cleaned = Object.values(result.legacyCleanup).filter((state) => state === 'removed').length; + if (cleaned > 0) lines.push('', `Removed ${cleaned} legacy global Cladding wire(s).`); + for (const warning of result.warnings) lines.push(` ! ${warning.step}: ${warning.message}`); + lines.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', + ); + return lines.join('\n'); } function resolveDefaultPkgRoot(): string { - // Resolves the cladding package root from this file's location. - // ESM build outputs a single bundled dist/clad.js (see scripts/build.mjs), - // so we walk up from that file's location until we find a package.json - // whose name is "cladding". This is robust to bundlers, symlinks, and any - // future restructuring of the dist/ output. - try { - const here = fileURLToPath(import.meta.url); - let cur = dirname(here); - for (let depth = 0; depth < 6; depth++) { - const pkgPath = join(cur, 'package.json'); - try { - const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as {name?: string}; - if (pkg.name === 'cladding') return cur; - } catch { - // fallthrough - } - const parent = dirname(cur); - if (parent === cur) break; - cur = parent; + const here = fileURLToPath(import.meta.url); + let current = dirname(here); + for (let depth = 0; depth < 7; depth++) { + try { + const pkg = JSON.parse(readFileSync(join(current, 'package.json'), 'utf8')) as {name?: string}; + if (pkg.name === 'cladding') return current; + } catch { + // Continue towards the filesystem root. } - // Fallback: assume two levels up from this file (src/init/x.ts pattern). - return resolve(dirname(here), '..', '..'); - } catch { - return process.cwd(); + current = dirname(current); } + return resolve(dirname(here), '..'); } -function readCladingVersion(pkgRoot: string): string { +function readCladdingVersion(pkgRoot: string): string { try { - const pkg = JSON.parse(readFileSync(join(pkgRoot, 'package.json'), 'utf8')) as {version: string}; - return pkg.version; + return (JSON.parse(readFileSync(join(pkgRoot, 'package.json'), 'utf8')) as {version?: string}).version ?? 'unknown'; } catch { return 'unknown'; } } -/** Read the version recorded by the last `clad setup` run, or null if never run. */ -export function getLastSetupVersion(home: string = homedir()): string | null { - return readLastSetupVersion(join(home, '.cladding', STATUS_FILENAME)); +export function getCurrentCladdingVersion(): string | null { + const version = readCladdingVersion(resolveDefaultPkgRoot()); + return version === 'unknown' ? null : version; } -/** Read the current cladding binary's package.json version, or null if unreadable. */ -export function getCurrentCladdingVersion(): string | null { +export function getLastSetupVersion(projectRoot: string = process.cwd()): string | null { + return readLastSetupVersion(join(resolve(projectRoot), '.cladding', STATUS_FILENAME)); +} + +/** Exported for diagnostics and tests; setup writes all selected hosts regardless of installation. */ +export function detectHosts(home: string = homedir()): HostDetection { + return { + claude: existsSync(join(home, '.claude')), + antigravity: existsSync(join(home, '.gemini', 'config')) || existsSync(join(home, '.gemini', 'antigravity-cli')), + codex: existsSync(join(home, '.codex')), + agents: existsSync(join(home, '.agents')), + cursor: existsSync(join(home, '.cursor')), + }; +} + +/** Test-only sanity helper used to ensure copied skill roots contain directories. */ +export function isDirectory(path: string): boolean { try { - const pkgRoot = resolveDefaultPkgRoot(); - const v = readCladingVersion(pkgRoot); - return v === 'unknown' ? null : v; + return statSync(path).isDirectory(); } catch { - return null; + return false; } } diff --git a/src/serve/server.ts b/src/serve/server.ts index d42dc2e8..d75fa67c 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -262,6 +262,19 @@ function loadSpecOrError(cwd: string): {readonly spec: Spec} | {readonly error: } } +/** Deterministic mutation boundary for a setup-only workspace. */ +function requireInitialized(cwd: string): string | null { + const loaded = loadSpecOrError(cwd); + if (!('error' in loaded)) return null; + return 'cladding: not_initialized — this project has host wiring but no valid spec.yaml; ' + + 'ordinary work must remain ordinary until the user explicitly requests Cladding initialization.'; +} + +function initializedMutationBoundary(cwd: string): {isError: true; content: Array<{type: 'text'; text: string}>} | null { + const error = requireInitialized(cwd); + return error ? {isError: true, content: [{type: 'text', text: error}]} : null; +} + /** Frozen wire field (F-570a3f): bump when a tool's payload shape changes. */ const PAYLOAD_SCHEMA_VERSION = 1; @@ -498,7 +511,7 @@ function onboardingPreparationSnapshot(cwd: string): string { } const ONBOARDING_WRITE_ROOTS = [ - 'spec.yaml', '.gitignore', 'AGENTS.md', 'CLAUDE.md', + 'spec.yaml', '.gitignore', 'AGENTS.md', 'docs/conventions.md', 'docs/project-context.md', 'spec/architecture.yaml', 'spec/capabilities.yaml', 'spec/scenarios', '.cladding/onboarding', '.cladding/scan', @@ -632,7 +645,7 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp 'Create docs/project-context.md and docs/conventions.md.', 'Create .cladding/onboarding/state.yaml and append .cladding/ to .gitignore.', 'Create a managed AGENTS.md block; preserve an existing unmanaged AGENTS.md.', - 'Create or append the Cladding section in CLAUDE.md.', + 'Preserve any existing CLAUDE.md unchanged; AGENTS.md is the shared host instruction surface.', ], confirmationQuestion: `To apply these changes, reply with the exact approval phrase: ${challenge}`, approvalChallenge: challenge, @@ -1435,6 +1448,8 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp }, }, async (args) => { + const boundary = initializedMutationBoundary(cwd); + if (boundary) return boundary; const rollback = capturePathRollback(cwd, FEATURE_TRANSACTION_ROOTS); try { const result = createFeature({ @@ -1498,6 +1513,8 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp }, }, async (args) => { + const boundary = initializedMutationBoundary(cwd); + if (boundary) return boundary; try { const result = resolveDesignImpact({feature: args.feature, cwd}); syncInventory(cwd); @@ -1540,6 +1557,8 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp }, }, async (args) => { + const boundary = initializedMutationBoundary(cwd); + if (boundary) return boundary; try { const result = recordOracle({ featureId: args.featureId, @@ -1607,6 +1626,8 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp }, }, async (args) => { + const boundary = initializedMutationBoundary(cwd); + if (boundary) return boundary; try { const result = createScenario({ slug: args.slug, @@ -1660,6 +1681,8 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp }, }, async (args) => { + const boundary = initializedMutationBoundary(cwd); + if (boundary) return boundary; try { const result = linkCapability({ capability: args.capability, diff --git a/tests/cli/doctor-hosts.test.ts b/tests/cli/doctor-hosts.test.ts index 845442dc..a1a24810 100644 --- a/tests/cli/doctor-hosts.test.ts +++ b/tests/cli/doctor-hosts.test.ts @@ -427,10 +427,10 @@ describe('Cursor is headlessly verified and carries separate wiring evidence (AC }); const wireCursor = (): void => { - mkdirSync(join(home, '.cursor'), {recursive: true}); + mkdirSync(join(dir, '.cursor'), {recursive: true}); writeFileSync( - join(home, '.cursor', 'mcp.json'), - JSON.stringify({mcpServers: {cladding: {command: 'clad', args: ['serve']}}}), + join(dir, '.cursor', 'mcp.json'), + JSON.stringify({mcpServers: {cladding: {command: 'node', args: ['.cladding/host/serve.cjs']}}}), ); }; diff --git a/tests/cli/init-onboarding-english-source.test.ts b/tests/cli/init-onboarding-english-source.test.ts index e9021240..8c6a9b6e 100644 --- a/tests/cli/init-onboarding-english-source.test.ts +++ b/tests/cli/init-onboarding-english-source.test.ts @@ -60,14 +60,11 @@ describe('init-onboarding-english-source (F-5cac007a)', () => { describe('AC-002 — renderSetupReport is English single-source', () => { const result = { - wiring: { - claude_plugin: 'created', - antigravity_plugin: 'skipped-not-installed', - codex_skills: [], - codex_mcp: 'skipped-not-installed', - cursor_mcp: 'skipped-not-installed', - }, + projectRoot: '/tmp/project', + wiring: {runtime: 'created', shared_init_skill: 'created', claude: 'created', codex: 'created', antigravity: 'created', cursor: 'created'}, + legacyCleanup: {claude_plugin: 'unchanged', antigravity_plugin: 'unchanged', codex_skills: 'unchanged', codex_mcp: 'unchanged', cursor_mcp: 'unchanged'}, errors: [], + warnings: [], statusFile: '/tmp/status.json', cladding_root: '/tmp/pkg', cladding_version: '0.8.1', @@ -76,17 +73,16 @@ describe('init-onboarding-english-source (F-5cac007a)', () => { test('the wiring report ends with an English "Next steps:" block, no Hangul', () => { const detection = {claude: true, antigravity: false, codex: false, agents: false, cursor: false}; - const report = renderSetupReport(result, detection, {claude: {attempted: true, success: true}}); + const report = renderSetupReport(result, detection); expect(report).toContain('Next steps:'); - expect(report).toContain('1. Restart your AI tool'); - expect(report).toContain('Activate: ✓'); // English activation hint, not 활성화 + expect(report).toContain('1. Start a new AI session in this project directory'); expect(HANGUL.test(report)).toBe(false); }); test('the "no AI tools detected" branch is English, no Hangul', () => { const detection = {claude: false, antigravity: false, codex: false, agents: false, cursor: false}; - const report = renderSetupReport(result, detection, {}); - expect(report).toContain('No AI tools detected'); + const report = renderSetupReport(result, detection); + expect(report).toContain('project activation'); expect(HANGUL.test(report)).toBe(false); }); }); diff --git a/tests/cli/setup.test.ts b/tests/cli/setup.test.ts index d5dfcb4e..ea3ab39d 100644 --- a/tests/cli/setup.test.ts +++ b/tests/cli/setup.test.ts @@ -1,377 +1,146 @@ -// Cladding · unit tests for src/init/host-setup.ts (F-80d19d) -// -// `clad setup` is the explicit replacement for F-90d054's npm postinstall hook. -// Each AC drives at least one test case. The host home is mocked via `mkdtempSync` -// so the suite is fully isolated from the developer's real `~/.claude` etc. +// Cladding · project-scoped setup and legacy-global migration tests. import {existsSync, mkdirSync, mkdtempSync, readFileSync, readlinkSync, rmSync, symlinkSync, writeFileSync} from 'node:fs'; import {tmpdir} from 'node:os'; import {join, resolve} from 'node:path'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; -import {getCurrentCladdingVersion, getLastSetupVersion, renderSetupReport, resolveServeLaunch, runHostSetup} from '../../src/init/host-setup.js'; -import {hostWireNotice} from '../../src/cli/init.js'; +import {getLastSetupVersion, renderSetupReport, runHostSetup} from '../../src/init/host-setup.js'; -describe('runHostSetup', () => { +describe('project-scoped runHostSetup', () => { let home: string; + let project: string; let pkgRoot: string; beforeEach(() => { - home = mkdtempSync(join(tmpdir(), 'clad-setup-home-')); - pkgRoot = mkdtempSync(join(tmpdir(), 'clad-setup-pkg-')); - // Minimal pkg skeleton mirroring the real cladding layout the wirer expects. - mkdirSync(join(pkgRoot, 'plugins', 'antigravity'), {recursive: true}); + home = mkdtempSync(join(tmpdir(), 'clad-home-')); + project = mkdtempSync(join(tmpdir(), 'clad-project-')); + pkgRoot = mkdtempSync(join(tmpdir(), 'clad-pkg-')); + mkdirSync(join(pkgRoot, 'dist'), {recursive: true}); mkdirSync(join(pkgRoot, 'plugins', 'codex', 'skills', 'init'), {recursive: true}); - mkdirSync(join(pkgRoot, 'plugins', 'codex', 'skills', 'check'), {recursive: true}); - writeFileSync(join(pkgRoot, 'package.json'), JSON.stringify({version: '0.4.0'})); + writeFileSync(join(pkgRoot, 'dist', 'clad.js'), '#!/usr/bin/env node\n'); + writeFileSync(join(pkgRoot, 'package.json'), JSON.stringify({name: 'cladding', version: '0.9.0'})); + writeFileSync( + join(pkgRoot, 'plugins', 'codex', 'skills', 'init', 'SKILL.md'), + '---\ndescription: Use only when the user explicitly names Cladding and asks to initialize it.\n---\n\n# Cladding init\n', + ); }); afterEach(() => { rmSync(home, {recursive: true, force: true}); + rmSync(project, {recursive: true, force: true}); rmSync(pkgRoot, {recursive: true, force: true}); }); - // AC-001 — detected hosts wired, undetected ones skipped (no surprise dirs). - test('wires only the host channels whose home directory exists', async () => { - mkdirSync(join(home, '.claude'), {recursive: true}); - mkdirSync(join(home, '.agents'), {recursive: true}); - // Antigravity and Codex intentionally absent. + test('writes only project-local host discovery files', async () => { + const result = await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); - const result = await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); - - expect(result.wiring.claude_plugin).toBe('created'); - expect(result.wiring.antigravity_plugin).toBe('skipped-not-installed'); - expect(result.wiring.codex_mcp).toBe('skipped-not-installed'); - expect(result.wiring.codex_skills.length).toBeGreaterThan(0); - expect(existsSync(join(home, '.gemini'))).toBe(false); + expect(result.errors).toEqual([]); + expect(existsSync(join(project, '.codex', 'config.toml'))).toBe(true); + expect(existsSync(join(project, '.agents', 'mcp_config.json'))).toBe(true); + expect(existsSync(join(project, '.cursor', 'mcp.json'))).toBe(true); + expect(existsSync(join(project, '.mcp.json'))).toBe(true); + expect(existsSync(join(project, '.agents', 'skills', 'cladding-init', 'SKILL.md'))).toBe(true); + expect(existsSync(join(project, '.claude', 'skills', 'cladding-init', 'SKILL.md'))).toBe(true); + expect(existsSync(join(project, '.cursor', 'skills', 'cladding-init', 'SKILL.md'))).toBe(true); + expect(existsSync(join(home, '.agents'))).toBe(false); expect(existsSync(join(home, '.codex'))).toBe(false); }); - // AC-002 — re-running on already-wired host yields no filesystem changes. - test('second run reports already-wired without re-creating links', async () => { - mkdirSync(join(home, '.claude'), {recursive: true}); - - await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); - const result2 = await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); - - expect(result2.wiring.claude_plugin).toBe('unchanged'); - expect(result2.errors.length).toBe(0); - }); - - // AC-003 — delta: previously undetected host added later → wired on next run. - test('delta-wires a host that was not installed on the previous run', async () => { - mkdirSync(join(home, '.claude'), {recursive: true}); - const first = await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); - expect(first.wiring.antigravity_plugin).toBe('skipped-not-installed'); - - // Simulate: user installs Antigravity between the two runs. - mkdirSync(join(home, '.gemini', 'config'), {recursive: true}); - const second = await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); - - expect(second.wiring.antigravity_plugin).toBe('created'); - expect(second.wiring.claude_plugin).toBe('unchanged'); - }); - - // AC-004 — update: symlink target changed (cladding upgraded to a new path). - test('re-wires when the symlink target no longer matches the current cladding root', async () => { - mkdirSync(join(home, '.claude'), {recursive: true}); - const oldPkg = mkdtempSync(join(tmpdir(), 'clad-old-pkg-')); - writeFileSync(join(oldPkg, 'package.json'), JSON.stringify({version: '0.3.60'})); - mkdirSync(join(home, '.claude', 'plugins'), {recursive: true}); - symlinkSync(oldPkg, join(home, '.claude', 'plugins', 'cladding'), 'dir'); - - const result = await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); - - expect(['created', 'rewired']).toContain(result.wiring.claude_plugin); - const linked = readlinkSync(join(home, '.claude', 'plugins', 'cladding')); - expect(resolve(linked)).toBe(resolve(pkgRoot)); - - rmSync(oldPkg, {recursive: true, force: true}); - }); - - // AC-005 — repair: symlink deleted → re-create on next run. - test('re-creates a missing symlink as a repair', async () => { - mkdirSync(join(home, '.claude'), {recursive: true}); - await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); - - rmSync(join(home, '.claude', 'plugins', 'cladding'), {force: true}); - expect(existsSync(join(home, '.claude', 'plugins', 'cladding'))).toBe(false); - - const result = await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); - expect(result.wiring.claude_plugin).toBe('created'); - expect(existsSync(join(home, '.claude', 'plugins', 'cladding'))).toBe(true); - }); - - // AC-008 — npm install must not run any wiring code (no postinstall hook). - // This is enforced at package.json level; we sanity-check by confirming the - // exported runner is opt-in (importing the module has no filesystem effect). - test('importing host-setup does not wire anything on its own', () => { - // The module is already imported at the top of this file. If importing - // had wired anything, ~/.cladding/ would exist on the test machine — but - // this test runs against a fresh tmp home where nothing should exist - // until runHostSetup is explicitly invoked. - expect(existsSync(join(home, '.cladding'))).toBe(false); - }); - - test('setup wires only global host state and does not create project instructions', async () => { - const project = mkdtempSync(join(tmpdir(), 'clad-setup-project-')); - const previousCwd = process.cwd(); - writeFileSync(join(project, 'user-file.txt'), 'keep'); - mkdirSync(join(home, '.codex'), {recursive: true}); - - try { - process.chdir(project); - await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); - expect(existsSync(join(project, 'AGENTS.md'))).toBe(false); - expect(existsSync(join(project, 'CLAUDE.md'))).toBe(false); - expect(readFileSync(join(project, 'user-file.txt'), 'utf8')).toBe('keep'); - } finally { - process.chdir(previousCwd); - rmSync(project, {recursive: true, force: true}); - } - }); + test('keeps machine-specific runtime state out of a Git worktree', async () => { + mkdirSync(join(project, '.git', 'info'), {recursive: true}); + writeFileSync(join(project, '.git', 'info', 'exclude'), '# local excludes\n', 'utf8'); - // AC-009 — directory-copy fallback with diverged contents → skipped unless --force. - test('refuses to overwrite a non-symlink wire without --force', async () => { - mkdirSync(join(home, '.claude'), {recursive: true}); - const linkParent = join(home, '.claude', 'plugins'); - mkdirSync(linkParent, {recursive: true}); - // Simulate Win directory-copy fallback: a real directory at the link path. - mkdirSync(join(linkParent, 'cladding'), {recursive: true}); - writeFileSync(join(linkParent, 'cladding', 'user-customised.txt'), 'do not lose this'); + await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); - const result = await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); - - expect(result.wiring.claude_plugin).toBe('skipped-different'); - // User customisation is preserved. - expect(existsSync(join(linkParent, 'cladding', 'user-customised.txt'))).toBe(true); - - // --force overwrites it. - const forced = await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, force: true, activate: false}); - expect(['created', 'rewired']).toContain(forced.wiring.claude_plugin); + const exclude = readFileSync(join(project, '.git', 'info', 'exclude'), 'utf8'); + expect(exclude).toContain('/.cladding/host/'); + expect(exclude).toContain('/.cladding/setup-status.json'); }); - // Status file is written + readable via getLastSetupVersion. - test('writes setup-status.json and exposes last version via getLastSetupVersion', async () => { - mkdirSync(join(home, '.claude'), {recursive: true}); - - await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); + test('host configs use the portable project runtime rather than an npm absolute path', async () => { + await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); - const statusFile = join(home, '.cladding', 'setup-status.json'); - expect(existsSync(statusFile)).toBe(true); - const parsed = JSON.parse(readFileSync(statusFile, 'utf8')); - expect(parsed.cladding_version).toBe('0.4.0'); - expect(getLastSetupVersion(home)).toBe('0.4.0'); + const codex = readFileSync(join(project, '.codex', 'config.toml'), 'utf8'); + const cursor = readFileSync(join(project, '.cursor', 'mcp.json'), 'utf8'); + const runtime = readFileSync(join(project, '.cladding', 'host', 'serve.cjs'), 'utf8'); + expect(codex).toContain('.cladding/host/serve.cjs'); + expect(cursor).toContain('.cladding/host/serve.cjs'); + expect(codex).not.toContain(pkgRoot); + expect(runtime).toContain(join(pkgRoot, 'dist', 'clad.js')); }); - // AC-007 — version skew between setup-status.json and binary is observable. - test('records the version used at setup time so init can detect skew', async () => { - mkdirSync(join(home, '.claude'), {recursive: true}); - - await runHostSetup({home, pkgRoot, version: '0.4.0', quiet: true, activate: false}); - expect(getLastSetupVersion(home)).toBe('0.4.0'); - - // The next "setup" pretends a newer binary; the previously recorded version - // is what init reads back for the skew warning. - expect(getLastSetupVersion(home)).not.toBe('0.5.0'); - }); -}); - -describe('getCurrentCladdingVersion', () => { - // Smoke-only — resolves the real package.json from the cladding repo root. - test('returns a non-null version when run from the cladding repo', () => { - const v = getCurrentCladdingVersion(); - // Either the real version or null (CI sandboxes may not expose pkg). - expect(v === null || /^\d+\.\d+\.\d+/.test(v)).toBe(true); - }); -}); - -// ─── F-80d19d AC-011 / AC-012 / AC-010 / AC-006 / AC-007 + serve-launch (F-102 follow-up) ─── - -describe('MCP serve launch resolution', () => { - let home: string; - let pkgRoot: string; - - beforeEach(() => { - home = mkdtempSync(join(tmpdir(), 'clad-setup-home-')); - pkgRoot = mkdtempSync(join(tmpdir(), 'clad-setup-pkg-')); - mkdirSync(join(pkgRoot, 'plugins', 'antigravity'), {recursive: true}); - mkdirSync(join(pkgRoot, 'plugins', 'codex', 'skills', 'init'), {recursive: true}); - writeFileSync(join(pkgRoot, 'package.json'), JSON.stringify({version: '0.6.0'})); - }); + test('is idempotent and stores setup status under the project', async () => { + await runHostSetup({home, projectRoot: project, pkgRoot, version: '0.9.0', quiet: true, activate: false}); + const second = await runHostSetup({home, projectRoot: project, pkgRoot, version: '0.9.0', quiet: true, activate: false}); - afterEach(() => { - rmSync(home, {recursive: true, force: true}); - rmSync(pkgRoot, {recursive: true, force: true}); + expect(second.wiring.runtime).toBe('unchanged'); + expect(second.wiring.codex).toBe('unchanged'); + expect(second.wiring.cursor).toBe('unchanged'); + expect(getLastSetupVersion(project)).toBe('0.9.0'); + expect(second.statusFile).toBe(join(resolve(project), '.cladding', 'setup-status.json')); }); - test('resolves to the absolute bundled engine when dist/clad.js exists', () => { - mkdirSync(join(pkgRoot, 'dist'), {recursive: true}); - writeFileSync(join(pkgRoot, 'dist', 'clad.js'), '// bundled engine stub\n'); - - const launch = resolveServeLaunch(pkgRoot); + test('one-host setup limits the generated surfaces', async () => { + await runHostSetup({home, projectRoot: project, pkgRoot, hosts: ['codex'], quiet: true, activate: false}); - expect(launch.command).toBe('node'); - expect(launch.args[0]).toBe(join(pkgRoot, 'dist', 'clad.js')); - expect(launch.args[1]).toBe('serve'); + expect(existsSync(join(project, '.codex', 'config.toml'))).toBe(true); + expect(existsSync(join(project, '.agents', 'skills', 'cladding-init', 'SKILL.md'))).toBe(true); + expect(existsSync(join(project, '.cursor'))).toBe(false); + expect(existsSync(join(project, '.mcp.json'))).toBe(false); }); - test('falls back to PATH-resolved clad when no built engine exists', () => { - const launch = resolveServeLaunch(pkgRoot); - expect(launch).toEqual({command: 'clad', args: ['serve']}); - }); - - // AC-011 — Cursor wire merges mcpServers.cladding while preserving other entries. - test('wires Cursor mcp.json with the absolute engine, preserving existing servers', async () => { - mkdirSync(join(pkgRoot, 'dist'), {recursive: true}); - writeFileSync(join(pkgRoot, 'dist', 'clad.js'), '// bundled engine stub\n'); - mkdirSync(join(home, '.cursor'), {recursive: true}); - writeFileSync( - join(home, '.cursor', 'mcp.json'), - JSON.stringify({mcpServers: {other: {command: 'other-server', args: []}}}), - ); + test('preserves a conflicting user MCP entry unless force is explicit', async () => { + mkdirSync(join(project, '.cursor'), {recursive: true}); + writeFileSync(join(project, '.cursor', 'mcp.json'), JSON.stringify({mcpServers: {cladding: {command: 'custom'}}})); - const result = await runHostSetup({home, pkgRoot, version: '0.6.0', quiet: true, activate: false}); + const safe = await runHostSetup({home, projectRoot: project, pkgRoot, hosts: ['cursor'], quiet: true, activate: false}); + expect(safe.wiring.cursor).toBe('skipped-different'); + expect(readFileSync(join(project, '.cursor', 'mcp.json'), 'utf8')).toContain('custom'); - expect(result.wiring.cursor_mcp).toBe('created'); - const written = JSON.parse(readFileSync(join(home, '.cursor', 'mcp.json'), 'utf8')) as { - mcpServers: Record; - }; - expect(written.mcpServers.other.command).toBe('other-server'); - expect(written.mcpServers.cladding.command).toBe('node'); - expect(written.mcpServers.cladding.args[0]).toBe(join(pkgRoot, 'dist', 'clad.js')); + const forced = await runHostSetup({home, projectRoot: project, pkgRoot, hosts: ['cursor'], force: true, quiet: true, activate: false}); + expect(['created', 'rewired']).toContain(forced.wiring.cursor); + expect(readFileSync(join(project, '.cursor', 'mcp.json'), 'utf8')).toContain('.cladding/host/serve.cjs'); }); - // The dead-server bug: a PATH-resolved `clad` entry from an older setup is - // re-wired to the absolute engine on the next run. - test('re-wires a legacy PATH-resolved codex entry to the absolute engine', async () => { - mkdirSync(join(pkgRoot, 'dist'), {recursive: true}); - writeFileSync(join(pkgRoot, 'dist', 'clad.js'), '// bundled engine stub\n'); + test('removes only provably-owned legacy global wires', async () => { + mkdirSync(join(home, '.agents', 'skills'), {recursive: true}); + mkdirSync(join(home, '.gemini', 'config', 'plugins'), {recursive: true}); + symlinkSync(join(pkgRoot, 'plugins', 'codex', 'skills', 'init'), join(home, '.agents', 'skills', 'cladding-init')); + symlinkSync(pkgRoot, join(home, '.gemini', 'config', 'plugins', 'cladding')); mkdirSync(join(home, '.codex'), {recursive: true}); writeFileSync( join(home, '.codex', 'config.toml'), - '[mcp_servers.cladding]\ncommand = "clad"\nargs = ["serve"]\n', + `[mcp_servers.other]\ncommand = "other"\n\n[mcp_servers.cladding]\ncommand = "node"\nargs = [${JSON.stringify(join(pkgRoot, 'dist', 'clad.js'))}, "serve"]\n`, ); - const result = await runHostSetup({home, pkgRoot, version: '0.6.0', quiet: true, activate: false}); - - expect(result.wiring.codex_mcp).toBe('rewired'); - const toml = readFileSync(join(home, '.codex', 'config.toml'), 'utf8'); - expect(toml).toContain(join(pkgRoot, 'dist', 'clad.js')); - expect(toml).toContain('"node"'); - }); -}); - -describe('activation (AC-012) — non-interactive, injectable, opt-out', () => { - let home: string; - let pkgRoot: string; - - beforeEach(() => { - home = mkdtempSync(join(tmpdir(), 'clad-setup-home-')); - pkgRoot = mkdtempSync(join(tmpdir(), 'clad-setup-pkg-')); - mkdirSync(join(pkgRoot, 'plugins', 'antigravity'), {recursive: true}); - writeFileSync(join(pkgRoot, 'package.json'), JSON.stringify({version: '0.6.0'})); - }); - - afterEach(() => { - rmSync(home, {recursive: true, force: true}); - rmSync(pkgRoot, {recursive: true, force: true}); - }); - - test('invokes the claude activator with the wired plugin path', async () => { - mkdirSync(join(home, '.claude'), {recursive: true}); - const calls: string[] = []; - - await runHostSetup({ - home, - pkgRoot, - version: '0.6.0', - quiet: true, - activators: {claude: (p) => (calls.push(p), {attempted: true, success: true})}, - }); - - expect(calls).toEqual([join(home, '.claude', 'plugins', 'cladding')]); - }); - - test('does not activate channels that were not wired', async () => { - // No host dirs at all — nothing wired, nothing activated. - const calls: string[] = []; - - await runHostSetup({ - home, - pkgRoot, - version: '0.6.0', - quiet: true, - activators: { - claude: (p) => (calls.push(p), {attempted: true, success: true}), - }, - }); + const result = await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); - expect(calls).toEqual([]); + expect(result.legacyCleanup.codex_skills).toBe('removed'); + expect(result.legacyCleanup.antigravity_plugin).toBe('removed'); + expect(result.legacyCleanup.codex_mcp).toBe('removed'); + expect(existsSync(join(home, '.agents', 'skills', 'cladding-init'))).toBe(false); + expect(readFileSync(join(home, '.codex', 'config.toml'), 'utf8')).toContain('other'); }); - test('activate:false suppresses activation even when channels are wired', async () => { - mkdirSync(join(home, '.claude'), {recursive: true}); - const calls: string[] = []; - - await runHostSetup({ - home, - pkgRoot, - version: '0.6.0', - quiet: true, - activate: false, - activators: {claude: (p) => (calls.push(p), {attempted: true, success: true})}, - }); - - expect(calls).toEqual([]); - }); -}); - -describe('setup report (AC-010) and init wire notices (AC-006/AC-007)', () => { - test('renderSetupReport ends with the numbered "Next steps" guidance block', () => { - const result = { - wiring: { - claude_plugin: 'created', - antigravity_plugin: 'skipped-not-installed', - codex_skills: [], - codex_mcp: 'skipped-not-installed', - cursor_mcp: 'skipped-not-installed', - }, - errors: [], - statusFile: '/tmp/status.json', - cladding_root: '/tmp/pkg', - cladding_version: '0.6.0', - last_setup_version: null, - } as const; - const detection = {claude: true, antigravity: false, codex: false, agents: false, cursor: false}; - - const report = renderSetupReport(result, detection, {}); - - expect(report).toContain('Next steps:'); - expect(report).toContain('1. Restart your AI tool'); - expect(report).toContain('2. Open the project directory'); - expect(report).toContain('3. Ask: "Apply Cladding to this project"'); - expect(report).not.toContain('clad init'); - expect(report).toContain('4. Start building'); - }); - - // AC-006 — never ran `clad setup`. - test('hostWireNotice points at clad setup when no setup-status exists', () => { - const notice = hostWireNotice(null, '0.6.0'); - expect(notice).toContain('run `clad setup`'); - expect(notice).toContain('ask it to apply Cladding'); - expect(notice).not.toContain('/cladding init'); - }); - - // AC-007 — wired at an older binary version. - test('hostWireNotice flags version skew between wire and binary', () => { - const notice = hostWireNotice('0.5.1', '0.6.0'); - expect(notice).toContain('v0.5.1'); - expect(notice).toContain('v0.6.0'); - expect(notice).toContain('clad setup'); + test('preserves unowned global files with Cladding-like names', async () => { + const custom = mkdtempSync(join(tmpdir(), 'custom-plugin-')); + try { + mkdirSync(join(home, '.agents', 'skills'), {recursive: true}); + symlinkSync(custom, join(home, '.agents', 'skills', 'cladding-custom')); + const result = await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); + expect(result.legacyCleanup.codex_skills).toBe('skipped-different'); + expect(resolve(readlinkSync(join(home, '.agents', 'skills', 'cladding-custom')))).toBe(resolve(custom)); + } finally { + rmSync(custom, {recursive: true, force: true}); + } }); - test('hostWireNotice is silent when wire matches the running binary', () => { - expect(hostWireNotice('0.6.0', '0.6.0')).toBeNull(); + test('report explains the project boundary and normal post-init development', async () => { + const result = await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); + const report = renderSetupReport(result); + expect(report).toContain('project activation'); + expect(report).toContain('Start a new AI session in this project directory'); + expect(report).toContain('After initialization, develop normally in natural language'); }); }); diff --git a/tests/cli/update.test.ts b/tests/cli/update.test.ts index 66c4ce0b..8fd53a70 100644 --- a/tests/cli/update.test.ts +++ b/tests/cli/update.test.ts @@ -26,7 +26,6 @@ describe('runUpdate', () => { test('no spec.yaml → re-wires only, isProject false, no project files written', async () => { const r = await runUpdate(dir, {wireHosts: okWire}); expect(r.isProject).toBe(false); - expect(r.claudeMd).toBe('n/a'); expect(r.agentsMd).toBe('n/a'); expect(r.code).toBe(0); }); @@ -37,13 +36,13 @@ describe('runUpdate', () => { expect(r.code).toBe(1); }); - test('fresh project → inventory written, CLAUDE.md + AGENTS.md created, code 0', async () => { + test('fresh project → inventory written and AGENTS.md created without CLAUDE.md, code 0', async () => { writeFileSync(join(dir, 'spec.yaml'), SPEC); const r = await runUpdate(dir, {wireHosts: okWire}); expect(r.isProject).toBe(true); expect(r.features).toBe(0); - expect(r.claudeMd).toBe('created'); expect(r.agentsMd).toBe('created'); + expect(existsSync(join(dir, 'CLAUDE.md'))).toBe(false); expect(r.code).toBe(0); // inventory block was materialized into spec.yaml expect(readFileSync(join(dir, 'spec.yaml'), 'utf8')).toContain('inventory:'); @@ -53,7 +52,6 @@ describe('runUpdate', () => { writeFileSync(join(dir, 'spec.yaml'), SPEC); await runUpdate(dir, {wireHosts: okWire}); const r2 = await runUpdate(dir, {wireHosts: okWire}); - expect(r2.claudeMd).toBe('unchanged'); // section already present + fresh expect(r2.agentsMd).toBe('skipped-exists'); // existing, non-stale expect(r2.code).toBe(0); }); diff --git a/tests/docs-prune.test.ts b/tests/docs-prune.test.ts index 2e81b88d..b3475daf 100644 --- a/tests/docs-prune.test.ts +++ b/tests/docs-prune.test.ts @@ -132,14 +132,14 @@ describe('AC-4c28425b · deleted docs leave zero dangling references outside his } }); - test('src/init/host-setup.ts carries the Antigravity npm-delegation WHY directly above wireAntigravity', () => { + test('src/init/host-setup.ts carries the project-scoped Antigravity boundary directly', () => { const hostSetup = read('src/init/host-setup.ts'); - const fnIdx = hostSetup.indexOf('function wireAntigravity('); - expect(fnIdx, 'wireAntigravity function present').toBeGreaterThan(-1); - const before = hostSetup.slice(Math.max(0, fnIdx - 1200), fnIdx); - expect(before, 'load-bearing WHY: AGY discovery path').toContain('~/.gemini/config/plugins'); - expect(before, 'names the npm-delegated MCP launch').toContain('globally installed `clad`'); - expect(before, 'relocates the reasoning, not just a pointer to the deleted doc').not.toContain(MARKETPLACE_DOC); + expect(hostSetup, 'load-bearing WHY: global install must not leak context').toContain( + 'Installing the CLI globally must not make Cladding visible to every AI', + ); + expect(hostSetup, 'AGY uses its project MCP discovery file').toContain("'.agents', 'mcp_config.json'"); + expect(hostSetup, 'AGY shares only the project init skill').toContain("'.agents', 'skills', 'cladding-init'"); + expect(hostSetup, 'does not point back to the deleted marketplace design').not.toContain(MARKETPLACE_DOC); }); test('src/spec/types.ts J5b comment cites the ac-hash-ids shard, not the deleted doc', () => { diff --git a/tests/serve/gate-footer-unavailable.test.ts b/tests/serve/gate-footer-unavailable.test.ts index e6dd905e..fc88003a 100644 --- a/tests/serve/gate-footer-unavailable.test.ts +++ b/tests/serve/gate-footer-unavailable.test.ts @@ -28,7 +28,11 @@ describe('gateFooter — engine fault fails closed, never a fabricated GREEN', ( beforeEach(() => { dir = mkdtempSync(join(tmpdir(), 'clad-gatefooter-')); - writeFileSync(join(dir, 'spec.yaml'), 'schema: "0.1"\nproject:\n name: fixture\n', 'utf8'); + writeFileSync( + join(dir, 'spec.yaml'), + 'schema: "0.1"\nproject:\n name: fixture\n language: typescript\nfeatures: []\nscenarios: []\ncapabilities: []\n', + 'utf8', + ); mkdirSync(join(dir, 'spec', 'features'), {recursive: true}); }); diff --git a/tests/serve/init-tools.test.ts b/tests/serve/init-tools.test.ts index 192456ee..a936fb2d 100644 --- a/tests/serve/init-tools.test.ts +++ b/tests/serve/init-tools.test.ts @@ -89,7 +89,7 @@ describe('serve/server — natural-language init tools', () => { } }); - test('idea mode initializes through the shared engine and writes host instructions after spec', async () => { + test('idea mode initializes through the shared engine and writes only AGENTS.md after spec', async () => { const {client, cleanup} = await makePair(dir); try { const {token, confirmation} = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); @@ -102,7 +102,7 @@ describe('serve/server — natural-language init tools', () => { }); expect(existsSync(join(dir, 'spec.yaml'))).toBe(true); expect(existsSync(join(dir, 'AGENTS.md'))).toBe(true); - expect(existsSync(join(dir, 'CLAUDE.md'))).toBe(true); + expect(existsSync(join(dir, 'CLAUDE.md'))).toBe(false); } finally { await cleanup(); } diff --git a/tests/serve/server.test.ts b/tests/serve/server.test.ts index 37b90dd2..6abfc627 100644 --- a/tests/serve/server.test.ts +++ b/tests/serve/server.test.ts @@ -222,6 +222,17 @@ describe('serve/server — MCP read surface', () => { const msg = (r.content as Array<{text: string}>)[0].text; expect(msg, `${name} must carry the clad-init guidance`).toContain('clad init'); } + + const mutation = await client.callTool({ + name: 'clad_create_feature', + arguments: { + slug: 'must-not-exist', + design_impact: {classification: 'none', rationale: 'boundary probe'}, + }, + }); + expect(mutation.isError).toBe(true); + expect((mutation.content as Array<{text: string}>)[0].text).toContain('not_initialized'); + expect(existsSync(join(bare, 'spec'))).toBe(false); } finally { await cleanup(); rmSync(bare, {recursive: true, force: true}); From da13654d711ce5eb72f786cab1a3f2ee81b1bbb8 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 15 Jul 2026 12:07:47 +0900 Subject: [PATCH 18/28] fix(onboarding): preserve staged drafts across hosts --- README.md | 2 +- docs/dogfood/antigravity-cli-2026-07-15.md | 17 + docs/dogfood/claude-code-2026-07-15.md | 9 + docs/dogfood/codex-cli-2026-07-15.md | 26 + docs/dogfood/cursor-agent-2026-07-15.md | 16 + docs/dogfood/matrix.md | 13 +- docs/glossary.md | 1 + docs/setup.md | 21 +- plugins/antigravity/skills/init/SKILL.md | 10 +- plugins/claude-code/commands/init.md | 10 +- plugins/claude-code/dist/clad.js | 660 +++++++++--------- plugins/codex/skills/init/SKILL.md | 10 +- plugins/gemini-cli/commands/init.toml | 10 +- skills/init/SKILL.md | 10 +- .../natural-language-init-0f4dd6.yaml | 14 + src/cli/clad.ts | 2 +- src/serve/server.ts | 103 ++- tests/serve/init-tools.test.ts | 42 +- 18 files changed, 582 insertions(+), 394 deletions(-) create mode 100644 docs/dogfood/antigravity-cli-2026-07-15.md create mode 100644 docs/dogfood/claude-code-2026-07-15.md create mode 100644 docs/dogfood/codex-cli-2026-07-15.md create mode 100644 docs/dogfood/cursor-agent-2026-07-15.md diff --git a/README.md b/README.md index 8d26b9a4..211fb17d 100644 --- a/README.md +++ b/README.md @@ -306,7 +306,7 @@ Implement email sign-in, including tests. There is nothing new to memorize. For host-specific invocation, stricter Git/CI enforcement, and verified host status, see [setup details](docs/setup.md). - + diff --git a/docs/dogfood/antigravity-cli-2026-07-15.md b/docs/dogfood/antigravity-cli-2026-07-15.md new file mode 100644 index 00000000..3cd161a4 --- /dev/null +++ b/docs/dogfood/antigravity-cli-2026-07-15.md @@ -0,0 +1,17 @@ +# Antigravity CLI project-scoped onboarding campaign — 2026-07-15 + +- Host: Antigravity CLI `1.1.2` +- Transport: `.agents/mcp_config.json` → project `.cladding/host/serve.cjs` +- Result: verified + +The legacy 0.8.3 global plugin was backed up and temporarily disabled so it could not make the project wiring pass vacuously. A shell trap restored the plugin and its configuration after the campaign; the before/after configuration diff was empty. + +| Case | Result | +|---|---| +| No setup control | only the requested `greeting.txt` was created | +| Setup-only control | ordinary request completed without initialization or Cladding commentary | +| Idea | staged draft applied after a separate exact phrase; two material product questions returned | +| Complete `plan.md` | initialized with the document intent and no follow-up questions | +| Existing code | existing-adoption initialized while preserving source and tests | + +All three initialization cases passed `clad sync`, left no staged cache after apply, and wrote no authored onboarding artifact before approval. diff --git a/docs/dogfood/claude-code-2026-07-15.md b/docs/dogfood/claude-code-2026-07-15.md new file mode 100644 index 00000000..e8f3d6c7 --- /dev/null +++ b/docs/dogfood/claude-code-2026-07-15.md @@ -0,0 +1,9 @@ +# Claude Code project-scoped onboarding campaign — 2026-07-15 + +- Host: Claude Code `2.1.207` +- Authentication: OAuth login present +- Result: live model campaign blocked by the host quota + +Claude reported that the weekly model limit had been reached and would reset on July 17 at 17:00 Asia/Seoul. This is recorded as `not-run`, not a pass or a Cladding failure. + +The free structural checks did pass: project setup produced only `.claude/skills/cladding-init`, `.mcp.json`, and the ignored launcher; a direct stdio initialize + `tools/list` handshake reached that launcher and exposed `clad_stage_init`. The natural-language control and three initialization scenarios must be rerun after quota reset before this release can claim a live Claude onboarding pass. diff --git a/docs/dogfood/codex-cli-2026-07-15.md b/docs/dogfood/codex-cli-2026-07-15.md new file mode 100644 index 00000000..2d542d2e --- /dev/null +++ b/docs/dogfood/codex-cli-2026-07-15.md @@ -0,0 +1,26 @@ +# Codex CLI project-scoped onboarding campaign — 2026-07-15 + +- Host: Codex CLI `0.144.3` +- Authentication: ChatGPT subscription in an isolated `CODEX_HOME` +- Transport: trusted-repository `.codex/config.toml` → project `.cladding/host/serve.cjs` +- Result: onboarding verified after a process-per-turn defect was fixed + +## Live cases + +| Case | Result | +|---|---| +| No setup control | ordinary `greeting.txt` request completed; zero Cladding files or intervention | +| Setup-only control | ordinary request completed; only project wiring/runtime files plus `greeting.txt` existed | +| Idea | prepare → stage → separate exact approval → greenfield initialization passed | +| Complete `plan.md` | prepare → stage → fresh-process approval passed; intent preserved and no follow-up question | +| Existing code | observed adoption passed and preserved the source/test fixture | + +Every final run had no `spec.yaml` before approval, created it only after the exact phrase, removed the staged cache after apply, and passed `clad sync`. + +## Defect found and fixed + +Codex headless resume reloads without project MCP, while a fresh process loses the host-model draft. The old short-lived `/tmp` cache retained only the preparation request, so a new model turn could reinterpret the approval code as project intent. The campaign added `clad_stage_init`: the reviewed draft is now validated and retained under ignored project runtime state, and the approval tool requires the complete `APPLY CLADDING XXXXXX` reply. A fresh-process replay then applied only the staged `plan.md` draft. + +## Post-init development + +An ordinary archive-feature request created a feature shard, implementation, and four oracle files. Direct compiled execution passed 6/6 tests. The long-running host session was manually stopped while its collaborators were still finishing governance metadata; its generated `npm test` glob reported zero tests, so the post-init development case is recorded as partial rather than a full green campaign. diff --git a/docs/dogfood/cursor-agent-2026-07-15.md b/docs/dogfood/cursor-agent-2026-07-15.md new file mode 100644 index 00000000..c5dc42b2 --- /dev/null +++ b/docs/dogfood/cursor-agent-2026-07-15.md @@ -0,0 +1,16 @@ +# Cursor Agent project-scoped onboarding campaign — 2026-07-15 + +- Host: Cursor Agent `2026.07.09-a3815c0` +- Interface: headless `cursor-agent --print --trust --approve-mcps --force` +- Transport: `.cursor/mcp.json` → project `.cladding/host/serve.cjs` +- Result: verified + +| Case | Result | +|---|---| +| No setup control | only the requested `greeting.txt` was created | +| Setup-only control | ordinary request completed without initialization or Cladding commentary | +| Idea | staged draft applied after a separate exact phrase; three material product questions returned | +| Complete `plan.md` | initialized with the document intent and no follow-up questions | +| Existing code | existing-adoption initialized while preserving source and tests | + +All three initialization cases passed `clad sync`, left no staged cache after apply, and wrote no authored onboarding artifact before approval. diff --git a/docs/dogfood/matrix.md b/docs/dogfood/matrix.md index 6e7ab15f..a733060c 100644 --- a/docs/dogfood/matrix.md +++ b/docs/dogfood/matrix.md @@ -1,16 +1,16 @@ # Host support matrix - + - Cladding version: `0.8.3` -- Generated: 2026-07-14T15:01:15.000Z +- Generated: 2026-07-15T12:03:31+09:00 | Host | list-features | get-feature | run-check | wiring | Grade | |---|---|---|---|---|---| | claude | pass | pass | pass | — | verified | | antigravity | pass | pass | pass | pass | verified | -| codex | not-run | not-run | not-run | — | not-run | +| codex | pass | pass | pass | — | verified | | cursor | pass | pass | pass | pass | verified | **Legend** @@ -21,8 +21,9 @@ **Why not-run / fail** -- `antigravity`: live onboarding campaign passed; see `antigravity-cli-2026-07-14.md`. -- `codex`: binary not on PATH -- `cursor`: live Cursor Agent onboarding campaign passed; see `cursor-agent-2026-07-14.md`. +- `claude`: doctor surfaces remain verified from the prior campaign; the 2026-07-15 onboarding rerun was blocked by host quota. +- `antigravity`: project-scoped onboarding campaign passed; see `antigravity-cli-2026-07-15.md`. +- `codex`: project-scoped onboarding and all three surfaces passed; see `codex-cli-2026-07-15.md`. +- `cursor`: project-scoped onboarding campaign passed; see `cursor-agent-2026-07-15.md`. > Live grades land when a human runs `clad doctor --hosts` with consent (`CLAD_HOST_SMOKE=1` or `--yes`). Without consent this baseline records only what is checkable for free — Cursor wiring — and leaves all LLM-driven surfaces `not-run`. diff --git a/docs/glossary.md b/docs/glossary.md index 07493b80..f098211a 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -87,6 +87,7 @@ | Tool | Meaning | |---|---| | `clad_prepare_init` | Read the project and return a bounded briefing plus one-time token; never writes files. | +| `clad_stage_init` | Validate the host-model onboarding draft and cache it only as ignored project runtime state for a later approval turn. | | `clad_init` | Validate and apply the host model's structured onboarding draft. | | `clad_prepare_clarify` | Read current onboarding state and prepare a real user answer for host-model refinement. | | `clad_clarify` | Validate and apply the host model's structured refinement draft. | diff --git a/docs/setup.md b/docs/setup.md index 648af76f..1a9de22a 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -24,11 +24,13 @@ On upgrade, setup removes legacy global Cladding wires only when their ownership **Verification level (honesty note).** Claude Code's MCP/runtime surfaces and real-time intervention are verified through earlier real-usage campaigns; the natural-language onboarding -flow introduced in this release has not yet been re-run live on Claude Code and remains a pending -host campaign. Codex onboarding is live-verified for idea, planning-document, existing-project, -and uninitialized control cases. Antigravity 1.1.0 is also live-verified for all three onboarding -cases plus the uninitialized control case. Cursor Agent `2026.07.09-a3815c0` is live-verified for -the same four cases through its headless CLI and global MCP configuration. (The machine-readable +flow introduced in this release could not be re-run because the logged-in host reported its weekly +quota exhausted; project MCP handshake and tool discovery passed, but onboarding remains pending. +Codex CLI `0.144.3` is live-verified for idea, planning-document, existing-project, uninitialized +controls, and all three doctor surfaces. Antigravity `1.1.2` is live-verified for all three +onboarding cases plus both controls after disabling the legacy global plugin. Cursor Agent +`2026.07.09-a3815c0` is live-verified for the same five cases through project-local MCP wiring. +(The machine-readable claim lives in the README's `clad:host-claims` fence, which `HOST_CLAIM_DRIFT` polices against `docs/dogfood/matrix.md`; its `verified` grade covers the doctor surfaces listed in that matrix, not every release-specific onboarding campaign.) @@ -41,9 +43,12 @@ diagnostic view, but normal use starts by asking the AI to apply Cladding to the Every host follows the same portable onboarding protocol under the surface: Cladding first returns a read-only, bounded project briefing; the host's own model drafts structured onboarding data; then -Cladding validates and writes it. Follow-up answers use the same prepare/apply split. This requires -only standard MCP tool calls—not server-side sampling—and prevents incomplete, stale, or replayed -drafts from partially changing the project. +Cladding validates and stages that draft before showing the approval phrase. Staging writes only an +opaque, short-lived cache under the ignored `.cladding/host/` runtime boundary. A later host process +can therefore apply the exact reviewed draft without reconstructing it from the approval code. +Follow-up answers use the same prepare/apply safety boundary. This requires only standard MCP tool +calls—not server-side sampling—and prevents incomplete, stale, or replayed drafts from partially +changing the project. Initialization never writes immediately from the first natural-language request. The host previews the planned file operations and shows a one-time approval phrase; only a separate user reply that diff --git a/plugins/antigravity/skills/init/SKILL.md b/plugins/antigravity/skills/init/SKILL.md index 48a8c488..1bdbfcaa 100644 --- a/plugins/antigravity/skills/init/SKILL.md +++ b/plugins/antigravity/skills/init/SKILL.md @@ -8,18 +8,20 @@ Use this workflow only when the user explicitly asks to initialize, adopt, or re ## Required host workflow +If the current user message itself matches `APPLY CLADDING XXXXXX`, do not call prepare or stage again. Call `clad_init` once and copy the entire user message, including the `APPLY CLADDING` prefix, into `confirmation`. + 1. If a greenfield request has no project intent, ask for one short description. 2. Call `clad_prepare_init` with exactly one starting mode: - `idea` with the user's description. - `document` with a project-relative planning-document path. - `existing` for an existing codebase; include an optional adoption goal. -3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. -4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. -5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the draft and that reply verbatim as `confirmation`. Include the one-time token when the host retained it; process-per-turn hosts may omit it and Cladding resolves the exact challenge from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. +3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model, then call `clad_stage_init` with the preparation token and that draft. Staging validates the draft and stores only ignored runtime state under `.cladding/host/`; it does not modify authored project files. +4. Show `plannedChanges`, the staged `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the entire reply verbatim as `confirmation`—never strip the `APPLY CLADDING` prefix. Include the draft and token when the host retained them; process-per-turn hosts may omit both because Cladding resolves the exact staged draft from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. 6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. -`clad_prepare_init` is read-only. Never call prepare and apply in the same assistant turn. Only `clad_init` writes artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. +`clad_prepare_init` does not modify the workspace, and `clad_stage_init` writes only ignored runtime state. Never call stage and apply in the same assistant turn. Only `clad_init` writes authored artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. The raw CLI remains available for terminal, CI, offline, and explicitly configured SDK automation; it is not the primary host onboarding path. diff --git a/plugins/claude-code/commands/init.md b/plugins/claude-code/commands/init.md index 48a8c488..1bdbfcaa 100644 --- a/plugins/claude-code/commands/init.md +++ b/plugins/claude-code/commands/init.md @@ -8,18 +8,20 @@ Use this workflow only when the user explicitly asks to initialize, adopt, or re ## Required host workflow +If the current user message itself matches `APPLY CLADDING XXXXXX`, do not call prepare or stage again. Call `clad_init` once and copy the entire user message, including the `APPLY CLADDING` prefix, into `confirmation`. + 1. If a greenfield request has no project intent, ask for one short description. 2. Call `clad_prepare_init` with exactly one starting mode: - `idea` with the user's description. - `document` with a project-relative planning-document path. - `existing` for an existing codebase; include an optional adoption goal. -3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. -4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. -5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the draft and that reply verbatim as `confirmation`. Include the one-time token when the host retained it; process-per-turn hosts may omit it and Cladding resolves the exact challenge from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. +3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model, then call `clad_stage_init` with the preparation token and that draft. Staging validates the draft and stores only ignored runtime state under `.cladding/host/`; it does not modify authored project files. +4. Show `plannedChanges`, the staged `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the entire reply verbatim as `confirmation`—never strip the `APPLY CLADDING` prefix. Include the draft and token when the host retained them; process-per-turn hosts may omit both because Cladding resolves the exact staged draft from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. 6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. -`clad_prepare_init` is read-only. Never call prepare and apply in the same assistant turn. Only `clad_init` writes artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. +`clad_prepare_init` does not modify the workspace, and `clad_stage_init` writes only ignored runtime state. Never call stage and apply in the same assistant turn. Only `clad_init` writes authored artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. The raw CLI remains available for terminal, CI, offline, and explicitly configured SDK automation; it is not the primary host onboarding path. diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index f967aaff..dc9f7c5a 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 pde=Object.create;var fA=Object.defineProperty;var mde=Object.getOwnPropertyDescriptor;var hde=Object.getOwnPropertyNames;var gde=Object.getPrototypeOf,yde=Object.prototype.hasOwnProperty;var He=(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)fA(t,r,{get:e[r],enumerable:!0})},_de=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hde(e))!yde.call(t,i)&&i!==r&&fA(t,i,{get:()=>e[i],enumerable:!(n=mde(e,i))||n.enumerable});return t};var vt=(t,e,r)=>(r=t!=null?pde(gde(t)):{},_de(e||!t||!t.__esModule?fA(r,"default",{value:t,enumerable:!0}):r,t));var Wd=v(mA=>{var iy=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}},pA=class extends iy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};mA.CommanderError=iy;mA.InvalidArgumentError=pA});var oy=v(gA=>{var{InvalidArgumentError:bde}=Wd(),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 bde(`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 vde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}gA.Argument=hA;gA.humanReadableArgName=vde});var bA=v(_A=>{var{humanReadableArgName:Sde}=oy(),yA=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=>Sde(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 Hq(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ir=(t,e)=>{for(var r in e)hA(t,r,{get:e[r],enumerable:!0})},_de=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hde(e))!yde.call(t,i)&&i!==r&&hA(t,i,{get:()=>e[i],enumerable:!(n=mde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?pde(gde(t)):{},_de(e||!t||!t.__esModule?hA(r,"default",{value:t,enumerable:!0}):r,t));var Wd=v(yA=>{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}},gA=class extends oy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};yA.CommanderError=oy;yA.InvalidArgumentError=gA});var sy=v(bA=>{var{InvalidArgumentError:bde}=Wd(),_A=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 bde(`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 vde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}bA.Argument=_A;bA.humanReadableArgName=vde});var wA=v(SA=>{var{humanReadableArgName:Sde}=sy(),vA=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=>Sde(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 Vq(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 Hq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}_A.Help=yA;_A.stripColor=Hq});var xA=v(wA=>{var{InvalidArgumentError:wde}=Wd(),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=xde(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 wde(`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?Gq(this.name().replace(/^no-/,"")):Gq(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}},SA=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 Gq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function xde(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 Vq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}SA.Help=vA;SA.stripColor=Vq});var EA=v(kA=>{var{InvalidArgumentError:wde}=Wd(),xA=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=xde(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 wde(`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?Wq(this.name().replace(/^no-/,"")):Wq(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}},$A=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 Wq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function xde(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=vA;wA.DualOptions=SA});var Vq=v(Zq=>{function $de(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 kde(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=$de(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=xA;kA.DualOptions=$A});var Jq=v(Kq=>{function $de(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 kde(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=$de(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]}?)`:""}Zq.suggestSimilar=kde});var Yq=v(OA=>{var Ede=He("node:events").EventEmitter,$A=He("node:child_process"),so=He("node:path"),sy=He("node:fs"),Ue=He("node:process"),{Argument:Ade,humanReadableArgName:Ode}=oy(),{CommanderError:kA}=Wd(),{Help:Tde,stripColor:Rde}=bA(),{Option:Wq,DualOptions:Ide}=xA(),{suggestSimilar:Kq}=Vq(),EA=class t extends Ede{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>AA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>AA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Rde(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 Tde,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]}?)`:""}Kq.suggestSimilar=kde});var e4=v(PA=>{var Ede=He("node:events").EventEmitter,AA=He("node:child_process"),so=He("node:path"),ay=He("node:fs"),Ue=He("node:process"),{Argument:Ade,humanReadableArgName:Tde}=sy(),{CommanderError:TA}=Wd(),{Help:Ode,stripColor:Rde}=wA(),{Option:Yq,DualOptions:Pde}=EA(),{suggestSimilar:Xq}=Jq(),OA=class t extends Ede{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>RA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>RA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Rde(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 Ode,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 Ade(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 kA(e,r,n)),Ue.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 Wq(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 Wq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(sy.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 +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 TA(e,r,n)),Ue.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 Yq(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 Yq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(ay.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=so.resolve(u,d);if(sy.existsSync(f))return f;if(i.includes(so.extname(d)))return;let p=i.find(m=>sy.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=sy.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=so.resolve(so.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=so.basename(this._scriptPath,so.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(so.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Jq(Ue.execArgv).concat(r),c=$A.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=$A.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Jq(Ue.execArgv).concat(r),c=$A.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 kA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new kA(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=so.resolve(u,d);if(ay.existsSync(f))return f;if(i.includes(so.extname(d)))return;let p=i.find(m=>ay.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=ay.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=so.resolve(so.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=so.basename(this._scriptPath,so.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(so.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Qq(Ue.execArgv).concat(r),c=AA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=AA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Qq(Ue.execArgv).concat(r),c=AA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 TA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new TA(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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Ide(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=Kq(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=Kq(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=>Ode(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=so.basename(e,so.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(Ue.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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Pde(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=Xq(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=Xq(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=>Tde(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=so.basename(e,so.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(Ue.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 Jq(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 AA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}OA.Command=EA;OA.useColor=AA});var t4=v(xn=>{var{Argument:Xq}=oy(),{Command:TA}=Yq(),{CommanderError:Pde,InvalidArgumentError:Qq}=Wd(),{Help:Cde}=bA(),{Option:e4}=xA();xn.program=new TA;xn.createCommand=t=>new TA(t);xn.createOption=(t,e)=>new e4(t,e);xn.createArgument=(t,e)=>new Xq(t,e);xn.Command=TA;xn.Option=e4;xn.Argument=Xq;xn.Help=Cde;xn.CommanderError=Pde;xn.InvalidArgumentError=Qq;xn.InvalidOptionArgumentError=Qq});var Ce=v(Xt=>{"use strict";var IA=Symbol.for("yaml.alias"),o4=Symbol.for("yaml.document"),ay=Symbol.for("yaml.map"),s4=Symbol.for("yaml.pair"),PA=Symbol.for("yaml.scalar"),cy=Symbol.for("yaml.seq"),ao=Symbol.for("yaml.node.type"),Lde=t=>!!t&&typeof t=="object"&&t[ao]===IA,zde=t=>!!t&&typeof t=="object"&&t[ao]===o4,Ude=t=>!!t&&typeof t=="object"&&t[ao]===ay,qde=t=>!!t&&typeof t=="object"&&t[ao]===s4,a4=t=>!!t&&typeof t=="object"&&t[ao]===PA,Bde=t=>!!t&&typeof t=="object"&&t[ao]===cy;function c4(t){if(t&&typeof t=="object")switch(t[ao]){case ay:case cy:return!0}return!1}function Hde(t){if(t&&typeof t=="object")switch(t[ao]){case IA:case ay:case PA:case cy:return!0}return!1}var Gde=t=>(a4(t)||c4(t))&&!!t.anchor;Xt.ALIAS=IA;Xt.DOC=o4;Xt.MAP=ay;Xt.NODE_TYPE=ao;Xt.PAIR=s4;Xt.SCALAR=PA;Xt.SEQ=cy;Xt.hasAnchor=Gde;Xt.isAlias=Lde;Xt.isCollection=c4;Xt.isDocument=zde;Xt.isMap=Ude;Xt.isNode=Hde;Xt.isPair=qde;Xt.isScalar=a4;Xt.isSeq=Bde});var Kd=v(CA=>{"use strict";var Lt=Ce(),Cr=Symbol("break visit"),l4=Symbol("skip children"),xi=Symbol("remove node");function ly(t,e){let r=u4(e);Lt.isDocument(t)?Hc(null,t.contents,r,Object.freeze([t]))===xi&&(t.contents=null):Hc(null,t,r,Object.freeze([]))}ly.BREAK=Cr;ly.SKIP=l4;ly.REMOVE=xi;function Hc(t,e,r,n){let i=d4(t,e,r,n);if(Lt.isNode(i)||Lt.isPair(i))return f4(t,n,i),Hc(t,i,r,n);if(typeof i!="symbol"){if(Lt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var p4=Ce(),Zde=Kd(),Vde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Wde=t=>t.replace(/[!,[\]{}]/g,e=>Vde[e]),Jd=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+Wde(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&&p4.isNode(e.contents)){let o={};Zde.visit(e.contents,(s,a)=>{p4.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(` -`)}};Jd.defaultYaml={explicit:!1,version:"1.2"};Jd.defaultTags={"!!":"tag:yaml.org,2002:"};m4.Directives=Jd});var dy=v(Yd=>{"use strict";var h4=Ce(),Kde=Kd();function Jde(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 g4(t){let e=new Set;return Kde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function y4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Yde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=g4(t));let s=y4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(h4.isScalar(s.node)||h4.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}}Yd.anchorIsValid=Jde;Yd.anchorNames=g4;Yd.createNodeAnchors=Yde;Yd.findNewAnchor=y4});var NA=v(_4=>{"use strict";function Xd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Xde=Ce();function b4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>b4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Xde.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}v4.toJS=b4});var fy=v(w4=>{"use strict";var Qde=NA(),S4=Ce(),efe=Bo(),jA=class{constructor(e){Object.defineProperty(this,S4.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(!S4.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=efe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Qde.applyReviver(o,{"":a},"",a):a}};w4.NodeBase=jA});var Qd=v(x4=>{"use strict";var tfe=dy(),rfe=Kd(),Zc=Ce(),nfe=fy(),ife=Bo(),MA=class extends nfe.NodeBase{constructor(e){super(Zc.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=[],rfe.visit(e,{Node:(o,s)=>{(Zc.isAlias(s)||Zc.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||(ife.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=py(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(tfe.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 py(t,e,r){if(Zc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Zc.isCollection(e)){let n=0;for(let i of e.items){let o=py(t,i,r);o>n&&(n=o)}return n}else if(Zc.isPair(e)){let n=py(t,e.key,r),i=py(t,e.value,r);return Math.max(n,i)}return 1}x4.Alias=MA});var Ct=v(FA=>{"use strict";var ofe=Ce(),sfe=fy(),afe=Bo(),cfe=t=>!t||typeof t!="function"&&typeof t!="object",Ho=class extends sfe.NodeBase{constructor(e){super(ofe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:afe.toJS(this.value,e,r)}toString(){return String(this.value)}};Ho.BLOCK_FOLDED="BLOCK_FOLDED";Ho.BLOCK_LITERAL="BLOCK_LITERAL";Ho.PLAIN="PLAIN";Ho.QUOTE_DOUBLE="QUOTE_DOUBLE";Ho.QUOTE_SINGLE="QUOTE_SINGLE";FA.Scalar=Ho;FA.isScalarValue=cfe});var ef=v(k4=>{"use strict";var lfe=Qd(),ca=Ce(),$4=Ct(),ufe="tag:yaml.org,2002:";function dfe(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 ffe(t,e,r){if(ca.isDocument(t)&&(t=t.contents),ca.isNode(t))return t;if(ca.isPair(t)){let d=r.schema[ca.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 lfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=ufe+e.slice(2));let l=dfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new $4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ca.MAP]:Symbol.iterator in Object(t)?s[ca.SEQ]:s[ca.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 $4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}k4.createNode=ffe});var hy=v(my=>{"use strict";var pfe=ef(),$i=Ce(),mfe=fy();function LA(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 pfe.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 E4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,zA=class extends mfe.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=>$i.isNode(n)||$i.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(E4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if($i.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,LA(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($i.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&&$i.isScalar(o)?o.value:o:$i.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!$i.isPair(r))return!1;let n=r.value;return n==null||e&&$i.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 $i.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($i.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,LA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};my.Collection=zA;my.collectionFromPath=LA;my.isEmptyPath=E4});var tf=v(gy=>{"use strict";var hfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function UA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var gfe=(t,e,r)=>t.endsWith(` -`)?UA(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 Qq(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 RA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}PA.Command=OA;PA.useColor=RA});var i4=v(xn=>{var{Argument:t4}=sy(),{Command:IA}=e4(),{CommanderError:Ide,InvalidArgumentError:r4}=Wd(),{Help:Cde}=wA(),{Option:n4}=EA();xn.program=new IA;xn.createCommand=t=>new IA(t);xn.createOption=(t,e)=>new n4(t,e);xn.createArgument=(t,e)=>new t4(t,e);xn.Command=IA;xn.Option=n4;xn.Argument=t4;xn.Help=Cde;xn.CommanderError=Ide;xn.InvalidArgumentError=r4;xn.InvalidOptionArgumentError=r4});var Ce=v(Xt=>{"use strict";var DA=Symbol.for("yaml.alias"),c4=Symbol.for("yaml.document"),cy=Symbol.for("yaml.map"),l4=Symbol.for("yaml.pair"),NA=Symbol.for("yaml.scalar"),ly=Symbol.for("yaml.seq"),ao=Symbol.for("yaml.node.type"),Lde=t=>!!t&&typeof t=="object"&&t[ao]===DA,zde=t=>!!t&&typeof t=="object"&&t[ao]===c4,Ude=t=>!!t&&typeof t=="object"&&t[ao]===cy,qde=t=>!!t&&typeof t=="object"&&t[ao]===l4,u4=t=>!!t&&typeof t=="object"&&t[ao]===NA,Bde=t=>!!t&&typeof t=="object"&&t[ao]===ly;function d4(t){if(t&&typeof t=="object")switch(t[ao]){case cy:case ly:return!0}return!1}function Hde(t){if(t&&typeof t=="object")switch(t[ao]){case DA:case cy:case NA:case ly:return!0}return!1}var Gde=t=>(u4(t)||d4(t))&&!!t.anchor;Xt.ALIAS=DA;Xt.DOC=c4;Xt.MAP=cy;Xt.NODE_TYPE=ao;Xt.PAIR=l4;Xt.SCALAR=NA;Xt.SEQ=ly;Xt.hasAnchor=Gde;Xt.isAlias=Lde;Xt.isCollection=d4;Xt.isDocument=zde;Xt.isMap=Ude;Xt.isNode=Hde;Xt.isPair=qde;Xt.isScalar=u4;Xt.isSeq=Bde});var Kd=v(jA=>{"use strict";var zt=Ce(),Cr=Symbol("break visit"),f4=Symbol("skip children"),xi=Symbol("remove node");function uy(t,e){let r=p4(e);zt.isDocument(t)?Hc(null,t.contents,r,Object.freeze([t]))===xi&&(t.contents=null):Hc(null,t,r,Object.freeze([]))}uy.BREAK=Cr;uy.SKIP=f4;uy.REMOVE=xi;function Hc(t,e,r,n){let i=m4(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return h4(t,n,i),Hc(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var g4=Ce(),Zde=Kd(),Vde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Wde=t=>t.replace(/[!,[\]{}]/g,e=>Vde[e]),Jd=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+Wde(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&&g4.isNode(e.contents)){let o={};Zde.visit(e.contents,(s,a)=>{g4.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(` +`)}};Jd.defaultYaml={explicit:!1,version:"1.2"};Jd.defaultTags={"!!":"tag:yaml.org,2002:"};y4.Directives=Jd});var fy=v(Yd=>{"use strict";var _4=Ce(),Kde=Kd();function Jde(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 b4(t){let e=new Set;return Kde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function v4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Yde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=b4(t));let s=v4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(_4.isScalar(s.node)||_4.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}}Yd.anchorIsValid=Jde;Yd.anchorNames=b4;Yd.createNodeAnchors=Yde;Yd.findNewAnchor=v4});var FA=v(S4=>{"use strict";function Xd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Xde=Ce();function w4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>w4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Xde.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}x4.toJS=w4});var py=v(k4=>{"use strict";var Qde=FA(),$4=Ce(),efe=Bo(),LA=class{constructor(e){Object.defineProperty(this,$4.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(!$4.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=efe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Qde.applyReviver(o,{"":a},"",a):a}};k4.NodeBase=LA});var Qd=v(E4=>{"use strict";var tfe=fy(),rfe=Kd(),Zc=Ce(),nfe=py(),ife=Bo(),zA=class extends nfe.NodeBase{constructor(e){super(Zc.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=[],rfe.visit(e,{Node:(o,s)=>{(Zc.isAlias(s)||Zc.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||(ife.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(tfe.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(Zc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Zc.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(Zc.isPair(e)){let n=my(t,e.key,r),i=my(t,e.value,r);return Math.max(n,i)}return 1}E4.Alias=zA});var Ct=v(UA=>{"use strict";var ofe=Ce(),sfe=py(),afe=Bo(),cfe=t=>!t||typeof t!="function"&&typeof t!="object",Ho=class extends sfe.NodeBase{constructor(e){super(ofe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:afe.toJS(this.value,e,r)}toString(){return String(this.value)}};Ho.BLOCK_FOLDED="BLOCK_FOLDED";Ho.BLOCK_LITERAL="BLOCK_LITERAL";Ho.PLAIN="PLAIN";Ho.QUOTE_DOUBLE="QUOTE_DOUBLE";Ho.QUOTE_SINGLE="QUOTE_SINGLE";UA.Scalar=Ho;UA.isScalarValue=cfe});var ef=v(T4=>{"use strict";var lfe=Qd(),ca=Ce(),A4=Ct(),ufe="tag:yaml.org,2002:";function dfe(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 ffe(t,e,r){if(ca.isDocument(t)&&(t=t.contents),ca.isNode(t))return t;if(ca.isPair(t)){let d=r.schema[ca.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 lfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=ufe+e.slice(2));let l=dfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new A4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ca.MAP]:Symbol.iterator in Object(t)?s[ca.SEQ]:s[ca.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 A4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}T4.createNode=ffe});var gy=v(hy=>{"use strict";var pfe=ef(),$i=Ce(),mfe=py();function qA(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 pfe.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 O4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,BA=class extends mfe.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=>$i.isNode(n)||$i.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(O4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if($i.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,qA(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($i.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&&$i.isScalar(o)?o.value:o:$i.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!$i.isPair(r))return!1;let n=r.value;return n==null||e&&$i.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 $i.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($i.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,qA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};hy.Collection=BA;hy.collectionFromPath=qA;hy.isEmptyPath=O4});var tf=v(yy=>{"use strict";var hfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function HA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var gfe=(t,e,r)=>t.endsWith(` +`)?HA(r,e):r.includes(` `)?` -`+UA(r,e):(t.endsWith(" ")?"":" ")+r;gy.indentComment=UA;gy.lineComment=gfe;gy.stringifyComment=hfe});var O4=v(rf=>{"use strict";var yfe="flow",qA="block",yy="quoted";function _fe(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===qA&&(h=A4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===yy&&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===qA&&(h=A4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+HA(r,e):(t.endsWith(" ")?"":" ")+r;yy.indentComment=HA;yy.lineComment=gfe;yy.stringifyComment=hfe});var P4=v(rf=>{"use strict";var yfe="flow",GA="block",_y="quoted";function _fe(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===GA&&(h=R4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===_y&&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===GA&&(h=R4(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===yy){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 Vn=Ct(),Go=O4(),by=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),vy=t=>/^(%|---|\.\.\.)/m.test(t);function bfe(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 nf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(vy(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===_y){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 Vn=Ct(),Go=P4(),vy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Sy=t=>/^(%|---|\.\.\.)/m.test(t);function bfe(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 nf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Sy(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(HA,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{T=!0});let A=Go.foldFlowLines(`${_}${w}${p}`,l,Go.FOLD_BLOCK,O);if(!T)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,T=vy(n,!0);s!=="folded"&&e!==Vn.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{O=!0});let A=Go.foldFlowLines(`${_}${w}${p}`,l,Go.FOLD_BLOCK,T);if(!O)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} ${l}${_}${r}${p}`}function vfe(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 Vc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?Vc(o,e):_y(t,e,r,n);if(!a&&!u&&i!==Vn.Scalar.PLAIN&&o.includes(` -`))return _y(t,e,r,n);if(vy(o)){if(c==="")return e.forceBlockIndent=!0,_y(t,e,r,n);if(a&&c===l)return Vc(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 Vc(o,e)}return a?d:Go.foldFlowLines(d,c,Go.FOLD_FLOW,by(e,!1))}function Sfe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Vc(s.value,e):_y(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return nf(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return BA(s.value,e);case Vn.Scalar.PLAIN:return vfe(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}T4.stringifyString=Sfe});var sf=v(GA=>{"use strict";var wfe=dy(),Zo=Ce(),xfe=tf(),$fe=of();function kfe(t,e){let r=Object.assign({blockQuote:!0,commentString:xfe.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 Efe(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(Zo.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 Afe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Zo.isScalar(t)||Zo.isCollection(t))&&t.anchor;o&&wfe.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 Ofe(t,e,r,n){if(Zo.isPair(t))return t.toString(e,r,n);if(Zo.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=Zo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Efe(e.doc.schema.tags,o));let s=Afe(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):Zo.isScalar(o)?$fe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Zo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}GA.createStringifyContext=kfe;GA.stringify=Ofe});var C4=v(P4=>{"use strict";var co=Ce(),R4=Ct(),I4=sf(),af=tf();function Tfe({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=co.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(co.isCollection(t)||!co.isNode(t)&&typeof t=="object"){let O="With simple keys, collection cannot be used as a key value";throw new Error(O)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||co.isCollection(t)||(co.isScalar(t)?t.type===R4.Scalar.BLOCK_FOLDED||t.type===R4.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=I4.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+=af.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=af.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=af.lineComment(g,r.indent,l(f))));let b,_,S;co.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&&co.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&co.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=I4.stringify(e,r,()=>x=!0,()=>h=!0),T=" ";if(f||b||_){if(T=b?` -`:"",_){let O=l(_);T+=` -${af.indentComment(O,r.indent)}`}w===""&&!r.inFlow?T===` -`&&S&&(T=` - -`):T+=` -${r.indent}`}else if(!p&&co.isCollection(e)){let O=w[0],A=w.indexOf(` -`),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let se=!1;if(D&&(O==="&"||O==="!")){let Y=w.indexOf(" ");O==="&"&&Y!==-1&&Yh.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 Vc(o,e)}return a?d:Go.foldFlowLines(d,c,Go.FOLD_FLOW,vy(e,!1))}function Sfe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Vc(s.value,e):by(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return nf(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return ZA(s.value,e);case Vn.Scalar.PLAIN:return vfe(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}I4.stringifyString=Sfe});var sf=v(WA=>{"use strict";var wfe=fy(),Zo=Ce(),xfe=tf(),$fe=of();function kfe(t,e){let r=Object.assign({blockQuote:!0,commentString:xfe.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 Efe(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(Zo.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 Afe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Zo.isScalar(t)||Zo.isCollection(t))&&t.anchor;o&&wfe.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 Tfe(t,e,r,n){if(Zo.isPair(t))return t.toString(e,r,n);if(Zo.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=Zo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Efe(e.doc.schema.tags,o));let s=Afe(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):Zo.isScalar(o)?$fe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Zo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}WA.createStringifyContext=kfe;WA.stringify=Tfe});var j4=v(N4=>{"use strict";var co=Ce(),C4=Ct(),D4=sf(),af=tf();function Ofe({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=co.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(co.isCollection(t)||!co.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||co.isCollection(t)||(co.isScalar(t)?t.type===C4.Scalar.BLOCK_FOLDED||t.type===C4.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=D4.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+=af.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=af.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=af.lineComment(g,r.indent,l(f))));let b,_,S;co.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&&co.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&co.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=D4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +`:"",_){let T=l(_);O+=` +${af.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` +`&&S&&(O=` + +`):O+=` +${r.indent}`}else if(!p&&co.isCollection(e)){let T=w[0],A=w.indexOf(` +`),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let se=!1;if(D&&(T==="&"||T==="!")){let Y=w.indexOf(" ");T==="&"&&Y!==-1&&Y{"use strict";var D4=He("process");function Rfe(t,...e){t==="debug"&&console.log(...e)}function Ife(t,e){(t==="debug"||t==="warn")&&(typeof D4.emitWarning=="function"?D4.emitWarning(e):console.warn(e))}ZA.debug=Rfe;ZA.warn=Ife});var ky=v($y=>{"use strict";var xy=Ce(),N4=Ct(),Sy="<<",wy={identify:t=>t===Sy||typeof t=="symbol"&&t.description===Sy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new N4.Scalar(Symbol(Sy)),{addToJSMap:j4}),stringify:()=>Sy},Pfe=(t,e)=>(wy.identify(e)||xy.isScalar(e)&&(!e.type||e.type===N4.Scalar.PLAIN)&&wy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===wy.tag&&r.default);function j4(t,e,r){let n=M4(t,r);if(xy.isSeq(n))for(let i of n.items)WA(t,e,i);else if(Array.isArray(n))for(let i of n)WA(t,e,i);else WA(t,e,n)}function WA(t,e,r){let n=M4(t,r);if(!xy.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 M4(t,e){return t&&xy.isAlias(e)?e.resolve(t.doc,t):e}$y.addMergeToJSMap=j4;$y.isMergeKey=Pfe;$y.merge=wy});var JA=v(z4=>{"use strict";var Cfe=VA(),F4=ky(),Dfe=sf(),L4=Ce(),KA=Bo();function Nfe(t,e,{key:r,value:n}){if(L4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(F4.isMergeKey(t,r))F4.addMergeToJSMap(t,e,n);else{let i=KA.toJS(r,"",t);if(e instanceof Map)e.set(i,KA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=jfe(r,i,t),s=KA.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 jfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(L4.isNode(t)&&r?.doc){let n=Dfe.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)+'..."'),Cfe.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)}z4.addPairToJSMap=Nfe});var Vo=v(YA=>{"use strict";var U4=ef(),Mfe=C4(),Ffe=JA(),Ey=Ce();function Lfe(t,e,r){let n=U4.createNode(t,void 0,r),i=U4.createNode(e,void 0,r);return new Ay(n,i)}var Ay=class t{constructor(e,r=null){Object.defineProperty(this,Ey.NODE_TYPE,{value:Ey.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Ey.isNode(r)&&(r=r.clone(e)),Ey.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Ffe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Mfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};YA.Pair=Ay;YA.createPair=Lfe});var XA=v(B4=>{"use strict";var la=Ce(),q4=sf(),Oy=tf();function zfe(t,e,r){return(e.inFlow??t.flow?qfe:Ufe)(t,e,r)}function Ufe({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+=Oy.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 M4=He("process");function Rfe(t,...e){t==="debug"&&console.log(...e)}function Pfe(t,e){(t==="debug"||t==="warn")&&(typeof M4.emitWarning=="function"?M4.emitWarning(e):console.warn(e))}KA.debug=Rfe;KA.warn=Pfe});var Ey=v(ky=>{"use strict";var $y=Ce(),F4=Ct(),wy="<<",xy={identify:t=>t===wy||typeof t=="symbol"&&t.description===wy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new F4.Scalar(Symbol(wy)),{addToJSMap:L4}),stringify:()=>wy},Ife=(t,e)=>(xy.identify(e)||$y.isScalar(e)&&(!e.type||e.type===F4.Scalar.PLAIN)&&xy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===xy.tag&&r.default);function L4(t,e,r){let n=z4(t,r);if($y.isSeq(n))for(let i of n.items)YA(t,e,i);else if(Array.isArray(n))for(let i of n)YA(t,e,i);else YA(t,e,n)}function YA(t,e,r){let n=z4(t,r);if(!$y.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 z4(t,e){return t&&$y.isAlias(e)?e.resolve(t.doc,t):e}ky.addMergeToJSMap=L4;ky.isMergeKey=Ife;ky.merge=xy});var QA=v(B4=>{"use strict";var Cfe=JA(),U4=Ey(),Dfe=sf(),q4=Ce(),XA=Bo();function Nfe(t,e,{key:r,value:n}){if(q4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(U4.isMergeKey(t,r))U4.addMergeToJSMap(t,e,n);else{let i=XA.toJS(r,"",t);if(e instanceof Map)e.set(i,XA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=jfe(r,i,t),s=XA.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 jfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(q4.isNode(t)&&r?.doc){let n=Dfe.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)+'..."'),Cfe.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)}B4.addPairToJSMap=Nfe});var Vo=v(eT=>{"use strict";var H4=ef(),Mfe=j4(),Ffe=QA(),Ay=Ce();function Lfe(t,e,r){let n=H4.createNode(t,void 0,r),i=H4.createNode(e,void 0,r);return new Ty(n,i)}var Ty=class t{constructor(e,r=null){Object.defineProperty(this,Ay.NODE_TYPE,{value:Ay.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Ay.isNode(r)&&(r=r.clone(e)),Ay.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Ffe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Mfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};eT.Pair=Ty;eT.createPair=Lfe});var tT=v(Z4=>{"use strict";var la=Ce(),G4=sf(),Oy=tf();function zfe(t,e,r){return(e.inFlow??t.flow?qfe:Ufe)(t,e,r)}function Ufe({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+=Oy.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(` +`+Oy.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function qfe({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+=Oy.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 Ty({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Oy.indentComment(e(n),t);r.push(o.trimStart())}}B4.stringifyCollection=zfe});var Ko=v(eO=>{"use strict";var Bfe=XA(),Hfe=JA(),Gfe=hy(),Wo=Ce(),Ry=Vo(),Zfe=Ct();function cf(t,e){let r=Wo.isScalar(e)?e.value:e;for(let n of t)if(Wo.isPair(n)&&(n.key===e||n.key===r||Wo.isScalar(n.key)&&n.key.value===r))return n}var QA=class extends Gfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Wo.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(Ry.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;Wo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Ry.Pair(e,e?.value):n=new Ry.Pair(e.key,e.value);let i=cf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Wo.isScalar(i.value)&&Zfe.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=cf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=cf(this.items,e)?.value;return(!r&&Wo.isScalar(i)?i.value:i)??void 0}has(e){return!!cf(this.items,e)}set(e,r){this.add(new Ry.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)Hfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Wo.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})),Bfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};eO.YAMLMap=QA;eO.findPair=cf});var Wc=v(G4=>{"use strict";var Vfe=Ce(),H4=Ko(),Wfe={collection:"map",default:!0,nodeClass:H4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Vfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>H4.YAMLMap.from(t,e,r)};G4.map=Wfe});var Jo=v(Z4=>{"use strict";var Kfe=ef(),Jfe=XA(),Yfe=hy(),Py=Ce(),Xfe=Ct(),Qfe=Bo(),tO=class extends Yfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Py.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Iy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Iy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Py.isScalar(i)?i.value:i}has(e){let r=Iy(e);return typeof r=="number"&&r=0?e:null}Z4.YAMLSeq=tO});var Kc=v(W4=>{"use strict";var epe=Ce(),V4=Jo(),tpe={collection:"seq",default:!0,nodeClass:V4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return epe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>V4.YAMLSeq.from(t,e,r)};W4.seq=tpe});var lf=v(K4=>{"use strict";var rpe=of(),npe={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),rpe.stringifyString(t,e,r,n)}};K4.string=npe});var Cy=v(X4=>{"use strict";var J4=Ct(),Y4={identify:t=>t==null,createNode:()=>new J4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new J4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Y4.test.test(t)?t:e.options.nullStr};X4.nullTag=Y4});var rO=v(e6=>{"use strict";var ipe=Ct(),Q4={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new ipe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&Q4.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};e6.boolTag=Q4});var Jc=v(t6=>{"use strict";function ope({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}t6.stringifyNumber=ope});var iO=v(Dy=>{"use strict";var spe=Ct(),nO=Jc(),ape={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:nO.stringifyNumber},cpe={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():nO.stringifyNumber(t)}},lpe={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 spe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:nO.stringifyNumber};Dy.float=lpe;Dy.floatExp=cpe;Dy.floatNaN=ape});var sO=v(jy=>{"use strict";var r6=Jc(),Ny=t=>typeof t=="bigint"||Number.isInteger(t),oO=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function n6(t,e,r){let{value:n}=t;return Ny(n)&&n>=0?r+n.toString(e):r6.stringifyNumber(t)}var upe={identify:t=>Ny(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>oO(t,2,8,r),stringify:t=>n6(t,8,"0o")},dpe={identify:Ny,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>oO(t,0,10,r),stringify:r6.stringifyNumber},fpe={identify:t=>Ny(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>oO(t,2,16,r),stringify:t=>n6(t,16,"0x")};jy.int=dpe;jy.intHex=fpe;jy.intOct=upe});var o6=v(i6=>{"use strict";var ppe=Wc(),mpe=Cy(),hpe=Kc(),gpe=lf(),ype=rO(),aO=iO(),cO=sO(),_pe=[ppe.map,hpe.seq,gpe.string,mpe.nullTag,ype.boolTag,cO.intOct,cO.int,cO.intHex,aO.floatNaN,aO.floatExp,aO.float];i6.schema=_pe});var c6=v(a6=>{"use strict";var bpe=Ct(),vpe=Wc(),Spe=Kc();function s6(t){return typeof t=="bigint"||Number.isInteger(t)}var My=({value:t})=>JSON.stringify(t),wpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:My},{identify:t=>t==null,createNode:()=>new bpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:My},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:My},{identify:s6,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})=>s6(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:My}],xpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},$pe=[vpe.map,Spe.seq].concat(wpe,xpe);a6.schema=$pe});var uO=v(l6=>{"use strict";var uf=He("buffer"),lO=Ct(),kpe=of(),Epe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof uf.Buffer=="function")return uf.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 Fy=Ce(),dO=Vo(),Ape=Ct(),Ope=Jo();function u6(t,e){if(Fy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new dO.Pair(new Ape.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Ry({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Oy.indentComment(e(n),t);r.push(o.trimStart())}}Z4.stringifyCollection=zfe});var Ko=v(nT=>{"use strict";var Bfe=tT(),Hfe=QA(),Gfe=gy(),Wo=Ce(),Py=Vo(),Zfe=Ct();function cf(t,e){let r=Wo.isScalar(e)?e.value:e;for(let n of t)if(Wo.isPair(n)&&(n.key===e||n.key===r||Wo.isScalar(n.key)&&n.key.value===r))return n}var rT=class extends Gfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Wo.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(Py.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;Wo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Py.Pair(e,e?.value):n=new Py.Pair(e.key,e.value);let i=cf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Wo.isScalar(i.value)&&Zfe.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=cf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=cf(this.items,e)?.value;return(!r&&Wo.isScalar(i)?i.value:i)??void 0}has(e){return!!cf(this.items,e)}set(e,r){this.add(new Py.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)Hfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Wo.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})),Bfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};nT.YAMLMap=rT;nT.findPair=cf});var Wc=v(W4=>{"use strict";var Vfe=Ce(),V4=Ko(),Wfe={collection:"map",default:!0,nodeClass:V4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Vfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>V4.YAMLMap.from(t,e,r)};W4.map=Wfe});var Jo=v(K4=>{"use strict";var Kfe=ef(),Jfe=tT(),Yfe=gy(),Cy=Ce(),Xfe=Ct(),Qfe=Bo(),iT=class extends Yfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Cy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Iy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Iy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Cy.isScalar(i)?i.value:i}has(e){let r=Iy(e);return typeof r=="number"&&r=0?e:null}K4.YAMLSeq=iT});var Kc=v(Y4=>{"use strict";var epe=Ce(),J4=Jo(),tpe={collection:"seq",default:!0,nodeClass:J4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return epe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>J4.YAMLSeq.from(t,e,r)};Y4.seq=tpe});var lf=v(X4=>{"use strict";var rpe=of(),npe={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),rpe.stringifyString(t,e,r,n)}};X4.string=npe});var Dy=v(t6=>{"use strict";var Q4=Ct(),e6={identify:t=>t==null,createNode:()=>new Q4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Q4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&e6.test.test(t)?t:e.options.nullStr};t6.nullTag=e6});var oT=v(n6=>{"use strict";var ipe=Ct(),r6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new ipe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&r6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};n6.boolTag=r6});var Jc=v(i6=>{"use strict";function ope({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}i6.stringifyNumber=ope});var aT=v(Ny=>{"use strict";var spe=Ct(),sT=Jc(),ape={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:sT.stringifyNumber},cpe={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():sT.stringifyNumber(t)}},lpe={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 spe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:sT.stringifyNumber};Ny.float=lpe;Ny.floatExp=cpe;Ny.floatNaN=ape});var lT=v(My=>{"use strict";var o6=Jc(),jy=t=>typeof t=="bigint"||Number.isInteger(t),cT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function s6(t,e,r){let{value:n}=t;return jy(n)&&n>=0?r+n.toString(e):o6.stringifyNumber(t)}var upe={identify:t=>jy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>cT(t,2,8,r),stringify:t=>s6(t,8,"0o")},dpe={identify:jy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>cT(t,0,10,r),stringify:o6.stringifyNumber},fpe={identify:t=>jy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>cT(t,2,16,r),stringify:t=>s6(t,16,"0x")};My.int=dpe;My.intHex=fpe;My.intOct=upe});var c6=v(a6=>{"use strict";var ppe=Wc(),mpe=Dy(),hpe=Kc(),gpe=lf(),ype=oT(),uT=aT(),dT=lT(),_pe=[ppe.map,hpe.seq,gpe.string,mpe.nullTag,ype.boolTag,dT.intOct,dT.int,dT.intHex,uT.floatNaN,uT.floatExp,uT.float];a6.schema=_pe});var d6=v(u6=>{"use strict";var bpe=Ct(),vpe=Wc(),Spe=Kc();function l6(t){return typeof t=="bigint"||Number.isInteger(t)}var Fy=({value:t})=>JSON.stringify(t),wpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Fy},{identify:t=>t==null,createNode:()=>new bpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Fy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Fy},{identify:l6,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})=>l6(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:Fy}],xpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},$pe=[vpe.map,Spe.seq].concat(wpe,xpe);u6.schema=$pe});var pT=v(f6=>{"use strict";var uf=He("buffer"),fT=Ct(),kpe=of(),Epe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof uf.Buffer=="function")return uf.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 Ly=Ce(),mT=Vo(),Ape=Ct(),Tpe=Jo();function p6(t,e){if(Ly.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 Ape.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]=Fy.isPair(n)?n:new dO.Pair(n)}}else e("Expected a sequence for this tag");return t}function d6(t,e,r){let{replacer:n}=r,i=new Ope.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(dO.createPair(a,c,r))}return i}var Tpe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:u6,createNode:d6};Ly.createPairs=d6;Ly.pairs=Tpe;Ly.resolvePairs=u6});var mO=v(pO=>{"use strict";var f6=Ce(),fO=Bo(),df=Ko(),Rpe=Jo(),p6=zy(),ua=class t extends Rpe.YAMLSeq{constructor(){super(),this.add=df.YAMLMap.prototype.add.bind(this),this.delete=df.YAMLMap.prototype.delete.bind(this),this.get=df.YAMLMap.prototype.get.bind(this),this.has=df.YAMLMap.prototype.has.bind(this),this.set=df.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(f6.isPair(i)?(o=fO.toJS(i.key,"",r),s=fO.toJS(i.value,o,r)):o=fO.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=p6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ua.tag="tag:yaml.org,2002:omap";var Ipe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ua,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=p6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)f6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ua,r)},createNode:(t,e,r)=>ua.from(t,e,r)};pO.YAMLOMap=ua;pO.omap=Ipe});var _6=v(hO=>{"use strict";var m6=Ct();function h6({value:t,source:e},r){return e&&(t?g6:y6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var g6={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 m6.Scalar(!0),stringify:h6},y6={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 m6.Scalar(!1),stringify:h6};hO.falseTag=y6;hO.trueTag=g6});var b6=v(Uy=>{"use strict";var Ppe=Ct(),gO=Jc(),Cpe={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:gO.stringifyNumber},Dpe={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():gO.stringifyNumber(t)}},Npe={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 Ppe.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:gO.stringifyNumber};Uy.float=Npe;Uy.floatExp=Dpe;Uy.floatNaN=Cpe});var S6=v(pf=>{"use strict";var v6=Jc(),ff=t=>typeof t=="bigint"||Number.isInteger(t);function qy(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 yO(t,e,r){let{value:n}=t;if(ff(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return v6.stringifyNumber(t)}var jpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>qy(t,2,2,r),stringify:t=>yO(t,2,"0b")},Mpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>qy(t,1,8,r),stringify:t=>yO(t,8,"0")},Fpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>qy(t,0,10,r),stringify:v6.stringifyNumber},Lpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>qy(t,2,16,r),stringify:t=>yO(t,16,"0x")};pf.int=Fpe;pf.intBin=jpe;pf.intHex=Lpe;pf.intOct=Mpe});var bO=v(_O=>{"use strict";var Gy=Ce(),By=Vo(),Hy=Ko(),da=class t extends Hy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Gy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new By.Pair(e.key,null):r=new By.Pair(e,null),Hy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Hy.findPair(this.items,e);return!r&&Gy.isPair(n)?Gy.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=Hy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new By.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(By.createPair(s,null,n));return o}};da.tag="tag:yaml.org,2002:set";var zpe={collection:"map",identify:t=>t instanceof Set,nodeClass:da,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>da.from(t,e,r),resolve(t,e){if(Gy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new da,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};_O.YAMLSet=da;_O.set=zpe});var SO=v(Zy=>{"use strict";var Upe=Jc();function vO(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 w6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Upe.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 qpe={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})=>vO(t,r),stringify:w6},Bpe={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=>vO(t,!1),stringify:w6},x6={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(x6.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=vO(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$/,"")??""};Zy.floatTime=Bpe;Zy.intTime=qpe;Zy.timestamp=x6});var E6=v(k6=>{"use strict";var Hpe=Wc(),Gpe=Cy(),Zpe=Kc(),Vpe=lf(),Wpe=uO(),$6=_6(),wO=b6(),Vy=S6(),Kpe=ky(),Jpe=mO(),Ype=zy(),Xpe=bO(),xO=SO(),Qpe=[Hpe.map,Zpe.seq,Vpe.string,Gpe.nullTag,$6.trueTag,$6.falseTag,Vy.intBin,Vy.intOct,Vy.int,Vy.intHex,wO.floatNaN,wO.floatExp,wO.float,Wpe.binary,Kpe.merge,Jpe.omap,Ype.pairs,Xpe.set,xO.intTime,xO.floatTime,xO.timestamp];k6.schema=Qpe});var j6=v(EO=>{"use strict";var R6=Wc(),eme=Cy(),I6=Kc(),tme=lf(),rme=rO(),$O=iO(),kO=sO(),nme=o6(),ime=c6(),P6=uO(),mf=ky(),C6=mO(),D6=zy(),A6=E6(),N6=bO(),Wy=SO(),O6=new Map([["core",nme.schema],["failsafe",[R6.map,I6.seq,tme.string]],["json",ime.schema],["yaml11",A6.schema],["yaml-1.1",A6.schema]]),T6={binary:P6.binary,bool:rme.boolTag,float:$O.float,floatExp:$O.floatExp,floatNaN:$O.floatNaN,floatTime:Wy.floatTime,int:kO.int,intHex:kO.intHex,intOct:kO.intOct,intTime:Wy.intTime,map:R6.map,merge:mf.merge,null:eme.nullTag,omap:C6.omap,pairs:D6.pairs,seq:I6.seq,set:N6.set,timestamp:Wy.timestamp},ome={"tag:yaml.org,2002:binary":P6.binary,"tag:yaml.org,2002:merge":mf.merge,"tag:yaml.org,2002:omap":C6.omap,"tag:yaml.org,2002:pairs":D6.pairs,"tag:yaml.org,2002:set":N6.set,"tag:yaml.org,2002:timestamp":Wy.timestamp};function sme(t,e,r){let n=O6.get(e);if(n&&!t)return r&&!n.includes(mf.merge)?n.concat(mf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(O6.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(mf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?T6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(T6).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},[])}EO.coreKnownTags=ome;EO.getTags=sme});var TO=v(M6=>{"use strict";var AO=Ce(),ame=Wc(),cme=Kc(),lme=lf(),Ky=j6(),ume=(t,e)=>t.keye.key?1:0,OO=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Ky.getTags(e,"compat"):e?Ky.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Ky.coreKnownTags:{},this.tags=Ky.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,AO.MAP,{value:ame.map}),Object.defineProperty(this,AO.SCALAR,{value:lme.string}),Object.defineProperty(this,AO.SEQ,{value:cme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?ume:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};M6.Schema=OO});var L6=v(F6=>{"use strict";var dme=Ce(),RO=sf(),hf=tf();function fme(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(hf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(dme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(hf.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+=hf.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]=Ly.isPair(n)?n:new mT.Pair(n)}}else e("Expected a sequence for this tag");return t}function m6(t,e,r){let{replacer:n}=r,i=new Tpe.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 Ope={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:p6,createNode:m6};zy.createPairs=m6;zy.pairs=Ope;zy.resolvePairs=p6});var yT=v(gT=>{"use strict";var h6=Ce(),hT=Bo(),df=Ko(),Rpe=Jo(),g6=Uy(),ua=class t extends Rpe.YAMLSeq{constructor(){super(),this.add=df.YAMLMap.prototype.add.bind(this),this.delete=df.YAMLMap.prototype.delete.bind(this),this.get=df.YAMLMap.prototype.get.bind(this),this.has=df.YAMLMap.prototype.has.bind(this),this.set=df.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(h6.isPair(i)?(o=hT.toJS(i.key,"",r),s=hT.toJS(i.value,o,r)):o=hT.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=g6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ua.tag="tag:yaml.org,2002:omap";var Ppe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ua,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=g6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)h6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ua,r)},createNode:(t,e,r)=>ua.from(t,e,r)};gT.YAMLOMap=ua;gT.omap=Ppe});var S6=v(_T=>{"use strict";var y6=Ct();function _6({value:t,source:e},r){return e&&(t?b6:v6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var b6={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 y6.Scalar(!0),stringify:_6},v6={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 y6.Scalar(!1),stringify:_6};_T.falseTag=v6;_T.trueTag=b6});var w6=v(qy=>{"use strict";var Ipe=Ct(),bT=Jc(),Cpe={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:bT.stringifyNumber},Dpe={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():bT.stringifyNumber(t)}},Npe={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 Ipe.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:bT.stringifyNumber};qy.float=Npe;qy.floatExp=Dpe;qy.floatNaN=Cpe});var $6=v(pf=>{"use strict";var x6=Jc(),ff=t=>typeof t=="bigint"||Number.isInteger(t);function By(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 vT(t,e,r){let{value:n}=t;if(ff(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return x6.stringifyNumber(t)}var jpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>By(t,2,2,r),stringify:t=>vT(t,2,"0b")},Mpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>By(t,1,8,r),stringify:t=>vT(t,8,"0")},Fpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>By(t,0,10,r),stringify:x6.stringifyNumber},Lpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>By(t,2,16,r),stringify:t=>vT(t,16,"0x")};pf.int=Fpe;pf.intBin=jpe;pf.intHex=Lpe;pf.intOct=Mpe});var wT=v(ST=>{"use strict";var Zy=Ce(),Hy=Vo(),Gy=Ko(),da=class t extends Gy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Zy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Hy.Pair(e.key,null):r=new Hy.Pair(e,null),Gy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Gy.findPair(this.items,e);return!r&&Zy.isPair(n)?Zy.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=Gy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Hy.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(Hy.createPair(s,null,n));return o}};da.tag="tag:yaml.org,2002:set";var zpe={collection:"map",identify:t=>t instanceof Set,nodeClass:da,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>da.from(t,e,r),resolve(t,e){if(Zy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new da,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};ST.YAMLSet=da;ST.set=zpe});var $T=v(Vy=>{"use strict";var Upe=Jc();function xT(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 k6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Upe.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 qpe={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})=>xT(t,r),stringify:k6},Bpe={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=>xT(t,!1),stringify:k6},E6={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(E6.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=xT(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$/,"")??""};Vy.floatTime=Bpe;Vy.intTime=qpe;Vy.timestamp=E6});var O6=v(T6=>{"use strict";var Hpe=Wc(),Gpe=Dy(),Zpe=Kc(),Vpe=lf(),Wpe=pT(),A6=S6(),kT=w6(),Wy=$6(),Kpe=Ey(),Jpe=yT(),Ype=Uy(),Xpe=wT(),ET=$T(),Qpe=[Hpe.map,Zpe.seq,Vpe.string,Gpe.nullTag,A6.trueTag,A6.falseTag,Wy.intBin,Wy.intOct,Wy.int,Wy.intHex,kT.floatNaN,kT.floatExp,kT.float,Wpe.binary,Kpe.merge,Jpe.omap,Ype.pairs,Xpe.set,ET.intTime,ET.floatTime,ET.timestamp];T6.schema=Qpe});var L6=v(OT=>{"use strict";var C6=Wc(),eme=Dy(),D6=Kc(),tme=lf(),rme=oT(),AT=aT(),TT=lT(),nme=c6(),ime=d6(),N6=pT(),mf=Ey(),j6=yT(),M6=Uy(),R6=O6(),F6=wT(),Ky=$T(),P6=new Map([["core",nme.schema],["failsafe",[C6.map,D6.seq,tme.string]],["json",ime.schema],["yaml11",R6.schema],["yaml-1.1",R6.schema]]),I6={binary:N6.binary,bool:rme.boolTag,float:AT.float,floatExp:AT.floatExp,floatNaN:AT.floatNaN,floatTime:Ky.floatTime,int:TT.int,intHex:TT.intHex,intOct:TT.intOct,intTime:Ky.intTime,map:C6.map,merge:mf.merge,null:eme.nullTag,omap:j6.omap,pairs:M6.pairs,seq:D6.seq,set:F6.set,timestamp:Ky.timestamp},ome={"tag:yaml.org,2002:binary":N6.binary,"tag:yaml.org,2002:merge":mf.merge,"tag:yaml.org,2002:omap":j6.omap,"tag:yaml.org,2002:pairs":M6.pairs,"tag:yaml.org,2002:set":F6.set,"tag:yaml.org,2002:timestamp":Ky.timestamp};function sme(t,e,r){let n=P6.get(e);if(n&&!t)return r&&!n.includes(mf.merge)?n.concat(mf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(P6.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(mf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?I6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(I6).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},[])}OT.coreKnownTags=ome;OT.getTags=sme});var IT=v(z6=>{"use strict";var RT=Ce(),ame=Wc(),cme=Kc(),lme=lf(),Jy=L6(),ume=(t,e)=>t.keye.key?1:0,PT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Jy.getTags(e,"compat"):e?Jy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Jy.coreKnownTags:{},this.tags=Jy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,RT.MAP,{value:ame.map}),Object.defineProperty(this,RT.SCALAR,{value:lme.string}),Object.defineProperty(this,RT.SEQ,{value:cme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?ume:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};z6.Schema=PT});var q6=v(U6=>{"use strict";var dme=Ce(),CT=sf(),hf=tf();function fme(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=CT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(hf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(dme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(hf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=CT.stringify(t.contents,i,()=>a=null,c);a&&(l+=hf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(CT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` `)?(r.push("..."),r.push(hf.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(hf.indentComment(o(c),"")))}return r.join(` `)+` -`}F6.stringifyDocument=fme});var gf=v(z6=>{"use strict";var pme=Qd(),Yc=hy(),$n=Ce(),mme=Vo(),hme=Bo(),gme=TO(),yme=L6(),IO=dy(),_me=NA(),bme=ef(),PO=DA(),CO=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 PO.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Xc(this.contents)&&this.contents.add(e)}addIn(e,r){Xc(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 pme.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=bme.createNode(e,u,m);return a&&$n.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 mme.Pair(i,o)}delete(e){return Xc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Yc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Xc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Yc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Yc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Yc.collectionFromPath(this.schema,[e],r):Xc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Yc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Yc.collectionFromPath(this.schema,Array.from(e),r):Xc(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 PO.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 PO.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 gme.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=hme.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"?_me.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 yme.stringifyDocument(this,e)}};function Xc(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}z6.Document=CO});var bf=v(_f=>{"use strict";var yf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},DO=class extends yf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},NO=class extends yf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},vme=(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 +`}U6.stringifyDocument=fme});var gf=v(B6=>{"use strict";var pme=Qd(),Yc=gy(),$n=Ce(),mme=Vo(),hme=Bo(),gme=IT(),yme=q6(),DT=fy(),_me=FA(),bme=ef(),NT=MA(),jT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 NT.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Xc(this.contents)&&this.contents.add(e)}addIn(e,r){Xc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=DT.anchorNames(this);e.anchor=!r||n.has(r)?DT.findNewAnchor(r||"a",n):r}return new pme.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}=DT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=bme.createNode(e,u,m);return a&&$n.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 mme.Pair(i,o)}delete(e){return Xc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Yc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Xc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Yc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Yc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Yc.collectionFromPath(this.schema,[e],r):Xc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Yc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Yc.collectionFromPath(this.schema,Array.from(e),r):Xc(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 NT.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 NT.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 gme.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=hme.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"?_me.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 yme.stringifyDocument(this,e)}};function Xc(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}B6.Document=jT});var bf=v(_f=>{"use strict";var yf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},MT=class extends yf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},FT=class extends yf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},vme=(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} -`}};_f.YAMLError=yf;_f.YAMLParseError=DO;_f.YAMLWarning=NO;_f.prettifyError=vme});var vf=v(U6=>{"use strict";function Sme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let T=t[t.length-1],O=T?T.offset+T.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:O,start:w??O}}U6.resolveProps=Sme});var Jy=v(q6=>{"use strict";function jO(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(jO(e.key)||jO(e.value))return!0}return!1;default:return!0}}q6.containsNewline=jO});var MO=v(B6=>{"use strict";var wme=Jy();function xme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&wme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}B6.flowIndentCheck=xme});var FO=v(G6=>{"use strict";var H6=Ce();function $me(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||H6.isScalar(o)&&H6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}G6.mapIncludes=$me});var Y6=v(J6=>{"use strict";var Z6=Vo(),kme=Ko(),V6=vf(),Eme=Jy(),W6=MO(),Ame=FO(),K6="All mapping items must start at the same column";function Ome({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??kme.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=V6.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",K6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Eme.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",K6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&W6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Ame.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=V6.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 Tme=Jo(),Rme=vf(),Ime=MO();function Pme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Tme.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=Rme.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&&Ime.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}X6.resolveBlockSeq=Pme});var Qc=v(eB=>{"use strict";function Cme(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}}eB.resolveEnd=Cme});var iB=v(nB=>{"use strict";var Dme=Ce(),Nme=Vo(),tB=Ko(),jme=Jo(),Mme=Qc(),rB=vf(),Fme=Jy(),Lme=FO(),LO="Block collections are not allowed within flow collections",zO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function zme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?tB.YAMLMap:jme.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=Mme.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}nB.resolveFlowCollection=zme});var sB=v(oB=>{"use strict";var Ume=Ce(),qme=Ct(),Bme=Ko(),Hme=Jo(),Gme=Y6(),Zme=Q6(),Vme=iB();function UO(t,e,r,n,i,o){let s=r.type==="block-map"?Gme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Zme.resolveBlockSeq(t,e,r,n,o):Vme.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 Wme(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),UO(t,e,r,i,s)}let l=UO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Ume.isNode(u)?u:new qme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}oB.composeCollection=Wme});var BO=v(aB=>{"use strict";var qO=Ct();function Kme(t,e,r){let n=e.offset,i=Jme(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?qO.Scalar.BLOCK_FOLDED:qO.Scalar.BLOCK_LITERAL,s=e.source?Yme(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?` +`}};_f.YAMLError=yf;_f.YAMLParseError=MT;_f.YAMLWarning=FT;_f.prettifyError=vme});var vf=v(H6=>{"use strict";function Sme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}H6.resolveProps=Sme});var Yy=v(G6=>{"use strict";function LT(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(LT(e.key)||LT(e.value))return!0}return!1;default:return!0}}G6.containsNewline=LT});var zT=v(Z6=>{"use strict";var wme=Yy();function xme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&wme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Z6.flowIndentCheck=xme});var UT=v(W6=>{"use strict";var V6=Ce();function $me(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||V6.isScalar(o)&&V6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}W6.mapIncludes=$me});var eB=v(Q6=>{"use strict";var K6=Vo(),kme=Ko(),J6=vf(),Eme=Yy(),Y6=zT(),Ame=UT(),X6="All mapping items must start at the same column";function Tme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??kme.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",X6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Eme.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",X6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&Y6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Ame.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 Ome=Jo(),Rme=vf(),Pme=zT();function Ime({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Ome.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=Rme.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&&Pme.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}tB.resolveBlockSeq=Ime});var Qc=v(nB=>{"use strict";function Cme(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}}nB.resolveEnd=Cme});var aB=v(sB=>{"use strict";var Dme=Ce(),Nme=Vo(),iB=Ko(),jme=Jo(),Mme=Qc(),oB=vf(),Fme=Yy(),Lme=UT(),qT="Block collections are not allowed within flow collections",BT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function zme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?iB.YAMLMap:jme.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=Mme.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}sB.resolveFlowCollection=zme});var lB=v(cB=>{"use strict";var Ume=Ce(),qme=Ct(),Bme=Ko(),Hme=Jo(),Gme=eB(),Zme=rB(),Vme=aB();function HT(t,e,r,n,i,o){let s=r.type==="block-map"?Gme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Zme.resolveBlockSeq(t,e,r,n,o):Vme.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 Wme(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=Ume.isNode(u)?u:new qme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}cB.composeCollection=Wme});var ZT=v(uB=>{"use strict";var GT=Ct();function Kme(t,e,r){let n=e.offset,i=Jme(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?Yme(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 Jme({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=Ct(),Xme=Qc();function Qme(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=ehe(o,l);break;case"single-quoted-scalar":a=HO.Scalar.QUOTE_SINGLE,c=the(o,l);break;case"double-quoted-scalar":a=HO.Scalar.QUOTE_DOUBLE,c=rhe(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=Xme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function ehe(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}`),cB(t)}function the(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),cB(t.slice(1,-1)).replace(/''/g,"'")}function cB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var VT=Ct(),Xme=Qc();function Qme(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=VT.Scalar.PLAIN,c=ehe(o,l);break;case"single-quoted-scalar":a=VT.Scalar.QUOTE_SINGLE,c=the(o,l);break;case"double-quoted-scalar":a=VT.Scalar.QUOTE_DOUBLE,c=rhe(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=Xme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function ehe(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}`),dB(t)}function the(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),dB(t.slice(1,-1)).replace(/''/g,"'")}function dB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var fa=Ce(),uB=Ct(),she=BO(),ahe=GO();function che(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?she.resolveBlockScalar(t,e,n):ahe.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[fa.SCALAR]:c?l=lhe(t.schema,i,c,r,n):e.type==="scalar"?l=uhe(t,i,e,n):l=t.schema[fa.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=fa.isScalar(d)?d:new uB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new uB.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 lhe(t,e,r,n,i){if(r==="!")return t[fa.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[fa.SCALAR])}function uhe({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[fa.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[fa.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}dB.composeScalar=che});var mB=v(pB=>{"use strict";function dhe(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}pB.emptyScalarPosition=dhe});var yB=v(VO=>{"use strict";var fhe=Qd(),phe=Ce(),mhe=sB(),hB=fB(),hhe=Qc(),ghe=mB(),yhe={composeNode:gB,composeEmptyNode:ZO};function gB(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=_he(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=hB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=mhe.composeCollection(yhe,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=ZO(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&&(!phe.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 ZO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:ghe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=hB.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 _he({options:t},{offset:e,source:r,end:n},i){let o=new fhe.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=hhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}VO.composeEmptyNode=ZO;VO.composeNode=gB});var vB=v(bB=>{"use strict";var bhe=gf(),_B=yB(),vhe=Qc(),She=vf();function whe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new bhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=She.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?_B.composeNode(l,i,u,s):_B.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=vhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}bB.composeDoc=whe});var KO=v(xB=>{"use strict";var xhe=He("process"),$he=DA(),khe=gf(),Sf=bf(),SB=Ce(),Ehe=vB(),Ahe=Qc();function wf(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 wB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var fa=Ce(),pB=Ct(),she=ZT(),ahe=WT();function che(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?she.resolveBlockScalar(t,e,n):ahe.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[fa.SCALAR]:c?l=lhe(t.schema,i,c,r,n):e.type==="scalar"?l=uhe(t,i,e,n):l=t.schema[fa.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=fa.isScalar(d)?d:new pB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new pB.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 lhe(t,e,r,n,i){if(r==="!")return t[fa.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[fa.SCALAR])}function uhe({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[fa.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[fa.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}mB.composeScalar=che});var yB=v(gB=>{"use strict";function dhe(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}gB.emptyScalarPosition=dhe});var vB=v(JT=>{"use strict";var fhe=Qd(),phe=Ce(),mhe=lB(),_B=hB(),hhe=Qc(),ghe=yB(),yhe={composeNode:bB,composeEmptyNode:KT};function bB(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=_he(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=_B.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=mhe.composeCollection(yhe,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=KT(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&&(!phe.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 KT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:ghe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=_B.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 _he({options:t},{offset:e,source:r,end:n},i){let o=new fhe.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=hhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}JT.composeEmptyNode=KT;JT.composeNode=bB});var xB=v(wB=>{"use strict";var bhe=gf(),SB=vB(),vhe=Qc(),She=vf();function whe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new bhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=She.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=vhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}wB.composeDoc=whe});var XT=v(EB=>{"use strict";var xhe=He("process"),$he=MA(),khe=gf(),Sf=bf(),$B=Ce(),Ehe=xB(),Ahe=Qc();function wf(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 kB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=wf(r);o?this.warnings.push(new Sf.YAMLWarning(s,n,i)):this.errors.push(new Sf.YAMLParseError(s,n,i))},this.directives=new $he.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=wB(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(SB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];SB.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 YT=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=wf(r);o?this.warnings.push(new Sf.YAMLWarning(s,n,i)):this.errors.push(new Sf.YAMLParseError(s,n,i))},this.directives=new $he.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=kB(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($B.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];$B.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=wf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Ehe.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 Sf.YAMLParseError(wf(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 Sf.YAMLParseError(wf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Ahe.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 Sf.YAMLParseError(wf(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 khe.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}}};xB.Composer=WO});var EB=v(Yy=>{"use strict";var Ohe=BO(),The=GO(),Rhe=bf(),$B=of();function Ihe(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 Rhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return The.resolveFlowScalar(t,e,n);case"block-scalar":return Ohe.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Phe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=$B.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=wf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Ehe.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 Sf.YAMLParseError(wf(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 Sf.YAMLParseError(wf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Ahe.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 Sf.YAMLParseError(wf(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 khe.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}}};EB.Composer=YT});var OB=v(Xy=>{"use strict";var The=ZT(),Ohe=WT(),Rhe=bf(),AB=of();function Phe(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 Rhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ohe.resolveFlowScalar(t,e,n);case"block-scalar":return The.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Ihe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=AB.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 kB(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 Che(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=$B.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">":Dhe(t,c);break;case'"':JO(t,c,"double-quoted-scalar");break;case"'":JO(t,c,"single-quoted-scalar");break;default:JO(t,c,"scalar")}}function Dhe(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return TB(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 Che(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=AB.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">":Dhe(t,c);break;case'"':QT(t,c,"double-quoted-scalar");break;case"'":QT(t,c,"single-quoted-scalar");break;default:QT(t,c,"scalar")}}function Dhe(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}];kB(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 kB(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 JO(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})}}}Yy.createScalarToken=Phe;Yy.resolveAsScalar=Ihe;Yy.setScalarValue=Che});var OB=v(AB=>{"use strict";var Nhe=t=>"type"in t?Qy(t):Xy(t);function Qy(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Qy(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Xy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Xy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Xy(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 Xy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=Qy(e)),r)for(let o of r)i+=o.source;return n&&(i+=Qy(n)),i}AB.stringify=Nhe});var PB=v(IB=>{"use strict";var YO=Symbol("break visit"),jhe=Symbol("skip children"),TB=Symbol("remove item");function pa(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),RB(Object.freeze([]),t,e)}pa.BREAK=YO;pa.SKIP=jhe;pa.REMOVE=TB;pa.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};pa.parentCollection=(t,e)=>{let r=pa.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 RB(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=EB(),Mhe=OB(),Fhe=PB(),QO="\uFEFF",eT="",tT="",rT="",Lhe=t=>!!t&&"items"in t,zhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Uhe(t){switch(t){case QO:return"";case eT:return"";case tT:return"";case rT:return"";default:return JSON.stringify(t)}}function qhe(t){switch(t){case QO:return"byte-order-mark";case eT:return"doc-mode";case tT:return"flow-error-end";case rT: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}];TB(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 TB(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 QT(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})}}}Xy.createScalarToken=Ihe;Xy.resolveAsScalar=Phe;Xy.setScalarValue=Che});var PB=v(RB=>{"use strict";var Nhe=t=>"type"in t?e_(t):Qy(t);function e_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=e_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Qy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Qy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Qy(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 Qy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=e_(e)),r)for(let o of r)i+=o.source;return n&&(i+=e_(n)),i}RB.stringify=Nhe});var NB=v(DB=>{"use strict";var eO=Symbol("break visit"),jhe=Symbol("skip children"),IB=Symbol("remove item");function pa(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),CB(Object.freeze([]),t,e)}pa.BREAK=eO;pa.SKIP=jhe;pa.REMOVE=IB;pa.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};pa.parentCollection=(t,e)=>{let r=pa.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 CB(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 tO=OB(),Mhe=PB(),Fhe=NB(),rO="\uFEFF",nO="",iO="",oO="",Lhe=t=>!!t&&"items"in t,zhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Uhe(t){switch(t){case rO:return"";case nO:return"";case iO:return"";case oO:return"";default:return JSON.stringify(t)}}function qhe(t){switch(t){case rO:return"byte-order-mark";case nO:return"doc-mode";case iO: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}Dr.createScalarToken=XO.createScalarToken;Dr.resolveAsScalar=XO.resolveAsScalar;Dr.setScalarValue=XO.setScalarValue;Dr.stringify=Mhe.stringify;Dr.visit=Fhe.visit;Dr.BOM=QO;Dr.DOCUMENT=eT;Dr.FLOW_END=tT;Dr.SCALAR=rT;Dr.isCollection=Lhe;Dr.isScalar=zhe;Dr.prettyToken=Uhe;Dr.tokenType=qhe});var oT=v(DB=>{"use strict";var xf=e_();function Wn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var CB=new Set("0123456789ABCDEFabcdef"),Bhe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),t_=new Set(",[]{}"),Hhe=new Set(` ,[]{} -\r `),nT=t=>!t||Hhe.has(t),iT=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}Dr.createScalarToken=tO.createScalarToken;Dr.resolveAsScalar=tO.resolveAsScalar;Dr.setScalarValue=tO.setScalarValue;Dr.stringify=Mhe.stringify;Dr.visit=Fhe.visit;Dr.BOM=rO;Dr.DOCUMENT=nO;Dr.FLOW_END=iO;Dr.SCALAR=oO;Dr.isCollection=Lhe;Dr.isScalar=zhe;Dr.prettyToken=Uhe;Dr.tokenType=qhe});var cO=v(MB=>{"use strict";var xf=t_();function Wn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var jB=new Set("0123456789ABCDEFabcdef"),Bhe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),r_=new Set(",[]{}"),Hhe=new Set(` ,[]{} +\r `),sO=t=>!t||Hhe.has(t),aO=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==="...")&&Wn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Wn(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===":")&&Wn(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(nT),"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&&!Wn(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===":")&&Wn(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(sO),"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=>Wn(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 xf.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(Wn(o)||e&&t_.has(o))break;r=n}else if(Wn(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 xf.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(Wn(o)||e&&r_.has(o))break;r=n}else if(Wn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&t_.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&t_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield xf.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(nT),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Wn(n)||r&&t_.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(;!Wn(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(Bhe.has(r))r=this.buffer[++e];else if(r==="%"&&CB.has(this.buffer[e+1])&&CB.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&&r_.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&r_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield xf.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(sO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Wn(n)||r&&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(;!Wn(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(Bhe.has(r))r=this.buffer[++e];else if(r==="%"&&jB.has(this.buffer[e+1])&&jB.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)}};DB.Lexer=iT});var aT=v(NB=>{"use strict";var sT=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 Ghe=He("process"),jB=e_(),Zhe=oT();function Yo(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 n_(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"&&FB(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&&MB(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)}};MB.Lexer=aO});var uO=v(FB=>{"use strict";var lO=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 Ghe=He("process"),LB=t_(),Zhe=cO();function Yo(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 i_(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"&&UB(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&&zB(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(Yo(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(LB(r.key)&&!Yo(r.sep,"newline")){let s=el(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(Yo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=el(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]}):Yo(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&&!Yo(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)){n_(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||Yo(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=r_(n),o=el(i);FB(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)){i_(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(Yo(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(qB(r.key)&&!Yo(r.sep,"newline")){let s=el(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(Yo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=el(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]}):Yo(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&&!Yo(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)){i_(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||Yo(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=n_(n),o=el(i);UB(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=r_(e),n=el(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=r_(e),n=el(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())}}};zB.Parser=cT});var GB=v(kf=>{"use strict";var UB=KO(),Vhe=gf(),$f=bf(),Whe=VA(),Khe=Ce(),Jhe=aT(),qB=lT();function BB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Jhe.LineCounter||null,prettyErrors:e}}function Yhe(t,e={}){let{lineCounter:r,prettyErrors:n}=BB(e),i=new qB.Parser(r?.addNewLine),o=new UB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach($f.prettifyError(t,r)),a.warnings.forEach($f.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function HB(t,e={}){let{lineCounter:r,prettyErrors:n}=BB(e),i=new qB.Parser(r?.addNewLine),o=new UB.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 $f.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach($f.prettifyError(t,r)),s.warnings.forEach($f.prettifyError(t,r))),s}function Xhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=HB(t,r);if(!i)return null;if(i.warnings.forEach(o=>Whe.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 Qhe(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 Khe.isDocument(t)&&!n?t.toString(r):new Vhe.Document(t,n,r).toString(r)}kf.parse=Xhe;kf.parseAllDocuments=Yhe;kf.parseDocument=HB;kf.stringify=Qhe});var Qt=v(Ge=>{"use strict";var ege=KO(),tge=gf(),rge=TO(),uT=bf(),nge=Qd(),Xo=Ce(),ige=Vo(),oge=Ct(),sge=Ko(),age=Jo(),cge=e_(),lge=oT(),uge=aT(),dge=lT(),i_=GB(),ZB=Kd();Ge.Composer=ege.Composer;Ge.Document=tge.Document;Ge.Schema=rge.Schema;Ge.YAMLError=uT.YAMLError;Ge.YAMLParseError=uT.YAMLParseError;Ge.YAMLWarning=uT.YAMLWarning;Ge.Alias=nge.Alias;Ge.isAlias=Xo.isAlias;Ge.isCollection=Xo.isCollection;Ge.isDocument=Xo.isDocument;Ge.isMap=Xo.isMap;Ge.isNode=Xo.isNode;Ge.isPair=Xo.isPair;Ge.isScalar=Xo.isScalar;Ge.isSeq=Xo.isSeq;Ge.Pair=ige.Pair;Ge.Scalar=oge.Scalar;Ge.YAMLMap=sge.YAMLMap;Ge.YAMLSeq=age.YAMLSeq;Ge.CST=cge;Ge.Lexer=lge.Lexer;Ge.LineCounter=uge.LineCounter;Ge.Parser=dge.Parser;Ge.parse=i_.parse;Ge.parseAllDocuments=i_.parseAllDocuments;Ge.parseDocument=i_.parseDocument;Ge.stringify=i_.stringify;Ge.visit=ZB.visit;Ge.visitAsync=ZB.visitAsync});import{execFileSync as VB}from"node:child_process";import{existsSync as o_}from"node:fs";import{join as s_,resolve as fge}from"node:path";function pge(t){try{let e=VB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?fge(t,e):null}catch{return null}}function dT(t){let e=pge(t);if(!e)return null;try{if(o_(s_(e,"MERGE_HEAD")))return"merge";if(o_(s_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(o_(s_(e,"rebase-merge"))||o_(s_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ma(t){return dT(t)!==null}function fT(t,e){try{let r=VB("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 a_(t,e){return fT(t,e)!==null}var ha=y(()=>{"use strict"});import{execFileSync as mge}from"node:child_process";import{existsSync as hge,readFileSync as gge}from"node:fs";import{join as JB}from"node:path";function Ef(t,e){return mge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Qo(t){try{let e=Ef(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 es(t,e){yge(t,e);let r=Ef(t,["rev-parse","HEAD"]).trim(),n=_ge(t,e);return{groups:bge(t,n),head:r,inventory:{after:KB(l_(t,"spec.yaml")),before:KB(pT(t,e,"spec.yaml"))},since:e,unsharded_commits:xge(t,e)}}function mT(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 yge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!a_(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 _ge(t,e){let r=Ef(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(!(!WB(c)&&!WB(a)))if(s.startsWith("A")){let l=c_(l_(t,c));if(!l)continue;l.status==="done"?n.push(tl(l,"added-as-done")):l.status==="archived"&&n.push(tl(l,"archived"))}else if(s.startsWith("D")){let l=c_(pT(t,e,a));l&&n.push(tl(l,"archived"))}else{let l=c_(l_(t,c));if(!l)continue;let d=c_(pT(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(tl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(tl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(tl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function WB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function tl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>mT(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function c_(t){if(t===null)return null;let e;try{e=(0,u_.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 l_(t,e){let r=JB(t,e);if(!hge(r))return null;try{return gge(r,"utf8")}catch{return null}}function pT(t,e,r){try{return Ef(t,["show",`${e}:${r}`])}catch{return null}}function bge(t,e){let r=vge(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 vge(t){let e=l_(t,JB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,u_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function KB(t){let e={};if(t!==null)try{let n=(0,u_.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 xge(t,e){let r=Ef(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);Sge.test(a)&&(wge.test(a)||n.push({hash:s,subject:a}))}return n}var u_,Sge,wge,rl=y(()=>{"use strict";u_=vt(Qt(),1);ha();Sge=/^(feat|fix)(\([^)]*\))?!?:/,wge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as YB}from"node:child_process";import{appendFileSync as $ge,existsSync as hT,mkdirSync as kge,readFileSync as Ege,renameSync as Age,statSync as Oge}from"node:fs";import{userInfo as Tge}from"node:os";import{dirname as Rge,join as yT}from"node:path";function _T(t){return yT(t,XB,Ige)}function Xr(t,e){let r=_T(t),n=Rge(r);hT(n)||kge(n,{recursive:!0});try{hT(r)&&Oge(r).size>Pge&&Age(r,yT(n,QB))}catch{}$ge(r,`${JSON.stringify(e)} -`,"utf8")}function gT(t){if(!hT(t))return[];let e=Ege(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ga(t){return gT(_T(t))}function d_(t){return[...gT(yT(t,XB,QB)),...gT(_T(t))]}function Qr(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 Cge(t){let e;try{e=YB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Tge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Dge(t){try{return YB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Af(t,e){try{let r=ga(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Dge(t),i=Cge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Af(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var XB,Ige,QB,Pge,Nr=y(()=>{"use strict";XB=".cladding",Ige="events.log.jsonl",QB="events.log.1.jsonl",Pge=5*1024*1024});import{execFileSync as Nge}from"node:child_process";import{existsSync as eH,readdirSync as jge,readFileSync as Mge,statSync as tH}from"node:fs";import{createHash as Fge}from"node:crypto";import{join as bT}from"node:path";function ya(t){try{return Nge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function vT(t){let e=[],r=bT(t,"spec.yaml");eH(r)&&tH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=bT(t,"spec",i);if(!(!eH(o)||!tH(o).isDirectory()))for(let s of jge(o))s.endsWith(".yaml")&&e.push(bT(o,s))}e.sort();let n=Fge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Mge(i)),n.update("\0")}return n.digest("hex")}function f_(t,e){let r={featureId:e,gitHead:ya(t),specDigest:vT(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function p_(t,e){let r=ga(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=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Of=y(()=>{"use strict";Nr()});import{readFileSync as Lge,statSync as zge}from"node:fs";import{extname as Uge,resolve as ST,sep as qge}from"node:path";function en(t){return Math.ceil(t.length/4)}function Gge(t,e){let r=ST(e),n=ST(r,t);return n===r||n.startsWith(r+qge)}function nH(t,e,r,n){if(!Gge(t,e))return{path:t,omitted:"unsafe-path"};if(!Bge.has(Uge(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>rH)return{path:t,omitted:"too-large",bytes:o}}else{let l=ST(e,t);try{o=zge(l).size}catch{return{path:t,omitted:"missing"}}if(o>rH)return{path:t,omitted:"too-large",bytes:o};try{i=Lge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Hge))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=n_(e),n=el(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=n_(e),n=el(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())}}};BB.Parser=dO});var WB=v(kf=>{"use strict";var HB=XT(),Vhe=gf(),$f=bf(),Whe=JA(),Khe=Ce(),Jhe=uO(),GB=fO();function ZB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Jhe.LineCounter||null,prettyErrors:e}}function Yhe(t,e={}){let{lineCounter:r,prettyErrors:n}=ZB(e),i=new GB.Parser(r?.addNewLine),o=new HB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach($f.prettifyError(t,r)),a.warnings.forEach($f.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function VB(t,e={}){let{lineCounter:r,prettyErrors:n}=ZB(e),i=new GB.Parser(r?.addNewLine),o=new HB.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 $f.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach($f.prettifyError(t,r)),s.warnings.forEach($f.prettifyError(t,r))),s}function Xhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=VB(t,r);if(!i)return null;if(i.warnings.forEach(o=>Whe.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 Qhe(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 Khe.isDocument(t)&&!n?t.toString(r):new Vhe.Document(t,n,r).toString(r)}kf.parse=Xhe;kf.parseAllDocuments=Yhe;kf.parseDocument=VB;kf.stringify=Qhe});var Qt=v(Ge=>{"use strict";var ege=XT(),tge=gf(),rge=IT(),pO=bf(),nge=Qd(),Xo=Ce(),ige=Vo(),oge=Ct(),sge=Ko(),age=Jo(),cge=t_(),lge=cO(),uge=uO(),dge=fO(),o_=WB(),KB=Kd();Ge.Composer=ege.Composer;Ge.Document=tge.Document;Ge.Schema=rge.Schema;Ge.YAMLError=pO.YAMLError;Ge.YAMLParseError=pO.YAMLParseError;Ge.YAMLWarning=pO.YAMLWarning;Ge.Alias=nge.Alias;Ge.isAlias=Xo.isAlias;Ge.isCollection=Xo.isCollection;Ge.isDocument=Xo.isDocument;Ge.isMap=Xo.isMap;Ge.isNode=Xo.isNode;Ge.isPair=Xo.isPair;Ge.isScalar=Xo.isScalar;Ge.isSeq=Xo.isSeq;Ge.Pair=ige.Pair;Ge.Scalar=oge.Scalar;Ge.YAMLMap=sge.YAMLMap;Ge.YAMLSeq=age.YAMLSeq;Ge.CST=cge;Ge.Lexer=lge.Lexer;Ge.LineCounter=uge.LineCounter;Ge.Parser=dge.Parser;Ge.parse=o_.parse;Ge.parseAllDocuments=o_.parseAllDocuments;Ge.parseDocument=o_.parseDocument;Ge.stringify=o_.stringify;Ge.visit=KB.visit;Ge.visitAsync=KB.visitAsync});import{execFileSync as JB}from"node:child_process";import{existsSync as s_}from"node:fs";import{join as a_,resolve as fge}from"node:path";function pge(t){try{let e=JB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?fge(t,e):null}catch{return null}}function mO(t){let e=pge(t);if(!e)return null;try{if(s_(a_(e,"MERGE_HEAD")))return"merge";if(s_(a_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(s_(a_(e,"rebase-merge"))||s_(a_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ma(t){return mO(t)!==null}function hO(t,e){try{let r=JB("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 c_(t,e){return hO(t,e)!==null}var ha=y(()=>{"use strict"});import{execFileSync as mge}from"node:child_process";import{existsSync as hge,readFileSync as gge}from"node:fs";import{join as QB}from"node:path";function Ef(t,e){return mge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Qo(t){try{let e=Ef(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 es(t,e){yge(t,e);let r=Ef(t,["rev-parse","HEAD"]).trim(),n=_ge(t,e);return{groups:bge(t,n),head:r,inventory:{after:XB(u_(t,"spec.yaml")),before:XB(gO(t,e,"spec.yaml"))},since:e,unsharded_commits:xge(t,e)}}function yO(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 yge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!c_(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 _ge(t,e){let r=Ef(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(!(!YB(c)&&!YB(a)))if(s.startsWith("A")){let l=l_(u_(t,c));if(!l)continue;l.status==="done"?n.push(tl(l,"added-as-done")):l.status==="archived"&&n.push(tl(l,"archived"))}else if(s.startsWith("D")){let l=l_(gO(t,e,a));l&&n.push(tl(l,"archived"))}else{let l=l_(u_(t,c));if(!l)continue;let d=l_(gO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(tl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(tl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(tl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function YB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function tl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>yO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function l_(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 u_(t,e){let r=QB(t,e);if(!hge(r))return null;try{return gge(r,"utf8")}catch{return null}}function gO(t,e,r){try{return Ef(t,["show",`${e}:${r}`])}catch{return null}}function bge(t,e){let r=vge(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 vge(t){let e=u_(t,QB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,d_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function XB(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 xge(t,e){let r=Ef(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);Sge.test(a)&&(wge.test(a)||n.push({hash:s,subject:a}))}return n}var d_,Sge,wge,rl=y(()=>{"use strict";d_=St(Qt(),1);ha();Sge=/^(feat|fix)(\([^)]*\))?!?:/,wge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as eH}from"node:child_process";import{appendFileSync as $ge,existsSync as _O,mkdirSync as kge,readFileSync as Ege,renameSync as Age,statSync as Tge}from"node:fs";import{userInfo as Oge}from"node:os";import{dirname as Rge,join as vO}from"node:path";function SO(t){return vO(t,tH,Pge)}function Xr(t,e){let r=SO(t),n=Rge(r);_O(n)||kge(n,{recursive:!0});try{_O(r)&&Tge(r).size>Ige&&Age(r,vO(n,rH))}catch{}$ge(r,`${JSON.stringify(e)} +`,"utf8")}function bO(t){if(!_O(t))return[];let e=Ege(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ga(t){return bO(SO(t))}function f_(t){return[...bO(vO(t,tH,rH)),...bO(SO(t))]}function Qr(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 Cge(t){let e;try{e=eH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Oge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Dge(t){try{return eH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Af(t,e){try{let r=ga(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Dge(t),i=Cge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Af(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var tH,Pge,rH,Ige,Nr=y(()=>{"use strict";tH=".cladding",Pge="events.log.jsonl",rH="events.log.1.jsonl",Ige=5*1024*1024});import{execFileSync as Nge}from"node:child_process";import{existsSync as nH,readdirSync as jge,readFileSync as Mge,statSync as iH}from"node:fs";import{createHash as Fge}from"node:crypto";import{join as wO}from"node:path";function ya(t){try{return Nge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function xO(t){let e=[],r=wO(t,"spec.yaml");nH(r)&&iH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=wO(t,"spec",i);if(!(!nH(o)||!iH(o).isDirectory()))for(let s of jge(o))s.endsWith(".yaml")&&e.push(wO(o,s))}e.sort();let n=Fge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Mge(i)),n.update("\0")}return n.digest("hex")}function p_(t,e){let r={featureId:e,gitHead:ya(t),specDigest:xO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function m_(t,e){let r=ga(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 h_(t,e,r,n){let i=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Tf=y(()=>{"use strict";Nr()});import{readFileSync as Lge,statSync as zge}from"node:fs";import{extname as Uge,resolve as $O,sep as qge}from"node:path";function en(t){return Math.ceil(t.length/4)}function Gge(t,e){let r=$O(e),n=$O(r,t);return n===r||n.startsWith(r+qge)}function sH(t,e,r,n){if(!Gge(t,e))return{path:t,omitted:"unsafe-path"};if(!Bge.has(Uge(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>oH)return{path:t,omitted:"too-large",bytes:o}}else{let l=$O(e,t);try{o=zge(l).size}catch{return{path:t,omitted:"missing"}}if(o>oH)return{path:t,omitted:"too-large",bytes:o};try{i=Lge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Hge))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 Bge,rH,Hge,h_=y(()=>{"use strict";Bge=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"]),rH=2e6,Hge="\0"});function Vge(t){for(let i of Zge)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 wT(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Wge(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??[])wT(e,s,o);for(let s of i.modules??[])wT(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Vge(a);c&&wT(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=iH.get(t);return e||(e=Wge(t),iH.set(t,e)),e}var Zge,iH,_a=y(()=>{"use strict";Zge=["derived:","fixture:","script:","self-dogfood:"];iH=new WeakMap});function xT(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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Kge(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=xT(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:$T(i)}}var ba=y(()=>{"use strict";_a()});function oH(t){return t.impacted.length}function y_(t,e,r={}){let n=r.initialDepth??g_.initialDepth,i=r.maxDepth??g_.maxDepth,o=r.coverageThreshold??g_.coverageThreshold,s=r.marginYieldThreshold??g_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=xT(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=oH(_),x=S-p,w=S>0?x/S:0;f.push(w);let T=d>0?S/d:1,O=x===0&&b>n,A={frontierExhausted:O,coverage:T,marginalYields:[...f],totalKnownDependents:d};if(O)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(T>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var g_,kT=y(()=>{"use strict";ba();_a();g_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Jge(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 sH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Jge(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 aH=y(()=>{"use strict"});function Yge(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 nl(t,e){let r=Yge(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=sH(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 __=y(()=>{"use strict";aH()});import{existsSync as lH,readdirSync as Xge,readFileSync as Qge}from"node:fs";import{join as AT}from"node:path";function OT(t,e=tye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function rye(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:OT(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:OT(`done reverted \u2014 pre-push strict gate red${r}`)}}function cH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function nye(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 OT(n)}function iye(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)=>cH(m)-cH(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(-eye).map(rye),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?nye(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 ET(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function oye(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 sye(t,e,r){let n=ET(t,/_Rolled back at_\s*`([^`]+)`/),i=ET(t,/Last failed gate:\s*`([^`]+)`/),o=ET(t,/Retry attempts:\s*(\d+)/),s=oye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function aye(t,e){let r=AT(t,".cladding","post-mortems");if(!lH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Xge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(sye(Qge(AT(r,o),"utf8"),e,o))}catch{}return i}function uH(t,e){try{let r=d_(t),n=aye(t,e),i=lH(AT(t,".cladding","events.log.1.jsonl"));return iye(r,n,e,{truncated:i})}catch{return}}var eye,tye,dH=y(()=>{"use strict";Nr();eye=5,tye=120});function b_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function va(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:cye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let oe=[...a].sort();o=oe[0],oe.length>1&&(s=oe)}let c=nl(t,o);if("not_found"in c)return c;let l=c.focus,u=uH(n,l.id),d=a&&a.size>0?e:l.id,f=y_(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(oe=>oe.ears==="unwanted"||oe.ears==="state").map(oe=>({id:oe.id,ears:String(oe.ears)})),S=[...new Set(b.flatMap(oe=>oe.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}},T=[...c.ancestors];for(;T.length>lye&&b_(w,T,[])>i;)T.pop();T.lengthi){x.push(`code: omitted ${oe} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${oe}`)}O>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(oe,Pe)=>({impacted:oe,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(oe,Pe,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],io={...w,needs:T,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(oe,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(io))>i},se=m,Y=h;if($(se,Y,0,0)){let oe=br(t,d,{depth:1}),Pe=new Set("not_found"in oe?[]:oe.impacted.map(de=>de.id)),Kt=new Set("not_found"in oe?[]:oe.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],io=0;for(;Yt.length>Pe.size&&$(Yt,Y,io,0);)Yt=Yt.slice(0,-1),io++;let vi=[...h],Yr=0;for(;$(Yt,vi,io,Yr);){let de=-1;for(let oo=vi.length-1;oo>=0;oo--)if(!Kt.has(vi[oo])){de=oo;break}if(de<0)break;vi.splice(de,1),Yr++}se=Yt,Y=vi,io+Yr>0&&x.push(`breaks: omitted ${io} feature(s) / ${Yr} test(s)`),$(se,Y,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Te=D(se,Y),C={...w,needs:T,must_edit:{...w.must_edit,code:A},breaks_if_changed:Te},P=C;if(u){let oe={...C,prior_attempts:u};en(JSON.stringify(oe))<=i?P=oe:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var cye,lye,v_=y(()=>{"use strict";h_();__();kT();dH();ba();_a();cye=3e3,lye=3});function Kn(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 uye(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 fH(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=va(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=va(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=y_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let T of f.modules??[]){let O=e(T);O&&(S+=en(O))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:uye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var il,S_=y(()=>{"use strict";h_();kT();v_();_a();il="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as dye,existsSync as TT,mkdirSync as fye,readFileSync as pH}from"node:fs";import{dirname as pye,join as mye}from"node:path";function RT(t){return mye(t,hye,gye)}function yye(t,e){return{timestamp:new Date().toISOString(),head:ya(t),spec_digest:vT(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function mH(t,e){try{let r=yye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=IT(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=RT(t),s=pye(o);return TT(s)||fye(s,{recursive:!0}),dye(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function hH(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 IT(t,e){let r=RT(t);if(!TT(r))return[];let n;try{n=pH(r,"utf8")}catch{return[]}let i=hH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function gH(t){let e=RT(t);if(!TT(e))return{snapshots:[],unreadable:!1};let r;try{r=pH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=hH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Tf(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 yH(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?` (${Tf(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(` ${il}`),i.join(` -`)}var hye,gye,Rf=y(()=>{"use strict";Of();S_();hye=".cladding",gye="measure.jsonl"});import{existsSync as _ye}from"node:fs";import{join as bye}from"node:path";function ol(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}** (${vye[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 bH(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 ${Tf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Tf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Tf(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`,"",il),r.join(` +`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var Bge,oH,Hge,g_=y(()=>{"use strict";Bge=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"]),oH=2e6,Hge="\0"});function Vge(t){for(let i of Zge)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 kO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Wge(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??[])kO(e,s,o);for(let s of i.modules??[])kO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Vge(a);c&&kO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=aH.get(t);return e||(e=Wge(t),aH.set(t,e)),e}var Zge,aH,_a=y(()=>{"use strict";Zge=["derived:","fixture:","script:","self-dogfood:"];aH=new WeakMap});function EO(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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Kge(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=EO(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:AO(i)}}var ba=y(()=>{"use strict";_a()});function cH(t){return t.impacted.length}function __(t,e,r={}){let n=r.initialDepth??y_.initialDepth,i=r.maxDepth??y_.maxDepth,o=r.coverageThreshold??y_.coverageThreshold,s=r.marginYieldThreshold??y_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=EO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=cH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var y_,TO=y(()=>{"use strict";ba();_a();y_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Jge(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 lH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Jge(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 uH=y(()=>{"use strict"});function Yge(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 nl(t,e){let r=Yge(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=lH(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 b_=y(()=>{"use strict";uH()});import{existsSync as fH,readdirSync as Xge,readFileSync as Qge}from"node:fs";import{join as RO}from"node:path";function PO(t,e=tye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function rye(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:PO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:PO(`done reverted \u2014 pre-push strict gate red${r}`)}}function dH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function nye(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 PO(n)}function iye(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)=>dH(m)-dH(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(-eye).map(rye),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?nye(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 OO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function oye(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 sye(t,e,r){let n=OO(t,/_Rolled back at_\s*`([^`]+)`/),i=OO(t,/Last failed gate:\s*`([^`]+)`/),o=OO(t,/Retry attempts:\s*(\d+)/),s=oye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function aye(t,e){let r=RO(t,".cladding","post-mortems");if(!fH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Xge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(sye(Qge(RO(r,o),"utf8"),e,o))}catch{}return i}function pH(t,e){try{let r=f_(t),n=aye(t,e),i=fH(RO(t,".cladding","events.log.1.jsonl"));return iye(r,n,e,{truncated:i})}catch{return}}var eye,tye,mH=y(()=>{"use strict";Nr();eye=5,tye=120});function v_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function va(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:cye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let oe=[...a].sort();o=oe[0],oe.length>1&&(s=oe)}let c=nl(t,o);if("not_found"in c)return c;let l=c.focus,u=pH(n,l.id),d=a&&a.size>0?e:l.id,f=__(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(oe=>oe.ears==="unwanted"||oe.ears==="state").map(oe=>({id:oe.id,ears:String(oe.ears)})),S=[...new Set(b.flatMap(oe=>oe.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}},O=[...c.ancestors];for(;O.length>lye&&v_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${oe} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${oe}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(oe,Ie)=>({impacted:oe,regression_tests:Ie,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(oe,Ie,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],io={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(oe,Ie),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(io))>i},se=m,Y=h;if($(se,Y,0,0)){let oe=br(t,d,{depth:1}),Ie=new Set("not_found"in oe?[]:oe.impacted.map(de=>de.id)),Kt=new Set("not_found"in oe?[]:oe.test_refs),Yt=[...m.filter(de=>Ie.has(de.id)),...m.filter(de=>!Ie.has(de.id))],io=0;for(;Yt.length>Ie.size&&$(Yt,Y,io,0);)Yt=Yt.slice(0,-1),io++;let vi=[...h],Yr=0;for(;$(Yt,vi,io,Yr);){let de=-1;for(let oo=vi.length-1;oo>=0;oo--)if(!Kt.has(vi[oo])){de=oo;break}if(de<0)break;vi.splice(de,1),Yr++}se=Yt,Y=vi,io+Yr>0&&x.push(`breaks: omitted ${io} feature(s) / ${Yr} test(s)`),$(se,Y,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Oe=D(se,Y),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Oe},I=C;if(u){let oe={...C,prior_attempts:u};en(JSON.stringify(oe))<=i?I=oe:x.push("prior_attempts: omitted (budget)")}let Pr=en(JSON.stringify(I));return{...I,budget:{max_tokens:i,used_tokens:Pr,truncated:x}}}var cye,lye,S_=y(()=>{"use strict";g_();b_();TO();mH();ba();_a();cye=3e3,lye=3});function Kn(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 uye(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 hH(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=va(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=va(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=__(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:uye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var il,w_=y(()=>{"use strict";g_();TO();S_();_a();il="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as dye,existsSync as IO,mkdirSync as fye,readFileSync as gH}from"node:fs";import{dirname as pye,join as mye}from"node:path";function CO(t){return mye(t,hye,gye)}function yye(t,e){return{timestamp:new Date().toISOString(),head:ya(t),spec_digest:xO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function yH(t,e){try{let r=yye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=DO(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=CO(t),s=pye(o);return IO(s)||fye(s,{recursive:!0}),dye(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function _H(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 DO(t,e){let r=CO(t);if(!IO(r))return[];let n;try{n=gH(r,"utf8")}catch{return[]}let i=_H(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function bH(t){let e=CO(t);if(!IO(e))return{snapshots:[],unreadable:!1};let r;try{r=gH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=_H(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Of(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 vH(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?` (${Of(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(` ${il}`),i.join(` +`)}var hye,gye,Rf=y(()=>{"use strict";Tf();w_();hye=".cladding",gye="measure.jsonl"});import{existsSync as _ye}from"node:fs";import{join as bye}from"node:path";function ol(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}** (${vye[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 wH(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 ${Of(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Of(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Of(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`,"",il),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"} | ${wye(l,r)} |`)}return n.join(` -`)}function wye(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 Sye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${_ye(bye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function al(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),_H(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)_H(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function _H(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=mT(r);n&&t.push(`- ${n}`)}t.push("")}var vye,Sye,w_=y(()=>{"use strict";Rf();S_();rl();vye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Sye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as xye}from"node:fs";function ki(t="./spec.yaml"){let e=xye(t,"utf8");return(0,vH.parse)(e)}var vH,x_=y(()=>{"use strict";vH=vt(Qt(),1)});var ts=v((jr,NT)=>{"use strict";var PT=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+wH(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()};PT.prototype.toString=function(){return this.property+" "+this.message};var $_=jr.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};$_.prototype.addError=function(e){var r;if(typeof e=="string")r=new PT(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 PT(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new Sa(this);if(this.throwError)throw r;return r};$_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function $ye(t,e){return e+": "+t.toString()+` -`}$_.prototype.toString=function(e){return this.errors.map($ye).join("")};Object.defineProperty($_.prototype,"valid",{get:function(){return!this.errors.length}});NT.exports.ValidatorResultError=Sa;function Sa(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Sa),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}Sa.prototype=new Error;Sa.prototype.constructor=Sa;Sa.prototype.name="Validation Error";var SH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};SH.prototype=Object.create(Error.prototype,{constructor:{value:SH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var CT=jr.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+wH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};CT.prototype.resolve=function(e){return xH(this.base,e)};CT.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=xH(this.base,i||"");var s=new CT(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var wH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 kye(t,e,r,n){typeof r=="object"?e[n]=DT(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Eye(t,e,r){e[r]=t[r]}function Aye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=DT(t[n],e[n]):r[n]=e[n]}function DT(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(kye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Eye.bind(null,t,n)),Object.keys(e).forEach(Aye.bind(null,t,e,n))),n}NT.exports.deepMerge=DT;jr.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 Oye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Oye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var xH=jr.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 AH=v((oXe,EH)=>{"use strict";var tn=ts(),Fe=tn.ValidatorResult,rs=tn.SchemaError,jT={};jT.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=jT.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 MT(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new rs("anyOf must be an array");if(!r.anyOf.some(MT.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new rs("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new rs("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(MT.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=MT.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 FT(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new rs('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(FT(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=FT(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 $H(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('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&&$H.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)$H.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Tye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var LT=ts();zT.exports.SchemaScanResult=OH;function OH(t,e){this.id=t,this.ref=e}zT.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=LT.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=LT.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!LT.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 TH=AH(),ns=ts(),RH=k_().scan,IH=ns.ValidatorResult,Rye=ns.ValidatorResultError,If=ns.SchemaError,PH=ns.SchemaContext,Iye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ei),this.attributes=Object.create(TH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=RH(r||Iye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ns.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new If("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new If('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 Ei=Jt.prototype.types={};Ei.string=function(e){return typeof e=="string"};Ei.number=function(e){return typeof e=="number"&&isFinite(e)};Ei.integer=function(e){return typeof e=="number"&&e%1===0};Ei.boolean=function(e){return typeof e=="boolean"};Ei.array=function(e){return Array.isArray(e)};Ei.null=function(e){return e===null};Ei.date=function(e){return e instanceof Date};Ei.any=function(e){return!0};Ei.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};DH.exports=Jt});var jH=v((cXe,lo)=>{"use strict";var Pye=lo.exports.Validator=NH();lo.exports.ValidatorResult=ts().ValidatorResult;lo.exports.ValidatorResultError=ts().ValidatorResultError;lo.exports.ValidationError=ts().ValidationError;lo.exports.SchemaError=ts().SchemaError;lo.exports.SchemaScanResult=k_().SchemaScanResult;lo.exports.scan=k_().scan;lo.exports.validate=function(t,e,r){var n=new Pye;return n.validate(t,e,r)}});import{readFileSync as Cye}from"node:fs";import{dirname as Dye,join as Nye}from"node:path";import{fileURLToPath as jye}from"node:url";function Uye(t){let e=zye.validate(t,Lye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function FH(t){let e=Uye(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`)}function wye(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 Sye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${_ye(bye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function al(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),SH(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)SH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function SH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=yO(r);n&&t.push(`- ${n}`)}t.push("")}var vye,Sye,x_=y(()=>{"use strict";Rf();w_();rl();vye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Sye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as xye}from"node:fs";function ki(t="./spec.yaml"){let e=xye(t,"utf8");return(0,xH.parse)(e)}var xH,$_=y(()=>{"use strict";xH=St(Qt(),1)});var ts=v((jr,FO)=>{"use strict";var NO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+kH(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()};NO.prototype.toString=function(){return this.property+" "+this.message};var k_=jr.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};k_.prototype.addError=function(e){var r;if(typeof e=="string")r=new NO(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 NO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new Sa(this);if(this.throwError)throw r;return r};k_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function $ye(t,e){return e+": "+t.toString()+` +`}k_.prototype.toString=function(e){return this.errors.map($ye).join("")};Object.defineProperty(k_.prototype,"valid",{get:function(){return!this.errors.length}});FO.exports.ValidatorResultError=Sa;function Sa(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Sa),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}Sa.prototype=new Error;Sa.prototype.constructor=Sa;Sa.prototype.name="Validation Error";var $H=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};$H.prototype=Object.create(Error.prototype,{constructor:{value:$H,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var jO=jr.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+kH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};jO.prototype.resolve=function(e){return EH(this.base,e)};jO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=EH(this.base,i||"");var s=new jO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var kH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 kye(t,e,r,n){typeof r=="object"?e[n]=MO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Eye(t,e,r){e[r]=t[r]}function Aye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=MO(t[n],e[n]):r[n]=e[n]}function MO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(kye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Eye.bind(null,t,n)),Object.keys(e).forEach(Aye.bind(null,t,e,n))),n}FO.exports.deepMerge=MO;jr.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 Tye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Tye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var EH=jr.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 RH=v((oXe,OH)=>{"use strict";var tn=ts(),Fe=tn.ValidatorResult,rs=tn.SchemaError,LO={};LO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=LO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 zO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new rs("anyOf must be an array");if(!r.anyOf.some(zO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new rs("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new rs("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(zO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=zO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 UO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new rs('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(UO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=UO(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 AH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('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&&AH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)AH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Oye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var qO=ts();BO.exports.SchemaScanResult=PH;function PH(t,e){this.id=t,this.ref=e}BO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=qO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=qO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!qO.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 IH=RH(),ns=ts(),CH=E_().scan,DH=ns.ValidatorResult,Rye=ns.ValidatorResultError,Pf=ns.SchemaError,NH=ns.SchemaContext,Pye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ei),this.attributes=Object.create(IH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=CH(r||Pye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ns.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Pf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Pf('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 Ei=Jt.prototype.types={};Ei.string=function(e){return typeof e=="string"};Ei.number=function(e){return typeof e=="number"&&isFinite(e)};Ei.integer=function(e){return typeof e=="number"&&e%1===0};Ei.boolean=function(e){return typeof e=="boolean"};Ei.array=function(e){return Array.isArray(e)};Ei.null=function(e){return e===null};Ei.date=function(e){return e instanceof Date};Ei.any=function(e){return!0};Ei.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};MH.exports=Jt});var LH=v((cXe,lo)=>{"use strict";var Iye=lo.exports.Validator=FH();lo.exports.ValidatorResult=ts().ValidatorResult;lo.exports.ValidatorResultError=ts().ValidatorResultError;lo.exports.ValidationError=ts().ValidationError;lo.exports.SchemaError=ts().SchemaError;lo.exports.SchemaScanResult=E_().SchemaScanResult;lo.exports.scan=E_().scan;lo.exports.validate=function(t,e,r){var n=new Iye;return n.validate(t,e,r)}});import{readFileSync as Cye}from"node:fs";import{dirname as Dye,join as Nye}from"node:path";import{fileURLToPath as jye}from"node:url";function Uye(t){let e=zye.validate(t,Lye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function UH(t){let e=Uye(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var MH,Mye,Fye,Lye,zye,LH=y(()=>{"use strict";MH=vt(jH(),1),Mye=Dye(jye(import.meta.url)),Fye=Nye(Mye,"schema.json"),Lye=JSON.parse(Cye(Fye,"utf8")),zye=new MH.Validator});import{existsSync as UT,readdirSync as qye}from"node:fs";import{dirname as Bye,join as wa,resolve as UH}from"node:path";function zH(t){return UT(t)?qye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ki(wa(t,r))):[]}function xa(t,e){E_=e?{cwd:UH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return E_&&e==="spec.yaml"&&UH(t)===E_.cwd?E_.spec:Hye(t,e)}function Hye(t,e){let r=wa(t,e),n=ki(r),i=wa(t,Bye(e),"spec");if(!n.features||n.features.length===0){let o=zH(wa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=zH(wa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=wa(i,"architecture.yaml");UT(o)&&(n.architecture=ki(o))}if(!n.capabilities||n.capabilities.length===0){let o=wa(i,"capabilities.yaml");if(UT(o)){let s=ki(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return FH(n),n}var E_,qe=y(()=>{"use strict";x_();LH();E_=null});import cl from"node:process";function HT(){return!!cl.stdout.isTTY}function U(t,e,r=""){let n=qH[t],i=r?` ${r}`:"";HT()?cl.stdout.write(`${qT[t]}${n}${BT} ${e}${i} + `)}`)}var zH,Mye,Fye,Lye,zye,qH=y(()=>{"use strict";zH=St(LH(),1),Mye=Dye(jye(import.meta.url)),Fye=Nye(Mye,"schema.json"),Lye=JSON.parse(Cye(Fye,"utf8")),zye=new zH.Validator});import{existsSync as HO,readdirSync as qye}from"node:fs";import{dirname as Bye,join as wa,resolve as HH}from"node:path";function BH(t){return HO(t)?qye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ki(wa(t,r))):[]}function xa(t,e){A_=e?{cwd:HH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return A_&&e==="spec.yaml"&&HH(t)===A_.cwd?A_.spec:Hye(t,e)}function Hye(t,e){let r=wa(t,e),n=ki(r),i=wa(t,Bye(e),"spec");if(!n.features||n.features.length===0){let o=BH(wa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=BH(wa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=wa(i,"architecture.yaml");HO(o)&&(n.architecture=ki(o))}if(!n.capabilities||n.capabilities.length===0){let o=wa(i,"capabilities.yaml");if(HO(o)){let s=ki(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return UH(n),n}var A_,qe=y(()=>{"use strict";$_();qH();A_=null});import cl from"node:process";function VO(){return!!cl.stdout.isTTY}function U(t,e,r=""){let n=GH[t],i=r?` ${r}`:"";VO()?cl.stdout.write(`${GO[t]}${n}${ZO} ${e}${i} `):cl.stdout.write(`${n} ${e}${i} -`)}function Pf(t,e,r=""){if(!HT())return;let n=r?` ${r}`:"";cl.stdout.write(`${BH}${qT.start}\xB7${BT} ${t} \xB7 ${e}${n}`)}function $a(t,e,r=""){let n=qH[t],i=r?` ${r}`:"";HT()?cl.stdout.write(`${BH}${qT[t]}${n}${BT} ${e}${i} +`)}function If(t,e,r=""){if(!VO())return;let n=r?` ${r}`:"";cl.stdout.write(`${ZH}${GO.start}\xB7${ZO} ${t} \xB7 ${e}${n}`)}function $a(t,e,r=""){let n=GH[t],i=r?` ${r}`:"";VO()?cl.stdout.write(`${ZH}${GO[t]}${n}${ZO} ${e}${i} `):cl.stdout.write(`${n} ${e}${i} -`)}var qH,qT,BT,BH,Ai=y(()=>{"use strict";qH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},qT={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},BT="\x1B[0m",BH="\r\x1B[K"});import{createHash as uG}from"node:crypto";import{existsSync as w_e,readFileSync as VT,writeFileSync as x_e}from"node:fs";import{join as A_}from"node:path";function $_e(t,e){let r=uG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(VT(A_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function fG(t,e){let r=uG("sha256");try{r.update(VT(A_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function is(t){let e=A_(t,...dG);if(!w_e(e))return null;let r;try{r=VT(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function O_(t){return t.features?.size??t.v1?.size??0}function T_(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)!==fG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===$_e(e,n)?{state:"fresh"}:{state:"stale"}}function pG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${fG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=k_e+`attested_modules: +`)}var GH,GO,ZO,ZH,Ai=y(()=>{"use strict";GH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},GO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},ZO="\x1B[0m",ZH="\r\x1B[K"});import{createHash as pG}from"node:crypto";import{existsSync as w_e,readFileSync as JO,writeFileSync as x_e}from"node:fs";import{join as T_}from"node:path";function $_e(t,e){let r=pG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(JO(T_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function hG(t,e){let r=pG("sha256");try{r.update(JO(T_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function is(t){let e=T_(t,...mG);if(!w_e(e))return null;let r;try{r=JO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function O_(t){return t.features?.size??t.v1?.size??0}function R_(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)!==hG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===$_e(e,n)?{state:"fresh"}:{state:"stale"}}function gG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${hG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=k_e+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return x_e(A_(t,...dG),s,"utf8"),!0}var dG,k_e,ul=y(()=>{"use strict";dG=["spec","attestation.yaml"];k_e=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return x_e(T_(t,...mG),s,"utf8"),!0}var mG,k_e,ul=y(()=>{"use strict";mG=["spec","attestation.yaml"];k_e=`# 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. # @@ -211,52 +211,52 @@ 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 WT}from"node:path";function R_(t){os={cwd:WT(t),results:new Map}}function mG(t,e,r){!os||os.cwd!==WT(e)||os.results.set(t,r)}function I_(t,e){return!os||os.cwd!==WT(e)?null:os.results.get(t)??null}function P_(){os=null}var os,dl=y(()=>{"use strict";os=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 fo=y(()=>{});import{fileURLToPath as E_e}from"node:url";var fl,A_e,KT,JT,pl=y(()=>{fl=(t,e)=>{let r=JT(A_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},A_e=t=>KT(t)?t.toString():t,KT=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,JT=t=>t instanceof URL?E_e(t):t});var C_,YT=y(()=>{fo();pl();C_=(t,e=[],r={})=>{let n=fl(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 O_e}from"node:string_decoder";var hG,gG,zt,po,T_e,yG,R_e,D_,_G,I_e,Nf,P_e,XT,C_e,rn=y(()=>{({toString:hG}=Object.prototype),gG=t=>hG.call(t)==="[object ArrayBuffer]",zt=t=>hG.call(t)==="[object Uint8Array]",po=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),T_e=new TextEncoder,yG=t=>T_e.encode(t),R_e=new TextDecoder,D_=t=>R_e.decode(t),_G=(t,e)=>I_e(t,e).join(""),I_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new O_e(e),n=t.map(o=>typeof o=="string"?yG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Nf=t=>t.length===1&&zt(t[0])?t[0]:XT(P_e(t)),P_e=t=>t.map(e=>typeof e=="string"?yG(e):e),XT=t=>{let e=new Uint8Array(C_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},C_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as D_e}from"node:child_process";var wG,xG,N_e,j_e,bG,M_e,vG,SG,F_e,$G=y(()=>{fo();rn();wG=t=>Array.isArray(t)&&Array.isArray(t.raw),xG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=N_e({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,{}]},N_e=({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}=j_e(i,t.raw[n]),c=vG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>SG(d)):[SG(l)];return vG(c,u,a)},j_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=bG.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)],SG=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 F_e(t);throw t instanceof D_e||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`)},F_e=({stdout:t})=>{if(typeof t=="string")return t;if(zt(t))return D_(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 QT from"node:process";var Yn,N_,En,j_,mo=y(()=>{Yn=t=>N_.includes(t),N_=[QT.stdin,QT.stdout,QT.stderr],En=["stdin","stdout","stderr"],j_=t=>En[t]??`stdio[${t}]`});import{debuglog as L_e}from"node:util";var EG,eR,z_e,U_e,q_e,B_e,kG,H_e,tR,G_e,Z_e,V_e,W_e,rR,ho,go=y(()=>{fo();mo();EG=t=>{let e={...t};for(let r of rR)e[r]=eR(t,r);return e},eR=(t,e)=>{let r=Array.from({length:z_e(t)+1}),n=U_e(t[e],r,e);return Z_e(n,e)},z_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,U_e=(t,e,r)=>Ot(t)?q_e(t,e,r):e.fill(t),q_e=(t,e,r)=>{for(let n of Object.keys(t).sort(B_e))for(let i of H_e(n,r,e))e[i]=t[n];return e},B_e=(t,e)=>kG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,H_e=(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 YO}from"node:path";function P_(t){os={cwd:YO(t),results:new Map}}function yG(t,e,r){!os||os.cwd!==YO(e)||os.results.set(t,r)}function I_(t,e){return!os||os.cwd!==YO(e)?null:os.results.get(t)??null}function C_(){os=null}var os,dl=y(()=>{"use strict";os=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 fo=y(()=>{});import{fileURLToPath as E_e}from"node:url";var fl,A_e,XO,QO,pl=y(()=>{fl=(t,e)=>{let r=QO(A_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},A_e=t=>XO(t)?t.toString():t,XO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,QO=t=>t instanceof URL?E_e(t):t});var D_,eR=y(()=>{fo();pl();D_=(t,e=[],r={})=>{let n=fl(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 T_e}from"node:string_decoder";var _G,bG,Ut,po,O_e,vG,R_e,N_,SG,P_e,Nf,I_e,tR,C_e,rn=y(()=>{({toString:_G}=Object.prototype),bG=t=>_G.call(t)==="[object ArrayBuffer]",Ut=t=>_G.call(t)==="[object Uint8Array]",po=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),O_e=new TextEncoder,vG=t=>O_e.encode(t),R_e=new TextDecoder,N_=t=>R_e.decode(t),SG=(t,e)=>P_e(t,e).join(""),P_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new T_e(e),n=t.map(o=>typeof o=="string"?vG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Nf=t=>t.length===1&&Ut(t[0])?t[0]:tR(I_e(t)),I_e=t=>t.map(e=>typeof e=="string"?vG(e):e),tR=t=>{let e=new Uint8Array(C_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},C_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as D_e}from"node:child_process";var kG,EG,N_e,j_e,wG,M_e,xG,$G,F_e,AG=y(()=>{fo();rn();kG=t=>Array.isArray(t)&&Array.isArray(t.raw),EG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=N_e({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,{}]},N_e=({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}=j_e(i,t.raw[n]),c=xG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>$G(d)):[$G(l)];return xG(c,u,a)},j_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=wG.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)],$G=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 F_e(t);throw t instanceof D_e||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`)},F_e=({stdout:t})=>{if(typeof t=="string")return t;if(Ut(t))return N_(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 rR from"node:process";var Yn,j_,En,M_,mo=y(()=>{Yn=t=>j_.includes(t),j_=[rR.stdin,rR.stdout,rR.stderr],En=["stdin","stdout","stderr"],M_=t=>En[t]??`stdio[${t}]`});import{debuglog as L_e}from"node:util";var OG,nR,z_e,U_e,q_e,B_e,TG,H_e,iR,G_e,Z_e,V_e,W_e,oR,ho,go=y(()=>{fo();mo();OG=t=>{let e={...t};for(let r of oR)e[r]=nR(t,r);return e},nR=(t,e)=>{let r=Array.from({length:z_e(t)+1}),n=U_e(t[e],r,e);return Z_e(n,e)},z_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,U_e=(t,e,r)=>Ot(t)?q_e(t,e,r):e.fill(t),q_e=(t,e,r)=>{for(let n of Object.keys(t).sort(B_e))for(let i of H_e(n,r,e))e[i]=t[n];return e},B_e=(t,e)=>TG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,H_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=iR(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(En.includes(t))return En.indexOf(t);let e=G_e.exec(t);if(e!==null)return Number(e[1])},G_e=/^fd(\d+)$/,Z_e=(t,e)=>t.map(r=>r===void 0?W_e[e]:r),V_e=L_e("execa").enabled?"full":"none",W_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:V_e,stripFinalNewline:!0},rR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],ho=(t,e)=>e==="ipc"?t.at(-1):t[e]});var ml,hl,AG,nR,K_e,M_,F_,ss=y(()=>{go();ml=({verbose:t},e)=>nR(t,e)!=="none",hl=({verbose:t},e)=>!["none","short"].includes(nR(t,e)),AG=({verbose:t},e)=>{let r=nR(t,e);return M_(r)?r:void 0},nR=(t,e)=>e===void 0?K_e(t):ho(t,e),K_e=t=>t.find(e=>M_(e))??F_.findLast(e=>t.includes(e)),M_=t=>typeof t=="function",F_=["none","short","full"]});import{platform as J_e}from"node:process";import{stripVTControlCharacters as Y_e}from"node:util";var OG,jf,TG,X_e,Q_e,ebe,tbe,rbe,nbe,ibe,L_=y(()=>{OG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>nbe(TG(o))).join(" ");return{command:n,escapedCommand:i}},jf=t=>Y_e(t).split(` -`).map(e=>TG(e)).join(` -`),TG=t=>t.replaceAll(ebe,e=>X_e(e)),X_e=t=>{let e=tbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=rbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Q_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},ebe=Q_e(),tbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},rbe=65535,nbe=t=>ibe.test(t)?t:J_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,ibe=/^[\w./-]+$/});import RG from"node:process";function iR(){let{env:t}=RG,{TERM:e,TERM_PROGRAM:r}=t;return RG.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 IG=y(()=>{});var PG,CG,obe,sbe,abe,cbe,lbe,z_,f7e,DG=y(()=>{IG();PG={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"},CG={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"},obe={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"},sbe={...PG,...CG},abe={...PG,...obe},cbe=iR(),lbe=cbe?sbe:abe,z_=lbe,f7e=Object.entries(CG)});import ube from"node:tty";var dbe,_e,h7e,NG,g7e,y7e,_7e,b7e,v7e,S7e,w7e,x7e,$7e,k7e,E7e,A7e,O7e,T7e,R7e,U_,I7e,P7e,C7e,D7e,N7e,j7e,M7e,F7e,L7e,jG,z7e,MG,U7e,q7e,B7e,H7e,G7e,Z7e,V7e,W7e,K7e,J7e,Y7e,oR=y(()=>{dbe=ube?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!dbe)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}},h7e=_e(0,0),NG=_e(1,22),g7e=_e(2,22),y7e=_e(3,23),_7e=_e(4,24),b7e=_e(53,55),v7e=_e(7,27),S7e=_e(8,28),w7e=_e(9,29),x7e=_e(30,39),$7e=_e(31,39),k7e=_e(32,39),E7e=_e(33,39),A7e=_e(34,39),O7e=_e(35,39),T7e=_e(36,39),R7e=_e(37,39),U_=_e(90,39),I7e=_e(40,49),P7e=_e(41,49),C7e=_e(42,49),D7e=_e(43,49),N7e=_e(44,49),j7e=_e(45,49),M7e=_e(46,49),F7e=_e(47,49),L7e=_e(100,49),jG=_e(91,39),z7e=_e(92,39),MG=_e(93,39),U7e=_e(94,39),q7e=_e(95,39),B7e=_e(96,39),H7e=_e(97,39),G7e=_e(101,49),Z7e=_e(102,49),V7e=_e(103,49),W7e=_e(104,49),K7e=_e(105,49),J7e=_e(106,49),Y7e=_e(107,49)});var FG=y(()=>{oR();oR()});var UG,pbe,q_,LG,mbe,zG,hbe,qG=y(()=>{DG();FG();UG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=pbe(r),c=mbe[t]({failed:o,reject:s,piped:n}),l=hbe[t]({reject:s});return`${U_(`[${a}]`)} ${U_(`[${i}]`)} ${l(c)} ${l(e)}`},pbe=t=>`${q_(t.getHours(),2)}:${q_(t.getMinutes(),2)}:${q_(t.getSeconds(),2)}.${q_(t.getMilliseconds(),3)}`,q_=(t,e)=>String(t).padStart(e,"0"),LG=({failed:t,reject:e})=>t?e?z_.cross:z_.warning:z_.tick,mbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:LG,duration:LG},zG=t=>t,hbe={command:()=>NG,output:()=>zG,ipc:()=>zG,error:({reject:t})=>t?jG:MG,duration:()=>U_}});var BG,gbe,ybe,HG=y(()=>{ss();BG=(t,e,r)=>{let n=AG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>gbe(i,o,n)).filter(i=>i!==void 0).map(i=>ybe(i)).join("")},gbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ybe=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},iR=t=>{if(t==="all")return t;if(En.includes(t))return En.indexOf(t);let e=G_e.exec(t);if(e!==null)return Number(e[1])},G_e=/^fd(\d+)$/,Z_e=(t,e)=>t.map(r=>r===void 0?W_e[e]:r),V_e=L_e("execa").enabled?"full":"none",W_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:V_e,stripFinalNewline:!0},oR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],ho=(t,e)=>e==="ipc"?t.at(-1):t[e]});var ml,hl,RG,sR,K_e,F_,L_,ss=y(()=>{go();ml=({verbose:t},e)=>sR(t,e)!=="none",hl=({verbose:t},e)=>!["none","short"].includes(sR(t,e)),RG=({verbose:t},e)=>{let r=sR(t,e);return F_(r)?r:void 0},sR=(t,e)=>e===void 0?K_e(t):ho(t,e),K_e=t=>t.find(e=>F_(e))??L_.findLast(e=>t.includes(e)),F_=t=>typeof t=="function",L_=["none","short","full"]});import{platform as J_e}from"node:process";import{stripVTControlCharacters as Y_e}from"node:util";var PG,jf,IG,X_e,Q_e,ebe,tbe,rbe,nbe,ibe,z_=y(()=>{PG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>nbe(IG(o))).join(" ");return{command:n,escapedCommand:i}},jf=t=>Y_e(t).split(` +`).map(e=>IG(e)).join(` +`),IG=t=>t.replaceAll(ebe,e=>X_e(e)),X_e=t=>{let e=tbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=rbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Q_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},ebe=Q_e(),tbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},rbe=65535,nbe=t=>ibe.test(t)?t:J_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,ibe=/^[\w./-]+$/});import CG from"node:process";function aR(){let{env:t}=CG,{TERM:e,TERM_PROGRAM:r}=t;return CG.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 DG=y(()=>{});var NG,jG,obe,sbe,abe,cbe,lbe,U_,f7e,MG=y(()=>{DG();NG={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"},jG={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"},obe={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"},sbe={...NG,...jG},abe={...NG,...obe},cbe=aR(),lbe=cbe?sbe:abe,U_=lbe,f7e=Object.entries(jG)});import ube from"node:tty";var dbe,_e,h7e,FG,g7e,y7e,_7e,b7e,v7e,S7e,w7e,x7e,$7e,k7e,E7e,A7e,T7e,O7e,R7e,q_,P7e,I7e,C7e,D7e,N7e,j7e,M7e,F7e,L7e,LG,z7e,zG,U7e,q7e,B7e,H7e,G7e,Z7e,V7e,W7e,K7e,J7e,Y7e,cR=y(()=>{dbe=ube?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!dbe)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}},h7e=_e(0,0),FG=_e(1,22),g7e=_e(2,22),y7e=_e(3,23),_7e=_e(4,24),b7e=_e(53,55),v7e=_e(7,27),S7e=_e(8,28),w7e=_e(9,29),x7e=_e(30,39),$7e=_e(31,39),k7e=_e(32,39),E7e=_e(33,39),A7e=_e(34,39),T7e=_e(35,39),O7e=_e(36,39),R7e=_e(37,39),q_=_e(90,39),P7e=_e(40,49),I7e=_e(41,49),C7e=_e(42,49),D7e=_e(43,49),N7e=_e(44,49),j7e=_e(45,49),M7e=_e(46,49),F7e=_e(47,49),L7e=_e(100,49),LG=_e(91,39),z7e=_e(92,39),zG=_e(93,39),U7e=_e(94,39),q7e=_e(95,39),B7e=_e(96,39),H7e=_e(97,39),G7e=_e(101,49),Z7e=_e(102,49),V7e=_e(103,49),W7e=_e(104,49),K7e=_e(105,49),J7e=_e(106,49),Y7e=_e(107,49)});var UG=y(()=>{cR();cR()});var HG,pbe,B_,qG,mbe,BG,hbe,GG=y(()=>{MG();UG();HG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=pbe(r),c=mbe[t]({failed:o,reject:s,piped:n}),l=hbe[t]({reject:s});return`${q_(`[${a}]`)} ${q_(`[${i}]`)} ${l(c)} ${l(e)}`},pbe=t=>`${B_(t.getHours(),2)}:${B_(t.getMinutes(),2)}:${B_(t.getSeconds(),2)}.${B_(t.getMilliseconds(),3)}`,B_=(t,e)=>String(t).padStart(e,"0"),qG=({failed:t,reject:e})=>t?e?U_.cross:U_.warning:U_.tick,mbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:qG,duration:qG},BG=t=>t,hbe={command:()=>FG,output:()=>BG,ipc:()=>BG,error:({reject:t})=>t?LG:zG,duration:()=>q_}});var ZG,gbe,ybe,VG=y(()=>{ss();ZG=(t,e,r)=>{let n=RG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>gbe(i,o,n)).filter(i=>i!==void 0).map(i=>ybe(i)).join("")},gbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ybe=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as _be}from"node:util";var Oi,bbe,vbe,Sbe,B_,wbe,gl=y(()=>{L_();qG();HG();Oi=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=bbe({type:t,result:i,verboseInfo:n}),s=vbe(e,o),a=BG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},bbe=({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}),vbe=(t,e)=>t.split(` -`).map(r=>Sbe({...e,message:r})),Sbe=t=>({verboseLine:UG(t),verboseObject:t}),B_=t=>{let e=typeof t=="string"?t:_be(t);return jf(e).replaceAll(" "," ".repeat(wbe))},wbe=2});var GG,ZG=y(()=>{ss();gl();GG=(t,e)=>{ml(e)&&Oi({type:"command",verboseMessage:t,verboseInfo:e})}});var VG,xbe,$be,kbe,WG=y(()=>{ss();VG=(t,e,r)=>{kbe(t);let n=xbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},xbe=t=>ml({verbose:t})?$be++:void 0,$be=0n,kbe=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(!F_.includes(e)&&!M_(e)){let r=F_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as KG}from"node:process";var H_,sR,G_=y(()=>{H_=()=>KG.bigint(),sR=t=>Number(KG.bigint()-t)/1e6});var Z_,aR=y(()=>{ZG();WG();G_();L_();go();Z_=(t,e,r)=>{let n=H_(),{command:i,escapedCommand:o}=OG(t,e),s=eR(r,"verbose"),a=VG(s,o,{...r});return GG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var eZ=v((xQe,QG)=>{QG.exports=XG;XG.sync=Abe;var JG=He("fs");function Ebe(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{iZ.exports=rZ;rZ.sync=Obe;var tZ=He("fs");function rZ(t,e,r){tZ.stat(t,function(n,i){r(n,n?!1:nZ(i,e))})}function Obe(t,e){return nZ(tZ.statSync(t),e)}function nZ(t,e){return t.isFile()&&Tbe(t,e)}function Tbe(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 aZ=v((EQe,sZ)=>{var kQe=He("fs"),V_;process.platform==="win32"||global.TESTING_WINDOWS?V_=eZ():V_=oZ();sZ.exports=cR;cR.sync=Rbe;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)})})}V_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Rbe(t,e){try{return V_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var mZ=v((AQe,pZ)=>{var yl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",cZ=He("path"),Ibe=yl?";":":",lZ=aZ(),uZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),dZ=(t,e)=>{let r=e.colon||Ibe,n=t.match(/\//)||yl&&t.match(/\\/)?[""]:[...yl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=yl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=yl?i.split(r):[""];return yl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},fZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=dZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(uZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=cZ.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];lZ(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)},Pbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=dZ(t,e),o=[];for(let s=0;s{"use strict";var hZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};lR.exports=hZ;lR.exports.default=hZ});var vZ=v((TQe,bZ)=>{"use strict";var yZ=He("path"),Cbe=mZ(),Dbe=gZ();function _Z(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=Cbe.sync(t.command,{path:r[Dbe({env:r})],pathExt:e?yZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=yZ.resolve(i?t.options.cwd:"",s)),s}function Nbe(t){return _Z(t)||_Z(t,!0)}bZ.exports=Nbe});var SZ=v((RQe,dR)=>{"use strict";var uR=/([()\][%!^"`<>&|;, *?])/g;function jbe(t){return t=t.replace(uR,"^$1"),t}function Mbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(uR,"^$1"),e&&(t=t.replace(uR,"^$1")),t}dR.exports.command=jbe;dR.exports.argument=Mbe});var xZ=v((IQe,wZ)=>{"use strict";wZ.exports=/^#!(.*)/});var kZ=v((PQe,$Z)=>{"use strict";var Fbe=xZ();$Z.exports=(t="")=>{let e=t.match(Fbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var AZ=v((CQe,EZ)=>{"use strict";var fR=He("fs"),Lbe=kZ();function zbe(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 Lbe(r.toString())}EZ.exports=zbe});var IZ=v((DQe,RZ)=>{"use strict";var Ube=He("path"),OZ=vZ(),TZ=SZ(),qbe=AZ(),Bbe=process.platform==="win32",Hbe=/\.(?:com|exe)$/i,Gbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Zbe(t){t.file=OZ(t);let e=t.file&&qbe(t.file);return e?(t.args.unshift(t.file),t.command=e,OZ(t)):t.file}function Vbe(t){if(!Bbe)return t;let e=Zbe(t),r=!Hbe.test(e);if(t.options.forceShell||r){let n=Gbe.test(e);t.command=Ube.normalize(t.command),t.command=TZ.command(t.command),t.args=t.args.map(o=>TZ.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 Wbe(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:Vbe(n)}RZ.exports=Wbe});var DZ=v((NQe,CZ)=>{"use strict";var pR=process.platform==="win32";function mR(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 Kbe(t,e){if(!pR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=PZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function PZ(t,e){return pR&&t===1&&!e.file?mR(e.original,"spawn"):null}function Jbe(t,e){return pR&&t===1&&!e.file?mR(e.original,"spawnSync"):null}CZ.exports={hookChildProcess:Kbe,verifyENOENT:PZ,verifyENOENTSync:Jbe,notFoundError:mR}});var MZ=v((jQe,_l)=>{"use strict";var NZ=He("child_process"),hR=IZ(),gR=DZ();function jZ(t,e,r){let n=hR(t,e,r),i=NZ.spawn(n.command,n.args,n.options);return gR.hookChildProcess(i,n),i}function Ybe(t,e,r){let n=hR(t,e,r),i=NZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||gR.verifyENOENTSync(i.status,n),i}_l.exports=jZ;_l.exports.spawn=jZ;_l.exports.sync=Ybe;_l.exports._parse=hR;_l.exports._enoent=gR});function W_(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 FZ=y(()=>{});var LZ=y(()=>{});import{promisify as Xbe}from"node:util";import{execFile as Qbe,execFileSync as UQe}from"node:child_process";import zZ from"node:path";import{fileURLToPath as eve}from"node:url";function K_(t){return t instanceof URL?eve(t):t}function UZ(t){return{*[Symbol.iterator](){let e=zZ.resolve(K_(t)),r;for(;r!==e;)yield e,r=e,e=zZ.resolve(e,"..")}}}var HQe,GQe,qZ=y(()=>{LZ();HQe=Xbe(Qbe);GQe=10*1024*1024});import J_ from"node:process";import Ea from"node:path";var tve,rve,nve,BZ,HZ=y(()=>{FZ();qZ();tve=({cwd:t=J_.cwd(),path:e=J_.env[W_()],preferLocal:r=!0,execPath:n=J_.execPath,addExecPath:i=!0}={})=>{let o=Ea.resolve(K_(t)),s=[],a=e.split(Ea.delimiter);return r&&rve(s,a,o),i&&nve(s,a,n,o),e===""||e===Ea.delimiter?`${s.join(Ea.delimiter)}${e}`:[...s,e].join(Ea.delimiter)},rve=(t,e,r)=>{for(let n of UZ(r)){let i=Ea.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},nve=(t,e,r,n)=>{let i=Ea.resolve(n,K_(r),"..");e.includes(i)||t.push(i)},BZ=({env:t=J_.env,...e}={})=>{t={...t};let r=W_({env:t});return e.path=t[r],t[r]=tve(e),t}});var GZ,Xn,ZZ,VZ,WZ,Y_,Mf,Ff,Aa=y(()=>{GZ=(t,e,r)=>{let n=r?Ff:Mf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},ZZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,WZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},VZ=t=>Y_(t)&&WZ in t,WZ=Symbol("isExecaError"),Y_=t=>Object.prototype.toString.call(t)==="[object Error]",Mf=class extends Error{};ZZ(Mf,Mf.name);Ff=class extends Error{};ZZ(Ff,Ff.name)});var KZ,ive,JZ,YZ,XZ=y(()=>{KZ=()=>{let t=YZ-JZ+1;return Array.from({length:t},ive)},ive=(t,e)=>({name:`SIGRT${e+1}`,number:JZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),JZ=34,YZ=64});var QZ,e9=y(()=>{QZ=[{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 ove}from"node:os";var yR,sve,t9=y(()=>{e9();XZ();yR=()=>{let t=KZ();return[...QZ,...t].map(sve)},sve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=ove,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as ave}from"node:os";var cve,lve,r9,uve,dve,fve,cet,n9=y(()=>{t9();cve=()=>{let t=yR();return Object.fromEntries(t.map(lve))},lve=({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}],r9=cve(),uve=()=>{let t=yR(),e=65,r=Array.from({length:e},(n,i)=>dve(i,t));return Object.assign({},...r)},dve=(t,e)=>{let r=fve(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}}},fve=(t,e)=>{let r=e.find(({name:n})=>ave.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},cet=uve()});import{constants as Lf}from"node:os";var o9,s9,a9,pve,mve,i9,hve,_R,gve,yve,X_,zf=y(()=>{n9();o9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return a9(t,e)},s9=t=>t===0?t:a9(t,"`subprocess.kill()`'s argument"),a9=(t,e)=>{if(Number.isInteger(t))return pve(t,e);if(typeof t=="string")return hve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${_R()}`)},pve=(t,e)=>{if(i9.has(t))return i9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${_R()}`)},mve=()=>new Map(Object.entries(Lf.signals).reverse().map(([t,e])=>[e,t])),i9=mve(),hve=(t,e)=>{if(t in Lf.signals)return t;throw t.toUpperCase()in Lf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${_R()}`)},_R=()=>`Available signal names: ${gve()}. -Available signal numbers: ${yve()}.`,gve=()=>Object.keys(Lf.signals).sort().map(t=>`'${t}'`).join(", "),yve=()=>[...new Set(Object.values(Lf.signals).sort((t,e)=>t-e))].join(", "),X_=t=>r9[t].description});import{setTimeout as _ve}from"node:timers/promises";var c9,bve,l9,vve,Sve,wve,bR,Q_=y(()=>{Aa();zf();c9=t=>{if(t===!1)return t;if(t===!0)return bve;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},bve=1e3*5,l9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=vve(s,a,r);Sve(l,n);let u=t(c);return wve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},vve=(t,e,r)=>{let[n=r,i]=Y_(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&&!Y_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:s9(n),error:i}},Sve=(t,e)=>{t!==void 0&&e.reject(t)},wve=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 _ve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as xve}from"node:events";var eb,vR=y(()=>{eb=async(t,e)=>{t.aborted||await xve(t,"abort",{signal:e})}});var u9,d9,$ve,SR=y(()=>{vR();u9=({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)}`)},d9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[$ve(t,e,n,i)],$ve=async(t,e,r,{signal:n})=>{throw await eb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var bl,kve,wR,f9,p9,tb,m9,h9,g9,y9,_9,b9,Eve,Ave,Ove,Qn,Tve,as,vl,Sl=y(()=>{bl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{kve(t,e,r),wR(t,e,n)},kve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},wR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${as(e)} has already exited or disconnected.`)},f9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${as(t)} exited or disconnected.`)},p9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as _be}from"node:util";var Ti,bbe,vbe,Sbe,H_,wbe,gl=y(()=>{z_();GG();VG();Ti=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=bbe({type:t,result:i,verboseInfo:n}),s=vbe(e,o),a=ZG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},bbe=({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}),vbe=(t,e)=>t.split(` +`).map(r=>Sbe({...e,message:r})),Sbe=t=>({verboseLine:HG(t),verboseObject:t}),H_=t=>{let e=typeof t=="string"?t:_be(t);return jf(e).replaceAll(" "," ".repeat(wbe))},wbe=2});var WG,KG=y(()=>{ss();gl();WG=(t,e)=>{ml(e)&&Ti({type:"command",verboseMessage:t,verboseInfo:e})}});var JG,xbe,$be,kbe,YG=y(()=>{ss();JG=(t,e,r)=>{kbe(t);let n=xbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},xbe=t=>ml({verbose:t})?$be++:void 0,$be=0n,kbe=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(!L_.includes(e)&&!F_(e)){let r=L_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as XG}from"node:process";var G_,lR,Z_=y(()=>{G_=()=>XG.bigint(),lR=t=>Number(XG.bigint()-t)/1e6});var V_,uR=y(()=>{KG();YG();Z_();z_();go();V_=(t,e,r)=>{let n=G_(),{command:i,escapedCommand:o}=PG(t,e),s=nR(r,"verbose"),a=JG(s,o,{...r});return WG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var nZ=v((xQe,rZ)=>{rZ.exports=tZ;tZ.sync=Abe;var QG=He("fs");function Ebe(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{aZ.exports=oZ;oZ.sync=Tbe;var iZ=He("fs");function oZ(t,e,r){iZ.stat(t,function(n,i){r(n,n?!1:sZ(i,e))})}function Tbe(t,e){return sZ(iZ.statSync(t),e)}function sZ(t,e){return t.isFile()&&Obe(t,e)}function Obe(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 uZ=v((EQe,lZ)=>{var kQe=He("fs"),W_;process.platform==="win32"||global.TESTING_WINDOWS?W_=nZ():W_=cZ();lZ.exports=dR;dR.sync=Rbe;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)})})}W_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Rbe(t,e){try{return W_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var yZ=v((AQe,gZ)=>{var yl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",dZ=He("path"),Pbe=yl?";":":",fZ=uZ(),pZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),mZ=(t,e)=>{let r=e.colon||Pbe,n=t.match(/\//)||yl&&t.match(/\\/)?[""]:[...yl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=yl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=yl?i.split(r):[""];return yl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},hZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=mZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(pZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=dZ.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];fZ(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)},Ibe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=mZ(t,e),o=[];for(let s=0;s{"use strict";var _Z=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};fR.exports=_Z;fR.exports.default=_Z});var xZ=v((OQe,wZ)=>{"use strict";var vZ=He("path"),Cbe=yZ(),Dbe=bZ();function SZ(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=Cbe.sync(t.command,{path:r[Dbe({env:r})],pathExt:e?vZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=vZ.resolve(i?t.options.cwd:"",s)),s}function Nbe(t){return SZ(t)||SZ(t,!0)}wZ.exports=Nbe});var $Z=v((RQe,mR)=>{"use strict";var pR=/([()\][%!^"`<>&|;, *?])/g;function jbe(t){return t=t.replace(pR,"^$1"),t}function Mbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(pR,"^$1"),e&&(t=t.replace(pR,"^$1")),t}mR.exports.command=jbe;mR.exports.argument=Mbe});var EZ=v((PQe,kZ)=>{"use strict";kZ.exports=/^#!(.*)/});var TZ=v((IQe,AZ)=>{"use strict";var Fbe=EZ();AZ.exports=(t="")=>{let e=t.match(Fbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var RZ=v((CQe,OZ)=>{"use strict";var hR=He("fs"),Lbe=TZ();function zbe(t){let r=Buffer.alloc(150),n;try{n=hR.openSync(t,"r"),hR.readSync(n,r,0,150,0),hR.closeSync(n)}catch{}return Lbe(r.toString())}OZ.exports=zbe});var DZ=v((DQe,CZ)=>{"use strict";var Ube=He("path"),PZ=xZ(),IZ=$Z(),qbe=RZ(),Bbe=process.platform==="win32",Hbe=/\.(?:com|exe)$/i,Gbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Zbe(t){t.file=PZ(t);let e=t.file&&qbe(t.file);return e?(t.args.unshift(t.file),t.command=e,PZ(t)):t.file}function Vbe(t){if(!Bbe)return t;let e=Zbe(t),r=!Hbe.test(e);if(t.options.forceShell||r){let n=Gbe.test(e);t.command=Ube.normalize(t.command),t.command=IZ.command(t.command),t.args=t.args.map(o=>IZ.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 Wbe(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:Vbe(n)}CZ.exports=Wbe});var MZ=v((NQe,jZ)=>{"use strict";var gR=process.platform==="win32";function yR(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 Kbe(t,e){if(!gR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=NZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function NZ(t,e){return gR&&t===1&&!e.file?yR(e.original,"spawn"):null}function Jbe(t,e){return gR&&t===1&&!e.file?yR(e.original,"spawnSync"):null}jZ.exports={hookChildProcess:Kbe,verifyENOENT:NZ,verifyENOENTSync:Jbe,notFoundError:yR}});var zZ=v((jQe,_l)=>{"use strict";var FZ=He("child_process"),_R=DZ(),bR=MZ();function LZ(t,e,r){let n=_R(t,e,r),i=FZ.spawn(n.command,n.args,n.options);return bR.hookChildProcess(i,n),i}function Ybe(t,e,r){let n=_R(t,e,r),i=FZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||bR.verifyENOENTSync(i.status,n),i}_l.exports=LZ;_l.exports.spawn=LZ;_l.exports.sync=Ybe;_l.exports._parse=_R;_l.exports._enoent=bR});function K_(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 UZ=y(()=>{});var qZ=y(()=>{});import{promisify as Xbe}from"node:util";import{execFile as Qbe,execFileSync as UQe}from"node:child_process";import BZ from"node:path";import{fileURLToPath as eve}from"node:url";function J_(t){return t instanceof URL?eve(t):t}function HZ(t){return{*[Symbol.iterator](){let e=BZ.resolve(J_(t)),r;for(;r!==e;)yield e,r=e,e=BZ.resolve(e,"..")}}}var HQe,GQe,GZ=y(()=>{qZ();HQe=Xbe(Qbe);GQe=10*1024*1024});import Y_ from"node:process";import Ea from"node:path";var tve,rve,nve,ZZ,VZ=y(()=>{UZ();GZ();tve=({cwd:t=Y_.cwd(),path:e=Y_.env[K_()],preferLocal:r=!0,execPath:n=Y_.execPath,addExecPath:i=!0}={})=>{let o=Ea.resolve(J_(t)),s=[],a=e.split(Ea.delimiter);return r&&rve(s,a,o),i&&nve(s,a,n,o),e===""||e===Ea.delimiter?`${s.join(Ea.delimiter)}${e}`:[...s,e].join(Ea.delimiter)},rve=(t,e,r)=>{for(let n of HZ(r)){let i=Ea.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},nve=(t,e,r,n)=>{let i=Ea.resolve(n,J_(r),"..");e.includes(i)||t.push(i)},ZZ=({env:t=Y_.env,...e}={})=>{t={...t};let r=K_({env:t});return e.path=t[r],t[r]=tve(e),t}});var WZ,Xn,KZ,JZ,YZ,X_,Mf,Ff,Aa=y(()=>{WZ=(t,e,r)=>{let n=r?Ff:Mf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},KZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,YZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},JZ=t=>X_(t)&&YZ in t,YZ=Symbol("isExecaError"),X_=t=>Object.prototype.toString.call(t)==="[object Error]",Mf=class extends Error{};KZ(Mf,Mf.name);Ff=class extends Error{};KZ(Ff,Ff.name)});var XZ,ive,QZ,e9,t9=y(()=>{XZ=()=>{let t=e9-QZ+1;return Array.from({length:t},ive)},ive=(t,e)=>({name:`SIGRT${e+1}`,number:QZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),QZ=34,e9=64});var r9,n9=y(()=>{r9=[{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 ove}from"node:os";var vR,sve,i9=y(()=>{n9();t9();vR=()=>{let t=XZ();return[...r9,...t].map(sve)},sve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=ove,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as ave}from"node:os";var cve,lve,o9,uve,dve,fve,cet,s9=y(()=>{i9();cve=()=>{let t=vR();return Object.fromEntries(t.map(lve))},lve=({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}],o9=cve(),uve=()=>{let t=vR(),e=65,r=Array.from({length:e},(n,i)=>dve(i,t));return Object.assign({},...r)},dve=(t,e)=>{let r=fve(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}}},fve=(t,e)=>{let r=e.find(({name:n})=>ave.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},cet=uve()});import{constants as Lf}from"node:os";var c9,l9,u9,pve,mve,a9,hve,SR,gve,yve,Q_,zf=y(()=>{s9();c9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return u9(t,e)},l9=t=>t===0?t:u9(t,"`subprocess.kill()`'s argument"),u9=(t,e)=>{if(Number.isInteger(t))return pve(t,e);if(typeof t=="string")return hve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${SR()}`)},pve=(t,e)=>{if(a9.has(t))return a9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${SR()}`)},mve=()=>new Map(Object.entries(Lf.signals).reverse().map(([t,e])=>[e,t])),a9=mve(),hve=(t,e)=>{if(t in Lf.signals)return t;throw t.toUpperCase()in Lf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${SR()}`)},SR=()=>`Available signal names: ${gve()}. +Available signal numbers: ${yve()}.`,gve=()=>Object.keys(Lf.signals).sort().map(t=>`'${t}'`).join(", "),yve=()=>[...new Set(Object.values(Lf.signals).sort((t,e)=>t-e))].join(", "),Q_=t=>o9[t].description});import{setTimeout as _ve}from"node:timers/promises";var d9,bve,f9,vve,Sve,wve,wR,eb=y(()=>{Aa();zf();d9=t=>{if(t===!1)return t;if(t===!0)return bve;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},bve=1e3*5,f9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=vve(s,a,r);Sve(l,n);let u=t(c);return wve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},vve=(t,e,r)=>{let[n=r,i]=X_(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&&!X_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:l9(n),error:i}},Sve=(t,e)=>{t!==void 0&&e.reject(t)},wve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&wR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},wR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await _ve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as xve}from"node:events";var tb,xR=y(()=>{tb=async(t,e)=>{t.aborted||await xve(t,"abort",{signal:e})}});var p9,m9,$ve,$R=y(()=>{xR();p9=({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)}`)},m9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[$ve(t,e,n,i)],$ve=async(t,e,r,{signal:n})=>{throw await tb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var bl,kve,kR,h9,g9,rb,y9,_9,b9,v9,S9,w9,Eve,Ave,Tve,Qn,Ove,as,vl,Sl=y(()=>{bl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{kve(t,e,r),kR(t,e,n)},kve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},kR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${as(e)} has already exited or disconnected.`)},h9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${as(t)} exited or disconnected.`)},g9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(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([ ${Qn("getOneMessage",t)}, ${Qn("sendMessage",t,"message, {strict: true}")}, -]);`)},tb=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${as(e)}.`,{cause:t}),m9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is not listening to incoming messages.`)},h9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} exited without listening to incoming messages.`)},g9=()=>new Error(`\`cancelSignal\` aborted: the ${as(!0)} disconnected.`),y9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},_9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Qn(e,r)} cannot be used: the ${as(r)} is disconnecting.`,{cause:t})},b9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Eve(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Eve=({code:t,message:e})=>Ave.has(t)||Ove.some(r=>e.includes(r)),Ave=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Ove=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Tve(e)}${t}(${r})`,Tve=t=>t?"":"subprocess.",as=t=>t?"parent process":"subprocess",vl=t=>{t.connected&&t.disconnect()}});var Ti,wl=y(()=>{Ti=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var nb,xl,Ri,v9,Rve,Ive,S9,Pve,w9,Uf,rb,cs=y(()=>{go();nb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=v9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(S9(o,e,n,!0));return s},xl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=v9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(S9(o,e,n,!1));return s},Ri=new WeakMap,v9=(t,e,r)=>{let n=Rve(e,r);return Ive(n,e,r,t),n},Rve=(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(`"${Uf(e)}" must not be "${t}". +]);`)},rb=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${as(e)}.`,{cause:t}),y9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is not listening to incoming messages.`)},_9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} exited without listening to incoming messages.`)},b9=()=>new Error(`\`cancelSignal\` aborted: the ${as(!0)} disconnected.`),v9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},S9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Qn(e,r)} cannot be used: the ${as(r)} is disconnecting.`,{cause:t})},w9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Eve(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Eve=({code:t,message:e})=>Ave.has(t)||Tve.some(r=>e.includes(r)),Ave=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Tve=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Ove(e)}${t}(${r})`,Ove=t=>t?"":"subprocess.",as=t=>t?"parent process":"subprocess",vl=t=>{t.connected&&t.disconnect()}});var Oi,wl=y(()=>{Oi=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var ib,xl,Ri,x9,Rve,Pve,$9,Ive,k9,Uf,nb,cs=y(()=>{go();ib=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=x9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError($9(o,e,n,!0));return s},xl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=x9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError($9(o,e,n,!1));return s},Ri=new WeakMap,x9=(t,e,r)=>{let n=Rve(e,r);return Pve(n,e,r,t),n},Rve=(t,e)=>{let r=iR(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(`"${Uf(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},Ive=(t,e,r,n)=>{let i=n[w9(t)];if(i===void 0)throw new TypeError(`"${Uf(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(`"${Uf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Uf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},S9=(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}=Pve(t,r);return`The "${i}: ${rb(o)}" option is incompatible with using "${Uf(n)}: ${rb(e)}". -Please set this option with "pipe" instead.`},Pve=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=w9(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]}},w9=t=>t==="all"?1:t,Uf=t=>t?"to":"from",rb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Cve}from"node:events";var Oa,ib=y(()=>{Oa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Cve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var ob,xR,sb,$R,x9,$9,qf=y(()=>{ob=(t,e)=>{e&&xR(t)},xR=t=>{t.refCounted()},sb=(t,e)=>{e&&$R(t)},$R=t=>{t.unrefCounted()},x9=(t,e)=>{e&&($R(t),$R(t))},$9=(t,e)=>{e&&(xR(t),xR(t))}});import{once as Dve}from"node:events";import{scheduler as Nve}from"node:timers/promises";var k9,E9,ab,A9=y(()=>{lb();qf();cb();ub();k9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(T9(i)||I9(i))return;ab.has(t)||ab.set(t,[]);let o=ab.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await R9(t,n,i),await Nve.yield();let s=await O9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},E9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{kR();let o=ab.get(t);for(;o?.length>0;)await Dve(n,"message:done");t.removeListener("message",i),$9(e,r),n.connected=!1,n.emit("disconnect")},ab=new WeakMap});import{EventEmitter as jve}from"node:events";var ls,db,Mve,fb,Bf=y(()=>{A9();qf();ls=(t,e,r)=>{if(db.has(t))return db.get(t);let n=new jve;return n.connected=!0,db.set(t,n),Mve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},db=new WeakMap,Mve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=k9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",E9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),x9(r,n)},fb=t=>{let e=db.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Fve}from"node:events";var P9,Lve,C9,O9,T9,D9,pb,zve,mb,N9,cb=y(()=>{wl();ib();yb();Sl();Bf();lb();P9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ls(t,e,r),s=hb(t,o);return{id:Lve++,type:mb,message:n,hasListeners:s}},Lve=0n,C9=(t,e)=>{if(!(e?.type!==mb||e.hasListeners))for(let{id:r}of t)r!==void 0&&pb[r].resolve({isDeadlock:!0,hasListeners:!1})},O9=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:N9,message:hb(e,i)};try{await gb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},T9=t=>{if(t?.type!==N9)return!1;let{id:e,message:r}=t;return pb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},D9=async(t,e,r)=>{if(t?.type!==mb)return;let n=Ti();pb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,zve(e,r,i)]);o&&p9(r),s||m9(r)}finally{i.abort(),delete pb[t.id]}},pb={},zve=async(t,e,{signal:r})=>{Oa(t,1,r),await Fve(t,"disconnect",{signal:r}),h9(e)},mb="execa:ipc:request",N9="execa:ipc:response"});var j9,M9,R9,Hf,hb,Uve,lb=y(()=>{wl();go();cs();cb();j9=(t,e,r)=>{Hf.has(t)||Hf.set(t,new Set);let n=Hf.get(t),i=Ti(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},M9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},R9=async(t,e,r)=>{for(;!hb(t,e)&&Hf.get(t)?.size>0;){let n=[...Hf.get(t)];C9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Hf=new WeakMap,hb=(t,e)=>e.listenerCount("message")>Uve(t),Uve=t=>Ri.has(t)&&!ho(Ri.get(t).options.buffer,"ipc")?1:0});import{promisify as qve}from"node:util";var gb,Bve,AR,Hve,ER,yb=y(()=>{Sl();lb();cb();gb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return bl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),Bve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},Bve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=P9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=j9(t,s,o);try{await AR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw vl(t),c}finally{M9(a)}},AR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Hve(t);try{await Promise.all([D9(n,t,r),o(n)])}catch(s){throw _9({error:s,methodName:e,isSubprocess:r}),b9({error:s,methodName:e,isSubprocess:r,message:i}),s}},Hve=t=>{if(ER.has(t))return ER.get(t);let e=qve(t.send.bind(t));return ER.set(t,e),e},ER=new WeakMap});import{scheduler as Gve}from"node:timers/promises";var L9,z9,Zve,F9,I9,U9,kR,OR,ub=y(()=>{yb();Bf();Sl();L9=(t,e)=>{let r="cancelSignal";return wR(r,!1,t.connected),AR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:U9,message:e},message:e})},z9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Zve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),OR.signal),Zve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!F9){if(F9=!0,!n){y9();return}if(e===null){kR();return}ls(t,e,r),await Gve.yield()}},F9=!1,I9=t=>t?.type!==U9?!1:(OR.abort(t.message),!0),U9="execa:ipc:cancel",kR=()=>{OR.abort(g9())},OR=new AbortController});var q9,B9,Vve,Wve,TR=y(()=>{vR();ub();Q_();q9=({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.")}},B9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[Vve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],Vve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await eb(e,i);let o=Wve(e);throw await L9(t,o),bR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Wve=({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 Kve}from"node:timers/promises";var H9,G9,Jve,RR=y(()=>{Aa();H9=({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})`)},G9=(t,e,r,n)=>e===0||e===void 0?[]:[Jve(t,e,r,n)],Jve=async(t,e,r,{signal:n})=>{throw await Kve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as Yve,execArgv as Xve}from"node:process";import Z9 from"node:path";var V9,W9,IR=y(()=>{pl();V9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},W9=(t,e,{node:r=!1,nodePath:n=Yve,nodeOptions:i=Xve.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=fl(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 Qve}from"node:v8";var K9,eSe,tSe,rSe,J9,PR=y(()=>{K9=({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`.");rSe[r](t)}},eSe=t=>{try{Qve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},tSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},rSe={advanced:eSe,json:tSe},J9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var X9,nSe,nn,CR,iSe,Y9,_b,Ta=y(()=>{X9=({encoding:t})=>{if(CR.has(t))return;let e=iSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${_b(t)}\`. -Please rename it to ${_b(e)}.`);let r=[...CR].map(n=>_b(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${_b(t)}\`. -Please rename it to one of: ${r}.`)},nSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),CR=new Set([...nSe,...nn]),iSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in Y9)return Y9[e];if(CR.has(e))return e},Y9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},_b=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as oSe}from"node:fs";import sSe from"node:path";import aSe from"node:process";var Q9,eV,tV,DR=y(()=>{pl();Q9=(t=eV())=>{let e=fl(t,'The "cwd" option');return sSe.resolve(e)},eV=()=>{try{return aSe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},tV=(t,e)=>{if(e===eV())return t;let r;try{r=oSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},Pve=(t,e,r,n)=>{let i=n[k9(t)];if(i===void 0)throw new TypeError(`"${Uf(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(`"${Uf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Uf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},$9=(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}=Ive(t,r);return`The "${i}: ${nb(o)}" option is incompatible with using "${Uf(n)}: ${nb(e)}". +Please set this option with "pipe" instead.`},Ive=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=k9(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]}},k9=t=>t==="all"?1:t,Uf=t=>t?"to":"from",nb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Cve}from"node:events";var Ta,ob=y(()=>{Ta=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Cve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var sb,ER,ab,AR,E9,A9,qf=y(()=>{sb=(t,e)=>{e&&ER(t)},ER=t=>{t.refCounted()},ab=(t,e)=>{e&&AR(t)},AR=t=>{t.unrefCounted()},E9=(t,e)=>{e&&(AR(t),AR(t))},A9=(t,e)=>{e&&(ER(t),ER(t))}});import{once as Dve}from"node:events";import{scheduler as Nve}from"node:timers/promises";var T9,O9,cb,R9=y(()=>{ub();qf();lb();db();T9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(I9(i)||D9(i))return;cb.has(t)||cb.set(t,[]);let o=cb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await C9(t,n,i),await Nve.yield();let s=await P9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},O9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{TR();let o=cb.get(t);for(;o?.length>0;)await Dve(n,"message:done");t.removeListener("message",i),A9(e,r),n.connected=!1,n.emit("disconnect")},cb=new WeakMap});import{EventEmitter as jve}from"node:events";var ls,fb,Mve,pb,Bf=y(()=>{R9();qf();ls=(t,e,r)=>{if(fb.has(t))return fb.get(t);let n=new jve;return n.connected=!0,fb.set(t,n),Mve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},fb=new WeakMap,Mve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=T9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",O9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),E9(r,n)},pb=t=>{let e=fb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Fve}from"node:events";var N9,Lve,j9,P9,I9,M9,mb,zve,hb,F9,lb=y(()=>{wl();ob();_b();Sl();Bf();ub();N9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ls(t,e,r),s=gb(t,o);return{id:Lve++,type:hb,message:n,hasListeners:s}},Lve=0n,j9=(t,e)=>{if(!(e?.type!==hb||e.hasListeners))for(let{id:r}of t)r!==void 0&&mb[r].resolve({isDeadlock:!0,hasListeners:!1})},P9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==hb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:F9,message:gb(e,i)};try{await yb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},I9=t=>{if(t?.type!==F9)return!1;let{id:e,message:r}=t;return mb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},M9=async(t,e,r)=>{if(t?.type!==hb)return;let n=Oi();mb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,zve(e,r,i)]);o&&g9(r),s||y9(r)}finally{i.abort(),delete mb[t.id]}},mb={},zve=async(t,e,{signal:r})=>{Ta(t,1,r),await Fve(t,"disconnect",{signal:r}),_9(e)},hb="execa:ipc:request",F9="execa:ipc:response"});var L9,z9,C9,Hf,gb,Uve,ub=y(()=>{wl();go();cs();lb();L9=(t,e,r)=>{Hf.has(t)||Hf.set(t,new Set);let n=Hf.get(t),i=Oi(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},z9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},C9=async(t,e,r)=>{for(;!gb(t,e)&&Hf.get(t)?.size>0;){let n=[...Hf.get(t)];j9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Hf=new WeakMap,gb=(t,e)=>e.listenerCount("message")>Uve(t),Uve=t=>Ri.has(t)&&!ho(Ri.get(t).options.buffer,"ipc")?1:0});import{promisify as qve}from"node:util";var yb,Bve,RR,Hve,OR,_b=y(()=>{Sl();ub();lb();yb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return bl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),Bve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},Bve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=N9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=L9(t,s,o);try{await RR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw vl(t),c}finally{z9(a)}},RR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Hve(t);try{await Promise.all([M9(n,t,r),o(n)])}catch(s){throw S9({error:s,methodName:e,isSubprocess:r}),w9({error:s,methodName:e,isSubprocess:r,message:i}),s}},Hve=t=>{if(OR.has(t))return OR.get(t);let e=qve(t.send.bind(t));return OR.set(t,e),e},OR=new WeakMap});import{scheduler as Gve}from"node:timers/promises";var q9,B9,Zve,U9,D9,H9,TR,PR,db=y(()=>{_b();Bf();Sl();q9=(t,e)=>{let r="cancelSignal";return kR(r,!1,t.connected),RR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:H9,message:e},message:e})},B9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Zve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),PR.signal),Zve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!U9){if(U9=!0,!n){v9();return}if(e===null){TR();return}ls(t,e,r),await Gve.yield()}},U9=!1,D9=t=>t?.type!==H9?!1:(PR.abort(t.message),!0),H9="execa:ipc:cancel",TR=()=>{PR.abort(b9())},PR=new AbortController});var G9,Z9,Vve,Wve,IR=y(()=>{xR();db();eb();G9=({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.")}},Z9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[Vve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],Vve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await tb(e,i);let o=Wve(e);throw await q9(t,o),wR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Wve=({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 Kve}from"node:timers/promises";var V9,W9,Jve,CR=y(()=>{Aa();V9=({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})`)},W9=(t,e,r,n)=>e===0||e===void 0?[]:[Jve(t,e,r,n)],Jve=async(t,e,r,{signal:n})=>{throw await Kve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as Yve,execArgv as Xve}from"node:process";import K9 from"node:path";var J9,Y9,DR=y(()=>{pl();J9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},Y9=(t,e,{node:r=!1,nodePath:n=Yve,nodeOptions:i=Xve.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=fl(n,'The "nodePath" option'),l=K9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(K9.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 Qve}from"node:v8";var X9,eSe,tSe,rSe,Q9,NR=y(()=>{X9=({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`.");rSe[r](t)}},eSe=t=>{try{Qve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},tSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},rSe={advanced:eSe,json:tSe},Q9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var tV,nSe,nn,jR,iSe,eV,bb,Oa=y(()=>{tV=({encoding:t})=>{if(jR.has(t))return;let e=iSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${bb(t)}\`. +Please rename it to ${bb(e)}.`);let r=[...jR].map(n=>bb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${bb(t)}\`. +Please rename it to one of: ${r}.`)},nSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),jR=new Set([...nSe,...nn]),iSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in eV)return eV[e];if(jR.has(e))return e},eV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},bb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as oSe}from"node:fs";import sSe from"node:path";import aSe from"node:process";var rV,nV,iV,MR=y(()=>{pl();rV=(t=nV())=>{let e=fl(t,'The "cwd" option');return sSe.resolve(e)},nV=()=>{try{return aSe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},iV=(t,e)=>{if(e===nV())return t;let r;try{r=oSe(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 cSe from"node:path";import rV from"node:process";var nV,bb,lSe,uSe,NR=y(()=>{nV=vt(MZ(),1);HZ();Q_();zf();SR();TR();RR();IR();PR();Ta();DR();pl();go();bb=(t,e,r)=>{r.cwd=Q9(r.cwd);let[n,i,o]=W9(t,e,r),{command:s,args:a,options:c}=nV.default._parse(n,i,o),l=EG(c),u=lSe(l);return H9(u),X9(u),K9(u),u9(u),q9(u),u.shell=JT(u.shell),u.env=uSe(u),u.killSignal=o9(u.killSignal),u.forceKillAfterDelay=c9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),rV.platform==="win32"&&cSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},lSe=({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}),uSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...rV.env,...t}:t;return r||n?BZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var vb,jR=y(()=>{vb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function $l(t){if(typeof t=="string")return dSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return fSe(t)}var dSe,fSe,iV,pSe,oV,mSe,MR=y(()=>{dSe=t=>t.at(-1)===iV?t.slice(0,t.at(-2)===oV?-2:-1):t,fSe=t=>t.at(-1)===pSe?t.subarray(0,t.at(-2)===mSe?-2:-1):t,iV=` -`,pSe=iV.codePointAt(0),oV="\r",mSe=oV.codePointAt(0)});function ei(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 FR(t,{checkOpen:e=!0}={}){return ei(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 Ra(t,{checkOpen:e=!0}={}){return ei(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 LR(t,e){return FR(t,e)&&Ra(t,e)}var Ia=y(()=>{});function sV(){return this[UR].next()}function aV(t){return this[UR].return(t)}function qR({preventCancel:t=!1}={}){let e=this.getReader(),r=new zR(e,t),n=Object.create(gSe);return n[UR]=r,n}var hSe,zR,UR,gSe,cV=y(()=>{hSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),zR=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}}},UR=Symbol();Object.defineProperty(sV,"name",{value:"next"});Object.defineProperty(aV,"name",{value:"return"});gSe=Object.create(hSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:sV},return:{enumerable:!0,configurable:!0,writable:!0,value:aV}})});var lV=y(()=>{});var uV=y(()=>{cV();lV()});var dV,ySe,_Se,bSe,Gf,BR=y(()=>{Ia();uV();dV=t=>{if(Ra(t,{checkOpen:!1})&&Gf.on!==void 0)return _Se(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(ySe.call(t)==="[object ReadableStream]")return qR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:ySe}=Object.prototype,_Se=async function*(t){let e=new AbortController,r={};bSe(t,e,r);try{for await(let[n]of Gf.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()}},bSe=async(t,e,r)=>{try{await Gf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Gf={}});var kl,vSe,mV,fV,SSe,pV,Ii,Zf=y(()=>{BR();kl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=dV(t),u=e();u.length=0;try{for await(let d of l){let f=SSe(d),p=r[f](d,u);mV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return vSe({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}},vSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&mV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},mV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){fV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&fV(c,e,i,o),new Ii},fV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},SSe=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=pV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&pV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:pV}=Object.prototype,Ii=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var yo,Vf,Sb,wb,xb,$b=y(()=>{yo=t=>t,Vf=()=>{},Sb=({contents:t})=>t,wb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},xb=t=>t.length});async function kb(t,e){return kl(t,kSe,e)}var wSe,xSe,$Se,kSe,hV=y(()=>{Zf();$b();wSe=()=>({contents:[]}),xSe=()=>1,$Se=(t,{contents:e})=>(e.push(t),e),kSe={init:wSe,convertChunk:{string:yo,buffer:yo,arrayBuffer:yo,dataView:yo,typedArray:yo,others:yo},getSize:xSe,truncateChunk:Vf,addChunk:$Se,getFinalChunk:Vf,finalize:Sb}});async function Eb(t,e){return kl(t,DSe,e)}var ESe,ASe,OSe,gV,yV,TSe,RSe,ISe,PSe,bV,_V,CSe,vV,DSe,SV=y(()=>{Zf();$b();ESe=()=>({contents:new ArrayBuffer(0)}),ASe=t=>OSe.encode(t),OSe=new TextEncoder,gV=t=>new Uint8Array(t),yV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),TSe=(t,e)=>t.slice(0,e),RSe=(t,{contents:e,length:r},n)=>{let i=vV()?PSe(e,n):ISe(e,n);return new Uint8Array(i).set(t,r),i},ISe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(bV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},PSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:bV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},bV=t=>_V**Math.ceil(Math.log(t)/Math.log(_V)),_V=2,CSe=({contents:t,length:e})=>vV()?t:t.slice(0,e),vV=()=>"resize"in ArrayBuffer.prototype,DSe={init:ESe,convertChunk:{string:ASe,buffer:gV,arrayBuffer:gV,dataView:yV,typedArray:yV,others:wb},getSize:xb,truncateChunk:TSe,addChunk:RSe,getFinalChunk:Vf,finalize:CSe}});async function Ob(t,e){return kl(t,LSe,e)}var NSe,Ab,jSe,MSe,FSe,LSe,wV=y(()=>{Zf();$b();NSe=()=>({contents:"",textDecoder:new TextDecoder}),Ab=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),jSe=(t,{contents:e})=>e+t,MSe=(t,e)=>t.slice(0,e),FSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},LSe={init:NSe,convertChunk:{string:yo,buffer:Ab,arrayBuffer:Ab,dataView:Ab,typedArray:Ab,others:wb},getSize:xb,truncateChunk:MSe,addChunk:jSe,getFinalChunk:FSe,finalize:Sb}});var xV=y(()=>{hV();SV();wV();Zf()});import{on as zSe}from"node:events";import{finished as USe}from"node:stream/promises";var Tb=y(()=>{BR();xV();Object.assign(Gf,{on:zSe,finished:USe})});var $V,qSe,kV,EV,BSe,AV,OV,Rb,Pa=y(()=>{Tb();mo();go();$V=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ii))throw t;if(o==="all")return t;let s=qSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},qSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",kV=(t,e,r)=>{if(e.length!==r)return;let n=new Ii;throw n.maxBufferInfo={fdNumber:"ipc"},n},EV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=BSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},BSe=(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=ho(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:j_(r),threshold:i,unit:n}},AV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Rb(r)),OV=(t,e,r)=>{if(!e)return t;let n=Rb(r);return t.length>n?t.slice(0,n):t},Rb=([,t])=>t});import{inspect as HSe}from"node:util";var RV,GSe,ZSe,VSe,WSe,KSe,TV,IV=y(()=>{MR();rn();DR();L_();Pa();zf();Aa();RV=({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=GSe({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=VSe(n,b),w=x===void 0?"":` -${x}`,T=`${S}: ${a}${w}`,O=e===void 0?[t[2],t[1]]:[e],A=[T,...O,...t.slice(3),r.map(D=>WSe(D)).join(` +${t}`}});import cSe from"node:path";import oV from"node:process";var sV,vb,lSe,uSe,FR=y(()=>{sV=St(zZ(),1);VZ();eb();zf();$R();IR();CR();DR();NR();Oa();MR();pl();go();vb=(t,e,r)=>{r.cwd=rV(r.cwd);let[n,i,o]=Y9(t,e,r),{command:s,args:a,options:c}=sV.default._parse(n,i,o),l=OG(c),u=lSe(l);return V9(u),tV(u),X9(u),p9(u),G9(u),u.shell=QO(u.shell),u.env=uSe(u),u.killSignal=c9(u.killSignal),u.forceKillAfterDelay=d9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),oV.platform==="win32"&&cSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},lSe=({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}),uSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...oV.env,...t}:t;return r||n?ZZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Sb,LR=y(()=>{Sb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function $l(t){if(typeof t=="string")return dSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return fSe(t)}var dSe,fSe,aV,pSe,cV,mSe,zR=y(()=>{dSe=t=>t.at(-1)===aV?t.slice(0,t.at(-2)===cV?-2:-1):t,fSe=t=>t.at(-1)===pSe?t.subarray(0,t.at(-2)===mSe?-2:-1):t,aV=` +`,pSe=aV.codePointAt(0),cV="\r",mSe=cV.codePointAt(0)});function ei(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 UR(t,{checkOpen:e=!0}={}){return ei(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 Ra(t,{checkOpen:e=!0}={}){return ei(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 qR(t,e){return UR(t,e)&&Ra(t,e)}var Pa=y(()=>{});function lV(){return this[HR].next()}function uV(t){return this[HR].return(t)}function GR({preventCancel:t=!1}={}){let e=this.getReader(),r=new BR(e,t),n=Object.create(gSe);return n[HR]=r,n}var hSe,BR,HR,gSe,dV=y(()=>{hSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),BR=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}}},HR=Symbol();Object.defineProperty(lV,"name",{value:"next"});Object.defineProperty(uV,"name",{value:"return"});gSe=Object.create(hSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:lV},return:{enumerable:!0,configurable:!0,writable:!0,value:uV}})});var fV=y(()=>{});var pV=y(()=>{dV();fV()});var mV,ySe,_Se,bSe,Gf,ZR=y(()=>{Pa();pV();mV=t=>{if(Ra(t,{checkOpen:!1})&&Gf.on!==void 0)return _Se(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(ySe.call(t)==="[object ReadableStream]")return GR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:ySe}=Object.prototype,_Se=async function*(t){let e=new AbortController,r={};bSe(t,e,r);try{for await(let[n]of Gf.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()}},bSe=async(t,e,r)=>{try{await Gf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Gf={}});var kl,vSe,yV,hV,SSe,gV,Pi,Zf=y(()=>{ZR();kl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=mV(t),u=e();u.length=0;try{for await(let d of l){let f=SSe(d),p=r[f](d,u);yV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return vSe({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}},vSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&yV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},yV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){hV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&hV(c,e,i,o),new Pi},hV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},SSe=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=gV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&gV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:gV}=Object.prototype,Pi=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var yo,Vf,wb,xb,$b,kb=y(()=>{yo=t=>t,Vf=()=>{},wb=({contents:t})=>t,xb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},$b=t=>t.length});async function Eb(t,e){return kl(t,kSe,e)}var wSe,xSe,$Se,kSe,_V=y(()=>{Zf();kb();wSe=()=>({contents:[]}),xSe=()=>1,$Se=(t,{contents:e})=>(e.push(t),e),kSe={init:wSe,convertChunk:{string:yo,buffer:yo,arrayBuffer:yo,dataView:yo,typedArray:yo,others:yo},getSize:xSe,truncateChunk:Vf,addChunk:$Se,getFinalChunk:Vf,finalize:wb}});async function Ab(t,e){return kl(t,DSe,e)}var ESe,ASe,TSe,bV,vV,OSe,RSe,PSe,ISe,wV,SV,CSe,xV,DSe,$V=y(()=>{Zf();kb();ESe=()=>({contents:new ArrayBuffer(0)}),ASe=t=>TSe.encode(t),TSe=new TextEncoder,bV=t=>new Uint8Array(t),vV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),OSe=(t,e)=>t.slice(0,e),RSe=(t,{contents:e,length:r},n)=>{let i=xV()?ISe(e,n):PSe(e,n);return new Uint8Array(i).set(t,r),i},PSe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(wV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},ISe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:wV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},wV=t=>SV**Math.ceil(Math.log(t)/Math.log(SV)),SV=2,CSe=({contents:t,length:e})=>xV()?t:t.slice(0,e),xV=()=>"resize"in ArrayBuffer.prototype,DSe={init:ESe,convertChunk:{string:ASe,buffer:bV,arrayBuffer:bV,dataView:vV,typedArray:vV,others:xb},getSize:$b,truncateChunk:OSe,addChunk:RSe,getFinalChunk:Vf,finalize:CSe}});async function Ob(t,e){return kl(t,LSe,e)}var NSe,Tb,jSe,MSe,FSe,LSe,kV=y(()=>{Zf();kb();NSe=()=>({contents:"",textDecoder:new TextDecoder}),Tb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),jSe=(t,{contents:e})=>e+t,MSe=(t,e)=>t.slice(0,e),FSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},LSe={init:NSe,convertChunk:{string:yo,buffer:Tb,arrayBuffer:Tb,dataView:Tb,typedArray:Tb,others:xb},getSize:$b,truncateChunk:MSe,addChunk:jSe,getFinalChunk:FSe,finalize:wb}});var EV=y(()=>{_V();$V();kV();Zf()});import{on as zSe}from"node:events";import{finished as USe}from"node:stream/promises";var Rb=y(()=>{ZR();EV();Object.assign(Gf,{on:zSe,finished:USe})});var AV,qSe,TV,OV,BSe,RV,PV,Pb,Ia=y(()=>{Rb();mo();go();AV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Pi))throw t;if(o==="all")return t;let s=qSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},qSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",TV=(t,e,r)=>{if(e.length!==r)return;let n=new Pi;throw n.maxBufferInfo={fdNumber:"ipc"},n},OV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=BSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},BSe=(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=ho(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:M_(r),threshold:i,unit:n}},RV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Pb(r)),PV=(t,e,r)=>{if(!e)return t;let n=Pb(r);return t.length>n?t.slice(0,n):t},Pb=([,t])=>t});import{inspect as HSe}from"node:util";var CV,GSe,ZSe,VSe,WSe,KSe,IV,DV=y(()=>{zR();rn();MR();z_();Ia();zf();Aa();CV=({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=GSe({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=VSe(n,b),w=x===void 0?"":` +${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>WSe(D)).join(` `)].map(D=>jf($l(KSe(D)))).filter(Boolean).join(` -`);return{originalMessage:x,shortMessage:T,message:A}},GSe=({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=ZSe(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?`${EV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${X_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},ZSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",VSe=(t,e)=>{if(t instanceof Xn)return;let r=VZ(t)?t.originalMessage:String(t?.message??t),n=jf(tV(r,e));return n===""?void 0:n},WSe=t=>typeof t=="string"?t:HSe(t),KSe=t=>Array.isArray(t)?t.map(e=>$l(TV(e))).filter(Boolean).join(` -`):TV(t),TV=t=>typeof t=="string"?t:zt(t)?D_(t):""});var Ib,El,Wf,JSe,PV,YSe,Kf=y(()=>{zf();G_();Aa();IV();Ib=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>PV({command:t,escapedCommand:e,cwd:o,durationMs:sR(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:[]}),El=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Wf({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}),Wf=({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:T,signalDescription:O}=YSe(l,u),{originalMessage:A,shortMessage:D,message:$}=RV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:T,signalDescription:O,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),se=GZ(t,$,x);return Object.assign(se,JSe({error:se,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:T,signalDescription:O,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),se},JSe=({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})=>PV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:sR(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:[]}),PV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),YSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:X_(e);return{exitCode:r,signal:n,signalDescription:i}}});function XSe(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(CV(t*1e3)%1e3),nanoseconds:Math.trunc(CV(t*1e6)%1e3)}}function QSe(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 HR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return XSe(t);break}case"bigint":return QSe(t)}throw new TypeError("Expected a finite number or bigint")}var CV,DV=y(()=>{CV=t=>Number.isFinite(t)?t:0});function GR(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+rwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ewe(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?" "+twe(d,u):f;i.push(p)}},a=HR(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%nwe):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 ewe,twe,rwe,nwe,NV=y(()=>{DV();ewe=t=>t===0||t===0n,twe=(t,e)=>e===1||e===1n?t:`${t}s`,rwe=1e-7,nwe=24n*60n*60n*1000n});var jV,MV=y(()=>{gl();jV=(t,e)=>{t.failed&&Oi({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var FV,iwe,LV=y(()=>{NV();ss();gl();MV();FV=(t,e)=>{ml(e)&&(jV(t,e),iwe(t,e))},iwe=(t,e)=>{let r=`(done in ${GR(t.durationMs)})`;Oi({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Al,Pb=y(()=>{LV();Al=(t,e,{reject:r})=>{if(FV(t,e),t.failed&&r)throw t;return t}});var qV,owe,swe,BV,HV,zV,awe,ZR,UV,Ca,GV,cwe,Cb,ZV,lwe,uwe,VR,VV,dwe,WV,Db,fwe,WR,pwe,mwe,KV,An,Nb,KR,JV,YV,us,vr=y(()=>{Ia();fo();rn();qV=(t,e)=>Ca(t)?"asyncGenerator":GV(t)?"generator":Cb(t)?"fileUrl":lwe(t)?"filePath":fwe(t)?"webStream":ei(t,{checkOpen:!1})?"native":zt(t)?"uint8Array":pwe(t)?"asyncIterable":mwe(t)?"iterable":WR(t)?BV({transform:t},e):cwe(t)?owe(t,e):"native",owe=(t,e)=>LR(t.transform,{checkOpen:!1})?swe(t,e):WR(t.transform)?BV(t,e):awe(t,e),swe=(t,e)=>(HV(t,e,"Duplex stream"),"duplex"),BV=(t,e)=>(HV(t,e,"web TransformStream"),"webTransform"),HV=({final:t,binary:e,objectMode:r},n,i)=>{zV(t,`${n}.final`,i),zV(e,`${n}.binary`,i),ZR(r,`${n}.objectMode`)},zV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},awe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!UV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(LR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(WR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!UV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return ZR(r,`${i}.binary`),ZR(n,`${i}.objectMode`),Ca(t)||Ca(e)?"asyncGenerator":"generator"},ZR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},UV=t=>Ca(t)||GV(t),Ca=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",GV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",cwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Cb=t=>Object.prototype.toString.call(t)==="[object URL]",ZV=t=>Cb(t)&&t.protocol!=="file:",lwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>uwe.has(e))&&VR(t.file),uwe=new Set(["file","append"]),VR=t=>typeof t=="string",VV=(t,e)=>t==="native"&&typeof e=="string"&&!dwe.has(e),dwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),WV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Db=t=>Object.prototype.toString.call(t)==="[object WritableStream]",fwe=t=>WV(t)||Db(t),WR=t=>WV(t?.readable)&&Db(t?.writable),pwe=t=>KV(t)&&typeof t[Symbol.asyncIterator]=="function",mwe=t=>KV(t)&&typeof t[Symbol.iterator]=="function",KV=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),Nb=new Set(["fileUrl","filePath","fileNumber"]),KR=new Set(["fileUrl","filePath"]),JV=new Set([...KR,"webStream","nodeStream"]),YV=new Set(["webTransform","duplex"]),us={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 JR,hwe,gwe,XV,YR=y(()=>{vr();JR=(t,e,r,n)=>n==="output"?hwe(t,e,r):gwe(t,e,r),hwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},gwe=(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}},XV=(t,e)=>{let r=t.findLast(({type:n})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var QV,ywe,_we,bwe,vwe,Swe,wwe,eW=y(()=>{fo();Ta();vr();YR();QV=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...ywe(t,e,r,n)],ywe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=_we({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return wwe(o,r)},_we=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?bwe({stdioItem:t,optionName:i}):e==="webTransform"?vwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Swe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),bwe=({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}}},vwe=({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}=JR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Swe=({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||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=JR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},wwe=(t,e)=>e==="input"?t.reverse():t});import XR from"node:process";var tW,xwe,$we,Ol,QR,rW,kwe,Ewe,nW=y(()=>{Ia();vr();tW=(t,e,r)=>{let n=t.map(i=>xwe(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)??Ewe},xwe=({type:t,value:e},r)=>$we[r]??rW[t](e),$we=["input","output","output"],Ol=()=>{},QR=()=>"input",rW={generator:Ol,asyncGenerator:Ol,fileUrl:Ol,filePath:Ol,iterable:QR,asyncIterable:QR,uint8Array:QR,webStream:t=>Db(t)?"output":"input",nodeStream(t){return Ra(t,{checkOpen:!1})?FR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Ol,duplex:Ol,native(t){let e=kwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return rW.nodeStream(t)}},kwe=t=>{if([0,XR.stdin].includes(t))return"input";if([1,2,XR.stdout,XR.stderr].includes(t))return"output"},Ewe="output"});var iW,oW=y(()=>{iW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var sW,Awe,Owe,aW,Twe,Rwe,cW=y(()=>{mo();oW();ss();sW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Awe(t,n).map((a,c)=>aW(a,c));return o?Twe(s,r,i):iW(s,e)},Awe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(Owe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},Owe=t=>En.some(e=>t[e]!==void 0),aW=(t,e)=>Array.isArray(t)?t.map(r=>aW(r,e)):t??(e>=En.length?"ignore":"pipe"),Twe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!hl(r,i)&&Rwe(n)?"ignore":n),Rwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Iwe}from"node:fs";import Pwe from"node:tty";var uW,Cwe,Dwe,Nwe,jwe,lW,dW=y(()=>{Ia();mo();rn();cs();uW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Cwe({stdioItem:t,fdNumber:n,direction:i}):jwe({stdioItem:t,fdNumber:n}),Cwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Dwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Dwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Nwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Pwe.isatty(i))throw new TypeError(`The \`${e}: ${rb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:po(Iwe(i)),optionName:e}}},Nwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=N_.indexOf(t);if(r!==-1)return r},jwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:lW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:lW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,lW=(t,e,r)=>{let n=N_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var fW,Mwe,Fwe,Lwe,zwe,pW=y(()=>{Ia();rn();vr();fW=({input:t,inputFile:e},r)=>r===0?[...Mwe(t),...Lwe(e)]:[],Mwe=t=>t===void 0?[]:[{type:Fwe(t),value:t,optionName:"input"}],Fwe=t=>{if(Ra(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(zt(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Lwe=t=>t===void 0?[]:[{...zwe(t),optionName:"inputFile"}],zwe=t=>{if(Cb(t))return{type:"fileUrl",value:t};if(VR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var mW,hW,Uwe,qwe,gW,Bwe,Hwe,yW,_W=y(()=>{vr();mW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),hW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Uwe(i,t);if(s.length!==0){if(o){qwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(JV.has(t))return gW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});YV.has(t)&&Hwe({otherStdioItems:s,type:t,value:e,optionName:r})}},Uwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),qwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{KR.has(e)&&gW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},gW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Bwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return yW(s,n,e),i==="output"?o[0].stream:void 0},Bwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Hwe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);yW(i,n,e)},yW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${us[r]} that is the same.`)}});var jb,Gwe,Zwe,Vwe,Wwe,Kwe,Jwe,Ywe,Xwe,Qwe,exe,txe,eI,rxe,Mb=y(()=>{mo();eW();YR();vr();nW();cW();dW();pW();_W();jb=(t,e,r,n)=>{let o=sW(e,r,n).map((a,c)=>Gwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Qwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>rxe(a)),s},Gwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=j_(e),{stdioItems:o,isStdioArray:s}=Zwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=tW(o,e,i),c=o.map(d=>uW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=QV(c,i,a,r),u=XV(l,a);return Xwe(l,u),{direction:a,objectMode:u,stdioItems:l}},Zwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Vwe(c,n)),...fW(r,e)],s=mW(o),a=s.length>1;return Wwe(s,a,n),Jwe(s),{stdioItems:s,isStdioArray:a}},Vwe=(t,e)=>({type:qV(t,e),value:t,optionName:e}),Wwe=(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(Kwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Kwe=new Set(["ignore","ipc"]),Jwe=t=>{for(let e of t)Ywe(e)},Ywe=({type:t,value:e,optionName:r})=>{if(ZV(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(VV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Xwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Nb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Qwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(exe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw eI(i),o}},exe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>txe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},txe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=hW({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&&!Yn(r)&&r.destroy()},rxe=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 bW}from"node:fs";var SW,Pi,nxe,wW,vW,ixe,xW=y(()=>{rn();Mb();vr();SW=(t,e)=>jb(ixe,t,e,!0),Pi=({type:t,optionName:e})=>{wW(e,us[t])},nxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&wW(t,`"${e}"`),{}),wW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},vW={generator(){},asyncGenerator:Pi,webStream:Pi,nodeStream:Pi,webTransform:Pi,duplex:Pi,asyncIterable:Pi,native:nxe},ixe={input:{...vW,fileUrl:({value:t})=>({contents:[po(bW(t))]}),filePath:({value:{file:t}})=>({contents:[po(bW(t))]}),fileNumber:Pi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...vW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Pi,string:Pi,uint8Array:Pi}}});var _o,tI,Jf=y(()=>{MR();_o=(t,{stripFinalNewline:e},r)=>tI(e,r)&&t!==void 0&&!Array.isArray(t)?$l(t):t,tI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Fb,nI,$W,kW,oxe,sxe,axe,EW,cxe,rI,lxe,uxe,dxe,Lb=y(()=>{Fb=(t,e,r,n)=>t||r?void 0:kW(e,n),nI=(t,e,r)=>r?t.flatMap(n=>$W(n,e)):$W(t,e),$W=(t,e)=>{let{transform:r,final:n}=kW(e,{});return[...r(t),...n()]},kW=(t,e)=>(e.previousChunks="",{transform:oxe.bind(void 0,e,t),final:axe.bind(void 0,e)}),oxe=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},sxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),axe=function*({previousChunks:t}){t.length>0&&(yield t)},EW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:cxe.bind(void 0,n)},cxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?lxe:dxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},rI=(t,e)=>`${t}${e}`,lxe={windowsNewline:`\r +`);return{originalMessage:x,shortMessage:O,message:A}},GSe=({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=ZSe(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?`${OV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${Q_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},ZSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",VSe=(t,e)=>{if(t instanceof Xn)return;let r=JZ(t)?t.originalMessage:String(t?.message??t),n=jf(iV(r,e));return n===""?void 0:n},WSe=t=>typeof t=="string"?t:HSe(t),KSe=t=>Array.isArray(t)?t.map(e=>$l(IV(e))).filter(Boolean).join(` +`):IV(t),IV=t=>typeof t=="string"?t:Ut(t)?N_(t):""});var Ib,El,Wf,JSe,NV,YSe,Kf=y(()=>{zf();Z_();Aa();DV();Ib=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>NV({command:t,escapedCommand:e,cwd:o,durationMs:lR(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:[]}),El=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Wf({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}),Wf=({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:O,signalDescription:T}=YSe(l,u),{originalMessage:A,shortMessage:D,message:$}=CV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),se=WZ(t,$,x);return Object.assign(se,JSe({error:se,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),se},JSe=({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})=>NV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:lR(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:[]}),NV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),YSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:Q_(e);return{exitCode:r,signal:n,signalDescription:i}}});function XSe(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(jV(t*1e3)%1e3),nanoseconds:Math.trunc(jV(t*1e6)%1e3)}}function QSe(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 VR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return XSe(t);break}case"bigint":return QSe(t)}throw new TypeError("Expected a finite number or bigint")}var jV,MV=y(()=>{jV=t=>Number.isFinite(t)?t:0});function WR(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+rwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ewe(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?" "+twe(d,u):f;i.push(p)}},a=VR(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%nwe):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 ewe,twe,rwe,nwe,FV=y(()=>{MV();ewe=t=>t===0||t===0n,twe=(t,e)=>e===1||e===1n?t:`${t}s`,rwe=1e-7,nwe=24n*60n*60n*1000n});var LV,zV=y(()=>{gl();LV=(t,e)=>{t.failed&&Ti({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var UV,iwe,qV=y(()=>{FV();ss();gl();zV();UV=(t,e)=>{ml(e)&&(LV(t,e),iwe(t,e))},iwe=(t,e)=>{let r=`(done in ${WR(t.durationMs)})`;Ti({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Al,Cb=y(()=>{qV();Al=(t,e,{reject:r})=>{if(UV(t,e),t.failed&&r)throw t;return t}});var GV,owe,swe,ZV,VV,BV,awe,KR,HV,Ca,WV,cwe,Db,KV,lwe,uwe,JR,JV,dwe,YV,Nb,fwe,YR,pwe,mwe,XV,An,jb,XR,QV,eW,us,vr=y(()=>{Pa();fo();rn();GV=(t,e)=>Ca(t)?"asyncGenerator":WV(t)?"generator":Db(t)?"fileUrl":lwe(t)?"filePath":fwe(t)?"webStream":ei(t,{checkOpen:!1})?"native":Ut(t)?"uint8Array":pwe(t)?"asyncIterable":mwe(t)?"iterable":YR(t)?ZV({transform:t},e):cwe(t)?owe(t,e):"native",owe=(t,e)=>qR(t.transform,{checkOpen:!1})?swe(t,e):YR(t.transform)?ZV(t,e):awe(t,e),swe=(t,e)=>(VV(t,e,"Duplex stream"),"duplex"),ZV=(t,e)=>(VV(t,e,"web TransformStream"),"webTransform"),VV=({final:t,binary:e,objectMode:r},n,i)=>{BV(t,`${n}.final`,i),BV(e,`${n}.binary`,i),KR(r,`${n}.objectMode`)},BV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},awe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!HV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(qR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(YR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!HV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return KR(r,`${i}.binary`),KR(n,`${i}.objectMode`),Ca(t)||Ca(e)?"asyncGenerator":"generator"},KR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},HV=t=>Ca(t)||WV(t),Ca=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",WV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",cwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Db=t=>Object.prototype.toString.call(t)==="[object URL]",KV=t=>Db(t)&&t.protocol!=="file:",lwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>uwe.has(e))&&JR(t.file),uwe=new Set(["file","append"]),JR=t=>typeof t=="string",JV=(t,e)=>t==="native"&&typeof e=="string"&&!dwe.has(e),dwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),YV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Nb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",fwe=t=>YV(t)||Nb(t),YR=t=>YV(t?.readable)&&Nb(t?.writable),pwe=t=>XV(t)&&typeof t[Symbol.asyncIterator]=="function",mwe=t=>XV(t)&&typeof t[Symbol.iterator]=="function",XV=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),jb=new Set(["fileUrl","filePath","fileNumber"]),XR=new Set(["fileUrl","filePath"]),QV=new Set([...XR,"webStream","nodeStream"]),eW=new Set(["webTransform","duplex"]),us={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 QR,hwe,gwe,tW,eP=y(()=>{vr();QR=(t,e,r,n)=>n==="output"?hwe(t,e,r):gwe(t,e,r),hwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},gwe=(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}},tW=(t,e)=>{let r=t.findLast(({type:n})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var rW,ywe,_we,bwe,vwe,Swe,wwe,nW=y(()=>{fo();Oa();vr();eP();rW=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...ywe(t,e,r,n)],ywe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=_we({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return wwe(o,r)},_we=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?bwe({stdioItem:t,optionName:i}):e==="webTransform"?vwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Swe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),bwe=({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}}},vwe=({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}=QR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Swe=({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||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=QR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},wwe=(t,e)=>e==="input"?t.reverse():t});import tP from"node:process";var iW,xwe,$we,Tl,rP,oW,kwe,Ewe,sW=y(()=>{Pa();vr();iW=(t,e,r)=>{let n=t.map(i=>xwe(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)??Ewe},xwe=({type:t,value:e},r)=>$we[r]??oW[t](e),$we=["input","output","output"],Tl=()=>{},rP=()=>"input",oW={generator:Tl,asyncGenerator:Tl,fileUrl:Tl,filePath:Tl,iterable:rP,asyncIterable:rP,uint8Array:rP,webStream:t=>Nb(t)?"output":"input",nodeStream(t){return Ra(t,{checkOpen:!1})?UR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Tl,duplex:Tl,native(t){let e=kwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return oW.nodeStream(t)}},kwe=t=>{if([0,tP.stdin].includes(t))return"input";if([1,2,tP.stdout,tP.stderr].includes(t))return"output"},Ewe="output"});var aW,cW=y(()=>{aW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var lW,Awe,Twe,uW,Owe,Rwe,dW=y(()=>{mo();cW();ss();lW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Awe(t,n).map((a,c)=>uW(a,c));return o?Owe(s,r,i):aW(s,e)},Awe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(Twe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},Twe=t=>En.some(e=>t[e]!==void 0),uW=(t,e)=>Array.isArray(t)?t.map(r=>uW(r,e)):t??(e>=En.length?"ignore":"pipe"),Owe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!hl(r,i)&&Rwe(n)?"ignore":n),Rwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Pwe}from"node:fs";import Iwe from"node:tty";var pW,Cwe,Dwe,Nwe,jwe,fW,mW=y(()=>{Pa();mo();rn();cs();pW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Cwe({stdioItem:t,fdNumber:n,direction:i}):jwe({stdioItem:t,fdNumber:n}),Cwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Dwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Dwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Nwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Iwe.isatty(i))throw new TypeError(`The \`${e}: ${nb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:po(Pwe(i)),optionName:e}}},Nwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=j_.indexOf(t);if(r!==-1)return r},jwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:fW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:fW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,fW=(t,e,r)=>{let n=j_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var hW,Mwe,Fwe,Lwe,zwe,gW=y(()=>{Pa();rn();vr();hW=({input:t,inputFile:e},r)=>r===0?[...Mwe(t),...Lwe(e)]:[],Mwe=t=>t===void 0?[]:[{type:Fwe(t),value:t,optionName:"input"}],Fwe=t=>{if(Ra(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ut(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Lwe=t=>t===void 0?[]:[{...zwe(t),optionName:"inputFile"}],zwe=t=>{if(Db(t))return{type:"fileUrl",value:t};if(JR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var yW,_W,Uwe,qwe,bW,Bwe,Hwe,vW,SW=y(()=>{vr();yW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),_W=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Uwe(i,t);if(s.length!==0){if(o){qwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(QV.has(t))return bW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});eW.has(t)&&Hwe({otherStdioItems:s,type:t,value:e,optionName:r})}},Uwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),qwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{XR.has(e)&&bW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},bW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Bwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return vW(s,n,e),i==="output"?o[0].stream:void 0},Bwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Hwe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);vW(i,n,e)},vW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${us[r]} that is the same.`)}});var Mb,Gwe,Zwe,Vwe,Wwe,Kwe,Jwe,Ywe,Xwe,Qwe,exe,txe,nP,rxe,Fb=y(()=>{mo();nW();eP();vr();sW();dW();mW();gW();SW();Mb=(t,e,r,n)=>{let o=lW(e,r,n).map((a,c)=>Gwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Qwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>rxe(a)),s},Gwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=M_(e),{stdioItems:o,isStdioArray:s}=Zwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=iW(o,e,i),c=o.map(d=>pW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=rW(c,i,a,r),u=tW(l,a);return Xwe(l,u),{direction:a,objectMode:u,stdioItems:l}},Zwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Vwe(c,n)),...hW(r,e)],s=yW(o),a=s.length>1;return Wwe(s,a,n),Jwe(s),{stdioItems:s,isStdioArray:a}},Vwe=(t,e)=>({type:GV(t,e),value:t,optionName:e}),Wwe=(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(Kwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Kwe=new Set(["ignore","ipc"]),Jwe=t=>{for(let e of t)Ywe(e)},Ywe=({type:t,value:e,optionName:r})=>{if(KV(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(JV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Xwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>jb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Qwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(exe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw nP(i),o}},exe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>txe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},txe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=_W({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},nP=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Yn(r)&&r.destroy()},rxe=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 wW}from"node:fs";var $W,Ii,nxe,kW,xW,ixe,EW=y(()=>{rn();Fb();vr();$W=(t,e)=>Mb(ixe,t,e,!0),Ii=({type:t,optionName:e})=>{kW(e,us[t])},nxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&kW(t,`"${e}"`),{}),kW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},xW={generator(){},asyncGenerator:Ii,webStream:Ii,nodeStream:Ii,webTransform:Ii,duplex:Ii,asyncIterable:Ii,native:nxe},ixe={input:{...xW,fileUrl:({value:t})=>({contents:[po(wW(t))]}),filePath:({value:{file:t}})=>({contents:[po(wW(t))]}),fileNumber:Ii,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...xW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Ii,string:Ii,uint8Array:Ii}}});var _o,iP,Jf=y(()=>{zR();_o=(t,{stripFinalNewline:e},r)=>iP(e,r)&&t!==void 0&&!Array.isArray(t)?$l(t):t,iP=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Lb,sP,AW,TW,oxe,sxe,axe,OW,cxe,oP,lxe,uxe,dxe,zb=y(()=>{Lb=(t,e,r,n)=>t||r?void 0:TW(e,n),sP=(t,e,r)=>r?t.flatMap(n=>AW(n,e)):AW(t,e),AW=(t,e)=>{let{transform:r,final:n}=TW(e,{});return[...r(t),...n()]},TW=(t,e)=>(e.previousChunks="",{transform:oxe.bind(void 0,e,t),final:axe.bind(void 0,e)}),oxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=oP(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=oP(n,r.slice(i+1))),t.previousChunks=n},sxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),axe=function*({previousChunks:t}){t.length>0&&(yield t)},OW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:cxe.bind(void 0,n)},cxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?lxe:dxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},oP=(t,e)=>`${t}${e}`,lxe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:rI},uxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},dxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:uxe}});import{Buffer as fxe}from"node:buffer";var AW,pxe,OW,mxe,hxe,TW,RW=y(()=>{rn();AW=(t,e)=>t?void 0:pxe.bind(void 0,e),pxe=function*(t,e){if(typeof e!="string"&&!zt(e)&&!fxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},OW=(t,e)=>t?mxe.bind(void 0,e):hxe.bind(void 0,e),mxe=function*(t,e){TW(t,e),yield e},hxe=function*(t,e){if(TW(t,e),typeof e!="string"&&!zt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},TW=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:oP},uxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},dxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:uxe}});import{Buffer as fxe}from"node:buffer";var RW,pxe,PW,mxe,hxe,IW,CW=y(()=>{rn();RW=(t,e)=>t?void 0:pxe.bind(void 0,e),pxe=function*(t,e){if(typeof e!="string"&&!Ut(e)&&!fxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},PW=(t,e)=>t?mxe.bind(void 0,e):hxe.bind(void 0,e),mxe=function*(t,e){IW(t,e),yield e},hxe=function*(t,e){if(IW(t,e),typeof e!="string"&&!Ut(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},IW=(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 gxe}from"node:buffer";import{StringDecoder as yxe}from"node:string_decoder";var zb,_xe,bxe,vxe,iI=y(()=>{rn();zb=(t,e,r)=>{if(r)return;if(t)return{transform:_xe.bind(void 0,new TextEncoder)};let n=new yxe(e);return{transform:bxe.bind(void 0,n),final:vxe.bind(void 0,n)}},_xe=function*(t,e){gxe.isBuffer(e)?yield po(e):typeof e=="string"?yield t.encode(e):yield e},bxe=function*(t,e){yield zt(e)?t.write(e):e},vxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as IW}from"node:util";var oI,Ub,PW,Sxe,CW,wxe,DW=y(()=>{oI=IW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Ub=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=wxe}=e[r];for await(let i of n(t))yield*Ub(i,e,r+1)},PW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Sxe(r,Number(e),t)},Sxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Ub(n,r,e+1)},CW=IW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),wxe=function*(t){yield t}});var sI,NW,Da,Yf,xxe,$xe,aI=y(()=>{sI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},NW=(t,e)=>[...e.flatMap(r=>[...Da(r,t,0)]),...Yf(t)],Da=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=$xe}=e[r];for(let i of n(t))yield*Da(i,e,r+1)},Yf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*xxe(r,Number(e),t)},xxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Da(n,r,e+1)},$xe=function*(t){yield t}});import{Transform as kxe,getDefaultHighWaterMark as jW}from"node:stream";var cI,qb,MW,Bb=y(()=>{vr();Lb();RW();iI();DW();aI();cI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=MW(t,s,o),l=Ca(e),u=Ca(r),d=l?oI.bind(void 0,Ub,a):sI.bind(void 0,Da),f=l||u?oI.bind(void 0,PW,a):sI.bind(void 0,Yf),p=l||u?CW.bind(void 0,a):void 0;return{stream:new kxe({writableObjectMode:n,writableHighWaterMark:jW(n),readableObjectMode:i,readableHighWaterMark:jW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},qb=(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=MW(s,r,a);t=NW(c,t)}return t},MW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:AW(n,a)},zb(r,s,n),Fb(r,o,n,c),{transform:t,final:e},{transform:OW(i,a)},EW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var FW,Exe,Axe,Oxe,Txe,LW=y(()=>{Bb();rn();vr();FW=(t,e)=>{for(let r of Exe(t))Axe(t,r,e)},Exe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Axe=(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 ${us[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Oxe(a,n));r.input=Nf(s)},Oxe=(t,e)=>{let r=qb(t,e,"utf8",!0);return Txe(r),Nf(r)},Txe=t=>{let e=t.find(r=>typeof r!="string"&&!zt(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 Hb,Rxe,Ixe,zW,UW,Pxe,qW,lI=y(()=>{Ta();vr();gl();ss();Hb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&hl(r,n)&&!nn.has(e)&&Rxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Ixe.has(o))||t.every(({type:i})=>An.has(i))),Rxe=t=>t===1||t===2,Ixe=new Set(["pipe","overlapped"]),zW=async(t,e,r,n)=>{for await(let i of t)Pxe(e)||qW(i,r,n)},UW=(t,e,r)=>{for(let n of t)qW(n,e,r)},Pxe=t=>t._readableState.pipes.length>0,qW=(t,e,r)=>{let n=B_(t);Oi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Cxe,appendFileSync as Dxe}from"node:fs";var BW,Nxe,jxe,Mxe,Fxe,Lxe,HW=y(()=>{lI();Bb();Lb();rn();vr();Pa();BW=({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)=>Nxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Nxe=({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=OV(t,o,d),p=po(f),{stdioItems:m,objectMode:h}=e[r],g=jxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Mxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Fxe({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&&Lxe(b,m,i),S}catch(x){return n.error=x,S}},jxe=(t,e,r,n)=>{try{return qb(t,e,r,!1)}catch(i){return n.error=i,t}},Mxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Nf(t)};let s=_G(t,r);return n[o]?{serializedResult:s,finalResult:nI(s,!i[o],e)}:{serializedResult:s}},Fxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Hb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=nI(t,!1,s);try{UW(a,e,n)}catch(c){r.error??=c}},Lxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Nb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Dxe(n,t):(r.add(o),Cxe(n,t))}}});var GW,ZW=y(()=>{rn();Jf();GW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,_o(e,r,"all")]:Array.isArray(e)?[_o(t,r,"all"),...e]:zt(t)&&zt(e)?XT([t,e]):`${t}${e}`}});import{once as uI}from"node:events";var VW,zxe,WW,KW,Uxe,dI,fI=y(()=>{Aa();VW=async(t,e)=>{let[r,n]=await zxe(t);return e.isForcefullyTerminated??=!1,[r,n]},zxe=async t=>{let[e,r]=await Promise.allSettled([uI(t,"spawn"),uI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?WW(t):r.value},WW=async t=>{try{return await uI(t,"exit")}catch{return WW(t)}},KW=async t=>{let[e,r]=await t;if(!Uxe(e,r)&&dI(e,r))throw new Xn;return[e,r]},Uxe=(t,e)=>t===void 0&&e===void 0,dI=(t,e)=>t!==0||e!==null});var JW,qxe,YW=y(()=>{Aa();Pa();fI();JW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=qxe(t,e,r),s=o?.code==="ETIMEDOUT",a=AV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},qxe=(t,e,r)=>t!==void 0?t:dI(e,r)?new Xn:void 0});import{spawnSync as Bxe}from"node:child_process";var XW,Hxe,Gxe,Zxe,Gb,Vxe,Wxe,Kxe,Jxe,QW=y(()=>{aR();NR();jR();Kf();Pb();xW();Jf();LW();HW();Pa();ZW();YW();XW=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Hxe(t,e,r),d=Vxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Al(d,c,l)},Hxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Z_(t,e,r),a=Gxe(r),{file:c,commandArguments:l,options:u}=bb(t,e,a);Zxe(u);let d=SW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Gxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Zxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Gb("ipcInput"),t&&Gb("ipc: true"),r&&Gb("detached: true"),n&&Gb("cancelSignal")},Gb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Vxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Wxe({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}=JW(c,r),{output:m,error:h=l}=BW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>_o(_,r,S)),b=_o(GW(m,r),r,"all");return Jxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Wxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{FW(o,r);let a=Kxe(r);return Bxe(...vb(t,e,a))}catch(a){return El({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},Kxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Rb(e)}),Jxe=({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?Ib({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Wf({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 pI,on as Yxe}from"node:events";var e3,Xxe,Qxe,e0e,t0e,t3=y(()=>{Sl();Bf();qf();e3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(bl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:fb(t)}),Xxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Xxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ob(e,i);let o=ls(t,e,r),s=new AbortController;try{return await Promise.race([Qxe(o,n,s),e0e(o,r,s),t0e(o,r,s)])}catch(a){throw vl(t),a}finally{s.abort(),sb(e,i)}},Qxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await pI(t,"message",{signal:r});return n}for await(let[n]of Yxe(t,"message",{signal:r}))if(e(n))return n},e0e=async(t,e,{signal:r})=>{await pI(t,"disconnect",{signal:r}),f9(e)},t0e=async(t,e,{signal:r})=>{let[n]=await pI(t,"strict:error",{signal:r});throw tb(n,e)}});import{once as n3,on as r0e}from"node:events";var i3,mI,n0e,i0e,o0e,r3,hI=y(()=>{Sl();Bf();qf();i3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>mI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),mI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{bl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:fb(t)}),ob(e,o);let s=ls(t,e,r),a=new AbortController,c={};return n0e(t,s,a),i0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),o0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},n0e=async(t,e,r)=>{try{await n3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},i0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await n3(t,"strict:error",{signal:r.signal});n.error=tb(i,e),r.abort()}catch{}},o0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of r0e(r,"message",{signal:o.signal}))r3(s),yield c}catch{r3(s)}finally{o.abort(),sb(e,a),n||vl(t),i&&await t}},r3=({error:t})=>{if(t)throw t}});import o3 from"node:process";var s3,a3,c3,gI=y(()=>{yb();t3();hI();ub();s3=(t,{ipc:e})=>{Object.assign(t,c3(t,!1,e))},a3=()=>{let t=o3,e=!0,r=o3.channel!==void 0;return{...c3(t,e,r),getCancelSignal:z9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},c3=(t,e,r)=>({sendMessage:gb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:e3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:i3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as s0e}from"node:child_process";import{PassThrough as a0e,Readable as c0e,Writable as l0e,Duplex as u0e}from"node:stream";var l3,d0e,Xf,f0e,p0e,m0e,h0e,u3=y(()=>{Mb();Kf();Pb();l3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{eI(n);let a=new s0e;d0e(a,n),Object.assign(a,{readable:f0e,writable:p0e,duplex:m0e});let c=El({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=h0e(c,s,i);return{subprocess:a,promise:l}},d0e=(t,e)=>{let r=Xf(),n=Xf(),i=Xf(),o=Array.from({length:e.length-3},Xf),s=Xf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Xf=()=>{let t=new a0e;return t.end(),t},f0e=()=>new c0e({read(){}}),p0e=()=>new l0e({write(){}}),m0e=()=>new u0e({read(){},write(){}}),h0e=async(t,e,r)=>Al(t,e,r)});import{createReadStream as d3,createWriteStream as f3}from"node:fs";import{Buffer as g0e}from"node:buffer";import{Readable as Qf,Writable as y0e,Duplex as _0e}from"node:stream";var m3,ep,p3,b0e,h3=y(()=>{Bb();Mb();vr();m3=(t,e)=>jb(b0e,t,e,!1),ep=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${us[t]}.`)},p3={fileNumber:ep,generator:cI,asyncGenerator:cI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:_0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},b0e={input:{...p3,fileUrl:({value:t})=>({stream:d3(t)}),filePath:({value:{file:t}})=>({stream:d3(t)}),webStream:({value:t})=>({stream:Qf.fromWeb(t)}),iterable:({value:t})=>({stream:Qf.from(t)}),asyncIterable:({value:t})=>({stream:Qf.from(t)}),string:({value:t})=>({stream:Qf.from(t)}),uint8Array:({value:t})=>({stream:Qf.from(g0e.from(t))})},output:{...p3,fileUrl:({value:t})=>({stream:f3(t)}),filePath:({value:{file:t,append:e}})=>({stream:f3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:y0e.fromWeb(t)}),iterable:ep,asyncIterable:ep,string:ep,uint8Array:ep}}});import{on as v0e,once as g3}from"node:events";import{PassThrough as S0e,getDefaultHighWaterMark as w0e}from"node:stream";import{finished as b3}from"node:stream/promises";function Na(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)_I(i);let e=t.some(({readableObjectMode:i})=>i),r=x0e(t,e),n=new yI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var x0e,yI,$0e,k0e,E0e,_I,A0e,O0e,T0e,R0e,I0e,v3,S3,bI,w3,P0e,Zb,y3,_3,Vb=y(()=>{x0e=(t,e)=>{if(t.length===0)return w0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},yI=class extends S0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(_I(e),this.#t.has(e))return;this.#t.add(e),this.#n??=$0e(this,this.#t,this.#o);let r=A0e({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(_I(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)}},$0e=async(t,e,r)=>{Zb(t,y3);let n=new AbortController;try{await Promise.race([k0e(t,n),E0e(t,e,r,n)])}finally{n.abort(),Zb(t,-y3)}},k0e=async(t,{signal:e})=>{try{await b3(t,{signal:e,cleanup:!0})}catch(r){throw v3(t,r),r}},E0e=async(t,e,r,{signal:n})=>{for await(let[i]of v0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},_I=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},A0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Zb(t,_3);let a=new AbortController;try{await Promise.race([O0e(o,e,a),T0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),R0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Zb(t,-_3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?bI(t):I0e(t))},O0e=async(t,e,{signal:r})=>{try{await t,r.aborted||bI(e)}catch(n){r.aborted||v3(e,n)}},T0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await b3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;S3(s)?i.add(e):w3(t,s)}},R0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await g3(t,i,{signal:o}),!t.readable)return g3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},I0e=t=>{t.writable&&t.end()},v3=(t,e)=>{S3(e)?bI(t):w3(t,e)},S3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",bI=t=>{(t.readable||t.writable)&&t.destroy()},w3=(t,e)=>{t.destroyed||(t.once("error",P0e),t.destroy(e))},P0e=()=>{},Zb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},y3=2,_3=1});import{finished as x3}from"node:stream/promises";var Tl,C0e,vI,D0e,SI,Wb=y(()=>{mo();Tl=(t,e)=>{t.pipe(e),C0e(t,e),D0e(t,e)},C0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await x3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}vI(e)}},vI=t=>{t.writable&&t.end()},D0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await x3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}SI(t)}},SI=t=>{t.readable&&t.destroy()}});var $3,N0e,j0e,M0e,F0e,L0e,k3=y(()=>{Vb();mo();ib();vr();Wb();$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})=>An.has(c)))N0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.has(c)))M0e({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]:Na(o);Tl(s,i)}},N0e=(t,e,r,n)=>{r==="output"?Tl(t.stdio[n],e):Tl(e,t.stdio[n]);let i=j0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},j0e=["stdin","stdout","stderr"],M0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;F0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},F0e=(t,{signal:e})=>{Yn(t)&&Oa(t,L0e,e)},L0e=2});var ja,E3=y(()=>{ja=[];ja.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&ja.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&ja.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Kb,wI,xI,z0e,$I,Jb,U0e,kI,EI,AI,A3,Vot,Wot,O3=y(()=>{E3();Kb=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"),xI=globalThis,z0e=Object.defineProperty.bind(Object),$I=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(xI[wI])return xI[wI];z0e(xI,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}},Jb=class{},U0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),kI=class extends Jb{onExit(){return()=>{}}load(){}unload(){}},EI=class extends Jb{#t=AI.platform==="win32"?"SIGINT":"SIGHUP";#r=new $I;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of ja)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(!Kb(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 ja)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,ja.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 Kb(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"&&Kb(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)}},AI=globalThis.process,{onExit:A3,load:Vot,unload:Wot}=U0e(Kb(AI)?new EI(AI):new kI)});import{addAbortListener as q0e}from"node:events";var T3,R3=y(()=>{O3();T3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=A3(()=>{t.kill()});q0e(n,()=>{i()})}});var P3,B0e,H0e,I3,G0e,C3=y(()=>{YT();G_();cs();pl();P3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=H_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=B0e(r,n,i),{sourceStream:d,sourceError:f}=G0e(t,l),{options:p,fileDescriptors:m}=Ri.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},B0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=H0e(t,e,...r),a=nb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},H0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(I3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||KT(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]=C_(r,...n);return{destination:e(I3)(i,o,s),pipeOptions:s}}if(Ri.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}`)},I3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),G0e=(t,e)=>{try{return{sourceStream:xl(t,e)}}catch(r){return{sourceError:r}}}});var N3,Z0e,OI,D3,TI=y(()=>{Kf();Wb();N3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=Z0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw OI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},Z0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return SI(t),n;if(e!==void 0)return vI(r),e},OI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>El({error:t,command:D3,escapedCommand:D3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),D3="source.pipe(destination)"});var j3,M3=y(()=>{j3=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 V0e}from"node:stream/promises";var F3,W0e,K0e,J0e,Yb,Y0e,X0e,L3=y(()=>{Vb();ib();Wb();F3=(t,e,r)=>{let n=Yb.has(e)?K0e(t,e):W0e(t,e);return Oa(t,Y0e,r.signal),Oa(e,X0e,r.signal),J0e(e),n},W0e=(t,e)=>{let r=Na([t]);return Tl(r,e),Yb.set(e,r),r},K0e=(t,e)=>{let r=Yb.get(e);return r.add(t),r},J0e=async t=>{try{await V0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Yb.delete(t)},Yb=new WeakMap,Y0e=2,X0e=1});import{aborted as Q0e}from"node:util";var z3,e$e,U3=y(()=>{TI();z3=(t,e)=>t===void 0?[]:[e$e(t,e)],e$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Q0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw OI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var Xb,t$e,r$e,q3=y(()=>{fo();C3();TI();M3();L3();U3();Xb=(t,...e)=>{if(Ot(e[0]))return Xb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=P3(t,...e),i=t$e({...n,destination:r});return i.pipe=Xb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},t$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=r$e(t,i);N3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=F3(e,o,d);return await Promise.race([j3(u),...z3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},r$e=(t,e)=>Promise.allSettled([t,e])});import{on as n$e}from"node:events";import{getDefaultHighWaterMark as i$e}from"node:stream";var Qb,o$e,RI,s$e,H3,II,B3,a$e,c$e,ev=y(()=>{iI();Lb();aI();Qb=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return o$e(e,s),H3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},o$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},RI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;s$e(e,s,t);let a=t.readableObjectMode&&!o;return H3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},s$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},H3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=n$e(t,"data",{signal:e.signal,highWaterMark:B3,highWatermark:B3});return a$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},II=i$e(!0),B3=II,a$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=c$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Da(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Yf(a)}},c$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[zb(t,r,!e),Fb(t,i,!n,{})].filter(Boolean)});import{setImmediate as l$e}from"node:timers/promises";var G3,u$e,d$e,f$e,PI,Z3,CI=y(()=>{Tb();rn();lI();ev();Pa();Jf();G3=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=u$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([d$e(t),d]);return}let f=tI(c,r),p=RI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([f$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},u$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Hb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=RI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await zW(a,t,r,o)},d$e=async t=>{await l$e(),t.readableFlowing===null&&t.resume()},f$e=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 Eb(r,{maxBuffer:o})):await Ob(r,{maxBuffer:o})}catch(a){return Z3($V({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},PI=async t=>{try{return await t}catch(e){return Z3(e)}},Z3=({bufferedData:t})=>gG(t)?new Uint8Array(t):t});import{finished as p$e}from"node:stream/promises";var tp,m$e,h$e,g$e,y$e,_$e,DI,tv,V3,rv=y(()=>{tp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=m$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],p$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||y$e(a,e,r,n)}finally{s.abort()}},m$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&h$e(t,r,n),n},h$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{g$e(e,r),n.call(t,...i)}},g$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},y$e=(t,e,r,n)=>{if(!_$e(t,e,r,n))throw t},_$e=(t,e,r,n=!0)=>r.propagating?V3(t)||tv(t):(r.propagating=!0,DI(r,e)===n?V3(t):tv(t)),DI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",tv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",V3=t=>t?.code==="EPIPE"});var W3,NI,jI=y(()=>{CI();rv();W3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>NI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),NI=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=tp(t,e,l);if(DI(l,e)){await u;return}let[d]=await Promise.all([G3({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 K3,J3,b$e,v$e,MI=y(()=>{Vb();jI();K3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Na([t,e].filter(Boolean)):void 0,J3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>NI({...b$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:v$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),b$e=({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}},v$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var Y3,X3,Q3=y(()=>{gl();ss();Y3=t=>hl(t,"ipc"),X3=(t,e)=>{let r=B_(t);Oi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var eK,tK,rK=y(()=>{Pa();Q3();go();hI();eK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Y3(o),a=ho(e,"ipc"),c=ho(r,"ipc");for await(let l of mI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(kV(t,i,c),i.push(l)),s&&X3(l,o);return i},tK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as S$e}from"node:events";var nK,w$e,x$e,$$e,iK=y(()=>{Ia();RR();SR();TR();mo();vr();CI();rK();PR();MI();jI();fI();rv();nK=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 _=VW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=W3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=J3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),T=[],O=eK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:T,verboseInfo:p}),A=w$e(h,t,S),D=x$e(m,S);try{return await Promise.race([Promise.all([{},KW(_),Promise.all(x),w,O,J9(t,d),...A,...D]),g,$$e(t,b),...G9(t,o,f,b),...d9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...B9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(se=>PI(se))),PI(w),tK(O,T),Promise.allSettled(A),Promise.allSettled(D)])}},w$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:tp(n,i,r)),x$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>tp(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),$$e=async(t,{signal:e})=>{let[r]=await S$e(t,"error",{signal:e});throw r}});var oK,rp,Rl,nv=y(()=>{wl();oK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),rp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ti();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Rl=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 sK}from"node:stream/promises";var FI,aK,LI,zI,iv,ov,UI=y(()=>{rv();FI=async t=>{if(t!==void 0)try{await LI(t)}catch{}},aK=async t=>{if(t!==void 0)try{await zI(t)}catch{}},LI=async t=>{await sK(t,{cleanup:!0,readable:!1,writable:!0})},zI=async t=>{await sK(t,{cleanup:!0,readable:!0,writable:!1})},iv=async(t,e)=>{if(await t,e)throw e},ov=(t,e,r)=>{r&&!tv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as k$e}from"node:stream";import{callbackify as E$e}from"node:util";var cK,qI,BI,HI,A$e,GI,ZI,lK,VI=y(()=>{Ta();cs();ev();wl();nv();UI();cK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=qI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=BI(a,s),{read:f,onStdoutDataDone:p}=HI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new k$e({read:f,destroy:E$e(ZI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return GI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},qI=(t,e,r)=>{let n=xl(t,e),i=rp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},BI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:II},HI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ti(),s=Qb({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){A$e(this,s,o)},onStdoutDataDone:o}},A$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},GI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await zI(t),await n,await FI(i),await e,r.readable&&r.push(null)}catch(o){await FI(i),lK(r,o)}},ZI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Rl(r,e)&&(lK(t,n),await iv(e,n))},lK=(t,e)=>{ov(t,t.readable,e)}});import{Writable as O$e}from"node:stream";import{callbackify as uK}from"node:util";var dK,WI,KI,T$e,R$e,JI,YI,fK,XI=y(()=>{cs();nv();UI();dK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=WI(t,r,e),s=new O$e({...KI(n,t,i),destroy:uK(YI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return JI(n,s),s},WI=(t,e,r)=>{let n=nb(t,e),i=rp(r,n,"writableFinal"),o=rp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},KI=(t,e,r)=>({write:T$e.bind(void 0,t),final:uK(R$e.bind(void 0,t,e,r))}),T$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},R$e=async(t,e,r)=>{await Rl(r,e)&&(t.writable&&t.end(),await e)},JI=async(t,e,r)=>{try{await LI(t),e.writable&&e.end()}catch(n){await aK(r),fK(e,n)}},YI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Rl(r,e),await Rl(n,e)&&(fK(t,i),await iv(e,i))},fK=(t,e)=>{ov(t,t.writable,e)}});import{Duplex as I$e}from"node:stream";import{callbackify as P$e}from"node:util";var pK,C$e,mK=y(()=>{Ta();VI();XI();pK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=qI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=WI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=BI(c,a),{read:g,onStdoutDataDone:b}=HI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new I$e({read:g,...KI(u,t,d),destroy:P$e(C$e.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 GI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),JI(u,_,c),_},C$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([ZI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),YI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var QI,D$e,hK=y(()=>{Ta();cs();ev();QI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=xl(t,r),a=Qb({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return D$e(a,s,t)},D$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var gK,yK=y(()=>{nv();VI();XI();mK();hK();gK=(t,{encoding:e})=>{let r=oK();t.readable=cK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=dK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=pK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=QI.bind(void 0,t,e),t[Symbol.asyncIterator]=QI.bind(void 0,t,e,{})}});var _K,N$e,j$e,bK=y(()=>{_K=(t,e)=>{for(let[r,n]of j$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},N$e=(async()=>{})().constructor.prototype,j$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(N$e,t)])});import{setMaxListeners as M$e}from"node:events";import{spawn as F$e}from"node:child_process";var vK,L$e,z$e,U$e,q$e,B$e,SK=y(()=>{Tb();aR();NR();cs();jR();gI();Kf();Pb();u3();h3();Jf();k3();Q_();R3();q3();MI();iK();yK();wl();bK();vK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=L$e(t,e,r),{subprocess:f,promise:p}=U$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Xb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),_K(f,p),Ri.set(f,{options:u,fileDescriptors:d}),f},L$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Z_(t,e,r),{file:a,commandArguments:c,options:l}=bb(t,e,r),u=z$e(l),d=m3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},z$e=({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}},U$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=F$e(...vb(t,e,r))}catch(m){return l3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;M$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];$3(c,a,l),T3(c,r,l);let d={},f=Ti();c.kill=l9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=K3(c,r),gK(c,r),s3(c,r);let p=q$e({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}},q$e=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 nK({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)=>_o(x,e,w)),_=_o(h,e,"all"),S=B$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Al(S,n,e)},B$e=({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?Wf({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 Ii,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Ib({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var sv,H$e,G$e,wK=y(()=>{fo();go();sv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,H$e(n,t[n],i)]));return{...t,...r}},H$e=(t,e,r)=>G$e.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,G$e=new Set(["env",...rR])});var ds,Z$e,V$e,xK=y(()=>{fo();YT();$G();QW();SK();wK();ds=(t,e,r,n)=>{let i=(s,a,c)=>ds(s,a,r,c),o=(...s)=>Z$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Z$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,sv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=V$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?XW(a,c,l):vK(a,c,l,i)},V$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=wG(e)?xG(e,r):[e,...r],[s,a,c]=C_(...o),l=sv(sv(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 $K,kK,EK,W$e,K$e,AK=y(()=>{$K=({file:t,commandArguments:e})=>EK(t,e),kK=({file:t,commandArguments:e})=>({...EK(t,e),isSync:!0}),EK=(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]=W$e(t);return{file:r,commandArguments:n}},W$e=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(K$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},K$e=/ +/g});var OK,TK,J$e,RK,Y$e,IK,PK=y(()=>{OK=(t,e,r)=>{t.sync=e(J$e,r),t.s=t.sync},TK=({options:t})=>RK(t),J$e=({options:t})=>({...RK(t),isSync:!0}),RK=t=>({options:{...Y$e(t),...t}}),Y$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},IK={preferLocal:!0}});var Mct,Je,Fct,Lct,zct,Uct,qct,Bct,Hct,Gct,Mr=y(()=>{xK();AK();IR();PK();gI();Mct=ds(()=>({})),Je=ds(()=>({isSync:!0})),Fct=ds($K),Lct=ds(kK),zct=ds(V9),Uct=ds(TK,{},IK,OK),{sendMessage:qct,getOneMessage:Bct,getEachMessage:Hct,getCancelSignal:Gct}=a3()});import{existsSync as av,statSync as X$e}from"node:fs";import{dirname as eP,extname as Q$e,isAbsolute as CK,join as tP,relative as rP,resolve as cv,sep as eke}from"node:path";function lv(t){return t==="./gradlew"||t==="gradle"}function tke(t){return(av(tP(t,"build.gradle.kts"))||av(tP(t,"build.gradle")))&&av(tP(t,"gradle.properties"))}function rke(t,e){let n=rP(t,e).split(eke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function fs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function nke(t,e){let r=cv(t,e),n=r;av(r)?X$e(r).isFile()&&(n=eP(r)):Q$e(r)!==""&&(n=eP(r));let i=rP(t,n);if(i.startsWith("..")||CK(i))return null;let o=n;for(;;){if(tke(o))return o;if(cv(o)===cv(t))return null;let s=eP(o);if(s===o)return null;let a=rP(t,s);if(a.startsWith("..")||CK(a))return null;o=s}}function uv(t,e){let r=cv(t),n=new Map,i=[];for(let o of e){let s=nke(r,o);if(!s){i.push(o);continue}let a=rke(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 ike,readFileSync as oke}from"node:fs";import{join as ske}from"node:path";function Il(t="."){let e=ske(t,".cladding","config.yaml");if(!ike(e))return nP;try{let n=(0,DK.parse)(oke(e,"utf8"))?.gate;if(!n)return nP;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 ake){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 nP}}function NK(t,e){let r=[],n=!1;for(let i of t){let o=cke.exec(i);if(o){n=!0;for(let s of e)r.push(fs(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 DK,ake,nP,cke,fv=y(()=>{"use strict";DK=vt(Qt(),1);dv();ake=["type","lint","test","coverage"],nP={scope:"feature"};cke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as oP,readFileSync as jK,readdirSync as lke,statSync as uke}from"node:fs";import{join as pv}from"node:path";function cP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=pv(t,e);if(oP(r))try{if(MK.test(jK(r,"utf8")))return!0}catch{}}return!1}function FK(t){try{return oP(t)&&MK.test(jK(t,"utf8"))}catch{return!1}}function LK(t,e=0){if(e>4||!oP(t))return!1;let r;try{r=lke(t)}catch{return!1}for(let n of r){let i=pv(t,n),o=!1;try{o=uke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(LK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&FK(i))return!0}return!1}function pke(t){if(cP(t))return!0;for(let e of dke)if(FK(pv(t,e)))return!0;for(let e of fke)if(LK(pv(t,e)))return!0;return!1}function zK(t="."){let e=Il(t).coverage;return e||(pke(t)?"kover":"jacoco")}function UK(t="."){return sP[zK(t)]}function qK(t="."){return iP[zK(t)]}var sP,iP,aP,MK,dke,fke,mv=y(()=>{"use strict";fv();sP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},iP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},aP=[iP.kover,iP.jacoco],MK=/kover/i;dke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],fke=["buildSrc","build-logic"]});import{existsSync as hv,readFileSync as BK,readdirSync as HK}from"node:fs";import{join as Ma}from"node:path";function lP(t){return hv(Ma(t,"gradlew"))?"./gradlew":"gradle"}function mke(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:[UK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function hke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(BK(Ma(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 yke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function vke(t,e){for(let r of e)if(hv(Ma(t,r)))return r}function Ske(t,e){try{return HK(t).find(n=>n.endsWith(e))}catch{return}}function xke(t,e){for(let r of wke)if(r.configs.some(n=>hv(Ma(t,n))))return r.gate;return e}function kke(t){if($ke.some(e=>hv(Ma(t,e))))return!0;try{return JSON.parse(BK(Ma(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function Eke(t,e){let r=e.lint?{...e,lint:xke(t,e.lint)}:{...e};return e.test&&e.coverage&&kke(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function dt(t="."){for(let e of _ke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Ske(t,o):r=vke(t,[o]),r)break;if(!r||e.requiresSource&&!yke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Eke(t,n):n;return{language:e.language,manifest:r,gates:i}}return bke}var gke,_ke,bke,wke,$ke,on=y(()=>{"use strict";mv();gke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);_ke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:mke},{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:hke}],bke={language:"unknown",manifest:"",gates:{}};wke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];$ke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Ake,readFileSync as Oke}from"node:fs";import{join as Tke}from"node:path";function Fa(t){return t.code==="ENOENT"}function gv(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=(o||s||`exit ${i}`).slice(0,200);return GK.test(o)||GK.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Ut(t,e,r){return Fa(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Pl(t,e){let r=Tke(t,"package.json");if(!Ake(r))return!1;try{return!!JSON.parse(Oke(r,"utf8")).scripts?.[e]}catch{return!1}}var GK,On=y(()=>{"use strict";GK=/config (is |file )?not found|no such file|ENOENT|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 Rke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:yv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Fa(i)?[{detector:yv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:gv(i,yv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var yv,La,_v=y(()=>{"use strict";Mr();on();On();yv="ARCHITECTURE_VIOLATION";La={name:yv,subprocess:!0,run:Rke}});function Ike(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:bv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Fa(i)?[{detector:bv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:gv(i,bv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var bv,za,vv=y(()=>{"use strict";Mr();on();On();bv="HARDCODED_SECRET";za={name:bv,subprocess:!0,run:Ike}});import{existsSync as uP,readdirSync as ZK}from"node:fs";import{join as Sv}from"node:path";function Cke(t,e){let r=Sv(t,e.path);if(!uP(r))return!0;if(e.isDirectory)try{return ZK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Dke(t){let{cwd:e="."}=t,r=[];for(let i of Pke)Cke(e,i)&&r.push({detector:np,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=Sv(e,"spec.yaml");if(uP(n)){let i=Mke(n),o=i?null:Nke(e);if(i)r.push({detector:np,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:np,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=jke(e);s&&r.push({detector:np,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 Nke(t){for(let e of["spec/features","spec/scenarios"]){let r=Sv(t,e);if(!uP(r))continue;let n;try{n=ZK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ki(Sv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function jke(t){try{return H(t),null}catch(e){return e.message}}function Mke(t){let e;try{e=ki(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var np,Pke,VK,WK=y(()=>{"use strict";qe();x_();np="ABSENCE_OF_GOVERNANCE",Pke=[{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}];VK={name:np,run:Dke}});function wv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function dP(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=wv(r)==="while",o=Lke.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 '${wv(r)}'`}let n=Fke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:wv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${wv(r)}'`:null}function zke(t,e){let r=dP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function KK(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...zke(r,n));return e}var Fke,Lke,fP=y(()=>{"use strict";Fke={event:"when",state:"while",optional:"where",unwanted:"if"},Lke=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var St=y(()=>{"use strict";qe()});function Uke(t){let{cwd:e="."}=t;return he(e,xv,qke)}function qke(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:xv,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 KK(t.features))e.push({detector:xv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var xv,JK,YK=y(()=>{"use strict";fP();St();xv="AC_DRIFT";JK={name:xv,run:Uke}});function Ci(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return QK[n]??XK}var Bke,Hke,Gke,XK,Zke,Vke,QK,Wke,eJ,Ua=y(()=>{"use strict";on();Bke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,Hke=/^[ \t]*import\s+([\w.]+)/gm,Gke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,XK={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:Bke,importStyle:"relative"},Zke={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:Hke,importStyle:"dotted"},Vke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:Gke,importStyle:"dotted"},QK={typescript:XK,kotlin:Zke,python:Vke},Wke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],eJ=new Set([...Object.values(QK).flatMap(t=>t?.extensions??[]),...Wke].map(t=>t.toLowerCase()))});import{existsSync as Kke,readFileSync as Jke,readdirSync as Yke,statSync as Xke}from"node:fs";import{join as rJ,relative as tJ}from"node:path";function Qke(t,e){if(!Kke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=Yke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=rJ(i,s),c;try{c=Xke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function eEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function rEe(t){return tEe.test(t)}function nEe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Ci(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Qke(rJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=Jke(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";qe();Ua();nJ="AI_HINTS_FORBIDDEN_PATTERN";tEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;iJ={name:nJ,run:nEe}});function iEe(t){let{cwd:e="."}=t,r;try{r=H(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:sJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var sJ,aJ,cJ=y(()=>{"use strict";qe();sJ="AC_DUPLICATE_WITHIN_FEATURE";aJ={name:sJ,run:iEe}});import{createRequire as oEe}from"module";import{basename as sEe,dirname as mP,normalize as aEe,relative as cEe,resolve as lEe,sep as dJ}from"path";import*as uEe from"fs";function dEe(t){let e=aEe(t);return e.length>1&&e[e.length-1]===dJ&&(e=e.substring(0,e.length-1)),e}function fJ(t,e){return t.replace(fEe,e)}function mEe(t){return t==="/"||pEe.test(t)}function pP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=lEe(t)),(n||o)&&(t=dEe(t)),t===".")return"";let s=t[t.length-1]!==i;return fJ(s?t+i:t,i)}function pJ(t,e){return e+t}function hEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:fJ(cEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function gEe(t){return t}function yEe(t,e,r){return e+t+r}function _Ee(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?hEe(t,e):n?pJ:gEe}function bEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function vEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function $Ee(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?vEe(t):bEe(t):n&&n.length?wEe:SEe:xEe}function REe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?TEe:r&&r.length?n?kEe:EEe:n?AEe:OEe}function CEe(t){return t.group?PEe:IEe}function jEe(t){return t.group?DEe:NEe}function LEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?FEe:MEe}function mJ(t,e,r){if(r.options.useRealPaths)return zEe(e,r);let n=mP(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=mP(n)}return r.symlinks.set(t,e),i>1}function zEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function $v(t,e,r,n){e(t&&!n?t:null,r)}function KEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?UEe:GEe:n?e?qEe:WEe:i?e?HEe:VEe:e?BEe:ZEe}function XEe(t){return t?YEe:JEe}function rAe(t,e){return new Promise((r,n)=>{yJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function yJ(t,e,r){new gJ(t,e,r).start()}function nAe(t,e){return new gJ(t,e).start()}var lJ,fEe,pEe,SEe,wEe,xEe,kEe,EEe,AEe,OEe,TEe,IEe,PEe,DEe,NEe,MEe,FEe,UEe,qEe,BEe,HEe,GEe,ZEe,VEe,WEe,hJ,JEe,YEe,QEe,eAe,tAe,gJ,uJ,_J,bJ,vJ=y(()=>{lJ=oEe(import.meta.url);fEe=/[\\/]/g;pEe=/^[a-z]:[\\/]$/i;SEe=(t,e)=>{e.push(t||".")},wEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},xEe=()=>{};kEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},EEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},AEe=(t,e,r,n)=>{r.files++},OEe=(t,e)=>{e.push(t)},TEe=()=>{};IEe=t=>t,PEe=()=>[""].slice(0,0);DEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},NEe=()=>{};MEe=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()&&mJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},FEe=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()&&mJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};UEe=t=>t.counts,qEe=t=>t.groups,BEe=t=>t.paths,HEe=t=>t.paths.slice(0,t.options.maxFiles),GEe=(t,e,r)=>($v(e,r,t.counts,t.options.suppressErrors),null),ZEe=(t,e,r)=>($v(e,r,t.paths,t.options.suppressErrors),null),VEe=(t,e,r)=>($v(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),WEe=(t,e,r)=>($v(e,r,t.groups,t.options.suppressErrors),null);hJ={withFileTypes:!0},JEe=(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||".",hJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},YEe=(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||".",hJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};QEe=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))}},eAe=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}},tAe=class{aborted=!1;abort(){this.aborted=!0}},gJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=KEe(e,this.isSynchronous),this.root=pP(t,e),this.state={root:mEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new eAe,options:e,queue:new QEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new tAe,fs:e.fs||uEe},this.joinPath=_Ee(this.root,e),this.pushDirectory=$Ee(this.root,e),this.pushFile=REe(e),this.getArray=CEe(e),this.groupFiles=jEe(e),this.resolveSymlink=LEe(e,this.isSynchronous),this.walkDirectory=XEe(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(_=pP(_,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=sEe(_),x=pP(mP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};uJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return rAe(this.root,this.options)}withCallback(t){yJ(this.root,this.options,t)}sync(){return nAe(this.root,this.options)}},_J=null;try{lJ.resolve("picomatch"),_J=lJ("picomatch")}catch{}bJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:dJ,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 uJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new uJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||_J;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 ip=v((Wlt,kJ)=>{"use strict";var SJ="[^\\\\/]",iAe="(?=.)",wJ="[^/]",hP="(?:\\/|$)",xJ="(?:^|\\/)",gP=`\\.{1,2}${hP}`,oAe="(?!\\.)",sAe=`(?!${xJ}${gP})`,aAe=`(?!\\.{0,1}${hP})`,cAe=`(?!${gP})`,lAe="[^.\\/]",uAe=`${wJ}*?`,dAe="/",$J={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:iAe,QMARK:wJ,END_ANCHOR:hP,DOTS_SLASH:gP,NO_DOT:oAe,NO_DOTS:sAe,NO_DOT_SLASH:aAe,NO_DOTS_SLASH:cAe,QMARK_NO_DOT:lAe,STAR:uAe,START_ANCHOR:xJ,SEP:dAe},fAe={...$J,SLASH_LITERAL:"[\\\\/]",QMARK:SJ,STAR:`${SJ}*?`,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:"\\"},pAe={__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"};kJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:pAe,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?fAe:$J}}});var op=v(Fr=>{"use strict";var{REGEX_BACKSLASH:mAe,REGEX_REMOVE_BACKSLASH:hAe,REGEX_SPECIAL_CHARS:gAe,REGEX_SPECIAL_CHARS_GLOBAL:yAe}=ip();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>gAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(yAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(mAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(hAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var CJ=v((Jlt,PJ)=>{"use strict";var EJ=op(),{CHAR_ASTERISK:yP,CHAR_AT:_Ae,CHAR_BACKWARD_SLASH:sp,CHAR_COMMA:bAe,CHAR_DOT:_P,CHAR_EXCLAMATION_MARK:bP,CHAR_FORWARD_SLASH:IJ,CHAR_LEFT_CURLY_BRACE:vP,CHAR_LEFT_PARENTHESES:SP,CHAR_LEFT_SQUARE_BRACKET:vAe,CHAR_PLUS:SAe,CHAR_QUESTION_MARK:AJ,CHAR_RIGHT_CURLY_BRACE:wAe,CHAR_RIGHT_PARENTHESES:OJ,CHAR_RIGHT_SQUARE_BRACKET:xAe}=ip(),TJ=t=>t===IJ||t===sp,RJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},$Ae=(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,T=0,O,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,se=()=>c.charCodeAt(l+1),Y=()=>(O=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),Te&&m===!0&&d>0?(Te=c.slice(0,d),P=c.slice(d)):m===!0?(Te="",P=c):Te=c,Te&&Te!==""&&Te!=="/"&&Te!==c&&TJ(Te.charCodeAt(Te.length-1))&&(Te=Te.slice(0,-1)),r.unescape===!0&&(P&&(P=EJ.removeBackslashes(P)),Te&&_===!0&&(Te=EJ.removeBackslashes(Te)));let Ir={prefix:C,input:t,start:u,base:Te,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,TJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let oe;for(let Pe=0;Pe{"use strict";var ap=ip(),sn=op(),{MAX_LENGTH:kv,POSIX_REGEX_SOURCE:kAe,REGEX_NON_SPECIAL_CHARS:EAe,REGEX_SPECIAL_CHARS_BACKREF:AAe,REPLACEMENTS:DJ}=ap,OAe=(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=>sn.escapeRegex(i)).join("..")}return r},Cl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,NJ=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},TAe=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},jJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(TAe(e))return e.replace(/\\(.)/g,"$1")},RAe=t=>{let e=t.map(jJ).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}}}}},IAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=jJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},PAe=t=>{let e=0,r=t.trim(),n=wP(r);for(;n;)e++,r=n.body.trim(),n=wP(r);return e},CAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:ap.DEFAULT_MAX_EXTGLOB_RECURSION,n=NJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||RAe(n)))return{risky:!0};for(let i of n){let o=IAe(i);if(o)return{risky:!0,safeOutput:o};if(PAe(i)>r)return{risky:!0}}return{risky:!1}},xP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=DJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(kv,r.maxLength):kv,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,T=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,O=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?T(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={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=sn.removePrefix(t,$),i=t.length;let se=[],Y=[],Te=[],C=o,P,Ir=()=>$.index===i-1,oe=$.peek=(B=1)=>t[$.index+B],Pe=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(B="",mt=0)=>{$.consumed+=B,$.index+=mt},Yt=B=>{$.output+=B.output!=null?B.output:B.value,dr(B.value)},io=()=>{let B=1;for(;oe()==="!"&&(oe(2)!=="("||oe(3)==="?");)Pe(),$.start++,B++;return B%2===0?!1:($.negated=!0,$.start++,!0)},vi=B=>{$[B]++,Te.push(B)},Yr=B=>{$[B]--,Te.pop()},de=B=>{if(C.type==="globstar"){let mt=$.braces>0&&(B.type==="comma"||B.type==="brace"),q=B.extglob===!0||se.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!mt&&!q&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(se.length&&B.type!=="paren"&&(se[se.length-1].inner+=B.value),(B.value||B.output)&&Yt(B),C&&C.type==="text"&&B.type==="text"){C.output=(C.output||C.value)+B.value,C.value+=B.value;return}B.prev=C,s.push(B),C=B},oo=(B,mt)=>{let q={...l[mt],conditions:1,inner:""};q.prev=C,q.parens=$.parens,q.output=$.output,q.startIndex=$.index,q.tokensIndex=s.length;let Ae=(r.capture?"(":"")+q.open;vi("parens"),de({type:B,value:mt,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Ae}),se.push(q)},fde=B=>{let mt=t.slice(B.startIndex,$.index+1),q=t.slice(B.startIndex+2,$.index),Ae=CAe(q,r);if((B.type==="plus"||B.type==="star")&&Ae.risky){let ct=Ae.safeOutput?(B.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,Si=s[B.tokensIndex];Si.type="text",Si.value=mt,Si.output=ct||sn.escapeRegex(mt);for(let wi=B.tokensIndex+1;wi1&&B.inner.includes("/")&&(ct=T(r)),(ct!==D||Ir()||/^\)+$/.test(Kt()))&&(ut=B.close=`)$))${ct}`),B.inner.includes("*")&&(Ft=Kt())&&/^\.[^\\/.]+$/.test(Ft)){let Si=xP(Ft,{...e,fastpaths:!1}).output;ut=B.close=`)${Si})${ct})`}B.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,mt=t.replace(AAe,(q,Ae,ut,Ft,ct,Si)=>Ft==="\\"?(B=!0,q):Ft==="?"?Ae?Ae+Ft+(ct?_.repeat(ct.length):""):Si===0?A+(ct?_.repeat(ct.length):""):_.repeat(ut.length):Ft==="."?u.repeat(ut.length):Ft==="*"?Ae?Ae+Ft+(ct?D:""):D:Ae?q:`\\${q}`);return B===!0&&(r.unescape===!0?mt=mt.replace(/\\/g,""):mt=mt.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),mt===t&&r.contains===!0?($.output=t,$):($.output=sn.wrapOutput(mt,$,e),$)}for(;!Ir();){if(P=Pe(),P==="\0")continue;if(P==="\\"){let q=oe();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){P+="\\",de({type:"text",value:P});continue}let Ae=/^\\+/.exec(Kt()),ut=0;if(Ae&&Ae[0].length>2&&(ut=Ae[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Pe():P+=Pe(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let q=C.value.slice(1);if(q.includes("[")&&(C.posix=!0,q.includes(":"))){let Ae=C.value.lastIndexOf("["),ut=C.value.slice(0,Ae),Ft=C.value.slice(Ae+2),ct=kAe[Ft];if(ct){C.value=ut+ct,$.backtrack=!0,Pe(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&oe()!==":"||P==="-"&&oe()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Yt({value:P});continue}if($.quotes===1&&P!=='"'){P=sn.escapeRegex(P),C.value+=P,Yt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){vi("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Cl("opening","("));let q=se[se.length-1];if(q&&$.parens===q.parens+1){fde(se.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Yr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Cl("closing","]"));P=`\\${P}`}else vi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Cl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Yr("brackets");let q=C.value.slice(1);if(C.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(P=`/${P}`),C.value+=P,Yt({value:P}),r.literalBrackets===!1||sn.hasRegexChars(q))continue;let Ae=sn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Ae,C.value=Ae;continue}C.value=`(${a}${Ae}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){vi("braces");let q={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};Y.push(q),de(q);continue}if(P==="}"){let q=Y[Y.length-1];if(r.nobrace===!0||!q){de({type:"text",value:P,output:P});continue}let Ae=")";if(q.dots===!0){let ut=s.slice(),Ft=[];for(let ct=ut.length-1;ct>=0&&(s.pop(),ut[ct].type!=="brace");ct--)ut[ct].type!=="dots"&&Ft.unshift(ut[ct].value);Ae=OAe(Ft,r),$.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let ut=$.output.slice(0,q.outputIndex),Ft=$.tokens.slice(q.tokensIndex);q.value=q.output="\\{",P=Ae="\\}",$.output=ut;for(let ct of Ft)$.output+=ct.output||ct.value}de({type:"brace",value:P,output:Ae}),Yr("braces"),Y.pop();continue}if(P==="|"){se.length>0&&se[se.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let q=P,Ae=Y[Y.length-1];Ae&&Te[Te.length-1]==="braces"&&(Ae.comma=!0,q="|"),de({type:"comma",value:P,output:q});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let q=Y[Y.length-1];C.type="dots",C.output+=P,C.value+=P,q.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){oo("qmark",P);continue}if(C&&C.type==="paren"){let Ae=oe(),ut=P;(C.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&oe()==="("&&(oe(2)!=="?"||!/[!=<:]/.test(oe(3)))){oo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){io();continue}}if(P==="+"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){oo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let q=EAe.exec(Kt());q&&(P+=q[0],$.index+=q[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let B=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){oo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let q=C.prev,Ae=q.prev,ut=q.type==="slash"||q.type==="bos",Ft=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!ut||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let ct=$.braces>0&&(q.type==="comma"||q.type==="brace"),Si=se.length&&(q.type==="pipe"||q.type==="paren");if(!ut&&q.type!=="paren"&&!ct&&!Si){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let wi=t[$.index+4];if(wi&&wi!=="/")break;B=B.slice(3),dr("/**",3)}if(q.type==="bos"&&Ir()){C.type="globstar",C.value+=P,C.output=T(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!Ft&&Ir()){$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=T(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=q.output+C.output,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&B[0]==="/"){let wi=B[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=`${T(r)}${f}|${f}${wi})`,C.value+=P,$.output+=q.output+C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&B[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${T(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=T(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let mt={type:"star",value:P,output:D};if(r.bash===!0){mt.output=".*?",(C.type==="bos"||C.type==="slash")&&(mt.output=O+mt.output),de(mt);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){mt.output=P,de(mt);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=O,C.output+=O),oe()!=="*"&&($.output+=p,C.output+=p)),de(mt)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cl("closing","]"));$.output=sn.escapeLast($.output,"["),Yr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cl("closing",")"));$.output=sn.escapeLast($.output,"("),Yr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cl("closing","}"));$.output=sn.escapeLast($.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let B of $.tokens)$.output+=B.output!=null?B.output:B.value,B.suffix&&($.output+=B.suffix)}return $};xP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(kv,r.maxLength):kv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=DJ[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=O=>O.noglobstar===!0?_:`(${g}(?:(?!${p}${O.dot?c:o}).)*?)`,x=O=>{switch(O){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 A=/^(.*?)\.(\w+)$/.exec(O);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),T=x(w);return T&&r.strictSlashes!==!0&&(T+=`${s}?`),T};MJ.exports=xP});var UJ=v((Xlt,zJ)=>{"use strict";var DAe=CJ(),$P=FJ(),LJ=op(),NAe=ip(),jAe=t=>t&&typeof t=="object"&&!Array.isArray(t),Tt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Tt(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=jAe(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?Tt.compileRe(t,e):Tt.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=Tt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=Tt.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};Tt.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?LJ.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=Tt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Tt.matchBase=(t,e,r)=>(e instanceof RegExp?e:Tt.makeRe(e,r)).test(LJ.basename(t));Tt.isMatch=(t,e,r)=>Tt(e,r)(t);Tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Tt.parse(r,e)):$P(t,{...e,fastpaths:!1});Tt.scan=(t,e)=>DAe(t,e);Tt.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=Tt.toRegex(a,e);return n===!0&&(c.state=t),c};Tt.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=$P.fastpaths(t,e)),i.output||(i=$P(t,e)),Tt.compileRe(i,e,r,n)};Tt.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/$^/}};Tt.constants=NAe;zJ.exports=Tt});var GJ=v((Qlt,HJ)=>{"use strict";var qJ=UJ(),MAe=op();function BJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:MAe.isWindows()}),qJ(t,e,r)}Object.assign(BJ,qJ);HJ.exports=BJ});import{readdir as FAe,readdirSync as LAe,realpath as zAe,realpathSync as UAe,stat as qAe,statSync as BAe}from"fs";import{isAbsolute as HAe,posix as qa,resolve as GAe}from"path";import{fileURLToPath as ZAe}from"url";function KAe(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]===".."&&WAe.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=>qa.relative(t,n)||".":n=>qa.relative(t,`${e}/${n}`)||"."}function XAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=qa.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function KJ(t){var e;let r=Dl.default.scan(t,QAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function oOe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Dl.default.scan(t);return r.isGlob||r.negated}function cp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function JJ(t){return typeof t=="string"?[t]:t??[]}function kP(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=HAe(s.replace(aOe,""))?qa.relative(a,s):qa.normalize(s);let c=(i=sOe.exec(s))===null||i===void 0?void 0:i[0],l=KJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?qa.join(o,...d):o}return s}function cOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(kP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(kP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(kP(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=cOe(t,e,n);t.debug&&cp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(VJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Dl.default)(i.match,f),m=(0,Dl.default)(i.ignore,f),h=KAe(i.match,f),g=ZJ(r,d,o),b=o?g:ZJ(r,d,!0),_=(w,T)=>{let O=b(T,!0);return O!=="."&&!h(O)||m(O)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new bJ({filters:[a?(w,T)=>{let O=g(w,T),A=p(O)&&!m(O);return A&&cp(`matched ${O}`),A}:(w,T)=>{let O=g(w,T);return p(O)&&!m(O)}],exclude:a?(w,T)=>{let O=_(w,T);return cp(`${O?"skipped":"crawling"} ${T}`),O}:_,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&&cp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&XAe(r,d)]}function uOe(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={...dOe,...t};return e.cwd=(e.cwd instanceof URL?ZAe(e.cwd):GAe(e.cwd)).replace(VJ,"/"),e.ignore=JJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||FAe,readdirSync:e.fs.readdirSync||LAe,realpath:e.fs.realpath||zAe,realpathSync:e.fs.realpathSync||UAe,stat:e.fs.stat||qAe,statSync:e.fs.statSync||BAe}),e.debug&&cp("globbing with options:",e),e}function pOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=VAe(t)||typeof t=="string",i=JJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=fOe(n?e:t);return i.length>0?lOe(o,i):[]}function ps(t,e){let[r,n]=pOe(t,e);return r?uOe(r.sync(),n):[]}var Dl,VAe,VJ,WJ,WAe,JAe,YAe,QAe,eOe,tOe,rOe,nOe,iOe,sOe,aOe,dOe,lp=y(()=>{vJ();Dl=vt(GJ(),1),VAe=Array.isArray,VJ=/\\/g,WJ=process.platform==="win32",WAe=/^(\/?\.\.)+$/;JAe=/^[A-Z]:\/$/i,YAe=WJ?t=>JAe.test(t):t=>t==="/";QAe={parts:!0};eOe=/(?t.replace(eOe,"\\$&"),nOe=t=>t.replace(tOe,"\\$&"),iOe=WJ?nOe:rOe;sOe=/^(\/?\.\.)+/,aOe=/\\(?=[()[\]{}!*+?@|])/g;dOe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as up,readFileSync as mOe,readdirSync as hOe,statSync as YJ}from"node:fs";import{join as Ba}from"node:path";function gOe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Ci(e,n),o=[],{layers:s,forbiddenImports:a}=EP(r);return(s.size>0||a.length>0)&&!up(Ba(e,i.mainRoot))?[{detector:dp,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&&(yOe(e,i,s,o),_Oe(e,i,s,o)),a.length>0&&bOe(e,i,a,o),o)}function EP(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 yOe(t,e,r,n){let i=e.mainRoot,o=Ba(t,i);if(up(o))for(let s of hOe(o)){let a=Ba(o,s);YJ(a).isDirectory()&&(r.has(s)||n.push({detector:dp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function _Oe(t,e,r,n){let i=e.mainRoot,o=Ba(t,i);if(up(o))for(let s of r){let a=Ba(o,s);up(a)&&YJ(a).isDirectory()||n.push({detector:dp,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 bOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ba(t,i,s.from);if(!up(a))continue;let c=ps([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ba(a,l),d;try{d=mOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];vOe(p,s.to,e.importStyle)&&n.push({detector:dp,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 vOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var dp,XJ,AP=y(()=>{"use strict";lp();qe();Ua();dp="ARCHITECTURE_FROM_SPEC";XJ={name:dp,run:gOe}});import{existsSync as SOe,readFileSync as wOe}from"node:fs";import{join as xOe}from"node:path";function $Oe(t){let{cwd:e="."}=t,r=xOe(e,"spec/capabilities.yaml");if(!SOe(r))return[];let n;try{let c=wOe(r,"utf8"),l=QJ.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=H(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:Ev,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:Ev,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:Ev,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var QJ,Ev,e8,t8=y(()=>{"use strict";QJ=vt(Qt(),1);qe();Ev="CAPABILITIES_FEATURE_MAPPING";e8={name:Ev,run:$Oe}});import{existsSync as kOe,readFileSync as EOe}from"node:fs";import{join as AOe}from"node:path";function OOe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function TOe(t){let{cwd:e="."}=t;return he(e,OP,r=>ROe(r,e))}function ROe(t,e){let r=Ci(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=AOe(e,o);if(!kOe(s))continue;let a=EOe(s,"utf8");OOe(a)||n.push({detector:OP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var OP,r8,n8=y(()=>{"use strict";Ua();St();OP="CONVENTION_DRIFT";r8={name:OP,run:TOe}});import{existsSync as TP,readFileSync as i8}from"node:fs";import{join as Av}from"node:path";function IOe(t){return JSON.parse(t).total?.lines?.pct??0}function o8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function DOe(t,e){if(!lv(dt(t).gates.coverage?.cmd))return null;let r;try{r=uv(t,e)}catch(c){return[{detector:bo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=aP.find(d=>TP(Av(c.dir,d)));if(!l){s.push(c.path);continue}let u=o8(i8(Av(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:bo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=s8(n,i);return a0?[{detector:bo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function NOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=DOe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Ci(e,r),i=dt(e).language==="kotlin"?aP.find(a=>TP(Av(e,a)))??qK(e):n.coverageSummary,o=Av(e,i);if(!TP(o))return[{detector:bo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=i8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?POe(a):n.coverageFormat==="cobertura-xml"?COe(a):IOe(a)}catch(a){return[{detector:bo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:bo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Ov?[]:[{detector:bo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Ov}%`}]}var bo,Ov,a8,c8=y(()=>{"use strict";qe();mv();Ua();dv();on();bo="COVERAGE_DROP",Ov=70;a8={name:bo,run:NOe}});import{existsSync as jOe}from"node:fs";import{join as MOe}from"node:path";function FOe(t){let{cwd:e="."}=t;return he(e,Tv,r=>LOe(r,e))}function LOe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?jOe(MOe(e,r.path))?[]:[{detector:Tv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:Tv,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var Tv,l8,u8=y(()=>{"use strict";St();Tv="DELIVERABLE_INTEGRITY";l8={name:Tv,run:FOe}});function zOe(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:Rv,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 UOe(t){let e=zOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Rv,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 qOe(t){let{cwd:e="."}=t;return he(e,Rv,r=>UOe(r))}var Rv,d8,f8=y(()=>{"use strict";St();Rv="SMOKE_PROBE_DEMAND";d8={name:Rv,run:qOe}});function BOe(t){let{cwd:e="."}=t;return he(e,Iv,r=>HOe(r,e))}function HOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=is(e);if(n===null)return[{detector:Iv,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=T_(n,e,o);s.state!=="fresh"&&i.push({detector:Iv,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 Iv,Pv,RP=y(()=>{"use strict";ul();St();Iv="STALE_ATTESTATION";Pv={name:Iv,run:BOe}});function GOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return ZOe(r)}function ZOe(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:p8,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 p8,Cv,IP=y(()=>{"use strict";qe();p8="DEPENDENCY_CYCLE";Cv={name:p8,run:GOe}});import{appendFileSync as VOe,existsSync as m8,mkdirSync as WOe,readFileSync as KOe}from"node:fs";import{dirname as JOe,join as YOe}from"node:path";function h8(t){return YOe(t,XOe,QOe)}function g8(t){return PP.add(t),()=>PP.delete(t)}function Ha(t,e){let r=h8(t),n=JOe(r);m8(n)||WOe(n,{recursive:!0}),VOe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of PP)try{i(t,e)}catch{}}function Tn(t){let e=h8(t);if(!m8(e))return[];let r=KOe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var XOe,QOe,PP,ti=y(()=>{"use strict";XOe=".cladding",QOe="audit.log.jsonl";PP=new Set});import{existsSync as eTe}from"node:fs";import{join as tTe}from"node:path";function rTe(t){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return[{detector:CP,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&&(eTe(tTe(e,i.artifact))||n.push({detector:CP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var CP,y8,_8=y(()=>{"use strict";ti();CP="EVIDENCE_MISMATCH";y8={name:CP,run:rTe}});import{existsSync as nTe,readFileSync as iTe}from"node:fs";import{join as oTe}from"node:path";function sTe(t){let e=oTe(t,w8);if(!nTe(e))return null;try{let n=((0,S8.parse)(iTe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*v8(t,e){for(let r of t??[])r.startsWith(b8)&&(yield{ref:r,name:r.slice(b8.length),field:e})}function aTe(t){let{cwd:e="."}=t,r=sTe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:DP,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=[...v8(s.evidence_refs,"evidence_refs"),...v8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:DP,severity:"warn",path:w8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var S8,DP,b8,w8,x8,$8=y(()=>{"use strict";S8=vt(Qt(),1);qe();DP="FIXTURE_REFERENCE_INVALID",b8="fixture:",w8="conformance/fixtures.yaml";x8={name:DP,run:aTe}});import{existsSync as Nl,readFileSync as NP}from"node:fs";import{join as Ga}from"node:path";function cTe(t){return ps(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function fp(t){if(!Nl(t))return null;try{return JSON.parse(NP(t,"utf8"))}catch{return null}}function lTe(t,e){let r=Ga(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(NP(r,"utf8"))}catch(c){e.push({detector:vo,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:vo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=cTe(t);s!==a&&e.push({detector:vo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function uTe(t,e){for(let r of k8){let n=Ga(t,r.path);if(!Nl(n))continue;let i=fp(n);if(!i){e.push({detector:vo,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:vo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function dTe(t,e){let r=fp(Ga(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of k8){let s=Ga(t,o.path);if(!Nl(s))continue;let a=fp(s);a?.version&&a.version!==n&&e.push({detector:vo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ga(t,".claude-plugin","marketplace.json");if(Nl(i)){let o=fp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:vo,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 fTe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function pTe(t,e){let r=Ga(t,"src","cli","clad.ts"),n=Ga(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Nl(r)||!Nl(n))return;let i=fTe(NP(r,"utf8"));if(i.length===0)return;let s=fp(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:vo,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 mTe(t){let{cwd:e="."}=t,r=[];return lTe(e,r),pTe(e,r),uTe(e,r),dTe(e,r),r}var vo,k8,E8,A8=y(()=>{"use strict";lp();vo="HARNESS_INTEGRITY",k8=[{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"]}];E8={name:vo,run:mTe}});import{existsSync as hTe,readFileSync as gTe}from"node:fs";import{join as yTe}from"node:path";function bTe(t){let{cwd:e="."}=t;return he(e,Dv,r=>STe(r,e))}function vTe(t){let e=yTe(t,"spec/capabilities.yaml");if(!hTe(e))return!1;try{let r=O8.default.parse(gTe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function STe(t,e){let r=t.features.length;if(r<_Te)return[];let n=[];return vTe(e)&&n.push({detector:Dv,severity:"warn",path:"spec/capabilities.yaml",message:`${r} features but spec/capabilities.yaml declares no capabilities (capabilities: []) \u2014 the design SSoT is an empty seed. Populate it (capability \u2194 feature links) or run \`clad init --scan\`.`}),t.architecture&&(t.architecture.layers??[]).length===0&&n.push({detector:Dv,severity:"warn",path:"spec/architecture.yaml",message:`${r} features but spec/architecture.yaml declares no layers (layers: []) \u2014 the architecture SSoT is an empty seed. Populate it or run \`clad init --scan\`.`}),n}var O8,Dv,_Te,T8,R8=y(()=>{"use strict";O8=vt(Qt(),1);St();Dv="HOLLOW_GOVERNANCE",_Te=8;T8={name:Dv,run:bTe}});import{existsSync as I8,readFileSync as P8}from"node:fs";import{join as C8}from"node:path";function D8(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 $Te(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 kTe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function ETe(t){let e=C8(t,"README.md"),r=C8(t,"docs","dogfood","matrix.md");if(!I8(e)||!I8(r))return[];let n=D8(P8(e,"utf8"),wTe),i=D8(P8(r,"utf8"),xTe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=kTe(a);if(c===null)continue;let l=i[s]??"not-run",u=$Te(l);u!==null&&c>u&&o.push({detector:N8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function ATe(t){let{cwd:e="."}=t;return ETe(e)}var N8,wTe,xTe,j8,M8=y(()=>{"use strict";N8="HOST_CLAIM_DRIFT",wTe=//,xTe=//;j8={name:N8,run:ATe}});function OTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return F8(r.features.map(i=>i.id),"feature","spec/features/",n),F8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function F8(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:L8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var L8,z8,U8=y(()=>{"use strict";qe();L8="ID_COLLISION";z8={name:L8,run:OTe}});import{existsSync as pp,readFileSync as jP,readdirSync as MP,statSync as TTe,writeFileSync as B8}from"node:fs";import{join as So}from"node:path";function q8(t){if(!pp(t))return 0;try{return MP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function RTe(t){if(!pp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=MP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=So(n,o),a;try{a=TTe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function ITe(t){let e=So(t,"spec","capabilities.yaml");if(!pp(e))return 0;try{let r=Nv.default.parse(jP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ms(t="."){let e=q8(So(t,"spec","features")),r=q8(So(t,"spec","scenarios")),n=ITe(t),i=RTe(So(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function jl(t,e){let r=So(t,"spec.yaml");if(!pp(r))return;let n=jP(r,"utf8"),i=PTe(n,e);i!==n&&B8(r,i)}function PTe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as gxe}from"node:buffer";import{StringDecoder as yxe}from"node:string_decoder";var Ub,_xe,bxe,vxe,aP=y(()=>{rn();Ub=(t,e,r)=>{if(r)return;if(t)return{transform:_xe.bind(void 0,new TextEncoder)};let n=new yxe(e);return{transform:bxe.bind(void 0,n),final:vxe.bind(void 0,n)}},_xe=function*(t,e){gxe.isBuffer(e)?yield po(e):typeof e=="string"?yield t.encode(e):yield e},bxe=function*(t,e){yield Ut(e)?t.write(e):e},vxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as DW}from"node:util";var cP,qb,NW,Sxe,jW,wxe,MW=y(()=>{cP=DW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),qb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=wxe}=e[r];for await(let i of n(t))yield*qb(i,e,r+1)},NW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Sxe(r,Number(e),t)},Sxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*qb(n,r,e+1)},jW=DW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),wxe=function*(t){yield t}});var lP,FW,Da,Yf,xxe,$xe,uP=y(()=>{lP=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},FW=(t,e)=>[...e.flatMap(r=>[...Da(r,t,0)]),...Yf(t)],Da=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=$xe}=e[r];for(let i of n(t))yield*Da(i,e,r+1)},Yf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*xxe(r,Number(e),t)},xxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Da(n,r,e+1)},$xe=function*(t){yield t}});import{Transform as kxe,getDefaultHighWaterMark as LW}from"node:stream";var dP,Bb,zW,Hb=y(()=>{vr();zb();CW();aP();MW();uP();dP=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=zW(t,s,o),l=Ca(e),u=Ca(r),d=l?cP.bind(void 0,qb,a):lP.bind(void 0,Da),f=l||u?cP.bind(void 0,NW,a):lP.bind(void 0,Yf),p=l||u?jW.bind(void 0,a):void 0;return{stream:new kxe({writableObjectMode:n,writableHighWaterMark:LW(n),readableObjectMode:i,readableHighWaterMark:LW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Bb=(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=zW(s,r,a);t=FW(c,t)}return t},zW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:RW(n,a)},Ub(r,s,n),Lb(r,o,n,c),{transform:t,final:e},{transform:PW(i,a)},OW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var UW,Exe,Axe,Txe,Oxe,qW=y(()=>{Hb();rn();vr();UW=(t,e)=>{for(let r of Exe(t))Axe(t,r,e)},Exe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Axe=(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 ${us[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Txe(a,n));r.input=Nf(s)},Txe=(t,e)=>{let r=Bb(t,e,"utf8",!0);return Oxe(r),Nf(r)},Oxe=t=>{let e=t.find(r=>typeof r!="string"&&!Ut(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 Gb,Rxe,Pxe,BW,HW,Ixe,GW,fP=y(()=>{Oa();vr();gl();ss();Gb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&hl(r,n)&&!nn.has(e)&&Rxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Pxe.has(o))||t.every(({type:i})=>An.has(i))),Rxe=t=>t===1||t===2,Pxe=new Set(["pipe","overlapped"]),BW=async(t,e,r,n)=>{for await(let i of t)Ixe(e)||GW(i,r,n)},HW=(t,e,r)=>{for(let n of t)GW(n,e,r)},Ixe=t=>t._readableState.pipes.length>0,GW=(t,e,r)=>{let n=H_(t);Ti({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Cxe,appendFileSync as Dxe}from"node:fs";var ZW,Nxe,jxe,Mxe,Fxe,Lxe,VW=y(()=>{fP();Hb();zb();rn();vr();Ia();ZW=({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)=>Nxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Nxe=({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=PV(t,o,d),p=po(f),{stdioItems:m,objectMode:h}=e[r],g=jxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Mxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Fxe({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&&Lxe(b,m,i),S}catch(x){return n.error=x,S}},jxe=(t,e,r,n)=>{try{return Bb(t,e,r,!1)}catch(i){return n.error=i,t}},Mxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Nf(t)};let s=SG(t,r);return n[o]?{serializedResult:s,finalResult:sP(s,!i[o],e)}:{serializedResult:s}},Fxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Gb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=sP(t,!1,s);try{HW(a,e,n)}catch(c){r.error??=c}},Lxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>jb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Dxe(n,t):(r.add(o),Cxe(n,t))}}});var WW,KW=y(()=>{rn();Jf();WW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,_o(e,r,"all")]:Array.isArray(e)?[_o(t,r,"all"),...e]:Ut(t)&&Ut(e)?tR([t,e]):`${t}${e}`}});import{once as pP}from"node:events";var JW,zxe,YW,XW,Uxe,mP,hP=y(()=>{Aa();JW=async(t,e)=>{let[r,n]=await zxe(t);return e.isForcefullyTerminated??=!1,[r,n]},zxe=async t=>{let[e,r]=await Promise.allSettled([pP(t,"spawn"),pP(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?YW(t):r.value},YW=async t=>{try{return await pP(t,"exit")}catch{return YW(t)}},XW=async t=>{let[e,r]=await t;if(!Uxe(e,r)&&mP(e,r))throw new Xn;return[e,r]},Uxe=(t,e)=>t===void 0&&e===void 0,mP=(t,e)=>t!==0||e!==null});var QW,qxe,e3=y(()=>{Aa();Ia();hP();QW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=qxe(t,e,r),s=o?.code==="ETIMEDOUT",a=RV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},qxe=(t,e,r)=>t!==void 0?t:mP(e,r)?new Xn:void 0});import{spawnSync as Bxe}from"node:child_process";var t3,Hxe,Gxe,Zxe,Zb,Vxe,Wxe,Kxe,Jxe,r3=y(()=>{uR();FR();LR();Kf();Cb();EW();Jf();qW();VW();Ia();KW();e3();t3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Hxe(t,e,r),d=Vxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Al(d,c,l)},Hxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=V_(t,e,r),a=Gxe(r),{file:c,commandArguments:l,options:u}=vb(t,e,a);Zxe(u);let d=$W(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Gxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Zxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Zb("ipcInput"),t&&Zb("ipc: true"),r&&Zb("detached: true"),n&&Zb("cancelSignal")},Zb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Vxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Wxe({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}=QW(c,r),{output:m,error:h=l}=ZW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>_o(_,r,S)),b=_o(WW(m,r),r,"all");return Jxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Wxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{UW(o,r);let a=Kxe(r);return Bxe(...Sb(t,e,a))}catch(a){return El({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},Kxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Pb(e)}),Jxe=({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?Ib({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Wf({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 gP,on as Yxe}from"node:events";var n3,Xxe,Qxe,e0e,t0e,i3=y(()=>{Sl();Bf();qf();n3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(bl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:pb(t)}),Xxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Xxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{sb(e,i);let o=ls(t,e,r),s=new AbortController;try{return await Promise.race([Qxe(o,n,s),e0e(o,r,s),t0e(o,r,s)])}catch(a){throw vl(t),a}finally{s.abort(),ab(e,i)}},Qxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await gP(t,"message",{signal:r});return n}for await(let[n]of Yxe(t,"message",{signal:r}))if(e(n))return n},e0e=async(t,e,{signal:r})=>{await gP(t,"disconnect",{signal:r}),h9(e)},t0e=async(t,e,{signal:r})=>{let[n]=await gP(t,"strict:error",{signal:r});throw rb(n,e)}});import{once as s3,on as r0e}from"node:events";var a3,yP,n0e,i0e,o0e,o3,_P=y(()=>{Sl();Bf();qf();a3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>yP({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),yP=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{bl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:pb(t)}),sb(e,o);let s=ls(t,e,r),a=new AbortController,c={};return n0e(t,s,a),i0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),o0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},n0e=async(t,e,r)=>{try{await s3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},i0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await s3(t,"strict:error",{signal:r.signal});n.error=rb(i,e),r.abort()}catch{}},o0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of r0e(r,"message",{signal:o.signal}))o3(s),yield c}catch{o3(s)}finally{o.abort(),ab(e,a),n||vl(t),i&&await t}},o3=({error:t})=>{if(t)throw t}});import c3 from"node:process";var l3,u3,d3,bP=y(()=>{_b();i3();_P();db();l3=(t,{ipc:e})=>{Object.assign(t,d3(t,!1,e))},u3=()=>{let t=c3,e=!0,r=c3.channel!==void 0;return{...d3(t,e,r),getCancelSignal:B9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},d3=(t,e,r)=>({sendMessage:yb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:n3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:a3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as s0e}from"node:child_process";import{PassThrough as a0e,Readable as c0e,Writable as l0e,Duplex as u0e}from"node:stream";var f3,d0e,Xf,f0e,p0e,m0e,h0e,p3=y(()=>{Fb();Kf();Cb();f3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{nP(n);let a=new s0e;d0e(a,n),Object.assign(a,{readable:f0e,writable:p0e,duplex:m0e});let c=El({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=h0e(c,s,i);return{subprocess:a,promise:l}},d0e=(t,e)=>{let r=Xf(),n=Xf(),i=Xf(),o=Array.from({length:e.length-3},Xf),s=Xf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Xf=()=>{let t=new a0e;return t.end(),t},f0e=()=>new c0e({read(){}}),p0e=()=>new l0e({write(){}}),m0e=()=>new u0e({read(){},write(){}}),h0e=async(t,e,r)=>Al(t,e,r)});import{createReadStream as m3,createWriteStream as h3}from"node:fs";import{Buffer as g0e}from"node:buffer";import{Readable as Qf,Writable as y0e,Duplex as _0e}from"node:stream";var y3,ep,g3,b0e,_3=y(()=>{Hb();Fb();vr();y3=(t,e)=>Mb(b0e,t,e,!1),ep=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${us[t]}.`)},g3={fileNumber:ep,generator:dP,asyncGenerator:dP,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:_0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},b0e={input:{...g3,fileUrl:({value:t})=>({stream:m3(t)}),filePath:({value:{file:t}})=>({stream:m3(t)}),webStream:({value:t})=>({stream:Qf.fromWeb(t)}),iterable:({value:t})=>({stream:Qf.from(t)}),asyncIterable:({value:t})=>({stream:Qf.from(t)}),string:({value:t})=>({stream:Qf.from(t)}),uint8Array:({value:t})=>({stream:Qf.from(g0e.from(t))})},output:{...g3,fileUrl:({value:t})=>({stream:h3(t)}),filePath:({value:{file:t,append:e}})=>({stream:h3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:y0e.fromWeb(t)}),iterable:ep,asyncIterable:ep,string:ep,uint8Array:ep}}});import{on as v0e,once as b3}from"node:events";import{PassThrough as S0e,getDefaultHighWaterMark as w0e}from"node:stream";import{finished as w3}from"node:stream/promises";function Na(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)SP(i);let e=t.some(({readableObjectMode:i})=>i),r=x0e(t,e),n=new vP({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var x0e,vP,$0e,k0e,E0e,SP,A0e,T0e,O0e,R0e,P0e,x3,$3,wP,k3,I0e,Vb,v3,S3,Wb=y(()=>{x0e=(t,e)=>{if(t.length===0)return w0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},vP=class extends S0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(SP(e),this.#t.has(e))return;this.#t.add(e),this.#n??=$0e(this,this.#t,this.#o);let r=A0e({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(SP(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)}},$0e=async(t,e,r)=>{Vb(t,v3);let n=new AbortController;try{await Promise.race([k0e(t,n),E0e(t,e,r,n)])}finally{n.abort(),Vb(t,-v3)}},k0e=async(t,{signal:e})=>{try{await w3(t,{signal:e,cleanup:!0})}catch(r){throw x3(t,r),r}},E0e=async(t,e,r,{signal:n})=>{for await(let[i]of v0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},SP=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},A0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Vb(t,S3);let a=new AbortController;try{await Promise.race([T0e(o,e,a),O0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),R0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Vb(t,-S3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?wP(t):P0e(t))},T0e=async(t,e,{signal:r})=>{try{await t,r.aborted||wP(e)}catch(n){r.aborted||x3(e,n)}},O0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await w3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;$3(s)?i.add(e):k3(t,s)}},R0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await b3(t,i,{signal:o}),!t.readable)return b3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},P0e=t=>{t.writable&&t.end()},x3=(t,e)=>{$3(e)?wP(t):k3(t,e)},$3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",wP=t=>{(t.readable||t.writable)&&t.destroy()},k3=(t,e)=>{t.destroyed||(t.once("error",I0e),t.destroy(e))},I0e=()=>{},Vb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},v3=2,S3=1});import{finished as E3}from"node:stream/promises";var Ol,C0e,xP,D0e,$P,Kb=y(()=>{mo();Ol=(t,e)=>{t.pipe(e),C0e(t,e),D0e(t,e)},C0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await E3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}xP(e)}},xP=t=>{t.writable&&t.end()},D0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await E3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}$P(t)}},$P=t=>{t.readable&&t.destroy()}});var A3,N0e,j0e,M0e,F0e,L0e,T3=y(()=>{Wb();mo();ob();vr();Kb();A3=(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})=>An.has(c)))N0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.has(c)))M0e({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]:Na(o);Ol(s,i)}},N0e=(t,e,r,n)=>{r==="output"?Ol(t.stdio[n],e):Ol(e,t.stdio[n]);let i=j0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},j0e=["stdin","stdout","stderr"],M0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;F0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},F0e=(t,{signal:e})=>{Yn(t)&&Ta(t,L0e,e)},L0e=2});var ja,O3=y(()=>{ja=[];ja.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&ja.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&ja.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Jb,kP,EP,z0e,AP,Yb,U0e,TP,OP,RP,R3,Vot,Wot,P3=y(()=>{O3();Jb=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",kP=Symbol.for("signal-exit emitter"),EP=globalThis,z0e=Object.defineProperty.bind(Object),AP=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(EP[kP])return EP[kP];z0e(EP,kP,{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}},Yb=class{},U0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),TP=class extends Yb{onExit(){return()=>{}}load(){}unload(){}},OP=class extends Yb{#t=RP.platform==="win32"?"SIGINT":"SIGHUP";#r=new AP;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of ja)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(!Jb(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 ja)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,ja.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 Jb(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"&&Jb(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)}},RP=globalThis.process,{onExit:R3,load:Vot,unload:Wot}=U0e(Jb(RP)?new OP(RP):new TP)});import{addAbortListener as q0e}from"node:events";var I3,C3=y(()=>{P3();I3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=R3(()=>{t.kill()});q0e(n,()=>{i()})}});var N3,B0e,H0e,D3,G0e,j3=y(()=>{eR();Z_();cs();pl();N3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=G_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=B0e(r,n,i),{sourceStream:d,sourceError:f}=G0e(t,l),{options:p,fileDescriptors:m}=Ri.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},B0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=H0e(t,e,...r),a=ib(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},H0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(D3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||XO(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]=D_(r,...n);return{destination:e(D3)(i,o,s),pipeOptions:s}}if(Ri.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}`)},D3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),G0e=(t,e)=>{try{return{sourceStream:xl(t,e)}}catch(r){return{sourceError:r}}}});var F3,Z0e,PP,M3,IP=y(()=>{Kf();Kb();F3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=Z0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw PP({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},Z0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return $P(t),n;if(e!==void 0)return xP(r),e},PP=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>El({error:t,command:M3,escapedCommand:M3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),M3="source.pipe(destination)"});var L3,z3=y(()=>{L3=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 V0e}from"node:stream/promises";var U3,W0e,K0e,J0e,Xb,Y0e,X0e,q3=y(()=>{Wb();ob();Kb();U3=(t,e,r)=>{let n=Xb.has(e)?K0e(t,e):W0e(t,e);return Ta(t,Y0e,r.signal),Ta(e,X0e,r.signal),J0e(e),n},W0e=(t,e)=>{let r=Na([t]);return Ol(r,e),Xb.set(e,r),r},K0e=(t,e)=>{let r=Xb.get(e);return r.add(t),r},J0e=async t=>{try{await V0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Xb.delete(t)},Xb=new WeakMap,Y0e=2,X0e=1});import{aborted as Q0e}from"node:util";var B3,e$e,H3=y(()=>{IP();B3=(t,e)=>t===void 0?[]:[e$e(t,e)],e$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Q0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw PP({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var Qb,t$e,r$e,G3=y(()=>{fo();j3();IP();z3();q3();H3();Qb=(t,...e)=>{if(Ot(e[0]))return Qb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=N3(t,...e),i=t$e({...n,destination:r});return i.pipe=Qb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},t$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=r$e(t,i);F3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=U3(e,o,d);return await Promise.race([L3(u),...B3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},r$e=(t,e)=>Promise.allSettled([t,e])});import{on as n$e}from"node:events";import{getDefaultHighWaterMark as i$e}from"node:stream";var ev,o$e,CP,s$e,V3,DP,Z3,a$e,c$e,tv=y(()=>{aP();zb();uP();ev=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return o$e(e,s),V3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},o$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},CP=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;s$e(e,s,t);let a=t.readableObjectMode&&!o;return V3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},s$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},V3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=n$e(t,"data",{signal:e.signal,highWaterMark:Z3,highWatermark:Z3});return a$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},DP=i$e(!0),Z3=DP,a$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=c$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Da(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Yf(a)}},c$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Ub(t,r,!e),Lb(t,i,!n,{})].filter(Boolean)});import{setImmediate as l$e}from"node:timers/promises";var W3,u$e,d$e,f$e,NP,K3,jP=y(()=>{Rb();rn();fP();tv();Ia();Jf();W3=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=u$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([d$e(t),d]);return}let f=iP(c,r),p=CP({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([f$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},u$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Gb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=CP({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await BW(a,t,r,o)},d$e=async t=>{await l$e(),t.readableFlowing===null&&t.resume()},f$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Eb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Ab(r,{maxBuffer:o})):await Ob(r,{maxBuffer:o})}catch(a){return K3(AV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},NP=async t=>{try{return await t}catch(e){return K3(e)}},K3=({bufferedData:t})=>bG(t)?new Uint8Array(t):t});import{finished as p$e}from"node:stream/promises";var tp,m$e,h$e,g$e,y$e,_$e,MP,rv,J3,nv=y(()=>{tp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=m$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],p$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||y$e(a,e,r,n)}finally{s.abort()}},m$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&h$e(t,r,n),n},h$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{g$e(e,r),n.call(t,...i)}},g$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},y$e=(t,e,r,n)=>{if(!_$e(t,e,r,n))throw t},_$e=(t,e,r,n=!0)=>r.propagating?J3(t)||rv(t):(r.propagating=!0,MP(r,e)===n?J3(t):rv(t)),MP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",rv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",J3=t=>t?.code==="EPIPE"});var Y3,FP,LP=y(()=>{jP();nv();Y3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>FP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),FP=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=tp(t,e,l);if(MP(l,e)){await u;return}let[d]=await Promise.all([W3({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 X3,Q3,b$e,v$e,zP=y(()=>{Wb();LP();X3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Na([t,e].filter(Boolean)):void 0,Q3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>FP({...b$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:v$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),b$e=({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}},v$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var eK,tK,rK=y(()=>{gl();ss();eK=t=>hl(t,"ipc"),tK=(t,e)=>{let r=H_(t);Ti({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var nK,iK,oK=y(()=>{Ia();rK();go();_P();nK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=eK(o),a=ho(e,"ipc"),c=ho(r,"ipc");for await(let l of yP({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(TV(t,i,c),i.push(l)),s&&tK(l,o);return i},iK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as S$e}from"node:events";var sK,w$e,x$e,$$e,aK=y(()=>{Pa();CR();$R();IR();mo();vr();jP();oK();NR();zP();LP();hP();nv();sK=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 _=JW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=Y3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=Q3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=nK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=w$e(h,t,S),D=x$e(m,S);try{return await Promise.race([Promise.all([{},XW(_),Promise.all(x),w,T,Q9(t,d),...A,...D]),g,$$e(t,b),...W9(t,o,f,b),...m9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...Z9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(se=>NP(se))),NP(w),iK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},w$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:tp(n,i,r)),x$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>tp(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),$$e=async(t,{signal:e})=>{let[r]=await S$e(t,"error",{signal:e});throw r}});var cK,rp,Rl,iv=y(()=>{wl();cK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),rp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Oi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Rl=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 lK}from"node:stream/promises";var UP,uK,qP,BP,ov,sv,HP=y(()=>{nv();UP=async t=>{if(t!==void 0)try{await qP(t)}catch{}},uK=async t=>{if(t!==void 0)try{await BP(t)}catch{}},qP=async t=>{await lK(t,{cleanup:!0,readable:!1,writable:!0})},BP=async t=>{await lK(t,{cleanup:!0,readable:!0,writable:!1})},ov=async(t,e)=>{if(await t,e)throw e},sv=(t,e,r)=>{r&&!rv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as k$e}from"node:stream";import{callbackify as E$e}from"node:util";var dK,GP,ZP,VP,A$e,WP,KP,fK,JP=y(()=>{Oa();cs();tv();wl();iv();HP();dK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=GP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=ZP(a,s),{read:f,onStdoutDataDone:p}=VP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new k$e({read:f,destroy:E$e(KP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return WP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},GP=(t,e,r)=>{let n=xl(t,e),i=rp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},ZP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:DP},VP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Oi(),s=ev({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){A$e(this,s,o)},onStdoutDataDone:o}},A$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},WP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await BP(t),await n,await UP(i),await e,r.readable&&r.push(null)}catch(o){await UP(i),fK(r,o)}},KP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Rl(r,e)&&(fK(t,n),await ov(e,n))},fK=(t,e)=>{sv(t,t.readable,e)}});import{Writable as T$e}from"node:stream";import{callbackify as pK}from"node:util";var mK,YP,XP,O$e,R$e,QP,eI,hK,tI=y(()=>{cs();iv();HP();mK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=YP(t,r,e),s=new T$e({...XP(n,t,i),destroy:pK(eI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return QP(n,s),s},YP=(t,e,r)=>{let n=ib(t,e),i=rp(r,n,"writableFinal"),o=rp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},XP=(t,e,r)=>({write:O$e.bind(void 0,t),final:pK(R$e.bind(void 0,t,e,r))}),O$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},R$e=async(t,e,r)=>{await Rl(r,e)&&(t.writable&&t.end(),await e)},QP=async(t,e,r)=>{try{await qP(t),e.writable&&e.end()}catch(n){await uK(r),hK(e,n)}},eI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Rl(r,e),await Rl(n,e)&&(hK(t,i),await ov(e,i))},hK=(t,e)=>{sv(t,t.writable,e)}});import{Duplex as P$e}from"node:stream";import{callbackify as I$e}from"node:util";var gK,C$e,yK=y(()=>{Oa();JP();tI();gK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=GP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=YP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=ZP(c,a),{read:g,onStdoutDataDone:b}=VP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new P$e({read:g,...XP(u,t,d),destroy:I$e(C$e.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 WP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),QP(u,_,c),_},C$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([KP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),eI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var rI,D$e,_K=y(()=>{Oa();cs();tv();rI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=xl(t,r),a=ev({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return D$e(a,s,t)},D$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var bK,vK=y(()=>{iv();JP();tI();yK();_K();bK=(t,{encoding:e})=>{let r=cK();t.readable=dK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=mK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=gK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=rI.bind(void 0,t,e),t[Symbol.asyncIterator]=rI.bind(void 0,t,e,{})}});var SK,N$e,j$e,wK=y(()=>{SK=(t,e)=>{for(let[r,n]of j$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},N$e=(async()=>{})().constructor.prototype,j$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(N$e,t)])});import{setMaxListeners as M$e}from"node:events";import{spawn as F$e}from"node:child_process";var xK,L$e,z$e,U$e,q$e,B$e,$K=y(()=>{Rb();uR();FR();cs();LR();bP();Kf();Cb();p3();_3();Jf();T3();eb();C3();G3();zP();aK();vK();wl();wK();xK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=L$e(t,e,r),{subprocess:f,promise:p}=U$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Qb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),SK(f,p),Ri.set(f,{options:u,fileDescriptors:d}),f},L$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=V_(t,e,r),{file:a,commandArguments:c,options:l}=vb(t,e,r),u=z$e(l),d=y3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},z$e=({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}},U$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=F$e(...Sb(t,e,r))}catch(m){return f3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;M$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];A3(c,a,l),I3(c,r,l);let d={},f=Oi();c.kill=f9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=X3(c,r),bK(c,r),l3(c,r);let p=q$e({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}},q$e=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 sK({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)=>_o(x,e,w)),_=_o(h,e,"all"),S=B$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Al(S,n,e)},B$e=({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?Wf({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 Pi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Ib({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var av,H$e,G$e,kK=y(()=>{fo();go();av=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,H$e(n,t[n],i)]));return{...t,...r}},H$e=(t,e,r)=>G$e.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,G$e=new Set(["env",...oR])});var ds,Z$e,V$e,EK=y(()=>{fo();eR();AG();r3();$K();kK();ds=(t,e,r,n)=>{let i=(s,a,c)=>ds(s,a,r,c),o=(...s)=>Z$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Z$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,av(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=V$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?t3(a,c,l):xK(a,c,l,i)},V$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=kG(e)?EG(e,r):[e,...r],[s,a,c]=D_(...o),l=av(av(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 AK,TK,OK,W$e,K$e,RK=y(()=>{AK=({file:t,commandArguments:e})=>OK(t,e),TK=({file:t,commandArguments:e})=>({...OK(t,e),isSync:!0}),OK=(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]=W$e(t);return{file:r,commandArguments:n}},W$e=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(K$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},K$e=/ +/g});var PK,IK,J$e,CK,Y$e,DK,NK=y(()=>{PK=(t,e,r)=>{t.sync=e(J$e,r),t.s=t.sync},IK=({options:t})=>CK(t),J$e=({options:t})=>({...CK(t),isSync:!0}),CK=t=>({options:{...Y$e(t),...t}}),Y$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},DK={preferLocal:!0}});var Mct,Je,Fct,Lct,zct,Uct,qct,Bct,Hct,Gct,Mr=y(()=>{EK();RK();DR();NK();bP();Mct=ds(()=>({})),Je=ds(()=>({isSync:!0})),Fct=ds(AK),Lct=ds(TK),zct=ds(J9),Uct=ds(IK,{},DK,PK),{sendMessage:qct,getOneMessage:Bct,getEachMessage:Hct,getCancelSignal:Gct}=u3()});import{existsSync as cv,statSync as X$e}from"node:fs";import{dirname as nI,extname as Q$e,isAbsolute as jK,join as iI,relative as oI,resolve as lv,sep as eke}from"node:path";function uv(t){return t==="./gradlew"||t==="gradle"}function tke(t){return(cv(iI(t,"build.gradle.kts"))||cv(iI(t,"build.gradle")))&&cv(iI(t,"gradle.properties"))}function rke(t,e){let n=oI(t,e).split(eke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function fs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function nke(t,e){let r=lv(t,e),n=r;cv(r)?X$e(r).isFile()&&(n=nI(r)):Q$e(r)!==""&&(n=nI(r));let i=oI(t,n);if(i.startsWith("..")||jK(i))return null;let o=n;for(;;){if(tke(o))return o;if(lv(o)===lv(t))return null;let s=nI(o);if(s===o)return null;let a=oI(t,s);if(a.startsWith("..")||jK(a))return null;o=s}}function dv(t,e){let r=lv(t),n=new Map,i=[];for(let o of e){let s=nke(r,o);if(!s){i.push(o);continue}let a=rke(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 fv=y(()=>{"use strict"});import{existsSync as ike,readFileSync as oke}from"node:fs";import{join as ske}from"node:path";function Pl(t="."){let e=ske(t,".cladding","config.yaml");if(!ike(e))return sI;try{let n=(0,MK.parse)(oke(e,"utf8"))?.gate;if(!n)return sI;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 ake){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 sI}}function FK(t,e){let r=[],n=!1;for(let i of t){let o=cke.exec(i);if(o){n=!0;for(let s of e)r.push(fs(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 MK,ake,sI,cke,pv=y(()=>{"use strict";MK=St(Qt(),1);fv();ake=["type","lint","test","coverage"],sI={scope:"feature"};cke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as cI,readFileSync as LK,readdirSync as lke,statSync as uke}from"node:fs";import{join as mv}from"node:path";function dI(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=mv(t,e);if(cI(r))try{if(zK.test(LK(r,"utf8")))return!0}catch{}}return!1}function UK(t){try{return cI(t)&&zK.test(LK(t,"utf8"))}catch{return!1}}function qK(t,e=0){if(e>4||!cI(t))return!1;let r;try{r=lke(t)}catch{return!1}for(let n of r){let i=mv(t,n),o=!1;try{o=uke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(qK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&UK(i))return!0}return!1}function pke(t){if(dI(t))return!0;for(let e of dke)if(UK(mv(t,e)))return!0;for(let e of fke)if(qK(mv(t,e)))return!0;return!1}function BK(t="."){let e=Pl(t).coverage;return e||(pke(t)?"kover":"jacoco")}function HK(t="."){return lI[BK(t)]}function GK(t="."){return aI[BK(t)]}var lI,aI,uI,zK,dke,fke,hv=y(()=>{"use strict";pv();lI={kover:"koverXmlReport",jacoco:"jacocoTestReport"},aI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},uI=[aI.kover,aI.jacoco],zK=/kover/i;dke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],fke=["buildSrc","build-logic"]});import{existsSync as gv,readFileSync as ZK,readdirSync as VK}from"node:fs";import{join as Ma}from"node:path";function fI(t){return gv(Ma(t,"gradlew"))?"./gradlew":"gradle"}function mke(t){let e=fI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[HK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function hke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(ZK(Ma(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 yke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function vke(t,e){for(let r of e)if(gv(Ma(t,r)))return r}function Ske(t,e){try{return VK(t).find(n=>n.endsWith(e))}catch{return}}function xke(t,e){for(let r of wke)if(r.configs.some(n=>gv(Ma(t,n))))return r.gate;return e}function kke(t){if($ke.some(e=>gv(Ma(t,e))))return!0;try{return JSON.parse(ZK(Ma(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function Eke(t,e){let r=e.lint?{...e,lint:xke(t,e.lint)}:{...e};return e.test&&e.coverage&&kke(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function dt(t="."){for(let e of _ke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Ske(t,o):r=vke(t,[o]),r)break;if(!r||e.requiresSource&&!yke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Eke(t,n):n;return{language:e.language,manifest:r,gates:i}}return bke}var gke,_ke,bke,wke,$ke,on=y(()=>{"use strict";hv();gke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);_ke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:mke},{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:hke}],bke={language:"unknown",manifest:"",gates:{}};wke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];$ke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Ake,readFileSync as Tke}from"node:fs";import{join as Oke}from"node:path";function Fa(t){return t.code==="ENOENT"}function yv(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=(o||s||`exit ${i}`).slice(0,200);return WK.test(o)||WK.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function qt(t,e,r){return Fa(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Il(t,e){let r=Oke(t,"package.json");if(!Ake(r))return!1;try{return!!JSON.parse(Tke(r,"utf8")).scripts?.[e]}catch{return!1}}var WK,Tn=y(()=>{"use strict";WK=/config (is |file )?not found|no such file|ENOENT|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 Rke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:_v,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Fa(i)?[{detector:_v,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:yv(i,_v,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var _v,La,bv=y(()=>{"use strict";Mr();on();Tn();_v="ARCHITECTURE_VIOLATION";La={name:_v,subprocess:!0,run:Rke}});function Pke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:vv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Fa(i)?[{detector:vv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:yv(i,vv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var vv,za,Sv=y(()=>{"use strict";Mr();on();Tn();vv="HARDCODED_SECRET";za={name:vv,subprocess:!0,run:Pke}});import{existsSync as pI,readdirSync as KK}from"node:fs";import{join as wv}from"node:path";function Cke(t,e){let r=wv(t,e.path);if(!pI(r))return!0;if(e.isDirectory)try{return KK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Dke(t){let{cwd:e="."}=t,r=[];for(let i of Ike)Cke(e,i)&&r.push({detector:np,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=wv(e,"spec.yaml");if(pI(n)){let i=Mke(n),o=i?null:Nke(e);if(i)r.push({detector:np,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:np,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=jke(e);s&&r.push({detector:np,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 Nke(t){for(let e of["spec/features","spec/scenarios"]){let r=wv(t,e);if(!pI(r))continue;let n;try{n=KK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ki(wv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function jke(t){try{return H(t),null}catch(e){return e.message}}function Mke(t){let e;try{e=ki(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var np,Ike,JK,YK=y(()=>{"use strict";qe();$_();np="ABSENCE_OF_GOVERNANCE",Ike=[{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}];JK={name:np,run:Dke}});function xv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function mI(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=xv(r)==="while",o=Lke.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 '${xv(r)}'`}let n=Fke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:xv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${xv(r)}'`:null}function zke(t,e){let r=mI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function XK(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...zke(r,n));return e}var Fke,Lke,hI=y(()=>{"use strict";Fke={event:"when",state:"while",optional:"where",unwanted:"if"},Lke=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";qe()});function Uke(t){let{cwd:e="."}=t;return he(e,$v,qke)}function qke(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:$v,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 XK(t.features))e.push({detector:$v,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var $v,QK,eJ=y(()=>{"use strict";hI();wt();$v="AC_DRIFT";QK={name:$v,run:Uke}});function Ci(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return rJ[n]??tJ}var Bke,Hke,Gke,tJ,Zke,Vke,rJ,Wke,nJ,Ua=y(()=>{"use strict";on();Bke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,Hke=/^[ \t]*import\s+([\w.]+)/gm,Gke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,tJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:Bke,importStyle:"relative"},Zke={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:Hke,importStyle:"dotted"},Vke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:Gke,importStyle:"dotted"},rJ={typescript:tJ,kotlin:Zke,python:Vke},Wke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],nJ=new Set([...Object.values(rJ).flatMap(t=>t?.extensions??[]),...Wke].map(t=>t.toLowerCase()))});import{existsSync as Kke,readFileSync as Jke,readdirSync as Yke,statSync as Xke}from"node:fs";import{join as oJ,relative as iJ}from"node:path";function Qke(t,e){if(!Kke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=Yke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=oJ(i,s),c;try{c=Xke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function eEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function rEe(t){return tEe.test(t)}function nEe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Ci(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Qke(oJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=Jke(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";qe();Ua();sJ="AI_HINTS_FORBIDDEN_PATTERN";tEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;aJ={name:sJ,run:nEe}});function iEe(t){let{cwd:e="."}=t,r;try{r=H(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:lJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var lJ,uJ,dJ=y(()=>{"use strict";qe();lJ="AC_DUPLICATE_WITHIN_FEATURE";uJ={name:lJ,run:iEe}});import{createRequire as oEe}from"module";import{basename as sEe,dirname as yI,normalize as aEe,relative as cEe,resolve as lEe,sep as mJ}from"path";import*as uEe from"fs";function dEe(t){let e=aEe(t);return e.length>1&&e[e.length-1]===mJ&&(e=e.substring(0,e.length-1)),e}function hJ(t,e){return t.replace(fEe,e)}function mEe(t){return t==="/"||pEe.test(t)}function gI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=lEe(t)),(n||o)&&(t=dEe(t)),t===".")return"";let s=t[t.length-1]!==i;return hJ(s?t+i:t,i)}function gJ(t,e){return e+t}function hEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:hJ(cEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function gEe(t){return t}function yEe(t,e,r){return e+t+r}function _Ee(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?hEe(t,e):n?gJ:gEe}function bEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function vEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function $Ee(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?vEe(t):bEe(t):n&&n.length?wEe:SEe:xEe}function REe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?OEe:r&&r.length?n?kEe:EEe:n?AEe:TEe}function CEe(t){return t.group?IEe:PEe}function jEe(t){return t.group?DEe:NEe}function LEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?FEe:MEe}function yJ(t,e,r){if(r.options.useRealPaths)return zEe(e,r);let n=yI(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=yI(n)}return r.symlinks.set(t,e),i>1}function zEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function kv(t,e,r,n){e(t&&!n?t:null,r)}function KEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?UEe:GEe:n?e?qEe:WEe:i?e?HEe:VEe:e?BEe:ZEe}function XEe(t){return t?YEe:JEe}function rAe(t,e){return new Promise((r,n)=>{vJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function vJ(t,e,r){new bJ(t,e,r).start()}function nAe(t,e){return new bJ(t,e).start()}var fJ,fEe,pEe,SEe,wEe,xEe,kEe,EEe,AEe,TEe,OEe,PEe,IEe,DEe,NEe,MEe,FEe,UEe,qEe,BEe,HEe,GEe,ZEe,VEe,WEe,_J,JEe,YEe,QEe,eAe,tAe,bJ,pJ,SJ,wJ,xJ=y(()=>{fJ=oEe(import.meta.url);fEe=/[\\/]/g;pEe=/^[a-z]:[\\/]$/i;SEe=(t,e)=>{e.push(t||".")},wEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},xEe=()=>{};kEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},EEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},AEe=(t,e,r,n)=>{r.files++},TEe=(t,e)=>{e.push(t)},OEe=()=>{};PEe=t=>t,IEe=()=>[""].slice(0,0);DEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},NEe=()=>{};MEe=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()&&yJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},FEe=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()&&yJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};UEe=t=>t.counts,qEe=t=>t.groups,BEe=t=>t.paths,HEe=t=>t.paths.slice(0,t.options.maxFiles),GEe=(t,e,r)=>(kv(e,r,t.counts,t.options.suppressErrors),null),ZEe=(t,e,r)=>(kv(e,r,t.paths,t.options.suppressErrors),null),VEe=(t,e,r)=>(kv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),WEe=(t,e,r)=>(kv(e,r,t.groups,t.options.suppressErrors),null);_J={withFileTypes:!0},JEe=(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||".",_J,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},YEe=(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||".",_J)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};QEe=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))}},eAe=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}},tAe=class{aborted=!1;abort(){this.aborted=!0}},bJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=KEe(e,this.isSynchronous),this.root=gI(t,e),this.state={root:mEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new eAe,options:e,queue:new QEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new tAe,fs:e.fs||uEe},this.joinPath=_Ee(this.root,e),this.pushDirectory=$Ee(this.root,e),this.pushFile=REe(e),this.getArray=CEe(e),this.groupFiles=jEe(e),this.resolveSymlink=LEe(e,this.isSynchronous),this.walkDirectory=XEe(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(_=gI(_,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=sEe(_),x=gI(yI(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};pJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return rAe(this.root,this.options)}withCallback(t){vJ(this.root,this.options,t)}sync(){return nAe(this.root,this.options)}},SJ=null;try{fJ.resolve("picomatch"),SJ=fJ("picomatch")}catch{}wJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:mJ,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 pJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new pJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||SJ;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 ip=v((Wlt,TJ)=>{"use strict";var $J="[^\\\\/]",iAe="(?=.)",kJ="[^/]",_I="(?:\\/|$)",EJ="(?:^|\\/)",bI=`\\.{1,2}${_I}`,oAe="(?!\\.)",sAe=`(?!${EJ}${bI})`,aAe=`(?!\\.{0,1}${_I})`,cAe=`(?!${bI})`,lAe="[^.\\/]",uAe=`${kJ}*?`,dAe="/",AJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:iAe,QMARK:kJ,END_ANCHOR:_I,DOTS_SLASH:bI,NO_DOT:oAe,NO_DOTS:sAe,NO_DOT_SLASH:aAe,NO_DOTS_SLASH:cAe,QMARK_NO_DOT:lAe,STAR:uAe,START_ANCHOR:EJ,SEP:dAe},fAe={...AJ,SLASH_LITERAL:"[\\\\/]",QMARK:$J,STAR:`${$J}*?`,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:"\\"},pAe={__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"};TJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:pAe,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?fAe:AJ}}});var op=v(Fr=>{"use strict";var{REGEX_BACKSLASH:mAe,REGEX_REMOVE_BACKSLASH:hAe,REGEX_SPECIAL_CHARS:gAe,REGEX_SPECIAL_CHARS_GLOBAL:yAe}=ip();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>gAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(yAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(mAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(hAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var jJ=v((Jlt,NJ)=>{"use strict";var OJ=op(),{CHAR_ASTERISK:vI,CHAR_AT:_Ae,CHAR_BACKWARD_SLASH:sp,CHAR_COMMA:bAe,CHAR_DOT:SI,CHAR_EXCLAMATION_MARK:wI,CHAR_FORWARD_SLASH:DJ,CHAR_LEFT_CURLY_BRACE:xI,CHAR_LEFT_PARENTHESES:$I,CHAR_LEFT_SQUARE_BRACKET:vAe,CHAR_PLUS:SAe,CHAR_QUESTION_MARK:RJ,CHAR_RIGHT_CURLY_BRACE:wAe,CHAR_RIGHT_PARENTHESES:PJ,CHAR_RIGHT_SQUARE_BRACKET:xAe}=ip(),IJ=t=>t===DJ||t===sp,CJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},$Ae=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,se=()=>c.charCodeAt(l+1),Y=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),Oe&&m===!0&&d>0?(Oe=c.slice(0,d),I=c.slice(d)):m===!0?(Oe="",I=c):Oe=c,Oe&&Oe!==""&&Oe!=="/"&&Oe!==c&&IJ(Oe.charCodeAt(Oe.length-1))&&(Oe=Oe.slice(0,-1)),r.unescape===!0&&(I&&(I=OJ.removeBackslashes(I)),Oe&&_===!0&&(Oe=OJ.removeBackslashes(Oe)));let Pr={prefix:C,input:t,start:u,base:Oe,glob:I,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Pr.maxDepth=0,IJ(A)||s.push(D),Pr.tokens=s),r.parts===!0||r.tokens===!0){let oe;for(let Ie=0;Ie{"use strict";var ap=ip(),sn=op(),{MAX_LENGTH:Ev,POSIX_REGEX_SOURCE:kAe,REGEX_NON_SPECIAL_CHARS:EAe,REGEX_SPECIAL_CHARS_BACKREF:AAe,REPLACEMENTS:MJ}=ap,TAe=(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=>sn.escapeRegex(i)).join("..")}return r},Cl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,FJ=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},OAe=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},LJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(OAe(e))return e.replace(/\\(.)/g,"$1")},RAe=t=>{let e=t.map(LJ).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}}}}},PAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=LJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},IAe=t=>{let e=0,r=t.trim(),n=kI(r);for(;n;)e++,r=n.body.trim(),n=kI(r);return e},CAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:ap.DEFAULT_MAX_EXTGLOB_RECURSION,n=FJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||RAe(n)))return{risky:!0};for(let i of n){let o=PAe(i);if(o)return{risky:!0,safeOutput:o};if(IAe(i)>r)return{risky:!0}}return{risky:!1}},EI=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=MJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Ev,r.maxLength):Ev,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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={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=sn.removePrefix(t,$),i=t.length;let se=[],Y=[],Oe=[],C=o,I,Pr=()=>$.index===i-1,oe=$.peek=(B=1)=>t[$.index+B],Ie=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(B="",ht=0)=>{$.consumed+=B,$.index+=ht},Yt=B=>{$.output+=B.output!=null?B.output:B.value,dr(B.value)},io=()=>{let B=1;for(;oe()==="!"&&(oe(2)!=="("||oe(3)==="?");)Ie(),$.start++,B++;return B%2===0?!1:($.negated=!0,$.start++,!0)},vi=B=>{$[B]++,Oe.push(B)},Yr=B=>{$[B]--,Oe.pop()},de=B=>{if(C.type==="globstar"){let ht=$.braces>0&&(B.type==="comma"||B.type==="brace"),q=B.extglob===!0||se.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ht&&!q&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(se.length&&B.type!=="paren"&&(se[se.length-1].inner+=B.value),(B.value||B.output)&&Yt(B),C&&C.type==="text"&&B.type==="text"){C.output=(C.output||C.value)+B.value,C.value+=B.value;return}B.prev=C,s.push(B),C=B},oo=(B,ht)=>{let q={...l[ht],conditions:1,inner:""};q.prev=C,q.parens=$.parens,q.output=$.output,q.startIndex=$.index,q.tokensIndex=s.length;let Ae=(r.capture?"(":"")+q.open;vi("parens"),de({type:B,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ie(),output:Ae}),se.push(q)},fde=B=>{let ht=t.slice(B.startIndex,$.index+1),q=t.slice(B.startIndex+2,$.index),Ae=CAe(q,r);if((B.type==="plus"||B.type==="star")&&Ae.risky){let ct=Ae.safeOutput?(B.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,Si=s[B.tokensIndex];Si.type="text",Si.value=ht,Si.output=ct||sn.escapeRegex(ht);for(let wi=B.tokensIndex+1;wi1&&B.inner.includes("/")&&(ct=O(r)),(ct!==D||Pr()||/^\)+$/.test(Kt()))&&(ut=B.close=`)$))${ct}`),B.inner.includes("*")&&(Lt=Kt())&&/^\.[^\\/.]+$/.test(Lt)){let Si=EI(Lt,{...e,fastpaths:!1}).output;ut=B.close=`)${Si})${ct})`}B.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:I,output:ut}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ht=t.replace(AAe,(q,Ae,ut,Lt,ct,Si)=>Lt==="\\"?(B=!0,q):Lt==="?"?Ae?Ae+Lt+(ct?_.repeat(ct.length):""):Si===0?A+(ct?_.repeat(ct.length):""):_.repeat(ut.length):Lt==="."?u.repeat(ut.length):Lt==="*"?Ae?Ae+Lt+(ct?D:""):D:Ae?q:`\\${q}`);return B===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=sn.wrapOutput(ht,$,e),$)}for(;!Pr();){if(I=Ie(),I==="\0")continue;if(I==="\\"){let q=oe();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){I+="\\",de({type:"text",value:I});continue}let Ae=/^\\+/.exec(Kt()),ut=0;if(Ae&&Ae[0].length>2&&(ut=Ae[0].length,$.index+=ut,ut%2!==0&&(I+="\\")),r.unescape===!0?I=Ie():I+=Ie(),$.brackets===0){de({type:"text",value:I});continue}}if($.brackets>0&&(I!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&I===":"){let q=C.value.slice(1);if(q.includes("[")&&(C.posix=!0,q.includes(":"))){let Ae=C.value.lastIndexOf("["),ut=C.value.slice(0,Ae),Lt=C.value.slice(Ae+2),ct=kAe[Lt];if(ct){C.value=ut+ct,$.backtrack=!0,Ie(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(I==="["&&oe()!==":"||I==="-"&&oe()==="]")&&(I=`\\${I}`),I==="]"&&(C.value==="["||C.value==="[^")&&(I=`\\${I}`),r.posix===!0&&I==="!"&&C.value==="["&&(I="^"),C.value+=I,Yt({value:I});continue}if($.quotes===1&&I!=='"'){I=sn.escapeRegex(I),C.value+=I,Yt({value:I});continue}if(I==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:I});continue}if(I==="("){vi("parens"),de({type:"paren",value:I});continue}if(I===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Cl("opening","("));let q=se[se.length-1];if(q&&$.parens===q.parens+1){fde(se.pop());continue}de({type:"paren",value:I,output:$.parens?")":"\\)"}),Yr("parens");continue}if(I==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Cl("closing","]"));I=`\\${I}`}else vi("brackets");de({type:"bracket",value:I});continue}if(I==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:I,output:`\\${I}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Cl("opening","["));de({type:"text",value:I,output:`\\${I}`});continue}Yr("brackets");let q=C.value.slice(1);if(C.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(I=`/${I}`),C.value+=I,Yt({value:I}),r.literalBrackets===!1||sn.hasRegexChars(q))continue;let Ae=sn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Ae,C.value=Ae;continue}C.value=`(${a}${Ae}|${C.value})`,$.output+=C.value;continue}if(I==="{"&&r.nobrace!==!0){vi("braces");let q={type:"brace",value:I,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};Y.push(q),de(q);continue}if(I==="}"){let q=Y[Y.length-1];if(r.nobrace===!0||!q){de({type:"text",value:I,output:I});continue}let Ae=")";if(q.dots===!0){let ut=s.slice(),Lt=[];for(let ct=ut.length-1;ct>=0&&(s.pop(),ut[ct].type!=="brace");ct--)ut[ct].type!=="dots"&&Lt.unshift(ut[ct].value);Ae=TAe(Lt,r),$.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let ut=$.output.slice(0,q.outputIndex),Lt=$.tokens.slice(q.tokensIndex);q.value=q.output="\\{",I=Ae="\\}",$.output=ut;for(let ct of Lt)$.output+=ct.output||ct.value}de({type:"brace",value:I,output:Ae}),Yr("braces"),Y.pop();continue}if(I==="|"){se.length>0&&se[se.length-1].conditions++,de({type:"text",value:I});continue}if(I===","){let q=I,Ae=Y[Y.length-1];Ae&&Oe[Oe.length-1]==="braces"&&(Ae.comma=!0,q="|"),de({type:"comma",value:I,output:q});continue}if(I==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:I,output:f});continue}if(I==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let q=Y[Y.length-1];C.type="dots",C.output+=I,C.value+=I,q.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:I,output:u});continue}de({type:"dot",value:I,output:u});continue}if(I==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){oo("qmark",I);continue}if(C&&C.type==="paren"){let Ae=oe(),ut=I;(C.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${I}`),de({type:"text",value:I,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:I,output:S});continue}de({type:"qmark",value:I,output:_});continue}if(I==="!"){if(r.noextglob!==!0&&oe()==="("&&(oe(2)!=="?"||!/[!=<:]/.test(oe(3)))){oo("negate",I);continue}if(r.nonegate!==!0&&$.index===0){io();continue}}if(I==="+"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){oo("plus",I);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:I,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:I});continue}de({type:"plus",value:d});continue}if(I==="@"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){de({type:"at",extglob:!0,value:I,output:""});continue}de({type:"text",value:I});continue}if(I!=="*"){(I==="$"||I==="^")&&(I=`\\${I}`);let q=EAe.exec(Kt());q&&(I+=q[0],$.index+=q[0].length),de({type:"text",value:I});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=I,C.output=D,$.backtrack=!0,$.globstar=!0,dr(I);continue}let B=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){oo("star",I);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(I);continue}let q=C.prev,Ae=q.prev,ut=q.type==="slash"||q.type==="bos",Lt=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!ut||B[0]&&B[0]!=="/")){de({type:"star",value:I,output:""});continue}let ct=$.braces>0&&(q.type==="comma"||q.type==="brace"),Si=se.length&&(q.type==="pipe"||q.type==="paren");if(!ut&&q.type!=="paren"&&!ct&&!Si){de({type:"star",value:I,output:""});continue}for(;B.slice(0,3)==="/**";){let wi=t[$.index+4];if(wi&&wi!=="/")break;B=B.slice(3),dr("/**",3)}if(q.type==="bos"&&Pr()){C.type="globstar",C.value+=I,C.output=O(r),$.output=C.output,$.globstar=!0,dr(I);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!Lt&&Pr()){$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=I,$.globstar=!0,$.output+=q.output+C.output,dr(I);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&B[0]==="/"){let wi=B[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${wi})`,C.value+=I,$.output+=q.output+C.output,$.globstar=!0,dr(I+Ie()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&B[0]==="/"){C.type="globstar",C.value+=I,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(I+Ie()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=I,$.output+=C.output,$.globstar=!0,dr(I);continue}let ht={type:"star",value:I,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=I,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),oe()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cl("closing","]"));$.output=sn.escapeLast($.output,"["),Yr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cl("closing",")"));$.output=sn.escapeLast($.output,"("),Yr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cl("closing","}"));$.output=sn.escapeLast($.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let B of $.tokens)$.output+=B.output!=null?B.output:B.value,B.suffix&&($.output+=B.suffix)}return $};EI.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Ev,r.maxLength):Ev,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=MJ[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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};zJ.exports=EI});var HJ=v((Xlt,BJ)=>{"use strict";var DAe=jJ(),AI=UJ(),qJ=op(),NAe=ip(),jAe=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=jAe(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?qJ.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)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(qJ.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):AI(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>DAe(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=AI.fastpaths(t,e)),i.output||(i=AI(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=NAe;BJ.exports=Rt});var WJ=v((Qlt,VJ)=>{"use strict";var GJ=HJ(),MAe=op();function ZJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:MAe.isWindows()}),GJ(t,e,r)}Object.assign(ZJ,GJ);VJ.exports=ZJ});import{readdir as FAe,readdirSync as LAe,realpath as zAe,realpathSync as UAe,stat as qAe,statSync as BAe}from"fs";import{isAbsolute as HAe,posix as qa,resolve as GAe}from"path";import{fileURLToPath as ZAe}from"url";function KAe(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]===".."&&WAe.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=>qa.relative(t,n)||".":n=>qa.relative(t,`${e}/${n}`)||"."}function XAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=qa.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function XJ(t){var e;let r=Dl.default.scan(t,QAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function oTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Dl.default.scan(t);return r.isGlob||r.negated}function cp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function QJ(t){return typeof t=="string"?[t]:t??[]}function TI(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=iTe(o);s=HAe(s.replace(aTe,""))?qa.relative(a,s):qa.normalize(s);let c=(i=sTe.exec(s))===null||i===void 0?void 0:i[0],l=XJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?qa.join(o,...d):o}return s}function cTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(TI(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(TI(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(TI(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function lTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=cTe(t,e,n);t.debug&&cp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(JJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Dl.default)(i.match,f),m=(0,Dl.default)(i.ignore,f),h=KAe(i.match,f),g=KJ(r,d,o),b=o?g:KJ(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new wJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&cp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return cp(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&cp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&XAe(r,d)]}function uTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function fTe(t){let e={...dTe,...t};return e.cwd=(e.cwd instanceof URL?ZAe(e.cwd):GAe(e.cwd)).replace(JJ,"/"),e.ignore=QJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||FAe,readdirSync:e.fs.readdirSync||LAe,realpath:e.fs.realpath||zAe,realpathSync:e.fs.realpathSync||UAe,stat:e.fs.stat||qAe,statSync:e.fs.statSync||BAe}),e.debug&&cp("globbing with options:",e),e}function pTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=VAe(t)||typeof t=="string",i=QJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=fTe(n?e:t);return i.length>0?lTe(o,i):[]}function ps(t,e){let[r,n]=pTe(t,e);return r?uTe(r.sync(),n):[]}var Dl,VAe,JJ,YJ,WAe,JAe,YAe,QAe,eTe,tTe,rTe,nTe,iTe,sTe,aTe,dTe,lp=y(()=>{xJ();Dl=St(WJ(),1),VAe=Array.isArray,JJ=/\\/g,YJ=process.platform==="win32",WAe=/^(\/?\.\.)+$/;JAe=/^[A-Z]:\/$/i,YAe=YJ?t=>JAe.test(t):t=>t==="/";QAe={parts:!0};eTe=/(?t.replace(eTe,"\\$&"),nTe=t=>t.replace(tTe,"\\$&"),iTe=YJ?nTe:rTe;sTe=/^(\/?\.\.)+/,aTe=/\\(?=[()[\]{}!*+?@|])/g;dTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as up,readFileSync as mTe,readdirSync as hTe,statSync as e8}from"node:fs";import{join as Ba}from"node:path";function gTe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Ci(e,n),o=[],{layers:s,forbiddenImports:a}=OI(r);return(s.size>0||a.length>0)&&!up(Ba(e,i.mainRoot))?[{detector:dp,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&&(yTe(e,i,s,o),_Te(e,i,s,o)),a.length>0&&bTe(e,i,a,o),o)}function OI(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 yTe(t,e,r,n){let i=e.mainRoot,o=Ba(t,i);if(up(o))for(let s of hTe(o)){let a=Ba(o,s);e8(a).isDirectory()&&(r.has(s)||n.push({detector:dp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function _Te(t,e,r,n){let i=e.mainRoot,o=Ba(t,i);if(up(o))for(let s of r){let a=Ba(o,s);up(a)&&e8(a).isDirectory()||n.push({detector:dp,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 bTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ba(t,i,s.from);if(!up(a))continue;let c=ps([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ba(a,l),d;try{d=mTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];vTe(p,s.to,e.importStyle)&&n.push({detector:dp,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 vTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var dp,t8,RI=y(()=>{"use strict";lp();qe();Ua();dp="ARCHITECTURE_FROM_SPEC";t8={name:dp,run:gTe}});import{existsSync as STe,readFileSync as wTe}from"node:fs";import{join as xTe}from"node:path";function $Te(t){let{cwd:e="."}=t,r=xTe(e,"spec/capabilities.yaml");if(!STe(r))return[];let n;try{let c=wTe(r,"utf8"),l=r8.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=H(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:Av,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:Av,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:Av,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var r8,Av,n8,i8=y(()=>{"use strict";r8=St(Qt(),1);qe();Av="CAPABILITIES_FEATURE_MAPPING";n8={name:Av,run:$Te}});import{existsSync as kTe,readFileSync as ETe}from"node:fs";import{join as ATe}from"node:path";function TTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function OTe(t){let{cwd:e="."}=t;return he(e,PI,r=>RTe(r,e))}function RTe(t,e){let r=Ci(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=ATe(e,o);if(!kTe(s))continue;let a=ETe(s,"utf8");TTe(a)||n.push({detector:PI,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var PI,o8,s8=y(()=>{"use strict";Ua();wt();PI="CONVENTION_DRIFT";o8={name:PI,run:OTe}});import{existsSync as II,readFileSync as a8}from"node:fs";import{join as Tv}from"node:path";function PTe(t){return JSON.parse(t).total?.lines?.pct??0}function c8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function DTe(t,e){if(!uv(dt(t).gates.coverage?.cmd))return null;let r;try{r=dv(t,e)}catch(c){return[{detector:bo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=uI.find(d=>II(Tv(c.dir,d)));if(!l){s.push(c.path);continue}let u=c8(a8(Tv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:bo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=l8(n,i);return a0?[{detector:bo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function NTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=DTe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Ci(e,r),i=dt(e).language==="kotlin"?uI.find(a=>II(Tv(e,a)))??GK(e):n.coverageSummary,o=Tv(e,i);if(!II(o))return[{detector:bo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=a8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?ITe(a):n.coverageFormat==="cobertura-xml"?CTe(a):PTe(a)}catch(a){return[{detector:bo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:bo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Ov?[]:[{detector:bo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Ov}%`}]}var bo,Ov,u8,d8=y(()=>{"use strict";qe();hv();Ua();fv();on();bo="COVERAGE_DROP",Ov=70;u8={name:bo,run:NTe}});import{existsSync as jTe}from"node:fs";import{join as MTe}from"node:path";function FTe(t){let{cwd:e="."}=t;return he(e,Rv,r=>LTe(r,e))}function LTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?jTe(MTe(e,r.path))?[]:[{detector:Rv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:Rv,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var Rv,f8,p8=y(()=>{"use strict";wt();Rv="DELIVERABLE_INTEGRITY";f8={name:Rv,run:FTe}});function zTe(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:Pv,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 UTe(t){let e=zTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Pv,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 qTe(t){let{cwd:e="."}=t;return he(e,Pv,r=>UTe(r))}var Pv,m8,h8=y(()=>{"use strict";wt();Pv="SMOKE_PROBE_DEMAND";m8={name:Pv,run:qTe}});function BTe(t){let{cwd:e="."}=t;return he(e,Iv,r=>HTe(r,e))}function HTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=is(e);if(n===null)return[{detector:Iv,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=R_(n,e,o);s.state!=="fresh"&&i.push({detector:Iv,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 Iv,Cv,CI=y(()=>{"use strict";ul();wt();Iv="STALE_ATTESTATION";Cv={name:Iv,run:BTe}});function GTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return ZTe(r)}function ZTe(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:g8,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 g8,Dv,DI=y(()=>{"use strict";qe();g8="DEPENDENCY_CYCLE";Dv={name:g8,run:GTe}});import{appendFileSync as VTe,existsSync as y8,mkdirSync as WTe,readFileSync as KTe}from"node:fs";import{dirname as JTe,join as YTe}from"node:path";function _8(t){return YTe(t,XTe,QTe)}function b8(t){return NI.add(t),()=>NI.delete(t)}function Ha(t,e){let r=_8(t),n=JTe(r);y8(n)||WTe(n,{recursive:!0}),VTe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of NI)try{i(t,e)}catch{}}function On(t){let e=_8(t);if(!y8(e))return[];let r=KTe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var XTe,QTe,NI,ti=y(()=>{"use strict";XTe=".cladding",QTe="audit.log.jsonl";NI=new Set});import{existsSync as eOe}from"node:fs";import{join as tOe}from"node:path";function rOe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:jI,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&&(eOe(tOe(e,i.artifact))||n.push({detector:jI,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var jI,v8,S8=y(()=>{"use strict";ti();jI="EVIDENCE_MISMATCH";v8={name:jI,run:rOe}});import{existsSync as nOe,readFileSync as iOe}from"node:fs";import{join as oOe}from"node:path";function sOe(t){let e=oOe(t,k8);if(!nOe(e))return null;try{let n=((0,$8.parse)(iOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*x8(t,e){for(let r of t??[])r.startsWith(w8)&&(yield{ref:r,name:r.slice(w8.length),field:e})}function aOe(t){let{cwd:e="."}=t,r=sOe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:MI,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=[...x8(s.evidence_refs,"evidence_refs"),...x8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:MI,severity:"warn",path:k8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var $8,MI,w8,k8,E8,A8=y(()=>{"use strict";$8=St(Qt(),1);qe();MI="FIXTURE_REFERENCE_INVALID",w8="fixture:",k8="conformance/fixtures.yaml";E8={name:MI,run:aOe}});import{existsSync as Nl,readFileSync as FI}from"node:fs";import{join as Ga}from"node:path";function cOe(t){return ps(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function fp(t){if(!Nl(t))return null;try{return JSON.parse(FI(t,"utf8"))}catch{return null}}function lOe(t,e){let r=Ga(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(FI(r,"utf8"))}catch(c){e.push({detector:vo,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:vo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=cOe(t);s!==a&&e.push({detector:vo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function uOe(t,e){for(let r of T8){let n=Ga(t,r.path);if(!Nl(n))continue;let i=fp(n);if(!i){e.push({detector:vo,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:vo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function dOe(t,e){let r=fp(Ga(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of T8){let s=Ga(t,o.path);if(!Nl(s))continue;let a=fp(s);a?.version&&a.version!==n&&e.push({detector:vo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ga(t,".claude-plugin","marketplace.json");if(Nl(i)){let o=fp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:vo,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 fOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function pOe(t,e){let r=Ga(t,"src","cli","clad.ts"),n=Ga(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Nl(r)||!Nl(n))return;let i=fOe(FI(r,"utf8"));if(i.length===0)return;let s=fp(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:vo,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 mOe(t){let{cwd:e="."}=t,r=[];return lOe(e,r),pOe(e,r),uOe(e,r),dOe(e,r),r}var vo,T8,O8,R8=y(()=>{"use strict";lp();vo="HARNESS_INTEGRITY",T8=[{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"]}];O8={name:vo,run:mOe}});import{existsSync as hOe,readFileSync as gOe}from"node:fs";import{join as yOe}from"node:path";function bOe(t){let{cwd:e="."}=t;return he(e,Nv,r=>SOe(r,e))}function vOe(t){let e=yOe(t,"spec/capabilities.yaml");if(!hOe(e))return!1;try{let r=P8.default.parse(gOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function SOe(t,e){let r=t.features.length;if(r<_Oe)return[];let n=[];return vOe(e)&&n.push({detector:Nv,severity:"warn",path:"spec/capabilities.yaml",message:`${r} features but spec/capabilities.yaml declares no capabilities (capabilities: []) \u2014 the design SSoT is an empty seed. Populate it (capability \u2194 feature links) or run \`clad init --scan\`.`}),t.architecture&&(t.architecture.layers??[]).length===0&&n.push({detector:Nv,severity:"warn",path:"spec/architecture.yaml",message:`${r} features but spec/architecture.yaml declares no layers (layers: []) \u2014 the architecture SSoT is an empty seed. Populate it or run \`clad init --scan\`.`}),n}var P8,Nv,_Oe,I8,C8=y(()=>{"use strict";P8=St(Qt(),1);wt();Nv="HOLLOW_GOVERNANCE",_Oe=8;I8={name:Nv,run:bOe}});import{existsSync as D8,readFileSync as N8}from"node:fs";import{join as j8}from"node:path";function M8(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 $Oe(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 kOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function EOe(t){let e=j8(t,"README.md"),r=j8(t,"docs","dogfood","matrix.md");if(!D8(e)||!D8(r))return[];let n=M8(N8(e,"utf8"),wOe),i=M8(N8(r,"utf8"),xOe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=kOe(a);if(c===null)continue;let l=i[s]??"not-run",u=$Oe(l);u!==null&&c>u&&o.push({detector:F8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function AOe(t){let{cwd:e="."}=t;return EOe(e)}var F8,wOe,xOe,L8,z8=y(()=>{"use strict";F8="HOST_CLAIM_DRIFT",wOe=//,xOe=//;L8={name:F8,run:AOe}});function TOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return U8(r.features.map(i=>i.id),"feature","spec/features/",n),U8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function U8(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:q8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var q8,B8,H8=y(()=>{"use strict";qe();q8="ID_COLLISION";B8={name:q8,run:TOe}});import{existsSync as pp,readFileSync as LI,readdirSync as zI,statSync as OOe,writeFileSync as Z8}from"node:fs";import{join as So}from"node:path";function G8(t){if(!pp(t))return 0;try{return zI(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function ROe(t){if(!pp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=zI(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=So(n,o),a;try{a=OOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function POe(t){let e=So(t,"spec","capabilities.yaml");if(!pp(e))return 0;try{let r=jv.default.parse(LI(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ms(t="."){let e=G8(So(t,"spec","features")),r=G8(So(t,"spec","scenarios")),n=POe(t),i=ROe(So(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function jl(t,e){let r=So(t,"spec.yaml");if(!pp(r))return;let n=LI(r,"utf8"),i=IOe(n,e);i!==n&&Z8(r,i)}function IOe(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 @@ -269,51 +269,51 @@ ${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 Za(t="."){let e=So(t,"spec","features");if(!pp(e))return!1;let r=[];for(let i of MP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Nv.parse)(jP(So(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 Za(t="."){let e=So(t,"spec","features");if(!pp(e))return!1;let r=[];for(let i of zI(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,jv.parse)(LI(So(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 B8(So(t,"spec","index.yaml"),n,"utf8"),!0}var Nv,mp=y(()=>{"use strict";Nv=vt(Qt(),1)});import{existsSync as H8,readFileSync as G8,readdirSync as CTe}from"node:fs";import{join as FP}from"node:path";function DTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=ms(e),i=r.inventory;if(!i){let s=Z8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return LP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...LP(e),{detector:hp,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 Z8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:hp,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(...LP(e)),o}function LP(t){let e=FP(t,"spec","index.yaml"),r=FP(t,"spec","features");if(!H8(e)||!H8(r))return[];let n=new Map;try{for(let l of G8(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 CTe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=G8(FP(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:hp,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:hp,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 hp,Z8,V8,W8=y(()=>{"use strict";mp();qe();hp="INVENTORY_DRIFT",Z8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];V8={name:hp,run:DTe}});import{existsSync as NTe,readFileSync as jTe}from"node:fs";import{join as MTe}from"node:path";function LTe(t){let{cwd:e="."}=t,r=MTe(e,"src","spec","schema.json"),n=[];if(NTe(r)){let i;try{i=JSON.parse(jTe(r,"utf8"))}catch(o){n.push({detector:gp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of FTe)i.required?.includes(o)||n.push({detector:gp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:gp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==K8&&n.push({detector:gp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${K8}'`})}catch{}return n}var gp,FTe,K8,J8,Y8=y(()=>{"use strict";qe();gp="META_INTEGRITY",FTe=["schema","project","features"],K8="0.1";J8={name:gp,run:LTe}});function zTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return X8(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),X8((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function X8(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:Q8,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 Q8,e5,t5=y(()=>{"use strict";qe();Q8="SLUG_CONFLICT";e5={name:Q8,run:zTe}});function Ml(t){return t==="planned"||t==="in_progress"}var jv=y(()=>{"use strict"});import{existsSync as UTe}from"node:fs";import{join as qTe}from"node:path";function BTe(t){let{cwd:e="."}=t;return he(e,Mv,r=>HTe(r,e))}function HTe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=qTe(e,i);UTe(o)||r.push(GTe(n.id,i,n.status))}return r}function GTe(t,e,r){return Ml(r)?{detector:Mv,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:Mv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Mv,Fv,zP=y(()=>{"use strict";jv();St();Mv="MISSING_IMPLEMENTATION";Fv={name:Mv,run:BTe}});function ZTe(t){let{cwd:e="."}=t;return he(e,UP,VTe)}function VTe(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:UP,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 UP,Lv,qP=y(()=>{"use strict";St();UP="MISSING_TESTS";Lv={name:UP,run:ZTe}});import{existsSync as WTe,readFileSync as KTe}from"node:fs";import{join as r5}from"node:path";function n5(t){if(WTe(t))try{return JSON.parse(KTe(t,"utf8"))}catch{return}}function QTe(t){let{cwd:e="."}=t,r=n5(r5(e,JTe)),n=n5(r5(e,YTe));if(!r||!n)return[{detector:BP,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>XTe&&i.push({detector:BP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var BP,JTe,YTe,XTe,i5,o5=y(()=>{"use strict";BP="PERFORMANCE_DRIFT",JTe="perf/baseline.json",YTe="perf/current.json",XTe=10;i5={name:BP,run:QTe}});import{existsSync as eRe}from"node:fs";import{join as tRe}from"node:path";function nRe(t){let{cwd:e="."}=t;return he(e,HP,r=>oRe(r,e))}function iRe(t,e){return(t.modules??[]).some(r=>eRe(tRe(e,r)))}function oRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||iRe(s,e)||r.push(s.id);let n=rRe;if(r.length<=n)return[];let i=r.slice(0,s5).join(", "),o=r.length>s5?", \u2026":"";return[{detector:HP,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 HP,rRe,s5,a5,c5=y(()=>{"use strict";St();HP="PLANNED_BACKLOG",rRe=5,s5=8;a5={name:HP,run:nRe}});import{existsSync as sRe,readFileSync as aRe}from"node:fs";import{join as cRe}from"node:path";function dRe(t){let{cwd:e="."}=t;return he(e,GP,r=>fRe(r,e))}function fRe(t,e){if(t.features.lengthn.includes(i))?[{detector:GP,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 GP,lRe,uRe,l5,u5=y(()=>{"use strict";St();GP="PROJECT_CONTEXT_DRIFT",lRe=8,uRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];l5={name:GP,run:dRe}});function d5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:zv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function pRe(t){let{cwd:e="."}=t;return he(e,zv,mRe)}function mRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...d5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:zv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...d5(e,n.features,`scenario ${n.id}.features`));return r}var zv,Uv,ZP=y(()=>{"use strict";St();zv="REFERENCE_INTEGRITY";Uv={name:zv,run:pRe}});function yp(t=""){return new RegExp(hRe,t)}var hRe,VP=y(()=>{"use strict";hRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as gRe,readdirSync as yRe,readFileSync as _Re,statSync as bRe,writeFileSync as vRe}from"node:fs";import{dirname as SRe,join as _p,normalize as wRe,relative as xRe}from"node:path";function ORe(t){let e=[];for(let r of t.matchAll(ARe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(yp("g"))??[])e.push(n);return[...new Set(e)].sort()}function TRe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function f5(t){return t.split("\\").join("/")}function RRe(t){return $Re.some(e=>t===e||t.startsWith(`${e}/`))}function IRe(t){let e=_p(t,"docs");if(!gRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=yRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=_p(i,s),c;try{c=bRe(a)}catch{continue}let l=f5(xRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function PRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=wRe(_p(SRe(t),e));return f5(r)}function bp(t="."){let e=[];for(let r of IRe(t)){let n;try{n=_Re(_p(t,r),"utf8")}catch{continue}let i=TRe(n),o=ORe(i);if(RRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(kRe)?[]:i.match(yp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(ERe)){let d=PRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function p5(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 vRe(_p(t,"spec","_doc-links.yaml"),`${r.join(` +`;return Z8(So(t,"spec","index.yaml"),n,"utf8"),!0}var jv,mp=y(()=>{"use strict";jv=St(Qt(),1)});import{existsSync as V8,readFileSync as W8,readdirSync as COe}from"node:fs";import{join as UI}from"node:path";function DOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=ms(e),i=r.inventory;if(!i){let s=K8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return qI(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...qI(e),{detector:hp,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 K8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:hp,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(...qI(e)),o}function qI(t){let e=UI(t,"spec","index.yaml"),r=UI(t,"spec","features");if(!V8(e)||!V8(r))return[];let n=new Map;try{for(let l of W8(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 COe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=W8(UI(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:hp,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:hp,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 hp,K8,J8,Y8=y(()=>{"use strict";mp();qe();hp="INVENTORY_DRIFT",K8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];J8={name:hp,run:DOe}});import{existsSync as NOe,readFileSync as jOe}from"node:fs";import{join as MOe}from"node:path";function LOe(t){let{cwd:e="."}=t,r=MOe(e,"src","spec","schema.json"),n=[];if(NOe(r)){let i;try{i=JSON.parse(jOe(r,"utf8"))}catch(o){n.push({detector:gp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of FOe)i.required?.includes(o)||n.push({detector:gp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:gp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==X8&&n.push({detector:gp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${X8}'`})}catch{}return n}var gp,FOe,X8,Q8,e5=y(()=>{"use strict";qe();gp="META_INTEGRITY",FOe=["schema","project","features"],X8="0.1";Q8={name:gp,run:LOe}});function zOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return t5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),t5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function t5(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:r5,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 r5,n5,i5=y(()=>{"use strict";qe();r5="SLUG_CONFLICT";n5={name:r5,run:zOe}});function Ml(t){return t==="planned"||t==="in_progress"}var Mv=y(()=>{"use strict"});import{existsSync as UOe}from"node:fs";import{join as qOe}from"node:path";function BOe(t){let{cwd:e="."}=t;return he(e,Fv,r=>HOe(r,e))}function HOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=qOe(e,i);UOe(o)||r.push(GOe(n.id,i,n.status))}return r}function GOe(t,e,r){return Ml(r)?{detector:Fv,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:Fv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Fv,Lv,BI=y(()=>{"use strict";Mv();wt();Fv="MISSING_IMPLEMENTATION";Lv={name:Fv,run:BOe}});function ZOe(t){let{cwd:e="."}=t;return he(e,HI,VOe)}function VOe(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:HI,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 HI,zv,GI=y(()=>{"use strict";wt();HI="MISSING_TESTS";zv={name:HI,run:ZOe}});import{existsSync as WOe,readFileSync as KOe}from"node:fs";import{join as o5}from"node:path";function s5(t){if(WOe(t))try{return JSON.parse(KOe(t,"utf8"))}catch{return}}function QOe(t){let{cwd:e="."}=t,r=s5(o5(e,JOe)),n=s5(o5(e,YOe));if(!r||!n)return[{detector:ZI,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>XOe&&i.push({detector:ZI,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var ZI,JOe,YOe,XOe,a5,c5=y(()=>{"use strict";ZI="PERFORMANCE_DRIFT",JOe="perf/baseline.json",YOe="perf/current.json",XOe=10;a5={name:ZI,run:QOe}});import{existsSync as eRe}from"node:fs";import{join as tRe}from"node:path";function nRe(t){let{cwd:e="."}=t;return he(e,VI,r=>oRe(r,e))}function iRe(t,e){return(t.modules??[]).some(r=>eRe(tRe(e,r)))}function oRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||iRe(s,e)||r.push(s.id);let n=rRe;if(r.length<=n)return[];let i=r.slice(0,l5).join(", "),o=r.length>l5?", \u2026":"";return[{detector:VI,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 VI,rRe,l5,u5,d5=y(()=>{"use strict";wt();VI="PLANNED_BACKLOG",rRe=5,l5=8;u5={name:VI,run:nRe}});import{existsSync as sRe,readFileSync as aRe}from"node:fs";import{join as cRe}from"node:path";function dRe(t){let{cwd:e="."}=t;return he(e,WI,r=>fRe(r,e))}function fRe(t,e){if(t.features.lengthn.includes(i))?[{detector:WI,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 WI,lRe,uRe,f5,p5=y(()=>{"use strict";wt();WI="PROJECT_CONTEXT_DRIFT",lRe=8,uRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];f5={name:WI,run:dRe}});function m5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Uv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function pRe(t){let{cwd:e="."}=t;return he(e,Uv,mRe)}function mRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...m5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Uv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...m5(e,n.features,`scenario ${n.id}.features`));return r}var Uv,qv,KI=y(()=>{"use strict";wt();Uv="REFERENCE_INTEGRITY";qv={name:Uv,run:pRe}});function yp(t=""){return new RegExp(hRe,t)}var hRe,JI=y(()=>{"use strict";hRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as gRe,readdirSync as yRe,readFileSync as _Re,statSync as bRe,writeFileSync as vRe}from"node:fs";import{dirname as SRe,join as _p,normalize as wRe,relative as xRe}from"node:path";function TRe(t){let e=[];for(let r of t.matchAll(ARe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(yp("g"))??[])e.push(n);return[...new Set(e)].sort()}function ORe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function h5(t){return t.split("\\").join("/")}function RRe(t){return $Re.some(e=>t===e||t.startsWith(`${e}/`))}function PRe(t){let e=_p(t,"docs");if(!gRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=yRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=_p(i,s),c;try{c=bRe(a)}catch{continue}let l=h5(xRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function IRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=wRe(_p(SRe(t),e));return h5(r)}function bp(t="."){let e=[];for(let r of PRe(t)){let n;try{n=_Re(_p(t,r),"utf8")}catch{continue}let i=ORe(n),o=TRe(i);if(RRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(kRe)?[]:i.match(yp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(ERe)){let d=IRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function g5(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 vRe(_p(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var $Re,kRe,ERe,ARe,qv=y(()=>{"use strict";VP();$Re=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],kRe="clad-doc-links: ignore",ERe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,ARe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as CRe}from"node:fs";import{join as DRe}from"node:path";function NRe(t){let{cwd:e="."}=t;return he(e,Bv,r=>jRe(r,e))}function jRe(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)CRe(DRe(e,o))||n.push({detector:Bv,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:Bv,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 Bv,Hv,WP=y(()=>{"use strict";qv();St();Bv="DOC_LINK_INTEGRITY";Hv={name:Bv,run:NRe}});function FRe(t){let{cwd:e="."}=t;return he(e,vp,r=>LRe(r))}function LRe(t){let e=[],r=t.features.length,n=t.scenarios??[];r>=MRe&&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 o of n)(o.features??[]).length===0&&e.push({detector:vp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let i=new Map(t.features.filter(o=>typeof o.slug=="string"&&o.slug.length>0).map(o=>[o.slug,o.id]));for(let o of n){if(!o.flow)continue;let s=new Set(o.features??[]),a=new Map;for(let c of o.flow.matchAll(/\(([^)]+)\)/g))for(let l of c[1].split(/[,/·]/)){let u=l.trim(),d=i.get(u);d&&!s.has(d)&&a.set(u,d)}if(a.size>0){let c=[...a].map(([l,u])=>`${l} (${u})`).join(", ");e.push({detector:vp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} flow references ${c} but features[] does not bind ${a.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,MRe,m5,h5=y(()=>{"use strict";St();vp="SCENARIO_COVERAGE",MRe=8;m5={name:vp,run:FRe}});import{createHash as zRe}from"node:crypto";function URe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Sp(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??g5),sample:URe(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(g5),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 qRe(t,e){return e<=0?!1:e>=1?!0:parseInt(zRe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var g5,Gv=y(()=>{"use strict";g5=["unwanted"]});import{existsSync as BRe,readdirSync as HRe}from"node:fs";import{join as _5}from"node:path";import b5 from"node:process";function GRe(t){let e=!1,r=n=>{for(let i of HRe(n,{withFileTypes:!0})){if(e)return;let o=_5(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 KP(t={}){let{cwd:e="."}=t,r=_5(e,hs);if(!BRe(r)||!GRe(r))return{stage:Zv,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${hs}/ \u2014 skipped`};let n=dt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Zv,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o=Je(i.cmd,[...i.args,hs],{cwd:e,reject:!1}),s=Ut(Zv,i.cmd,o);return s||tr(Zv,o)}var Zv,hs,ZRe,JP=y(()=>{"use strict";Mr();on();On();Zv="stage_2.3",hs="tests/oracle";ZRe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${b5.argv[1]}`;if(ZRe){let t=KP();console.log(JSON.stringify(t)),b5.exit(t.exitCode)}});import{existsSync as VRe}from"node:fs";import{join as WRe}from"node:path";function KRe(t){let{cwd:e="."}=t;return he(e,ri,r=>JRe(r,e))}function JRe(t,e){let r=[],n=Sp(t.project,wp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?Tn(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(xp(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:ri,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${hs}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!VRe(WRe(e,f))){r.push({detector:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${hs}/`)||r.push({detector:ri,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${hs}/ \u2014 stage_2.3 only runs ${hs}/, 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:ri,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:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ri,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:ri,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:ri,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:ri,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 ri,v5,S5=y(()=>{"use strict";ti();Gv();JP();St();ri="SPEC_CONFORMANCE";v5={name:ri,run:KRe}});function YRe(t){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return[{detector:YP,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>w5&&i.push({detector:YP,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${w5})`})}return i}var YP,w5,x5,$5=y(()=>{"use strict";ti();YP="STALE_EVIDENCE",w5=90;x5={name:YP,run:YRe}});import{existsSync as k5}from"node:fs";import{join as E5}from"node:path";function XRe(t){let{cwd:e="."}=t;return he(e,Fl,r=>QRe(r,e))}function QRe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Fl,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:Fl,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=>k5(E5(e,o)));i.length>0&&r.push({detector:Fl,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Ml(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>k5(E5(e,i)))&&r.push({detector:Fl,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 Fl,Vv,XP=y(()=>{"use strict";jv();St();Fl="STALE_SPECIFICATION";Vv={name:Fl,run:XRe}});import{existsSync as A5,statSync as O5}from"node:fs";import{join as T5}from"node:path";function tIe(t,e){let r=0;for(let n of e){let i=T5(t,n);if(!A5(i))continue;let o=O5(i).mtimeMs;o>r&&(r=o)}return r}function rIe(t){let{cwd:e="."}=t;return he(e,QP,r=>nIe(r,e))}function nIe(t,e){let r=Ci(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=tIe(e,n);if(i===0)return[];let o=ps([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=T5(e,a);if(!A5(c))continue;let l=O5(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>eIe&&s.push({detector:QP,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var QP,eIe,Wv,eC=y(()=>{"use strict";lp();Ua();St();QP="STALE_TESTS",eIe=30;Wv={name:QP,run:rIe}});import{existsSync as iIe}from"node:fs";import{join as oIe}from"node:path";function sIe(t){let{cwd:e="."}=t;return he(e,$p,r=>aIe(r,e))}function aIe(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:$p,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=>!iIe(oIe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:$p,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:$p,severity:Ml(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 $p,Kv,tC=y(()=>{"use strict";jv();St();$p="STATUS_DRIFT";Kv={name:$p,run:sIe}});function cIe(t){let{cwd:e="."}=t;return he(e,Jv,r=>lIe(r,e))}function lIe(t,e){let r=dt(e).language;return r==="unknown"?[{detector:Jv,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:Jv,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var Jv,R5,I5=y(()=>{"use strict";on();St();Jv="TECH_STACK_MISMATCH";R5={name:Jv,run:cIe}});function pIe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function mIe(t){let{cwd:e="."}=t;return he(e,rC,r=>hIe(r,e))}function hIe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=ps([...pIe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:rC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var rC,P5,uIe,dIe,fIe,Yv,nC=y(()=>{"use strict";lp();AP();St();rC="UNMAPPED_ARTIFACT",P5=["src/stages/**/*.ts","src/spec/**/*.ts"],uIe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},dIe={kotlin:"src/main/kotlin"},fIe=8;Yv={name:rC,run:mIe}});import{existsSync as C5}from"node:fs";import{join as D5}from"node:path";function yIe(t){return gIe.some(e=>t.startsWith(e))}function _Ie(t){let{cwd:e="."}=t;return he(e,iC,r=>bIe(r,e))}function bIe(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(yIe(o))continue;let s=o.split("#",1)[0];C5(D5(e,o))||s&&C5(D5(e,s))||r.push({detector:iC,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 xx(t){return`${JSON.stringify(t,null,2)} +`}function Pee(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?`[[${Aee(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(Tee);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(Tee);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}/${Aee(s)}.md`,`${a.join(` +`)}`)}return o}function Tee(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as B2e}from"node:fs";import{dirname as H2e,join as dj}from"node:path";import{fileURLToPath as G2e}from"node:url";var fj=H2e(G2e(import.meta.url));function Iee(t){for(let e of[dj(fj,"viewer",t),dj(fj,"..","graph","viewer",t),dj(fj,"..","..","dist","viewer",t)])try{return B2e(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function Cee(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -874,20 +874,20 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify
${n} -`}IP();WP();zP();qP();ZP();RP();eC();tC();nC();oC();Fm();VP();qe();var Z2e=[Lv,Xv,Fv,Yv,Uv,Hv,Cv,Kv,Wv,Pv];function V2e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=yp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function $x(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{xa(e,H(e))}catch{}try{for(let o of Z2e){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 V2e(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{xa(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}uj();qe();Ai();var K2e=new Set(["mermaid","dot","json","obsidian","html"]);function Pee(t={}){try{let e=t.format??"mermaid";if(!K2e.has(e)){U("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=mc(n,".");if(t.focus){let s=_x(n,i,t.focus);if(s.length===0){U("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){U("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=yx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Oee(i);for(let[c,l]of a){let u=W2e(s,c);dj(pj(u),{recursive:!0}),fj(u,l,"utf8")}U("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){U("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=xx(i,$x(i,"."));dj(pj(t.out),{recursive:!0}),fj(t.out,s,"utf8"),U("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"?Aee(i):r==="json"?wx(i):Eee(i);t.out?(dj(pj(t.out),{recursive:!0}),fj(t.out,o,"utf8"),U("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){U("fail","graph",e.message),process.exit(1)}}function Cee(){try{let t=mc(H(),".");process.stdout.write(Iee(kx(t)),()=>process.exit(0))}catch(t){U("fail","graph",t.message),process.exit(1)}}Fm();import{createServer as J2e}from"node:http";import{existsSync as Y2e,watch as X2e}from"node:fs";import{join as Q2e}from"node:path";qe();Ai();function eUe(t={}){let e=t.cwd??".",r=new Set,n=()=>mc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}DI();YI();BI();GI();KI();CI();nC();iC();sC();cC();Fm();JI();qe();var Z2e=[zv,Qv,Lv,Xv,qv,Gv,Dv,Jv,Kv,Cv];function V2e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=yp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function kx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{xa(e,H(e))}catch{}try{for(let o of Z2e){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 V2e(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{xa(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}pj();qe();Ai();var K2e=new Set(["mermaid","dot","json","obsidian","html"]);function Nee(t={}){try{let e=t.format??"mermaid";if(!K2e.has(e)){U("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=mc(n,".");if(t.focus){let s=bx(n,i,t.focus);if(s.length===0){U("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){U("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=_x(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Pee(i);for(let[c,l]of a){let u=W2e(s,c);mj(gj(u),{recursive:!0}),hj(u,l,"utf8")}U("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){U("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=$x(i,kx(i,"."));mj(gj(t.out),{recursive:!0}),hj(t.out,s,"utf8"),U("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"?Ree(i):r==="json"?xx(i):Oee(i);t.out?(mj(gj(t.out),{recursive:!0}),hj(t.out,o,"utf8"),U("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){U("fail","graph",e.message),process.exit(1)}}function jee(){try{let t=mc(H(),".");process.stdout.write(Dee(Ex(t)),()=>process.exit(0))}catch(t){U("fail","graph",t.message),process.exit(1)}}Fm();import{createServer as J2e}from"node:http";import{existsSync as Y2e,watch as X2e}from"node:fs";import{join as Q2e}from"node:path";qe();Ai();function eUe(t={}){let e=t.cwd??".",r=new Set,n=()=>mc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=J2e((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($x(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=J2e((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=xx(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=xx(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=Q2e(e,u);if(Y2e(d))try{let f=X2e(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=$x(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=Q2e(e,u);if(Y2e(d))try{let f=X2e(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 Dee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await eUe({port:e,cwd:t.cwd??"."});U("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){U("fail","graph",r.message),process.exit(1)}}var tUe=["stage_1.1","stage_2.1","stage_2.3"];function rUe(t){return(t.features??[]).filter(e=>e.status==="done")}function nUe(t,e){let r=rUe(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 Nee(t,e){let r=[];for(let n of tUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=nUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}uS();import jee from"node:process";function iUe(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 Ex(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=iUe(n,t);i.pass||r.push(i)}return r}ti();var mj="stage_4.1";function hj(t={}){let{cwd:e="."}=t,r=Tn(e);if(r.length===0)return{stage:mj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Ex(r);if(n.length===0)return{stage:mj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:mj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var oUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${jee.argv[1]}`;if(oUe){let t=hj();console.log(JSON.stringify(t)),jee.exit(t.exitCode)}dl();import{randomBytes as sUe}from"node:crypto";import{unlinkSync as aUe}from"node:fs";import{tmpdir as cUe}from"node:os";import{join as lUe,resolve as gj}from"node:path";import uUe from"node:process";var qr=null;function Mee(t){qr={cwd:gj(t),run:null,jsonFile:null}}function Fee(){return qr!==null}function Lee(t,e){if(!qr||qr.cwd!==gj(t))return null;if(qr.run)return qr.run;let r=lUe(cUe(),`clad-shared-vitest-${uUe.pid}-${sUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function zee(t){return!qr||qr.cwd!==gj(t)?null:qr.run}function Uee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function qee(){let t=qr?.jsonFile;if(qr=null,t)try{aUe(t)}catch{}}Mr();import Bee from"node:process";var Ax="stage_1.4";function yj(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Ax,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:Ax,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Ax,pass:!0,exitCode:0}:{stage:Ax,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var dUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Bee.argv[1]}`;if(dUe){let t=yj();console.log(JSON.stringify(t)),Bee.exit(t.exitCode)}Mr();import Hee from"node:process";Lm();On();var Ox="stage_2.2";function _j(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Io("coverage",t))}catch(c){return{stage:Ox,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Ox,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=zee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=Ut(Ox,r,s);return a||tr(Ox,s)}var mUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Hee.argv[1]}`;if(mUe){let t=_j();console.log(JSON.stringify(t)),Hee.exit(t.exitCode)}Ep();bj();Mr();on();On();import Zee from"node:process";var Px="stage_3.2";function vj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Px,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Pl(e,o[o.length-1]))return{stage:Px,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Px,i,s);return a||tr(Px,s)}var IUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Zee.argv[1]}`;if(IUe){let t=vj();console.log(JSON.stringify(t)),Zee.exit(t.exitCode)}Mr();qe();On();import{existsSync as PUe}from"node:fs";import{resolve as Wee}from"node:path";import Kee from"node:process";var ai="stage_2.4",Sj=5e3,CUe=3e4;function wj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ai,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return NUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ai,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ai,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Wee(e,r.path);if(!PUe(s))return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Sj,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=Ut(ai,r.path,c);if(l)return l;if(c.timedOut)return{stage:ai,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:ai,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ai,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Vee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},DUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function NUe(t,e,r){let n=Math.min(e.length*Sj,CUe),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(jUe(t,s,r))}return MUe(o)}function jUe(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("/")?Wee(t,a):a,u=Sj,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Fa(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 MUe(t){let e="skip";for(let o of t)Vee[o.disposition]>Vee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${DUe[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:ai,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ai,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var FUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Kee.argv[1]}`;if(FUe){let t=wj();console.log(JSON.stringify(t)),Kee.exit(t.exitCode)}Mr();on();On();import Jee from"node:process";var Cx="stage_3.1";function xj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Cx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Pl(e,o[o.length-1]))return{stage:Cx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(Cx,i,s);return a||tr(Cx,s)}var LUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Jee.argv[1]}`;if(LUe){let t=xj();console.log(JSON.stringify(t)),Jee.exit(t.exitCode)}JP();$j();kj();Mr();Rx();import{randomBytes as ZUe}from"node:crypto";import{unlinkSync as VUe}from"node:fs";import{tmpdir as WUe}from"node:os";import{join as KUe}from"node:path";import Aj from"node:process";Lm();On();qe();import{readFileSync as qUe}from"node:fs";import{resolve as Qee}from"node:path";function BUe(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=Qee(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 HUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function GUe(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=HUe(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(Qee(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 Ej(t,e){try{let r=BUe(qUe(t,"utf8"));return r?GUe(H(e),r,e):[]}catch{return[]}}var Po="stage_2.1";function ete(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function JUe(t,e,r){let n,i;try{({cmd:n,args:i}=Io("coverage",t))}catch{return null}if(!n||!i||!ete(n,i))return null;let o=n,s=i,a=Lee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Ut(Po,n,c))return null;let u=tr(Po,c);if(Uee(u)==="fallback")return null;if(r){let d=Ej(l,e);if(d.length>0)return{stage:Po,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Po,pass:!0,exitCode:0}}function Oj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Io("test",t))}catch(u){return{stage:Po,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Po,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=ete(n,i),a=r&&s;if(Fee()&&s){let u=JUe(t,e,a);if(u)return u}let c,l=i;a&&(c=KUe(WUe(),`clad-vitest-${Aj.pid}-${ZUe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=Ut(Po,n,u);if(d)return d;let f=wu("unit",tr(Po,u),u);if(a&&f.pass&&c){let p=Ej(c,e);if(p.length>0)return{stage:Po,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{VUe(c)}catch{}}}var YUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Aj.argv[1]}`;if(YUe){let t=Oj();console.log(JSON.stringify(t)),Aj.exit(t.exitCode)}Mr();on();On();import tte from"node:process";var jx="stage_3.3";function Tj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:jx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Pl(e,o[o.length-1]))return{stage:jx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=Ut(jx,i,s);return a||tr(jx,s)}var XUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tte.argv[1]}`;if(XUe){let t=Tj();console.log(JSON.stringify(t)),tte.exit(t.exitCode)}XP();Of();ha();Ij();mp();qv();var cte=vt(Qt(),1);import{existsSync as Pj,readFileSync as lqe,readdirSync as ate,statSync as uqe,writeFileSync as dqe}from"node:fs";import{basename as Bm,join as Hm,relative as ste}from"node:path";var fqe=["self-dogfood:","fixture:","derived:"],lte=/\.(test|spec)\.[jt]sx?$/;function ute(t,e=t,r=[]){let n;try{n=ate(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Hm(e,i);try{uqe(o).isDirectory()?ute(t,o,r):lte.test(i)&&r.push(o)}catch{continue}}return r}function dte(t="."){let e=Hm(t,"spec","features"),r=Hm(t,"tests"),n=[],i=[];if(!Pj(e)||!Pj(r))return{repaired:n,suggested:i};let o=ute(r),s=new Map;for(let a of o){let c=ste(t,a).split("\\").join("/"),l=s.get(Bm(a))??[];l.push(c),s.set(Bm(a),l)}for(let a of ate(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Hm(e,a),l,u;try{l=lqe(c,"utf8"),u=(0,cte.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(fqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Pj(Hm(t,b)))continue;let _=s.get(Bm(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=>Bm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>ste(t,h).split("\\").join("/")).find(h=>{let g=Bm(h).replace(lte,"");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 Mee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await eUe({port:e,cwd:t.cwd??"."});U("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){U("fail","graph",r.message),process.exit(1)}}var tUe=["stage_1.1","stage_2.1","stage_2.3"];function rUe(t){return(t.features??[]).filter(e=>e.status==="done")}function nUe(t,e){let r=rUe(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 Fee(t,e){let r=[];for(let n of tUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=nUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}dS();import Lee from"node:process";function iUe(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 Ax(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=iUe(n,t);i.pass||r.push(i)}return r}ti();var yj="stage_4.1";function _j(t={}){let{cwd:e="."}=t,r=On(e);if(r.length===0)return{stage:yj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Ax(r);if(n.length===0)return{stage:yj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:yj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var oUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Lee.argv[1]}`;if(oUe){let t=_j();console.log(JSON.stringify(t)),Lee.exit(t.exitCode)}dl();import{randomBytes as sUe}from"node:crypto";import{unlinkSync as aUe}from"node:fs";import{tmpdir as cUe}from"node:os";import{join as lUe,resolve as bj}from"node:path";import uUe from"node:process";var qr=null;function zee(t){qr={cwd:bj(t),run:null,jsonFile:null}}function Uee(){return qr!==null}function qee(t,e){if(!qr||qr.cwd!==bj(t))return null;if(qr.run)return qr.run;let r=lUe(cUe(),`clad-shared-vitest-${uUe.pid}-${sUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function Bee(t){return!qr||qr.cwd!==bj(t)?null:qr.run}function Hee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Gee(){let t=qr?.jsonFile;if(qr=null,t)try{aUe(t)}catch{}}Mr();import Zee from"node:process";var Tx="stage_1.4";function vj(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Tx,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:Tx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Tx,pass:!0,exitCode:0}:{stage:Tx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var dUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Zee.argv[1]}`;if(dUe){let t=vj();console.log(JSON.stringify(t)),Zee.exit(t.exitCode)}Mr();import Vee from"node:process";Lm();Tn();var Ox="stage_2.2";function Sj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Po("coverage",t))}catch(c){return{stage:Ox,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Ox,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Bee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=qt(Ox,r,s);return a||tr(Ox,s)}var mUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Vee.argv[1]}`;if(mUe){let t=Sj();console.log(JSON.stringify(t)),Vee.exit(t.exitCode)}Ep();wj();Mr();on();Tn();import Kee from"node:process";var Cx="stage_3.2";function xj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Cx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Cx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=qt(Cx,i,s);return a||tr(Cx,s)}var PUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Kee.argv[1]}`;if(PUe){let t=xj();console.log(JSON.stringify(t)),Kee.exit(t.exitCode)}Mr();qe();Tn();import{existsSync as IUe}from"node:fs";import{resolve as Yee}from"node:path";import Xee from"node:process";var ai="stage_2.4",$j=5e3,CUe=3e4;function kj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ai,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return NUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ai,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ai,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Yee(e,r.path);if(!IUe(s))return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??$j,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=qt(ai,r.path,c);if(l)return l;if(c.timedOut)return{stage:ai,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:ai,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ai,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Jee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},DUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function NUe(t,e,r){let n=Math.min(e.length*$j,CUe),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(jUe(t,s,r))}return MUe(o)}function jUe(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("/")?Yee(t,a):a,u=$j,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Fa(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 MUe(t){let e="skip";for(let o of t)Jee[o.disposition]>Jee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${DUe[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:ai,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ai,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var FUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Xee.argv[1]}`;if(FUe){let t=kj();console.log(JSON.stringify(t)),Xee.exit(t.exitCode)}Mr();on();Tn();import Qee from"node:process";var Dx="stage_3.1";function Ej(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Dx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Dx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=qt(Dx,i,s);return a||tr(Dx,s)}var LUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Qee.argv[1]}`;if(LUe){let t=Ej();console.log(JSON.stringify(t)),Qee.exit(t.exitCode)}QI();Aj();Tj();Mr();Px();import{randomBytes as ZUe}from"node:crypto";import{unlinkSync as VUe}from"node:fs";import{tmpdir as WUe}from"node:os";import{join as KUe}from"node:path";import Rj from"node:process";Lm();Tn();qe();import{readFileSync as qUe}from"node:fs";import{resolve as rte}from"node:path";function BUe(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=rte(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 HUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function GUe(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=HUe(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(rte(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 Oj(t,e){try{let r=BUe(qUe(t,"utf8"));return r?GUe(H(e),r,e):[]}catch{return[]}}var Io="stage_2.1";function nte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function JUe(t,e,r){let n,i;try{({cmd:n,args:i}=Po("coverage",t))}catch{return null}if(!n||!i||!nte(n,i))return null;let o=n,s=i,a=qee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(qt(Io,n,c))return null;let u=tr(Io,c);if(Hee(u)==="fallback")return null;if(r){let d=Oj(l,e);if(d.length>0)return{stage:Io,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Io,pass:!0,exitCode:0}}function Pj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Po("test",t))}catch(u){return{stage:Io,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Io,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=nte(n,i),a=r&&s;if(Uee()&&s){let u=JUe(t,e,a);if(u)return u}let c,l=i;a&&(c=KUe(WUe(),`clad-vitest-${Rj.pid}-${ZUe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=qt(Io,n,u);if(d)return d;let f=wu("unit",tr(Io,u),u);if(a&&f.pass&&c){let p=Oj(c,e);if(p.length>0)return{stage:Io,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{VUe(c)}catch{}}}var YUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rj.argv[1]}`;if(YUe){let t=Pj();console.log(JSON.stringify(t)),Rj.exit(t.exitCode)}Mr();on();Tn();import ite from"node:process";var Mx="stage_3.3";function Ij(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Mx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Mx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=qt(Mx,i,s);return a||tr(Mx,s)}var XUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ite.argv[1]}`;if(XUe){let t=Ij();console.log(JSON.stringify(t)),ite.exit(t.exitCode)}tC();Tf();ha();Dj();mp();Bv();var dte=St(Qt(),1);import{existsSync as Nj,readFileSync as lqe,readdirSync as ute,statSync as uqe,writeFileSync as dqe}from"node:fs";import{basename as Bm,join as Hm,relative as lte}from"node:path";var fqe=["self-dogfood:","fixture:","derived:"],fte=/\.(test|spec)\.[jt]sx?$/;function pte(t,e=t,r=[]){let n;try{n=ute(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Hm(e,i);try{uqe(o).isDirectory()?pte(t,o,r):fte.test(i)&&r.push(o)}catch{continue}}return r}function mte(t="."){let e=Hm(t,"spec","features"),r=Hm(t,"tests"),n=[],i=[];if(!Nj(e)||!Nj(r))return{repaired:n,suggested:i};let o=pte(r),s=new Map;for(let a of o){let c=lte(t,a).split("\\").join("/"),l=s.get(Bm(a))??[];l.push(c),s.set(Bm(a),l)}for(let a of ute(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Hm(e,a),l,u;try{l=lqe(c,"utf8"),u=(0,dte.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(fqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Nj(Hm(t,b)))continue;let _=s.get(Bm(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=>Bm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>lte(t,h).split("\\").join("/")).find(h=>{let g=Bm(h).replace(fte,"");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&&dqe(c,l,"utf8")}return{repaired:n,suggested:i}}ul();import{existsSync as pqe,readFileSync as mqe}from"node:fs";import{join as hqe}from"node:path";function gqe(t,e){let r=hqe(t,e);if(!pqe(r))return[];let n=[];for(let i of mqe(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 fte(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=>gqe(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 pte(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(` -`)}Gv();qe();Ai();ti();ul();var Cj=["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"],yqe=[...Cj,"att"];function _qe(t,e,r){if(e.startsWith("stage_4")){let n=Tn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Ex(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function bqe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":T_(e,r,t).state==="fresh"?"\u2713":"!"}function zx(t,e="."){let r=is(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Cj.map(o=>_qe(i,o,e)),bqe(i,r,e)]}));return{columns:yqe,rows:n}}function mte(t,e=".",r={}){let n=r.internal??!1,i=zx(t,e),o=[...Cj.map(c=>n?c.replace("stage_",""):vqe(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 vqe(t){return ka(t).slice(0,3)}async function HJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Cue(),Pue)),Promise.resolve().then(()=>(Fue(),Mue)),Promise.resolve().then(()=>(Up(),LX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>_ee(s),prepareInit:({cwd:s,mode:a,intent:c})=>gee(s,a,c),initialize:YN,prepareClarify:(s,{cwd:a})=>yee(a,s),clarify:tj,resolveReview:(s,{cwd:a})=>fee(s,{cwd:a})}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function GJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await YN({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){V.stdout.write(`${JSON.stringify(n,null,2)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&dqe(c,l,"utf8")}return{repaired:n,suggested:i}}ul();import{existsSync as pqe,readFileSync as mqe}from"node:fs";import{join as hqe}from"node:path";function gqe(t,e){let r=hqe(t,e);if(!pqe(r))return[];let n=[];for(let i of mqe(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 hte(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=>gqe(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 gte(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(` +`)}Zv();qe();Ai();ti();ul();var jj=["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"],yqe=[...jj,"att"];function _qe(t,e,r){if(e.startsWith("stage_4")){let n=On(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Ax(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function bqe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":R_(e,r,t).state==="fresh"?"\u2713":"!"}function Ux(t,e="."){let r=is(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...jj.map(o=>_qe(i,o,e)),bqe(i,r,e)]}));return{columns:yqe,rows:n}}function yte(t,e=".",r={}){let n=r.internal??!1,i=Ux(t,e),o=[...jj.map(c=>n?c.replace("stage_",""):vqe(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 vqe(t){return ka(t).slice(0,3)}async function HJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Cue(),Iue)),Promise.resolve().then(()=>(Fue(),Mue)),Promise.resolve().then(()=>(Up(),qX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>See(s),prepareInit:({cwd:s,mode:a,intent:c})=>bee(s,a,c),initialize:ej,prepareClarify:(s,{cwd:a})=>vee(a,s),clarify:ij,resolveReview:(s,{cwd:a})=>hee(s,{cwd:a})}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function GJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await ej({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){V.stdout.write(`${JSON.stringify(n,null,2)} `),V.exit(0);return}for(let o of n.created)U("pass",`created ${o}`);for(let o of n.skipped)U("skip",o);for(let o of n.proposals??[])U("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(U("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){V.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())V.stdout.write(` ${o+1}. ${s} @@ -899,29 +899,29 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&dqe(c,l,"u `),V.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. `));V.exit(0)}async function ZJe(t,e){U("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(()=>(lde(),cde)),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)U(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),V.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>GT(l,s)),c=`${VH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;U(i,"run",c),a.length>0&&V.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&U("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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function VJe(t={}){try{let e=H();if(ma("."))U("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ms(".");jl(".",r),Za("."),p5(".");let n=Zl(".");n==="created"?U("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&U("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=dte(".");for(let s of i.repaired)U("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)U("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=Lx(".");o&&U("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Vv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){U("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);U("note",`propose-archive \xB7 ${s}`,a)}U("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),V.exit(0);return}U("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){U("fail","sync",e.message),V.exit(1)}}function WJe(t){if(!t){U("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=f_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";U("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function KJe(t,e={}){if(!t){U("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=p_(".",t);if(!r){U("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}m_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";U("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?V.stdout.write(`Run: git checkout ${r.gitHead} +`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>WO(l,s)),c=`${JH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;U(i,"run",c),a.length>0&&V.stdout.write(`Touched: ${a.join(", ")} +`)}let o=n.stubsCreated.length>0;o&&U("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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function VJe(t={}){try{let e=H();if(ma("."))U("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ms(".");jl(".",r),Za("."),g5(".");let n=Zl(".");n==="created"?U("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&U("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=mte(".");for(let s of i.repaired)U("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)U("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=zx(".");o&&U("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Wv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){U("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);U("note",`propose-archive \xB7 ${s}`,a)}U("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),V.exit(0);return}U("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){U("fail","sync",e.message),V.exit(1)}}function WJe(t){if(!t){U("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=p_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";U("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function KJe(t,e={}){if(!t){U("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=m_(".",t);if(!r){U("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}h_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";U("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?V.stdout.write(`Run: git checkout ${r.gitHead} `):V.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),V.exit(0)}async function JJe(t){let e=t.host&&t.host!=="all"?[t.host]:void 0,r=await CC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});V.exit(r.errors.length>0?1:0)}async function YJe(){U("note","update","reconciling the current project after the engine upgrade");let t=await oX(".",{wireHosts:async()=>(await CC({quiet:!0,projectRoot:"."})).errors.length});if(U(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){U("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}t.inventoryDeferred?U("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):U("pass","spec",`inventory synced \xB7 ${t.features} features`),U(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)U("note","deprecated",r);V.stdout.write(` +`),V.exit(0)}async function JJe(t){let e=t.host&&t.host!=="all"?[t.host]:void 0,r=await jC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});V.exit(r.errors.length>0?1:0)}async function YJe(){U("note","update","reconciling the current project after the engine upgrade");let t=await cX(".",{wireHosts:async()=>(await jC({quiet:!0,projectRoot:"."})).errors.length});if(U(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){U("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}t.inventoryDeferred?U("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):U("pass","spec",`inventory synced \xB7 ${t.features} features`),U(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)U("note","deprecated",r);V.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),dA({tier:"pre-commit",strict:!0}).anyFailed?V.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"):U("pass","drift","clean against the stricter detectors"),V.exit(t.code)}var XJe={"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 dA(t){let e=t.tier??"all",r=t.silent===!0,n=XJe[e];if(!n)return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):r||U("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",()=>Um(i)],["stage_1.2",()=>zm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",yj],["stage_1.5",Ya],["stage_1.6",Dp],["stage_2.1",()=>Oj({...i,strict:t.strict})],["stage_2.2",()=>_j(i)],["stage_2.3",KP],["stage_2.4",wj],["stage_3.1",xj],["stage_3.2",vj],["stage_3.3",Tj],["stage_4.1",hj],["stage_4.2",qm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ii(d)?"fail":"skip",u=[];R_("."),Mee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:ka(d),h=WY(p);ii(h)&&(c=!0,a=Math.max(a,KY(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(U(l(h),m),ii(h)&&s8e(p))}}finally{P_(),qee()}if(t.strict)try{let d=H();for(let f of Nee(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&&U("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"||!ii(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=>ii(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&U("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(ma("."))t.json||U("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{pG(".",H())&&(t.json||U("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`),mA({tier:"pre-commit",strict:!0}).anyFailed?V.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"):U("pass","drift","clean against the stricter detectors"),V.exit(t.code)}var XJe={"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=XJe[e];if(!n)return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):r||U("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",()=>Um(i)],["stage_1.2",()=>zm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",vj],["stage_1.5",Ya],["stage_1.6",Dp],["stage_2.1",()=>Pj({...i,strict:t.strict})],["stage_2.2",()=>Sj(i)],["stage_2.3",XI],["stage_2.4",kj],["stage_3.1",Ej],["stage_3.2",xj],["stage_3.3",Ij],["stage_4.1",_j],["stage_4.2",qm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ii(d)?"fail":"skip",u=[];P_("."),zee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:ka(d),h=YY(p);ii(h)&&(c=!0,a=Math.max(a,XY(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(U(l(h),m),ii(h)&&s8e(p))}}finally{C_(),Gee()}if(t.strict)try{let d=H();for(let f of Fee(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&&U("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"||!ii(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=>ii(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&U("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(ma("."))t.json||U("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{gG(".",H())&&(t.json||U("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} `):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function QJe(t){try{let e=H(),r=nl(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} `),V.exit("not_found"in r?1:0)}catch(e){U("fail","context",e.message),V.exit(1)}}function e8e(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} -`),V.exit("not_found"in i?1:0)}catch(r){U("fail","impact",r.message),V.exit(1)}}function t8e(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Qv(e,o=>{try{return dde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),V.exit(0)}catch(e){U("fail","infer-deps",e.message),V.exit(1)}}function r8e(t={}){try{if(t.sessions){See(t);return}if(t.trend!==void 0&&t.trend!==!1){wee(t);return}let e=H(),n=fH(e,o=>{try{return dde(o,"utf8")}catch{return null}},"."),i=mH(".",n);if(t.json)V.stdout.write(`${JSON.stringify(n,null,2)} +`),V.exit("not_found"in i?1:0)}catch(r){U("fail","impact",r.message),V.exit(1)}}function t8e(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=eS(e,o=>{try{return dde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),V.exit(0)}catch(e){U("fail","infer-deps",e.message),V.exit(1)}}function r8e(t={}){try{if(t.sessions){$ee(t);return}if(t.trend!==void 0&&t.trend!==!1){kee(t);return}let e=H(),n=hH(e,o=>{try{return dde(o,"utf8")}catch{return null}},"."),i=yH(".",n);if(t.json)V.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)}`,` ${il}`];V.stdout.write(`${c.join(` `)} -`),i.appended?U("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?U("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&U("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}V.exit(0)}catch(e){U("fail","measure",e.message),V.exit(1)}}function n8e(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(U("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){U("fail","check",r.message),V.exit(1)}V.exitCode=dA({...t,focusModules:e}).worst}function i8e(t){let e=TY(".",t,{checkStages:dA,onIndex:Za,gitOpInProgress:dT});U(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function o8e(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){U("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=y5(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),i.appended?U("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?U("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&U("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}V.exit(0)}catch(e){U("fail","measure",e.message),V.exit(1)}}function n8e(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(U("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){U("fail","check",r.message),V.exit(1)}V.exitCode=mA({...t,focusModules:e}).worst}function i8e(t){let e=IY(".",t,{checkStages:mA,onIndex:Za,gitOpInProgress:mO});U(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function o8e(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){U("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=v5(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),V.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";V.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}V.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),V.exit(s.length>0?1:0);return}if(!t){U("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),V.exit(1);return}let i=fte(n,t,e.ac,r);if(!i||i.acs.length===0){U("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),V.exit(1);return}V.stdout.write(`${pte(i)} +`),V.exit(s.length>0?1:0);return}if(!t){U("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),V.exit(1);return}let i=hte(n,t,e.ac,r);if(!i||i.acs.length===0){U("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),V.exit(1);return}V.stdout.write(`${gte(i)} `),V.exit(0)}function s8e(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=ude(Cf(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&V.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` `).find(r=>r.trim().length>0);e&&V.stdout.write(` ${ude(e.trim(),160)} -`)}}function ude(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function a8e(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(zx(e,"."),null,2)} -`),V.exitCode=0;return}V.stdout.write(`${mte(e,".",{internal:t.internal})} -`),V.exit(0)}function c8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function l8e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){U("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=zx(i,e),s={gitHead:ya(e),version:Ul(),generatedAt:t.now??new Date().toISOString()},a=al(i),c;try{let l=t.since??Qo(e),u=es(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:ol(u),auditMarkdown:sl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=oG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){U("fail","bundle",i.message),V.exit(1);return}try{BJe(r,n,"utf8")}catch(i){U("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}U("pass","bundle",`${r} \xB7 ${c8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function u8e(t){let e=RA(t);U("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function d8e(){let t=new n4;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(GJe),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(ZJe),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(VJe),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate all hosts (default) or one of: claude, codex, antigravity, cursor","all").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(JJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh AGENTS.md, then report stricter detector findings").action(YJe),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(n8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(WJe),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(i8e),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)=>o8e(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(KJe),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(a8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(QJe),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)=>e8e(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=>rX(r,{checkStages:dA})),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=>t8e(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=>r8e(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=>Pee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Cee()),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=>{Dee(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=>ZH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>Y5(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=>l8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(u8e),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(VY),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(HJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){EY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}eY(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(hee),t}var f8e=!!globalThis.__CLADDING_BUNDLED,p8e=f8e||import.meta.url===`file://${V.argv[1]}`;p8e&&d8e().parse();export{XJe as TIER_STAGES,d8e as createProgram,l8e as runBundleCommand,n8e as runCheckCommand,dA as runCheckStages,WJe as runCheckpointCommand,QJe as runContextCommand,i8e as runDoneCommand,e8e as runImpactCommand,t8e as runInferDepsCommand,GJe as runInitCommand,r8e as runMeasureCommand,o8e as runOracleCommand,KJe as runRollbackCommand,u8e as runRouteCommand,ZJe as runRunCommand,HJe as runServeCommand,JJe as runSetupCommand,a8e as runStatusCommand,VJe as runSyncCommand,YJe as runUpdateCommand}; +`)}}function ude(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function a8e(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(Ux(e,"."),null,2)} +`),V.exitCode=0;return}V.stdout.write(`${yte(e,".",{internal:t.internal})} +`),V.exit(0)}function c8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function l8e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){U("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=Ux(i,e),s={gitHead:ya(e),version:Ul(),generatedAt:t.now??new Date().toISOString()},a=al(i),c;try{let l=t.since??Qo(e),u=es(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:ol(u),auditMarkdown:sl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=cG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){U("fail","bundle",i.message),V.exit(1);return}try{BJe(r,n,"utf8")}catch(i){U("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}U("pass","bundle",`${r} \xB7 ${c8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function u8e(t){let e=CA(t);U("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function d8e(){let t=new s4;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(GJe),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(ZJe),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(VJe),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate all hosts (default) or one of: claude, codex, antigravity, cursor","all").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(JJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh AGENTS.md, then report stricter detector findings").action(YJe),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(n8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(WJe),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(i8e),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)=>o8e(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(KJe),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(a8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(QJe),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)=>e8e(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=>oX(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=>t8e(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=>r8e(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=>Nee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>jee()),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=>{Mee(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=>KH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>eY(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=>l8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(u8e),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(JY),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(HJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){OY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}nY(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(_ee),t}var f8e=!!globalThis.__CLADDING_BUNDLED,p8e=f8e||import.meta.url===`file://${V.argv[1]}`;p8e&&d8e().parse();export{XJe as TIER_STAGES,d8e as createProgram,l8e as runBundleCommand,n8e as runCheckCommand,mA as runCheckStages,WJe as runCheckpointCommand,QJe as runContextCommand,i8e as runDoneCommand,e8e as runImpactCommand,t8e as runInferDepsCommand,GJe as runInitCommand,r8e as runMeasureCommand,o8e as runOracleCommand,KJe as runRollbackCommand,u8e as runRouteCommand,ZJe as runRunCommand,HJe as runServeCommand,JJe as runSetupCommand,a8e as runStatusCommand,VJe as runSyncCommand,YJe as runUpdateCommand}; diff --git a/plugins/codex/skills/init/SKILL.md b/plugins/codex/skills/init/SKILL.md index 48a8c488..1bdbfcaa 100644 --- a/plugins/codex/skills/init/SKILL.md +++ b/plugins/codex/skills/init/SKILL.md @@ -8,18 +8,20 @@ Use this workflow only when the user explicitly asks to initialize, adopt, or re ## Required host workflow +If the current user message itself matches `APPLY CLADDING XXXXXX`, do not call prepare or stage again. Call `clad_init` once and copy the entire user message, including the `APPLY CLADDING` prefix, into `confirmation`. + 1. If a greenfield request has no project intent, ask for one short description. 2. Call `clad_prepare_init` with exactly one starting mode: - `idea` with the user's description. - `document` with a project-relative planning-document path. - `existing` for an existing codebase; include an optional adoption goal. -3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. -4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. -5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the draft and that reply verbatim as `confirmation`. Include the one-time token when the host retained it; process-per-turn hosts may omit it and Cladding resolves the exact challenge from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. +3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model, then call `clad_stage_init` with the preparation token and that draft. Staging validates the draft and stores only ignored runtime state under `.cladding/host/`; it does not modify authored project files. +4. Show `plannedChanges`, the staged `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the entire reply verbatim as `confirmation`—never strip the `APPLY CLADDING` prefix. Include the draft and token when the host retained them; process-per-turn hosts may omit both because Cladding resolves the exact staged draft from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. 6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. -`clad_prepare_init` is read-only. Never call prepare and apply in the same assistant turn. Only `clad_init` writes artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. +`clad_prepare_init` does not modify the workspace, and `clad_stage_init` writes only ignored runtime state. Never call stage and apply in the same assistant turn. Only `clad_init` writes authored artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. The raw CLI remains available for terminal, CI, offline, and explicitly configured SDK automation; it is not the primary host onboarding path. diff --git a/plugins/gemini-cli/commands/init.toml b/plugins/gemini-cli/commands/init.toml index 596af33e..9548cf16 100644 --- a/plugins/gemini-cli/commands/init.toml +++ b/plugins/gemini-cli/commands/init.toml @@ -6,19 +6,21 @@ Use this workflow only when the user explicitly asks to initialize, adopt, or re ## Required host workflow +If the current user message itself matches `APPLY CLADDING XXXXXX`, do not call prepare or stage again. Call `clad_init` once and copy the entire user message, including the `APPLY CLADDING` prefix, into `confirmation`. + 1. If a greenfield request has no project intent, ask for one short description. 2. Call `clad_prepare_init` with exactly one starting mode: - `idea` with the user's description. - `document` with a project-relative planning-document path. - `existing` for an existing codebase; include an optional adoption goal. -3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. -4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. -5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the draft and that reply verbatim as `confirmation`. Include the one-time token when the host retained it; process-per-turn hosts may omit it and Cladding resolves the exact challenge from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. +3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model, then call `clad_stage_init` with the preparation token and that draft. Staging validates the draft and stores only ignored runtime state under `.cladding/host/`; it does not modify authored project files. +4. Show `plannedChanges`, the staged `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the entire reply verbatim as `confirmation`—never strip the `APPLY CLADDING` prefix. Include the draft and token when the host retained them; process-per-turn hosts may omit both because Cladding resolves the exact staged draft from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. 6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. -`clad_prepare_init` is read-only. Never call prepare and apply in the same assistant turn. Only `clad_init` writes artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. +`clad_prepare_init` does not modify the workspace, and `clad_stage_init` writes only ignored runtime state. Never call stage and apply in the same assistant turn. Only `clad_init` writes authored artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. The raw CLI remains available for terminal, CI, offline, and explicitly configured SDK automation; it is not the primary host onboarding path. ''' diff --git a/skills/init/SKILL.md b/skills/init/SKILL.md index 48a8c488..1bdbfcaa 100644 --- a/skills/init/SKILL.md +++ b/skills/init/SKILL.md @@ -8,18 +8,20 @@ Use this workflow only when the user explicitly asks to initialize, adopt, or re ## Required host workflow +If the current user message itself matches `APPLY CLADDING XXXXXX`, do not call prepare or stage again. Call `clad_init` once and copy the entire user message, including the `APPLY CLADDING` prefix, into `confirmation`. + 1. If a greenfield request has no project intent, ask for one short description. 2. Call `clad_prepare_init` with exactly one starting mode: - `idea` with the user's description. - `document` with a project-relative planning-document path. - `existing` for an existing codebase; include an optional adoption goal. -3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model. -4. Show `plannedChanges`, `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. -5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the draft and that reply verbatim as `confirmation`. Include the one-time token when the host retained it; process-per-turn hosts may omit it and Cladding resolves the exact challenge from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. +3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model, then call `clad_stage_init` with the preparation token and that draft. Staging validates the draft and stores only ignored runtime state under `.cladding/host/`; it does not modify authored project files. +4. Show `plannedChanges`, the staged `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the entire reply verbatim as `confirmation`—never strip the `APPLY CLADDING` prefix. Include the draft and token when the host retained them; process-per-turn hosts may omit both because Cladding resolves the exact staged draft from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. 6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. -`clad_prepare_init` is read-only. Never call prepare and apply in the same assistant turn. Only `clad_init` writes artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. +`clad_prepare_init` does not modify the workspace, and `clad_stage_init` writes only ignored runtime state. Never call stage and apply in the same assistant turn. Only `clad_init` writes authored artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. The raw CLI remains available for terminal, CI, offline, and explicitly configured SDK automation; it is not the primary host onboarding path. diff --git a/spec/features/natural-language-init-0f4dd6.yaml b/spec/features/natural-language-init-0f4dd6.yaml index 129e3cc0..02fe070f 100644 --- a/spec/features/natural-language-init-0f4dd6.yaml +++ b/spec/features/natural-language-init-0f4dd6.yaml @@ -180,3 +180,17 @@ acceptance_criteria: response: project guidance has one shared source instead of diverging host copies text: The system shall use AGENTS.md as the generated cross-host instruction surface and preserve any existing CLAUDE.md without creating a new one, so project guidance has one shared source instead of diverging host copies. test_refs: [tests/cli/update.test.ts, tests/cli/init-onboarding-english-source.test.ts] + - id: AC-020 + ears: event + condition: when a process-per-turn host stages a validated onboarding draft before showing the approval challenge + action: retain that exact draft only as ignored project runtime state and apply it after the complete approval phrase without asking the model to reconstruct intent + response: MCP process restarts cannot replace a planning document or observed project intent with an approval code + text: When a process-per-turn host stages a validated onboarding draft before showing the approval challenge, the system shall retain that exact draft only as ignored project runtime state and apply it after the complete approval phrase without asking the model to reconstruct intent, so MCP process restarts cannot replace a planning document or observed project intent with an approval code. + test_refs: [tests/serve/init-tools.test.ts] + notes: | + ## Decision + Add a read-only staging tool between host-model drafting and the destructive apply tool. + ## Why + Real Codex headless sessions reload MCP per turn and may isolate temporary directories; without a durable staged draft, a new model turn can reconstruct the wrong intent from the approval code. + ## Trade-off + Staging writes an opaque short-lived cache under the already ignored `.cladding/host/` runtime boundary, while authored spec and documentation remain untouched until exact approval. diff --git a/src/cli/clad.ts b/src/cli/clad.ts index e9eaa491..27e880d0 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -1261,7 +1261,7 @@ export function createProgram(): Command { .description('Summarise .cladding/events.log.jsonl — sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)') .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/gemini/codex) + Cursor wiring → dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run') + .option('--hosts', 'smoke-test host CLIs (Claude Code / Antigravity / Codex / Cursor) and project wiring → 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((opts) => { diff --git a/src/serve/server.ts b/src/serve/server.ts index d75fa67c..b1160dbe 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -75,6 +75,7 @@ export const PERSONA_PROMPT_ALIASES: Readonly> = { /** Tool names cladding's MCP server exposes (stable wire identifiers). */ export const TOOL_NAMES = [ 'clad_prepare_init', + 'clad_stage_init', 'clad_init', 'clad_prepare_clarify', 'clad_clarify', @@ -177,8 +178,8 @@ export function buildServer(opts: ServerOptions = {}): McpServer { { instructions: 'For explicit Cladding onboarding, always call clad_prepare_init first, draft the requested structured data ' + - 'with the current host model, show the planned changes, and wait for a separate user confirmation before ' + - 'calling clad_init with its token and the confirmation verbatim. For each real user answer, call ' + + 'with the current host model, then call clad_stage_init before showing the planned changes. Wait for a separate ' + + 'user confirmation before calling clad_init with the confirmation verbatim. For each real user answer, call ' + 'clad_prepare_clarify and then clad_clarify only after a new user message supplies the answer. Never infer an ' + 'answer or call clarify during the initialization approval turn. Never run onboarding shell commands or request MCP sampling. ' + 'Prepare tools are read-only; apply tools validate and write.', @@ -389,6 +390,7 @@ const hostDraftSchema = z.object({ questions: z.array(z.string().min(1)).max(3), ai_hints: z.record(z.string(), z.unknown()).optional(), }); +type HostDraft = z.infer; interface PreparedOnboarding { readonly kind: 'init' | 'clarify'; @@ -437,9 +439,11 @@ function decodePreparedOnboarding(token: string): PreparedOnboarding | null { } } -function pendingPreparationPath(cwd: string, key: string): string { +function pendingPreparationPath(cwd: string, key: string, durable = false): string { const id = createHash('sha256').update(`${resolve(cwd)}\0${key}`).digest('hex'); - return join(tmpdir(), 'cladding-onboarding-pending', `${id}.json`); + return durable + ? join(cwd, '.cladding', 'host', 'onboarding-pending', `${id}.json`) + : join(tmpdir(), 'cladding-onboarding-pending', `${id}.json`); } function persistPendingPreparation( @@ -447,35 +451,41 @@ function persistPendingPreparation( key: string, token: string, request: PreparedOnboarding, + draft?: HostDraft, ): void { - const path = pendingPreparationPath(cwd, key); + const path = pendingPreparationPath(cwd, key, draft != null); mkdirSync(dirname(path), {recursive: true, mode: 0o700}); - writeFileSync(path, JSON.stringify({expiresAt: Date.now() + PREPARATION_TTL_MS, token, request}), {mode: 0o600}); + writeFileSync(path, JSON.stringify({expiresAt: Date.now() + PREPARATION_TTL_MS, token, request, draft}), {mode: 0o600}); } function loadPendingPreparation( cwd: string, key: string, -): {readonly token: string; readonly request: PreparedOnboarding} | null { - const path = pendingPreparationPath(cwd, key); - try { - const parsed = JSON.parse(readFileSync(path, 'utf8')) as { - expiresAt?: number; - token?: string; - request?: PreparedOnboarding; - }; - if (!parsed.expiresAt || parsed.expiresAt < Date.now() || !parsed.token || !parsed.request) { - rmSync(path, {force: true}); - return null; +): {readonly token: string; readonly request: PreparedOnboarding; readonly draft?: HostDraft} | null { + for (const durable of [true, false]) { + const path = pendingPreparationPath(cwd, key, durable); + try { + const parsed = JSON.parse(readFileSync(path, 'utf8')) as { + expiresAt?: number; + token?: string; + request?: PreparedOnboarding; + draft?: HostDraft; + }; + if (!parsed.expiresAt || parsed.expiresAt < Date.now() || !parsed.token || !parsed.request) { + rmSync(path, {force: true}); + continue; + } + return {token: parsed.token, request: parsed.request, draft: parsed.draft}; + } catch { + // Try the other cache tier. A missing durable cache is normal before staging. } - return {token: parsed.token, request: parsed.request}; - } catch { - return null; } + return null; } function removePendingPreparation(cwd: string, key: string): void { rmSync(pendingPreparationPath(cwd, key), {force: true}); + rmSync(pendingPreparationPath(cwd, key, true), {force: true}); } /** Returns a short, one-time phrase that is easy for a human to verify and hard to pass accidentally. */ @@ -654,6 +664,41 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp }, ); + server.registerTool( + 'clad_stage_init', + { + title: 'Stage a Cladding onboarding draft for approval', + description: + 'Validate and temporarily cache the host-model draft from clad_prepare_init before showing the approval phrase. ' + + 'This does not modify project files and lets a later host process apply the exact staged draft.', + inputSchema: { + token: z.string().min(1).max(MAX_APPROVAL_ENVELOPE_BYTES), + draft: hostDraftSchema, + }, + outputSchema: { + status: z.string(), changed: z.boolean(), approvalChallenge: z.string().optional(), + confirmationQuestion: z.string().optional(), error: z.string().optional(), + }, + annotations: {readOnlyHint: false, destructiveHint: false, idempotentHint: true}, + }, + async (args) => { + const request = prepared.get(args.token) ?? decodePreparedOnboarding(args.token); + if (!request || request.kind !== 'init' || !request.approvalChallenge) { + return mcpPayload({status: 'invalid_token', changed: false}, true); + } + if (request.snapshot !== onboardingPreparationSnapshot(cwd)) { + return mcpPayload({status: 'stale_preparation', changed: false}, true); + } + persistPendingPreparation(cwd, request.approvalChallenge, args.token, request, args.draft); + return mcpPayload({ + status: 'staged', + changed: false, + approvalChallenge: request.approvalChallenge, + confirmationQuestion: `To apply these changes, reply with the exact approval phrase: ${request.approvalChallenge}`, + }); + }, + ); + server.registerTool( 'clad_init', { @@ -661,11 +706,14 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp description: 'Write Cladding artifacts from the host model draft returned after clad_prepare_init. ' + 'Use the one-time token when the host retained it; process-per-turn hosts may use the exact approval phrase ' + - 'through the short-lived machine-local cache. Malformed, stale, or replayed requests do not write files.', + 'through the short-lived project runtime cache. Copy the complete user message, including the APPLY CLADDING ' + + 'prefix, into confirmation. Malformed, stale, or replayed requests do not write files.', inputSchema: { token: z.string().min(1).max(MAX_APPROVAL_ENVELOPE_BYTES).optional(), - confirmation: z.string().min(1).describe('The user\'s separate confirmation reply, verbatim'), - draft: hostDraftSchema, + confirmation: z.string().regex(/^APPLY CLADDING [A-F0-9]{6}$/).describe( + 'The complete separate user reply, verbatim, including the APPLY CLADDING prefix', + ), + draft: hostDraftSchema.optional(), }, outputSchema: { status: z.string(), changed: z.boolean(), created: z.array(z.string()).optional(), skipped: z.array(z.string()).optional(), @@ -690,9 +738,16 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp } if (request.snapshot !== onboardingPreparationSnapshot(cwd)) return mcpPayload({status: 'stale_preparation', changed: false}, true); if (!onboarding) return mcpPayload({status: 'unavailable', changed: false}, true); + const draft = args.draft ?? pending?.draft; + if (!draft) { + return mcpPayload({ + status: 'draft_required', changed: false, + error: 'No staged onboarding draft is available. Prepare and stage the draft again before approval.', + }, true); + } if (args.token) prepared.delete(args.token); removePendingPreparation(cwd, args.confirmation.trim()); - const response = onboarding.renderDraft(args.draft); + const response = onboarding.renderDraft(draft); const rollback = captureOnboardingRollback(cwd); let init: Awaited>; try { diff --git a/tests/serve/init-tools.test.ts b/tests/serve/init-tools.test.ts index a936fb2d..29ea1873 100644 --- a/tests/serve/init-tools.test.ts +++ b/tests/serve/init-tools.test.ts @@ -131,14 +131,24 @@ describe('serve/server — natural-language init tools', () => { test('process-per-turn hosts can apply by exact challenge when they discard opaque tool tokens', async () => { const first = await makePair(dir); const prepared = await prepare(first.client, {mode: 'idea', intent: 'B2B payment SaaS'}); + const staged = await first.client.callTool({name: 'clad_stage_init', arguments: { + token: prepared.token, + draft, + }}); + expect(payload(staged)).toMatchObject({ + status: 'staged', + changed: false, + approvalChallenge: prepared.confirmation, + }); await first.cleanup(); - expect(readdirSync(dir)).toEqual([]); + expect(existsSync(join(dir, 'spec.yaml'))).toBe(false); + expect(existsSync(join(dir, 'AGENTS.md'))).toBe(false); + expect(existsSync(join(dir, '.cladding', 'host', 'onboarding-pending'))).toBe(true); const second = await makePair(dir); try { const result = await second.client.callTool({name: 'clad_init', arguments: { confirmation: prepared.confirmation, - draft, }}); expect(result.isError).not.toBe(true); expect(payload(result)).toMatchObject({changed: true, onboardingSource: 'host'}); @@ -147,6 +157,28 @@ describe('serve/server — natural-language init tools', () => { } }); + test('approval without a direct or staged draft fails closed', async () => { + const first = await makePair(dir); + const prepared = await prepare(first.client, {mode: 'document', document_path: (() => { + mkdirSync(join(dir, 'docs'), {recursive: true}); + writeFileSync(join(dir, 'docs', 'plan.md'), 'Complete payment product plan.'); + return 'docs/plan.md'; + })()}); + await first.cleanup(); + + const second = await makePair(dir); + try { + const result = await second.client.callTool({name: 'clad_init', arguments: { + confirmation: prepared.confirmation, + }}); + expect(result.isError).toBe(true); + expect(payload(result)).toMatchObject({status: 'draft_required', changed: false}); + expect(existsSync(join(dir, 'spec.yaml'))).toBe(false); + } finally { + await second.cleanup(); + } + }); + test('initial request is not accepted as the separate write confirmation', async () => { const {client, cleanup} = await makePair(dir); try { @@ -159,7 +191,8 @@ describe('serve/server — natural-language init tools', () => { }); const token = payload(preparation).token as string; const result = await client.callTool({name: 'clad_init', arguments: {token, confirmation: intent, draft}}); - expect(payload(result)).toMatchObject({status: 'confirmation_required', changed: false}); + expect(result.isError).toBe(true); + expect((result.content as Array<{text: string}>)[0].text).toContain('Invalid arguments'); expect(existsSync(join(dir, 'spec.yaml'))).toBe(false); } finally { await cleanup(); @@ -175,7 +208,8 @@ describe('serve/server — natural-language init tools', () => { confirmation: 'Which files will be created?', draft, }}); - expect(payload(result)).toMatchObject({status: 'confirmation_required', changed: false}); + expect(result.isError).toBe(true); + expect((result.content as Array<{text: string}>)[0].text).toContain('Invalid arguments'); expect(existsSync(join(dir, 'spec.yaml'))).toBe(false); } finally { await cleanup(); From d66157d203394036e106b73792fcd6e46f6cff0b Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 15 Jul 2026 12:12:24 +0900 Subject: [PATCH 19/28] chore(plugin): refresh bundled CLI --- plugins/claude-code/dist/clad.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index dc9f7c5a..13b11ae9 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -924,4 +924,4 @@ ${o.length} AC(s) required, ${s.length} missing an oracle. `).find(r=>r.trim().length>0);e&&V.stdout.write(` ${ude(e.trim(),160)} `)}}function ude(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function a8e(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(Ux(e,"."),null,2)} `),V.exitCode=0;return}V.stdout.write(`${yte(e,".",{internal:t.internal})} -`),V.exit(0)}function c8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function l8e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){U("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=Ux(i,e),s={gitHead:ya(e),version:Ul(),generatedAt:t.now??new Date().toISOString()},a=al(i),c;try{let l=t.since??Qo(e),u=es(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:ol(u),auditMarkdown:sl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=cG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){U("fail","bundle",i.message),V.exit(1);return}try{BJe(r,n,"utf8")}catch(i){U("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}U("pass","bundle",`${r} \xB7 ${c8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function u8e(t){let e=CA(t);U("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function d8e(){let t=new s4;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(GJe),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(ZJe),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(VJe),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate all hosts (default) or one of: claude, codex, antigravity, cursor","all").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(JJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh AGENTS.md, then report stricter detector findings").action(YJe),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(n8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(WJe),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(i8e),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)=>o8e(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(KJe),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(a8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(QJe),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)=>e8e(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=>oX(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=>t8e(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=>r8e(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=>Nee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>jee()),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=>{Mee(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=>KH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>eY(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=>l8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(u8e),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(JY),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(HJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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/gemini/codex) + Cursor 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){OY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}nY(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(_ee),t}var f8e=!!globalThis.__CLADDING_BUNDLED,p8e=f8e||import.meta.url===`file://${V.argv[1]}`;p8e&&d8e().parse();export{XJe as TIER_STAGES,d8e as createProgram,l8e as runBundleCommand,n8e as runCheckCommand,mA as runCheckStages,WJe as runCheckpointCommand,QJe as runContextCommand,i8e as runDoneCommand,e8e as runImpactCommand,t8e as runInferDepsCommand,GJe as runInitCommand,r8e as runMeasureCommand,o8e as runOracleCommand,KJe as runRollbackCommand,u8e as runRouteCommand,ZJe as runRunCommand,HJe as runServeCommand,JJe as runSetupCommand,a8e as runStatusCommand,VJe as runSyncCommand,YJe as runUpdateCommand}; +`),V.exit(0)}function c8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function l8e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){U("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=Ux(i,e),s={gitHead:ya(e),version:Ul(),generatedAt:t.now??new Date().toISOString()},a=al(i),c;try{let l=t.since??Qo(e),u=es(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:ol(u),auditMarkdown:sl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=cG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){U("fail","bundle",i.message),V.exit(1);return}try{BJe(r,n,"utf8")}catch(i){U("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}U("pass","bundle",`${r} \xB7 ${c8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function u8e(t){let e=CA(t);U("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function d8e(){let t=new s4;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(GJe),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(ZJe),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(VJe),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate all hosts (default) or one of: claude, codex, antigravity, cursor","all").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(JJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh AGENTS.md, then report stricter detector findings").action(YJe),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(n8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(WJe),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(i8e),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)=>o8e(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(KJe),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(a8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(QJe),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)=>e8e(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=>oX(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=>t8e(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=>r8e(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=>Nee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>jee()),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=>{Mee(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=>KH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>eY(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=>l8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(u8e),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(JY),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(HJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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 / 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){OY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}nY(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(_ee),t}var f8e=!!globalThis.__CLADDING_BUNDLED,p8e=f8e||import.meta.url===`file://${V.argv[1]}`;p8e&&d8e().parse();export{XJe as TIER_STAGES,d8e as createProgram,l8e as runBundleCommand,n8e as runCheckCommand,mA as runCheckStages,WJe as runCheckpointCommand,QJe as runContextCommand,i8e as runDoneCommand,e8e as runImpactCommand,t8e as runInferDepsCommand,GJe as runInitCommand,r8e as runMeasureCommand,o8e as runOracleCommand,KJe as runRollbackCommand,u8e as runRouteCommand,ZJe as runRunCommand,HJe as runServeCommand,JJe as runSetupCommand,a8e as runStatusCommand,VJe as runSyncCommand,YJe as runUpdateCommand}; From 344d1418f3b9045bd8260c52c2b66512580bd68d Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 15 Jul 2026 12:15:47 +0900 Subject: [PATCH 20/28] chore(spec): refresh verification attestation --- spec/attestation.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 9f7e7aee..1954f8e6 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -23,8 +23,8 @@ attested_modules: GOVERNANCE.md: 21cc28eaaf637a20 README.html: 227583ec95375954 README.ko.html: 5ea397c6e72ff11b - README.ko.md: 30e8134c403232b1 - README.md: 09323b6557720aca + README.ko.md: c23a202221cbcef4 + README.md: ee306d0c8277e943 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -52,7 +52,7 @@ attested_modules: docs/dogfood/claude-code-2026-05-20.md: 04870d41e75576d6 docs/dogfood/gemini-cli-2026-05-20.md: 2da1ba66c4f108f0 docs/feature-cycle.md: b8c48c86d1f1e093 - docs/glossary.md: 5c2d8f6a0837e3c9 + docs/glossary.md: 1f2acc81a22cdd3e docs/img/en/ecosystem.svg: ed14d1d17f088b00 docs/img/en/relationship.svg: c7a24203925b4664 docs/img/ko/ecosystem.svg: 2b7341576c2af0a8 @@ -69,13 +69,13 @@ attested_modules: plugins/claude-code/agents/orchestrator.md: 18f41e1dbfe6d95b plugins/claude-code/agents/planner.md: 934753c28d5f1287 plugins/claude-code/agents/reviewer.md: 9c4e095e60040473 - plugins/claude-code/commands/init.md: 2d19f8ffebf41bb2 + plugins/claude-code/commands/init.md: 6175a8492a6ee48c plugins/claude-code/hooks/hooks.json: 42321ead26fb1da8 plugins/codex/.codex-plugin/plugin.json: e2898491a8fd62b8 plugins/codex/.mcp.json: 43e3f4b2af24aa18 plugins/codex/skills/check/SKILL.md: 455d912ce1d47b5a plugins/codex/skills/developer/SKILL.md: 40af2943253f6c72 - plugins/codex/skills/init/SKILL.md: 2d19f8ffebf41bb2 + plugins/codex/skills/init/SKILL.md: 6175a8492a6ee48c plugins/codex/skills/observability/SKILL.md: 5ea8f14b1c9b4a61 plugins/codex/skills/orchestrator/SKILL.md: 18f41e1dbfe6d95b plugins/codex/skills/planner/SKILL.md: 934753c28d5f1287 @@ -86,7 +86,7 @@ attested_modules: plugins/codex/skills/sync/SKILL.md: 775c0f990a52a3d9 plugins/gemini-cli/GEMINI.md: ba08eaf2cd557a65 plugins/gemini-cli/commands/README.md: 3527d771578431bd - plugins/gemini-cli/commands/init.toml: a91afdccf4206c59 + plugins/gemini-cli/commands/init.toml: e44c7ead9bd927b2 plugins/gemini-cli/gemini-extension.json: 47685e98f1f67e11 scripts/build-plugin.mjs: 7fabe2b6301b142a scripts/build.mjs: 3a4b204063024ef1 @@ -97,7 +97,7 @@ attested_modules: skills/checkpoint/SKILL.md: f723e8cfb8286a64 skills/clarify/SKILL.md: 5d08bbb821258d03 skills/doctor/SKILL.md: 6581c6c900c72d68 - skills/init/SKILL.md: 2d19f8ffebf41bb2 + skills/init/SKILL.md: 6175a8492a6ee48c skills/oracle/SKILL.md: 0986572a0a5604f6 skills/rollback/SKILL.md: d472dc3a562b347b skills/route/SKILL.md: 5958830fef280c67 @@ -138,15 +138,15 @@ attested_modules: src/cli: a4d0f0eb87fed960 src/cli/benchmark.ts: 77f84d2a898d724f src/cli/changelog.ts: 2de1adb009b89ab4 - src/cli/clad.ts: e75a16da5809a319 + src/cli/clad.ts: 85e7e3f59bddcd1d src/cli/clarify.ts: 393cc93a6feb698a - src/cli/doctor-hosts.ts: b6e47f8c5d545416 + src/cli/doctor-hosts.ts: 093bf18c79cf363f src/cli/doctor.ts: b98b955fe75e7f7e src/cli/done.ts: 02bd4397eaf34fa1 src/cli/graph-serve.ts: 23e6e389225d0f98 src/cli/graph.ts: bab410061b8c746a src/cli/hook.ts: 201f82f4c89e173f - src/cli/init.ts: f4aef7a828a8cfda + src/cli/init.ts: 580469d8416910b4 src/cli/intent-from-path.ts: e69862821d979f22 src/cli/measure.ts: 3a562f16589e26c2 src/cli/report.ts: 911f859b2446834b @@ -167,7 +167,7 @@ attested_modules: src/cli/scan/thresholds.ts: ec0047b894a6aa6a src/cli/scan/types.ts: ea0170aa88c1c14a src/cli/scan/walker.ts: 33e4448e365e47c6 - src/cli/update.ts: bbd9c97bfc2b99ff + src/cli/update.ts: b342feb657e33418 src/cli/verdict.ts: 7aa16b8739ab8e5f src/core/checkpoint.ts: 63300c2764533b6c src/core/git-ops.ts: 4544bde493a0628f @@ -195,7 +195,7 @@ attested_modules: src/init/agents-md.ts: cb15264f0a0f2f8c src/init/git-hook.ts: 4e02f177b3764ae8 src/init/host-instructions.ts: f6d10695ef0c4763 - src/init/host-setup.ts: b12ffb4a11019b45 + src/init/host-setup.ts: 6d83a5a3a59131e4 src/optimizer: a4d0f0eb87fed960 src/optimizer/code-excerpt.ts: e2c4598efcd28d2a src/optimizer/context-slice.ts: b5864aaed1e7ae48 @@ -218,7 +218,7 @@ attested_modules: src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 - src/serve/server.ts: 4b78c2a2a87b5741 + src/serve/server.ts: ce75e0c6989f1bc8 src/spec: a4d0f0eb87fed960 src/spec/attestation.ts: 294a1e99c42d4aef src/spec/cli.ts: 7a9bcd0f66677810 From 24919177460fa2d6a76306ee9a492e83c5abee72 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 15 Jul 2026 15:26:12 +0900 Subject: [PATCH 21/28] fix(onboarding): harden post-init development flow --- docs/ab-evaluation/case-existing-adoption.md | 14 +- docs/ab-evaluation/case-payment-saas.md | 14 +- docs/dogfood/codex-cli-2026-07-15.md | 39 +- docs/setup.md | 2 +- docs/ssot-model.md | 5 +- plugins/claude-code/dist/clad.js | 752 +++++++++--------- spec/attestation.yaml | 34 +- spec/features/deliverable-smoke-9064ff.yaml | 17 +- .../lint-config-detection-b2094740.yaml | 10 +- .../natural-language-init-0f4dd6.yaml | 80 ++ .../scenario-coverage-detector-315fd7.yaml | 10 +- spec/features/ssot-governance-d12edf.yaml | 2 +- ...chain-jest-and-multiext-arch-47b8bee5.yaml | 6 +- .../features/vacuous-test-guard-b81d203e.yaml | 12 +- spec/index.yaml | 4 +- src/init/agents-md.ts | 12 +- src/init/host-setup.ts | 6 +- src/stages/README.md | 10 +- src/stages/detectors/README.md | 4 +- .../detectors/capabilities-feature-mapping.ts | 24 +- src/stages/detectors/deliverable-integrity.ts | 14 +- src/stages/detectors/scenario-coverage.ts | 19 +- src/stages/toolchain/detect.ts | 173 +++- src/stages/unit.ts | 27 + src/stages/util.ts | 13 +- tests/cli/setup.test.ts | 16 +- tests/init/agents-md.test.ts | 11 + .../capabilities-feature-mapping.test.ts | 52 +- .../detectors/deliverable-integrity.test.ts | 29 +- tests/stages/lint.test.ts | 13 +- tests/stages/scenario-coverage.test.ts | 12 +- tests/stages/spec-conformance.test.ts | 6 +- tests/stages/toolchain.test.ts | 83 +- tests/stages/toolchain/scoped-command.test.ts | 2 +- tests/stages/unit.test.ts | 18 + tests/stages/util.test.ts | 32 + 36 files changed, 1014 insertions(+), 563 deletions(-) diff --git a/docs/ab-evaluation/case-existing-adoption.md b/docs/ab-evaluation/case-existing-adoption.md index 3e24c6cc..c28b54a5 100644 --- a/docs/ab-evaluation/case-existing-adoption.md +++ b/docs/ab-evaluation/case-existing-adoption.md @@ -41,8 +41,8 @@ No spec, no architecture invariants — just code on the existing tree. | Architecture layers | 3 | 0 | +3 | | Forbidden-import rules | 0 | 0 | +0 | | Detector errors | 0 | 1 | -1 | -| Detector warnings | 5 | 3 | +2 | -| Detector infos | 6 | 28 | -22 | +| Detector warnings | 1 | 3 | -2 | +| Detector infos | 10 | 28 | -18 | | Tiered doc files | 2 | 0 | +2 | | Tiered docs (lines) | 139 | 0 | +139 | | Other doc files | 1 | 1 | +0 | @@ -57,7 +57,7 @@ No spec, no architecture invariants — just code on the existing tree. **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): ``` -A (Cladding) — errors: 0 warns: 5 infos: 6 +A (Cladding) — errors: 0 warns: 1 infos: 10 B (Vanilla) — errors: 1 warns: 3 infos: 28 Sample errors: @@ -80,8 +80,8 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 | Architecture layers | 3 | 0 | +3 | | Forbidden-import rules | 0 | 0 | +0 | | Detector errors | 1 | 1 | +0 | -| Detector warnings | 5 | 3 | +2 | -| Detector infos | 7 | 28 | -21 | +| Detector warnings | 1 | 3 | -2 | +| Detector infos | 11 | 28 | -17 | | Tiered doc files | 2 | 0 | +2 | | Tiered docs (lines) | 139 | 0 | +139 | | Other doc files | 1 | 1 | +0 | @@ -96,7 +96,7 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): ``` -A (Cladding) — errors: 1 warns: 5 infos: 7 +A (Cladding) — errors: 1 warns: 1 infos: 11 Sample errors: - [AC_DRIFT] F-4db939.AC-002 EARS: ears='unwanted' requires condition starting with 'if' — empty @@ -110,7 +110,7 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 - **Structured artifacts**: cladding produces 8 tier-banner-bearing files vs vanilla's 0. - **Spec ↔ code traceability**: cladding emits 1 feature(s), 2 AC(s), 1 scenario(s), 3 capability(s); vanilla has 0 of each. - **Architecture enforcement**: cladding declares 3 layer(s) with 0 forbidden-import rule(s); vanilla has 0. -- **Detector behavior**: cladding-managed tree → 1 error(s) / 5 warn(s) / 7 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) / 1 warn(s) / 11 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 ~3199 tokens vs vanilla's ~1280 (heuristic chars/4) — Δ ≈ 1919 tokens, the price of structure. - **Code surface**: vanilla writes 9 source file(s) / 144 LoC + 2 test file(s) / 3 test case(s); cladding writes 9 / 128 + 2 / 3. (Vanilla front-loads code, cladding front-loads spec — both converge by M2.) diff --git a/docs/ab-evaluation/case-payment-saas.md b/docs/ab-evaluation/case-payment-saas.md index 2031cb2e..2343015f 100644 --- a/docs/ab-evaluation/case-payment-saas.md +++ b/docs/ab-evaluation/case-payment-saas.md @@ -40,8 +40,8 @@ no spec, no scenarios, no architecture invariants. | Architecture layers | 3 | 0 | +3 | | Forbidden-import rules | 2 | 0 | +2 | | Detector errors | 0 | 1 | -1 | -| Detector warnings | 6 | 3 | +3 | -| Detector infos | 8 | 28 | -20 | +| Detector warnings | 1 | 3 | -2 | +| Detector infos | 13 | 28 | -15 | | 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: 6 infos: 8 +A (Cladding) — errors: 0 warns: 1 infos: 13 B (Vanilla) — errors: 1 warns: 3 infos: 28 Sample errors: @@ -79,8 +79,8 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 | Architecture layers | 3 | 0 | +3 | | Forbidden-import rules | 2 | 0 | +2 | | Detector errors | 1 | 1 | +0 | -| Detector warnings | 9 | 3 | +6 | -| Detector infos | 9 | 28 | -19 | +| Detector warnings | 3 | 3 | +0 | +| Detector infos | 15 | 28 | -13 | | 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: 9 infos: 9 +A (Cladding) — errors: 1 warns: 3 infos: 15 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) / 9 warn(s) / 9 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) / 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. - **Token cost**: cladding's cumulative artifact + code consumes ~1963 tokens vs vanilla's ~1399 (heuristic chars/4) — Δ ≈ 564 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/docs/dogfood/codex-cli-2026-07-15.md b/docs/dogfood/codex-cli-2026-07-15.md index 2d542d2e..dcf9bb30 100644 --- a/docs/dogfood/codex-cli-2026-07-15.md +++ b/docs/dogfood/codex-cli-2026-07-15.md @@ -3,7 +3,7 @@ - Host: Codex CLI `0.144.3` - Authentication: ChatGPT subscription in an isolated `CODEX_HOME` - Transport: trusted-repository `.codex/config.toml` → project `.cladding/host/serve.cjs` -- Result: onboarding verified after a process-per-turn defect was fixed +- Result: onboarding and the first ordinary post-init feature cycle verified ## Live cases @@ -14,6 +14,7 @@ | Idea | prepare → stage → separate exact approval → greenfield initialization passed | | Complete `plan.md` | prepare → stage → fresh-process approval passed; intent preserved and no follow-up question | | Existing code | observed adoption passed and preserved the source/test fixture | +| Ordinary post-init development | feature creation → implementation → independent tests/review → strict gate → `done` passed | Every final run had no `spec.yaml` before approval, created it only after the exact phrase, removed the staged cache after apply, and passed `clad sync`. @@ -23,4 +24,38 @@ Codex headless resume reloads without project MCP, while a fresh process loses t ## Post-init development -An ordinary archive-feature request created a feature shard, implementation, and four oracle files. Direct compiled execution passed 6/6 tests. The long-running host session was manually stopped while its collaborators were still finishing governance metadata; its generated `npm test` glob reported zero tests, so the post-init development case is recorded as partial rather than a full green campaign. +The original archive-feature session was manually aborted 0.8 seconds after it +started its final verification command. The preserved event log therefore shows +an external cancellation, not a hung Codex process. Its shell-expanded +`dist/tests/**/*.test.js` script happened to collect six tests on the original +macOS shell; the real defect was portability—quoted/literal globs fail on Node +20, and Windows shells do not expand them. The earlier “zero tests” wording was +not supported by the preserved output. + +Forensic replay exposed four independent post-init integration gaps: + +1. MCP used the project-pinned branch engine while shell `clad` resolved an + older global build with the same version string. The ignored project launcher + now serves MCP with no arguments and forwards explicit CLI arguments to that + exact engine. +2. Fresh onboarding capabilities and scenarios intentionally had no feature + links, but strict mode promoted their warnings and made the first `done` + unreachable. Empty links are informational before the shared eight-feature + maturity boundary; dangling links still block. +3. TypeScript gate detection substituted ESLint, Vitest, and Vitest coverage for + an explicit Node built-in test workflow. Project scripts are now authoritative; + undeclared lint/coverage gates skip honestly, and inferred npx tools run + offline so a missing optional tool cannot stall or become a false finding. +4. The first domain slice had no runnable entry point yet, but the advisory + deliverable warning was promoted by strict mode. That unresolved decision is + informational before the same maturity boundary and becomes a warning once + the project grows. + +The final fresh Codex CLI run (`019f6457-c9c6-7f51-880f-0a9d6f799ba7`) ended +naturally with exit 0. It first demonstrated that `node --test dist/tests` fails, +then replaced it with the shell-portable explicit target +`dist/tests/noteArchive.test.js`. Six tests passed under both the host Node and +Node 20.20.2. The project-local strict pre-push gate passed, independent review +passed, the attestation refreshed, and “Note archival” transitioned from +`in_progress` to `done`. Lint, coverage, formal oracle, and deliverable smoke +remained visible skips because the project had not configured those workflows. diff --git a/docs/setup.md b/docs/setup.md index 1a9de22a..be19392b 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -16,7 +16,7 @@ the detail behind them: where each host is wired, how the MCP server works, and | Antigravity (`agy`) | `.agents/skills/cladding-init` + `.agents/mcp_config.json` | | Cursor | `.cursor/skills/cladding-init` + `.cursor/mcp.json` + bootstrap rule | -The only machine-specific path lives in `.cladding/host/serve.cjs`, which is ignored project runtime state. Re-run setup on each developer machine. Host config files use the portable relative launcher path and preserve unrelated entries. +The only machine-specific path lives in `.cladding/host/serve.cjs`, which is ignored project runtime state. Re-run setup on each developer machine. Host config files use the portable relative launcher path and preserve unrelated entries. With no arguments the launcher starts MCP; with arguments it forwards a normal CLI command to that exact same engine. Generated project guidance therefore uses `node .cladding/host/serve.cjs check --strict` and similar shell calls when the launcher exists, preventing a different global installation from silently validating the project with another build. Codex loads `.codex/config.toml` only for a trusted Git repository. Accept Codex's normal project-trust prompt when opening the repository; this is a Codex security boundary and `clad setup` does not bypass or pre-approve it. diff --git a/docs/ssot-model.md b/docs/ssot-model.md index 587f8d0e..d660a5fa 100644 --- a/docs/ssot-model.md +++ b/docs/ssot-model.md @@ -187,13 +187,14 @@ Detector-enforced (today + this cycle): - `ARCHITECTURE_FROM_SPEC`: imports don't cross `forbidden_imports` boundaries - `REFERENCE_INTEGRITY`: scenario `features[]`, feature `depends_on[]`, `superseded_by` resolve (existence) - `HARNESS_INTEGRITY`: plugin manifest version sync, detector count -- **`CAPABILITIES_FEATURE_MAPPING` (NEW v0.3.45)**: capability `features[]` resolve to real features +- **`CAPABILITIES_FEATURE_MAPPING` (NEW v0.3.45)**: capability `features[]` resolve to real features; + unbound onboarding capabilities are informational below eight features and graduate to warnings once the project is grown - **`INVENTORY_DRIFT` (v0.4.x)**: the `inventory:` counts match the on-disk shard reality - **`PLANNED_BACKLOG` (v0.4.x)**: too many `planned`/`in_progress` features with no code on disk (the spec racing ahead of the code) - **`HOLLOW_GOVERNANCE` (v0.4.x, J1)**: a grown project with a present-but-empty `capabilities`/`architecture` design tier - **`DEPENDENCY_CYCLE` (v0.4.x, J3)**: `features[].depends_on` is acyclic (pairs with `REFERENCE_INTEGRITY`'s existence check) - **`AI_HINTS_FORBIDDEN_PATTERN` (v0.3.57)**: code avoids `ai_hints.forbidden_patterns` -- **`SCENARIO_COVERAGE` (v0.4.x, S-b)**: a grown project declares ≥1 scenario, no scenario binds an empty `features[]`, and no scenario under-states its coverage (its `flow` names a feature slug it doesn't bind) +- **`SCENARIO_COVERAGE` (v0.4.x, S-b)**: a grown project declares ≥1 scenario, no grown-project scenario binds an empty `features[]`, and no scenario under-states its coverage (its `flow` names a feature slug it doesn't bind); empty onboarding journeys stay informational below eight features - **`PROJECT_CONTEXT_DRIFT` (v0.4.x, S-c)**: a grown project's `project-context.md` is not still the unrefined init template Detector-enforced (deferred to future cycles): diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 13b11ae9..0e6129f8 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 pde=Object.create;var hA=Object.defineProperty;var mde=Object.getOwnPropertyDescriptor;var hde=Object.getOwnPropertyNames;var gde=Object.getPrototypeOf,yde=Object.prototype.hasOwnProperty;var He=(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ir=(t,e)=>{for(var r in e)hA(t,r,{get:e[r],enumerable:!0})},_de=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hde(e))!yde.call(t,i)&&i!==r&&hA(t,i,{get:()=>e[i],enumerable:!(n=mde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?pde(gde(t)):{},_de(e||!t||!t.__esModule?hA(r,"default",{value:t,enumerable:!0}):r,t));var Wd=v(yA=>{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}},gA=class extends oy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};yA.CommanderError=oy;yA.InvalidArgumentError=gA});var sy=v(bA=>{var{InvalidArgumentError:bde}=Wd(),_A=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 bde(`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 vde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}bA.Argument=_A;bA.humanReadableArgName=vde});var wA=v(SA=>{var{humanReadableArgName:Sde}=sy(),vA=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=>Sde(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 Vq(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)yA(t,r,{get:e[r],enumerable:!0})},xde=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of vde(e))!wde.call(t,i)&&i!==r&&yA(t,i,{get:()=>e[i],enumerable:!(n=bde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?_de(Sde(t)):{},xde(e||!t||!t.__esModule?yA(r,"default",{value:t,enumerable:!0}):r,t));var Kd=v(bA=>{var cy=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}},_A=class extends cy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};bA.CommanderError=cy;bA.InvalidArgumentError=_A});var ly=v(SA=>{var{InvalidArgumentError:$de}=Kd(),vA=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 $de(`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 kde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}SA.Argument=vA;SA.humanReadableArgName=kde});var $A=v(xA=>{var{humanReadableArgName:Ede}=ly(),wA=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=>Ede(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 Jq(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 Vq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}SA.Help=vA;SA.stripColor=Vq});var EA=v(kA=>{var{InvalidArgumentError:wde}=Wd(),xA=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=xde(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 wde(`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?Wq(this.name().replace(/^no-/,"")):Wq(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}},$A=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 Wq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function xde(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 Jq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}xA.Help=wA;xA.stripColor=Jq});var TA=v(AA=>{var{InvalidArgumentError:Ade}=Kd(),kA=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=Tde(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 Ade(`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?Yq(this.name().replace(/^no-/,"")):Yq(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}},EA=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 Yq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Tde(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=xA;kA.DualOptions=$A});var Jq=v(Kq=>{function $de(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 kde(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=$de(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}}AA.Option=kA;AA.DualOptions=EA});var Qq=v(Xq=>{function Ode(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 Rde(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=Ode(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]}?)`:""}Kq.suggestSimilar=kde});var e4=v(PA=>{var Ede=He("node:events").EventEmitter,AA=He("node:child_process"),so=He("node:path"),ay=He("node:fs"),Ue=He("node:process"),{Argument:Ade,humanReadableArgName:Tde}=sy(),{CommanderError:TA}=Wd(),{Help:Ode,stripColor:Rde}=wA(),{Option:Yq,DualOptions:Pde}=EA(),{suggestSimilar:Xq}=Jq(),OA=class t extends Ede{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>RA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>RA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Rde(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 Ode,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 Ade(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 TA(e,r,n)),Ue.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 Yq(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 Yq)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(ay.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]}?)`:""}Xq.suggestSimilar=Rde});var n4=v(CA=>{var Ide=He("node:events").EventEmitter,OA=He("node:child_process"),co=He("node:path"),uy=He("node:fs"),Ue=He("node:process"),{Argument:Pde,humanReadableArgName:Cde}=ly(),{CommanderError:RA}=Kd(),{Help:Dde,stripColor:Nde}=$A(),{Option:e4,DualOptions:jde}=TA(),{suggestSimilar:t4}=Qq(),IA=class t extends Ide{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>PA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>PA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Nde(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 Dde,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 Pde(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 RA(e,r,n)),Ue.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 e4(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 e4)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(uy.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=so.resolve(u,d);if(ay.existsSync(f))return f;if(i.includes(so.extname(d)))return;let p=i.find(m=>ay.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=ay.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=so.resolve(so.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=so.basename(this._scriptPath,so.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(so.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=Qq(Ue.execArgv).concat(r),c=AA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=AA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=Qq(Ue.execArgv).concat(r),c=AA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 TA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new TA(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=co.resolve(u,d);if(uy.existsSync(f))return f;if(i.includes(co.extname(d)))return;let p=i.find(m=>uy.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=uy.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=co.resolve(co.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=co.basename(this._scriptPath,co.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(co.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=r4(Ue.execArgv).concat(r),c=OA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=OA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=r4(Ue.execArgv).concat(r),c=OA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 RA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new RA(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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Pde(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=Xq(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=Xq(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=>Tde(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=so.basename(e,so.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(Ue.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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new jde(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=t4(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=t4(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=>Cde(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=co.basename(e,co.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(Ue.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 Qq(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 RA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}PA.Command=OA;PA.useColor=RA});var i4=v(xn=>{var{Argument:t4}=sy(),{Command:IA}=e4(),{CommanderError:Ide,InvalidArgumentError:r4}=Wd(),{Help:Cde}=wA(),{Option:n4}=EA();xn.program=new IA;xn.createCommand=t=>new IA(t);xn.createOption=(t,e)=>new n4(t,e);xn.createArgument=(t,e)=>new t4(t,e);xn.Command=IA;xn.Option=n4;xn.Argument=t4;xn.Help=Cde;xn.CommanderError=Ide;xn.InvalidArgumentError=r4;xn.InvalidOptionArgumentError=r4});var Ce=v(Xt=>{"use strict";var DA=Symbol.for("yaml.alias"),c4=Symbol.for("yaml.document"),cy=Symbol.for("yaml.map"),l4=Symbol.for("yaml.pair"),NA=Symbol.for("yaml.scalar"),ly=Symbol.for("yaml.seq"),ao=Symbol.for("yaml.node.type"),Lde=t=>!!t&&typeof t=="object"&&t[ao]===DA,zde=t=>!!t&&typeof t=="object"&&t[ao]===c4,Ude=t=>!!t&&typeof t=="object"&&t[ao]===cy,qde=t=>!!t&&typeof t=="object"&&t[ao]===l4,u4=t=>!!t&&typeof t=="object"&&t[ao]===NA,Bde=t=>!!t&&typeof t=="object"&&t[ao]===ly;function d4(t){if(t&&typeof t=="object")switch(t[ao]){case cy:case ly:return!0}return!1}function Hde(t){if(t&&typeof t=="object")switch(t[ao]){case DA:case cy:case NA:case ly:return!0}return!1}var Gde=t=>(u4(t)||d4(t))&&!!t.anchor;Xt.ALIAS=DA;Xt.DOC=c4;Xt.MAP=cy;Xt.NODE_TYPE=ao;Xt.PAIR=l4;Xt.SCALAR=NA;Xt.SEQ=ly;Xt.hasAnchor=Gde;Xt.isAlias=Lde;Xt.isCollection=d4;Xt.isDocument=zde;Xt.isMap=Ude;Xt.isNode=Hde;Xt.isPair=qde;Xt.isScalar=u4;Xt.isSeq=Bde});var Kd=v(jA=>{"use strict";var zt=Ce(),Cr=Symbol("break visit"),f4=Symbol("skip children"),xi=Symbol("remove node");function uy(t,e){let r=p4(e);zt.isDocument(t)?Hc(null,t.contents,r,Object.freeze([t]))===xi&&(t.contents=null):Hc(null,t,r,Object.freeze([]))}uy.BREAK=Cr;uy.SKIP=f4;uy.REMOVE=xi;function Hc(t,e,r,n){let i=m4(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return h4(t,n,i),Hc(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var g4=Ce(),Zde=Kd(),Vde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Wde=t=>t.replace(/[!,[\]{}]/g,e=>Vde[e]),Jd=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+Wde(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&&g4.isNode(e.contents)){let o={};Zde.visit(e.contents,(s,a)=>{g4.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(` -`)}};Jd.defaultYaml={explicit:!1,version:"1.2"};Jd.defaultTags={"!!":"tag:yaml.org,2002:"};y4.Directives=Jd});var fy=v(Yd=>{"use strict";var _4=Ce(),Kde=Kd();function Jde(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 b4(t){let e=new Set;return Kde.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function v4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Yde(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=b4(t));let s=v4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(_4.isScalar(s.node)||_4.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}}Yd.anchorIsValid=Jde;Yd.anchorNames=b4;Yd.createNodeAnchors=Yde;Yd.findNewAnchor=v4});var FA=v(S4=>{"use strict";function Xd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Xde=Ce();function w4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>w4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Xde.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}x4.toJS=w4});var py=v(k4=>{"use strict";var Qde=FA(),$4=Ce(),efe=Bo(),LA=class{constructor(e){Object.defineProperty(this,$4.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(!$4.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=efe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Qde.applyReviver(o,{"":a},"",a):a}};k4.NodeBase=LA});var Qd=v(E4=>{"use strict";var tfe=fy(),rfe=Kd(),Zc=Ce(),nfe=py(),ife=Bo(),zA=class extends nfe.NodeBase{constructor(e){super(Zc.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=[],rfe.visit(e,{Node:(o,s)=>{(Zc.isAlias(s)||Zc.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||(ife.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(tfe.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(Zc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Zc.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(Zc.isPair(e)){let n=my(t,e.key,r),i=my(t,e.value,r);return Math.max(n,i)}return 1}E4.Alias=zA});var Ct=v(UA=>{"use strict";var ofe=Ce(),sfe=py(),afe=Bo(),cfe=t=>!t||typeof t!="function"&&typeof t!="object",Ho=class extends sfe.NodeBase{constructor(e){super(ofe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:afe.toJS(this.value,e,r)}toString(){return String(this.value)}};Ho.BLOCK_FOLDED="BLOCK_FOLDED";Ho.BLOCK_LITERAL="BLOCK_LITERAL";Ho.PLAIN="PLAIN";Ho.QUOTE_DOUBLE="QUOTE_DOUBLE";Ho.QUOTE_SINGLE="QUOTE_SINGLE";UA.Scalar=Ho;UA.isScalarValue=cfe});var ef=v(T4=>{"use strict";var lfe=Qd(),ca=Ce(),A4=Ct(),ufe="tag:yaml.org,2002:";function dfe(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 ffe(t,e,r){if(ca.isDocument(t)&&(t=t.contents),ca.isNode(t))return t;if(ca.isPair(t)){let d=r.schema[ca.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 lfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=ufe+e.slice(2));let l=dfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new A4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ca.MAP]:Symbol.iterator in Object(t)?s[ca.SEQ]:s[ca.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 A4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}T4.createNode=ffe});var gy=v(hy=>{"use strict";var pfe=ef(),$i=Ce(),mfe=py();function qA(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 pfe.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 O4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,BA=class extends mfe.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=>$i.isNode(n)||$i.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(O4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if($i.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,qA(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($i.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&&$i.isScalar(o)?o.value:o:$i.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!$i.isPair(r))return!1;let n=r.value;return n==null||e&&$i.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 $i.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($i.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,qA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};hy.Collection=BA;hy.collectionFromPath=qA;hy.isEmptyPath=O4});var tf=v(yy=>{"use strict";var hfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function HA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var gfe=(t,e,r)=>t.endsWith(` -`)?HA(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 r4(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 PA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}CA.Command=IA;CA.useColor=PA});var a4=v(xn=>{var{Argument:i4}=ly(),{Command:DA}=n4(),{CommanderError:Mde,InvalidArgumentError:o4}=Kd(),{Help:Fde}=$A(),{Option:s4}=TA();xn.program=new DA;xn.createCommand=t=>new DA(t);xn.createOption=(t,e)=>new s4(t,e);xn.createArgument=(t,e)=>new i4(t,e);xn.Command=DA;xn.Option=s4;xn.Argument=i4;xn.Help=Fde;xn.CommanderError=Mde;xn.InvalidArgumentError=o4;xn.InvalidOptionArgumentError=o4});var Ce=v(Xt=>{"use strict";var jA=Symbol.for("yaml.alias"),d4=Symbol.for("yaml.document"),dy=Symbol.for("yaml.map"),f4=Symbol.for("yaml.pair"),MA=Symbol.for("yaml.scalar"),fy=Symbol.for("yaml.seq"),lo=Symbol.for("yaml.node.type"),Hde=t=>!!t&&typeof t=="object"&&t[lo]===jA,Gde=t=>!!t&&typeof t=="object"&&t[lo]===d4,Zde=t=>!!t&&typeof t=="object"&&t[lo]===dy,Vde=t=>!!t&&typeof t=="object"&&t[lo]===f4,p4=t=>!!t&&typeof t=="object"&&t[lo]===MA,Wde=t=>!!t&&typeof t=="object"&&t[lo]===fy;function m4(t){if(t&&typeof t=="object")switch(t[lo]){case dy:case fy:return!0}return!1}function Kde(t){if(t&&typeof t=="object")switch(t[lo]){case jA:case dy:case MA:case fy:return!0}return!1}var Jde=t=>(p4(t)||m4(t))&&!!t.anchor;Xt.ALIAS=jA;Xt.DOC=d4;Xt.MAP=dy;Xt.NODE_TYPE=lo;Xt.PAIR=f4;Xt.SCALAR=MA;Xt.SEQ=fy;Xt.hasAnchor=Jde;Xt.isAlias=Hde;Xt.isCollection=m4;Xt.isDocument=Gde;Xt.isMap=Zde;Xt.isNode=Kde;Xt.isPair=Vde;Xt.isScalar=p4;Xt.isSeq=Wde});var Jd=v(FA=>{"use strict";var zt=Ce(),Cr=Symbol("break visit"),h4=Symbol("skip children"),xi=Symbol("remove node");function py(t,e){let r=g4(e);zt.isDocument(t)?Gc(null,t.contents,r,Object.freeze([t]))===xi&&(t.contents=null):Gc(null,t,r,Object.freeze([]))}py.BREAK=Cr;py.SKIP=h4;py.REMOVE=xi;function Gc(t,e,r,n){let i=y4(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return _4(t,n,i),Gc(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var b4=Ce(),Yde=Jd(),Xde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Qde=t=>t.replace(/[!,[\]{}]/g,e=>Xde[e]),Yd=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+Qde(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&&b4.isNode(e.contents)){let o={};Yde.visit(e.contents,(s,a)=>{b4.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(` +`)}};Yd.defaultYaml={explicit:!1,version:"1.2"};Yd.defaultTags={"!!":"tag:yaml.org,2002:"};v4.Directives=Yd});var hy=v(Xd=>{"use strict";var S4=Ce(),efe=Jd();function tfe(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 w4(t){let e=new Set;return efe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function x4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function rfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=w4(t));let s=x4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(S4.isScalar(s.node)||S4.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}}Xd.anchorIsValid=tfe;Xd.anchorNames=w4;Xd.createNodeAnchors=rfe;Xd.findNewAnchor=x4});var zA=v($4=>{"use strict";function Qd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var nfe=Ce();function k4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>k4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!nfe.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}E4.toJS=k4});var gy=v(T4=>{"use strict";var ife=zA(),A4=Ce(),ofe=Ho(),UA=class{constructor(e){Object.defineProperty(this,A4.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(!A4.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=ofe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?ife.applyReviver(o,{"":a},"",a):a}};T4.NodeBase=UA});var ef=v(O4=>{"use strict";var sfe=hy(),afe=Jd(),Vc=Ce(),cfe=gy(),lfe=Ho(),qA=class extends cfe.NodeBase{constructor(e){super(Vc.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=[],afe.visit(e,{Node:(o,s)=>{(Vc.isAlias(s)||Vc.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||(lfe.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=yy(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(sfe.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 yy(t,e,r){if(Vc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Vc.isCollection(e)){let n=0;for(let i of e.items){let o=yy(t,i,r);o>n&&(n=o)}return n}else if(Vc.isPair(e)){let n=yy(t,e.key,r),i=yy(t,e.value,r);return Math.max(n,i)}return 1}O4.Alias=qA});var Ct=v(BA=>{"use strict";var ufe=Ce(),dfe=gy(),ffe=Ho(),pfe=t=>!t||typeof t!="function"&&typeof t!="object",Go=class extends dfe.NodeBase{constructor(e){super(ufe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:ffe.toJS(this.value,e,r)}toString(){return String(this.value)}};Go.BLOCK_FOLDED="BLOCK_FOLDED";Go.BLOCK_LITERAL="BLOCK_LITERAL";Go.PLAIN="PLAIN";Go.QUOTE_DOUBLE="QUOTE_DOUBLE";Go.QUOTE_SINGLE="QUOTE_SINGLE";BA.Scalar=Go;BA.isScalarValue=pfe});var tf=v(I4=>{"use strict";var mfe=ef(),ua=Ce(),R4=Ct(),hfe="tag:yaml.org,2002:";function gfe(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 yfe(t,e,r){if(ua.isDocument(t)&&(t=t.contents),ua.isNode(t))return t;if(ua.isPair(t)){let d=r.schema[ua.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 mfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=hfe+e.slice(2));let l=gfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new R4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ua.MAP]:Symbol.iterator in Object(t)?s[ua.SEQ]:s[ua.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 R4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}I4.createNode=yfe});var by=v(_y=>{"use strict";var _fe=tf(),$i=Ce(),bfe=gy();function HA(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 _fe.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 P4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,GA=class extends bfe.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=>$i.isNode(n)||$i.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(P4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if($i.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,HA(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($i.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&&$i.isScalar(o)?o.value:o:$i.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!$i.isPair(r))return!1;let n=r.value;return n==null||e&&$i.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 $i.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($i.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,HA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};_y.Collection=GA;_y.collectionFromPath=HA;_y.isEmptyPath=P4});var rf=v(vy=>{"use strict";var vfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function ZA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Sfe=(t,e,r)=>t.endsWith(` +`)?ZA(r,e):r.includes(` `)?` -`+HA(r,e):(t.endsWith(" ")?"":" ")+r;yy.indentComment=HA;yy.lineComment=gfe;yy.stringifyComment=hfe});var P4=v(rf=>{"use strict";var yfe="flow",GA="block",_y="quoted";function _fe(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===GA&&(h=R4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===_y&&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===GA&&(h=R4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+ZA(r,e):(t.endsWith(" ")?"":" ")+r;vy.indentComment=ZA;vy.lineComment=Sfe;vy.stringifyComment=vfe});var D4=v(nf=>{"use strict";var wfe="flow",VA="block",Sy="quoted";function xfe(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===VA&&(h=C4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Sy&&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===VA&&(h=C4(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===_y){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 Vn=Ct(),Go=P4(),vy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Sy=t=>/^(%|---|\.\.\.)/m.test(t);function bfe(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 nf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Sy(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===Sy){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 Vn=Ct(),Zo=D4(),xy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),$y=t=>/^(%|---|\.\.\.)/m.test(t);function $fe(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 of(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||($y(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(VA,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{O=!0});let A=Go.foldFlowLines(`${_}${w}${p}`,l,Go.FOLD_BLOCK,T);if(!O)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,T=xy(n,!0);s!=="folded"&&e!==Vn.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{O=!0});let A=Zo.foldFlowLines(`${_}${w}${p}`,l,Zo.FOLD_BLOCK,T);if(!O)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function vfe(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 Vc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?Vc(o,e):by(t,e,r,n);if(!a&&!u&&i!==Vn.Scalar.PLAIN&&o.includes(` -`))return by(t,e,r,n);if(Sy(o)){if(c==="")return e.forceBlockIndent=!0,by(t,e,r,n);if(a&&c===l)return Vc(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 Vc(o,e)}return a?d:Go.foldFlowLines(d,c,Go.FOLD_FLOW,vy(e,!1))}function Sfe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Vc(s.value,e):by(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return nf(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return ZA(s.value,e);case Vn.Scalar.PLAIN:return vfe(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}I4.stringifyString=Sfe});var sf=v(WA=>{"use strict";var wfe=fy(),Zo=Ce(),xfe=tf(),$fe=of();function kfe(t,e){let r=Object.assign({blockQuote:!0,commentString:xfe.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 Efe(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(Zo.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 Afe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Zo.isScalar(t)||Zo.isCollection(t))&&t.anchor;o&&wfe.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 Tfe(t,e,r,n){if(Zo.isPair(t))return t.toString(e,r,n);if(Zo.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=Zo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Efe(e.doc.schema.tags,o));let s=Afe(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):Zo.isScalar(o)?$fe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Zo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}WA.createStringifyContext=kfe;WA.stringify=Tfe});var j4=v(N4=>{"use strict";var co=Ce(),C4=Ct(),D4=sf(),af=tf();function Ofe({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=co.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(co.isCollection(t)||!co.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||co.isCollection(t)||(co.isScalar(t)?t.type===C4.Scalar.BLOCK_FOLDED||t.type===C4.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=D4.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+=af.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=af.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=af.lineComment(g,r.indent,l(f))));let b,_,S;co.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&&co.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&co.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=D4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +${l}${_}${r}${p}`}function kfe(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 Wc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?Wc(o,e):wy(t,e,r,n);if(!a&&!u&&i!==Vn.Scalar.PLAIN&&o.includes(` +`))return wy(t,e,r,n);if($y(o)){if(c==="")return e.forceBlockIndent=!0,wy(t,e,r,n);if(a&&c===l)return Wc(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 Wc(o,e)}return a?d:Zo.foldFlowLines(d,c,Zo.FOLD_FLOW,xy(e,!1))}function Efe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Wc(s.value,e):wy(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return of(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return WA(s.value,e);case Vn.Scalar.PLAIN:return kfe(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}N4.stringifyString=Efe});var af=v(JA=>{"use strict";var Afe=hy(),Vo=Ce(),Tfe=rf(),Ofe=sf();function Rfe(t,e){let r=Object.assign({blockQuote:!0,commentString:Tfe.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 Ife(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(Vo.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 Pfe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Vo.isScalar(t)||Vo.isCollection(t))&&t.anchor;o&&Afe.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 Cfe(t,e,r,n){if(Vo.isPair(t))return t.toString(e,r,n);if(Vo.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=Vo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Ife(e.doc.schema.tags,o));let s=Pfe(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):Vo.isScalar(o)?Ofe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Vo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}JA.createStringifyContext=Rfe;JA.stringify=Cfe});var L4=v(F4=>{"use strict";var uo=Ce(),j4=Ct(),M4=af(),cf=rf();function Dfe({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=uo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(uo.isCollection(t)||!uo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||uo.isCollection(t)||(uo.isScalar(t)?t.type===j4.Scalar.BLOCK_FOLDED||t.type===j4.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=M4.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+=cf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=cf.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=cf.lineComment(g,r.indent,l(f))));let b,_,S;uo.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&&uo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&uo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=M4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let T=l(_);O+=` -${af.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` +${cf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` `&&S&&(O=` `):O+=` -${r.indent}`}else if(!p&&co.isCollection(e)){let T=w[0],A=w.indexOf(` +${r.indent}`}else if(!p&&uo.isCollection(e)){let T=w[0],A=w.indexOf(` `),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let se=!1;if(D&&(T==="&"||T==="!")){let Y=w.indexOf(" ");T==="&"&&Y!==-1&&Y{"use strict";var M4=He("process");function Rfe(t,...e){t==="debug"&&console.log(...e)}function Pfe(t,e){(t==="debug"||t==="warn")&&(typeof M4.emitWarning=="function"?M4.emitWarning(e):console.warn(e))}KA.debug=Rfe;KA.warn=Pfe});var Ey=v(ky=>{"use strict";var $y=Ce(),F4=Ct(),wy="<<",xy={identify:t=>t===wy||typeof t=="symbol"&&t.description===wy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new F4.Scalar(Symbol(wy)),{addToJSMap:L4}),stringify:()=>wy},Ife=(t,e)=>(xy.identify(e)||$y.isScalar(e)&&(!e.type||e.type===F4.Scalar.PLAIN)&&xy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===xy.tag&&r.default);function L4(t,e,r){let n=z4(t,r);if($y.isSeq(n))for(let i of n.items)YA(t,e,i);else if(Array.isArray(n))for(let i of n)YA(t,e,i);else YA(t,e,n)}function YA(t,e,r){let n=z4(t,r);if(!$y.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 z4(t,e){return t&&$y.isAlias(e)?e.resolve(t.doc,t):e}ky.addMergeToJSMap=L4;ky.isMergeKey=Ife;ky.merge=xy});var QA=v(B4=>{"use strict";var Cfe=JA(),U4=Ey(),Dfe=sf(),q4=Ce(),XA=Bo();function Nfe(t,e,{key:r,value:n}){if(q4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(U4.isMergeKey(t,r))U4.addMergeToJSMap(t,e,n);else{let i=XA.toJS(r,"",t);if(e instanceof Map)e.set(i,XA.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=jfe(r,i,t),s=XA.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 jfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(q4.isNode(t)&&r?.doc){let n=Dfe.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)+'..."'),Cfe.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)}B4.addPairToJSMap=Nfe});var Vo=v(eT=>{"use strict";var H4=ef(),Mfe=j4(),Ffe=QA(),Ay=Ce();function Lfe(t,e,r){let n=H4.createNode(t,void 0,r),i=H4.createNode(e,void 0,r);return new Ty(n,i)}var Ty=class t{constructor(e,r=null){Object.defineProperty(this,Ay.NODE_TYPE,{value:Ay.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Ay.isNode(r)&&(r=r.clone(e)),Ay.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Ffe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Mfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};eT.Pair=Ty;eT.createPair=Lfe});var tT=v(Z4=>{"use strict";var la=Ce(),G4=sf(),Oy=tf();function zfe(t,e,r){return(e.inFlow??t.flow?qfe:Ufe)(t,e,r)}function Ufe({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+=Oy.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 z4=He("process");function Nfe(t,...e){t==="debug"&&console.log(...e)}function jfe(t,e){(t==="debug"||t==="warn")&&(typeof z4.emitWarning=="function"?z4.emitWarning(e):console.warn(e))}YA.debug=Nfe;YA.warn=jfe});var Oy=v(Ty=>{"use strict";var Ay=Ce(),U4=Ct(),ky="<<",Ey={identify:t=>t===ky||typeof t=="symbol"&&t.description===ky,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new U4.Scalar(Symbol(ky)),{addToJSMap:q4}),stringify:()=>ky},Mfe=(t,e)=>(Ey.identify(e)||Ay.isScalar(e)&&(!e.type||e.type===U4.Scalar.PLAIN)&&Ey.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Ey.tag&&r.default);function q4(t,e,r){let n=B4(t,r);if(Ay.isSeq(n))for(let i of n.items)QA(t,e,i);else if(Array.isArray(n))for(let i of n)QA(t,e,i);else QA(t,e,n)}function QA(t,e,r){let n=B4(t,r);if(!Ay.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 B4(t,e){return t&&Ay.isAlias(e)?e.resolve(t.doc,t):e}Ty.addMergeToJSMap=q4;Ty.isMergeKey=Mfe;Ty.merge=Ey});var tT=v(Z4=>{"use strict";var Ffe=XA(),H4=Oy(),Lfe=af(),G4=Ce(),eT=Ho();function zfe(t,e,{key:r,value:n}){if(G4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(H4.isMergeKey(t,r))H4.addMergeToJSMap(t,e,n);else{let i=eT.toJS(r,"",t);if(e instanceof Map)e.set(i,eT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Ufe(r,i,t),s=eT.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 Ufe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(G4.isNode(t)&&r?.doc){let n=Lfe.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)+'..."'),Ffe.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)}Z4.addPairToJSMap=zfe});var Wo=v(rT=>{"use strict";var V4=tf(),qfe=L4(),Bfe=tT(),Ry=Ce();function Hfe(t,e,r){let n=V4.createNode(t,void 0,r),i=V4.createNode(e,void 0,r);return new Iy(n,i)}var Iy=class t{constructor(e,r=null){Object.defineProperty(this,Ry.NODE_TYPE,{value:Ry.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Ry.isNode(r)&&(r=r.clone(e)),Ry.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Bfe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?qfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};rT.Pair=Iy;rT.createPair=Hfe});var nT=v(K4=>{"use strict";var da=Ce(),W4=af(),Py=rf();function Gfe(t,e,r){return(e.inFlow??t.flow?Vfe:Zfe)(t,e,r)}function Zfe({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+=Py.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+=Oy.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?` +`+Py.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function Vfe({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+=Py.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 Ry({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Oy.indentComment(e(n),t);r.push(o.trimStart())}}Z4.stringifyCollection=zfe});var Ko=v(nT=>{"use strict";var Bfe=tT(),Hfe=QA(),Gfe=gy(),Wo=Ce(),Py=Vo(),Zfe=Ct();function cf(t,e){let r=Wo.isScalar(e)?e.value:e;for(let n of t)if(Wo.isPair(n)&&(n.key===e||n.key===r||Wo.isScalar(n.key)&&n.key.value===r))return n}var rT=class extends Gfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Wo.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(Py.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;Wo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Py.Pair(e,e?.value):n=new Py.Pair(e.key,e.value);let i=cf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Wo.isScalar(i.value)&&Zfe.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=cf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=cf(this.items,e)?.value;return(!r&&Wo.isScalar(i)?i.value:i)??void 0}has(e){return!!cf(this.items,e)}set(e,r){this.add(new Py.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)Hfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Wo.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})),Bfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};nT.YAMLMap=rT;nT.findPair=cf});var Wc=v(W4=>{"use strict";var Vfe=Ce(),V4=Ko(),Wfe={collection:"map",default:!0,nodeClass:V4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Vfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>V4.YAMLMap.from(t,e,r)};W4.map=Wfe});var Jo=v(K4=>{"use strict";var Kfe=ef(),Jfe=tT(),Yfe=gy(),Cy=Ce(),Xfe=Ct(),Qfe=Bo(),iT=class extends Yfe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Cy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Iy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Iy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Cy.isScalar(i)?i.value:i}has(e){let r=Iy(e);return typeof r=="number"&&r=0?e:null}K4.YAMLSeq=iT});var Kc=v(Y4=>{"use strict";var epe=Ce(),J4=Jo(),tpe={collection:"seq",default:!0,nodeClass:J4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return epe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>J4.YAMLSeq.from(t,e,r)};Y4.seq=tpe});var lf=v(X4=>{"use strict";var rpe=of(),npe={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),rpe.stringifyString(t,e,r,n)}};X4.string=npe});var Dy=v(t6=>{"use strict";var Q4=Ct(),e6={identify:t=>t==null,createNode:()=>new Q4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Q4.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&e6.test.test(t)?t:e.options.nullStr};t6.nullTag=e6});var oT=v(n6=>{"use strict";var ipe=Ct(),r6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new ipe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&r6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};n6.boolTag=r6});var Jc=v(i6=>{"use strict";function ope({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}i6.stringifyNumber=ope});var aT=v(Ny=>{"use strict";var spe=Ct(),sT=Jc(),ape={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:sT.stringifyNumber},cpe={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():sT.stringifyNumber(t)}},lpe={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 spe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:sT.stringifyNumber};Ny.float=lpe;Ny.floatExp=cpe;Ny.floatNaN=ape});var lT=v(My=>{"use strict";var o6=Jc(),jy=t=>typeof t=="bigint"||Number.isInteger(t),cT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function s6(t,e,r){let{value:n}=t;return jy(n)&&n>=0?r+n.toString(e):o6.stringifyNumber(t)}var upe={identify:t=>jy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>cT(t,2,8,r),stringify:t=>s6(t,8,"0o")},dpe={identify:jy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>cT(t,0,10,r),stringify:o6.stringifyNumber},fpe={identify:t=>jy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>cT(t,2,16,r),stringify:t=>s6(t,16,"0x")};My.int=dpe;My.intHex=fpe;My.intOct=upe});var c6=v(a6=>{"use strict";var ppe=Wc(),mpe=Dy(),hpe=Kc(),gpe=lf(),ype=oT(),uT=aT(),dT=lT(),_pe=[ppe.map,hpe.seq,gpe.string,mpe.nullTag,ype.boolTag,dT.intOct,dT.int,dT.intHex,uT.floatNaN,uT.floatExp,uT.float];a6.schema=_pe});var d6=v(u6=>{"use strict";var bpe=Ct(),vpe=Wc(),Spe=Kc();function l6(t){return typeof t=="bigint"||Number.isInteger(t)}var Fy=({value:t})=>JSON.stringify(t),wpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Fy},{identify:t=>t==null,createNode:()=>new bpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Fy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Fy},{identify:l6,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})=>l6(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:Fy}],xpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},$pe=[vpe.map,Spe.seq].concat(wpe,xpe);u6.schema=$pe});var pT=v(f6=>{"use strict";var uf=He("buffer"),fT=Ct(),kpe=of(),Epe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof uf.Buffer=="function")return uf.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 Ly=Ce(),mT=Vo(),Ape=Ct(),Tpe=Jo();function p6(t,e){if(Ly.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 Ape.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Cy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Py.indentComment(e(n),t);r.push(o.trimStart())}}K4.stringifyCollection=Gfe});var Jo=v(oT=>{"use strict";var Wfe=nT(),Kfe=tT(),Jfe=by(),Ko=Ce(),Dy=Wo(),Yfe=Ct();function lf(t,e){let r=Ko.isScalar(e)?e.value:e;for(let n of t)if(Ko.isPair(n)&&(n.key===e||n.key===r||Ko.isScalar(n.key)&&n.key.value===r))return n}var iT=class extends Jfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ko.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(Dy.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;Ko.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Dy.Pair(e,e?.value):n=new Dy.Pair(e.key,e.value);let i=lf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Ko.isScalar(i.value)&&Yfe.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=lf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=lf(this.items,e)?.value;return(!r&&Ko.isScalar(i)?i.value:i)??void 0}has(e){return!!lf(this.items,e)}set(e,r){this.add(new Dy.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)Kfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Ko.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})),Wfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};oT.YAMLMap=iT;oT.findPair=lf});var Kc=v(Y4=>{"use strict";var Xfe=Ce(),J4=Jo(),Qfe={collection:"map",default:!0,nodeClass:J4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Xfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>J4.YAMLMap.from(t,e,r)};Y4.map=Qfe});var Yo=v(X4=>{"use strict";var epe=tf(),tpe=nT(),rpe=by(),jy=Ce(),npe=Ct(),ipe=Ho(),sT=class extends rpe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(jy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Ny(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Ny(e);if(typeof n!="number")return;let i=this.items[n];return!r&&jy.isScalar(i)?i.value:i}has(e){let r=Ny(e);return typeof r=="number"&&r=0?e:null}X4.YAMLSeq=sT});var Jc=v(e6=>{"use strict";var ope=Ce(),Q4=Yo(),spe={collection:"seq",default:!0,nodeClass:Q4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return ope.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>Q4.YAMLSeq.from(t,e,r)};e6.seq=spe});var uf=v(t6=>{"use strict";var ape=sf(),cpe={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),ape.stringifyString(t,e,r,n)}};t6.string=cpe});var My=v(i6=>{"use strict";var r6=Ct(),n6={identify:t=>t==null,createNode:()=>new r6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new r6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&n6.test.test(t)?t:e.options.nullStr};i6.nullTag=n6});var aT=v(s6=>{"use strict";var lpe=Ct(),o6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new lpe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&o6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};s6.boolTag=o6});var Yc=v(a6=>{"use strict";function upe({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}a6.stringifyNumber=upe});var lT=v(Fy=>{"use strict";var dpe=Ct(),cT=Yc(),fpe={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:cT.stringifyNumber},ppe={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():cT.stringifyNumber(t)}},mpe={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 dpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:cT.stringifyNumber};Fy.float=mpe;Fy.floatExp=ppe;Fy.floatNaN=fpe});var dT=v(zy=>{"use strict";var c6=Yc(),Ly=t=>typeof t=="bigint"||Number.isInteger(t),uT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function l6(t,e,r){let{value:n}=t;return Ly(n)&&n>=0?r+n.toString(e):c6.stringifyNumber(t)}var hpe={identify:t=>Ly(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>uT(t,2,8,r),stringify:t=>l6(t,8,"0o")},gpe={identify:Ly,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>uT(t,0,10,r),stringify:c6.stringifyNumber},ype={identify:t=>Ly(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>uT(t,2,16,r),stringify:t=>l6(t,16,"0x")};zy.int=gpe;zy.intHex=ype;zy.intOct=hpe});var d6=v(u6=>{"use strict";var _pe=Kc(),bpe=My(),vpe=Jc(),Spe=uf(),wpe=aT(),fT=lT(),pT=dT(),xpe=[_pe.map,vpe.seq,Spe.string,bpe.nullTag,wpe.boolTag,pT.intOct,pT.int,pT.intHex,fT.floatNaN,fT.floatExp,fT.float];u6.schema=xpe});var m6=v(p6=>{"use strict";var $pe=Ct(),kpe=Kc(),Epe=Jc();function f6(t){return typeof t=="bigint"||Number.isInteger(t)}var Uy=({value:t})=>JSON.stringify(t),Ape=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Uy},{identify:t=>t==null,createNode:()=>new $pe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Uy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Uy},{identify:f6,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})=>f6(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:Uy}],Tpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Ope=[kpe.map,Epe.seq].concat(Ape,Tpe);p6.schema=Ope});var hT=v(h6=>{"use strict";var df=He("buffer"),mT=Ct(),Rpe=sf(),Ipe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof df.Buffer=="function")return df.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 qy=Ce(),gT=Wo(),Ppe=Ct(),Cpe=Yo();function g6(t,e){if(qy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new gT.Pair(new Ppe.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]=Ly.isPair(n)?n:new mT.Pair(n)}}else e("Expected a sequence for this tag");return t}function m6(t,e,r){let{replacer:n}=r,i=new Tpe.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 Ope={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:p6,createNode:m6};zy.createPairs=m6;zy.pairs=Ope;zy.resolvePairs=p6});var yT=v(gT=>{"use strict";var h6=Ce(),hT=Bo(),df=Ko(),Rpe=Jo(),g6=Uy(),ua=class t extends Rpe.YAMLSeq{constructor(){super(),this.add=df.YAMLMap.prototype.add.bind(this),this.delete=df.YAMLMap.prototype.delete.bind(this),this.get=df.YAMLMap.prototype.get.bind(this),this.has=df.YAMLMap.prototype.has.bind(this),this.set=df.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(h6.isPair(i)?(o=hT.toJS(i.key,"",r),s=hT.toJS(i.value,o,r)):o=hT.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=g6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ua.tag="tag:yaml.org,2002:omap";var Ppe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ua,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=g6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)h6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ua,r)},createNode:(t,e,r)=>ua.from(t,e,r)};gT.YAMLOMap=ua;gT.omap=Ppe});var S6=v(_T=>{"use strict";var y6=Ct();function _6({value:t,source:e},r){return e&&(t?b6:v6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var b6={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 y6.Scalar(!0),stringify:_6},v6={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 y6.Scalar(!1),stringify:_6};_T.falseTag=v6;_T.trueTag=b6});var w6=v(qy=>{"use strict";var Ipe=Ct(),bT=Jc(),Cpe={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:bT.stringifyNumber},Dpe={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():bT.stringifyNumber(t)}},Npe={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 Ipe.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:bT.stringifyNumber};qy.float=Npe;qy.floatExp=Dpe;qy.floatNaN=Cpe});var $6=v(pf=>{"use strict";var x6=Jc(),ff=t=>typeof t=="bigint"||Number.isInteger(t);function By(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 vT(t,e,r){let{value:n}=t;if(ff(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return x6.stringifyNumber(t)}var jpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>By(t,2,2,r),stringify:t=>vT(t,2,"0b")},Mpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>By(t,1,8,r),stringify:t=>vT(t,8,"0")},Fpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>By(t,0,10,r),stringify:x6.stringifyNumber},Lpe={identify:ff,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>By(t,2,16,r),stringify:t=>vT(t,16,"0x")};pf.int=Fpe;pf.intBin=jpe;pf.intHex=Lpe;pf.intOct=Mpe});var wT=v(ST=>{"use strict";var Zy=Ce(),Hy=Vo(),Gy=Ko(),da=class t extends Gy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Zy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Hy.Pair(e.key,null):r=new Hy.Pair(e,null),Gy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Gy.findPair(this.items,e);return!r&&Zy.isPair(n)?Zy.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=Gy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Hy.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(Hy.createPair(s,null,n));return o}};da.tag="tag:yaml.org,2002:set";var zpe={collection:"map",identify:t=>t instanceof Set,nodeClass:da,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>da.from(t,e,r),resolve(t,e){if(Zy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new da,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};ST.YAMLSet=da;ST.set=zpe});var $T=v(Vy=>{"use strict";var Upe=Jc();function xT(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 k6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Upe.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 qpe={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})=>xT(t,r),stringify:k6},Bpe={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=>xT(t,!1),stringify:k6},E6={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(E6.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=xT(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$/,"")??""};Vy.floatTime=Bpe;Vy.intTime=qpe;Vy.timestamp=E6});var O6=v(T6=>{"use strict";var Hpe=Wc(),Gpe=Dy(),Zpe=Kc(),Vpe=lf(),Wpe=pT(),A6=S6(),kT=w6(),Wy=$6(),Kpe=Ey(),Jpe=yT(),Ype=Uy(),Xpe=wT(),ET=$T(),Qpe=[Hpe.map,Zpe.seq,Vpe.string,Gpe.nullTag,A6.trueTag,A6.falseTag,Wy.intBin,Wy.intOct,Wy.int,Wy.intHex,kT.floatNaN,kT.floatExp,kT.float,Wpe.binary,Kpe.merge,Jpe.omap,Ype.pairs,Xpe.set,ET.intTime,ET.floatTime,ET.timestamp];T6.schema=Qpe});var L6=v(OT=>{"use strict";var C6=Wc(),eme=Dy(),D6=Kc(),tme=lf(),rme=oT(),AT=aT(),TT=lT(),nme=c6(),ime=d6(),N6=pT(),mf=Ey(),j6=yT(),M6=Uy(),R6=O6(),F6=wT(),Ky=$T(),P6=new Map([["core",nme.schema],["failsafe",[C6.map,D6.seq,tme.string]],["json",ime.schema],["yaml11",R6.schema],["yaml-1.1",R6.schema]]),I6={binary:N6.binary,bool:rme.boolTag,float:AT.float,floatExp:AT.floatExp,floatNaN:AT.floatNaN,floatTime:Ky.floatTime,int:TT.int,intHex:TT.intHex,intOct:TT.intOct,intTime:Ky.intTime,map:C6.map,merge:mf.merge,null:eme.nullTag,omap:j6.omap,pairs:M6.pairs,seq:D6.seq,set:F6.set,timestamp:Ky.timestamp},ome={"tag:yaml.org,2002:binary":N6.binary,"tag:yaml.org,2002:merge":mf.merge,"tag:yaml.org,2002:omap":j6.omap,"tag:yaml.org,2002:pairs":M6.pairs,"tag:yaml.org,2002:set":F6.set,"tag:yaml.org,2002:timestamp":Ky.timestamp};function sme(t,e,r){let n=P6.get(e);if(n&&!t)return r&&!n.includes(mf.merge)?n.concat(mf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(P6.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(mf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?I6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(I6).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},[])}OT.coreKnownTags=ome;OT.getTags=sme});var IT=v(z6=>{"use strict";var RT=Ce(),ame=Wc(),cme=Kc(),lme=lf(),Jy=L6(),ume=(t,e)=>t.keye.key?1:0,PT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Jy.getTags(e,"compat"):e?Jy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Jy.coreKnownTags:{},this.tags=Jy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,RT.MAP,{value:ame.map}),Object.defineProperty(this,RT.SCALAR,{value:lme.string}),Object.defineProperty(this,RT.SEQ,{value:cme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?ume:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};z6.Schema=PT});var q6=v(U6=>{"use strict";var dme=Ce(),CT=sf(),hf=tf();function fme(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=CT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(hf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(dme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(hf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=CT.stringify(t.contents,i,()=>a=null,c);a&&(l+=hf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(CT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(hf.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(hf.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=qy.isPair(n)?n:new gT.Pair(n)}}else e("Expected a sequence for this tag");return t}function y6(t,e,r){let{replacer:n}=r,i=new Cpe.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(gT.createPair(a,c,r))}return i}var Dpe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:g6,createNode:y6};By.createPairs=y6;By.pairs=Dpe;By.resolvePairs=g6});var bT=v(_T=>{"use strict";var _6=Ce(),yT=Ho(),ff=Jo(),Npe=Yo(),b6=Hy(),fa=class t extends Npe.YAMLSeq{constructor(){super(),this.add=ff.YAMLMap.prototype.add.bind(this),this.delete=ff.YAMLMap.prototype.delete.bind(this),this.get=ff.YAMLMap.prototype.get.bind(this),this.has=ff.YAMLMap.prototype.has.bind(this),this.set=ff.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(_6.isPair(i)?(o=yT.toJS(i.key,"",r),s=yT.toJS(i.value,o,r)):o=yT.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=b6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};fa.tag="tag:yaml.org,2002:omap";var jpe={collection:"seq",identify:t=>t instanceof Map,nodeClass:fa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=b6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)_6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new fa,r)},createNode:(t,e,r)=>fa.from(t,e,r)};_T.YAMLOMap=fa;_T.omap=jpe});var $6=v(vT=>{"use strict";var v6=Ct();function S6({value:t,source:e},r){return e&&(t?w6:x6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var w6={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 v6.Scalar(!0),stringify:S6},x6={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 v6.Scalar(!1),stringify:S6};vT.falseTag=x6;vT.trueTag=w6});var k6=v(Gy=>{"use strict";var Mpe=Ct(),ST=Yc(),Fpe={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:ST.stringifyNumber},Lpe={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():ST.stringifyNumber(t)}},zpe={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 Mpe.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:ST.stringifyNumber};Gy.float=zpe;Gy.floatExp=Lpe;Gy.floatNaN=Fpe});var A6=v(mf=>{"use strict";var E6=Yc(),pf=t=>typeof t=="bigint"||Number.isInteger(t);function Zy(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 wT(t,e,r){let{value:n}=t;if(pf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return E6.stringifyNumber(t)}var Upe={identify:pf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Zy(t,2,2,r),stringify:t=>wT(t,2,"0b")},qpe={identify:pf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Zy(t,1,8,r),stringify:t=>wT(t,8,"0")},Bpe={identify:pf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Zy(t,0,10,r),stringify:E6.stringifyNumber},Hpe={identify:pf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Zy(t,2,16,r),stringify:t=>wT(t,16,"0x")};mf.int=Bpe;mf.intBin=Upe;mf.intHex=Hpe;mf.intOct=qpe});var $T=v(xT=>{"use strict";var Ky=Ce(),Vy=Wo(),Wy=Jo(),pa=class t extends Wy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Ky.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Vy.Pair(e.key,null):r=new Vy.Pair(e,null),Wy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Wy.findPair(this.items,e);return!r&&Ky.isPair(n)?Ky.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=Wy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Vy.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(Vy.createPair(s,null,n));return o}};pa.tag="tag:yaml.org,2002:set";var Gpe={collection:"map",identify:t=>t instanceof Set,nodeClass:pa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>pa.from(t,e,r),resolve(t,e){if(Ky.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new pa,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};xT.YAMLSet=pa;xT.set=Gpe});var ET=v(Jy=>{"use strict";var Zpe=Yc();function kT(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 T6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Zpe.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 Vpe={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})=>kT(t,r),stringify:T6},Wpe={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=>kT(t,!1),stringify:T6},O6={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(O6.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=kT(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$/,"")??""};Jy.floatTime=Wpe;Jy.intTime=Vpe;Jy.timestamp=O6});var P6=v(I6=>{"use strict";var Kpe=Kc(),Jpe=My(),Ype=Jc(),Xpe=uf(),Qpe=hT(),R6=$6(),AT=k6(),Yy=A6(),eme=Oy(),tme=bT(),rme=Hy(),nme=$T(),TT=ET(),ime=[Kpe.map,Ype.seq,Xpe.string,Jpe.nullTag,R6.trueTag,R6.falseTag,Yy.intBin,Yy.intOct,Yy.int,Yy.intHex,AT.floatNaN,AT.floatExp,AT.float,Qpe.binary,eme.merge,tme.omap,rme.pairs,nme.set,TT.intTime,TT.floatTime,TT.timestamp];I6.schema=ime});var q6=v(IT=>{"use strict";var j6=Kc(),ome=My(),M6=Jc(),sme=uf(),ame=aT(),OT=lT(),RT=dT(),cme=d6(),lme=m6(),F6=hT(),hf=Oy(),L6=bT(),z6=Hy(),C6=P6(),U6=$T(),Xy=ET(),D6=new Map([["core",cme.schema],["failsafe",[j6.map,M6.seq,sme.string]],["json",lme.schema],["yaml11",C6.schema],["yaml-1.1",C6.schema]]),N6={binary:F6.binary,bool:ame.boolTag,float:OT.float,floatExp:OT.floatExp,floatNaN:OT.floatNaN,floatTime:Xy.floatTime,int:RT.int,intHex:RT.intHex,intOct:RT.intOct,intTime:Xy.intTime,map:j6.map,merge:hf.merge,null:ome.nullTag,omap:L6.omap,pairs:z6.pairs,seq:M6.seq,set:U6.set,timestamp:Xy.timestamp},ume={"tag:yaml.org,2002:binary":F6.binary,"tag:yaml.org,2002:merge":hf.merge,"tag:yaml.org,2002:omap":L6.omap,"tag:yaml.org,2002:pairs":z6.pairs,"tag:yaml.org,2002:set":U6.set,"tag:yaml.org,2002:timestamp":Xy.timestamp};function dme(t,e,r){let n=D6.get(e);if(n&&!t)return r&&!n.includes(hf.merge)?n.concat(hf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(D6.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(hf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?N6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(N6).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},[])}IT.coreKnownTags=ume;IT.getTags=dme});var DT=v(B6=>{"use strict";var PT=Ce(),fme=Kc(),pme=Jc(),mme=uf(),Qy=q6(),hme=(t,e)=>t.keye.key?1:0,CT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Qy.getTags(e,"compat"):e?Qy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Qy.coreKnownTags:{},this.tags=Qy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,PT.MAP,{value:fme.map}),Object.defineProperty(this,PT.SCALAR,{value:mme.string}),Object.defineProperty(this,PT.SEQ,{value:pme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?hme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};B6.Schema=CT});var G6=v(H6=>{"use strict";var gme=Ce(),NT=af(),gf=rf();function yme(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=NT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(gf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(gme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(gf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=NT.stringify(t.contents,i,()=>a=null,c);a&&(l+=gf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(NT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(gf.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(gf.indentComment(o(c),"")))}return r.join(` `)+` -`}U6.stringifyDocument=fme});var gf=v(B6=>{"use strict";var pme=Qd(),Yc=gy(),$n=Ce(),mme=Vo(),hme=Bo(),gme=IT(),yme=q6(),DT=fy(),_me=FA(),bme=ef(),NT=MA(),jT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 NT.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Xc(this.contents)&&this.contents.add(e)}addIn(e,r){Xc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=DT.anchorNames(this);e.anchor=!r||n.has(r)?DT.findNewAnchor(r||"a",n):r}return new pme.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}=DT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=bme.createNode(e,u,m);return a&&$n.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 mme.Pair(i,o)}delete(e){return Xc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Yc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Xc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Yc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Yc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Yc.collectionFromPath(this.schema,[e],r):Xc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Yc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Yc.collectionFromPath(this.schema,Array.from(e),r):Xc(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 NT.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 NT.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 gme.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=hme.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"?_me.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 yme.stringifyDocument(this,e)}};function Xc(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}B6.Document=jT});var bf=v(_f=>{"use strict";var yf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},MT=class extends yf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},FT=class extends yf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},vme=(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 +`}H6.stringifyDocument=yme});var yf=v(Z6=>{"use strict";var _me=ef(),Xc=by(),$n=Ce(),bme=Wo(),vme=Ho(),Sme=DT(),wme=G6(),jT=hy(),xme=zA(),$me=tf(),MT=LA(),FT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 MT.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Qc(this.contents)&&this.contents.add(e)}addIn(e,r){Qc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=jT.anchorNames(this);e.anchor=!r||n.has(r)?jT.findNewAnchor(r||"a",n):r}return new _me.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}=jT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=$me.createNode(e,u,m);return a&&$n.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 bme.Pair(i,o)}delete(e){return Qc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Xc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Qc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Xc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Xc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Xc.collectionFromPath(this.schema,[e],r):Qc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Xc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Xc.collectionFromPath(this.schema,Array.from(e),r):Qc(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 MT.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 MT.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 Sme.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=vme.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"?xme.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 wme.stringifyDocument(this,e)}};function Qc(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Z6.Document=FT});var vf=v(bf=>{"use strict";var _f=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},LT=class extends _f{constructor(e,r,n){super("YAMLParseError",e,r,n)}},zT=class extends _f{constructor(e,r,n){super("YAMLWarning",e,r,n)}},kme=(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} -`}};_f.YAMLError=yf;_f.YAMLParseError=MT;_f.YAMLWarning=FT;_f.prettifyError=vme});var vf=v(H6=>{"use strict";function Sme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}H6.resolveProps=Sme});var Yy=v(G6=>{"use strict";function LT(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(LT(e.key)||LT(e.value))return!0}return!1;default:return!0}}G6.containsNewline=LT});var zT=v(Z6=>{"use strict";var wme=Yy();function xme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&wme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Z6.flowIndentCheck=xme});var UT=v(W6=>{"use strict";var V6=Ce();function $me(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||V6.isScalar(o)&&V6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}W6.mapIncludes=$me});var eB=v(Q6=>{"use strict";var K6=Vo(),kme=Ko(),J6=vf(),Eme=Yy(),Y6=zT(),Ame=UT(),X6="All mapping items must start at the same column";function Tme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??kme.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",X6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Eme.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",X6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&Y6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Ame.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 Ome=Jo(),Rme=vf(),Pme=zT();function Ime({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Ome.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=Rme.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&&Pme.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}tB.resolveBlockSeq=Ime});var Qc=v(nB=>{"use strict";function Cme(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}}nB.resolveEnd=Cme});var aB=v(sB=>{"use strict";var Dme=Ce(),Nme=Vo(),iB=Ko(),jme=Jo(),Mme=Qc(),oB=vf(),Fme=Yy(),Lme=UT(),qT="Block collections are not allowed within flow collections",BT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function zme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?iB.YAMLMap:jme.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=Mme.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}sB.resolveFlowCollection=zme});var lB=v(cB=>{"use strict";var Ume=Ce(),qme=Ct(),Bme=Ko(),Hme=Jo(),Gme=eB(),Zme=rB(),Vme=aB();function HT(t,e,r,n,i,o){let s=r.type==="block-map"?Gme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Zme.resolveBlockSeq(t,e,r,n,o):Vme.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 Wme(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=Ume.isNode(u)?u:new qme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}cB.composeCollection=Wme});var ZT=v(uB=>{"use strict";var GT=Ct();function Kme(t,e,r){let n=e.offset,i=Jme(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?Yme(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?` +`}};bf.YAMLError=_f;bf.YAMLParseError=LT;bf.YAMLWarning=zT;bf.prettifyError=kme});var Sf=v(V6=>{"use strict";function Eme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}V6.resolveProps=Eme});var e_=v(W6=>{"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}}W6.containsNewline=UT});var qT=v(K6=>{"use strict";var Ame=e_();function Tme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Ame.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}K6.flowIndentCheck=Tme});var BT=v(Y6=>{"use strict";var J6=Ce();function Ome(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||J6.isScalar(o)&&J6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}Y6.mapIncludes=Ome});var nB=v(rB=>{"use strict";var X6=Wo(),Rme=Jo(),Q6=Sf(),Ime=e_(),eB=qT(),Pme=BT(),tB="All mapping items must start at the same column";function Cme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Rme.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=Q6.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",tB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Ime.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",tB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&eB.flowIndentCheck(n.indent,f,i),r.atKey=!1,Pme.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=Q6.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 Dme=Yo(),Nme=Sf(),jme=qT();function Mme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Dme.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=Nme.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&&jme.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}iB.resolveBlockSeq=Mme});var el=v(sB=>{"use strict";function Fme(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}}sB.resolveEnd=Fme});var uB=v(lB=>{"use strict";var Lme=Ce(),zme=Wo(),aB=Jo(),Ume=Yo(),qme=el(),cB=Sf(),Bme=e_(),Hme=BT(),HT="Block collections are not allowed within flow collections",GT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Gme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?aB.YAMLMap:Ume.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=qme.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}lB.resolveFlowCollection=Gme});var fB=v(dB=>{"use strict";var Zme=Ce(),Vme=Ct(),Wme=Jo(),Kme=Yo(),Jme=nB(),Yme=oB(),Xme=uB();function ZT(t,e,r,n,i,o){let s=r.type==="block-map"?Jme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Yme.resolveBlockSeq(t,e,r,n,o):Xme.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 Qme(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),ZT(t,e,r,i,s)}let l=ZT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Zme.isNode(u)?u:new Vme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}dB.composeCollection=Qme});var WT=v(pB=>{"use strict";var VT=Ct();function ehe(t,e,r){let n=e.offset,i=the(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?VT.Scalar.BLOCK_FOLDED:VT.Scalar.BLOCK_LITERAL,s=e.source?rhe(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,91 +112,91 @@ ${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 Jme({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 VT=Ct(),Xme=Qc();function Qme(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=VT.Scalar.PLAIN,c=ehe(o,l);break;case"single-quoted-scalar":a=VT.Scalar.QUOTE_SINGLE,c=the(o,l);break;case"double-quoted-scalar":a=VT.Scalar.QUOTE_DOUBLE,c=rhe(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=Xme.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function ehe(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}`),dB(t)}function the(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),dB(t.slice(1,-1)).replace(/''/g,"'")}function dB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var KT=Ct(),nhe=el();function ihe(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=KT.Scalar.PLAIN,c=ohe(o,l);break;case"single-quoted-scalar":a=KT.Scalar.QUOTE_SINGLE,c=she(o,l);break;case"double-quoted-scalar":a=KT.Scalar.QUOTE_DOUBLE,c=ahe(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=nhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function ohe(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}`),mB(t)}function she(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),mB(t.slice(1,-1)).replace(/''/g,"'")}function mB(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 nhe(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 che(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 ihe={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function ohe(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}}fB.resolveFlowScalar=Qme});var hB=v(mB=>{"use strict";var fa=Ce(),pB=Ct(),she=ZT(),ahe=WT();function che(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?she.resolveBlockScalar(t,e,n):ahe.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[fa.SCALAR]:c?l=lhe(t.schema,i,c,r,n):e.type==="scalar"?l=uhe(t,i,e,n):l=t.schema[fa.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=fa.isScalar(d)?d:new pB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new pB.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 lhe(t,e,r,n,i){if(r==="!")return t[fa.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[fa.SCALAR])}function uhe({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[fa.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[fa.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}mB.composeScalar=che});var yB=v(gB=>{"use strict";function dhe(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}gB.emptyScalarPosition=dhe});var vB=v(JT=>{"use strict";var fhe=Qd(),phe=Ce(),mhe=lB(),_B=hB(),hhe=Qc(),ghe=yB(),yhe={composeNode:bB,composeEmptyNode:KT};function bB(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=_he(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=_B.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=mhe.composeCollection(yhe,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=KT(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&&(!phe.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 KT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:ghe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=_B.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 _he({options:t},{offset:e,source:r,end:n},i){let o=new fhe.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=hhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}JT.composeEmptyNode=KT;JT.composeNode=bB});var xB=v(wB=>{"use strict";var bhe=gf(),SB=vB(),vhe=Qc(),She=vf();function whe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new bhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=She.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=vhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}wB.composeDoc=whe});var XT=v(EB=>{"use strict";var xhe=He("process"),$he=MA(),khe=gf(),Sf=bf(),$B=Ce(),Ehe=xB(),Ahe=Qc();function wf(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 kB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ma=Ce(),gB=Ct(),dhe=WT(),fhe=JT();function phe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?dhe.resolveBlockScalar(t,e,n):fhe.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[ma.SCALAR]:c?l=mhe(t.schema,i,c,r,n):e.type==="scalar"?l=hhe(t,i,e,n):l=t.schema[ma.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ma.isScalar(d)?d:new gB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new gB.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 mhe(t,e,r,n,i){if(r==="!")return t[ma.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[ma.SCALAR])}function hhe({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[ma.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ma.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}yB.composeScalar=phe});var vB=v(bB=>{"use strict";function ghe(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}bB.emptyScalarPosition=ghe});var xB=v(XT=>{"use strict";var yhe=ef(),_he=Ce(),bhe=fB(),SB=_B(),vhe=el(),She=vB(),whe={composeNode:wB,composeEmptyNode:YT};function wB(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=xhe(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=SB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=bhe.composeCollection(whe,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=YT(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&&(!_he.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 YT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:She.emptyScalarPosition(e,r,n),indent:-1,source:""},d=SB.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 xhe({options:t},{offset:e,source:r,end:n},i){let o=new yhe.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=vhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}XT.composeEmptyNode=YT;XT.composeNode=wB});var EB=v(kB=>{"use strict";var $he=yf(),$B=xB(),khe=el(),Ehe=Sf();function Ahe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new $he.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Ehe.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?$B.composeNode(l,i,u,s):$B.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=khe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}kB.composeDoc=Ahe});var eO=v(OB=>{"use strict";var The=He("process"),Ohe=LA(),Rhe=yf(),wf=vf(),AB=Ce(),Ihe=EB(),Phe=el();function xf(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 TB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=wf(r);o?this.warnings.push(new Sf.YAMLWarning(s,n,i)):this.errors.push(new Sf.YAMLParseError(s,n,i))},this.directives=new $he.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=kB(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($B.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];$B.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 QT=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=xf(r);o?this.warnings.push(new wf.YAMLWarning(s,n,i)):this.errors.push(new wf.YAMLParseError(s,n,i))},this.directives=new Ohe.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=TB(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(AB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];AB.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=wf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Ehe.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 Sf.YAMLParseError(wf(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 Sf.YAMLParseError(wf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Ahe.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 Sf.YAMLParseError(wf(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 khe.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}}};EB.Composer=YT});var OB=v(Xy=>{"use strict";var The=ZT(),Ohe=WT(),Rhe=bf(),AB=of();function Phe(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 Rhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ohe.resolveFlowScalar(t,e,n);case"block-scalar":return The.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Ihe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=AB.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=xf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Ihe.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 wf.YAMLParseError(xf(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 wf.YAMLParseError(xf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Phe.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 wf.YAMLParseError(xf(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 Rhe.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}}};OB.Composer=QT});var PB=v(t_=>{"use strict";var Che=WT(),Dhe=JT(),Nhe=vf(),RB=sf();function jhe(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 Nhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Dhe.resolveFlowScalar(t,e,n);case"block-scalar":return Che.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Mhe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=RB.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 TB(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 Che(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=AB.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">":Dhe(t,c);break;case'"':QT(t,c,"double-quoted-scalar");break;case"'":QT(t,c,"single-quoted-scalar");break;default:QT(t,c,"scalar")}}function Dhe(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return IB(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 Fhe(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=RB.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">":Lhe(t,c);break;case'"':tO(t,c,"double-quoted-scalar");break;case"'":tO(t,c,"single-quoted-scalar");break;default:tO(t,c,"scalar")}}function Lhe(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}];TB(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 TB(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 QT(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})}}}Xy.createScalarToken=Ihe;Xy.resolveAsScalar=Phe;Xy.setScalarValue=Che});var PB=v(RB=>{"use strict";var Nhe=t=>"type"in t?e_(t):Qy(t);function e_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=e_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Qy(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Qy(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Qy(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 Qy({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=e_(e)),r)for(let o of r)i+=o.source;return n&&(i+=e_(n)),i}RB.stringify=Nhe});var NB=v(DB=>{"use strict";var eO=Symbol("break visit"),jhe=Symbol("skip children"),IB=Symbol("remove item");function pa(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),CB(Object.freeze([]),t,e)}pa.BREAK=eO;pa.SKIP=jhe;pa.REMOVE=IB;pa.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};pa.parentCollection=(t,e)=>{let r=pa.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 CB(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 tO=OB(),Mhe=PB(),Fhe=NB(),rO="\uFEFF",nO="",iO="",oO="",Lhe=t=>!!t&&"items"in t,zhe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Uhe(t){switch(t){case rO:return"";case nO:return"";case iO:return"";case oO:return"";default:return JSON.stringify(t)}}function qhe(t){switch(t){case rO:return"byte-order-mark";case nO:return"doc-mode";case iO: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}];IB(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 IB(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 tO(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})}}}t_.createScalarToken=Mhe;t_.resolveAsScalar=jhe;t_.setScalarValue=Fhe});var DB=v(CB=>{"use strict";var zhe=t=>"type"in t?n_(t):r_(t);function n_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=n_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=r_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=r_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=r_(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 r_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=n_(e)),r)for(let o of r)i+=o.source;return n&&(i+=n_(n)),i}CB.stringify=zhe});var FB=v(MB=>{"use strict";var rO=Symbol("break visit"),Uhe=Symbol("skip children"),NB=Symbol("remove item");function ha(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),jB(Object.freeze([]),t,e)}ha.BREAK=rO;ha.SKIP=Uhe;ha.REMOVE=NB;ha.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};ha.parentCollection=(t,e)=>{let r=ha.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 jB(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 nO=PB(),qhe=DB(),Bhe=FB(),iO="\uFEFF",oO="",sO="",aO="",Hhe=t=>!!t&&"items"in t,Ghe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Zhe(t){switch(t){case iO:return"";case oO:return"";case sO:return"";case aO:return"";default:return JSON.stringify(t)}}function Vhe(t){switch(t){case iO:return"byte-order-mark";case oO:return"doc-mode";case sO:return"flow-error-end";case aO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r -`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Dr.createScalarToken=tO.createScalarToken;Dr.resolveAsScalar=tO.resolveAsScalar;Dr.setScalarValue=tO.setScalarValue;Dr.stringify=Mhe.stringify;Dr.visit=Fhe.visit;Dr.BOM=rO;Dr.DOCUMENT=nO;Dr.FLOW_END=iO;Dr.SCALAR=oO;Dr.isCollection=Lhe;Dr.isScalar=zhe;Dr.prettyToken=Uhe;Dr.tokenType=qhe});var cO=v(MB=>{"use strict";var xf=t_();function Wn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var jB=new Set("0123456789ABCDEFabcdef"),Bhe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),r_=new Set(",[]{}"),Hhe=new Set(` ,[]{} -\r `),sO=t=>!t||Hhe.has(t),aO=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}Dr.createScalarToken=nO.createScalarToken;Dr.resolveAsScalar=nO.resolveAsScalar;Dr.setScalarValue=nO.setScalarValue;Dr.stringify=qhe.stringify;Dr.visit=Bhe.visit;Dr.BOM=iO;Dr.DOCUMENT=oO;Dr.FLOW_END=sO;Dr.SCALAR=aO;Dr.isCollection=Hhe;Dr.isScalar=Ghe;Dr.prettyToken=Zhe;Dr.tokenType=Vhe});var uO=v(zB=>{"use strict";var $f=i_();function Wn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var LB=new Set("0123456789ABCDEFabcdef"),Whe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),o_=new Set(",[]{}"),Khe=new Set(` ,[]{} +\r `),cO=t=>!t||Khe.has(t),lO=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==="...")&&Wn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Wn(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===":")&&Wn(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(sO),"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&&!Wn(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===":")&&Wn(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(cO),"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=>Wn(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 xf.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(Wn(o)||e&&r_.has(o))break;r=n}else if(Wn(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 $f.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(Wn(o)||e&&o_.has(o))break;r=n}else if(Wn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&r_.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&r_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield xf.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(sO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Wn(n)||r&&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(;!Wn(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(Bhe.has(r))r=this.buffer[++e];else if(r==="%"&&jB.has(this.buffer[e+1])&&jB.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&&o_.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&o_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield $f.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(cO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Wn(n)||r&&o_.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(;!Wn(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(Whe.has(r))r=this.buffer[++e];else if(r==="%"&&LB.has(this.buffer[e+1])&&LB.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)}};MB.Lexer=aO});var uO=v(FB=>{"use strict";var lO=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 Ghe=He("process"),LB=t_(),Zhe=cO();function Yo(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 i_(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"&&UB(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&&zB(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)}};zB.Lexer=lO});var fO=v(UB=>{"use strict";var dO=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 Jhe=He("process"),qB=i_(),Yhe=uO();function Xo(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"&&HB(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&&BB(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(Yo(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(qB(r.key)&&!Yo(r.sep,"newline")){let s=el(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(Yo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=el(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]}):Yo(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&&!Yo(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)){i_(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||Yo(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=n_(n),o=el(i);UB(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(Xo(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(GB(r.key)&&!Xo(r.sep,"newline")){let s=tl(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(Xo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=tl(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]}):Xo(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&&!Xo(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||Xo(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=s_(n),o=tl(i);HB(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=n_(e),n=el(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=n_(e),n=el(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())}}};BB.Parser=dO});var WB=v(kf=>{"use strict";var HB=XT(),Vhe=gf(),$f=bf(),Whe=JA(),Khe=Ce(),Jhe=uO(),GB=fO();function ZB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Jhe.LineCounter||null,prettyErrors:e}}function Yhe(t,e={}){let{lineCounter:r,prettyErrors:n}=ZB(e),i=new GB.Parser(r?.addNewLine),o=new HB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach($f.prettifyError(t,r)),a.warnings.forEach($f.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function VB(t,e={}){let{lineCounter:r,prettyErrors:n}=ZB(e),i=new GB.Parser(r?.addNewLine),o=new HB.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 $f.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach($f.prettifyError(t,r)),s.warnings.forEach($f.prettifyError(t,r))),s}function Xhe(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=VB(t,r);if(!i)return null;if(i.warnings.forEach(o=>Whe.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 Qhe(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 Khe.isDocument(t)&&!n?t.toString(r):new Vhe.Document(t,n,r).toString(r)}kf.parse=Xhe;kf.parseAllDocuments=Yhe;kf.parseDocument=VB;kf.stringify=Qhe});var Qt=v(Ge=>{"use strict";var ege=XT(),tge=gf(),rge=IT(),pO=bf(),nge=Qd(),Xo=Ce(),ige=Vo(),oge=Ct(),sge=Ko(),age=Jo(),cge=t_(),lge=cO(),uge=uO(),dge=fO(),o_=WB(),KB=Kd();Ge.Composer=ege.Composer;Ge.Document=tge.Document;Ge.Schema=rge.Schema;Ge.YAMLError=pO.YAMLError;Ge.YAMLParseError=pO.YAMLParseError;Ge.YAMLWarning=pO.YAMLWarning;Ge.Alias=nge.Alias;Ge.isAlias=Xo.isAlias;Ge.isCollection=Xo.isCollection;Ge.isDocument=Xo.isDocument;Ge.isMap=Xo.isMap;Ge.isNode=Xo.isNode;Ge.isPair=Xo.isPair;Ge.isScalar=Xo.isScalar;Ge.isSeq=Xo.isSeq;Ge.Pair=ige.Pair;Ge.Scalar=oge.Scalar;Ge.YAMLMap=sge.YAMLMap;Ge.YAMLSeq=age.YAMLSeq;Ge.CST=cge;Ge.Lexer=lge.Lexer;Ge.LineCounter=uge.LineCounter;Ge.Parser=dge.Parser;Ge.parse=o_.parse;Ge.parseAllDocuments=o_.parseAllDocuments;Ge.parseDocument=o_.parseDocument;Ge.stringify=o_.stringify;Ge.visit=KB.visit;Ge.visitAsync=KB.visitAsync});import{execFileSync as JB}from"node:child_process";import{existsSync as s_}from"node:fs";import{join as a_,resolve as fge}from"node:path";function pge(t){try{let e=JB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?fge(t,e):null}catch{return null}}function mO(t){let e=pge(t);if(!e)return null;try{if(s_(a_(e,"MERGE_HEAD")))return"merge";if(s_(a_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(s_(a_(e,"rebase-merge"))||s_(a_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ma(t){return mO(t)!==null}function hO(t,e){try{let r=JB("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 c_(t,e){return hO(t,e)!==null}var ha=y(()=>{"use strict"});import{execFileSync as mge}from"node:child_process";import{existsSync as hge,readFileSync as gge}from"node:fs";import{join as QB}from"node:path";function Ef(t,e){return mge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Qo(t){try{let e=Ef(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 es(t,e){yge(t,e);let r=Ef(t,["rev-parse","HEAD"]).trim(),n=_ge(t,e);return{groups:bge(t,n),head:r,inventory:{after:XB(u_(t,"spec.yaml")),before:XB(gO(t,e,"spec.yaml"))},since:e,unsharded_commits:xge(t,e)}}function yO(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 yge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!c_(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 _ge(t,e){let r=Ef(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(!(!YB(c)&&!YB(a)))if(s.startsWith("A")){let l=l_(u_(t,c));if(!l)continue;l.status==="done"?n.push(tl(l,"added-as-done")):l.status==="archived"&&n.push(tl(l,"archived"))}else if(s.startsWith("D")){let l=l_(gO(t,e,a));l&&n.push(tl(l,"archived"))}else{let l=l_(u_(t,c));if(!l)continue;let d=l_(gO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(tl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(tl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(tl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function YB(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function tl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>yO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function l_(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 u_(t,e){let r=QB(t,e);if(!hge(r))return null;try{return gge(r,"utf8")}catch{return null}}function gO(t,e,r){try{return Ef(t,["show",`${e}:${r}`])}catch{return null}}function bge(t,e){let r=vge(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 vge(t){let e=u_(t,QB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,d_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function XB(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 xge(t,e){let r=Ef(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);Sge.test(a)&&(wge.test(a)||n.push({hash:s,subject:a}))}return n}var d_,Sge,wge,rl=y(()=>{"use strict";d_=St(Qt(),1);ha();Sge=/^(feat|fix)(\([^)]*\))?!?:/,wge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as eH}from"node:child_process";import{appendFileSync as $ge,existsSync as _O,mkdirSync as kge,readFileSync as Ege,renameSync as Age,statSync as Tge}from"node:fs";import{userInfo as Oge}from"node:os";import{dirname as Rge,join as vO}from"node:path";function SO(t){return vO(t,tH,Pge)}function Xr(t,e){let r=SO(t),n=Rge(r);_O(n)||kge(n,{recursive:!0});try{_O(r)&&Tge(r).size>Ige&&Age(r,vO(n,rH))}catch{}$ge(r,`${JSON.stringify(e)} -`,"utf8")}function bO(t){if(!_O(t))return[];let e=Ege(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ga(t){return bO(SO(t))}function f_(t){return[...bO(vO(t,tH,rH)),...bO(SO(t))]}function Qr(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 Cge(t){let e;try{e=eH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Oge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Dge(t){try{return eH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Af(t,e){try{let r=ga(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Dge(t),i=Cge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Af(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var tH,Pge,rH,Ige,Nr=y(()=>{"use strict";tH=".cladding",Pge="events.log.jsonl",rH="events.log.1.jsonl",Ige=5*1024*1024});import{execFileSync as Nge}from"node:child_process";import{existsSync as nH,readdirSync as jge,readFileSync as Mge,statSync as iH}from"node:fs";import{createHash as Fge}from"node:crypto";import{join as wO}from"node:path";function ya(t){try{return Nge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function xO(t){let e=[],r=wO(t,"spec.yaml");nH(r)&&iH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=wO(t,"spec",i);if(!(!nH(o)||!iH(o).isDirectory()))for(let s of jge(o))s.endsWith(".yaml")&&e.push(wO(o,s))}e.sort();let n=Fge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Mge(i)),n.update("\0")}return n.digest("hex")}function p_(t,e){let r={featureId:e,gitHead:ya(t),specDigest:xO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function m_(t,e){let r=ga(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 h_(t,e,r,n){let i=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Tf=y(()=>{"use strict";Nr()});import{readFileSync as Lge,statSync as zge}from"node:fs";import{extname as Uge,resolve as $O,sep as qge}from"node:path";function en(t){return Math.ceil(t.length/4)}function Gge(t,e){let r=$O(e),n=$O(r,t);return n===r||n.startsWith(r+qge)}function sH(t,e,r,n){if(!Gge(t,e))return{path:t,omitted:"unsafe-path"};if(!Bge.has(Uge(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>oH)return{path:t,omitted:"too-large",bytes:o}}else{let l=$O(e,t);try{o=zge(l).size}catch{return{path:t,omitted:"missing"}}if(o>oH)return{path:t,omitted:"too-large",bytes:o};try{i=Lge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Hge))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=s_(e),n=tl(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=s_(e),n=tl(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())}}};ZB.Parser=pO});var YB=v(Ef=>{"use strict";var VB=eO(),Xhe=yf(),kf=vf(),Qhe=XA(),ege=Ce(),tge=fO(),WB=mO();function KB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new tge.LineCounter||null,prettyErrors:e}}function rge(t,e={}){let{lineCounter:r,prettyErrors:n}=KB(e),i=new WB.Parser(r?.addNewLine),o=new VB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(kf.prettifyError(t,r)),a.warnings.forEach(kf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function JB(t,e={}){let{lineCounter:r,prettyErrors:n}=KB(e),i=new WB.Parser(r?.addNewLine),o=new VB.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 kf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(kf.prettifyError(t,r)),s.warnings.forEach(kf.prettifyError(t,r))),s}function nge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=JB(t,r);if(!i)return null;if(i.warnings.forEach(o=>Qhe.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 ige(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 ege.isDocument(t)&&!n?t.toString(r):new Xhe.Document(t,n,r).toString(r)}Ef.parse=nge;Ef.parseAllDocuments=rge;Ef.parseDocument=JB;Ef.stringify=ige});var Qt=v(Ge=>{"use strict";var oge=eO(),sge=yf(),age=DT(),hO=vf(),cge=ef(),Qo=Ce(),lge=Wo(),uge=Ct(),dge=Jo(),fge=Yo(),pge=i_(),mge=uO(),hge=fO(),gge=mO(),c_=YB(),XB=Jd();Ge.Composer=oge.Composer;Ge.Document=sge.Document;Ge.Schema=age.Schema;Ge.YAMLError=hO.YAMLError;Ge.YAMLParseError=hO.YAMLParseError;Ge.YAMLWarning=hO.YAMLWarning;Ge.Alias=cge.Alias;Ge.isAlias=Qo.isAlias;Ge.isCollection=Qo.isCollection;Ge.isDocument=Qo.isDocument;Ge.isMap=Qo.isMap;Ge.isNode=Qo.isNode;Ge.isPair=Qo.isPair;Ge.isScalar=Qo.isScalar;Ge.isSeq=Qo.isSeq;Ge.Pair=lge.Pair;Ge.Scalar=uge.Scalar;Ge.YAMLMap=dge.YAMLMap;Ge.YAMLSeq=fge.YAMLSeq;Ge.CST=pge;Ge.Lexer=mge.Lexer;Ge.LineCounter=hge.LineCounter;Ge.Parser=gge.Parser;Ge.parse=c_.parse;Ge.parseAllDocuments=c_.parseAllDocuments;Ge.parseDocument=c_.parseDocument;Ge.stringify=c_.stringify;Ge.visit=XB.visit;Ge.visitAsync=XB.visitAsync});import{execFileSync as QB}from"node:child_process";import{existsSync as l_}from"node:fs";import{join as u_,resolve as yge}from"node:path";function _ge(t){try{let e=QB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?yge(t,e):null}catch{return null}}function gO(t){let e=_ge(t);if(!e)return null;try{if(l_(u_(e,"MERGE_HEAD")))return"merge";if(l_(u_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(l_(u_(e,"rebase-merge"))||l_(u_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ga(t){return gO(t)!==null}function yO(t,e){try{let r=QB("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 d_(t,e){return yO(t,e)!==null}var ya=y(()=>{"use strict"});import{execFileSync as bge}from"node:child_process";import{existsSync as vge,readFileSync as Sge}from"node:fs";import{join as rH}from"node:path";function Af(t,e){return bge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function es(t){try{let e=Af(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 ts(t,e){wge(t,e);let r=Af(t,["rev-parse","HEAD"]).trim(),n=xge(t,e);return{groups:$ge(t,n),head:r,inventory:{after:tH(p_(t,"spec.yaml")),before:tH(_O(t,e,"spec.yaml"))},since:e,unsharded_commits:Tge(t,e)}}function bO(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 wge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!d_(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 xge(t,e){let r=Af(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(!(!eH(c)&&!eH(a)))if(s.startsWith("A")){let l=f_(p_(t,c));if(!l)continue;l.status==="done"?n.push(rl(l,"added-as-done")):l.status==="archived"&&n.push(rl(l,"archived"))}else if(s.startsWith("D")){let l=f_(_O(t,e,a));l&&n.push(rl(l,"archived"))}else{let l=f_(p_(t,c));if(!l)continue;let d=f_(_O(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(rl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(rl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(rl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function eH(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function rl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>bO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function f_(t){if(t===null)return null;let e;try{e=(0,m_.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=rH(t,e);if(!vge(r))return null;try{return Sge(r,"utf8")}catch{return null}}function _O(t,e,r){try{return Af(t,["show",`${e}:${r}`])}catch{return null}}function $ge(t,e){let r=kge(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 kge(t){let e=p_(t,rH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,m_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function tH(t){let e={};if(t!==null)try{let n=(0,m_.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 Tge(t,e){let r=Af(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);Ege.test(a)&&(Age.test(a)||n.push({hash:s,subject:a}))}return n}var m_,Ege,Age,nl=y(()=>{"use strict";m_=St(Qt(),1);ya();Ege=/^(feat|fix)(\([^)]*\))?!?:/,Age=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as nH}from"node:child_process";import{appendFileSync as Oge,existsSync as vO,mkdirSync as Rge,readFileSync as Ige,renameSync as Pge,statSync as Cge}from"node:fs";import{userInfo as Dge}from"node:os";import{dirname as Nge,join as wO}from"node:path";function xO(t){return wO(t,iH,jge)}function Xr(t,e){let r=xO(t),n=Nge(r);vO(n)||Rge(n,{recursive:!0});try{vO(r)&&Cge(r).size>Mge&&Pge(r,wO(n,oH))}catch{}Oge(r,`${JSON.stringify(e)} +`,"utf8")}function SO(t){if(!vO(t))return[];let e=Ige(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function _a(t){return SO(xO(t))}function h_(t){return[...SO(wO(t,iH,oH)),...SO(xO(t))]}function Qr(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 Fge(t){let e;try{e=nH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Dge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Lge(t){try{return nH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Tf(t,e){try{let r=_a(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Lge(t),i=Fge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Tf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var iH,jge,oH,Mge,Nr=y(()=>{"use strict";iH=".cladding",jge="events.log.jsonl",oH="events.log.1.jsonl",Mge=5*1024*1024});import{execFileSync as zge}from"node:child_process";import{existsSync as sH,readdirSync as Uge,readFileSync as qge,statSync as aH}from"node:fs";import{createHash as Bge}from"node:crypto";import{join as $O}from"node:path";function ba(t){try{return zge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function kO(t){let e=[],r=$O(t,"spec.yaml");sH(r)&&aH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=$O(t,"spec",i);if(!(!sH(o)||!aH(o).isDirectory()))for(let s of Uge(o))s.endsWith(".yaml")&&e.push($O(o,s))}e.sort();let n=Bge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(qge(i)),n.update("\0")}return n.digest("hex")}function g_(t,e){let r={featureId:e,gitHead:ba(t),specDigest:kO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function y_(t,e){let r=_a(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 __(t,e,r,n){let i=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Of=y(()=>{"use strict";Nr()});import{readFileSync as Hge,statSync as Gge}from"node:fs";import{extname as Zge,resolve as EO,sep as Vge}from"node:path";function en(t){return Math.ceil(t.length/4)}function Jge(t,e){let r=EO(e),n=EO(r,t);return n===r||n.startsWith(r+Vge)}function lH(t,e,r,n){if(!Jge(t,e))return{path:t,omitted:"unsafe-path"};if(!Wge.has(Zge(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>cH)return{path:t,omitted:"too-large",bytes:o}}else{let l=EO(e,t);try{o=Gge(l).size}catch{return{path:t,omitted:"missing"}}if(o>cH)return{path:t,omitted:"too-large",bytes:o};try{i=Hge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Kge))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 Bge,oH,Hge,g_=y(()=>{"use strict";Bge=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"]),oH=2e6,Hge="\0"});function Vge(t){for(let i of Zge)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 kO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Wge(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??[])kO(e,s,o);for(let s of i.modules??[])kO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Vge(a);c&&kO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=aH.get(t);return e||(e=Wge(t),aH.set(t,e)),e}var Zge,aH,_a=y(()=>{"use strict";Zge=["derived:","fixture:","script:","self-dogfood:"];aH=new WeakMap});function EO(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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=Kge(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=EO(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:AO(i)}}var ba=y(()=>{"use strict";_a()});function cH(t){return t.impacted.length}function __(t,e,r={}){let n=r.initialDepth??y_.initialDepth,i=r.maxDepth??y_.maxDepth,o=r.coverageThreshold??y_.coverageThreshold,s=r.marginYieldThreshold??y_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=EO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=cH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var y_,TO=y(()=>{"use strict";ba();_a();y_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function Jge(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 lH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=Jge(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 uH=y(()=>{"use strict"});function Yge(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 nl(t,e){let r=Yge(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=lH(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 b_=y(()=>{"use strict";uH()});import{existsSync as fH,readdirSync as Xge,readFileSync as Qge}from"node:fs";import{join as RO}from"node:path";function PO(t,e=tye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function rye(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:PO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:PO(`done reverted \u2014 pre-push strict gate red${r}`)}}function dH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function nye(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 PO(n)}function iye(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)=>dH(m)-dH(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(-eye).map(rye),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?nye(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 OO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function oye(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 sye(t,e,r){let n=OO(t,/_Rolled back at_\s*`([^`]+)`/),i=OO(t,/Last failed gate:\s*`([^`]+)`/),o=OO(t,/Retry attempts:\s*(\d+)/),s=oye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function aye(t,e){let r=RO(t,".cladding","post-mortems");if(!fH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of Xge(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(sye(Qge(RO(r,o),"utf8"),e,o))}catch{}return i}function pH(t,e){try{let r=f_(t),n=aye(t,e),i=fH(RO(t,".cladding","events.log.1.jsonl"));return iye(r,n,e,{truncated:i})}catch{return}}var eye,tye,mH=y(()=>{"use strict";Nr();eye=5,tye=120});function v_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function va(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:cye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let oe=[...a].sort();o=oe[0],oe.length>1&&(s=oe)}let c=nl(t,o);if("not_found"in c)return c;let l=c.focus,u=pH(n,l.id),d=a&&a.size>0?e:l.id,f=__(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(oe=>oe.ears==="unwanted"||oe.ears==="state").map(oe=>({id:oe.id,ears:String(oe.ears)})),S=[...new Set(b.flatMap(oe=>oe.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}},O=[...c.ancestors];for(;O.length>lye&&v_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${oe} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${oe}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(oe,Ie)=>({impacted:oe,regression_tests:Ie,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(oe,Ie,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],io={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(oe,Ie),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(io))>i},se=m,Y=h;if($(se,Y,0,0)){let oe=br(t,d,{depth:1}),Ie=new Set("not_found"in oe?[]:oe.impacted.map(de=>de.id)),Kt=new Set("not_found"in oe?[]:oe.test_refs),Yt=[...m.filter(de=>Ie.has(de.id)),...m.filter(de=>!Ie.has(de.id))],io=0;for(;Yt.length>Ie.size&&$(Yt,Y,io,0);)Yt=Yt.slice(0,-1),io++;let vi=[...h],Yr=0;for(;$(Yt,vi,io,Yr);){let de=-1;for(let oo=vi.length-1;oo>=0;oo--)if(!Kt.has(vi[oo])){de=oo;break}if(de<0)break;vi.splice(de,1),Yr++}se=Yt,Y=vi,io+Yr>0&&x.push(`breaks: omitted ${io} feature(s) / ${Yr} test(s)`),$(se,Y,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Oe=D(se,Y),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Oe},I=C;if(u){let oe={...C,prior_attempts:u};en(JSON.stringify(oe))<=i?I=oe:x.push("prior_attempts: omitted (budget)")}let Pr=en(JSON.stringify(I));return{...I,budget:{max_tokens:i,used_tokens:Pr,truncated:x}}}var cye,lye,S_=y(()=>{"use strict";g_();b_();TO();mH();ba();_a();cye=3e3,lye=3});function Kn(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 uye(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 hH(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=va(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=va(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=__(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:uye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var il,w_=y(()=>{"use strict";g_();TO();S_();_a();il="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as dye,existsSync as IO,mkdirSync as fye,readFileSync as gH}from"node:fs";import{dirname as pye,join as mye}from"node:path";function CO(t){return mye(t,hye,gye)}function yye(t,e){return{timestamp:new Date().toISOString(),head:ya(t),spec_digest:xO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function yH(t,e){try{let r=yye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=DO(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=CO(t),s=pye(o);return IO(s)||fye(s,{recursive:!0}),dye(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function _H(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 DO(t,e){let r=CO(t);if(!IO(r))return[];let n;try{n=gH(r,"utf8")}catch{return[]}let i=_H(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function bH(t){let e=CO(t);if(!IO(e))return{snapshots:[],unreadable:!1};let r;try{r=gH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=_H(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Of(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 vH(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?` (${Of(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(` ${il}`),i.join(` -`)}var hye,gye,Rf=y(()=>{"use strict";Tf();w_();hye=".cladding",gye="measure.jsonl"});import{existsSync as _ye}from"node:fs";import{join as bye}from"node:path";function ol(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}** (${vye[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 wH(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 ${Of(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Of(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Of(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`,"",il),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"} | ${wye(l,r)} |`)}return n.join(` -`)}function wye(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 Sye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${_ye(bye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function al(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),SH(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)SH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function SH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=yO(r);n&&t.push(`- ${n}`)}t.push("")}var vye,Sye,x_=y(()=>{"use strict";Rf();w_();rl();vye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Sye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as xye}from"node:fs";function ki(t="./spec.yaml"){let e=xye(t,"utf8");return(0,xH.parse)(e)}var xH,$_=y(()=>{"use strict";xH=St(Qt(),1)});var ts=v((jr,FO)=>{"use strict";var NO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+kH(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()};NO.prototype.toString=function(){return this.property+" "+this.message};var k_=jr.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};k_.prototype.addError=function(e){var r;if(typeof e=="string")r=new NO(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 NO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new Sa(this);if(this.throwError)throw r;return r};k_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function $ye(t,e){return e+": "+t.toString()+` -`}k_.prototype.toString=function(e){return this.errors.map($ye).join("")};Object.defineProperty(k_.prototype,"valid",{get:function(){return!this.errors.length}});FO.exports.ValidatorResultError=Sa;function Sa(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Sa),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}Sa.prototype=new Error;Sa.prototype.constructor=Sa;Sa.prototype.name="Validation Error";var $H=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};$H.prototype=Object.create(Error.prototype,{constructor:{value:$H,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var jO=jr.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+kH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};jO.prototype.resolve=function(e){return EH(this.base,e)};jO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=EH(this.base,i||"");var s=new jO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var kH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 kye(t,e,r,n){typeof r=="object"?e[n]=MO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Eye(t,e,r){e[r]=t[r]}function Aye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=MO(t[n],e[n]):r[n]=e[n]}function MO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(kye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Eye.bind(null,t,n)),Object.keys(e).forEach(Aye.bind(null,t,e,n))),n}FO.exports.deepMerge=MO;jr.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 Tye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Tye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var EH=jr.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 RH=v((oXe,OH)=>{"use strict";var tn=ts(),Fe=tn.ValidatorResult,rs=tn.SchemaError,LO={};LO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=LO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 zO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new rs("anyOf must be an array");if(!r.anyOf.some(zO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new rs("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new rs("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(zO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=zO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 UO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new rs('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(UO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=UO(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 AH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 rs('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&&AH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)AH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Oye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var qO=ts();BO.exports.SchemaScanResult=PH;function PH(t,e){this.id=t,this.ref=e}BO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=qO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=qO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!qO.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 IH=RH(),ns=ts(),CH=E_().scan,DH=ns.ValidatorResult,Rye=ns.ValidatorResultError,Pf=ns.SchemaError,NH=ns.SchemaContext,Pye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ei),this.attributes=Object.create(IH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=CH(r||Pye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ns.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Pf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Pf('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 Ei=Jt.prototype.types={};Ei.string=function(e){return typeof e=="string"};Ei.number=function(e){return typeof e=="number"&&isFinite(e)};Ei.integer=function(e){return typeof e=="number"&&e%1===0};Ei.boolean=function(e){return typeof e=="boolean"};Ei.array=function(e){return Array.isArray(e)};Ei.null=function(e){return e===null};Ei.date=function(e){return e instanceof Date};Ei.any=function(e){return!0};Ei.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};MH.exports=Jt});var LH=v((cXe,lo)=>{"use strict";var Iye=lo.exports.Validator=FH();lo.exports.ValidatorResult=ts().ValidatorResult;lo.exports.ValidatorResultError=ts().ValidatorResultError;lo.exports.ValidationError=ts().ValidationError;lo.exports.SchemaError=ts().SchemaError;lo.exports.SchemaScanResult=E_().SchemaScanResult;lo.exports.scan=E_().scan;lo.exports.validate=function(t,e,r){var n=new Iye;return n.validate(t,e,r)}});import{readFileSync as Cye}from"node:fs";import{dirname as Dye,join as Nye}from"node:path";import{fileURLToPath as jye}from"node:url";function Uye(t){let e=zye.validate(t,Lye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function UH(t){let e=Uye(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 Wge,cH,Kge,b_=y(()=>{"use strict";Wge=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"]),cH=2e6,Kge="\0"});function Xge(t){for(let i of Yge)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 AO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Qge(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??[])AO(e,s,o);for(let s of i.modules??[])AO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Xge(a);c&&AO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=uH.get(t);return e||(e=Qge(t),uH.set(t,e)),e}var Yge,uH,va=y(()=>{"use strict";Yge=["derived:","fixture:","script:","self-dogfood:"];uH=new WeakMap});function TO(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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=eye(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=TO(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:OO(i)}}var Sa=y(()=>{"use strict";va()});function dH(t){return t.impacted.length}function S_(t,e,r={}){let n=r.initialDepth??v_.initialDepth,i=r.maxDepth??v_.maxDepth,o=r.coverageThreshold??v_.coverageThreshold,s=r.marginYieldThreshold??v_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=TO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=dH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var v_,RO=y(()=>{"use strict";Sa();va();v_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function tye(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 fH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=tye(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 pH=y(()=>{"use strict"});function rye(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 il(t,e){let r=rye(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=fH(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 w_=y(()=>{"use strict";pH()});import{existsSync as hH,readdirSync as nye,readFileSync as iye}from"node:fs";import{join as PO}from"node:path";function CO(t,e=sye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function aye(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:CO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:CO(`done reverted \u2014 pre-push strict gate red${r}`)}}function mH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function cye(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 CO(n)}function lye(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)=>mH(m)-mH(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(-oye).map(aye),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?cye(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 IO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function uye(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 dye(t,e,r){let n=IO(t,/_Rolled back at_\s*`([^`]+)`/),i=IO(t,/Last failed gate:\s*`([^`]+)`/),o=IO(t,/Retry attempts:\s*(\d+)/),s=uye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function fye(t,e){let r=PO(t,".cladding","post-mortems");if(!hH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of nye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(dye(iye(PO(r,o),"utf8"),e,o))}catch{}return i}function gH(t,e){try{let r=h_(t),n=fye(t,e),i=hH(PO(t,".cladding","events.log.1.jsonl"));return lye(r,n,e,{truncated:i})}catch{return}}var oye,sye,yH=y(()=>{"use strict";Nr();oye=5,sye=120});function x_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function wa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:pye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let oe=[...a].sort();o=oe[0],oe.length>1&&(s=oe)}let c=il(t,o);if("not_found"in c)return c;let l=c.focus,u=gH(n,l.id),d=a&&a.size>0?e:l.id,f=S_(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(oe=>oe.ears==="unwanted"||oe.ears==="state").map(oe=>({id:oe.id,ears:String(oe.ears)})),S=[...new Set(b.flatMap(oe=>oe.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}},O=[...c.ancestors];for(;O.length>mye&&x_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${oe} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${oe}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(oe,Pe)=>({impacted:oe,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(oe,Pe,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],so={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(oe,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(so))>i},se=m,Y=h;if($(se,Y,0,0)){let oe=br(t,d,{depth:1}),Pe=new Set("not_found"in oe?[]:oe.impacted.map(de=>de.id)),Kt=new Set("not_found"in oe?[]:oe.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],so=0;for(;Yt.length>Pe.size&&$(Yt,Y,so,0);)Yt=Yt.slice(0,-1),so++;let vi=[...h],Yr=0;for(;$(Yt,vi,so,Yr);){let de=-1;for(let ao=vi.length-1;ao>=0;ao--)if(!Kt.has(vi[ao])){de=ao;break}if(de<0)break;vi.splice(de,1),Yr++}se=Yt,Y=vi,so+Yr>0&&x.push(`breaks: omitted ${so} feature(s) / ${Yr} test(s)`),$(se,Y,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Oe=D(se,Y),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Oe},P=C;if(u){let oe={...C,prior_attempts:u};en(JSON.stringify(oe))<=i?P=oe:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var pye,mye,$_=y(()=>{"use strict";b_();w_();RO();yH();Sa();va();pye=3e3,mye=3});function Kn(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 hye(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 _H(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=wa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=wa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=S_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:hye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var ol,k_=y(()=>{"use strict";b_();RO();$_();va();ol="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as gye,existsSync as DO,mkdirSync as yye,readFileSync as bH}from"node:fs";import{dirname as _ye,join as bye}from"node:path";function NO(t){return bye(t,vye,Sye)}function wye(t,e){return{timestamp:new Date().toISOString(),head:ba(t),spec_digest:kO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function vH(t,e){try{let r=wye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=jO(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=NO(t),s=_ye(o);return DO(s)||yye(s,{recursive:!0}),gye(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function SH(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 jO(t,e){let r=NO(t);if(!DO(r))return[];let n;try{n=bH(r,"utf8")}catch{return[]}let i=SH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function wH(t){let e=NO(t);if(!DO(e))return{snapshots:[],unreadable:!1};let r;try{r=bH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=SH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Rf(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 xH(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?` (${Rf(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(` ${ol}`),i.join(` +`)}var vye,Sye,If=y(()=>{"use strict";Of();k_();vye=".cladding",Sye="measure.jsonl"});import{existsSync as xye}from"node:fs";import{join as $ye}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}** (${kye[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 kH(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 ${Rf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Rf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Rf(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`,"",ol),r.join(` +`)}function al(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"} | ${Aye(l,r)} |`)}return n.join(` +`)}function Aye(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 Eye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${xye($ye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function cl(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),$H(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)$H(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function $H(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=bO(r);n&&t.push(`- ${n}`)}t.push("")}var kye,Eye,E_=y(()=>{"use strict";If();k_();nl();kye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Eye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Tye}from"node:fs";function ki(t="./spec.yaml"){let e=Tye(t,"utf8");return(0,EH.parse)(e)}var EH,A_=y(()=>{"use strict";EH=St(Qt(),1)});var rs=v((jr,zO)=>{"use strict";var MO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+TH(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()};MO.prototype.toString=function(){return this.property+" "+this.message};var T_=jr.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};T_.prototype.addError=function(e){var r;if(typeof e=="string")r=new MO(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 MO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new xa(this);if(this.throwError)throw r;return r};T_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Oye(t,e){return e+": "+t.toString()+` +`}T_.prototype.toString=function(e){return this.errors.map(Oye).join("")};Object.defineProperty(T_.prototype,"valid",{get:function(){return!this.errors.length}});zO.exports.ValidatorResultError=xa;function xa(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,xa),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}xa.prototype=new Error;xa.prototype.constructor=xa;xa.prototype.name="Validation Error";var AH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};AH.prototype=Object.create(Error.prototype,{constructor:{value:AH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var FO=jr.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+TH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};FO.prototype.resolve=function(e){return OH(this.base,e)};FO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=OH(this.base,i||"");var s=new FO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var TH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 Rye(t,e,r,n){typeof r=="object"?e[n]=LO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Iye(t,e,r){e[r]=t[r]}function Pye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=LO(t[n],e[n]):r[n]=e[n]}function LO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Rye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Iye.bind(null,t,n)),Object.keys(e).forEach(Pye.bind(null,t,e,n))),n}zO.exports.deepMerge=LO;jr.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 Cye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Cye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var OH=jr.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 CH=v((hXe,PH)=>{"use strict";var tn=rs(),Fe=tn.ValidatorResult,ns=tn.SchemaError,UO={};UO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=UO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 qO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new ns("anyOf must be an array");if(!r.anyOf.some(qO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new ns("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new ns("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(qO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=qO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 BO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new ns('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(BO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 ns('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=BO(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 RH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 ns('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&&RH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)RH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Dye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var HO=rs();GO.exports.SchemaScanResult=DH;function DH(t,e){this.id=t,this.ref=e}GO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=HO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=HO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!HO.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 NH=CH(),is=rs(),jH=O_().scan,MH=is.ValidatorResult,Nye=is.ValidatorResultError,Pf=is.SchemaError,FH=is.SchemaContext,jye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ei),this.attributes=Object.create(NH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=jH(r||jye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=is.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Pf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Pf('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 Ei=Jt.prototype.types={};Ei.string=function(e){return typeof e=="string"};Ei.number=function(e){return typeof e=="number"&&isFinite(e)};Ei.integer=function(e){return typeof e=="number"&&e%1===0};Ei.boolean=function(e){return typeof e=="boolean"};Ei.array=function(e){return Array.isArray(e)};Ei.null=function(e){return e===null};Ei.date=function(e){return e instanceof Date};Ei.any=function(e){return!0};Ei.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};zH.exports=Jt});var qH=v((_Xe,fo)=>{"use strict";var Mye=fo.exports.Validator=UH();fo.exports.ValidatorResult=rs().ValidatorResult;fo.exports.ValidatorResultError=rs().ValidatorResultError;fo.exports.ValidationError=rs().ValidationError;fo.exports.SchemaError=rs().SchemaError;fo.exports.SchemaScanResult=O_().SchemaScanResult;fo.exports.scan=O_().scan;fo.exports.validate=function(t,e,r){var n=new Mye;return n.validate(t,e,r)}});import{readFileSync as Fye}from"node:fs";import{dirname as Lye,join as zye}from"node:path";import{fileURLToPath as Uye}from"node:url";function Zye(t){let e=Gye.validate(t,Hye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function HH(t){let e=Zye(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var zH,Mye,Fye,Lye,zye,qH=y(()=>{"use strict";zH=St(LH(),1),Mye=Dye(jye(import.meta.url)),Fye=Nye(Mye,"schema.json"),Lye=JSON.parse(Cye(Fye,"utf8")),zye=new zH.Validator});import{existsSync as HO,readdirSync as qye}from"node:fs";import{dirname as Bye,join as wa,resolve as HH}from"node:path";function BH(t){return HO(t)?qye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ki(wa(t,r))):[]}function xa(t,e){A_=e?{cwd:HH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return A_&&e==="spec.yaml"&&HH(t)===A_.cwd?A_.spec:Hye(t,e)}function Hye(t,e){let r=wa(t,e),n=ki(r),i=wa(t,Bye(e),"spec");if(!n.features||n.features.length===0){let o=BH(wa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=BH(wa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=wa(i,"architecture.yaml");HO(o)&&(n.architecture=ki(o))}if(!n.capabilities||n.capabilities.length===0){let o=wa(i,"capabilities.yaml");if(HO(o)){let s=ki(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return UH(n),n}var A_,qe=y(()=>{"use strict";$_();qH();A_=null});import cl from"node:process";function VO(){return!!cl.stdout.isTTY}function U(t,e,r=""){let n=GH[t],i=r?` ${r}`:"";VO()?cl.stdout.write(`${GO[t]}${n}${ZO} ${e}${i} -`):cl.stdout.write(`${n} ${e}${i} -`)}function If(t,e,r=""){if(!VO())return;let n=r?` ${r}`:"";cl.stdout.write(`${ZH}${GO.start}\xB7${ZO} ${t} \xB7 ${e}${n}`)}function $a(t,e,r=""){let n=GH[t],i=r?` ${r}`:"";VO()?cl.stdout.write(`${ZH}${GO[t]}${n}${ZO} ${e}${i} -`):cl.stdout.write(`${n} ${e}${i} -`)}var GH,GO,ZO,ZH,Ai=y(()=>{"use strict";GH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},GO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},ZO="\x1B[0m",ZH="\r\x1B[K"});import{createHash as pG}from"node:crypto";import{existsSync as w_e,readFileSync as JO,writeFileSync as x_e}from"node:fs";import{join as T_}from"node:path";function $_e(t,e){let r=pG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(JO(T_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function hG(t,e){let r=pG("sha256");try{r.update(JO(T_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function is(t){let e=T_(t,...mG);if(!w_e(e))return null;let r;try{r=JO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function O_(t){return t.features?.size??t.v1?.size??0}function R_(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)!==hG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===$_e(e,n)?{state:"fresh"}:{state:"stale"}}function gG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${hG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=k_e+`attested_modules: + `)}`)}var BH,qye,Bye,Hye,Gye,GH=y(()=>{"use strict";BH=St(qH(),1),qye=Lye(Uye(import.meta.url)),Bye=zye(qye,"schema.json"),Hye=JSON.parse(Fye(Bye,"utf8")),Gye=new BH.Validator});import{existsSync as ZO,readdirSync as Vye}from"node:fs";import{dirname as Wye,join as $a,resolve as VH}from"node:path";function ZH(t){return ZO(t)?Vye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ki($a(t,r))):[]}function ka(t,e){R_=e?{cwd:VH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return R_&&e==="spec.yaml"&&VH(t)===R_.cwd?R_.spec:Kye(t,e)}function Kye(t,e){let r=$a(t,e),n=ki(r),i=$a(t,Wye(e),"spec");if(!n.features||n.features.length===0){let o=ZH($a(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=ZH($a(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=$a(i,"architecture.yaml");ZO(o)&&(n.architecture=ki(o))}if(!n.capabilities||n.capabilities.length===0){let o=$a(i,"capabilities.yaml");if(ZO(o)){let s=ki(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return HH(n),n}var R_,qe=y(()=>{"use strict";A_();GH();R_=null});import ll from"node:process";function KO(){return!!ll.stdout.isTTY}function U(t,e,r=""){let n=WH[t],i=r?` ${r}`:"";KO()?ll.stdout.write(`${VO[t]}${n}${WO} ${e}${i} +`):ll.stdout.write(`${n} ${e}${i} +`)}function Cf(t,e,r=""){if(!KO())return;let n=r?` ${r}`:"";ll.stdout.write(`${KH}${VO.start}\xB7${WO} ${t} \xB7 ${e}${n}`)}function Ea(t,e,r=""){let n=WH[t],i=r?` ${r}`:"";KO()?ll.stdout.write(`${KH}${VO[t]}${n}${WO} ${e}${i} +`):ll.stdout.write(`${n} ${e}${i} +`)}var WH,VO,WO,KH,Ai=y(()=>{"use strict";WH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},VO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},WO="\x1B[0m",KH="\r\x1B[K"});import{createHash as gG}from"node:crypto";import{existsSync as A_e,readFileSync as XO,writeFileSync as T_e}from"node:fs";import{join as I_}from"node:path";function O_e(t,e){let r=gG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(XO(I_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function _G(t,e){let r=gG("sha256");try{r.update(XO(I_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function os(t){let e=I_(t,...yG);if(!A_e(e))return null;let r;try{r=XO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function P_(t){return t.features?.size??t.v1?.size??0}function C_(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)!==_G(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===O_e(e,n)?{state:"fresh"}:{state:"stale"}}function bG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${_G(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=R_e+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return x_e(T_(t,...mG),s,"utf8"),!0}var mG,k_e,ul=y(()=>{"use strict";mG=["spec","attestation.yaml"];k_e=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return T_e(I_(t,...yG),s,"utf8"),!0}var yG,R_e,dl=y(()=>{"use strict";yG=["spec","attestation.yaml"];R_e=`# 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. # @@ -211,52 +211,53 @@ 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 YO}from"node:path";function P_(t){os={cwd:YO(t),results:new Map}}function yG(t,e,r){!os||os.cwd!==YO(e)||os.results.set(t,r)}function I_(t,e){return!os||os.cwd!==YO(e)?null:os.results.get(t)??null}function C_(){os=null}var os,dl=y(()=>{"use strict";os=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 fo=y(()=>{});import{fileURLToPath as E_e}from"node:url";var fl,A_e,XO,QO,pl=y(()=>{fl=(t,e)=>{let r=QO(A_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},A_e=t=>XO(t)?t.toString():t,XO=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,QO=t=>t instanceof URL?E_e(t):t});var D_,eR=y(()=>{fo();pl();D_=(t,e=[],r={})=>{let n=fl(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 T_e}from"node:string_decoder";var _G,bG,Ut,po,O_e,vG,R_e,N_,SG,P_e,Nf,I_e,tR,C_e,rn=y(()=>{({toString:_G}=Object.prototype),bG=t=>_G.call(t)==="[object ArrayBuffer]",Ut=t=>_G.call(t)==="[object Uint8Array]",po=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),O_e=new TextEncoder,vG=t=>O_e.encode(t),R_e=new TextDecoder,N_=t=>R_e.decode(t),SG=(t,e)=>P_e(t,e).join(""),P_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new T_e(e),n=t.map(o=>typeof o=="string"?vG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Nf=t=>t.length===1&&Ut(t[0])?t[0]:tR(I_e(t)),I_e=t=>t.map(e=>typeof e=="string"?vG(e):e),tR=t=>{let e=new Uint8Array(C_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},C_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as D_e}from"node:child_process";var kG,EG,N_e,j_e,wG,M_e,xG,$G,F_e,AG=y(()=>{fo();rn();kG=t=>Array.isArray(t)&&Array.isArray(t.raw),EG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=N_e({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,{}]},N_e=({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}=j_e(i,t.raw[n]),c=xG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>$G(d)):[$G(l)];return xG(c,u,a)},j_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=wG.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)],$G=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 F_e(t);throw t instanceof D_e||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`)},F_e=({stdout:t})=>{if(typeof t=="string")return t;if(Ut(t))return N_(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 rR from"node:process";var Yn,j_,En,M_,mo=y(()=>{Yn=t=>j_.includes(t),j_=[rR.stdin,rR.stdout,rR.stderr],En=["stdin","stdout","stderr"],M_=t=>En[t]??`stdio[${t}]`});import{debuglog as L_e}from"node:util";var OG,nR,z_e,U_e,q_e,B_e,TG,H_e,iR,G_e,Z_e,V_e,W_e,oR,ho,go=y(()=>{fo();mo();OG=t=>{let e={...t};for(let r of oR)e[r]=nR(t,r);return e},nR=(t,e)=>{let r=Array.from({length:z_e(t)+1}),n=U_e(t[e],r,e);return Z_e(n,e)},z_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,U_e=(t,e,r)=>Ot(t)?q_e(t,e,r):e.fill(t),q_e=(t,e,r)=>{for(let n of Object.keys(t).sort(B_e))for(let i of H_e(n,r,e))e[i]=t[n];return e},B_e=(t,e)=>TG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,H_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=iR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as QO}from"node:path";function D_(t){ss={cwd:QO(t),results:new Map}}function vG(t,e,r){!ss||ss.cwd!==QO(e)||ss.results.set(t,r)}function N_(t,e){return!ss||ss.cwd!==QO(e)?null:ss.results.get(t)??null}function j_(){ss=null}var ss,fl=y(()=>{"use strict";ss=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 mo=y(()=>{});import{fileURLToPath as I_e}from"node:url";var pl,P_e,eR,tR,ml=y(()=>{pl=(t,e)=>{let r=tR(P_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},P_e=t=>eR(t)?t.toString():t,eR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,tR=t=>t instanceof URL?I_e(t):t});var M_,rR=y(()=>{mo();ml();M_=(t,e=[],r={})=>{let n=pl(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 C_e}from"node:string_decoder";var SG,wG,Ut,ho,D_e,xG,N_e,F_,$G,j_e,jf,M_e,nR,F_e,rn=y(()=>{({toString:SG}=Object.prototype),wG=t=>SG.call(t)==="[object ArrayBuffer]",Ut=t=>SG.call(t)==="[object Uint8Array]",ho=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),D_e=new TextEncoder,xG=t=>D_e.encode(t),N_e=new TextDecoder,F_=t=>N_e.decode(t),$G=(t,e)=>j_e(t,e).join(""),j_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new C_e(e),n=t.map(o=>typeof o=="string"?xG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},jf=t=>t.length===1&&Ut(t[0])?t[0]:nR(M_e(t)),M_e=t=>t.map(e=>typeof e=="string"?xG(e):e),nR=t=>{let e=new Uint8Array(F_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},F_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as L_e}from"node:child_process";var TG,OG,z_e,U_e,kG,q_e,EG,AG,B_e,RG=y(()=>{mo();rn();TG=t=>Array.isArray(t)&&Array.isArray(t.raw),OG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=z_e({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,{}]},z_e=({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}=U_e(i,t.raw[n]),c=EG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>AG(d)):[AG(l)];return EG(c,u,a)},U_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=kG.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)],AG=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 B_e(t);throw t instanceof L_e||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`)},B_e=({stdout:t})=>{if(typeof t=="string")return t;if(Ut(t))return F_(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 iR from"node:process";var Yn,L_,En,z_,go=y(()=>{Yn=t=>L_.includes(t),L_=[iR.stdin,iR.stdout,iR.stderr],En=["stdin","stdout","stderr"],z_=t=>En[t]??`stdio[${t}]`});import{debuglog as H_e}from"node:util";var PG,oR,G_e,Z_e,V_e,W_e,IG,K_e,sR,J_e,Y_e,X_e,Q_e,aR,yo,_o=y(()=>{mo();go();PG=t=>{let e={...t};for(let r of aR)e[r]=oR(t,r);return e},oR=(t,e)=>{let r=Array.from({length:G_e(t)+1}),n=Z_e(t[e],r,e);return Y_e(n,e)},G_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,Z_e=(t,e,r)=>Ot(t)?V_e(t,e,r):e.fill(t),V_e=(t,e,r)=>{for(let n of Object.keys(t).sort(W_e))for(let i of K_e(n,r,e))e[i]=t[n];return e},W_e=(t,e)=>IG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,K_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=sR(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]},iR=t=>{if(t==="all")return t;if(En.includes(t))return En.indexOf(t);let e=G_e.exec(t);if(e!==null)return Number(e[1])},G_e=/^fd(\d+)$/,Z_e=(t,e)=>t.map(r=>r===void 0?W_e[e]:r),V_e=L_e("execa").enabled?"full":"none",W_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:V_e,stripFinalNewline:!0},oR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],ho=(t,e)=>e==="ipc"?t.at(-1):t[e]});var ml,hl,RG,sR,K_e,F_,L_,ss=y(()=>{go();ml=({verbose:t},e)=>sR(t,e)!=="none",hl=({verbose:t},e)=>!["none","short"].includes(sR(t,e)),RG=({verbose:t},e)=>{let r=sR(t,e);return F_(r)?r:void 0},sR=(t,e)=>e===void 0?K_e(t):ho(t,e),K_e=t=>t.find(e=>F_(e))??L_.findLast(e=>t.includes(e)),F_=t=>typeof t=="function",L_=["none","short","full"]});import{platform as J_e}from"node:process";import{stripVTControlCharacters as Y_e}from"node:util";var PG,jf,IG,X_e,Q_e,ebe,tbe,rbe,nbe,ibe,z_=y(()=>{PG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>nbe(IG(o))).join(" ");return{command:n,escapedCommand:i}},jf=t=>Y_e(t).split(` -`).map(e=>IG(e)).join(` -`),IG=t=>t.replaceAll(ebe,e=>X_e(e)),X_e=t=>{let e=tbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=rbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Q_e=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},ebe=Q_e(),tbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},rbe=65535,nbe=t=>ibe.test(t)?t:J_e==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,ibe=/^[\w./-]+$/});import CG from"node:process";function aR(){let{env:t}=CG,{TERM:e,TERM_PROGRAM:r}=t;return CG.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 DG=y(()=>{});var NG,jG,obe,sbe,abe,cbe,lbe,U_,f7e,MG=y(()=>{DG();NG={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"},jG={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"},obe={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"},sbe={...NG,...jG},abe={...NG,...obe},cbe=aR(),lbe=cbe?sbe:abe,U_=lbe,f7e=Object.entries(jG)});import ube from"node:tty";var dbe,_e,h7e,FG,g7e,y7e,_7e,b7e,v7e,S7e,w7e,x7e,$7e,k7e,E7e,A7e,T7e,O7e,R7e,q_,P7e,I7e,C7e,D7e,N7e,j7e,M7e,F7e,L7e,LG,z7e,zG,U7e,q7e,B7e,H7e,G7e,Z7e,V7e,W7e,K7e,J7e,Y7e,cR=y(()=>{dbe=ube?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!dbe)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}},h7e=_e(0,0),FG=_e(1,22),g7e=_e(2,22),y7e=_e(3,23),_7e=_e(4,24),b7e=_e(53,55),v7e=_e(7,27),S7e=_e(8,28),w7e=_e(9,29),x7e=_e(30,39),$7e=_e(31,39),k7e=_e(32,39),E7e=_e(33,39),A7e=_e(34,39),T7e=_e(35,39),O7e=_e(36,39),R7e=_e(37,39),q_=_e(90,39),P7e=_e(40,49),I7e=_e(41,49),C7e=_e(42,49),D7e=_e(43,49),N7e=_e(44,49),j7e=_e(45,49),M7e=_e(46,49),F7e=_e(47,49),L7e=_e(100,49),LG=_e(91,39),z7e=_e(92,39),zG=_e(93,39),U7e=_e(94,39),q7e=_e(95,39),B7e=_e(96,39),H7e=_e(97,39),G7e=_e(101,49),Z7e=_e(102,49),V7e=_e(103,49),W7e=_e(104,49),K7e=_e(105,49),J7e=_e(106,49),Y7e=_e(107,49)});var UG=y(()=>{cR();cR()});var HG,pbe,B_,qG,mbe,BG,hbe,GG=y(()=>{MG();UG();HG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=pbe(r),c=mbe[t]({failed:o,reject:s,piped:n}),l=hbe[t]({reject:s});return`${q_(`[${a}]`)} ${q_(`[${i}]`)} ${l(c)} ${l(e)}`},pbe=t=>`${B_(t.getHours(),2)}:${B_(t.getMinutes(),2)}:${B_(t.getSeconds(),2)}.${B_(t.getMilliseconds(),3)}`,B_=(t,e)=>String(t).padStart(e,"0"),qG=({failed:t,reject:e})=>t?e?U_.cross:U_.warning:U_.tick,mbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:qG,duration:qG},BG=t=>t,hbe={command:()=>FG,output:()=>BG,ipc:()=>BG,error:({reject:t})=>t?LG:zG,duration:()=>q_}});var ZG,gbe,ybe,VG=y(()=>{ss();ZG=(t,e,r)=>{let n=RG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>gbe(i,o,n)).filter(i=>i!==void 0).map(i=>ybe(i)).join("")},gbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},ybe=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},sR=t=>{if(t==="all")return t;if(En.includes(t))return En.indexOf(t);let e=J_e.exec(t);if(e!==null)return Number(e[1])},J_e=/^fd(\d+)$/,Y_e=(t,e)=>t.map(r=>r===void 0?Q_e[e]:r),X_e=H_e("execa").enabled?"full":"none",Q_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:X_e,stripFinalNewline:!0},aR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],yo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var hl,gl,CG,cR,ebe,U_,q_,as=y(()=>{_o();hl=({verbose:t},e)=>cR(t,e)!=="none",gl=({verbose:t},e)=>!["none","short"].includes(cR(t,e)),CG=({verbose:t},e)=>{let r=cR(t,e);return U_(r)?r:void 0},cR=(t,e)=>e===void 0?ebe(t):yo(t,e),ebe=t=>t.find(e=>U_(e))??q_.findLast(e=>t.includes(e)),U_=t=>typeof t=="function",q_=["none","short","full"]});import{platform as tbe}from"node:process";import{stripVTControlCharacters as rbe}from"node:util";var DG,Mf,NG,nbe,ibe,obe,sbe,abe,cbe,lbe,B_=y(()=>{DG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>cbe(NG(o))).join(" ");return{command:n,escapedCommand:i}},Mf=t=>rbe(t).split(` +`).map(e=>NG(e)).join(` +`),NG=t=>t.replaceAll(obe,e=>nbe(e)),nbe=t=>{let e=sbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=abe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},ibe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},obe=ibe(),sbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},abe=65535,cbe=t=>lbe.test(t)?t:tbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,lbe=/^[\w./-]+$/});import jG from"node:process";function lR(){let{env:t}=jG,{TERM:e,TERM_PROGRAM:r}=t;return jG.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 MG=y(()=>{});var FG,LG,ube,dbe,fbe,pbe,mbe,H_,w7e,zG=y(()=>{MG();FG={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"},LG={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"},ube={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"},dbe={...FG,...LG},fbe={...FG,...ube},pbe=lR(),mbe=pbe?dbe:fbe,H_=mbe,w7e=Object.entries(LG)});import hbe from"node:tty";var gbe,_e,k7e,UG,E7e,A7e,T7e,O7e,R7e,I7e,P7e,C7e,D7e,N7e,j7e,M7e,F7e,L7e,z7e,G_,U7e,q7e,B7e,H7e,G7e,Z7e,V7e,W7e,K7e,qG,J7e,BG,Y7e,X7e,Q7e,eQe,tQe,rQe,nQe,iQe,oQe,sQe,aQe,uR=y(()=>{gbe=hbe?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!gbe)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}},k7e=_e(0,0),UG=_e(1,22),E7e=_e(2,22),A7e=_e(3,23),T7e=_e(4,24),O7e=_e(53,55),R7e=_e(7,27),I7e=_e(8,28),P7e=_e(9,29),C7e=_e(30,39),D7e=_e(31,39),N7e=_e(32,39),j7e=_e(33,39),M7e=_e(34,39),F7e=_e(35,39),L7e=_e(36,39),z7e=_e(37,39),G_=_e(90,39),U7e=_e(40,49),q7e=_e(41,49),B7e=_e(42,49),H7e=_e(43,49),G7e=_e(44,49),Z7e=_e(45,49),V7e=_e(46,49),W7e=_e(47,49),K7e=_e(100,49),qG=_e(91,39),J7e=_e(92,39),BG=_e(93,39),Y7e=_e(94,39),X7e=_e(95,39),Q7e=_e(96,39),eQe=_e(97,39),tQe=_e(101,49),rQe=_e(102,49),nQe=_e(103,49),iQe=_e(104,49),oQe=_e(105,49),sQe=_e(106,49),aQe=_e(107,49)});var HG=y(()=>{uR();uR()});var VG,_be,Z_,GG,bbe,ZG,vbe,WG=y(()=>{zG();HG();VG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=_be(r),c=bbe[t]({failed:o,reject:s,piped:n}),l=vbe[t]({reject:s});return`${G_(`[${a}]`)} ${G_(`[${i}]`)} ${l(c)} ${l(e)}`},_be=t=>`${Z_(t.getHours(),2)}:${Z_(t.getMinutes(),2)}:${Z_(t.getSeconds(),2)}.${Z_(t.getMilliseconds(),3)}`,Z_=(t,e)=>String(t).padStart(e,"0"),GG=({failed:t,reject:e})=>t?e?H_.cross:H_.warning:H_.tick,bbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:GG,duration:GG},ZG=t=>t,vbe={command:()=>UG,output:()=>ZG,ipc:()=>ZG,error:({reject:t})=>t?qG:BG,duration:()=>G_}});var KG,Sbe,wbe,JG=y(()=>{as();KG=(t,e,r)=>{let n=CG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Sbe(i,o,n)).filter(i=>i!==void 0).map(i=>wbe(i)).join("")},Sbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},wbe=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as _be}from"node:util";var Ti,bbe,vbe,Sbe,H_,wbe,gl=y(()=>{z_();GG();VG();Ti=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=bbe({type:t,result:i,verboseInfo:n}),s=vbe(e,o),a=ZG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},bbe=({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}),vbe=(t,e)=>t.split(` -`).map(r=>Sbe({...e,message:r})),Sbe=t=>({verboseLine:HG(t),verboseObject:t}),H_=t=>{let e=typeof t=="string"?t:_be(t);return jf(e).replaceAll(" "," ".repeat(wbe))},wbe=2});var WG,KG=y(()=>{ss();gl();WG=(t,e)=>{ml(e)&&Ti({type:"command",verboseMessage:t,verboseInfo:e})}});var JG,xbe,$be,kbe,YG=y(()=>{ss();JG=(t,e,r)=>{kbe(t);let n=xbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},xbe=t=>ml({verbose:t})?$be++:void 0,$be=0n,kbe=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(!L_.includes(e)&&!F_(e)){let r=L_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as XG}from"node:process";var G_,lR,Z_=y(()=>{G_=()=>XG.bigint(),lR=t=>Number(XG.bigint()-t)/1e6});var V_,uR=y(()=>{KG();YG();Z_();z_();go();V_=(t,e,r)=>{let n=G_(),{command:i,escapedCommand:o}=PG(t,e),s=nR(r,"verbose"),a=JG(s,o,{...r});return WG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var nZ=v((xQe,rZ)=>{rZ.exports=tZ;tZ.sync=Abe;var QG=He("fs");function Ebe(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{aZ.exports=oZ;oZ.sync=Tbe;var iZ=He("fs");function oZ(t,e,r){iZ.stat(t,function(n,i){r(n,n?!1:sZ(i,e))})}function Tbe(t,e){return sZ(iZ.statSync(t),e)}function sZ(t,e){return t.isFile()&&Obe(t,e)}function Obe(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 uZ=v((EQe,lZ)=>{var kQe=He("fs"),W_;process.platform==="win32"||global.TESTING_WINDOWS?W_=nZ():W_=cZ();lZ.exports=dR;dR.sync=Rbe;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)})})}W_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Rbe(t,e){try{return W_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var yZ=v((AQe,gZ)=>{var yl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",dZ=He("path"),Pbe=yl?";":":",fZ=uZ(),pZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),mZ=(t,e)=>{let r=e.colon||Pbe,n=t.match(/\//)||yl&&t.match(/\\/)?[""]:[...yl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=yl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=yl?i.split(r):[""];return yl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},hZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=mZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(pZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=dZ.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];fZ(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)},Ibe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=mZ(t,e),o=[];for(let s=0;s{"use strict";var _Z=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};fR.exports=_Z;fR.exports.default=_Z});var xZ=v((OQe,wZ)=>{"use strict";var vZ=He("path"),Cbe=yZ(),Dbe=bZ();function SZ(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=Cbe.sync(t.command,{path:r[Dbe({env:r})],pathExt:e?vZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=vZ.resolve(i?t.options.cwd:"",s)),s}function Nbe(t){return SZ(t)||SZ(t,!0)}wZ.exports=Nbe});var $Z=v((RQe,mR)=>{"use strict";var pR=/([()\][%!^"`<>&|;, *?])/g;function jbe(t){return t=t.replace(pR,"^$1"),t}function Mbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(pR,"^$1"),e&&(t=t.replace(pR,"^$1")),t}mR.exports.command=jbe;mR.exports.argument=Mbe});var EZ=v((PQe,kZ)=>{"use strict";kZ.exports=/^#!(.*)/});var TZ=v((IQe,AZ)=>{"use strict";var Fbe=EZ();AZ.exports=(t="")=>{let e=t.match(Fbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var RZ=v((CQe,OZ)=>{"use strict";var hR=He("fs"),Lbe=TZ();function zbe(t){let r=Buffer.alloc(150),n;try{n=hR.openSync(t,"r"),hR.readSync(n,r,0,150,0),hR.closeSync(n)}catch{}return Lbe(r.toString())}OZ.exports=zbe});var DZ=v((DQe,CZ)=>{"use strict";var Ube=He("path"),PZ=xZ(),IZ=$Z(),qbe=RZ(),Bbe=process.platform==="win32",Hbe=/\.(?:com|exe)$/i,Gbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Zbe(t){t.file=PZ(t);let e=t.file&&qbe(t.file);return e?(t.args.unshift(t.file),t.command=e,PZ(t)):t.file}function Vbe(t){if(!Bbe)return t;let e=Zbe(t),r=!Hbe.test(e);if(t.options.forceShell||r){let n=Gbe.test(e);t.command=Ube.normalize(t.command),t.command=IZ.command(t.command),t.args=t.args.map(o=>IZ.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 Wbe(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:Vbe(n)}CZ.exports=Wbe});var MZ=v((NQe,jZ)=>{"use strict";var gR=process.platform==="win32";function yR(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 Kbe(t,e){if(!gR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=NZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function NZ(t,e){return gR&&t===1&&!e.file?yR(e.original,"spawn"):null}function Jbe(t,e){return gR&&t===1&&!e.file?yR(e.original,"spawnSync"):null}jZ.exports={hookChildProcess:Kbe,verifyENOENT:NZ,verifyENOENTSync:Jbe,notFoundError:yR}});var zZ=v((jQe,_l)=>{"use strict";var FZ=He("child_process"),_R=DZ(),bR=MZ();function LZ(t,e,r){let n=_R(t,e,r),i=FZ.spawn(n.command,n.args,n.options);return bR.hookChildProcess(i,n),i}function Ybe(t,e,r){let n=_R(t,e,r),i=FZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||bR.verifyENOENTSync(i.status,n),i}_l.exports=LZ;_l.exports.spawn=LZ;_l.exports.sync=Ybe;_l.exports._parse=_R;_l.exports._enoent=bR});function K_(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 UZ=y(()=>{});var qZ=y(()=>{});import{promisify as Xbe}from"node:util";import{execFile as Qbe,execFileSync as UQe}from"node:child_process";import BZ from"node:path";import{fileURLToPath as eve}from"node:url";function J_(t){return t instanceof URL?eve(t):t}function HZ(t){return{*[Symbol.iterator](){let e=BZ.resolve(J_(t)),r;for(;r!==e;)yield e,r=e,e=BZ.resolve(e,"..")}}}var HQe,GQe,GZ=y(()=>{qZ();HQe=Xbe(Qbe);GQe=10*1024*1024});import Y_ from"node:process";import Ea from"node:path";var tve,rve,nve,ZZ,VZ=y(()=>{UZ();GZ();tve=({cwd:t=Y_.cwd(),path:e=Y_.env[K_()],preferLocal:r=!0,execPath:n=Y_.execPath,addExecPath:i=!0}={})=>{let o=Ea.resolve(J_(t)),s=[],a=e.split(Ea.delimiter);return r&&rve(s,a,o),i&&nve(s,a,n,o),e===""||e===Ea.delimiter?`${s.join(Ea.delimiter)}${e}`:[...s,e].join(Ea.delimiter)},rve=(t,e,r)=>{for(let n of HZ(r)){let i=Ea.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},nve=(t,e,r,n)=>{let i=Ea.resolve(n,J_(r),"..");e.includes(i)||t.push(i)},ZZ=({env:t=Y_.env,...e}={})=>{t={...t};let r=K_({env:t});return e.path=t[r],t[r]=tve(e),t}});var WZ,Xn,KZ,JZ,YZ,X_,Mf,Ff,Aa=y(()=>{WZ=(t,e,r)=>{let n=r?Ff:Mf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},KZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,YZ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},JZ=t=>X_(t)&&YZ in t,YZ=Symbol("isExecaError"),X_=t=>Object.prototype.toString.call(t)==="[object Error]",Mf=class extends Error{};KZ(Mf,Mf.name);Ff=class extends Error{};KZ(Ff,Ff.name)});var XZ,ive,QZ,e9,t9=y(()=>{XZ=()=>{let t=e9-QZ+1;return Array.from({length:t},ive)},ive=(t,e)=>({name:`SIGRT${e+1}`,number:QZ+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),QZ=34,e9=64});var r9,n9=y(()=>{r9=[{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 ove}from"node:os";var vR,sve,i9=y(()=>{n9();t9();vR=()=>{let t=XZ();return[...r9,...t].map(sve)},sve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=ove,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as ave}from"node:os";var cve,lve,o9,uve,dve,fve,cet,s9=y(()=>{i9();cve=()=>{let t=vR();return Object.fromEntries(t.map(lve))},lve=({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}],o9=cve(),uve=()=>{let t=vR(),e=65,r=Array.from({length:e},(n,i)=>dve(i,t));return Object.assign({},...r)},dve=(t,e)=>{let r=fve(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}}},fve=(t,e)=>{let r=e.find(({name:n})=>ave.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},cet=uve()});import{constants as Lf}from"node:os";var c9,l9,u9,pve,mve,a9,hve,SR,gve,yve,Q_,zf=y(()=>{s9();c9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return u9(t,e)},l9=t=>t===0?t:u9(t,"`subprocess.kill()`'s argument"),u9=(t,e)=>{if(Number.isInteger(t))return pve(t,e);if(typeof t=="string")return hve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${SR()}`)},pve=(t,e)=>{if(a9.has(t))return a9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${SR()}`)},mve=()=>new Map(Object.entries(Lf.signals).reverse().map(([t,e])=>[e,t])),a9=mve(),hve=(t,e)=>{if(t in Lf.signals)return t;throw t.toUpperCase()in Lf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${SR()}`)},SR=()=>`Available signal names: ${gve()}. -Available signal numbers: ${yve()}.`,gve=()=>Object.keys(Lf.signals).sort().map(t=>`'${t}'`).join(", "),yve=()=>[...new Set(Object.values(Lf.signals).sort((t,e)=>t-e))].join(", "),Q_=t=>o9[t].description});import{setTimeout as _ve}from"node:timers/promises";var d9,bve,f9,vve,Sve,wve,wR,eb=y(()=>{Aa();zf();d9=t=>{if(t===!1)return t;if(t===!0)return bve;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},bve=1e3*5,f9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=vve(s,a,r);Sve(l,n);let u=t(c);return wve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},vve=(t,e,r)=>{let[n=r,i]=X_(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&&!X_(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:l9(n),error:i}},Sve=(t,e)=>{t!==void 0&&e.reject(t)},wve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&wR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},wR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await _ve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as xve}from"node:events";var tb,xR=y(()=>{tb=async(t,e)=>{t.aborted||await xve(t,"abort",{signal:e})}});var p9,m9,$ve,$R=y(()=>{xR();p9=({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)}`)},m9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[$ve(t,e,n,i)],$ve=async(t,e,r,{signal:n})=>{throw await tb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var bl,kve,kR,h9,g9,rb,y9,_9,b9,v9,S9,w9,Eve,Ave,Tve,Qn,Ove,as,vl,Sl=y(()=>{bl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{kve(t,e,r),kR(t,e,n)},kve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},kR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${as(e)} has already exited or disconnected.`)},h9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${as(t)} exited or disconnected.`)},g9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as xbe}from"node:util";var Ti,$be,kbe,Ebe,V_,Abe,yl=y(()=>{B_();WG();JG();Ti=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=$be({type:t,result:i,verboseInfo:n}),s=kbe(e,o),a=KG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},$be=({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}),kbe=(t,e)=>t.split(` +`).map(r=>Ebe({...e,message:r})),Ebe=t=>({verboseLine:VG(t),verboseObject:t}),V_=t=>{let e=typeof t=="string"?t:xbe(t);return Mf(e).replaceAll(" "," ".repeat(Abe))},Abe=2});var YG,XG=y(()=>{as();yl();YG=(t,e)=>{hl(e)&&Ti({type:"command",verboseMessage:t,verboseInfo:e})}});var QG,Tbe,Obe,Rbe,eZ=y(()=>{as();QG=(t,e,r)=>{Rbe(t);let n=Tbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Tbe=t=>hl({verbose:t})?Obe++:void 0,Obe=0n,Rbe=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(!q_.includes(e)&&!U_(e)){let r=q_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as tZ}from"node:process";var W_,dR,K_=y(()=>{W_=()=>tZ.bigint(),dR=t=>Number(tZ.bigint()-t)/1e6});var J_,fR=y(()=>{XG();eZ();K_();B_();_o();J_=(t,e,r)=>{let n=W_(),{command:i,escapedCommand:o}=DG(t,e),s=oR(r,"verbose"),a=QG(s,o,{...r});return YG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var sZ=v((CQe,oZ)=>{oZ.exports=iZ;iZ.sync=Pbe;var rZ=He("fs");function Ibe(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{uZ.exports=cZ;cZ.sync=Cbe;var aZ=He("fs");function cZ(t,e,r){aZ.stat(t,function(n,i){r(n,n?!1:lZ(i,e))})}function Cbe(t,e){return lZ(aZ.statSync(t),e)}function lZ(t,e){return t.isFile()&&Dbe(t,e)}function Dbe(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 pZ=v((jQe,fZ)=>{var NQe=He("fs"),Y_;process.platform==="win32"||global.TESTING_WINDOWS?Y_=sZ():Y_=dZ();fZ.exports=pR;pR.sync=Nbe;function pR(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){pR(t,e||{},function(o,s){o?i(o):n(s)})})}Y_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Nbe(t,e){try{return Y_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var vZ=v((MQe,bZ)=>{var _l=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",mZ=He("path"),jbe=_l?";":":",hZ=pZ(),gZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),yZ=(t,e)=>{let r=e.colon||jbe,n=t.match(/\//)||_l&&t.match(/\\/)?[""]:[..._l?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=_l?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=_l?i.split(r):[""];return _l&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},_Z=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=yZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(gZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=mZ.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];hZ(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)},Mbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=yZ(t,e),o=[];for(let s=0;s{"use strict";var SZ=(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=SZ;mR.exports.default=SZ});var EZ=v((LQe,kZ)=>{"use strict";var xZ=He("path"),Fbe=vZ(),Lbe=wZ();function $Z(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=Fbe.sync(t.command,{path:r[Lbe({env:r})],pathExt:e?xZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=xZ.resolve(i?t.options.cwd:"",s)),s}function zbe(t){return $Z(t)||$Z(t,!0)}kZ.exports=zbe});var AZ=v((zQe,gR)=>{"use strict";var hR=/([()\][%!^"`<>&|;, *?])/g;function Ube(t){return t=t.replace(hR,"^$1"),t}function qbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(hR,"^$1"),e&&(t=t.replace(hR,"^$1")),t}gR.exports.command=Ube;gR.exports.argument=qbe});var OZ=v((UQe,TZ)=>{"use strict";TZ.exports=/^#!(.*)/});var IZ=v((qQe,RZ)=>{"use strict";var Bbe=OZ();RZ.exports=(t="")=>{let e=t.match(Bbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var CZ=v((BQe,PZ)=>{"use strict";var yR=He("fs"),Hbe=IZ();function Gbe(t){let r=Buffer.alloc(150),n;try{n=yR.openSync(t,"r"),yR.readSync(n,r,0,150,0),yR.closeSync(n)}catch{}return Hbe(r.toString())}PZ.exports=Gbe});var MZ=v((HQe,jZ)=>{"use strict";var Zbe=He("path"),DZ=EZ(),NZ=AZ(),Vbe=CZ(),Wbe=process.platform==="win32",Kbe=/\.(?:com|exe)$/i,Jbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Ybe(t){t.file=DZ(t);let e=t.file&&Vbe(t.file);return e?(t.args.unshift(t.file),t.command=e,DZ(t)):t.file}function Xbe(t){if(!Wbe)return t;let e=Ybe(t),r=!Kbe.test(e);if(t.options.forceShell||r){let n=Jbe.test(e);t.command=Zbe.normalize(t.command),t.command=NZ.command(t.command),t.args=t.args.map(o=>NZ.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 Qbe(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:Xbe(n)}jZ.exports=Qbe});var zZ=v((GQe,LZ)=>{"use strict";var _R=process.platform==="win32";function bR(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 eve(t,e){if(!_R)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=FZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function FZ(t,e){return _R&&t===1&&!e.file?bR(e.original,"spawn"):null}function tve(t,e){return _R&&t===1&&!e.file?bR(e.original,"spawnSync"):null}LZ.exports={hookChildProcess:eve,verifyENOENT:FZ,verifyENOENTSync:tve,notFoundError:bR}});var BZ=v((ZQe,bl)=>{"use strict";var UZ=He("child_process"),vR=MZ(),SR=zZ();function qZ(t,e,r){let n=vR(t,e,r),i=UZ.spawn(n.command,n.args,n.options);return SR.hookChildProcess(i,n),i}function rve(t,e,r){let n=vR(t,e,r),i=UZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||SR.verifyENOENTSync(i.status,n),i}bl.exports=qZ;bl.exports.spawn=qZ;bl.exports.sync=rve;bl.exports._parse=vR;bl.exports._enoent=SR});function X_(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 HZ=y(()=>{});var GZ=y(()=>{});import{promisify as nve}from"node:util";import{execFile as ive,execFileSync as YQe}from"node:child_process";import ZZ from"node:path";import{fileURLToPath as ove}from"node:url";function Q_(t){return t instanceof URL?ove(t):t}function VZ(t){return{*[Symbol.iterator](){let e=ZZ.resolve(Q_(t)),r;for(;r!==e;)yield e,r=e,e=ZZ.resolve(e,"..")}}}var eet,tet,WZ=y(()=>{GZ();eet=nve(ive);tet=10*1024*1024});import eb from"node:process";import Ta from"node:path";var sve,ave,cve,KZ,JZ=y(()=>{HZ();WZ();sve=({cwd:t=eb.cwd(),path:e=eb.env[X_()],preferLocal:r=!0,execPath:n=eb.execPath,addExecPath:i=!0}={})=>{let o=Ta.resolve(Q_(t)),s=[],a=e.split(Ta.delimiter);return r&&ave(s,a,o),i&&cve(s,a,n,o),e===""||e===Ta.delimiter?`${s.join(Ta.delimiter)}${e}`:[...s,e].join(Ta.delimiter)},ave=(t,e,r)=>{for(let n of VZ(r)){let i=Ta.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},cve=(t,e,r,n)=>{let i=Ta.resolve(n,Q_(r),"..");e.includes(i)||t.push(i)},KZ=({env:t=eb.env,...e}={})=>{t={...t};let r=X_({env:t});return e.path=t[r],t[r]=sve(e),t}});var YZ,Xn,XZ,QZ,e9,tb,Ff,Lf,Oa=y(()=>{YZ=(t,e,r)=>{let n=r?Lf:Ff,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},XZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,e9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},QZ=t=>tb(t)&&e9 in t,e9=Symbol("isExecaError"),tb=t=>Object.prototype.toString.call(t)==="[object Error]",Ff=class extends Error{};XZ(Ff,Ff.name);Lf=class extends Error{};XZ(Lf,Lf.name)});var t9,lve,r9,n9,i9=y(()=>{t9=()=>{let t=n9-r9+1;return Array.from({length:t},lve)},lve=(t,e)=>({name:`SIGRT${e+1}`,number:r9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),r9=34,n9=64});var o9,s9=y(()=>{o9=[{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 uve}from"node:os";var wR,dve,a9=y(()=>{s9();i9();wR=()=>{let t=t9();return[...o9,...t].map(dve)},dve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=uve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as fve}from"node:os";var pve,mve,c9,hve,gve,yve,bet,l9=y(()=>{a9();pve=()=>{let t=wR();return Object.fromEntries(t.map(mve))},mve=({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}],c9=pve(),hve=()=>{let t=wR(),e=65,r=Array.from({length:e},(n,i)=>gve(i,t));return Object.assign({},...r)},gve=(t,e)=>{let r=yve(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}}},yve=(t,e)=>{let r=e.find(({name:n})=>fve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},bet=hve()});import{constants as zf}from"node:os";var d9,f9,p9,_ve,bve,u9,vve,xR,Sve,wve,rb,Uf=y(()=>{l9();d9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return p9(t,e)},f9=t=>t===0?t:p9(t,"`subprocess.kill()`'s argument"),p9=(t,e)=>{if(Number.isInteger(t))return _ve(t,e);if(typeof t=="string")return vve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${xR()}`)},_ve=(t,e)=>{if(u9.has(t))return u9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${xR()}`)},bve=()=>new Map(Object.entries(zf.signals).reverse().map(([t,e])=>[e,t])),u9=bve(),vve=(t,e)=>{if(t in zf.signals)return t;throw t.toUpperCase()in zf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${xR()}`)},xR=()=>`Available signal names: ${Sve()}. +Available signal numbers: ${wve()}.`,Sve=()=>Object.keys(zf.signals).sort().map(t=>`'${t}'`).join(", "),wve=()=>[...new Set(Object.values(zf.signals).sort((t,e)=>t-e))].join(", "),rb=t=>c9[t].description});import{setTimeout as xve}from"node:timers/promises";var m9,$ve,h9,kve,Eve,Ave,$R,nb=y(()=>{Oa();Uf();m9=t=>{if(t===!1)return t;if(t===!0)return $ve;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},$ve=1e3*5,h9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=kve(s,a,r);Eve(l,n);let u=t(c);return Ave({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},kve=(t,e,r)=>{let[n=r,i]=tb(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&&!tb(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:f9(n),error:i}},Eve=(t,e)=>{t!==void 0&&e.reject(t)},Ave=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&$R({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},$R=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await xve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Tve}from"node:events";var ib,kR=y(()=>{ib=async(t,e)=>{t.aborted||await Tve(t,"abort",{signal:e})}});var g9,y9,Ove,ER=y(()=>{kR();g9=({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)}`)},y9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Ove(t,e,n,i)],Ove=async(t,e,r,{signal:n})=>{throw await ib(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var vl,Rve,AR,_9,b9,ob,v9,S9,w9,x9,$9,k9,Ive,Pve,Cve,Qn,Dve,cs,Sl,wl=y(()=>{vl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Rve(t,e,r),AR(t,e,n)},Rve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},AR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${cs(e)} has already exited or disconnected.`)},_9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${cs(t)} exited or disconnected.`)},b9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${cs(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([ ${Qn("getOneMessage",t)}, ${Qn("sendMessage",t,"message, {strict: true}")}, -]);`)},rb=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${as(e)}.`,{cause:t}),y9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} is not listening to incoming messages.`)},_9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${as(t)} exited without listening to incoming messages.`)},b9=()=>new Error(`\`cancelSignal\` aborted: the ${as(!0)} disconnected.`),v9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},S9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Qn(e,r)} cannot be used: the ${as(r)} is disconnecting.`,{cause:t})},w9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Eve(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Eve=({code:t,message:e})=>Ave.has(t)||Tve.some(r=>e.includes(r)),Ave=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Tve=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Ove(e)}${t}(${r})`,Ove=t=>t?"":"subprocess.",as=t=>t?"parent process":"subprocess",vl=t=>{t.connected&&t.disconnect()}});var Oi,wl=y(()=>{Oi=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var ib,xl,Ri,x9,Rve,Pve,$9,Ive,k9,Uf,nb,cs=y(()=>{go();ib=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=x9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError($9(o,e,n,!0));return s},xl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=x9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError($9(o,e,n,!1));return s},Ri=new WeakMap,x9=(t,e,r)=>{let n=Rve(e,r);return Pve(n,e,r,t),n},Rve=(t,e)=>{let r=iR(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(`"${Uf(e)}" must not be "${t}". +]);`)},ob=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${cs(e)}.`,{cause:t}),v9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${cs(t)} is not listening to incoming messages.`)},S9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${cs(t)} exited without listening to incoming messages.`)},w9=()=>new Error(`\`cancelSignal\` aborted: the ${cs(!0)} disconnected.`),x9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},$9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Qn(e,r)} cannot be used: the ${cs(r)} is disconnecting.`,{cause:t})},k9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Ive(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Ive=({code:t,message:e})=>Pve.has(t)||Cve.some(r=>e.includes(r)),Pve=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Cve=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Dve(e)}${t}(${r})`,Dve=t=>t?"":"subprocess.",cs=t=>t?"parent process":"subprocess",Sl=t=>{t.connected&&t.disconnect()}});var Oi,xl=y(()=>{Oi=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var ab,$l,Ri,E9,Nve,jve,A9,Mve,T9,qf,sb,ls=y(()=>{_o();ab=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=E9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(A9(o,e,n,!0));return s},$l=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=E9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(A9(o,e,n,!1));return s},Ri=new WeakMap,E9=(t,e,r)=>{let n=Nve(e,r);return jve(n,e,r,t),n},Nve=(t,e)=>{let r=sR(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(`"${qf(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},Pve=(t,e,r,n)=>{let i=n[k9(t)];if(i===void 0)throw new TypeError(`"${Uf(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(`"${Uf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Uf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},$9=(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}=Ive(t,r);return`The "${i}: ${nb(o)}" option is incompatible with using "${Uf(n)}: ${nb(e)}". -Please set this option with "pipe" instead.`},Ive=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=k9(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]}},k9=t=>t==="all"?1:t,Uf=t=>t?"to":"from",nb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Cve}from"node:events";var Ta,ob=y(()=>{Ta=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Cve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var sb,ER,ab,AR,E9,A9,qf=y(()=>{sb=(t,e)=>{e&&ER(t)},ER=t=>{t.refCounted()},ab=(t,e)=>{e&&AR(t)},AR=t=>{t.unrefCounted()},E9=(t,e)=>{e&&(AR(t),AR(t))},A9=(t,e)=>{e&&(ER(t),ER(t))}});import{once as Dve}from"node:events";import{scheduler as Nve}from"node:timers/promises";var T9,O9,cb,R9=y(()=>{ub();qf();lb();db();T9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(I9(i)||D9(i))return;cb.has(t)||cb.set(t,[]);let o=cb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await C9(t,n,i),await Nve.yield();let s=await P9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},O9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{TR();let o=cb.get(t);for(;o?.length>0;)await Dve(n,"message:done");t.removeListener("message",i),A9(e,r),n.connected=!1,n.emit("disconnect")},cb=new WeakMap});import{EventEmitter as jve}from"node:events";var ls,fb,Mve,pb,Bf=y(()=>{R9();qf();ls=(t,e,r)=>{if(fb.has(t))return fb.get(t);let n=new jve;return n.connected=!0,fb.set(t,n),Mve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},fb=new WeakMap,Mve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=T9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",O9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),E9(r,n)},pb=t=>{let e=fb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Fve}from"node:events";var N9,Lve,j9,P9,I9,M9,mb,zve,hb,F9,lb=y(()=>{wl();ob();_b();Sl();Bf();ub();N9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ls(t,e,r),s=gb(t,o);return{id:Lve++,type:hb,message:n,hasListeners:s}},Lve=0n,j9=(t,e)=>{if(!(e?.type!==hb||e.hasListeners))for(let{id:r}of t)r!==void 0&&mb[r].resolve({isDeadlock:!0,hasListeners:!1})},P9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==hb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:F9,message:gb(e,i)};try{await yb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},I9=t=>{if(t?.type!==F9)return!1;let{id:e,message:r}=t;return mb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},M9=async(t,e,r)=>{if(t?.type!==hb)return;let n=Oi();mb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,zve(e,r,i)]);o&&g9(r),s||y9(r)}finally{i.abort(),delete mb[t.id]}},mb={},zve=async(t,e,{signal:r})=>{Ta(t,1,r),await Fve(t,"disconnect",{signal:r}),_9(e)},hb="execa:ipc:request",F9="execa:ipc:response"});var L9,z9,C9,Hf,gb,Uve,ub=y(()=>{wl();go();cs();lb();L9=(t,e,r)=>{Hf.has(t)||Hf.set(t,new Set);let n=Hf.get(t),i=Oi(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},z9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},C9=async(t,e,r)=>{for(;!gb(t,e)&&Hf.get(t)?.size>0;){let n=[...Hf.get(t)];j9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Hf=new WeakMap,gb=(t,e)=>e.listenerCount("message")>Uve(t),Uve=t=>Ri.has(t)&&!ho(Ri.get(t).options.buffer,"ipc")?1:0});import{promisify as qve}from"node:util";var yb,Bve,RR,Hve,OR,_b=y(()=>{Sl();ub();lb();yb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return bl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),Bve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},Bve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=N9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=L9(t,s,o);try{await RR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw vl(t),c}finally{z9(a)}},RR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Hve(t);try{await Promise.all([M9(n,t,r),o(n)])}catch(s){throw S9({error:s,methodName:e,isSubprocess:r}),w9({error:s,methodName:e,isSubprocess:r,message:i}),s}},Hve=t=>{if(OR.has(t))return OR.get(t);let e=qve(t.send.bind(t));return OR.set(t,e),e},OR=new WeakMap});import{scheduler as Gve}from"node:timers/promises";var q9,B9,Zve,U9,D9,H9,TR,PR,db=y(()=>{_b();Bf();Sl();q9=(t,e)=>{let r="cancelSignal";return kR(r,!1,t.connected),RR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:H9,message:e},message:e})},B9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Zve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),PR.signal),Zve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!U9){if(U9=!0,!n){v9();return}if(e===null){TR();return}ls(t,e,r),await Gve.yield()}},U9=!1,D9=t=>t?.type!==H9?!1:(PR.abort(t.message),!0),H9="execa:ipc:cancel",TR=()=>{PR.abort(b9())},PR=new AbortController});var G9,Z9,Vve,Wve,IR=y(()=>{xR();db();eb();G9=({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.")}},Z9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[Vve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],Vve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await tb(e,i);let o=Wve(e);throw await q9(t,o),wR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Wve=({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 Kve}from"node:timers/promises";var V9,W9,Jve,CR=y(()=>{Aa();V9=({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})`)},W9=(t,e,r,n)=>e===0||e===void 0?[]:[Jve(t,e,r,n)],Jve=async(t,e,r,{signal:n})=>{throw await Kve(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as Yve,execArgv as Xve}from"node:process";import K9 from"node:path";var J9,Y9,DR=y(()=>{pl();J9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},Y9=(t,e,{node:r=!1,nodePath:n=Yve,nodeOptions:i=Xve.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=fl(n,'The "nodePath" option'),l=K9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(K9.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 Qve}from"node:v8";var X9,eSe,tSe,rSe,Q9,NR=y(()=>{X9=({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`.");rSe[r](t)}},eSe=t=>{try{Qve(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},tSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},rSe={advanced:eSe,json:tSe},Q9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var tV,nSe,nn,jR,iSe,eV,bb,Oa=y(()=>{tV=({encoding:t})=>{if(jR.has(t))return;let e=iSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${bb(t)}\`. -Please rename it to ${bb(e)}.`);let r=[...jR].map(n=>bb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${bb(t)}\`. -Please rename it to one of: ${r}.`)},nSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),jR=new Set([...nSe,...nn]),iSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in eV)return eV[e];if(jR.has(e))return e},eV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},bb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as oSe}from"node:fs";import sSe from"node:path";import aSe from"node:process";var rV,nV,iV,MR=y(()=>{pl();rV=(t=nV())=>{let e=fl(t,'The "cwd" option');return sSe.resolve(e)},nV=()=>{try{return aSe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},iV=(t,e)=>{if(e===nV())return t;let r;try{r=oSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},jve=(t,e,r,n)=>{let i=n[T9(t)];if(i===void 0)throw new TypeError(`"${qf(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(`"${qf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${qf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},A9=(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}=Mve(t,r);return`The "${i}: ${sb(o)}" option is incompatible with using "${qf(n)}: ${sb(e)}". +Please set this option with "pipe" instead.`},Mve=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=T9(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]}},T9=t=>t==="all"?1:t,qf=t=>t?"to":"from",sb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Fve}from"node:events";var Ra,cb=y(()=>{Ra=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Fve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var lb,TR,ub,OR,O9,R9,Bf=y(()=>{lb=(t,e)=>{e&&TR(t)},TR=t=>{t.refCounted()},ub=(t,e)=>{e&&OR(t)},OR=t=>{t.unrefCounted()},O9=(t,e)=>{e&&(OR(t),OR(t))},R9=(t,e)=>{e&&(TR(t),TR(t))}});import{once as Lve}from"node:events";import{scheduler as zve}from"node:timers/promises";var I9,P9,db,C9=y(()=>{pb();Bf();fb();mb();I9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(N9(i)||M9(i))return;db.has(t)||db.set(t,[]);let o=db.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await j9(t,n,i),await zve.yield();let s=await D9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},P9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{RR();let o=db.get(t);for(;o?.length>0;)await Lve(n,"message:done");t.removeListener("message",i),R9(e,r),n.connected=!1,n.emit("disconnect")},db=new WeakMap});import{EventEmitter as Uve}from"node:events";var us,hb,qve,gb,Hf=y(()=>{C9();Bf();us=(t,e,r)=>{if(hb.has(t))return hb.get(t);let n=new Uve;return n.connected=!0,hb.set(t,n),qve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},hb=new WeakMap,qve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=I9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",P9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),O9(r,n)},gb=t=>{let e=hb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Bve}from"node:events";var F9,Hve,L9,D9,N9,z9,yb,Gve,_b,U9,fb=y(()=>{xl();cb();Sb();wl();Hf();pb();F9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=us(t,e,r),s=bb(t,o);return{id:Hve++,type:_b,message:n,hasListeners:s}},Hve=0n,L9=(t,e)=>{if(!(e?.type!==_b||e.hasListeners))for(let{id:r}of t)r!==void 0&&yb[r].resolve({isDeadlock:!0,hasListeners:!1})},D9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==_b||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:U9,message:bb(e,i)};try{await vb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},N9=t=>{if(t?.type!==U9)return!1;let{id:e,message:r}=t;return yb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},z9=async(t,e,r)=>{if(t?.type!==_b)return;let n=Oi();yb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,Gve(e,r,i)]);o&&b9(r),s||v9(r)}finally{i.abort(),delete yb[t.id]}},yb={},Gve=async(t,e,{signal:r})=>{Ra(t,1,r),await Bve(t,"disconnect",{signal:r}),S9(e)},_b="execa:ipc:request",U9="execa:ipc:response"});var q9,B9,j9,Gf,bb,Zve,pb=y(()=>{xl();_o();ls();fb();q9=(t,e,r)=>{Gf.has(t)||Gf.set(t,new Set);let n=Gf.get(t),i=Oi(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},B9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},j9=async(t,e,r)=>{for(;!bb(t,e)&&Gf.get(t)?.size>0;){let n=[...Gf.get(t)];L9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Gf=new WeakMap,bb=(t,e)=>e.listenerCount("message")>Zve(t),Zve=t=>Ri.has(t)&&!yo(Ri.get(t).options.buffer,"ipc")?1:0});import{promisify as Vve}from"node:util";var vb,Wve,PR,Kve,IR,Sb=y(()=>{wl();pb();fb();vb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return vl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),Wve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},Wve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=F9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=q9(t,s,o);try{await PR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Sl(t),c}finally{B9(a)}},PR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Kve(t);try{await Promise.all([z9(n,t,r),o(n)])}catch(s){throw $9({error:s,methodName:e,isSubprocess:r}),k9({error:s,methodName:e,isSubprocess:r,message:i}),s}},Kve=t=>{if(IR.has(t))return IR.get(t);let e=Vve(t.send.bind(t));return IR.set(t,e),e},IR=new WeakMap});import{scheduler as Jve}from"node:timers/promises";var G9,Z9,Yve,H9,M9,V9,RR,CR,mb=y(()=>{Sb();Hf();wl();G9=(t,e)=>{let r="cancelSignal";return AR(r,!1,t.connected),PR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:V9,message:e},message:e})},Z9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Yve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),CR.signal),Yve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!H9){if(H9=!0,!n){x9();return}if(e===null){RR();return}us(t,e,r),await Jve.yield()}},H9=!1,M9=t=>t?.type!==V9?!1:(CR.abort(t.message),!0),V9="execa:ipc:cancel",RR=()=>{CR.abort(w9())},CR=new AbortController});var W9,K9,Xve,Qve,DR=y(()=>{kR();mb();nb();W9=({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.")}},K9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[Xve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],Xve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await ib(e,i);let o=Qve(e);throw await G9(t,o),$R({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Qve=({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 eSe}from"node:timers/promises";var J9,Y9,tSe,NR=y(()=>{Oa();J9=({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})`)},Y9=(t,e,r,n)=>e===0||e===void 0?[]:[tSe(t,e,r,n)],tSe=async(t,e,r,{signal:n})=>{throw await eSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as rSe,execArgv as nSe}from"node:process";import X9 from"node:path";var Q9,eV,jR=y(()=>{ml();Q9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},eV=(t,e,{node:r=!1,nodePath:n=rSe,nodeOptions:i=nSe.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=pl(n,'The "nodePath" option'),l=X9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(X9.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 iSe}from"node:v8";var tV,oSe,sSe,aSe,rV,MR=y(()=>{tV=({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`.");aSe[r](t)}},oSe=t=>{try{iSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},sSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},aSe={advanced:oSe,json:sSe},rV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var iV,cSe,nn,FR,lSe,nV,wb,Ia=y(()=>{iV=({encoding:t})=>{if(FR.has(t))return;let e=lSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${wb(t)}\`. +Please rename it to ${wb(e)}.`);let r=[...FR].map(n=>wb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${wb(t)}\`. +Please rename it to one of: ${r}.`)},cSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),FR=new Set([...cSe,...nn]),lSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in nV)return nV[e];if(FR.has(e))return e},nV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},wb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as uSe}from"node:fs";import dSe from"node:path";import fSe from"node:process";var oV,sV,aV,LR=y(()=>{ml();oV=(t=sV())=>{let e=pl(t,'The "cwd" option');return dSe.resolve(e)},sV=()=>{try{return fSe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},aV=(t,e)=>{if(e===sV())return t;let r;try{r=uSe(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 cSe from"node:path";import oV from"node:process";var sV,vb,lSe,uSe,FR=y(()=>{sV=St(zZ(),1);VZ();eb();zf();$R();IR();CR();DR();NR();Oa();MR();pl();go();vb=(t,e,r)=>{r.cwd=rV(r.cwd);let[n,i,o]=Y9(t,e,r),{command:s,args:a,options:c}=sV.default._parse(n,i,o),l=OG(c),u=lSe(l);return V9(u),tV(u),X9(u),p9(u),G9(u),u.shell=QO(u.shell),u.env=uSe(u),u.killSignal=c9(u.killSignal),u.forceKillAfterDelay=d9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),oV.platform==="win32"&&cSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},lSe=({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}),uSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...oV.env,...t}:t;return r||n?ZZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Sb,LR=y(()=>{Sb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function $l(t){if(typeof t=="string")return dSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return fSe(t)}var dSe,fSe,aV,pSe,cV,mSe,zR=y(()=>{dSe=t=>t.at(-1)===aV?t.slice(0,t.at(-2)===cV?-2:-1):t,fSe=t=>t.at(-1)===pSe?t.subarray(0,t.at(-2)===mSe?-2:-1):t,aV=` -`,pSe=aV.codePointAt(0),cV="\r",mSe=cV.codePointAt(0)});function ei(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 UR(t,{checkOpen:e=!0}={}){return ei(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 Ra(t,{checkOpen:e=!0}={}){return ei(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 qR(t,e){return UR(t,e)&&Ra(t,e)}var Pa=y(()=>{});function lV(){return this[HR].next()}function uV(t){return this[HR].return(t)}function GR({preventCancel:t=!1}={}){let e=this.getReader(),r=new BR(e,t),n=Object.create(gSe);return n[HR]=r,n}var hSe,BR,HR,gSe,dV=y(()=>{hSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),BR=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}}},HR=Symbol();Object.defineProperty(lV,"name",{value:"next"});Object.defineProperty(uV,"name",{value:"return"});gSe=Object.create(hSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:lV},return:{enumerable:!0,configurable:!0,writable:!0,value:uV}})});var fV=y(()=>{});var pV=y(()=>{dV();fV()});var mV,ySe,_Se,bSe,Gf,ZR=y(()=>{Pa();pV();mV=t=>{if(Ra(t,{checkOpen:!1})&&Gf.on!==void 0)return _Se(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(ySe.call(t)==="[object ReadableStream]")return GR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:ySe}=Object.prototype,_Se=async function*(t){let e=new AbortController,r={};bSe(t,e,r);try{for await(let[n]of Gf.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()}},bSe=async(t,e,r)=>{try{await Gf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Gf={}});var kl,vSe,yV,hV,SSe,gV,Pi,Zf=y(()=>{ZR();kl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=mV(t),u=e();u.length=0;try{for await(let d of l){let f=SSe(d),p=r[f](d,u);yV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return vSe({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}},vSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&yV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},yV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){hV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&hV(c,e,i,o),new Pi},hV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},SSe=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=gV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&gV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:gV}=Object.prototype,Pi=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var yo,Vf,wb,xb,$b,kb=y(()=>{yo=t=>t,Vf=()=>{},wb=({contents:t})=>t,xb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},$b=t=>t.length});async function Eb(t,e){return kl(t,kSe,e)}var wSe,xSe,$Se,kSe,_V=y(()=>{Zf();kb();wSe=()=>({contents:[]}),xSe=()=>1,$Se=(t,{contents:e})=>(e.push(t),e),kSe={init:wSe,convertChunk:{string:yo,buffer:yo,arrayBuffer:yo,dataView:yo,typedArray:yo,others:yo},getSize:xSe,truncateChunk:Vf,addChunk:$Se,getFinalChunk:Vf,finalize:wb}});async function Ab(t,e){return kl(t,DSe,e)}var ESe,ASe,TSe,bV,vV,OSe,RSe,PSe,ISe,wV,SV,CSe,xV,DSe,$V=y(()=>{Zf();kb();ESe=()=>({contents:new ArrayBuffer(0)}),ASe=t=>TSe.encode(t),TSe=new TextEncoder,bV=t=>new Uint8Array(t),vV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),OSe=(t,e)=>t.slice(0,e),RSe=(t,{contents:e,length:r},n)=>{let i=xV()?ISe(e,n):PSe(e,n);return new Uint8Array(i).set(t,r),i},PSe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(wV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},ISe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:wV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},wV=t=>SV**Math.ceil(Math.log(t)/Math.log(SV)),SV=2,CSe=({contents:t,length:e})=>xV()?t:t.slice(0,e),xV=()=>"resize"in ArrayBuffer.prototype,DSe={init:ESe,convertChunk:{string:ASe,buffer:bV,arrayBuffer:bV,dataView:vV,typedArray:vV,others:xb},getSize:$b,truncateChunk:OSe,addChunk:RSe,getFinalChunk:Vf,finalize:CSe}});async function Ob(t,e){return kl(t,LSe,e)}var NSe,Tb,jSe,MSe,FSe,LSe,kV=y(()=>{Zf();kb();NSe=()=>({contents:"",textDecoder:new TextDecoder}),Tb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),jSe=(t,{contents:e})=>e+t,MSe=(t,e)=>t.slice(0,e),FSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},LSe={init:NSe,convertChunk:{string:yo,buffer:Tb,arrayBuffer:Tb,dataView:Tb,typedArray:Tb,others:xb},getSize:$b,truncateChunk:MSe,addChunk:jSe,getFinalChunk:FSe,finalize:wb}});var EV=y(()=>{_V();$V();kV();Zf()});import{on as zSe}from"node:events";import{finished as USe}from"node:stream/promises";var Rb=y(()=>{ZR();EV();Object.assign(Gf,{on:zSe,finished:USe})});var AV,qSe,TV,OV,BSe,RV,PV,Pb,Ia=y(()=>{Rb();mo();go();AV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Pi))throw t;if(o==="all")return t;let s=qSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},qSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",TV=(t,e,r)=>{if(e.length!==r)return;let n=new Pi;throw n.maxBufferInfo={fdNumber:"ipc"},n},OV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=BSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},BSe=(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=ho(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:M_(r),threshold:i,unit:n}},RV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Pb(r)),PV=(t,e,r)=>{if(!e)return t;let n=Pb(r);return t.length>n?t.slice(0,n):t},Pb=([,t])=>t});import{inspect as HSe}from"node:util";var CV,GSe,ZSe,VSe,WSe,KSe,IV,DV=y(()=>{zR();rn();MR();z_();Ia();zf();Aa();CV=({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=GSe({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=VSe(n,b),w=x===void 0?"":` -${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>WSe(D)).join(` -`)].map(D=>jf($l(KSe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:O,message:A}},GSe=({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=ZSe(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?`${OV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${Q_(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},ZSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",VSe=(t,e)=>{if(t instanceof Xn)return;let r=JZ(t)?t.originalMessage:String(t?.message??t),n=jf(iV(r,e));return n===""?void 0:n},WSe=t=>typeof t=="string"?t:HSe(t),KSe=t=>Array.isArray(t)?t.map(e=>$l(IV(e))).filter(Boolean).join(` -`):IV(t),IV=t=>typeof t=="string"?t:Ut(t)?N_(t):""});var Ib,El,Wf,JSe,NV,YSe,Kf=y(()=>{zf();Z_();Aa();DV();Ib=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>NV({command:t,escapedCommand:e,cwd:o,durationMs:lR(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:[]}),El=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Wf({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}),Wf=({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:O,signalDescription:T}=YSe(l,u),{originalMessage:A,shortMessage:D,message:$}=CV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),se=WZ(t,$,x);return Object.assign(se,JSe({error:se,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),se},JSe=({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})=>NV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:lR(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:[]}),NV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),YSe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:Q_(e);return{exitCode:r,signal:n,signalDescription:i}}});function XSe(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(jV(t*1e3)%1e3),nanoseconds:Math.trunc(jV(t*1e6)%1e3)}}function QSe(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 VR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return XSe(t);break}case"bigint":return QSe(t)}throw new TypeError("Expected a finite number or bigint")}var jV,MV=y(()=>{jV=t=>Number.isFinite(t)?t:0});function WR(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+rwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ewe(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?" "+twe(d,u):f;i.push(p)}},a=VR(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%nwe):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 ewe,twe,rwe,nwe,FV=y(()=>{MV();ewe=t=>t===0||t===0n,twe=(t,e)=>e===1||e===1n?t:`${t}s`,rwe=1e-7,nwe=24n*60n*60n*1000n});var LV,zV=y(()=>{gl();LV=(t,e)=>{t.failed&&Ti({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var UV,iwe,qV=y(()=>{FV();ss();gl();zV();UV=(t,e)=>{ml(e)&&(LV(t,e),iwe(t,e))},iwe=(t,e)=>{let r=`(done in ${WR(t.durationMs)})`;Ti({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Al,Cb=y(()=>{qV();Al=(t,e,{reject:r})=>{if(UV(t,e),t.failed&&r)throw t;return t}});var GV,owe,swe,ZV,VV,BV,awe,KR,HV,Ca,WV,cwe,Db,KV,lwe,uwe,JR,JV,dwe,YV,Nb,fwe,YR,pwe,mwe,XV,An,jb,XR,QV,eW,us,vr=y(()=>{Pa();fo();rn();GV=(t,e)=>Ca(t)?"asyncGenerator":WV(t)?"generator":Db(t)?"fileUrl":lwe(t)?"filePath":fwe(t)?"webStream":ei(t,{checkOpen:!1})?"native":Ut(t)?"uint8Array":pwe(t)?"asyncIterable":mwe(t)?"iterable":YR(t)?ZV({transform:t},e):cwe(t)?owe(t,e):"native",owe=(t,e)=>qR(t.transform,{checkOpen:!1})?swe(t,e):YR(t.transform)?ZV(t,e):awe(t,e),swe=(t,e)=>(VV(t,e,"Duplex stream"),"duplex"),ZV=(t,e)=>(VV(t,e,"web TransformStream"),"webTransform"),VV=({final:t,binary:e,objectMode:r},n,i)=>{BV(t,`${n}.final`,i),BV(e,`${n}.binary`,i),KR(r,`${n}.objectMode`)},BV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},awe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!HV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(qR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(YR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!HV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return KR(r,`${i}.binary`),KR(n,`${i}.objectMode`),Ca(t)||Ca(e)?"asyncGenerator":"generator"},KR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},HV=t=>Ca(t)||WV(t),Ca=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",WV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",cwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Db=t=>Object.prototype.toString.call(t)==="[object URL]",KV=t=>Db(t)&&t.protocol!=="file:",lwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>uwe.has(e))&&JR(t.file),uwe=new Set(["file","append"]),JR=t=>typeof t=="string",JV=(t,e)=>t==="native"&&typeof e=="string"&&!dwe.has(e),dwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),YV=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Nb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",fwe=t=>YV(t)||Nb(t),YR=t=>YV(t?.readable)&&Nb(t?.writable),pwe=t=>XV(t)&&typeof t[Symbol.asyncIterator]=="function",mwe=t=>XV(t)&&typeof t[Symbol.iterator]=="function",XV=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),jb=new Set(["fileUrl","filePath","fileNumber"]),XR=new Set(["fileUrl","filePath"]),QV=new Set([...XR,"webStream","nodeStream"]),eW=new Set(["webTransform","duplex"]),us={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 QR,hwe,gwe,tW,eP=y(()=>{vr();QR=(t,e,r,n)=>n==="output"?hwe(t,e,r):gwe(t,e,r),hwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},gwe=(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}},tW=(t,e)=>{let r=t.findLast(({type:n})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var rW,ywe,_we,bwe,vwe,Swe,wwe,nW=y(()=>{fo();Oa();vr();eP();rW=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...ywe(t,e,r,n)],ywe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=_we({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return wwe(o,r)},_we=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?bwe({stdioItem:t,optionName:i}):e==="webTransform"?vwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Swe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),bwe=({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}}},vwe=({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}=QR(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Swe=({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||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=QR(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},wwe=(t,e)=>e==="input"?t.reverse():t});import tP from"node:process";var iW,xwe,$we,Tl,rP,oW,kwe,Ewe,sW=y(()=>{Pa();vr();iW=(t,e,r)=>{let n=t.map(i=>xwe(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)??Ewe},xwe=({type:t,value:e},r)=>$we[r]??oW[t](e),$we=["input","output","output"],Tl=()=>{},rP=()=>"input",oW={generator:Tl,asyncGenerator:Tl,fileUrl:Tl,filePath:Tl,iterable:rP,asyncIterable:rP,uint8Array:rP,webStream:t=>Nb(t)?"output":"input",nodeStream(t){return Ra(t,{checkOpen:!1})?UR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Tl,duplex:Tl,native(t){let e=kwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return oW.nodeStream(t)}},kwe=t=>{if([0,tP.stdin].includes(t))return"input";if([1,2,tP.stdout,tP.stderr].includes(t))return"output"},Ewe="output"});var aW,cW=y(()=>{aW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var lW,Awe,Twe,uW,Owe,Rwe,dW=y(()=>{mo();cW();ss();lW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Awe(t,n).map((a,c)=>uW(a,c));return o?Owe(s,r,i):aW(s,e)},Awe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(Twe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},Twe=t=>En.some(e=>t[e]!==void 0),uW=(t,e)=>Array.isArray(t)?t.map(r=>uW(r,e)):t??(e>=En.length?"ignore":"pipe"),Owe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!hl(r,i)&&Rwe(n)?"ignore":n),Rwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Pwe}from"node:fs";import Iwe from"node:tty";var pW,Cwe,Dwe,Nwe,jwe,fW,mW=y(()=>{Pa();mo();rn();cs();pW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Cwe({stdioItem:t,fdNumber:n,direction:i}):jwe({stdioItem:t,fdNumber:n}),Cwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Dwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Dwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Nwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Iwe.isatty(i))throw new TypeError(`The \`${e}: ${nb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:po(Pwe(i)),optionName:e}}},Nwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=j_.indexOf(t);if(r!==-1)return r},jwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:fW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:fW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,fW=(t,e,r)=>{let n=j_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var hW,Mwe,Fwe,Lwe,zwe,gW=y(()=>{Pa();rn();vr();hW=({input:t,inputFile:e},r)=>r===0?[...Mwe(t),...Lwe(e)]:[],Mwe=t=>t===void 0?[]:[{type:Fwe(t),value:t,optionName:"input"}],Fwe=t=>{if(Ra(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ut(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Lwe=t=>t===void 0?[]:[{...zwe(t),optionName:"inputFile"}],zwe=t=>{if(Db(t))return{type:"fileUrl",value:t};if(JR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var yW,_W,Uwe,qwe,bW,Bwe,Hwe,vW,SW=y(()=>{vr();yW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),_W=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Uwe(i,t);if(s.length!==0){if(o){qwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(QV.has(t))return bW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});eW.has(t)&&Hwe({otherStdioItems:s,type:t,value:e,optionName:r})}},Uwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),qwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{XR.has(e)&&bW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},bW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Bwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return vW(s,n,e),i==="output"?o[0].stream:void 0},Bwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Hwe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);vW(i,n,e)},vW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${us[r]} that is the same.`)}});var Mb,Gwe,Zwe,Vwe,Wwe,Kwe,Jwe,Ywe,Xwe,Qwe,exe,txe,nP,rxe,Fb=y(()=>{mo();nW();eP();vr();sW();dW();mW();gW();SW();Mb=(t,e,r,n)=>{let o=lW(e,r,n).map((a,c)=>Gwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=Qwe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>rxe(a)),s},Gwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=M_(e),{stdioItems:o,isStdioArray:s}=Zwe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=iW(o,e,i),c=o.map(d=>pW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=rW(c,i,a,r),u=tW(l,a);return Xwe(l,u),{direction:a,objectMode:u,stdioItems:l}},Zwe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Vwe(c,n)),...hW(r,e)],s=yW(o),a=s.length>1;return Wwe(s,a,n),Jwe(s),{stdioItems:s,isStdioArray:a}},Vwe=(t,e)=>({type:GV(t,e),value:t,optionName:e}),Wwe=(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(Kwe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},Kwe=new Set(["ignore","ipc"]),Jwe=t=>{for(let e of t)Ywe(e)},Ywe=({type:t,value:e,optionName:r})=>{if(KV(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(JV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Xwe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>jb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Qwe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(exe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw nP(i),o}},exe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>txe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},txe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=_W({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},nP=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Yn(r)&&r.destroy()},rxe=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 wW}from"node:fs";var $W,Ii,nxe,kW,xW,ixe,EW=y(()=>{rn();Fb();vr();$W=(t,e)=>Mb(ixe,t,e,!0),Ii=({type:t,optionName:e})=>{kW(e,us[t])},nxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&kW(t,`"${e}"`),{}),kW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},xW={generator(){},asyncGenerator:Ii,webStream:Ii,nodeStream:Ii,webTransform:Ii,duplex:Ii,asyncIterable:Ii,native:nxe},ixe={input:{...xW,fileUrl:({value:t})=>({contents:[po(wW(t))]}),filePath:({value:{file:t}})=>({contents:[po(wW(t))]}),fileNumber:Ii,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...xW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Ii,string:Ii,uint8Array:Ii}}});var _o,iP,Jf=y(()=>{zR();_o=(t,{stripFinalNewline:e},r)=>iP(e,r)&&t!==void 0&&!Array.isArray(t)?$l(t):t,iP=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Lb,sP,AW,TW,oxe,sxe,axe,OW,cxe,oP,lxe,uxe,dxe,zb=y(()=>{Lb=(t,e,r,n)=>t||r?void 0:TW(e,n),sP=(t,e,r)=>r?t.flatMap(n=>AW(n,e)):AW(t,e),AW=(t,e)=>{let{transform:r,final:n}=TW(e,{});return[...r(t),...n()]},TW=(t,e)=>(e.previousChunks="",{transform:oxe.bind(void 0,e,t),final:axe.bind(void 0,e)}),oxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=oP(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=oP(n,r.slice(i+1))),t.previousChunks=n},sxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),axe=function*({previousChunks:t}){t.length>0&&(yield t)},OW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:cxe.bind(void 0,n)},cxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?lxe:dxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},oP=(t,e)=>`${t}${e}`,lxe={windowsNewline:`\r +${t}`}});import pSe from"node:path";import cV from"node:process";var lV,xb,mSe,hSe,zR=y(()=>{lV=St(BZ(),1);JZ();nb();Uf();ER();DR();NR();jR();MR();Ia();LR();ml();_o();xb=(t,e,r)=>{r.cwd=oV(r.cwd);let[n,i,o]=eV(t,e,r),{command:s,args:a,options:c}=lV.default._parse(n,i,o),l=PG(c),u=mSe(l);return J9(u),iV(u),tV(u),g9(u),W9(u),u.shell=tR(u.shell),u.env=hSe(u),u.killSignal=d9(u.killSignal),u.forceKillAfterDelay=m9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),cV.platform==="win32"&&pSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},mSe=({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}),hSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...cV.env,...t}:t;return r||n?KZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var $b,UR=y(()=>{$b=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function kl(t){if(typeof t=="string")return gSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return ySe(t)}var gSe,ySe,uV,_Se,dV,bSe,qR=y(()=>{gSe=t=>t.at(-1)===uV?t.slice(0,t.at(-2)===dV?-2:-1):t,ySe=t=>t.at(-1)===_Se?t.subarray(0,t.at(-2)===bSe?-2:-1):t,uV=` +`,_Se=uV.codePointAt(0),dV="\r",bSe=dV.codePointAt(0)});function ei(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 BR(t,{checkOpen:e=!0}={}){return ei(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 Pa(t,{checkOpen:e=!0}={}){return ei(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 HR(t,e){return BR(t,e)&&Pa(t,e)}var Ca=y(()=>{});function fV(){return this[ZR].next()}function pV(t){return this[ZR].return(t)}function VR({preventCancel:t=!1}={}){let e=this.getReader(),r=new GR(e,t),n=Object.create(SSe);return n[ZR]=r,n}var vSe,GR,ZR,SSe,mV=y(()=>{vSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),GR=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}}},ZR=Symbol();Object.defineProperty(fV,"name",{value:"next"});Object.defineProperty(pV,"name",{value:"return"});SSe=Object.create(vSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:fV},return:{enumerable:!0,configurable:!0,writable:!0,value:pV}})});var hV=y(()=>{});var gV=y(()=>{mV();hV()});var yV,wSe,xSe,$Se,Zf,WR=y(()=>{Ca();gV();yV=t=>{if(Pa(t,{checkOpen:!1})&&Zf.on!==void 0)return xSe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(wSe.call(t)==="[object ReadableStream]")return VR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:wSe}=Object.prototype,xSe=async function*(t){let e=new AbortController,r={};$Se(t,e,r);try{for await(let[n]of Zf.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()}},$Se=async(t,e,r)=>{try{await Zf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Zf={}});var El,kSe,vV,_V,ESe,bV,Ii,Vf=y(()=>{WR();El=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=yV(t),u=e();u.length=0;try{for await(let d of l){let f=ESe(d),p=r[f](d,u);vV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return kSe({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}},kSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&vV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},vV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){_V(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&_V(c,e,i,o),new Ii},_V=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},ESe=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=bV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&bV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:bV}=Object.prototype,Ii=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var bo,Wf,kb,Eb,Ab,Tb=y(()=>{bo=t=>t,Wf=()=>{},kb=({contents:t})=>t,Eb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Ab=t=>t.length});async function Ob(t,e){return El(t,RSe,e)}var ASe,TSe,OSe,RSe,SV=y(()=>{Vf();Tb();ASe=()=>({contents:[]}),TSe=()=>1,OSe=(t,{contents:e})=>(e.push(t),e),RSe={init:ASe,convertChunk:{string:bo,buffer:bo,arrayBuffer:bo,dataView:bo,typedArray:bo,others:bo},getSize:TSe,truncateChunk:Wf,addChunk:OSe,getFinalChunk:Wf,finalize:kb}});async function Rb(t,e){return El(t,LSe,e)}var ISe,PSe,CSe,wV,xV,DSe,NSe,jSe,MSe,kV,$V,FSe,EV,LSe,AV=y(()=>{Vf();Tb();ISe=()=>({contents:new ArrayBuffer(0)}),PSe=t=>CSe.encode(t),CSe=new TextEncoder,wV=t=>new Uint8Array(t),xV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),DSe=(t,e)=>t.slice(0,e),NSe=(t,{contents:e,length:r},n)=>{let i=EV()?MSe(e,n):jSe(e,n);return new Uint8Array(i).set(t,r),i},jSe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(kV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},MSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:kV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},kV=t=>$V**Math.ceil(Math.log(t)/Math.log($V)),$V=2,FSe=({contents:t,length:e})=>EV()?t:t.slice(0,e),EV=()=>"resize"in ArrayBuffer.prototype,LSe={init:ISe,convertChunk:{string:PSe,buffer:wV,arrayBuffer:wV,dataView:xV,typedArray:xV,others:Eb},getSize:Ab,truncateChunk:DSe,addChunk:NSe,getFinalChunk:Wf,finalize:FSe}});async function Pb(t,e){return El(t,HSe,e)}var zSe,Ib,USe,qSe,BSe,HSe,TV=y(()=>{Vf();Tb();zSe=()=>({contents:"",textDecoder:new TextDecoder}),Ib=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),USe=(t,{contents:e})=>e+t,qSe=(t,e)=>t.slice(0,e),BSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},HSe={init:zSe,convertChunk:{string:bo,buffer:Ib,arrayBuffer:Ib,dataView:Ib,typedArray:Ib,others:Eb},getSize:Ab,truncateChunk:qSe,addChunk:USe,getFinalChunk:BSe,finalize:kb}});var OV=y(()=>{SV();AV();TV();Vf()});import{on as GSe}from"node:events";import{finished as ZSe}from"node:stream/promises";var Cb=y(()=>{WR();OV();Object.assign(Zf,{on:GSe,finished:ZSe})});var RV,VSe,IV,PV,WSe,CV,DV,Db,Da=y(()=>{Cb();go();_o();RV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ii))throw t;if(o==="all")return t;let s=VSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},VSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",IV=(t,e,r)=>{if(e.length!==r)return;let n=new Ii;throw n.maxBufferInfo={fdNumber:"ipc"},n},PV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=WSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},WSe=(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=yo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:z_(r),threshold:i,unit:n}},CV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Db(r)),DV=(t,e,r)=>{if(!e)return t;let n=Db(r);return t.length>n?t.slice(0,n):t},Db=([,t])=>t});import{inspect as KSe}from"node:util";var jV,JSe,YSe,XSe,QSe,ewe,NV,MV=y(()=>{qR();rn();LR();B_();Da();Uf();Oa();jV=({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=JSe({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=XSe(n,b),w=x===void 0?"":` +${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>QSe(D)).join(` +`)].map(D=>Mf(kl(ewe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:O,message:A}},JSe=({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=YSe(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?`${PV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${rb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},YSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",XSe=(t,e)=>{if(t instanceof Xn)return;let r=QZ(t)?t.originalMessage:String(t?.message??t),n=Mf(aV(r,e));return n===""?void 0:n},QSe=t=>typeof t=="string"?t:KSe(t),ewe=t=>Array.isArray(t)?t.map(e=>kl(NV(e))).filter(Boolean).join(` +`):NV(t),NV=t=>typeof t=="string"?t:Ut(t)?F_(t):""});var Nb,Al,Kf,twe,FV,rwe,Jf=y(()=>{Uf();K_();Oa();MV();Nb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>FV({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:[]}),Al=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Kf({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}),Kf=({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:O,signalDescription:T}=rwe(l,u),{originalMessage:A,shortMessage:D,message:$}=jV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),se=YZ(t,$,x);return Object.assign(se,twe({error:se,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),se},twe=({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})=>FV({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:[]}),FV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),rwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:rb(e);return{exitCode:r,signal:n,signalDescription:i}}});function nwe(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(LV(t*1e3)%1e3),nanoseconds:Math.trunc(LV(t*1e6)%1e3)}}function iwe(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 KR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return nwe(t);break}case"bigint":return iwe(t)}throw new TypeError("Expected a finite number or bigint")}var LV,zV=y(()=>{LV=t=>Number.isFinite(t)?t:0});function JR(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+awe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&owe(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?" "+swe(d,u):f;i.push(p)}},a=KR(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%cwe):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 owe,swe,awe,cwe,UV=y(()=>{zV();owe=t=>t===0||t===0n,swe=(t,e)=>e===1||e===1n?t:`${t}s`,awe=1e-7,cwe=24n*60n*60n*1000n});var qV,BV=y(()=>{yl();qV=(t,e)=>{t.failed&&Ti({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var HV,lwe,GV=y(()=>{UV();as();yl();BV();HV=(t,e)=>{hl(e)&&(qV(t,e),lwe(t,e))},lwe=(t,e)=>{let r=`(done in ${JR(t.durationMs)})`;Ti({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Tl,jb=y(()=>{GV();Tl=(t,e,{reject:r})=>{if(HV(t,e),t.failed&&r)throw t;return t}});var WV,uwe,dwe,KV,JV,ZV,fwe,YR,VV,Na,YV,pwe,Mb,XV,mwe,hwe,XR,QV,gwe,eW,Fb,ywe,QR,_we,bwe,tW,An,Lb,eI,rW,nW,ds,vr=y(()=>{Ca();mo();rn();WV=(t,e)=>Na(t)?"asyncGenerator":YV(t)?"generator":Mb(t)?"fileUrl":mwe(t)?"filePath":ywe(t)?"webStream":ei(t,{checkOpen:!1})?"native":Ut(t)?"uint8Array":_we(t)?"asyncIterable":bwe(t)?"iterable":QR(t)?KV({transform:t},e):pwe(t)?uwe(t,e):"native",uwe=(t,e)=>HR(t.transform,{checkOpen:!1})?dwe(t,e):QR(t.transform)?KV(t,e):fwe(t,e),dwe=(t,e)=>(JV(t,e,"Duplex stream"),"duplex"),KV=(t,e)=>(JV(t,e,"web TransformStream"),"webTransform"),JV=({final:t,binary:e,objectMode:r},n,i)=>{ZV(t,`${n}.final`,i),ZV(e,`${n}.binary`,i),YR(r,`${n}.objectMode`)},ZV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},fwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!VV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(HR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(QR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!VV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return YR(r,`${i}.binary`),YR(n,`${i}.objectMode`),Na(t)||Na(e)?"asyncGenerator":"generator"},YR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},VV=t=>Na(t)||YV(t),Na=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",YV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",pwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Mb=t=>Object.prototype.toString.call(t)==="[object URL]",XV=t=>Mb(t)&&t.protocol!=="file:",mwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>hwe.has(e))&&XR(t.file),hwe=new Set(["file","append"]),XR=t=>typeof t=="string",QV=(t,e)=>t==="native"&&typeof e=="string"&&!gwe.has(e),gwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),eW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Fb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",ywe=t=>eW(t)||Fb(t),QR=t=>eW(t?.readable)&&Fb(t?.writable),_we=t=>tW(t)&&typeof t[Symbol.asyncIterator]=="function",bwe=t=>tW(t)&&typeof t[Symbol.iterator]=="function",tW=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),Lb=new Set(["fileUrl","filePath","fileNumber"]),eI=new Set(["fileUrl","filePath"]),rW=new Set([...eI,"webStream","nodeStream"]),nW=new Set(["webTransform","duplex"]),ds={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 tI,vwe,Swe,iW,rI=y(()=>{vr();tI=(t,e,r,n)=>n==="output"?vwe(t,e,r):Swe(t,e,r),vwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Swe=(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}},iW=(t,e)=>{let r=t.findLast(({type:n})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var oW,wwe,xwe,$we,kwe,Ewe,Awe,sW=y(()=>{mo();Ia();vr();rI();oW=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...wwe(t,e,r,n)],wwe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=xwe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Awe(o,r)},xwe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?$we({stdioItem:t,optionName:i}):e==="webTransform"?kwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Ewe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),$we=({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}}},kwe=({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}=tI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Ewe=({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||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=tI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Awe=(t,e)=>e==="input"?t.reverse():t});import nI from"node:process";var aW,Twe,Owe,Ol,iI,cW,Rwe,Iwe,lW=y(()=>{Ca();vr();aW=(t,e,r)=>{let n=t.map(i=>Twe(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)??Iwe},Twe=({type:t,value:e},r)=>Owe[r]??cW[t](e),Owe=["input","output","output"],Ol=()=>{},iI=()=>"input",cW={generator:Ol,asyncGenerator:Ol,fileUrl:Ol,filePath:Ol,iterable:iI,asyncIterable:iI,uint8Array:iI,webStream:t=>Fb(t)?"output":"input",nodeStream(t){return Pa(t,{checkOpen:!1})?BR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Ol,duplex:Ol,native(t){let e=Rwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return cW.nodeStream(t)}},Rwe=t=>{if([0,nI.stdin].includes(t))return"input";if([1,2,nI.stdout,nI.stderr].includes(t))return"output"},Iwe="output"});var uW,dW=y(()=>{uW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var fW,Pwe,Cwe,pW,Dwe,Nwe,mW=y(()=>{go();dW();as();fW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Pwe(t,n).map((a,c)=>pW(a,c));return o?Dwe(s,r,i):uW(s,e)},Pwe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(Cwe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},Cwe=t=>En.some(e=>t[e]!==void 0),pW=(t,e)=>Array.isArray(t)?t.map(r=>pW(r,e)):t??(e>=En.length?"ignore":"pipe"),Dwe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!gl(r,i)&&Nwe(n)?"ignore":n),Nwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as jwe}from"node:fs";import Mwe from"node:tty";var gW,Fwe,Lwe,zwe,Uwe,hW,yW=y(()=>{Ca();go();rn();ls();gW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Fwe({stdioItem:t,fdNumber:n,direction:i}):Uwe({stdioItem:t,fdNumber:n}),Fwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Lwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Lwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=zwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Mwe.isatty(i))throw new TypeError(`The \`${e}: ${sb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:ho(jwe(i)),optionName:e}}},zwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=L_.indexOf(t);if(r!==-1)return r},Uwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:hW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:hW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,hW=(t,e,r)=>{let n=L_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var _W,qwe,Bwe,Hwe,Gwe,bW=y(()=>{Ca();rn();vr();_W=({input:t,inputFile:e},r)=>r===0?[...qwe(t),...Hwe(e)]:[],qwe=t=>t===void 0?[]:[{type:Bwe(t),value:t,optionName:"input"}],Bwe=t=>{if(Pa(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ut(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Hwe=t=>t===void 0?[]:[{...Gwe(t),optionName:"inputFile"}],Gwe=t=>{if(Mb(t))return{type:"fileUrl",value:t};if(XR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var vW,SW,Zwe,Vwe,wW,Wwe,Kwe,xW,$W=y(()=>{vr();vW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),SW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Zwe(i,t);if(s.length!==0){if(o){Vwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(rW.has(t))return wW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});nW.has(t)&&Kwe({otherStdioItems:s,type:t,value:e,optionName:r})}},Zwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Vwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{eI.has(e)&&wW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},wW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Wwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return xW(s,n,e),i==="output"?o[0].stream:void 0},Wwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Kwe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);xW(i,n,e)},xW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${ds[r]} that is the same.`)}});var zb,Jwe,Ywe,Xwe,Qwe,exe,txe,rxe,nxe,ixe,oxe,sxe,oI,axe,Ub=y(()=>{go();sW();rI();vr();lW();mW();yW();bW();$W();zb=(t,e,r,n)=>{let o=fW(e,r,n).map((a,c)=>Jwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=ixe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>axe(a)),s},Jwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=z_(e),{stdioItems:o,isStdioArray:s}=Ywe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=aW(o,e,i),c=o.map(d=>gW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=oW(c,i,a,r),u=iW(l,a);return nxe(l,u),{direction:a,objectMode:u,stdioItems:l}},Ywe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Xwe(c,n)),..._W(r,e)],s=vW(o),a=s.length>1;return Qwe(s,a,n),txe(s),{stdioItems:s,isStdioArray:a}},Xwe=(t,e)=>({type:WV(t,e),value:t,optionName:e}),Qwe=(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(exe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},exe=new Set(["ignore","ipc"]),txe=t=>{for(let e of t)rxe(e)},rxe=({type:t,value:e,optionName:r})=>{if(XV(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(QV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},nxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Lb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},ixe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(oxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw oI(i),o}},oxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>sxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},sxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=SW({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&&!Yn(r)&&r.destroy()},axe=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 kW}from"node:fs";var AW,Pi,cxe,TW,EW,lxe,OW=y(()=>{rn();Ub();vr();AW=(t,e)=>zb(lxe,t,e,!0),Pi=({type:t,optionName:e})=>{TW(e,ds[t])},cxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&TW(t,`"${e}"`),{}),TW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},EW={generator(){},asyncGenerator:Pi,webStream:Pi,nodeStream:Pi,webTransform:Pi,duplex:Pi,asyncIterable:Pi,native:cxe},lxe={input:{...EW,fileUrl:({value:t})=>({contents:[ho(kW(t))]}),filePath:({value:{file:t}})=>({contents:[ho(kW(t))]}),fileNumber:Pi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...EW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Pi,string:Pi,uint8Array:Pi}}});var vo,sI,Yf=y(()=>{qR();vo=(t,{stripFinalNewline:e},r)=>sI(e,r)&&t!==void 0&&!Array.isArray(t)?kl(t):t,sI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var qb,cI,RW,IW,uxe,dxe,fxe,PW,pxe,aI,mxe,hxe,gxe,Bb=y(()=>{qb=(t,e,r,n)=>t||r?void 0:IW(e,n),cI=(t,e,r)=>r?t.flatMap(n=>RW(n,e)):RW(t,e),RW=(t,e)=>{let{transform:r,final:n}=IW(e,{});return[...r(t),...n()]},IW=(t,e)=>(e.previousChunks="",{transform:uxe.bind(void 0,e,t),final:fxe.bind(void 0,e)}),uxe=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},dxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),fxe=function*({previousChunks:t}){t.length>0&&(yield t)},PW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:pxe.bind(void 0,n)},pxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?mxe:gxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},aI=(t,e)=>`${t}${e}`,mxe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:oP},uxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},dxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:uxe}});import{Buffer as fxe}from"node:buffer";var RW,pxe,PW,mxe,hxe,IW,CW=y(()=>{rn();RW=(t,e)=>t?void 0:pxe.bind(void 0,e),pxe=function*(t,e){if(typeof e!="string"&&!Ut(e)&&!fxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},PW=(t,e)=>t?mxe.bind(void 0,e):hxe.bind(void 0,e),mxe=function*(t,e){IW(t,e),yield e},hxe=function*(t,e){if(IW(t,e),typeof e!="string"&&!Ut(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},IW=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:aI},hxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},gxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:hxe}});import{Buffer as yxe}from"node:buffer";var CW,_xe,DW,bxe,vxe,NW,jW=y(()=>{rn();CW=(t,e)=>t?void 0:_xe.bind(void 0,e),_xe=function*(t,e){if(typeof e!="string"&&!Ut(e)&&!yxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},DW=(t,e)=>t?bxe.bind(void 0,e):vxe.bind(void 0,e),bxe=function*(t,e){NW(t,e),yield e},vxe=function*(t,e){if(NW(t,e),typeof e!="string"&&!Ut(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},NW=(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 gxe}from"node:buffer";import{StringDecoder as yxe}from"node:string_decoder";var Ub,_xe,bxe,vxe,aP=y(()=>{rn();Ub=(t,e,r)=>{if(r)return;if(t)return{transform:_xe.bind(void 0,new TextEncoder)};let n=new yxe(e);return{transform:bxe.bind(void 0,n),final:vxe.bind(void 0,n)}},_xe=function*(t,e){gxe.isBuffer(e)?yield po(e):typeof e=="string"?yield t.encode(e):yield e},bxe=function*(t,e){yield Ut(e)?t.write(e):e},vxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as DW}from"node:util";var cP,qb,NW,Sxe,jW,wxe,MW=y(()=>{cP=DW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),qb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=wxe}=e[r];for await(let i of n(t))yield*qb(i,e,r+1)},NW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Sxe(r,Number(e),t)},Sxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*qb(n,r,e+1)},jW=DW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),wxe=function*(t){yield t}});var lP,FW,Da,Yf,xxe,$xe,uP=y(()=>{lP=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},FW=(t,e)=>[...e.flatMap(r=>[...Da(r,t,0)]),...Yf(t)],Da=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=$xe}=e[r];for(let i of n(t))yield*Da(i,e,r+1)},Yf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*xxe(r,Number(e),t)},xxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Da(n,r,e+1)},$xe=function*(t){yield t}});import{Transform as kxe,getDefaultHighWaterMark as LW}from"node:stream";var dP,Bb,zW,Hb=y(()=>{vr();zb();CW();aP();MW();uP();dP=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=zW(t,s,o),l=Ca(e),u=Ca(r),d=l?cP.bind(void 0,qb,a):lP.bind(void 0,Da),f=l||u?cP.bind(void 0,NW,a):lP.bind(void 0,Yf),p=l||u?jW.bind(void 0,a):void 0;return{stream:new kxe({writableObjectMode:n,writableHighWaterMark:LW(n),readableObjectMode:i,readableHighWaterMark:LW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Bb=(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=zW(s,r,a);t=FW(c,t)}return t},zW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:RW(n,a)},Ub(r,s,n),Lb(r,o,n,c),{transform:t,final:e},{transform:PW(i,a)},OW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var UW,Exe,Axe,Txe,Oxe,qW=y(()=>{Hb();rn();vr();UW=(t,e)=>{for(let r of Exe(t))Axe(t,r,e)},Exe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Axe=(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 ${us[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Txe(a,n));r.input=Nf(s)},Txe=(t,e)=>{let r=Bb(t,e,"utf8",!0);return Oxe(r),Nf(r)},Oxe=t=>{let e=t.find(r=>typeof r!="string"&&!Ut(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 Gb,Rxe,Pxe,BW,HW,Ixe,GW,fP=y(()=>{Oa();vr();gl();ss();Gb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&hl(r,n)&&!nn.has(e)&&Rxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Pxe.has(o))||t.every(({type:i})=>An.has(i))),Rxe=t=>t===1||t===2,Pxe=new Set(["pipe","overlapped"]),BW=async(t,e,r,n)=>{for await(let i of t)Ixe(e)||GW(i,r,n)},HW=(t,e,r)=>{for(let n of t)GW(n,e,r)},Ixe=t=>t._readableState.pipes.length>0,GW=(t,e,r)=>{let n=H_(t);Ti({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Cxe,appendFileSync as Dxe}from"node:fs";var ZW,Nxe,jxe,Mxe,Fxe,Lxe,VW=y(()=>{fP();Hb();zb();rn();vr();Ia();ZW=({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)=>Nxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Nxe=({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=PV(t,o,d),p=po(f),{stdioItems:m,objectMode:h}=e[r],g=jxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Mxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Fxe({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&&Lxe(b,m,i),S}catch(x){return n.error=x,S}},jxe=(t,e,r,n)=>{try{return Bb(t,e,r,!1)}catch(i){return n.error=i,t}},Mxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Nf(t)};let s=SG(t,r);return n[o]?{serializedResult:s,finalResult:sP(s,!i[o],e)}:{serializedResult:s}},Fxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Gb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=sP(t,!1,s);try{HW(a,e,n)}catch(c){r.error??=c}},Lxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>jb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Dxe(n,t):(r.add(o),Cxe(n,t))}}});var WW,KW=y(()=>{rn();Jf();WW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,_o(e,r,"all")]:Array.isArray(e)?[_o(t,r,"all"),...e]:Ut(t)&&Ut(e)?tR([t,e]):`${t}${e}`}});import{once as pP}from"node:events";var JW,zxe,YW,XW,Uxe,mP,hP=y(()=>{Aa();JW=async(t,e)=>{let[r,n]=await zxe(t);return e.isForcefullyTerminated??=!1,[r,n]},zxe=async t=>{let[e,r]=await Promise.allSettled([pP(t,"spawn"),pP(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?YW(t):r.value},YW=async t=>{try{return await pP(t,"exit")}catch{return YW(t)}},XW=async t=>{let[e,r]=await t;if(!Uxe(e,r)&&mP(e,r))throw new Xn;return[e,r]},Uxe=(t,e)=>t===void 0&&e===void 0,mP=(t,e)=>t!==0||e!==null});var QW,qxe,e3=y(()=>{Aa();Ia();hP();QW=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=qxe(t,e,r),s=o?.code==="ETIMEDOUT",a=RV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},qxe=(t,e,r)=>t!==void 0?t:mP(e,r)?new Xn:void 0});import{spawnSync as Bxe}from"node:child_process";var t3,Hxe,Gxe,Zxe,Zb,Vxe,Wxe,Kxe,Jxe,r3=y(()=>{uR();FR();LR();Kf();Cb();EW();Jf();qW();VW();Ia();KW();e3();t3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Hxe(t,e,r),d=Vxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Al(d,c,l)},Hxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=V_(t,e,r),a=Gxe(r),{file:c,commandArguments:l,options:u}=vb(t,e,a);Zxe(u);let d=$W(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Gxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Zxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Zb("ipcInput"),t&&Zb("ipc: true"),r&&Zb("detached: true"),n&&Zb("cancelSignal")},Zb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Vxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Wxe({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}=QW(c,r),{output:m,error:h=l}=ZW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>_o(_,r,S)),b=_o(WW(m,r),r,"all");return Jxe({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Wxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{UW(o,r);let a=Kxe(r);return Bxe(...Sb(t,e,a))}catch(a){return El({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},Kxe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Pb(e)}),Jxe=({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?Ib({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Wf({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 gP,on as Yxe}from"node:events";var n3,Xxe,Qxe,e0e,t0e,i3=y(()=>{Sl();Bf();qf();n3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(bl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:pb(t)}),Xxe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Xxe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{sb(e,i);let o=ls(t,e,r),s=new AbortController;try{return await Promise.race([Qxe(o,n,s),e0e(o,r,s),t0e(o,r,s)])}catch(a){throw vl(t),a}finally{s.abort(),ab(e,i)}},Qxe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await gP(t,"message",{signal:r});return n}for await(let[n]of Yxe(t,"message",{signal:r}))if(e(n))return n},e0e=async(t,e,{signal:r})=>{await gP(t,"disconnect",{signal:r}),h9(e)},t0e=async(t,e,{signal:r})=>{let[n]=await gP(t,"strict:error",{signal:r});throw rb(n,e)}});import{once as s3,on as r0e}from"node:events";var a3,yP,n0e,i0e,o0e,o3,_P=y(()=>{Sl();Bf();qf();a3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>yP({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),yP=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{bl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:pb(t)}),sb(e,o);let s=ls(t,e,r),a=new AbortController,c={};return n0e(t,s,a),i0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),o0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},n0e=async(t,e,r)=>{try{await s3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},i0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await s3(t,"strict:error",{signal:r.signal});n.error=rb(i,e),r.abort()}catch{}},o0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of r0e(r,"message",{signal:o.signal}))o3(s),yield c}catch{o3(s)}finally{o.abort(),ab(e,a),n||vl(t),i&&await t}},o3=({error:t})=>{if(t)throw t}});import c3 from"node:process";var l3,u3,d3,bP=y(()=>{_b();i3();_P();db();l3=(t,{ipc:e})=>{Object.assign(t,d3(t,!1,e))},u3=()=>{let t=c3,e=!0,r=c3.channel!==void 0;return{...d3(t,e,r),getCancelSignal:B9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},d3=(t,e,r)=>({sendMessage:yb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:n3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:a3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as s0e}from"node:child_process";import{PassThrough as a0e,Readable as c0e,Writable as l0e,Duplex as u0e}from"node:stream";var f3,d0e,Xf,f0e,p0e,m0e,h0e,p3=y(()=>{Fb();Kf();Cb();f3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{nP(n);let a=new s0e;d0e(a,n),Object.assign(a,{readable:f0e,writable:p0e,duplex:m0e});let c=El({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=h0e(c,s,i);return{subprocess:a,promise:l}},d0e=(t,e)=>{let r=Xf(),n=Xf(),i=Xf(),o=Array.from({length:e.length-3},Xf),s=Xf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Xf=()=>{let t=new a0e;return t.end(),t},f0e=()=>new c0e({read(){}}),p0e=()=>new l0e({write(){}}),m0e=()=>new u0e({read(){},write(){}}),h0e=async(t,e,r)=>Al(t,e,r)});import{createReadStream as m3,createWriteStream as h3}from"node:fs";import{Buffer as g0e}from"node:buffer";import{Readable as Qf,Writable as y0e,Duplex as _0e}from"node:stream";var y3,ep,g3,b0e,_3=y(()=>{Hb();Fb();vr();y3=(t,e)=>Mb(b0e,t,e,!1),ep=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${us[t]}.`)},g3={fileNumber:ep,generator:dP,asyncGenerator:dP,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:_0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},b0e={input:{...g3,fileUrl:({value:t})=>({stream:m3(t)}),filePath:({value:{file:t}})=>({stream:m3(t)}),webStream:({value:t})=>({stream:Qf.fromWeb(t)}),iterable:({value:t})=>({stream:Qf.from(t)}),asyncIterable:({value:t})=>({stream:Qf.from(t)}),string:({value:t})=>({stream:Qf.from(t)}),uint8Array:({value:t})=>({stream:Qf.from(g0e.from(t))})},output:{...g3,fileUrl:({value:t})=>({stream:h3(t)}),filePath:({value:{file:t,append:e}})=>({stream:h3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:y0e.fromWeb(t)}),iterable:ep,asyncIterable:ep,string:ep,uint8Array:ep}}});import{on as v0e,once as b3}from"node:events";import{PassThrough as S0e,getDefaultHighWaterMark as w0e}from"node:stream";import{finished as w3}from"node:stream/promises";function Na(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)SP(i);let e=t.some(({readableObjectMode:i})=>i),r=x0e(t,e),n=new vP({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var x0e,vP,$0e,k0e,E0e,SP,A0e,T0e,O0e,R0e,P0e,x3,$3,wP,k3,I0e,Vb,v3,S3,Wb=y(()=>{x0e=(t,e)=>{if(t.length===0)return w0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},vP=class extends S0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(SP(e),this.#t.has(e))return;this.#t.add(e),this.#n??=$0e(this,this.#t,this.#o);let r=A0e({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(SP(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)}},$0e=async(t,e,r)=>{Vb(t,v3);let n=new AbortController;try{await Promise.race([k0e(t,n),E0e(t,e,r,n)])}finally{n.abort(),Vb(t,-v3)}},k0e=async(t,{signal:e})=>{try{await w3(t,{signal:e,cleanup:!0})}catch(r){throw x3(t,r),r}},E0e=async(t,e,r,{signal:n})=>{for await(let[i]of v0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},SP=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},A0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Vb(t,S3);let a=new AbortController;try{await Promise.race([T0e(o,e,a),O0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),R0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Vb(t,-S3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?wP(t):P0e(t))},T0e=async(t,e,{signal:r})=>{try{await t,r.aborted||wP(e)}catch(n){r.aborted||x3(e,n)}},O0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await w3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;$3(s)?i.add(e):k3(t,s)}},R0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await b3(t,i,{signal:o}),!t.readable)return b3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},P0e=t=>{t.writable&&t.end()},x3=(t,e)=>{$3(e)?wP(t):k3(t,e)},$3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",wP=t=>{(t.readable||t.writable)&&t.destroy()},k3=(t,e)=>{t.destroyed||(t.once("error",I0e),t.destroy(e))},I0e=()=>{},Vb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},v3=2,S3=1});import{finished as E3}from"node:stream/promises";var Ol,C0e,xP,D0e,$P,Kb=y(()=>{mo();Ol=(t,e)=>{t.pipe(e),C0e(t,e),D0e(t,e)},C0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await E3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}xP(e)}},xP=t=>{t.writable&&t.end()},D0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await E3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}$P(t)}},$P=t=>{t.readable&&t.destroy()}});var A3,N0e,j0e,M0e,F0e,L0e,T3=y(()=>{Wb();mo();ob();vr();Kb();A3=(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})=>An.has(c)))N0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.has(c)))M0e({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]:Na(o);Ol(s,i)}},N0e=(t,e,r,n)=>{r==="output"?Ol(t.stdio[n],e):Ol(e,t.stdio[n]);let i=j0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},j0e=["stdin","stdout","stderr"],M0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;F0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},F0e=(t,{signal:e})=>{Yn(t)&&Ta(t,L0e,e)},L0e=2});var ja,O3=y(()=>{ja=[];ja.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&ja.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&ja.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Jb,kP,EP,z0e,AP,Yb,U0e,TP,OP,RP,R3,Vot,Wot,P3=y(()=>{O3();Jb=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",kP=Symbol.for("signal-exit emitter"),EP=globalThis,z0e=Object.defineProperty.bind(Object),AP=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(EP[kP])return EP[kP];z0e(EP,kP,{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}},Yb=class{},U0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),TP=class extends Yb{onExit(){return()=>{}}load(){}unload(){}},OP=class extends Yb{#t=RP.platform==="win32"?"SIGINT":"SIGHUP";#r=new AP;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of ja)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(!Jb(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 ja)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,ja.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 Jb(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"&&Jb(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)}},RP=globalThis.process,{onExit:R3,load:Vot,unload:Wot}=U0e(Jb(RP)?new OP(RP):new TP)});import{addAbortListener as q0e}from"node:events";var I3,C3=y(()=>{P3();I3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=R3(()=>{t.kill()});q0e(n,()=>{i()})}});var N3,B0e,H0e,D3,G0e,j3=y(()=>{eR();Z_();cs();pl();N3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=G_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=B0e(r,n,i),{sourceStream:d,sourceError:f}=G0e(t,l),{options:p,fileDescriptors:m}=Ri.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},B0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=H0e(t,e,...r),a=ib(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},H0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(D3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||XO(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]=D_(r,...n);return{destination:e(D3)(i,o,s),pipeOptions:s}}if(Ri.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}`)},D3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),G0e=(t,e)=>{try{return{sourceStream:xl(t,e)}}catch(r){return{sourceError:r}}}});var F3,Z0e,PP,M3,IP=y(()=>{Kf();Kb();F3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=Z0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw PP({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},Z0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return $P(t),n;if(e!==void 0)return xP(r),e},PP=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>El({error:t,command:M3,escapedCommand:M3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),M3="source.pipe(destination)"});var L3,z3=y(()=>{L3=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 V0e}from"node:stream/promises";var U3,W0e,K0e,J0e,Xb,Y0e,X0e,q3=y(()=>{Wb();ob();Kb();U3=(t,e,r)=>{let n=Xb.has(e)?K0e(t,e):W0e(t,e);return Ta(t,Y0e,r.signal),Ta(e,X0e,r.signal),J0e(e),n},W0e=(t,e)=>{let r=Na([t]);return Ol(r,e),Xb.set(e,r),r},K0e=(t,e)=>{let r=Xb.get(e);return r.add(t),r},J0e=async t=>{try{await V0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Xb.delete(t)},Xb=new WeakMap,Y0e=2,X0e=1});import{aborted as Q0e}from"node:util";var B3,e$e,H3=y(()=>{IP();B3=(t,e)=>t===void 0?[]:[e$e(t,e)],e$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Q0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw PP({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var Qb,t$e,r$e,G3=y(()=>{fo();j3();IP();z3();q3();H3();Qb=(t,...e)=>{if(Ot(e[0]))return Qb.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=N3(t,...e),i=t$e({...n,destination:r});return i.pipe=Qb.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},t$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=r$e(t,i);F3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=U3(e,o,d);return await Promise.race([L3(u),...B3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},r$e=(t,e)=>Promise.allSettled([t,e])});import{on as n$e}from"node:events";import{getDefaultHighWaterMark as i$e}from"node:stream";var ev,o$e,CP,s$e,V3,DP,Z3,a$e,c$e,tv=y(()=>{aP();zb();uP();ev=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return o$e(e,s),V3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},o$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},CP=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;s$e(e,s,t);let a=t.readableObjectMode&&!o;return V3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},s$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},V3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=n$e(t,"data",{signal:e.signal,highWaterMark:Z3,highWatermark:Z3});return a$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},DP=i$e(!0),Z3=DP,a$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=c$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Da(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Yf(a)}},c$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Ub(t,r,!e),Lb(t,i,!n,{})].filter(Boolean)});import{setImmediate as l$e}from"node:timers/promises";var W3,u$e,d$e,f$e,NP,K3,jP=y(()=>{Rb();rn();fP();tv();Ia();Jf();W3=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=u$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([d$e(t),d]);return}let f=iP(c,r),p=CP({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([f$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},u$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Gb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=CP({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await BW(a,t,r,o)},d$e=async t=>{await l$e(),t.readableFlowing===null&&t.resume()},f$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Eb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Ab(r,{maxBuffer:o})):await Ob(r,{maxBuffer:o})}catch(a){return K3(AV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},NP=async t=>{try{return await t}catch(e){return K3(e)}},K3=({bufferedData:t})=>bG(t)?new Uint8Array(t):t});import{finished as p$e}from"node:stream/promises";var tp,m$e,h$e,g$e,y$e,_$e,MP,rv,J3,nv=y(()=>{tp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=m$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],p$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||y$e(a,e,r,n)}finally{s.abort()}},m$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&h$e(t,r,n),n},h$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{g$e(e,r),n.call(t,...i)}},g$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},y$e=(t,e,r,n)=>{if(!_$e(t,e,r,n))throw t},_$e=(t,e,r,n=!0)=>r.propagating?J3(t)||rv(t):(r.propagating=!0,MP(r,e)===n?J3(t):rv(t)),MP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",rv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",J3=t=>t?.code==="EPIPE"});var Y3,FP,LP=y(()=>{jP();nv();Y3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>FP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),FP=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=tp(t,e,l);if(MP(l,e)){await u;return}let[d]=await Promise.all([W3({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 X3,Q3,b$e,v$e,zP=y(()=>{Wb();LP();X3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Na([t,e].filter(Boolean)):void 0,Q3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>FP({...b$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:v$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),b$e=({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}},v$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var eK,tK,rK=y(()=>{gl();ss();eK=t=>hl(t,"ipc"),tK=(t,e)=>{let r=H_(t);Ti({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var nK,iK,oK=y(()=>{Ia();rK();go();_P();nK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=eK(o),a=ho(e,"ipc"),c=ho(r,"ipc");for await(let l of yP({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(TV(t,i,c),i.push(l)),s&&tK(l,o);return i},iK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as S$e}from"node:events";var sK,w$e,x$e,$$e,aK=y(()=>{Pa();CR();$R();IR();mo();vr();jP();oK();NR();zP();LP();hP();nv();sK=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 _=JW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=Y3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=Q3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=nK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=w$e(h,t,S),D=x$e(m,S);try{return await Promise.race([Promise.all([{},XW(_),Promise.all(x),w,T,Q9(t,d),...A,...D]),g,$$e(t,b),...W9(t,o,f,b),...m9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...Z9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(se=>NP(se))),NP(w),iK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},w$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:tp(n,i,r)),x$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>tp(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),$$e=async(t,{signal:e})=>{let[r]=await S$e(t,"error",{signal:e});throw r}});var cK,rp,Rl,iv=y(()=>{wl();cK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),rp=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Oi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Rl=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 lK}from"node:stream/promises";var UP,uK,qP,BP,ov,sv,HP=y(()=>{nv();UP=async t=>{if(t!==void 0)try{await qP(t)}catch{}},uK=async t=>{if(t!==void 0)try{await BP(t)}catch{}},qP=async t=>{await lK(t,{cleanup:!0,readable:!1,writable:!0})},BP=async t=>{await lK(t,{cleanup:!0,readable:!0,writable:!1})},ov=async(t,e)=>{if(await t,e)throw e},sv=(t,e,r)=>{r&&!rv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as k$e}from"node:stream";import{callbackify as E$e}from"node:util";var dK,GP,ZP,VP,A$e,WP,KP,fK,JP=y(()=>{Oa();cs();tv();wl();iv();HP();dK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=GP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=ZP(a,s),{read:f,onStdoutDataDone:p}=VP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new k$e({read:f,destroy:E$e(KP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return WP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},GP=(t,e,r)=>{let n=xl(t,e),i=rp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},ZP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:DP},VP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Oi(),s=ev({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){A$e(this,s,o)},onStdoutDataDone:o}},A$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},WP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await BP(t),await n,await UP(i),await e,r.readable&&r.push(null)}catch(o){await UP(i),fK(r,o)}},KP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Rl(r,e)&&(fK(t,n),await ov(e,n))},fK=(t,e)=>{sv(t,t.readable,e)}});import{Writable as T$e}from"node:stream";import{callbackify as pK}from"node:util";var mK,YP,XP,O$e,R$e,QP,eI,hK,tI=y(()=>{cs();iv();HP();mK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=YP(t,r,e),s=new T$e({...XP(n,t,i),destroy:pK(eI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return QP(n,s),s},YP=(t,e,r)=>{let n=ib(t,e),i=rp(r,n,"writableFinal"),o=rp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},XP=(t,e,r)=>({write:O$e.bind(void 0,t),final:pK(R$e.bind(void 0,t,e,r))}),O$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},R$e=async(t,e,r)=>{await Rl(r,e)&&(t.writable&&t.end(),await e)},QP=async(t,e,r)=>{try{await qP(t),e.writable&&e.end()}catch(n){await uK(r),hK(e,n)}},eI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Rl(r,e),await Rl(n,e)&&(hK(t,i),await ov(e,i))},hK=(t,e)=>{sv(t,t.writable,e)}});import{Duplex as P$e}from"node:stream";import{callbackify as I$e}from"node:util";var gK,C$e,yK=y(()=>{Oa();JP();tI();gK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=GP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=YP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=ZP(c,a),{read:g,onStdoutDataDone:b}=VP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new P$e({read:g,...XP(u,t,d),destroy:I$e(C$e.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 WP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),QP(u,_,c),_},C$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([KP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),eI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var rI,D$e,_K=y(()=>{Oa();cs();tv();rI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=xl(t,r),a=ev({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return D$e(a,s,t)},D$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var bK,vK=y(()=>{iv();JP();tI();yK();_K();bK=(t,{encoding:e})=>{let r=cK();t.readable=dK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=mK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=gK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=rI.bind(void 0,t,e),t[Symbol.asyncIterator]=rI.bind(void 0,t,e,{})}});var SK,N$e,j$e,wK=y(()=>{SK=(t,e)=>{for(let[r,n]of j$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},N$e=(async()=>{})().constructor.prototype,j$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(N$e,t)])});import{setMaxListeners as M$e}from"node:events";import{spawn as F$e}from"node:child_process";var xK,L$e,z$e,U$e,q$e,B$e,$K=y(()=>{Rb();uR();FR();cs();LR();bP();Kf();Cb();p3();_3();Jf();T3();eb();C3();G3();zP();aK();vK();wl();wK();xK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=L$e(t,e,r),{subprocess:f,promise:p}=U$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Qb.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),SK(f,p),Ri.set(f,{options:u,fileDescriptors:d}),f},L$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=V_(t,e,r),{file:a,commandArguments:c,options:l}=vb(t,e,r),u=z$e(l),d=y3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},z$e=({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}},U$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=F$e(...Sb(t,e,r))}catch(m){return f3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;M$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];A3(c,a,l),I3(c,r,l);let d={},f=Oi();c.kill=f9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=X3(c,r),bK(c,r),l3(c,r);let p=q$e({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}},q$e=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 sK({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)=>_o(x,e,w)),_=_o(h,e,"all"),S=B$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Al(S,n,e)},B$e=({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?Wf({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 Pi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Ib({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var av,H$e,G$e,kK=y(()=>{fo();go();av=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,H$e(n,t[n],i)]));return{...t,...r}},H$e=(t,e,r)=>G$e.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,G$e=new Set(["env",...oR])});var ds,Z$e,V$e,EK=y(()=>{fo();eR();AG();r3();$K();kK();ds=(t,e,r,n)=>{let i=(s,a,c)=>ds(s,a,r,c),o=(...s)=>Z$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Z$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,av(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=V$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?t3(a,c,l):xK(a,c,l,i)},V$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=kG(e)?EG(e,r):[e,...r],[s,a,c]=D_(...o),l=av(av(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 AK,TK,OK,W$e,K$e,RK=y(()=>{AK=({file:t,commandArguments:e})=>OK(t,e),TK=({file:t,commandArguments:e})=>({...OK(t,e),isSync:!0}),OK=(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]=W$e(t);return{file:r,commandArguments:n}},W$e=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(K$e)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},K$e=/ +/g});var PK,IK,J$e,CK,Y$e,DK,NK=y(()=>{PK=(t,e,r)=>{t.sync=e(J$e,r),t.s=t.sync},IK=({options:t})=>CK(t),J$e=({options:t})=>({...CK(t),isSync:!0}),CK=t=>({options:{...Y$e(t),...t}}),Y$e=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},DK={preferLocal:!0}});var Mct,Je,Fct,Lct,zct,Uct,qct,Bct,Hct,Gct,Mr=y(()=>{EK();RK();DR();NK();bP();Mct=ds(()=>({})),Je=ds(()=>({isSync:!0})),Fct=ds(AK),Lct=ds(TK),zct=ds(J9),Uct=ds(IK,{},DK,PK),{sendMessage:qct,getOneMessage:Bct,getEachMessage:Hct,getCancelSignal:Gct}=u3()});import{existsSync as cv,statSync as X$e}from"node:fs";import{dirname as nI,extname as Q$e,isAbsolute as jK,join as iI,relative as oI,resolve as lv,sep as eke}from"node:path";function uv(t){return t==="./gradlew"||t==="gradle"}function tke(t){return(cv(iI(t,"build.gradle.kts"))||cv(iI(t,"build.gradle")))&&cv(iI(t,"gradle.properties"))}function rke(t,e){let n=oI(t,e).split(eke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function fs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function nke(t,e){let r=lv(t,e),n=r;cv(r)?X$e(r).isFile()&&(n=nI(r)):Q$e(r)!==""&&(n=nI(r));let i=oI(t,n);if(i.startsWith("..")||jK(i))return null;let o=n;for(;;){if(tke(o))return o;if(lv(o)===lv(t))return null;let s=nI(o);if(s===o)return null;let a=oI(t,s);if(a.startsWith("..")||jK(a))return null;o=s}}function dv(t,e){let r=lv(t),n=new Map,i=[];for(let o of e){let s=nke(r,o);if(!s){i.push(o);continue}let a=rke(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 fv=y(()=>{"use strict"});import{existsSync as ike,readFileSync as oke}from"node:fs";import{join as ske}from"node:path";function Pl(t="."){let e=ske(t,".cladding","config.yaml");if(!ike(e))return sI;try{let n=(0,MK.parse)(oke(e,"utf8"))?.gate;if(!n)return sI;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 ake){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 sI}}function FK(t,e){let r=[],n=!1;for(let i of t){let o=cke.exec(i);if(o){n=!0;for(let s of e)r.push(fs(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 MK,ake,sI,cke,pv=y(()=>{"use strict";MK=St(Qt(),1);fv();ake=["type","lint","test","coverage"],sI={scope:"feature"};cke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as cI,readFileSync as LK,readdirSync as lke,statSync as uke}from"node:fs";import{join as mv}from"node:path";function dI(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=mv(t,e);if(cI(r))try{if(zK.test(LK(r,"utf8")))return!0}catch{}}return!1}function UK(t){try{return cI(t)&&zK.test(LK(t,"utf8"))}catch{return!1}}function qK(t,e=0){if(e>4||!cI(t))return!1;let r;try{r=lke(t)}catch{return!1}for(let n of r){let i=mv(t,n),o=!1;try{o=uke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(qK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&UK(i))return!0}return!1}function pke(t){if(dI(t))return!0;for(let e of dke)if(UK(mv(t,e)))return!0;for(let e of fke)if(qK(mv(t,e)))return!0;return!1}function BK(t="."){let e=Pl(t).coverage;return e||(pke(t)?"kover":"jacoco")}function HK(t="."){return lI[BK(t)]}function GK(t="."){return aI[BK(t)]}var lI,aI,uI,zK,dke,fke,hv=y(()=>{"use strict";pv();lI={kover:"koverXmlReport",jacoco:"jacocoTestReport"},aI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},uI=[aI.kover,aI.jacoco],zK=/kover/i;dke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],fke=["buildSrc","build-logic"]});import{existsSync as gv,readFileSync as ZK,readdirSync as VK}from"node:fs";import{join as Ma}from"node:path";function fI(t){return gv(Ma(t,"gradlew"))?"./gradlew":"gradle"}function mke(t){let e=fI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[HK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function hke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(ZK(Ma(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 yke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function vke(t,e){for(let r of e)if(gv(Ma(t,r)))return r}function Ske(t,e){try{return VK(t).find(n=>n.endsWith(e))}catch{return}}function xke(t,e){for(let r of wke)if(r.configs.some(n=>gv(Ma(t,n))))return r.gate;return e}function kke(t){if($ke.some(e=>gv(Ma(t,e))))return!0;try{return JSON.parse(ZK(Ma(t,"package.json"),"utf8")).jest!==void 0}catch{return!1}}function Eke(t,e){let r=e.lint?{...e,lint:xke(t,e.lint)}:{...e};return e.test&&e.coverage&&kke(t)?{...r,test:{cmd:"npx",args:["--no-install","jest"]},coverage:{cmd:"npx",args:["--no-install","jest","--coverage"]}}:r}function dt(t="."){for(let e of _ke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Ske(t,o):r=vke(t,[o]),r)break;if(!r||e.requiresSource&&!yke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Eke(t,n):n;return{language:e.language,manifest:r,gates:i}}return bke}var gke,_ke,bke,wke,$ke,on=y(()=>{"use strict";hv();gke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);_ke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","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:mke},{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:hke}],bke={language:"unknown",manifest:"",gates:{}};wke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}];$ke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Ake,readFileSync as Tke}from"node:fs";import{join as Oke}from"node:path";function Fa(t){return t.code==="ENOENT"}function yv(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=(o||s||`exit ${i}`).slice(0,200);return WK.test(o)||WK.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function qt(t,e,r){return Fa(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Il(t,e){let r=Oke(t,"package.json");if(!Ake(r))return!1;try{return!!JSON.parse(Tke(r,"utf8")).scripts?.[e]}catch{return!1}}var WK,Tn=y(()=>{"use strict";WK=/config (is |file )?not found|no such file|ENOENT|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 Rke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:_v,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Fa(i)?[{detector:_v,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:yv(i,_v,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var _v,La,bv=y(()=>{"use strict";Mr();on();Tn();_v="ARCHITECTURE_VIOLATION";La={name:_v,subprocess:!0,run:Rke}});function Pke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:vv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return Fa(i)?[{detector:vv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:yv(i,vv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var vv,za,Sv=y(()=>{"use strict";Mr();on();Tn();vv="HARDCODED_SECRET";za={name:vv,subprocess:!0,run:Pke}});import{existsSync as pI,readdirSync as KK}from"node:fs";import{join as wv}from"node:path";function Cke(t,e){let r=wv(t,e.path);if(!pI(r))return!0;if(e.isDirectory)try{return KK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Dke(t){let{cwd:e="."}=t,r=[];for(let i of Ike)Cke(e,i)&&r.push({detector:np,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=wv(e,"spec.yaml");if(pI(n)){let i=Mke(n),o=i?null:Nke(e);if(i)r.push({detector:np,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:np,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=jke(e);s&&r.push({detector:np,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 Nke(t){for(let e of["spec/features","spec/scenarios"]){let r=wv(t,e);if(!pI(r))continue;let n;try{n=KK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ki(wv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function jke(t){try{return H(t),null}catch(e){return e.message}}function Mke(t){let e;try{e=ki(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var np,Ike,JK,YK=y(()=>{"use strict";qe();$_();np="ABSENCE_OF_GOVERNANCE",Ike=[{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}];JK={name:np,run:Dke}});function xv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function mI(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=xv(r)==="while",o=Lke.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 '${xv(r)}'`}let n=Fke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:xv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${xv(r)}'`:null}function zke(t,e){let r=mI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function XK(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...zke(r,n));return e}var Fke,Lke,hI=y(()=>{"use strict";Fke={event:"when",state:"while",optional:"where",unwanted:"if"},Lke=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";qe()});function Uke(t){let{cwd:e="."}=t;return he(e,$v,qke)}function qke(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:$v,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 XK(t.features))e.push({detector:$v,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var $v,QK,eJ=y(()=>{"use strict";hI();wt();$v="AC_DRIFT";QK={name:$v,run:Uke}});function Ci(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return rJ[n]??tJ}var Bke,Hke,Gke,tJ,Zke,Vke,rJ,Wke,nJ,Ua=y(()=>{"use strict";on();Bke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,Hke=/^[ \t]*import\s+([\w.]+)/gm,Gke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,tJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:Bke,importStyle:"relative"},Zke={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:Hke,importStyle:"dotted"},Vke={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:Gke,importStyle:"dotted"},rJ={typescript:tJ,kotlin:Zke,python:Vke},Wke=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],nJ=new Set([...Object.values(rJ).flatMap(t=>t?.extensions??[]),...Wke].map(t=>t.toLowerCase()))});import{existsSync as Kke,readFileSync as Jke,readdirSync as Yke,statSync as Xke}from"node:fs";import{join as oJ,relative as iJ}from"node:path";function Qke(t,e){if(!Kke(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=Yke(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=oJ(i,s),c;try{c=Xke(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function eEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function rEe(t){return tEe.test(t)}function nEe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Ci(e,r.project?.language),o=i.sourceRoots.flatMap(a=>Qke(oJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=Jke(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";qe();Ua();sJ="AI_HINTS_FORBIDDEN_PATTERN";tEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;aJ={name:sJ,run:nEe}});function iEe(t){let{cwd:e="."}=t,r;try{r=H(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:lJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var lJ,uJ,dJ=y(()=>{"use strict";qe();lJ="AC_DUPLICATE_WITHIN_FEATURE";uJ={name:lJ,run:iEe}});import{createRequire as oEe}from"module";import{basename as sEe,dirname as yI,normalize as aEe,relative as cEe,resolve as lEe,sep as mJ}from"path";import*as uEe from"fs";function dEe(t){let e=aEe(t);return e.length>1&&e[e.length-1]===mJ&&(e=e.substring(0,e.length-1)),e}function hJ(t,e){return t.replace(fEe,e)}function mEe(t){return t==="/"||pEe.test(t)}function gI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=lEe(t)),(n||o)&&(t=dEe(t)),t===".")return"";let s=t[t.length-1]!==i;return hJ(s?t+i:t,i)}function gJ(t,e){return e+t}function hEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:hJ(cEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function gEe(t){return t}function yEe(t,e,r){return e+t+r}function _Ee(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?hEe(t,e):n?gJ:gEe}function bEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function vEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function $Ee(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?vEe(t):bEe(t):n&&n.length?wEe:SEe:xEe}function REe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?OEe:r&&r.length?n?kEe:EEe:n?AEe:TEe}function CEe(t){return t.group?IEe:PEe}function jEe(t){return t.group?DEe:NEe}function LEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?FEe:MEe}function yJ(t,e,r){if(r.options.useRealPaths)return zEe(e,r);let n=yI(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=yI(n)}return r.symlinks.set(t,e),i>1}function zEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function kv(t,e,r,n){e(t&&!n?t:null,r)}function KEe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?UEe:GEe:n?e?qEe:WEe:i?e?HEe:VEe:e?BEe:ZEe}function XEe(t){return t?YEe:JEe}function rAe(t,e){return new Promise((r,n)=>{vJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function vJ(t,e,r){new bJ(t,e,r).start()}function nAe(t,e){return new bJ(t,e).start()}var fJ,fEe,pEe,SEe,wEe,xEe,kEe,EEe,AEe,TEe,OEe,PEe,IEe,DEe,NEe,MEe,FEe,UEe,qEe,BEe,HEe,GEe,ZEe,VEe,WEe,_J,JEe,YEe,QEe,eAe,tAe,bJ,pJ,SJ,wJ,xJ=y(()=>{fJ=oEe(import.meta.url);fEe=/[\\/]/g;pEe=/^[a-z]:[\\/]$/i;SEe=(t,e)=>{e.push(t||".")},wEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},xEe=()=>{};kEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},EEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},AEe=(t,e,r,n)=>{r.files++},TEe=(t,e)=>{e.push(t)},OEe=()=>{};PEe=t=>t,IEe=()=>[""].slice(0,0);DEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},NEe=()=>{};MEe=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()&&yJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},FEe=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()&&yJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};UEe=t=>t.counts,qEe=t=>t.groups,BEe=t=>t.paths,HEe=t=>t.paths.slice(0,t.options.maxFiles),GEe=(t,e,r)=>(kv(e,r,t.counts,t.options.suppressErrors),null),ZEe=(t,e,r)=>(kv(e,r,t.paths,t.options.suppressErrors),null),VEe=(t,e,r)=>(kv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),WEe=(t,e,r)=>(kv(e,r,t.groups,t.options.suppressErrors),null);_J={withFileTypes:!0},JEe=(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||".",_J,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},YEe=(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||".",_J)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};QEe=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))}},eAe=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}},tAe=class{aborted=!1;abort(){this.aborted=!0}},bJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=KEe(e,this.isSynchronous),this.root=gI(t,e),this.state={root:mEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new eAe,options:e,queue:new QEe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new tAe,fs:e.fs||uEe},this.joinPath=_Ee(this.root,e),this.pushDirectory=$Ee(this.root,e),this.pushFile=REe(e),this.getArray=CEe(e),this.groupFiles=jEe(e),this.resolveSymlink=LEe(e,this.isSynchronous),this.walkDirectory=XEe(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(_=gI(_,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=sEe(_),x=gI(yI(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};pJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return rAe(this.root,this.options)}withCallback(t){vJ(this.root,this.options,t)}sync(){return nAe(this.root,this.options)}},SJ=null;try{fJ.resolve("picomatch"),SJ=fJ("picomatch")}catch{}wJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:mJ,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 pJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new pJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||SJ;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 ip=v((Wlt,TJ)=>{"use strict";var $J="[^\\\\/]",iAe="(?=.)",kJ="[^/]",_I="(?:\\/|$)",EJ="(?:^|\\/)",bI=`\\.{1,2}${_I}`,oAe="(?!\\.)",sAe=`(?!${EJ}${bI})`,aAe=`(?!\\.{0,1}${_I})`,cAe=`(?!${bI})`,lAe="[^.\\/]",uAe=`${kJ}*?`,dAe="/",AJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:iAe,QMARK:kJ,END_ANCHOR:_I,DOTS_SLASH:bI,NO_DOT:oAe,NO_DOTS:sAe,NO_DOT_SLASH:aAe,NO_DOTS_SLASH:cAe,QMARK_NO_DOT:lAe,STAR:uAe,START_ANCHOR:EJ,SEP:dAe},fAe={...AJ,SLASH_LITERAL:"[\\\\/]",QMARK:$J,STAR:`${$J}*?`,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:"\\"},pAe={__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"};TJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:pAe,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?fAe:AJ}}});var op=v(Fr=>{"use strict";var{REGEX_BACKSLASH:mAe,REGEX_REMOVE_BACKSLASH:hAe,REGEX_SPECIAL_CHARS:gAe,REGEX_SPECIAL_CHARS_GLOBAL:yAe}=ip();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>gAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(yAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(mAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(hAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var jJ=v((Jlt,NJ)=>{"use strict";var OJ=op(),{CHAR_ASTERISK:vI,CHAR_AT:_Ae,CHAR_BACKWARD_SLASH:sp,CHAR_COMMA:bAe,CHAR_DOT:SI,CHAR_EXCLAMATION_MARK:wI,CHAR_FORWARD_SLASH:DJ,CHAR_LEFT_CURLY_BRACE:xI,CHAR_LEFT_PARENTHESES:$I,CHAR_LEFT_SQUARE_BRACKET:vAe,CHAR_PLUS:SAe,CHAR_QUESTION_MARK:RJ,CHAR_RIGHT_CURLY_BRACE:wAe,CHAR_RIGHT_PARENTHESES:PJ,CHAR_RIGHT_SQUARE_BRACKET:xAe}=ip(),IJ=t=>t===DJ||t===sp,CJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},$Ae=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,se=()=>c.charCodeAt(l+1),Y=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),Oe&&m===!0&&d>0?(Oe=c.slice(0,d),I=c.slice(d)):m===!0?(Oe="",I=c):Oe=c,Oe&&Oe!==""&&Oe!=="/"&&Oe!==c&&IJ(Oe.charCodeAt(Oe.length-1))&&(Oe=Oe.slice(0,-1)),r.unescape===!0&&(I&&(I=OJ.removeBackslashes(I)),Oe&&_===!0&&(Oe=OJ.removeBackslashes(Oe)));let Pr={prefix:C,input:t,start:u,base:Oe,glob:I,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Pr.maxDepth=0,IJ(A)||s.push(D),Pr.tokens=s),r.parts===!0||r.tokens===!0){let oe;for(let Ie=0;Ie{"use strict";var ap=ip(),sn=op(),{MAX_LENGTH:Ev,POSIX_REGEX_SOURCE:kAe,REGEX_NON_SPECIAL_CHARS:EAe,REGEX_SPECIAL_CHARS_BACKREF:AAe,REPLACEMENTS:MJ}=ap,TAe=(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=>sn.escapeRegex(i)).join("..")}return r},Cl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,FJ=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},OAe=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},LJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(OAe(e))return e.replace(/\\(.)/g,"$1")},RAe=t=>{let e=t.map(LJ).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}}}}},PAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=LJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},IAe=t=>{let e=0,r=t.trim(),n=kI(r);for(;n;)e++,r=n.body.trim(),n=kI(r);return e},CAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:ap.DEFAULT_MAX_EXTGLOB_RECURSION,n=FJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||RAe(n)))return{risky:!0};for(let i of n){let o=PAe(i);if(o)return{risky:!0,safeOutput:o};if(IAe(i)>r)return{risky:!0}}return{risky:!1}},EI=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=MJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Ev,r.maxLength):Ev,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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={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=sn.removePrefix(t,$),i=t.length;let se=[],Y=[],Oe=[],C=o,I,Pr=()=>$.index===i-1,oe=$.peek=(B=1)=>t[$.index+B],Ie=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(B="",ht=0)=>{$.consumed+=B,$.index+=ht},Yt=B=>{$.output+=B.output!=null?B.output:B.value,dr(B.value)},io=()=>{let B=1;for(;oe()==="!"&&(oe(2)!=="("||oe(3)==="?");)Ie(),$.start++,B++;return B%2===0?!1:($.negated=!0,$.start++,!0)},vi=B=>{$[B]++,Oe.push(B)},Yr=B=>{$[B]--,Oe.pop()},de=B=>{if(C.type==="globstar"){let ht=$.braces>0&&(B.type==="comma"||B.type==="brace"),q=B.extglob===!0||se.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ht&&!q&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(se.length&&B.type!=="paren"&&(se[se.length-1].inner+=B.value),(B.value||B.output)&&Yt(B),C&&C.type==="text"&&B.type==="text"){C.output=(C.output||C.value)+B.value,C.value+=B.value;return}B.prev=C,s.push(B),C=B},oo=(B,ht)=>{let q={...l[ht],conditions:1,inner:""};q.prev=C,q.parens=$.parens,q.output=$.output,q.startIndex=$.index,q.tokensIndex=s.length;let Ae=(r.capture?"(":"")+q.open;vi("parens"),de({type:B,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ie(),output:Ae}),se.push(q)},fde=B=>{let ht=t.slice(B.startIndex,$.index+1),q=t.slice(B.startIndex+2,$.index),Ae=CAe(q,r);if((B.type==="plus"||B.type==="star")&&Ae.risky){let ct=Ae.safeOutput?(B.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,Si=s[B.tokensIndex];Si.type="text",Si.value=ht,Si.output=ct||sn.escapeRegex(ht);for(let wi=B.tokensIndex+1;wi1&&B.inner.includes("/")&&(ct=O(r)),(ct!==D||Pr()||/^\)+$/.test(Kt()))&&(ut=B.close=`)$))${ct}`),B.inner.includes("*")&&(Lt=Kt())&&/^\.[^\\/.]+$/.test(Lt)){let Si=EI(Lt,{...e,fastpaths:!1}).output;ut=B.close=`)${Si})${ct})`}B.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:I,output:ut}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ht=t.replace(AAe,(q,Ae,ut,Lt,ct,Si)=>Lt==="\\"?(B=!0,q):Lt==="?"?Ae?Ae+Lt+(ct?_.repeat(ct.length):""):Si===0?A+(ct?_.repeat(ct.length):""):_.repeat(ut.length):Lt==="."?u.repeat(ut.length):Lt==="*"?Ae?Ae+Lt+(ct?D:""):D:Ae?q:`\\${q}`);return B===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=sn.wrapOutput(ht,$,e),$)}for(;!Pr();){if(I=Ie(),I==="\0")continue;if(I==="\\"){let q=oe();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){I+="\\",de({type:"text",value:I});continue}let Ae=/^\\+/.exec(Kt()),ut=0;if(Ae&&Ae[0].length>2&&(ut=Ae[0].length,$.index+=ut,ut%2!==0&&(I+="\\")),r.unescape===!0?I=Ie():I+=Ie(),$.brackets===0){de({type:"text",value:I});continue}}if($.brackets>0&&(I!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&I===":"){let q=C.value.slice(1);if(q.includes("[")&&(C.posix=!0,q.includes(":"))){let Ae=C.value.lastIndexOf("["),ut=C.value.slice(0,Ae),Lt=C.value.slice(Ae+2),ct=kAe[Lt];if(ct){C.value=ut+ct,$.backtrack=!0,Ie(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(I==="["&&oe()!==":"||I==="-"&&oe()==="]")&&(I=`\\${I}`),I==="]"&&(C.value==="["||C.value==="[^")&&(I=`\\${I}`),r.posix===!0&&I==="!"&&C.value==="["&&(I="^"),C.value+=I,Yt({value:I});continue}if($.quotes===1&&I!=='"'){I=sn.escapeRegex(I),C.value+=I,Yt({value:I});continue}if(I==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:I});continue}if(I==="("){vi("parens"),de({type:"paren",value:I});continue}if(I===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Cl("opening","("));let q=se[se.length-1];if(q&&$.parens===q.parens+1){fde(se.pop());continue}de({type:"paren",value:I,output:$.parens?")":"\\)"}),Yr("parens");continue}if(I==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Cl("closing","]"));I=`\\${I}`}else vi("brackets");de({type:"bracket",value:I});continue}if(I==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:I,output:`\\${I}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Cl("opening","["));de({type:"text",value:I,output:`\\${I}`});continue}Yr("brackets");let q=C.value.slice(1);if(C.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(I=`/${I}`),C.value+=I,Yt({value:I}),r.literalBrackets===!1||sn.hasRegexChars(q))continue;let Ae=sn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Ae,C.value=Ae;continue}C.value=`(${a}${Ae}|${C.value})`,$.output+=C.value;continue}if(I==="{"&&r.nobrace!==!0){vi("braces");let q={type:"brace",value:I,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};Y.push(q),de(q);continue}if(I==="}"){let q=Y[Y.length-1];if(r.nobrace===!0||!q){de({type:"text",value:I,output:I});continue}let Ae=")";if(q.dots===!0){let ut=s.slice(),Lt=[];for(let ct=ut.length-1;ct>=0&&(s.pop(),ut[ct].type!=="brace");ct--)ut[ct].type!=="dots"&&Lt.unshift(ut[ct].value);Ae=TAe(Lt,r),$.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let ut=$.output.slice(0,q.outputIndex),Lt=$.tokens.slice(q.tokensIndex);q.value=q.output="\\{",I=Ae="\\}",$.output=ut;for(let ct of Lt)$.output+=ct.output||ct.value}de({type:"brace",value:I,output:Ae}),Yr("braces"),Y.pop();continue}if(I==="|"){se.length>0&&se[se.length-1].conditions++,de({type:"text",value:I});continue}if(I===","){let q=I,Ae=Y[Y.length-1];Ae&&Oe[Oe.length-1]==="braces"&&(Ae.comma=!0,q="|"),de({type:"comma",value:I,output:q});continue}if(I==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:I,output:f});continue}if(I==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let q=Y[Y.length-1];C.type="dots",C.output+=I,C.value+=I,q.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:I,output:u});continue}de({type:"dot",value:I,output:u});continue}if(I==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){oo("qmark",I);continue}if(C&&C.type==="paren"){let Ae=oe(),ut=I;(C.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${I}`),de({type:"text",value:I,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:I,output:S});continue}de({type:"qmark",value:I,output:_});continue}if(I==="!"){if(r.noextglob!==!0&&oe()==="("&&(oe(2)!=="?"||!/[!=<:]/.test(oe(3)))){oo("negate",I);continue}if(r.nonegate!==!0&&$.index===0){io();continue}}if(I==="+"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){oo("plus",I);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:I,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:I});continue}de({type:"plus",value:d});continue}if(I==="@"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){de({type:"at",extglob:!0,value:I,output:""});continue}de({type:"text",value:I});continue}if(I!=="*"){(I==="$"||I==="^")&&(I=`\\${I}`);let q=EAe.exec(Kt());q&&(I+=q[0],$.index+=q[0].length),de({type:"text",value:I});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=I,C.output=D,$.backtrack=!0,$.globstar=!0,dr(I);continue}let B=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){oo("star",I);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(I);continue}let q=C.prev,Ae=q.prev,ut=q.type==="slash"||q.type==="bos",Lt=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!ut||B[0]&&B[0]!=="/")){de({type:"star",value:I,output:""});continue}let ct=$.braces>0&&(q.type==="comma"||q.type==="brace"),Si=se.length&&(q.type==="pipe"||q.type==="paren");if(!ut&&q.type!=="paren"&&!ct&&!Si){de({type:"star",value:I,output:""});continue}for(;B.slice(0,3)==="/**";){let wi=t[$.index+4];if(wi&&wi!=="/")break;B=B.slice(3),dr("/**",3)}if(q.type==="bos"&&Pr()){C.type="globstar",C.value+=I,C.output=O(r),$.output=C.output,$.globstar=!0,dr(I);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!Lt&&Pr()){$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=I,$.globstar=!0,$.output+=q.output+C.output,dr(I);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&B[0]==="/"){let wi=B[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${wi})`,C.value+=I,$.output+=q.output+C.output,$.globstar=!0,dr(I+Ie()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&B[0]==="/"){C.type="globstar",C.value+=I,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(I+Ie()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=I,$.output+=C.output,$.globstar=!0,dr(I);continue}let ht={type:"star",value:I,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=I,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),oe()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cl("closing","]"));$.output=sn.escapeLast($.output,"["),Yr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cl("closing",")"));$.output=sn.escapeLast($.output,"("),Yr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Cl("closing","}"));$.output=sn.escapeLast($.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let B of $.tokens)$.output+=B.output!=null?B.output:B.value,B.suffix&&($.output+=B.suffix)}return $};EI.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Ev,r.maxLength):Ev,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=MJ[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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};zJ.exports=EI});var HJ=v((Xlt,BJ)=>{"use strict";var DAe=jJ(),AI=UJ(),qJ=op(),NAe=ip(),jAe=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=jAe(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?qJ.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)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(qJ.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):AI(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>DAe(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=AI.fastpaths(t,e)),i.output||(i=AI(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=NAe;BJ.exports=Rt});var WJ=v((Qlt,VJ)=>{"use strict";var GJ=HJ(),MAe=op();function ZJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:MAe.isWindows()}),GJ(t,e,r)}Object.assign(ZJ,GJ);VJ.exports=ZJ});import{readdir as FAe,readdirSync as LAe,realpath as zAe,realpathSync as UAe,stat as qAe,statSync as BAe}from"fs";import{isAbsolute as HAe,posix as qa,resolve as GAe}from"path";import{fileURLToPath as ZAe}from"url";function KAe(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]===".."&&WAe.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=>qa.relative(t,n)||".":n=>qa.relative(t,`${e}/${n}`)||"."}function XAe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=qa.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function XJ(t){var e;let r=Dl.default.scan(t,QAe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function oTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Dl.default.scan(t);return r.isGlob||r.negated}function cp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function QJ(t){return typeof t=="string"?[t]:t??[]}function TI(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=iTe(o);s=HAe(s.replace(aTe,""))?qa.relative(a,s):qa.normalize(s);let c=(i=sTe.exec(s))===null||i===void 0?void 0:i[0],l=XJ(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?qa.join(o,...d):o}return s}function cTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(TI(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(TI(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(TI(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function lTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=cTe(t,e,n);t.debug&&cp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(JJ,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Dl.default)(i.match,f),m=(0,Dl.default)(i.ignore,f),h=KAe(i.match,f),g=KJ(r,d,o),b=o?g:KJ(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new wJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&cp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return cp(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&cp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&XAe(r,d)]}function uTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function fTe(t){let e={...dTe,...t};return e.cwd=(e.cwd instanceof URL?ZAe(e.cwd):GAe(e.cwd)).replace(JJ,"/"),e.ignore=QJ(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||FAe,readdirSync:e.fs.readdirSync||LAe,realpath:e.fs.realpath||zAe,realpathSync:e.fs.realpathSync||UAe,stat:e.fs.stat||qAe,statSync:e.fs.statSync||BAe}),e.debug&&cp("globbing with options:",e),e}function pTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=VAe(t)||typeof t=="string",i=QJ((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=fTe(n?e:t);return i.length>0?lTe(o,i):[]}function ps(t,e){let[r,n]=pTe(t,e);return r?uTe(r.sync(),n):[]}var Dl,VAe,JJ,YJ,WAe,JAe,YAe,QAe,eTe,tTe,rTe,nTe,iTe,sTe,aTe,dTe,lp=y(()=>{xJ();Dl=St(WJ(),1),VAe=Array.isArray,JJ=/\\/g,YJ=process.platform==="win32",WAe=/^(\/?\.\.)+$/;JAe=/^[A-Z]:\/$/i,YAe=YJ?t=>JAe.test(t):t=>t==="/";QAe={parts:!0};eTe=/(?t.replace(eTe,"\\$&"),nTe=t=>t.replace(tTe,"\\$&"),iTe=YJ?nTe:rTe;sTe=/^(\/?\.\.)+/,aTe=/\\(?=[()[\]{}!*+?@|])/g;dTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as up,readFileSync as mTe,readdirSync as hTe,statSync as e8}from"node:fs";import{join as Ba}from"node:path";function gTe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Ci(e,n),o=[],{layers:s,forbiddenImports:a}=OI(r);return(s.size>0||a.length>0)&&!up(Ba(e,i.mainRoot))?[{detector:dp,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&&(yTe(e,i,s,o),_Te(e,i,s,o)),a.length>0&&bTe(e,i,a,o),o)}function OI(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 yTe(t,e,r,n){let i=e.mainRoot,o=Ba(t,i);if(up(o))for(let s of hTe(o)){let a=Ba(o,s);e8(a).isDirectory()&&(r.has(s)||n.push({detector:dp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function _Te(t,e,r,n){let i=e.mainRoot,o=Ba(t,i);if(up(o))for(let s of r){let a=Ba(o,s);up(a)&&e8(a).isDirectory()||n.push({detector:dp,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 bTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ba(t,i,s.from);if(!up(a))continue;let c=ps([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ba(a,l),d;try{d=mTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];vTe(p,s.to,e.importStyle)&&n.push({detector:dp,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 vTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var dp,t8,RI=y(()=>{"use strict";lp();qe();Ua();dp="ARCHITECTURE_FROM_SPEC";t8={name:dp,run:gTe}});import{existsSync as STe,readFileSync as wTe}from"node:fs";import{join as xTe}from"node:path";function $Te(t){let{cwd:e="."}=t,r=xTe(e,"spec/capabilities.yaml");if(!STe(r))return[];let n;try{let c=wTe(r,"utf8"),l=r8.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=H(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:Av,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:Av,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:Av,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var r8,Av,n8,i8=y(()=>{"use strict";r8=St(Qt(),1);qe();Av="CAPABILITIES_FEATURE_MAPPING";n8={name:Av,run:$Te}});import{existsSync as kTe,readFileSync as ETe}from"node:fs";import{join as ATe}from"node:path";function TTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function OTe(t){let{cwd:e="."}=t;return he(e,PI,r=>RTe(r,e))}function RTe(t,e){let r=Ci(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=ATe(e,o);if(!kTe(s))continue;let a=ETe(s,"utf8");TTe(a)||n.push({detector:PI,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var PI,o8,s8=y(()=>{"use strict";Ua();wt();PI="CONVENTION_DRIFT";o8={name:PI,run:OTe}});import{existsSync as II,readFileSync as a8}from"node:fs";import{join as Tv}from"node:path";function PTe(t){return JSON.parse(t).total?.lines?.pct??0}function c8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function DTe(t,e){if(!uv(dt(t).gates.coverage?.cmd))return null;let r;try{r=dv(t,e)}catch(c){return[{detector:bo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=uI.find(d=>II(Tv(c.dir,d)));if(!l){s.push(c.path);continue}let u=c8(a8(Tv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:bo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=l8(n,i);return a0?[{detector:bo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function NTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=DTe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Ci(e,r),i=dt(e).language==="kotlin"?uI.find(a=>II(Tv(e,a)))??GK(e):n.coverageSummary,o=Tv(e,i);if(!II(o))return[{detector:bo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=a8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?ITe(a):n.coverageFormat==="cobertura-xml"?CTe(a):PTe(a)}catch(a){return[{detector:bo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:bo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Ov?[]:[{detector:bo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Ov}%`}]}var bo,Ov,u8,d8=y(()=>{"use strict";qe();hv();Ua();fv();on();bo="COVERAGE_DROP",Ov=70;u8={name:bo,run:NTe}});import{existsSync as jTe}from"node:fs";import{join as MTe}from"node:path";function FTe(t){let{cwd:e="."}=t;return he(e,Rv,r=>LTe(r,e))}function LTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?jTe(MTe(e,r.path))?[]:[{detector:Rv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:Rv,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var Rv,f8,p8=y(()=>{"use strict";wt();Rv="DELIVERABLE_INTEGRITY";f8={name:Rv,run:FTe}});function zTe(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:Pv,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 UTe(t){let e=zTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Pv,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 qTe(t){let{cwd:e="."}=t;return he(e,Pv,r=>UTe(r))}var Pv,m8,h8=y(()=>{"use strict";wt();Pv="SMOKE_PROBE_DEMAND";m8={name:Pv,run:qTe}});function BTe(t){let{cwd:e="."}=t;return he(e,Iv,r=>HTe(r,e))}function HTe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=is(e);if(n===null)return[{detector:Iv,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=R_(n,e,o);s.state!=="fresh"&&i.push({detector:Iv,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 Iv,Cv,CI=y(()=>{"use strict";ul();wt();Iv="STALE_ATTESTATION";Cv={name:Iv,run:BTe}});function GTe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return ZTe(r)}function ZTe(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:g8,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 g8,Dv,DI=y(()=>{"use strict";qe();g8="DEPENDENCY_CYCLE";Dv={name:g8,run:GTe}});import{appendFileSync as VTe,existsSync as y8,mkdirSync as WTe,readFileSync as KTe}from"node:fs";import{dirname as JTe,join as YTe}from"node:path";function _8(t){return YTe(t,XTe,QTe)}function b8(t){return NI.add(t),()=>NI.delete(t)}function Ha(t,e){let r=_8(t),n=JTe(r);y8(n)||WTe(n,{recursive:!0}),VTe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of NI)try{i(t,e)}catch{}}function On(t){let e=_8(t);if(!y8(e))return[];let r=KTe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var XTe,QTe,NI,ti=y(()=>{"use strict";XTe=".cladding",QTe="audit.log.jsonl";NI=new Set});import{existsSync as eOe}from"node:fs";import{join as tOe}from"node:path";function rOe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:jI,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&&(eOe(tOe(e,i.artifact))||n.push({detector:jI,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var jI,v8,S8=y(()=>{"use strict";ti();jI="EVIDENCE_MISMATCH";v8={name:jI,run:rOe}});import{existsSync as nOe,readFileSync as iOe}from"node:fs";import{join as oOe}from"node:path";function sOe(t){let e=oOe(t,k8);if(!nOe(e))return null;try{let n=((0,$8.parse)(iOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*x8(t,e){for(let r of t??[])r.startsWith(w8)&&(yield{ref:r,name:r.slice(w8.length),field:e})}function aOe(t){let{cwd:e="."}=t,r=sOe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:MI,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=[...x8(s.evidence_refs,"evidence_refs"),...x8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:MI,severity:"warn",path:k8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var $8,MI,w8,k8,E8,A8=y(()=>{"use strict";$8=St(Qt(),1);qe();MI="FIXTURE_REFERENCE_INVALID",w8="fixture:",k8="conformance/fixtures.yaml";E8={name:MI,run:aOe}});import{existsSync as Nl,readFileSync as FI}from"node:fs";import{join as Ga}from"node:path";function cOe(t){return ps(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function fp(t){if(!Nl(t))return null;try{return JSON.parse(FI(t,"utf8"))}catch{return null}}function lOe(t,e){let r=Ga(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(FI(r,"utf8"))}catch(c){e.push({detector:vo,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:vo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=cOe(t);s!==a&&e.push({detector:vo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function uOe(t,e){for(let r of T8){let n=Ga(t,r.path);if(!Nl(n))continue;let i=fp(n);if(!i){e.push({detector:vo,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:vo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function dOe(t,e){let r=fp(Ga(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of T8){let s=Ga(t,o.path);if(!Nl(s))continue;let a=fp(s);a?.version&&a.version!==n&&e.push({detector:vo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ga(t,".claude-plugin","marketplace.json");if(Nl(i)){let o=fp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:vo,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 fOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function pOe(t,e){let r=Ga(t,"src","cli","clad.ts"),n=Ga(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Nl(r)||!Nl(n))return;let i=fOe(FI(r,"utf8"));if(i.length===0)return;let s=fp(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:vo,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 mOe(t){let{cwd:e="."}=t,r=[];return lOe(e,r),pOe(e,r),uOe(e,r),dOe(e,r),r}var vo,T8,O8,R8=y(()=>{"use strict";lp();vo="HARNESS_INTEGRITY",T8=[{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"]}];O8={name:vo,run:mOe}});import{existsSync as hOe,readFileSync as gOe}from"node:fs";import{join as yOe}from"node:path";function bOe(t){let{cwd:e="."}=t;return he(e,Nv,r=>SOe(r,e))}function vOe(t){let e=yOe(t,"spec/capabilities.yaml");if(!hOe(e))return!1;try{let r=P8.default.parse(gOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function SOe(t,e){let r=t.features.length;if(r<_Oe)return[];let n=[];return vOe(e)&&n.push({detector:Nv,severity:"warn",path:"spec/capabilities.yaml",message:`${r} features but spec/capabilities.yaml declares no capabilities (capabilities: []) \u2014 the design SSoT is an empty seed. Populate it (capability \u2194 feature links) or run \`clad init --scan\`.`}),t.architecture&&(t.architecture.layers??[]).length===0&&n.push({detector:Nv,severity:"warn",path:"spec/architecture.yaml",message:`${r} features but spec/architecture.yaml declares no layers (layers: []) \u2014 the architecture SSoT is an empty seed. Populate it or run \`clad init --scan\`.`}),n}var P8,Nv,_Oe,I8,C8=y(()=>{"use strict";P8=St(Qt(),1);wt();Nv="HOLLOW_GOVERNANCE",_Oe=8;I8={name:Nv,run:bOe}});import{existsSync as D8,readFileSync as N8}from"node:fs";import{join as j8}from"node:path";function M8(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 $Oe(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 kOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function EOe(t){let e=j8(t,"README.md"),r=j8(t,"docs","dogfood","matrix.md");if(!D8(e)||!D8(r))return[];let n=M8(N8(e,"utf8"),wOe),i=M8(N8(r,"utf8"),xOe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=kOe(a);if(c===null)continue;let l=i[s]??"not-run",u=$Oe(l);u!==null&&c>u&&o.push({detector:F8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function AOe(t){let{cwd:e="."}=t;return EOe(e)}var F8,wOe,xOe,L8,z8=y(()=>{"use strict";F8="HOST_CLAIM_DRIFT",wOe=//,xOe=//;L8={name:F8,run:AOe}});function TOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return U8(r.features.map(i=>i.id),"feature","spec/features/",n),U8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function U8(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:q8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var q8,B8,H8=y(()=>{"use strict";qe();q8="ID_COLLISION";B8={name:q8,run:TOe}});import{existsSync as pp,readFileSync as LI,readdirSync as zI,statSync as OOe,writeFileSync as Z8}from"node:fs";import{join as So}from"node:path";function G8(t){if(!pp(t))return 0;try{return zI(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function ROe(t){if(!pp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=zI(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=So(n,o),a;try{a=OOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function POe(t){let e=So(t,"spec","capabilities.yaml");if(!pp(e))return 0;try{let r=jv.default.parse(LI(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ms(t="."){let e=G8(So(t,"spec","features")),r=G8(So(t,"spec","scenarios")),n=POe(t),i=ROe(So(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function jl(t,e){let r=So(t,"spec.yaml");if(!pp(r))return;let n=LI(r,"utf8"),i=IOe(n,e);i!==n&&Z8(r,i)}function IOe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as Sxe}from"node:buffer";import{StringDecoder as wxe}from"node:string_decoder";var Hb,xxe,$xe,kxe,lI=y(()=>{rn();Hb=(t,e,r)=>{if(r)return;if(t)return{transform:xxe.bind(void 0,new TextEncoder)};let n=new wxe(e);return{transform:$xe.bind(void 0,n),final:kxe.bind(void 0,n)}},xxe=function*(t,e){Sxe.isBuffer(e)?yield ho(e):typeof e=="string"?yield t.encode(e):yield e},$xe=function*(t,e){yield Ut(e)?t.write(e):e},kxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as MW}from"node:util";var uI,Gb,FW,Exe,LW,Axe,zW=y(()=>{uI=MW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Gb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Axe}=e[r];for await(let i of n(t))yield*Gb(i,e,r+1)},FW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Exe(r,Number(e),t)},Exe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Gb(n,r,e+1)},LW=MW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Axe=function*(t){yield t}});var dI,UW,ja,Xf,Txe,Oxe,fI=y(()=>{dI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},UW=(t,e)=>[...e.flatMap(r=>[...ja(r,t,0)]),...Xf(t)],ja=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Oxe}=e[r];for(let i of n(t))yield*ja(i,e,r+1)},Xf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Txe(r,Number(e),t)},Txe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*ja(n,r,e+1)},Oxe=function*(t){yield t}});import{Transform as Rxe,getDefaultHighWaterMark as qW}from"node:stream";var pI,Zb,BW,Vb=y(()=>{vr();Bb();jW();lI();zW();fI();pI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=BW(t,s,o),l=Na(e),u=Na(r),d=l?uI.bind(void 0,Gb,a):dI.bind(void 0,ja),f=l||u?uI.bind(void 0,FW,a):dI.bind(void 0,Xf),p=l||u?LW.bind(void 0,a):void 0;return{stream:new Rxe({writableObjectMode:n,writableHighWaterMark:qW(n),readableObjectMode:i,readableHighWaterMark:qW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Zb=(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=BW(s,r,a);t=UW(c,t)}return t},BW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:CW(n,a)},Hb(r,s,n),qb(r,o,n,c),{transform:t,final:e},{transform:DW(i,a)},PW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var HW,Ixe,Pxe,Cxe,Dxe,GW=y(()=>{Vb();rn();vr();HW=(t,e)=>{for(let r of Ixe(t))Pxe(t,r,e)},Ixe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Pxe=(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 ${ds[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Cxe(a,n));r.input=jf(s)},Cxe=(t,e)=>{let r=Zb(t,e,"utf8",!0);return Dxe(r),jf(r)},Dxe=t=>{let e=t.find(r=>typeof r!="string"&&!Ut(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 Wb,Nxe,jxe,ZW,VW,Mxe,WW,mI=y(()=>{Ia();vr();yl();as();Wb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&gl(r,n)&&!nn.has(e)&&Nxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&jxe.has(o))||t.every(({type:i})=>An.has(i))),Nxe=t=>t===1||t===2,jxe=new Set(["pipe","overlapped"]),ZW=async(t,e,r,n)=>{for await(let i of t)Mxe(e)||WW(i,r,n)},VW=(t,e,r)=>{for(let n of t)WW(n,e,r)},Mxe=t=>t._readableState.pipes.length>0,WW=(t,e,r)=>{let n=V_(t);Ti({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Fxe,appendFileSync as Lxe}from"node:fs";var KW,zxe,Uxe,qxe,Bxe,Hxe,JW=y(()=>{mI();Vb();Bb();rn();vr();Da();KW=({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)=>zxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},zxe=({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=DV(t,o,d),p=ho(f),{stdioItems:m,objectMode:h}=e[r],g=Uxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=qxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Bxe({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&&Hxe(b,m,i),S}catch(x){return n.error=x,S}},Uxe=(t,e,r,n)=>{try{return Zb(t,e,r,!1)}catch(i){return n.error=i,t}},qxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:jf(t)};let s=$G(t,r);return n[o]?{serializedResult:s,finalResult:cI(s,!i[o],e)}:{serializedResult:s}},Bxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Wb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=cI(t,!1,s);try{VW(a,e,n)}catch(c){r.error??=c}},Hxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Lb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Lxe(n,t):(r.add(o),Fxe(n,t))}}});var YW,XW=y(()=>{rn();Yf();YW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,vo(e,r,"all")]:Array.isArray(e)?[vo(t,r,"all"),...e]:Ut(t)&&Ut(e)?nR([t,e]):`${t}${e}`}});import{once as hI}from"node:events";var QW,Gxe,e3,t3,Zxe,gI,yI=y(()=>{Oa();QW=async(t,e)=>{let[r,n]=await Gxe(t);return e.isForcefullyTerminated??=!1,[r,n]},Gxe=async t=>{let[e,r]=await Promise.allSettled([hI(t,"spawn"),hI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?e3(t):r.value},e3=async t=>{try{return await hI(t,"exit")}catch{return e3(t)}},t3=async t=>{let[e,r]=await t;if(!Zxe(e,r)&&gI(e,r))throw new Xn;return[e,r]},Zxe=(t,e)=>t===void 0&&e===void 0,gI=(t,e)=>t!==0||e!==null});var r3,Vxe,n3=y(()=>{Oa();Da();yI();r3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=Vxe(t,e,r),s=o?.code==="ETIMEDOUT",a=CV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},Vxe=(t,e,r)=>t!==void 0?t:gI(e,r)?new Xn:void 0});import{spawnSync as Wxe}from"node:child_process";var i3,Kxe,Jxe,Yxe,Kb,Xxe,Qxe,e0e,t0e,o3=y(()=>{fR();zR();UR();Jf();jb();OW();Yf();GW();JW();Da();XW();n3();i3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Kxe(t,e,r),d=Xxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Tl(d,c,l)},Kxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=J_(t,e,r),a=Jxe(r),{file:c,commandArguments:l,options:u}=xb(t,e,a);Yxe(u);let d=AW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Jxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Yxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Kb("ipcInput"),t&&Kb("ipc: true"),r&&Kb("detached: true"),n&&Kb("cancelSignal")},Kb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Xxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Qxe({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}=r3(c,r),{output:m,error:h=l}=KW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>vo(_,r,S)),b=vo(YW(m,r),r,"all");return t0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Qxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{HW(o,r);let a=e0e(r);return Wxe(...$b(t,e,a))}catch(a){return Al({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},e0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Db(e)}),t0e=({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?Nb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Kf({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 _I,on as r0e}from"node:events";var s3,n0e,i0e,o0e,s0e,a3=y(()=>{wl();Hf();Bf();s3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(vl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:gb(t)}),n0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),n0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{lb(e,i);let o=us(t,e,r),s=new AbortController;try{return await Promise.race([i0e(o,n,s),o0e(o,r,s),s0e(o,r,s)])}catch(a){throw Sl(t),a}finally{s.abort(),ub(e,i)}},i0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await _I(t,"message",{signal:r});return n}for await(let[n]of r0e(t,"message",{signal:r}))if(e(n))return n},o0e=async(t,e,{signal:r})=>{await _I(t,"disconnect",{signal:r}),_9(e)},s0e=async(t,e,{signal:r})=>{let[n]=await _I(t,"strict:error",{signal:r});throw ob(n,e)}});import{once as l3,on as a0e}from"node:events";var u3,bI,c0e,l0e,u0e,c3,vI=y(()=>{wl();Hf();Bf();u3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>bI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),bI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{vl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:gb(t)}),lb(e,o);let s=us(t,e,r),a=new AbortController,c={};return c0e(t,s,a),l0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),u0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},c0e=async(t,e,r)=>{try{await l3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},l0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await l3(t,"strict:error",{signal:r.signal});n.error=ob(i,e),r.abort()}catch{}},u0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of a0e(r,"message",{signal:o.signal}))c3(s),yield c}catch{c3(s)}finally{o.abort(),ub(e,a),n||Sl(t),i&&await t}},c3=({error:t})=>{if(t)throw t}});import d3 from"node:process";var f3,p3,m3,SI=y(()=>{Sb();a3();vI();mb();f3=(t,{ipc:e})=>{Object.assign(t,m3(t,!1,e))},p3=()=>{let t=d3,e=!0,r=d3.channel!==void 0;return{...m3(t,e,r),getCancelSignal:Z9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},m3=(t,e,r)=>({sendMessage:vb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:s3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:u3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as d0e}from"node:child_process";import{PassThrough as f0e,Readable as p0e,Writable as m0e,Duplex as h0e}from"node:stream";var h3,g0e,Qf,y0e,_0e,b0e,v0e,g3=y(()=>{Ub();Jf();jb();h3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{oI(n);let a=new d0e;g0e(a,n),Object.assign(a,{readable:y0e,writable:_0e,duplex:b0e});let c=Al({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=v0e(c,s,i);return{subprocess:a,promise:l}},g0e=(t,e)=>{let r=Qf(),n=Qf(),i=Qf(),o=Array.from({length:e.length-3},Qf),s=Qf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Qf=()=>{let t=new f0e;return t.end(),t},y0e=()=>new p0e({read(){}}),_0e=()=>new m0e({write(){}}),b0e=()=>new h0e({read(){},write(){}}),v0e=async(t,e,r)=>Tl(t,e,r)});import{createReadStream as y3,createWriteStream as _3}from"node:fs";import{Buffer as S0e}from"node:buffer";import{Readable as ep,Writable as w0e,Duplex as x0e}from"node:stream";var v3,tp,b3,$0e,S3=y(()=>{Vb();Ub();vr();v3=(t,e)=>zb($0e,t,e,!1),tp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ds[t]}.`)},b3={fileNumber:tp,generator:pI,asyncGenerator:pI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:x0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},$0e={input:{...b3,fileUrl:({value:t})=>({stream:y3(t)}),filePath:({value:{file:t}})=>({stream:y3(t)}),webStream:({value:t})=>({stream:ep.fromWeb(t)}),iterable:({value:t})=>({stream:ep.from(t)}),asyncIterable:({value:t})=>({stream:ep.from(t)}),string:({value:t})=>({stream:ep.from(t)}),uint8Array:({value:t})=>({stream:ep.from(S0e.from(t))})},output:{...b3,fileUrl:({value:t})=>({stream:_3(t)}),filePath:({value:{file:t,append:e}})=>({stream:_3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:w0e.fromWeb(t)}),iterable:tp,asyncIterable:tp,string:tp,uint8Array:tp}}});import{on as k0e,once as w3}from"node:events";import{PassThrough as E0e,getDefaultHighWaterMark as A0e}from"node:stream";import{finished as k3}from"node:stream/promises";function Ma(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)xI(i);let e=t.some(({readableObjectMode:i})=>i),r=T0e(t,e),n=new wI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var T0e,wI,O0e,R0e,I0e,xI,P0e,C0e,D0e,N0e,j0e,E3,A3,$I,T3,M0e,Jb,x3,$3,Yb=y(()=>{T0e=(t,e)=>{if(t.length===0)return A0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},wI=class extends E0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(xI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=O0e(this,this.#t,this.#o);let r=P0e({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(xI(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)}},O0e=async(t,e,r)=>{Jb(t,x3);let n=new AbortController;try{await Promise.race([R0e(t,n),I0e(t,e,r,n)])}finally{n.abort(),Jb(t,-x3)}},R0e=async(t,{signal:e})=>{try{await k3(t,{signal:e,cleanup:!0})}catch(r){throw E3(t,r),r}},I0e=async(t,e,r,{signal:n})=>{for await(let[i]of k0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},xI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},P0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Jb(t,$3);let a=new AbortController;try{await Promise.race([C0e(o,e,a),D0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),N0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Jb(t,-$3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?$I(t):j0e(t))},C0e=async(t,e,{signal:r})=>{try{await t,r.aborted||$I(e)}catch(n){r.aborted||E3(e,n)}},D0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await k3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;A3(s)?i.add(e):T3(t,s)}},N0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await w3(t,i,{signal:o}),!t.readable)return w3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},j0e=t=>{t.writable&&t.end()},E3=(t,e)=>{A3(e)?$I(t):T3(t,e)},A3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",$I=t=>{(t.readable||t.writable)&&t.destroy()},T3=(t,e)=>{t.destroyed||(t.once("error",M0e),t.destroy(e))},M0e=()=>{},Jb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},x3=2,$3=1});import{finished as O3}from"node:stream/promises";var Rl,F0e,kI,L0e,EI,Xb=y(()=>{go();Rl=(t,e)=>{t.pipe(e),F0e(t,e),L0e(t,e)},F0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await O3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}kI(e)}},kI=t=>{t.writable&&t.end()},L0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await O3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}EI(t)}},EI=t=>{t.readable&&t.destroy()}});var R3,z0e,U0e,q0e,B0e,H0e,I3=y(()=>{Yb();go();cb();vr();Xb();R3=(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})=>An.has(c)))z0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.has(c)))q0e({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]:Ma(o);Rl(s,i)}},z0e=(t,e,r,n)=>{r==="output"?Rl(t.stdio[n],e):Rl(e,t.stdio[n]);let i=U0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},U0e=["stdin","stdout","stderr"],q0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;B0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},B0e=(t,{signal:e})=>{Yn(t)&&Ra(t,H0e,e)},H0e=2});var Fa,P3=y(()=>{Fa=[];Fa.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Fa.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Fa.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Qb,AI,TI,G0e,OI,ev,Z0e,RI,II,PI,C3,nst,ist,D3=y(()=>{P3();Qb=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",AI=Symbol.for("signal-exit emitter"),TI=globalThis,G0e=Object.defineProperty.bind(Object),OI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(TI[AI])return TI[AI];G0e(TI,AI,{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}},ev=class{},Z0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),RI=class extends ev{onExit(){return()=>{}}load(){}unload(){}},II=class extends ev{#t=PI.platform==="win32"?"SIGINT":"SIGHUP";#r=new OI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Fa)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(!Qb(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 Fa)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,Fa.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 Qb(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"&&Qb(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)}},PI=globalThis.process,{onExit:C3,load:nst,unload:ist}=Z0e(Qb(PI)?new II(PI):new RI)});import{addAbortListener as V0e}from"node:events";var N3,j3=y(()=>{D3();N3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=C3(()=>{t.kill()});V0e(n,()=>{i()})}});var F3,W0e,K0e,M3,J0e,L3=y(()=>{rR();K_();ls();ml();F3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=W_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=W0e(r,n,i),{sourceStream:d,sourceError:f}=J0e(t,l),{options:p,fileDescriptors:m}=Ri.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},W0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=K0e(t,e,...r),a=ab(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},K0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(M3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||eR(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]=M_(r,...n);return{destination:e(M3)(i,o,s),pipeOptions:s}}if(Ri.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}`)},M3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),J0e=(t,e)=>{try{return{sourceStream:$l(t,e)}}catch(r){return{sourceError:r}}}});var U3,Y0e,CI,z3,DI=y(()=>{Jf();Xb();U3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=Y0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw CI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},Y0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return EI(t),n;if(e!==void 0)return kI(r),e},CI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Al({error:t,command:z3,escapedCommand:z3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),z3="source.pipe(destination)"});var q3,B3=y(()=>{q3=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 X0e}from"node:stream/promises";var H3,Q0e,e$e,t$e,tv,r$e,n$e,G3=y(()=>{Yb();cb();Xb();H3=(t,e,r)=>{let n=tv.has(e)?e$e(t,e):Q0e(t,e);return Ra(t,r$e,r.signal),Ra(e,n$e,r.signal),t$e(e),n},Q0e=(t,e)=>{let r=Ma([t]);return Rl(r,e),tv.set(e,r),r},e$e=(t,e)=>{let r=tv.get(e);return r.add(t),r},t$e=async t=>{try{await X0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}tv.delete(t)},tv=new WeakMap,r$e=2,n$e=1});import{aborted as i$e}from"node:util";var Z3,o$e,V3=y(()=>{DI();Z3=(t,e)=>t===void 0?[]:[o$e(t,e)],o$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await i$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw CI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var rv,s$e,a$e,W3=y(()=>{mo();L3();DI();B3();G3();V3();rv=(t,...e)=>{if(Ot(e[0]))return rv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=F3(t,...e),i=s$e({...n,destination:r});return i.pipe=rv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},s$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=a$e(t,i);U3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=H3(e,o,d);return await Promise.race([q3(u),...Z3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},a$e=(t,e)=>Promise.allSettled([t,e])});import{on as c$e}from"node:events";import{getDefaultHighWaterMark as l$e}from"node:stream";var nv,u$e,NI,d$e,J3,jI,K3,f$e,p$e,iv=y(()=>{lI();Bb();fI();nv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return u$e(e,s),J3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},u$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},NI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;d$e(e,s,t);let a=t.readableObjectMode&&!o;return J3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},d$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},J3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=c$e(t,"data",{signal:e.signal,highWaterMark:K3,highWatermark:K3});return f$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},jI=l$e(!0),K3=jI,f$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=p$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*ja(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Xf(a)}},p$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Hb(t,r,!e),qb(t,i,!n,{})].filter(Boolean)});import{setImmediate as m$e}from"node:timers/promises";var Y3,h$e,g$e,y$e,MI,X3,FI=y(()=>{Cb();rn();mI();iv();Da();Yf();Y3=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=h$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([g$e(t),d]);return}let f=sI(c,r),p=NI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([y$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},h$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Wb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=NI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await ZW(a,t,r,o)},g$e=async t=>{await m$e(),t.readableFlowing===null&&t.resume()},y$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Ob(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Rb(r,{maxBuffer:o})):await Pb(r,{maxBuffer:o})}catch(a){return X3(RV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},MI=async t=>{try{return await t}catch(e){return X3(e)}},X3=({bufferedData:t})=>wG(t)?new Uint8Array(t):t});import{finished as _$e}from"node:stream/promises";var rp,b$e,v$e,S$e,w$e,x$e,LI,ov,Q3,sv=y(()=>{rp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=b$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],_$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||w$e(a,e,r,n)}finally{s.abort()}},b$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&v$e(t,r,n),n},v$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{S$e(e,r),n.call(t,...i)}},S$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},w$e=(t,e,r,n)=>{if(!x$e(t,e,r,n))throw t},x$e=(t,e,r,n=!0)=>r.propagating?Q3(t)||ov(t):(r.propagating=!0,LI(r,e)===n?Q3(t):ov(t)),LI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",ov=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Q3=t=>t?.code==="EPIPE"});var eK,zI,UI=y(()=>{FI();sv();eK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>zI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),zI=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=rp(t,e,l);if(LI(l,e)){await u;return}let[d]=await Promise.all([Y3({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 tK,rK,$$e,k$e,qI=y(()=>{Yb();UI();tK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ma([t,e].filter(Boolean)):void 0,rK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>zI({...$$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:k$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),$$e=({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}},k$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var nK,iK,oK=y(()=>{yl();as();nK=t=>gl(t,"ipc"),iK=(t,e)=>{let r=V_(t);Ti({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var sK,aK,cK=y(()=>{Da();oK();_o();vI();sK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=nK(o),a=yo(e,"ipc"),c=yo(r,"ipc");for await(let l of bI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(IV(t,i,c),i.push(l)),s&&iK(l,o);return i},aK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as E$e}from"node:events";var lK,A$e,T$e,O$e,uK=y(()=>{Ca();NR();ER();DR();go();vr();FI();cK();MR();qI();UI();yI();sv();lK=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 _=QW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=eK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=rK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=sK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=A$e(h,t,S),D=T$e(m,S);try{return await Promise.race([Promise.all([{},t3(_),Promise.all(x),w,T,rV(t,d),...A,...D]),g,O$e(t,b),...Y9(t,o,f,b),...y9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...K9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(se=>MI(se))),MI(w),aK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},A$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:rp(n,i,r)),T$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>rp(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),O$e=async(t,{signal:e})=>{let[r]=await E$e(t,"error",{signal:e});throw r}});var dK,np,Il,av=y(()=>{xl();dK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),np=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Oi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Il=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 fK}from"node:stream/promises";var BI,pK,HI,GI,cv,lv,ZI=y(()=>{sv();BI=async t=>{if(t!==void 0)try{await HI(t)}catch{}},pK=async t=>{if(t!==void 0)try{await GI(t)}catch{}},HI=async t=>{await fK(t,{cleanup:!0,readable:!1,writable:!0})},GI=async t=>{await fK(t,{cleanup:!0,readable:!0,writable:!1})},cv=async(t,e)=>{if(await t,e)throw e},lv=(t,e,r)=>{r&&!ov(r)?t.destroy(r):e&&t.destroy()}});import{Readable as R$e}from"node:stream";import{callbackify as I$e}from"node:util";var mK,VI,WI,KI,P$e,JI,YI,hK,XI=y(()=>{Ia();ls();iv();xl();av();ZI();mK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=VI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=WI(a,s),{read:f,onStdoutDataDone:p}=KI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new R$e({read:f,destroy:I$e(YI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return JI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},VI=(t,e,r)=>{let n=$l(t,e),i=np(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},WI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:jI},KI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Oi(),s=nv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){P$e(this,s,o)},onStdoutDataDone:o}},P$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},JI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await GI(t),await n,await BI(i),await e,r.readable&&r.push(null)}catch(o){await BI(i),hK(r,o)}},YI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Il(r,e)&&(hK(t,n),await cv(e,n))},hK=(t,e)=>{lv(t,t.readable,e)}});import{Writable as C$e}from"node:stream";import{callbackify as gK}from"node:util";var yK,QI,eP,D$e,N$e,tP,rP,_K,nP=y(()=>{ls();av();ZI();yK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=QI(t,r,e),s=new C$e({...eP(n,t,i),destroy:gK(rP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return tP(n,s),s},QI=(t,e,r)=>{let n=ab(t,e),i=np(r,n,"writableFinal"),o=np(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},eP=(t,e,r)=>({write:D$e.bind(void 0,t),final:gK(N$e.bind(void 0,t,e,r))}),D$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},N$e=async(t,e,r)=>{await Il(r,e)&&(t.writable&&t.end(),await e)},tP=async(t,e,r)=>{try{await HI(t),e.writable&&e.end()}catch(n){await pK(r),_K(e,n)}},rP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Il(r,e),await Il(n,e)&&(_K(t,i),await cv(e,i))},_K=(t,e)=>{lv(t,t.writable,e)}});import{Duplex as j$e}from"node:stream";import{callbackify as M$e}from"node:util";var bK,F$e,vK=y(()=>{Ia();XI();nP();bK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=VI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=QI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=WI(c,a),{read:g,onStdoutDataDone:b}=KI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new j$e({read:g,...eP(u,t,d),destroy:M$e(F$e.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 JI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),tP(u,_,c),_},F$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([YI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),rP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var iP,L$e,SK=y(()=>{Ia();ls();iv();iP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=$l(t,r),a=nv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return L$e(a,s,t)},L$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var wK,xK=y(()=>{av();XI();nP();vK();SK();wK=(t,{encoding:e})=>{let r=dK();t.readable=mK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=yK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=bK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=iP.bind(void 0,t,e),t[Symbol.asyncIterator]=iP.bind(void 0,t,e,{})}});var $K,z$e,U$e,kK=y(()=>{$K=(t,e)=>{for(let[r,n]of U$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},z$e=(async()=>{})().constructor.prototype,U$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(z$e,t)])});import{setMaxListeners as q$e}from"node:events";import{spawn as B$e}from"node:child_process";var EK,H$e,G$e,Z$e,V$e,W$e,AK=y(()=>{Cb();fR();zR();ls();UR();SI();Jf();jb();g3();S3();Yf();I3();nb();j3();W3();qI();uK();xK();xl();kK();EK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=H$e(t,e,r),{subprocess:f,promise:p}=Z$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=rv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),$K(f,p),Ri.set(f,{options:u,fileDescriptors:d}),f},H$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=J_(t,e,r),{file:a,commandArguments:c,options:l}=xb(t,e,r),u=G$e(l),d=v3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},G$e=({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}},Z$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=B$e(...$b(t,e,r))}catch(m){return h3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;q$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];R3(c,a,l),N3(c,r,l);let d={},f=Oi();c.kill=h9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=tK(c,r),wK(c,r),f3(c,r);let p=V$e({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}},V$e=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 lK({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)=>vo(x,e,w)),_=vo(h,e,"all"),S=W$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Tl(S,n,e)},W$e=({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?Kf({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 Ii,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Nb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var uv,K$e,J$e,TK=y(()=>{mo();_o();uv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,K$e(n,t[n],i)]));return{...t,...r}},K$e=(t,e,r)=>J$e.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,J$e=new Set(["env",...aR])});var fs,Y$e,X$e,OK=y(()=>{mo();rR();RG();o3();AK();TK();fs=(t,e,r,n)=>{let i=(s,a,c)=>fs(s,a,r,c),o=(...s)=>Y$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Y$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,uv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=X$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?i3(a,c,l):EK(a,c,l,i)},X$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=TG(e)?OG(e,r):[e,...r],[s,a,c]=M_(...o),l=uv(uv(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 RK,IK,PK,Q$e,eke,CK=y(()=>{RK=({file:t,commandArguments:e})=>PK(t,e),IK=({file:t,commandArguments:e})=>({...PK(t,e),isSync:!0}),PK=(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]=Q$e(t);return{file:r,commandArguments:n}},Q$e=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(eke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},eke=/ +/g});var DK,NK,tke,jK,rke,MK,FK=y(()=>{DK=(t,e,r)=>{t.sync=e(tke,r),t.s=t.sync},NK=({options:t})=>jK(t),tke=({options:t})=>({...jK(t),isSync:!0}),jK=t=>({options:{...rke(t),...t}}),rke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},MK={preferLocal:!0}});var Vct,Je,Wct,Kct,Jct,Yct,Xct,Qct,elt,tlt,Mr=y(()=>{OK();CK();jR();FK();SI();Vct=fs(()=>({})),Je=fs(()=>({isSync:!0})),Wct=fs(RK),Kct=fs(IK),Jct=fs(Q9),Yct=fs(NK,{},MK,DK),{sendMessage:Xct,getOneMessage:Qct,getEachMessage:elt,getCancelSignal:tlt}=p3()});import{existsSync as dv,statSync as nke}from"node:fs";import{dirname as oP,extname as ike,isAbsolute as LK,join as sP,relative as aP,resolve as fv,sep as oke}from"node:path";function pv(t){return t==="./gradlew"||t==="gradle"}function ske(t){return(dv(sP(t,"build.gradle.kts"))||dv(sP(t,"build.gradle")))&&dv(sP(t,"gradle.properties"))}function ake(t,e){let n=aP(t,e).split(oke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ps(t,e){return t===":"?`:${e}`:`${t}:${e}`}function cke(t,e){let r=fv(t,e),n=r;dv(r)?nke(r).isFile()&&(n=oP(r)):ike(r)!==""&&(n=oP(r));let i=aP(t,n);if(i.startsWith("..")||LK(i))return null;let o=n;for(;;){if(ske(o))return o;if(fv(o)===fv(t))return null;let s=oP(o);if(s===o)return null;let a=aP(t,s);if(a.startsWith("..")||LK(a))return null;o=s}}function mv(t,e){let r=fv(t),n=new Map,i=[];for(let o of e){let s=cke(r,o);if(!s){i.push(o);continue}let a=ake(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 hv=y(()=>{"use strict"});import{existsSync as lke,readFileSync as uke}from"node:fs";import{join as dke}from"node:path";function Pl(t="."){let e=dke(t,".cladding","config.yaml");if(!lke(e))return cP;try{let n=(0,zK.parse)(uke(e,"utf8"))?.gate;if(!n)return cP;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 fke){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 cP}}function UK(t,e){let r=[],n=!1;for(let i of t){let o=pke.exec(i);if(o){n=!0;for(let s of e)r.push(ps(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 zK,fke,cP,pke,gv=y(()=>{"use strict";zK=St(Qt(),1);hv();fke=["type","lint","test","coverage"],cP={scope:"feature"};pke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as uP,readFileSync as qK,readdirSync as mke,statSync as hke}from"node:fs";import{join as yv}from"node:path";function pP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=yv(t,e);if(uP(r))try{if(BK.test(qK(r,"utf8")))return!0}catch{}}return!1}function HK(t){try{return uP(t)&&BK.test(qK(t,"utf8"))}catch{return!1}}function GK(t,e=0){if(e>4||!uP(t))return!1;let r;try{r=mke(t)}catch{return!1}for(let n of r){let i=yv(t,n),o=!1;try{o=hke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(GK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&HK(i))return!0}return!1}function _ke(t){if(pP(t))return!0;for(let e of gke)if(HK(yv(t,e)))return!0;for(let e of yke)if(GK(yv(t,e)))return!0;return!1}function ZK(t="."){let e=Pl(t).coverage;return e||(_ke(t)?"kover":"jacoco")}function VK(t="."){return dP[ZK(t)]}function WK(t="."){return lP[ZK(t)]}var dP,lP,fP,BK,gke,yke,_v=y(()=>{"use strict";gv();dP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},lP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},fP=[lP.kover,lP.jacoco],BK=/kover/i;gke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],yke=["buildSrc","build-logic"]});import{existsSync as op,readFileSync as JK,readdirSync as YK}from"node:fs";import{join as ms}from"node:path";function hP(t){return op(ms(t,"gradlew"))?"./gradlew":"gradle"}function bke(t){let e=hP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[VK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function vke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(JK(ms(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 wke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function kke(t,e){for(let r of e)if(op(ms(t,r)))return r}function Eke(t,e){try{return YK(t).find(n=>n.endsWith(e))}catch{return}}function Oke(t){try{return JSON.parse(JK(ms(t,"package.json"),"utf8"))}catch{return{}}}function ip(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function KK(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function Rke(t,e,r){if(ip(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of Ake)if(n.configs.some(i=>op(ms(t,i))))return n.gate;if(Tke.some(n=>op(ms(t,n)))||r.eslintConfig!==void 0)return e}function Pke(t,e){return Ike.some(r=>op(ms(t,r)))?!0:e.jest!==void 0}function Cke(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 Dke(t,e){let r=Oke(t),n=e.lint?Rke(t,e.lint,r):void 0,i=n?{...e,lint:n}:mP(e,"lint"),o=ip(r,"test"),s=o?Cke(o):void 0;return o&&!s?(i=mP(i,"coverage"),{...i,test:{cmd:"npm",args:["test"]},...ip(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):s==="jest"||!o&&Pke(t,r)?{...i,test:{cmd:"npx",args:[...Ci,"jest"]},coverage:{cmd:"npx",args:[...Ci,"jest","--coverage"]}}:(s==="vitest"&&!ip(r,"coverage")&&!KK(r,"@vitest/coverage-v8")&&!KK(r,"@vitest/coverage-istanbul")?i=mP(i,"coverage"):s==="vitest"&&ip(r,"coverage")&&(i={...i,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),i)}function dt(t="."){for(let e of xke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Eke(t,o):r=kke(t,[o]),r)break;if(!r||e.requiresSource&&!wke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Dke(t,n):n;return{language:e.language,manifest:r,gates:i}}return $ke}var Ci,Ske,xke,$ke,Ake,Tke,Ike,on=y(()=>{"use strict";_v();Ci=["--offline","--no-install"];Ske=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);xke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Ci,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Ci,"eslint","."]},test:{cmd:"npx",args:[...Ci,"vitest","run"]},coverage:{cmd:"npx",args:[...Ci,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Ci,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Ci,"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:bke},{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:vke}],$ke={language:"unknown",manifest:"",gates:{}};Ake=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Ci,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Ci,"oxlint"]}}],Tke=["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"];Ike=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Nke,readFileSync as jke}from"node:fs";import{join as Mke}from"node:path";function La(t){return t.code==="ENOENT"}function bv(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=(o||s||`exit ${i}`).slice(0,200);return XK.test(o)||XK.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function qt(t,e,r){if(La(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let n=`${String(r.stderr??"")} +${String(r.stdout??"")}`;return e==="npx"&&/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(n)?{stage:t,pass:!1,exitCode:2,stderr:"'npx' could not resolve the configured tool without installing it"}:null}function tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Cl(t,e){let r=Mke(t,"package.json");if(!Nke(r))return!1;try{return!!JSON.parse(jke(r,"utf8")).scripts?.[e]}catch{return!1}}var XK,Tn=y(()=>{"use strict";XK=/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 Fke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:vv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return La(i)?[{detector:vv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:bv(i,vv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var vv,za,Sv=y(()=>{"use strict";Mr();on();Tn();vv="ARCHITECTURE_VIOLATION";za={name:vv,subprocess:!0,run:Fke}});function Lke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:wv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return La(i)?[{detector:wv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:bv(i,wv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var wv,Ua,xv=y(()=>{"use strict";Mr();on();Tn();wv="HARDCODED_SECRET";Ua={name:wv,subprocess:!0,run:Lke}});import{existsSync as gP,readdirSync as QK}from"node:fs";import{join as $v}from"node:path";function Uke(t,e){let r=$v(t,e.path);if(!gP(r))return!0;if(e.isDirectory)try{return QK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function qke(t){let{cwd:e="."}=t,r=[];for(let i of zke)Uke(e,i)&&r.push({detector:sp,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=$v(e,"spec.yaml");if(gP(n)){let i=Gke(n),o=i?null:Bke(e);if(i)r.push({detector:sp,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:sp,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=Hke(e);s&&r.push({detector:sp,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 Bke(t){for(let e of["spec/features","spec/scenarios"]){let r=$v(t,e);if(!gP(r))continue;let n;try{n=QK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ki($v(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function Hke(t){try{return H(t),null}catch(e){return e.message}}function Gke(t){let e;try{e=ki(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var sp,zke,eJ,tJ=y(()=>{"use strict";qe();A_();sp="ABSENCE_OF_GOVERNANCE",zke=[{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}];eJ={name:sp,run:qke}});function kv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function yP(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=kv(r)==="while",o=Vke.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 '${kv(r)}'`}let n=Zke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:kv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${kv(r)}'`:null}function Wke(t,e){let r=yP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function rJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...Wke(r,n));return e}var Zke,Vke,_P=y(()=>{"use strict";Zke={event:"when",state:"while",optional:"where",unwanted:"if"},Vke=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";qe()});function Kke(t){let{cwd:e="."}=t;return he(e,Ev,Jke)}function Jke(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:Ev,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 rJ(t.features))e.push({detector:Ev,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Ev,nJ,iJ=y(()=>{"use strict";_P();wt();Ev="AC_DRIFT";nJ={name:Ev,run:Kke}});function Di(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return sJ[n]??oJ}var Yke,Xke,Qke,oJ,eEe,tEe,sJ,rEe,aJ,qa=y(()=>{"use strict";on();Yke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,Xke=/^[ \t]*import\s+([\w.]+)/gm,Qke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,oJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:Yke,importStyle:"relative"},eEe={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:Xke,importStyle:"dotted"},tEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:Qke,importStyle:"dotted"},sJ={typescript:oJ,kotlin:eEe,python:tEe},rEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],aJ=new Set([...Object.values(sJ).flatMap(t=>t?.extensions??[]),...rEe].map(t=>t.toLowerCase()))});import{existsSync as nEe,readFileSync as iEe,readdirSync as oEe,statSync as sEe}from"node:fs";import{join as lJ,relative as cJ}from"node:path";function aEe(t,e){if(!nEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=oEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=lJ(i,s),c;try{c=sEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function cEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function uEe(t){return lEe.test(t)}function dEe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Di(e,r.project?.language),o=i.sourceRoots.flatMap(a=>aEe(lJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=iEe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";qe();qa();uJ="AI_HINTS_FORBIDDEN_PATTERN";lEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;dJ={name:uJ,run:dEe}});function fEe(t){let{cwd:e="."}=t,r;try{r=H(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:pJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var pJ,mJ,hJ=y(()=>{"use strict";qe();pJ="AC_DUPLICATE_WITHIN_FEATURE";mJ={name:pJ,run:fEe}});import{createRequire as pEe}from"module";import{basename as mEe,dirname as vP,normalize as hEe,relative as gEe,resolve as yEe,sep as _J}from"path";import*as _Ee from"fs";function bEe(t){let e=hEe(t);return e.length>1&&e[e.length-1]===_J&&(e=e.substring(0,e.length-1)),e}function bJ(t,e){return t.replace(vEe,e)}function wEe(t){return t==="/"||SEe.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=yEe(t)),(n||o)&&(t=bEe(t)),t===".")return"";let s=t[t.length-1]!==i;return bJ(s?t+i:t,i)}function vJ(t,e){return e+t}function xEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:bJ(gEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function $Ee(t){return t}function kEe(t,e,r){return e+t+r}function EEe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?xEe(t,e):n?vJ:$Ee}function AEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function TEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function PEe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?TEe(t):AEe(t):n&&n.length?REe:OEe:IEe}function FEe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?MEe:r&&r.length?n?CEe:DEe:n?NEe:jEe}function UEe(t){return t.group?zEe:LEe}function HEe(t){return t.group?qEe:BEe}function VEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?ZEe:GEe}function SJ(t,e,r){if(r.options.useRealPaths)return WEe(e,r);let n=vP(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=vP(n)}return r.symlinks.set(t,e),i>1}function WEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Av(t,e,r,n){e(t&&!n?t:null,r)}function nAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?KEe:QEe:n?e?JEe:rAe:i?e?XEe:tAe:e?YEe:eAe}function sAe(t){return t?oAe:iAe}function uAe(t,e){return new Promise((r,n)=>{$J(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function $J(t,e,r){new xJ(t,e,r).start()}function dAe(t,e){return new xJ(t,e).start()}var gJ,vEe,SEe,OEe,REe,IEe,CEe,DEe,NEe,jEe,MEe,LEe,zEe,qEe,BEe,GEe,ZEe,KEe,JEe,YEe,XEe,QEe,eAe,tAe,rAe,wJ,iAe,oAe,aAe,cAe,lAe,xJ,yJ,kJ,EJ,AJ=y(()=>{gJ=pEe(import.meta.url);vEe=/[\\/]/g;SEe=/^[a-z]:[\\/]$/i;OEe=(t,e)=>{e.push(t||".")},REe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},IEe=()=>{};CEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},DEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},NEe=(t,e,r,n)=>{r.files++},jEe=(t,e)=>{e.push(t)},MEe=()=>{};LEe=t=>t,zEe=()=>[""].slice(0,0);qEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},BEe=()=>{};GEe=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()&&SJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},ZEe=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()&&SJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};KEe=t=>t.counts,JEe=t=>t.groups,YEe=t=>t.paths,XEe=t=>t.paths.slice(0,t.options.maxFiles),QEe=(t,e,r)=>(Av(e,r,t.counts,t.options.suppressErrors),null),eAe=(t,e,r)=>(Av(e,r,t.paths,t.options.suppressErrors),null),tAe=(t,e,r)=>(Av(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),rAe=(t,e,r)=>(Av(e,r,t.groups,t.options.suppressErrors),null);wJ={withFileTypes:!0},iAe=(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||".",wJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},oAe=(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||".",wJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};aAe=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))}},cAe=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}},lAe=class{aborted=!1;abort(){this.aborted=!0}},xJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=nAe(e,this.isSynchronous),this.root=bP(t,e),this.state={root:wEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new cAe,options:e,queue:new aAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new lAe,fs:e.fs||_Ee},this.joinPath=EEe(this.root,e),this.pushDirectory=PEe(this.root,e),this.pushFile=FEe(e),this.getArray=UEe(e),this.groupFiles=HEe(e),this.resolveSymlink=VEe(e,this.isSynchronous),this.walkDirectory=sAe(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=mEe(_),x=bP(vP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};yJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return uAe(this.root,this.options)}withCallback(t){$J(this.root,this.options,t)}sync(){return dAe(this.root,this.options)}},kJ=null;try{gJ.resolve("picomatch"),kJ=gJ("picomatch")}catch{}EJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:_J,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 yJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new yJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||kJ;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 ap=v((iut,PJ)=>{"use strict";var TJ="[^\\\\/]",fAe="(?=.)",OJ="[^/]",SP="(?:\\/|$)",RJ="(?:^|\\/)",wP=`\\.{1,2}${SP}`,pAe="(?!\\.)",mAe=`(?!${RJ}${wP})`,hAe=`(?!\\.{0,1}${SP})`,gAe=`(?!${wP})`,yAe="[^.\\/]",_Ae=`${OJ}*?`,bAe="/",IJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:fAe,QMARK:OJ,END_ANCHOR:SP,DOTS_SLASH:wP,NO_DOT:pAe,NO_DOTS:mAe,NO_DOT_SLASH:hAe,NO_DOTS_SLASH:gAe,QMARK_NO_DOT:yAe,STAR:_Ae,START_ANCHOR:RJ,SEP:bAe},vAe={...IJ,SLASH_LITERAL:"[\\\\/]",QMARK:TJ,STAR:`${TJ}*?`,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:"\\"},SAe={__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"};PJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:SAe,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?vAe:IJ}}});var cp=v(Fr=>{"use strict";var{REGEX_BACKSLASH:wAe,REGEX_REMOVE_BACKSLASH:xAe,REGEX_SPECIAL_CHARS:$Ae,REGEX_SPECIAL_CHARS_GLOBAL:kAe}=ap();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>$Ae.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(kAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(wAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(xAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var zJ=v((sut,LJ)=>{"use strict";var CJ=cp(),{CHAR_ASTERISK:xP,CHAR_AT:EAe,CHAR_BACKWARD_SLASH:lp,CHAR_COMMA:AAe,CHAR_DOT:$P,CHAR_EXCLAMATION_MARK:kP,CHAR_FORWARD_SLASH:FJ,CHAR_LEFT_CURLY_BRACE:EP,CHAR_LEFT_PARENTHESES:AP,CHAR_LEFT_SQUARE_BRACKET:TAe,CHAR_PLUS:OAe,CHAR_QUESTION_MARK:DJ,CHAR_RIGHT_CURLY_BRACE:RAe,CHAR_RIGHT_PARENTHESES:NJ,CHAR_RIGHT_SQUARE_BRACKET:IAe}=ap(),jJ=t=>t===FJ||t===lp,MJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},PAe=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,se=()=>c.charCodeAt(l+1),Y=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),Oe&&m===!0&&d>0?(Oe=c.slice(0,d),P=c.slice(d)):m===!0?(Oe="",P=c):Oe=c,Oe&&Oe!==""&&Oe!=="/"&&Oe!==c&&jJ(Oe.charCodeAt(Oe.length-1))&&(Oe=Oe.slice(0,-1)),r.unescape===!0&&(P&&(P=CJ.removeBackslashes(P)),Oe&&_===!0&&(Oe=CJ.removeBackslashes(Oe)));let Ir={prefix:C,input:t,start:u,base:Oe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,jJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let oe;for(let Pe=0;Pe{"use strict";var up=ap(),sn=cp(),{MAX_LENGTH:Tv,POSIX_REGEX_SOURCE:CAe,REGEX_NON_SPECIAL_CHARS:DAe,REGEX_SPECIAL_CHARS_BACKREF:NAe,REPLACEMENTS:UJ}=up,jAe=(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=>sn.escapeRegex(i)).join("..")}return r},Dl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,qJ=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},MAe=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},BJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(MAe(e))return e.replace(/\\(.)/g,"$1")},FAe=t=>{let e=t.map(BJ).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}}}}},LAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=BJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},zAe=t=>{let e=0,r=t.trim(),n=TP(r);for(;n;)e++,r=n.body.trim(),n=TP(r);return e},UAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:up.DEFAULT_MAX_EXTGLOB_RECURSION,n=qJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||FAe(n)))return{risky:!0};for(let i of n){let o=LAe(i);if(o)return{risky:!0,safeOutput:o};if(zAe(i)>r)return{risky:!0}}return{risky:!1}},OP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=UJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Tv,r.maxLength):Tv,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=up.globChars(r.windows),l=up.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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={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=sn.removePrefix(t,$),i=t.length;let se=[],Y=[],Oe=[],C=o,P,Ir=()=>$.index===i-1,oe=$.peek=(B=1)=>t[$.index+B],Pe=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(B="",ht=0)=>{$.consumed+=B,$.index+=ht},Yt=B=>{$.output+=B.output!=null?B.output:B.value,dr(B.value)},so=()=>{let B=1;for(;oe()==="!"&&(oe(2)!=="("||oe(3)==="?");)Pe(),$.start++,B++;return B%2===0?!1:($.negated=!0,$.start++,!0)},vi=B=>{$[B]++,Oe.push(B)},Yr=B=>{$[B]--,Oe.pop()},de=B=>{if(C.type==="globstar"){let ht=$.braces>0&&(B.type==="comma"||B.type==="brace"),q=B.extglob===!0||se.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ht&&!q&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(se.length&&B.type!=="paren"&&(se[se.length-1].inner+=B.value),(B.value||B.output)&&Yt(B),C&&C.type==="text"&&B.type==="text"){C.output=(C.output||C.value)+B.value,C.value+=B.value;return}B.prev=C,s.push(B),C=B},ao=(B,ht)=>{let q={...l[ht],conditions:1,inner:""};q.prev=C,q.parens=$.parens,q.output=$.output,q.startIndex=$.index,q.tokensIndex=s.length;let Ae=(r.capture?"(":"")+q.open;vi("parens"),de({type:B,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Ae}),se.push(q)},yde=B=>{let ht=t.slice(B.startIndex,$.index+1),q=t.slice(B.startIndex+2,$.index),Ae=UAe(q,r);if((B.type==="plus"||B.type==="star")&&Ae.risky){let ct=Ae.safeOutput?(B.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,Si=s[B.tokensIndex];Si.type="text",Si.value=ht,Si.output=ct||sn.escapeRegex(ht);for(let wi=B.tokensIndex+1;wi1&&B.inner.includes("/")&&(ct=O(r)),(ct!==D||Ir()||/^\)+$/.test(Kt()))&&(ut=B.close=`)$))${ct}`),B.inner.includes("*")&&(Lt=Kt())&&/^\.[^\\/.]+$/.test(Lt)){let Si=OP(Lt,{...e,fastpaths:!1}).output;ut=B.close=`)${Si})${ct})`}B.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ht=t.replace(NAe,(q,Ae,ut,Lt,ct,Si)=>Lt==="\\"?(B=!0,q):Lt==="?"?Ae?Ae+Lt+(ct?_.repeat(ct.length):""):Si===0?A+(ct?_.repeat(ct.length):""):_.repeat(ut.length):Lt==="."?u.repeat(ut.length):Lt==="*"?Ae?Ae+Lt+(ct?D:""):D:Ae?q:`\\${q}`);return B===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=sn.wrapOutput(ht,$,e),$)}for(;!Ir();){if(P=Pe(),P==="\0")continue;if(P==="\\"){let q=oe();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){P+="\\",de({type:"text",value:P});continue}let Ae=/^\\+/.exec(Kt()),ut=0;if(Ae&&Ae[0].length>2&&(ut=Ae[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Pe():P+=Pe(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let q=C.value.slice(1);if(q.includes("[")&&(C.posix=!0,q.includes(":"))){let Ae=C.value.lastIndexOf("["),ut=C.value.slice(0,Ae),Lt=C.value.slice(Ae+2),ct=CAe[Lt];if(ct){C.value=ut+ct,$.backtrack=!0,Pe(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&oe()!==":"||P==="-"&&oe()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Yt({value:P});continue}if($.quotes===1&&P!=='"'){P=sn.escapeRegex(P),C.value+=P,Yt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){vi("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Dl("opening","("));let q=se[se.length-1];if(q&&$.parens===q.parens+1){yde(se.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Yr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Dl("closing","]"));P=`\\${P}`}else vi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Dl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Yr("brackets");let q=C.value.slice(1);if(C.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(P=`/${P}`),C.value+=P,Yt({value:P}),r.literalBrackets===!1||sn.hasRegexChars(q))continue;let Ae=sn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Ae,C.value=Ae;continue}C.value=`(${a}${Ae}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){vi("braces");let q={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};Y.push(q),de(q);continue}if(P==="}"){let q=Y[Y.length-1];if(r.nobrace===!0||!q){de({type:"text",value:P,output:P});continue}let Ae=")";if(q.dots===!0){let ut=s.slice(),Lt=[];for(let ct=ut.length-1;ct>=0&&(s.pop(),ut[ct].type!=="brace");ct--)ut[ct].type!=="dots"&&Lt.unshift(ut[ct].value);Ae=jAe(Lt,r),$.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let ut=$.output.slice(0,q.outputIndex),Lt=$.tokens.slice(q.tokensIndex);q.value=q.output="\\{",P=Ae="\\}",$.output=ut;for(let ct of Lt)$.output+=ct.output||ct.value}de({type:"brace",value:P,output:Ae}),Yr("braces"),Y.pop();continue}if(P==="|"){se.length>0&&se[se.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let q=P,Ae=Y[Y.length-1];Ae&&Oe[Oe.length-1]==="braces"&&(Ae.comma=!0,q="|"),de({type:"comma",value:P,output:q});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let q=Y[Y.length-1];C.type="dots",C.output+=P,C.value+=P,q.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){ao("qmark",P);continue}if(C&&C.type==="paren"){let Ae=oe(),ut=P;(C.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&oe()==="("&&(oe(2)!=="?"||!/[!=<:]/.test(oe(3)))){ao("negate",P);continue}if(r.nonegate!==!0&&$.index===0){so();continue}}if(P==="+"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){ao("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let q=DAe.exec(Kt());q&&(P+=q[0],$.index+=q[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let B=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){ao("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let q=C.prev,Ae=q.prev,ut=q.type==="slash"||q.type==="bos",Lt=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!ut||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let ct=$.braces>0&&(q.type==="comma"||q.type==="brace"),Si=se.length&&(q.type==="pipe"||q.type==="paren");if(!ut&&q.type!=="paren"&&!ct&&!Si){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let wi=t[$.index+4];if(wi&&wi!=="/")break;B=B.slice(3),dr("/**",3)}if(q.type==="bos"&&Ir()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!Lt&&Ir()){$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=q.output+C.output,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&B[0]==="/"){let wi=B[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${wi})`,C.value+=P,$.output+=q.output+C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&B[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),oe()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Dl("closing","]"));$.output=sn.escapeLast($.output,"["),Yr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Dl("closing",")"));$.output=sn.escapeLast($.output,"("),Yr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Dl("closing","}"));$.output=sn.escapeLast($.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let B of $.tokens)$.output+=B.output!=null?B.output:B.value,B.suffix&&($.output+=B.suffix)}return $};OP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Tv,r.maxLength):Tv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=UJ[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}=up.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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};HJ.exports=OP});var WJ=v((cut,VJ)=>{"use strict";var qAe=zJ(),RP=GJ(),ZJ=cp(),BAe=ap(),HAe=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=HAe(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?ZJ.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)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(ZJ.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):RP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>qAe(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=RP.fastpaths(t,e)),i.output||(i=RP(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=BAe;VJ.exports=Rt});var XJ=v((lut,YJ)=>{"use strict";var KJ=WJ(),GAe=cp();function JJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:GAe.isWindows()}),KJ(t,e,r)}Object.assign(JJ,KJ);YJ.exports=JJ});import{readdir as ZAe,readdirSync as VAe,realpath as WAe,realpathSync as KAe,stat as JAe,statSync as YAe}from"fs";import{isAbsolute as XAe,posix as Ba,resolve as QAe}from"path";import{fileURLToPath as eTe}from"url";function nTe(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]===".."&&rTe.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=>Ba.relative(t,n)||".":n=>Ba.relative(t,`${e}/${n}`)||"."}function sTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ba.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function r8(t){var e;let r=Nl.default.scan(t,aTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function pTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Nl.default.scan(t);return r.isGlob||r.negated}function dp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function n8(t){return typeof t=="string"?[t]:t??[]}function IP(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=fTe(o);s=XAe(s.replace(hTe,""))?Ba.relative(a,s):Ba.normalize(s);let c=(i=mTe.exec(s))===null||i===void 0?void 0:i[0],l=r8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?Ba.join(o,...d):o}return s}function gTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(IP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(IP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(IP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function yTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=gTe(t,e,n);t.debug&&dp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(e8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Nl.default)(i.match,f),m=(0,Nl.default)(i.ignore,f),h=nTe(i.match,f),g=QJ(r,d,o),b=o?g:QJ(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new EJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&dp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return dp(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&dp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&sTe(r,d)]}function _Te(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function vTe(t){let e={...bTe,...t};return e.cwd=(e.cwd instanceof URL?eTe(e.cwd):QAe(e.cwd)).replace(e8,"/"),e.ignore=n8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||ZAe,readdirSync:e.fs.readdirSync||VAe,realpath:e.fs.realpath||WAe,realpathSync:e.fs.realpathSync||KAe,stat:e.fs.stat||JAe,statSync:e.fs.statSync||YAe}),e.debug&&dp("globbing with options:",e),e}function STe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=tTe(t)||typeof t=="string",i=n8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=vTe(n?e:t);return i.length>0?yTe(o,i):[]}function hs(t,e){let[r,n]=STe(t,e);return r?_Te(r.sync(),n):[]}var Nl,tTe,e8,t8,rTe,iTe,oTe,aTe,cTe,lTe,uTe,dTe,fTe,mTe,hTe,bTe,fp=y(()=>{AJ();Nl=St(XJ(),1),tTe=Array.isArray,e8=/\\/g,t8=process.platform==="win32",rTe=/^(\/?\.\.)+$/;iTe=/^[A-Z]:\/$/i,oTe=t8?t=>iTe.test(t):t=>t==="/";aTe={parts:!0};cTe=/(?t.replace(cTe,"\\$&"),dTe=t=>t.replace(lTe,"\\$&"),fTe=t8?dTe:uTe;mTe=/^(\/?\.\.)+/,hTe=/\\(?=[()[\]{}!*+?@|])/g;bTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as pp,readFileSync as wTe,readdirSync as xTe,statSync as i8}from"node:fs";import{join as Ha}from"node:path";function $Te(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Di(e,n),o=[],{layers:s,forbiddenImports:a}=PP(r);return(s.size>0||a.length>0)&&!pp(Ha(e,i.mainRoot))?[{detector:mp,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&&(kTe(e,i,s,o),ETe(e,i,s,o)),a.length>0&&ATe(e,i,a,o),o)}function PP(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 kTe(t,e,r,n){let i=e.mainRoot,o=Ha(t,i);if(pp(o))for(let s of xTe(o)){let a=Ha(o,s);i8(a).isDirectory()&&(r.has(s)||n.push({detector:mp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function ETe(t,e,r,n){let i=e.mainRoot,o=Ha(t,i);if(pp(o))for(let s of r){let a=Ha(o,s);pp(a)&&i8(a).isDirectory()||n.push({detector:mp,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 ATe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ha(t,i,s.from);if(!pp(a))continue;let c=hs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ha(a,l),d;try{d=wTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];TTe(p,s.to,e.importStyle)&&n.push({detector:mp,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 TTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var mp,o8,CP=y(()=>{"use strict";fp();qe();qa();mp="ARCHITECTURE_FROM_SPEC";o8={name:mp,run:$Te}});import{existsSync as OTe,readFileSync as RTe}from"node:fs";import{join as ITe}from"node:path";function CTe(t){let{cwd:e="."}=t,r=ITe(e,"spec/capabilities.yaml");if(!OTe(r))return[];let n;try{let l=RTe(r,"utf8"),u=s8.default.parse(l);if(!u||typeof u!="object")return[];n=u}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let l=H(e);o=new Set(l.features.map(u=>u.id))}catch{return[]}let s=[],a=new Set,c=o.size>=PTe;for(let l of i){if(typeof l!="object"||l===null)continue;let u=String(l.id??"(unnamed)"),d=Array.isArray(l.features)?l.features:[];if(d.length===0){s.push({detector:Ov,severity:c?"warn":"info",path:"spec/capabilities.yaml",message:c?`capability "${u}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`:`capability "${u}" has no features mapped yet \u2014 retained as future onboarding intent; bind it when a matching feature lands`});continue}for(let f of d){let p=String(f);o.has(p)?a.add(p):s.push({detector:Ov,severity:"error",path:"spec/capabilities.yaml",message:`capability "${u}" references feature ${p} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let l of o)a.has(l)||s.push({detector:Ov,severity:"info",path:"spec.yaml",message:`feature ${l} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var s8,Ov,PTe,a8,c8=y(()=>{"use strict";s8=St(Qt(),1);qe();Ov="CAPABILITIES_FEATURE_MAPPING",PTe=8;a8={name:Ov,run:CTe}});import{existsSync as DTe,readFileSync as NTe}from"node:fs";import{join as jTe}from"node:path";function MTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function FTe(t){let{cwd:e="."}=t;return he(e,DP,r=>LTe(r,e))}function LTe(t,e){let r=Di(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=jTe(e,o);if(!DTe(s))continue;let a=NTe(s,"utf8");MTe(a)||n.push({detector:DP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var DP,l8,u8=y(()=>{"use strict";qa();wt();DP="CONVENTION_DRIFT";l8={name:DP,run:FTe}});import{existsSync as NP,readFileSync as d8}from"node:fs";import{join as Rv}from"node:path";function zTe(t){return JSON.parse(t).total?.lines?.pct??0}function f8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function BTe(t,e){if(!pv(dt(t).gates.coverage?.cmd))return null;let r;try{r=mv(t,e)}catch(c){return[{detector:So,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=fP.find(d=>NP(Rv(c.dir,d)));if(!l){s.push(c.path);continue}let u=f8(d8(Rv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:So,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=p8(n,i);return a0?[{detector:So,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function HTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=BTe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Di(e,r),i=dt(e).language==="kotlin"?fP.find(a=>NP(Rv(e,a)))??WK(e):n.coverageSummary,o=Rv(e,i);if(!NP(o))return[{detector:So,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=d8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?UTe(a):n.coverageFormat==="cobertura-xml"?qTe(a):zTe(a)}catch(a){return[{detector:So,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:So,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Iv?[]:[{detector:So,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Iv}%`}]}var So,Iv,m8,h8=y(()=>{"use strict";qe();_v();qa();hv();on();So="COVERAGE_DROP",Iv=70;m8={name:So,run:HTe}});import{existsSync as GTe}from"node:fs";import{join as ZTe}from"node:path";function WTe(t){let{cwd:e="."}=t;return he(e,Pv,r=>KTe(r,e))}function KTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?GTe(ZTe(e,r.path))?[]:[{detector:Pv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:Pv,severity:t.features.length>=VTe?"warn":"info",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var Pv,VTe,g8,y8=y(()=>{"use strict";wt();Pv="DELIVERABLE_INTEGRITY",VTe=8;g8={name:Pv,run:WTe}});function JTe(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:Cv,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 YTe(t){let e=JTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Cv,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 XTe(t){let{cwd:e="."}=t;return he(e,Cv,r=>YTe(r))}var Cv,_8,b8=y(()=>{"use strict";wt();Cv="SMOKE_PROBE_DEMAND";_8={name:Cv,run:XTe}});function QTe(t){let{cwd:e="."}=t;return he(e,Dv,r=>eOe(r,e))}function eOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=os(e);if(n===null)return[{detector:Dv,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=C_(n,e,o);s.state!=="fresh"&&i.push({detector:Dv,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 Dv,Nv,jP=y(()=>{"use strict";dl();wt();Dv="STALE_ATTESTATION";Nv={name:Dv,run:QTe}});function tOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return rOe(r)}function rOe(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:v8,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 v8,jv,MP=y(()=>{"use strict";qe();v8="DEPENDENCY_CYCLE";jv={name:v8,run:tOe}});import{appendFileSync as nOe,existsSync as S8,mkdirSync as iOe,readFileSync as oOe}from"node:fs";import{dirname as sOe,join as aOe}from"node:path";function w8(t){return aOe(t,cOe,lOe)}function x8(t){return FP.add(t),()=>FP.delete(t)}function Ga(t,e){let r=w8(t),n=sOe(r);S8(n)||iOe(n,{recursive:!0}),nOe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of FP)try{i(t,e)}catch{}}function On(t){let e=w8(t);if(!S8(e))return[];let r=oOe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var cOe,lOe,FP,ti=y(()=>{"use strict";cOe=".cladding",lOe="audit.log.jsonl";FP=new Set});import{existsSync as uOe}from"node:fs";import{join as dOe}from"node:path";function fOe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:LP,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&&(uOe(dOe(e,i.artifact))||n.push({detector:LP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var LP,$8,k8=y(()=>{"use strict";ti();LP="EVIDENCE_MISMATCH";$8={name:LP,run:fOe}});import{existsSync as pOe,readFileSync as mOe}from"node:fs";import{join as hOe}from"node:path";function gOe(t){let e=hOe(t,O8);if(!pOe(e))return null;try{let n=((0,T8.parse)(mOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*A8(t,e){for(let r of t??[])r.startsWith(E8)&&(yield{ref:r,name:r.slice(E8.length),field:e})}function yOe(t){let{cwd:e="."}=t,r=gOe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:zP,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=[...A8(s.evidence_refs,"evidence_refs"),...A8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:zP,severity:"warn",path:O8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var T8,zP,E8,O8,R8,I8=y(()=>{"use strict";T8=St(Qt(),1);qe();zP="FIXTURE_REFERENCE_INVALID",E8="fixture:",O8="conformance/fixtures.yaml";R8={name:zP,run:yOe}});import{existsSync as jl,readFileSync as UP}from"node:fs";import{join as Za}from"node:path";function _Oe(t){return hs(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function hp(t){if(!jl(t))return null;try{return JSON.parse(UP(t,"utf8"))}catch{return null}}function bOe(t,e){let r=Za(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(UP(r,"utf8"))}catch(c){e.push({detector:wo,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:wo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=_Oe(t);s!==a&&e.push({detector:wo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function vOe(t,e){for(let r of P8){let n=Za(t,r.path);if(!jl(n))continue;let i=hp(n);if(!i){e.push({detector:wo,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:wo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function SOe(t,e){let r=hp(Za(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of P8){let s=Za(t,o.path);if(!jl(s))continue;let a=hp(s);a?.version&&a.version!==n&&e.push({detector:wo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Za(t,".claude-plugin","marketplace.json");if(jl(i)){let o=hp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:wo,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 wOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function xOe(t,e){let r=Za(t,"src","cli","clad.ts"),n=Za(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!jl(r)||!jl(n))return;let i=wOe(UP(r,"utf8"));if(i.length===0)return;let s=hp(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:wo,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 $Oe(t){let{cwd:e="."}=t,r=[];return bOe(e,r),xOe(e,r),vOe(e,r),SOe(e,r),r}var wo,P8,C8,D8=y(()=>{"use strict";fp();wo="HARNESS_INTEGRITY",P8=[{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"]}];C8={name:wo,run:$Oe}});import{existsSync as kOe,readFileSync as EOe}from"node:fs";import{join as AOe}from"node:path";function OOe(t){let{cwd:e="."}=t;return he(e,Mv,r=>IOe(r,e))}function ROe(t){let e=AOe(t,"spec/capabilities.yaml");if(!kOe(e))return!1;try{let r=N8.default.parse(EOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function IOe(t,e){let r=t.features.length;if(r{"use strict";N8=St(Qt(),1);wt();Mv="HOLLOW_GOVERNANCE",TOe=8;j8={name:Mv,run:OOe}});import{existsSync as F8,readFileSync as L8}from"node:fs";import{join as z8}from"node:path";function U8(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 DOe(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 NOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function jOe(t){let e=z8(t,"README.md"),r=z8(t,"docs","dogfood","matrix.md");if(!F8(e)||!F8(r))return[];let n=U8(L8(e,"utf8"),POe),i=U8(L8(r,"utf8"),COe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=NOe(a);if(c===null)continue;let l=i[s]??"not-run",u=DOe(l);u!==null&&c>u&&o.push({detector:q8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function MOe(t){let{cwd:e="."}=t;return jOe(e)}var q8,POe,COe,B8,H8=y(()=>{"use strict";q8="HOST_CLAIM_DRIFT",POe=//,COe=//;B8={name:q8,run:MOe}});function FOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return G8(r.features.map(i=>i.id),"feature","spec/features/",n),G8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function G8(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:Z8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var Z8,V8,W8=y(()=>{"use strict";qe();Z8="ID_COLLISION";V8={name:Z8,run:FOe}});import{existsSync as gp,readFileSync as qP,readdirSync as BP,statSync as LOe,writeFileSync as J8}from"node:fs";import{join as xo}from"node:path";function K8(t){if(!gp(t))return 0;try{return BP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function zOe(t){if(!gp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=BP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=xo(n,o),a;try{a=LOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function UOe(t){let e=xo(t,"spec","capabilities.yaml");if(!gp(e))return 0;try{let r=Fv.default.parse(qP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function gs(t="."){let e=K8(xo(t,"spec","features")),r=K8(xo(t,"spec","scenarios")),n=UOe(t),i=zOe(xo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Ml(t,e){let r=xo(t,"spec.yaml");if(!gp(r))return;let n=qP(r,"utf8"),i=qOe(n,e);i!==n&&J8(r,i)}function qOe(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 @@ -269,51 +270,51 @@ ${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 Za(t="."){let e=So(t,"spec","features");if(!pp(e))return!1;let r=[];for(let i of zI(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,jv.parse)(LI(So(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 Va(t="."){let e=xo(t,"spec","features");if(!gp(e))return!1;let r=[];for(let i of BP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Fv.parse)(qP(xo(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 Z8(So(t,"spec","index.yaml"),n,"utf8"),!0}var jv,mp=y(()=>{"use strict";jv=St(Qt(),1)});import{existsSync as V8,readFileSync as W8,readdirSync as COe}from"node:fs";import{join as UI}from"node:path";function DOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=ms(e),i=r.inventory;if(!i){let s=K8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return qI(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...qI(e),{detector:hp,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 K8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:hp,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(...qI(e)),o}function qI(t){let e=UI(t,"spec","index.yaml"),r=UI(t,"spec","features");if(!V8(e)||!V8(r))return[];let n=new Map;try{for(let l of W8(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 COe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=W8(UI(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:hp,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:hp,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 hp,K8,J8,Y8=y(()=>{"use strict";mp();qe();hp="INVENTORY_DRIFT",K8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];J8={name:hp,run:DOe}});import{existsSync as NOe,readFileSync as jOe}from"node:fs";import{join as MOe}from"node:path";function LOe(t){let{cwd:e="."}=t,r=MOe(e,"src","spec","schema.json"),n=[];if(NOe(r)){let i;try{i=JSON.parse(jOe(r,"utf8"))}catch(o){n.push({detector:gp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of FOe)i.required?.includes(o)||n.push({detector:gp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:gp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==X8&&n.push({detector:gp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${X8}'`})}catch{}return n}var gp,FOe,X8,Q8,e5=y(()=>{"use strict";qe();gp="META_INTEGRITY",FOe=["schema","project","features"],X8="0.1";Q8={name:gp,run:LOe}});function zOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return t5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),t5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function t5(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:r5,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 r5,n5,i5=y(()=>{"use strict";qe();r5="SLUG_CONFLICT";n5={name:r5,run:zOe}});function Ml(t){return t==="planned"||t==="in_progress"}var Mv=y(()=>{"use strict"});import{existsSync as UOe}from"node:fs";import{join as qOe}from"node:path";function BOe(t){let{cwd:e="."}=t;return he(e,Fv,r=>HOe(r,e))}function HOe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=qOe(e,i);UOe(o)||r.push(GOe(n.id,i,n.status))}return r}function GOe(t,e,r){return Ml(r)?{detector:Fv,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:Fv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Fv,Lv,BI=y(()=>{"use strict";Mv();wt();Fv="MISSING_IMPLEMENTATION";Lv={name:Fv,run:BOe}});function ZOe(t){let{cwd:e="."}=t;return he(e,HI,VOe)}function VOe(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:HI,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 HI,zv,GI=y(()=>{"use strict";wt();HI="MISSING_TESTS";zv={name:HI,run:ZOe}});import{existsSync as WOe,readFileSync as KOe}from"node:fs";import{join as o5}from"node:path";function s5(t){if(WOe(t))try{return JSON.parse(KOe(t,"utf8"))}catch{return}}function QOe(t){let{cwd:e="."}=t,r=s5(o5(e,JOe)),n=s5(o5(e,YOe));if(!r||!n)return[{detector:ZI,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>XOe&&i.push({detector:ZI,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var ZI,JOe,YOe,XOe,a5,c5=y(()=>{"use strict";ZI="PERFORMANCE_DRIFT",JOe="perf/baseline.json",YOe="perf/current.json",XOe=10;a5={name:ZI,run:QOe}});import{existsSync as eRe}from"node:fs";import{join as tRe}from"node:path";function nRe(t){let{cwd:e="."}=t;return he(e,VI,r=>oRe(r,e))}function iRe(t,e){return(t.modules??[]).some(r=>eRe(tRe(e,r)))}function oRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||iRe(s,e)||r.push(s.id);let n=rRe;if(r.length<=n)return[];let i=r.slice(0,l5).join(", "),o=r.length>l5?", \u2026":"";return[{detector:VI,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 VI,rRe,l5,u5,d5=y(()=>{"use strict";wt();VI="PLANNED_BACKLOG",rRe=5,l5=8;u5={name:VI,run:nRe}});import{existsSync as sRe,readFileSync as aRe}from"node:fs";import{join as cRe}from"node:path";function dRe(t){let{cwd:e="."}=t;return he(e,WI,r=>fRe(r,e))}function fRe(t,e){if(t.features.lengthn.includes(i))?[{detector:WI,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 WI,lRe,uRe,f5,p5=y(()=>{"use strict";wt();WI="PROJECT_CONTEXT_DRIFT",lRe=8,uRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];f5={name:WI,run:dRe}});function m5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Uv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function pRe(t){let{cwd:e="."}=t;return he(e,Uv,mRe)}function mRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...m5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Uv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...m5(e,n.features,`scenario ${n.id}.features`));return r}var Uv,qv,KI=y(()=>{"use strict";wt();Uv="REFERENCE_INTEGRITY";qv={name:Uv,run:pRe}});function yp(t=""){return new RegExp(hRe,t)}var hRe,JI=y(()=>{"use strict";hRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as gRe,readdirSync as yRe,readFileSync as _Re,statSync as bRe,writeFileSync as vRe}from"node:fs";import{dirname as SRe,join as _p,normalize as wRe,relative as xRe}from"node:path";function TRe(t){let e=[];for(let r of t.matchAll(ARe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(yp("g"))??[])e.push(n);return[...new Set(e)].sort()}function ORe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function h5(t){return t.split("\\").join("/")}function RRe(t){return $Re.some(e=>t===e||t.startsWith(`${e}/`))}function PRe(t){let e=_p(t,"docs");if(!gRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=yRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=_p(i,s),c;try{c=bRe(a)}catch{continue}let l=h5(xRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function IRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=wRe(_p(SRe(t),e));return h5(r)}function bp(t="."){let e=[];for(let r of PRe(t)){let n;try{n=_Re(_p(t,r),"utf8")}catch{continue}let i=ORe(n),o=TRe(i);if(RRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(kRe)?[]:i.match(yp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(ERe)){let d=IRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function g5(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 vRe(_p(t,"spec","_doc-links.yaml"),`${r.join(` +`;return J8(xo(t,"spec","index.yaml"),n,"utf8"),!0}var Fv,yp=y(()=>{"use strict";Fv=St(Qt(),1)});import{existsSync as Y8,readFileSync as X8,readdirSync as BOe}from"node:fs";import{join as HP}from"node:path";function HOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=gs(e),i=r.inventory;if(!i){let s=Q8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return GP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...GP(e),{detector:_p,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 Q8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:_p,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(...GP(e)),o}function GP(t){let e=HP(t,"spec","index.yaml"),r=HP(t,"spec","features");if(!Y8(e)||!Y8(r))return[];let n=new Map;try{for(let l of X8(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 BOe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=X8(HP(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:_p,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:_p,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 _p,Q8,e5,t5=y(()=>{"use strict";yp();qe();_p="INVENTORY_DRIFT",Q8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];e5={name:_p,run:HOe}});import{existsSync as GOe,readFileSync as ZOe}from"node:fs";import{join as VOe}from"node:path";function KOe(t){let{cwd:e="."}=t,r=VOe(e,"src","spec","schema.json"),n=[];if(GOe(r)){let i;try{i=JSON.parse(ZOe(r,"utf8"))}catch(o){n.push({detector:bp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of WOe)i.required?.includes(o)||n.push({detector:bp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:bp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==r5&&n.push({detector:bp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${r5}'`})}catch{}return n}var bp,WOe,r5,n5,i5=y(()=>{"use strict";qe();bp="META_INTEGRITY",WOe=["schema","project","features"],r5="0.1";n5={name:bp,run:KOe}});function JOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return o5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),o5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function o5(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:s5,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 s5,a5,c5=y(()=>{"use strict";qe();s5="SLUG_CONFLICT";a5={name:s5,run:JOe}});function Fl(t){return t==="planned"||t==="in_progress"}var Lv=y(()=>{"use strict"});import{existsSync as YOe}from"node:fs";import{join as XOe}from"node:path";function QOe(t){let{cwd:e="."}=t;return he(e,zv,r=>eRe(r,e))}function eRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=XOe(e,i);YOe(o)||r.push(tRe(n.id,i,n.status))}return r}function tRe(t,e,r){return Fl(r)?{detector:zv,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:zv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var zv,Uv,ZP=y(()=>{"use strict";Lv();wt();zv="MISSING_IMPLEMENTATION";Uv={name:zv,run:QOe}});function rRe(t){let{cwd:e="."}=t;return he(e,VP,nRe)}function nRe(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:VP,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 VP,qv,WP=y(()=>{"use strict";wt();VP="MISSING_TESTS";qv={name:VP,run:rRe}});import{existsSync as iRe,readFileSync as oRe}from"node:fs";import{join as l5}from"node:path";function u5(t){if(iRe(t))try{return JSON.parse(oRe(t,"utf8"))}catch{return}}function lRe(t){let{cwd:e="."}=t,r=u5(l5(e,sRe)),n=u5(l5(e,aRe));if(!r||!n)return[{detector:KP,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>cRe&&i.push({detector:KP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var KP,sRe,aRe,cRe,d5,f5=y(()=>{"use strict";KP="PERFORMANCE_DRIFT",sRe="perf/baseline.json",aRe="perf/current.json",cRe=10;d5={name:KP,run:lRe}});import{existsSync as uRe}from"node:fs";import{join as dRe}from"node:path";function pRe(t){let{cwd:e="."}=t;return he(e,JP,r=>hRe(r,e))}function mRe(t,e){return(t.modules??[]).some(r=>uRe(dRe(e,r)))}function hRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||mRe(s,e)||r.push(s.id);let n=fRe;if(r.length<=n)return[];let i=r.slice(0,p5).join(", "),o=r.length>p5?", \u2026":"";return[{detector:JP,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 JP,fRe,p5,m5,h5=y(()=>{"use strict";wt();JP="PLANNED_BACKLOG",fRe=5,p5=8;m5={name:JP,run:pRe}});import{existsSync as gRe,readFileSync as yRe}from"node:fs";import{join as _Re}from"node:path";function SRe(t){let{cwd:e="."}=t;return he(e,YP,r=>wRe(r,e))}function wRe(t,e){if(t.features.lengthn.includes(i))?[{detector:YP,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 YP,bRe,vRe,g5,y5=y(()=>{"use strict";wt();YP="PROJECT_CONTEXT_DRIFT",bRe=8,vRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];g5={name:YP,run:SRe}});function _5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Bv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function xRe(t){let{cwd:e="."}=t;return he(e,Bv,$Re)}function $Re(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(..._5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Bv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(..._5(e,n.features,`scenario ${n.id}.features`));return r}var Bv,Hv,XP=y(()=>{"use strict";wt();Bv="REFERENCE_INTEGRITY";Hv={name:Bv,run:xRe}});function vp(t=""){return new RegExp(kRe,t)}var kRe,QP=y(()=>{"use strict";kRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as ERe,readdirSync as ARe,readFileSync as TRe,statSync as ORe,writeFileSync as RRe}from"node:fs";import{dirname as IRe,join as Sp,normalize as PRe,relative as CRe}from"node:path";function FRe(t){let e=[];for(let r of t.matchAll(MRe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(vp("g"))??[])e.push(n);return[...new Set(e)].sort()}function LRe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function b5(t){return t.split("\\").join("/")}function zRe(t){return DRe.some(e=>t===e||t.startsWith(`${e}/`))}function URe(t){let e=Sp(t,"docs");if(!ERe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=ARe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Sp(i,s),c;try{c=ORe(a)}catch{continue}let l=b5(CRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function qRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=PRe(Sp(IRe(t),e));return b5(r)}function wp(t="."){let e=[];for(let r of URe(t)){let n;try{n=TRe(Sp(t,r),"utf8")}catch{continue}let i=LRe(n),o=FRe(i);if(zRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(NRe)?[]:i.match(vp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(jRe)){let d=qRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function v5(t="."){let e=wp(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 RRe(Sp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var $Re,kRe,ERe,ARe,Bv=y(()=>{"use strict";JI();$Re=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],kRe="clad-doc-links: ignore",ERe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,ARe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as CRe}from"node:fs";import{join as DRe}from"node:path";function NRe(t){let{cwd:e="."}=t;return he(e,Hv,r=>jRe(r,e))}function jRe(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)CRe(DRe(e,o))||n.push({detector:Hv,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:Hv,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 Hv,Gv,YI=y(()=>{"use strict";Bv();wt();Hv="DOC_LINK_INTEGRITY";Gv={name:Hv,run:NRe}});function FRe(t){let{cwd:e="."}=t;return he(e,vp,r=>LRe(r))}function LRe(t){let e=[],r=t.features.length,n=t.scenarios??[];r>=MRe&&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 o of n)(o.features??[]).length===0&&e.push({detector:vp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} binds no features (features: []) \u2014 a scenario must cover at least one feature's flow, or it should be removed.`});let i=new Map(t.features.filter(o=>typeof o.slug=="string"&&o.slug.length>0).map(o=>[o.slug,o.id]));for(let o of n){if(!o.flow)continue;let s=new Set(o.features??[]),a=new Map;for(let c of o.flow.matchAll(/\(([^)]+)\)/g))for(let l of c[1].split(/[,/·]/)){let u=l.trim(),d=i.get(u);d&&!s.has(d)&&a.set(u,d)}if(a.size>0){let c=[...a].map(([l,u])=>`${l} (${u})`).join(", ");e.push({detector:vp,severity:"warn",path:"spec/scenarios/",message:`scenario ${o.id} flow references ${c} but features[] does not bind ${a.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,MRe,y5,_5=y(()=>{"use strict";wt();vp="SCENARIO_COVERAGE",MRe=8;y5={name:vp,run:FRe}});import{createHash as zRe}from"node:crypto";function URe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Sp(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??b5),sample:URe(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(b5),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 qRe(t,e){return e<=0?!1:e>=1?!0:parseInt(zRe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var b5,Zv=y(()=>{"use strict";b5=["unwanted"]});import{existsSync as BRe,readdirSync as HRe}from"node:fs";import{join as S5}from"node:path";import w5 from"node:process";function GRe(t){let e=!1,r=n=>{for(let i of HRe(n,{withFileTypes:!0})){if(e)return;let o=S5(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 XI(t={}){let{cwd:e="."}=t,r=S5(e,hs);if(!BRe(r)||!GRe(r))return{stage:Vv,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${hs}/ \u2014 skipped`};let n=dt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Vv,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o=Je(i.cmd,[...i.args,hs],{cwd:e,reject:!1}),s=qt(Vv,i.cmd,o);return s||tr(Vv,o)}var Vv,hs,ZRe,QI=y(()=>{"use strict";Mr();on();Tn();Vv="stage_2.3",hs="tests/oracle";ZRe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${w5.argv[1]}`;if(ZRe){let t=XI();console.log(JSON.stringify(t)),w5.exit(t.exitCode)}});import{existsSync as VRe}from"node:fs";import{join as WRe}from"node:path";function KRe(t){let{cwd:e="."}=t;return he(e,ri,r=>JRe(r,e))}function JRe(t,e){let r=[],n=Sp(t.project,wp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?On(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(xp(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:ri,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${hs}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!VRe(WRe(e,f))){r.push({detector:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${hs}/`)||r.push({detector:ri,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${hs}/ \u2014 stage_2.3 only runs ${hs}/, 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:ri,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:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ri,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:ri,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:ri,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:ri,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 ri,x5,$5=y(()=>{"use strict";ti();Zv();QI();wt();ri="SPEC_CONFORMANCE";x5={name:ri,run:KRe}});function YRe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:eC,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>k5&&i.push({detector:eC,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${k5})`})}return i}var eC,k5,E5,A5=y(()=>{"use strict";ti();eC="STALE_EVIDENCE",k5=90;E5={name:eC,run:YRe}});import{existsSync as T5}from"node:fs";import{join as O5}from"node:path";function XRe(t){let{cwd:e="."}=t;return he(e,Fl,r=>QRe(r,e))}function QRe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Fl,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:Fl,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=>T5(O5(e,o)));i.length>0&&r.push({detector:Fl,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Ml(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>T5(O5(e,i)))&&r.push({detector:Fl,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 Fl,Wv,tC=y(()=>{"use strict";Mv();wt();Fl="STALE_SPECIFICATION";Wv={name:Fl,run:XRe}});import{existsSync as R5,statSync as P5}from"node:fs";import{join as I5}from"node:path";function tPe(t,e){let r=0;for(let n of e){let i=I5(t,n);if(!R5(i))continue;let o=P5(i).mtimeMs;o>r&&(r=o)}return r}function rPe(t){let{cwd:e="."}=t;return he(e,rC,r=>nPe(r,e))}function nPe(t,e){let r=Ci(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=tPe(e,n);if(i===0)return[];let o=ps([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=I5(e,a);if(!R5(c))continue;let l=P5(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>ePe&&s.push({detector:rC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var rC,ePe,Kv,nC=y(()=>{"use strict";lp();Ua();wt();rC="STALE_TESTS",ePe=30;Kv={name:rC,run:rPe}});import{existsSync as iPe}from"node:fs";import{join as oPe}from"node:path";function sPe(t){let{cwd:e="."}=t;return he(e,$p,r=>aPe(r,e))}function aPe(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:$p,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=>!iPe(oPe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:$p,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:$p,severity:Ml(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 $p,Jv,iC=y(()=>{"use strict";Mv();wt();$p="STATUS_DRIFT";Jv={name:$p,run:sPe}});function cPe(t){let{cwd:e="."}=t;return he(e,Yv,r=>lPe(r,e))}function lPe(t,e){let r=dt(e).language;return r==="unknown"?[{detector:Yv,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:Yv,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var Yv,C5,D5=y(()=>{"use strict";on();wt();Yv="TECH_STACK_MISMATCH";C5={name:Yv,run:cPe}});function pPe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function mPe(t){let{cwd:e="."}=t;return he(e,oC,r=>hPe(r,e))}function hPe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=ps([...pPe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:oC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var oC,N5,uPe,dPe,fPe,Xv,sC=y(()=>{"use strict";lp();RI();wt();oC="UNMAPPED_ARTIFACT",N5=["src/stages/**/*.ts","src/spec/**/*.ts"],uPe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},dPe={kotlin:"src/main/kotlin"},fPe=8;Xv={name:oC,run:mPe}});import{existsSync as j5}from"node:fs";import{join as M5}from"node:path";function yPe(t){return gPe.some(e=>t.startsWith(e))}function _Pe(t){let{cwd:e="."}=t;return he(e,aC,r=>bPe(r,e))}function bPe(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(yPe(o))continue;let s=o.split("#",1)[0];j5(M5(e,o))||s&&j5(M5(e,s))||r.push({detector:aC,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 kx(t){return`${JSON.stringify(t,null,2)} +`}function jee(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?`[[${Pee(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(Cee);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(Cee);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}/${Pee(s)}.md`,`${a.join(` +`)}`)}return o}function Cee(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as X2e}from"node:fs";import{dirname as Q2e,join as mj}from"node:path";import{fileURLToPath as eUe}from"node:url";var hj=Q2e(eUe(import.meta.url));function Mee(t){for(let e of[mj(hj,"viewer",t),mj(hj,"..","graph","viewer",t),mj(hj,"..","..","dist","viewer",t)])try{return X2e(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function Fee(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -874,20 +875,21 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify
${n} -`}DI();YI();BI();GI();KI();CI();nC();iC();sC();cC();Fm();JI();qe();var Z2e=[zv,Qv,Lv,Xv,qv,Gv,Dv,Jv,Kv,Cv];function V2e(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=yp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function kx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{xa(e,H(e))}catch{}try{for(let o of Z2e){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 V2e(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{xa(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}pj();qe();Ai();var K2e=new Set(["mermaid","dot","json","obsidian","html"]);function Nee(t={}){try{let e=t.format??"mermaid";if(!K2e.has(e)){U("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=mc(n,".");if(t.focus){let s=bx(n,i,t.focus);if(s.length===0){U("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){U("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=_x(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Pee(i);for(let[c,l]of a){let u=W2e(s,c);mj(gj(u),{recursive:!0}),hj(u,l,"utf8")}U("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){U("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=$x(i,kx(i,"."));mj(gj(t.out),{recursive:!0}),hj(t.out,s,"utf8"),U("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"?Ree(i):r==="json"?xx(i):Oee(i);t.out?(mj(gj(t.out),{recursive:!0}),hj(t.out,o,"utf8"),U("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){U("fail","graph",e.message),process.exit(1)}}function jee(){try{let t=mc(H(),".");process.stdout.write(Dee(Ex(t)),()=>process.exit(0))}catch(t){U("fail","graph",t.message),process.exit(1)}}Fm();import{createServer as J2e}from"node:http";import{existsSync as Y2e,watch as X2e}from"node:fs";import{join as Q2e}from"node:path";qe();Ai();function eUe(t={}){let e=t.cwd??".",r=new Set,n=()=>mc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}MP();eC();ZP();WP();XP();jP();sC();aC();lC();dC();Um();QP();qe();var tUe=[qv,tS,Uv,eS,Hv,Vv,jv,Xv,Yv,Nv];function rUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=vp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function Ax(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{ka(e,H(e))}catch{}try{for(let o of tUe){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 rUe(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{ka(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}gj();qe();Ai();var iUe=new Set(["mermaid","dot","json","obsidian","html"]);function zee(t={}){try{let e=t.format??"mermaid";if(!iUe.has(e)){U("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=hc(n,".");if(t.focus){let s=Sx(n,i,t.focus);if(s.length===0){U("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){U("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=vx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=jee(i);for(let[c,l]of a){let u=nUe(s,c);yj(bj(u),{recursive:!0}),_j(u,l,"utf8")}U("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){U("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=Ex(i,Ax(i,"."));yj(bj(t.out),{recursive:!0}),_j(t.out,s,"utf8"),U("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"?Nee(i):r==="json"?kx(i):Dee(i);t.out?(yj(bj(t.out),{recursive:!0}),_j(t.out,o,"utf8"),U("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){U("fail","graph",e.message),process.exit(1)}}function Uee(){try{let t=hc(H(),".");process.stdout.write(Lee(Tx(t)),()=>process.exit(0))}catch(t){U("fail","graph",t.message),process.exit(1)}}Um();import{createServer as oUe}from"node:http";import{existsSync as sUe,watch as aUe}from"node:fs";import{join as cUe}from"node:path";qe();Ai();function lUe(t={}){let e=t.cwd??".",r=new Set,n=()=>hc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=J2e((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=xx(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=oUe((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(Ax(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=$x(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=Q2e(e,u);if(Y2e(d))try{let f=X2e(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=Ex(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=cUe(e,u);if(sUe(d))try{let f=aUe(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 Mee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await eUe({port:e,cwd:t.cwd??"."});U("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){U("fail","graph",r.message),process.exit(1)}}var tUe=["stage_1.1","stage_2.1","stage_2.3"];function rUe(t){return(t.features??[]).filter(e=>e.status==="done")}function nUe(t,e){let r=rUe(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 Fee(t,e){let r=[];for(let n of tUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=nUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}dS();import Lee from"node:process";function iUe(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 Ax(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=iUe(n,t);i.pass||r.push(i)}return r}ti();var yj="stage_4.1";function _j(t={}){let{cwd:e="."}=t,r=On(e);if(r.length===0)return{stage:yj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Ax(r);if(n.length===0)return{stage:yj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:yj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var oUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Lee.argv[1]}`;if(oUe){let t=_j();console.log(JSON.stringify(t)),Lee.exit(t.exitCode)}dl();import{randomBytes as sUe}from"node:crypto";import{unlinkSync as aUe}from"node:fs";import{tmpdir as cUe}from"node:os";import{join as lUe,resolve as bj}from"node:path";import uUe from"node:process";var qr=null;function zee(t){qr={cwd:bj(t),run:null,jsonFile:null}}function Uee(){return qr!==null}function qee(t,e){if(!qr||qr.cwd!==bj(t))return null;if(qr.run)return qr.run;let r=lUe(cUe(),`clad-shared-vitest-${uUe.pid}-${sUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function Bee(t){return!qr||qr.cwd!==bj(t)?null:qr.run}function Hee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Gee(){let t=qr?.jsonFile;if(qr=null,t)try{aUe(t)}catch{}}Mr();import Zee from"node:process";var Tx="stage_1.4";function vj(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Tx,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:Tx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Tx,pass:!0,exitCode:0}:{stage:Tx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var dUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Zee.argv[1]}`;if(dUe){let t=vj();console.log(JSON.stringify(t)),Zee.exit(t.exitCode)}Mr();import Vee from"node:process";Lm();Tn();var Ox="stage_2.2";function Sj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Po("coverage",t))}catch(c){return{stage:Ox,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Ox,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Bee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=qt(Ox,r,s);return a||tr(Ox,s)}var mUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Vee.argv[1]}`;if(mUe){let t=Sj();console.log(JSON.stringify(t)),Vee.exit(t.exitCode)}Ep();wj();Mr();on();Tn();import Kee from"node:process";var Cx="stage_3.2";function xj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Cx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Cx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=qt(Cx,i,s);return a||tr(Cx,s)}var PUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Kee.argv[1]}`;if(PUe){let t=xj();console.log(JSON.stringify(t)),Kee.exit(t.exitCode)}Mr();qe();Tn();import{existsSync as IUe}from"node:fs";import{resolve as Yee}from"node:path";import Xee from"node:process";var ai="stage_2.4",$j=5e3,CUe=3e4;function kj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ai,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return NUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ai,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ai,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=Yee(e,r.path);if(!IUe(s))return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??$j,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=qt(ai,r.path,c);if(l)return l;if(c.timedOut)return{stage:ai,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:ai,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ai,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var Jee={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},DUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function NUe(t,e,r){let n=Math.min(e.length*$j,CUe),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(jUe(t,s,r))}return MUe(o)}function jUe(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("/")?Yee(t,a):a,u=$j,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Fa(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 MUe(t){let e="skip";for(let o of t)Jee[o.disposition]>Jee[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${DUe[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:ai,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ai,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var FUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Xee.argv[1]}`;if(FUe){let t=kj();console.log(JSON.stringify(t)),Xee.exit(t.exitCode)}Mr();on();Tn();import Qee from"node:process";var Dx="stage_3.1";function Ej(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Dx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Dx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=qt(Dx,i,s);return a||tr(Dx,s)}var LUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Qee.argv[1]}`;if(LUe){let t=Ej();console.log(JSON.stringify(t)),Qee.exit(t.exitCode)}QI();Aj();Tj();Mr();Px();import{randomBytes as ZUe}from"node:crypto";import{unlinkSync as VUe}from"node:fs";import{tmpdir as WUe}from"node:os";import{join as KUe}from"node:path";import Rj from"node:process";Lm();Tn();qe();import{readFileSync as qUe}from"node:fs";import{resolve as rte}from"node:path";function BUe(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=rte(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 HUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function GUe(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=HUe(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(rte(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 Oj(t,e){try{let r=BUe(qUe(t,"utf8"));return r?GUe(H(e),r,e):[]}catch{return[]}}var Io="stage_2.1";function nte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function JUe(t,e,r){let n,i;try{({cmd:n,args:i}=Po("coverage",t))}catch{return null}if(!n||!i||!nte(n,i))return null;let o=n,s=i,a=qee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(qt(Io,n,c))return null;let u=tr(Io,c);if(Hee(u)==="fallback")return null;if(r){let d=Oj(l,e);if(d.length>0)return{stage:Io,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Io,pass:!0,exitCode:0}}function Pj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Po("test",t))}catch(u){return{stage:Io,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Io,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=nte(n,i),a=r&&s;if(Uee()&&s){let u=JUe(t,e,a);if(u)return u}let c,l=i;a&&(c=KUe(WUe(),`clad-vitest-${Rj.pid}-${ZUe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=qt(Io,n,u);if(d)return d;let f=wu("unit",tr(Io,u),u);if(a&&f.pass&&c){let p=Oj(c,e);if(p.length>0)return{stage:Io,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{VUe(c)}catch{}}}var YUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rj.argv[1]}`;if(YUe){let t=Pj();console.log(JSON.stringify(t)),Rj.exit(t.exitCode)}Mr();on();Tn();import ite from"node:process";var Mx="stage_3.3";function Ij(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Mx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Il(e,o[o.length-1]))return{stage:Mx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=qt(Mx,i,s);return a||tr(Mx,s)}var XUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ite.argv[1]}`;if(XUe){let t=Ij();console.log(JSON.stringify(t)),ite.exit(t.exitCode)}tC();Tf();ha();Dj();mp();Bv();var dte=St(Qt(),1);import{existsSync as Nj,readFileSync as lqe,readdirSync as ute,statSync as uqe,writeFileSync as dqe}from"node:fs";import{basename as Bm,join as Hm,relative as lte}from"node:path";var fqe=["self-dogfood:","fixture:","derived:"],fte=/\.(test|spec)\.[jt]sx?$/;function pte(t,e=t,r=[]){let n;try{n=ute(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Hm(e,i);try{uqe(o).isDirectory()?pte(t,o,r):fte.test(i)&&r.push(o)}catch{continue}}return r}function mte(t="."){let e=Hm(t,"spec","features"),r=Hm(t,"tests"),n=[],i=[];if(!Nj(e)||!Nj(r))return{repaired:n,suggested:i};let o=pte(r),s=new Map;for(let a of o){let c=lte(t,a).split("\\").join("/"),l=s.get(Bm(a))??[];l.push(c),s.set(Bm(a),l)}for(let a of ute(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Hm(e,a),l,u;try{l=lqe(c,"utf8"),u=(0,dte.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(fqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Nj(Hm(t,b)))continue;let _=s.get(Bm(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=>Bm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>lte(t,h).split("\\").join("/")).find(h=>{let g=Bm(h).replace(fte,"");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 qee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await lUe({port:e,cwd:t.cwd??"."});U("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){U("fail","graph",r.message),process.exit(1)}}var uUe=["stage_1.1","stage_2.1","stage_2.3"];function dUe(t){return(t.features??[]).filter(e=>e.status==="done")}function fUe(t,e){let r=dUe(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 Bee(t,e){let r=[];for(let n of uUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=fUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}pS();import Hee from"node:process";function pUe(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 Ox(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=pUe(n,t);i.pass||r.push(i)}return r}ti();var vj="stage_4.1";function Sj(t={}){let{cwd:e="."}=t,r=On(e);if(r.length===0)return{stage:vj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Ox(r);if(n.length===0)return{stage:vj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:vj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var mUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Hee.argv[1]}`;if(mUe){let t=Sj();console.log(JSON.stringify(t)),Hee.exit(t.exitCode)}fl();import{randomBytes as hUe}from"node:crypto";import{unlinkSync as gUe}from"node:fs";import{tmpdir as yUe}from"node:os";import{join as _Ue,resolve as wj}from"node:path";import bUe from"node:process";var qr=null;function Gee(t){qr={cwd:wj(t),run:null,jsonFile:null}}function Zee(){return qr!==null}function Vee(t,e){if(!qr||qr.cwd!==wj(t))return null;if(qr.run)return qr.run;let r=_Ue(yUe(),`clad-shared-vitest-${bUe.pid}-${hUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function Wee(t){return!qr||qr.cwd!==wj(t)?null:qr.run}function Kee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Jee(){let t=qr?.jsonFile;if(qr=null,t)try{gUe(t)}catch{}}Mr();import Yee from"node:process";var Rx="stage_1.4";function xj(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Rx,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:Rx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Rx,pass:!0,exitCode:0}:{stage:Rx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var vUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Yee.argv[1]}`;if(vUe){let t=xj();console.log(JSON.stringify(t)),Yee.exit(t.exitCode)}Mr();import Xee from"node:process";qm();Tn();var Ix="stage_2.2";function $j(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Co("coverage",t))}catch(c){return{stage:Ix,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Ix,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Wee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=qt(Ix,r,s);return a||tr(Ix,s)}var xUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Xee.argv[1]}`;if(xUe){let t=$j();console.log(JSON.stringify(t)),Xee.exit(t.exitCode)}Op();kj();Mr();on();Tn();import ete from"node:process";var Nx="stage_3.2";function Ej(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Nx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Cl(e,o[o.length-1]))return{stage:Nx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=qt(Nx,i,s);return a||tr(Nx,s)}var zUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ete.argv[1]}`;if(zUe){let t=Ej();console.log(JSON.stringify(t)),ete.exit(t.exitCode)}Mr();qe();Tn();import{existsSync as UUe}from"node:fs";import{resolve as rte}from"node:path";import nte from"node:process";var ai="stage_2.4",Aj=5e3,qUe=3e4;function Tj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ai,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return HUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ai,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ai,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=rte(e,r.path);if(!UUe(s))return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Aj,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=qt(ai,r.path,c);if(l)return l;if(c.timedOut)return{stage:ai,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:ai,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ai,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var tte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},BUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function HUe(t,e,r){let n=Math.min(e.length*Aj,qUe),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(GUe(t,s,r))}return ZUe(o)}function GUe(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("/")?rte(t,a):a,u=Aj,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(La(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 ZUe(t){let e="skip";for(let o of t)tte[o.disposition]>tte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${BUe[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:ai,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ai,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var VUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${nte.argv[1]}`;if(VUe){let t=Tj();console.log(JSON.stringify(t)),nte.exit(t.exitCode)}Mr();on();Tn();import ite from"node:process";var jx="stage_3.1";function Oj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:jx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Cl(e,o[o.length-1]))return{stage:jx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=qt(jx,i,s);return a||tr(jx,s)}var WUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ite.argv[1]}`;if(WUe){let t=Oj();console.log(JSON.stringify(t)),ite.exit(t.exitCode)}rC();Rj();Ij();Mr();Cx();import{randomBytes as tqe}from"node:crypto";import{unlinkSync as rqe}from"node:fs";import{tmpdir as nqe}from"node:os";import{join as iqe}from"node:path";import Cj from"node:process";qm();Tn();qe();import{readFileSync as YUe}from"node:fs";import{resolve as ate}from"node:path";function XUe(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=ate(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 QUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function eqe(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=QUe(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(ate(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 Pj(t,e){try{let r=XUe(YUe(t,"utf8"));return r?eqe(H(e),r,e):[]}catch{return[]}}var Wi="stage_2.1";function cte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function oqe(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];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 sqe(t,e,r){let n,i;try{({cmd:n,args:i}=Co("coverage",t))}catch{return null}if(!n||!i||!cte(n,i))return null;let o=n,s=i,a=Vee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(qt(Wi,n,c))return null;let u=tr(Wi,c);if(Kee(u)==="fallback")return null;if(r){let d=Pj(l,e);if(d.length>0)return{stage:Wi,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Wi,pass:!0,exitCode:0}}function Dj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Co("test",t))}catch(u){return{stage:Wi,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Wi,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=cte(n,i),a=r&&s;if(Zee()&&s){let u=sqe(t,e,a);if(u)return u}let c,l=i;a&&(c=iqe(nqe(),`clad-vitest-${Cj.pid}-${tqe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=qt(Wi,n,u);if(d)return d;let f=xu("unit",tr(Wi,u),u);if(r&&f.pass&&oqe(u)){let p={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Wi,pass:!1,exitCode:1,findings:[p],stderr:p.message}}if(a&&f.pass&&c){let p=Pj(c,e);if(p.length>0)return{stage:Wi,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{rqe(c)}catch{}}}var aqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Cj.argv[1]}`;if(aqe){let t=Dj();console.log(JSON.stringify(t)),Cj.exit(t.exitCode)}Mr();on();Tn();import lte from"node:process";var Lx="stage_3.3";function Nj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Lx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Cl(e,o[o.length-1]))return{stage:Lx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=qt(Lx,i,s);return a||tr(Lx,s)}var cqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${lte.argv[1]}`;if(cqe){let t=Nj();console.log(JSON.stringify(t)),lte.exit(t.exitCode)}iC();Of();ya();Mj();yp();Gv();var gte=St(Qt(),1);import{existsSync as Fj,readFileSync as bqe,readdirSync as hte,statSync as vqe,writeFileSync as Sqe}from"node:fs";import{basename as Zm,join as Vm,relative as mte}from"node:path";var wqe=["self-dogfood:","fixture:","derived:"],yte=/\.(test|spec)\.[jt]sx?$/;function _te(t,e=t,r=[]){let n;try{n=hte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Vm(e,i);try{vqe(o).isDirectory()?_te(t,o,r):yte.test(i)&&r.push(o)}catch{continue}}return r}function bte(t="."){let e=Vm(t,"spec","features"),r=Vm(t,"tests"),n=[],i=[];if(!Fj(e)||!Fj(r))return{repaired:n,suggested:i};let o=_te(r),s=new Map;for(let a of o){let c=mte(t,a).split("\\").join("/"),l=s.get(Zm(a))??[];l.push(c),s.set(Zm(a),l)}for(let a of hte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Vm(e,a),l,u;try{l=bqe(c,"utf8"),u=(0,gte.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(wqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Fj(Vm(t,b)))continue;let _=s.get(Zm(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=>Zm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>mte(t,h).split("\\").join("/")).find(h=>{let g=Zm(h).replace(yte,"");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&&dqe(c,l,"utf8")}return{repaired:n,suggested:i}}ul();import{existsSync as pqe,readFileSync as mqe}from"node:fs";import{join as hqe}from"node:path";function gqe(t,e){let r=hqe(t,e);if(!pqe(r))return[];let n=[];for(let i of mqe(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 hte(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=>gqe(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 gte(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(` -`)}Zv();qe();Ai();ti();ul();var jj=["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"],yqe=[...jj,"att"];function _qe(t,e,r){if(e.startsWith("stage_4")){let n=On(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Ax(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function bqe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":R_(e,r,t).state==="fresh"?"\u2713":"!"}function Ux(t,e="."){let r=is(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...jj.map(o=>_qe(i,o,e)),bqe(i,r,e)]}));return{columns:yqe,rows:n}}function yte(t,e=".",r={}){let n=r.internal??!1,i=Ux(t,e),o=[...jj.map(c=>n?c.replace("stage_",""):vqe(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 vqe(t){return ka(t).slice(0,3)}async function HJe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Cue(),Iue)),Promise.resolve().then(()=>(Fue(),Mue)),Promise.resolve().then(()=>(Up(),qX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>See(s),prepareInit:({cwd:s,mode:a,intent:c})=>bee(s,a,c),initialize:ej,prepareClarify:(s,{cwd:a})=>vee(a,s),clarify:ij,resolveReview:(s,{cwd:a})=>hee(s,{cwd:a})}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function GJe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await ej({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){V.stdout.write(`${JSON.stringify(n,null,2)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&Sqe(c,l,"utf8")}return{repaired:n,suggested:i}}dl();import{existsSync as xqe,readFileSync as $qe}from"node:fs";import{join as kqe}from"node:path";function Eqe(t,e){let r=kqe(t,e);if(!xqe(r))return[];let n=[];for(let i of $qe(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 vte(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=>Eqe(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 Ste(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(` +`)}Wv();qe();Ai();ti();dl();var Lj=["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"],Aqe=[...Lj,"att"];function Tqe(t,e,r){if(e.startsWith("stage_4")){let n=On(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Ox(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function Oqe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":C_(e,r,t).state==="fresh"?"\u2713":"!"}function Bx(t,e="."){let r=os(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Lj.map(o=>Tqe(i,o,e)),Oqe(i,r,e)]}));return{columns:Aqe,rows:n}}function wte(t,e=".",r={}){let n=r.internal??!1,i=Bx(t,e),o=[...Lj.map(c=>n?c.replace("stage_",""):Rqe(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 Rqe(t){return Aa(t).slice(0,3)}async function e8e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Fue(),Mue)),Promise.resolve().then(()=>(Bue(),que)),Promise.resolve().then(()=>(Hp(),VX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Eee(s),prepareInit:({cwd:s,mode:a,intent:c})=>$ee(s,a,c),initialize:nj,prepareClarify:(s,{cwd:a})=>kee(a,s),clarify:aj,resolveReview:(s,{cwd:a})=>vee(s,{cwd:a})}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function t8e(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){V.stdout.write(`${JSON.stringify(n,null,2)} `),V.exit(0);return}for(let o of n.created)U("pass",`created ${o}`);for(let o of n.skipped)U("skip",o);for(let o of n.proposals??[])U("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(U("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){V.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())V.stdout.write(` ${o+1}. ${s} @@ -898,30 +900,30 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&dqe(c,l,"u `),V.stdout.write(` e.g. clad init payment SaaS for B2B `),V.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));V.exit(0)}async function ZJe(t,e){U("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(()=>(lde(),cde)),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)U(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),V.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>WO(l,s)),c=`${JH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;U(i,"run",c),a.length>0&&V.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&U("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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function VJe(t={}){try{let e=H();if(ma("."))U("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ms(".");jl(".",r),Za("."),g5(".");let n=Zl(".");n==="created"?U("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&U("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=mte(".");for(let s of i.repaired)U("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)U("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=zx(".");o&&U("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Wv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){U("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);U("note",`propose-archive \xB7 ${s}`,a)}U("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),V.exit(0);return}U("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){U("fail","sync",e.message),V.exit(1)}}function WJe(t){if(!t){U("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=p_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";U("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function KJe(t,e={}){if(!t){U("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=m_(".",t);if(!r){U("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}h_(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";U("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?V.stdout.write(`Run: git checkout ${r.gitHead} +`));V.exit(0)}async function r8e(t,e){U("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(()=>(mde(),pde)),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)U(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),V.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>JO(l,s)),c=`${QH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;U(i,"run",c),a.length>0&&V.stdout.write(`Touched: ${a.join(", ")} +`)}let o=n.stubsCreated.length>0;o&&U("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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function n8e(t={}){try{let e=H();if(ga("."))U("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=gs(".");Ml(".",r),Va("."),v5(".");let n=Vl(".");n==="created"?U("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&U("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=bte(".");for(let s of i.repaired)U("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)U("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=qx(".");o&&U("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Jv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){U("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);U("note",`propose-archive \xB7 ${s}`,a)}U("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),V.exit(0);return}U("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){U("fail","sync",e.message),V.exit(1)}}function i8e(t){if(!t){U("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=g_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";U("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function o8e(t,e={}){if(!t){U("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=y_(".",t);if(!r){U("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}__(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";U("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?V.stdout.write(`Run: git checkout ${r.gitHead} `):V.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),V.exit(0)}async function JJe(t){let e=t.host&&t.host!=="all"?[t.host]:void 0,r=await jC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});V.exit(r.errors.length>0?1:0)}async function YJe(){U("note","update","reconciling the current project after the engine upgrade");let t=await cX(".",{wireHosts:async()=>(await jC({quiet:!0,projectRoot:"."})).errors.length});if(U(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){U("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}t.inventoryDeferred?U("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):U("pass","spec",`inventory synced \xB7 ${t.features} features`),U(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)U("note","deprecated",r);V.stdout.write(` +`),V.exit(0)}async function s8e(t){let e=t.host&&t.host!=="all"?[t.host]:void 0,r=await LC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});V.exit(r.errors.length>0?1:0)}async function a8e(){U("note","update","reconciling the current project after the engine upgrade");let t=await pX(".",{wireHosts:async()=>(await LC({quiet:!0,projectRoot:"."})).errors.length});if(U(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){U("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}t.inventoryDeferred?U("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):U("pass","spec",`inventory synced \xB7 ${t.features} features`),U(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)U("note","deprecated",r);V.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),mA({tier:"pre-commit",strict:!0}).anyFailed?V.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"):U("pass","drift","clean against the stricter detectors"),V.exit(t.code)}var XJe={"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=XJe[e];if(!n)return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):r||U("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",()=>Um(i)],["stage_1.2",()=>zm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",vj],["stage_1.5",Ya],["stage_1.6",Dp],["stage_2.1",()=>Pj({...i,strict:t.strict})],["stage_2.2",()=>Sj(i)],["stage_2.3",XI],["stage_2.4",kj],["stage_3.1",Ej],["stage_3.2",xj],["stage_3.3",Ij],["stage_4.1",_j],["stage_4.2",qm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ii(d)?"fail":"skip",u=[];P_("."),zee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:ka(d),h=YY(p);ii(h)&&(c=!0,a=Math.max(a,XY(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(U(l(h),m),ii(h)&&s8e(p))}}finally{C_(),Gee()}if(t.strict)try{let d=H();for(let f of Fee(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&&U("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"||!ii(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=>ii(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&U("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(ma("."))t.json||U("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{gG(".",H())&&(t.json||U("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function QJe(t){try{let e=H(),r=nl(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} -`),V.exit("not_found"in r?1:0)}catch(e){U("fail","context",e.message),V.exit(1)}}function e8e(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} -`),V.exit("not_found"in i?1:0)}catch(r){U("fail","impact",r.message),V.exit(1)}}function t8e(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=eS(e,o=>{try{return dde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),V.exit(0)}catch(e){U("fail","infer-deps",e.message),V.exit(1)}}function r8e(t={}){try{if(t.sessions){$ee(t);return}if(t.trend!==void 0&&t.trend!==!1){kee(t);return}let e=H(),n=hH(e,o=>{try{return dde(o,"utf8")}catch{return null}},"."),i=yH(".",n);if(t.json)V.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)}`,` ${il}`];V.stdout.write(`${c.join(` +`),gA({tier:"pre-commit",strict:!0}).anyFailed?V.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"):U("pass","drift","clean against the stricter detectors"),V.exit(t.code)}var c8e={"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 gA(t){let e=t.tier??"all",r=t.silent===!0,n=c8e[e];if(!n)return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):r||U("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",()=>Hm(i)],["stage_1.2",()=>Bm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",xj],["stage_1.5",Xa],["stage_1.6",Mp],["stage_2.1",()=>Dj({...i,strict:t.strict})],["stage_2.2",()=>$j(i)],["stage_2.3",tC],["stage_2.4",Tj],["stage_3.1",Oj],["stage_3.2",Ej],["stage_3.3",Nj],["stage_4.1",Sj],["stage_4.2",Gm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ii(d)?"fail":"skip",u=[];D_("."),Gee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Aa(d),h=rX(p);ii(h)&&(c=!0,a=Math.max(a,nX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(U(l(h),m),ii(h)&&g8e(p))}}finally{j_(),Jee()}if(t.strict)try{let d=H();for(let f of Bee(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&&U("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"||!ii(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=>ii(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&U("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(ga("."))t.json||U("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{bG(".",H())&&(t.json||U("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function l8e(t){try{let e=H(),r=il(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} +`),V.exit("not_found"in r?1:0)}catch(e){U("fail","context",e.message),V.exit(1)}}function u8e(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} +`),V.exit("not_found"in i?1:0)}catch(r){U("fail","impact",r.message),V.exit(1)}}function d8e(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=rS(e,o=>{try{return gde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),V.exit(0)}catch(e){U("fail","infer-deps",e.message),V.exit(1)}}function f8e(t={}){try{if(t.sessions){Oee(t);return}if(t.trend!==void 0&&t.trend!==!1){Ree(t);return}let e=H(),n=_H(e,o=>{try{return gde(o,"utf8")}catch{return null}},"."),i=vH(".",n);if(t.json)V.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)}`,` ${ol}`];V.stdout.write(`${c.join(` `)} -`),i.appended?U("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?U("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&U("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}V.exit(0)}catch(e){U("fail","measure",e.message),V.exit(1)}}function n8e(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(U("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){U("fail","check",r.message),V.exit(1)}V.exitCode=mA({...t,focusModules:e}).worst}function i8e(t){let e=IY(".",t,{checkStages:mA,onIndex:Za,gitOpInProgress:mO});U(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function o8e(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){U("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=v5(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),i.appended?U("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?U("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&U("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}V.exit(0)}catch(e){U("fail","measure",e.message),V.exit(1)}}function p8e(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(U("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){U("fail","check",r.message),V.exit(1)}V.exitCode=gA({...t,focusModules:e}).worst}function m8e(t){let e=MY(".",t,{checkStages:gA,onIndex:Va,gitOpInProgress:gO});U(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function h8e(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){U("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=k5(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),V.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";V.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}V.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),V.exit(s.length>0?1:0);return}if(!t){U("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),V.exit(1);return}let i=hte(n,t,e.ac,r);if(!i||i.acs.length===0){U("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),V.exit(1);return}V.stdout.write(`${gte(i)} -`),V.exit(0)}function s8e(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=ude(Cf(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] +`),V.exit(s.length>0?1:0);return}if(!t){U("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),V.exit(1);return}let i=vte(n,t,e.ac,r);if(!i||i.acs.length===0){U("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),V.exit(1);return}V.stdout.write(`${Ste(i)} +`),V.exit(0)}function g8e(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=hde(Df(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&V.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&V.stdout.write(` ${ude(e.trim(),160)} -`)}}function ude(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function a8e(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(Ux(e,"."),null,2)} -`),V.exitCode=0;return}V.stdout.write(`${yte(e,".",{internal:t.internal})} -`),V.exit(0)}function c8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function l8e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){U("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=Ux(i,e),s={gitHead:ya(e),version:Ul(),generatedAt:t.now??new Date().toISOString()},a=al(i),c;try{let l=t.since??Qo(e),u=es(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:ol(u),auditMarkdown:sl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=cG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){U("fail","bundle",i.message),V.exit(1);return}try{BJe(r,n,"utf8")}catch(i){U("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}U("pass","bundle",`${r} \xB7 ${c8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function u8e(t){let e=CA(t);U("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function d8e(){let t=new s4;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(GJe),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(ZJe),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(VJe),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate all hosts (default) or one of: claude, codex, antigravity, cursor","all").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(JJe),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh AGENTS.md, then report stricter detector findings").action(YJe),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(n8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(WJe),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(i8e),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)=>o8e(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(KJe),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(a8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(QJe),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)=>e8e(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=>oX(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=>t8e(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=>r8e(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=>Nee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>jee()),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=>{Mee(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=>KH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>eY(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=>l8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(u8e),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(JY),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(HJe),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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 / 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){OY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}nY(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(_ee),t}var f8e=!!globalThis.__CLADDING_BUNDLED,p8e=f8e||import.meta.url===`file://${V.argv[1]}`;p8e&&d8e().parse();export{XJe as TIER_STAGES,d8e as createProgram,l8e as runBundleCommand,n8e as runCheckCommand,mA as runCheckStages,WJe as runCheckpointCommand,QJe as runContextCommand,i8e as runDoneCommand,e8e as runImpactCommand,t8e as runInferDepsCommand,GJe as runInitCommand,r8e as runMeasureCommand,o8e as runOracleCommand,KJe as runRollbackCommand,u8e as runRouteCommand,ZJe as runRunCommand,HJe as runServeCommand,JJe as runSetupCommand,a8e as runStatusCommand,VJe as runSyncCommand,YJe as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&V.stdout.write(` ${hde(e.trim(),160)} +`)}}function hde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function y8e(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(Bx(e,"."),null,2)} +`),V.exitCode=0;return}V.stdout.write(`${wte(e,".",{internal:t.internal})} +`),V.exit(0)}function _8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function b8e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){U("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=Bx(i,e),s={gitHead:ba(e),version:ql(),generatedAt:t.now??new Date().toISOString()},a=cl(i),c;try{let l=t.since??es(e),u=ts(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:sl(u),auditMarkdown:al(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=dG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){U("fail","bundle",i.message),V.exit(1);return}try{QJe(r,n,"utf8")}catch(i){U("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}U("pass","bundle",`${r} \xB7 ${_8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function v8e(t){let e=NA(t);U("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function S8e(){let t=new l4;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(t8e),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(r8e),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(n8e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate all hosts (default) or one of: claude, codex, antigravity, cursor","all").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(s8e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh AGENTS.md, then report stricter detector findings").action(a8e),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(p8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(i8e),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(m8e),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)=>h8e(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(o8e),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(y8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(l8e),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)=>u8e(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=>uX(r,{checkStages:gA})),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=>d8e(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=>f8e(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=>zee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Uee()),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=>{qee(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=>XH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>oY(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=>b8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(v8e),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(tX),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(e8e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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 / 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){DY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}cY(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(xee),t}var w8e=!!globalThis.__CLADDING_BUNDLED,x8e=w8e||import.meta.url===`file://${V.argv[1]}`;x8e&&S8e().parse();export{c8e as TIER_STAGES,S8e as createProgram,b8e as runBundleCommand,p8e as runCheckCommand,gA as runCheckStages,i8e as runCheckpointCommand,l8e as runContextCommand,m8e as runDoneCommand,u8e as runImpactCommand,d8e as runInferDepsCommand,t8e as runInitCommand,f8e as runMeasureCommand,h8e as runOracleCommand,o8e as runRollbackCommand,v8e as runRouteCommand,r8e as runRunCommand,e8e as runServeCommand,s8e as runSetupCommand,y8e as runStatusCommand,n8e as runSyncCommand,a8e as runUpdateCommand}; diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 1954f8e6..e7a991c8 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -37,10 +37,10 @@ attested_modules: docs/ab-evaluation/README.md: 2467808b9871dcf0 docs/ab-evaluation/case-doverunner-scale.md: 2a435b6855823d41 docs/ab-evaluation/case-efficiency-measurement.md: 348aca146a7b2faa - docs/ab-evaluation/case-existing-adoption.md: ba73162bf6f43a34 + docs/ab-evaluation/case-existing-adoption.md: fc0997406abc7e61 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: a19608f25d0cf807 + docs/ab-evaluation/case-payment-saas.md: 4f9306412e40cee2 docs/ab-evaluation/case-working-set-landmine.md: b4f44dc463e99722 docs/ab-evaluation/summary.md: 59e527a531f13209 docs/b1-adoption-protocol.md: a041d8ad5ba1447f @@ -60,7 +60,7 @@ attested_modules: docs/multi-provider-roadmap.md: 1e5cf27ea1b18d06 docs/refinement-backlog.md: 3e38d60bf987eef1 docs/spec-ids-multi-dev.md: 28d58e84879f58b1 - docs/ssot-model.md: 35b911d1138b725e + docs/ssot-model.md: ab7933a8ef7b89b8 docs/ssot-testing.md: abf3b2bd5acb29a1 package.json: dadf1cd78af4d4a3 plugins/claude-code/.claude-plugin/plugin.json: 7493e69dee9ae24d @@ -192,10 +192,10 @@ attested_modules: src/hitl/anti-self-cert.ts: 53a714d8e489d00a src/hitl/audit.ts: 79b06e904815469a src/hitl/identity.ts: 52ff84aa666f1dab - src/init/agents-md.ts: cb15264f0a0f2f8c + src/init/agents-md.ts: 7dc05f6d82e5c3ce src/init/git-hook.ts: 4e02f177b3764ae8 src/init/host-instructions.ts: f6d10695ef0c4763 - src/init/host-setup.ts: 6d83a5a3a59131e4 + src/init/host-setup.ts: 7567497d563ef587 src/optimizer: a4d0f0eb87fed960 src/optimizer/code-excerpt.ts: e2c4598efcd28d2a src/optimizer/context-slice.ts: b5864aaed1e7ae48 @@ -242,17 +242,17 @@ attested_modules: src/stages/cov.ts: 9797f9316e391a55 src/stages/deliverable-smoke.ts: 9ecfd4210e6ec5c0 src/stages/detector-result-cache.ts: 93ea6af02ef361c5 - src/stages/detectors/README.md: 2e136e4f61e6d6bb + src/stages/detectors/README.md: 12e8d24351eef05c src/stages/detectors/absence-of-governance.ts: 954d8ce5c45b3b32 src/stages/detectors/ac-drift.ts: 1bceeae9ee99080b src/stages/detectors/ac-duplicate-within-feature.ts: 652ad48c8cd1ab2e src/stages/detectors/ai-hints-forbidden-pattern.ts: 96b225595ffd4d0a src/stages/detectors/architecture-from-spec.ts: ee36fa5f94a5be2a src/stages/detectors/architecture-violation.ts: b5035317a61e5ebe - src/stages/detectors/capabilities-feature-mapping.ts: c969d5dfa45851e1 + src/stages/detectors/capabilities-feature-mapping.ts: 4a245767d091d6ff src/stages/detectors/convention-drift.ts: 450cb86924dfcf82 src/stages/detectors/coverage-drop.ts: 809d13599596793e - src/stages/detectors/deliverable-integrity.ts: 2d14f1064eeb41a7 + src/stages/detectors/deliverable-integrity.ts: 40c4736774e9dfc6 src/stages/detectors/dependency-cycle.ts: 873c8fdde00aa48b src/stages/detectors/doc-reference-integrity.ts: ac693db9c4bed946 src/stages/detectors/evidence-mismatch.ts: c633778b8f9ec0af @@ -272,7 +272,7 @@ attested_modules: src/stages/detectors/planned-backlog.ts: a6850576b00d4a44 src/stages/detectors/project-context-drift.ts: d3643f369537a8e8 src/stages/detectors/reference-integrity.ts: 8883766a4bf69c61 - src/stages/detectors/scenario-coverage.ts: ff4cc3aa721abe26 + src/stages/detectors/scenario-coverage.ts: 08bd9a808d9e85ed src/stages/detectors/slug-conflict.ts: 5d9b8feec12dce07 src/stages/detectors/smoke-probe-demand.ts: 792b6d0d07f82a16 src/stages/detectors/spec-conformance.ts: 8c74460349f0acef @@ -300,7 +300,7 @@ attested_modules: src/stages/spec-conformance.ts: ba68465c4715cc65 src/stages/test-run-cache.ts: 46df49ab73a1a72e src/stages/toolchain/coverage-tool.ts: 310883060ed6d92e - src/stages/toolchain/detect.ts: 33e2f90c954a6c10 + src/stages/toolchain/detect.ts: 36d4947e5567bd5f src/stages/toolchain/gate-config.ts: 35c31716191a3dee src/stages/toolchain/language-config.ts: 65175718559b0710 src/stages/toolchain/module-scope.ts: 88358ec3b84eedd3 @@ -309,8 +309,8 @@ attested_modules: src/stages/type.ts: abe900ea8236d37f src/stages/types.ts: 24b4dc30ec7d7f33 src/stages/uat.ts: 62ec3e37a124f8c5 - src/stages/unit.ts: f25add219b764f03 - src/stages/util.ts: 7943e14136ec2da7 + src/stages/unit.ts: f61e0b2c79ed97e2 + src/stages/util.ts: 33e1a60e5bd097b9 src/stages/vacuous-tests.ts: 8e71b81e151325af src/stages/visual.ts: 48bbb6e77f09ed63 src/ui: a4d0f0eb87fed960 @@ -391,7 +391,7 @@ attested_modules: tests/stages/hardcoded-secret.test.ts: bf6adf480abdc4e0 tests/stages/harness-integrity.test.ts: 72e1770566c8e877 tests/stages/inventory-drift.test.ts: 5641e9bdfadb2d52 - tests/stages/lint.test.ts: 7bb84adc4f4e0820 + tests/stages/lint.test.ts: a5106351ff7aeabc tests/stages/meta-integrity.test.ts: f0781f010e95edd0 tests/stages/missing-implementation.test.ts: 2cf79871685fbdf4 tests/stages/missing-tests.test.ts: feb49f3af71cc1af @@ -400,18 +400,18 @@ attested_modules: tests/stages/reference-integrity.test.ts: 0f919c06f0ff96f3 tests/stages/secret.test.ts: 06291c1daf9df45c tests/stages/smoke.test.ts: 99f97875d29ac5d3 - tests/stages/spec-conformance.test.ts: 9f6ac08e09d7b10b + tests/stages/spec-conformance.test.ts: bdd78493c15a4ee4 tests/stages/stale-evidence.test.ts: 8e8622f17eb7f955 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/toolchain.test.ts: 13b2229e49d1eaba + tests/stages/toolchain.test.ts: 04e12be4ac1dee5c tests/stages/type.test.ts: b57cf7455cae3b32 tests/stages/uat.test.ts: 29c5bf3e7f3abc35 - tests/stages/unit.test.ts: cb1eea0a14681948 + tests/stages/unit.test.ts: 97781210eb81bb25 tests/stages/unmapped-artifact.test.ts: 6bfdae66990fd63a - tests/stages/util.test.ts: 6e0e86140028f336 + tests/stages/util.test.ts: b78f4f467b752bf2 tests/stages/visual.test.ts: dd819e7d25586b92 tests/ui/panel.test.ts: ad9ea207f34b1c51 tests/ui/pulse.test.ts: 30f1d091de9093ad diff --git a/spec/features/deliverable-smoke-9064ff.yaml b/spec/features/deliverable-smoke-9064ff.yaml index d650307e..d4f0c444 100644 --- a/spec/features/deliverable-smoke-9064ff.yaml +++ b/spec/features/deliverable-smoke-9064ff.yaml @@ -62,15 +62,16 @@ acceptance_criteria: test_refs: - tests/stages/detectors/deliverable-integrity.test.ts - id: AC-864efe - ears: optional - condition: "where done features ship modules but no deliverable is declared" - action: "leave an auditable advisory" - response: "DELIVERABLE_INTEGRITY emits a non-blocking warning" - text: "Where done features ship modules but no project.deliverable is declared, DELIVERABLE_INTEGRITY shall emit a non-blocking warning so that silencing the smoke (omitting the declaration) always leaves an auditable signal." + ears: state + condition: "while done features ship modules but no deliverable is declared" + action: "leave an informational signal before the shared eight-feature maturity boundary and an advisory warning after it" + response: "early domain or library slices can complete while a grown project must resolve its deliverable decision" + text: "While done features ship modules but no project.deliverable is declared, DELIVERABLE_INTEGRITY shall emit information before the eight-feature maturity boundary and a warning at or after it, so early domain or library slices can complete while grown projects retain an auditable deliverable obligation." notes: | ## Decision - Warn (not error) so legacy projects without a declared deliverable are not retro-failed, - while still nudging adoption — the deterministic floor is complementary to, not a - replacement for, the impl-blind oracle (stage_2.3), which alone catches "runs but wrong". + Information keeps the first strict `done` reachable before an executable entry exists; + warning after the shared maturity boundary nudges adoption. The deterministic floor is + complementary to, not a replacement for, the impl-blind oracle (stage_2.3), which alone + catches "runs but wrong". test_refs: - tests/stages/detectors/deliverable-integrity.test.ts diff --git a/spec/features/lint-config-detection-b2094740.yaml b/spec/features/lint-config-detection-b2094740.yaml index 08963ee4..dd18471e 100644 --- a/spec/features/lint-config-detection-b2094740.yaml +++ b/spec/features/lint-config-detection-b2094740.yaml @@ -9,8 +9,8 @@ acceptance_criteria: - id: AC-7bf859 ears: ubiquitous action: "resolve the TypeScript/JavaScript lint gate from the linter the project actually configured" - response: "detectToolchain selects biome when biome.json/biome.jsonc is present, oxlint when any of its config files (.oxlintrc.json/.oxlintrc.jsonc/oxlint.config.ts) is present (biome winning when both are), and keeps the eslint default when no linter config is present — so prior eslint and config-less projects behave exactly as before" - text: "The system shall resolve the stage_1.2 lint gate for a TypeScript/JavaScript project from the linter that project configured — selecting biome on a biome.json/biome.jsonc, oxlint on any oxlint config file (.oxlintrc.json / .oxlintrc.jsonc / oxlint.config.ts, all auto-detected by oxlint), with biome taking precedence when both exist, and falling back to the eslint default when no linter config is present — so a biome- or oxlint-based project gates natively without an eslint shim, while eslint and config-less projects keep their existing behavior." + response: "detectToolchain runs scripts.lint when declared, otherwise selects biome, oxlint, or eslint from explicit configuration, and leaves an undeclared lint gate unregistered" + text: "The system shall resolve the stage_1.2 lint gate for a TypeScript/JavaScript project from the workflow that project declared — preferring scripts.lint, otherwise selecting biome on biome configuration, oxlint on oxlint configuration, or eslint on eslint configuration, and leaving lint unregistered when none is declared." notes: | ## Why stage_1.2 is the polyglot lint gate that `clad done` must pass, and it @@ -24,9 +24,11 @@ acceptance_criteria: - "tests/stages/toolchain.test.ts#typescript + .oxlintrc.json → lint gate is oxlint" - "tests/stages/toolchain.test.ts#typescript + .oxlintrc.jsonc → lint gate is oxlint" - "tests/stages/toolchain.test.ts#typescript + oxlint.config.ts → lint gate is oxlint" - - "tests/stages/toolchain.test.ts#typescript with no linter config → lint gate stays eslint (default preserved)" + - "tests/stages/toolchain.test.ts#typescript with no lint script or config → lint gate is honestly unconfigured" + - "tests/stages/toolchain.test.ts#typescript scripts.lint → lint gate runs the exact project-owned workflow" + - "tests/stages/toolchain.test.ts#typescript eslint config without lint script → lint gate is eslint" - "tests/stages/toolchain.test.ts#biome takes precedence over oxlint when both configs present" - - "tests/stages/toolchain.test.ts#selection follows config presence — add biome.json swaps to biome, remove it falls back to eslint" + - "tests/stages/toolchain.test.ts#selection follows declarations — add biome.json enables biome, remove it leaves lint unconfigured" - id: AC-86822d ears: unwanted condition: "if a non-TypeScript project carries a stray linter config, or the resolved linter is not installed" diff --git a/spec/features/natural-language-init-0f4dd6.yaml b/spec/features/natural-language-init-0f4dd6.yaml index 02fe070f..c1b0650e 100644 --- a/spec/features/natural-language-init-0f4dd6.yaml +++ b/spec/features/natural-language-init-0f4dd6.yaml @@ -17,8 +17,18 @@ modules: - src/spec/types.ts - src/cli/done.ts - src/events/log.ts + - src/stages/detectors/capabilities-feature-mapping.ts + - src/stages/detectors/scenario-coverage.ts + - src/stages/detectors/deliverable-integrity.ts + - src/stages/toolchain/detect.ts + - src/stages/unit.ts + - src/stages/util.ts - README.md - docs/glossary.md + - docs/ssot-model.md + - docs/dogfood/codex-cli-2026-07-15.md + - src/stages/detectors/README.md + - src/stages/README.md depends_on: [F-56abaa, F-5f6b45, F-80d19d] acceptance_criteria: - id: AC-001 @@ -194,3 +204,73 @@ acceptance_criteria: Real Codex headless sessions reload MCP per turn and may isolate temporary directories; without a durable staged draft, a new model turn can reconstruct the wrong intent from the approval code. ## Trade-off Staging writes an opaque short-lived cache under the already ignored `.cladding/host/` runtime boundary, while authored spec and documentation remain untouched until exact approval. + - id: AC-021 + ears: event + condition: when an activated project's ignored runtime launcher receives shell command arguments after initialization + action: forward those arguments to the exact engine used for MCP while retaining no-argument MCP startup + response: post-init shell validation cannot silently use a different global build from the connected MCP server + text: When the project runtime launcher receives shell command arguments, the system shall forward them to the same engine used for MCP while preserving no-argument MCP startup, so post-init validation cannot silently use another build. + test_refs: [tests/cli/setup.test.ts] + notes: | + ## Decision + Make the existing ignored Node launcher dual-purpose instead of adding a second machine-specific command surface. + ## Why + The live Codex campaign connected MCP to the branch build but resolved shell `clad` to an older global build carrying the same version string, so schema validation disagreed without an obvious version warning. + ## Trade-off + The launcher's historical `serve.cjs` name remains slightly narrower than its role, but existing host configurations stay compatible and every argument is forwarded without shell interpolation. + - id: AC-022 + ears: state + condition: while the generated AGENTS.md guides ordinary development after initialization + action: prefer the project runtime for Cladding shell commands and require the declared test command to collect relevant tests without shell-expanded glob dependencies + response: agents use one engine and cannot treat a vacuous or host-specific test invocation as completion evidence + text: While generated project guidance directs ordinary development, the system shall prefer the project Cladding runtime and require non-vacuous, shell-portable test execution, so engine skew and host-specific test globs cannot masquerade as completion. + test_refs: [tests/init/agents-md.test.ts] + - id: AC-023 + ears: state + condition: while an initialized project is below the shared eight-feature design-maturity threshold and retains unbound onboarding capabilities or scenarios + action: report those future design links as information while continuing to block dangling references and under-bound flows + response: the first ordinary feature can earn a strict done result without deleting valid future intent + text: While an initialized project is below the design-maturity threshold, the system shall treat unbound onboarding capabilities and scenarios as informational future intent while retaining blocking checks for invalid links, so an early feature can complete without erasing the roadmap. + test_refs: [tests/stages/capabilities-feature-mapping.test.ts, tests/stages/scenario-coverage.test.ts] + notes: | + ## Decision + Graduate empty-link findings from information to warning at the existing eight-feature maturity boundary. + ## Why + Onboarding intentionally authors three to eight future capabilities and one to three future journeys with empty feature links, while strict mode promotes every warning to an error. Treating those intentional seeds as warnings made the first `clad done` impossible. + ## Trade-off + Small projects may ship while retaining visibly informational future design; once the project reaches eight features, unresolved empty links become strict-gate blockers again. + - id: AC-024 + ears: event + condition: when a TypeScript or JavaScript project declares lint, custom test, or coverage scripts after initialization + action: run those project-owned workflows before inferred ecosystem defaults and leave undeclared optional gates unregistered + response: Node test and other custom workflows are not replaced by unrelated cached or globally available ESLint and Vitest executables + text: When a TypeScript or JavaScript project declares its development scripts, the system shall run the project-owned lint, custom test, and coverage workflows before inferred defaults and leave undeclared optional gates unregistered, so an unrelated tool cannot make ordinary post-initialization development fail or pass. + test_refs: [tests/stages/toolchain.test.ts] + notes: | + ## Decision + Treat package scripts as executable project intent. Preserve the direct Vitest/Jest paths only for their simple canonical scripts, because those paths provide per-test evidence and single-run unit/coverage reuse. + ## Why + The live Codex project explicitly used Node's built-in test runner, yet the full gate invoked Vitest against both source and compiled tests, invoked unconfigured ESLint, and requested an absent Vitest coverage plug-in. + ## Trade-off + Optional lint and coverage stages honestly skip when the project declares neither a script nor configuration; strict test demand still blocks a missing unit runner whenever behavioral proof is required. + - id: AC-025 + ears: unwanted + condition: if a unit command exits successfully but its recognized aggregate summary reports that zero tests executed + action: emit a blocking vacuous-tests finding in strict mode + response: a portable command typo or empty test selection cannot become completion evidence + text: If a unit command exits successfully but its recognized aggregate summary reports zero executed tests, the system shall emit a blocking vacuous-tests finding in strict mode, so an empty test selection cannot become completion evidence. + test_refs: [tests/stages/unit.test.ts] + - id: AC-026 + ears: unwanted + condition: if an inferred npm tool is absent from a project during an offline or network-restricted development session + action: prohibit registry access and classify the unresolved tool as a visible setup gap + response: missing optional tooling neither stalls the host session nor becomes a false secret, architecture, lint, or test failure + text: If an inferred npm tool is absent during an offline or network-restricted development session, the system shall prohibit registry access and classify the unresolved tool as a visible setup gap, so missing optional tooling neither stalls the host nor masquerades as a product defect. + test_refs: [tests/stages/toolchain.test.ts, tests/stages/util.test.ts] + - id: AC-027 + ears: state + condition: while an initialized project is below the shared eight-feature design-maturity threshold and its first completed domain or library slice has no runnable entry point yet + action: report the missing deliverable decision as information and retain the warning after the maturity boundary + response: the first feature can complete without inventing an unsafe smoke target while grown products must resolve the entry-point obligation + text: While an initialized project is below the design-maturity threshold and has no runnable entry point yet, the system shall treat the missing deliverable decision as information and restore the warning after the threshold, so the first feature can complete without inventing an unsafe smoke target. + test_refs: [tests/stages/detectors/deliverable-integrity.test.ts] diff --git a/spec/features/scenario-coverage-detector-315fd7.yaml b/spec/features/scenario-coverage-detector-315fd7.yaml index 1a7a0dfb..d7905659 100644 --- a/spec/features/scenario-coverage-detector-315fd7.yaml +++ b/spec/features/scenario-coverage-detector-315fd7.yaml @@ -19,14 +19,14 @@ acceptance_criteria: - id: AC-002 ears: unwanted condition: if a scenario declares an empty features[] list - action: 'warn that the scenario binds no features regardless of project size' - text: If a scenario binds no features, the system shall warn that it is hollow — a scenario must cover at least one feature's flow. + action: 'report that the scenario binds no features, as information below the maturity threshold and a warning once the project is grown' + text: If a scenario binds no features, the system shall report the unresolved link and graduate it to a warning when the project reaches the design-maturity threshold. test_refs: [tests/stages/scenario-coverage.test.ts] - id: AC-003 ears: ubiquitous - action: 'classify both signals warn so a small or genuinely flow-free project is not hard-broken, while a push/CI under --strict blocks' - response: 'the signal rides the existing warn/strict dial; a small project under the threshold with no scenarios is silent' - text: The system shall classify scenario-coverage findings as warn — advisory locally, blocking under --strict. + action: 'classify grown-project scenario-coverage findings as warn while retaining early onboarding seeds as info' + response: 'the grown-project signal rides the existing warn/strict dial, while a small project can retain explicit future journeys without blocking its first completed feature' + text: The system shall make grown-project scenario-coverage gaps blocking under strict mode while keeping early onboarding seeds informational. test_refs: [tests/stages/scenario-coverage.test.ts] - id: AC-004 ears: event diff --git a/spec/features/ssot-governance-d12edf.yaml b/spec/features/ssot-governance-d12edf.yaml index 8f6dbb8b..e832d243 100644 --- a/spec/features/ssot-governance-d12edf.yaml +++ b/spec/features/ssot-governance-d12edf.yaml @@ -41,7 +41,7 @@ acceptance_criteria: - id: AC-003 ears: ubiquitous action: resolve the spec/capabilities.yaml orphan by introducing the CAPABILITIES_FEATURE_MAPPING detector so the Tier B artifact gains an actual consumer - response: 'src/stages/detectors/capabilities-feature-mapping.ts exports a detector that loads spec/capabilities.yaml and spec.yaml, then emits error findings for capability features[] entries that reference a non-existent feature id, warn findings for capabilities whose features[] is empty or missing (orphan capability), and info findings for spec.yaml features that no capability claims; detector skips silently when capabilities.yaml is missing or capabilities array is empty (adoption hasn`t reached this artifact yet); registered in src/stages/detectors/index.ts (24 → 25 detectors)' + response: 'src/stages/detectors/capabilities-feature-mapping.ts exports a detector that loads spec/capabilities.yaml and spec.yaml, then emits error findings for capability features[] entries that reference a non-existent feature id, graduated info-to-warn findings for capabilities whose features[] is empty or missing (informational below eight features, warning once grown), and info findings for spec.yaml features that no capability claims; detector skips silently when capabilities.yaml is missing or capabilities array is empty (adoption hasn`t reached this artifact yet); registered in src/stages/detectors/index.ts (24 → 25 detectors)' text: The system shall resolve the spec/capabilities.yaml orphan by introducing the CAPABILITIES_FEATURE_MAPPING detector so the Tier B artifact gains an actual consumer. test_refs: [tests/stages/capabilities-feature-mapping.test.ts] - id: AC-004 diff --git a/spec/features/ts-toolchain-jest-and-multiext-arch-47b8bee5.yaml b/spec/features/ts-toolchain-jest-and-multiext-arch-47b8bee5.yaml index f663a021..69672f2d 100644 --- a/spec/features/ts-toolchain-jest-and-multiext-arch-47b8bee5.yaml +++ b/spec/features/ts-toolchain-jest-and-multiext-arch-47b8bee5.yaml @@ -14,10 +14,10 @@ acceptance_criteria: test_refs: ["tests/stages/toolchain.test.ts"] - id: AC-a3be7a76 ears: event - condition: "when no jest config file is present in a detected TypeScript/JavaScript project" + condition: "when no jest config and no custom test script is present in a detected TypeScript/JavaScript project" action: "keep the vitest test and coverage gate defaults unchanged" - response: "config-less and vitest projects behave exactly as before (backward compatible)" - text: "When no jest config file is present in a detected TypeScript/JavaScript project, the system shall keep the vitest `run` test gate and `run --coverage` coverage gate defaults unchanged." + response: "legacy config-less projects behave exactly as before while explicit custom runners remain authoritative" + text: "When no jest config and no custom test script is present in a detected TypeScript/JavaScript project, the system shall keep the vitest `run` test and `run --coverage` defaults unchanged." test_refs: ["tests/stages/toolchain.test.ts"] - id: AC-3a899053 ears: ubiquitous diff --git a/spec/features/vacuous-test-guard-b81d203e.yaml b/spec/features/vacuous-test-guard-b81d203e.yaml index bf145a55..3fbc8750 100644 --- a/spec/features/vacuous-test-guard-b81d203e.yaml +++ b/spec/features/vacuous-test-guard-b81d203e.yaml @@ -4,6 +4,7 @@ title: "vacuous-test guard — a done feature's declared tests must actually exe status: done modules: - src/stages/vacuous-tests.ts + - src/stages/unit.ts acceptance_criteria: - id: AC-41e112d3 test_refs: @@ -24,9 +25,9 @@ acceptance_criteria: test_refs: - tests/stages/vacuous-tests.test.ts ears: unwanted - condition: "if the per-test data cannot be parsed or the test runner is unsupported" + condition: "if neither per-test data nor a definitive aggregate execution count can be parsed, or the test runner is unsupported" response: "fall back to the existing exit-code behavior with no error" - text: "If the per-test data cannot be parsed or the test runner is unsupported, the system shall fall back to the exit-code behavior without failing the gate." + text: "If neither per-test data nor a definitive aggregate execution count can be parsed, or the test runner is unsupported, the system shall fall back to the exit-code behavior without failing the gate." notes: "DEFENSIVE (non-negotiable): a parse failure must NEVER fail the gate. Guard fires only when we are confident." - id: AC-d7a9568e test_refs: @@ -41,3 +42,10 @@ acceptance_criteria: ears: ubiquitous text: "The guard shall apply only to done features and shall preserve the test runner's human-readable output." notes: "Planned/in-progress features are legitimately incomplete. Dual-reporter (json to file + default to stdout) so clad check output stays readable." + - id: AC-0e76a1b2 + test_refs: + - tests/stages/unit.test.ts + ears: unwanted + condition: "if a successful test command definitively reports zero executed tests" + response: "emit a blocking VACUOUS_TESTS finding under strict mode" + text: "If a successful test command definitively reports zero executed tests, the system shall emit a blocking VACUOUS_TESTS finding under strict mode." diff --git a/spec/index.yaml b/spec/index.yaml index fd56bb21..1b9255ef 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -94,7 +94,7 @@ features: F-0e84628e: {slug: merge-ritual-docs, status: done, modules: 2} F-0ed2db: {slug: ai-hints-consumer-instructions, status: done, modules: 11} F-0f2984d0: {slug: infer-deps-dynamic-flag, status: done, modules: 2} - F-0f4dd6: {slug: natural-language-init, status: in_progress, modules: 16} + F-0f4dd6: {slug: natural-language-init, status: in_progress, modules: 26} F-10cc42d1: {slug: git-op-write-guard, status: done, modules: 5} F-12d740: {slug: atomic-ac-evidence-fanout, status: done, modules: 1} F-15999130: {slug: inferable-depends-on-detector, status: done, modules: 2} @@ -203,7 +203,7 @@ features: F-b43066: {slug: model-defaults-refresh, status: done, modules: 6} F-b61449: {slug: gemini-cli-dogfood, status: done, modules: 1} F-b7873005: {slug: gate-error-parser, status: done, modules: 1} - F-b81d203e: {slug: vacuous-test-guard, status: done, modules: 1} + F-b81d203e: {slug: vacuous-test-guard, status: done, modules: 2} F-b84c38: {slug: lifecycle-events-identity, status: done, modules: 4} F-b8d74801: {slug: verb-rename-residue-sweep, status: done, modules: 6} F-b99577: {slug: stale-archive-suggestion, status: done, modules: 4} diff --git a/src/init/agents-md.ts b/src/init/agents-md.ts index 72f7b213..e10f3144 100644 --- a/src/init/agents-md.ts +++ b/src/init/agents-md.ts @@ -137,14 +137,20 @@ export function renderAgentsMdManagedBlock(spec: Spec | null, cwd: string = '.') ' `acceptance_criteria`. Feature detail lives in `spec/features/-.yaml` —', ' never hand-author `F-NNN` filenames; ask cladding via the `clad` CLI (or', ' `clad_create_feature` when your host has cladding wired as an MCP server).', - '- Run `clad check --strict` to verify spec ↔ code across every drift detector.', + '- For shell commands, use `node .cladding/host/serve.cjs ` when that', + ' project launcher exists; it pins the CLI to the same engine as MCP. Fall back to', + ' `clad ` only when the project has no launcher.', + '- Run the resolved Cladding command with `check --strict` to verify spec ↔ code', + ' across every drift detector.', renderDocPointers(cwd).replace(/\n$/, ''), '', '## Feature cycle — one at a time', '', 'Finish ONE feature end-to-end before the next: author its shard (`acceptance_criteria`', - '+ `modules`) → implement → author tests in a separate context → `clad done `', - '(sets `status: done` only when `clad check --tier=pre-push --strict` is GREEN). Do not', + '+ `modules`) → implement → author tests in a separate context → run the declared test', + 'command and confirm it collected relevant tests → run the resolved Cladding command', + 'with `done ` (sets `status: done` only when the strict pre-push gate is', + 'GREEN). Package test scripts must not depend on shell-expanded glob patterns. Do not', 'author shards ahead of their code, or hand-write `status: done`.', '', '## Design evolves with each feature', diff --git a/src/init/host-setup.ts b/src/init/host-setup.ts index 38be42d6..5714de94 100644 --- a/src/init/host-setup.ts +++ b/src/init/host-setup.ts @@ -243,9 +243,11 @@ function runtimeBody(pkgRoot: string): string { "'use strict';", "const {spawn} = require('node:child_process');", `const engine = ${JSON.stringify(engine)};`, - "const child = spawn(process.execPath, [engine, 'serve'], {cwd: process.cwd(), stdio: 'inherit'});", + "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 MCP launcher: ${error.message}`); process.exitCode = 1; });", + "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('\n'); diff --git a/src/stages/README.md b/src/stages/README.md index 4974bb27..6bfaaab3 100644 --- a/src/stages/README.md +++ b/src/stages/README.md @@ -42,12 +42,12 @@ Ironclad iron-law stage implementations. One module per stage. Shared types in ` | stage | file | pass criteria (Ironclad spec) | determinism | default tool | |---|---|---|---|---| | stage_1.1 Type | `type.ts` | type checker exit 0, no errors | deterministic | polyglot chain (TS→tsc · Py→mypy · Rust→cargo check · …) | -| stage_1.2 Lint | `lint.ts` | linter exit 0, no errors | deterministic | polyglot chain (TS→eslint · Py→ruff · Rust→clippy · …) | +| stage_1.2 Lint | `lint.ts` | linter exit 0, no errors | deterministic | project script/config, then polyglot chain (TS→eslint/biome/oxlint · Py→ruff · …) | | stage_1.3 Drift (core) | `drift.ts` | zero error-severity findings | deterministic | plug-in registry (1/19 detector wired) | | stage_1.4 Commit | `commit.ts` | working tree + index both clean | deterministic | `git status --porcelain` (language-agnostic) | | stage_1.5 Arch | `arch.ts` | no architecture rule violations | deterministic | toolchain chain (TS→madge --circular · Python→lint-imports) | | stage_1.6 Secret | `secret.ts` | no hardcoded secrets in tracked code | deterministic | toolchain chain (TS→secretlint · others→gitleaks) | -| stage_2.1 Unit | `unit.ts` | unit-test runner exit 0 | deterministic | toolchain chain (TS→vitest · Python→pytest · Rust→cargo test · …) | +| stage_2.1 Unit | `unit.ts` | runner exit 0 and, under strict mode, a non-zero executed-test count | deterministic | project script, then toolchain chain (TS→vitest/jest · Python→pytest · …) | ## [INTERFACE] @@ -122,6 +122,12 @@ Output: one-line JSON on stdout, exit code matches stage result. Runtime: zero. Each stage module defers heavy lifting to the project's own toolchain (resolved by `toolchain/detect.ts`). +For TypeScript/JavaScript projects, an explicit `scripts.lint` or a non-Jest/Vitest +`scripts.test` is authoritative. Cladding invokes that npm workflow verbatim; +it does not substitute ESLint or Vitest. Coverage is registered for a custom +test runner only when `scripts.coverage` exists. An undeclared lint or coverage +workflow is reported as skipped, not guessed from the presence of package.json. + ## [POLYGLOT] Cladding is language-agnostic. Stages `type`, `lint`, `test`, `coverage`, `secret` resolve the actual tool by scanning the project for a recognized manifest, in priority order: diff --git a/src/stages/detectors/README.md b/src/stages/detectors/README.md index 870a8c4b..aff64994 100644 --- a/src/stages/detectors/README.md +++ b/src/stages/detectors/README.md @@ -38,13 +38,13 @@ ironclad_spec_ref: https://github.com/qwerfunch/ironclad/blob/main/detectors.sch | 23 | `SLUG_CONFLICT` *(cladding extension)* | within-spec | `slug-conflict.ts` | error | blind | | 24 | `AC_DUPLICATE_WITHIN_FEATURE` *(cladding extension)* | within-spec | `ac-duplicate-within-feature.ts` | error | blind | | 25 | `ARCHITECTURE_FROM_SPEC` *(cladding extension, v0.3.13)* | spec ↔ code | `architecture-from-spec.ts` | graduated (error / warn) | blind | -| 26 | `CAPABILITIES_FEATURE_MAPPING` *(cladding extension)* | spec ↔ spec | `capabilities-feature-mapping.ts` | graduated (error / warn / info) | blind | +| 26 | `CAPABILITIES_FEATURE_MAPPING` *(cladding extension)* | spec ↔ spec | `capabilities-feature-mapping.ts` | graduated (error / grown warn / info) | blind | | 27 | `AI_HINTS_FORBIDDEN_PATTERN` *(cladding extension, v0.3.57)* | spec ↔ code | `ai-hints-forbidden-pattern.ts` | error | blind | | 28 | `INVENTORY_DRIFT` *(cladding extension, v0.4.x)* | spec ↔ spec | `inventory-drift.ts` | error | blind | | 29 | `PLANNED_BACKLOG` *(cladding extension, v0.4.x)* | spec ↔ code | `planned-backlog.ts` | warn | **aware** *(planned-state)* | | 30 | `HOLLOW_GOVERNANCE` *(cladding extension, v0.4.x)* | spec ↔ spec | `hollow-governance.ts` | warn | blind *(scale-gated)* | | 31 | `DEPENDENCY_CYCLE` *(cladding extension, v0.4.x)* | spec ↔ spec | `dependency-cycle.ts` | error | blind | -| 32 | `SCENARIO_COVERAGE` *(cladding extension, v0.4.x)* | spec ↔ spec | `scenario-coverage.ts` | warn | blind *(scale-gated)* | +| 32 | `SCENARIO_COVERAGE` *(cladding extension, v0.4.x)* | spec ↔ spec | `scenario-coverage.ts` | grown warn / early info | blind *(scale-gated)* | | 33 | `PROJECT_CONTEXT_DRIFT` *(cladding extension, v0.4.x)* | spec ↔ doc | `project-context-drift.ts` | warn | blind *(scale-gated)* | | 34 | `SPEC_CONFORMANCE` *(cladding extension, v0.5.x)* | spec ↔ test | `spec-conformance.ts` | error | **aware** *(done-direction)* | | 35 | `DELIVERABLE_INTEGRITY` *(cladding extension, v0.5.x)* | spec ↔ code | `deliverable-integrity.ts` | error/warn | **aware** *(done-direction)* | diff --git a/src/stages/detectors/capabilities-feature-mapping.ts b/src/stages/detectors/capabilities-feature-mapping.ts index 5ff82c02..6a80325c 100644 --- a/src/stages/detectors/capabilities-feature-mapping.ts +++ b/src/stages/detectors/capabilities-feature-mapping.ts @@ -14,11 +14,11 @@ // typo or a feature that was deleted without updating the // capability registry. // -// 2. **Orphan capability (warn)** — a capability whose `features[]` -// is empty (or missing) is not yet bound to any feature. -// Acceptable during early onboarding (clad init may emit -// capability stubs before features land), but should be -// resolved before release. +// 2. **Orphan capability (graduated)** — a capability whose `features[]` +// is empty (or missing) is not yet bound to any feature. Intent-aware +// onboarding deliberately emits future capability seeds before features +// land, so the finding is info while a project is small and graduates to +// warn at the shared eight-feature maturity boundary. // // 3. **Unmapped feature (info)** — a feature in spec.yaml that no // capability claims via its `features[]`. Acceptable for @@ -45,6 +45,9 @@ import type {CommandStageOptions, DriftDetector, DriftFinding} from '../types.js const NAME = 'CAPABILITIES_FEATURE_MAPPING'; +/** Shared maturity boundary: below this count onboarding design is still expected to be ahead of implementation. */ +export const DEFAULT_MIN_FEATURES_FOR_CAPABILITY_BINDINGS = 8; + interface CapabilityEntry { readonly id: string; readonly title?: string; @@ -92,6 +95,7 @@ function run(opts: CommandStageOptions): readonly DriftFinding[] { const findings: DriftFinding[] = []; const featuresClaimedByCapabilities = new Set(); + const isGrown = featureIds.size >= DEFAULT_MIN_FEATURES_FOR_CAPABILITY_BINDINGS; for (const cap of capabilities) { if (typeof cap !== 'object' || cap === null) continue; @@ -101,11 +105,13 @@ function run(opts: CommandStageOptions): readonly DriftFinding[] { if (features.length === 0) { findings.push({ detector: NAME, - severity: 'warn', + severity: isGrown ? 'warn' : 'info', path: 'spec/capabilities.yaml', - message: - `capability "${capId}" has no features mapped — bind at least one feature via the features[] field, ` + - `or remove the capability if it's no longer relevant`, + message: isGrown + ? `capability "${capId}" has no features mapped — bind at least one feature via the features[] field, ` + + `or remove the capability if it's no longer relevant` + : `capability "${capId}" has no features mapped yet — retained as future onboarding intent; ` + + `bind it when a matching feature lands`, }); continue; } diff --git a/src/stages/detectors/deliverable-integrity.ts b/src/stages/detectors/deliverable-integrity.ts index 612aeb3d..d07534ef 100644 --- a/src/stages/detectors/deliverable-integrity.ts +++ b/src/stages/detectors/deliverable-integrity.ts @@ -4,11 +4,12 @@ // — it NEVER executes anything (that is the stage's job). Two checks, done-only: // - project.deliverable.path declared but ABSENT on disk → error (blocking): a // project that has shipped a `done` feature must have its declared entry present. -// - done features ship modules[] but NO project.deliverable is declared → warn: +// - done features ship modules[] but NO project.deliverable is declared → info +// before the shared eight-feature maturity boundary, warn after it: // the gate cannot smoke-test the shipped entry, so a broken entry could ship -// green (the Mini-Lang S5 failure). Warn (not error) keeps it advisory — legacy -// projects without a declared deliverable are not retro-failed — while ensuring -// silencing the smoke (omitting the declaration) always leaves an auditable signal. +// green (the Mini-Lang S5 failure). The graduated signal keeps early +// domain/library slices completable while ensuring a grown project's omitted +// smoke decision remains auditable and strict-gate actionable. // // BOUNDARY: presence/absence only. Whether the entry RUNS is stage_2.4; whether it // is CORRECT per spec is the impl-blind oracle (stage_2.3). @@ -22,6 +23,9 @@ import {withSpec} from './with-spec.js'; const NAME = 'DELIVERABLE_INTEGRITY'; +/** Shared maturity scale: early domain/library slices need not expose an entry yet. */ +export const DEFAULT_MIN_FEATURES_FOR_DELIVERABLE = 8; + function runDeliverableIntegrity(opts: CommandStageOptions): readonly DriftFinding[] { const {cwd = '.'} = opts; return withSpec(cwd, NAME, (spec) => detect(spec, cwd)); @@ -35,7 +39,7 @@ function detect(spec: Spec, cwd: string): readonly DriftFinding[] { return [ { detector: NAME, - severity: 'warn', + severity: spec.features.length >= DEFAULT_MIN_FEATURES_FOR_DELIVERABLE ? 'warn' : 'info', message: `${doneWithModules.length} done feature(s) ship modules but project.deliverable is not declared — ` + 'the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. ' + diff --git a/src/stages/detectors/scenario-coverage.ts b/src/stages/detectors/scenario-coverage.ts index af760eca..87b90327 100644 --- a/src/stages/detectors/scenario-coverage.ts +++ b/src/stages/detectors/scenario-coverage.ts @@ -12,8 +12,9 @@ // scenarios, warn: a non-trivial product with zero captured cross-feature // flows is under-specified. (status-blind on total feature count, like // HOLLOW_GOVERNANCE — the gap appeared on all-`done` builds.) -// 2. UNCONDITIONAL HOLLOW — a scenario whose `features[]` is empty is hollow (it -// claims to cover a flow but binds nothing), warn regardless of size. +// 2. GRADUATED HOLLOW — onboarding intentionally creates future journeys with +// empty `features[]`. Report them as info while the project is small, then +// warn at the same maturity threshold used by the no-scenarios check. // 3. UNDER-BOUND — a scenario whose `flow` names a feature by its slug (the // `(feature-slug)` convention) that it doesn't bind in `features[]`, so its // declared coverage under-states the flow it walks. Exact-slug match only, so @@ -42,6 +43,7 @@ function detect(spec: Spec): readonly DriftFinding[] { const findings: DriftFinding[] = []; const featureCount = spec.features.length; const scenarios = spec.scenarios ?? []; + const isGrown = featureCount >= DEFAULT_MIN_FEATURES_FOR_SCENARIOS; // 1. Grown project with no cross-feature flows captured. if (featureCount >= DEFAULT_MIN_FEATURES_FOR_SCENARIOS && scenarios.length === 0) { @@ -55,16 +57,19 @@ function detect(spec: Spec): readonly DriftFinding[] { }); } - // 2. A scenario that binds no features is hollow (claims a flow, covers nothing). + // 2. An empty onboarding scenario is future design until the project grows; + // after that boundary the same unresolved link is blocking under --strict. for (const s of scenarios) { if ((s.features ?? []).length === 0) { findings.push({ detector: NAME, - severity: 'warn', + severity: isGrown ? 'warn' : 'info', path: 'spec/scenarios/', - message: - `scenario ${s.id} binds no features (features: []) — a scenario must cover at least ` + - "one feature's flow, or it should be removed.", + message: isGrown + ? `scenario ${s.id} binds no features (features: []) — a grown project's scenario must cover at least ` + + "one feature's flow, or it should be removed." + : `scenario ${s.id} binds no features yet — retained as future onboarding intent; ` + + 'bind it when a matching feature lands.', }); } } diff --git a/src/stages/toolchain/detect.ts b/src/stages/toolchain/detect.ts index ca4de93f..a52a3a5b 100644 --- a/src/stages/toolchain/detect.ts +++ b/src/stages/toolchain/detect.ts @@ -4,9 +4,9 @@ // Cargo.toml → go.mod → pom.xml → build.gradle → composer.json → mix.exs → // .csproj → Gemfile` and returns the first match. Each language has a // curated default per gate (chosen as the *most common* tool, not the only -// one — users override per-stage via `CommandStageOptions`). The TS/JS lint -// gate additionally auto-selects biome/oxlint over the eslint default by -// linter config-file presence (`resolveTsLint`); detection never installs. +// one — users override per-stage via `CommandStageOptions`). For TS/JS, +// explicit package scripts and config files refine those defaults so Cladding +// runs the workflow the project declared; detection never installs. // // This is the polyglot adapter: cladding itself stays language-agnostic; // the *user project* decides which language tools run. @@ -37,6 +37,20 @@ interface Entry { readonly requiresSource?: readonly string[]; } +/** package.json fields that affect TS/JS gate selection. */ +interface PackageManifest { + readonly scripts?: Readonly>; + readonly dependencies?: Readonly>; + readonly devDependencies?: Readonly>; + readonly optionalDependencies?: Readonly>; + readonly peerDependencies?: Readonly>; + readonly eslintConfig?: unknown; + readonly jest?: unknown; +} + +/** npx must resolve only already-installed/cacheable tools and never touch the network. */ +const NPX_LOCAL_ONLY = ['--offline', '--no-install'] as const; + /** * Prefers the committed Gradle wrapper (`./gradlew`) over a bare `gradle` * on PATH. The wrapper pins the Gradle version per project and is the @@ -140,23 +154,23 @@ const CHAIN: readonly Entry[] = [ language: 'typescript', manifests: ['package.json'], gates: { - // --no-install everywhere (0.6.0, battery NOTE 1): a bare `npx tsc` + // --offline + --no-install everywhere: a bare `npx tsc` // AUTO-INSTALLS the typosquat package `tsc@2.0.4` (not TypeScript) on // toolchain-less machines — the gate must never fetch and execute an // unpinned third-party package. Absent tool → npx exits non-zero with // "not found" → the stage's missing-tool classification → skip (exit 2), // which the strict demand table (F-67d2e9) escalates when the spec // relies on the stage. - type: {cmd: 'npx', args: ['--no-install', 'tsc', '--noEmit']}, - lint: {cmd: 'npx', args: ['--no-install', 'eslint', '.']}, - test: {cmd: 'npx', args: ['--no-install', 'vitest', 'run']}, - coverage: {cmd: 'npx', args: ['--no-install', 'vitest', 'run', '--coverage']}, - secret: {cmd: 'npx', args: ['--no-install', 'secretlint', '**/*']}, + type: {cmd: 'npx', args: [...NPX_LOCAL_ONLY, 'tsc', '--noEmit']}, + lint: {cmd: 'npx', args: [...NPX_LOCAL_ONLY, 'eslint', '.']}, + test: {cmd: 'npx', args: [...NPX_LOCAL_ONLY, 'vitest', 'run']}, + coverage: {cmd: 'npx', args: [...NPX_LOCAL_ONLY, 'vitest', 'run', '--coverage']}, + secret: {cmd: 'npx', args: [...NPX_LOCAL_ONLY, 'secretlint', '**/*']}, // .tsx/.jsx/.js alongside .ts so circular-dependency detection covers // React/JSX component trees, not only plain .ts (F-47b8bee5). madge // excludes node_modules by default, so widening extensions does not pull // the dependency tree into the scan. - arch: {cmd: 'npx', args: ['--no-install', 'madge', '--circular', '--extensions', 'ts,tsx,js,jsx', '.']}, + arch: {cmd: 'npx', args: [...NPX_LOCAL_ONLY, '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']}, @@ -313,14 +327,13 @@ function hasExtensionFile(cwd: string, suffix: string): string | undefined { * TypeScript/JavaScript linter resolution by config-file presence (F-b2094740). * * `package.json` maps to one language ('typescript'), but the JS/TS ecosystem - * has several common linters. Rather than hardcode eslint, detect the linter - * the project actually configured and gate with THAT — so a biome/oxlint - * project passes stage_1.2 natively, no eslint shim. Precedence: biome → - * oxlint → eslint (the default, also used when no linter config is present, so - * eslint and config-less projects behave exactly as before). + * has several common linters. Rather than hardcode eslint, run the project's + * explicit `scripts.lint` first, then detect a configured biome/oxlint/eslint. + * With no declaration, omit the gate: a package.json alone is not evidence + * that ESLint is installed or configured. * - * `--no-install` is kept on every gate: detection only decides WHICH tool to - * invoke, it NEVER installs one. A configured-but-absent linter still resolves + * `--offline --no-install` is kept on every gate: detection only decides WHICH + * tool to invoke, it NEVER installs one or contacts a registry. An absent linter resolves * to skip via stage_1.2's missing-tool path (lint.ts), which `--strict`'s * skip-policy escalates when the spec relies on lint. * @@ -331,17 +344,57 @@ function hasExtensionFile(cwd: string, suffix: string): string | undefined { * with a different tool overrides via CommandStageOptions (the cmd/args seam). */ const TS_LINTERS: ReadonlyArray<{readonly configs: readonly string[]; readonly gate: ToolSpec}> = [ - {configs: ['biome.json', 'biome.jsonc'], gate: {cmd: 'npx', args: ['--no-install', 'biome', 'lint', '.']}}, + {configs: ['biome.json', 'biome.jsonc'], gate: {cmd: 'npx', args: [...NPX_LOCAL_ONLY, 'biome', 'lint', '.']}}, // oxlint auto-detects all three filenames in cwd (oxc.rs config reference). - {configs: ['.oxlintrc.json', '.oxlintrc.jsonc', 'oxlint.config.ts'], gate: {cmd: 'npx', args: ['--no-install', 'oxlint']}}, + {configs: ['.oxlintrc.json', '.oxlintrc.jsonc', 'oxlint.config.ts'], gate: {cmd: 'npx', args: [...NPX_LOCAL_ONLY, 'oxlint']}}, +]; + +const ESLINT_CONFIGS: readonly string[] = [ + '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', ]; -/** The project's configured TS/JS lint gate, or `fallback` (eslint) when none. */ -function resolveTsLint(cwd: string, fallback: ToolSpec): ToolSpec { +/** Reads package.json once for gate refinement; malformed input declares nothing. */ +function readPackageManifest(cwd: string): PackageManifest { + try { + return JSON.parse(readFileSync(join(cwd, 'package.json'), 'utf8')) as PackageManifest; + } catch { + return {}; + } +} + +/** True when a non-empty npm script is explicitly declared. */ +function packageScript(pkg: PackageManifest, name: string): string | undefined { + const script = pkg.scripts?.[name]; + return typeof script === 'string' && script.trim().length > 0 ? script.trim() : undefined; +} + +/** True when package.json declares a dependency in any installable section. */ +function hasPackageDependency(pkg: PackageManifest, name: string): boolean { + return [pkg.dependencies, pkg.devDependencies, pkg.optionalDependencies, pkg.peerDependencies] + .some((group) => group?.[name] !== undefined); +} + +/** The project's declared TS/JS lint gate, or undefined when lint is unconfigured. */ +function resolveTsLint(cwd: string, eslintDefault: ToolSpec, pkg: PackageManifest): ToolSpec | undefined { + if (packageScript(pkg, 'lint')) return {cmd: 'npm', args: ['run', '--silent', 'lint']}; for (const linter of TS_LINTERS) { if (linter.configs.some((c) => existsSync(join(cwd, c)))) return linter.gate; } - return fallback; + if (ESLINT_CONFIGS.some((c) => existsSync(join(cwd, c))) || pkg.eslintConfig !== undefined) { + return eslintDefault; + } + return undefined; } /** @@ -350,14 +403,15 @@ function resolveTsLint(cwd: string, fallback: ToolSpec): ToolSpec { * * `package.json` maps to one language, but the test gate defaulted to vitest * unconditionally — so a Jest project (CRA, React Native, classic React) hit - * `npx --no-install vitest`, found nothing, and SILENTLY SKIPPED stage_2.1 / + * the Vitest fallback, found nothing, and SILENTLY SKIPPED stage_2.1 / * stage_2.2. Detect the Jest the project actually configured and gate with - * THAT. Precedence: jest config present → jest; else vitest (the default, also - * used config-less, so vitest and config-less projects behave exactly as - * before). + * THAT. An explicit non-Jest/Vitest `scripts.test` is authoritative and runs + * through npm (preserving build steps and Node's built-in runner); its coverage + * gate exists only when `scripts.coverage` is also declared. Otherwise the + * historical Jest-config → Jest → Vitest-default chain remains intact. * - * `--no-install` is kept: detection only decides WHICH runner to invoke, never - * installs one. A configured-but-absent jest still resolves to skip via the + * `--offline --no-install` is kept: detection only decides WHICH runner to + * invoke, never installs one or contacts a registry. An absent Jest resolves to skip via the * stage's missing-tool path, which `--strict`'s skip-policy escalates. * * CAVEAT — by config PRESENCE, not content (mirrors `resolveTsLint`). A project @@ -369,14 +423,28 @@ const JEST_CONFIGS: readonly string[] = [ ]; /** True when the project configures Jest — a jest.config.* file or a `jest` key in package.json. */ -function hasJestConfig(cwd: string): boolean { +function hasJestConfig(cwd: string, pkg: PackageManifest): boolean { if (JEST_CONFIGS.some((c) => existsSync(join(cwd, c)))) return true; - try { - const pkg = JSON.parse(readFileSync(join(cwd, 'package.json'), 'utf8')) as {jest?: unknown}; - return pkg.jest !== undefined; - } catch { - return false; + return pkg.jest !== undefined; +} + +/** Runner scripts simple enough to preserve the native Vitest/Jest gate path. */ +function simpleTestRunner(script: string): 'vitest' | 'jest' | undefined { + if (/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?vitest(?:\s+run)?$/i.test(script)) { + return 'vitest'; } + if (/^(?:(?:npx|npm exec)\s+(?:--offline\s+)?(?:--no-install\s+)?(?:--\s+)?)?jest$/i.test(script)) { + return 'jest'; + } + return undefined; +} + +/** Drops one optional gate without mutating the curated base object. */ +function withoutGate(base: ToolchainGates, gate: 'lint' | 'coverage'): ToolchainGates { + const rest = {...base}; + if (gate === 'lint') delete rest.lint; + else delete rest.coverage; + return rest; } /** @@ -385,14 +453,38 @@ function hasJestConfig(cwd: string): boolean { * `hasJestConfig`). Other gates pass through unchanged. */ function resolveTsGates(cwd: string, base: ToolchainGates): ToolchainGates { - const out: ToolchainGates = base.lint ? {...base, lint: resolveTsLint(cwd, base.lint)} : {...base}; - if (base.test && base.coverage && hasJestConfig(cwd)) { + const pkg = readPackageManifest(cwd); + const lint = base.lint ? resolveTsLint(cwd, base.lint, pkg) : undefined; + let out: ToolchainGates = lint ? {...base, lint} : withoutGate(base, 'lint'); + const testScript = packageScript(pkg, 'test'); + const runner = testScript ? simpleTestRunner(testScript) : undefined; + + if (testScript && !runner) { + out = withoutGate(out, 'coverage'); + return { + ...out, + test: {cmd: 'npm', args: ['test']}, + ...(packageScript(pkg, 'coverage') + ? {coverage: {cmd: 'npm', args: ['run', '--silent', 'coverage']}} + : {}), + }; + } + + if (runner === 'jest' || (!testScript && hasJestConfig(cwd, pkg))) { return { ...out, - test: {cmd: 'npx', args: ['--no-install', 'jest']}, - coverage: {cmd: 'npx', args: ['--no-install', 'jest', '--coverage']}, + test: {cmd: 'npx', args: [...NPX_LOCAL_ONLY, 'jest']}, + coverage: {cmd: 'npx', args: [...NPX_LOCAL_ONLY, 'jest', '--coverage']}, }; } + + if (runner === 'vitest' && !packageScript(pkg, 'coverage') + && !hasPackageDependency(pkg, '@vitest/coverage-v8') + && !hasPackageDependency(pkg, '@vitest/coverage-istanbul')) { + out = withoutGate(out, 'coverage'); + } else if (runner === 'vitest' && packageScript(pkg, 'coverage')) { + out = {...out, coverage: {cmd: 'npm', args: ['run', '--silent', 'coverage']}}; + } return out; } @@ -426,9 +518,8 @@ export function detectToolchain(cwd: string = '.'): Toolchain { if (entry.requiresSource && !hasSourceFile(cwd, entry.requiresSource)) continue; // Kotlin gates are a function of cwd (gradlew vs gradle); resolve first. const baseGates = typeof entry.gates === 'function' ? entry.gates(cwd) : entry.gates; - // TS/JS: pick the linter (biome/oxlint) and test runner (jest) the project - // configured over the eslint/vitest defaults, so a non-eslint / Jest project - // gates natively. Other languages keep their single curated default. + // TS/JS: prefer declared npm workflows, then configured ecosystem tools. + // Other languages keep their single curated default. const gates = entry.language === 'typescript' ? resolveTsGates(cwd, baseGates) : baseGates; return {language: entry.language, manifest, gates}; } diff --git a/src/stages/unit.ts b/src/stages/unit.ts index c846cc00..bbcabcac 100644 --- a/src/stages/unit.ts +++ b/src/stages/unit.ts @@ -41,6 +41,25 @@ function isVitestRunner(cmd: string, args: readonly string[]): boolean { return cmd === 'vitest' || cmd.endsWith('/vitest') || args.includes('vitest'); } +/** + * Returns true only when a successful runner output definitively reports that + * every aggregate test count was zero. Multiple summaries can occur in npm + * workspaces; any positive count prevents a false alarm. + */ +function reportsZeroExecutedTests(proc: {readonly stdout?: unknown; readonly stderr?: unknown}): boolean { + const output = `${String(proc.stdout ?? '')}\n${String(proc.stderr ?? '')}`; + const counts: number[] = []; + const patterns = [ + /^\s*#\s*tests\s+(\d+)\s*$/gim, + /^\s*ℹ\s+tests\s+(\d+)\s*$/gim, + /^\s*Tests:\s+.*?\b(\d+)\s+total\b.*$/gim, + ]; + for (const pattern of patterns) { + for (const match of output.matchAll(pattern)) counts.push(Number(match[1])); + } + return counts.length > 0 && counts.every((count) => count === 0); +} + /** * Gate-scoped dedup fast path (F-49f6f2d2). On a primed vitest gate, the unit * stage reuses the ONE shared coverage+dual-json vitest run the coverage stage @@ -165,6 +184,14 @@ export function runUnit(opts: UnitStageOptions = {}): StageResult { // ADDITIVE (F-b7873005): on failure, attach structured findings parsed from // the test runner's own output — the raw stderr is preserved unchanged. const base = withFindings('unit', ranToolResult(STAGE, proc), proc); + if (strict && base.pass && reportsZeroExecutedTests(proc)) { + const finding = { + detector: 'VACUOUS_TESTS', + severity: 'error' as const, + message: 'The unit test command exited successfully but reported zero executed tests.', + }; + return {stage: STAGE, pass: false, exitCode: 1, findings: [finding], stderr: finding.message}; + } // Vacuous-test guard (F-b81d203e): only escalate an otherwise-GREEN run — a // failing suite already blocks; a vacuous run exits 0 (skips don't fail) yet // must not read as verified. vacuousDoneFindings is total (never throws). diff --git a/src/stages/util.ts b/src/stages/util.ts index 9ef8d223..4dd2226b 100644 --- a/src/stages/util.ts +++ b/src/stages/util.ts @@ -53,7 +53,7 @@ export function isMissingBinary(proc: {readonly code?: string}): boolean { * ARCHITECTURE_VIOLATION error (breaking the committed A/B report baselines). */ const SCANNER_SETUP_FAILURE = - /config (is |file )?not found|no such file|ENOENT|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i; + /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; export function classifyScannerExit( proc: {readonly exitCode?: number | null; readonly stdout?: unknown; readonly stderr?: unknown}, @@ -75,11 +75,20 @@ export function classifyScannerExit( export function missingToolSkip( stage: string, cmd: string, - proc: {readonly code?: string; readonly exitCode?: number | null}, + proc: { + readonly code?: string; + readonly exitCode?: number | null; + readonly stdout?: unknown; + readonly stderr?: unknown; + }, ): StageResult | null { if (isMissingBinary(proc)) { return {stage, pass: false, exitCode: 2, stderr: `'${cmd}' not installed`}; } + const output = `${String(proc.stderr ?? '')}\n${String(proc.stdout ?? '')}`; + if (cmd === 'npx' && /ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(output)) { + return {stage, pass: false, exitCode: 2, stderr: `'npx' could not resolve the configured tool without installing it`}; + } return null; } diff --git a/tests/cli/setup.test.ts b/tests/cli/setup.test.ts index ea3ab39d..17c70294 100644 --- a/tests/cli/setup.test.ts +++ b/tests/cli/setup.test.ts @@ -1,6 +1,7 @@ // Cladding · project-scoped setup and legacy-global migration tests. import {existsSync, mkdirSync, mkdtempSync, readFileSync, readlinkSync, rmSync, symlinkSync, writeFileSync} from 'node:fs'; +import {spawnSync} from 'node:child_process'; import {tmpdir} from 'node:os'; import {join, resolve} from 'node:path'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; @@ -18,7 +19,7 @@ describe('project-scoped runHostSetup', () => { pkgRoot = mkdtempSync(join(tmpdir(), 'clad-pkg-')); mkdirSync(join(pkgRoot, 'dist'), {recursive: true}); mkdirSync(join(pkgRoot, 'plugins', 'codex', 'skills', 'init'), {recursive: true}); - writeFileSync(join(pkgRoot, 'dist', 'clad.js'), '#!/usr/bin/env node\n'); + writeFileSync(join(pkgRoot, 'dist', 'clad.js'), 'process.stdout.write(JSON.stringify(process.argv.slice(2)));\n'); writeFileSync(join(pkgRoot, 'package.json'), JSON.stringify({name: 'cladding', version: '0.9.0'})); writeFileSync( join(pkgRoot, 'plugins', 'codex', 'skills', 'init', 'SKILL.md'), @@ -70,6 +71,19 @@ describe('project-scoped runHostSetup', () => { expect(runtime).toContain(join(pkgRoot, 'dist', 'clad.js')); }); + test('project runtime pins MCP and shell commands to the same engine', async () => { + await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); + + const runtime = join(project, '.cladding', 'host', 'serve.cjs'); + const mcp = spawnSync(process.execPath, [runtime], {cwd: project, encoding: 'utf8'}); + const cli = spawnSync(process.execPath, [runtime, 'check', '--strict'], {cwd: project, encoding: 'utf8'}); + + expect(mcp.status).toBe(0); + expect(mcp.stdout).toBe('["serve"]'); + expect(cli.status).toBe(0); + expect(cli.stdout).toBe('["check","--strict"]'); + }); + test('is idempotent and stores setup status under the project', async () => { await runHostSetup({home, projectRoot: project, pkgRoot, version: '0.9.0', quiet: true, activate: false}); const second = await runHostSetup({home, projectRoot: project, pkgRoot, version: '0.9.0', quiet: true, activate: false}); diff --git a/tests/init/agents-md.test.ts b/tests/init/agents-md.test.ts index 0365d778..fbba39cb 100644 --- a/tests/init/agents-md.test.ts +++ b/tests/init/agents-md.test.ts @@ -127,6 +127,17 @@ describe('renderAgentsMdManagedBlock — AC-9d3f2e88 (cross-host persona map)', }); }); +describe('renderAgentsMdManagedBlock — post-init command integrity', () => { + test('pins shell commands to the project engine and requires non-vacuous portable tests', () => { + const block = renderAgentsMdManagedBlock(null, '.'); + + expect(block).toContain('node .cladding/host/serve.cjs '); + expect(block).toContain('same engine as MCP'); + expect(block).toContain('confirm it collected relevant tests'); + expect(block).toContain('must not depend on shell-expanded glob patterns'); + }); +}); + describe('renderAgentsMdManagedBlock — AC-4b6c1a97 (graceful degrade, never throws)', () => { test('null spec renders the generic block without throwing', () => { expect(() => renderAgentsMdManagedBlock(null, '.')).not.toThrow(); diff --git a/tests/stages/capabilities-feature-mapping.test.ts b/tests/stages/capabilities-feature-mapping.test.ts index 4a2d2167..d0165650 100644 --- a/tests/stages/capabilities-feature-mapping.test.ts +++ b/tests/stages/capabilities-feature-mapping.test.ts @@ -4,7 +4,7 @@ // `capabilities[].features[]` against Tier A `spec.yaml` feature ids. // Three findings: // - dangling feature id → error -// - orphan capability → warn +// - orphan capability → info while small, warn once grown // - feature without cap → info // // Detector skips silently when capabilities.yaml is missing or @@ -16,7 +16,10 @@ import {tmpdir} from 'node:os'; import {join} from 'node:path'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; -import {capabilitiesFeatureMapping} from '../../src/stages/detectors/capabilities-feature-mapping.js'; +import { + capabilitiesFeatureMapping, + DEFAULT_MIN_FEATURES_FOR_CAPABILITY_BINDINGS, +} from '../../src/stages/detectors/capabilities-feature-mapping.js'; function writeSpec(dir: string, featureIds: readonly string[]): void { const features = featureIds @@ -97,7 +100,7 @@ describe('CAPABILITIES_FEATURE_MAPPING detector', () => { expect(errors[0].message).toContain('does not exist'); }); - test('orphan capability (features: []) → warn finding', () => { + test('orphan capability below the maturity threshold → informational future intent', () => { writeSpec(dir, ['F-001']); writeCapabilities( dir, @@ -112,13 +115,12 @@ describe('CAPABILITIES_FEATURE_MAPPING detector', () => { ].join('\n'), ); const findings = capabilitiesFeatureMapping.run({cwd: dir}); - const warns = findings.filter((f) => f.severity === 'warn'); - expect(warns.length).toBe(1); - expect(warns[0].message).toContain('orphan-cap'); - expect(warns[0].message).toContain('no features mapped'); + const infos = findings.filter((f) => f.severity === 'info'); + expect(infos.length).toBe(2); // orphan capability + F-001 not claimed + expect(infos.some((f) => f.message.includes('orphan-cap') && f.message.includes('future onboarding intent'))).toBe(true); }); - test('capability without features field → warn (treated as orphan)', () => { + test('capability without features field below the threshold → info (treated as future intent)', () => { writeSpec(dir, ['F-001']); writeCapabilities( dir, @@ -132,9 +134,31 @@ describe('CAPABILITIES_FEATURE_MAPPING detector', () => { ].join('\n'), ); const findings = capabilitiesFeatureMapping.run({cwd: dir}); + const infos = findings.filter((f) => f.severity === 'info'); + expect(infos.some((f) => f.message.includes('missing-features-field'))).toBe(true); + }); + + test('orphan capability at the maturity threshold → warn finding', () => { + const ids = Array.from( + {length: DEFAULT_MIN_FEATURES_FOR_CAPABILITY_BINDINGS}, + (_, index) => `F-${String(index + 1).padStart(3, '0')}`, + ); + writeSpec(dir, ids); + writeCapabilities( + dir, + [ + 'schema: "0.1"', + 'source: intent', + 'capabilities:', + ' - id: overdue-binding', + ' features: []', + '', + ].join('\n'), + ); + const findings = capabilitiesFeatureMapping.run({cwd: dir}); const warns = findings.filter((f) => f.severity === 'warn'); - expect(warns.length).toBe(1); - expect(warns[0].message).toContain('missing-features-field'); + expect(warns).toHaveLength(1); + expect(warns[0].message).toContain('overdue-binding'); }); test('feature without capability → info finding', () => { @@ -160,7 +184,7 @@ describe('CAPABILITIES_FEATURE_MAPPING detector', () => { ])); }); - test('mixed findings: orphan + dangling + info', () => { + test('mixed findings: early orphan info + dangling error + unclaimed-feature info', () => { writeSpec(dir, ['F-001', 'F-002']); writeCapabilities( dir, @@ -187,9 +211,9 @@ describe('CAPABILITIES_FEATURE_MAPPING detector', () => { info: findings.filter((f) => f.severity === 'info'), }; expect(bySev.error.length).toBe(1); - expect(bySev.warn.length).toBe(1); - expect(bySev.info.length).toBe(1); // F-002 unclaimed - expect(bySev.info[0].message).toContain('F-002'); + expect(bySev.warn.length).toBe(0); + expect(bySev.info.length).toBe(2); // early orphan + F-002 unclaimed + expect(bySev.info.some((f) => f.message.includes('F-002'))).toBe(true); }); test('malformed YAML → skip silently (other detectors flag corruption)', () => { diff --git a/tests/stages/detectors/deliverable-integrity.test.ts b/tests/stages/detectors/deliverable-integrity.test.ts index 49984226..4f09eda7 100644 --- a/tests/stages/detectors/deliverable-integrity.test.ts +++ b/tests/stages/detectors/deliverable-integrity.test.ts @@ -10,7 +10,10 @@ import {tmpdir} from 'node:os'; import {join} from 'node:path'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; -import {deliverableIntegrity} from '../../../src/stages/detectors/deliverable-integrity.js'; +import { + DEFAULT_MIN_FEATURES_FOR_DELIVERABLE, + deliverableIntegrity, +} from '../../../src/stages/detectors/deliverable-integrity.js'; let dir: string; beforeEach(() => { @@ -20,15 +23,23 @@ afterEach(() => { rmSync(dir, {recursive: true, force: true}); }); -function writeSpec(opts: {deliverable?: string; done?: boolean; modules?: boolean} = {}): void { +function writeSpec(opts: {deliverable?: string; done?: boolean; modules?: boolean; featureCount?: number} = {}): void { const done = opts.done ?? true; const deliverable = opts.deliverable ?? ''; const modules = (opts.modules ?? true) ? ' modules: [src/x.ts]\n' : ''; + const featureCount = opts.featureCount ?? 1; + const features = Array.from({length: featureCount}, (_, index) => + ` - id: F-${String(index + 1).padStart(3, '0')}\n` + + ` title: f${index + 1}\n` + + ` status: ${done ? 'done' : 'planned'}\n` + + modules + + ` acceptance_criteria:\n - id: AC-${String(index + 1).padStart(3, '0')}\n` + + ' ears: ubiquitous\n text: t\n', + ).join(''); writeFileSync( join(dir, 'spec.yaml'), `schema: "0.1"\nproject:\n name: t\n language: typescript\n${deliverable}` + - `features:\n - id: F-001\n title: f\n status: ${done ? 'done' : 'planned'}\n${modules}` + - ' acceptance_criteria:\n - id: AC-001\n ears: ubiquitous\n text: t\n', + `features:\n${features}`, ); } function run(): readonly {detector: string; severity: string; message: string}[] { @@ -36,10 +47,18 @@ function run(): readonly {detector: string; severity: string; message: string}[] } describe('DELIVERABLE_INTEGRITY detector', () => { - test('WARN when done features ship modules but no deliverable is declared', () => { + test('INFO when an early project ships modules before declaring a deliverable', () => { writeSpec(); const findings = run(); expect(findings).toHaveLength(1); + expect(findings[0].severity).toBe('info'); + expect(findings[0].message).toMatch(/ship modules but project.deliverable is not declared/); + }); + + test('WARN once a grown project still ships modules without a deliverable decision', () => { + writeSpec({featureCount: DEFAULT_MIN_FEATURES_FOR_DELIVERABLE}); + const findings = run(); + expect(findings).toHaveLength(1); expect(findings[0].severity).toBe('warn'); expect(findings[0].message).toMatch(/ship modules but project.deliverable is not declared/); }); diff --git a/tests/stages/lint.test.ts b/tests/stages/lint.test.ts index 229b55d7..aad3f3f5 100644 --- a/tests/stages/lint.test.ts +++ b/tests/stages/lint.test.ts @@ -28,6 +28,9 @@ const execaSyncMock = execaMod.execaSync as unknown as ReturnType; describe('runLint (stage_1.2)', () => { let dir: string; + const seedLintProject = () => { + writeFileSync(join(dir, 'package.json'), '{"name":"x","scripts":{"lint":"eslint ."}}\n'); + }; beforeEach(() => { dir = mkdtempSync(join(tmpdir(), 'clad-lint-stage-')); execaSyncMock.mockReset(); @@ -45,8 +48,8 @@ describe('runLint (stage_1.2)', () => { expect(execaSyncMock).not.toHaveBeenCalled(); }); - test('package.json present + tool exits 0 → pass=true', () => { - writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); + test('declared lint workflow + tool exits 0 → pass=true', () => { + seedLintProject(); execaSyncMock.mockReturnValueOnce({exitCode: 0, stdout: '', stderr: ''}); const r = runLint({cwd: dir}); expect(r.pass).toBe(true); @@ -54,7 +57,7 @@ describe('runLint (stage_1.2)', () => { }); test('tool non-zero exit + stderr → pass=false with stderr', () => { - writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); + seedLintProject(); execaSyncMock.mockReturnValueOnce({ exitCode: 1, stdout: '', @@ -66,7 +69,7 @@ describe('runLint (stage_1.2)', () => { }); test('tool non-zero exit + no stderr → pass=false, no stderr field', () => { - writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); + seedLintProject(); execaSyncMock.mockReturnValueOnce({exitCode: 1, stdout: '', stderr: ''}); const r = runLint({cwd: dir}); expect(r.pass).toBe(false); @@ -81,7 +84,7 @@ describe('runLint (stage_1.2)', () => { }); test('null exit code defaults to 1', () => { - writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); + seedLintProject(); execaSyncMock.mockReturnValueOnce({exitCode: null, stdout: '', stderr: 'killed'}); expect(runLint({cwd: dir}).exitCode).toBe(1); }); diff --git a/tests/stages/scenario-coverage.test.ts b/tests/stages/scenario-coverage.test.ts index 29c1c96e..d7dc71a3 100644 --- a/tests/stages/scenario-coverage.test.ts +++ b/tests/stages/scenario-coverage.test.ts @@ -8,9 +8,9 @@ // scenarios, a single WARN fires (the integration tier never started). // Below the threshold the size guard dominates and this check is silent. // -// 2. Unconditional "hollow scenario": for every scenario whose features[] -// binds nothing (`features: []` or absent), one WARN fires regardless of -// feature count — a scenario that names no features is integration theatre. +// 2. Graduated "hollow scenario": an empty onboarding scenario is INFO below +// the threshold and WARN once grown, so future journeys do not block the +// first feature while mature projects cannot leave them unresolved. // // On spec-load failure it emits one `info` finding (the shared withSpec seam, // same policy as STATUS_DRIFT / PLANNED_BACKLOG / HOLLOW_GOVERNANCE). @@ -96,15 +96,15 @@ describe('SCENARIO_COVERAGE detector', () => { expect(scenarioCoverage.run({cwd: dir})).toEqual([]); }); - test('hollow scenario below threshold: 2 features + 1 scenario binding nothing → exactly 1 warn (hollow check only)', () => { + test('hollow scenario below threshold → exactly 1 informational future-intent finding', () => { writeSpec(dir, 2); writeScenario(dir, 1, []); // features: [] → hollow const findings = scenarioCoverage.run({cwd: dir}); // Check 1 cannot fire: only 2 features AND a scenario exists. expect(findings).toHaveLength(1); - expect(findings[0].severity).toBe('warn'); + expect(findings[0].severity).toBe('info'); expect(findings[0].message).toContain('S-001'); - expect(findings[0].message).toContain('binds no features'); + expect(findings[0].message).toContain('future onboarding intent'); expect(findings[0].path).toBe('spec/scenarios/'); }); diff --git a/tests/stages/spec-conformance.test.ts b/tests/stages/spec-conformance.test.ts index aba38049..269707f5 100644 --- a/tests/stages/spec-conformance.test.ts +++ b/tests/stages/spec-conformance.test.ts @@ -77,7 +77,11 @@ describe('runSpecConformance (stage_2.3)', () => { seedOracle(dir); execaSyncMock.mockReturnValueOnce({exitCode: 0, stdout: '', stderr: ''}); runSpecConformance({cwd: dir}); - expect(execaSyncMock).toHaveBeenCalledWith('npx', ['--no-install', 'vitest', 'run', ORACLE_DIR], expect.any(Object)); + expect(execaSyncMock).toHaveBeenCalledWith( + 'npx', + ['--offline', '--no-install', 'vitest', 'run', ORACLE_DIR], + expect.any(Object), + ); }); test('missing runner binary (ENOENT) → skipped, not a false failure', () => { diff --git a/tests/stages/toolchain.test.ts b/tests/stages/toolchain.test.ts index a76f5f68..59fecb89 100644 --- a/tests/stages/toolchain.test.ts +++ b/tests/stages/toolchain.test.ts @@ -121,42 +121,52 @@ describe('detectToolchain', () => { writeFileSync(join(dir, 'biome.json'), '{}'); const tc = detectToolchain(dir); expect(tc.language).toBe('typescript'); - expect(tc.gates.lint).toEqual({cmd: 'npx', args: ['--no-install', 'biome', 'lint', '.']}); + expect(tc.gates.lint).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'biome', 'lint', '.']}); }); test('typescript + .oxlintrc.json → lint gate is oxlint', () => { writeFileSync(join(dir, 'package.json'), '{}'); writeFileSync(join(dir, '.oxlintrc.json'), '{}'); - expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npx', args: ['--no-install', 'oxlint']}); + expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'oxlint']}); }); test('typescript + .oxlintrc.jsonc → lint gate is oxlint', () => { writeFileSync(join(dir, 'package.json'), '{}'); writeFileSync(join(dir, '.oxlintrc.jsonc'), '{}'); - expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npx', args: ['--no-install', 'oxlint']}); + expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'oxlint']}); }); test('typescript + oxlint.config.ts → lint gate is oxlint', () => { writeFileSync(join(dir, 'package.json'), '{}'); writeFileSync(join(dir, 'oxlint.config.ts'), 'export default {}'); - expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npx', args: ['--no-install', 'oxlint']}); + expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'oxlint']}); }); - test('selection follows config presence — add biome.json swaps to biome, remove it falls back to eslint', () => { + test('selection follows declarations — add biome.json enables biome, remove it leaves lint unconfigured', () => { // State-transition: proves resolveTsLint actually reads the filesystem each call, // not a hard-coded return (defeats the one-way-test critique). writeFileSync(join(dir, 'package.json'), '{}'); - const eslintGate = {cmd: 'npx', args: ['--no-install', 'eslint', '.']}; - expect(detectToolchain(dir).gates.lint).toEqual(eslintGate); + expect(detectToolchain(dir).gates.lint).toBeUndefined(); writeFileSync(join(dir, 'biome.json'), '{}'); - expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npx', args: ['--no-install', 'biome', 'lint', '.']}); + expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'biome', 'lint', '.']}); rmSync(join(dir, 'biome.json')); - expect(detectToolchain(dir).gates.lint).toEqual(eslintGate); + expect(detectToolchain(dir).gates.lint).toBeUndefined(); }); - test('typescript with no linter config → lint gate stays eslint (default preserved)', () => { + test('typescript with no lint script or config → lint gate is honestly unconfigured', () => { writeFileSync(join(dir, 'package.json'), '{}'); - expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npx', args: ['--no-install', 'eslint', '.']}); + expect(detectToolchain(dir).gates.lint).toBeUndefined(); + }); + + test('typescript scripts.lint → lint gate runs the exact project-owned workflow', () => { + writeFileSync(join(dir, 'package.json'), '{"scripts":{"lint":"eslint src --max-warnings=0"}}'); + expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npm', args: ['run', '--silent', 'lint']}); + }); + + test('typescript eslint config without lint script → lint gate is eslint', () => { + writeFileSync(join(dir, 'package.json'), '{}'); + writeFileSync(join(dir, 'eslint.config.js'), 'export default []'); + expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'eslint', '.']}); }); test('biome takes precedence over oxlint when both configs present', () => { @@ -170,8 +180,8 @@ describe('detectToolchain', () => { writeFileSync(join(dir, 'package.json'), '{}'); writeFileSync(join(dir, 'biome.json'), '{}'); const tc = detectToolchain(dir); - expect(tc.gates.type).toEqual({cmd: 'npx', args: ['--no-install', 'tsc', '--noEmit']}); - expect(tc.gates.test).toEqual({cmd: 'npx', args: ['--no-install', 'vitest', 'run']}); + expect(tc.gates.type).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'tsc', '--noEmit']}); + expect(tc.gates.test).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'vitest', 'run']}); }); test('biome.json does not leak into a non-TS language', () => { @@ -189,8 +199,8 @@ describe('detectToolchain', () => { writeFileSync(join(dir, 'package.json'), '{}'); writeFileSync(join(dir, 'jest.config.js'), 'module.exports = {}'); const tc = detectToolchain(dir); - expect(tc.gates.test).toEqual({cmd: 'npx', args: ['--no-install', 'jest']}); - expect(tc.gates.coverage).toEqual({cmd: 'npx', args: ['--no-install', 'jest', '--coverage']}); + expect(tc.gates.test).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'jest']}); + expect(tc.gates.coverage).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'jest', '--coverage']}); }); for (const cfg of ['jest.config.ts', 'jest.config.mjs', 'jest.config.cjs', 'jest.config.json']) { @@ -203,24 +213,55 @@ describe('detectToolchain', () => { test('package.json with a top-level "jest" key and no jest.config.* → test gate is jest', () => { writeFileSync(join(dir, 'package.json'), '{"jest":{}}'); - expect(detectToolchain(dir).gates.test).toEqual({cmd: 'npx', args: ['--no-install', 'jest']}); + expect(detectToolchain(dir).gates.test).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'jest']}); }); test('typescript with no jest config → test/coverage stay vitest (default preserved)', () => { writeFileSync(join(dir, 'package.json'), '{}'); const tc = detectToolchain(dir); - expect(tc.gates.test).toEqual({cmd: 'npx', args: ['--no-install', 'vitest', 'run']}); - expect(tc.gates.coverage).toEqual({cmd: 'npx', args: ['--no-install', 'vitest', 'run', '--coverage']}); + expect(tc.gates.test).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'vitest', 'run']}); + expect(tc.gates.coverage).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'vitest', 'run', '--coverage']}); + }); + + test('custom scripts.test → npm test and no assumed coverage runner', () => { + writeFileSync(join(dir, 'package.json'), '{"scripts":{"test":"npm run build && node --test dist/tests/app.test.js"}}'); + const tc = detectToolchain(dir); + expect(tc.gates.test).toEqual({cmd: 'npm', args: ['test']}); + expect(tc.gates.coverage).toBeUndefined(); + }); + + test('custom test and coverage scripts → both exact project-owned workflows', () => { + writeFileSync(join(dir, 'package.json'), '{"scripts":{"test":"node --test","coverage":"c8 npm test"}}'); + const tc = detectToolchain(dir); + expect(tc.gates.test).toEqual({cmd: 'npm', args: ['test']}); + expect(tc.gates.coverage).toEqual({cmd: 'npm', args: ['run', '--silent', 'coverage']}); + }); + + test('simple vitest script without a coverage provider keeps unit native but omits coverage', () => { + writeFileSync(join(dir, 'package.json'), '{"scripts":{"test":"vitest run"},"devDependencies":{"vitest":"^4.0.0"}}'); + const tc = detectToolchain(dir); + expect(tc.gates.test).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'vitest', 'run']}); + expect(tc.gates.coverage).toBeUndefined(); + }); + + test('simple vitest script with a coverage provider preserves the native coverage gate', () => { + writeFileSync(join(dir, 'package.json'), '{"scripts":{"test":"vitest run"},"devDependencies":{"vitest":"^4.0.0","@vitest/coverage-v8":"^4.0.0"}}'); + expect(detectToolchain(dir).gates.coverage).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'vitest', 'run', '--coverage']}); + }); + + test('simple jest script selects jest without requiring a config file', () => { + writeFileSync(join(dir, 'package.json'), '{"scripts":{"test":"jest"}}'); + expect(detectToolchain(dir).gates.test).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'jest']}); }); test('test runner selection follows config presence — add jest.config.js swaps to jest, remove it falls back to vitest', () => { // State-transition: proves the test-runner resolution reads the filesystem each call, // not a hard-coded return. writeFileSync(join(dir, 'package.json'), '{}'); - const vitestGate = {cmd: 'npx', args: ['--no-install', 'vitest', 'run']}; + const vitestGate = {cmd: 'npx', args: ['--offline', '--no-install', 'vitest', 'run']}; expect(detectToolchain(dir).gates.test).toEqual(vitestGate); writeFileSync(join(dir, 'jest.config.js'), 'module.exports = {}'); - expect(detectToolchain(dir).gates.test).toEqual({cmd: 'npx', args: ['--no-install', 'jest']}); + expect(detectToolchain(dir).gates.test).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'jest']}); rmSync(join(dir, 'jest.config.js')); expect(detectToolchain(dir).gates.test).toEqual(vitestGate); }); @@ -236,7 +277,7 @@ describe('detectToolchain', () => { test('typescript arch gate scans ts,tsx,js,jsx extensions', () => { writeFileSync(join(dir, 'package.json'), '{}'); - expect(detectToolchain(dir).gates.arch).toEqual({cmd: 'npx', args: ['--no-install', 'madge', '--circular', '--extensions', 'ts,tsx,js,jsx', '.']}); + expect(detectToolchain(dir).gates.arch).toEqual({cmd: 'npx', args: ['--offline', '--no-install', 'madge', '--circular', '--extensions', 'ts,tsx,js,jsx', '.']}); }); // ─── Swift (SPM) + Flutter/Dart toolchain (F-e4159959) ─── diff --git a/tests/stages/toolchain/scoped-command.test.ts b/tests/stages/toolchain/scoped-command.test.ts index f87f964c..c7b070da 100644 --- a/tests/stages/toolchain/scoped-command.test.ts +++ b/tests/stages/toolchain/scoped-command.test.ts @@ -53,7 +53,7 @@ describe('resolveStageCommand — repo fallback', () => { writeFileSync(join(dir, 'package.json'), '{"name":"x"}'); const r = resolveStageCommand('test', {cwd: dir, focusModules: ['a']}); expect(r.cmd).toBe('npx'); - expect(r.args).toEqual(['--no-install', 'vitest', 'run']); + expect(r.args).toEqual(['--offline', '--no-install', 'vitest', 'run']); }); }); diff --git a/tests/stages/unit.test.ts b/tests/stages/unit.test.ts index 26e0a30f..1e802fbf 100644 --- a/tests/stages/unit.test.ts +++ b/tests/stages/unit.test.ts @@ -71,4 +71,22 @@ describe('runUnit (stage_2.1)', () => { execaSyncMock.mockReturnValueOnce({exitCode: null, stdout: '', stderr: ''}); expect(runUnit({cwd: dir}).exitCode).toBe(1); }); + + test('strict mode rejects a successful runner that definitively reports zero tests', () => { + execaSyncMock.mockReturnValueOnce({exitCode: 0, stdout: '# tests 0\n# pass 0', stderr: ''}); + const r = runUnit({cwd: dir, cmd: 'npm', args: ['test'], strict: true}); + expect(r.pass).toBe(false); + expect(r.exitCode).toBe(1); + expect(r.findings?.[0]?.detector).toBe('VACUOUS_TESTS'); + }); + + test('zero-test summary remains backward-compatible outside strict mode', () => { + execaSyncMock.mockReturnValueOnce({exitCode: 0, stdout: '# tests 0', stderr: ''}); + expect(runUnit({cwd: dir, cmd: 'npm', args: ['test']}).pass).toBe(true); + }); + + test('multiple workspace summaries do not false-fail when any tests executed', () => { + execaSyncMock.mockReturnValueOnce({exitCode: 0, stdout: '# tests 0\n# tests 3', stderr: ''}); + expect(runUnit({cwd: dir, cmd: 'npm', args: ['test'], strict: true}).pass).toBe(true); + }); }); diff --git a/tests/stages/util.test.ts b/tests/stages/util.test.ts index 3d4038f6..3e56b588 100644 --- a/tests/stages/util.test.ts +++ b/tests/stages/util.test.ts @@ -78,6 +78,30 @@ describe('missingToolSkip — ENOENT is the ONLY exit-2 (skip) path', () => { expect(missingToolSkip('stage_x', 'mytool', {exitCode: 1})).toBeNull(); expect(missingToolSkip('stage_x', 'mytool', {exitCode: 0})).toBeNull(); }); + + test('npx refusal under --no-install → skip because the configured tool never ran', () => { + const r = missingToolSkip('stage_x', 'npx', { + exitCode: 1, + stderr: 'npm error npx canceled due to missing packages and no YES option: ["eslint@9"]', + }); + expect(r?.exitCode).toBe(2); + expect(r?.stderr).toContain('could not resolve'); + }); + + test('offline npx cache miss → skip immediately instead of becoming a tool failure', () => { + const r = missingToolSkip('stage_x', 'npx', { + exitCode: 1, + stderr: "npm error code ENOTCACHED\nnpm error cache mode is 'only-if-cached'", + }); + expect(r?.exitCode).toBe(2); + }); + + test('the same text from a project-owned npm script is still a real failure', () => { + expect(missingToolSkip('stage_x', 'npm', { + exitCode: 1, + stderr: 'could not determine executable to run', + })).toBeNull(); + }); }); // Fix ② — a scanner (secretlint / arch validator) that RAN but exited non-zero: @@ -134,4 +158,12 @@ describe('classifyScannerExit — finding vs config/setup gap', () => { ); expect(out[0].severity).toBe('info'); }); + + test('offline npx cache miss → INFO setup gap, never a scanner finding', () => { + const out = classifyScannerExit( + {exitCode: 1, stderr: 'npm error code ENOTCACHED'}, + 'ARCHITECTURE_VIOLATION', found, skipped, + ); + expect(out[0].severity).toBe('info'); + }); }); From de3c3c9272e6cc4431470daab84d23c9b6e17e28 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Thu, 16 Jul 2026 01:12:46 +0900 Subject: [PATCH 22/28] fix: harden project-local onboarding across hosts --- README.ko.md | 9 +- README.md | 11 +- docs/ab-evaluation/case-existing-adoption.md | 10 +- docs/ab-evaluation/case-payment-saas.md | 10 +- docs/dogfood/antigravity-cli-2026-07-15.md | 9 + docs/dogfood/cursor-agent-2026-07-15.md | 20 + docs/dogfood/gemini-cli-2026-07-16.md | 29 + docs/dogfood/matrix.md | 8 +- docs/setup.md | 22 +- docs/ssot-model.md | 4 +- package.json | 4 +- plugins/antigravity/skills/init/SKILL.md | 1 + plugins/claude-code/commands/init.md | 1 + plugins/claude-code/dist/clad.js | 777 +++++++++--------- plugins/claude-code/dist/schema.json | 4 + plugins/codex/skills/init/SKILL.md | 1 + skills/init/SKILL.md | 1 + spec/attestation.yaml | 34 +- spec/features/deliverable-smoke-9064ff.yaml | 10 +- spec/features/host-smoke-matrix-5283985e.yaml | 26 +- .../lint-config-detection-b2094740.yaml | 3 + .../natural-language-init-0f4dd6.yaml | 387 ++++++--- ...no-vacuous-green-gate-contract-af96b1.yaml | 18 + .../scenario-coverage-detector-315fd7.yaml | 10 +- .../spec-conformance-oracle-stage-c4c5ae.yaml | 17 + spec/features/ssot-governance-d12edf.yaml | 3 +- ...chain-jest-and-multiext-arch-47b8bee5.yaml | 10 + .../features/vacuous-test-guard-b81d203e.yaml | 1 + spec/index.yaml | 8 +- src/cli/clad.ts | 13 +- src/cli/doctor-hosts.ts | 49 +- src/cli/init.ts | 1 + src/cli/update.ts | 18 +- src/init/host-setup.ts | 129 ++- src/serve/server.ts | 45 +- src/spec/new.ts | 2 +- src/spec/schema.json | 4 + src/spec/types.ts | 6 + src/stages/cov.ts | 2 +- .../detectors/capabilities-feature-mapping.ts | 23 +- src/stages/detectors/deliverable-integrity.ts | 12 +- src/stages/detectors/scenario-coverage.ts | 23 +- src/stages/detectors/unverified-ac.ts | 19 +- src/stages/lint.ts | 2 +- src/stages/perf.ts | 2 +- src/stages/smoke.ts | 2 +- src/stages/spec-conformance.ts | 114 ++- src/stages/toolchain/gate-config.ts | 52 ++ src/stages/type.ts | 2 +- src/stages/unit.ts | 4 +- src/stages/util.ts | 31 +- src/stages/visual.ts | 2 +- tests/cli/doctor-hosts.test.ts | 78 +- .../init-onboarding-english-source.test.ts | 8 +- tests/cli/setup.test.ts | 125 ++- tests/cli/update.test.ts | 7 +- tests/init/skill-activation.test.ts | 5 + tests/serve/init-tools.test.ts | 1 + tests/serve/server.test.ts | 39 + .../capabilities-feature-mapping.test.ts | 37 +- .../detectors/deliverable-integrity.test.ts | 22 +- tests/stages/scenario-coverage.test.ts | 22 +- tests/stages/spec-conformance.test.ts | 74 +- tests/stages/toolchain/gate-config.test.ts | 33 +- tests/stages/util.test.ts | 24 + 65 files changed, 1785 insertions(+), 695 deletions(-) create mode 100644 docs/dogfood/gemini-cli-2026-07-16.md diff --git a/README.ko.md b/README.ko.md index 1c49464c..eda7c120 100644 --- a/README.ko.md +++ b/README.ko.md @@ -6,7 +6,7 @@

기업이 AI에게 코딩을 맡기려면 세 가지가 필요하다 —
믿을 수 있고, 추적되고, 규모가 커져도 흔들리지 않아야 한다. cladding이 그 셋을 만든다.

- cladding(외장재)이라는 이름 그대로, 호스트 LLM(Claude Code · Codex · Antigravity · Cursor)을 감싼다: 일을 시작하기 전엔 프로젝트의 의도를 넣어 주고, 마친 후엔 41개 검출기와 15단계 게이트로 결과를 검증한다. + cladding(외장재)이라는 이름 그대로, 호스트 LLM(Claude Code · Codex · Gemini · Antigravity · Cursor)을 감싼다: 일을 시작하기 전엔 프로젝트의 의도를 넣어 주고, 마친 후엔 41개 검출기와 15단계 게이트로 결과를 검증한다.

@@ -46,7 +46,7 @@ cladding은 **자기 자신도 cladding으로 만든다** — 기능 254개 중 | **세션을 실패 상태로 끝낼 때** | 그대로 종료, 다음에 잊힘 | 종료를 한 번 막고, 실패한 검사를 수리 카드로 인계 | | **두 명이 동시에 feature 추가** | merge conflict | hash-8 ID · 파일 분리 → 충돌 0 | | **AI가 짠 코드를 누가 검증?** | 작성한 AI가 자기 검증 (위험) | 구현을 못 보는 채점자 + 기계 관문 | -| **AI 도구를 바꿀 때** | 도구마다 재구성 | 1 spec → 4 host 자동 연결 | +| **AI 도구를 바꿀 때** | 도구마다 재구성 | 1 spec → 5 host 자동 연결 | ## 누구를 위한 것 @@ -66,7 +66,7 @@ cladding은 **자기 자신도 cladding으로 만든다** — 기능 254개 중 **후 — 결과를 검증한다:** 15단계 게이트 · 41개 어긋남 검출기 · 그리고 **구현을 못 보는 채점자** — 구현을 읽을 도구 없이 산출물을 스펙과 대조하는 에이전트라, 자기가 쓴 것에 도장을 찍어 줄 수 없다. -실시간 개입(지도 주입 · 즉시 차단 · 종료 차단)은 Claude Code에서 전부 동작한다. Codex · Antigravity · Cursor에서는 같은 검증을 대화 속 도구 호출과 git · CI 관문으로 수행한다. +실시간 개입(지도 주입 · 즉시 차단 · 종료 차단)은 Claude Code에서 전부 동작한다. Codex · Gemini · Antigravity · Cursor에서는 같은 검증을 대화 속 도구 호출과 git · CI 관문으로 수행한다. @@ -257,11 +257,12 @@ clad setup # 이 프로젝트에만 AI 도구 연결 # 정확히 하나를 골라 앞의 '#'을 지우고 실행한다: # codex # Codex # claude # Claude Code +# gemini # Gemini CLI # agy # Antigravity # cursor-agent # Cursor Agent ``` -`clad setup`은 현재 프로젝트에만 Claude Code · Codex · Antigravity · Cursor 연결을 만든다. 설정하지 않은 다른 프로젝트의 모델 컨텍스트에는 Cladding skill이나 MCP 도구가 들어가지 않는다. Cursor IDE는 `` 폴더를 작업공간으로 연다. setup 뒤에는 반드시 이 폴더에서 AI 도구를 새 세션으로 시작한다. Codex가 Git 저장소를 처음 열며 프로젝트 신뢰 여부를 물으면 승인한다. Codex는 신뢰하기 전까지 프로젝트 MCP 설정을 의도적으로 무시한다. +`clad setup`은 현재 프로젝트에만 Claude Code · Codex · Gemini · Antigravity · Cursor 연결을 만든다. 설정하지 않은 다른 프로젝트의 모델 컨텍스트에는 Cladding skill이나 MCP 도구가 들어가지 않는다. Cursor IDE는 `` 폴더를 작업공간으로 연다. setup 뒤에는 반드시 이 폴더에서 AI 도구를 새 세션으로 시작한다. Codex와 Gemini가 프로젝트 신뢰 여부를 물으면 각 호스트의 정상 보안 경계에 따라 승인한다. 신뢰하기 전에는 프로젝트 로컬 MCP 설정이 의도적으로 적용되지 않는다. ### 3. 프로젝트에 Cladding 한 번 적용하기 diff --git a/README.md b/README.md index 211fb17d..c53fc171 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@

To trust AI with coding, an organization needs three things — that the code can be trusted,
that it's traced, and that it holds up as you scale. cladding builds those three.

- True to its name (cladding = the outer layer), it wraps your host LLM (Claude Code · Codex · Antigravity · Cursor): before it starts, cladding feeds it the project's intent; after it finishes, cladding verifies the result with 41 detectors and a 15-stage gate. + True to its name (cladding = the outer layer), it wraps your host LLM (Claude Code · Codex · Gemini · Antigravity · Cursor): before it starts, cladding feeds it the project's intent; after it finishes, cladding verifies the result with 41 detectors and a 15-stage gate.

@@ -46,7 +46,7 @@ The same situation, in a *vanilla AI setup* and in cladding. | **Ending a session in a failing state** | exits as-is, forgotten next time | the exit is blocked once, the failing checks handed off as a repair card | | **Two devs add a feature at the same time** | merge conflict | hash-8 IDs · separate files → 0 conflicts | | **Who verifies the AI-written code?** | the AI that wrote it self-certifies (risky) | an implementation-blind grader + the mechanical gate | -| **Switching AI tools** | reconfigure per tool | one spec → 4 hosts wired automatically | +| **Switching AI tools** | reconfigure per tool | one spec → 5 hosts wired automatically | ## Who it's for @@ -66,7 +66,7 @@ The same situation, in a *vanilla AI setup* and in cladding. **After — verify the result:** the 15-stage gate, 41 drift detectors, and an **implementation-blind grader** — an agent that checks the work against the spec *with no tool to read the implementation*, so it can't rubber-stamp what it wrote. -Real-time intervention (map injection · instant block · stop-block) runs fully on Claude Code. On Codex · Antigravity · Cursor the same verification runs through in-conversation tool calls plus the git · CI gate. +Real-time intervention (map injection · instant block · stop-block) runs fully on Claude Code. On Codex · Gemini · Antigravity · Cursor the same verification runs through in-conversation tool calls plus the git · CI gate. @@ -254,11 +254,12 @@ clad setup # connect Cladding only to this project # Choose exactly one and remove its leading '#': # codex # Codex # claude # Claude Code +# gemini # Gemini CLI # agy # Antigravity # cursor-agent # Cursor Agent ``` -`clad setup` creates project-local connections for Claude Code, Codex, Antigravity, and Cursor. It +`clad setup` creates project-local connections for Claude Code, Codex, Gemini, Antigravity, and Cursor. It does not expose Cladding skills or MCP tools in projects where setup was not run. Use only the command for your AI tool; for Cursor IDE, open `` as the workspace. Start a new AI session from this folder after setup so the host discovers the project-local connection. When Codex first opens a Git @@ -306,7 +307,7 @@ Implement email sign-in, including tests. There is nothing new to memorize. For host-specific invocation, stricter Git/CI enforcement, and verified host status, see [setup details](docs/setup.md). - + diff --git a/docs/ab-evaluation/case-existing-adoption.md b/docs/ab-evaluation/case-existing-adoption.md index c28b54a5..54cd6394 100644 --- a/docs/ab-evaluation/case-existing-adoption.md +++ b/docs/ab-evaluation/case-existing-adoption.md @@ -51,8 +51,8 @@ No spec, no architecture invariants — just code on the existing tree. | Test files | 1 | 1 | +0 | | Test LoC | 14 | 14 | +0 | | Test cases | 1 | 1 | +0 | -| Total chars (artifacts + code) | 11242 | 3864 | +7378 | -| Estimated tokens | 2813 | 967 | +1846 | +| Total chars (artifacts + code) | 11268 | 3864 | +7404 | +| Estimated tokens | 2819 | 967 | +1852 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -90,8 +90,8 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 | Test files | 2 | 2 | +0 | | Test LoC | 27 | 27 | +0 | | Test cases | 3 | 3 | +0 | -| Total chars (artifacts + code) | 12785 | 5115 | +7670 | -| Estimated tokens | 3199 | 1280 | +1919 | +| Total chars (artifacts + code) | 12811 | 5115 | +7696 | +| Estimated tokens | 3205 | 1280 | +1925 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -111,7 +111,7 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 - **Spec ↔ code traceability**: cladding emits 1 feature(s), 2 AC(s), 1 scenario(s), 3 capability(s); vanilla has 0 of each. - **Architecture enforcement**: cladding declares 3 layer(s) with 0 forbidden-import rule(s); vanilla has 0. - **Detector behavior**: cladding-managed tree → 1 error(s) / 1 warn(s) / 11 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 ~3199 tokens vs vanilla's ~1280 (heuristic chars/4) — Δ ≈ 1919 tokens, the price of structure. +- **Token cost**: cladding's cumulative artifact + code consumes ~3205 tokens vs vanilla's ~1280 (heuristic chars/4) — Δ ≈ 1925 tokens, the price of structure. - **Code surface**: vanilla writes 9 source file(s) / 144 LoC + 2 test file(s) / 3 test case(s); cladding writes 9 / 128 + 2 / 3. (Vanilla front-loads code, cladding front-loads spec — both converge by M2.) ## Outcome Quality (F-ba2e05) diff --git a/docs/ab-evaluation/case-payment-saas.md b/docs/ab-evaluation/case-payment-saas.md index 2343015f..549a169b 100644 --- a/docs/ab-evaluation/case-payment-saas.md +++ b/docs/ab-evaluation/case-payment-saas.md @@ -50,8 +50,8 @@ no spec, no scenarios, no architecture invariants. | Test files | 0 | 1 | -1 | | Test LoC | 0 | 20 | -20 | | Test cases | 0 | 2 | -2 | -| Total chars (artifacts + code) | 6682 | 3463 | +3219 | -| Estimated tokens | 1672 | 867 | +805 | +| Total chars (artifacts + code) | 6708 | 3463 | +3245 | +| Estimated tokens | 1679 | 867 | +812 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -89,8 +89,8 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 | Test files | 1 | 2 | -1 | | Test LoC | 8 | 33 | -25 | | Test cases | 1 | 4 | -3 | -| Total chars (artifacts + code) | 7846 | 5592 | +2254 | -| Estimated tokens | 1963 | 1399 | +564 | +| Total chars (artifacts + code) | 7872 | 5592 | +2280 | +| Estimated tokens | 1970 | 1399 | +571 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -110,7 +110,7 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 - **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. -- **Token cost**: cladding's cumulative artifact + code consumes ~1963 tokens vs vanilla's ~1399 (heuristic chars/4) — Δ ≈ 564 tokens, the price of structure. +- **Token cost**: cladding's cumulative artifact + code consumes ~1970 tokens vs vanilla's ~1399 (heuristic chars/4) — Δ ≈ 571 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.) ## Outcome Quality (F-ba2e05) diff --git a/docs/dogfood/antigravity-cli-2026-07-15.md b/docs/dogfood/antigravity-cli-2026-07-15.md index 3cd161a4..1742370a 100644 --- a/docs/dogfood/antigravity-cli-2026-07-15.md +++ b/docs/dogfood/antigravity-cli-2026-07-15.md @@ -15,3 +15,12 @@ The legacy 0.8.3 global plugin was backed up and temporarily disabled so it coul | Existing code | existing-adoption initialized while preserving source and tests | All three initialization cases passed `clad sync`, left no staged cache after apply, and wrote no authored onboarding artifact before approval. + +## Post-initialization ordinary development + +- Isolation: Antigravity kept its authenticated HOME, but the imported user-global Cladding plugin was disabled and all 25 user-global `cladding-*` skill links were moved to a temporary backup for the live run. The active count was independently observed as zero; the trap restored all 25 links and re-enabled the plugin afterward. +- Live task: the host added the **Note favorites** feature using only the initialized project's `AGENTS.md`, MCP configuration, init skill, and runtime launcher. The main conversation was `480c524f-6b7e-40e3-a8c5-342409f63648`, and the process exited normally. +- Independent contexts: conversation `50cdbfb0-39e2-4e05-bd89-a56a9c071ab9` authored the tests, and conversation `e65fbd5d-ee3a-4ac8-9070-bd5c4c571cb5` performed the final review. The reviewer approved the result. +- Design and completion: the feature was classified additive, linked to the note-favorites capability and the find-and-manage-note journey, and marked done through the project-local completion command. +- Test collection: `npm test` used the explicit paths `dist/tests/noteArchive.test.js` and `dist/tests/noteFavorites.test.js`; 12/12 tests passed. The same paths passed 12/12 under an independently selected Node 20 runtime. +- Clean gate: the host created implementation, attestation, and completion commits (`3d19430`, `d90f31d`, `23bd356`). An independent strict check passed every configured stage on a clean tree, and `git diff --check` reported no whitespace errors. diff --git a/docs/dogfood/cursor-agent-2026-07-15.md b/docs/dogfood/cursor-agent-2026-07-15.md index c5dc42b2..6bbe22b9 100644 --- a/docs/dogfood/cursor-agent-2026-07-15.md +++ b/docs/dogfood/cursor-agent-2026-07-15.md @@ -14,3 +14,23 @@ | Existing code | existing-adoption initialized while preserving source and tests | All three initialization cases passed `clad sync`, left no staged cache after apply, and wrote no authored onboarding artifact before approval. + +## Post-initialization ordinary development + +- Isolation: a fresh HOME contained no user-global Cladding skills; Cursor authentication was passed to the process through its memory-only credential store. The project-local MCP launcher and generated `AGENTS.md` were the only Cladding guidance. +- Live task: the host added the **Note reminders** feature, kept the capability, journey, project context, and feature shard aligned, and exited normally (session `e23c4638-ec07-40c6-a325-913bc5162fbd`). +- Independent contexts: Cursor created one blind test-author transcript and one read-only reviewer transcript. The reviewer approved all six acceptance behaviors and the design linkage. +- Test collection: `npm test` used the explicit paths `dist/tests/noteArchive.test.js` and `dist/tests/noteReminders.test.js`; 13/13 tests passed. The same two paths passed 13/13 under an independently selected Node 20 runtime. +- Completion: the feature completion command marked **Note reminders** done. The host left its changes uncommitted, so an immediate project-wide strict check reported only the expected dirty-tree finding; after an evidence-only commit (`a735825`), all configured stages passed and the tree was clean. +- Diff hygiene: `git diff --check` passed, and the final package script contained no shell-expanded glob. + +## Project permission follow-up + +The setup path now writes `.cursor/cli.json` with exact allow entries for only +`clad_list_features`, `clad_get_feature`, and `clad_run_check`. Cursor's own +configuration parser accepted the file, `cursor-agent mcp list` reported +`cladding: ready`, and `cursor-agent mcp list-tools cladding` returned all 22 +tools. The three exact entries let the doctor remain in read-only ask mode; +write-capable Cladding tools are not allowlisted. A model-backed replay of that +permission correction remains pending because the account usage limit was +reached first. diff --git a/docs/dogfood/gemini-cli-2026-07-16.md b/docs/dogfood/gemini-cli-2026-07-16.md new file mode 100644 index 00000000..4971ec19 --- /dev/null +++ b/docs/dogfood/gemini-cli-2026-07-16.md @@ -0,0 +1,29 @@ +# Gemini CLI project-local setup verification — 2026-07-16 + +- Host: Gemini CLI `0.42.0` +- Isolation: temporary HOME with no user-global Cladding extension or skill +- Transport: project `.gemini/settings.json` → project `.cladding/host/serve.cjs` +- Skill: project `.agents/skills/cladding-init/SKILL.md` +- Result: project-local discovery and MCP connectivity verified; model surfaces not-run + +`clad setup --host gemini` was run from a temporary Git project. It created the +Gemini settings file and shared project skill under that project, while the +isolated HOME remained free of Cladding configuration. Gemini reported +`cladding-init` enabled from `.agents/skills` and reported the `cladding` stdio +server connected through `.cladding/host/serve.cjs`. + +The headless probe command uses Gemini Plan Mode plus the ignored project policy +`.cladding/host/gemini-doctor-policy.toml`. That policy matches the `cladding` +server, the three doctor tools, and their `readOnlyHint`; it does not enable +YOLO mode. Gemini accepted the policy arguments before reaching its account +precondition. + +The model-backed probes could not run under the available Google login. Gemini +returned `IneligibleTierError` with `UNSUPPORTED_CLIENT` and directed the account +to Antigravity before any Cladding tool call occurred. No API-key environment +variable was available. Those surfaces are therefore recorded as `not-run`, not +as a pass and not as a project-wiring failure. + +This supersedes the old global-extension setup recipe for current installation +guidance. The earlier report remains only as historical evidence; current setup +is project-scoped. diff --git a/docs/dogfood/matrix.md b/docs/dogfood/matrix.md index a733060c..fe517950 100644 --- a/docs/dogfood/matrix.md +++ b/docs/dogfood/matrix.md @@ -1,14 +1,15 @@ # Host support matrix - + - Cladding version: `0.8.3` -- Generated: 2026-07-15T12:03:31+09:00 +- Generated: 2026-07-16T00:52:17+09:00 | Host | list-features | get-feature | run-check | wiring | Grade | |---|---|---|---|---|---| | claude | pass | pass | pass | — | verified | +| gemini | — | — | — | — | not-run | | antigravity | pass | pass | pass | pass | verified | | codex | pass | pass | pass | — | verified | | cursor | pass | pass | pass | pass | verified | @@ -22,8 +23,9 @@ **Why not-run / fail** - `claude`: doctor surfaces remain verified from the prior campaign; the 2026-07-15 onboarding rerun was blocked by host quota. +- `gemini`: isolated project-local skill discovery and MCP connectivity passed, but the current Google account returned `UNSUPPORTED_CLIENT` before a model prompt could run; see `gemini-cli-2026-07-16.md`. - `antigravity`: project-scoped onboarding campaign passed; see `antigravity-cli-2026-07-15.md`. - `codex`: project-scoped onboarding and all three surfaces passed; see `codex-cli-2026-07-15.md`. -- `cursor`: project-scoped onboarding campaign passed; see `cursor-agent-2026-07-15.md`. +- `cursor`: project-scoped onboarding and ordinary development passed in the recorded campaign; the account usage limit was reached before the corrected project read-only allowlist could be model-replayed, so no newer pass replaces that evidence. See `cursor-agent-2026-07-15.md`. > Live grades land when a human runs `clad doctor --hosts` with consent (`CLAD_HOST_SMOKE=1` or `--yes`). Without consent this baseline records only what is checkable for free — Cursor wiring — and leaves all LLM-driven surfaces `not-run`. diff --git a/docs/setup.md b/docs/setup.md index be19392b..8d500886 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -13,19 +13,31 @@ the detail behind them: where each host is wired, how the MCP server works, and |---|---| | Claude Code | `.claude/skills/cladding-init` + `.mcp.json` | | Codex CLI | `.agents/skills/cladding-init` + `.codex/config.toml` | +| Gemini CLI | `.agents/skills/cladding-init` + `.gemini/settings.json` | | Antigravity (`agy`) | `.agents/skills/cladding-init` + `.agents/mcp_config.json` | -| Cursor | `.cursor/skills/cladding-init` + `.cursor/mcp.json` + bootstrap rule | +| Cursor | `.cursor/skills/cladding-init` + `.cursor/mcp.json` + `.cursor/cli.json` read-only tool allowlist + bootstrap rule | The only machine-specific path lives in `.cladding/host/serve.cjs`, which is ignored project runtime state. Re-run setup on each developer machine. Host config files use the portable relative launcher path and preserve unrelated entries. With no arguments the launcher starts MCP; with arguments it forwards a normal CLI command to that exact same engine. Generated project guidance therefore uses `node .cladding/host/serve.cjs check --strict` and similar shell calls when the launcher exists, preventing a different global installation from silently validating the project with another build. Codex loads `.codex/config.toml` only for a trusted Git repository. Accept Codex's normal project-trust prompt when opening the repository; this is a Codex security boundary and `clad setup` does not bypass or pre-approve it. +Gemini likewise loads project skills and settings only after its normal folder-trust boundary is satisfied. Interactive use keeps that prompt intact; the explicitly consented doctor smoke uses Gemini's session-only trust override so a fresh verification fixture can exercise the project-local MCP connection without changing persistent trust settings. +That smoke stays in Gemini Plan Mode and loads an ignored project policy permitting only the three +annotated read-only doctor tools; it does not enable YOLO mode. + +Cursor's project CLI configuration allowlists only the three read-only doctor tools. It does not +add a server-wide wildcard, and it preserves unrelated project allow/deny entries; write-capable +Cladding tools retain Cursor's normal approval boundary. + On upgrade, setup removes legacy global Cladding wires only when their ownership is provable. Ambiguous or hand-edited files are preserved and reported. If an old Claude user plugin remains, run `claude plugin uninstall claude-code@cladding --scope user --keep-data`. **Verification level (honesty note).** Claude Code's MCP/runtime surfaces and real-time intervention are verified through earlier real-usage campaigns; the natural-language onboarding flow introduced in this release could not be re-run because the logged-in host reported its weekly quota exhausted; project MCP handshake and tool discovery passed, but onboarding remains pending. +Gemini's project-local skill discovery and MCP connection passed in an isolated HOME, but the +available Google login was rejected before a model prompt could run, so its model surfaces remain +`not-run` rather than being promoted from structural evidence. Codex CLI `0.144.3` is live-verified for idea, planning-document, existing-project, uninitialized controls, and all three doctor surfaces. Antigravity `1.1.2` is live-verified for all three onboarding cases plus both controls after disabling the legacy global plugin. Cursor Agent @@ -37,7 +49,7 @@ not every release-specific onboarding campaign.) ## About the MCP server -All 4 hosts wire cladding as an MCP server — only the wire *location* differs. MCP is not +All 5 hosts wire cladding as an MCP server — only the wire *location* differs. MCP is not something you invoke directly and there is no manual connect step. A host may provide an `/mcp` diagnostic view, but normal use starts by asking the AI to apply Cladding to the open project. @@ -59,6 +71,7 @@ project, asking about Cladding, or running `clad setup` are not consent. |---|---|---| | Claude Code | `Apply Cladding to this project` | `/cladding:init` | | Codex | `Apply Cladding to this project` | Type `$cladding`, then choose `init (cladding)` | +| Gemini CLI | `Apply Cladding to this project` | Select the project-local `cladding-init` skill | | Antigravity | `Apply Cladding to this project` | Select the project-local `cladding-init` skill | | Cursor IDE / Agent | `Apply Cladding to this project` | Natural language routes through the connected onboarding tool | @@ -71,6 +84,7 @@ clad update # 3. refresh project wiring + derived state ``` Your authored code, feature/spec content, and documentation are preserved. The command may refresh -derived inventory/index data and the Cladding-managed block in `AGENTS.md`. Existing `CLAUDE.md` -files are preserved and Cladding does not create a new one. If the +derived inventory/index data and the Cladding-managed blocks in `AGENTS.md` and `CLAUDE.md`. +Onboarding itself does not create or change `CLAUDE.md`; the update command retains its established +Claude-specific refresh for existing users while preserving their prose. If the newer version is stricter, it only **points out** drift — it does not rewrite authored project intent. diff --git a/docs/ssot-model.md b/docs/ssot-model.md index d660a5fa..1626d26e 100644 --- a/docs/ssot-model.md +++ b/docs/ssot-model.md @@ -188,13 +188,13 @@ Detector-enforced (today + this cycle): - `REFERENCE_INTEGRITY`: scenario `features[]`, feature `depends_on[]`, `superseded_by` resolve (existence) - `HARNESS_INTEGRITY`: plugin manifest version sync, detector count - **`CAPABILITIES_FEATURE_MAPPING` (NEW v0.3.45)**: capability `features[]` resolve to real features; - unbound onboarding capabilities are informational below eight features and graduate to warnings once the project is grown + unbound capabilities remain warnings unless the project carries Cladding's onboarding-seeded marker; marked seeds are informational below eight features and graduate to warnings once the project is grown - **`INVENTORY_DRIFT` (v0.4.x)**: the `inventory:` counts match the on-disk shard reality - **`PLANNED_BACKLOG` (v0.4.x)**: too many `planned`/`in_progress` features with no code on disk (the spec racing ahead of the code) - **`HOLLOW_GOVERNANCE` (v0.4.x, J1)**: a grown project with a present-but-empty `capabilities`/`architecture` design tier - **`DEPENDENCY_CYCLE` (v0.4.x, J3)**: `features[].depends_on` is acyclic (pairs with `REFERENCE_INTEGRITY`'s existence check) - **`AI_HINTS_FORBIDDEN_PATTERN` (v0.3.57)**: code avoids `ai_hints.forbidden_patterns` -- **`SCENARIO_COVERAGE` (v0.4.x, S-b)**: a grown project declares ≥1 scenario, no grown-project scenario binds an empty `features[]`, and no scenario under-states its coverage (its `flow` names a feature slug it doesn't bind); empty onboarding journeys stay informational below eight features +- **`SCENARIO_COVERAGE` (v0.4.x, S-b)**: a grown project declares ≥1 scenario, no grown-project scenario binds an empty `features[]`, and no scenario under-states its coverage (its `flow` names a feature slug it doesn't bind); only explicitly marked onboarding journeys stay informational below eight features, while unmarked projects keep the established warning - **`PROJECT_CONTEXT_DRIFT` (v0.4.x, S-c)**: a grown project's `project-context.md` is not still the unrefined init template Detector-enforced (deferred to future cycles): diff --git a/package.json b/package.json index 053c67bc..0a864023 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cladding", "version": "0.8.3", - "description": "Spec-driven verification layer for AI coding agents — Claude Code · Codex · Antigravity · Cursor. Intent in before it writes, result verified against your spec after. Reference implementation of the Ironclad standard.", + "description": "Spec-driven verification layer for AI coding agents — Claude Code · Codex · Gemini · Antigravity · Cursor. Intent in before it writes, result verified against your spec after. Reference implementation of the Ironclad standard.", "type": "module", "license": "MIT", "author": "qwerfunch", @@ -18,7 +18,7 @@ "spec-driven-development", "governance", "ironclad", "drift-detection", "multi-agent", "loop-engineering", "verification", "ai-coding", "compliance", "architecture-enforcement", - "claude-code", "codex-cli", "antigravity-cli", "cursor", + "claude-code", "codex-cli", "gemini-cli", "antigravity-cli", "cursor", "mcp-server", "claude-code-plugin" ], "bin": { diff --git a/plugins/antigravity/skills/init/SKILL.md b/plugins/antigravity/skills/init/SKILL.md index 1bdbfcaa..1de064d0 100644 --- a/plugins/antigravity/skills/init/SKILL.md +++ b/plugins/antigravity/skills/init/SKILL.md @@ -1,4 +1,5 @@ --- +name: init description: Use only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it; never use for an ordinary project creation or implementation request. Scaffold from an idea, planning document, or existing project through the MCP prepare/apply flow. --- diff --git a/plugins/claude-code/commands/init.md b/plugins/claude-code/commands/init.md index 1bdbfcaa..1de064d0 100644 --- a/plugins/claude-code/commands/init.md +++ b/plugins/claude-code/commands/init.md @@ -1,4 +1,5 @@ --- +name: init description: Use only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it; never use for an ordinary project creation or implementation request. Scaffold from an idea, planning document, or existing project through the MCP prepare/apply flow. --- diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 0e6129f8..33851346 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 _de=Object.create;var yA=Object.defineProperty;var bde=Object.getOwnPropertyDescriptor;var vde=Object.getOwnPropertyNames;var Sde=Object.getPrototypeOf,wde=Object.prototype.hasOwnProperty;var He=(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)yA(t,r,{get:e[r],enumerable:!0})},xde=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of vde(e))!wde.call(t,i)&&i!==r&&yA(t,i,{get:()=>e[i],enumerable:!(n=bde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?_de(Sde(t)):{},xde(e||!t||!t.__esModule?yA(r,"default",{value:t,enumerable:!0}):r,t));var Kd=v(bA=>{var cy=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}},_A=class extends cy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};bA.CommanderError=cy;bA.InvalidArgumentError=_A});var ly=v(SA=>{var{InvalidArgumentError:$de}=Kd(),vA=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 $de(`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 kde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}SA.Argument=vA;SA.humanReadableArgName=kde});var $A=v(xA=>{var{humanReadableArgName:Ede}=ly(),wA=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=>Ede(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 Jq(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)wA(t,r,{get:e[r],enumerable:!0})},Dde=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ide(e))!Cde.call(t,i)&&i!==r&&wA(t,i,{get:()=>e[i],enumerable:!(n=Rde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Ode(Pde(t)):{},Dde(e||!t||!t.__esModule?wA(r,"default",{value:t,enumerable:!0}):r,t));var Qd=v($A=>{var fy=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}},xA=class extends fy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};$A.CommanderError=fy;$A.InvalidArgumentError=xA});var py=v(EA=>{var{InvalidArgumentError:Nde}=Qd(),kA=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 Nde(`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 jde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}EA.Argument=kA;EA.humanReadableArgName=jde});var OA=v(TA=>{var{humanReadableArgName:Mde}=py(),AA=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=>Mde(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 r4(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 Jq(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}xA.Help=wA;xA.stripColor=Jq});var TA=v(AA=>{var{InvalidArgumentError:Ade}=Kd(),kA=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=Tde(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 Ade(`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?Yq(this.name().replace(/^no-/,"")):Yq(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}},EA=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 Yq(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Tde(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 r4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}TA.Help=AA;TA.stripColor=r4});var CA=v(PA=>{var{InvalidArgumentError:Fde}=Qd(),RA=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=Lde(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 Fde(`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?n4(this.name().replace(/^no-/,"")):n4(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}},IA=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 n4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Lde(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}}AA.Option=kA;AA.DualOptions=EA});var Qq=v(Xq=>{function Ode(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 Rde(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=Ode(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}}PA.Option=RA;PA.DualOptions=IA});var o4=v(i4=>{function zde(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 Ude(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=zde(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]}?)`:""}Xq.suggestSimilar=Rde});var n4=v(CA=>{var Ide=He("node:events").EventEmitter,OA=He("node:child_process"),co=He("node:path"),uy=He("node:fs"),Ue=He("node:process"),{Argument:Pde,humanReadableArgName:Cde}=ly(),{CommanderError:RA}=Kd(),{Help:Dde,stripColor:Nde}=$A(),{Option:e4,DualOptions:jde}=TA(),{suggestSimilar:t4}=Qq(),IA=class t extends Ide{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>PA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>PA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Nde(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 Dde,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 Pde(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 RA(e,r,n)),Ue.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 e4(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 e4)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(uy.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]}?)`:""}i4.suggestSimilar=Ude});var l4=v(FA=>{var qde=Ge("node:events").EventEmitter,DA=Ge("node:child_process"),lo=Ge("node:path"),my=Ge("node:fs"),Ue=Ge("node:process"),{Argument:Bde,humanReadableArgName:Hde}=py(),{CommanderError:NA}=Qd(),{Help:Gde,stripColor:Zde}=OA(),{Option:s4,DualOptions:Vde}=CA(),{suggestSimilar:a4}=o4(),jA=class t extends qde{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>MA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>MA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Zde(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 Gde,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 Bde(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 NA(e,r,n)),Ue.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 s4(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 s4)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(my.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=co.resolve(u,d);if(uy.existsSync(f))return f;if(i.includes(co.extname(d)))return;let p=i.find(m=>uy.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=uy.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=co.resolve(co.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=co.basename(this._scriptPath,co.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(co.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=r4(Ue.execArgv).concat(r),c=OA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=OA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=r4(Ue.execArgv).concat(r),c=OA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 RA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new RA(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=lo.resolve(u,d);if(my.existsSync(f))return f;if(i.includes(lo.extname(d)))return;let p=i.find(m=>my.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=my.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=lo.resolve(lo.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=lo.basename(this._scriptPath,lo.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(lo.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=c4(Ue.execArgv).concat(r),c=DA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=DA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=c4(Ue.execArgv).concat(r),c=DA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 NA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new NA(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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new jde(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=t4(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=t4(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=>Cde(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=co.basename(e,co.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(Ue.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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Vde(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=a4(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=a4(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=>Hde(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=lo.basename(e,lo.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(Ue.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 r4(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 PA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}CA.Command=IA;CA.useColor=PA});var a4=v(xn=>{var{Argument:i4}=ly(),{Command:DA}=n4(),{CommanderError:Mde,InvalidArgumentError:o4}=Kd(),{Help:Fde}=$A(),{Option:s4}=TA();xn.program=new DA;xn.createCommand=t=>new DA(t);xn.createOption=(t,e)=>new s4(t,e);xn.createArgument=(t,e)=>new i4(t,e);xn.Command=DA;xn.Option=s4;xn.Argument=i4;xn.Help=Fde;xn.CommanderError=Mde;xn.InvalidArgumentError=o4;xn.InvalidOptionArgumentError=o4});var Ce=v(Xt=>{"use strict";var jA=Symbol.for("yaml.alias"),d4=Symbol.for("yaml.document"),dy=Symbol.for("yaml.map"),f4=Symbol.for("yaml.pair"),MA=Symbol.for("yaml.scalar"),fy=Symbol.for("yaml.seq"),lo=Symbol.for("yaml.node.type"),Hde=t=>!!t&&typeof t=="object"&&t[lo]===jA,Gde=t=>!!t&&typeof t=="object"&&t[lo]===d4,Zde=t=>!!t&&typeof t=="object"&&t[lo]===dy,Vde=t=>!!t&&typeof t=="object"&&t[lo]===f4,p4=t=>!!t&&typeof t=="object"&&t[lo]===MA,Wde=t=>!!t&&typeof t=="object"&&t[lo]===fy;function m4(t){if(t&&typeof t=="object")switch(t[lo]){case dy:case fy:return!0}return!1}function Kde(t){if(t&&typeof t=="object")switch(t[lo]){case jA:case dy:case MA:case fy:return!0}return!1}var Jde=t=>(p4(t)||m4(t))&&!!t.anchor;Xt.ALIAS=jA;Xt.DOC=d4;Xt.MAP=dy;Xt.NODE_TYPE=lo;Xt.PAIR=f4;Xt.SCALAR=MA;Xt.SEQ=fy;Xt.hasAnchor=Jde;Xt.isAlias=Hde;Xt.isCollection=m4;Xt.isDocument=Gde;Xt.isMap=Zde;Xt.isNode=Kde;Xt.isPair=Vde;Xt.isScalar=p4;Xt.isSeq=Wde});var Jd=v(FA=>{"use strict";var zt=Ce(),Cr=Symbol("break visit"),h4=Symbol("skip children"),xi=Symbol("remove node");function py(t,e){let r=g4(e);zt.isDocument(t)?Gc(null,t.contents,r,Object.freeze([t]))===xi&&(t.contents=null):Gc(null,t,r,Object.freeze([]))}py.BREAK=Cr;py.SKIP=h4;py.REMOVE=xi;function Gc(t,e,r,n){let i=y4(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return _4(t,n,i),Gc(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var b4=Ce(),Yde=Jd(),Xde={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Qde=t=>t.replace(/[!,[\]{}]/g,e=>Xde[e]),Yd=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+Qde(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&&b4.isNode(e.contents)){let o={};Yde.visit(e.contents,(s,a)=>{b4.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(` -`)}};Yd.defaultYaml={explicit:!1,version:"1.2"};Yd.defaultTags={"!!":"tag:yaml.org,2002:"};v4.Directives=Yd});var hy=v(Xd=>{"use strict";var S4=Ce(),efe=Jd();function tfe(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 w4(t){let e=new Set;return efe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function x4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function rfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=w4(t));let s=x4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(S4.isScalar(s.node)||S4.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}}Xd.anchorIsValid=tfe;Xd.anchorNames=w4;Xd.createNodeAnchors=rfe;Xd.findNewAnchor=x4});var zA=v($4=>{"use strict";function Qd(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var nfe=Ce();function k4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>k4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!nfe.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}E4.toJS=k4});var gy=v(T4=>{"use strict";var ife=zA(),A4=Ce(),ofe=Ho(),UA=class{constructor(e){Object.defineProperty(this,A4.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(!A4.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=ofe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?ife.applyReviver(o,{"":a},"",a):a}};T4.NodeBase=UA});var ef=v(O4=>{"use strict";var sfe=hy(),afe=Jd(),Vc=Ce(),cfe=gy(),lfe=Ho(),qA=class extends cfe.NodeBase{constructor(e){super(Vc.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=[],afe.visit(e,{Node:(o,s)=>{(Vc.isAlias(s)||Vc.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||(lfe.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=yy(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(sfe.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 yy(t,e,r){if(Vc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Vc.isCollection(e)){let n=0;for(let i of e.items){let o=yy(t,i,r);o>n&&(n=o)}return n}else if(Vc.isPair(e)){let n=yy(t,e.key,r),i=yy(t,e.value,r);return Math.max(n,i)}return 1}O4.Alias=qA});var Ct=v(BA=>{"use strict";var ufe=Ce(),dfe=gy(),ffe=Ho(),pfe=t=>!t||typeof t!="function"&&typeof t!="object",Go=class extends dfe.NodeBase{constructor(e){super(ufe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:ffe.toJS(this.value,e,r)}toString(){return String(this.value)}};Go.BLOCK_FOLDED="BLOCK_FOLDED";Go.BLOCK_LITERAL="BLOCK_LITERAL";Go.PLAIN="PLAIN";Go.QUOTE_DOUBLE="QUOTE_DOUBLE";Go.QUOTE_SINGLE="QUOTE_SINGLE";BA.Scalar=Go;BA.isScalarValue=pfe});var tf=v(I4=>{"use strict";var mfe=ef(),ua=Ce(),R4=Ct(),hfe="tag:yaml.org,2002:";function gfe(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 yfe(t,e,r){if(ua.isDocument(t)&&(t=t.contents),ua.isNode(t))return t;if(ua.isPair(t)){let d=r.schema[ua.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 mfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=hfe+e.slice(2));let l=gfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new R4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ua.MAP]:Symbol.iterator in Object(t)?s[ua.SEQ]:s[ua.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 R4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}I4.createNode=yfe});var by=v(_y=>{"use strict";var _fe=tf(),$i=Ce(),bfe=gy();function HA(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 _fe.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 P4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,GA=class extends bfe.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=>$i.isNode(n)||$i.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(P4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if($i.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,HA(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($i.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&&$i.isScalar(o)?o.value:o:$i.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!$i.isPair(r))return!1;let n=r.value;return n==null||e&&$i.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 $i.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($i.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,HA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};_y.Collection=GA;_y.collectionFromPath=HA;_y.isEmptyPath=P4});var rf=v(vy=>{"use strict";var vfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function ZA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Sfe=(t,e,r)=>t.endsWith(` -`)?ZA(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 c4(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 MA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}FA.Command=jA;FA.useColor=MA});var p4=v(xn=>{var{Argument:u4}=py(),{Command:LA}=l4(),{CommanderError:Wde,InvalidArgumentError:d4}=Qd(),{Help:Kde}=OA(),{Option:f4}=CA();xn.program=new LA;xn.createCommand=t=>new LA(t);xn.createOption=(t,e)=>new f4(t,e);xn.createArgument=(t,e)=>new u4(t,e);xn.Command=LA;xn.Option=f4;xn.Argument=u4;xn.Help=Kde;xn.CommanderError=Wde;xn.InvalidArgumentError=d4;xn.InvalidOptionArgumentError=d4});var Ce=v(Xt=>{"use strict";var UA=Symbol.for("yaml.alias"),y4=Symbol.for("yaml.document"),hy=Symbol.for("yaml.map"),_4=Symbol.for("yaml.pair"),qA=Symbol.for("yaml.scalar"),gy=Symbol.for("yaml.seq"),uo=Symbol.for("yaml.node.type"),tfe=t=>!!t&&typeof t=="object"&&t[uo]===UA,rfe=t=>!!t&&typeof t=="object"&&t[uo]===y4,nfe=t=>!!t&&typeof t=="object"&&t[uo]===hy,ife=t=>!!t&&typeof t=="object"&&t[uo]===_4,b4=t=>!!t&&typeof t=="object"&&t[uo]===qA,ofe=t=>!!t&&typeof t=="object"&&t[uo]===gy;function v4(t){if(t&&typeof t=="object")switch(t[uo]){case hy:case gy:return!0}return!1}function sfe(t){if(t&&typeof t=="object")switch(t[uo]){case UA:case hy:case qA:case gy:return!0}return!1}var afe=t=>(b4(t)||v4(t))&&!!t.anchor;Xt.ALIAS=UA;Xt.DOC=y4;Xt.MAP=hy;Xt.NODE_TYPE=uo;Xt.PAIR=_4;Xt.SCALAR=qA;Xt.SEQ=gy;Xt.hasAnchor=afe;Xt.isAlias=tfe;Xt.isCollection=v4;Xt.isDocument=rfe;Xt.isMap=nfe;Xt.isNode=sfe;Xt.isPair=ife;Xt.isScalar=b4;Xt.isSeq=ofe});var ef=v(BA=>{"use strict";var zt=Ce(),Cr=Symbol("break visit"),S4=Symbol("skip children"),xi=Symbol("remove node");function yy(t,e){let r=w4(e);zt.isDocument(t)?Zc(null,t.contents,r,Object.freeze([t]))===xi&&(t.contents=null):Zc(null,t,r,Object.freeze([]))}yy.BREAK=Cr;yy.SKIP=S4;yy.REMOVE=xi;function Zc(t,e,r,n){let i=x4(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return $4(t,n,i),Zc(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var k4=Ce(),cfe=ef(),lfe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ufe=t=>t.replace(/[!,[\]{}]/g,e=>lfe[e]),tf=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+ufe(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&&k4.isNode(e.contents)){let o={};cfe.visit(e.contents,(s,a)=>{k4.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(` +`)}};tf.defaultYaml={explicit:!1,version:"1.2"};tf.defaultTags={"!!":"tag:yaml.org,2002:"};E4.Directives=tf});var by=v(rf=>{"use strict";var A4=Ce(),dfe=ef();function ffe(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 T4(t){let e=new Set;return dfe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function O4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function pfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=T4(t));let s=O4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(A4.isScalar(s.node)||A4.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}}rf.anchorIsValid=ffe;rf.anchorNames=T4;rf.createNodeAnchors=pfe;rf.findNewAnchor=O4});var GA=v(R4=>{"use strict";function nf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var mfe=Ce();function I4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>I4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!mfe.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}P4.toJS=I4});var vy=v(D4=>{"use strict";var hfe=GA(),C4=Ce(),gfe=Go(),ZA=class{constructor(e){Object.defineProperty(this,C4.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(!C4.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=gfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?hfe.applyReviver(o,{"":a},"",a):a}};D4.NodeBase=ZA});var of=v(N4=>{"use strict";var yfe=by(),_fe=ef(),Wc=Ce(),bfe=vy(),vfe=Go(),VA=class extends bfe.NodeBase{constructor(e){super(Wc.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=[],_fe.visit(e,{Node:(o,s)=>{(Wc.isAlias(s)||Wc.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||(vfe.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=Sy(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(yfe.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 Sy(t,e,r){if(Wc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Wc.isCollection(e)){let n=0;for(let i of e.items){let o=Sy(t,i,r);o>n&&(n=o)}return n}else if(Wc.isPair(e)){let n=Sy(t,e.key,r),i=Sy(t,e.value,r);return Math.max(n,i)}return 1}N4.Alias=VA});var Ct=v(WA=>{"use strict";var Sfe=Ce(),wfe=vy(),xfe=Go(),$fe=t=>!t||typeof t!="function"&&typeof t!="object",Zo=class extends wfe.NodeBase{constructor(e){super(Sfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:xfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Zo.BLOCK_FOLDED="BLOCK_FOLDED";Zo.BLOCK_LITERAL="BLOCK_LITERAL";Zo.PLAIN="PLAIN";Zo.QUOTE_DOUBLE="QUOTE_DOUBLE";Zo.QUOTE_SINGLE="QUOTE_SINGLE";WA.Scalar=Zo;WA.isScalarValue=$fe});var sf=v(M4=>{"use strict";var kfe=of(),ua=Ce(),j4=Ct(),Efe="tag:yaml.org,2002:";function Afe(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 Tfe(t,e,r){if(ua.isDocument(t)&&(t=t.contents),ua.isNode(t))return t;if(ua.isPair(t)){let d=r.schema[ua.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 kfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Efe+e.slice(2));let l=Afe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new j4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ua.MAP]:Symbol.iterator in Object(t)?s[ua.SEQ]:s[ua.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 j4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}M4.createNode=Tfe});var xy=v(wy=>{"use strict";var Ofe=sf(),$i=Ce(),Rfe=vy();function KA(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 Ofe.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 F4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,JA=class extends Rfe.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=>$i.isNode(n)||$i.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(F4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if($i.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,KA(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($i.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&&$i.isScalar(o)?o.value:o:$i.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!$i.isPair(r))return!1;let n=r.value;return n==null||e&&$i.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 $i.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($i.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,KA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};wy.Collection=JA;wy.collectionFromPath=KA;wy.isEmptyPath=F4});var af=v($y=>{"use strict";var Ife=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function YA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Pfe=(t,e,r)=>t.endsWith(` +`)?YA(r,e):r.includes(` `)?` -`+ZA(r,e):(t.endsWith(" ")?"":" ")+r;vy.indentComment=ZA;vy.lineComment=Sfe;vy.stringifyComment=vfe});var D4=v(nf=>{"use strict";var wfe="flow",VA="block",Sy="quoted";function xfe(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===VA&&(h=C4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Sy&&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===VA&&(h=C4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+YA(r,e):(t.endsWith(" ")?"":" ")+r;$y.indentComment=YA;$y.lineComment=Pfe;$y.stringifyComment=Ife});var z4=v(cf=>{"use strict";var Cfe="flow",XA="block",ky="quoted";function Dfe(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===XA&&(h=L4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===ky&&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===XA&&(h=L4(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===Sy){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 Vn=Ct(),Zo=D4(),xy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),$y=t=>/^(%|---|\.\.\.)/m.test(t);function $fe(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 of(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||($y(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===ky){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 Vn=Ct(),Vo=z4(),Ay=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ty=t=>/^(%|---|\.\.\.)/m.test(t);function Nfe(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 lf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Ty(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(KA,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{O=!0});let A=Zo.foldFlowLines(`${_}${w}${p}`,l,Zo.FOLD_BLOCK,T);if(!O)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,T=Ay(n,!0);s!=="folded"&&e!==Vn.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{O=!0});let A=Vo.foldFlowLines(`${_}${w}${p}`,l,Vo.FOLD_BLOCK,T);if(!O)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function kfe(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 Wc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?Wc(o,e):wy(t,e,r,n);if(!a&&!u&&i!==Vn.Scalar.PLAIN&&o.includes(` -`))return wy(t,e,r,n);if($y(o)){if(c==="")return e.forceBlockIndent=!0,wy(t,e,r,n);if(a&&c===l)return Wc(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 Wc(o,e)}return a?d:Zo.foldFlowLines(d,c,Zo.FOLD_FLOW,xy(e,!1))}function Efe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Wc(s.value,e):wy(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return of(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return WA(s.value,e);case Vn.Scalar.PLAIN:return kfe(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}N4.stringifyString=Efe});var af=v(JA=>{"use strict";var Afe=hy(),Vo=Ce(),Tfe=rf(),Ofe=sf();function Rfe(t,e){let r=Object.assign({blockQuote:!0,commentString:Tfe.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 Ife(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(Vo.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 Pfe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Vo.isScalar(t)||Vo.isCollection(t))&&t.anchor;o&&Afe.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 Cfe(t,e,r,n){if(Vo.isPair(t))return t.toString(e,r,n);if(Vo.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=Vo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Ife(e.doc.schema.tags,o));let s=Pfe(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):Vo.isScalar(o)?Ofe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Vo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}JA.createStringifyContext=Rfe;JA.stringify=Cfe});var L4=v(F4=>{"use strict";var uo=Ce(),j4=Ct(),M4=af(),cf=rf();function Dfe({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=uo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(uo.isCollection(t)||!uo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||uo.isCollection(t)||(uo.isScalar(t)?t.type===j4.Scalar.BLOCK_FOLDED||t.type===j4.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=M4.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+=cf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=cf.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=cf.lineComment(g,r.indent,l(f))));let b,_,S;uo.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&&uo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&uo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=M4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +${l}${_}${r}${p}`}function jfe(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 Kc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?Kc(o,e):Ey(t,e,r,n);if(!a&&!u&&i!==Vn.Scalar.PLAIN&&o.includes(` +`))return Ey(t,e,r,n);if(Ty(o)){if(c==="")return e.forceBlockIndent=!0,Ey(t,e,r,n);if(a&&c===l)return Kc(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 Kc(o,e)}return a?d:Vo.foldFlowLines(d,c,Vo.FOLD_FLOW,Ay(e,!1))}function Mfe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Kc(s.value,e):Ey(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return lf(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return QA(s.value,e);case Vn.Scalar.PLAIN:return jfe(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}U4.stringifyString=Mfe});var df=v(tT=>{"use strict";var Ffe=by(),Wo=Ce(),Lfe=af(),zfe=uf();function Ufe(t,e){let r=Object.assign({blockQuote:!0,commentString:Lfe.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 qfe(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(Wo.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 Bfe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Wo.isScalar(t)||Wo.isCollection(t))&&t.anchor;o&&Ffe.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 Hfe(t,e,r,n){if(Wo.isPair(t))return t.toString(e,r,n);if(Wo.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=Wo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=qfe(e.doc.schema.tags,o));let s=Bfe(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):Wo.isScalar(o)?zfe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Wo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}tT.createStringifyContext=Ufe;tT.stringify=Hfe});var G4=v(H4=>{"use strict";var fo=Ce(),q4=Ct(),B4=df(),ff=af();function Gfe({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=fo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(fo.isCollection(t)||!fo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||fo.isCollection(t)||(fo.isScalar(t)?t.type===q4.Scalar.BLOCK_FOLDED||t.type===q4.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=B4.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+=ff.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=ff.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=ff.lineComment(g,r.indent,l(f))));let b,_,S;fo.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&&fo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&fo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=B4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let T=l(_);O+=` -${cf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` +${ff.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` `&&S&&(O=` `):O+=` -${r.indent}`}else if(!p&&uo.isCollection(e)){let T=w[0],A=w.indexOf(` -`),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let se=!1;if(D&&(T==="&"||T==="!")){let Y=w.indexOf(" ");T==="&"&&Y!==-1&&Y{"use strict";var z4=He("process");function Nfe(t,...e){t==="debug"&&console.log(...e)}function jfe(t,e){(t==="debug"||t==="warn")&&(typeof z4.emitWarning=="function"?z4.emitWarning(e):console.warn(e))}YA.debug=Nfe;YA.warn=jfe});var Oy=v(Ty=>{"use strict";var Ay=Ce(),U4=Ct(),ky="<<",Ey={identify:t=>t===ky||typeof t=="symbol"&&t.description===ky,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new U4.Scalar(Symbol(ky)),{addToJSMap:q4}),stringify:()=>ky},Mfe=(t,e)=>(Ey.identify(e)||Ay.isScalar(e)&&(!e.type||e.type===U4.Scalar.PLAIN)&&Ey.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Ey.tag&&r.default);function q4(t,e,r){let n=B4(t,r);if(Ay.isSeq(n))for(let i of n.items)QA(t,e,i);else if(Array.isArray(n))for(let i of n)QA(t,e,i);else QA(t,e,n)}function QA(t,e,r){let n=B4(t,r);if(!Ay.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 B4(t,e){return t&&Ay.isAlias(e)?e.resolve(t.doc,t):e}Ty.addMergeToJSMap=q4;Ty.isMergeKey=Mfe;Ty.merge=Ey});var tT=v(Z4=>{"use strict";var Ffe=XA(),H4=Oy(),Lfe=af(),G4=Ce(),eT=Ho();function zfe(t,e,{key:r,value:n}){if(G4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(H4.isMergeKey(t,r))H4.addMergeToJSMap(t,e,n);else{let i=eT.toJS(r,"",t);if(e instanceof Map)e.set(i,eT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Ufe(r,i,t),s=eT.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 Ufe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(G4.isNode(t)&&r?.doc){let n=Lfe.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)+'..."'),Ffe.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)}Z4.addPairToJSMap=zfe});var Wo=v(rT=>{"use strict";var V4=tf(),qfe=L4(),Bfe=tT(),Ry=Ce();function Hfe(t,e,r){let n=V4.createNode(t,void 0,r),i=V4.createNode(e,void 0,r);return new Iy(n,i)}var Iy=class t{constructor(e,r=null){Object.defineProperty(this,Ry.NODE_TYPE,{value:Ry.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Ry.isNode(r)&&(r=r.clone(e)),Ry.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return Bfe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?qfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};rT.Pair=Iy;rT.createPair=Hfe});var nT=v(K4=>{"use strict";var da=Ce(),W4=af(),Py=rf();function Gfe(t,e,r){return(e.inFlow??t.flow?Vfe:Zfe)(t,e,r)}function Zfe({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+=Py.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 Z4=Ge("process");function Zfe(t,...e){t==="debug"&&console.log(...e)}function Vfe(t,e){(t==="debug"||t==="warn")&&(typeof Z4.emitWarning=="function"?Z4.emitWarning(e):console.warn(e))}rT.debug=Zfe;rT.warn=Vfe});var Cy=v(Py=>{"use strict";var Iy=Ce(),V4=Ct(),Oy="<<",Ry={identify:t=>t===Oy||typeof t=="symbol"&&t.description===Oy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new V4.Scalar(Symbol(Oy)),{addToJSMap:W4}),stringify:()=>Oy},Wfe=(t,e)=>(Ry.identify(e)||Iy.isScalar(e)&&(!e.type||e.type===V4.Scalar.PLAIN)&&Ry.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Ry.tag&&r.default);function W4(t,e,r){let n=K4(t,r);if(Iy.isSeq(n))for(let i of n.items)iT(t,e,i);else if(Array.isArray(n))for(let i of n)iT(t,e,i);else iT(t,e,n)}function iT(t,e,r){let n=K4(t,r);if(!Iy.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 K4(t,e){return t&&Iy.isAlias(e)?e.resolve(t.doc,t):e}Py.addMergeToJSMap=W4;Py.isMergeKey=Wfe;Py.merge=Ry});var sT=v(X4=>{"use strict";var Kfe=nT(),J4=Cy(),Jfe=df(),Y4=Ce(),oT=Go();function Yfe(t,e,{key:r,value:n}){if(Y4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(J4.isMergeKey(t,r))J4.addMergeToJSMap(t,e,n);else{let i=oT.toJS(r,"",t);if(e instanceof Map)e.set(i,oT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Xfe(r,i,t),s=oT.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 Xfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(Y4.isNode(t)&&r?.doc){let n=Jfe.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)+'..."'),Kfe.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)}X4.addPairToJSMap=Yfe});var Ko=v(aT=>{"use strict";var Q4=sf(),Qfe=G4(),epe=sT(),Dy=Ce();function tpe(t,e,r){let n=Q4.createNode(t,void 0,r),i=Q4.createNode(e,void 0,r);return new Ny(n,i)}var Ny=class t{constructor(e,r=null){Object.defineProperty(this,Dy.NODE_TYPE,{value:Dy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Dy.isNode(r)&&(r=r.clone(e)),Dy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return epe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Qfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};aT.Pair=Ny;aT.createPair=tpe});var cT=v(t6=>{"use strict";var da=Ce(),e6=df(),jy=af();function rpe(t,e,r){return(e.inFlow??t.flow?ipe:npe)(t,e,r)}function npe({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+=jy.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+=Py.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?` +`+jy.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function ipe({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+=jy.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 Cy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Py.indentComment(e(n),t);r.push(o.trimStart())}}K4.stringifyCollection=Gfe});var Jo=v(oT=>{"use strict";var Wfe=nT(),Kfe=tT(),Jfe=by(),Ko=Ce(),Dy=Wo(),Yfe=Ct();function lf(t,e){let r=Ko.isScalar(e)?e.value:e;for(let n of t)if(Ko.isPair(n)&&(n.key===e||n.key===r||Ko.isScalar(n.key)&&n.key.value===r))return n}var iT=class extends Jfe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ko.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(Dy.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;Ko.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Dy.Pair(e,e?.value):n=new Dy.Pair(e.key,e.value);let i=lf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Ko.isScalar(i.value)&&Yfe.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=lf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=lf(this.items,e)?.value;return(!r&&Ko.isScalar(i)?i.value:i)??void 0}has(e){return!!lf(this.items,e)}set(e,r){this.add(new Dy.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)Kfe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Ko.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})),Wfe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};oT.YAMLMap=iT;oT.findPair=lf});var Kc=v(Y4=>{"use strict";var Xfe=Ce(),J4=Jo(),Qfe={collection:"map",default:!0,nodeClass:J4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Xfe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>J4.YAMLMap.from(t,e,r)};Y4.map=Qfe});var Yo=v(X4=>{"use strict";var epe=tf(),tpe=nT(),rpe=by(),jy=Ce(),npe=Ct(),ipe=Ho(),sT=class extends rpe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(jy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Ny(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Ny(e);if(typeof n!="number")return;let i=this.items[n];return!r&&jy.isScalar(i)?i.value:i}has(e){let r=Ny(e);return typeof r=="number"&&r=0?e:null}X4.YAMLSeq=sT});var Jc=v(e6=>{"use strict";var ope=Ce(),Q4=Yo(),spe={collection:"seq",default:!0,nodeClass:Q4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return ope.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>Q4.YAMLSeq.from(t,e,r)};e6.seq=spe});var uf=v(t6=>{"use strict";var ape=sf(),cpe={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),ape.stringifyString(t,e,r,n)}};t6.string=cpe});var My=v(i6=>{"use strict";var r6=Ct(),n6={identify:t=>t==null,createNode:()=>new r6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new r6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&n6.test.test(t)?t:e.options.nullStr};i6.nullTag=n6});var aT=v(s6=>{"use strict";var lpe=Ct(),o6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new lpe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&o6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};s6.boolTag=o6});var Yc=v(a6=>{"use strict";function upe({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}a6.stringifyNumber=upe});var lT=v(Fy=>{"use strict";var dpe=Ct(),cT=Yc(),fpe={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:cT.stringifyNumber},ppe={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():cT.stringifyNumber(t)}},mpe={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 dpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:cT.stringifyNumber};Fy.float=mpe;Fy.floatExp=ppe;Fy.floatNaN=fpe});var dT=v(zy=>{"use strict";var c6=Yc(),Ly=t=>typeof t=="bigint"||Number.isInteger(t),uT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function l6(t,e,r){let{value:n}=t;return Ly(n)&&n>=0?r+n.toString(e):c6.stringifyNumber(t)}var hpe={identify:t=>Ly(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>uT(t,2,8,r),stringify:t=>l6(t,8,"0o")},gpe={identify:Ly,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>uT(t,0,10,r),stringify:c6.stringifyNumber},ype={identify:t=>Ly(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>uT(t,2,16,r),stringify:t=>l6(t,16,"0x")};zy.int=gpe;zy.intHex=ype;zy.intOct=hpe});var d6=v(u6=>{"use strict";var _pe=Kc(),bpe=My(),vpe=Jc(),Spe=uf(),wpe=aT(),fT=lT(),pT=dT(),xpe=[_pe.map,vpe.seq,Spe.string,bpe.nullTag,wpe.boolTag,pT.intOct,pT.int,pT.intHex,fT.floatNaN,fT.floatExp,fT.float];u6.schema=xpe});var m6=v(p6=>{"use strict";var $pe=Ct(),kpe=Kc(),Epe=Jc();function f6(t){return typeof t=="bigint"||Number.isInteger(t)}var Uy=({value:t})=>JSON.stringify(t),Ape=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Uy},{identify:t=>t==null,createNode:()=>new $pe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Uy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Uy},{identify:f6,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})=>f6(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:Uy}],Tpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Ope=[kpe.map,Epe.seq].concat(Ape,Tpe);p6.schema=Ope});var hT=v(h6=>{"use strict";var df=He("buffer"),mT=Ct(),Rpe=sf(),Ipe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof df.Buffer=="function")return df.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 qy=Ce(),gT=Wo(),Ppe=Ct(),Cpe=Yo();function g6(t,e){if(qy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new gT.Pair(new Ppe.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function My({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=jy.indentComment(e(n),t);r.push(o.trimStart())}}t6.stringifyCollection=rpe});var Yo=v(uT=>{"use strict";var ope=cT(),spe=sT(),ape=xy(),Jo=Ce(),Fy=Ko(),cpe=Ct();function pf(t,e){let r=Jo.isScalar(e)?e.value:e;for(let n of t)if(Jo.isPair(n)&&(n.key===e||n.key===r||Jo.isScalar(n.key)&&n.key.value===r))return n}var lT=class extends ape.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Jo.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(Fy.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;Jo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Fy.Pair(e,e?.value):n=new Fy.Pair(e.key,e.value);let i=pf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Jo.isScalar(i.value)&&cpe.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=pf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=pf(this.items,e)?.value;return(!r&&Jo.isScalar(i)?i.value:i)??void 0}has(e){return!!pf(this.items,e)}set(e,r){this.add(new Fy.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)spe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Jo.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})),ope.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};uT.YAMLMap=lT;uT.findPair=pf});var Jc=v(n6=>{"use strict";var lpe=Ce(),r6=Yo(),upe={collection:"map",default:!0,nodeClass:r6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return lpe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>r6.YAMLMap.from(t,e,r)};n6.map=upe});var Xo=v(i6=>{"use strict";var dpe=sf(),fpe=cT(),ppe=xy(),zy=Ce(),mpe=Ct(),hpe=Go(),dT=class extends ppe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(zy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Ly(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Ly(e);if(typeof n!="number")return;let i=this.items[n];return!r&&zy.isScalar(i)?i.value:i}has(e){let r=Ly(e);return typeof r=="number"&&r=0?e:null}i6.YAMLSeq=dT});var Yc=v(s6=>{"use strict";var gpe=Ce(),o6=Xo(),ype={collection:"seq",default:!0,nodeClass:o6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return gpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>o6.YAMLSeq.from(t,e,r)};s6.seq=ype});var mf=v(a6=>{"use strict";var _pe=uf(),bpe={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),_pe.stringifyString(t,e,r,n)}};a6.string=bpe});var Uy=v(u6=>{"use strict";var c6=Ct(),l6={identify:t=>t==null,createNode:()=>new c6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new c6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&l6.test.test(t)?t:e.options.nullStr};u6.nullTag=l6});var fT=v(f6=>{"use strict";var vpe=Ct(),d6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new vpe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&d6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};f6.boolTag=d6});var Xc=v(p6=>{"use strict";function Spe({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}p6.stringifyNumber=Spe});var mT=v(qy=>{"use strict";var wpe=Ct(),pT=Xc(),xpe={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:pT.stringifyNumber},$pe={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():pT.stringifyNumber(t)}},kpe={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 wpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:pT.stringifyNumber};qy.float=kpe;qy.floatExp=$pe;qy.floatNaN=xpe});var gT=v(Hy=>{"use strict";var m6=Xc(),By=t=>typeof t=="bigint"||Number.isInteger(t),hT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function h6(t,e,r){let{value:n}=t;return By(n)&&n>=0?r+n.toString(e):m6.stringifyNumber(t)}var Epe={identify:t=>By(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>hT(t,2,8,r),stringify:t=>h6(t,8,"0o")},Ape={identify:By,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>hT(t,0,10,r),stringify:m6.stringifyNumber},Tpe={identify:t=>By(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>hT(t,2,16,r),stringify:t=>h6(t,16,"0x")};Hy.int=Ape;Hy.intHex=Tpe;Hy.intOct=Epe});var y6=v(g6=>{"use strict";var Ope=Jc(),Rpe=Uy(),Ipe=Yc(),Ppe=mf(),Cpe=fT(),yT=mT(),_T=gT(),Dpe=[Ope.map,Ipe.seq,Ppe.string,Rpe.nullTag,Cpe.boolTag,_T.intOct,_T.int,_T.intHex,yT.floatNaN,yT.floatExp,yT.float];g6.schema=Dpe});var v6=v(b6=>{"use strict";var Npe=Ct(),jpe=Jc(),Mpe=Yc();function _6(t){return typeof t=="bigint"||Number.isInteger(t)}var Gy=({value:t})=>JSON.stringify(t),Fpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Gy},{identify:t=>t==null,createNode:()=>new Npe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Gy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Gy},{identify:_6,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})=>_6(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:Gy}],Lpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},zpe=[jpe.map,Mpe.seq].concat(Fpe,Lpe);b6.schema=zpe});var vT=v(S6=>{"use strict";var hf=Ge("buffer"),bT=Ct(),Upe=uf(),qpe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof hf.Buffer=="function")return hf.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 Zy=Ce(),ST=Ko(),Bpe=Ct(),Hpe=Xo();function w6(t,e){if(Zy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new ST.Pair(new Bpe.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]=qy.isPair(n)?n:new gT.Pair(n)}}else e("Expected a sequence for this tag");return t}function y6(t,e,r){let{replacer:n}=r,i=new Cpe.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(gT.createPair(a,c,r))}return i}var Dpe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:g6,createNode:y6};By.createPairs=y6;By.pairs=Dpe;By.resolvePairs=g6});var bT=v(_T=>{"use strict";var _6=Ce(),yT=Ho(),ff=Jo(),Npe=Yo(),b6=Hy(),fa=class t extends Npe.YAMLSeq{constructor(){super(),this.add=ff.YAMLMap.prototype.add.bind(this),this.delete=ff.YAMLMap.prototype.delete.bind(this),this.get=ff.YAMLMap.prototype.get.bind(this),this.has=ff.YAMLMap.prototype.has.bind(this),this.set=ff.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(_6.isPair(i)?(o=yT.toJS(i.key,"",r),s=yT.toJS(i.value,o,r)):o=yT.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=b6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};fa.tag="tag:yaml.org,2002:omap";var jpe={collection:"seq",identify:t=>t instanceof Map,nodeClass:fa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=b6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)_6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new fa,r)},createNode:(t,e,r)=>fa.from(t,e,r)};_T.YAMLOMap=fa;_T.omap=jpe});var $6=v(vT=>{"use strict";var v6=Ct();function S6({value:t,source:e},r){return e&&(t?w6:x6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var w6={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 v6.Scalar(!0),stringify:S6},x6={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 v6.Scalar(!1),stringify:S6};vT.falseTag=x6;vT.trueTag=w6});var k6=v(Gy=>{"use strict";var Mpe=Ct(),ST=Yc(),Fpe={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:ST.stringifyNumber},Lpe={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():ST.stringifyNumber(t)}},zpe={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 Mpe.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:ST.stringifyNumber};Gy.float=zpe;Gy.floatExp=Lpe;Gy.floatNaN=Fpe});var A6=v(mf=>{"use strict";var E6=Yc(),pf=t=>typeof t=="bigint"||Number.isInteger(t);function Zy(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 wT(t,e,r){let{value:n}=t;if(pf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return E6.stringifyNumber(t)}var Upe={identify:pf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Zy(t,2,2,r),stringify:t=>wT(t,2,"0b")},qpe={identify:pf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Zy(t,1,8,r),stringify:t=>wT(t,8,"0")},Bpe={identify:pf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Zy(t,0,10,r),stringify:E6.stringifyNumber},Hpe={identify:pf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Zy(t,2,16,r),stringify:t=>wT(t,16,"0x")};mf.int=Bpe;mf.intBin=Upe;mf.intHex=Hpe;mf.intOct=qpe});var $T=v(xT=>{"use strict";var Ky=Ce(),Vy=Wo(),Wy=Jo(),pa=class t extends Wy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Ky.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Vy.Pair(e.key,null):r=new Vy.Pair(e,null),Wy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Wy.findPair(this.items,e);return!r&&Ky.isPair(n)?Ky.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=Wy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Vy.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(Vy.createPair(s,null,n));return o}};pa.tag="tag:yaml.org,2002:set";var Gpe={collection:"map",identify:t=>t instanceof Set,nodeClass:pa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>pa.from(t,e,r),resolve(t,e){if(Ky.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new pa,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};xT.YAMLSet=pa;xT.set=Gpe});var ET=v(Jy=>{"use strict";var Zpe=Yc();function kT(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 T6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Zpe.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 Vpe={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})=>kT(t,r),stringify:T6},Wpe={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=>kT(t,!1),stringify:T6},O6={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(O6.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=kT(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$/,"")??""};Jy.floatTime=Wpe;Jy.intTime=Vpe;Jy.timestamp=O6});var P6=v(I6=>{"use strict";var Kpe=Kc(),Jpe=My(),Ype=Jc(),Xpe=uf(),Qpe=hT(),R6=$6(),AT=k6(),Yy=A6(),eme=Oy(),tme=bT(),rme=Hy(),nme=$T(),TT=ET(),ime=[Kpe.map,Ype.seq,Xpe.string,Jpe.nullTag,R6.trueTag,R6.falseTag,Yy.intBin,Yy.intOct,Yy.int,Yy.intHex,AT.floatNaN,AT.floatExp,AT.float,Qpe.binary,eme.merge,tme.omap,rme.pairs,nme.set,TT.intTime,TT.floatTime,TT.timestamp];I6.schema=ime});var q6=v(IT=>{"use strict";var j6=Kc(),ome=My(),M6=Jc(),sme=uf(),ame=aT(),OT=lT(),RT=dT(),cme=d6(),lme=m6(),F6=hT(),hf=Oy(),L6=bT(),z6=Hy(),C6=P6(),U6=$T(),Xy=ET(),D6=new Map([["core",cme.schema],["failsafe",[j6.map,M6.seq,sme.string]],["json",lme.schema],["yaml11",C6.schema],["yaml-1.1",C6.schema]]),N6={binary:F6.binary,bool:ame.boolTag,float:OT.float,floatExp:OT.floatExp,floatNaN:OT.floatNaN,floatTime:Xy.floatTime,int:RT.int,intHex:RT.intHex,intOct:RT.intOct,intTime:Xy.intTime,map:j6.map,merge:hf.merge,null:ome.nullTag,omap:L6.omap,pairs:z6.pairs,seq:M6.seq,set:U6.set,timestamp:Xy.timestamp},ume={"tag:yaml.org,2002:binary":F6.binary,"tag:yaml.org,2002:merge":hf.merge,"tag:yaml.org,2002:omap":L6.omap,"tag:yaml.org,2002:pairs":z6.pairs,"tag:yaml.org,2002:set":U6.set,"tag:yaml.org,2002:timestamp":Xy.timestamp};function dme(t,e,r){let n=D6.get(e);if(n&&!t)return r&&!n.includes(hf.merge)?n.concat(hf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(D6.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(hf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?N6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(N6).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},[])}IT.coreKnownTags=ume;IT.getTags=dme});var DT=v(B6=>{"use strict";var PT=Ce(),fme=Kc(),pme=Jc(),mme=uf(),Qy=q6(),hme=(t,e)=>t.keye.key?1:0,CT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Qy.getTags(e,"compat"):e?Qy.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Qy.coreKnownTags:{},this.tags=Qy.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,PT.MAP,{value:fme.map}),Object.defineProperty(this,PT.SCALAR,{value:mme.string}),Object.defineProperty(this,PT.SEQ,{value:pme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?hme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};B6.Schema=CT});var G6=v(H6=>{"use strict";var gme=Ce(),NT=af(),gf=rf();function yme(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=NT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(gf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(gme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(gf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=NT.stringify(t.contents,i,()=>a=null,c);a&&(l+=gf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(NT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(gf.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(gf.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=Zy.isPair(n)?n:new ST.Pair(n)}}else e("Expected a sequence for this tag");return t}function x6(t,e,r){let{replacer:n}=r,i=new Hpe.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(ST.createPair(a,c,r))}return i}var Gpe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:w6,createNode:x6};Vy.createPairs=x6;Vy.pairs=Gpe;Vy.resolvePairs=w6});var $T=v(xT=>{"use strict";var $6=Ce(),wT=Go(),gf=Yo(),Zpe=Xo(),k6=Wy(),fa=class t extends Zpe.YAMLSeq{constructor(){super(),this.add=gf.YAMLMap.prototype.add.bind(this),this.delete=gf.YAMLMap.prototype.delete.bind(this),this.get=gf.YAMLMap.prototype.get.bind(this),this.has=gf.YAMLMap.prototype.has.bind(this),this.set=gf.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($6.isPair(i)?(o=wT.toJS(i.key,"",r),s=wT.toJS(i.value,o,r)):o=wT.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=k6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};fa.tag="tag:yaml.org,2002:omap";var Vpe={collection:"seq",identify:t=>t instanceof Map,nodeClass:fa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=k6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)$6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new fa,r)},createNode:(t,e,r)=>fa.from(t,e,r)};xT.YAMLOMap=fa;xT.omap=Vpe});var R6=v(kT=>{"use strict";var E6=Ct();function A6({value:t,source:e},r){return e&&(t?T6:O6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var T6={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 E6.Scalar(!0),stringify:A6},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 E6.Scalar(!1),stringify:A6};kT.falseTag=O6;kT.trueTag=T6});var I6=v(Ky=>{"use strict";var Wpe=Ct(),ET=Xc(),Kpe={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:ET.stringifyNumber},Jpe={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():ET.stringifyNumber(t)}},Ype={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 Wpe.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:ET.stringifyNumber};Ky.float=Ype;Ky.floatExp=Jpe;Ky.floatNaN=Kpe});var C6=v(_f=>{"use strict";var P6=Xc(),yf=t=>typeof t=="bigint"||Number.isInteger(t);function Jy(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 AT(t,e,r){let{value:n}=t;if(yf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return P6.stringifyNumber(t)}var Xpe={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Jy(t,2,2,r),stringify:t=>AT(t,2,"0b")},Qpe={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Jy(t,1,8,r),stringify:t=>AT(t,8,"0")},eme={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Jy(t,0,10,r),stringify:P6.stringifyNumber},tme={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Jy(t,2,16,r),stringify:t=>AT(t,16,"0x")};_f.int=eme;_f.intBin=Xpe;_f.intHex=tme;_f.intOct=Qpe});var OT=v(TT=>{"use strict";var Qy=Ce(),Yy=Ko(),Xy=Yo(),pa=class t extends Xy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Qy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Yy.Pair(e.key,null):r=new Yy.Pair(e,null),Xy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Xy.findPair(this.items,e);return!r&&Qy.isPair(n)?Qy.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=Xy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Yy.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(Yy.createPair(s,null,n));return o}};pa.tag="tag:yaml.org,2002:set";var rme={collection:"map",identify:t=>t instanceof Set,nodeClass:pa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>pa.from(t,e,r),resolve(t,e){if(Qy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new pa,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};TT.YAMLSet=pa;TT.set=rme});var IT=v(e_=>{"use strict";var nme=Xc();function RT(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 nme.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 ime={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})=>RT(t,r),stringify:D6},ome={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=>RT(t,!1),stringify:D6},N6={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(N6.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=RT(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$/,"")??""};e_.floatTime=ome;e_.intTime=ime;e_.timestamp=N6});var F6=v(M6=>{"use strict";var sme=Jc(),ame=Uy(),cme=Yc(),lme=mf(),ume=vT(),j6=R6(),PT=I6(),t_=C6(),dme=Cy(),fme=$T(),pme=Wy(),mme=OT(),CT=IT(),hme=[sme.map,cme.seq,lme.string,ame.nullTag,j6.trueTag,j6.falseTag,t_.intBin,t_.intOct,t_.int,t_.intHex,PT.floatNaN,PT.floatExp,PT.float,ume.binary,dme.merge,fme.omap,pme.pairs,mme.set,CT.intTime,CT.floatTime,CT.timestamp];M6.schema=hme});var W6=v(jT=>{"use strict";var q6=Jc(),gme=Uy(),B6=Yc(),yme=mf(),_me=fT(),DT=mT(),NT=gT(),bme=y6(),vme=v6(),H6=vT(),bf=Cy(),G6=$T(),Z6=Wy(),L6=F6(),V6=OT(),r_=IT(),z6=new Map([["core",bme.schema],["failsafe",[q6.map,B6.seq,yme.string]],["json",vme.schema],["yaml11",L6.schema],["yaml-1.1",L6.schema]]),U6={binary:H6.binary,bool:_me.boolTag,float:DT.float,floatExp:DT.floatExp,floatNaN:DT.floatNaN,floatTime:r_.floatTime,int:NT.int,intHex:NT.intHex,intOct:NT.intOct,intTime:r_.intTime,map:q6.map,merge:bf.merge,null:gme.nullTag,omap:G6.omap,pairs:Z6.pairs,seq:B6.seq,set:V6.set,timestamp:r_.timestamp},Sme={"tag:yaml.org,2002:binary":H6.binary,"tag:yaml.org,2002:merge":bf.merge,"tag:yaml.org,2002:omap":G6.omap,"tag:yaml.org,2002:pairs":Z6.pairs,"tag:yaml.org,2002:set":V6.set,"tag:yaml.org,2002:timestamp":r_.timestamp};function wme(t,e,r){let n=z6.get(e);if(n&&!t)return r&&!n.includes(bf.merge)?n.concat(bf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(z6.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(bf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?U6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(U6).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},[])}jT.coreKnownTags=Sme;jT.getTags=wme});var LT=v(K6=>{"use strict";var MT=Ce(),xme=Jc(),$me=Yc(),kme=mf(),n_=W6(),Eme=(t,e)=>t.keye.key?1:0,FT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?n_.getTags(e,"compat"):e?n_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?n_.coreKnownTags:{},this.tags=n_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,MT.MAP,{value:xme.map}),Object.defineProperty(this,MT.SCALAR,{value:kme.string}),Object.defineProperty(this,MT.SEQ,{value:$me.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Eme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};K6.Schema=FT});var Y6=v(J6=>{"use strict";var Ame=Ce(),zT=df(),vf=af();function Tme(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=zT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(vf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Ame.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(vf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=zT.stringify(t.contents,i,()=>a=null,c);a&&(l+=vf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(zT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(vf.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(vf.indentComment(o(c),"")))}return r.join(` `)+` -`}H6.stringifyDocument=yme});var yf=v(Z6=>{"use strict";var _me=ef(),Xc=by(),$n=Ce(),bme=Wo(),vme=Ho(),Sme=DT(),wme=G6(),jT=hy(),xme=zA(),$me=tf(),MT=LA(),FT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 MT.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Qc(this.contents)&&this.contents.add(e)}addIn(e,r){Qc(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=jT.anchorNames(this);e.anchor=!r||n.has(r)?jT.findNewAnchor(r||"a",n):r}return new _me.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}=jT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=$me.createNode(e,u,m);return a&&$n.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 bme.Pair(i,o)}delete(e){return Qc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Xc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Qc(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Xc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Xc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Xc.collectionFromPath(this.schema,[e],r):Qc(this.contents)&&this.contents.set(e,r)}setIn(e,r){Xc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Xc.collectionFromPath(this.schema,Array.from(e),r):Qc(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 MT.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 MT.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 Sme.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=vme.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"?xme.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 wme.stringifyDocument(this,e)}};function Qc(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Z6.Document=FT});var vf=v(bf=>{"use strict";var _f=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},LT=class extends _f{constructor(e,r,n){super("YAMLParseError",e,r,n)}},zT=class extends _f{constructor(e,r,n){super("YAMLWarning",e,r,n)}},kme=(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 +`}J6.stringifyDocument=Tme});var Sf=v(X6=>{"use strict";var Ome=of(),Qc=xy(),$n=Ce(),Rme=Ko(),Ime=Go(),Pme=LT(),Cme=Y6(),UT=by(),Dme=GA(),Nme=sf(),qT=HA(),BT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 qT.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){el(this.contents)&&this.contents.add(e)}addIn(e,r){el(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=UT.anchorNames(this);e.anchor=!r||n.has(r)?UT.findNewAnchor(r||"a",n):r}return new Ome.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}=UT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Nme.createNode(e,u,m);return a&&$n.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 Rme.Pair(i,o)}delete(e){return el(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Qc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):el(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Qc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Qc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Qc.collectionFromPath(this.schema,[e],r):el(this.contents)&&this.contents.set(e,r)}setIn(e,r){Qc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Qc.collectionFromPath(this.schema,Array.from(e),r):el(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 qT.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 qT.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 Pme.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=Ime.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"?Dme.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 Cme.stringifyDocument(this,e)}};function el(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}X6.Document=BT});var $f=v(xf=>{"use strict";var wf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},HT=class extends wf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},GT=class extends wf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},jme=(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} -`}};bf.YAMLError=_f;bf.YAMLParseError=LT;bf.YAMLWarning=zT;bf.prettifyError=kme});var Sf=v(V6=>{"use strict";function Eme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}V6.resolveProps=Eme});var e_=v(W6=>{"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}}W6.containsNewline=UT});var qT=v(K6=>{"use strict";var Ame=e_();function Tme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Ame.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}K6.flowIndentCheck=Tme});var BT=v(Y6=>{"use strict";var J6=Ce();function Ome(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||J6.isScalar(o)&&J6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}Y6.mapIncludes=Ome});var nB=v(rB=>{"use strict";var X6=Wo(),Rme=Jo(),Q6=Sf(),Ime=e_(),eB=qT(),Pme=BT(),tB="All mapping items must start at the same column";function Cme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Rme.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=Q6.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",tB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Ime.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",tB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&eB.flowIndentCheck(n.indent,f,i),r.atKey=!1,Pme.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=Q6.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 Dme=Yo(),Nme=Sf(),jme=qT();function Mme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Dme.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=Nme.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&&jme.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}iB.resolveBlockSeq=Mme});var el=v(sB=>{"use strict";function Fme(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}}sB.resolveEnd=Fme});var uB=v(lB=>{"use strict";var Lme=Ce(),zme=Wo(),aB=Jo(),Ume=Yo(),qme=el(),cB=Sf(),Bme=e_(),Hme=BT(),HT="Block collections are not allowed within flow collections",GT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Gme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?aB.YAMLMap:Ume.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=qme.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}lB.resolveFlowCollection=Gme});var fB=v(dB=>{"use strict";var Zme=Ce(),Vme=Ct(),Wme=Jo(),Kme=Yo(),Jme=nB(),Yme=oB(),Xme=uB();function ZT(t,e,r,n,i,o){let s=r.type==="block-map"?Jme.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?Yme.resolveBlockSeq(t,e,r,n,o):Xme.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 Qme(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),ZT(t,e,r,i,s)}let l=ZT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Zme.isNode(u)?u:new Vme.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}dB.composeCollection=Qme});var WT=v(pB=>{"use strict";var VT=Ct();function ehe(t,e,r){let n=e.offset,i=the(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?VT.Scalar.BLOCK_FOLDED:VT.Scalar.BLOCK_LITERAL,s=e.source?rhe(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?` +`}};xf.YAMLError=wf;xf.YAMLParseError=HT;xf.YAMLWarning=GT;xf.prettifyError=jme});var kf=v(Q6=>{"use strict";function Mme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}Q6.resolveProps=Mme});var i_=v(eB=>{"use strict";function ZT(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(ZT(e.key)||ZT(e.value))return!0}return!1;default:return!0}}eB.containsNewline=ZT});var VT=v(tB=>{"use strict";var Fme=i_();function Lme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Fme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}tB.flowIndentCheck=Lme});var WT=v(nB=>{"use strict";var rB=Ce();function zme(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||rB.isScalar(o)&&rB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}nB.mapIncludes=zme});var lB=v(cB=>{"use strict";var iB=Ko(),Ume=Yo(),oB=kf(),qme=i_(),sB=VT(),Bme=WT(),aB="All mapping items must start at the same column";function Hme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Ume.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=oB.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",aB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||qme.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",aB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&sB.flowIndentCheck(n.indent,f,i),r.atKey=!1,Bme.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=oB.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 Gme=Xo(),Zme=kf(),Vme=VT();function Wme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Gme.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=Zme.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&&Vme.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}uB.resolveBlockSeq=Wme});var tl=v(fB=>{"use strict";function Kme(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}}fB.resolveEnd=Kme});var gB=v(hB=>{"use strict";var Jme=Ce(),Yme=Ko(),pB=Yo(),Xme=Xo(),Qme=tl(),mB=kf(),ehe=i_(),the=WT(),KT="Block collections are not allowed within flow collections",JT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function rhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?pB.YAMLMap:Xme.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=Qme.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}hB.resolveFlowCollection=rhe});var _B=v(yB=>{"use strict";var nhe=Ce(),ihe=Ct(),ohe=Yo(),she=Xo(),ahe=lB(),che=dB(),lhe=gB();function YT(t,e,r,n,i,o){let s=r.type==="block-map"?ahe.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?che.resolveBlockSeq(t,e,r,n,o):lhe.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 uhe(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),YT(t,e,r,i,s)}let l=YT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=nhe.isNode(u)?u:new ihe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}yB.composeCollection=uhe});var QT=v(bB=>{"use strict";var XT=Ct();function dhe(t,e,r){let n=e.offset,i=fhe(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?XT.Scalar.BLOCK_FOLDED:XT.Scalar.BLOCK_LITERAL,s=e.source?phe(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,91 +112,91 @@ ${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 the({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 KT=Ct(),nhe=el();function ihe(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=KT.Scalar.PLAIN,c=ohe(o,l);break;case"single-quoted-scalar":a=KT.Scalar.QUOTE_SINGLE,c=she(o,l);break;case"double-quoted-scalar":a=KT.Scalar.QUOTE_DOUBLE,c=ahe(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=nhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function ohe(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}`),mB(t)}function she(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),mB(t.slice(1,-1)).replace(/''/g,"'")}function mB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var eO=Ct(),mhe=tl();function hhe(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=eO.Scalar.PLAIN,c=ghe(o,l);break;case"single-quoted-scalar":a=eO.Scalar.QUOTE_SINGLE,c=yhe(o,l);break;case"double-quoted-scalar":a=eO.Scalar.QUOTE_DOUBLE,c=_he(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=mhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function ghe(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}`),vB(t)}function yhe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),vB(t.slice(1,-1)).replace(/''/g,"'")}function vB(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 che(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 bhe(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 lhe={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function uhe(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}}hB.resolveFlowScalar=ihe});var _B=v(yB=>{"use strict";var ma=Ce(),gB=Ct(),dhe=WT(),fhe=JT();function phe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?dhe.resolveBlockScalar(t,e,n):fhe.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[ma.SCALAR]:c?l=mhe(t.schema,i,c,r,n):e.type==="scalar"?l=hhe(t,i,e,n):l=t.schema[ma.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ma.isScalar(d)?d:new gB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new gB.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 mhe(t,e,r,n,i){if(r==="!")return t[ma.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[ma.SCALAR])}function hhe({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[ma.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ma.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}yB.composeScalar=phe});var vB=v(bB=>{"use strict";function ghe(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}bB.emptyScalarPosition=ghe});var xB=v(XT=>{"use strict";var yhe=ef(),_he=Ce(),bhe=fB(),SB=_B(),vhe=el(),She=vB(),whe={composeNode:wB,composeEmptyNode:YT};function wB(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=xhe(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=SB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=bhe.composeCollection(whe,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=YT(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&&(!_he.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 YT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:She.emptyScalarPosition(e,r,n),indent:-1,source:""},d=SB.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 xhe({options:t},{offset:e,source:r,end:n},i){let o=new yhe.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=vhe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}XT.composeEmptyNode=YT;XT.composeNode=wB});var EB=v(kB=>{"use strict";var $he=yf(),$B=xB(),khe=el(),Ehe=Sf();function Ahe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new $he.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Ehe.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?$B.composeNode(l,i,u,s):$B.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=khe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}kB.composeDoc=Ahe});var eO=v(OB=>{"use strict";var The=He("process"),Ohe=LA(),Rhe=yf(),wf=vf(),AB=Ce(),Ihe=EB(),Phe=el();function xf(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 TB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ma=Ce(),wB=Ct(),whe=QT(),xhe=tO();function $he(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?whe.resolveBlockScalar(t,e,n):xhe.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[ma.SCALAR]:c?l=khe(t.schema,i,c,r,n):e.type==="scalar"?l=Ehe(t,i,e,n):l=t.schema[ma.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ma.isScalar(d)?d:new wB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new wB.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 khe(t,e,r,n,i){if(r==="!")return t[ma.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[ma.SCALAR])}function Ehe({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[ma.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ma.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}xB.composeScalar=$he});var EB=v(kB=>{"use strict";function Ahe(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}kB.emptyScalarPosition=Ahe});var OB=v(nO=>{"use strict";var The=of(),Ohe=Ce(),Rhe=_B(),AB=$B(),Ihe=tl(),Phe=EB(),Che={composeNode:TB,composeEmptyNode:rO};function TB(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=Dhe(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=AB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Rhe.composeCollection(Che,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=rO(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&&(!Ohe.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 rO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Phe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=AB.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 Dhe({options:t},{offset:e,source:r,end:n},i){let o=new The.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=Ihe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}nO.composeEmptyNode=rO;nO.composeNode=TB});var PB=v(IB=>{"use strict";var Nhe=Sf(),RB=OB(),jhe=tl(),Mhe=kf();function Fhe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Nhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Mhe.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=jhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}IB.composeDoc=Fhe});var oO=v(NB=>{"use strict";var Lhe=Ge("process"),zhe=HA(),Uhe=Sf(),Ef=$f(),CB=Ce(),qhe=PB(),Bhe=tl();function Af(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=xf(r);o?this.warnings.push(new wf.YAMLWarning(s,n,i)):this.errors.push(new wf.YAMLParseError(s,n,i))},this.directives=new Ohe.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=TB(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(AB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];AB.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 iO=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=Af(r);o?this.warnings.push(new Ef.YAMLWarning(s,n,i)):this.errors.push(new Ef.YAMLParseError(s,n,i))},this.directives=new zhe.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(CB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];CB.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=xf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Ihe.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 wf.YAMLParseError(xf(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 wf.YAMLParseError(xf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Phe.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 wf.YAMLParseError(xf(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 Rhe.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}}};OB.Composer=QT});var PB=v(t_=>{"use strict";var Che=WT(),Dhe=JT(),Nhe=vf(),RB=sf();function jhe(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 Nhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Dhe.resolveFlowScalar(t,e,n);case"block-scalar":return Che.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Mhe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=RB.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=Af(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=qhe.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 Ef.YAMLParseError(Af(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 Ef.YAMLParseError(Af(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Bhe.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 Ef.YAMLParseError(Af(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 Uhe.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}}};NB.Composer=iO});var FB=v(o_=>{"use strict";var Hhe=QT(),Ghe=tO(),Zhe=$f(),jB=uf();function Vhe(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 Zhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ghe.resolveFlowScalar(t,e,n);case"block-scalar":return Hhe.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Whe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=jB.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 IB(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 Fhe(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=RB.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">":Lhe(t,c);break;case'"':tO(t,c,"double-quoted-scalar");break;case"'":tO(t,c,"single-quoted-scalar");break;default:tO(t,c,"scalar")}}function Lhe(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 Khe(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=jB.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">":Jhe(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 Jhe(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}];IB(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 IB(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 tO(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})}}}t_.createScalarToken=Mhe;t_.resolveAsScalar=jhe;t_.setScalarValue=Fhe});var DB=v(CB=>{"use strict";var zhe=t=>"type"in t?n_(t):r_(t);function n_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=n_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=r_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=r_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=r_(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 r_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=n_(e)),r)for(let o of r)i+=o.source;return n&&(i+=n_(n)),i}CB.stringify=zhe});var FB=v(MB=>{"use strict";var rO=Symbol("break visit"),Uhe=Symbol("skip children"),NB=Symbol("remove item");function ha(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),jB(Object.freeze([]),t,e)}ha.BREAK=rO;ha.SKIP=Uhe;ha.REMOVE=NB;ha.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};ha.parentCollection=(t,e)=>{let r=ha.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 jB(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 nO=PB(),qhe=DB(),Bhe=FB(),iO="\uFEFF",oO="",sO="",aO="",Hhe=t=>!!t&&"items"in t,Ghe=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Zhe(t){switch(t){case iO:return"";case oO:return"";case sO:return"";case aO:return"";default:return JSON.stringify(t)}}function Vhe(t){switch(t){case iO:return"byte-order-mark";case oO:return"doc-mode";case sO: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}];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 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})}}}o_.createScalarToken=Whe;o_.resolveAsScalar=Vhe;o_.setScalarValue=Khe});var zB=v(LB=>{"use strict";var Yhe=t=>"type"in t?a_(t):s_(t);function a_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=a_(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+=a_(e)),r)for(let o of r)i+=o.source;return n&&(i+=a_(n)),i}LB.stringify=Yhe});var HB=v(BB=>{"use strict";var aO=Symbol("break visit"),Xhe=Symbol("skip children"),UB=Symbol("remove item");function ha(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),qB(Object.freeze([]),t,e)}ha.BREAK=aO;ha.SKIP=Xhe;ha.REMOVE=UB;ha.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};ha.parentCollection=(t,e)=>{let r=ha.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 qB(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 cO=FB(),Qhe=zB(),ege=HB(),lO="\uFEFF",uO="",dO="",fO="",tge=t=>!!t&&"items"in t,rge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function nge(t){switch(t){case lO:return"";case uO:return"";case dO:return"";case fO:return"";default:return JSON.stringify(t)}}function ige(t){switch(t){case lO:return"byte-order-mark";case uO:return"doc-mode";case dO:return"flow-error-end";case fO: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}Dr.createScalarToken=nO.createScalarToken;Dr.resolveAsScalar=nO.resolveAsScalar;Dr.setScalarValue=nO.setScalarValue;Dr.stringify=qhe.stringify;Dr.visit=Bhe.visit;Dr.BOM=iO;Dr.DOCUMENT=oO;Dr.FLOW_END=sO;Dr.SCALAR=aO;Dr.isCollection=Hhe;Dr.isScalar=Ghe;Dr.prettyToken=Zhe;Dr.tokenType=Vhe});var uO=v(zB=>{"use strict";var $f=i_();function Wn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var LB=new Set("0123456789ABCDEFabcdef"),Whe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),o_=new Set(",[]{}"),Khe=new Set(` ,[]{} -\r `),cO=t=>!t||Khe.has(t),lO=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}Dr.createScalarToken=cO.createScalarToken;Dr.resolveAsScalar=cO.resolveAsScalar;Dr.setScalarValue=cO.setScalarValue;Dr.stringify=Qhe.stringify;Dr.visit=ege.visit;Dr.BOM=lO;Dr.DOCUMENT=uO;Dr.FLOW_END=dO;Dr.SCALAR=fO;Dr.isCollection=tge;Dr.isScalar=rge;Dr.prettyToken=nge;Dr.tokenType=ige});var hO=v(ZB=>{"use strict";var Tf=c_();function Wn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var GB=new Set("0123456789ABCDEFabcdef"),oge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),l_=new Set(",[]{}"),sge=new Set(` ,[]{} +\r `),pO=t=>!t||sge.has(t),mO=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==="...")&&Wn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Wn(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===":")&&Wn(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(cO),"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&&!Wn(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===":")&&Wn(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(pO),"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=>Wn(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 $f.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(Wn(o)||e&&o_.has(o))break;r=n}else if(Wn(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 Tf.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(Wn(o)||e&&l_.has(o))break;r=n}else if(Wn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&o_.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&o_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield $f.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(cO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Wn(n)||r&&o_.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(;!Wn(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(Whe.has(r))r=this.buffer[++e];else if(r==="%"&&LB.has(this.buffer[e+1])&&LB.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&&l_.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&l_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Tf.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(pO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Wn(n)||r&&l_.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(;!Wn(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(oge.has(r))r=this.buffer[++e];else if(r==="%"&&GB.has(this.buffer[e+1])&&GB.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)}};zB.Lexer=lO});var fO=v(UB=>{"use strict";var dO=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 Jhe=He("process"),qB=i_(),Yhe=uO();function Xo(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"&&HB(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&&BB(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)}};ZB.Lexer=mO});var yO=v(VB=>{"use strict";var gO=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 age=Ge("process"),WB=c_(),cge=hO();function Qo(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 d_(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"&&JB(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(Xo(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(GB(r.key)&&!Xo(r.sep,"newline")){let s=tl(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(Xo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=tl(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]}):Xo(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&&!Xo(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||Xo(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=s_(n),o=tl(i);HB(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)){d_(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(Qo(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(YB(r.key)&&!Qo(r.sep,"newline")){let s=rl(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(Qo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=rl(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]}):Qo(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&&!Qo(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)){d_(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||Qo(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=u_(n),o=rl(i);JB(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=s_(e),n=tl(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=s_(e),n=tl(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())}}};ZB.Parser=pO});var YB=v(Ef=>{"use strict";var VB=eO(),Xhe=yf(),kf=vf(),Qhe=XA(),ege=Ce(),tge=fO(),WB=mO();function KB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new tge.LineCounter||null,prettyErrors:e}}function rge(t,e={}){let{lineCounter:r,prettyErrors:n}=KB(e),i=new WB.Parser(r?.addNewLine),o=new VB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(kf.prettifyError(t,r)),a.warnings.forEach(kf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function JB(t,e={}){let{lineCounter:r,prettyErrors:n}=KB(e),i=new WB.Parser(r?.addNewLine),o=new VB.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 kf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(kf.prettifyError(t,r)),s.warnings.forEach(kf.prettifyError(t,r))),s}function nge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=JB(t,r);if(!i)return null;if(i.warnings.forEach(o=>Qhe.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 ige(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 ege.isDocument(t)&&!n?t.toString(r):new Xhe.Document(t,n,r).toString(r)}Ef.parse=nge;Ef.parseAllDocuments=rge;Ef.parseDocument=JB;Ef.stringify=ige});var Qt=v(Ge=>{"use strict";var oge=eO(),sge=yf(),age=DT(),hO=vf(),cge=ef(),Qo=Ce(),lge=Wo(),uge=Ct(),dge=Jo(),fge=Yo(),pge=i_(),mge=uO(),hge=fO(),gge=mO(),c_=YB(),XB=Jd();Ge.Composer=oge.Composer;Ge.Document=sge.Document;Ge.Schema=age.Schema;Ge.YAMLError=hO.YAMLError;Ge.YAMLParseError=hO.YAMLParseError;Ge.YAMLWarning=hO.YAMLWarning;Ge.Alias=cge.Alias;Ge.isAlias=Qo.isAlias;Ge.isCollection=Qo.isCollection;Ge.isDocument=Qo.isDocument;Ge.isMap=Qo.isMap;Ge.isNode=Qo.isNode;Ge.isPair=Qo.isPair;Ge.isScalar=Qo.isScalar;Ge.isSeq=Qo.isSeq;Ge.Pair=lge.Pair;Ge.Scalar=uge.Scalar;Ge.YAMLMap=dge.YAMLMap;Ge.YAMLSeq=fge.YAMLSeq;Ge.CST=pge;Ge.Lexer=mge.Lexer;Ge.LineCounter=hge.LineCounter;Ge.Parser=gge.Parser;Ge.parse=c_.parse;Ge.parseAllDocuments=c_.parseAllDocuments;Ge.parseDocument=c_.parseDocument;Ge.stringify=c_.stringify;Ge.visit=XB.visit;Ge.visitAsync=XB.visitAsync});import{execFileSync as QB}from"node:child_process";import{existsSync as l_}from"node:fs";import{join as u_,resolve as yge}from"node:path";function _ge(t){try{let e=QB("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?yge(t,e):null}catch{return null}}function gO(t){let e=_ge(t);if(!e)return null;try{if(l_(u_(e,"MERGE_HEAD")))return"merge";if(l_(u_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(l_(u_(e,"rebase-merge"))||l_(u_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ga(t){return gO(t)!==null}function yO(t,e){try{let r=QB("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 d_(t,e){return yO(t,e)!==null}var ya=y(()=>{"use strict"});import{execFileSync as bge}from"node:child_process";import{existsSync as vge,readFileSync as Sge}from"node:fs";import{join as rH}from"node:path";function Af(t,e){return bge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function es(t){try{let e=Af(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 ts(t,e){wge(t,e);let r=Af(t,["rev-parse","HEAD"]).trim(),n=xge(t,e);return{groups:$ge(t,n),head:r,inventory:{after:tH(p_(t,"spec.yaml")),before:tH(_O(t,e,"spec.yaml"))},since:e,unsharded_commits:Tge(t,e)}}function bO(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 wge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!d_(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 xge(t,e){let r=Af(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(!(!eH(c)&&!eH(a)))if(s.startsWith("A")){let l=f_(p_(t,c));if(!l)continue;l.status==="done"?n.push(rl(l,"added-as-done")):l.status==="archived"&&n.push(rl(l,"archived"))}else if(s.startsWith("D")){let l=f_(_O(t,e,a));l&&n.push(rl(l,"archived"))}else{let l=f_(p_(t,c));if(!l)continue;let d=f_(_O(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(rl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(rl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(rl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function eH(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function rl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>bO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function f_(t){if(t===null)return null;let e;try{e=(0,m_.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=rH(t,e);if(!vge(r))return null;try{return Sge(r,"utf8")}catch{return null}}function _O(t,e,r){try{return Af(t,["show",`${e}:${r}`])}catch{return null}}function $ge(t,e){let r=kge(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 kge(t){let e=p_(t,rH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,m_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function tH(t){let e={};if(t!==null)try{let n=(0,m_.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 Tge(t,e){let r=Af(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);Ege.test(a)&&(Age.test(a)||n.push({hash:s,subject:a}))}return n}var m_,Ege,Age,nl=y(()=>{"use strict";m_=St(Qt(),1);ya();Ege=/^(feat|fix)(\([^)]*\))?!?:/,Age=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as nH}from"node:child_process";import{appendFileSync as Oge,existsSync as vO,mkdirSync as Rge,readFileSync as Ige,renameSync as Pge,statSync as Cge}from"node:fs";import{userInfo as Dge}from"node:os";import{dirname as Nge,join as wO}from"node:path";function xO(t){return wO(t,iH,jge)}function Xr(t,e){let r=xO(t),n=Nge(r);vO(n)||Rge(n,{recursive:!0});try{vO(r)&&Cge(r).size>Mge&&Pge(r,wO(n,oH))}catch{}Oge(r,`${JSON.stringify(e)} -`,"utf8")}function SO(t){if(!vO(t))return[];let e=Ige(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function _a(t){return SO(xO(t))}function h_(t){return[...SO(wO(t,iH,oH)),...SO(xO(t))]}function Qr(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 Fge(t){let e;try{e=nH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Dge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Lge(t){try{return nH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Tf(t,e){try{let r=_a(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Lge(t),i=Fge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Tf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var iH,jge,oH,Mge,Nr=y(()=>{"use strict";iH=".cladding",jge="events.log.jsonl",oH="events.log.1.jsonl",Mge=5*1024*1024});import{execFileSync as zge}from"node:child_process";import{existsSync as sH,readdirSync as Uge,readFileSync as qge,statSync as aH}from"node:fs";import{createHash as Bge}from"node:crypto";import{join as $O}from"node:path";function ba(t){try{return zge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function kO(t){let e=[],r=$O(t,"spec.yaml");sH(r)&&aH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=$O(t,"spec",i);if(!(!sH(o)||!aH(o).isDirectory()))for(let s of Uge(o))s.endsWith(".yaml")&&e.push($O(o,s))}e.sort();let n=Bge("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(qge(i)),n.update("\0")}return n.digest("hex")}function g_(t,e){let r={featureId:e,gitHead:ba(t),specDigest:kO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function y_(t,e){let r=_a(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 __(t,e,r,n){let i=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Of=y(()=>{"use strict";Nr()});import{readFileSync as Hge,statSync as Gge}from"node:fs";import{extname as Zge,resolve as EO,sep as Vge}from"node:path";function en(t){return Math.ceil(t.length/4)}function Jge(t,e){let r=EO(e),n=EO(r,t);return n===r||n.startsWith(r+Vge)}function lH(t,e,r,n){if(!Jge(t,e))return{path:t,omitted:"unsafe-path"};if(!Wge.has(Zge(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>cH)return{path:t,omitted:"too-large",bytes:o}}else{let l=EO(e,t);try{o=Gge(l).size}catch{return{path:t,omitted:"missing"}}if(o>cH)return{path:t,omitted:"too-large",bytes:o};try{i=Hge(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(Kge))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=u_(e),n=rl(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=u_(e),n=rl(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())}}};XB.Parser=_O});var nH=v(Rf=>{"use strict";var QB=oO(),lge=Sf(),Of=$f(),uge=nT(),dge=Ce(),fge=yO(),eH=bO();function tH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new fge.LineCounter||null,prettyErrors:e}}function pge(t,e={}){let{lineCounter:r,prettyErrors:n}=tH(e),i=new eH.Parser(r?.addNewLine),o=new QB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Of.prettifyError(t,r)),a.warnings.forEach(Of.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function rH(t,e={}){let{lineCounter:r,prettyErrors:n}=tH(e),i=new eH.Parser(r?.addNewLine),o=new QB.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 Of.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Of.prettifyError(t,r)),s.warnings.forEach(Of.prettifyError(t,r))),s}function mge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=rH(t,r);if(!i)return null;if(i.warnings.forEach(o=>uge.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 hge(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 dge.isDocument(t)&&!n?t.toString(r):new lge.Document(t,n,r).toString(r)}Rf.parse=mge;Rf.parseAllDocuments=pge;Rf.parseDocument=rH;Rf.stringify=hge});var Qt=v(Ze=>{"use strict";var gge=oO(),yge=Sf(),_ge=LT(),vO=$f(),bge=of(),es=Ce(),vge=Ko(),Sge=Ct(),wge=Yo(),xge=Xo(),$ge=c_(),kge=hO(),Ege=yO(),Age=bO(),f_=nH(),iH=ef();Ze.Composer=gge.Composer;Ze.Document=yge.Document;Ze.Schema=_ge.Schema;Ze.YAMLError=vO.YAMLError;Ze.YAMLParseError=vO.YAMLParseError;Ze.YAMLWarning=vO.YAMLWarning;Ze.Alias=bge.Alias;Ze.isAlias=es.isAlias;Ze.isCollection=es.isCollection;Ze.isDocument=es.isDocument;Ze.isMap=es.isMap;Ze.isNode=es.isNode;Ze.isPair=es.isPair;Ze.isScalar=es.isScalar;Ze.isSeq=es.isSeq;Ze.Pair=vge.Pair;Ze.Scalar=Sge.Scalar;Ze.YAMLMap=wge.YAMLMap;Ze.YAMLSeq=xge.YAMLSeq;Ze.CST=$ge;Ze.Lexer=kge.Lexer;Ze.LineCounter=Ege.LineCounter;Ze.Parser=Age.Parser;Ze.parse=f_.parse;Ze.parseAllDocuments=f_.parseAllDocuments;Ze.parseDocument=f_.parseDocument;Ze.stringify=f_.stringify;Ze.visit=iH.visit;Ze.visitAsync=iH.visitAsync});import{execFileSync as oH}from"node:child_process";import{existsSync as p_}from"node:fs";import{join as m_,resolve as Tge}from"node:path";function Oge(t){try{let e=oH("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Tge(t,e):null}catch{return null}}function SO(t){let e=Oge(t);if(!e)return null;try{if(p_(m_(e,"MERGE_HEAD")))return"merge";if(p_(m_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(p_(m_(e,"rebase-merge"))||p_(m_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ga(t){return SO(t)!==null}function wO(t,e){try{let r=oH("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 h_(t,e){return wO(t,e)!==null}var ya=y(()=>{"use strict"});import{execFileSync as Rge}from"node:child_process";import{existsSync as Ige,readFileSync as Pge}from"node:fs";import{join as cH}from"node:path";function If(t,e){return Rge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ts(t){try{let e=If(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 rs(t,e){Cge(t,e);let r=If(t,["rev-parse","HEAD"]).trim(),n=Dge(t,e);return{groups:Nge(t,n),head:r,inventory:{after:aH(y_(t,"spec.yaml")),before:aH(xO(t,e,"spec.yaml"))},since:e,unsharded_commits:Lge(t,e)}}function $O(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 Cge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!h_(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 Dge(t,e){let r=If(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(!(!sH(c)&&!sH(a)))if(s.startsWith("A")){let l=g_(y_(t,c));if(!l)continue;l.status==="done"?n.push(nl(l,"added-as-done")):l.status==="archived"&&n.push(nl(l,"archived"))}else if(s.startsWith("D")){let l=g_(xO(t,e,a));l&&n.push(nl(l,"archived"))}else{let l=g_(y_(t,c));if(!l)continue;let d=g_(xO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(nl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(nl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(nl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function sH(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function nl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>$O(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function g_(t){if(t===null)return null;let e;try{e=(0,__.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 y_(t,e){let r=cH(t,e);if(!Ige(r))return null;try{return Pge(r,"utf8")}catch{return null}}function xO(t,e,r){try{return If(t,["show",`${e}:${r}`])}catch{return null}}function Nge(t,e){let r=jge(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 jge(t){let e=y_(t,cH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,__.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function aH(t){let e={};if(t!==null)try{let n=(0,__.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 Lge(t,e){let r=If(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);Mge.test(a)&&(Fge.test(a)||n.push({hash:s,subject:a}))}return n}var __,Mge,Fge,il=y(()=>{"use strict";__=St(Qt(),1);ya();Mge=/^(feat|fix)(\([^)]*\))?!?:/,Fge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as lH}from"node:child_process";import{appendFileSync as zge,existsSync as kO,mkdirSync as Uge,readFileSync as qge,renameSync as Bge,statSync as Hge}from"node:fs";import{userInfo as Gge}from"node:os";import{dirname as Zge,join as AO}from"node:path";function TO(t){return AO(t,uH,Vge)}function Xr(t,e){let r=TO(t),n=Zge(r);kO(n)||Uge(n,{recursive:!0});try{kO(r)&&Hge(r).size>Wge&&Bge(r,AO(n,dH))}catch{}zge(r,`${JSON.stringify(e)} +`,"utf8")}function EO(t){if(!kO(t))return[];let e=qge(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function _a(t){return EO(TO(t))}function b_(t){return[...EO(AO(t,uH,dH)),...EO(TO(t))]}function Qr(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 Kge(t){let e;try{e=lH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Gge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Jge(t){try{return lH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Pf(t,e){try{let r=_a(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Jge(t),i=Kge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Pf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var uH,Vge,dH,Wge,Nr=y(()=>{"use strict";uH=".cladding",Vge="events.log.jsonl",dH="events.log.1.jsonl",Wge=5*1024*1024});import{execFileSync as Yge}from"node:child_process";import{existsSync as fH,readdirSync as Xge,readFileSync as Qge,statSync as pH}from"node:fs";import{createHash as eye}from"node:crypto";import{join as OO}from"node:path";function ba(t){try{return Yge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function RO(t){let e=[],r=OO(t,"spec.yaml");fH(r)&&pH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=OO(t,"spec",i);if(!(!fH(o)||!pH(o).isDirectory()))for(let s of Xge(o))s.endsWith(".yaml")&&e.push(OO(o,s))}e.sort();let n=eye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Qge(i)),n.update("\0")}return n.digest("hex")}function v_(t,e){let r={featureId:e,gitHead:ba(t),specDigest:RO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function S_(t,e){let r=_a(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 w_(t,e,r,n){let i=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Cf=y(()=>{"use strict";Nr()});import{readFileSync as tye,statSync as rye}from"node:fs";import{extname as nye,resolve as IO,sep as iye}from"node:path";function en(t){return Math.ceil(t.length/4)}function aye(t,e){let r=IO(e),n=IO(r,t);return n===r||n.startsWith(r+iye)}function hH(t,e,r,n){if(!aye(t,e))return{path:t,omitted:"unsafe-path"};if(!oye.has(nye(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>mH)return{path:t,omitted:"too-large",bytes:o}}else{let l=IO(e,t);try{o=rye(l).size}catch{return{path:t,omitted:"missing"}}if(o>mH)return{path:t,omitted:"too-large",bytes:o};try{i=tye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(sye))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 Wge,cH,Kge,b_=y(()=>{"use strict";Wge=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"]),cH=2e6,Kge="\0"});function Xge(t){for(let i of Yge)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 AO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function Qge(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??[])AO(e,s,o);for(let s of i.modules??[])AO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Xge(a);c&&AO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=uH.get(t);return e||(e=Qge(t),uH.set(t,e)),e}var Yge,uH,va=y(()=>{"use strict";Yge=["derived:","fixture:","script:","self-dogfood:"];uH=new WeakMap});function TO(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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=eye(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=TO(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:OO(i)}}var Sa=y(()=>{"use strict";va()});function dH(t){return t.impacted.length}function S_(t,e,r={}){let n=r.initialDepth??v_.initialDepth,i=r.maxDepth??v_.maxDepth,o=r.coverageThreshold??v_.coverageThreshold,s=r.marginYieldThreshold??v_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=TO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=dH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var v_,RO=y(()=>{"use strict";Sa();va();v_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function tye(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 fH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=tye(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 pH=y(()=>{"use strict"});function rye(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 il(t,e){let r=rye(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=fH(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 w_=y(()=>{"use strict";pH()});import{existsSync as hH,readdirSync as nye,readFileSync as iye}from"node:fs";import{join as PO}from"node:path";function CO(t,e=sye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function aye(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:CO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:CO(`done reverted \u2014 pre-push strict gate red${r}`)}}function mH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function cye(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 CO(n)}function lye(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)=>mH(m)-mH(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(-oye).map(aye),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?cye(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 IO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function uye(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 dye(t,e,r){let n=IO(t,/_Rolled back at_\s*`([^`]+)`/),i=IO(t,/Last failed gate:\s*`([^`]+)`/),o=IO(t,/Retry attempts:\s*(\d+)/),s=uye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function fye(t,e){let r=PO(t,".cladding","post-mortems");if(!hH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of nye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(dye(iye(PO(r,o),"utf8"),e,o))}catch{}return i}function gH(t,e){try{let r=h_(t),n=fye(t,e),i=hH(PO(t,".cladding","events.log.1.jsonl"));return lye(r,n,e,{truncated:i})}catch{return}}var oye,sye,yH=y(()=>{"use strict";Nr();oye=5,sye=120});function x_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function wa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:pye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let oe=[...a].sort();o=oe[0],oe.length>1&&(s=oe)}let c=il(t,o);if("not_found"in c)return c;let l=c.focus,u=gH(n,l.id),d=a&&a.size>0?e:l.id,f=S_(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(oe=>oe.ears==="unwanted"||oe.ears==="state").map(oe=>({id:oe.id,ears:String(oe.ears)})),S=[...new Set(b.flatMap(oe=>oe.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}},O=[...c.ancestors];for(;O.length>mye&&x_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${oe} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${oe}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(oe,Pe)=>({impacted:oe,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(oe,Pe,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],so={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(oe,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(so))>i},se=m,Y=h;if($(se,Y,0,0)){let oe=br(t,d,{depth:1}),Pe=new Set("not_found"in oe?[]:oe.impacted.map(de=>de.id)),Kt=new Set("not_found"in oe?[]:oe.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],so=0;for(;Yt.length>Pe.size&&$(Yt,Y,so,0);)Yt=Yt.slice(0,-1),so++;let vi=[...h],Yr=0;for(;$(Yt,vi,so,Yr);){let de=-1;for(let ao=vi.length-1;ao>=0;ao--)if(!Kt.has(vi[ao])){de=ao;break}if(de<0)break;vi.splice(de,1),Yr++}se=Yt,Y=vi,so+Yr>0&&x.push(`breaks: omitted ${so} feature(s) / ${Yr} test(s)`),$(se,Y,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Oe=D(se,Y),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Oe},P=C;if(u){let oe={...C,prior_attempts:u};en(JSON.stringify(oe))<=i?P=oe:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var pye,mye,$_=y(()=>{"use strict";b_();w_();RO();yH();Sa();va();pye=3e3,mye=3});function Kn(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 hye(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 _H(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=wa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=wa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=S_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:hye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var ol,k_=y(()=>{"use strict";b_();RO();$_();va();ol="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as gye,existsSync as DO,mkdirSync as yye,readFileSync as bH}from"node:fs";import{dirname as _ye,join as bye}from"node:path";function NO(t){return bye(t,vye,Sye)}function wye(t,e){return{timestamp:new Date().toISOString(),head:ba(t),spec_digest:kO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function vH(t,e){try{let r=wye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=jO(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=NO(t),s=_ye(o);return DO(s)||yye(s,{recursive:!0}),gye(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function SH(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 jO(t,e){let r=NO(t);if(!DO(r))return[];let n;try{n=bH(r,"utf8")}catch{return[]}let i=SH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function wH(t){let e=NO(t);if(!DO(e))return{snapshots:[],unreadable:!1};let r;try{r=bH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=SH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Rf(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 xH(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?` (${Rf(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(` ${ol}`),i.join(` -`)}var vye,Sye,If=y(()=>{"use strict";Of();k_();vye=".cladding",Sye="measure.jsonl"});import{existsSync as xye}from"node:fs";import{join as $ye}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}** (${kye[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 kH(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 ${Rf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Rf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Rf(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`,"",ol),r.join(` -`)}function al(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"} | ${Aye(l,r)} |`)}return n.join(` -`)}function Aye(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 Eye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${xye($ye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function cl(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),$H(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)$H(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function $H(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=bO(r);n&&t.push(`- ${n}`)}t.push("")}var kye,Eye,E_=y(()=>{"use strict";If();k_();nl();kye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Eye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Tye}from"node:fs";function ki(t="./spec.yaml"){let e=Tye(t,"utf8");return(0,EH.parse)(e)}var EH,A_=y(()=>{"use strict";EH=St(Qt(),1)});var rs=v((jr,zO)=>{"use strict";var MO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+TH(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()};MO.prototype.toString=function(){return this.property+" "+this.message};var T_=jr.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};T_.prototype.addError=function(e){var r;if(typeof e=="string")r=new MO(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 MO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new xa(this);if(this.throwError)throw r;return r};T_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Oye(t,e){return e+": "+t.toString()+` -`}T_.prototype.toString=function(e){return this.errors.map(Oye).join("")};Object.defineProperty(T_.prototype,"valid",{get:function(){return!this.errors.length}});zO.exports.ValidatorResultError=xa;function xa(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,xa),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}xa.prototype=new Error;xa.prototype.constructor=xa;xa.prototype.name="Validation Error";var AH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};AH.prototype=Object.create(Error.prototype,{constructor:{value:AH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var FO=jr.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+TH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};FO.prototype.resolve=function(e){return OH(this.base,e)};FO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=OH(this.base,i||"");var s=new FO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var TH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 Rye(t,e,r,n){typeof r=="object"?e[n]=LO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Iye(t,e,r){e[r]=t[r]}function Pye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=LO(t[n],e[n]):r[n]=e[n]}function LO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Rye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Iye.bind(null,t,n)),Object.keys(e).forEach(Pye.bind(null,t,e,n))),n}zO.exports.deepMerge=LO;jr.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 Cye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Cye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var OH=jr.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 CH=v((hXe,PH)=>{"use strict";var tn=rs(),Fe=tn.ValidatorResult,ns=tn.SchemaError,UO={};UO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=UO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 qO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new ns("anyOf must be an array");if(!r.anyOf.some(qO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new ns("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new ns("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(qO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=qO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 BO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new ns('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(BO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 ns('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=BO(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 RH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 ns('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&&RH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)RH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Dye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var HO=rs();GO.exports.SchemaScanResult=DH;function DH(t,e){this.id=t,this.ref=e}GO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=HO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=HO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!HO.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 NH=CH(),is=rs(),jH=O_().scan,MH=is.ValidatorResult,Nye=is.ValidatorResultError,Pf=is.SchemaError,FH=is.SchemaContext,jye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ei),this.attributes=Object.create(NH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=jH(r||jye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=is.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Pf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Pf('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 Ei=Jt.prototype.types={};Ei.string=function(e){return typeof e=="string"};Ei.number=function(e){return typeof e=="number"&&isFinite(e)};Ei.integer=function(e){return typeof e=="number"&&e%1===0};Ei.boolean=function(e){return typeof e=="boolean"};Ei.array=function(e){return Array.isArray(e)};Ei.null=function(e){return e===null};Ei.date=function(e){return e instanceof Date};Ei.any=function(e){return!0};Ei.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};zH.exports=Jt});var qH=v((_Xe,fo)=>{"use strict";var Mye=fo.exports.Validator=UH();fo.exports.ValidatorResult=rs().ValidatorResult;fo.exports.ValidatorResultError=rs().ValidatorResultError;fo.exports.ValidationError=rs().ValidationError;fo.exports.SchemaError=rs().SchemaError;fo.exports.SchemaScanResult=O_().SchemaScanResult;fo.exports.scan=O_().scan;fo.exports.validate=function(t,e,r){var n=new Mye;return n.validate(t,e,r)}});import{readFileSync as Fye}from"node:fs";import{dirname as Lye,join as zye}from"node:path";import{fileURLToPath as Uye}from"node:url";function Zye(t){let e=Gye.validate(t,Hye);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function HH(t){let e=Zye(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 oye,mH,sye,x_=y(()=>{"use strict";oye=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"]),mH=2e6,sye="\0"});function lye(t){for(let i of cye)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 PO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function uye(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??[])PO(e,s,o);for(let s of i.modules??[])PO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=lye(a);c&&PO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=gH.get(t);return e||(e=uye(t),gH.set(t,e)),e}var cye,gH,va=y(()=>{"use strict";cye=["derived:","fixture:","script:","self-dogfood:"];gH=new WeakMap});function CO(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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=dye(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=CO(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:DO(i)}}var Sa=y(()=>{"use strict";va()});function yH(t){return t.impacted.length}function k_(t,e,r={}){let n=r.initialDepth??$_.initialDepth,i=r.maxDepth??$_.maxDepth,o=r.coverageThreshold??$_.coverageThreshold,s=r.marginYieldThreshold??$_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=CO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=yH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var $_,NO=y(()=>{"use strict";Sa();va();$_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function fye(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 _H(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=fye(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 bH=y(()=>{"use strict"});function pye(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 ol(t,e){let r=pye(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=_H(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 E_=y(()=>{"use strict";bH()});import{existsSync as SH,readdirSync as mye,readFileSync as hye}from"node:fs";import{join as MO}from"node:path";function FO(t,e=yye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function _ye(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:FO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:FO(`done reverted \u2014 pre-push strict gate red${r}`)}}function vH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function bye(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 FO(n)}function vye(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)=>vH(m)-vH(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(-gye).map(_ye),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?bye(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 Sye(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 wye(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=Sye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function xye(t,e){let r=MO(t,".cladding","post-mortems");if(!SH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of mye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(wye(hye(MO(r,o),"utf8"),e,o))}catch{}return i}function wH(t,e){try{let r=b_(t),n=xye(t,e),i=SH(MO(t,".cladding","events.log.1.jsonl"));return vye(r,n,e,{truncated:i})}catch{return}}var gye,yye,xH=y(()=>{"use strict";Nr();gye=5,yye=120});function A_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function wa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:$ye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=ol(t,o);if("not_found"in c)return c;let l=c.focus,u=wH(n,l.id),d=a&&a.size>0?e:l.id,f=k_(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}},O=[...c.ancestors];for(;O.length>kye&&A_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Pe,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],ao={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(ao))>i},ie=m,J=h;if($(ie,J,0,0)){let se=br(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],ao=0;for(;Yt.length>Pe.size&&$(Yt,J,ao,0);)Yt=Yt.slice(0,-1),ao++;let vi=[...h],Yr=0;for(;$(Yt,vi,ao,Yr);){let de=-1;for(let co=vi.length-1;co>=0;co--)if(!Kt.has(vi[co])){de=co;break}if(de<0)break;vi.splice(de,1),Yr++}ie=Yt,J=vi,ao+Yr>0&&x.push(`breaks: omitted ${ao} feature(s) / ${Yr} test(s)`),$(ie,J,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Oe=D(ie,J),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Oe},P=C;if(u){let se={...C,prior_attempts:u};en(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var $ye,kye,T_=y(()=>{"use strict";x_();E_();NO();xH();Sa();va();$ye=3e3,kye=3});function Kn(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 Eye(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 $H(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=wa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=wa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=k_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:Eye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var sl,O_=y(()=>{"use strict";x_();NO();T_();va();sl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Aye,existsSync as LO,mkdirSync as Tye,readFileSync as kH}from"node:fs";import{dirname as Oye,join as Rye}from"node:path";function zO(t){return Rye(t,Iye,Pye)}function Cye(t,e){return{timestamp:new Date().toISOString(),head:ba(t),spec_digest:RO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function EH(t,e){try{let r=Cye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=UO(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=zO(t),s=Oye(o);return LO(s)||Tye(s,{recursive:!0}),Aye(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function AH(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 UO(t,e){let r=zO(t);if(!LO(r))return[];let n;try{n=kH(r,"utf8")}catch{return[]}let i=AH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function TH(t){let e=zO(t);if(!LO(e))return{snapshots:[],unreadable:!1};let r;try{r=kH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=AH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Df(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 OH(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?` (${Df(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(` ${sl}`),i.join(` +`)}var Iye,Pye,Nf=y(()=>{"use strict";Cf();O_();Iye=".cladding",Pye="measure.jsonl"});import{existsSync as Dye}from"node:fs";import{join as Nye}from"node:path";function al(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}** (${jye[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 IH(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 ${Df(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Df(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Df(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`,"",sl),r.join(` +`)}function cl(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"} | ${Fye(l,r)} |`)}return n.join(` +`)}function Fye(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 Mye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Dye(Nye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function ll(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),RH(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)RH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function RH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=$O(r);n&&t.push(`- ${n}`)}t.push("")}var jye,Mye,R_=y(()=>{"use strict";Nf();O_();il();jye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Mye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Lye}from"node:fs";function ki(t="./spec.yaml"){let e=Lye(t,"utf8");return(0,PH.parse)(e)}var PH,I_=y(()=>{"use strict";PH=St(Qt(),1)});var ns=v((jr,GO)=>{"use strict";var qO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+DH(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()};qO.prototype.toString=function(){return this.property+" "+this.message};var P_=jr.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};P_.prototype.addError=function(e){var r;if(typeof e=="string")r=new qO(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 qO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new xa(this);if(this.throwError)throw r;return r};P_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function zye(t,e){return e+": "+t.toString()+` +`}P_.prototype.toString=function(e){return this.errors.map(zye).join("")};Object.defineProperty(P_.prototype,"valid",{get:function(){return!this.errors.length}});GO.exports.ValidatorResultError=xa;function xa(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,xa),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}xa.prototype=new Error;xa.prototype.constructor=xa;xa.prototype.name="Validation Error";var CH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};CH.prototype=Object.create(Error.prototype,{constructor:{value:CH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var BO=jr.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+DH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};BO.prototype.resolve=function(e){return NH(this.base,e)};BO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=NH(this.base,i||"");var s=new BO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var DH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 Uye(t,e,r,n){typeof r=="object"?e[n]=HO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function qye(t,e,r){e[r]=t[r]}function Bye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=HO(t[n],e[n]):r[n]=e[n]}function HO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Uye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(qye.bind(null,t,n)),Object.keys(e).forEach(Bye.bind(null,t,e,n))),n}GO.exports.deepMerge=HO;jr.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 Hye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Hye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var NH=jr.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 LH=v((zXe,FH)=>{"use strict";var tn=ns(),Fe=tn.ValidatorResult,is=tn.SchemaError,ZO={};ZO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=ZO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 VO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new is("anyOf must be an array");if(!r.anyOf.some(VO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new is("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new is("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(VO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=VO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 WO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new is('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(WO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 is('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=WO(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 jH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 is('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&&jH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)jH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Gye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var KO=ns();JO.exports.SchemaScanResult=zH;function zH(t,e){this.id=t,this.ref=e}JO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=KO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=KO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!KO.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 UH=LH(),os=ns(),qH=C_().scan,BH=os.ValidatorResult,Zye=os.ValidatorResultError,jf=os.SchemaError,HH=os.SchemaContext,Vye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ei),this.attributes=Object.create(UH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=qH(r||Vye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=os.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}};Jt.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 Ei=Jt.prototype.types={};Ei.string=function(e){return typeof e=="string"};Ei.number=function(e){return typeof e=="number"&&isFinite(e)};Ei.integer=function(e){return typeof e=="number"&&e%1===0};Ei.boolean=function(e){return typeof e=="boolean"};Ei.array=function(e){return Array.isArray(e)};Ei.null=function(e){return e===null};Ei.date=function(e){return e instanceof Date};Ei.any=function(e){return!0};Ei.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};ZH.exports=Jt});var WH=v((BXe,po)=>{"use strict";var Wye=po.exports.Validator=VH();po.exports.ValidatorResult=ns().ValidatorResult;po.exports.ValidatorResultError=ns().ValidatorResultError;po.exports.ValidationError=ns().ValidationError;po.exports.SchemaError=ns().SchemaError;po.exports.SchemaScanResult=C_().SchemaScanResult;po.exports.scan=C_().scan;po.exports.validate=function(t,e,r){var n=new Wye;return n.validate(t,e,r)}});import{readFileSync as Kye}from"node:fs";import{dirname as Jye,join as Yye}from"node:path";import{fileURLToPath as Xye}from"node:url";function n_e(t){let e=r_e.validate(t,t_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function JH(t){let e=n_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var BH,qye,Bye,Hye,Gye,GH=y(()=>{"use strict";BH=St(qH(),1),qye=Lye(Uye(import.meta.url)),Bye=zye(qye,"schema.json"),Hye=JSON.parse(Fye(Bye,"utf8")),Gye=new BH.Validator});import{existsSync as ZO,readdirSync as Vye}from"node:fs";import{dirname as Wye,join as $a,resolve as VH}from"node:path";function ZH(t){return ZO(t)?Vye(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ki($a(t,r))):[]}function ka(t,e){R_=e?{cwd:VH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return R_&&e==="spec.yaml"&&VH(t)===R_.cwd?R_.spec:Kye(t,e)}function Kye(t,e){let r=$a(t,e),n=ki(r),i=$a(t,Wye(e),"spec");if(!n.features||n.features.length===0){let o=ZH($a(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=ZH($a(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=$a(i,"architecture.yaml");ZO(o)&&(n.architecture=ki(o))}if(!n.capabilities||n.capabilities.length===0){let o=$a(i,"capabilities.yaml");if(ZO(o)){let s=ki(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return HH(n),n}var R_,qe=y(()=>{"use strict";A_();GH();R_=null});import ll from"node:process";function KO(){return!!ll.stdout.isTTY}function U(t,e,r=""){let n=WH[t],i=r?` ${r}`:"";KO()?ll.stdout.write(`${VO[t]}${n}${WO} ${e}${i} -`):ll.stdout.write(`${n} ${e}${i} -`)}function Cf(t,e,r=""){if(!KO())return;let n=r?` ${r}`:"";ll.stdout.write(`${KH}${VO.start}\xB7${WO} ${t} \xB7 ${e}${n}`)}function Ea(t,e,r=""){let n=WH[t],i=r?` ${r}`:"";KO()?ll.stdout.write(`${KH}${VO[t]}${n}${WO} ${e}${i} -`):ll.stdout.write(`${n} ${e}${i} -`)}var WH,VO,WO,KH,Ai=y(()=>{"use strict";WH={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},VO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},WO="\x1B[0m",KH="\r\x1B[K"});import{createHash as gG}from"node:crypto";import{existsSync as A_e,readFileSync as XO,writeFileSync as T_e}from"node:fs";import{join as I_}from"node:path";function O_e(t,e){let r=gG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(XO(I_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function _G(t,e){let r=gG("sha256");try{r.update(XO(I_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function os(t){let e=I_(t,...yG);if(!A_e(e))return null;let r;try{r=XO(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function P_(t){return t.features?.size??t.v1?.size??0}function C_(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)!==_G(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===O_e(e,n)?{state:"fresh"}:{state:"stale"}}function bG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${_G(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=R_e+`attested_modules: + `)}`)}var KH,Qye,e_e,t_e,r_e,YH=y(()=>{"use strict";KH=St(WH(),1),Qye=Jye(Xye(import.meta.url)),e_e=Yye(Qye,"schema.json"),t_e=JSON.parse(Kye(e_e,"utf8")),r_e=new KH.Validator});import{existsSync as YO,readdirSync as i_e}from"node:fs";import{dirname as o_e,join as $a,resolve as QH}from"node:path";function XH(t){return YO(t)?i_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ki($a(t,r))):[]}function ka(t,e){D_=e?{cwd:QH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return D_&&e==="spec.yaml"&&QH(t)===D_.cwd?D_.spec:s_e(t,e)}function s_e(t,e){let r=$a(t,e),n=ki(r),i=$a(t,o_e(e),"spec");if(!n.features||n.features.length===0){let o=XH($a(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=XH($a(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=$a(i,"architecture.yaml");YO(o)&&(n.architecture=ki(o))}if(!n.capabilities||n.capabilities.length===0){let o=$a(i,"capabilities.yaml");if(YO(o)){let s=ki(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return JH(n),n}var D_,qe=y(()=>{"use strict";I_();YH();D_=null});import ul from"node:process";function eR(){return!!ul.stdout.isTTY}function L(t,e,r=""){let n=eG[t],i=r?` ${r}`:"";eR()?ul.stdout.write(`${XO[t]}${n}${QO} ${e}${i} +`):ul.stdout.write(`${n} ${e}${i} +`)}function Mf(t,e,r=""){if(!eR())return;let n=r?` ${r}`:"";ul.stdout.write(`${tG}${XO.start}\xB7${QO} ${t} \xB7 ${e}${n}`)}function Ea(t,e,r=""){let n=eG[t],i=r?` ${r}`:"";eR()?ul.stdout.write(`${tG}${XO[t]}${n}${QO} ${e}${i} +`):ul.stdout.write(`${n} ${e}${i} +`)}var eG,XO,QO,tG,Ai=y(()=>{"use strict";eG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},XO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},QO="\x1B[0m",tG="\r\x1B[K"});import{createHash as wG}from"node:crypto";import{existsSync as F_e,readFileSync as nR,writeFileSync as L_e}from"node:fs";import{join as N_}from"node:path";function z_e(t,e){let r=wG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(nR(N_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function $G(t,e){let r=wG("sha256");try{r.update(nR(N_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ss(t){let e=N_(t,...xG);if(!F_e(e))return null;let r;try{r=nR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function j_(t){return t.features?.size??t.v1?.size??0}function M_(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)!==$G(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===z_e(e,n)?{state:"fresh"}:{state:"stale"}}function kG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${$G(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=U_e+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return T_e(I_(t,...yG),s,"utf8"),!0}var yG,R_e,dl=y(()=>{"use strict";yG=["spec","attestation.yaml"];R_e=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return L_e(N_(t,...xG),s,"utf8"),!0}var xG,U_e,fl=y(()=>{"use strict";xG=["spec","attestation.yaml"];U_e=`# 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. # @@ -211,53 +211,53 @@ 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 QO}from"node:path";function D_(t){ss={cwd:QO(t),results:new Map}}function vG(t,e,r){!ss||ss.cwd!==QO(e)||ss.results.set(t,r)}function N_(t,e){return!ss||ss.cwd!==QO(e)?null:ss.results.get(t)??null}function j_(){ss=null}var ss,fl=y(()=>{"use strict";ss=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 mo=y(()=>{});import{fileURLToPath as I_e}from"node:url";var pl,P_e,eR,tR,ml=y(()=>{pl=(t,e)=>{let r=tR(P_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},P_e=t=>eR(t)?t.toString():t,eR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,tR=t=>t instanceof URL?I_e(t):t});var M_,rR=y(()=>{mo();ml();M_=(t,e=[],r={})=>{let n=pl(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 C_e}from"node:string_decoder";var SG,wG,Ut,ho,D_e,xG,N_e,F_,$G,j_e,jf,M_e,nR,F_e,rn=y(()=>{({toString:SG}=Object.prototype),wG=t=>SG.call(t)==="[object ArrayBuffer]",Ut=t=>SG.call(t)==="[object Uint8Array]",ho=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),D_e=new TextEncoder,xG=t=>D_e.encode(t),N_e=new TextDecoder,F_=t=>N_e.decode(t),$G=(t,e)=>j_e(t,e).join(""),j_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new C_e(e),n=t.map(o=>typeof o=="string"?xG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},jf=t=>t.length===1&&Ut(t[0])?t[0]:nR(M_e(t)),M_e=t=>t.map(e=>typeof e=="string"?xG(e):e),nR=t=>{let e=new Uint8Array(F_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},F_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as L_e}from"node:child_process";var TG,OG,z_e,U_e,kG,q_e,EG,AG,B_e,RG=y(()=>{mo();rn();TG=t=>Array.isArray(t)&&Array.isArray(t.raw),OG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=z_e({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,{}]},z_e=({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}=U_e(i,t.raw[n]),c=EG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>AG(d)):[AG(l)];return EG(c,u,a)},U_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=kG.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)],AG=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 B_e(t);throw t instanceof L_e||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`)},B_e=({stdout:t})=>{if(typeof t=="string")return t;if(Ut(t))return F_(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 iR from"node:process";var Yn,L_,En,z_,go=y(()=>{Yn=t=>L_.includes(t),L_=[iR.stdin,iR.stdout,iR.stderr],En=["stdin","stdout","stderr"],z_=t=>En[t]??`stdio[${t}]`});import{debuglog as H_e}from"node:util";var PG,oR,G_e,Z_e,V_e,W_e,IG,K_e,sR,J_e,Y_e,X_e,Q_e,aR,yo,_o=y(()=>{mo();go();PG=t=>{let e={...t};for(let r of aR)e[r]=oR(t,r);return e},oR=(t,e)=>{let r=Array.from({length:G_e(t)+1}),n=Z_e(t[e],r,e);return Y_e(n,e)},G_e=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,Z_e=(t,e,r)=>Ot(t)?V_e(t,e,r):e.fill(t),V_e=(t,e,r)=>{for(let n of Object.keys(t).sort(W_e))for(let i of K_e(n,r,e))e[i]=t[n];return e},W_e=(t,e)=>IG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,K_e=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=sR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as iR}from"node:path";function F_(t){as={cwd:iR(t),results:new Map}}function EG(t,e,r){!as||as.cwd!==iR(e)||as.results.set(t,r)}function L_(t,e){return!as||as.cwd!==iR(e)?null:as.results.get(t)??null}function z_(){as=null}var as,pl=y(()=>{"use strict";as=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 ho=y(()=>{});import{fileURLToPath as q_e}from"node:url";var ml,B_e,oR,sR,hl=y(()=>{ml=(t,e)=>{let r=sR(B_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},B_e=t=>oR(t)?t.toString():t,oR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,sR=t=>t instanceof URL?q_e(t):t});var U_,aR=y(()=>{ho();hl();U_=(t,e=[],r={})=>{let n=ml(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 H_e}from"node:string_decoder";var AG,TG,Ut,go,G_e,OG,Z_e,q_,RG,V_e,zf,W_e,cR,K_e,rn=y(()=>{({toString:AG}=Object.prototype),TG=t=>AG.call(t)==="[object ArrayBuffer]",Ut=t=>AG.call(t)==="[object Uint8Array]",go=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),G_e=new TextEncoder,OG=t=>G_e.encode(t),Z_e=new TextDecoder,q_=t=>Z_e.decode(t),RG=(t,e)=>V_e(t,e).join(""),V_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new H_e(e),n=t.map(o=>typeof o=="string"?OG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},zf=t=>t.length===1&&Ut(t[0])?t[0]:cR(W_e(t)),W_e=t=>t.map(e=>typeof e=="string"?OG(e):e),cR=t=>{let e=new Uint8Array(K_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},K_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as J_e}from"node:child_process";var DG,NG,Y_e,X_e,IG,Q_e,PG,CG,ebe,jG=y(()=>{ho();rn();DG=t=>Array.isArray(t)&&Array.isArray(t.raw),NG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Y_e({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,{}]},Y_e=({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}=X_e(i,t.raw[n]),c=PG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>CG(d)):[CG(l)];return PG(c,u,a)},X_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=IG.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)],CG=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 ebe(t);throw t instanceof J_e||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`)},ebe=({stdout:t})=>{if(typeof t=="string")return t;if(Ut(t))return q_(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 lR from"node:process";var Yn,B_,En,H_,yo=y(()=>{Yn=t=>B_.includes(t),B_=[lR.stdin,lR.stdout,lR.stderr],En=["stdin","stdout","stderr"],H_=t=>En[t]??`stdio[${t}]`});import{debuglog as tbe}from"node:util";var FG,uR,rbe,nbe,ibe,obe,MG,sbe,dR,abe,cbe,lbe,ube,fR,_o,bo=y(()=>{ho();yo();FG=t=>{let e={...t};for(let r of fR)e[r]=uR(t,r);return e},uR=(t,e)=>{let r=Array.from({length:rbe(t)+1}),n=nbe(t[e],r,e);return cbe(n,e)},rbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,nbe=(t,e,r)=>Ot(t)?ibe(t,e,r):e.fill(t),ibe=(t,e,r)=>{for(let n of Object.keys(t).sort(obe))for(let i of sbe(n,r,e))e[i]=t[n];return e},obe=(t,e)=>MG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,sbe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=dR(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]},sR=t=>{if(t==="all")return t;if(En.includes(t))return En.indexOf(t);let e=J_e.exec(t);if(e!==null)return Number(e[1])},J_e=/^fd(\d+)$/,Y_e=(t,e)=>t.map(r=>r===void 0?Q_e[e]:r),X_e=H_e("execa").enabled?"full":"none",Q_e={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:X_e,stripFinalNewline:!0},aR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],yo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var hl,gl,CG,cR,ebe,U_,q_,as=y(()=>{_o();hl=({verbose:t},e)=>cR(t,e)!=="none",gl=({verbose:t},e)=>!["none","short"].includes(cR(t,e)),CG=({verbose:t},e)=>{let r=cR(t,e);return U_(r)?r:void 0},cR=(t,e)=>e===void 0?ebe(t):yo(t,e),ebe=t=>t.find(e=>U_(e))??q_.findLast(e=>t.includes(e)),U_=t=>typeof t=="function",q_=["none","short","full"]});import{platform as tbe}from"node:process";import{stripVTControlCharacters as rbe}from"node:util";var DG,Mf,NG,nbe,ibe,obe,sbe,abe,cbe,lbe,B_=y(()=>{DG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>cbe(NG(o))).join(" ");return{command:n,escapedCommand:i}},Mf=t=>rbe(t).split(` -`).map(e=>NG(e)).join(` -`),NG=t=>t.replaceAll(obe,e=>nbe(e)),nbe=t=>{let e=sbe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=abe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},ibe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},obe=ibe(),sbe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},abe=65535,cbe=t=>lbe.test(t)?t:tbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,lbe=/^[\w./-]+$/});import jG from"node:process";function lR(){let{env:t}=jG,{TERM:e,TERM_PROGRAM:r}=t;return jG.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 MG=y(()=>{});var FG,LG,ube,dbe,fbe,pbe,mbe,H_,w7e,zG=y(()=>{MG();FG={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"},LG={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"},ube={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"},dbe={...FG,...LG},fbe={...FG,...ube},pbe=lR(),mbe=pbe?dbe:fbe,H_=mbe,w7e=Object.entries(LG)});import hbe from"node:tty";var gbe,_e,k7e,UG,E7e,A7e,T7e,O7e,R7e,I7e,P7e,C7e,D7e,N7e,j7e,M7e,F7e,L7e,z7e,G_,U7e,q7e,B7e,H7e,G7e,Z7e,V7e,W7e,K7e,qG,J7e,BG,Y7e,X7e,Q7e,eQe,tQe,rQe,nQe,iQe,oQe,sQe,aQe,uR=y(()=>{gbe=hbe?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!gbe)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}},k7e=_e(0,0),UG=_e(1,22),E7e=_e(2,22),A7e=_e(3,23),T7e=_e(4,24),O7e=_e(53,55),R7e=_e(7,27),I7e=_e(8,28),P7e=_e(9,29),C7e=_e(30,39),D7e=_e(31,39),N7e=_e(32,39),j7e=_e(33,39),M7e=_e(34,39),F7e=_e(35,39),L7e=_e(36,39),z7e=_e(37,39),G_=_e(90,39),U7e=_e(40,49),q7e=_e(41,49),B7e=_e(42,49),H7e=_e(43,49),G7e=_e(44,49),Z7e=_e(45,49),V7e=_e(46,49),W7e=_e(47,49),K7e=_e(100,49),qG=_e(91,39),J7e=_e(92,39),BG=_e(93,39),Y7e=_e(94,39),X7e=_e(95,39),Q7e=_e(96,39),eQe=_e(97,39),tQe=_e(101,49),rQe=_e(102,49),nQe=_e(103,49),iQe=_e(104,49),oQe=_e(105,49),sQe=_e(106,49),aQe=_e(107,49)});var HG=y(()=>{uR();uR()});var VG,_be,Z_,GG,bbe,ZG,vbe,WG=y(()=>{zG();HG();VG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=_be(r),c=bbe[t]({failed:o,reject:s,piped:n}),l=vbe[t]({reject:s});return`${G_(`[${a}]`)} ${G_(`[${i}]`)} ${l(c)} ${l(e)}`},_be=t=>`${Z_(t.getHours(),2)}:${Z_(t.getMinutes(),2)}:${Z_(t.getSeconds(),2)}.${Z_(t.getMilliseconds(),3)}`,Z_=(t,e)=>String(t).padStart(e,"0"),GG=({failed:t,reject:e})=>t?e?H_.cross:H_.warning:H_.tick,bbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:GG,duration:GG},ZG=t=>t,vbe={command:()=>UG,output:()=>ZG,ipc:()=>ZG,error:({reject:t})=>t?qG:BG,duration:()=>G_}});var KG,Sbe,wbe,JG=y(()=>{as();KG=(t,e,r)=>{let n=CG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Sbe(i,o,n)).filter(i=>i!==void 0).map(i=>wbe(i)).join("")},Sbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},wbe=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},dR=t=>{if(t==="all")return t;if(En.includes(t))return En.indexOf(t);let e=abe.exec(t);if(e!==null)return Number(e[1])},abe=/^fd(\d+)$/,cbe=(t,e)=>t.map(r=>r===void 0?ube[e]:r),lbe=tbe("execa").enabled?"full":"none",ube={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:lbe,stripFinalNewline:!0},fR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],_o=(t,e)=>e==="ipc"?t.at(-1):t[e]});var gl,yl,LG,pR,dbe,G_,Z_,cs=y(()=>{bo();gl=({verbose:t},e)=>pR(t,e)!=="none",yl=({verbose:t},e)=>!["none","short"].includes(pR(t,e)),LG=({verbose:t},e)=>{let r=pR(t,e);return G_(r)?r:void 0},pR=(t,e)=>e===void 0?dbe(t):_o(t,e),dbe=t=>t.find(e=>G_(e))??Z_.findLast(e=>t.includes(e)),G_=t=>typeof t=="function",Z_=["none","short","full"]});import{platform as fbe}from"node:process";import{stripVTControlCharacters as pbe}from"node:util";var zG,Uf,UG,mbe,hbe,gbe,ybe,_be,bbe,vbe,V_=y(()=>{zG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>bbe(UG(o))).join(" ");return{command:n,escapedCommand:i}},Uf=t=>pbe(t).split(` +`).map(e=>UG(e)).join(` +`),UG=t=>t.replaceAll(gbe,e=>mbe(e)),mbe=t=>{let e=ybe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=_be?`\\u${n.padStart(4,"0")}`:`\\U${n}`},hbe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},gbe=hbe(),ybe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},_be=65535,bbe=t=>vbe.test(t)?t:fbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,vbe=/^[\w./-]+$/});import qG from"node:process";function mR(){let{env:t}=qG,{TERM:e,TERM_PROGRAM:r}=t;return qG.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 BG=y(()=>{});var HG,GG,Sbe,wbe,xbe,$be,kbe,W_,V7e,ZG=y(()=>{BG();HG={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"},GG={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"},Sbe={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"},wbe={...HG,...GG},xbe={...HG,...Sbe},$be=mR(),kbe=$be?wbe:xbe,W_=kbe,V7e=Object.entries(GG)});import Ebe from"node:tty";var Abe,_e,J7e,VG,Y7e,X7e,Q7e,eQe,tQe,rQe,nQe,iQe,oQe,sQe,aQe,cQe,lQe,uQe,dQe,K_,fQe,pQe,mQe,hQe,gQe,yQe,_Qe,bQe,vQe,WG,SQe,KG,wQe,xQe,$Qe,kQe,EQe,AQe,TQe,OQe,RQe,IQe,PQe,hR=y(()=>{Abe=Ebe?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!Abe)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}},J7e=_e(0,0),VG=_e(1,22),Y7e=_e(2,22),X7e=_e(3,23),Q7e=_e(4,24),eQe=_e(53,55),tQe=_e(7,27),rQe=_e(8,28),nQe=_e(9,29),iQe=_e(30,39),oQe=_e(31,39),sQe=_e(32,39),aQe=_e(33,39),cQe=_e(34,39),lQe=_e(35,39),uQe=_e(36,39),dQe=_e(37,39),K_=_e(90,39),fQe=_e(40,49),pQe=_e(41,49),mQe=_e(42,49),hQe=_e(43,49),gQe=_e(44,49),yQe=_e(45,49),_Qe=_e(46,49),bQe=_e(47,49),vQe=_e(100,49),WG=_e(91,39),SQe=_e(92,39),KG=_e(93,39),wQe=_e(94,39),xQe=_e(95,39),$Qe=_e(96,39),kQe=_e(97,39),EQe=_e(101,49),AQe=_e(102,49),TQe=_e(103,49),OQe=_e(104,49),RQe=_e(105,49),IQe=_e(106,49),PQe=_e(107,49)});var JG=y(()=>{hR();hR()});var QG,Obe,J_,YG,Rbe,XG,Ibe,eZ=y(()=>{ZG();JG();QG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Obe(r),c=Rbe[t]({failed:o,reject:s,piped:n}),l=Ibe[t]({reject:s});return`${K_(`[${a}]`)} ${K_(`[${i}]`)} ${l(c)} ${l(e)}`},Obe=t=>`${J_(t.getHours(),2)}:${J_(t.getMinutes(),2)}:${J_(t.getSeconds(),2)}.${J_(t.getMilliseconds(),3)}`,J_=(t,e)=>String(t).padStart(e,"0"),YG=({failed:t,reject:e})=>t?e?W_.cross:W_.warning:W_.tick,Rbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:YG,duration:YG},XG=t=>t,Ibe={command:()=>VG,output:()=>XG,ipc:()=>XG,error:({reject:t})=>t?WG:KG,duration:()=>K_}});var tZ,Pbe,Cbe,rZ=y(()=>{cs();tZ=(t,e,r)=>{let n=LG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Pbe(i,o,n)).filter(i=>i!==void 0).map(i=>Cbe(i)).join("")},Pbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Cbe=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as xbe}from"node:util";var Ti,$be,kbe,Ebe,V_,Abe,yl=y(()=>{B_();WG();JG();Ti=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=$be({type:t,result:i,verboseInfo:n}),s=kbe(e,o),a=KG(s,n,r);a!==""&&console.warn(a.slice(0,-1))},$be=({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}),kbe=(t,e)=>t.split(` -`).map(r=>Ebe({...e,message:r})),Ebe=t=>({verboseLine:VG(t),verboseObject:t}),V_=t=>{let e=typeof t=="string"?t:xbe(t);return Mf(e).replaceAll(" "," ".repeat(Abe))},Abe=2});var YG,XG=y(()=>{as();yl();YG=(t,e)=>{hl(e)&&Ti({type:"command",verboseMessage:t,verboseInfo:e})}});var QG,Tbe,Obe,Rbe,eZ=y(()=>{as();QG=(t,e,r)=>{Rbe(t);let n=Tbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Tbe=t=>hl({verbose:t})?Obe++:void 0,Obe=0n,Rbe=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(!q_.includes(e)&&!U_(e)){let r=q_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as tZ}from"node:process";var W_,dR,K_=y(()=>{W_=()=>tZ.bigint(),dR=t=>Number(tZ.bigint()-t)/1e6});var J_,fR=y(()=>{XG();eZ();K_();B_();_o();J_=(t,e,r)=>{let n=W_(),{command:i,escapedCommand:o}=DG(t,e),s=oR(r,"verbose"),a=QG(s,o,{...r});return YG(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var sZ=v((CQe,oZ)=>{oZ.exports=iZ;iZ.sync=Pbe;var rZ=He("fs");function Ibe(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{uZ.exports=cZ;cZ.sync=Cbe;var aZ=He("fs");function cZ(t,e,r){aZ.stat(t,function(n,i){r(n,n?!1:lZ(i,e))})}function Cbe(t,e){return lZ(aZ.statSync(t),e)}function lZ(t,e){return t.isFile()&&Dbe(t,e)}function Dbe(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 pZ=v((jQe,fZ)=>{var NQe=He("fs"),Y_;process.platform==="win32"||global.TESTING_WINDOWS?Y_=sZ():Y_=dZ();fZ.exports=pR;pR.sync=Nbe;function pR(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){pR(t,e||{},function(o,s){o?i(o):n(s)})})}Y_(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Nbe(t,e){try{return Y_.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var vZ=v((MQe,bZ)=>{var _l=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",mZ=He("path"),jbe=_l?";":":",hZ=pZ(),gZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),yZ=(t,e)=>{let r=e.colon||jbe,n=t.match(/\//)||_l&&t.match(/\\/)?[""]:[..._l?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=_l?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=_l?i.split(r):[""];return _l&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},_Z=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=yZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(gZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=mZ.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];hZ(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)},Mbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=yZ(t,e),o=[];for(let s=0;s{"use strict";var SZ=(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=SZ;mR.exports.default=SZ});var EZ=v((LQe,kZ)=>{"use strict";var xZ=He("path"),Fbe=vZ(),Lbe=wZ();function $Z(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=Fbe.sync(t.command,{path:r[Lbe({env:r})],pathExt:e?xZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=xZ.resolve(i?t.options.cwd:"",s)),s}function zbe(t){return $Z(t)||$Z(t,!0)}kZ.exports=zbe});var AZ=v((zQe,gR)=>{"use strict";var hR=/([()\][%!^"`<>&|;, *?])/g;function Ube(t){return t=t.replace(hR,"^$1"),t}function qbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(hR,"^$1"),e&&(t=t.replace(hR,"^$1")),t}gR.exports.command=Ube;gR.exports.argument=qbe});var OZ=v((UQe,TZ)=>{"use strict";TZ.exports=/^#!(.*)/});var IZ=v((qQe,RZ)=>{"use strict";var Bbe=OZ();RZ.exports=(t="")=>{let e=t.match(Bbe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var CZ=v((BQe,PZ)=>{"use strict";var yR=He("fs"),Hbe=IZ();function Gbe(t){let r=Buffer.alloc(150),n;try{n=yR.openSync(t,"r"),yR.readSync(n,r,0,150,0),yR.closeSync(n)}catch{}return Hbe(r.toString())}PZ.exports=Gbe});var MZ=v((HQe,jZ)=>{"use strict";var Zbe=He("path"),DZ=EZ(),NZ=AZ(),Vbe=CZ(),Wbe=process.platform==="win32",Kbe=/\.(?:com|exe)$/i,Jbe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Ybe(t){t.file=DZ(t);let e=t.file&&Vbe(t.file);return e?(t.args.unshift(t.file),t.command=e,DZ(t)):t.file}function Xbe(t){if(!Wbe)return t;let e=Ybe(t),r=!Kbe.test(e);if(t.options.forceShell||r){let n=Jbe.test(e);t.command=Zbe.normalize(t.command),t.command=NZ.command(t.command),t.args=t.args.map(o=>NZ.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 Qbe(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:Xbe(n)}jZ.exports=Qbe});var zZ=v((GQe,LZ)=>{"use strict";var _R=process.platform==="win32";function bR(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 eve(t,e){if(!_R)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=FZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function FZ(t,e){return _R&&t===1&&!e.file?bR(e.original,"spawn"):null}function tve(t,e){return _R&&t===1&&!e.file?bR(e.original,"spawnSync"):null}LZ.exports={hookChildProcess:eve,verifyENOENT:FZ,verifyENOENTSync:tve,notFoundError:bR}});var BZ=v((ZQe,bl)=>{"use strict";var UZ=He("child_process"),vR=MZ(),SR=zZ();function qZ(t,e,r){let n=vR(t,e,r),i=UZ.spawn(n.command,n.args,n.options);return SR.hookChildProcess(i,n),i}function rve(t,e,r){let n=vR(t,e,r),i=UZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||SR.verifyENOENTSync(i.status,n),i}bl.exports=qZ;bl.exports.spawn=qZ;bl.exports.sync=rve;bl.exports._parse=vR;bl.exports._enoent=SR});function X_(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 HZ=y(()=>{});var GZ=y(()=>{});import{promisify as nve}from"node:util";import{execFile as ive,execFileSync as YQe}from"node:child_process";import ZZ from"node:path";import{fileURLToPath as ove}from"node:url";function Q_(t){return t instanceof URL?ove(t):t}function VZ(t){return{*[Symbol.iterator](){let e=ZZ.resolve(Q_(t)),r;for(;r!==e;)yield e,r=e,e=ZZ.resolve(e,"..")}}}var eet,tet,WZ=y(()=>{GZ();eet=nve(ive);tet=10*1024*1024});import eb from"node:process";import Ta from"node:path";var sve,ave,cve,KZ,JZ=y(()=>{HZ();WZ();sve=({cwd:t=eb.cwd(),path:e=eb.env[X_()],preferLocal:r=!0,execPath:n=eb.execPath,addExecPath:i=!0}={})=>{let o=Ta.resolve(Q_(t)),s=[],a=e.split(Ta.delimiter);return r&&ave(s,a,o),i&&cve(s,a,n,o),e===""||e===Ta.delimiter?`${s.join(Ta.delimiter)}${e}`:[...s,e].join(Ta.delimiter)},ave=(t,e,r)=>{for(let n of VZ(r)){let i=Ta.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},cve=(t,e,r,n)=>{let i=Ta.resolve(n,Q_(r),"..");e.includes(i)||t.push(i)},KZ=({env:t=eb.env,...e}={})=>{t={...t};let r=X_({env:t});return e.path=t[r],t[r]=sve(e),t}});var YZ,Xn,XZ,QZ,e9,tb,Ff,Lf,Oa=y(()=>{YZ=(t,e,r)=>{let n=r?Lf:Ff,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},XZ=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,e9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},QZ=t=>tb(t)&&e9 in t,e9=Symbol("isExecaError"),tb=t=>Object.prototype.toString.call(t)==="[object Error]",Ff=class extends Error{};XZ(Ff,Ff.name);Lf=class extends Error{};XZ(Lf,Lf.name)});var t9,lve,r9,n9,i9=y(()=>{t9=()=>{let t=n9-r9+1;return Array.from({length:t},lve)},lve=(t,e)=>({name:`SIGRT${e+1}`,number:r9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),r9=34,n9=64});var o9,s9=y(()=>{o9=[{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 uve}from"node:os";var wR,dve,a9=y(()=>{s9();i9();wR=()=>{let t=t9();return[...o9,...t].map(dve)},dve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=uve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as fve}from"node:os";var pve,mve,c9,hve,gve,yve,bet,l9=y(()=>{a9();pve=()=>{let t=wR();return Object.fromEntries(t.map(mve))},mve=({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}],c9=pve(),hve=()=>{let t=wR(),e=65,r=Array.from({length:e},(n,i)=>gve(i,t));return Object.assign({},...r)},gve=(t,e)=>{let r=yve(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}}},yve=(t,e)=>{let r=e.find(({name:n})=>fve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},bet=hve()});import{constants as zf}from"node:os";var d9,f9,p9,_ve,bve,u9,vve,xR,Sve,wve,rb,Uf=y(()=>{l9();d9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return p9(t,e)},f9=t=>t===0?t:p9(t,"`subprocess.kill()`'s argument"),p9=(t,e)=>{if(Number.isInteger(t))return _ve(t,e);if(typeof t=="string")return vve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${xR()}`)},_ve=(t,e)=>{if(u9.has(t))return u9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${xR()}`)},bve=()=>new Map(Object.entries(zf.signals).reverse().map(([t,e])=>[e,t])),u9=bve(),vve=(t,e)=>{if(t in zf.signals)return t;throw t.toUpperCase()in zf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${xR()}`)},xR=()=>`Available signal names: ${Sve()}. -Available signal numbers: ${wve()}.`,Sve=()=>Object.keys(zf.signals).sort().map(t=>`'${t}'`).join(", "),wve=()=>[...new Set(Object.values(zf.signals).sort((t,e)=>t-e))].join(", "),rb=t=>c9[t].description});import{setTimeout as xve}from"node:timers/promises";var m9,$ve,h9,kve,Eve,Ave,$R,nb=y(()=>{Oa();Uf();m9=t=>{if(t===!1)return t;if(t===!0)return $ve;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},$ve=1e3*5,h9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=kve(s,a,r);Eve(l,n);let u=t(c);return Ave({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},kve=(t,e,r)=>{let[n=r,i]=tb(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&&!tb(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:f9(n),error:i}},Eve=(t,e)=>{t!==void 0&&e.reject(t)},Ave=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&$R({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},$R=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await xve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Tve}from"node:events";var ib,kR=y(()=>{ib=async(t,e)=>{t.aborted||await Tve(t,"abort",{signal:e})}});var g9,y9,Ove,ER=y(()=>{kR();g9=({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)}`)},y9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Ove(t,e,n,i)],Ove=async(t,e,r,{signal:n})=>{throw await ib(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var vl,Rve,AR,_9,b9,ob,v9,S9,w9,x9,$9,k9,Ive,Pve,Cve,Qn,Dve,cs,Sl,wl=y(()=>{vl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Rve(t,e,r),AR(t,e,n)},Rve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},AR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${cs(e)} has already exited or disconnected.`)},_9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${cs(t)} exited or disconnected.`)},b9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${cs(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as Dbe}from"node:util";var Ti,Nbe,jbe,Mbe,Y_,Fbe,_l=y(()=>{V_();eZ();rZ();Ti=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Nbe({type:t,result:i,verboseInfo:n}),s=jbe(e,o),a=tZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Nbe=({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}),jbe=(t,e)=>t.split(` +`).map(r=>Mbe({...e,message:r})),Mbe=t=>({verboseLine:QG(t),verboseObject:t}),Y_=t=>{let e=typeof t=="string"?t:Dbe(t);return Uf(e).replaceAll(" "," ".repeat(Fbe))},Fbe=2});var nZ,iZ=y(()=>{cs();_l();nZ=(t,e)=>{gl(e)&&Ti({type:"command",verboseMessage:t,verboseInfo:e})}});var oZ,Lbe,zbe,Ube,sZ=y(()=>{cs();oZ=(t,e,r)=>{Ube(t);let n=Lbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Lbe=t=>gl({verbose:t})?zbe++:void 0,zbe=0n,Ube=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(!Z_.includes(e)&&!G_(e)){let r=Z_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as aZ}from"node:process";var X_,gR,Q_=y(()=>{X_=()=>aZ.bigint(),gR=t=>Number(aZ.bigint()-t)/1e6});var eb,yR=y(()=>{iZ();sZ();Q_();V_();bo();eb=(t,e,r)=>{let n=X_(),{command:i,escapedCommand:o}=zG(t,e),s=uR(r,"verbose"),a=oZ(s,o,{...r});return nZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var fZ=v((iet,dZ)=>{dZ.exports=uZ;uZ.sync=Bbe;var cZ=Ge("fs");function qbe(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{gZ.exports=mZ;mZ.sync=Hbe;var pZ=Ge("fs");function mZ(t,e,r){pZ.stat(t,function(n,i){r(n,n?!1:hZ(i,e))})}function Hbe(t,e){return hZ(pZ.statSync(t),e)}function hZ(t,e){return t.isFile()&&Gbe(t,e)}function Gbe(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 bZ=v((aet,_Z)=>{var set=Ge("fs"),tb;process.platform==="win32"||global.TESTING_WINDOWS?tb=fZ():tb=yZ();_Z.exports=_R;_R.sync=Zbe;function _R(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){_R(t,e||{},function(o,s){o?i(o):n(s)})})}tb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Zbe(t,e){try{return tb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var EZ=v((cet,kZ)=>{var bl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",vZ=Ge("path"),Vbe=bl?";":":",SZ=bZ(),wZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),xZ=(t,e)=>{let r=e.colon||Vbe,n=t.match(/\//)||bl&&t.match(/\\/)?[""]:[...bl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=bl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=bl?i.split(r):[""];return bl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},$Z=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=xZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(wZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=vZ.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];SZ(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)},Wbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=xZ(t,e),o=[];for(let s=0;s{"use strict";var AZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};bR.exports=AZ;bR.exports.default=AZ});var PZ=v((det,IZ)=>{"use strict";var OZ=Ge("path"),Kbe=EZ(),Jbe=TZ();function RZ(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=Kbe.sync(t.command,{path:r[Jbe({env:r})],pathExt:e?OZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=OZ.resolve(i?t.options.cwd:"",s)),s}function Ybe(t){return RZ(t)||RZ(t,!0)}IZ.exports=Ybe});var CZ=v((fet,SR)=>{"use strict";var vR=/([()\][%!^"`<>&|;, *?])/g;function Xbe(t){return t=t.replace(vR,"^$1"),t}function Qbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(vR,"^$1"),e&&(t=t.replace(vR,"^$1")),t}SR.exports.command=Xbe;SR.exports.argument=Qbe});var NZ=v((pet,DZ)=>{"use strict";DZ.exports=/^#!(.*)/});var MZ=v((met,jZ)=>{"use strict";var eve=NZ();jZ.exports=(t="")=>{let e=t.match(eve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var LZ=v((het,FZ)=>{"use strict";var wR=Ge("fs"),tve=MZ();function rve(t){let r=Buffer.alloc(150),n;try{n=wR.openSync(t,"r"),wR.readSync(n,r,0,150,0),wR.closeSync(n)}catch{}return tve(r.toString())}FZ.exports=rve});var BZ=v((get,qZ)=>{"use strict";var nve=Ge("path"),zZ=PZ(),UZ=CZ(),ive=LZ(),ove=process.platform==="win32",sve=/\.(?:com|exe)$/i,ave=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function cve(t){t.file=zZ(t);let e=t.file&&ive(t.file);return e?(t.args.unshift(t.file),t.command=e,zZ(t)):t.file}function lve(t){if(!ove)return t;let e=cve(t),r=!sve.test(e);if(t.options.forceShell||r){let n=ave.test(e);t.command=nve.normalize(t.command),t.command=UZ.command(t.command),t.args=t.args.map(o=>UZ.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 uve(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:lve(n)}qZ.exports=uve});var ZZ=v((yet,GZ)=>{"use strict";var xR=process.platform==="win32";function $R(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 dve(t,e){if(!xR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=HZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function HZ(t,e){return xR&&t===1&&!e.file?$R(e.original,"spawn"):null}function fve(t,e){return xR&&t===1&&!e.file?$R(e.original,"spawnSync"):null}GZ.exports={hookChildProcess:dve,verifyENOENT:HZ,verifyENOENTSync:fve,notFoundError:$R}});var KZ=v((_et,vl)=>{"use strict";var VZ=Ge("child_process"),kR=BZ(),ER=ZZ();function WZ(t,e,r){let n=kR(t,e,r),i=VZ.spawn(n.command,n.args,n.options);return ER.hookChildProcess(i,n),i}function pve(t,e,r){let n=kR(t,e,r),i=VZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||ER.verifyENOENTSync(i.status,n),i}vl.exports=WZ;vl.exports.spawn=WZ;vl.exports.sync=pve;vl.exports._parse=kR;vl.exports._enoent=ER});function rb(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 JZ=y(()=>{});var YZ=y(()=>{});import{promisify as mve}from"node:util";import{execFile as hve,execFileSync as $et}from"node:child_process";import XZ from"node:path";import{fileURLToPath as gve}from"node:url";function nb(t){return t instanceof URL?gve(t):t}function QZ(t){return{*[Symbol.iterator](){let e=XZ.resolve(nb(t)),r;for(;r!==e;)yield e,r=e,e=XZ.resolve(e,"..")}}}var Aet,Tet,e9=y(()=>{YZ();Aet=mve(hve);Tet=10*1024*1024});import ib from"node:process";import Ta from"node:path";var yve,_ve,bve,t9,r9=y(()=>{JZ();e9();yve=({cwd:t=ib.cwd(),path:e=ib.env[rb()],preferLocal:r=!0,execPath:n=ib.execPath,addExecPath:i=!0}={})=>{let o=Ta.resolve(nb(t)),s=[],a=e.split(Ta.delimiter);return r&&_ve(s,a,o),i&&bve(s,a,n,o),e===""||e===Ta.delimiter?`${s.join(Ta.delimiter)}${e}`:[...s,e].join(Ta.delimiter)},_ve=(t,e,r)=>{for(let n of QZ(r)){let i=Ta.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},bve=(t,e,r,n)=>{let i=Ta.resolve(n,nb(r),"..");e.includes(i)||t.push(i)},t9=({env:t=ib.env,...e}={})=>{t={...t};let r=rb({env:t});return e.path=t[r],t[r]=yve(e),t}});var n9,Xn,i9,o9,s9,ob,qf,Bf,Oa=y(()=>{n9=(t,e,r)=>{let n=r?Bf:qf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},i9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,s9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},o9=t=>ob(t)&&s9 in t,s9=Symbol("isExecaError"),ob=t=>Object.prototype.toString.call(t)==="[object Error]",qf=class extends Error{};i9(qf,qf.name);Bf=class extends Error{};i9(Bf,Bf.name)});var a9,vve,c9,l9,u9=y(()=>{a9=()=>{let t=l9-c9+1;return Array.from({length:t},vve)},vve=(t,e)=>({name:`SIGRT${e+1}`,number:c9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),c9=34,l9=64});var d9,f9=y(()=>{d9=[{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 Sve}from"node:os";var AR,wve,p9=y(()=>{f9();u9();AR=()=>{let t=a9();return[...d9,...t].map(wve)},wve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Sve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as xve}from"node:os";var $ve,kve,m9,Eve,Ave,Tve,Get,h9=y(()=>{p9();$ve=()=>{let t=AR();return Object.fromEntries(t.map(kve))},kve=({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}],m9=$ve(),Eve=()=>{let t=AR(),e=65,r=Array.from({length:e},(n,i)=>Ave(i,t));return Object.assign({},...r)},Ave=(t,e)=>{let r=Tve(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}}},Tve=(t,e)=>{let r=e.find(({name:n})=>xve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Get=Eve()});import{constants as Hf}from"node:os";var y9,_9,b9,Ove,Rve,g9,Ive,TR,Pve,Cve,sb,Gf=y(()=>{h9();y9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return b9(t,e)},_9=t=>t===0?t:b9(t,"`subprocess.kill()`'s argument"),b9=(t,e)=>{if(Number.isInteger(t))return Ove(t,e);if(typeof t=="string")return Ive(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${TR()}`)},Ove=(t,e)=>{if(g9.has(t))return g9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${TR()}`)},Rve=()=>new Map(Object.entries(Hf.signals).reverse().map(([t,e])=>[e,t])),g9=Rve(),Ive=(t,e)=>{if(t in Hf.signals)return t;throw t.toUpperCase()in Hf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${TR()}`)},TR=()=>`Available signal names: ${Pve()}. +Available signal numbers: ${Cve()}.`,Pve=()=>Object.keys(Hf.signals).sort().map(t=>`'${t}'`).join(", "),Cve=()=>[...new Set(Object.values(Hf.signals).sort((t,e)=>t-e))].join(", "),sb=t=>m9[t].description});import{setTimeout as Dve}from"node:timers/promises";var v9,Nve,S9,jve,Mve,Fve,OR,ab=y(()=>{Oa();Gf();v9=t=>{if(t===!1)return t;if(t===!0)return Nve;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},Nve=1e3*5,S9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=jve(s,a,r);Mve(l,n);let u=t(c);return Fve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},jve=(t,e,r)=>{let[n=r,i]=ob(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&&!ob(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:_9(n),error:i}},Mve=(t,e)=>{t!==void 0&&e.reject(t)},Fve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&OR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},OR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Dve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Lve}from"node:events";var cb,RR=y(()=>{cb=async(t,e)=>{t.aborted||await Lve(t,"abort",{signal:e})}});var w9,x9,zve,IR=y(()=>{RR();w9=({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)}`)},x9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[zve(t,e,n,i)],zve=async(t,e,r,{signal:n})=>{throw await cb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Sl,Uve,PR,$9,k9,lb,E9,A9,T9,O9,R9,I9,qve,Bve,Hve,Qn,Gve,ls,wl,xl=y(()=>{Sl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Uve(t,e,r),PR(t,e,n)},Uve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},PR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${ls(e)} has already exited or disconnected.`)},$9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${ls(t)} exited or disconnected.`)},k9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${ls(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([ ${Qn("getOneMessage",t)}, ${Qn("sendMessage",t,"message, {strict: true}")}, -]);`)},ob=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${cs(e)}.`,{cause:t}),v9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${cs(t)} is not listening to incoming messages.`)},S9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${cs(t)} exited without listening to incoming messages.`)},w9=()=>new Error(`\`cancelSignal\` aborted: the ${cs(!0)} disconnected.`),x9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},$9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Qn(e,r)} cannot be used: the ${cs(r)} is disconnecting.`,{cause:t})},k9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Ive(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Ive=({code:t,message:e})=>Pve.has(t)||Cve.some(r=>e.includes(r)),Pve=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Cve=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Dve(e)}${t}(${r})`,Dve=t=>t?"":"subprocess.",cs=t=>t?"parent process":"subprocess",Sl=t=>{t.connected&&t.disconnect()}});var Oi,xl=y(()=>{Oi=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var ab,$l,Ri,E9,Nve,jve,A9,Mve,T9,qf,sb,ls=y(()=>{_o();ab=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=E9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(A9(o,e,n,!0));return s},$l=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=E9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(A9(o,e,n,!1));return s},Ri=new WeakMap,E9=(t,e,r)=>{let n=Nve(e,r);return jve(n,e,r,t),n},Nve=(t,e)=>{let r=sR(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(`"${qf(e)}" must not be "${t}". +]);`)},lb=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${ls(e)}.`,{cause:t}),E9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${ls(t)} is not listening to incoming messages.`)},A9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${ls(t)} exited without listening to incoming messages.`)},T9=()=>new Error(`\`cancelSignal\` aborted: the ${ls(!0)} disconnected.`),O9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},R9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Qn(e,r)} cannot be used: the ${ls(r)} is disconnecting.`,{cause:t})},I9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(qve(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},qve=({code:t,message:e})=>Bve.has(t)||Hve.some(r=>e.includes(r)),Bve=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Hve=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Gve(e)}${t}(${r})`,Gve=t=>t?"":"subprocess.",ls=t=>t?"parent process":"subprocess",wl=t=>{t.connected&&t.disconnect()}});var Oi,$l=y(()=>{Oi=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var db,kl,Ri,P9,Zve,Vve,C9,Wve,D9,Zf,ub,us=y(()=>{bo();db=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=P9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(C9(o,e,n,!0));return s},kl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=P9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(C9(o,e,n,!1));return s},Ri=new WeakMap,P9=(t,e,r)=>{let n=Zve(e,r);return Vve(n,e,r,t),n},Zve=(t,e)=>{let r=dR(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(`"${Zf(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},jve=(t,e,r,n)=>{let i=n[T9(t)];if(i===void 0)throw new TypeError(`"${qf(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(`"${qf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${qf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},A9=(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}=Mve(t,r);return`The "${i}: ${sb(o)}" option is incompatible with using "${qf(n)}: ${sb(e)}". -Please set this option with "pipe" instead.`},Mve=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=T9(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]}},T9=t=>t==="all"?1:t,qf=t=>t?"to":"from",sb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Fve}from"node:events";var Ra,cb=y(()=>{Ra=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Fve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var lb,TR,ub,OR,O9,R9,Bf=y(()=>{lb=(t,e)=>{e&&TR(t)},TR=t=>{t.refCounted()},ub=(t,e)=>{e&&OR(t)},OR=t=>{t.unrefCounted()},O9=(t,e)=>{e&&(OR(t),OR(t))},R9=(t,e)=>{e&&(TR(t),TR(t))}});import{once as Lve}from"node:events";import{scheduler as zve}from"node:timers/promises";var I9,P9,db,C9=y(()=>{pb();Bf();fb();mb();I9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(N9(i)||M9(i))return;db.has(t)||db.set(t,[]);let o=db.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await j9(t,n,i),await zve.yield();let s=await D9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},P9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{RR();let o=db.get(t);for(;o?.length>0;)await Lve(n,"message:done");t.removeListener("message",i),R9(e,r),n.connected=!1,n.emit("disconnect")},db=new WeakMap});import{EventEmitter as Uve}from"node:events";var us,hb,qve,gb,Hf=y(()=>{C9();Bf();us=(t,e,r)=>{if(hb.has(t))return hb.get(t);let n=new Uve;return n.connected=!0,hb.set(t,n),qve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},hb=new WeakMap,qve=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=I9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",P9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),O9(r,n)},gb=t=>{let e=hb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as Bve}from"node:events";var F9,Hve,L9,D9,N9,z9,yb,Gve,_b,U9,fb=y(()=>{xl();cb();Sb();wl();Hf();pb();F9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=us(t,e,r),s=bb(t,o);return{id:Hve++,type:_b,message:n,hasListeners:s}},Hve=0n,L9=(t,e)=>{if(!(e?.type!==_b||e.hasListeners))for(let{id:r}of t)r!==void 0&&yb[r].resolve({isDeadlock:!0,hasListeners:!1})},D9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==_b||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:U9,message:bb(e,i)};try{await vb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},N9=t=>{if(t?.type!==U9)return!1;let{id:e,message:r}=t;return yb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},z9=async(t,e,r)=>{if(t?.type!==_b)return;let n=Oi();yb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,Gve(e,r,i)]);o&&b9(r),s||v9(r)}finally{i.abort(),delete yb[t.id]}},yb={},Gve=async(t,e,{signal:r})=>{Ra(t,1,r),await Bve(t,"disconnect",{signal:r}),S9(e)},_b="execa:ipc:request",U9="execa:ipc:response"});var q9,B9,j9,Gf,bb,Zve,pb=y(()=>{xl();_o();ls();fb();q9=(t,e,r)=>{Gf.has(t)||Gf.set(t,new Set);let n=Gf.get(t),i=Oi(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},B9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},j9=async(t,e,r)=>{for(;!bb(t,e)&&Gf.get(t)?.size>0;){let n=[...Gf.get(t)];L9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Gf=new WeakMap,bb=(t,e)=>e.listenerCount("message")>Zve(t),Zve=t=>Ri.has(t)&&!yo(Ri.get(t).options.buffer,"ipc")?1:0});import{promisify as Vve}from"node:util";var vb,Wve,PR,Kve,IR,Sb=y(()=>{wl();pb();fb();vb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return vl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),Wve({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},Wve=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=F9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=q9(t,s,o);try{await PR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Sl(t),c}finally{B9(a)}},PR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=Kve(t);try{await Promise.all([z9(n,t,r),o(n)])}catch(s){throw $9({error:s,methodName:e,isSubprocess:r}),k9({error:s,methodName:e,isSubprocess:r,message:i}),s}},Kve=t=>{if(IR.has(t))return IR.get(t);let e=Vve(t.send.bind(t));return IR.set(t,e),e},IR=new WeakMap});import{scheduler as Jve}from"node:timers/promises";var G9,Z9,Yve,H9,M9,V9,RR,CR,mb=y(()=>{Sb();Hf();wl();G9=(t,e)=>{let r="cancelSignal";return AR(r,!1,t.connected),PR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:V9,message:e},message:e})},Z9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await Yve({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),CR.signal),Yve=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!H9){if(H9=!0,!n){x9();return}if(e===null){RR();return}us(t,e,r),await Jve.yield()}},H9=!1,M9=t=>t?.type!==V9?!1:(CR.abort(t.message),!0),V9="execa:ipc:cancel",RR=()=>{CR.abort(w9())},CR=new AbortController});var W9,K9,Xve,Qve,DR=y(()=>{kR();mb();nb();W9=({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.")}},K9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[Xve({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],Xve=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await ib(e,i);let o=Qve(e);throw await G9(t,o),$R({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Qve=({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 eSe}from"node:timers/promises";var J9,Y9,tSe,NR=y(()=>{Oa();J9=({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})`)},Y9=(t,e,r,n)=>e===0||e===void 0?[]:[tSe(t,e,r,n)],tSe=async(t,e,r,{signal:n})=>{throw await eSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as rSe,execArgv as nSe}from"node:process";import X9 from"node:path";var Q9,eV,jR=y(()=>{ml();Q9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},eV=(t,e,{node:r=!1,nodePath:n=rSe,nodeOptions:i=nSe.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=pl(n,'The "nodePath" option'),l=X9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(X9.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 iSe}from"node:v8";var tV,oSe,sSe,aSe,rV,MR=y(()=>{tV=({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`.");aSe[r](t)}},oSe=t=>{try{iSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},sSe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},aSe={advanced:oSe,json:sSe},rV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var iV,cSe,nn,FR,lSe,nV,wb,Ia=y(()=>{iV=({encoding:t})=>{if(FR.has(t))return;let e=lSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${wb(t)}\`. -Please rename it to ${wb(e)}.`);let r=[...FR].map(n=>wb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${wb(t)}\`. -Please rename it to one of: ${r}.`)},cSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),FR=new Set([...cSe,...nn]),lSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in nV)return nV[e];if(FR.has(e))return e},nV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},wb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as uSe}from"node:fs";import dSe from"node:path";import fSe from"node:process";var oV,sV,aV,LR=y(()=>{ml();oV=(t=sV())=>{let e=pl(t,'The "cwd" option');return dSe.resolve(e)},sV=()=>{try{return fSe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},aV=(t,e)=>{if(e===sV())return t;let r;try{r=uSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},Vve=(t,e,r,n)=>{let i=n[D9(t)];if(i===void 0)throw new TypeError(`"${Zf(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(`"${Zf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Zf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},C9=(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}=Wve(t,r);return`The "${i}: ${ub(o)}" option is incompatible with using "${Zf(n)}: ${ub(e)}". +Please set this option with "pipe" instead.`},Wve=(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,Zf=t=>t?"to":"from",ub=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Kve}from"node:events";var Ra,fb=y(()=>{Ra=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Kve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var pb,CR,mb,DR,N9,j9,Vf=y(()=>{pb=(t,e)=>{e&&CR(t)},CR=t=>{t.refCounted()},mb=(t,e)=>{e&&DR(t)},DR=t=>{t.unrefCounted()},N9=(t,e)=>{e&&(DR(t),DR(t))},j9=(t,e)=>{e&&(CR(t),CR(t))}});import{once as Jve}from"node:events";import{scheduler as Yve}from"node:timers/promises";var M9,F9,hb,L9=y(()=>{yb();Vf();gb();_b();M9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(U9(i)||B9(i))return;hb.has(t)||hb.set(t,[]);let o=hb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await q9(t,n,i),await Yve.yield();let s=await z9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},F9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{NR();let o=hb.get(t);for(;o?.length>0;)await Jve(n,"message:done");t.removeListener("message",i),j9(e,r),n.connected=!1,n.emit("disconnect")},hb=new WeakMap});import{EventEmitter as Xve}from"node:events";var ds,bb,Qve,vb,Wf=y(()=>{L9();Vf();ds=(t,e,r)=>{if(bb.has(t))return bb.get(t);let n=new Xve;return n.connected=!0,bb.set(t,n),Qve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},bb=new WeakMap,Qve=({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",F9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),N9(r,n)},vb=t=>{let e=bb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as eSe}from"node:events";var H9,tSe,G9,z9,U9,Z9,Sb,rSe,wb,V9,gb=y(()=>{$l();fb();kb();xl();Wf();yb();H9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ds(t,e,r),s=xb(t,o);return{id:tSe++,type:wb,message:n,hasListeners:s}},tSe=0n,G9=(t,e)=>{if(!(e?.type!==wb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Sb[r].resolve({isDeadlock:!0,hasListeners:!1})},z9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==wb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:V9,message:xb(e,i)};try{await $b({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},U9=t=>{if(t?.type!==V9)return!1;let{id:e,message:r}=t;return Sb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},Z9=async(t,e,r)=>{if(t?.type!==wb)return;let n=Oi();Sb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,rSe(e,r,i)]);o&&k9(r),s||E9(r)}finally{i.abort(),delete Sb[t.id]}},Sb={},rSe=async(t,e,{signal:r})=>{Ra(t,1,r),await eSe(t,"disconnect",{signal:r}),A9(e)},wb="execa:ipc:request",V9="execa:ipc:response"});var W9,K9,q9,Kf,xb,nSe,yb=y(()=>{$l();bo();us();gb();W9=(t,e,r)=>{Kf.has(t)||Kf.set(t,new Set);let n=Kf.get(t),i=Oi(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},K9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},q9=async(t,e,r)=>{for(;!xb(t,e)&&Kf.get(t)?.size>0;){let n=[...Kf.get(t)];G9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Kf=new WeakMap,xb=(t,e)=>e.listenerCount("message")>nSe(t),nSe=t=>Ri.has(t)&&!_o(Ri.get(t).options.buffer,"ipc")?1:0});import{promisify as iSe}from"node:util";var $b,oSe,MR,sSe,jR,kb=y(()=>{xl();yb();gb();$b=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Sl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),oSe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},oSe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=H9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=W9(t,s,o);try{await MR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw wl(t),c}finally{K9(a)}},MR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=sSe(t);try{await Promise.all([Z9(n,t,r),o(n)])}catch(s){throw R9({error:s,methodName:e,isSubprocess:r}),I9({error:s,methodName:e,isSubprocess:r,message:i}),s}},sSe=t=>{if(jR.has(t))return jR.get(t);let e=iSe(t.send.bind(t));return jR.set(t,e),e},jR=new WeakMap});import{scheduler as aSe}from"node:timers/promises";var Y9,X9,cSe,J9,B9,Q9,NR,FR,_b=y(()=>{kb();Wf();xl();Y9=(t,e)=>{let r="cancelSignal";return PR(r,!1,t.connected),MR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:Q9,message:e},message:e})},X9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await cSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),FR.signal),cSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!J9){if(J9=!0,!n){O9();return}if(e===null){NR();return}ds(t,e,r),await aSe.yield()}},J9=!1,B9=t=>t?.type!==Q9?!1:(FR.abort(t.message),!0),Q9="execa:ipc:cancel",NR=()=>{FR.abort(T9())},FR=new AbortController});var eV,tV,lSe,uSe,LR=y(()=>{RR();_b();ab();eV=({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.")}},tV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[lSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],lSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await cb(e,i);let o=uSe(e);throw await Y9(t,o),OR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},uSe=({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 dSe}from"node:timers/promises";var rV,nV,fSe,zR=y(()=>{Oa();rV=({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})`)},nV=(t,e,r,n)=>e===0||e===void 0?[]:[fSe(t,e,r,n)],fSe=async(t,e,r,{signal:n})=>{throw await dSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as pSe,execArgv as mSe}from"node:process";import iV from"node:path";var oV,sV,UR=y(()=>{hl();oV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},sV=(t,e,{node:r=!1,nodePath:n=pSe,nodeOptions:i=mSe.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=ml(n,'The "nodePath" option'),l=iV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(iV.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 hSe}from"node:v8";var aV,gSe,ySe,_Se,cV,qR=y(()=>{aV=({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`.");_Se[r](t)}},gSe=t=>{try{hSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},ySe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},_Se={advanced:gSe,json:ySe},cV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var uV,bSe,nn,BR,vSe,lV,Eb,Ia=y(()=>{uV=({encoding:t})=>{if(BR.has(t))return;let e=vSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Eb(t)}\`. +Please rename it to ${Eb(e)}.`);let r=[...BR].map(n=>Eb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Eb(t)}\`. +Please rename it to one of: ${r}.`)},bSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),BR=new Set([...bSe,...nn]),vSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in lV)return lV[e];if(BR.has(e))return e},lV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Eb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as SSe}from"node:fs";import wSe from"node:path";import xSe from"node:process";var dV,fV,pV,HR=y(()=>{hl();dV=(t=fV())=>{let e=ml(t,'The "cwd" option');return wSe.resolve(e)},fV=()=>{try{return xSe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},pV=(t,e)=>{if(e===fV())return t;let r;try{r=SSe(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 pSe from"node:path";import cV from"node:process";var lV,xb,mSe,hSe,zR=y(()=>{lV=St(BZ(),1);JZ();nb();Uf();ER();DR();NR();jR();MR();Ia();LR();ml();_o();xb=(t,e,r)=>{r.cwd=oV(r.cwd);let[n,i,o]=eV(t,e,r),{command:s,args:a,options:c}=lV.default._parse(n,i,o),l=PG(c),u=mSe(l);return J9(u),iV(u),tV(u),g9(u),W9(u),u.shell=tR(u.shell),u.env=hSe(u),u.killSignal=d9(u.killSignal),u.forceKillAfterDelay=m9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),cV.platform==="win32"&&pSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},mSe=({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}),hSe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...cV.env,...t}:t;return r||n?KZ({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var $b,UR=y(()=>{$b=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function kl(t){if(typeof t=="string")return gSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return ySe(t)}var gSe,ySe,uV,_Se,dV,bSe,qR=y(()=>{gSe=t=>t.at(-1)===uV?t.slice(0,t.at(-2)===dV?-2:-1):t,ySe=t=>t.at(-1)===_Se?t.subarray(0,t.at(-2)===bSe?-2:-1):t,uV=` -`,_Se=uV.codePointAt(0),dV="\r",bSe=dV.codePointAt(0)});function ei(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 BR(t,{checkOpen:e=!0}={}){return ei(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 Pa(t,{checkOpen:e=!0}={}){return ei(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 HR(t,e){return BR(t,e)&&Pa(t,e)}var Ca=y(()=>{});function fV(){return this[ZR].next()}function pV(t){return this[ZR].return(t)}function VR({preventCancel:t=!1}={}){let e=this.getReader(),r=new GR(e,t),n=Object.create(SSe);return n[ZR]=r,n}var vSe,GR,ZR,SSe,mV=y(()=>{vSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),GR=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}}},ZR=Symbol();Object.defineProperty(fV,"name",{value:"next"});Object.defineProperty(pV,"name",{value:"return"});SSe=Object.create(vSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:fV},return:{enumerable:!0,configurable:!0,writable:!0,value:pV}})});var hV=y(()=>{});var gV=y(()=>{mV();hV()});var yV,wSe,xSe,$Se,Zf,WR=y(()=>{Ca();gV();yV=t=>{if(Pa(t,{checkOpen:!1})&&Zf.on!==void 0)return xSe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(wSe.call(t)==="[object ReadableStream]")return VR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:wSe}=Object.prototype,xSe=async function*(t){let e=new AbortController,r={};$Se(t,e,r);try{for await(let[n]of Zf.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()}},$Se=async(t,e,r)=>{try{await Zf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Zf={}});var El,kSe,vV,_V,ESe,bV,Ii,Vf=y(()=>{WR();El=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=yV(t),u=e();u.length=0;try{for await(let d of l){let f=ESe(d),p=r[f](d,u);vV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return kSe({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}},kSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&vV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},vV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){_V(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&_V(c,e,i,o),new Ii},_V=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},ESe=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=bV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&bV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:bV}=Object.prototype,Ii=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var bo,Wf,kb,Eb,Ab,Tb=y(()=>{bo=t=>t,Wf=()=>{},kb=({contents:t})=>t,Eb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Ab=t=>t.length});async function Ob(t,e){return El(t,RSe,e)}var ASe,TSe,OSe,RSe,SV=y(()=>{Vf();Tb();ASe=()=>({contents:[]}),TSe=()=>1,OSe=(t,{contents:e})=>(e.push(t),e),RSe={init:ASe,convertChunk:{string:bo,buffer:bo,arrayBuffer:bo,dataView:bo,typedArray:bo,others:bo},getSize:TSe,truncateChunk:Wf,addChunk:OSe,getFinalChunk:Wf,finalize:kb}});async function Rb(t,e){return El(t,LSe,e)}var ISe,PSe,CSe,wV,xV,DSe,NSe,jSe,MSe,kV,$V,FSe,EV,LSe,AV=y(()=>{Vf();Tb();ISe=()=>({contents:new ArrayBuffer(0)}),PSe=t=>CSe.encode(t),CSe=new TextEncoder,wV=t=>new Uint8Array(t),xV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),DSe=(t,e)=>t.slice(0,e),NSe=(t,{contents:e,length:r},n)=>{let i=EV()?MSe(e,n):jSe(e,n);return new Uint8Array(i).set(t,r),i},jSe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(kV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},MSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:kV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},kV=t=>$V**Math.ceil(Math.log(t)/Math.log($V)),$V=2,FSe=({contents:t,length:e})=>EV()?t:t.slice(0,e),EV=()=>"resize"in ArrayBuffer.prototype,LSe={init:ISe,convertChunk:{string:PSe,buffer:wV,arrayBuffer:wV,dataView:xV,typedArray:xV,others:Eb},getSize:Ab,truncateChunk:DSe,addChunk:NSe,getFinalChunk:Wf,finalize:FSe}});async function Pb(t,e){return El(t,HSe,e)}var zSe,Ib,USe,qSe,BSe,HSe,TV=y(()=>{Vf();Tb();zSe=()=>({contents:"",textDecoder:new TextDecoder}),Ib=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),USe=(t,{contents:e})=>e+t,qSe=(t,e)=>t.slice(0,e),BSe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},HSe={init:zSe,convertChunk:{string:bo,buffer:Ib,arrayBuffer:Ib,dataView:Ib,typedArray:Ib,others:Eb},getSize:Ab,truncateChunk:qSe,addChunk:USe,getFinalChunk:BSe,finalize:kb}});var OV=y(()=>{SV();AV();TV();Vf()});import{on as GSe}from"node:events";import{finished as ZSe}from"node:stream/promises";var Cb=y(()=>{WR();OV();Object.assign(Zf,{on:GSe,finished:ZSe})});var RV,VSe,IV,PV,WSe,CV,DV,Db,Da=y(()=>{Cb();go();_o();RV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ii))throw t;if(o==="all")return t;let s=VSe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},VSe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",IV=(t,e,r)=>{if(e.length!==r)return;let n=new Ii;throw n.maxBufferInfo={fdNumber:"ipc"},n},PV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=WSe(t,e);return`Command's ${r} was larger than ${n} ${i}`},WSe=(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=yo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:z_(r),threshold:i,unit:n}},CV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Db(r)),DV=(t,e,r)=>{if(!e)return t;let n=Db(r);return t.length>n?t.slice(0,n):t},Db=([,t])=>t});import{inspect as KSe}from"node:util";var jV,JSe,YSe,XSe,QSe,ewe,NV,MV=y(()=>{qR();rn();LR();B_();Da();Uf();Oa();jV=({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=JSe({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=XSe(n,b),w=x===void 0?"":` -${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>QSe(D)).join(` -`)].map(D=>Mf(kl(ewe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:O,message:A}},JSe=({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=YSe(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?`${PV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${rb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},YSe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",XSe=(t,e)=>{if(t instanceof Xn)return;let r=QZ(t)?t.originalMessage:String(t?.message??t),n=Mf(aV(r,e));return n===""?void 0:n},QSe=t=>typeof t=="string"?t:KSe(t),ewe=t=>Array.isArray(t)?t.map(e=>kl(NV(e))).filter(Boolean).join(` -`):NV(t),NV=t=>typeof t=="string"?t:Ut(t)?F_(t):""});var Nb,Al,Kf,twe,FV,rwe,Jf=y(()=>{Uf();K_();Oa();MV();Nb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>FV({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:[]}),Al=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Kf({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}),Kf=({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:O,signalDescription:T}=rwe(l,u),{originalMessage:A,shortMessage:D,message:$}=jV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),se=YZ(t,$,x);return Object.assign(se,twe({error:se,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),se},twe=({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})=>FV({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:[]}),FV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),rwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:rb(e);return{exitCode:r,signal:n,signalDescription:i}}});function nwe(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(LV(t*1e3)%1e3),nanoseconds:Math.trunc(LV(t*1e6)%1e3)}}function iwe(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 KR(t){switch(typeof t){case"number":{if(Number.isFinite(t))return nwe(t);break}case"bigint":return iwe(t)}throw new TypeError("Expected a finite number or bigint")}var LV,zV=y(()=>{LV=t=>Number.isFinite(t)?t:0});function JR(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+awe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&owe(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?" "+swe(d,u):f;i.push(p)}},a=KR(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%cwe):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 owe,swe,awe,cwe,UV=y(()=>{zV();owe=t=>t===0||t===0n,swe=(t,e)=>e===1||e===1n?t:`${t}s`,awe=1e-7,cwe=24n*60n*60n*1000n});var qV,BV=y(()=>{yl();qV=(t,e)=>{t.failed&&Ti({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var HV,lwe,GV=y(()=>{UV();as();yl();BV();HV=(t,e)=>{hl(e)&&(qV(t,e),lwe(t,e))},lwe=(t,e)=>{let r=`(done in ${JR(t.durationMs)})`;Ti({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Tl,jb=y(()=>{GV();Tl=(t,e,{reject:r})=>{if(HV(t,e),t.failed&&r)throw t;return t}});var WV,uwe,dwe,KV,JV,ZV,fwe,YR,VV,Na,YV,pwe,Mb,XV,mwe,hwe,XR,QV,gwe,eW,Fb,ywe,QR,_we,bwe,tW,An,Lb,eI,rW,nW,ds,vr=y(()=>{Ca();mo();rn();WV=(t,e)=>Na(t)?"asyncGenerator":YV(t)?"generator":Mb(t)?"fileUrl":mwe(t)?"filePath":ywe(t)?"webStream":ei(t,{checkOpen:!1})?"native":Ut(t)?"uint8Array":_we(t)?"asyncIterable":bwe(t)?"iterable":QR(t)?KV({transform:t},e):pwe(t)?uwe(t,e):"native",uwe=(t,e)=>HR(t.transform,{checkOpen:!1})?dwe(t,e):QR(t.transform)?KV(t,e):fwe(t,e),dwe=(t,e)=>(JV(t,e,"Duplex stream"),"duplex"),KV=(t,e)=>(JV(t,e,"web TransformStream"),"webTransform"),JV=({final:t,binary:e,objectMode:r},n,i)=>{ZV(t,`${n}.final`,i),ZV(e,`${n}.binary`,i),YR(r,`${n}.objectMode`)},ZV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},fwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!VV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(HR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(QR(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!VV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return YR(r,`${i}.binary`),YR(n,`${i}.objectMode`),Na(t)||Na(e)?"asyncGenerator":"generator"},YR=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},VV=t=>Na(t)||YV(t),Na=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",YV=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",pwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Mb=t=>Object.prototype.toString.call(t)==="[object URL]",XV=t=>Mb(t)&&t.protocol!=="file:",mwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>hwe.has(e))&&XR(t.file),hwe=new Set(["file","append"]),XR=t=>typeof t=="string",QV=(t,e)=>t==="native"&&typeof e=="string"&&!gwe.has(e),gwe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),eW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Fb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",ywe=t=>eW(t)||Fb(t),QR=t=>eW(t?.readable)&&Fb(t?.writable),_we=t=>tW(t)&&typeof t[Symbol.asyncIterator]=="function",bwe=t=>tW(t)&&typeof t[Symbol.iterator]=="function",tW=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),Lb=new Set(["fileUrl","filePath","fileNumber"]),eI=new Set(["fileUrl","filePath"]),rW=new Set([...eI,"webStream","nodeStream"]),nW=new Set(["webTransform","duplex"]),ds={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 tI,vwe,Swe,iW,rI=y(()=>{vr();tI=(t,e,r,n)=>n==="output"?vwe(t,e,r):Swe(t,e,r),vwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Swe=(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}},iW=(t,e)=>{let r=t.findLast(({type:n})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var oW,wwe,xwe,$we,kwe,Ewe,Awe,sW=y(()=>{mo();Ia();vr();rI();oW=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...wwe(t,e,r,n)],wwe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=xwe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Awe(o,r)},xwe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?$we({stdioItem:t,optionName:i}):e==="webTransform"?kwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Ewe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),$we=({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}}},kwe=({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}=tI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Ewe=({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||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=tI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Awe=(t,e)=>e==="input"?t.reverse():t});import nI from"node:process";var aW,Twe,Owe,Ol,iI,cW,Rwe,Iwe,lW=y(()=>{Ca();vr();aW=(t,e,r)=>{let n=t.map(i=>Twe(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)??Iwe},Twe=({type:t,value:e},r)=>Owe[r]??cW[t](e),Owe=["input","output","output"],Ol=()=>{},iI=()=>"input",cW={generator:Ol,asyncGenerator:Ol,fileUrl:Ol,filePath:Ol,iterable:iI,asyncIterable:iI,uint8Array:iI,webStream:t=>Fb(t)?"output":"input",nodeStream(t){return Pa(t,{checkOpen:!1})?BR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Ol,duplex:Ol,native(t){let e=Rwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return cW.nodeStream(t)}},Rwe=t=>{if([0,nI.stdin].includes(t))return"input";if([1,2,nI.stdout,nI.stderr].includes(t))return"output"},Iwe="output"});var uW,dW=y(()=>{uW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var fW,Pwe,Cwe,pW,Dwe,Nwe,mW=y(()=>{go();dW();as();fW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Pwe(t,n).map((a,c)=>pW(a,c));return o?Dwe(s,r,i):uW(s,e)},Pwe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(Cwe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},Cwe=t=>En.some(e=>t[e]!==void 0),pW=(t,e)=>Array.isArray(t)?t.map(r=>pW(r,e)):t??(e>=En.length?"ignore":"pipe"),Dwe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!gl(r,i)&&Nwe(n)?"ignore":n),Nwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as jwe}from"node:fs";import Mwe from"node:tty";var gW,Fwe,Lwe,zwe,Uwe,hW,yW=y(()=>{Ca();go();rn();ls();gW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Fwe({stdioItem:t,fdNumber:n,direction:i}):Uwe({stdioItem:t,fdNumber:n}),Fwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Lwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Lwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=zwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Mwe.isatty(i))throw new TypeError(`The \`${e}: ${sb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:ho(jwe(i)),optionName:e}}},zwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=L_.indexOf(t);if(r!==-1)return r},Uwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:hW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:hW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,hW=(t,e,r)=>{let n=L_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var _W,qwe,Bwe,Hwe,Gwe,bW=y(()=>{Ca();rn();vr();_W=({input:t,inputFile:e},r)=>r===0?[...qwe(t),...Hwe(e)]:[],qwe=t=>t===void 0?[]:[{type:Bwe(t),value:t,optionName:"input"}],Bwe=t=>{if(Pa(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ut(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Hwe=t=>t===void 0?[]:[{...Gwe(t),optionName:"inputFile"}],Gwe=t=>{if(Mb(t))return{type:"fileUrl",value:t};if(XR(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var vW,SW,Zwe,Vwe,wW,Wwe,Kwe,xW,$W=y(()=>{vr();vW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),SW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=Zwe(i,t);if(s.length!==0){if(o){Vwe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(rW.has(t))return wW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});nW.has(t)&&Kwe({otherStdioItems:s,type:t,value:e,optionName:r})}},Zwe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),Vwe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{eI.has(e)&&wW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},wW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>Wwe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return xW(s,n,e),i==="output"?o[0].stream:void 0},Wwe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,Kwe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);xW(i,n,e)},xW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${ds[r]} that is the same.`)}});var zb,Jwe,Ywe,Xwe,Qwe,exe,txe,rxe,nxe,ixe,oxe,sxe,oI,axe,Ub=y(()=>{go();sW();rI();vr();lW();mW();yW();bW();$W();zb=(t,e,r,n)=>{let o=fW(e,r,n).map((a,c)=>Jwe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=ixe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>axe(a)),s},Jwe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=z_(e),{stdioItems:o,isStdioArray:s}=Ywe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=aW(o,e,i),c=o.map(d=>gW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=oW(c,i,a,r),u=iW(l,a);return nxe(l,u),{direction:a,objectMode:u,stdioItems:l}},Ywe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>Xwe(c,n)),..._W(r,e)],s=vW(o),a=s.length>1;return Qwe(s,a,n),txe(s),{stdioItems:s,isStdioArray:a}},Xwe=(t,e)=>({type:WV(t,e),value:t,optionName:e}),Qwe=(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(exe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},exe=new Set(["ignore","ipc"]),txe=t=>{for(let e of t)rxe(e)},rxe=({type:t,value:e,optionName:r})=>{if(XV(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(QV(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},nxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Lb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},ixe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(oxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw oI(i),o}},oxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>sxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},sxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=SW({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&&!Yn(r)&&r.destroy()},axe=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 kW}from"node:fs";var AW,Pi,cxe,TW,EW,lxe,OW=y(()=>{rn();Ub();vr();AW=(t,e)=>zb(lxe,t,e,!0),Pi=({type:t,optionName:e})=>{TW(e,ds[t])},cxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&TW(t,`"${e}"`),{}),TW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},EW={generator(){},asyncGenerator:Pi,webStream:Pi,nodeStream:Pi,webTransform:Pi,duplex:Pi,asyncIterable:Pi,native:cxe},lxe={input:{...EW,fileUrl:({value:t})=>({contents:[ho(kW(t))]}),filePath:({value:{file:t}})=>({contents:[ho(kW(t))]}),fileNumber:Pi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...EW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Pi,string:Pi,uint8Array:Pi}}});var vo,sI,Yf=y(()=>{qR();vo=(t,{stripFinalNewline:e},r)=>sI(e,r)&&t!==void 0&&!Array.isArray(t)?kl(t):t,sI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var qb,cI,RW,IW,uxe,dxe,fxe,PW,pxe,aI,mxe,hxe,gxe,Bb=y(()=>{qb=(t,e,r,n)=>t||r?void 0:IW(e,n),cI=(t,e,r)=>r?t.flatMap(n=>RW(n,e)):RW(t,e),RW=(t,e)=>{let{transform:r,final:n}=IW(e,{});return[...r(t),...n()]},IW=(t,e)=>(e.previousChunks="",{transform:uxe.bind(void 0,e,t),final:fxe.bind(void 0,e)}),uxe=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},dxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),fxe=function*({previousChunks:t}){t.length>0&&(yield t)},PW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:pxe.bind(void 0,n)},pxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?mxe:gxe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},aI=(t,e)=>`${t}${e}`,mxe={windowsNewline:`\r +${t}`}});import $Se from"node:path";import mV from"node:process";var hV,Ab,kSe,ESe,GR=y(()=>{hV=St(KZ(),1);r9();ab();Gf();IR();LR();zR();UR();qR();Ia();HR();hl();bo();Ab=(t,e,r)=>{r.cwd=dV(r.cwd);let[n,i,o]=sV(t,e,r),{command:s,args:a,options:c}=hV.default._parse(n,i,o),l=FG(c),u=kSe(l);return rV(u),uV(u),aV(u),w9(u),eV(u),u.shell=sR(u.shell),u.env=ESe(u),u.killSignal=y9(u.killSignal),u.forceKillAfterDelay=v9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),mV.platform==="win32"&&$Se.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},kSe=({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}),ESe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...mV.env,...t}:t;return r||n?t9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Tb,ZR=y(()=>{Tb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function El(t){if(typeof t=="string")return ASe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return TSe(t)}var ASe,TSe,gV,OSe,yV,RSe,VR=y(()=>{ASe=t=>t.at(-1)===gV?t.slice(0,t.at(-2)===yV?-2:-1):t,TSe=t=>t.at(-1)===OSe?t.subarray(0,t.at(-2)===RSe?-2:-1):t,gV=` +`,OSe=gV.codePointAt(0),yV="\r",RSe=yV.codePointAt(0)});function ei(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 WR(t,{checkOpen:e=!0}={}){return ei(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 Pa(t,{checkOpen:e=!0}={}){return ei(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 KR(t,e){return WR(t,e)&&Pa(t,e)}var Ca=y(()=>{});function _V(){return this[YR].next()}function bV(t){return this[YR].return(t)}function XR({preventCancel:t=!1}={}){let e=this.getReader(),r=new JR(e,t),n=Object.create(PSe);return n[YR]=r,n}var ISe,JR,YR,PSe,vV=y(()=>{ISe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),JR=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}}},YR=Symbol();Object.defineProperty(_V,"name",{value:"next"});Object.defineProperty(bV,"name",{value:"return"});PSe=Object.create(ISe,{next:{enumerable:!0,configurable:!0,writable:!0,value:_V},return:{enumerable:!0,configurable:!0,writable:!0,value:bV}})});var SV=y(()=>{});var wV=y(()=>{vV();SV()});var xV,CSe,DSe,NSe,Jf,QR=y(()=>{Ca();wV();xV=t=>{if(Pa(t,{checkOpen:!1})&&Jf.on!==void 0)return DSe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(CSe.call(t)==="[object ReadableStream]")return XR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:CSe}=Object.prototype,DSe=async function*(t){let e=new AbortController,r={};NSe(t,e,r);try{for await(let[n]of Jf.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()}},NSe=async(t,e,r)=>{try{await Jf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Jf={}});var Al,jSe,EV,$V,MSe,kV,Ii,Yf=y(()=>{QR();Al=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=xV(t),u=e();u.length=0;try{for await(let d of l){let f=MSe(d),p=r[f](d,u);EV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return jSe({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}},jSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&EV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},EV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){$V(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&$V(c,e,i,o),new Ii},$V=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},MSe=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=kV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&kV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:kV}=Object.prototype,Ii=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var vo,Xf,Ob,Rb,Ib,Pb=y(()=>{vo=t=>t,Xf=()=>{},Ob=({contents:t})=>t,Rb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Ib=t=>t.length});async function Cb(t,e){return Al(t,USe,e)}var FSe,LSe,zSe,USe,AV=y(()=>{Yf();Pb();FSe=()=>({contents:[]}),LSe=()=>1,zSe=(t,{contents:e})=>(e.push(t),e),USe={init:FSe,convertChunk:{string:vo,buffer:vo,arrayBuffer:vo,dataView:vo,typedArray:vo,others:vo},getSize:LSe,truncateChunk:Xf,addChunk:zSe,getFinalChunk:Xf,finalize:Ob}});async function Db(t,e){return Al(t,JSe,e)}var qSe,BSe,HSe,TV,OV,GSe,ZSe,VSe,WSe,IV,RV,KSe,PV,JSe,CV=y(()=>{Yf();Pb();qSe=()=>({contents:new ArrayBuffer(0)}),BSe=t=>HSe.encode(t),HSe=new TextEncoder,TV=t=>new Uint8Array(t),OV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),GSe=(t,e)=>t.slice(0,e),ZSe=(t,{contents:e,length:r},n)=>{let i=PV()?WSe(e,n):VSe(e,n);return new Uint8Array(i).set(t,r),i},VSe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(IV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},WSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:IV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},IV=t=>RV**Math.ceil(Math.log(t)/Math.log(RV)),RV=2,KSe=({contents:t,length:e})=>PV()?t:t.slice(0,e),PV=()=>"resize"in ArrayBuffer.prototype,JSe={init:qSe,convertChunk:{string:BSe,buffer:TV,arrayBuffer:TV,dataView:OV,typedArray:OV,others:Rb},getSize:Ib,truncateChunk:GSe,addChunk:ZSe,getFinalChunk:Xf,finalize:KSe}});async function jb(t,e){return Al(t,twe,e)}var YSe,Nb,XSe,QSe,ewe,twe,DV=y(()=>{Yf();Pb();YSe=()=>({contents:"",textDecoder:new TextDecoder}),Nb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),XSe=(t,{contents:e})=>e+t,QSe=(t,e)=>t.slice(0,e),ewe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},twe={init:YSe,convertChunk:{string:vo,buffer:Nb,arrayBuffer:Nb,dataView:Nb,typedArray:Nb,others:Rb},getSize:Ib,truncateChunk:QSe,addChunk:XSe,getFinalChunk:ewe,finalize:Ob}});var NV=y(()=>{AV();CV();DV();Yf()});import{on as rwe}from"node:events";import{finished as nwe}from"node:stream/promises";var Mb=y(()=>{QR();NV();Object.assign(Jf,{on:rwe,finished:nwe})});var jV,iwe,MV,FV,owe,LV,zV,Fb,Da=y(()=>{Mb();yo();bo();jV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ii))throw t;if(o==="all")return t;let s=iwe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},iwe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",MV=(t,e,r)=>{if(e.length!==r)return;let n=new Ii;throw n.maxBufferInfo={fdNumber:"ipc"},n},FV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=owe(t,e);return`Command's ${r} was larger than ${n} ${i}`},owe=(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=_o(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:H_(r),threshold:i,unit:n}},LV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Fb(r)),zV=(t,e,r)=>{if(!e)return t;let n=Fb(r);return t.length>n?t.slice(0,n):t},Fb=([,t])=>t});import{inspect as swe}from"node:util";var qV,awe,cwe,lwe,uwe,dwe,UV,BV=y(()=>{VR();rn();HR();V_();Da();Gf();Oa();qV=({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=awe({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=lwe(n,b),w=x===void 0?"":` +${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>uwe(D)).join(` +`)].map(D=>Uf(El(dwe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:O,message:A}},awe=({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=cwe(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?`${FV(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"},cwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",lwe=(t,e)=>{if(t instanceof Xn)return;let r=o9(t)?t.originalMessage:String(t?.message??t),n=Uf(pV(r,e));return n===""?void 0:n},uwe=t=>typeof t=="string"?t:swe(t),dwe=t=>Array.isArray(t)?t.map(e=>El(UV(e))).filter(Boolean).join(` +`):UV(t),UV=t=>typeof t=="string"?t:Ut(t)?q_(t):""});var Lb,Tl,Qf,fwe,HV,pwe,ep=y(()=>{Gf();Q_();Oa();BV();Lb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>HV({command:t,escapedCommand:e,cwd:o,durationMs:gR(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:[]}),Tl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Qf({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}),Qf=({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:O,signalDescription:T}=pwe(l,u),{originalMessage:A,shortMessage:D,message:$}=qV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),ie=n9(t,$,x);return Object.assign(ie,fwe({error:ie,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),ie},fwe=({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})=>HV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:gR(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:[]}),HV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),pwe=(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 mwe(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(GV(t*1e3)%1e3),nanoseconds:Math.trunc(GV(t*1e6)%1e3)}}function hwe(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 eI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return mwe(t);break}case"bigint":return hwe(t)}throw new TypeError("Expected a finite number or bigint")}var GV,ZV=y(()=>{GV=t=>Number.isFinite(t)?t:0});function tI(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+_we);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&gwe(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?" "+ywe(d,u):f;i.push(p)}},a=eI(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%bwe):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 gwe,ywe,_we,bwe,VV=y(()=>{ZV();gwe=t=>t===0||t===0n,ywe=(t,e)=>e===1||e===1n?t:`${t}s`,_we=1e-7,bwe=24n*60n*60n*1000n});var WV,KV=y(()=>{_l();WV=(t,e)=>{t.failed&&Ti({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var JV,vwe,YV=y(()=>{VV();cs();_l();KV();JV=(t,e)=>{gl(e)&&(WV(t,e),vwe(t,e))},vwe=(t,e)=>{let r=`(done in ${tI(t.durationMs)})`;Ti({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ol,zb=y(()=>{YV();Ol=(t,e,{reject:r})=>{if(JV(t,e),t.failed&&r)throw t;return t}});var eW,Swe,wwe,tW,rW,XV,xwe,rI,QV,Na,nW,$we,Ub,iW,kwe,Ewe,nI,oW,Awe,sW,qb,Twe,iI,Owe,Rwe,aW,An,Bb,oI,cW,lW,fs,vr=y(()=>{Ca();ho();rn();eW=(t,e)=>Na(t)?"asyncGenerator":nW(t)?"generator":Ub(t)?"fileUrl":kwe(t)?"filePath":Twe(t)?"webStream":ei(t,{checkOpen:!1})?"native":Ut(t)?"uint8Array":Owe(t)?"asyncIterable":Rwe(t)?"iterable":iI(t)?tW({transform:t},e):$we(t)?Swe(t,e):"native",Swe=(t,e)=>KR(t.transform,{checkOpen:!1})?wwe(t,e):iI(t.transform)?tW(t,e):xwe(t,e),wwe=(t,e)=>(rW(t,e,"Duplex stream"),"duplex"),tW=(t,e)=>(rW(t,e,"web TransformStream"),"webTransform"),rW=({final:t,binary:e,objectMode:r},n,i)=>{XV(t,`${n}.final`,i),XV(e,`${n}.binary`,i),rI(r,`${n}.objectMode`)},XV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},xwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!QV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(KR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(iI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!QV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return rI(r,`${i}.binary`),rI(n,`${i}.objectMode`),Na(t)||Na(e)?"asyncGenerator":"generator"},rI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},QV=t=>Na(t)||nW(t),Na=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",nW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",$we=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Ub=t=>Object.prototype.toString.call(t)==="[object URL]",iW=t=>Ub(t)&&t.protocol!=="file:",kwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Ewe.has(e))&&nI(t.file),Ewe=new Set(["file","append"]),nI=t=>typeof t=="string",oW=(t,e)=>t==="native"&&typeof e=="string"&&!Awe.has(e),Awe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),sW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",qb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Twe=t=>sW(t)||qb(t),iI=t=>sW(t?.readable)&&qb(t?.writable),Owe=t=>aW(t)&&typeof t[Symbol.asyncIterator]=="function",Rwe=t=>aW(t)&&typeof t[Symbol.iterator]=="function",aW=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),Bb=new Set(["fileUrl","filePath","fileNumber"]),oI=new Set(["fileUrl","filePath"]),cW=new Set([...oI,"webStream","nodeStream"]),lW=new Set(["webTransform","duplex"]),fs={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,Iwe,Pwe,uW,aI=y(()=>{vr();sI=(t,e,r,n)=>n==="output"?Iwe(t,e,r):Pwe(t,e,r),Iwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Pwe=(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})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var dW,Cwe,Dwe,Nwe,jwe,Mwe,Fwe,fW=y(()=>{ho();Ia();vr();aI();dW=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...Cwe(t,e,r,n)],Cwe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Dwe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Fwe(o,r)},Dwe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Nwe({stdioItem:t,optionName:i}):e==="webTransform"?jwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Mwe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Nwe=({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}}},jwe=({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}}},Mwe=({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||nn.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}}},Fwe=(t,e)=>e==="input"?t.reverse():t});import cI from"node:process";var pW,Lwe,zwe,Rl,lI,mW,Uwe,qwe,hW=y(()=>{Ca();vr();pW=(t,e,r)=>{let n=t.map(i=>Lwe(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)??qwe},Lwe=({type:t,value:e},r)=>zwe[r]??mW[t](e),zwe=["input","output","output"],Rl=()=>{},lI=()=>"input",mW={generator:Rl,asyncGenerator:Rl,fileUrl:Rl,filePath:Rl,iterable:lI,asyncIterable:lI,uint8Array:lI,webStream:t=>qb(t)?"output":"input",nodeStream(t){return Pa(t,{checkOpen:!1})?WR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Rl,duplex:Rl,native(t){let e=Uwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return mW.nodeStream(t)}},Uwe=t=>{if([0,cI.stdin].includes(t))return"input";if([1,2,cI.stdout,cI.stderr].includes(t))return"output"},qwe="output"});var gW,yW=y(()=>{gW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var _W,Bwe,Hwe,bW,Gwe,Zwe,vW=y(()=>{yo();yW();cs();_W=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Bwe(t,n).map((a,c)=>bW(a,c));return o?Gwe(s,r,i):gW(s,e)},Bwe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(Hwe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},Hwe=t=>En.some(e=>t[e]!==void 0),bW=(t,e)=>Array.isArray(t)?t.map(r=>bW(r,e)):t??(e>=En.length?"ignore":"pipe"),Gwe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!yl(r,i)&&Zwe(n)?"ignore":n),Zwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Vwe}from"node:fs";import Wwe from"node:tty";var wW,Kwe,Jwe,Ywe,Xwe,SW,xW=y(()=>{Ca();yo();rn();us();wW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Kwe({stdioItem:t,fdNumber:n,direction:i}):Xwe({stdioItem:t,fdNumber:n}),Kwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Jwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Jwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Ywe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Wwe.isatty(i))throw new TypeError(`The \`${e}: ${ub(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:go(Vwe(i)),optionName:e}}},Ywe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=B_.indexOf(t);if(r!==-1)return r},Xwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:SW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:SW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,SW=(t,e,r)=>{let n=B_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var $W,Qwe,exe,txe,rxe,kW=y(()=>{Ca();rn();vr();$W=({input:t,inputFile:e},r)=>r===0?[...Qwe(t),...txe(e)]:[],Qwe=t=>t===void 0?[]:[{type:exe(t),value:t,optionName:"input"}],exe=t=>{if(Pa(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ut(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},txe=t=>t===void 0?[]:[{...rxe(t),optionName:"inputFile"}],rxe=t=>{if(Ub(t))return{type:"fileUrl",value:t};if(nI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var EW,AW,nxe,ixe,TW,oxe,sxe,OW,RW=y(()=>{vr();EW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),AW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=nxe(i,t);if(s.length!==0){if(o){ixe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(cW.has(t))return TW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});lW.has(t)&&sxe({otherStdioItems:s,type:t,value:e,optionName:r})}},nxe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),ixe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{oI.has(e)&&TW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},TW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>oxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return OW(s,n,e),i==="output"?o[0].stream:void 0},oxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,sxe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);OW(i,n,e)},OW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${fs[r]} that is the same.`)}});var Hb,axe,cxe,lxe,uxe,dxe,fxe,pxe,mxe,hxe,gxe,yxe,uI,_xe,Gb=y(()=>{yo();fW();aI();vr();hW();vW();xW();kW();RW();Hb=(t,e,r,n)=>{let o=_W(e,r,n).map((a,c)=>axe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=hxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>_xe(a)),s},axe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=H_(e),{stdioItems:o,isStdioArray:s}=cxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=pW(o,e,i),c=o.map(d=>wW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=dW(c,i,a,r),u=uW(l,a);return mxe(l,u),{direction:a,objectMode:u,stdioItems:l}},cxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>lxe(c,n)),...$W(r,e)],s=EW(o),a=s.length>1;return uxe(s,a,n),fxe(s),{stdioItems:s,isStdioArray:a}},lxe=(t,e)=>({type:eW(t,e),value:t,optionName:e}),uxe=(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(dxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},dxe=new Set(["ignore","ipc"]),fxe=t=>{for(let e of t)pxe(e)},pxe=({type:t,value:e,optionName:r})=>{if(iW(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(oW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},mxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Bb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},hxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(gxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw uI(i),o}},gxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>yxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},yxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=AW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},uI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Yn(r)&&r.destroy()},_xe=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 IW}from"node:fs";var CW,Pi,bxe,DW,PW,vxe,NW=y(()=>{rn();Gb();vr();CW=(t,e)=>Hb(vxe,t,e,!0),Pi=({type:t,optionName:e})=>{DW(e,fs[t])},bxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&DW(t,`"${e}"`),{}),DW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},PW={generator(){},asyncGenerator:Pi,webStream:Pi,nodeStream:Pi,webTransform:Pi,duplex:Pi,asyncIterable:Pi,native:bxe},vxe={input:{...PW,fileUrl:({value:t})=>({contents:[go(IW(t))]}),filePath:({value:{file:t}})=>({contents:[go(IW(t))]}),fileNumber:Pi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...PW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Pi,string:Pi,uint8Array:Pi}}});var So,dI,tp=y(()=>{VR();So=(t,{stripFinalNewline:e},r)=>dI(e,r)&&t!==void 0&&!Array.isArray(t)?El(t):t,dI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Zb,pI,jW,MW,Sxe,wxe,xxe,FW,$xe,fI,kxe,Exe,Axe,Vb=y(()=>{Zb=(t,e,r,n)=>t||r?void 0:MW(e,n),pI=(t,e,r)=>r?t.flatMap(n=>jW(n,e)):jW(t,e),jW=(t,e)=>{let{transform:r,final:n}=MW(e,{});return[...r(t),...n()]},MW=(t,e)=>(e.previousChunks="",{transform:Sxe.bind(void 0,e,t),final:xxe.bind(void 0,e)}),Sxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=fI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=fI(n,r.slice(i+1))),t.previousChunks=n},wxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),xxe=function*({previousChunks:t}){t.length>0&&(yield t)},FW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:$xe.bind(void 0,n)},$xe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?kxe:Axe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},fI=(t,e)=>`${t}${e}`,kxe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:aI},hxe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},gxe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:hxe}});import{Buffer as yxe}from"node:buffer";var CW,_xe,DW,bxe,vxe,NW,jW=y(()=>{rn();CW=(t,e)=>t?void 0:_xe.bind(void 0,e),_xe=function*(t,e){if(typeof e!="string"&&!Ut(e)&&!yxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},DW=(t,e)=>t?bxe.bind(void 0,e):vxe.bind(void 0,e),bxe=function*(t,e){NW(t,e),yield e},vxe=function*(t,e){if(NW(t,e),typeof e!="string"&&!Ut(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},NW=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:fI},Exe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Axe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Exe}});import{Buffer as Txe}from"node:buffer";var LW,Oxe,zW,Rxe,Ixe,UW,qW=y(()=>{rn();LW=(t,e)=>t?void 0:Oxe.bind(void 0,e),Oxe=function*(t,e){if(typeof e!="string"&&!Ut(e)&&!Txe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},zW=(t,e)=>t?Rxe.bind(void 0,e):Ixe.bind(void 0,e),Rxe=function*(t,e){UW(t,e),yield e},Ixe=function*(t,e){if(UW(t,e),typeof e!="string"&&!Ut(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},UW=(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 Sxe}from"node:buffer";import{StringDecoder as wxe}from"node:string_decoder";var Hb,xxe,$xe,kxe,lI=y(()=>{rn();Hb=(t,e,r)=>{if(r)return;if(t)return{transform:xxe.bind(void 0,new TextEncoder)};let n=new wxe(e);return{transform:$xe.bind(void 0,n),final:kxe.bind(void 0,n)}},xxe=function*(t,e){Sxe.isBuffer(e)?yield ho(e):typeof e=="string"?yield t.encode(e):yield e},$xe=function*(t,e){yield Ut(e)?t.write(e):e},kxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as MW}from"node:util";var uI,Gb,FW,Exe,LW,Axe,zW=y(()=>{uI=MW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Gb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Axe}=e[r];for await(let i of n(t))yield*Gb(i,e,r+1)},FW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Exe(r,Number(e),t)},Exe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Gb(n,r,e+1)},LW=MW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Axe=function*(t){yield t}});var dI,UW,ja,Xf,Txe,Oxe,fI=y(()=>{dI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},UW=(t,e)=>[...e.flatMap(r=>[...ja(r,t,0)]),...Xf(t)],ja=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Oxe}=e[r];for(let i of n(t))yield*ja(i,e,r+1)},Xf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Txe(r,Number(e),t)},Txe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*ja(n,r,e+1)},Oxe=function*(t){yield t}});import{Transform as Rxe,getDefaultHighWaterMark as qW}from"node:stream";var pI,Zb,BW,Vb=y(()=>{vr();Bb();jW();lI();zW();fI();pI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=BW(t,s,o),l=Na(e),u=Na(r),d=l?uI.bind(void 0,Gb,a):dI.bind(void 0,ja),f=l||u?uI.bind(void 0,FW,a):dI.bind(void 0,Xf),p=l||u?LW.bind(void 0,a):void 0;return{stream:new Rxe({writableObjectMode:n,writableHighWaterMark:qW(n),readableObjectMode:i,readableHighWaterMark:qW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Zb=(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=BW(s,r,a);t=UW(c,t)}return t},BW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:CW(n,a)},Hb(r,s,n),qb(r,o,n,c),{transform:t,final:e},{transform:DW(i,a)},PW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var HW,Ixe,Pxe,Cxe,Dxe,GW=y(()=>{Vb();rn();vr();HW=(t,e)=>{for(let r of Ixe(t))Pxe(t,r,e)},Ixe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Pxe=(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 ${ds[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Cxe(a,n));r.input=jf(s)},Cxe=(t,e)=>{let r=Zb(t,e,"utf8",!0);return Dxe(r),jf(r)},Dxe=t=>{let e=t.find(r=>typeof r!="string"&&!Ut(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 Wb,Nxe,jxe,ZW,VW,Mxe,WW,mI=y(()=>{Ia();vr();yl();as();Wb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&gl(r,n)&&!nn.has(e)&&Nxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&jxe.has(o))||t.every(({type:i})=>An.has(i))),Nxe=t=>t===1||t===2,jxe=new Set(["pipe","overlapped"]),ZW=async(t,e,r,n)=>{for await(let i of t)Mxe(e)||WW(i,r,n)},VW=(t,e,r)=>{for(let n of t)WW(n,e,r)},Mxe=t=>t._readableState.pipes.length>0,WW=(t,e,r)=>{let n=V_(t);Ti({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Fxe,appendFileSync as Lxe}from"node:fs";var KW,zxe,Uxe,qxe,Bxe,Hxe,JW=y(()=>{mI();Vb();Bb();rn();vr();Da();KW=({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)=>zxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},zxe=({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=DV(t,o,d),p=ho(f),{stdioItems:m,objectMode:h}=e[r],g=Uxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=qxe({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});Bxe({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&&Hxe(b,m,i),S}catch(x){return n.error=x,S}},Uxe=(t,e,r,n)=>{try{return Zb(t,e,r,!1)}catch(i){return n.error=i,t}},qxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:jf(t)};let s=$G(t,r);return n[o]?{serializedResult:s,finalResult:cI(s,!i[o],e)}:{serializedResult:s}},Bxe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Wb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=cI(t,!1,s);try{VW(a,e,n)}catch(c){r.error??=c}},Hxe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Lb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Lxe(n,t):(r.add(o),Fxe(n,t))}}});var YW,XW=y(()=>{rn();Yf();YW=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,vo(e,r,"all")]:Array.isArray(e)?[vo(t,r,"all"),...e]:Ut(t)&&Ut(e)?nR([t,e]):`${t}${e}`}});import{once as hI}from"node:events";var QW,Gxe,e3,t3,Zxe,gI,yI=y(()=>{Oa();QW=async(t,e)=>{let[r,n]=await Gxe(t);return e.isForcefullyTerminated??=!1,[r,n]},Gxe=async t=>{let[e,r]=await Promise.allSettled([hI(t,"spawn"),hI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?e3(t):r.value},e3=async t=>{try{return await hI(t,"exit")}catch{return e3(t)}},t3=async t=>{let[e,r]=await t;if(!Zxe(e,r)&&gI(e,r))throw new Xn;return[e,r]},Zxe=(t,e)=>t===void 0&&e===void 0,gI=(t,e)=>t!==0||e!==null});var r3,Vxe,n3=y(()=>{Oa();Da();yI();r3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=Vxe(t,e,r),s=o?.code==="ETIMEDOUT",a=CV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},Vxe=(t,e,r)=>t!==void 0?t:gI(e,r)?new Xn:void 0});import{spawnSync as Wxe}from"node:child_process";var i3,Kxe,Jxe,Yxe,Kb,Xxe,Qxe,e0e,t0e,o3=y(()=>{fR();zR();UR();Jf();jb();OW();Yf();GW();JW();Da();XW();n3();i3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=Kxe(t,e,r),d=Xxe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Tl(d,c,l)},Kxe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=J_(t,e,r),a=Jxe(r),{file:c,commandArguments:l,options:u}=xb(t,e,a);Yxe(u);let d=AW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Jxe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,Yxe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Kb("ipcInput"),t&&Kb("ipc: true"),r&&Kb("detached: true"),n&&Kb("cancelSignal")},Kb=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Xxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=Qxe({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}=r3(c,r),{output:m,error:h=l}=KW({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>vo(_,r,S)),b=vo(YW(m,r),r,"all");return t0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},Qxe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{HW(o,r);let a=e0e(r);return Wxe(...$b(t,e,a))}catch(a){return Al({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},e0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Db(e)}),t0e=({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?Nb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Kf({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 _I,on as r0e}from"node:events";var s3,n0e,i0e,o0e,s0e,a3=y(()=>{wl();Hf();Bf();s3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(vl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:gb(t)}),n0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),n0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{lb(e,i);let o=us(t,e,r),s=new AbortController;try{return await Promise.race([i0e(o,n,s),o0e(o,r,s),s0e(o,r,s)])}catch(a){throw Sl(t),a}finally{s.abort(),ub(e,i)}},i0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await _I(t,"message",{signal:r});return n}for await(let[n]of r0e(t,"message",{signal:r}))if(e(n))return n},o0e=async(t,e,{signal:r})=>{await _I(t,"disconnect",{signal:r}),_9(e)},s0e=async(t,e,{signal:r})=>{let[n]=await _I(t,"strict:error",{signal:r});throw ob(n,e)}});import{once as l3,on as a0e}from"node:events";var u3,bI,c0e,l0e,u0e,c3,vI=y(()=>{wl();Hf();Bf();u3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>bI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),bI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{vl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:gb(t)}),lb(e,o);let s=us(t,e,r),a=new AbortController,c={};return c0e(t,s,a),l0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),u0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},c0e=async(t,e,r)=>{try{await l3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},l0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await l3(t,"strict:error",{signal:r.signal});n.error=ob(i,e),r.abort()}catch{}},u0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of a0e(r,"message",{signal:o.signal}))c3(s),yield c}catch{c3(s)}finally{o.abort(),ub(e,a),n||Sl(t),i&&await t}},c3=({error:t})=>{if(t)throw t}});import d3 from"node:process";var f3,p3,m3,SI=y(()=>{Sb();a3();vI();mb();f3=(t,{ipc:e})=>{Object.assign(t,m3(t,!1,e))},p3=()=>{let t=d3,e=!0,r=d3.channel!==void 0;return{...m3(t,e,r),getCancelSignal:Z9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},m3=(t,e,r)=>({sendMessage:vb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:s3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:u3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as d0e}from"node:child_process";import{PassThrough as f0e,Readable as p0e,Writable as m0e,Duplex as h0e}from"node:stream";var h3,g0e,Qf,y0e,_0e,b0e,v0e,g3=y(()=>{Ub();Jf();jb();h3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{oI(n);let a=new d0e;g0e(a,n),Object.assign(a,{readable:y0e,writable:_0e,duplex:b0e});let c=Al({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=v0e(c,s,i);return{subprocess:a,promise:l}},g0e=(t,e)=>{let r=Qf(),n=Qf(),i=Qf(),o=Array.from({length:e.length-3},Qf),s=Qf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},Qf=()=>{let t=new f0e;return t.end(),t},y0e=()=>new p0e({read(){}}),_0e=()=>new m0e({write(){}}),b0e=()=>new h0e({read(){},write(){}}),v0e=async(t,e,r)=>Tl(t,e,r)});import{createReadStream as y3,createWriteStream as _3}from"node:fs";import{Buffer as S0e}from"node:buffer";import{Readable as ep,Writable as w0e,Duplex as x0e}from"node:stream";var v3,tp,b3,$0e,S3=y(()=>{Vb();Ub();vr();v3=(t,e)=>zb($0e,t,e,!1),tp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ds[t]}.`)},b3={fileNumber:tp,generator:pI,asyncGenerator:pI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:x0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},$0e={input:{...b3,fileUrl:({value:t})=>({stream:y3(t)}),filePath:({value:{file:t}})=>({stream:y3(t)}),webStream:({value:t})=>({stream:ep.fromWeb(t)}),iterable:({value:t})=>({stream:ep.from(t)}),asyncIterable:({value:t})=>({stream:ep.from(t)}),string:({value:t})=>({stream:ep.from(t)}),uint8Array:({value:t})=>({stream:ep.from(S0e.from(t))})},output:{...b3,fileUrl:({value:t})=>({stream:_3(t)}),filePath:({value:{file:t,append:e}})=>({stream:_3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:w0e.fromWeb(t)}),iterable:tp,asyncIterable:tp,string:tp,uint8Array:tp}}});import{on as k0e,once as w3}from"node:events";import{PassThrough as E0e,getDefaultHighWaterMark as A0e}from"node:stream";import{finished as k3}from"node:stream/promises";function Ma(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)xI(i);let e=t.some(({readableObjectMode:i})=>i),r=T0e(t,e),n=new wI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var T0e,wI,O0e,R0e,I0e,xI,P0e,C0e,D0e,N0e,j0e,E3,A3,$I,T3,M0e,Jb,x3,$3,Yb=y(()=>{T0e=(t,e)=>{if(t.length===0)return A0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},wI=class extends E0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(xI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=O0e(this,this.#t,this.#o);let r=P0e({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(xI(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)}},O0e=async(t,e,r)=>{Jb(t,x3);let n=new AbortController;try{await Promise.race([R0e(t,n),I0e(t,e,r,n)])}finally{n.abort(),Jb(t,-x3)}},R0e=async(t,{signal:e})=>{try{await k3(t,{signal:e,cleanup:!0})}catch(r){throw E3(t,r),r}},I0e=async(t,e,r,{signal:n})=>{for await(let[i]of k0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},xI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},P0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Jb(t,$3);let a=new AbortController;try{await Promise.race([C0e(o,e,a),D0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),N0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Jb(t,-$3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?$I(t):j0e(t))},C0e=async(t,e,{signal:r})=>{try{await t,r.aborted||$I(e)}catch(n){r.aborted||E3(e,n)}},D0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await k3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;A3(s)?i.add(e):T3(t,s)}},N0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await w3(t,i,{signal:o}),!t.readable)return w3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},j0e=t=>{t.writable&&t.end()},E3=(t,e)=>{A3(e)?$I(t):T3(t,e)},A3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",$I=t=>{(t.readable||t.writable)&&t.destroy()},T3=(t,e)=>{t.destroyed||(t.once("error",M0e),t.destroy(e))},M0e=()=>{},Jb=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},x3=2,$3=1});import{finished as O3}from"node:stream/promises";var Rl,F0e,kI,L0e,EI,Xb=y(()=>{go();Rl=(t,e)=>{t.pipe(e),F0e(t,e),L0e(t,e)},F0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await O3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}kI(e)}},kI=t=>{t.writable&&t.end()},L0e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await O3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}EI(t)}},EI=t=>{t.readable&&t.destroy()}});var R3,z0e,U0e,q0e,B0e,H0e,I3=y(()=>{Yb();go();cb();vr();Xb();R3=(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})=>An.has(c)))z0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.has(c)))q0e({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]:Ma(o);Rl(s,i)}},z0e=(t,e,r,n)=>{r==="output"?Rl(t.stdio[n],e):Rl(e,t.stdio[n]);let i=U0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},U0e=["stdin","stdout","stderr"],q0e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;B0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},B0e=(t,{signal:e})=>{Yn(t)&&Ra(t,H0e,e)},H0e=2});var Fa,P3=y(()=>{Fa=[];Fa.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Fa.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Fa.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var Qb,AI,TI,G0e,OI,ev,Z0e,RI,II,PI,C3,nst,ist,D3=y(()=>{P3();Qb=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",AI=Symbol.for("signal-exit emitter"),TI=globalThis,G0e=Object.defineProperty.bind(Object),OI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(TI[AI])return TI[AI];G0e(TI,AI,{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}},ev=class{},Z0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),RI=class extends ev{onExit(){return()=>{}}load(){}unload(){}},II=class extends ev{#t=PI.platform==="win32"?"SIGINT":"SIGHUP";#r=new OI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Fa)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(!Qb(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 Fa)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,Fa.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 Qb(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"&&Qb(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)}},PI=globalThis.process,{onExit:C3,load:nst,unload:ist}=Z0e(Qb(PI)?new II(PI):new RI)});import{addAbortListener as V0e}from"node:events";var N3,j3=y(()=>{D3();N3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=C3(()=>{t.kill()});V0e(n,()=>{i()})}});var F3,W0e,K0e,M3,J0e,L3=y(()=>{rR();K_();ls();ml();F3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=W_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=W0e(r,n,i),{sourceStream:d,sourceError:f}=J0e(t,l),{options:p,fileDescriptors:m}=Ri.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},W0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=K0e(t,e,...r),a=ab(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},K0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(M3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||eR(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]=M_(r,...n);return{destination:e(M3)(i,o,s),pipeOptions:s}}if(Ri.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}`)},M3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),J0e=(t,e)=>{try{return{sourceStream:$l(t,e)}}catch(r){return{sourceError:r}}}});var U3,Y0e,CI,z3,DI=y(()=>{Jf();Xb();U3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=Y0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw CI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},Y0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return EI(t),n;if(e!==void 0)return kI(r),e},CI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Al({error:t,command:z3,escapedCommand:z3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),z3="source.pipe(destination)"});var q3,B3=y(()=>{q3=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 X0e}from"node:stream/promises";var H3,Q0e,e$e,t$e,tv,r$e,n$e,G3=y(()=>{Yb();cb();Xb();H3=(t,e,r)=>{let n=tv.has(e)?e$e(t,e):Q0e(t,e);return Ra(t,r$e,r.signal),Ra(e,n$e,r.signal),t$e(e),n},Q0e=(t,e)=>{let r=Ma([t]);return Rl(r,e),tv.set(e,r),r},e$e=(t,e)=>{let r=tv.get(e);return r.add(t),r},t$e=async t=>{try{await X0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}tv.delete(t)},tv=new WeakMap,r$e=2,n$e=1});import{aborted as i$e}from"node:util";var Z3,o$e,V3=y(()=>{DI();Z3=(t,e)=>t===void 0?[]:[o$e(t,e)],o$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await i$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw CI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var rv,s$e,a$e,W3=y(()=>{mo();L3();DI();B3();G3();V3();rv=(t,...e)=>{if(Ot(e[0]))return rv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=F3(t,...e),i=s$e({...n,destination:r});return i.pipe=rv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},s$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=a$e(t,i);U3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=H3(e,o,d);return await Promise.race([q3(u),...Z3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},a$e=(t,e)=>Promise.allSettled([t,e])});import{on as c$e}from"node:events";import{getDefaultHighWaterMark as l$e}from"node:stream";var nv,u$e,NI,d$e,J3,jI,K3,f$e,p$e,iv=y(()=>{lI();Bb();fI();nv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return u$e(e,s),J3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},u$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},NI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;d$e(e,s,t);let a=t.readableObjectMode&&!o;return J3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},d$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},J3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=c$e(t,"data",{signal:e.signal,highWaterMark:K3,highWatermark:K3});return f$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},jI=l$e(!0),K3=jI,f$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=p$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*ja(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Xf(a)}},p$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Hb(t,r,!e),qb(t,i,!n,{})].filter(Boolean)});import{setImmediate as m$e}from"node:timers/promises";var Y3,h$e,g$e,y$e,MI,X3,FI=y(()=>{Cb();rn();mI();iv();Da();Yf();Y3=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=h$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([g$e(t),d]);return}let f=sI(c,r),p=NI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([y$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},h$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Wb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=NI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await ZW(a,t,r,o)},g$e=async t=>{await m$e(),t.readableFlowing===null&&t.resume()},y$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Ob(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Rb(r,{maxBuffer:o})):await Pb(r,{maxBuffer:o})}catch(a){return X3(RV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},MI=async t=>{try{return await t}catch(e){return X3(e)}},X3=({bufferedData:t})=>wG(t)?new Uint8Array(t):t});import{finished as _$e}from"node:stream/promises";var rp,b$e,v$e,S$e,w$e,x$e,LI,ov,Q3,sv=y(()=>{rp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=b$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],_$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||w$e(a,e,r,n)}finally{s.abort()}},b$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&v$e(t,r,n),n},v$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{S$e(e,r),n.call(t,...i)}},S$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},w$e=(t,e,r,n)=>{if(!x$e(t,e,r,n))throw t},x$e=(t,e,r,n=!0)=>r.propagating?Q3(t)||ov(t):(r.propagating=!0,LI(r,e)===n?Q3(t):ov(t)),LI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",ov=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Q3=t=>t?.code==="EPIPE"});var eK,zI,UI=y(()=>{FI();sv();eK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>zI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),zI=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=rp(t,e,l);if(LI(l,e)){await u;return}let[d]=await Promise.all([Y3({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 tK,rK,$$e,k$e,qI=y(()=>{Yb();UI();tK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ma([t,e].filter(Boolean)):void 0,rK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>zI({...$$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:k$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),$$e=({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}},k$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var nK,iK,oK=y(()=>{yl();as();nK=t=>gl(t,"ipc"),iK=(t,e)=>{let r=V_(t);Ti({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var sK,aK,cK=y(()=>{Da();oK();_o();vI();sK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=nK(o),a=yo(e,"ipc"),c=yo(r,"ipc");for await(let l of bI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(IV(t,i,c),i.push(l)),s&&iK(l,o);return i},aK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as E$e}from"node:events";var lK,A$e,T$e,O$e,uK=y(()=>{Ca();NR();ER();DR();go();vr();FI();cK();MR();qI();UI();yI();sv();lK=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 _=QW(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=eK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=rK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=sK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=A$e(h,t,S),D=T$e(m,S);try{return await Promise.race([Promise.all([{},t3(_),Promise.all(x),w,T,rV(t,d),...A,...D]),g,O$e(t,b),...Y9(t,o,f,b),...y9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...K9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(se=>MI(se))),MI(w),aK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},A$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:rp(n,i,r)),T$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>rp(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),O$e=async(t,{signal:e})=>{let[r]=await E$e(t,"error",{signal:e});throw r}});var dK,np,Il,av=y(()=>{xl();dK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),np=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Oi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Il=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 fK}from"node:stream/promises";var BI,pK,HI,GI,cv,lv,ZI=y(()=>{sv();BI=async t=>{if(t!==void 0)try{await HI(t)}catch{}},pK=async t=>{if(t!==void 0)try{await GI(t)}catch{}},HI=async t=>{await fK(t,{cleanup:!0,readable:!1,writable:!0})},GI=async t=>{await fK(t,{cleanup:!0,readable:!0,writable:!1})},cv=async(t,e)=>{if(await t,e)throw e},lv=(t,e,r)=>{r&&!ov(r)?t.destroy(r):e&&t.destroy()}});import{Readable as R$e}from"node:stream";import{callbackify as I$e}from"node:util";var mK,VI,WI,KI,P$e,JI,YI,hK,XI=y(()=>{Ia();ls();iv();xl();av();ZI();mK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=VI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=WI(a,s),{read:f,onStdoutDataDone:p}=KI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new R$e({read:f,destroy:I$e(YI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return JI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},VI=(t,e,r)=>{let n=$l(t,e),i=np(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},WI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:jI},KI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Oi(),s=nv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){P$e(this,s,o)},onStdoutDataDone:o}},P$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},JI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await GI(t),await n,await BI(i),await e,r.readable&&r.push(null)}catch(o){await BI(i),hK(r,o)}},YI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Il(r,e)&&(hK(t,n),await cv(e,n))},hK=(t,e)=>{lv(t,t.readable,e)}});import{Writable as C$e}from"node:stream";import{callbackify as gK}from"node:util";var yK,QI,eP,D$e,N$e,tP,rP,_K,nP=y(()=>{ls();av();ZI();yK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=QI(t,r,e),s=new C$e({...eP(n,t,i),destroy:gK(rP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return tP(n,s),s},QI=(t,e,r)=>{let n=ab(t,e),i=np(r,n,"writableFinal"),o=np(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},eP=(t,e,r)=>({write:D$e.bind(void 0,t),final:gK(N$e.bind(void 0,t,e,r))}),D$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},N$e=async(t,e,r)=>{await Il(r,e)&&(t.writable&&t.end(),await e)},tP=async(t,e,r)=>{try{await HI(t),e.writable&&e.end()}catch(n){await pK(r),_K(e,n)}},rP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Il(r,e),await Il(n,e)&&(_K(t,i),await cv(e,i))},_K=(t,e)=>{lv(t,t.writable,e)}});import{Duplex as j$e}from"node:stream";import{callbackify as M$e}from"node:util";var bK,F$e,vK=y(()=>{Ia();XI();nP();bK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=VI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=QI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=WI(c,a),{read:g,onStdoutDataDone:b}=KI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new j$e({read:g,...eP(u,t,d),destroy:M$e(F$e.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 JI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),tP(u,_,c),_},F$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([YI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),rP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var iP,L$e,SK=y(()=>{Ia();ls();iv();iP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=$l(t,r),a=nv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return L$e(a,s,t)},L$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var wK,xK=y(()=>{av();XI();nP();vK();SK();wK=(t,{encoding:e})=>{let r=dK();t.readable=mK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=yK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=bK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=iP.bind(void 0,t,e),t[Symbol.asyncIterator]=iP.bind(void 0,t,e,{})}});var $K,z$e,U$e,kK=y(()=>{$K=(t,e)=>{for(let[r,n]of U$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},z$e=(async()=>{})().constructor.prototype,U$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(z$e,t)])});import{setMaxListeners as q$e}from"node:events";import{spawn as B$e}from"node:child_process";var EK,H$e,G$e,Z$e,V$e,W$e,AK=y(()=>{Cb();fR();zR();ls();UR();SI();Jf();jb();g3();S3();Yf();I3();nb();j3();W3();qI();uK();xK();xl();kK();EK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=H$e(t,e,r),{subprocess:f,promise:p}=Z$e({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=rv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),$K(f,p),Ri.set(f,{options:u,fileDescriptors:d}),f},H$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=J_(t,e,r),{file:a,commandArguments:c,options:l}=xb(t,e,r),u=G$e(l),d=v3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},G$e=({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}},Z$e=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=B$e(...$b(t,e,r))}catch(m){return h3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;q$e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];R3(c,a,l),N3(c,r,l);let d={},f=Oi();c.kill=h9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=tK(c,r),wK(c,r),f3(c,r);let p=V$e({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}},V$e=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 lK({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)=>vo(x,e,w)),_=vo(h,e,"all"),S=W$e({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Tl(S,n,e)},W$e=({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?Kf({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 Ii,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Nb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var uv,K$e,J$e,TK=y(()=>{mo();_o();uv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,K$e(n,t[n],i)]));return{...t,...r}},K$e=(t,e,r)=>J$e.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,J$e=new Set(["env",...aR])});var fs,Y$e,X$e,OK=y(()=>{mo();rR();RG();o3();AK();TK();fs=(t,e,r,n)=>{let i=(s,a,c)=>fs(s,a,r,c),o=(...s)=>Y$e({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},Y$e=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,uv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=X$e({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?i3(a,c,l):EK(a,c,l,i)},X$e=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=TG(e)?OG(e,r):[e,...r],[s,a,c]=M_(...o),l=uv(uv(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 RK,IK,PK,Q$e,eke,CK=y(()=>{RK=({file:t,commandArguments:e})=>PK(t,e),IK=({file:t,commandArguments:e})=>({...PK(t,e),isSync:!0}),PK=(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]=Q$e(t);return{file:r,commandArguments:n}},Q$e=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(eke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},eke=/ +/g});var DK,NK,tke,jK,rke,MK,FK=y(()=>{DK=(t,e,r)=>{t.sync=e(tke,r),t.s=t.sync},NK=({options:t})=>jK(t),tke=({options:t})=>({...jK(t),isSync:!0}),jK=t=>({options:{...rke(t),...t}}),rke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},MK={preferLocal:!0}});var Vct,Je,Wct,Kct,Jct,Yct,Xct,Qct,elt,tlt,Mr=y(()=>{OK();CK();jR();FK();SI();Vct=fs(()=>({})),Je=fs(()=>({isSync:!0})),Wct=fs(RK),Kct=fs(IK),Jct=fs(Q9),Yct=fs(NK,{},MK,DK),{sendMessage:Xct,getOneMessage:Qct,getEachMessage:elt,getCancelSignal:tlt}=p3()});import{existsSync as dv,statSync as nke}from"node:fs";import{dirname as oP,extname as ike,isAbsolute as LK,join as sP,relative as aP,resolve as fv,sep as oke}from"node:path";function pv(t){return t==="./gradlew"||t==="gradle"}function ske(t){return(dv(sP(t,"build.gradle.kts"))||dv(sP(t,"build.gradle")))&&dv(sP(t,"gradle.properties"))}function ake(t,e){let n=aP(t,e).split(oke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ps(t,e){return t===":"?`:${e}`:`${t}:${e}`}function cke(t,e){let r=fv(t,e),n=r;dv(r)?nke(r).isFile()&&(n=oP(r)):ike(r)!==""&&(n=oP(r));let i=aP(t,n);if(i.startsWith("..")||LK(i))return null;let o=n;for(;;){if(ske(o))return o;if(fv(o)===fv(t))return null;let s=oP(o);if(s===o)return null;let a=aP(t,s);if(a.startsWith("..")||LK(a))return null;o=s}}function mv(t,e){let r=fv(t),n=new Map,i=[];for(let o of e){let s=cke(r,o);if(!s){i.push(o);continue}let a=ake(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 hv=y(()=>{"use strict"});import{existsSync as lke,readFileSync as uke}from"node:fs";import{join as dke}from"node:path";function Pl(t="."){let e=dke(t,".cladding","config.yaml");if(!lke(e))return cP;try{let n=(0,zK.parse)(uke(e,"utf8"))?.gate;if(!n)return cP;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 fke){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 cP}}function UK(t,e){let r=[],n=!1;for(let i of t){let o=pke.exec(i);if(o){n=!0;for(let s of e)r.push(ps(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 zK,fke,cP,pke,gv=y(()=>{"use strict";zK=St(Qt(),1);hv();fke=["type","lint","test","coverage"],cP={scope:"feature"};pke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as uP,readFileSync as qK,readdirSync as mke,statSync as hke}from"node:fs";import{join as yv}from"node:path";function pP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=yv(t,e);if(uP(r))try{if(BK.test(qK(r,"utf8")))return!0}catch{}}return!1}function HK(t){try{return uP(t)&&BK.test(qK(t,"utf8"))}catch{return!1}}function GK(t,e=0){if(e>4||!uP(t))return!1;let r;try{r=mke(t)}catch{return!1}for(let n of r){let i=yv(t,n),o=!1;try{o=hke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(GK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&HK(i))return!0}return!1}function _ke(t){if(pP(t))return!0;for(let e of gke)if(HK(yv(t,e)))return!0;for(let e of yke)if(GK(yv(t,e)))return!0;return!1}function ZK(t="."){let e=Pl(t).coverage;return e||(_ke(t)?"kover":"jacoco")}function VK(t="."){return dP[ZK(t)]}function WK(t="."){return lP[ZK(t)]}var dP,lP,fP,BK,gke,yke,_v=y(()=>{"use strict";gv();dP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},lP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},fP=[lP.kover,lP.jacoco],BK=/kover/i;gke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],yke=["buildSrc","build-logic"]});import{existsSync as op,readFileSync as JK,readdirSync as YK}from"node:fs";import{join as ms}from"node:path";function hP(t){return op(ms(t,"gradlew"))?"./gradlew":"gradle"}function bke(t){let e=hP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[VK(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function vke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(JK(ms(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 wke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function kke(t,e){for(let r of e)if(op(ms(t,r)))return r}function Eke(t,e){try{return YK(t).find(n=>n.endsWith(e))}catch{return}}function Oke(t){try{return JSON.parse(JK(ms(t,"package.json"),"utf8"))}catch{return{}}}function ip(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function KK(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function Rke(t,e,r){if(ip(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of Ake)if(n.configs.some(i=>op(ms(t,i))))return n.gate;if(Tke.some(n=>op(ms(t,n)))||r.eslintConfig!==void 0)return e}function Pke(t,e){return Ike.some(r=>op(ms(t,r)))?!0:e.jest!==void 0}function Cke(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 Dke(t,e){let r=Oke(t),n=e.lint?Rke(t,e.lint,r):void 0,i=n?{...e,lint:n}:mP(e,"lint"),o=ip(r,"test"),s=o?Cke(o):void 0;return o&&!s?(i=mP(i,"coverage"),{...i,test:{cmd:"npm",args:["test"]},...ip(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):s==="jest"||!o&&Pke(t,r)?{...i,test:{cmd:"npx",args:[...Ci,"jest"]},coverage:{cmd:"npx",args:[...Ci,"jest","--coverage"]}}:(s==="vitest"&&!ip(r,"coverage")&&!KK(r,"@vitest/coverage-v8")&&!KK(r,"@vitest/coverage-istanbul")?i=mP(i,"coverage"):s==="vitest"&&ip(r,"coverage")&&(i={...i,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),i)}function dt(t="."){for(let e of xke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Eke(t,o):r=kke(t,[o]),r)break;if(!r||e.requiresSource&&!wke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Dke(t,n):n;return{language:e.language,manifest:r,gates:i}}return $ke}var Ci,Ske,xke,$ke,Ake,Tke,Ike,on=y(()=>{"use strict";_v();Ci=["--offline","--no-install"];Ske=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);xke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Ci,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Ci,"eslint","."]},test:{cmd:"npx",args:[...Ci,"vitest","run"]},coverage:{cmd:"npx",args:[...Ci,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Ci,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Ci,"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:bke},{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:vke}],$ke={language:"unknown",manifest:"",gates:{}};Ake=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Ci,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Ci,"oxlint"]}}],Tke=["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"];Ike=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Nke,readFileSync as jke}from"node:fs";import{join as Mke}from"node:path";function La(t){return t.code==="ENOENT"}function bv(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=(o||s||`exit ${i}`).slice(0,200);return XK.test(o)||XK.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function qt(t,e,r){if(La(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`};let n=`${String(r.stderr??"")} -${String(r.stdout??"")}`;return e==="npx"&&/ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(n)?{stage:t,pass:!1,exitCode:2,stderr:"'npx' could not resolve the configured tool without installing it"}:null}function tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Cl(t,e){let r=Mke(t,"package.json");if(!Nke(r))return!1;try{return!!JSON.parse(jke(r,"utf8")).scripts?.[e]}catch{return!1}}var XK,Tn=y(()=>{"use strict";XK=/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 Fke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:vv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return La(i)?[{detector:vv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:bv(i,vv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var vv,za,Sv=y(()=>{"use strict";Mr();on();Tn();vv="ARCHITECTURE_VIOLATION";za={name:vv,subprocess:!0,run:Fke}});function Lke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:wv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Je(n.cmd,[...n.args],{cwd:e,reject:!1});return La(i)?[{detector:wv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:bv(i,wv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var wv,Ua,xv=y(()=>{"use strict";Mr();on();Tn();wv="HARDCODED_SECRET";Ua={name:wv,subprocess:!0,run:Lke}});import{existsSync as gP,readdirSync as QK}from"node:fs";import{join as $v}from"node:path";function Uke(t,e){let r=$v(t,e.path);if(!gP(r))return!0;if(e.isDirectory)try{return QK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function qke(t){let{cwd:e="."}=t,r=[];for(let i of zke)Uke(e,i)&&r.push({detector:sp,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=$v(e,"spec.yaml");if(gP(n)){let i=Gke(n),o=i?null:Bke(e);if(i)r.push({detector:sp,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:sp,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=Hke(e);s&&r.push({detector:sp,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 Bke(t){for(let e of["spec/features","spec/scenarios"]){let r=$v(t,e);if(!gP(r))continue;let n;try{n=QK(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ki($v(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function Hke(t){try{return H(t),null}catch(e){return e.message}}function Gke(t){let e;try{e=ki(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var sp,zke,eJ,tJ=y(()=>{"use strict";qe();A_();sp="ABSENCE_OF_GOVERNANCE",zke=[{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}];eJ={name:sp,run:qke}});function kv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function yP(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=kv(r)==="while",o=Vke.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 '${kv(r)}'`}let n=Zke[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:kv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${kv(r)}'`:null}function Wke(t,e){let r=yP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function rJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...Wke(r,n));return e}var Zke,Vke,_P=y(()=>{"use strict";Zke={event:"when",state:"while",optional:"where",unwanted:"if"},Vke=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";qe()});function Kke(t){let{cwd:e="."}=t;return he(e,Ev,Jke)}function Jke(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:Ev,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 rJ(t.features))e.push({detector:Ev,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Ev,nJ,iJ=y(()=>{"use strict";_P();wt();Ev="AC_DRIFT";nJ={name:Ev,run:Kke}});function Di(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return sJ[n]??oJ}var Yke,Xke,Qke,oJ,eEe,tEe,sJ,rEe,aJ,qa=y(()=>{"use strict";on();Yke=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,Xke=/^[ \t]*import\s+([\w.]+)/gm,Qke=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,oJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:Yke,importStyle:"relative"},eEe={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:Xke,importStyle:"dotted"},tEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:Qke,importStyle:"dotted"},sJ={typescript:oJ,kotlin:eEe,python:tEe},rEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],aJ=new Set([...Object.values(sJ).flatMap(t=>t?.extensions??[]),...rEe].map(t=>t.toLowerCase()))});import{existsSync as nEe,readFileSync as iEe,readdirSync as oEe,statSync as sEe}from"node:fs";import{join as lJ,relative as cJ}from"node:path";function aEe(t,e){if(!nEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=oEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=lJ(i,s),c;try{c=sEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function cEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function uEe(t){return lEe.test(t)}function dEe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Di(e,r.project?.language),o=i.sourceRoots.flatMap(a=>aEe(lJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=iEe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";qe();qa();uJ="AI_HINTS_FORBIDDEN_PATTERN";lEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;dJ={name:uJ,run:dEe}});function fEe(t){let{cwd:e="."}=t,r;try{r=H(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:pJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var pJ,mJ,hJ=y(()=>{"use strict";qe();pJ="AC_DUPLICATE_WITHIN_FEATURE";mJ={name:pJ,run:fEe}});import{createRequire as pEe}from"module";import{basename as mEe,dirname as vP,normalize as hEe,relative as gEe,resolve as yEe,sep as _J}from"path";import*as _Ee from"fs";function bEe(t){let e=hEe(t);return e.length>1&&e[e.length-1]===_J&&(e=e.substring(0,e.length-1)),e}function bJ(t,e){return t.replace(vEe,e)}function wEe(t){return t==="/"||SEe.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=yEe(t)),(n||o)&&(t=bEe(t)),t===".")return"";let s=t[t.length-1]!==i;return bJ(s?t+i:t,i)}function vJ(t,e){return e+t}function xEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:bJ(gEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function $Ee(t){return t}function kEe(t,e,r){return e+t+r}function EEe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?xEe(t,e):n?vJ:$Ee}function AEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function TEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function PEe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?TEe(t):AEe(t):n&&n.length?REe:OEe:IEe}function FEe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?MEe:r&&r.length?n?CEe:DEe:n?NEe:jEe}function UEe(t){return t.group?zEe:LEe}function HEe(t){return t.group?qEe:BEe}function VEe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?ZEe:GEe}function SJ(t,e,r){if(r.options.useRealPaths)return WEe(e,r);let n=vP(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=vP(n)}return r.symlinks.set(t,e),i>1}function WEe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Av(t,e,r,n){e(t&&!n?t:null,r)}function nAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?KEe:QEe:n?e?JEe:rAe:i?e?XEe:tAe:e?YEe:eAe}function sAe(t){return t?oAe:iAe}function uAe(t,e){return new Promise((r,n)=>{$J(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function $J(t,e,r){new xJ(t,e,r).start()}function dAe(t,e){return new xJ(t,e).start()}var gJ,vEe,SEe,OEe,REe,IEe,CEe,DEe,NEe,jEe,MEe,LEe,zEe,qEe,BEe,GEe,ZEe,KEe,JEe,YEe,XEe,QEe,eAe,tAe,rAe,wJ,iAe,oAe,aAe,cAe,lAe,xJ,yJ,kJ,EJ,AJ=y(()=>{gJ=pEe(import.meta.url);vEe=/[\\/]/g;SEe=/^[a-z]:[\\/]$/i;OEe=(t,e)=>{e.push(t||".")},REe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},IEe=()=>{};CEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},DEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},NEe=(t,e,r,n)=>{r.files++},jEe=(t,e)=>{e.push(t)},MEe=()=>{};LEe=t=>t,zEe=()=>[""].slice(0,0);qEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},BEe=()=>{};GEe=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()&&SJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},ZEe=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()&&SJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};KEe=t=>t.counts,JEe=t=>t.groups,YEe=t=>t.paths,XEe=t=>t.paths.slice(0,t.options.maxFiles),QEe=(t,e,r)=>(Av(e,r,t.counts,t.options.suppressErrors),null),eAe=(t,e,r)=>(Av(e,r,t.paths,t.options.suppressErrors),null),tAe=(t,e,r)=>(Av(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),rAe=(t,e,r)=>(Av(e,r,t.groups,t.options.suppressErrors),null);wJ={withFileTypes:!0},iAe=(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||".",wJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},oAe=(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||".",wJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};aAe=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))}},cAe=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}},lAe=class{aborted=!1;abort(){this.aborted=!0}},xJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=nAe(e,this.isSynchronous),this.root=bP(t,e),this.state={root:wEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new cAe,options:e,queue:new aAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new lAe,fs:e.fs||_Ee},this.joinPath=EEe(this.root,e),this.pushDirectory=PEe(this.root,e),this.pushFile=FEe(e),this.getArray=UEe(e),this.groupFiles=HEe(e),this.resolveSymlink=VEe(e,this.isSynchronous),this.walkDirectory=sAe(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=mEe(_),x=bP(vP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};yJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return uAe(this.root,this.options)}withCallback(t){$J(this.root,this.options,t)}sync(){return dAe(this.root,this.options)}},kJ=null;try{gJ.resolve("picomatch"),kJ=gJ("picomatch")}catch{}EJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:_J,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 yJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new yJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||kJ;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 ap=v((iut,PJ)=>{"use strict";var TJ="[^\\\\/]",fAe="(?=.)",OJ="[^/]",SP="(?:\\/|$)",RJ="(?:^|\\/)",wP=`\\.{1,2}${SP}`,pAe="(?!\\.)",mAe=`(?!${RJ}${wP})`,hAe=`(?!\\.{0,1}${SP})`,gAe=`(?!${wP})`,yAe="[^.\\/]",_Ae=`${OJ}*?`,bAe="/",IJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:fAe,QMARK:OJ,END_ANCHOR:SP,DOTS_SLASH:wP,NO_DOT:pAe,NO_DOTS:mAe,NO_DOT_SLASH:hAe,NO_DOTS_SLASH:gAe,QMARK_NO_DOT:yAe,STAR:_Ae,START_ANCHOR:RJ,SEP:bAe},vAe={...IJ,SLASH_LITERAL:"[\\\\/]",QMARK:TJ,STAR:`${TJ}*?`,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:"\\"},SAe={__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"};PJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:SAe,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?vAe:IJ}}});var cp=v(Fr=>{"use strict";var{REGEX_BACKSLASH:wAe,REGEX_REMOVE_BACKSLASH:xAe,REGEX_SPECIAL_CHARS:$Ae,REGEX_SPECIAL_CHARS_GLOBAL:kAe}=ap();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>$Ae.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(kAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(wAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(xAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var zJ=v((sut,LJ)=>{"use strict";var CJ=cp(),{CHAR_ASTERISK:xP,CHAR_AT:EAe,CHAR_BACKWARD_SLASH:lp,CHAR_COMMA:AAe,CHAR_DOT:$P,CHAR_EXCLAMATION_MARK:kP,CHAR_FORWARD_SLASH:FJ,CHAR_LEFT_CURLY_BRACE:EP,CHAR_LEFT_PARENTHESES:AP,CHAR_LEFT_SQUARE_BRACKET:TAe,CHAR_PLUS:OAe,CHAR_QUESTION_MARK:DJ,CHAR_RIGHT_CURLY_BRACE:RAe,CHAR_RIGHT_PARENTHESES:NJ,CHAR_RIGHT_SQUARE_BRACKET:IAe}=ap(),jJ=t=>t===FJ||t===lp,MJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},PAe=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,se=()=>c.charCodeAt(l+1),Y=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),Oe&&m===!0&&d>0?(Oe=c.slice(0,d),P=c.slice(d)):m===!0?(Oe="",P=c):Oe=c,Oe&&Oe!==""&&Oe!=="/"&&Oe!==c&&jJ(Oe.charCodeAt(Oe.length-1))&&(Oe=Oe.slice(0,-1)),r.unescape===!0&&(P&&(P=CJ.removeBackslashes(P)),Oe&&_===!0&&(Oe=CJ.removeBackslashes(Oe)));let Ir={prefix:C,input:t,start:u,base:Oe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,jJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let oe;for(let Pe=0;Pe{"use strict";var up=ap(),sn=cp(),{MAX_LENGTH:Tv,POSIX_REGEX_SOURCE:CAe,REGEX_NON_SPECIAL_CHARS:DAe,REGEX_SPECIAL_CHARS_BACKREF:NAe,REPLACEMENTS:UJ}=up,jAe=(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=>sn.escapeRegex(i)).join("..")}return r},Dl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,qJ=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},MAe=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},BJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(MAe(e))return e.replace(/\\(.)/g,"$1")},FAe=t=>{let e=t.map(BJ).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}}}}},LAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=BJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},zAe=t=>{let e=0,r=t.trim(),n=TP(r);for(;n;)e++,r=n.body.trim(),n=TP(r);return e},UAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:up.DEFAULT_MAX_EXTGLOB_RECURSION,n=qJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||FAe(n)))return{risky:!0};for(let i of n){let o=LAe(i);if(o)return{risky:!0,safeOutput:o};if(zAe(i)>r)return{risky:!0}}return{risky:!1}},OP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=UJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Tv,r.maxLength):Tv,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=up.globChars(r.windows),l=up.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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={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=sn.removePrefix(t,$),i=t.length;let se=[],Y=[],Oe=[],C=o,P,Ir=()=>$.index===i-1,oe=$.peek=(B=1)=>t[$.index+B],Pe=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(B="",ht=0)=>{$.consumed+=B,$.index+=ht},Yt=B=>{$.output+=B.output!=null?B.output:B.value,dr(B.value)},so=()=>{let B=1;for(;oe()==="!"&&(oe(2)!=="("||oe(3)==="?");)Pe(),$.start++,B++;return B%2===0?!1:($.negated=!0,$.start++,!0)},vi=B=>{$[B]++,Oe.push(B)},Yr=B=>{$[B]--,Oe.pop()},de=B=>{if(C.type==="globstar"){let ht=$.braces>0&&(B.type==="comma"||B.type==="brace"),q=B.extglob===!0||se.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ht&&!q&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(se.length&&B.type!=="paren"&&(se[se.length-1].inner+=B.value),(B.value||B.output)&&Yt(B),C&&C.type==="text"&&B.type==="text"){C.output=(C.output||C.value)+B.value,C.value+=B.value;return}B.prev=C,s.push(B),C=B},ao=(B,ht)=>{let q={...l[ht],conditions:1,inner:""};q.prev=C,q.parens=$.parens,q.output=$.output,q.startIndex=$.index,q.tokensIndex=s.length;let Ae=(r.capture?"(":"")+q.open;vi("parens"),de({type:B,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Ae}),se.push(q)},yde=B=>{let ht=t.slice(B.startIndex,$.index+1),q=t.slice(B.startIndex+2,$.index),Ae=UAe(q,r);if((B.type==="plus"||B.type==="star")&&Ae.risky){let ct=Ae.safeOutput?(B.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,Si=s[B.tokensIndex];Si.type="text",Si.value=ht,Si.output=ct||sn.escapeRegex(ht);for(let wi=B.tokensIndex+1;wi1&&B.inner.includes("/")&&(ct=O(r)),(ct!==D||Ir()||/^\)+$/.test(Kt()))&&(ut=B.close=`)$))${ct}`),B.inner.includes("*")&&(Lt=Kt())&&/^\.[^\\/.]+$/.test(Lt)){let Si=OP(Lt,{...e,fastpaths:!1}).output;ut=B.close=`)${Si})${ct})`}B.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ht=t.replace(NAe,(q,Ae,ut,Lt,ct,Si)=>Lt==="\\"?(B=!0,q):Lt==="?"?Ae?Ae+Lt+(ct?_.repeat(ct.length):""):Si===0?A+(ct?_.repeat(ct.length):""):_.repeat(ut.length):Lt==="."?u.repeat(ut.length):Lt==="*"?Ae?Ae+Lt+(ct?D:""):D:Ae?q:`\\${q}`);return B===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=sn.wrapOutput(ht,$,e),$)}for(;!Ir();){if(P=Pe(),P==="\0")continue;if(P==="\\"){let q=oe();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){P+="\\",de({type:"text",value:P});continue}let Ae=/^\\+/.exec(Kt()),ut=0;if(Ae&&Ae[0].length>2&&(ut=Ae[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Pe():P+=Pe(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let q=C.value.slice(1);if(q.includes("[")&&(C.posix=!0,q.includes(":"))){let Ae=C.value.lastIndexOf("["),ut=C.value.slice(0,Ae),Lt=C.value.slice(Ae+2),ct=CAe[Lt];if(ct){C.value=ut+ct,$.backtrack=!0,Pe(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&oe()!==":"||P==="-"&&oe()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Yt({value:P});continue}if($.quotes===1&&P!=='"'){P=sn.escapeRegex(P),C.value+=P,Yt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){vi("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Dl("opening","("));let q=se[se.length-1];if(q&&$.parens===q.parens+1){yde(se.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Yr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Dl("closing","]"));P=`\\${P}`}else vi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Dl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Yr("brackets");let q=C.value.slice(1);if(C.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(P=`/${P}`),C.value+=P,Yt({value:P}),r.literalBrackets===!1||sn.hasRegexChars(q))continue;let Ae=sn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Ae,C.value=Ae;continue}C.value=`(${a}${Ae}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){vi("braces");let q={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};Y.push(q),de(q);continue}if(P==="}"){let q=Y[Y.length-1];if(r.nobrace===!0||!q){de({type:"text",value:P,output:P});continue}let Ae=")";if(q.dots===!0){let ut=s.slice(),Lt=[];for(let ct=ut.length-1;ct>=0&&(s.pop(),ut[ct].type!=="brace");ct--)ut[ct].type!=="dots"&&Lt.unshift(ut[ct].value);Ae=jAe(Lt,r),$.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let ut=$.output.slice(0,q.outputIndex),Lt=$.tokens.slice(q.tokensIndex);q.value=q.output="\\{",P=Ae="\\}",$.output=ut;for(let ct of Lt)$.output+=ct.output||ct.value}de({type:"brace",value:P,output:Ae}),Yr("braces"),Y.pop();continue}if(P==="|"){se.length>0&&se[se.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let q=P,Ae=Y[Y.length-1];Ae&&Oe[Oe.length-1]==="braces"&&(Ae.comma=!0,q="|"),de({type:"comma",value:P,output:q});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let q=Y[Y.length-1];C.type="dots",C.output+=P,C.value+=P,q.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){ao("qmark",P);continue}if(C&&C.type==="paren"){let Ae=oe(),ut=P;(C.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&oe()==="("&&(oe(2)!=="?"||!/[!=<:]/.test(oe(3)))){ao("negate",P);continue}if(r.nonegate!==!0&&$.index===0){so();continue}}if(P==="+"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){ao("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&oe()==="("&&oe(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let q=DAe.exec(Kt());q&&(P+=q[0],$.index+=q[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let B=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){ao("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let q=C.prev,Ae=q.prev,ut=q.type==="slash"||q.type==="bos",Lt=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!ut||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let ct=$.braces>0&&(q.type==="comma"||q.type==="brace"),Si=se.length&&(q.type==="pipe"||q.type==="paren");if(!ut&&q.type!=="paren"&&!ct&&!Si){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let wi=t[$.index+4];if(wi&&wi!=="/")break;B=B.slice(3),dr("/**",3)}if(q.type==="bos"&&Ir()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!Lt&&Ir()){$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=q.output+C.output,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&B[0]==="/"){let wi=B[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${wi})`,C.value+=P,$.output+=q.output+C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&B[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),oe()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Dl("closing","]"));$.output=sn.escapeLast($.output,"["),Yr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Dl("closing",")"));$.output=sn.escapeLast($.output,"("),Yr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Dl("closing","}"));$.output=sn.escapeLast($.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let B of $.tokens)$.output+=B.output!=null?B.output:B.value,B.suffix&&($.output+=B.suffix)}return $};OP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Tv,r.maxLength):Tv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=UJ[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}=up.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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};HJ.exports=OP});var WJ=v((cut,VJ)=>{"use strict";var qAe=zJ(),RP=GJ(),ZJ=cp(),BAe=ap(),HAe=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=HAe(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?ZJ.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)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(ZJ.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):RP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>qAe(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=RP.fastpaths(t,e)),i.output||(i=RP(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=BAe;VJ.exports=Rt});var XJ=v((lut,YJ)=>{"use strict";var KJ=WJ(),GAe=cp();function JJ(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:GAe.isWindows()}),KJ(t,e,r)}Object.assign(JJ,KJ);YJ.exports=JJ});import{readdir as ZAe,readdirSync as VAe,realpath as WAe,realpathSync as KAe,stat as JAe,statSync as YAe}from"fs";import{isAbsolute as XAe,posix as Ba,resolve as QAe}from"path";import{fileURLToPath as eTe}from"url";function nTe(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]===".."&&rTe.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=>Ba.relative(t,n)||".":n=>Ba.relative(t,`${e}/${n}`)||"."}function sTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ba.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function r8(t){var e;let r=Nl.default.scan(t,aTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function pTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Nl.default.scan(t);return r.isGlob||r.negated}function dp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function n8(t){return typeof t=="string"?[t]:t??[]}function IP(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=fTe(o);s=XAe(s.replace(hTe,""))?Ba.relative(a,s):Ba.normalize(s);let c=(i=mTe.exec(s))===null||i===void 0?void 0:i[0],l=r8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?Ba.join(o,...d):o}return s}function gTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(IP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(IP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(IP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function yTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=gTe(t,e,n);t.debug&&dp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(e8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Nl.default)(i.match,f),m=(0,Nl.default)(i.ignore,f),h=nTe(i.match,f),g=QJ(r,d,o),b=o?g:QJ(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new EJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&dp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return dp(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&dp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&sTe(r,d)]}function _Te(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function vTe(t){let e={...bTe,...t};return e.cwd=(e.cwd instanceof URL?eTe(e.cwd):QAe(e.cwd)).replace(e8,"/"),e.ignore=n8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||ZAe,readdirSync:e.fs.readdirSync||VAe,realpath:e.fs.realpath||WAe,realpathSync:e.fs.realpathSync||KAe,stat:e.fs.stat||JAe,statSync:e.fs.statSync||YAe}),e.debug&&dp("globbing with options:",e),e}function STe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=tTe(t)||typeof t=="string",i=n8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=vTe(n?e:t);return i.length>0?yTe(o,i):[]}function hs(t,e){let[r,n]=STe(t,e);return r?_Te(r.sync(),n):[]}var Nl,tTe,e8,t8,rTe,iTe,oTe,aTe,cTe,lTe,uTe,dTe,fTe,mTe,hTe,bTe,fp=y(()=>{AJ();Nl=St(XJ(),1),tTe=Array.isArray,e8=/\\/g,t8=process.platform==="win32",rTe=/^(\/?\.\.)+$/;iTe=/^[A-Z]:\/$/i,oTe=t8?t=>iTe.test(t):t=>t==="/";aTe={parts:!0};cTe=/(?t.replace(cTe,"\\$&"),dTe=t=>t.replace(lTe,"\\$&"),fTe=t8?dTe:uTe;mTe=/^(\/?\.\.)+/,hTe=/\\(?=[()[\]{}!*+?@|])/g;bTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as pp,readFileSync as wTe,readdirSync as xTe,statSync as i8}from"node:fs";import{join as Ha}from"node:path";function $Te(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Di(e,n),o=[],{layers:s,forbiddenImports:a}=PP(r);return(s.size>0||a.length>0)&&!pp(Ha(e,i.mainRoot))?[{detector:mp,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&&(kTe(e,i,s,o),ETe(e,i,s,o)),a.length>0&&ATe(e,i,a,o),o)}function PP(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 kTe(t,e,r,n){let i=e.mainRoot,o=Ha(t,i);if(pp(o))for(let s of xTe(o)){let a=Ha(o,s);i8(a).isDirectory()&&(r.has(s)||n.push({detector:mp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function ETe(t,e,r,n){let i=e.mainRoot,o=Ha(t,i);if(pp(o))for(let s of r){let a=Ha(o,s);pp(a)&&i8(a).isDirectory()||n.push({detector:mp,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 ATe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ha(t,i,s.from);if(!pp(a))continue;let c=hs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ha(a,l),d;try{d=wTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];TTe(p,s.to,e.importStyle)&&n.push({detector:mp,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 TTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var mp,o8,CP=y(()=>{"use strict";fp();qe();qa();mp="ARCHITECTURE_FROM_SPEC";o8={name:mp,run:$Te}});import{existsSync as OTe,readFileSync as RTe}from"node:fs";import{join as ITe}from"node:path";function CTe(t){let{cwd:e="."}=t,r=ITe(e,"spec/capabilities.yaml");if(!OTe(r))return[];let n;try{let l=RTe(r,"utf8"),u=s8.default.parse(l);if(!u||typeof u!="object")return[];n=u}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let l=H(e);o=new Set(l.features.map(u=>u.id))}catch{return[]}let s=[],a=new Set,c=o.size>=PTe;for(let l of i){if(typeof l!="object"||l===null)continue;let u=String(l.id??"(unnamed)"),d=Array.isArray(l.features)?l.features:[];if(d.length===0){s.push({detector:Ov,severity:c?"warn":"info",path:"spec/capabilities.yaml",message:c?`capability "${u}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`:`capability "${u}" has no features mapped yet \u2014 retained as future onboarding intent; bind it when a matching feature lands`});continue}for(let f of d){let p=String(f);o.has(p)?a.add(p):s.push({detector:Ov,severity:"error",path:"spec/capabilities.yaml",message:`capability "${u}" references feature ${p} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let l of o)a.has(l)||s.push({detector:Ov,severity:"info",path:"spec.yaml",message:`feature ${l} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var s8,Ov,PTe,a8,c8=y(()=>{"use strict";s8=St(Qt(),1);qe();Ov="CAPABILITIES_FEATURE_MAPPING",PTe=8;a8={name:Ov,run:CTe}});import{existsSync as DTe,readFileSync as NTe}from"node:fs";import{join as jTe}from"node:path";function MTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function FTe(t){let{cwd:e="."}=t;return he(e,DP,r=>LTe(r,e))}function LTe(t,e){let r=Di(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=jTe(e,o);if(!DTe(s))continue;let a=NTe(s,"utf8");MTe(a)||n.push({detector:DP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var DP,l8,u8=y(()=>{"use strict";qa();wt();DP="CONVENTION_DRIFT";l8={name:DP,run:FTe}});import{existsSync as NP,readFileSync as d8}from"node:fs";import{join as Rv}from"node:path";function zTe(t){return JSON.parse(t).total?.lines?.pct??0}function f8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function BTe(t,e){if(!pv(dt(t).gates.coverage?.cmd))return null;let r;try{r=mv(t,e)}catch(c){return[{detector:So,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=fP.find(d=>NP(Rv(c.dir,d)));if(!l){s.push(c.path);continue}let u=f8(d8(Rv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:So,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=p8(n,i);return a0?[{detector:So,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function HTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=BTe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Di(e,r),i=dt(e).language==="kotlin"?fP.find(a=>NP(Rv(e,a)))??WK(e):n.coverageSummary,o=Rv(e,i);if(!NP(o))return[{detector:So,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=d8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?UTe(a):n.coverageFormat==="cobertura-xml"?qTe(a):zTe(a)}catch(a){return[{detector:So,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:So,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Iv?[]:[{detector:So,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Iv}%`}]}var So,Iv,m8,h8=y(()=>{"use strict";qe();_v();qa();hv();on();So="COVERAGE_DROP",Iv=70;m8={name:So,run:HTe}});import{existsSync as GTe}from"node:fs";import{join as ZTe}from"node:path";function WTe(t){let{cwd:e="."}=t;return he(e,Pv,r=>KTe(r,e))}function KTe(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?GTe(ZTe(e,r.path))?[]:[{detector:Pv,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:Pv,severity:t.features.length>=VTe?"warn":"info",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var Pv,VTe,g8,y8=y(()=>{"use strict";wt();Pv="DELIVERABLE_INTEGRITY",VTe=8;g8={name:Pv,run:WTe}});function JTe(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:Cv,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 YTe(t){let e=JTe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Cv,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 XTe(t){let{cwd:e="."}=t;return he(e,Cv,r=>YTe(r))}var Cv,_8,b8=y(()=>{"use strict";wt();Cv="SMOKE_PROBE_DEMAND";_8={name:Cv,run:XTe}});function QTe(t){let{cwd:e="."}=t;return he(e,Dv,r=>eOe(r,e))}function eOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=os(e);if(n===null)return[{detector:Dv,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=C_(n,e,o);s.state!=="fresh"&&i.push({detector:Dv,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 Dv,Nv,jP=y(()=>{"use strict";dl();wt();Dv="STALE_ATTESTATION";Nv={name:Dv,run:QTe}});function tOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return rOe(r)}function rOe(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:v8,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 v8,jv,MP=y(()=>{"use strict";qe();v8="DEPENDENCY_CYCLE";jv={name:v8,run:tOe}});import{appendFileSync as nOe,existsSync as S8,mkdirSync as iOe,readFileSync as oOe}from"node:fs";import{dirname as sOe,join as aOe}from"node:path";function w8(t){return aOe(t,cOe,lOe)}function x8(t){return FP.add(t),()=>FP.delete(t)}function Ga(t,e){let r=w8(t),n=sOe(r);S8(n)||iOe(n,{recursive:!0}),nOe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of FP)try{i(t,e)}catch{}}function On(t){let e=w8(t);if(!S8(e))return[];let r=oOe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var cOe,lOe,FP,ti=y(()=>{"use strict";cOe=".cladding",lOe="audit.log.jsonl";FP=new Set});import{existsSync as uOe}from"node:fs";import{join as dOe}from"node:path";function fOe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:LP,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&&(uOe(dOe(e,i.artifact))||n.push({detector:LP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var LP,$8,k8=y(()=>{"use strict";ti();LP="EVIDENCE_MISMATCH";$8={name:LP,run:fOe}});import{existsSync as pOe,readFileSync as mOe}from"node:fs";import{join as hOe}from"node:path";function gOe(t){let e=hOe(t,O8);if(!pOe(e))return null;try{let n=((0,T8.parse)(mOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*A8(t,e){for(let r of t??[])r.startsWith(E8)&&(yield{ref:r,name:r.slice(E8.length),field:e})}function yOe(t){let{cwd:e="."}=t,r=gOe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:zP,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=[...A8(s.evidence_refs,"evidence_refs"),...A8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:zP,severity:"warn",path:O8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var T8,zP,E8,O8,R8,I8=y(()=>{"use strict";T8=St(Qt(),1);qe();zP="FIXTURE_REFERENCE_INVALID",E8="fixture:",O8="conformance/fixtures.yaml";R8={name:zP,run:yOe}});import{existsSync as jl,readFileSync as UP}from"node:fs";import{join as Za}from"node:path";function _Oe(t){return hs(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function hp(t){if(!jl(t))return null;try{return JSON.parse(UP(t,"utf8"))}catch{return null}}function bOe(t,e){let r=Za(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(UP(r,"utf8"))}catch(c){e.push({detector:wo,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:wo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=_Oe(t);s!==a&&e.push({detector:wo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function vOe(t,e){for(let r of P8){let n=Za(t,r.path);if(!jl(n))continue;let i=hp(n);if(!i){e.push({detector:wo,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:wo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function SOe(t,e){let r=hp(Za(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of P8){let s=Za(t,o.path);if(!jl(s))continue;let a=hp(s);a?.version&&a.version!==n&&e.push({detector:wo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Za(t,".claude-plugin","marketplace.json");if(jl(i)){let o=hp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:wo,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 wOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function xOe(t,e){let r=Za(t,"src","cli","clad.ts"),n=Za(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!jl(r)||!jl(n))return;let i=wOe(UP(r,"utf8"));if(i.length===0)return;let s=hp(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:wo,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 $Oe(t){let{cwd:e="."}=t,r=[];return bOe(e,r),xOe(e,r),vOe(e,r),SOe(e,r),r}var wo,P8,C8,D8=y(()=>{"use strict";fp();wo="HARNESS_INTEGRITY",P8=[{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"]}];C8={name:wo,run:$Oe}});import{existsSync as kOe,readFileSync as EOe}from"node:fs";import{join as AOe}from"node:path";function OOe(t){let{cwd:e="."}=t;return he(e,Mv,r=>IOe(r,e))}function ROe(t){let e=AOe(t,"spec/capabilities.yaml");if(!kOe(e))return!1;try{let r=N8.default.parse(EOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function IOe(t,e){let r=t.features.length;if(r{"use strict";N8=St(Qt(),1);wt();Mv="HOLLOW_GOVERNANCE",TOe=8;j8={name:Mv,run:OOe}});import{existsSync as F8,readFileSync as L8}from"node:fs";import{join as z8}from"node:path";function U8(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 DOe(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 NOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function jOe(t){let e=z8(t,"README.md"),r=z8(t,"docs","dogfood","matrix.md");if(!F8(e)||!F8(r))return[];let n=U8(L8(e,"utf8"),POe),i=U8(L8(r,"utf8"),COe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=NOe(a);if(c===null)continue;let l=i[s]??"not-run",u=DOe(l);u!==null&&c>u&&o.push({detector:q8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function MOe(t){let{cwd:e="."}=t;return jOe(e)}var q8,POe,COe,B8,H8=y(()=>{"use strict";q8="HOST_CLAIM_DRIFT",POe=//,COe=//;B8={name:q8,run:MOe}});function FOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return G8(r.features.map(i=>i.id),"feature","spec/features/",n),G8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function G8(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:Z8,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var Z8,V8,W8=y(()=>{"use strict";qe();Z8="ID_COLLISION";V8={name:Z8,run:FOe}});import{existsSync as gp,readFileSync as qP,readdirSync as BP,statSync as LOe,writeFileSync as J8}from"node:fs";import{join as xo}from"node:path";function K8(t){if(!gp(t))return 0;try{return BP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function zOe(t){if(!gp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=BP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=xo(n,o),a;try{a=LOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function UOe(t){let e=xo(t,"spec","capabilities.yaml");if(!gp(e))return 0;try{let r=Fv.default.parse(qP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function gs(t="."){let e=K8(xo(t,"spec","features")),r=K8(xo(t,"spec","scenarios")),n=UOe(t),i=zOe(xo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Ml(t,e){let r=xo(t,"spec.yaml");if(!gp(r))return;let n=qP(r,"utf8"),i=qOe(n,e);i!==n&&J8(r,i)}function qOe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as Pxe}from"node:buffer";import{StringDecoder as Cxe}from"node:string_decoder";var Wb,Dxe,Nxe,jxe,mI=y(()=>{rn();Wb=(t,e,r)=>{if(r)return;if(t)return{transform:Dxe.bind(void 0,new TextEncoder)};let n=new Cxe(e);return{transform:Nxe.bind(void 0,n),final:jxe.bind(void 0,n)}},Dxe=function*(t,e){Pxe.isBuffer(e)?yield go(e):typeof e=="string"?yield t.encode(e):yield e},Nxe=function*(t,e){yield Ut(e)?t.write(e):e},jxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as BW}from"node:util";var hI,Kb,HW,Mxe,GW,Fxe,ZW=y(()=>{hI=BW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Kb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Fxe}=e[r];for await(let i of n(t))yield*Kb(i,e,r+1)},HW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Mxe(r,Number(e),t)},Mxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Kb(n,r,e+1)},GW=BW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Fxe=function*(t){yield t}});var gI,VW,ja,rp,Lxe,zxe,yI=y(()=>{gI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},VW=(t,e)=>[...e.flatMap(r=>[...ja(r,t,0)]),...rp(t)],ja=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=zxe}=e[r];for(let i of n(t))yield*ja(i,e,r+1)},rp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Lxe(r,Number(e),t)},Lxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*ja(n,r,e+1)},zxe=function*(t){yield t}});import{Transform as Uxe,getDefaultHighWaterMark as WW}from"node:stream";var _I,Jb,KW,Yb=y(()=>{vr();Vb();qW();mI();ZW();yI();_I=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=KW(t,s,o),l=Na(e),u=Na(r),d=l?hI.bind(void 0,Kb,a):gI.bind(void 0,ja),f=l||u?hI.bind(void 0,HW,a):gI.bind(void 0,rp),p=l||u?GW.bind(void 0,a):void 0;return{stream:new Uxe({writableObjectMode:n,writableHighWaterMark:WW(n),readableObjectMode:i,readableHighWaterMark:WW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Jb=(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=KW(s,r,a);t=VW(c,t)}return t},KW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:LW(n,a)},Wb(r,s,n),Zb(r,o,n,c),{transform:t,final:e},{transform:zW(i,a)},FW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var JW,qxe,Bxe,Hxe,Gxe,YW=y(()=>{Yb();rn();vr();JW=(t,e)=>{for(let r of qxe(t))Bxe(t,r,e)},qxe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Bxe=(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 ${fs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Hxe(a,n));r.input=zf(s)},Hxe=(t,e)=>{let r=Jb(t,e,"utf8",!0);return Gxe(r),zf(r)},Gxe=t=>{let e=t.find(r=>typeof r!="string"&&!Ut(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 Xb,Zxe,Vxe,XW,QW,Wxe,e3,bI=y(()=>{Ia();vr();_l();cs();Xb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&yl(r,n)&&!nn.has(e)&&Zxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Vxe.has(o))||t.every(({type:i})=>An.has(i))),Zxe=t=>t===1||t===2,Vxe=new Set(["pipe","overlapped"]),XW=async(t,e,r,n)=>{for await(let i of t)Wxe(e)||e3(i,r,n)},QW=(t,e,r)=>{for(let n of t)e3(n,e,r)},Wxe=t=>t._readableState.pipes.length>0,e3=(t,e,r)=>{let n=Y_(t);Ti({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Kxe,appendFileSync as Jxe}from"node:fs";var t3,Yxe,Xxe,Qxe,e$e,t$e,r3=y(()=>{bI();Yb();Vb();rn();vr();Da();t3=({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)=>Yxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Yxe=({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=zV(t,o,d),p=go(f),{stdioItems:m,objectMode:h}=e[r],g=Xxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Qxe({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}},Xxe=(t,e,r,n)=>{try{return Jb(t,e,r,!1)}catch(i){return n.error=i,t}},Qxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:zf(t)};let s=RG(t,r);return n[o]?{serializedResult:s,finalResult:pI(s,!i[o],e)}:{serializedResult:s}},e$e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Xb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=pI(t,!1,s);try{QW(a,e,n)}catch(c){r.error??=c}},t$e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Bb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Jxe(n,t):(r.add(o),Kxe(n,t))}}});var n3,i3=y(()=>{rn();tp();n3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,So(e,r,"all")]:Array.isArray(e)?[So(t,r,"all"),...e]:Ut(t)&&Ut(e)?cR([t,e]):`${t}${e}`}});import{once as vI}from"node:events";var o3,r$e,s3,a3,n$e,SI,wI=y(()=>{Oa();o3=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([vI(t,"spawn"),vI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?s3(t):r.value},s3=async t=>{try{return await vI(t,"exit")}catch{return s3(t)}},a3=async t=>{let[e,r]=await t;if(!n$e(e,r)&&SI(e,r))throw new Xn;return[e,r]},n$e=(t,e)=>t===void 0&&e===void 0,SI=(t,e)=>t!==0||e!==null});var c3,i$e,l3=y(()=>{Oa();Da();wI();c3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=i$e(t,e,r),s=o?.code==="ETIMEDOUT",a=LV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},i$e=(t,e,r)=>t!==void 0?t:SI(e,r)?new Xn:void 0});import{spawnSync as o$e}from"node:child_process";var u3,s$e,a$e,c$e,Qb,l$e,u$e,d$e,f$e,d3=y(()=>{yR();GR();ZR();ep();zb();NW();tp();YW();r3();Da();i3();l3();u3=(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 Ol(d,c,l)},s$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=eb(t,e,r),a=a$e(r),{file:c,commandArguments:l,options:u}=Ab(t,e,a);c$e(u);let d=CW(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&&Qb("ipcInput"),t&&Qb("ipc: true"),r&&Qb("detached: true"),n&&Qb("cancelSignal")},Qb=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}=c3(c,r),{output:m,error:h=l}=t3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>So(_,r,S)),b=So(n3(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{JW(o,r);let a=d$e(r);return o$e(...Tb(t,e,a))}catch(a){return Tl({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:Fb(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?Lb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Qf({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 xI,on as p$e}from"node:events";var f3,m$e,h$e,g$e,y$e,p3=y(()=>{xl();Wf();Vf();f3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Sl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:vb(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})=>{pb(e,i);let o=ds(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 wl(t),a}finally{s.abort(),mb(e,i)}},h$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await xI(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 xI(t,"disconnect",{signal:r}),$9(e)},y$e=async(t,e,{signal:r})=>{let[n]=await xI(t,"strict:error",{signal:r});throw lb(n,e)}});import{once as h3,on as _$e}from"node:events";var g3,$I,b$e,v$e,S$e,m3,kI=y(()=>{xl();Wf();Vf();g3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>$I({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),$I=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Sl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:vb(t)}),pb(e,o);let s=ds(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 h3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},v$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await h3(t,"strict:error",{signal:r.signal});n.error=lb(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}))m3(s),yield c}catch{m3(s)}finally{o.abort(),mb(e,a),n||wl(t),i&&await t}},m3=({error:t})=>{if(t)throw t}});import y3 from"node:process";var _3,b3,v3,EI=y(()=>{kb();p3();kI();_b();_3=(t,{ipc:e})=>{Object.assign(t,v3(t,!1,e))},b3=()=>{let t=y3,e=!0,r=y3.channel!==void 0;return{...v3(t,e,r),getCancelSignal:X9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},v3=(t,e,r)=>({sendMessage:$b.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:f3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:g3.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 S3,A$e,np,T$e,O$e,R$e,I$e,w3=y(()=>{Gb();ep();zb();S3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{uI(n);let a=new w$e;A$e(a,n),Object.assign(a,{readable:T$e,writable:O$e,duplex:R$e});let c=Tl({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=np(),n=np(),i=np(),o=Array.from({length:e.length-3},np),s=np(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},np=()=>{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)=>Ol(t,e,r)});import{createReadStream as x3,createWriteStream as $3}from"node:fs";import{Buffer as P$e}from"node:buffer";import{Readable as ip,Writable as C$e,Duplex as D$e}from"node:stream";var E3,op,k3,N$e,A3=y(()=>{Yb();Gb();vr();E3=(t,e)=>Hb(N$e,t,e,!1),op=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${fs[t]}.`)},k3={fileNumber:op,generator:_I,asyncGenerator:_I,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:{...k3,fileUrl:({value:t})=>({stream:x3(t)}),filePath:({value:{file:t}})=>({stream:x3(t)}),webStream:({value:t})=>({stream:ip.fromWeb(t)}),iterable:({value:t})=>({stream:ip.from(t)}),asyncIterable:({value:t})=>({stream:ip.from(t)}),string:({value:t})=>({stream:ip.from(t)}),uint8Array:({value:t})=>({stream:ip.from(P$e.from(t))})},output:{...k3,fileUrl:({value:t})=>({stream:$3(t)}),filePath:({value:{file:t,append:e}})=>({stream:$3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:C$e.fromWeb(t)}),iterable:op,asyncIterable:op,string:op,uint8Array:op}}});import{on as j$e,once as T3}from"node:events";import{PassThrough as M$e,getDefaultHighWaterMark as F$e}from"node:stream";import{finished as I3}from"node:stream/promises";function Ma(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)TI(i);let e=t.some(({readableObjectMode:i})=>i),r=L$e(t,e),n=new AI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var L$e,AI,z$e,U$e,q$e,TI,B$e,H$e,G$e,Z$e,V$e,P3,C3,OI,D3,W$e,ev,O3,R3,tv=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)},AI=class extends M$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(TI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=z$e(this,this.#t,this.#o);let r=B$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(TI(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)=>{ev(t,O3);let n=new AbortController;try{await Promise.race([U$e(t,n),q$e(t,e,r,n)])}finally{n.abort(),ev(t,-O3)}},U$e=async(t,{signal:e})=>{try{await I3(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)},TI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},B$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{ev(t,R3);let a=new AbortController;try{await Promise.race([H$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(),ev(t,-R3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?OI(t):V$e(t))},H$e=async(t,e,{signal:r})=>{try{await t,r.aborted||OI(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 I3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;C3(s)?i.add(e):D3(t,s)}},Z$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await T3(t,i,{signal:o}),!t.readable)return T3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},V$e=t=>{t.writable&&t.end()},P3=(t,e)=>{C3(e)?OI(t):D3(t,e)},C3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",OI=t=>{(t.readable||t.writable)&&t.destroy()},D3=(t,e)=>{t.destroyed||(t.once("error",W$e),t.destroy(e))},W$e=()=>{},ev=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},O3=2,R3=1});import{finished as N3}from"node:stream/promises";var Il,K$e,RI,J$e,II,rv=y(()=>{yo();Il=(t,e)=>{t.pipe(e),K$e(t,e),J$e(t,e)},K$e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await N3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}RI(e)}},RI=t=>{t.writable&&t.end()},J$e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await N3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}II(t)}},II=t=>{t.readable&&t.destroy()}});var j3,Y$e,X$e,Q$e,e0e,t0e,M3=y(()=>{tv();yo();fb();vr();rv();j3=(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})=>An.has(c)))Y$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.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]:Ma(o);Il(s,i)}},Y$e=(t,e,r,n)=>{r==="output"?Il(t.stdio[n],e):Il(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;e0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},e0e=(t,{signal:e})=>{Yn(t)&&Ra(t,t0e,e)},t0e=2});var Fa,F3=y(()=>{Fa=[];Fa.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Fa.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Fa.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var nv,PI,CI,r0e,DI,iv,n0e,NI,jI,MI,L3,Tst,Ost,z3=y(()=>{F3();nv=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",PI=Symbol.for("signal-exit emitter"),CI=globalThis,r0e=Object.defineProperty.bind(Object),DI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(CI[PI])return CI[PI];r0e(CI,PI,{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}},iv=class{},n0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),NI=class extends iv{onExit(){return()=>{}}load(){}unload(){}},jI=class extends iv{#t=MI.platform==="win32"?"SIGINT":"SIGHUP";#r=new DI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Fa)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(!nv(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 Fa)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,Fa.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 nv(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"&&nv(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)}},MI=globalThis.process,{onExit:L3,load:Tst,unload:Ost}=n0e(nv(MI)?new jI(MI):new NI)});import{addAbortListener as i0e}from"node:events";var U3,q3=y(()=>{z3();U3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=L3(()=>{t.kill()});i0e(n,()=>{i()})}});var H3,o0e,s0e,B3,a0e,G3=y(()=>{aR();Q_();us();hl();H3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=X_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=o0e(r,n,i),{sourceStream:d,sourceError:f}=a0e(t,l),{options:p,fileDescriptors:m}=Ri.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},o0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=s0e(t,e,...r),a=db(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},s0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(B3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||oR(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]=U_(r,...n);return{destination:e(B3)(i,o,s),pipeOptions:s}}if(Ri.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}`)},B3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),a0e=(t,e)=>{try{return{sourceStream:kl(t,e)}}catch(r){return{sourceError:r}}}});var V3,c0e,FI,Z3,LI=y(()=>{ep();rv();V3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=c0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw FI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},c0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return II(t),n;if(e!==void 0)return RI(r),e},FI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Tl({error:t,command:Z3,escapedCommand:Z3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Z3="source.pipe(destination)"});var W3,K3=y(()=>{W3=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 l0e}from"node:stream/promises";var J3,u0e,d0e,f0e,ov,p0e,m0e,Y3=y(()=>{tv();fb();rv();J3=(t,e,r)=>{let n=ov.has(e)?d0e(t,e):u0e(t,e);return Ra(t,p0e,r.signal),Ra(e,m0e,r.signal),f0e(e),n},u0e=(t,e)=>{let r=Ma([t]);return Il(r,e),ov.set(e,r),r},d0e=(t,e)=>{let r=ov.get(e);return r.add(t),r},f0e=async t=>{try{await l0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}ov.delete(t)},ov=new WeakMap,p0e=2,m0e=1});import{aborted as h0e}from"node:util";var X3,g0e,Q3=y(()=>{LI();X3=(t,e)=>t===void 0?[]:[g0e(t,e)],g0e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await h0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw FI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var sv,y0e,_0e,eK=y(()=>{ho();G3();LI();K3();Y3();Q3();sv=(t,...e)=>{if(Ot(e[0]))return sv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=H3(t,...e),i=y0e({...n,destination:r});return i.pipe=sv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},y0e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=_0e(t,i);V3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=J3(e,o,d);return await Promise.race([W3(u),...X3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},_0e=(t,e)=>Promise.allSettled([t,e])});import{on as b0e}from"node:events";import{getDefaultHighWaterMark as v0e}from"node:stream";var av,S0e,zI,w0e,rK,UI,tK,x0e,$0e,cv=y(()=>{mI();Vb();yI();av=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return S0e(e,s),rK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},S0e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},zI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;w0e(e,s,t);let a=t.readableObjectMode&&!o;return rK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},w0e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},rK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=b0e(t,"data",{signal:e.signal,highWaterMark:tK,highWatermark:tK});return x0e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},UI=v0e(!0),tK=UI,x0e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=$0e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*ja(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*rp(a)}},$0e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Wb(t,r,!e),Zb(t,i,!n,{})].filter(Boolean)});import{setImmediate as k0e}from"node:timers/promises";var nK,E0e,A0e,T0e,qI,iK,BI=y(()=>{Mb();rn();bI();cv();Da();tp();nK=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=E0e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([A0e(t),d]);return}let f=dI(c,r),p=zI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([T0e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},E0e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Xb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=zI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await XW(a,t,r,o)},A0e=async t=>{await k0e(),t.readableFlowing===null&&t.resume()},T0e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Cb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Db(r,{maxBuffer:o})):await jb(r,{maxBuffer:o})}catch(a){return iK(jV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},qI=async t=>{try{return await t}catch(e){return iK(e)}},iK=({bufferedData:t})=>TG(t)?new Uint8Array(t):t});import{finished as O0e}from"node:stream/promises";var sp,R0e,I0e,P0e,C0e,D0e,HI,lv,oK,uv=y(()=>{sp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=R0e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],O0e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||C0e(a,e,r,n)}finally{s.abort()}},R0e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&I0e(t,r,n),n},I0e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{P0e(e,r),n.call(t,...i)}},P0e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},C0e=(t,e,r,n)=>{if(!D0e(t,e,r,n))throw t},D0e=(t,e,r,n=!0)=>r.propagating?oK(t)||lv(t):(r.propagating=!0,HI(r,e)===n?oK(t):lv(t)),HI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",lv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",oK=t=>t?.code==="EPIPE"});var sK,GI,ZI=y(()=>{BI();uv();sK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>GI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),GI=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=sp(t,e,l);if(HI(l,e)){await u;return}let[d]=await Promise.all([nK({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 aK,cK,N0e,j0e,VI=y(()=>{tv();ZI();aK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ma([t,e].filter(Boolean)):void 0,cK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>GI({...N0e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:j0e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),N0e=({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}},j0e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var lK,uK,dK=y(()=>{_l();cs();lK=t=>yl(t,"ipc"),uK=(t,e)=>{let r=Y_(t);Ti({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var fK,pK,mK=y(()=>{Da();dK();bo();kI();fK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=lK(o),a=_o(e,"ipc"),c=_o(r,"ipc");for await(let l of $I({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(MV(t,i,c),i.push(l)),s&&uK(l,o);return i},pK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as M0e}from"node:events";var hK,F0e,L0e,z0e,gK=y(()=>{Ca();zR();IR();LR();yo();vr();BI();mK();qR();VI();ZI();wI();uv();hK=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 _=o3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=sK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=cK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=fK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=F0e(h,t,S),D=L0e(m,S);try{return await Promise.race([Promise.all([{},a3(_),Promise.all(x),w,T,cV(t,d),...A,...D]),g,z0e(t,b),...nV(t,o,f,b),...x9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...tV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(ie=>qI(ie))),qI(w),pK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},F0e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:sp(n,i,r)),L0e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>sp(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),z0e=async(t,{signal:e})=>{let[r]=await M0e(t,"error",{signal:e});throw r}});var yK,ap,Pl,dv=y(()=>{$l();yK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),ap=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Oi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Pl=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 _K}from"node:stream/promises";var WI,bK,KI,JI,fv,pv,YI=y(()=>{uv();WI=async t=>{if(t!==void 0)try{await KI(t)}catch{}},bK=async t=>{if(t!==void 0)try{await JI(t)}catch{}},KI=async t=>{await _K(t,{cleanup:!0,readable:!1,writable:!0})},JI=async t=>{await _K(t,{cleanup:!0,readable:!0,writable:!1})},fv=async(t,e)=>{if(await t,e)throw e},pv=(t,e,r)=>{r&&!lv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as U0e}from"node:stream";import{callbackify as q0e}from"node:util";var vK,XI,QI,eP,B0e,tP,rP,SK,nP=y(()=>{Ia();us();cv();$l();dv();YI();vK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=XI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=QI(a,s),{read:f,onStdoutDataDone:p}=eP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new U0e({read:f,destroy:q0e(rP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return tP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},XI=(t,e,r)=>{let n=kl(t,e),i=ap(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},QI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:UI},eP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Oi(),s=av({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){B0e(this,s,o)},onStdoutDataDone:o}},B0e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},tP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await JI(t),await n,await WI(i),await e,r.readable&&r.push(null)}catch(o){await WI(i),SK(r,o)}},rP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Pl(r,e)&&(SK(t,n),await fv(e,n))},SK=(t,e)=>{pv(t,t.readable,e)}});import{Writable as H0e}from"node:stream";import{callbackify as wK}from"node:util";var xK,iP,oP,G0e,Z0e,sP,aP,$K,cP=y(()=>{us();dv();YI();xK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=iP(t,r,e),s=new H0e({...oP(n,t,i),destroy:wK(aP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return sP(n,s),s},iP=(t,e,r)=>{let n=db(t,e),i=ap(r,n,"writableFinal"),o=ap(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},oP=(t,e,r)=>({write:G0e.bind(void 0,t),final:wK(Z0e.bind(void 0,t,e,r))}),G0e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Z0e=async(t,e,r)=>{await Pl(r,e)&&(t.writable&&t.end(),await e)},sP=async(t,e,r)=>{try{await KI(t),e.writable&&e.end()}catch(n){await bK(r),$K(e,n)}},aP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Pl(r,e),await Pl(n,e)&&($K(t,i),await fv(e,i))},$K=(t,e)=>{pv(t,t.writable,e)}});import{Duplex as V0e}from"node:stream";import{callbackify as W0e}from"node:util";var kK,K0e,EK=y(()=>{Ia();nP();cP();kK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=XI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=iP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=QI(c,a),{read:g,onStdoutDataDone:b}=eP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new V0e({read:g,...oP(u,t,d),destroy:W0e(K0e.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 tP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),sP(u,_,c),_},K0e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([rP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),aP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var lP,J0e,AK=y(()=>{Ia();us();cv();lP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=kl(t,r),a=av({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return J0e(a,s,t)},J0e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var TK,OK=y(()=>{dv();nP();cP();EK();AK();TK=(t,{encoding:e})=>{let r=yK();t.readable=vK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=xK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=kK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=lP.bind(void 0,t,e),t[Symbol.asyncIterator]=lP.bind(void 0,t,e,{})}});var RK,Y0e,X0e,IK=y(()=>{RK=(t,e)=>{for(let[r,n]of X0e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Y0e=(async()=>{})().constructor.prototype,X0e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Y0e,t)])});import{setMaxListeners as Q0e}from"node:events";import{spawn as eke}from"node:child_process";var PK,tke,rke,nke,ike,oke,CK=y(()=>{Mb();yR();GR();us();ZR();EI();ep();zb();w3();A3();tp();M3();ab();q3();eK();VI();gK();OK();$l();IK();PK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=tke(t,e,r),{subprocess:f,promise:p}=nke({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}),RK(f,p),Ri.set(f,{options:u,fileDescriptors:d}),f},tke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=eb(t,e,r),{file:a,commandArguments:c,options:l}=Ab(t,e,r),u=rke(l),d=E3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},rke=({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}},nke=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=eke(...Tb(t,e,r))}catch(m){return S3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Q0e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];j3(c,a,l),U3(c,r,l);let d={},f=Oi();c.kill=S9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=aK(c,r),TK(c,r),_3(c,r);let p=ike({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}},ike=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 hK({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)=>So(x,e,w)),_=So(h,e,"all"),S=oke({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ol(S,n,e)},oke=({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?Qf({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 Ii,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Lb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var mv,ske,ake,DK=y(()=>{ho();bo();mv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,ske(n,t[n],i)]));return{...t,...r}},ske=(t,e,r)=>ake.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,ake=new Set(["env",...fR])});var ps,cke,lke,NK=y(()=>{ho();aR();jG();d3();CK();DK();ps=(t,e,r,n)=>{let i=(s,a,c)=>ps(s,a,r,c),o=(...s)=>cke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},cke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,mv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=lke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?u3(a,c,l):PK(a,c,l,i)},lke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=DG(e)?NG(e,r):[e,...r],[s,a,c]=U_(...o),l=mv(mv(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 jK,MK,FK,uke,dke,LK=y(()=>{jK=({file:t,commandArguments:e})=>FK(t,e),MK=({file:t,commandArguments:e})=>({...FK(t,e),isSync:!0}),FK=(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]=uke(t);return{file:r,commandArguments:n}},uke=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(dke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},dke=/ +/g});var zK,UK,fke,qK,pke,BK,HK=y(()=>{zK=(t,e,r)=>{t.sync=e(fke,r),t.s=t.sync},UK=({options:t})=>qK(t),fke=({options:t})=>({...qK(t),isSync:!0}),qK=t=>({options:{...pke(t),...t}}),pke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},BK={preferLocal:!0}});var _lt,Ye,blt,vlt,Slt,wlt,xlt,$lt,klt,Elt,Mr=y(()=>{NK();LK();UR();HK();EI();_lt=ps(()=>({})),Ye=ps(()=>({isSync:!0})),blt=ps(jK),vlt=ps(MK),Slt=ps(oV),wlt=ps(UK,{},BK,zK),{sendMessage:xlt,getOneMessage:$lt,getEachMessage:klt,getCancelSignal:Elt}=b3()});import{existsSync as hv,statSync as mke}from"node:fs";import{dirname as uP,extname as hke,isAbsolute as GK,join as dP,relative as fP,resolve as gv,sep as gke}from"node:path";function yv(t){return t==="./gradlew"||t==="gradle"}function yke(t){return(hv(dP(t,"build.gradle.kts"))||hv(dP(t,"build.gradle")))&&hv(dP(t,"gradle.properties"))}function _ke(t,e){let n=fP(t,e).split(gke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ms(t,e){return t===":"?`:${e}`:`${t}:${e}`}function bke(t,e){let r=gv(t,e),n=r;hv(r)?mke(r).isFile()&&(n=uP(r)):hke(r)!==""&&(n=uP(r));let i=fP(t,n);if(i.startsWith("..")||GK(i))return null;let o=n;for(;;){if(yke(o))return o;if(gv(o)===gv(t))return null;let s=uP(o);if(s===o)return null;let a=fP(t,s);if(a.startsWith("..")||GK(a))return null;o=s}}function _v(t,e){let r=gv(t),n=new Map,i=[];for(let o of e){let s=bke(r,o);if(!s){i.push(o);continue}let a=_ke(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 bv=y(()=>{"use strict"});import{existsSync as mP,readFileSync as vke}from"node:fs";import{join as Cl}from"node:path";function Dl(t="."){let e=Cl(t,".cladding","config.yaml");if(!mP(e))return pP;try{let n=(0,ZK.parse)(vke(e,"utf8"))?.gate;if(!n)return pP;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 Ske){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 pP}}function VK(t="."){let e=Dl(t).testReport,r=e?[e,...hP]:hP;return[...new Set(r.map(n=>Cl(t,n)))]}function WK(t="."){let e=Dl(t).testReport;if(e){let r=Cl(t,e);return mP(r)?r:null}return hP.map(r=>Cl(t,r)).find(r=>mP(r))??null}function KK(t,e){let r=[],n=!1;for(let i of t){let o=wke.exec(i);if(o){n=!0;for(let s of e)r.push(ms(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 ZK,Ske,pP,hP,wke,cp=y(()=>{"use strict";ZK=St(Qt(),1);bv();Ske=["type","lint","test","coverage"],pP={scope:"feature"},hP=["test-report.junit.xml",Cl("coverage","junit.xml"),Cl(".cladding","test-report.junit.xml")];wke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as yP,readFileSync as JK,readdirSync as xke,statSync as $ke}from"node:fs";import{join as vv}from"node:path";function vP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=vv(t,e);if(yP(r))try{if(YK.test(JK(r,"utf8")))return!0}catch{}}return!1}function XK(t){try{return yP(t)&&YK.test(JK(t,"utf8"))}catch{return!1}}function QK(t,e=0){if(e>4||!yP(t))return!1;let r;try{r=xke(t)}catch{return!1}for(let n of r){let i=vv(t,n),o=!1;try{o=$ke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(QK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&XK(i))return!0}return!1}function Ake(t){if(vP(t))return!0;for(let e of kke)if(XK(vv(t,e)))return!0;for(let e of Eke)if(QK(vv(t,e)))return!0;return!1}function eJ(t="."){let e=Dl(t).coverage;return e||(Ake(t)?"kover":"jacoco")}function tJ(t="."){return _P[eJ(t)]}function rJ(t="."){return gP[eJ(t)]}var _P,gP,bP,YK,kke,Eke,Sv=y(()=>{"use strict";cp();_P={kover:"koverXmlReport",jacoco:"jacocoTestReport"},gP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},bP=[gP.kover,gP.jacoco],YK=/kover/i;kke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Eke=["buildSrc","build-logic"]});import{existsSync as up,readFileSync as iJ,readdirSync as oJ}from"node:fs";import{join as hs}from"node:path";function wP(t){return up(hs(t,"gradlew"))?"./gradlew":"gradle"}function Tke(t){let e=wP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[tJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Oke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(iJ(hs(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 Ike(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function Dke(t,e){for(let r of e)if(up(hs(t,r)))return r}function Nke(t,e){try{return oJ(t).find(n=>n.endsWith(e))}catch{return}}function Fke(t){try{return JSON.parse(iJ(hs(t,"package.json"),"utf8"))}catch{return{}}}function lp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function nJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function Lke(t,e,r){if(lp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of jke)if(n.configs.some(i=>up(hs(t,i))))return n.gate;if(Mke.some(n=>up(hs(t,n)))||r.eslintConfig!==void 0)return e}function Uke(t,e){return zke.some(r=>up(hs(t,r)))?!0:e.jest!==void 0}function qke(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 SP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function Bke(t,e){let r=Fke(t),n=e.lint?Lke(t,e.lint,r):void 0,i=n?{...e,lint:n}:SP(e,"lint"),o=lp(r,"test"),s=o?qke(o):void 0;return o&&!s?(i=SP(i,"coverage"),{...i,test:{cmd:"npm",args:["test"]},...lp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):s==="jest"||!o&&Uke(t,r)?{...i,test:{cmd:"npx",args:[...Ci,"jest"]},coverage:{cmd:"npx",args:[...Ci,"jest","--coverage"]}}:(s==="vitest"&&!lp(r,"coverage")&&!nJ(r,"@vitest/coverage-v8")&&!nJ(r,"@vitest/coverage-istanbul")?i=SP(i,"coverage"):s==="vitest"&&lp(r,"coverage")&&(i={...i,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),i)}function dt(t="."){for(let e of Pke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Nke(t,o):r=Dke(t,[o]),r)break;if(!r||e.requiresSource&&!Ike(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Bke(t,n):n;return{language:e.language,manifest:r,gates:i}}return Cke}var Ci,Rke,Pke,Cke,jke,Mke,zke,on=y(()=>{"use strict";Sv();Ci=["--offline","--no-install"];Rke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);Pke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Ci,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Ci,"eslint","."]},test:{cmd:"npx",args:[...Ci,"vitest","run"]},coverage:{cmd:"npx",args:[...Ci,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Ci,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Ci,"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:Tke},{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:Oke}],Cke={language:"unknown",manifest:"",gates:{}};jke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Ci,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Ci,"oxlint"]}}],Mke=["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"];zke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Hke,readFileSync as Gke}from"node:fs";import{join as Zke}from"node:path";function La(t){return t.code==="ENOENT"}function wv(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=(o||s||`exit ${i}`).slice(0,200);return sJ.test(o)||sJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function qt(t,e,r,n=[]){if(La(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 tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Nl(t,e){let r=Zke(t,"package.json");if(!Hke(r))return!1;try{return!!JSON.parse(Gke(r,"utf8")).scripts?.[e]}catch{return!1}}var sJ,Tn=y(()=>{"use strict";sJ=/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 Vke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:xv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Ye(n.cmd,[...n.args],{cwd:e,reject:!1});return La(i)?[{detector:xv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:wv(i,xv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var xv,za,$v=y(()=>{"use strict";Mr();on();Tn();xv="ARCHITECTURE_VIOLATION";za={name:xv,subprocess:!0,run:Vke}});function Wke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:kv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Ye(n.cmd,[...n.args],{cwd:e,reject:!1});return La(i)?[{detector:kv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:wv(i,kv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var kv,Ua,Ev=y(()=>{"use strict";Mr();on();Tn();kv="HARDCODED_SECRET";Ua={name:kv,subprocess:!0,run:Wke}});import{existsSync as xP,readdirSync as aJ}from"node:fs";import{join as Av}from"node:path";function Jke(t,e){let r=Av(t,e.path);if(!xP(r))return!0;if(e.isDirectory)try{return aJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Yke(t){let{cwd:e="."}=t,r=[];for(let i of Kke)Jke(e,i)&&r.push({detector:dp,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=Av(e,"spec.yaml");if(xP(n)){let i=eEe(n),o=i?null:Xke(e);if(i)r.push({detector:dp,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:dp,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=Qke(e);s&&r.push({detector:dp,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 Xke(t){for(let e of["spec/features","spec/scenarios"]){let r=Av(t,e);if(!xP(r))continue;let n;try{n=aJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ki(Av(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function Qke(t){try{return H(t),null}catch(e){return e.message}}function eEe(t){let e;try{e=ki(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var dp,Kke,cJ,lJ=y(()=>{"use strict";qe();I_();dp="ABSENCE_OF_GOVERNANCE",Kke=[{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}];cJ={name:dp,run:Yke}});function Tv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function $P(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=Tv(r)==="while",o=rEe.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 '${Tv(r)}'`}let n=tEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Tv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Tv(r)}'`:null}function nEe(t,e){let r=$P(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(...nEe(r,n));return e}var tEe,rEe,kP=y(()=>{"use strict";tEe={event:"when",state:"while",optional:"where",unwanted:"if"},rEe=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";qe()});function iEe(t){let{cwd:e="."}=t;return he(e,Ov,oEe)}function oEe(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:Ov,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:Ov,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Ov,dJ,fJ=y(()=>{"use strict";kP();wt();Ov="AC_DRIFT";dJ={name:Ov,run:iEe}});function Di(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return mJ[n]??pJ}var sEe,aEe,cEe,pJ,lEe,uEe,mJ,dEe,hJ,qa=y(()=>{"use strict";on();sEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,aEe=/^[ \t]*import\s+([\w.]+)/gm,cEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,pJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:sEe,importStyle:"relative"},lEe={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:aEe,importStyle:"dotted"},uEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:cEe,importStyle:"dotted"},mJ={typescript:pJ,kotlin:lEe,python:uEe},dEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],hJ=new Set([...Object.values(mJ).flatMap(t=>t?.extensions??[]),...dEe].map(t=>t.toLowerCase()))});import{existsSync as fEe,readFileSync as pEe,readdirSync as mEe,statSync as hEe}from"node:fs";import{join as yJ,relative as gJ}from"node:path";function gEe(t,e){if(!fEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=mEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=yJ(i,s),c;try{c=hEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function yEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function bEe(t){return _Ee.test(t)}function vEe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Di(e,r.project?.language),o=i.sourceRoots.flatMap(a=>gEe(yJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=pEe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";qe();qa();_J="AI_HINTS_FORBIDDEN_PATTERN";_Ee=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;bJ={name:_J,run:vEe}});function SEe(t){let{cwd:e="."}=t,r;try{r=H(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:SJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var SJ,wJ,xJ=y(()=>{"use strict";qe();SJ="AC_DUPLICATE_WITHIN_FEATURE";wJ={name:SJ,run:SEe}});import{createRequire as wEe}from"module";import{basename as xEe,dirname as AP,normalize as $Ee,relative as kEe,resolve as EEe,sep as EJ}from"path";import*as AEe from"fs";function TEe(t){let e=$Ee(t);return e.length>1&&e[e.length-1]===EJ&&(e=e.substring(0,e.length-1)),e}function AJ(t,e){return t.replace(OEe,e)}function IEe(t){return t==="/"||REe.test(t)}function EP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=EEe(t)),(n||o)&&(t=TEe(t)),t===".")return"";let s=t[t.length-1]!==i;return AJ(s?t+i:t,i)}function TJ(t,e){return e+t}function PEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:AJ(kEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function CEe(t){return t}function DEe(t,e,r){return e+t+r}function NEe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?PEe(t,e):n?TJ:CEe}function jEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function MEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function UEe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?MEe(t):jEe(t):n&&n.length?LEe:FEe:zEe}function VEe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?ZEe:r&&r.length?n?qEe:BEe:n?HEe:GEe}function JEe(t){return t.group?KEe:WEe}function QEe(t){return t.group?YEe:XEe}function rAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?tAe:eAe}function OJ(t,e,r){if(r.options.useRealPaths)return nAe(e,r);let n=AP(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=AP(n)}return r.symlinks.set(t,e),i>1}function nAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Rv(t,e,r,n){e(t&&!n?t:null,r)}function fAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?iAe:cAe:n?e?oAe:dAe:i?e?aAe:uAe:e?sAe:lAe}function hAe(t){return t?mAe:pAe}function bAe(t,e){return new Promise((r,n)=>{PJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function PJ(t,e,r){new IJ(t,e,r).start()}function vAe(t,e){return new IJ(t,e).start()}var $J,OEe,REe,FEe,LEe,zEe,qEe,BEe,HEe,GEe,ZEe,WEe,KEe,YEe,XEe,eAe,tAe,iAe,oAe,sAe,aAe,cAe,lAe,uAe,dAe,RJ,pAe,mAe,gAe,yAe,_Ae,IJ,kJ,CJ,DJ,NJ=y(()=>{$J=wEe(import.meta.url);OEe=/[\\/]/g;REe=/^[a-z]:[\\/]$/i;FEe=(t,e)=>{e.push(t||".")},LEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},zEe=()=>{};qEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},BEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},HEe=(t,e,r,n)=>{r.files++},GEe=(t,e)=>{e.push(t)},ZEe=()=>{};WEe=t=>t,KEe=()=>[""].slice(0,0);YEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},XEe=()=>{};eAe=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()&&OJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},tAe=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()&&OJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};iAe=t=>t.counts,oAe=t=>t.groups,sAe=t=>t.paths,aAe=t=>t.paths.slice(0,t.options.maxFiles),cAe=(t,e,r)=>(Rv(e,r,t.counts,t.options.suppressErrors),null),lAe=(t,e,r)=>(Rv(e,r,t.paths,t.options.suppressErrors),null),uAe=(t,e,r)=>(Rv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),dAe=(t,e,r)=>(Rv(e,r,t.groups,t.options.suppressErrors),null);RJ={withFileTypes:!0},pAe=(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||".",RJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},mAe=(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||".",RJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};gAe=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))}},yAe=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}},_Ae=class{aborted=!1;abort(){this.aborted=!0}},IJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=fAe(e,this.isSynchronous),this.root=EP(t,e),this.state={root:IEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new yAe,options:e,queue:new gAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new _Ae,fs:e.fs||AEe},this.joinPath=NEe(this.root,e),this.pushDirectory=UEe(this.root,e),this.pushFile=VEe(e),this.getArray=JEe(e),this.groupFiles=QEe(e),this.resolveSymlink=rAe(e,this.isSynchronous),this.walkDirectory=hAe(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(_=EP(_,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=xEe(_),x=EP(AP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};kJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return bAe(this.root,this.options)}withCallback(t){PJ(this.root,this.options,t)}sync(){return vAe(this.root,this.options)}},CJ=null;try{$J.resolve("picomatch"),CJ=$J("picomatch")}catch{}DJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:EJ,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 kJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new kJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||CJ;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 fp=v((Out,zJ)=>{"use strict";var jJ="[^\\\\/]",SAe="(?=.)",MJ="[^/]",TP="(?:\\/|$)",FJ="(?:^|\\/)",OP=`\\.{1,2}${TP}`,wAe="(?!\\.)",xAe=`(?!${FJ}${OP})`,$Ae=`(?!\\.{0,1}${TP})`,kAe=`(?!${OP})`,EAe="[^.\\/]",AAe=`${MJ}*?`,TAe="/",LJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:SAe,QMARK:MJ,END_ANCHOR:TP,DOTS_SLASH:OP,NO_DOT:wAe,NO_DOTS:xAe,NO_DOT_SLASH:$Ae,NO_DOTS_SLASH:kAe,QMARK_NO_DOT:EAe,STAR:AAe,START_ANCHOR:FJ,SEP:TAe},OAe={...LJ,SLASH_LITERAL:"[\\\\/]",QMARK:jJ,STAR:`${jJ}*?`,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:"\\"},RAe={__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"};zJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:RAe,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?OAe:LJ}}});var pp=v(Fr=>{"use strict";var{REGEX_BACKSLASH:IAe,REGEX_REMOVE_BACKSLASH:PAe,REGEX_SPECIAL_CHARS:CAe,REGEX_SPECIAL_CHARS_GLOBAL:DAe}=fp();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>CAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(DAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(IAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(PAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var WJ=v((Iut,VJ)=>{"use strict";var UJ=pp(),{CHAR_ASTERISK:RP,CHAR_AT:NAe,CHAR_BACKWARD_SLASH:mp,CHAR_COMMA:jAe,CHAR_DOT:IP,CHAR_EXCLAMATION_MARK:PP,CHAR_FORWARD_SLASH:ZJ,CHAR_LEFT_CURLY_BRACE:CP,CHAR_LEFT_PARENTHESES:DP,CHAR_LEFT_SQUARE_BRACKET:MAe,CHAR_PLUS:FAe,CHAR_QUESTION_MARK:qJ,CHAR_RIGHT_CURLY_BRACE:LAe,CHAR_RIGHT_PARENTHESES:BJ,CHAR_RIGHT_SQUARE_BRACKET:zAe}=fp(),HJ=t=>t===ZJ||t===mp,GJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},UAe=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,ie=()=>c.charCodeAt(l+1),J=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),Oe&&m===!0&&d>0?(Oe=c.slice(0,d),P=c.slice(d)):m===!0?(Oe="",P=c):Oe=c,Oe&&Oe!==""&&Oe!=="/"&&Oe!==c&&HJ(Oe.charCodeAt(Oe.length-1))&&(Oe=Oe.slice(0,-1)),r.unescape===!0&&(P&&(P=UJ.removeBackslashes(P)),Oe&&_===!0&&(Oe=UJ.removeBackslashes(Oe)));let Ir={prefix:C,input:t,start:u,base:Oe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,HJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var hp=fp(),sn=pp(),{MAX_LENGTH:Iv,POSIX_REGEX_SOURCE:qAe,REGEX_NON_SPECIAL_CHARS:BAe,REGEX_SPECIAL_CHARS_BACKREF:HAe,REPLACEMENTS:KJ}=hp,GAe=(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=>sn.escapeRegex(i)).join("..")}return r},jl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,JJ=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},ZAe=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},YJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(ZAe(e))return e.replace(/\\(.)/g,"$1")},VAe=t=>{let e=t.map(YJ).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}}}}},WAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=YJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},KAe=t=>{let e=0,r=t.trim(),n=NP(r);for(;n;)e++,r=n.body.trim(),n=NP(r);return e},JAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:hp.DEFAULT_MAX_EXTGLOB_RECURSION,n=JJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||VAe(n)))return{risky:!0};for(let i of n){let o=WAe(i);if(o)return{risky:!0,safeOutput:o};if(KAe(i)>r)return{risky:!0}}return{risky:!1}},jP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=KJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Iv,r.maxLength):Iv,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=hp.globChars(r.windows),l=hp.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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={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=sn.removePrefix(t,$),i=t.length;let ie=[],J=[],Oe=[],C=o,P,Ir=()=>$.index===i-1,se=$.peek=(B=1)=>t[$.index+B],Pe=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(B="",ht=0)=>{$.consumed+=B,$.index+=ht},Yt=B=>{$.output+=B.output!=null?B.output:B.value,dr(B.value)},ao=()=>{let B=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),$.start++,B++;return B%2===0?!1:($.negated=!0,$.start++,!0)},vi=B=>{$[B]++,Oe.push(B)},Yr=B=>{$[B]--,Oe.pop()},de=B=>{if(C.type==="globstar"){let ht=$.braces>0&&(B.type==="comma"||B.type==="brace"),q=B.extglob===!0||ie.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ht&&!q&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(ie.length&&B.type!=="paren"&&(ie[ie.length-1].inner+=B.value),(B.value||B.output)&&Yt(B),C&&C.type==="text"&&B.type==="text"){C.output=(C.output||C.value)+B.value,C.value+=B.value;return}B.prev=C,s.push(B),C=B},co=(B,ht)=>{let q={...l[ht],conditions:1,inner:""};q.prev=C,q.parens=$.parens,q.output=$.output,q.startIndex=$.index,q.tokensIndex=s.length;let Ae=(r.capture?"(":"")+q.open;vi("parens"),de({type:B,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Ae}),ie.push(q)},Tde=B=>{let ht=t.slice(B.startIndex,$.index+1),q=t.slice(B.startIndex+2,$.index),Ae=JAe(q,r);if((B.type==="plus"||B.type==="star")&&Ae.risky){let lt=Ae.safeOutput?(B.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,Si=s[B.tokensIndex];Si.type="text",Si.value=ht,Si.output=lt||sn.escapeRegex(ht);for(let wi=B.tokensIndex+1;wi1&&B.inner.includes("/")&&(lt=O(r)),(lt!==D||Ir()||/^\)+$/.test(Kt()))&&(ut=B.close=`)$))${lt}`),B.inner.includes("*")&&(Lt=Kt())&&/^\.[^\\/.]+$/.test(Lt)){let Si=jP(Lt,{...e,fastpaths:!1}).output;ut=B.close=`)${Si})${lt})`}B.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ht=t.replace(HAe,(q,Ae,ut,Lt,lt,Si)=>Lt==="\\"?(B=!0,q):Lt==="?"?Ae?Ae+Lt+(lt?_.repeat(lt.length):""):Si===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):Lt==="."?u.repeat(ut.length):Lt==="*"?Ae?Ae+Lt+(lt?D:""):D:Ae?q:`\\${q}`);return B===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=sn.wrapOutput(ht,$,e),$)}for(;!Ir();){if(P=Pe(),P==="\0")continue;if(P==="\\"){let q=se();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){P+="\\",de({type:"text",value:P});continue}let Ae=/^\\+/.exec(Kt()),ut=0;if(Ae&&Ae[0].length>2&&(ut=Ae[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Pe():P+=Pe(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let q=C.value.slice(1);if(q.includes("[")&&(C.posix=!0,q.includes(":"))){let Ae=C.value.lastIndexOf("["),ut=C.value.slice(0,Ae),Lt=C.value.slice(Ae+2),lt=qAe[Lt];if(lt){C.value=ut+lt,$.backtrack=!0,Pe(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Yt({value:P});continue}if($.quotes===1&&P!=='"'){P=sn.escapeRegex(P),C.value+=P,Yt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){vi("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(jl("opening","("));let q=ie[ie.length-1];if(q&&$.parens===q.parens+1){Tde(ie.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Yr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(jl("closing","]"));P=`\\${P}`}else vi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(jl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Yr("brackets");let q=C.value.slice(1);if(C.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(P=`/${P}`),C.value+=P,Yt({value:P}),r.literalBrackets===!1||sn.hasRegexChars(q))continue;let Ae=sn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Ae,C.value=Ae;continue}C.value=`(${a}${Ae}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){vi("braces");let q={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};J.push(q),de(q);continue}if(P==="}"){let q=J[J.length-1];if(r.nobrace===!0||!q){de({type:"text",value:P,output:P});continue}let Ae=")";if(q.dots===!0){let ut=s.slice(),Lt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&Lt.unshift(ut[lt].value);Ae=GAe(Lt,r),$.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let ut=$.output.slice(0,q.outputIndex),Lt=$.tokens.slice(q.tokensIndex);q.value=q.output="\\{",P=Ae="\\}",$.output=ut;for(let lt of Lt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Ae}),Yr("braces"),J.pop();continue}if(P==="|"){ie.length>0&&ie[ie.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let q=P,Ae=J[J.length-1];Ae&&Oe[Oe.length-1]==="braces"&&(Ae.comma=!0,q="|"),de({type:"comma",value:P,output:q});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let q=J[J.length-1];C.type="dots",C.output+=P,C.value+=P,q.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){co("qmark",P);continue}if(C&&C.type==="paren"){let Ae=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){co("negate",P);continue}if(r.nonegate!==!0&&$.index===0){ao();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){co("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let q=BAe.exec(Kt());q&&(P+=q[0],$.index+=q[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let B=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){co("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let q=C.prev,Ae=q.prev,ut=q.type==="slash"||q.type==="bos",Lt=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!ut||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(q.type==="comma"||q.type==="brace"),Si=ie.length&&(q.type==="pipe"||q.type==="paren");if(!ut&&q.type!=="paren"&&!lt&&!Si){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let wi=t[$.index+4];if(wi&&wi!=="/")break;B=B.slice(3),dr("/**",3)}if(q.type==="bos"&&Ir()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!Lt&&Ir()){$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=q.output+C.output,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&B[0]==="/"){let wi=B[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${wi})`,C.value+=P,$.output+=q.output+C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&B[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(jl("closing","]"));$.output=sn.escapeLast($.output,"["),Yr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(jl("closing",")"));$.output=sn.escapeLast($.output,"("),Yr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(jl("closing","}"));$.output=sn.escapeLast($.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let B of $.tokens)$.output+=B.output!=null?B.output:B.value,B.suffix&&($.output+=B.suffix)}return $};jP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Iv,r.maxLength):Iv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=KJ[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}=hp.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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};XJ.exports=jP});var r8=v((Cut,t8)=>{"use strict";var YAe=WJ(),MP=QJ(),e8=pp(),XAe=fp(),QAe=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=QAe(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?e8.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)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(e8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):MP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>YAe(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=MP.fastpaths(t,e)),i.output||(i=MP(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=XAe;t8.exports=Rt});var s8=v((Dut,o8)=>{"use strict";var n8=r8(),eTe=pp();function i8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:eTe.isWindows()}),n8(t,e,r)}Object.assign(i8,n8);o8.exports=i8});import{readdir as tTe,readdirSync as rTe,realpath as nTe,realpathSync as iTe,stat as oTe,statSync as sTe}from"fs";import{isAbsolute as aTe,posix as Ba,resolve as cTe}from"path";import{fileURLToPath as lTe}from"url";function fTe(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]===".."&&dTe.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=>Ba.relative(t,n)||".":n=>Ba.relative(t,`${e}/${n}`)||"."}function hTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ba.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function u8(t){var e;let r=Ml.default.scan(t,gTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function wTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Ml.default.scan(t);return r.isGlob||r.negated}function gp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function d8(t){return typeof t=="string"?[t]:t??[]}function FP(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=STe(o);s=aTe(s.replace($Te,""))?Ba.relative(a,s):Ba.normalize(s);let c=(i=xTe.exec(s))===null||i===void 0?void 0:i[0],l=u8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?Ba.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(FP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(FP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(FP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function ETe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=kTe(t,e,n);t.debug&&gp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(c8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Ml.default)(i.match,f),m=(0,Ml.default)(i.ignore,f),h=fTe(i.match,f),g=a8(r,d,o),b=o?g:a8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new DJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&gp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return gp(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&gp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&hTe(r,d)]}function ATe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function OTe(t){let e={...TTe,...t};return e.cwd=(e.cwd instanceof URL?lTe(e.cwd):cTe(e.cwd)).replace(c8,"/"),e.ignore=d8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||tTe,readdirSync:e.fs.readdirSync||rTe,realpath:e.fs.realpath||nTe,realpathSync:e.fs.realpathSync||iTe,stat:e.fs.stat||oTe,statSync:e.fs.statSync||sTe}),e.debug&&gp("globbing with options:",e),e}function RTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=uTe(t)||typeof t=="string",i=d8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=OTe(n?e:t);return i.length>0?ETe(o,i):[]}function gs(t,e){let[r,n]=RTe(t,e);return r?ATe(r.sync(),n):[]}var Ml,uTe,c8,l8,dTe,pTe,mTe,gTe,yTe,_Te,bTe,vTe,STe,xTe,$Te,TTe,yp=y(()=>{NJ();Ml=St(s8(),1),uTe=Array.isArray,c8=/\\/g,l8=process.platform==="win32",dTe=/^(\/?\.\.)+$/;pTe=/^[A-Z]:\/$/i,mTe=l8?t=>pTe.test(t):t=>t==="/";gTe={parts:!0};yTe=/(?t.replace(yTe,"\\$&"),vTe=t=>t.replace(_Te,"\\$&"),STe=l8?vTe:bTe;xTe=/^(\/?\.\.)+/,$Te=/\\(?=[()[\]{}!*+?@|])/g;TTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as _p,readFileSync as ITe,readdirSync as PTe,statSync as f8}from"node:fs";import{join as Ha}from"node:path";function CTe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Di(e,n),o=[],{layers:s,forbiddenImports:a}=LP(r);return(s.size>0||a.length>0)&&!_p(Ha(e,i.mainRoot))?[{detector:bp,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&&(DTe(e,i,s,o),NTe(e,i,s,o)),a.length>0&&jTe(e,i,a,o),o)}function LP(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 DTe(t,e,r,n){let i=e.mainRoot,o=Ha(t,i);if(_p(o))for(let s of PTe(o)){let a=Ha(o,s);f8(a).isDirectory()&&(r.has(s)||n.push({detector:bp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function NTe(t,e,r,n){let i=e.mainRoot,o=Ha(t,i);if(_p(o))for(let s of r){let a=Ha(o,s);_p(a)&&f8(a).isDirectory()||n.push({detector:bp,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 jTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ha(t,i,s.from);if(!_p(a))continue;let c=gs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ha(a,l),d;try{d=ITe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];MTe(p,s.to,e.importStyle)&&n.push({detector:bp,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 MTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var bp,p8,zP=y(()=>{"use strict";yp();qe();qa();bp="ARCHITECTURE_FROM_SPEC";p8={name:bp,run:CTe}});import{existsSync as FTe,readFileSync as LTe}from"node:fs";import{join as zTe}from"node:path";function qTe(t){let{cwd:e="."}=t,r=zTe(e,"spec/capabilities.yaml");if(!FTe(r))return[];let n;try{let u=LTe(r,"utf8"),d=m8.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=H(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";m8=St(Qt(),1);qe();Pv="CAPABILITIES_FEATURE_MAPPING",UTe=8;h8={name:Pv,run:qTe}});import{existsSync as BTe,readFileSync as HTe}from"node:fs";import{join as GTe}from"node:path";function ZTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function VTe(t){let{cwd:e="."}=t;return he(e,UP,r=>WTe(r,e))}function WTe(t,e){let r=Di(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=GTe(e,o);if(!BTe(s))continue;let a=HTe(s,"utf8");ZTe(a)||n.push({detector:UP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var UP,y8,_8=y(()=>{"use strict";qa();wt();UP="CONVENTION_DRIFT";y8={name:UP,run:VTe}});import{existsSync as qP,readFileSync as b8}from"node:fs";import{join as Cv}from"node:path";function KTe(t){return JSON.parse(t).total?.lines?.pct??0}function v8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function XTe(t,e){if(!yv(dt(t).gates.coverage?.cmd))return null;let r;try{r=_v(t,e)}catch(c){return[{detector:wo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=bP.find(d=>qP(Cv(c.dir,d)));if(!l){s.push(c.path);continue}let u=v8(b8(Cv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:wo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=S8(n,i);return a0?[{detector:wo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function QTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=XTe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Di(e,r),i=dt(e).language==="kotlin"?bP.find(a=>qP(Cv(e,a)))??rJ(e):n.coverageSummary,o=Cv(e,i);if(!qP(o))return[{detector:wo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=b8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?JTe(a):n.coverageFormat==="cobertura-xml"?YTe(a):KTe(a)}catch(a){return[{detector:wo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:wo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Dv?[]:[{detector:wo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Dv}%`}]}var wo,Dv,w8,x8=y(()=>{"use strict";qe();Sv();qa();bv();on();wo="COVERAGE_DROP",Dv=70;w8={name:wo,run:QTe}});import{existsSync as eOe}from"node:fs";import{join as tOe}from"node:path";function nOe(t){let{cwd:e="."}=t;return he(e,Nv,r=>iOe(r,e))}function iOe(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";wt();Nv="DELIVERABLE_INTEGRITY",rOe=8;$8={name:Nv,run:nOe}});function oOe(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:jv,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 sOe(t){let e=oOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:jv,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 aOe(t){let{cwd:e="."}=t;return he(e,jv,r=>sOe(r))}var jv,E8,A8=y(()=>{"use strict";wt();jv="SMOKE_PROBE_DEMAND";E8={name:jv,run:aOe}});function cOe(t){let{cwd:e="."}=t;return he(e,Mv,r=>lOe(r,e))}function lOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ss(e);if(n===null)return[{detector:Mv,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=M_(n,e,o);s.state!=="fresh"&&i.push({detector:Mv,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 Mv,Fv,BP=y(()=>{"use strict";fl();wt();Mv="STALE_ATTESTATION";Fv={name:Mv,run:cOe}});function uOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return dOe(r)}function dOe(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:T8,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 T8,Lv,HP=y(()=>{"use strict";qe();T8="DEPENDENCY_CYCLE";Lv={name:T8,run:uOe}});import{appendFileSync as fOe,existsSync as O8,mkdirSync as pOe,readFileSync as mOe}from"node:fs";import{dirname as hOe,join as gOe}from"node:path";function R8(t){return gOe(t,yOe,_Oe)}function I8(t){return GP.add(t),()=>GP.delete(t)}function Ga(t,e){let r=R8(t),n=hOe(r);O8(n)||pOe(n,{recursive:!0}),fOe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of GP)try{i(t,e)}catch{}}function On(t){let e=R8(t);if(!O8(e))return[];let r=mOe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var yOe,_Oe,GP,ti=y(()=>{"use strict";yOe=".cladding",_Oe="audit.log.jsonl";GP=new Set});import{existsSync as bOe}from"node:fs";import{join as vOe}from"node:path";function SOe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:ZP,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&&(bOe(vOe(e,i.artifact))||n.push({detector:ZP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var ZP,P8,C8=y(()=>{"use strict";ti();ZP="EVIDENCE_MISMATCH";P8={name:ZP,run:SOe}});import{existsSync as wOe,readFileSync as xOe}from"node:fs";import{join as $Oe}from"node:path";function kOe(t){let e=$Oe(t,M8);if(!wOe(e))return null;try{let n=((0,j8.parse)(xOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*N8(t,e){for(let r of t??[])r.startsWith(D8)&&(yield{ref:r,name:r.slice(D8.length),field:e})}function EOe(t){let{cwd:e="."}=t,r=kOe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:VP,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=[...N8(s.evidence_refs,"evidence_refs"),...N8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:VP,severity:"warn",path:M8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var j8,VP,D8,M8,F8,L8=y(()=>{"use strict";j8=St(Qt(),1);qe();VP="FIXTURE_REFERENCE_INVALID",D8="fixture:",M8="conformance/fixtures.yaml";F8={name:VP,run:EOe}});import{existsSync as Fl,readFileSync as WP}from"node:fs";import{join as Za}from"node:path";function AOe(t){return gs(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function vp(t){if(!Fl(t))return null;try{return JSON.parse(WP(t,"utf8"))}catch{return null}}function TOe(t,e){let r=Za(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(WP(r,"utf8"))}catch(c){e.push({detector:xo,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:xo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=AOe(t);s!==a&&e.push({detector:xo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function OOe(t,e){for(let r of z8){let n=Za(t,r.path);if(!Fl(n))continue;let i=vp(n);if(!i){e.push({detector:xo,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:xo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function ROe(t,e){let r=vp(Za(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of z8){let s=Za(t,o.path);if(!Fl(s))continue;let a=vp(s);a?.version&&a.version!==n&&e.push({detector:xo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Za(t,".claude-plugin","marketplace.json");if(Fl(i)){let o=vp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:xo,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 IOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function POe(t,e){let r=Za(t,"src","cli","clad.ts"),n=Za(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Fl(r)||!Fl(n))return;let i=IOe(WP(r,"utf8"));if(i.length===0)return;let s=vp(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:xo,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 COe(t){let{cwd:e="."}=t,r=[];return TOe(e,r),POe(e,r),OOe(e,r),ROe(e,r),r}var xo,z8,U8,q8=y(()=>{"use strict";yp();xo="HARNESS_INTEGRITY",z8=[{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"]}];U8={name:xo,run:COe}});import{existsSync as DOe,readFileSync as NOe}from"node:fs";import{join as jOe}from"node:path";function FOe(t){let{cwd:e="."}=t;return he(e,zv,r=>zOe(r,e))}function LOe(t){let e=jOe(t,"spec/capabilities.yaml");if(!DOe(e))return!1;try{let r=B8.default.parse(NOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function zOe(t,e){let r=t.features.length;if(r{"use strict";B8=St(Qt(),1);wt();zv="HOLLOW_GOVERNANCE",MOe=8;H8={name:zv,run:FOe}});import{existsSync as Z8,readFileSync as V8}from"node:fs";import{join as W8}from"node:path";function K8(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 BOe(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 HOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function GOe(t){let e=W8(t,"README.md"),r=W8(t,"docs","dogfood","matrix.md");if(!Z8(e)||!Z8(r))return[];let n=K8(V8(e,"utf8"),UOe),i=K8(V8(r,"utf8"),qOe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=HOe(a);if(c===null)continue;let l=i[s]??"not-run",u=BOe(l);u!==null&&c>u&&o.push({detector:J8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function ZOe(t){let{cwd:e="."}=t;return GOe(e)}var J8,UOe,qOe,Y8,X8=y(()=>{"use strict";J8="HOST_CLAIM_DRIFT",UOe=//,qOe=//;Y8={name:J8,run:ZOe}});function VOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return Q8(r.features.map(i=>i.id),"feature","spec/features/",n),Q8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function Q8(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:e5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var e5,t5,r5=y(()=>{"use strict";qe();e5="ID_COLLISION";t5={name:e5,run:VOe}});import{existsSync as Sp,readFileSync as KP,readdirSync as JP,statSync as WOe,writeFileSync as i5}from"node:fs";import{join as $o}from"node:path";function n5(t){if(!Sp(t))return 0;try{return JP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function KOe(t){if(!Sp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=JP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=$o(n,o),a;try{a=WOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function JOe(t){let e=$o(t,"spec","capabilities.yaml");if(!Sp(e))return 0;try{let r=Uv.default.parse(KP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ys(t="."){let e=n5($o(t,"spec","features")),r=n5($o(t,"spec","scenarios")),n=JOe(t),i=KOe($o(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Ll(t,e){let r=$o(t,"spec.yaml");if(!Sp(r))return;let n=KP(r,"utf8"),i=YOe(n,e);i!==n&&i5(r,i)}function YOe(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 @@ -270,51 +270,51 @@ ${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 Va(t="."){let e=xo(t,"spec","features");if(!gp(e))return!1;let r=[];for(let i of BP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Fv.parse)(qP(xo(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 Va(t="."){let e=$o(t,"spec","features");if(!Sp(e))return!1;let r=[];for(let i of JP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Uv.parse)(KP($o(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 J8(xo(t,"spec","index.yaml"),n,"utf8"),!0}var Fv,yp=y(()=>{"use strict";Fv=St(Qt(),1)});import{existsSync as Y8,readFileSync as X8,readdirSync as BOe}from"node:fs";import{join as HP}from"node:path";function HOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=gs(e),i=r.inventory;if(!i){let s=Q8.filter(([c])=>(n[c]??0)>0);if(s.length===0)return GP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...GP(e),{detector:_p,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 Q8){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:_p,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(...GP(e)),o}function GP(t){let e=HP(t,"spec","index.yaml"),r=HP(t,"spec","features");if(!Y8(e)||!Y8(r))return[];let n=new Map;try{for(let l of X8(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 BOe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=X8(HP(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:_p,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:_p,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 _p,Q8,e5,t5=y(()=>{"use strict";yp();qe();_p="INVENTORY_DRIFT",Q8=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];e5={name:_p,run:HOe}});import{existsSync as GOe,readFileSync as ZOe}from"node:fs";import{join as VOe}from"node:path";function KOe(t){let{cwd:e="."}=t,r=VOe(e,"src","spec","schema.json"),n=[];if(GOe(r)){let i;try{i=JSON.parse(ZOe(r,"utf8"))}catch(o){n.push({detector:bp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of WOe)i.required?.includes(o)||n.push({detector:bp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:bp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==r5&&n.push({detector:bp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${r5}'`})}catch{}return n}var bp,WOe,r5,n5,i5=y(()=>{"use strict";qe();bp="META_INTEGRITY",WOe=["schema","project","features"],r5="0.1";n5={name:bp,run:KOe}});function JOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return o5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),o5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function o5(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:s5,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 s5,a5,c5=y(()=>{"use strict";qe();s5="SLUG_CONFLICT";a5={name:s5,run:JOe}});function Fl(t){return t==="planned"||t==="in_progress"}var Lv=y(()=>{"use strict"});import{existsSync as YOe}from"node:fs";import{join as XOe}from"node:path";function QOe(t){let{cwd:e="."}=t;return he(e,zv,r=>eRe(r,e))}function eRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=XOe(e,i);YOe(o)||r.push(tRe(n.id,i,n.status))}return r}function tRe(t,e,r){return Fl(r)?{detector:zv,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:zv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var zv,Uv,ZP=y(()=>{"use strict";Lv();wt();zv="MISSING_IMPLEMENTATION";Uv={name:zv,run:QOe}});function rRe(t){let{cwd:e="."}=t;return he(e,VP,nRe)}function nRe(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:VP,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 VP,qv,WP=y(()=>{"use strict";wt();VP="MISSING_TESTS";qv={name:VP,run:rRe}});import{existsSync as iRe,readFileSync as oRe}from"node:fs";import{join as l5}from"node:path";function u5(t){if(iRe(t))try{return JSON.parse(oRe(t,"utf8"))}catch{return}}function lRe(t){let{cwd:e="."}=t,r=u5(l5(e,sRe)),n=u5(l5(e,aRe));if(!r||!n)return[{detector:KP,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>cRe&&i.push({detector:KP,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var KP,sRe,aRe,cRe,d5,f5=y(()=>{"use strict";KP="PERFORMANCE_DRIFT",sRe="perf/baseline.json",aRe="perf/current.json",cRe=10;d5={name:KP,run:lRe}});import{existsSync as uRe}from"node:fs";import{join as dRe}from"node:path";function pRe(t){let{cwd:e="."}=t;return he(e,JP,r=>hRe(r,e))}function mRe(t,e){return(t.modules??[]).some(r=>uRe(dRe(e,r)))}function hRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||mRe(s,e)||r.push(s.id);let n=fRe;if(r.length<=n)return[];let i=r.slice(0,p5).join(", "),o=r.length>p5?", \u2026":"";return[{detector:JP,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 JP,fRe,p5,m5,h5=y(()=>{"use strict";wt();JP="PLANNED_BACKLOG",fRe=5,p5=8;m5={name:JP,run:pRe}});import{existsSync as gRe,readFileSync as yRe}from"node:fs";import{join as _Re}from"node:path";function SRe(t){let{cwd:e="."}=t;return he(e,YP,r=>wRe(r,e))}function wRe(t,e){if(t.features.lengthn.includes(i))?[{detector:YP,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 YP,bRe,vRe,g5,y5=y(()=>{"use strict";wt();YP="PROJECT_CONTEXT_DRIFT",bRe=8,vRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];g5={name:YP,run:SRe}});function _5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Bv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function xRe(t){let{cwd:e="."}=t;return he(e,Bv,$Re)}function $Re(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(..._5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Bv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(..._5(e,n.features,`scenario ${n.id}.features`));return r}var Bv,Hv,XP=y(()=>{"use strict";wt();Bv="REFERENCE_INTEGRITY";Hv={name:Bv,run:xRe}});function vp(t=""){return new RegExp(kRe,t)}var kRe,QP=y(()=>{"use strict";kRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as ERe,readdirSync as ARe,readFileSync as TRe,statSync as ORe,writeFileSync as RRe}from"node:fs";import{dirname as IRe,join as Sp,normalize as PRe,relative as CRe}from"node:path";function FRe(t){let e=[];for(let r of t.matchAll(MRe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(vp("g"))??[])e.push(n);return[...new Set(e)].sort()}function LRe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function b5(t){return t.split("\\").join("/")}function zRe(t){return DRe.some(e=>t===e||t.startsWith(`${e}/`))}function URe(t){let e=Sp(t,"docs");if(!ERe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=ARe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Sp(i,s),c;try{c=ORe(a)}catch{continue}let l=b5(CRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function qRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=PRe(Sp(IRe(t),e));return b5(r)}function wp(t="."){let e=[];for(let r of URe(t)){let n;try{n=TRe(Sp(t,r),"utf8")}catch{continue}let i=LRe(n),o=FRe(i);if(zRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(NRe)?[]:i.match(vp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(jRe)){let d=qRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function v5(t="."){let e=wp(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 RRe(Sp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return i5($o(t,"spec","index.yaml"),n,"utf8"),!0}var Uv,wp=y(()=>{"use strict";Uv=St(Qt(),1)});import{existsSync as o5,readFileSync as s5,readdirSync as XOe}from"node:fs";import{join as YP}from"node:path";function QOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=ys(e),i=r.inventory;if(!i){let s=a5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return XP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...XP(e),{detector:xp,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 a5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:xp,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(...XP(e)),o}function XP(t){let e=YP(t,"spec","index.yaml"),r=YP(t,"spec","features");if(!o5(e)||!o5(r))return[];let n=new Map;try{for(let l of s5(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 XOe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=s5(YP(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:xp,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:xp,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 xp,a5,c5,l5=y(()=>{"use strict";wp();qe();xp="INVENTORY_DRIFT",a5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];c5={name:xp,run:QOe}});import{existsSync as eRe,readFileSync as tRe}from"node:fs";import{join as rRe}from"node:path";function iRe(t){let{cwd:e="."}=t,r=rRe(e,"src","spec","schema.json"),n=[];if(eRe(r)){let i;try{i=JSON.parse(tRe(r,"utf8"))}catch(o){n.push({detector:$p,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of nRe)i.required?.includes(o)||n.push({detector:$p,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:$p,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==u5&&n.push({detector:$p,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${u5}'`})}catch{}return n}var $p,nRe,u5,d5,f5=y(()=>{"use strict";qe();$p="META_INTEGRITY",nRe=["schema","project","features"],u5="0.1";d5={name:$p,run:iRe}});function oRe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return p5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),p5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function p5(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:m5,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 m5,h5,g5=y(()=>{"use strict";qe();m5="SLUG_CONFLICT";h5={name:m5,run:oRe}});function zl(t){return t==="planned"||t==="in_progress"}var qv=y(()=>{"use strict"});import{existsSync as sRe}from"node:fs";import{join as aRe}from"node:path";function cRe(t){let{cwd:e="."}=t;return he(e,Bv,r=>lRe(r,e))}function lRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=aRe(e,i);sRe(o)||r.push(uRe(n.id,i,n.status))}return r}function uRe(t,e,r){return zl(r)?{detector:Bv,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:Bv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Bv,Hv,QP=y(()=>{"use strict";qv();wt();Bv="MISSING_IMPLEMENTATION";Hv={name:Bv,run:cRe}});function dRe(t){let{cwd:e="."}=t;return he(e,eC,fRe)}function fRe(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:eC,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 eC,Gv,tC=y(()=>{"use strict";wt();eC="MISSING_TESTS";Gv={name:eC,run:dRe}});import{existsSync as pRe,readFileSync as mRe}from"node:fs";import{join as y5}from"node:path";function _5(t){if(pRe(t))try{return JSON.parse(mRe(t,"utf8"))}catch{return}}function _Re(t){let{cwd:e="."}=t,r=_5(y5(e,hRe)),n=_5(y5(e,gRe));if(!r||!n)return[{detector:rC,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>yRe&&i.push({detector:rC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var rC,hRe,gRe,yRe,b5,v5=y(()=>{"use strict";rC="PERFORMANCE_DRIFT",hRe="perf/baseline.json",gRe="perf/current.json",yRe=10;b5={name:rC,run:_Re}});import{existsSync as bRe}from"node:fs";import{join as vRe}from"node:path";function wRe(t){let{cwd:e="."}=t;return he(e,nC,r=>$Re(r,e))}function xRe(t,e){return(t.modules??[]).some(r=>bRe(vRe(e,r)))}function $Re(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||xRe(s,e)||r.push(s.id);let n=SRe;if(r.length<=n)return[];let i=r.slice(0,S5).join(", "),o=r.length>S5?", \u2026":"";return[{detector:nC,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 nC,SRe,S5,w5,x5=y(()=>{"use strict";wt();nC="PLANNED_BACKLOG",SRe=5,S5=8;w5={name:nC,run:wRe}});import{existsSync as kRe,readFileSync as ERe}from"node:fs";import{join as ARe}from"node:path";function RRe(t){let{cwd:e="."}=t;return he(e,iC,r=>IRe(r,e))}function IRe(t,e){if(t.features.lengthn.includes(i))?[{detector:iC,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 iC,TRe,ORe,$5,k5=y(()=>{"use strict";wt();iC="PROJECT_CONTEXT_DRIFT",TRe=8,ORe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];$5={name:iC,run:RRe}});function E5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Zv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function PRe(t){let{cwd:e="."}=t;return he(e,Zv,CRe)}function CRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...E5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Zv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...E5(e,n.features,`scenario ${n.id}.features`));return r}var Zv,Vv,oC=y(()=>{"use strict";wt();Zv="REFERENCE_INTEGRITY";Vv={name:Zv,run:PRe}});function kp(t=""){return new RegExp(DRe,t)}var DRe,sC=y(()=>{"use strict";DRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as NRe,readdirSync as jRe,readFileSync as MRe,statSync as FRe,writeFileSync as LRe}from"node:fs";import{dirname as zRe,join as Ep,normalize as URe,relative as qRe}from"node:path";function VRe(t){let e=[];for(let r of t.matchAll(ZRe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(kp("g"))??[])e.push(n);return[...new Set(e)].sort()}function WRe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function A5(t){return t.split("\\").join("/")}function KRe(t){return BRe.some(e=>t===e||t.startsWith(`${e}/`))}function JRe(t){let e=Ep(t,"docs");if(!NRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=jRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Ep(i,s),c;try{c=FRe(a)}catch{continue}let l=A5(qRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function YRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=URe(Ep(zRe(t),e));return A5(r)}function Ap(t="."){let e=[];for(let r of JRe(t)){let n;try{n=MRe(Ep(t,r),"utf8")}catch{continue}let i=WRe(n),o=VRe(i);if(KRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(HRe)?[]:i.match(kp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(GRe)){let d=YRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function T5(t="."){let e=Ap(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 LRe(Ep(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var DRe,NRe,jRe,MRe,Gv=y(()=>{"use strict";QP();DRe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],NRe="clad-doc-links: ignore",jRe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,MRe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as BRe}from"node:fs";import{join as HRe}from"node:path";function GRe(t){let{cwd:e="."}=t;return he(e,Zv,r=>ZRe(r,e))}function ZRe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of wp(e).docs){for(let o of i.doc_links)BRe(HRe(e,o))||n.push({detector:Zv,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:Zv,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 Zv,Vv,eC=y(()=>{"use strict";Gv();wt();Zv="DOC_LINK_INTEGRITY";Vv={name:Zv,run:GRe}});function VRe(t){let{cwd:e="."}=t;return he(e,xp,r=>WRe(r))}function WRe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=S5;r>=S5&&n.length===0&&e.push({detector:xp,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 s of n)(s.features??[]).length===0&&e.push({detector:xp,severity:i?"warn":"info",path:"spec/scenarios/",message:i?`scenario ${s.id} binds no features (features: []) \u2014 a grown project's scenario must cover at least one feature's flow, or it should be removed.`:`scenario ${s.id} binds no features yet \u2014 retained as future onboarding intent; bind it when a matching feature lands.`});let o=new Map(t.features.filter(s=>typeof s.slug=="string"&&s.slug.length>0).map(s=>[s.slug,s.id]));for(let s of n){if(!s.flow)continue;let a=new Set(s.features??[]),c=new Map;for(let l of s.flow.matchAll(/\(([^)]+)\)/g))for(let u of l[1].split(/[,/·]/)){let d=u.trim(),f=o.get(d);f&&!a.has(f)&&c.set(d,f)}if(c.size>0){let l=[...c].map(([u,d])=>`${u} (${d})`).join(", ");e.push({detector:xp,severity:"warn",path:"spec/scenarios/",message:`scenario ${s.id} flow references ${l} but features[] does not bind ${c.size===1?"it":"them"} \u2014 bind every feature the flow walks, or trim the flow so coverage is not under-stated.`})}}return e}var xp,S5,w5,x5=y(()=>{"use strict";wt();xp="SCENARIO_COVERAGE",S5=8;w5={name:xp,run:VRe}});import{createHash as KRe}from"node:crypto";function JRe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function $p(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??$5),sample:JRe(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($5),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 YRe(t,e){return e<=0?!1:e>=1?!0:parseInt(KRe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var $5,Wv=y(()=>{"use strict";$5=["unwanted"]});import{existsSync as XRe,readdirSync as QRe}from"node:fs";import{join as E5}from"node:path";import A5 from"node:process";function eIe(t){let e=!1,r=n=>{for(let i of QRe(n,{withFileTypes:!0})){if(e)return;let o=E5(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 tC(t={}){let{cwd:e="."}=t,r=E5(e,ys);if(!XRe(r)||!eIe(r))return{stage:Kv,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${ys}/ \u2014 skipped`};let n=dt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Kv,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o=Je(i.cmd,[...i.args,ys],{cwd:e,reject:!1}),s=qt(Kv,i.cmd,o);return s||tr(Kv,o)}var Kv,ys,tIe,rC=y(()=>{"use strict";Mr();on();Tn();Kv="stage_2.3",ys="tests/oracle";tIe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${A5.argv[1]}`;if(tIe){let t=tC();console.log(JSON.stringify(t)),A5.exit(t.exitCode)}});import{existsSync as rIe}from"node:fs";import{join as nIe}from"node:path";function iIe(t){let{cwd:e="."}=t;return he(e,ri,r=>oIe(r,e))}function oIe(t,e){let r=[],n=$p(t.project,kp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?On(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(Ep(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:ri,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${f}; declare oracle_refs under ${ys}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let f of d){if(!rIe(nIe(e,f))){r.push({detector:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' resolves to nothing on disk`});continue}if(f.startsWith(`${ys}/`)||r.push({detector:ri,severity:"warn",path:f,message:`${l.id}.${u.id} oracle_ref '${f}' lives outside ${ys}/ \u2014 stage_2.3 only runs ${ys}/, 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:ri,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:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ri,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:ri,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:ri,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:ri,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 ri,T5,O5=y(()=>{"use strict";ti();Wv();rC();wt();ri="SPEC_CONFORMANCE";T5={name:ri,run:iIe}});function sIe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:nC,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>R5&&i.push({detector:nC,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${R5})`})}return i}var nC,R5,I5,P5=y(()=>{"use strict";ti();nC="STALE_EVIDENCE",R5=90;I5={name:nC,run:sIe}});import{existsSync as C5}from"node:fs";import{join as D5}from"node:path";function aIe(t){let{cwd:e="."}=t;return he(e,Ll,r=>cIe(r,e))}function cIe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Ll,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:Ll,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=>C5(D5(e,o)));i.length>0&&r.push({detector:Ll,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}Fl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>C5(D5(e,i)))&&r.push({detector:Ll,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 Ll,Jv,iC=y(()=>{"use strict";Lv();wt();Ll="STALE_SPECIFICATION";Jv={name:Ll,run:aIe}});import{existsSync as N5,statSync as j5}from"node:fs";import{join as M5}from"node:path";function uIe(t,e){let r=0;for(let n of e){let i=M5(t,n);if(!N5(i))continue;let o=j5(i).mtimeMs;o>r&&(r=o)}return r}function dIe(t){let{cwd:e="."}=t;return he(e,oC,r=>fIe(r,e))}function fIe(t,e){let r=Di(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=uIe(e,n);if(i===0)return[];let o=hs([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=M5(e,a);if(!N5(c))continue;let l=j5(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>lIe&&s.push({detector:oC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var oC,lIe,Yv,sC=y(()=>{"use strict";fp();qa();wt();oC="STALE_TESTS",lIe=30;Yv={name:oC,run:dIe}});import{existsSync as pIe}from"node:fs";import{join as mIe}from"node:path";function hIe(t){let{cwd:e="."}=t;return he(e,Ap,r=>gIe(r,e))}function gIe(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:Ap,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=>!pIe(mIe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:Ap,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:Ap,severity:Fl(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 Ap,Xv,aC=y(()=>{"use strict";Lv();wt();Ap="STATUS_DRIFT";Xv={name:Ap,run:hIe}});function yIe(t){let{cwd:e="."}=t;return he(e,Qv,r=>_Ie(r,e))}function _Ie(t,e){let r=dt(e).language;return r==="unknown"?[{detector:Qv,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:Qv,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var Qv,F5,L5=y(()=>{"use strict";on();wt();Qv="TECH_STACK_MISMATCH";F5={name:Qv,run:yIe}});function wIe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function xIe(t){let{cwd:e="."}=t;return he(e,cC,r=>$Ie(r,e))}function $Ie(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=hs([...wIe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:cC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var cC,z5,bIe,vIe,SIe,eS,lC=y(()=>{"use strict";fp();CP();wt();cC="UNMAPPED_ARTIFACT",z5=["src/stages/**/*.ts","src/spec/**/*.ts"],bIe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},vIe={kotlin:"src/main/kotlin"},SIe=8;eS={name:cC,run:xIe}});import{existsSync as U5}from"node:fs";import{join as q5}from"node:path";function EIe(t){return kIe.some(e=>t.startsWith(e))}function AIe(t){let{cwd:e="."}=t;return he(e,uC,r=>TIe(r,e))}function TIe(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(EIe(o))continue;let s=o.split("#",1)[0];U5(q5(e,o))||s&&U5(q5(e,s))||r.push({detector:uC,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 Rx(t){return`${JSON.stringify(t,null,2)} +`}function Vee(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?`[[${Bee(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(Hee);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(Hee);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}/${Bee(s)}.md`,`${a.join(` +`)}`)}return o}function Hee(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as xUe}from"node:fs";import{dirname as $Ue,join as vj}from"node:path";import{fileURLToPath as kUe}from"node:url";var Sj=$Ue(kUe(import.meta.url));function Wee(t){for(let e of[vj(Sj,"viewer",t),vj(Sj,"..","graph","viewer",t),vj(Sj,"..","..","dist","viewer",t)])try{return xUe(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function Kee(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -875,22 +892,22 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify
${n} -`}MP();eC();ZP();WP();XP();jP();sC();aC();lC();dC();Um();QP();qe();var tUe=[qv,tS,Uv,eS,Hv,Vv,jv,Xv,Yv,Nv];function rUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=vp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function Ax(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{ka(e,H(e))}catch{}try{for(let o of tUe){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 rUe(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{ka(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}gj();qe();Ai();var iUe=new Set(["mermaid","dot","json","obsidian","html"]);function zee(t={}){try{let e=t.format??"mermaid";if(!iUe.has(e)){U("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=hc(n,".");if(t.focus){let s=Sx(n,i,t.focus);if(s.length===0){U("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){U("fail","graph",`--depth must be a non-negative number, got '${t.depth}'`),process.exit(1);return}i=vx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=jee(i);for(let[c,l]of a){let u=nUe(s,c);yj(bj(u),{recursive:!0}),_j(u,l,"utf8")}U("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){U("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=Ex(i,Ax(i,"."));yj(bj(t.out),{recursive:!0}),_j(t.out,s,"utf8"),U("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"?Nee(i):r==="json"?kx(i):Dee(i);t.out?(yj(bj(t.out),{recursive:!0}),_j(t.out,o,"utf8"),U("pass","graph",`wrote ${r} graph to ${t.out}`),process.exit(0)):process.stdout.write(o,()=>process.exit(0))}catch(e){U("fail","graph",e.message),process.exit(1)}}function Uee(){try{let t=hc(H(),".");process.stdout.write(Lee(Tx(t)),()=>process.exit(0))}catch(t){U("fail","graph",t.message),process.exit(1)}}Um();import{createServer as oUe}from"node:http";import{existsSync as sUe,watch as aUe}from"node:fs";import{join as cUe}from"node:path";qe();Ai();function lUe(t={}){let e=t.cwd??".",r=new Set,n=()=>hc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}HP();aC();QP();tC();oC();BP();pC();mC();gC();_C();Gm();sC();qe();var EUe=[Gv,nS,Hv,rS,Vv,Jv,Lv,eS,Qv,Fv];function AUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=kp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function Px(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{ka(e,H(e))}catch{}try{for(let o of EUe){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 AUe(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{ka(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();qe();Ai();var OUe=new Set(["mermaid","dot","json","obsidian","html"]);function Yee(t={}){try{let e=t.format??"mermaid";if(!OUe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=gc(n,".");if(t.focus){let s=Ex(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=kx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Vee(i);for(let[c,l]of a){let u=TUe(s,c);xj(kj(u),{recursive:!0}),$j(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=Ix(i,Px(i,"."));xj(kj(t.out),{recursive:!0}),$j(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"?Zee(i):r==="json"?Rx(i):Gee(i);t.out?(xj(kj(t.out),{recursive:!0}),$j(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 Xee(){try{let t=gc(H(),".");process.stdout.write(Jee(Cx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Gm();import{createServer as RUe}from"node:http";import{existsSync as IUe,watch as PUe}from"node:fs";import{join as CUe}from"node:path";qe();Ai();function DUe(t={}){let e=t.cwd??".",r=new Set,n=()=>gc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=oUe((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(Ax(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=RUe((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=Rx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Px(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=Ex(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=cUe(e,u);if(sUe(d))try{let f=aUe(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=Ix(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=CUe(e,u);if(IUe(d))try{let f=PUe(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 qee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await lUe({port:e,cwd:t.cwd??"."});U("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){U("fail","graph",r.message),process.exit(1)}}var uUe=["stage_1.1","stage_2.1","stage_2.3"];function dUe(t){return(t.features??[]).filter(e=>e.status==="done")}function fUe(t,e){let r=dUe(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 Bee(t,e){let r=[];for(let n of uUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=fUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}pS();import Hee from"node:process";function pUe(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 Ox(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=pUe(n,t);i.pass||r.push(i)}return r}ti();var vj="stage_4.1";function Sj(t={}){let{cwd:e="."}=t,r=On(e);if(r.length===0)return{stage:vj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Ox(r);if(n.length===0)return{stage:vj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:vj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var mUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Hee.argv[1]}`;if(mUe){let t=Sj();console.log(JSON.stringify(t)),Hee.exit(t.exitCode)}fl();import{randomBytes as hUe}from"node:crypto";import{unlinkSync as gUe}from"node:fs";import{tmpdir as yUe}from"node:os";import{join as _Ue,resolve as wj}from"node:path";import bUe from"node:process";var qr=null;function Gee(t){qr={cwd:wj(t),run:null,jsonFile:null}}function Zee(){return qr!==null}function Vee(t,e){if(!qr||qr.cwd!==wj(t))return null;if(qr.run)return qr.run;let r=_Ue(yUe(),`clad-shared-vitest-${bUe.pid}-${hUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function Wee(t){return!qr||qr.cwd!==wj(t)?null:qr.run}function Kee(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function Jee(){let t=qr?.jsonFile;if(qr=null,t)try{gUe(t)}catch{}}Mr();import Yee from"node:process";var Rx="stage_1.4";function xj(t={}){let{cwd:e="."}=t,r;try{r=Je("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Rx,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:Rx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Rx,pass:!0,exitCode:0}:{stage:Rx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var vUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Yee.argv[1]}`;if(vUe){let t=xj();console.log(JSON.stringify(t)),Yee.exit(t.exitCode)}Mr();import Xee from"node:process";qm();Tn();var Ix="stage_2.2";function $j(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Co("coverage",t))}catch(c){return{stage:Ix,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Ix,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=Wee(e),s=o?o.proc:Je(r,[...n],{cwd:e,reject:!1}),a=qt(Ix,r,s);return a||tr(Ix,s)}var xUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Xee.argv[1]}`;if(xUe){let t=$j();console.log(JSON.stringify(t)),Xee.exit(t.exitCode)}Op();kj();Mr();on();Tn();import ete from"node:process";var Nx="stage_3.2";function Ej(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Nx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Cl(e,o[o.length-1]))return{stage:Nx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=qt(Nx,i,s);return a||tr(Nx,s)}var zUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ete.argv[1]}`;if(zUe){let t=Ej();console.log(JSON.stringify(t)),ete.exit(t.exitCode)}Mr();qe();Tn();import{existsSync as UUe}from"node:fs";import{resolve as rte}from"node:path";import nte from"node:process";var ai="stage_2.4",Aj=5e3,qUe=3e4;function Tj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ai,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return HUe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ai,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ai,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=rte(e,r.path);if(!UUe(s))return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Aj,c;try{c=Je(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=qt(ai,r.path,c);if(l)return l;if(c.timedOut)return{stage:ai,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:ai,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ai,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var tte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},BUe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function HUe(t,e,r){let n=Math.min(e.length*Aj,qUe),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(GUe(t,s,r))}return ZUe(o)}function GUe(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("/")?rte(t,a):a,u=Aj,d;try{d=Je(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(La(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 ZUe(t){let e="skip";for(let o of t)tte[o.disposition]>tte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${BUe[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:ai,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ai,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var VUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${nte.argv[1]}`;if(VUe){let t=Tj();console.log(JSON.stringify(t)),nte.exit(t.exitCode)}Mr();on();Tn();import ite from"node:process";var jx="stage_3.1";function Oj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:jx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Cl(e,o[o.length-1]))return{stage:jx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=qt(jx,i,s);return a||tr(jx,s)}var WUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ite.argv[1]}`;if(WUe){let t=Oj();console.log(JSON.stringify(t)),ite.exit(t.exitCode)}rC();Rj();Ij();Mr();Cx();import{randomBytes as tqe}from"node:crypto";import{unlinkSync as rqe}from"node:fs";import{tmpdir as nqe}from"node:os";import{join as iqe}from"node:path";import Cj from"node:process";qm();Tn();qe();import{readFileSync as YUe}from"node:fs";import{resolve as ate}from"node:path";function XUe(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=ate(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 QUe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function eqe(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=QUe(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(ate(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 Pj(t,e){try{let r=XUe(YUe(t,"utf8"));return r?eqe(H(e),r,e):[]}catch{return[]}}var Wi="stage_2.1";function cte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function oqe(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];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 sqe(t,e,r){let n,i;try{({cmd:n,args:i}=Co("coverage",t))}catch{return null}if(!n||!i||!cte(n,i))return null;let o=n,s=i,a=Vee(e,d=>Je(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(qt(Wi,n,c))return null;let u=tr(Wi,c);if(Kee(u)==="fallback")return null;if(r){let d=Pj(l,e);if(d.length>0)return{stage:Wi,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Wi,pass:!0,exitCode:0}}function Dj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Co("test",t))}catch(u){return{stage:Wi,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Wi,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=cte(n,i),a=r&&s;if(Zee()&&s){let u=sqe(t,e,a);if(u)return u}let c,l=i;a&&(c=iqe(nqe(),`clad-vitest-${Cj.pid}-${tqe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Je(n,[...l],{cwd:e,reject:!1}),d=qt(Wi,n,u);if(d)return d;let f=xu("unit",tr(Wi,u),u);if(r&&f.pass&&oqe(u)){let p={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Wi,pass:!1,exitCode:1,findings:[p],stderr:p.message}}if(a&&f.pass&&c){let p=Pj(c,e);if(p.length>0)return{stage:Wi,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{rqe(c)}catch{}}}var aqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Cj.argv[1]}`;if(aqe){let t=Dj();console.log(JSON.stringify(t)),Cj.exit(t.exitCode)}Mr();on();Tn();import lte from"node:process";var Lx="stage_3.3";function Nj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Lx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Cl(e,o[o.length-1]))return{stage:Lx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Je(i,[...o],{cwd:e,reject:!1}),a=qt(Lx,i,s);return a||tr(Lx,s)}var cqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${lte.argv[1]}`;if(cqe){let t=Nj();console.log(JSON.stringify(t)),lte.exit(t.exitCode)}iC();Of();ya();Mj();yp();Gv();var gte=St(Qt(),1);import{existsSync as Fj,readFileSync as bqe,readdirSync as hte,statSync as vqe,writeFileSync as Sqe}from"node:fs";import{basename as Zm,join as Vm,relative as mte}from"node:path";var wqe=["self-dogfood:","fixture:","derived:"],yte=/\.(test|spec)\.[jt]sx?$/;function _te(t,e=t,r=[]){let n;try{n=hte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Vm(e,i);try{vqe(o).isDirectory()?_te(t,o,r):yte.test(i)&&r.push(o)}catch{continue}}return r}function bte(t="."){let e=Vm(t,"spec","features"),r=Vm(t,"tests"),n=[],i=[];if(!Fj(e)||!Fj(r))return{repaired:n,suggested:i};let o=_te(r),s=new Map;for(let a of o){let c=mte(t,a).split("\\").join("/"),l=s.get(Zm(a))??[];l.push(c),s.set(Zm(a),l)}for(let a of hte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Vm(e,a),l,u;try{l=bqe(c,"utf8"),u=(0,gte.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(wqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Fj(Vm(t,b)))continue;let _=s.get(Zm(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=>Zm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>mte(t,h).split("\\").join("/")).find(h=>{let g=Zm(h).replace(yte,"");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 Qee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await DUe({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 NUe=["stage_1.1","stage_2.1","stage_2.3"];function jUe(t){return(t.features??[]).filter(e=>e.status==="done")}function MUe(t,e){let r=jUe(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 ete(t,e){let r=[];for(let n of NUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=MUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}gS();import tte from"node:process";function FUe(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 Dx(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=FUe(n,t);i.pass||r.push(i)}return r}ti();var Ej="stage_4.1";function Aj(t={}){let{cwd:e="."}=t,r=On(e);if(r.length===0)return{stage:Ej,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Dx(r);if(n.length===0)return{stage:Ej,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Ej,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var LUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tte.argv[1]}`;if(LUe){let t=Aj();console.log(JSON.stringify(t)),tte.exit(t.exitCode)}pl();import{randomBytes as zUe}from"node:crypto";import{unlinkSync as UUe}from"node:fs";import{tmpdir as qUe}from"node:os";import{join as BUe,resolve as Tj}from"node:path";import HUe from"node:process";var qr=null;function rte(t){qr={cwd:Tj(t),run:null,jsonFile:null}}function nte(){return qr!==null}function ite(t,e){if(!qr||qr.cwd!==Tj(t))return null;if(qr.run)return qr.run;let r=BUe(qUe(),`clad-shared-vitest-${HUe.pid}-${zUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function ote(t){return!qr||qr.cwd!==Tj(t)?null:qr.run}function ste(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function ate(){let t=qr?.jsonFile;if(qr=null,t)try{UUe(t)}catch{}}Mr();import cte from"node:process";var Nx="stage_1.4";function Oj(t={}){let{cwd:e="."}=t,r;try{r=Ye("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Nx,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:Nx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Nx,pass:!0,exitCode:0}:{stage:Nx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var GUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${cte.argv[1]}`;if(GUe){let t=Oj();console.log(JSON.stringify(t)),cte.exit(t.exitCode)}Mr();import lte from"node:process";Zm();Tn();var jx="stage_2.2";function Rj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Do("coverage",t))}catch(c){return{stage:jx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:jx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=ote(e),s=o?o.proc:Ye(r,[...n],{cwd:e,reject:!1}),a=qt(jx,r,s,n);return a||tr(jx,s)}var WUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${lte.argv[1]}`;if(WUe){let t=Rj();console.log(JSON.stringify(t)),lte.exit(t.exitCode)}Dp();Ij();Mr();on();Tn();import dte from"node:process";var zx="stage_3.2";function Pj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:zx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Nl(e,o[o.length-1]))return{stage:zx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(zx,i,s,o);return a||tr(zx,s)}var dqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dte.argv[1]}`;if(dqe){let t=Pj();console.log(JSON.stringify(t)),dte.exit(t.exitCode)}Mr();qe();Tn();import{existsSync as fqe}from"node:fs";import{resolve as pte}from"node:path";import mte from"node:process";var ai="stage_2.4",Cj=5e3,pqe=3e4;function Dj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ai,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return hqe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ai,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ai,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=pte(e,r.path);if(!fqe(s))return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Cj,c;try{c=Ye(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=qt(ai,r.path,c);if(l)return l;if(c.timedOut)return{stage:ai,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:ai,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ai,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var fte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},mqe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function hqe(t,e,r){let n=Math.min(e.length*Cj,pqe),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(gqe(t,s,r))}return yqe(o)}function gqe(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("/")?pte(t,a):a,u=Cj,d;try{d=Ye(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(La(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 yqe(t){let e="skip";for(let o of t)fte[o.disposition]>fte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${mqe[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:ai,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ai,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var _qe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${mte.argv[1]}`;if(_qe){let t=Dj();console.log(JSON.stringify(t)),mte.exit(t.exitCode)}Mr();on();Tn();import hte from"node:process";var Ux="stage_3.1";function Nj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Ux,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Nl(e,o[o.length-1]))return{stage:Ux,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Ux,i,s,o);return a||tr(Ux,s)}var bqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hte.argv[1]}`;if(bqe){let t=Nj();console.log(JSON.stringify(t)),hte.exit(t.exitCode)}lC();jj();Mj();Mr();Fx();import{randomBytes as Eqe}from"node:crypto";import{unlinkSync as Aqe}from"node:fs";import{tmpdir as Tqe}from"node:os";import{join as Oqe}from"node:path";import Lj from"node:process";Zm();Tn();qe();import{readFileSync as wqe}from"node:fs";import{resolve as _te}from"node:path";function xqe(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=_te(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 $qe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function kqe(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=$qe(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(_te(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 Fj(t,e){try{let r=xqe(wqe(t,"utf8"));return r?kqe(H(e),r,e):[]}catch{return[]}}var Ki="stage_2.1";function bte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Rqe(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];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 Iqe(t,e,r){let n,i;try{({cmd:n,args:i}=Do("coverage",t))}catch{return null}if(!n||!i||!bte(n,i))return null;let o=n,s=i,a=ite(e,d=>Ye(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(qt(Ki,n,c,s))return null;let u=tr(Ki,c);if(ste(u)==="fallback")return null;if(r){let d=Fj(l,e);if(d.length>0)return{stage:Ki,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ki,pass:!0,exitCode:0}}function zj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Do("test",t))}catch(u){return{stage:Ki,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Ki,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=bte(n,i),a=r&&s;if(nte()&&s){let u=Iqe(t,e,a);if(u)return u}let c,l=i;a&&(c=Oqe(Tqe(),`clad-vitest-${Lj.pid}-${Eqe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Ye(n,[...l],{cwd:e,reject:!1}),d=qt(Ki,n,u,l);if(d)return d;let f=Au("unit",tr(Ki,u),u);if(r&&f.pass&&Rqe(u)){let p={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Ki,pass:!1,exitCode:1,findings:[p],stderr:p.message}}if(a&&f.pass&&c){let p=Fj(c,e);if(p.length>0)return{stage:Ki,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{Aqe(c)}catch{}}}var Pqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Lj.argv[1]}`;if(Pqe){let t=zj();console.log(JSON.stringify(t)),Lj.exit(t.exitCode)}Mr();on();Tn();import vte from"node:process";var Hx="stage_3.3";function Uj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Hx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Nl(e,o[o.length-1]))return{stage:Hx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Hx,i,s,o);return a||tr(Hx,s)}var Cqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${vte.argv[1]}`;if(Cqe){let t=Uj();console.log(JSON.stringify(t)),vte.exit(t.exitCode)}dC();Cf();ya();Bj();wp();Wv();var Ate=St(Qt(),1);import{existsSync as Hj,readFileSync as Hqe,readdirSync as Ete,statSync as Gqe,writeFileSync as Zqe}from"node:fs";import{basename as Jm,join as Ym,relative as kte}from"node:path";var Vqe=["self-dogfood:","fixture:","derived:"],Tte=/\.(test|spec)\.[jt]sx?$/;function Ote(t,e=t,r=[]){let n;try{n=Ete(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Ym(e,i);try{Gqe(o).isDirectory()?Ote(t,o,r):Tte.test(i)&&r.push(o)}catch{continue}}return r}function Rte(t="."){let e=Ym(t,"spec","features"),r=Ym(t,"tests"),n=[],i=[];if(!Hj(e)||!Hj(r))return{repaired:n,suggested:i};let o=Ote(r),s=new Map;for(let a of o){let c=kte(t,a).split("\\").join("/"),l=s.get(Jm(a))??[];l.push(c),s.set(Jm(a),l)}for(let a of Ete(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Ym(e,a),l,u;try{l=Hqe(c,"utf8"),u=(0,Ate.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(Vqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Hj(Ym(t,b)))continue;let _=s.get(Jm(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=>Jm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>kte(t,h).split("\\").join("/")).find(h=>{let g=Jm(h).replace(Tte,"");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&&Sqe(c,l,"utf8")}return{repaired:n,suggested:i}}dl();import{existsSync as xqe,readFileSync as $qe}from"node:fs";import{join as kqe}from"node:path";function Eqe(t,e){let r=kqe(t,e);if(!xqe(r))return[];let n=[];for(let i of $qe(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 vte(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=>Eqe(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 Ste(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(` -`)}Wv();qe();Ai();ti();dl();var Lj=["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"],Aqe=[...Lj,"att"];function Tqe(t,e,r){if(e.startsWith("stage_4")){let n=On(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Ox(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function Oqe(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":C_(e,r,t).state==="fresh"?"\u2713":"!"}function Bx(t,e="."){let r=os(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Lj.map(o=>Tqe(i,o,e)),Oqe(i,r,e)]}));return{columns:Aqe,rows:n}}function wte(t,e=".",r={}){let n=r.internal??!1,i=Bx(t,e),o=[...Lj.map(c=>n?c.replace("stage_",""):Rqe(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 Rqe(t){return Aa(t).slice(0,3)}async function e8e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Fue(),Mue)),Promise.resolve().then(()=>(Bue(),que)),Promise.resolve().then(()=>(Hp(),VX))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Eee(s),prepareInit:({cwd:s,mode:a,intent:c})=>$ee(s,a,c),initialize:nj,prepareClarify:(s,{cwd:a})=>kee(a,s),clarify:aj,resolveReview:(s,{cwd:a})=>vee(s,{cwd:a})}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function t8e(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){V.stdout.write(`${JSON.stringify(n,null,2)} -`),V.exit(0);return}for(let o of n.created)U("pass",`created ${o}`);for(let o of n.skipped)U("skip",o);for(let o of n.proposals??[])U("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;if(U("note","init done",i),n.clarifyingQuestions&&n.clarifyingQuestions.length>0){V.stdout.write(` +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&Zqe(c,l,"utf8")}return{repaired:n,suggested:i}}fl();import{existsSync as Wqe,readFileSync as Kqe}from"node:fs";import{join as Jqe}from"node:path";function Yqe(t,e){let r=Jqe(t,e);if(!Wqe(r))return[];let n=[];for(let i of Kqe(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 Ite(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=>Yqe(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 Pte(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(` +`)}Yv();qe();Ai();ti();fl();var Gj=["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"],Xqe=[...Gj,"att"];function Qqe(t,e,r){if(e.startsWith("stage_4")){let n=On(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Dx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function e4e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":M_(e,r,t).state==="fresh"?"\u2713":"!"}function Wx(t,e="."){let r=ss(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Gj.map(o=>Qqe(i,o,e)),e4e(i,r,e)]}));return{columns:Xqe,rows:n}}function Cte(t,e=".",r={}){let n=r.internal??!1,i=Wx(t,e),o=[...Gj.map(c=>n?c.replace("stage_",""):t4e(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 t4e(t){return Aa(t).slice(0,3)}async function k8e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Kue(),Wue)),Promise.resolve().then(()=>(ede(),Que)),Promise.resolve().then(()=>(Wp(),i7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Mee(s),prepareInit:({cwd:s,mode:a,intent:c})=>Nee(s,a,c),initialize:lj,prepareClarify:(s,{cwd:a})=>jee(a,s),clarify:pj,resolveReview:(s,{cwd:a})=>Iee(s,{cwd:a})}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function E8e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await lj({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){V.stdout.write(`${JSON.stringify(n,null,2)} +`),V.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){V.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())V.stdout.write(` ${o+1}. ${s} `);V.stdout.write(` @@ -900,30 +917,30 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&Sqe(c,l,"u `),V.stdout.write(` e.g. clad init payment SaaS for B2B `),V.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));V.exit(0)}async function r8e(t,e){U("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(()=>(mde(),pde)),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)U(i,"run",`halt=${n.halt.class} iter=${n.iterations} features=${n.featuresTouched.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`),V.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>JO(l,s)),c=`${QH(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;U(i,"run",c),a.length>0&&V.stdout.write(`Touched: ${a.join(", ")} -`)}let o=n.stubsCreated.length>0;o&&U("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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function n8e(t={}){try{let e=H();if(ga("."))U("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=gs(".");Ml(".",r),Va("."),v5(".");let n=Vl(".");n==="created"?U("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):n==="updated"&&U("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let i=bte(".");for(let s of i.repaired)U("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of i.suggested)U("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let o=qx(".");o&&U("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Jv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){U("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.exit(0);return}for(let i of n){let o=i.suggestion?.args??{},s=String(o.featureId??"?"),a=String(o.reason??i.message);U("note",`propose-archive \xB7 ${s}`,a)}U("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),V.exit(0);return}U("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){U("fail","sync",e.message),V.exit(1)}}function i8e(t){if(!t){U("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=g_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";U("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function o8e(t,e={}){if(!t){U("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=y_(".",t);if(!r){U("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}__(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";U("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?V.stdout.write(`Run: git checkout ${r.gitHead} +`));V.exit(0)}async function A8e(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(()=>(kde(),$de)),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}`),V.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>tR(l,s)),c=`${oG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&V.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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function T8e(t={}){try{let e=H();if(ga("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ys(".");Ll(".",r),Va("."),T5(".");let n=Yl(".");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=Rte(".");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=Vx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Xv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.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)`),V.exit(0);return}L("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){L("fail","sync",e.message),V.exit(1)}}function O8e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=v_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function R8e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=S_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}w_(".",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?V.stdout.write(`Run: git checkout ${r.gitHead} `):V.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),V.exit(0)}async function s8e(t){let e=t.host&&t.host!=="all"?[t.host]:void 0,r=await LC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});V.exit(r.errors.length>0?1:0)}async function a8e(){U("note","update","reconciling the current project after the engine upgrade");let t=await pX(".",{wireHosts:async()=>(await LC({quiet:!0,projectRoot:"."})).errors.length});if(U(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){U("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}t.inventoryDeferred?U("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):U("pass","spec",`inventory synced \xB7 ${t.features} features`),U(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)U("note","deprecated",r);V.stdout.write(` +`),V.exit(0)}async function I8e(t){let e=t.host&&t.host!=="all"?[t.host]:void 0,r=await HC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});V.exit(r.errors.length>0?1:0)}async function P8e(){L("note","update","reconciling the current project after the engine upgrade");let t=await $X(".",{wireHosts:async()=>(await HC({quiet:!0,projectRoot:"."})).errors.length});if(L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){L("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}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);V.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),gA({tier:"pre-commit",strict:!0}).anyFailed?V.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"):U("pass","drift","clean against the stricter detectors"),V.exit(t.code)}var c8e={"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 gA(t){let e=t.tier??"all",r=t.silent===!0,n=c8e[e];if(!n)return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,error:`unknown tier '${e}'`,worst:2,anyFailed:!0,stages:[]},null,2)} -`):r||U("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",()=>Hm(i)],["stage_1.2",()=>Bm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",xj],["stage_1.5",Xa],["stage_1.6",Mp],["stage_2.1",()=>Dj({...i,strict:t.strict})],["stage_2.2",()=>$j(i)],["stage_2.3",tC],["stage_2.4",Tj],["stage_3.1",Oj],["stage_3.2",Ej],["stage_3.3",Nj],["stage_4.1",Sj],["stage_4.2",Gm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ii(d)?"fail":"skip",u=[];D_("."),Gee(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Aa(d),h=rX(p);ii(h)&&(c=!0,a=Math.max(a,nX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings}),!t.json&&!r&&(U(l(h),m),ii(h)&&g8e(p))}}finally{j_(),Jee()}if(t.strict)try{let d=H();for(let f of Bee(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&&U("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"||!ii(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=>ii(h.status)),a=c?Math.max(1,a):0,!t.json&&!r&&U("note","attestation","stale entries re-verified by this run \u2014 re-attesting")),!c&&!r)if(ga("."))t.json||U("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{bG(".",H())&&(t.json||U("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function l8e(t){try{let e=H(),r=il(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} -`),V.exit("not_found"in r?1:0)}catch(e){U("fail","context",e.message),V.exit(1)}}function u8e(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} -`),V.exit("not_found"in i?1:0)}catch(r){U("fail","impact",r.message),V.exit(1)}}function d8e(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=rS(e,o=>{try{return gde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),V.exit(0)}catch(e){U("fail","infer-deps",e.message),V.exit(1)}}function f8e(t={}){try{if(t.sessions){Oee(t);return}if(t.trend!==void 0&&t.trend!==!1){Ree(t);return}let e=H(),n=_H(e,o=>{try{return gde(o,"utf8")}catch{return null}},"."),i=vH(".",n);if(t.json)V.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)}`,` ${ol}`];V.stdout.write(`${c.join(` +`),SA({tier:"pre-commit",strict:!0}).anyFailed?V.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"),V.exit(t.code)}var C8e={"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 SA(t){let e=t.tier??"all",r=t.silent===!0,n=C8e[e];if(!n)return t.json&&!r?V.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",()=>Wm(i)],["stage_1.2",()=>Vm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",Oj],["stage_1.5",Qa],["stage_1.6",Up],["stage_2.1",()=>zj({...i,strict:t.strict})],["stage_2.2",()=>Rj(i)],["stage_2.3",cC],["stage_2.4",Dj],["stage_3.1",Nj],["stage_3.2",Pj],["stage_3.3",Uj],["stage_4.1",Aj],["stage_4.2",Km]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ii(d)?"fail":"skip",u=[];F_("."),rte(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Aa(d),h=dX(p);ii(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),ii(h)&&U8e(p))}}finally{z_(),ate()}if(t.strict)try{let d=H();for(let f of ete(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"||!ii(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=>ii(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(ga("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{kG(".",H())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function D8e(t){try{let e=H(),r=ol(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} +`),V.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),V.exit(1)}}function N8e(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} +`),V.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),V.exit(1)}}function j8e(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=iS(e,o=>{try{return Ade(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),V.exit(0)}catch(e){L("fail","infer-deps",e.message),V.exit(1)}}function M8e(t={}){try{if(t.sessions){zee(t);return}if(t.trend!==void 0&&t.trend!==!1){Uee(t);return}let e=H(),n=$H(e,o=>{try{return Ade(o,"utf8")}catch{return null}},"."),i=EH(".",n);if(t.json)V.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)}`,` ${sl}`];V.stdout.write(`${c.join(` `)} -`),i.appended?U("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?U("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&U("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}V.exit(0)}catch(e){U("fail","measure",e.message),V.exit(1)}}function p8e(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(U("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){U("fail","check",r.message),V.exit(1)}V.exitCode=gA({...t,focusModules:e}).worst}function m8e(t){let e=MY(".",t,{checkStages:gA,onIndex:Va,gitOpInProgress:gO});U(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function h8e(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){U("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=k5(n);if(o.length===0){V.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)")}V.exit(0)}catch(e){L("fail","measure",e.message),V.exit(1)}}function F8e(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),V.exit(1)}V.exitCode=SA({...t,focusModules:e}).worst}function L8e(t){let e=ZY(".",t,{checkStages:SA,onIndex:Va,gitOpInProgress:SO});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function z8e(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=C5(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),V.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";V.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}V.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),V.exit(s.length>0?1:0);return}if(!t){U("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),V.exit(1);return}let i=vte(n,t,e.ac,r);if(!i||i.acs.length===0){U("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),V.exit(1);return}V.stdout.write(`${Ste(i)} -`),V.exit(0)}function g8e(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=hde(Df(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] +`),V.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"),V.exit(1);return}let i=Ite(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`),V.exit(1);return}V.stdout.write(`${Pte(i)} +`),V.exit(0)}function U8e(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=Ede(Ff(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&V.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&V.stdout.write(` ${hde(e.trim(),160)} -`)}}function hde(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function y8e(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(Bx(e,"."),null,2)} -`),V.exitCode=0;return}V.stdout.write(`${wte(e,".",{internal:t.internal})} -`),V.exit(0)}function _8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function b8e(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){U("fail","bundle","missing --out \u2014 the bundle needs a destination path"),V.exit(1);return}let n;try{let i=H(e),o=Bx(i,e),s={gitHead:ba(e),version:ql(),generatedAt:t.now??new Date().toISOString()},a=cl(i),c;try{let l=t.since??es(e),u=ts(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:sl(u),auditMarkdown:al(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=dG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){U("fail","bundle",i.message),V.exit(1);return}try{QJe(r,n,"utf8")}catch(i){U("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}U("pass","bundle",`${r} \xB7 ${_8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function v8e(t){let e=NA(t);U("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function S8e(){let t=new l4;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(t8e),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(r8e),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(n8e),t.command("setup").description("Activate Cladding only for the current project (Claude Code / Codex / Antigravity / Cursor)").option("--project ","activate a project other than the current directory").option("--host ","activate all hosts (default) or one of: claude, codex, antigravity, cursor","all").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(s8e),t.command("update").description("Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh AGENTS.md, then report stricter detector findings").action(a8e),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(p8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(i8e),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(m8e),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)=>h8e(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(o8e),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(y8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(l8e),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)=>u8e(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=>uX(r,{checkStages:gA})),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=>d8e(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=>f8e(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=>zee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Uee()),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=>{qee(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=>XH(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>oY(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=>b8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(v8e),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(tX),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(e8e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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 / 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){DY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}cY(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(xee),t}var w8e=!!globalThis.__CLADDING_BUNDLED,x8e=w8e||import.meta.url===`file://${V.argv[1]}`;x8e&&S8e().parse();export{c8e as TIER_STAGES,S8e as createProgram,b8e as runBundleCommand,p8e as runCheckCommand,gA as runCheckStages,i8e as runCheckpointCommand,l8e as runContextCommand,m8e as runDoneCommand,u8e as runImpactCommand,d8e as runInferDepsCommand,t8e as runInitCommand,f8e as runMeasureCommand,h8e as runOracleCommand,o8e as runRollbackCommand,v8e as runRouteCommand,r8e as runRunCommand,e8e as runServeCommand,s8e as runSetupCommand,y8e as runStatusCommand,n8e as runSyncCommand,a8e as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&V.stdout.write(` ${Ede(e.trim(),160)} +`)}}function Ede(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function q8e(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(Wx(e,"."),null,2)} +`),V.exitCode=0;return}V.stdout.write(`${Cte(e,".",{internal:t.internal})} +`),V.exit(0)}function B8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function H8e(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"),V.exit(1);return}let n;try{let i=H(e),o=Wx(i,e),s={gitHead:ba(e),version:Gl(),generatedAt:t.now??new Date().toISOString()},a=ll(i),c;try{let l=t.since??ts(e),u=rs(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:al(u),auditMarkdown:cl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=yG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),V.exit(1);return}try{$8e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}L("pass","bundle",`${r} \xB7 ${B8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function G8e(t){let e=zA(t);L("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function Z8e(){let t=new h4;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(E8e),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(A8e),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(T8e),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 all hosts (default) or one of: claude, codex, gemini, antigravity, cursor","all").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(I8e),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(P8e),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(F8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(O8e),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(L8e),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)=>z8e(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(R8e),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(q8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(D8e),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)=>N8e(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=>bX(r,{checkStages:SA})),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=>j8e(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=>M8e(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=>Yee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Xee()),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=>{Qee(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-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>mY(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=>H8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(G8e),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(uX),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(k8e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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){BY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}yY(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(Dee),t}var V8e=!!globalThis.__CLADDING_BUNDLED,W8e=V8e||import.meta.url===`file://${V.argv[1]}`;W8e&&Z8e().parse();export{C8e as TIER_STAGES,Z8e as createProgram,H8e as runBundleCommand,F8e as runCheckCommand,SA as runCheckStages,O8e as runCheckpointCommand,D8e as runContextCommand,L8e as runDoneCommand,N8e as runImpactCommand,j8e as runInferDepsCommand,E8e as runInitCommand,M8e as runMeasureCommand,z8e as runOracleCommand,R8e as runRollbackCommand,G8e as runRouteCommand,A8e as runRunCommand,k8e as runServeCommand,I8e as runSetupCommand,q8e as runStatusCommand,T8e as runSyncCommand,P8e as runUpdateCommand}; diff --git a/plugins/claude-code/dist/schema.json b/plugins/claude-code/dist/schema.json index 5e6d3559..6092fd53 100644 --- a/plugins/claude-code/dist/schema.json +++ b/plugins/claude-code/dist/schema.json @@ -18,6 +18,10 @@ "properties": { "name": {"type": "string", "minLength": 1}, "language": {"type": "string", "minLength": 1}, + "onboarding_seeded": { + "type": "boolean", + "description": "True only when Cladding init authored the initial governance seeds. Used to scope early-project advisory findings without changing legacy-project behavior." + }, "description": { "type": "string", "description": "One-line summary of what the project is for. Used as the spec.yaml 'front door' hint." diff --git a/plugins/codex/skills/init/SKILL.md b/plugins/codex/skills/init/SKILL.md index 1bdbfcaa..1de064d0 100644 --- a/plugins/codex/skills/init/SKILL.md +++ b/plugins/codex/skills/init/SKILL.md @@ -1,4 +1,5 @@ --- +name: init description: Use only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it; never use for an ordinary project creation or implementation request. Scaffold from an idea, planning document, or existing project through the MCP prepare/apply flow. --- diff --git a/skills/init/SKILL.md b/skills/init/SKILL.md index 1bdbfcaa..1de064d0 100644 --- a/skills/init/SKILL.md +++ b/skills/init/SKILL.md @@ -1,4 +1,5 @@ --- +name: init description: Use only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it; never use for an ordinary project creation or implementation request. Scaffold from an idea, planning document, or existing project through the MCP prepare/apply flow. --- diff --git a/spec/attestation.yaml b/spec/attestation.yaml index e7a991c8..4271ba3c 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -49,7 +49,10 @@ attested_modules: docs/benchmarks/v0.4.0-consistency-bench.md: e49a0dc671ff6672 docs/benchmarks/v0.6.0-real-user-verification.md: 9af806f48f681d1a docs/code-style.md: f1fd100fa0d11c5e + docs/dogfood/antigravity-cli-2026-07-15.md: c7191d8548535998 docs/dogfood/claude-code-2026-05-20.md: 04870d41e75576d6 + docs/dogfood/codex-cli-2026-07-15.md: 4ed02eed031aeda8 + docs/dogfood/cursor-agent-2026-07-15.md: 4639686e20d8e497 docs/dogfood/gemini-cli-2026-05-20.md: 2da1ba66c4f108f0 docs/feature-cycle.md: b8c48c86d1f1e093 docs/glossary.md: 1f2acc81a22cdd3e @@ -105,7 +108,7 @@ attested_modules: skills/serve/SKILL.md: d65778260c663fbb skills/status/SKILL.md: 09faadc50b3449da skills/sync/SKILL.md: 775c0f990a52a3d9 - spec.yaml: 1ff1636cb3da324b + spec.yaml: 5554832234c04853 spec/README.md: 7c257426396d435c spec/architecture.yaml: f0888480405a13a8 spec/features/: a4d0f0eb87fed960 @@ -146,6 +149,7 @@ attested_modules: src/cli/graph-serve.ts: 23e6e389225d0f98 src/cli/graph.ts: bab410061b8c746a src/cli/hook.ts: 201f82f4c89e173f + src/cli/host-onboarding.ts: b046571d4be7280c src/cli/init.ts: 580469d8416910b4 src/cli/intent-from-path.ts: e69862821d979f22 src/cli/measure.ts: 3a562f16589e26c2 @@ -236,10 +240,11 @@ attested_modules: src/spec/types.ts: b97d69db856c78a5 src/spec/validate.ts: db88ca6512ab363a src/stages: a4d0f0eb87fed960 + src/stages/README.md: c79d2bced8c8b8d8 src/stages/arch.ts: 268422e53c6d20bb src/stages/audit.ts: 3ba117606f8a81a1 src/stages/commit.ts: f6b6836af0a4d96c - src/stages/cov.ts: 9797f9316e391a55 + src/stages/cov.ts: 3dbe8381e374e8c0 src/stages/deliverable-smoke.ts: 9ecfd4210e6ec5c0 src/stages/detector-result-cache.ts: 93ea6af02ef361c5 src/stages/detectors/README.md: 12e8d24351eef05c @@ -285,34 +290,34 @@ attested_modules: src/stages/detectors/tech-stack-mismatch.ts: 099162aff2c2966b src/stages/detectors/unmapped-artifact.ts: b29f7e277d8187ae src/stages/detectors/untested-ac.ts: 90725ef1fc9245d8 - src/stages/detectors/unverified-ac.ts: d78913ae463c88d6 + src/stages/detectors/unverified-ac.ts: 6887c4d699afaad5 src/stages/detectors/with-spec.ts: dcf3205e8d563574 src/stages/disposition.ts: b7fd2e591235a326 src/stages/drift.ts: d3993f3b168ceb34 src/stages/finding-parser.ts: 19a10c5fe216059c src/stages/graph-health.ts: a294f06796b0e293 src/stages/junit-report.ts: f8466dc1e00140f1 - src/stages/lint.ts: 2f316b14e048eafb - src/stages/perf.ts: 17888e913435e0fa + src/stages/lint.ts: c1513a7c710fb13b + src/stages/perf.ts: 2b27c12427f65b2e src/stages/secret.ts: b90abc0e00c86219 src/stages/skip-policy.ts: 1a6412d708561cf0 - src/stages/smoke.ts: 486205cd691a2b0d - src/stages/spec-conformance.ts: ba68465c4715cc65 + src/stages/smoke.ts: cbe55596f6b0a49e + src/stages/spec-conformance.ts: 82efe2285dab6da1 src/stages/test-run-cache.ts: 46df49ab73a1a72e src/stages/toolchain/coverage-tool.ts: 310883060ed6d92e src/stages/toolchain/detect.ts: 36d4947e5567bd5f - src/stages/toolchain/gate-config.ts: 35c31716191a3dee + src/stages/toolchain/gate-config.ts: ef672fd9664f72c2 src/stages/toolchain/language-config.ts: 65175718559b0710 src/stages/toolchain/module-scope.ts: 88358ec3b84eedd3 src/stages/toolchain/scoped-command.ts: f2dd6410c063279f src/stages/toolchain/types.ts: 05f018fb3dddc321 - src/stages/type.ts: abe900ea8236d37f + src/stages/type.ts: 0ac37e45b407446d src/stages/types.ts: 24b4dc30ec7d7f33 src/stages/uat.ts: 62ec3e37a124f8c5 - src/stages/unit.ts: f61e0b2c79ed97e2 - src/stages/util.ts: 33e1a60e5bd097b9 + src/stages/unit.ts: fe5bf9e4bec1de77 + src/stages/util.ts: a024afe34884d653 src/stages/vacuous-tests.ts: 8e71b81e151325af - src/stages/visual.ts: 48bbb6e77f09ed63 + src/stages/visual.ts: 2b60dd991fa8124e src/ui: a4d0f0eb87fed960 src/ui/panel.ts: 8b78cb14dafb28fb src/ui/pulse.ts: ee4255f5c6e49f51 @@ -400,7 +405,7 @@ attested_modules: tests/stages/reference-integrity.test.ts: 0f919c06f0ff96f3 tests/stages/secret.test.ts: 06291c1daf9df45c tests/stages/smoke.test.ts: 99f97875d29ac5d3 - tests/stages/spec-conformance.test.ts: bdd78493c15a4ee4 + tests/stages/spec-conformance.test.ts: e3d809bcd00263a2 tests/stages/stale-evidence.test.ts: 8e8622f17eb7f955 tests/stages/stale-specification.test.ts: 09bd06db377d890c tests/stages/stale-tests.test.ts: 1467ceedb8019e86 @@ -411,7 +416,7 @@ attested_modules: tests/stages/uat.test.ts: 29c5bf3e7f3abc35 tests/stages/unit.test.ts: 97781210eb81bb25 tests/stages/unmapped-artifact.test.ts: 6bfdae66990fd63a - tests/stages/util.test.ts: b78f4f467b752bf2 + tests/stages/util.test.ts: dd95144b36bfd2b1 tests/stages/visual.test.ts: dd819e7d25586b92 tests/ui/panel.test.ts: ad9ea207f34b1c51 tests/ui/pulse.test.ts: 30f1d091de9093ad @@ -508,6 +513,7 @@ attested_features: F-0e84628e: ok F-0ed2db: ok F-0f2984d0: ok + F-0f4dd6: ok F-10cc42d1: ok F-12d740: ok F-15999130: ok diff --git a/spec/features/deliverable-smoke-9064ff.yaml b/spec/features/deliverable-smoke-9064ff.yaml index d4f0c444..bc699d95 100644 --- a/spec/features/deliverable-smoke-9064ff.yaml +++ b/spec/features/deliverable-smoke-9064ff.yaml @@ -64,13 +64,13 @@ acceptance_criteria: - id: AC-864efe ears: state condition: "while done features ship modules but no deliverable is declared" - action: "leave an informational signal before the shared eight-feature maturity boundary and an advisory warning after it" - response: "early domain or library slices can complete while a grown project must resolve its deliverable decision" - text: "While done features ship modules but no project.deliverable is declared, DELIVERABLE_INTEGRITY shall emit information before the eight-feature maturity boundary and a warning at or after it, so early domain or library slices can complete while grown projects retain an auditable deliverable obligation." + action: "emit the established warning, relaxing only explicitly marked onboarding seeds to information before the shared eight-feature maturity boundary" + response: "generated early domain or library slices can complete without changing the signal for legacy or hand-authored projects" + text: "While done features ship modules but no project.deliverable is declared, DELIVERABLE_INTEGRITY shall warn, except that a project explicitly marked as onboarding-seeded shall receive information before the eight-feature maturity boundary and a warning at or after it." notes: | ## Decision - Information keeps the first strict `done` reachable before an executable entry exists; - warning after the shared maturity boundary nudges adoption. The deterministic floor is + Marker-scoped information keeps the first strict `done` reachable before an executable entry exists; + warning after the shared maturity boundary nudges adoption without weakening existing projects. The deterministic floor is complementary to, not a replacement for, the impl-blind oracle (stage_2.3), which alone catches "runs but wrong". test_refs: diff --git a/spec/features/host-smoke-matrix-5283985e.yaml b/spec/features/host-smoke-matrix-5283985e.yaml index f8b236e1..99869d12 100644 --- a/spec/features/host-smoke-matrix-5283985e.yaml +++ b/spec/features/host-smoke-matrix-5283985e.yaml @@ -5,12 +5,14 @@ status: done modules: - src/cli/doctor-hosts.ts - src/cli/clad.ts + - src/serve/server.ts + - src/init/host-setup.ts - src/stages/detectors/host-claim-drift.ts acceptance_criteria: - id: AC-87ebd442 ears: event condition: "when clad doctor --hosts runs with live-run consent (CLAD_HOST_SMOKE=1 or interactive confirmation)" - text: "When host smoke runs with consent, the system shall execute at most 3 canned one-shot prompts per host CLI found on PATH (claude, gemini, codex) and record per-host pass, fail, or not-run with the observed sentinel evidence into a dated artifact under .cladding/audit/." + text: "When host smoke runs with consent, the system shall execute at most 3 canned one-shot prompts per supported host CLI found on PATH (Claude Code, Gemini, Antigravity, Codex, and Cursor) and record per-host pass, fail, or not-run with the observed sentinel evidence into a dated artifact under .cladding/audit/." notes: "WHY: host verification is two hand-written dogfood docs pinned to v0.3.x — five minor versions stale; Codex explicitly deferred, Gemini drive-loop never exercised. Claims need dated receipts." test_refs: [tests/cli/doctor-hosts.test.ts] - id: AC-8dfa9cc4 @@ -33,6 +35,26 @@ acceptance_criteria: test_refs: [tests/stages/detectors/host-claim-drift.test.ts] - id: AC-6cbe51fc ears: ubiquitous - text: "The system shall headlessly prompt-probe Cursor Agent alongside Claude Code, Antigravity, and Codex, and shall additionally record whether Cursor's configured clad serve answers a tools list over stdio." + text: "The system shall headlessly prompt-probe Cursor Agent alongside Claude Code, Gemini, Antigravity, and Codex, and shall additionally record whether Cursor's configured clad serve answers a tools list over stdio." notes: "WHY: Cursor Agent now provides a headless CLI, so retaining the old wiring-only ceiling would understate directly observed end-to-end evidence." test_refs: [tests/cli/doctor-hosts.test.ts] + - id: AC-0d93bc + ears: event + condition: "when a committed host-smoke artifact predates a newly separated host row" + action: "load the recorded rows without relabeling their evidence and synthesize an honest not-run fallback for the absent host" + response: "matrix regeneration remains compatible while each host claim keeps its original provenance" + text: "When an older host-smoke artifact omits Gemini or Antigravity, the system shall preserve every recorded host row and represent the missing host as not-run instead of copying evidence between hosts." + test_refs: [tests/cli/doctor-hosts.test.ts] + - id: AC-4a71e2 + ears: ubiquitous + action: "advertise the doctor MCP surfaces as read-only and configure project-local Codex, Gemini, and Cursor wiring to auto-approve only those read-only tools" + response: "headless verification can call the intended tools without granting a model unrestricted write access" + text: "The system shall mark list-features, get-feature, and drift-check MCP tools as read-only and shall keep write-capable tools approval-gated in project-local Codex, Gemini, and Cursor configuration." + test_refs: [tests/serve/server.test.ts, tests/cli/setup.test.ts] + - id: AC-8bf019 + ears: unwanted + condition: "if a host refusal or cancellation echoes a requested feature id or the word findings" + action: "classify the surface as failed before applying the positive sentinel matcher" + response: "a denied MCP call cannot become a vacuous pass by paraphrasing the prompt" + text: "If a host rejects or cancels an MCP call, the system shall record that surface as failed even when the response repeats its expected sentinel." + test_refs: [tests/cli/doctor-hosts.test.ts] diff --git a/spec/features/lint-config-detection-b2094740.yaml b/spec/features/lint-config-detection-b2094740.yaml index dd18471e..8fd7d25c 100644 --- a/spec/features/lint-config-detection-b2094740.yaml +++ b/spec/features/lint-config-detection-b2094740.yaml @@ -19,6 +19,9 @@ acceptance_criteria: bridging eslint in. The JS/TS ecosystem has several mainstream linters; the honest gate runs the one the project declared, read from its config file, not a single assumed default. + This criterion also owns the project-script precedence requirement that + was first discovered during onboarding handoff verification; it applies + to every TypeScript or JavaScript project, not only initialized ones. test_refs: - "tests/stages/toolchain.test.ts#typescript + biome.json → lint gate is biome" - "tests/stages/toolchain.test.ts#typescript + .oxlintrc.json → lint gate is oxlint" diff --git a/spec/features/natural-language-init-0f4dd6.yaml b/spec/features/natural-language-init-0f4dd6.yaml index c1b0650e..17a6436c 100644 --- a/spec/features/natural-language-init-0f4dd6.yaml +++ b/spec/features/natural-language-init-0f4dd6.yaml @@ -1,7 +1,7 @@ id: F-0f4dd6 slug: natural-language-init title: "Natural-language init across skill and MCP hosts" -status: in_progress +status: done modules: - src/serve/server.ts - src/cli/init.ts @@ -12,6 +12,9 @@ modules: - src/init/host-setup.ts - src/init/agents-md.ts - src/init/host-instructions.ts + - skills/init/SKILL.md + - src/cli/update.ts + - src/cli/clad.ts - src/spec/new.ts - src/spec/schema.json - src/spec/types.ts @@ -20,65 +23,93 @@ modules: - src/stages/detectors/capabilities-feature-mapping.ts - src/stages/detectors/scenario-coverage.ts - src/stages/detectors/deliverable-integrity.ts - - src/stages/toolchain/detect.ts - - src/stages/unit.ts - - src/stages/util.ts - README.md + - docs/setup.md - docs/glossary.md - docs/ssot-model.md - docs/dogfood/codex-cli-2026-07-15.md + - docs/dogfood/cursor-agent-2026-07-15.md + - docs/dogfood/antigravity-cli-2026-07-15.md - src/stages/detectors/README.md - src/stages/README.md -depends_on: [F-56abaa, F-5f6b45, F-80d19d] +depends_on: [ F-56abaa, F-5f6b45, F-80d19d ] acceptance_criteria: - id: AC-001 ears: ubiquitous - action: expose project initialization and onboarding answers as MCP tools that reuse the CLI core - response: MCP hosts can complete init and its follow-up Q&A without asking the user to run a shell command - text: The system shall expose project initialization and onboarding answers as MCP tools that reuse the CLI core, so MCP hosts can complete init and its follow-up Q&A without asking the user to run a shell command. - test_refs: [tests/serve/server.test.ts, tests/serve/init-tools.test.ts] + action: expose project initialization and onboarding answers as MCP tools that + reuse the CLI core + response: MCP hosts can complete init and its follow-up Q&A without asking the + user to run a shell command + text: The system shall expose project initialization and onboarding answers as + MCP tools that reuse the CLI core, so MCP hosts can complete init and its + follow-up Q&A without asking the user to run a shell command. + test_refs: [ tests/serve/server.test.ts, tests/serve/init-tools.test.ts ] - id: AC-002 ears: event condition: when a new-project initialization request omits the project idea action: return a needs-input result before creating any project artifact response: the host asks for intent instead of producing a generic scaffold - text: When a new-project initialization request omits the project idea, the system shall return a needs-input result before creating any project artifact, so the host asks for intent instead of producing a generic scaffold. - test_refs: [tests/serve/init-tools.test.ts] + text: When a new-project initialization request omits the project idea, the + system shall return a needs-input result before creating any project + artifact, so the host asks for intent instead of producing a generic + scaffold. + test_refs: [ tests/serve/init-tools.test.ts ] - id: AC-003 ears: event condition: when initialization uses a planning document - action: read a recognized UTF-8 text file confined to the connected project root and pass its complete body through the existing intent-aware onboarding path + action: read a recognized UTF-8 text file confined to the connected project root + and pass its complete body through the existing intent-aware onboarding + path response: the planning document is neither truncated nor mistaken for literal intent - text: When initialization uses a planning document, the system shall read a recognized UTF-8 text file confined to the connected project root and pass its complete body through the existing intent-aware onboarding path, so the planning document is neither truncated nor mistaken for literal intent. - test_refs: [tests/serve/init-tools.test.ts] + text: When initialization uses a planning document, the system shall read a + recognized UTF-8 text file confined to the connected project root and pass + its complete body through the existing intent-aware onboarding path, so + the planning document is neither truncated nor mistaken for literal + intent. + test_refs: [ tests/serve/init-tools.test.ts ] - id: AC-004 ears: event condition: when initialization adopts an existing project - action: force the observed scan path even when the project contains fewer than three source files + action: force the observed scan path even when the project contains fewer than + three source files response: sparse existing projects are not treated as greenfield ideas - text: When initialization adopts an existing project, the system shall force the observed scan path even when the project contains fewer than three source files, so sparse existing projects are not treated as greenfield ideas. - test_refs: [tests/serve/init-tools.test.ts] + text: When initialization adopts an existing project, the system shall force the + observed scan path even when the project contains fewer than three source + files, so sparse existing projects are not treated as greenfield ideas. + test_refs: [ tests/serve/init-tools.test.ts ] - id: AC-005 ears: unwanted - condition: if the connected project already contains spec.yaml and refresh was not explicitly requested - action: return an already-initialized result without creating proposals or changing project files + condition: if the connected project already contains spec.yaml and refresh was + not explicitly requested + action: return an already-initialized result without creating proposals or + changing project files response: repeated natural-language requests remain non-destructive - text: If the connected project already contains spec.yaml and refresh was not explicitly requested, the system shall return an already-initialized result without creating proposals or changing project files, so repeated natural-language requests remain non-destructive. - test_refs: [tests/serve/init-tools.test.ts] + text: If the connected project already contains spec.yaml and refresh was not + explicitly requested, the system shall return an already-initialized + result without creating proposals or changing project files, so repeated + natural-language requests remain non-destructive. + test_refs: [ tests/serve/init-tools.test.ts ] - id: AC-006 ears: event condition: when init or clarify returns pending product questions action: include the next question and onboarding status in structured MCP output response: the host can continue one answer at a time until onboarding is complete - text: When init or clarify returns pending product questions, the system shall include the next question and onboarding status in structured MCP output, so the host can continue one answer at a time until onboarding is complete. - test_refs: [tests/serve/init-tools.test.ts] + text: When init or clarify returns pending product questions, the system shall + include the next question and onboarding status in structured MCP output, + so the host can continue one answer at a time until onboarding is + complete. + test_refs: [ tests/serve/init-tools.test.ts ] - id: AC-007 ears: state condition: while clad setup activates host integrations - action: write discovery configuration only inside the selected project and keep every other project free of Cladding skills and MCP tools + action: write discovery configuration only inside the selected project and keep + every other project free of Cladding skills and MCP tools response: installing Cladding globally cannot influence unrelated host sessions - text: While clad setup activates host integrations, the system shall write discovery configuration only inside the selected project and keep every other project free of Cladding skills and MCP tools, so installing Cladding globally cannot influence unrelated host sessions. - test_refs: [tests/cli/setup.test.ts] + text: While clad setup activates host integrations, the system shall write + discovery configuration only inside the selected project and keep every + other project free of Cladding skills and MCP tools, so installing + Cladding globally cannot influence unrelated host sessions. + test_refs: [ tests/cli/setup.test.ts ] notes: | ## Decision The npm package remains global, but host discovery is project-scoped. @@ -88,10 +119,15 @@ acceptance_criteria: Each developer runs `clad setup` once per project and machine, gaining structural isolation at the cost of one explicit activation step. - id: AC-008 ears: ubiquitous - action: document natural-language init as the primary path and describe each host's optional explicit invocation syntax accurately - response: Claude Code, Codex, Antigravity, and Cursor receive accurate project-scoped startup guidance - text: The system shall document natural-language init as the primary path and describe each host's project-scoped startup accurately, so Claude Code, Codex, Antigravity, and Cursor receive accurate project-scoped startup guidance. - evidence_refs: [README.md, docs/setup.md] + action: document natural-language init as the primary path and describe each + host's optional explicit invocation syntax accurately + response: Claude Code, Codex, Gemini, Antigravity, and Cursor receive accurate + project-scoped startup guidance + text: The system shall document natural-language init as the primary path and + describe each host's project-scoped startup accurately, so Claude Code, + Codex, Gemini, Antigravity, and Cursor receive accurate project-scoped startup + guidance. + evidence_refs: [ README.md, docs/setup.md ] notes: | ## Decision Keep raw `clad init` as a compatibility and automation surface, not the primary onboarding UX. @@ -101,11 +137,17 @@ acceptance_criteria: MCP init and clarify tools are required to make that promise deterministic for hosts without a bundled skill. - id: AC-009 ears: unwanted - condition: if an initialization request has not been followed by a separate affirmative user confirmation after the read-only preview + condition: if an initialization request has not been followed by a separate + affirmative user confirmation after the read-only preview action: reject the apply step without creating project artifacts - response: opening a project, asking about Cladding, or making the initial natural-language request cannot silently authorize file changes - text: If an initialization request has not been followed by a separate affirmative user confirmation after the read-only preview, the system shall reject the apply step without creating project artifacts, so opening a project, asking about Cladding, or making the initial natural-language request cannot silently authorize file changes. - test_refs: [tests/serve/init-tools.test.ts] + response: opening a project, asking about Cladding, or making the initial + natural-language request cannot silently authorize file changes + text: If an initialization request has not been followed by a separate + affirmative user confirmation after the read-only preview, the system + shall reject the apply step without creating project artifacts, so opening + a project, asking about Cladding, or making the initial natural-language + request cannot silently authorize file changes. + test_refs: [ tests/serve/init-tools.test.ts ] notes: | ## Decision Natural language may start the read-only preparation, but a distinct user turn authorizes the write. @@ -115,11 +157,16 @@ acceptance_criteria: The host instruction and verbatim confirmation field provide the strongest portable boundary; a malicious host could still fabricate consent, so this is not presented as a sandbox guarantee. - id: AC-010 ears: unwanted - condition: if the apply request does not carry the exact one-time approval challenge shown in the read-only preview + condition: if the apply request does not carry the exact one-time approval + challenge shown in the read-only preview action: reject initialization without writing project artifacts - response: questions, acknowledgements, and model-invented confirmations cannot be mistaken for user consent - text: If the apply request does not carry the exact one-time approval challenge shown in the read-only preview, the system shall reject initialization without writing project artifacts, so questions, acknowledgements, and model-invented confirmations cannot be mistaken for user consent. - test_refs: [tests/serve/init-tools.test.ts] + response: questions, acknowledgements, and model-invented confirmations cannot + be mistaken for user consent + text: If the apply request does not carry the exact one-time approval challenge + shown in the read-only preview, the system shall reject initialization + without writing project artifacts, so questions, acknowledgements, and + model-invented confirmations cannot be mistaken for user consent. + test_refs: [ tests/serve/init-tools.test.ts ] notes: | ## Decision Use a short preview-bound approval challenge rather than attempting to classify arbitrary affirmative prose across languages. @@ -129,74 +176,143 @@ acceptance_criteria: Initialization is a one-time destructive boundary, so one explicit copy/confirm step is preferred over a lower-friction but ambiguous yes/no classifier. - id: AC-011 ears: event - condition: when the supplied idea, planning document, and observed project already resolve the important product decisions + condition: when the supplied idea, planning document, and observed project + already resolve the important product decisions action: emit no follow-up questions - response: complete inputs can move directly into development while incomplete inputs receive at most three material product questions - text: When the supplied idea, planning document, and observed project already resolve the important product decisions, the system shall emit no follow-up questions, so complete inputs can move directly into development while incomplete inputs receive at most three material product questions. - test_refs: [tests/serve/init-tools.test.ts, tests/cli/intent-onboarding.test.ts] + response: complete inputs can move directly into development while incomplete + inputs receive at most three material product questions + text: When the supplied idea, planning document, and observed project already + resolve the important product decisions, the system shall emit no + follow-up questions, so complete inputs can move directly into development + while incomplete inputs receive at most three material product questions. + test_refs: [ tests/serve/init-tools.test.ts, tests/cli/intent-onboarding.test.ts ] - id: AC-012 ears: event condition: when a planning document and existing source code are both present - action: combine the complete project-local document with an observed code scan in one onboarding preparation - response: hybrid projects do not have to discard either declared intent or sparse implementation evidence - text: When a planning document and existing source code are both present, the system shall combine the complete project-local document with an observed code scan in one onboarding preparation, so hybrid projects do not have to discard either declared intent or sparse implementation evidence. - test_refs: [tests/serve/init-tools.test.ts] + action: combine the complete project-local document with an observed code scan + in one onboarding preparation + response: hybrid projects do not have to discard either declared intent or + sparse implementation evidence + text: When a planning document and existing source code are both present, the + system shall combine the complete project-local document with an observed + code scan in one onboarding preparation, so hybrid projects do not have to + discard either declared intent or sparse implementation evidence. + test_refs: [ tests/serve/init-tools.test.ts ] - id: AC-013 ears: event - condition: when a follow-up answer refines untouched Cladding-generated onboarding artifacts - action: update those artifacts atomically and keep onboarding active until every answer is represented in the active design - response: onboarding cannot report completion while the accepted answer exists only in a review proposal - text: When a follow-up answer refines untouched Cladding-generated onboarding artifacts, the system shall update those artifacts atomically and keep onboarding active until every answer is represented in the active design, so onboarding cannot report completion while the accepted answer exists only in a review proposal. - test_refs: [tests/serve/init-tools.test.ts, tests/cli/clarify.test.ts] + condition: when a follow-up answer refines untouched Cladding-generated + onboarding artifacts + action: update those artifacts atomically and keep onboarding active until every + answer is represented in the active design + response: onboarding cannot report completion while the accepted answer exists + only in a review proposal + text: When a follow-up answer refines untouched Cladding-generated onboarding + artifacts, the system shall update those artifacts atomically and keep + onboarding active until every answer is represented in the active design, + so onboarding cannot report completion while the accepted answer exists + only in a review proposal. + test_refs: [ tests/serve/init-tools.test.ts, tests/cli/clarify.test.ts ] - id: AC-014 ears: unwanted - condition: if an onboarding artifact changed after the read-only preparation or a write fails while applying the draft - action: leave every authored project file at its pre-apply content and return a stale or failed result + condition: if an onboarding artifact changed after the read-only preparation or + a write fails while applying the draft + action: leave every authored project file at its pre-apply content and return a + stale or failed result response: initialization and clarification never leave a partially applied design - text: If an onboarding artifact changed after the read-only preparation or a write fails while applying the draft, the system shall leave every authored project file at its pre-apply content and return a stale or failed result, so initialization and clarification never leave a partially applied design. - test_refs: [tests/serve/init-tools.test.ts] + text: If an onboarding artifact changed after the read-only preparation or a + write fails while applying the draft, the system shall leave every + authored project file at its pre-apply content and return a stale or + failed result, so initialization and clarification never leave a partially + applied design. + test_refs: [ tests/serve/init-tools.test.ts ] - id: AC-015 ears: event condition: when onboarding completes - action: report that ordinary natural-language development may continue, distinguish on-demand checks from opt-in hook or CI enforcement, and require each material feature to resolve its design impact before done - response: the handoff is truthful and Tier-B design grows selectively with the project - text: When onboarding completes, the system shall report that ordinary natural-language development may continue, distinguish on-demand checks from opt-in hook or CI enforcement, and require each material feature to resolve its design impact before done, so the handoff is truthful and Tier-B design grows selectively with the project. - test_refs: [tests/serve/server.test.ts, tests/cli/done.test.ts] - evidence_refs: [README.md, src/init/agents-md.ts, src/serve/server.ts] + action: report that ordinary natural-language development may continue, + distinguish on-demand checks from opt-in hook or CI enforcement, and + require each material feature to resolve its design impact before done + response: the handoff is truthful and Tier-B design grows selectively with the + project + text: When onboarding completes, the system shall report that ordinary + natural-language development may continue, distinguish on-demand checks + from opt-in hook or CI enforcement, and require each material feature to + resolve its design impact before done, so the handoff is truthful and + Tier-B design grows selectively with the project. + test_refs: [ tests/serve/server.test.ts, tests/cli/done.test.ts ] + evidence_refs: [ README.md, src/init/agents-md.ts, src/serve/server.ts ] - id: AC-016 ears: event - condition: when a host restarts its MCP server between the read-only preview and the user's separate approval reply - action: validate a restart-safe approval envelope against the current workspace snapshot - response: headless and process-per-turn hosts can apply the approved preview while stale or replayed envelopes remain non-destructive - text: When a host restarts its MCP server between the read-only preview and the user's separate approval reply, the system shall validate a restart-safe approval envelope against the current workspace snapshot, so headless and process-per-turn hosts can apply the approved preview while stale or replayed envelopes remain non-destructive. - test_refs: [tests/serve/init-tools.test.ts] + condition: when a host restarts its MCP server between the read-only preview and + the user's separate approval reply + action: validate a restart-safe approval envelope against the current workspace + snapshot + response: headless and process-per-turn hosts can apply the approved preview + while stale or replayed envelopes remain non-destructive + text: When a host restarts its MCP server between the read-only preview and the + user's separate approval reply, the system shall validate a restart-safe + approval envelope against the current workspace snapshot, so headless and + process-per-turn hosts can apply the approved preview while stale or + replayed envelopes remain non-destructive. + test_refs: [ tests/serve/init-tools.test.ts ] - id: AC-017 ears: state - condition: while an activated project has no spec.yaml and the user has not explicitly named Cladding - action: expose only the narrowly described init bootstrap and reject non-init mutations before writing - response: ordinary development remains ordinary even after setup but before explicit initialization - text: While an activated project has no spec.yaml and the user has not explicitly named Cladding, the system shall expose only the narrowly described init bootstrap and reject non-init mutations before writing, so ordinary development remains ordinary even after setup but before explicit initialization. - test_refs: [tests/init/skill-activation.test.ts, tests/cli/setup.test.ts, tests/serve/server.test.ts] + condition: while an activated project has no spec.yaml and the user has not + explicitly named Cladding + action: expose only the narrowly described init bootstrap and reject non-init + mutations before writing + response: ordinary development remains ordinary even after setup but before + explicit initialization + text: While an activated project has no spec.yaml and the user has not + explicitly named Cladding, the system shall expose only the narrowly + described init bootstrap and reject non-init mutations before writing, so + ordinary development remains ordinary even after setup but before explicit + initialization. + test_refs: + [ + tests/init/skill-activation.test.ts, + tests/cli/setup.test.ts, + tests/serve/server.test.ts + ] - id: AC-018 ears: event condition: when project-scoped setup finds a legacy global Cladding integration - action: remove only entries whose ownership is proven by a known Cladding package root or managed launch signature and preserve every ambiguous file - response: upgrading stops unrelated-project influence without deleting user configuration - text: When project-scoped setup finds a legacy global Cladding integration, the system shall remove only entries whose ownership is proven by a known Cladding package root or managed launch signature and preserve every ambiguous file, so upgrading stops unrelated-project influence without deleting user configuration. - test_refs: [tests/cli/setup.test.ts] + action: remove only entries whose ownership is proven by a known Cladding + package root or managed launch signature and preserve every ambiguous file + response: upgrading stops unrelated-project influence without deleting user + configuration + text: When project-scoped setup finds a legacy global Cladding integration, the + system shall remove only entries whose ownership is proven by a known + Cladding package root or managed launch signature and preserve every + ambiguous file, so upgrading stops unrelated-project influence without + deleting user configuration. + test_refs: [ tests/cli/setup.test.ts ] - id: AC-019 ears: ubiquitous - action: use AGENTS.md as the generated cross-host instruction surface and preserve any existing CLAUDE.md without creating a new one - response: project guidance has one shared source instead of diverging host copies - text: The system shall use AGENTS.md as the generated cross-host instruction surface and preserve any existing CLAUDE.md without creating a new one, so project guidance has one shared source instead of diverging host copies. - test_refs: [tests/cli/update.test.ts, tests/cli/init-onboarding-english-source.test.ts] + action: use AGENTS.md as the onboarding-generated cross-host instruction + surface while preserving the established update behavior for CLAUDE.md + response: init avoids a new host-specific copy and existing update users retain + their managed Claude guidance + text: The system shall generate AGENTS.md during onboarding without creating or + changing CLAUDE.md, while clad update shall retain its established managed + CLAUDE.md refresh, so init has one shared guidance source without breaking + existing update workflows. + test_refs: [ tests/cli/update.test.ts, tests/cli/init-onboarding-english-source.test.ts ] - id: AC-020 ears: event - condition: when a process-per-turn host stages a validated onboarding draft before showing the approval challenge - action: retain that exact draft only as ignored project runtime state and apply it after the complete approval phrase without asking the model to reconstruct intent - response: MCP process restarts cannot replace a planning document or observed project intent with an approval code - text: When a process-per-turn host stages a validated onboarding draft before showing the approval challenge, the system shall retain that exact draft only as ignored project runtime state and apply it after the complete approval phrase without asking the model to reconstruct intent, so MCP process restarts cannot replace a planning document or observed project intent with an approval code. - test_refs: [tests/serve/init-tools.test.ts] + condition: when a process-per-turn host stages a validated onboarding draft + before showing the approval challenge + action: retain that exact draft only as ignored project runtime state and apply + it after the complete approval phrase without asking the model to + reconstruct intent + response: MCP process restarts cannot replace a planning document or observed + project intent with an approval code + text: When a process-per-turn host stages a validated onboarding draft before + showing the approval challenge, the system shall retain that exact draft + only as ignored project runtime state and apply it after the complete + approval phrase without asking the model to reconstruct intent, so MCP + process restarts cannot replace a planning document or observed project + intent with an approval code. + test_refs: [ tests/serve/init-tools.test.ts ] notes: | ## Decision Add a read-only staging tool between host-model drafting and the destructive apply tool. @@ -206,11 +322,17 @@ acceptance_criteria: Staging writes an opaque short-lived cache under the already ignored `.cladding/host/` runtime boundary, while authored spec and documentation remain untouched until exact approval. - id: AC-021 ears: event - condition: when an activated project's ignored runtime launcher receives shell command arguments after initialization - action: forward those arguments to the exact engine used for MCP while retaining no-argument MCP startup - response: post-init shell validation cannot silently use a different global build from the connected MCP server - text: When the project runtime launcher receives shell command arguments, the system shall forward them to the same engine used for MCP while preserving no-argument MCP startup, so post-init validation cannot silently use another build. - test_refs: [tests/cli/setup.test.ts] + condition: when an activated project's ignored runtime launcher receives shell + command arguments after initialization + action: forward those arguments to the exact engine used for MCP while retaining + no-argument MCP startup + response: post-init shell validation cannot silently use a different global + build from the connected MCP server + text: When the project runtime launcher receives shell command arguments, the + system shall forward them to the same engine used for MCP while preserving + no-argument MCP startup, so post-init validation cannot silently use + another build. + test_refs: [ tests/cli/setup.test.ts ] notes: | ## Decision Make the existing ignored Node launcher dual-purpose instead of adding a second machine-specific command surface. @@ -220,57 +342,56 @@ acceptance_criteria: The launcher's historical `serve.cjs` name remains slightly narrower than its role, but existing host configurations stay compatible and every argument is forwarded without shell interpolation. - id: AC-022 ears: state - condition: while the generated AGENTS.md guides ordinary development after initialization - action: prefer the project runtime for Cladding shell commands and require the declared test command to collect relevant tests without shell-expanded glob dependencies - response: agents use one engine and cannot treat a vacuous or host-specific test invocation as completion evidence - text: While generated project guidance directs ordinary development, the system shall prefer the project Cladding runtime and require non-vacuous, shell-portable test execution, so engine skew and host-specific test globs cannot masquerade as completion. - test_refs: [tests/init/agents-md.test.ts] + condition: while the generated AGENTS.md guides ordinary development after + initialization + action: prefer the project runtime for Cladding shell commands and require the + declared test command to collect relevant tests without shell-expanded + glob dependencies + response: agents use one engine and cannot treat a vacuous or host-specific test + invocation as completion evidence + text: While generated project guidance directs ordinary development, the system + shall prefer the project Cladding runtime and require non-vacuous, + shell-portable test execution, so engine skew and host-specific test globs + cannot masquerade as completion. + test_refs: [ tests/init/agents-md.test.ts ] - id: AC-023 ears: state - condition: while an initialized project is below the shared eight-feature design-maturity threshold and retains unbound onboarding capabilities or scenarios - action: report those future design links as information while continuing to block dangling references and under-bound flows - response: the first ordinary feature can earn a strict done result without deleting valid future intent - text: While an initialized project is below the design-maturity threshold, the system shall treat unbound onboarding capabilities and scenarios as informational future intent while retaining blocking checks for invalid links, so an early feature can complete without erasing the roadmap. - test_refs: [tests/stages/capabilities-feature-mapping.test.ts, tests/stages/scenario-coverage.test.ts] + condition: while a project marked as onboarding-seeded is below the shared + eight-feature design-maturity threshold and retains unbound onboarding + capabilities or scenarios + action: report those future design links as information while continuing to + block dangling references and under-bound flows + response: the first ordinary feature can earn a strict done result without + deleting valid future intent + text: While a project explicitly marked as onboarding-seeded is below the + design-maturity threshold, the system shall treat unbound onboarding + capabilities and scenarios as informational future intent while retaining + blocking checks for invalid links, so an early feature can complete without + changing the warning behavior of legacy or hand-authored projects. + test_refs: + [ + tests/stages/capabilities-feature-mapping.test.ts, + tests/stages/scenario-coverage.test.ts + ] notes: | ## Decision - Graduate empty-link findings from information to warning at the existing eight-feature maturity boundary. + Persist an onboarding-seeded marker and graduate only those generated empty-link findings from information to warning at the existing eight-feature maturity boundary. ## Why Onboarding intentionally authors three to eight future capabilities and one to three future journeys with empty feature links, while strict mode promotes every warning to an error. Treating those intentional seeds as warnings made the first `clad done` impossible. ## Trade-off - Small projects may ship while retaining visibly informational future design; once the project reaches eight features, unresolved empty links become strict-gate blockers again. - - id: AC-024 - ears: event - condition: when a TypeScript or JavaScript project declares lint, custom test, or coverage scripts after initialization - action: run those project-owned workflows before inferred ecosystem defaults and leave undeclared optional gates unregistered - response: Node test and other custom workflows are not replaced by unrelated cached or globally available ESLint and Vitest executables - text: When a TypeScript or JavaScript project declares its development scripts, the system shall run the project-owned lint, custom test, and coverage workflows before inferred defaults and leave undeclared optional gates unregistered, so an unrelated tool cannot make ordinary post-initialization development fail or pass. - test_refs: [tests/stages/toolchain.test.ts] - notes: | - ## Decision - Treat package scripts as executable project intent. Preserve the direct Vitest/Jest paths only for their simple canonical scripts, because those paths provide per-test evidence and single-run unit/coverage reuse. - ## Why - The live Codex project explicitly used Node's built-in test runner, yet the full gate invoked Vitest against both source and compiled tests, invoked unconfigured ESLint, and requested an absent Vitest coverage plug-in. - ## Trade-off - Optional lint and coverage stages honestly skip when the project declares neither a script nor configuration; strict test demand still blocks a missing unit runner whenever behavioral proof is required. - - id: AC-025 - ears: unwanted - condition: if a unit command exits successfully but its recognized aggregate summary reports that zero tests executed - action: emit a blocking vacuous-tests finding in strict mode - response: a portable command typo or empty test selection cannot become completion evidence - text: If a unit command exits successfully but its recognized aggregate summary reports zero executed tests, the system shall emit a blocking vacuous-tests finding in strict mode, so an empty test selection cannot become completion evidence. - test_refs: [tests/stages/unit.test.ts] - - id: AC-026 - ears: unwanted - condition: if an inferred npm tool is absent from a project during an offline or network-restricted development session - action: prohibit registry access and classify the unresolved tool as a visible setup gap - response: missing optional tooling neither stalls the host session nor becomes a false secret, architecture, lint, or test failure - text: If an inferred npm tool is absent during an offline or network-restricted development session, the system shall prohibit registry access and classify the unresolved tool as a visible setup gap, so missing optional tooling neither stalls the host nor masquerades as a product defect. - test_refs: [tests/stages/toolchain.test.ts, tests/stages/util.test.ts] + Onboarding-seeded small projects may retain visibly informational future design; once the project reaches eight features, unresolved empty links become strict-gate blockers again. Projects without the marker keep the established warning at every size. - id: AC-027 ears: state - condition: while an initialized project is below the shared eight-feature design-maturity threshold and its first completed domain or library slice has no runnable entry point yet - action: report the missing deliverable decision as information and retain the warning after the maturity boundary - response: the first feature can complete without inventing an unsafe smoke target while grown products must resolve the entry-point obligation - text: While an initialized project is below the design-maturity threshold and has no runnable entry point yet, the system shall treat the missing deliverable decision as information and restore the warning after the threshold, so the first feature can complete without inventing an unsafe smoke target. - test_refs: [tests/stages/detectors/deliverable-integrity.test.ts] + condition: while a project marked as onboarding-seeded is below the shared + eight-feature design-maturity threshold and its first completed domain or + library slice has no runnable entry point yet + action: report the missing deliverable decision as information and retain the + warning after the maturity boundary + response: the first feature can complete without inventing an unsafe smoke + target while grown products must resolve the entry-point obligation + text: While a project explicitly marked as onboarding-seeded is below the + design-maturity threshold and has no runnable entry point yet, the system + shall treat the missing deliverable decision as information and restore the + warning after the threshold, so the first feature can complete without + changing the warning behavior of legacy or hand-authored projects. + test_refs: [ tests/stages/detectors/deliverable-integrity.test.ts ] diff --git a/spec/features/no-vacuous-green-gate-contract-af96b1.yaml b/spec/features/no-vacuous-green-gate-contract-af96b1.yaml index e5a0c327..fad1f5cc 100644 --- a/spec/features/no-vacuous-green-gate-contract-af96b1.yaml +++ b/spec/features/no-vacuous-green-gate-contract-af96b1.yaml @@ -4,6 +4,14 @@ slug: no-vacuous-green-gate-contract title: No Vacuous Green — honest gate exit-contract, shared spec-load seam, ambient hook (v0.4.x) status: done modules: + - src/stages/util.ts + - src/stages/type.ts + - src/stages/lint.ts + - src/stages/unit.ts + - src/stages/cov.ts + - src/stages/smoke.ts + - src/stages/perf.ts + - src/stages/visual.ts - src/stages/detectors/with-spec.ts - src/init/git-hook.ts - .github/workflows/ci.yml @@ -37,3 +45,13 @@ acceptance_criteria: response: 'tests/self-consistency.test.ts asserts the corrected self-drift fixes (counts, version, banners), and .github/workflows/ci.yml runs `npm test` plus the strict spec-native self-gate (`clad check --tier=pre-commit --strict`) on every push/PR so any future regression actually fails CI rather than the lock being a vacuous claim; these are cladding-self checks, not shipped detectors, so an adopting project may legitimately diverge without being false-failed' text: The system shall enforce cladding's own self-consistency (detector-count claims, spec/package version parity, tier banners) as CI-locked tests so the drift-prevention tool cannot silently drift against itself. test_refs: [tests/self-consistency.test.ts] + - id: AC-005 + ears: event + condition: when a locally constrained npx invocation cannot resolve its requested executable without registry access + action: classify only that unresolved target as a visible setup gap while preserving failures from tools that did start + response: missing optional tooling neither stalls offline work nor hides a real nested-command failure + text: When an offline local-only npx invocation cannot resolve its requested executable, the system shall report a setup gap without contacting the registry, while a tool that started and failed internally shall remain a blocking failure. + notes: | + This general stage exit-contract rule was isolated from onboarding handoff + verification because it applies equally to legacy and hand-authored projects. + test_refs: [tests/stages/util.test.ts] diff --git a/spec/features/scenario-coverage-detector-315fd7.yaml b/spec/features/scenario-coverage-detector-315fd7.yaml index d7905659..506032d7 100644 --- a/spec/features/scenario-coverage-detector-315fd7.yaml +++ b/spec/features/scenario-coverage-detector-315fd7.yaml @@ -19,14 +19,14 @@ acceptance_criteria: - id: AC-002 ears: unwanted condition: if a scenario declares an empty features[] list - action: 'report that the scenario binds no features, as information below the maturity threshold and a warning once the project is grown' - text: If a scenario binds no features, the system shall report the unresolved link and graduate it to a warning when the project reaches the design-maturity threshold. + action: 'report that the scenario binds no features as a warning, relaxing only marked onboarding seeds to information below the maturity threshold' + text: If a scenario binds no features, the system shall warn about the unresolved link, except that a project explicitly marked as onboarding-seeded may retain it as information until the design-maturity threshold. test_refs: [tests/stages/scenario-coverage.test.ts] - id: AC-003 ears: ubiquitous - action: 'classify grown-project scenario-coverage findings as warn while retaining early onboarding seeds as info' - response: 'the grown-project signal rides the existing warn/strict dial, while a small project can retain explicit future journeys without blocking its first completed feature' - text: The system shall make grown-project scenario-coverage gaps blocking under strict mode while keeping early onboarding seeds informational. + action: 'classify grown-project scenario-coverage findings as warn while retaining only explicitly marked early onboarding seeds as info' + response: 'the grown-project signal rides the existing warn/strict dial, while generated future journeys do not alter the established behavior of legacy or hand-authored projects' + text: The system shall make grown-project scenario-coverage gaps blocking under strict mode while keeping explicitly marked early onboarding seeds informational and all unmarked hollow scenarios advisory. test_refs: [tests/stages/scenario-coverage.test.ts] - id: AC-004 ears: event diff --git a/spec/features/spec-conformance-oracle-stage-c4c5ae.yaml b/spec/features/spec-conformance-oracle-stage-c4c5ae.yaml index 0f559bfa..65f86bf2 100644 --- a/spec/features/spec-conformance-oracle-stage-c4c5ae.yaml +++ b/spec/features/spec-conformance-oracle-stage-c4c5ae.yaml @@ -6,6 +6,9 @@ status: done modules: - src/stages/spec-conformance.ts - tests/stages/spec-conformance.test.ts + - src/stages/toolchain/gate-config.ts + - tests/stages/toolchain/gate-config.test.ts + - src/stages/detectors/unverified-ac.ts - src/stages/detectors/spec-conformance.ts - tests/stages/detectors/spec-conformance.test.ts - src/oracle/payload.ts @@ -64,3 +67,17 @@ acceptance_criteria: response: the recorded provenance is what the SPEC_CONFORMANCE gate audits (author≠implementer, manifest∩modules=∅); the shard edit goes through the yaml Document API so comments and layout survive text: When clad_author_oracle is called, the system shall write the oracle, record its impl-blind provenance, and stamp oracle_refs without malforming the shard. test_refs: [tests/oracle-record.test.ts] + - id: AC-008 + ears: event + condition: when the spec-conformance stage runs only the impl-blind oracle suite and the project reporter shares a result path with the full unit suite + action: preserve every configured or conventional full-suite test report across the scoped oracle invocation + response: a later strict gate cannot mistake the oracle-only selection for the project's complete test evidence + text: When spec conformance runs only the impl-blind oracle suite, the system shall preserve shared full-suite test reports across that scoped invocation, so a later strict gate cannot misread partial oracle results as complete test evidence. + notes: | + ## Decision + Snapshot configured and conventional test-report candidates before the oracle-only command, then restore existing files and remove candidates created only by that partial run. + ## Why + The oracle stage appends `tests/oracle` to the project runner, while reporters may still overwrite the shared full-suite result path. Without restoration, the next strict gate can report false unverified-acceptance findings. + ## Trade-off + Report preservation holds existing report bytes for the scoped run; restoration failures block instead of leaving misleading evidence. + test_refs: [tests/stages/spec-conformance.test.ts, tests/stages/toolchain/gate-config.test.ts] diff --git a/spec/features/ssot-governance-d12edf.yaml b/spec/features/ssot-governance-d12edf.yaml index e832d243..a3f5bfc6 100644 --- a/spec/features/ssot-governance-d12edf.yaml +++ b/spec/features/ssot-governance-d12edf.yaml @@ -41,9 +41,10 @@ acceptance_criteria: - id: AC-003 ears: ubiquitous action: resolve the spec/capabilities.yaml orphan by introducing the CAPABILITIES_FEATURE_MAPPING detector so the Tier B artifact gains an actual consumer - response: 'src/stages/detectors/capabilities-feature-mapping.ts exports a detector that loads spec/capabilities.yaml and spec.yaml, then emits error findings for capability features[] entries that reference a non-existent feature id, graduated info-to-warn findings for capabilities whose features[] is empty or missing (informational below eight features, warning once grown), and info findings for spec.yaml features that no capability claims; detector skips silently when capabilities.yaml is missing or capabilities array is empty (adoption hasn`t reached this artifact yet); registered in src/stages/detectors/index.ts (24 → 25 detectors)' + response: 'src/stages/detectors/capabilities-feature-mapping.ts exports a detector that loads spec/capabilities.yaml and spec.yaml, then emits error findings for capability features[] entries that reference a non-existent feature id, keeps the established warning for unbound capabilities, relaxes only Cladding-authored onboarding seeds to information below eight features, and emits info findings for spec.yaml features that no capability claims; detector skips silently when capabilities.yaml is missing or capabilities array is empty (adoption hasn`t reached this artifact yet); registered in src/stages/detectors/index.ts (24 → 25 detectors)' text: The system shall resolve the spec/capabilities.yaml orphan by introducing the CAPABILITIES_FEATURE_MAPPING detector so the Tier B artifact gains an actual consumer. test_refs: [tests/stages/capabilities-feature-mapping.test.ts] + notes: "The optional project.onboarding_seeded marker scopes the maturity grace to generated future intent; missing markers retain the established warning behavior." - id: AC-004 ears: ubiquitous action: close the docs/project-context.md ↔ spec/scenarios loop by extending intent-aware onboarding to extract user-journey scenarios from the project-context prose diff --git a/spec/features/ts-toolchain-jest-and-multiext-arch-47b8bee5.yaml b/spec/features/ts-toolchain-jest-and-multiext-arch-47b8bee5.yaml index 69672f2d..5ab87a44 100644 --- a/spec/features/ts-toolchain-jest-and-multiext-arch-47b8bee5.yaml +++ b/spec/features/ts-toolchain-jest-and-multiext-arch-47b8bee5.yaml @@ -19,6 +19,16 @@ acceptance_criteria: response: "legacy config-less projects behave exactly as before while explicit custom runners remain authoritative" text: "When no jest config and no custom test script is present in a detected TypeScript/JavaScript project, the system shall keep the vitest `run` test and `run --coverage` defaults unchanged." test_refs: ["tests/stages/toolchain.test.ts"] + - id: AC-4f0c9d + ears: event + condition: "when a TypeScript or JavaScript project declares a non-canonical test script or an explicit coverage script" + action: "run those project-owned workflows instead of substituting an inferred test runner, and omit coverage when neither a script nor supported runner coverage is available" + response: "Node's built-in test runner and other custom workflows remain authoritative without creating a false optional coverage gate" + text: "When a TypeScript or JavaScript project declares a custom test or coverage workflow, the system shall run the project-owned script before inferred ecosystem defaults and shall leave unsupported optional coverage unregistered." + notes: | + This general toolchain rule was isolated from onboarding handoff work so + its ownership and compatibility boundary are explicit for every project. + test_refs: ["tests/stages/toolchain.test.ts"] - id: AC-3a899053 ears: ubiquitous action: "configure the architecture (madge --circular) gate to scan .ts, .tsx, .js, and .jsx source files" diff --git a/spec/features/vacuous-test-guard-b81d203e.yaml b/spec/features/vacuous-test-guard-b81d203e.yaml index 3fbc8750..93c3e7a8 100644 --- a/spec/features/vacuous-test-guard-b81d203e.yaml +++ b/spec/features/vacuous-test-guard-b81d203e.yaml @@ -49,3 +49,4 @@ acceptance_criteria: condition: "if a successful test command definitively reports zero executed tests" response: "emit a blocking VACUOUS_TESTS finding under strict mode" text: "If a successful test command definitively reports zero executed tests, the system shall emit a blocking VACUOUS_TESTS finding under strict mode." + notes: "This runner-independent aggregate guard owns the zero-test case discovered during onboarding handoff verification; it is not scoped to initialized projects." diff --git a/spec/index.yaml b/spec/index.yaml index 1b9255ef..77034cdf 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -94,7 +94,7 @@ features: F-0e84628e: {slug: merge-ritual-docs, status: done, modules: 2} F-0ed2db: {slug: ai-hints-consumer-instructions, status: done, modules: 11} F-0f2984d0: {slug: infer-deps-dynamic-flag, status: done, modules: 2} - F-0f4dd6: {slug: natural-language-init, status: in_progress, modules: 26} + F-0f4dd6: {slug: natural-language-init, status: done, modules: 29} F-10cc42d1: {slug: git-op-write-guard, status: done, modules: 5} F-12d740: {slug: atomic-ac-evidence-fanout, status: done, modules: 1} F-15999130: {slug: inferable-depends-on-detector, status: done, modules: 2} @@ -136,7 +136,7 @@ features: F-4db939: {slug: ab-evaluation, status: done, modules: 9} F-4ef09f38: {slug: multi-probe-smoke, status: done, modules: 3} F-50ff43: {slug: meta-integrity-skip-when-absent, status: done, modules: 2} - F-5283985e: {slug: host-smoke-matrix, status: done, modules: 3} + F-5283985e: {slug: host-smoke-matrix, status: done, modules: 5} F-551a1c: {slug: oracle-cost-lever, status: done, modules: 4} F-569f4b37: {slug: graph-export-viz, status: done, modules: 5} F-56abaa: {slug: intent-aware-init, status: done, modules: 5} @@ -195,7 +195,7 @@ features: F-aee1da: {slug: scan-residuals, status: done, modules: 3} F-aee61f: {slug: scan-roots-from-architecture, status: done, modules: 1} F-af45042a: {slug: graph-live-health, status: done, modules: 5} - F-af96b1: {slug: no-vacuous-green-gate-contract, status: done, modules: 6} + F-af96b1: {slug: no-vacuous-green-gate-contract, status: done, modules: 14} F-b010427b: {slug: detector-layer-purity, status: done, modules: 2} F-b0c8ba2c: {slug: gate-no-progress, status: done, modules: 1} F-b0f898a6: {slug: attestation-v2-per-module, status: done, modules: 3} @@ -218,7 +218,7 @@ features: F-c2c996: {slug: checkpoint-events, status: done, modules: 3} F-c3747d7d: {slug: spec-first-window-complete, status: done, modules: 5} F-c48eb2: {slug: scan-source-roots, status: done, modules: 5} - F-c4c5ae: {slug: spec-conformance-oracle-stage, status: done, modules: 8} + F-c4c5ae: {slug: spec-conformance-oracle-stage, status: done, modules: 11} F-c58263b8: {slug: code-compact, status: done, modules: 12} F-c6a32fff: {slug: graph-honest-fallback, status: done, modules: 7} F-c6c3daaf: {slug: kotlin-module-scoped-gate, status: done, modules: 13} diff --git a/src/cli/clad.ts b/src/cli/clad.ts index 27e880d0..933c6eed 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -391,7 +391,7 @@ export function runRollbackCommand(featureId: string, opts: {reason?: string} = /** Handler for `clad setup`. Activates Cladding only for one project. */ export async function runSetupCommand(opts: {force?: boolean; quiet?: boolean; project?: string; host?: string}): Promise { const hosts = opts.host && opts.host !== 'all' - ? [opts.host as 'claude' | 'codex' | 'antigravity' | 'cursor'] + ? [opts.host as 'claude' | 'codex' | 'gemini' | 'antigravity' | 'cursor'] : undefined; const result = await runHostSetup({ force: opts.force, @@ -405,7 +405,7 @@ export async function runSetupCommand(opts: {force?: boolean; quiet?: boolean; p /** * Handler for `clad update`. The one-command "after you upgraded the engine" * step, run from INSIDE the project you want to reconcile: refresh its host - * wiring + reconcile the spec inventory + refresh the managed AGENTS.md section + * wiring + reconcile the spec inventory + refresh the managed CLAUDE.md/AGENTS.md section * (all safe + idempotent — see cli/update.ts), THEN run the now-stricter * detectors in REPORT mode. The drift report never blocks and never edits the * user's spec — it only surfaces the bar the upgrade raised, so `clad update` @@ -431,6 +431,7 @@ export async function runUpdateCommand(): Promise { } else { pulse('pass', 'spec', `inventory synced · ${r.features} features`); } + pulse(r.claudeMd === 'refreshed-stale' ? 'note' : 'pass', 'CLAUDE.md', r.claudeMd); pulse(r.agentsMd === 'refreshed-stale' ? 'note' : 'pass', 'AGENTS.md', r.agentsMd); for (const d of r.deprecations) pulse('note', 'deprecated', d); // Surface what the now-stricter detectors flag — REPORT only, never blocks. @@ -1075,16 +1076,16 @@ export function createProgram(): Command { program .command('setup') - .description('Activate Cladding only for the current project (Claude Code / Codex / Antigravity / Cursor)') + .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 all hosts (default) or one of: claude, codex, antigravity, cursor', 'all') + .option('--host ', 'activate all hosts (default) or one of: claude, codex, gemini, antigravity, cursor', 'all') .option('--force', 'replace an existing conflicting cladding-owned project entry') .option('--quiet', 'suppress stdout output') .action(runSetupCommand); program .command('update') - .description('Run from a project dir AFTER `npm update -g cladding`: refresh project host wiring + sync inventory + refresh AGENTS.md, then report stricter detector findings') + .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(runUpdateCommand); program @@ -1261,7 +1262,7 @@ export function createProgram(): Command { .description('Summarise .cladding/events.log.jsonl — sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)') .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 / Antigravity / Codex / Cursor) and project wiring → dated artifact + docs/dogfood/matrix.md. Live LLM prompts run only with consent (CLAD_HOST_SMOKE=1 or --yes); otherwise not-run') + .option('--hosts', 'smoke-test host CLIs (Claude Code / Gemini / Antigravity / Codex / Cursor) and project wiring → 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((opts) => { diff --git a/src/cli/doctor-hosts.ts b/src/cli/doctor-hosts.ts index 834d969a..98bb2e70 100644 --- a/src/cli/doctor-hosts.ts +++ b/src/cli/doctor-hosts.ts @@ -1,12 +1,11 @@ // Cladding · `clad doctor --hosts` — host-support smoke matrix (F-5283985e) // -// Host verification used to be two hand-written dogfood docs pinned to v0.3.x -// (docs/dogfood/claude-code-2026-05-20.md) — five minor versions -// stale, with Codex deferred and Cursor once over-claimed in the README table. +// Host verification used to rely on hand-written dogfood docs that could go +// stale, leave supported hosts deferred, or over-claim a README table row. // This module makes every host-support claim trace to a DATED, machine-produced // smoke artifact instead of prose: // -// • runHostSmoke — probes claude / agy / codex / cursor-agent CLIs (≤3 canned +// • runHostSmoke — probes claude / gemini / agy / codex / cursor-agent CLIs (≤3 canned // one-shot prompts each), recording per-host // pass / fail / not-run with the observed sentinel evidence. // • renderHostMatrix — pure renderer → docs/dogfood/matrix.md. @@ -26,7 +25,7 @@ import {homedir, platform} from 'node:os'; import {join} from 'node:path'; import process from 'node:process'; -import {getCurrentCladdingVersion} from '../init/host-setup.js'; +import {GEMINI_DOCTOR_POLICY_RELATIVE, getCurrentCladdingVersion} from '../init/host-setup.js'; import {loadSpec} from '../spec/load.js'; import {pulse} from '../ui/pulse.js'; @@ -44,7 +43,7 @@ export type SurfaceResultKind = 'pass' | 'fail' | 'not-run'; export type HostGrade = 'verified' | 'fail' | 'not-run' | 'wiring-ok' | 'wiring-fail'; /** The prompt-probed CLI hosts (each has a headless one-shot surface). */ -export const PROMPT_HOSTS = ['claude', 'antigravity', 'codex', 'cursor'] as const; +export const PROMPT_HOSTS = ['claude', 'gemini', 'antigravity', 'codex', 'cursor'] as const; export type PromptHost = (typeof PROMPT_HOSTS)[number]; /** Result of matching one surface's output against its sentinel. */ @@ -78,6 +77,7 @@ export interface HostSmokeArtifact { readonly generatedAt: string; readonly hosts: { readonly claude: HostRecord; + readonly gemini: HostRecord; readonly antigravity: HostRecord; readonly codex: HostRecord; readonly cursor: HostRecord; @@ -126,6 +126,15 @@ export function tail(text: string, max = 200): string { * generic feature-id pattern. */ export function parseHostOutput(surface: SurfaceName, text: string, expectedId?: string): SurfaceParse { + const refusal = + /\b(?:MCP|tool|clad_[a-z0-9_]+)(?:\s+tool)?(?:\s+calls?)?[^.\n]{0,80}\b(?:rejected|denied|refused|cancelled|canceled|not approved)\b|\buser cancelle?d MCP tool call\b|\bno tool payload\b|\bdon't have a findings count\b|\bre-approve the cladding MCP tool\b/i; + if (refusal.test(text)) { + return { + result: 'fail', + sentinel: SURFACE_SENTINELS[surface].label, + evidence: tail(text), + }; + } let pattern = SURFACE_SENTINELS[surface].pattern; let label = SURFACE_SENTINELS[surface].label; if (surface === 'get-feature' && expectedId) { @@ -164,6 +173,7 @@ export const SURFACE_PROMPTS: Readonly strin /** * How each host CLI runs a single non-interactive prompt: * - claude → `claude -p "" --output-format text` + * - gemini → `gemini --skip-trust --approval-mode plan --policy -o text -p ""` * - antigravity → `agy --new-project -p ""` * - codex → `codex exec ""` (Codex's non-interactive one-shot analog) * - cursor → `cursor-agent -p --mode ask --trust --approve-mcps ""` @@ -172,6 +182,23 @@ export function buildPromptCommand(host: PromptHost, prompt: string): {command: switch (host) { case 'claude': return {command: 'claude', args: ['-p', prompt, '--output-format', 'text']}; + case 'gemini': + return { + command: 'gemini', + args: [ + '--skip-trust', + '--approval-mode', + 'plan', + '--policy', + GEMINI_DOCTOR_POLICY_RELATIVE, + '--allowed-mcp-server-names', + 'cladding', + '-o', + 'text', + '-p', + prompt, + ], + }; case 'antigravity': return {command: 'agy', args: ['--new-project', '-p', prompt]}; case 'codex': @@ -375,8 +402,8 @@ function probePromptHost( } if (r.code !== 0) { // Exit-code gate — a crashed/refused CLI can never pass, no matter what - // its output text accidentally matches (first live run: gemini 0.42.0 - // crashed with exit 1 and the trace still matched a loose sentinel). + // its output text accidentally matches (a live host crash once emitted a + // trace that still matched a loose sentinel). surfaces.push({ name, result: 'fail', @@ -478,6 +505,7 @@ export function runHostSmoke(cwd: string, opts: HostSmokeOptions = {}): HostSmok generatedAt: now.toISOString(), hosts: { claude: promptRecords.claude, + gemini: promptRecords.gemini, antigravity: promptRecords.antigravity, codex: promptRecords.codex, cursor, @@ -493,6 +521,7 @@ export function runHostSmoke(cwd: string, opts: HostSmokeOptions = {}): HostSmok export function matrixGradesFence(artifact: HostSmokeArtifact): string { const grades = { claude: artifact.hosts.claude.grade, + gemini: artifact.hosts.gemini.grade, antigravity: artifact.hosts.antigravity.grade, codex: artifact.hosts.codex.grade, cursor: artifact.hosts.cursor.grade, @@ -526,6 +555,7 @@ export function renderHostMatrix(artifact: HostSmokeArtifact): string { const promptRow = (name: string, r: HostRecord): string => `| ${name} | ${surfaceCell(r, 'list-features')} | ${surfaceCell(r, 'get-feature')} | ${surfaceCell(r, 'run-check')} | — | ${r.grade} |`; lines.push(promptRow('claude', hosts.claude)); + lines.push(promptRow('gemini', hosts.gemini)); lines.push(promptRow('antigravity', hosts.antigravity)); lines.push(promptRow('codex', hosts.codex)); lines.push( @@ -633,6 +663,7 @@ export function readNewestArtifact(cwd: string): HostSmokeArtifact | null { generatedAt: parsed.generatedAt, hosts: { claude, + gemini: parsed.hosts.gemini ?? fallback, antigravity: parsed.hosts.antigravity ?? fallback, codex, cursor, @@ -694,7 +725,7 @@ export function runDoctorHosts(opts: DoctorHostsOptions = {}): void { : 'no live-run consent — LLM surfaces recorded not-run (set CLAD_HOST_SMOKE=1 to probe)', ); process.stdout.write( - ` claude: ${g.claude.grade} antigravity: ${g.antigravity.grade} ` + + ` claude: ${g.claude.grade} gemini: ${g.gemini.grade} antigravity: ${g.antigravity.grade} ` + `codex: ${g.codex.grade} cursor: ${g.cursor.grade}\n`, ); process.stdout.write(` artifact: ${artifactFile}\n`); diff --git a/src/cli/init.ts b/src/cli/init.ts index 2c83f42e..c6875eed 100644 --- a/src/cli/init.ts +++ b/src/cli/init.ts @@ -200,6 +200,7 @@ function specSeed( const projectLines = [ ` name: ${projectName}`, ` language: ${language}`, + ' onboarding_seeded: true', ]; if (metadata?.description) { projectLines.push(` description: ${quoted(metadata.description)}`); diff --git a/src/cli/update.ts b/src/cli/update.ts index e00e0f92..472ae9c8 100644 --- a/src/cli/update.ts +++ b/src/cli/update.ts @@ -28,7 +28,11 @@ import {existsSync, readFileSync} from 'node:fs'; import {join} from 'node:path'; -import {type AgentsMdResult} from '../init/host-instructions.js'; +import { + type AgentsMdResult, + type ClaudeMdResult, + writeClaudeMdSection, +} from '../init/host-instructions.js'; import {type SpecAgentsMdResult, writeSpecDrivenAgentsMd} from '../init/agents-md.js'; import {computeInventory, writeInventoryToSpecYaml, writeFeatureIndex} from '../spec/inventory.js'; import {gitOperationInProgress} from '../core/git-ops.js'; @@ -48,6 +52,8 @@ export interface UpdateResult { readonly isProject: boolean; /** Count of host channels that failed to wire (0 = clean). */ readonly wiringErrors: number; + /** `writeClaudeMdSection` outcome, or `'n/a'` when not a project. */ + readonly claudeMd: ClaudeMdResult | 'n/a'; /** Spec-driven AGENTS.md outcome (mapped onto AgentsMdResult), or `'n/a'` when not a project. */ readonly agentsMd: AgentsMdResult | 'n/a'; /** Feature count from the freshly-recomputed inventory. */ @@ -94,6 +100,7 @@ export async function runUpdate(cwd: string, deps: UpdateDeps): Promise 0 ? 1 : 0, @@ -111,8 +118,12 @@ export async function runUpdate(cwd: string, deps: UpdateDeps): Promise 0 ? 1 : 0, diff --git a/src/init/host-setup.ts b/src/init/host-setup.ts index 5714de94..1d95453e 100644 --- a/src/init/host-setup.ts +++ b/src/init/host-setup.ts @@ -18,7 +18,7 @@ import { writeFileSync, } from 'node:fs'; import {homedir, platform} from 'node:os'; -import {dirname, isAbsolute, join, relative, resolve} from 'node:path'; +import {basename, dirname, isAbsolute, join, relative, resolve} from 'node:path'; import {fileURLToPath} from 'node:url'; import {spawnSync} from 'node:child_process'; @@ -32,10 +32,11 @@ export type ChannelResult = | 'manual-required' | 'failed'; -export type SetupHost = 'claude' | 'codex' | 'antigravity' | 'cursor'; +export type SetupHost = 'claude' | 'codex' | 'gemini' | 'antigravity' | 'cursor'; export interface HostDetection { readonly claude: boolean; + readonly gemini: boolean; readonly antigravity: boolean; readonly codex: boolean; readonly agents: boolean; @@ -49,11 +50,13 @@ export interface SetupResult { readonly shared_init_skill: ChannelResult; readonly claude: ChannelResult; readonly codex: ChannelResult; + readonly gemini: ChannelResult; readonly antigravity: ChannelResult; readonly cursor: ChannelResult; }; readonly legacyCleanup: { readonly claude_plugin: ChannelResult; + readonly gemini_extension: ChannelResult; readonly antigravity_plugin: ChannelResult; readonly codex_skills: ChannelResult; readonly codex_mcp: ChannelResult; @@ -88,7 +91,18 @@ interface SetupStatus { const STATUS_FILENAME = 'setup-status.json'; const RUNTIME_RELATIVE = join('.cladding', 'host', 'serve.cjs'); -const ALL_HOSTS: readonly SetupHost[] = ['claude', 'codex', 'antigravity', 'cursor']; +/** + * Project-local Gemini policy used only by the explicitly consented read-only host smoke. + * + * @see spec/features/host-smoke-matrix-5283985e.yaml AC-4a71e2 + */ +export const GEMINI_DOCTOR_POLICY_RELATIVE = '.cladding/host/gemini-doctor-policy.toml'; +const ALL_HOSTS: readonly SetupHost[] = ['claude', 'codex', 'gemini', 'antigravity', 'cursor']; +const CURSOR_READONLY_MCP_PERMISSIONS = [ + 'Mcp(cladding:clad_list_features)', + 'Mcp(cladding:clad_get_feature)', + 'Mcp(cladding:clad_run_check)', +] as const; function ensureDir(path: string): void { mkdirSync(path, {recursive: true}); @@ -253,6 +267,36 @@ function runtimeBody(pkgRoot: string): string { ].join('\n'); } +/** Allow only the annotated read-only doctor surfaces while Gemini is in Plan Mode. */ +function geminiDoctorPolicyBody(): string { + 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('\n'); +} + /** Keep machine-specific setup state out of a Git worktree without editing the shared .gitignore. */ function ignoreLocalRuntime(projectRoot: string): void { const exclude = join(projectRoot, '.git', 'info', 'exclude'); @@ -278,15 +322,21 @@ function mcpLaunch(): {command: string; args: string[]} { function copyManagedSkill(source: string, destination: string, force: boolean): ChannelResult { if (!existsSync(source)) return 'failed'; + const sourceBody = readText(join(source, 'SKILL.md')); + if (sourceBody == null || !sourceBody.startsWith('---\n')) return 'failed'; + const destinationName = basename(destination); + const expected = /^name:\s*.*$/m.test(sourceBody) + ? sourceBody.replace(/^name:\s*.*$/m, `name: ${destinationName}`) + : sourceBody.replace(/^---\n/, `---\nname: ${destinationName}\n`); if (existsSync(destination)) { const current = readText(join(destination, 'SKILL.md')); - const expected = readText(join(source, 'SKILL.md')); if (current === expected) return 'unchanged'; if (!force && current != null && !current.includes('# Cladding init')) return 'skipped-different'; rmSync(destination, {recursive: true, force: true}); } ensureDir(dirname(destination)); cpSync(source, destination, {recursive: true, dereference: true}); + writeFileSync(join(destination, 'SKILL.md'), expected, 'utf8'); return 'created'; } @@ -307,6 +357,49 @@ function mergeJsonMcp(path: string, launch: {command: string; args: string[]}, f } } +/** Allow only Cladding's read-only doctor tools in project-local Cursor CLI sessions. */ +function mergeCursorCliPermissions(path: string): ChannelResult { + try { + const raw = readText(path); + const doc = raw == null ? {} : (JSON.parse(raw) as Record); + const currentPermissions = doc.permissions; + if ( + currentPermissions !== undefined && + (typeof currentPermissions !== 'object' || currentPermissions === null || Array.isArray(currentPermissions)) + ) { + return 'skipped-different'; + } + const permissions = (currentPermissions ?? {}) as Record; + const currentAllow = permissions.allow; + if ( + currentAllow !== undefined && + (!Array.isArray(currentAllow) || currentAllow.some((entry) => typeof entry !== 'string')) + ) { + return 'skipped-different'; + } + const currentDeny = permissions.deny; + if ( + currentDeny !== undefined && + (!Array.isArray(currentDeny) || currentDeny.some((entry) => typeof entry !== 'string')) + ) { + return 'skipped-different'; + } + const allow = (currentAllow ?? []) as string[]; + const deny = (currentDeny ?? []) as string[]; + const nextAllow = [...allow]; + for (const permission of CURSOR_READONLY_MCP_PERMISSIONS) { + if (!nextAllow.includes(permission)) nextAllow.push(permission); + } + if (nextAllow.length === allow.length && currentDeny !== undefined) return 'unchanged'; + permissions.allow = nextAllow; + permissions.deny = deny; + doc.permissions = permissions; + return writeIfChanged(path, `${JSON.stringify(doc, null, 2)}\n`); + } catch { + return 'failed'; + } +} + async function mergeCodexMcp(path: string, launch: {command: string; args: string[]}, force: boolean): Promise { try { const {parse, stringify} = await import('smol-toml'); @@ -315,7 +408,12 @@ async function mergeCodexMcp(path: string, launch: {command: string; args: strin if (!doc.mcp_servers || typeof doc.mcp_servers !== 'object') doc.mcp_servers = {}; const servers = doc.mcp_servers as Record; const current = servers.cladding; - const next = {command: launch.command, args: launch.args, description: 'cladding MCP server (project-scoped by `clad setup`)'}; + const next = { + command: launch.command, + args: launch.args, + description: 'cladding MCP server (project-scoped by `clad setup`)', + default_tools_approval_mode: 'writes', + }; if (JSON.stringify(current) === JSON.stringify(next)) return 'unchanged'; if (current && !force && !isKnownLaunch(current, [])) return 'skipped-different'; servers.cladding = next; @@ -383,9 +481,17 @@ export async function runHostSetup(opts: SetupOptions = {}): Promise { const loaded = loadSpecOrError(cwd); @@ -933,6 +934,7 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp id: z.string().optional().describe('Feature id such as "F-049" or "F-a3f9c2"'), slug: z.string().optional().describe("Feature slug such as 'login-flow'"), }, + annotations: {readOnlyHint: true, destructiveHint: false, idempotentHint: true}, }, async (args) => { if (!args.id && !args.slug) { @@ -977,6 +979,7 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp strict: z.boolean().optional().describe('Treat warnings as errors when true'), verbose: z.boolean().optional().describe('Return the full report (all findings incl. info + suggestions) instead of the terse top-3 summary'), }, + annotations: {readOnlyHint: true, destructiveHint: false, idempotentHint: true}, }, async (args) => { const result = runDrift({strict: args.strict, cwd}); @@ -1497,8 +1500,9 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp 'spec/architecture.yaml', 'spec/capabilities.yaml', 'docs/project-context.md', ])).min(1), }), - ]).describe( - 'Required design-impact decision. Structural changes remain review_required and block clad done until resolved.', + ]).optional().describe( + 'Optional design-impact decision. Omit for the legacy-compatible create-only path; ' + + 'structural changes remain review_required until resolved.', ), }, }, @@ -1513,14 +1517,18 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp status: args.status, modules: args.modules, acceptance_criteria: args.acceptance_criteria, - design_impact: { - classification: args.design_impact.classification, - rationale: args.design_impact.rationale, - artifacts: args.design_impact.classification === 'structural' ? args.design_impact.artifacts : undefined, - }, + design_impact: args.design_impact + ? { + classification: args.design_impact.classification, + rationale: args.design_impact.rationale, + artifacts: args.design_impact.classification === 'structural' + ? args.design_impact.artifacts + : undefined, + } + : undefined, cwd, }); - if (args.design_impact.classification === 'additive') { + if (args.design_impact?.classification === 'additive') { linkCapability({ capability: args.design_impact.capability, feature: result.id, @@ -1534,14 +1542,27 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp syncInventory(cwd); // Non-mutating firing-path nudge: travels as a `hint` FIELD (keeps the // payload valid JSON), never a silent write to capabilities.yaml. + const designImpact = args.design_impact; const withHint = { schema_version: PAYLOAD_SCHEMA_VERSION, ...result, gate: gateFooter(cwd), - designImpact: args.design_impact.classification === 'structural' - ? {status: 'review_required', artifacts: args.design_impact.artifacts, - next: 'Preview and apply the listed Tier-B design changes, then call clad_resolve_design_impact.'} - : {status: 'resolved', classification: args.design_impact.classification}, + ...(designImpact + ? { + designImpact: designImpact.classification === 'structural' + ? { + status: 'review_required', + artifacts: designImpact.artifacts, + next: 'Preview and apply the listed Tier-B design changes, then call clad_resolve_design_impact.', + } + : {status: 'resolved', classification: designImpact.classification}, + } + : { + hint: + 'If this feature is user-facing, link it to a capability with clad_link_capability ' + + `(capability: , feature: ${result.id}) so the Tier-B design SSoT grows with ` + + 'development instead of being left an empty seed.', + }), }; return { content: [{type: 'text', text: JSON.stringify(withHint, null, 2)}], diff --git a/src/spec/new.ts b/src/spec/new.ts index 26bc6b67..c337af49 100644 --- a/src/spec/new.ts +++ b/src/spec/new.ts @@ -76,7 +76,7 @@ export interface CreateFeatureOptions { readonly modules?: readonly string[]; /** Acceptance criteria authored at creation. Omitted → `acceptance_criteria: []`. */ readonly acceptance_criteria?: readonly AcceptanceCriterionInput[]; - /** Durable Tier-B impact decision. Required by the public MCP authoring path. */ + /** Optional durable Tier-B impact decision for hosts that support the richer authoring path. */ readonly design_impact?: { readonly classification: 'none' | 'additive' | 'structural'; readonly rationale: string; diff --git a/src/spec/schema.json b/src/spec/schema.json index 5e6d3559..6092fd53 100644 --- a/src/spec/schema.json +++ b/src/spec/schema.json @@ -18,6 +18,10 @@ "properties": { "name": {"type": "string", "minLength": 1}, "language": {"type": "string", "minLength": 1}, + "onboarding_seeded": { + "type": "boolean", + "description": "True only when Cladding init authored the initial governance seeds. Used to scope early-project advisory findings without changing legacy-project behavior." + }, "description": { "type": "string", "description": "One-line summary of what the project is for. Used as the spec.yaml 'front door' hint." diff --git a/src/spec/types.ts b/src/spec/types.ts index aea70d90..50475141 100644 --- a/src/spec/types.ts +++ b/src/spec/types.ts @@ -300,6 +300,12 @@ export interface SmokeProbe { export interface Project { readonly name: string; readonly language: string; + /** + * True only for workspaces scaffolded by Cladding onboarding. Detectors use + * this durable marker to distinguish intentional future-design seeds from + * empty governance in legacy or hand-authored projects. + */ + readonly onboarding_seeded?: boolean; /** * One-line summary of what the project is for. Renders as the * spec.yaml "front door" hint. Optional — kept opt-in so legacy diff --git a/src/stages/cov.ts b/src/stages/cov.ts index 3753d933..7b7afff5 100644 --- a/src/stages/cov.ts +++ b/src/stages/cov.ts @@ -46,7 +46,7 @@ export function runCov(opts: CommandStageOptions = {}): StageResult { const proc = shared ? shared.proc : execaSync(cmd, [...args], {cwd, reject: false}); // execaSync(reject:false) RETURNS (does not throw) on a missing binary; // detect ENOENT on the result so a missing tool skips, not false-fails. - const skip = missingToolSkip(STAGE, cmd, proc); + const skip = missingToolSkip(STAGE, cmd, proc, args); if (skip) return skip; // The tool RAN. Map its result to cladding's pass/fail/skip contract: // any non-zero exit → blocking fail (1), never the tool's raw 2 (= skip). diff --git a/src/stages/detectors/capabilities-feature-mapping.ts b/src/stages/detectors/capabilities-feature-mapping.ts index 6a80325c..fa697181 100644 --- a/src/stages/detectors/capabilities-feature-mapping.ts +++ b/src/stages/detectors/capabilities-feature-mapping.ts @@ -17,8 +17,8 @@ // 2. **Orphan capability (graduated)** — a capability whose `features[]` // is empty (or missing) is not yet bound to any feature. Intent-aware // onboarding deliberately emits future capability seeds before features -// land, so the finding is info while a project is small and graduates to -// warn at the shared eight-feature maturity boundary. +// land. An explicit onboarding marker scopes information-level grace to +// those seeds; every unmarked project retains the warning at any size. // // 3. **Unmapped feature (info)** — a feature in spec.yaml that no // capability claims via its `features[]`. Acceptable for @@ -45,7 +45,7 @@ import type {CommandStageOptions, DriftDetector, DriftFinding} from '../types.js const NAME = 'CAPABILITIES_FEATURE_MAPPING'; -/** Shared maturity boundary: below this count onboarding design is still expected to be ahead of implementation. */ +/** Shared maturity boundary for explicitly marked onboarding design seeds. */ export const DEFAULT_MIN_FEATURES_FOR_CAPABILITY_BINDINGS = 8; interface CapabilityEntry { @@ -83,9 +83,11 @@ function run(opts: CommandStageOptions): readonly DriftFinding[] { // separately; CAPABILITIES_FEATURE_MAPPING just exits silently when it // cannot load. let featureIds: Set; + let onboardingSeeded = false; try { const spec = loadSpec(cwd); featureIds = new Set(spec.features.map((f) => f.id)); + onboardingSeeded = spec.project.onboarding_seeded === true; } catch { // Load-failure policy (see detectors/with-spec.ts): within-spec-validity // detector — no spec means no capability↔feature links to validate; @@ -95,7 +97,8 @@ function run(opts: CommandStageOptions): readonly DriftFinding[] { const findings: DriftFinding[] = []; const featuresClaimedByCapabilities = new Set(); - const isGrown = featureIds.size >= DEFAULT_MIN_FEATURES_FOR_CAPABILITY_BINDINGS; + const onboardingGrace = + onboardingSeeded && featureIds.size < DEFAULT_MIN_FEATURES_FOR_CAPABILITY_BINDINGS; for (const cap of capabilities) { if (typeof cap !== 'object' || cap === null) continue; @@ -105,13 +108,13 @@ function run(opts: CommandStageOptions): readonly DriftFinding[] { if (features.length === 0) { findings.push({ detector: NAME, - severity: isGrown ? 'warn' : 'info', + severity: onboardingGrace ? 'info' : 'warn', path: 'spec/capabilities.yaml', - message: isGrown - ? `capability "${capId}" has no features mapped — bind at least one feature via the features[] field, ` + - `or remove the capability if it's no longer relevant` - : `capability "${capId}" has no features mapped yet — retained as future onboarding intent; ` + - `bind it when a matching feature lands`, + message: onboardingGrace + ? `capability "${capId}" has no features mapped yet — retained as future onboarding intent; ` + + `bind it when a matching feature lands` + : `capability "${capId}" has no features mapped — bind at least one feature via the features[] field, ` + + `or remove the capability if it's no longer relevant`, }); continue; } diff --git a/src/stages/detectors/deliverable-integrity.ts b/src/stages/detectors/deliverable-integrity.ts index d07534ef..13524848 100644 --- a/src/stages/detectors/deliverable-integrity.ts +++ b/src/stages/detectors/deliverable-integrity.ts @@ -4,8 +4,9 @@ // — it NEVER executes anything (that is the stage's job). Two checks, done-only: // - project.deliverable.path declared but ABSENT on disk → error (blocking): a // project that has shipped a `done` feature must have its declared entry present. -// - done features ship modules[] but NO project.deliverable is declared → info -// before the shared eight-feature maturity boundary, warn after it: +// - done features ship modules[] but NO project.deliverable is declared → warn, +// with info-level grace only for explicitly marked onboarding seeds before +// the shared eight-feature maturity boundary: // the gate cannot smoke-test the shipped entry, so a broken entry could ship // green (the Mini-Lang S5 failure). The graduated signal keeps early // domain/library slices completable while ensuring a grown project's omitted @@ -23,7 +24,7 @@ import {withSpec} from './with-spec.js'; const NAME = 'DELIVERABLE_INTEGRITY'; -/** Shared maturity scale: early domain/library slices need not expose an entry yet. */ +/** Shared maturity boundary for explicitly marked onboarding slices. */ export const DEFAULT_MIN_FEATURES_FOR_DELIVERABLE = 8; function runDeliverableIntegrity(opts: CommandStageOptions): readonly DriftFinding[] { @@ -36,10 +37,13 @@ function detect(spec: Spec, cwd: string): readonly DriftFinding[] { const doneWithModules = spec.features.filter((f) => f.status === 'done' && (f.modules?.length ?? 0) > 0); if (!deliverable) { if (doneWithModules.length === 0) return []; + const onboardingGrace = + spec.project.onboarding_seeded === true && + spec.features.length < DEFAULT_MIN_FEATURES_FOR_DELIVERABLE; return [ { detector: NAME, - severity: spec.features.length >= DEFAULT_MIN_FEATURES_FOR_DELIVERABLE ? 'warn' : 'info', + severity: onboardingGrace ? 'info' : 'warn', message: `${doneWithModules.length} done feature(s) ship modules but project.deliverable is not declared — ` + 'the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. ' + diff --git a/src/stages/detectors/scenario-coverage.ts b/src/stages/detectors/scenario-coverage.ts index 87b90327..6fa50255 100644 --- a/src/stages/detectors/scenario-coverage.ts +++ b/src/stages/detectors/scenario-coverage.ts @@ -13,8 +13,8 @@ // flows is under-specified. (status-blind on total feature count, like // HOLLOW_GOVERNANCE — the gap appeared on all-`done` builds.) // 2. GRADUATED HOLLOW — onboarding intentionally creates future journeys with -// empty `features[]`. Report them as info while the project is small, then -// warn at the same maturity threshold used by the no-scenarios check. +// empty `features[]`. Explicitly marked seeds are info while small, then +// warn at the maturity threshold; unmarked projects always retain warn. // 3. UNDER-BOUND — a scenario whose `flow` names a feature by its slug (the // `(feature-slug)` convention) that it doesn't bind in `features[]`, so its // declared coverage under-states the flow it walks. Exact-slug match only, so @@ -31,7 +31,7 @@ import {withSpec} from './with-spec.js'; const NAME = 'SCENARIO_COVERAGE'; -/** Below this feature count a project may legitimately have no scenarios yet. */ +/** Below this count explicitly marked onboarding scenarios receive grace. */ export const DEFAULT_MIN_FEATURES_FOR_SCENARIOS = 8; function runScenarioCoverage(opts: CommandStageOptions): readonly DriftFinding[] { @@ -44,6 +44,7 @@ function detect(spec: Spec): readonly DriftFinding[] { const featureCount = spec.features.length; const scenarios = spec.scenarios ?? []; const isGrown = featureCount >= DEFAULT_MIN_FEATURES_FOR_SCENARIOS; + const onboardingGrace = spec.project.onboarding_seeded === true && !isGrown; // 1. Grown project with no cross-feature flows captured. if (featureCount >= DEFAULT_MIN_FEATURES_FOR_SCENARIOS && scenarios.length === 0) { @@ -57,19 +58,19 @@ function detect(spec: Spec): readonly DriftFinding[] { }); } - // 2. An empty onboarding scenario is future design until the project grows; - // after that boundary the same unresolved link is blocking under --strict. + // 2. A marked empty onboarding scenario is future design until the project + // grows; unmarked scenarios preserve the established strict-mode warning. for (const s of scenarios) { if ((s.features ?? []).length === 0) { findings.push({ detector: NAME, - severity: isGrown ? 'warn' : 'info', + severity: onboardingGrace ? 'info' : 'warn', path: 'spec/scenarios/', - message: isGrown - ? `scenario ${s.id} binds no features (features: []) — a grown project's scenario must cover at least ` + - "one feature's flow, or it should be removed." - : `scenario ${s.id} binds no features yet — retained as future onboarding intent; ` + - 'bind it when a matching feature lands.', + message: onboardingGrace + ? `scenario ${s.id} binds no features yet — retained as future onboarding intent; ` + + 'bind it when a matching feature lands.' + : `scenario ${s.id} binds no features (features: []) — a scenario must cover at least ` + + "one feature's flow, or it should be removed.", }); } } diff --git a/src/stages/detectors/unverified-ac.ts b/src/stages/detectors/unverified-ac.ts index 6de2abbb..adff630e 100644 --- a/src/stages/detectors/unverified-ac.ts +++ b/src/stages/detectors/unverified-ac.ts @@ -18,38 +18,25 @@ // - a test_ref ABSENT from a present report → `warn` (a partial/scoped run is // legitimate; --strict promotes it). Status policy: done features only. -import {existsSync, readFileSync} from 'node:fs'; -import {join} from 'node:path'; +import {readFileSync} from 'node:fs'; import type {Spec} from '../../spec/types.js'; import {parseJUnitReport, lookupTestRef, isPathLike, type JUnitReport} from '../junit-report.js'; -import {readGateConfig} from '../toolchain/gate-config.js'; +import {resolveTestReportPath} from '../toolchain/gate-config.js'; import type {CommandStageOptions, DriftDetector, DriftFinding} from '../types.js'; import {withSpec} from './with-spec.js'; const NAME = 'UNVERIFIED_AC'; // Same non-file pseudo-refs UNTESTED_AC skips — they carry no observable test. const SKIPPABLE_PREFIXES = ['self-dogfood:', 'fixture:', 'derived:']; -// Tried in order when `gate.test_report` is unset; first existing one wins. -const DEFAULT_REPORT_CANDIDATES = ['test-report.junit.xml', join('coverage', 'junit.xml'), join('.cladding', 'test-report.junit.xml')]; function isSkippable(ref: string): boolean { return SKIPPABLE_PREFIXES.some((p) => ref.startsWith(p)); } -/** Resolve the JUnit report path: explicit config first, then conventions. Null = none present. */ -function resolveReportPath(cwd: string): string | null { - const configured = readGateConfig(cwd).testReport; - if (configured) return existsSync(join(cwd, configured)) ? join(cwd, configured) : null; - for (const candidate of DEFAULT_REPORT_CANDIDATES) { - if (existsSync(join(cwd, candidate))) return join(cwd, candidate); - } - return null; -} - function runUnverifiedAc(opts: CommandStageOptions): readonly DriftFinding[] { const {cwd = '.'} = opts; - const reportPath = resolveReportPath(cwd); + const reportPath = resolveTestReportPath(cwd); if (!reportPath) return []; // graceful skip — no report to verify against let report: JUnitReport; try { diff --git a/src/stages/lint.ts b/src/stages/lint.ts index 3c7ceb80..9c51e235 100644 --- a/src/stages/lint.ts +++ b/src/stages/lint.ts @@ -54,7 +54,7 @@ export function runLint(opts: CommandStageOptions = {}): StageResult { const proc = execaSync(cmd, [...args], {cwd, reject: false}); // execaSync(reject:false) RETURNS (does not throw) on a missing binary; // detect ENOENT on the result so a missing tool skips, not false-fails. - const skip = missingToolSkip(STAGE, cmd, proc); + const skip = missingToolSkip(STAGE, cmd, proc, args); if (skip) return skip; // The tool RAN. Map its result to cladding's pass/fail/skip contract: // any non-zero exit → blocking fail (1), never the tool's raw 2 (= skip). diff --git a/src/stages/perf.ts b/src/stages/perf.ts index aa5134ca..2d83c91c 100644 --- a/src/stages/perf.ts +++ b/src/stages/perf.ts @@ -38,7 +38,7 @@ export function runPerf(opts: CommandStageOptions = {}): StageResult { const proc = execaSync(cmd, [...args], {cwd, reject: false}); // execaSync(reject:false) RETURNS (does not throw) on a missing binary; // detect ENOENT on the result so a missing runner skips, not false-fails. - const skip = missingToolSkip(STAGE, cmd, proc); + const skip = missingToolSkip(STAGE, cmd, proc, args); if (skip) return skip; // The runner RAN. Map its result to cladding's pass/fail/skip contract: // any non-zero exit → blocking fail (1), never the tool's raw 2 (= skip). diff --git a/src/stages/smoke.ts b/src/stages/smoke.ts index 76b9155a..77266e10 100644 --- a/src/stages/smoke.ts +++ b/src/stages/smoke.ts @@ -43,7 +43,7 @@ export function runSmoke(opts: CommandStageOptions = {}): StageResult { const proc = execaSync(cmd, [...args], {cwd, reject: false}); // execaSync(reject:false) RETURNS (does not throw) on a missing binary; // detect ENOENT on the result so a missing runner skips, not false-fails. - const skip = missingToolSkip(STAGE, cmd, proc); + const skip = missingToolSkip(STAGE, cmd, proc, args); if (skip) return skip; // The runner RAN. Map its result to cladding's pass/fail/skip contract: // any non-zero exit → blocking fail (1), never the tool's raw 2 (= skip). diff --git a/src/stages/spec-conformance.ts b/src/stages/spec-conformance.ts index 2265988a..80a397cb 100644 --- a/src/stages/spec-conformance.ts +++ b/src/stages/spec-conformance.ts @@ -18,13 +18,23 @@ // enforced separately by the SPEC_CONFORMANCE drift detector, so this stage // never false-passes by silence — it only reports on oracles that exist. -import {existsSync, readdirSync} from 'node:fs'; +import { + chmodSync, + existsSync, + readFileSync, + readdirSync, + statSync, + unlinkSync, + utimesSync, + writeFileSync, +} from 'node:fs'; import {join} from 'node:path'; import process from 'node:process'; import {execaSync} from 'execa'; import {detectToolchain} from './toolchain/detect.js'; +import {testReportCandidatePaths} from './toolchain/gate-config.js'; import type {CommandStageOptions, StageResult} from './types.js'; import {missingToolSkip, ranToolResult} from './util.js'; @@ -32,6 +42,62 @@ const STAGE = 'stage_2.3'; /** Where spec-derived oracle suites live (relative to project root). */ export const ORACLE_DIR = 'tests/oracle'; +interface TestReportSnapshot { + readonly path: string; + /** Undefined means the candidate did not exist before the scoped run. */ + readonly body?: Buffer; + readonly mode?: number; + readonly atime?: Date; + readonly mtime?: Date; + /** A directory or other non-file candidate is never modified by restoration. */ + readonly nonFile?: boolean; +} + +/** Capture report bytes and observable file metadata before the partial run. */ +function snapshotTestReports(cwd: string): readonly TestReportSnapshot[] { + return testReportCandidatePaths(cwd).map((path) => { + try { + const stat = statSync(path); + if (!stat.isFile()) return {path, nonFile: true}; + return { + path, + body: readFileSync(path), + mode: stat.mode, + atime: stat.atime, + mtime: stat.mtime, + }; + } catch (error) { + if ((error as NodeJS.ErrnoException).code === 'ENOENT') return {path}; + throw error; + } + }); +} + +/** Restore existing reports and remove reports created only by the partial run. */ +function restoreTestReports(snapshots: readonly TestReportSnapshot[]): readonly string[] { + const errors: string[] = []; + for (const snapshot of snapshots) { + if (snapshot.nonFile) continue; + try { + if (snapshot.body === undefined) { + if (!existsSync(snapshot.path)) continue; + if (!statSync(snapshot.path).isFile()) { + errors.push(`${snapshot.path}: scoped oracle run created a non-file report candidate`); + continue; + } + unlinkSync(snapshot.path); + continue; + } + writeFileSync(snapshot.path, snapshot.body); + if (snapshot.mode !== undefined) chmodSync(snapshot.path, snapshot.mode); + if (snapshot.atime && snapshot.mtime) utimesSync(snapshot.path, snapshot.atime, snapshot.mtime); + } catch (error) { + errors.push(`${snapshot.path}: ${(error as Error).message}`); + } + } + return errors; +} + /** True when `dir` contains at least one test/spec file (any nesting depth). */ function hasOracle(dir: string): boolean { let found = false; @@ -60,6 +126,7 @@ function hasOracle(dir: string): boolean { * @param opts - Optional cwd override. * @returns A stage result. * @see stages/detectors/spec-conformance.ts — the presence/provenance guard. + * @see spec/features/spec-conformance-oracle-stage-c4c5ae.yaml AC-008 */ export function runSpecConformance(opts: CommandStageOptions = {}): StageResult { const {cwd = '.'} = opts; @@ -74,8 +141,49 @@ export function runSpecConformance(opts: CommandStageOptions = {}): StageResult } // Point the detected test runner at the oracle dir only (npx vitest run // tests/oracle · pytest tests/oracle · …) — never the agent's own suite. - const proc = execaSync(test.cmd, [...test.args, ORACLE_DIR], {cwd, reject: false}); - const skip = missingToolSkip(STAGE, test.cmd, proc); + // + // A project reporter can write every invocation to one authoritative JUnit + // path. Without isolation, this deliberately-partial oracle run replaces the + // full unit report; the NEXT strict gate then misreads every ordinary test_ref + // as unexecuted. Preserve every configured/conventional report candidate so + // stage_2.3 cannot leak its narrower selection into another stage or run. + let snapshots: readonly TestReportSnapshot[]; + try { + snapshots = snapshotTestReports(cwd); + } catch (error) { + return { + stage: STAGE, + pass: false, + exitCode: 1, + stderr: `could not preserve the full test report before the scoped oracle run: ${(error as Error).message}`, + }; + } + let proc: ReturnType | undefined; + let runError: unknown; + const runArgs = [...test.args, ORACLE_DIR]; + try { + proc = execaSync(test.cmd, runArgs, {cwd, reject: false}); + } catch (error) { + runError = error; + } + const restoreErrors = restoreTestReports(snapshots); + if (restoreErrors.length > 0) { + return { + stage: STAGE, + pass: false, + exitCode: 1, + stderr: `could not restore the full test report after the scoped oracle run: ${restoreErrors.join('; ')}`, + }; + } + if (runError || !proc) { + return { + stage: STAGE, + pass: false, + exitCode: 1, + stderr: `oracle runner failed to start: ${(runError as Error)?.message ?? 'unknown error'}`, + }; + } + const skip = missingToolSkip(STAGE, test.cmd, proc, runArgs); if (skip) return skip; return ranToolResult(STAGE, proc); } diff --git a/src/stages/toolchain/gate-config.ts b/src/stages/toolchain/gate-config.ts index c0591df9..6b0c4a3a 100644 --- a/src/stages/toolchain/gate-config.ts +++ b/src/stages/toolchain/gate-config.ts @@ -52,6 +52,20 @@ export interface GateConfig { const DEFAULT: GateConfig = {scope: 'feature'}; +/** + * Conventional JUnit paths inspected when `gate.test_report` is not explicit. + * + * Kept beside the gate config resolver so the detector that consumes a report + * and any scoped test stage that must preserve it share exactly one path set. + * + * @see spec/features/spec-conformance-oracle-stage-c4c5ae.yaml AC-008 + */ +export const DEFAULT_TEST_REPORT_CANDIDATES = [ + 'test-report.junit.xml', + join('coverage', 'junit.xml'), + join('.cladding', 'test-report.junit.xml'), +] as const; + /** Reads `.cladding/config.yaml::gate`, returning the default on any absence/error. */ export function readGateConfig(cwd: string = '.'): GateConfig { const path = join(cwd, '.cladding', 'config.yaml'); @@ -85,6 +99,44 @@ export function readGateConfig(cwd: string = '.'): GateConfig { } } +/** + * Returns every test-report path a scoped test run must leave untouched. + * + * The explicit `gate.test_report`, when present, is returned first, followed by + * every conventional candidate. A scoped runner can still write its framework + * default in addition to the configured evidence path, so report preservation + * must cover both sets even though the detector consumes only the explicit one. + * + * @param cwd - Project root. + * @returns Absolute-or-cwd-joined report paths in detector precedence order. + * @see spec/features/spec-conformance-oracle-stage-c4c5ae.yaml AC-008 + */ +export function testReportCandidatePaths(cwd: string = '.'): readonly string[] { + const configured = readGateConfig(cwd).testReport; + const candidates = configured + ? [configured, ...DEFAULT_TEST_REPORT_CANDIDATES] + : DEFAULT_TEST_REPORT_CANDIDATES; + return [...new Set(candidates.map((candidate) => join(cwd, candidate)))]; +} + +/** + * Resolves the first existing report using the detector's precedence rules. + * + * @param cwd - Project root. + * @returns The selected report path, or null when no report exists. + * @see spec/features/spec-conformance-oracle-stage-c4c5ae.yaml AC-008 + */ +export function resolveTestReportPath(cwd: string = '.'): string | null { + const configured = readGateConfig(cwd).testReport; + if (configured) { + const path = join(cwd, configured); + return existsSync(path) ? path : null; + } + return DEFAULT_TEST_REPORT_CANDIDATES + .map((candidate) => join(cwd, candidate)) + .find((candidate) => existsSync(candidate)) ?? null; +} + // `{modules:TASK}` — TASK is a Gradle task name (letters/digits/_.:- ). const MODULE_TOKEN = /^\{modules:([A-Za-z0-9_.:-]+)\}$/; diff --git a/src/stages/type.ts b/src/stages/type.ts index 9a195631..b8cf5f61 100644 --- a/src/stages/type.ts +++ b/src/stages/type.ts @@ -58,7 +58,7 @@ export function runType(opts: CommandStageOptions = {}): StageResult { const proc = execaSync(cmd, [...args], {cwd, reject: false}); // execaSync(reject:false) RETURNS (does not throw) on a missing binary; // detect ENOENT on the result so a missing tool skips, not false-fails. - const skip = missingToolSkip(STAGE, cmd, proc); + const skip = missingToolSkip(STAGE, cmd, proc, args); if (skip) return skip; // The tool RAN. Map its result to cladding's pass/fail/skip contract: // any non-zero exit → blocking fail (1), never the tool's raw 2 (= skip). diff --git a/src/stages/unit.ts b/src/stages/unit.ts index bbcabcac..39a60079 100644 --- a/src/stages/unit.ts +++ b/src/stages/unit.ts @@ -105,7 +105,7 @@ function tryReuseSharedRun(opts: UnitStageOptions, cwd: string, guardOn: boolean if (!shared) return null; // cwd mismatch / unprimed → own run const {proc, jsonFile} = shared; // Missing binary → let the own-run path surface the honest skip (exit 2). - if (missingToolSkip(STAGE, covCmd, proc)) return null; + if (missingToolSkip(STAGE, covCmd, proc, baseArgs)) return null; const covResult = ranToolResult(STAGE, proc); if (unitActionFromCoverage(covResult) === 'fallback') return null; // not green → own tests-only run // reuse-pass: the shared run is GREEN. Under --strict the vacuous-test guard @@ -177,7 +177,7 @@ export function runUnit(opts: UnitStageOptions = {}): StageResult { const proc = execaSync(cmd, [...runArgs], {cwd, reject: false}); // execaSync(reject:false) RETURNS (does not throw) on a missing binary; // detect ENOENT on the result so a missing tool skips, not false-fails. - const skip = missingToolSkip(STAGE, cmd, proc); + const skip = missingToolSkip(STAGE, cmd, proc, runArgs); if (skip) return skip; // The tool RAN. Map its result to cladding's pass/fail/skip contract: // any non-zero exit → blocking fail (1), never the tool's raw 2 (= skip). diff --git a/src/stages/util.ts b/src/stages/util.ts index 4dd2226b..b0fec62d 100644 --- a/src/stages/util.ts +++ b/src/stages/util.ts @@ -72,6 +72,19 @@ export function classifyScannerExit( return [{detector, severity: 'error', message: foundMsg(detail)}]; } +/** + * Maps an unavailable command or unresolved offline npx target to a setup gap. + * + * The npx shell-level fallback is bound to the requested executable. A tool + * that starts successfully and then misses one of its own helper commands must + * remain a real failure instead of being hidden as an installation gap. + * + * @param stage - Ironclad stage id for the result. + * @param cmd - Command that was attempted. + * @param proc - Completed process result. + * @param args - Arguments passed to the command, used to identify an npx target. + * @returns A skipped setup-gap result, or null when the command actually ran. + */ export function missingToolSkip( stage: string, cmd: string, @@ -81,13 +94,27 @@ export function missingToolSkip( readonly stdout?: unknown; readonly stderr?: unknown; }, + args: readonly string[] = [], ): StageResult | null { if (isMissingBinary(proc)) { return {stage, pass: false, exitCode: 2, stderr: `'${cmd}' not installed`}; } const output = `${String(proc.stderr ?? '')}\n${String(proc.stdout ?? '')}`; - if (cmd === 'npx' && /ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(output)) { - return {stage, pass: false, exitCode: 2, stderr: `'npx' could not resolve the configured tool without installing it`}; + const npxResolutionFailure = + /ENOTCACHED|ENOTFOUND|EAI_AGAIN|canceled due to missing packages|could not determine executable/i.test(output); + const npxTarget = args.find((arg) => arg !== '--' && !arg.startsWith('-')); + const escapedTarget = npxTarget?.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + const npxShellMissing = proc.exitCode === 127 && escapedTarget !== undefined && + new RegExp(`(?:^|[\\s:])${escapedTarget}: (?:command )?not found\\b`, 'i').test(output); + if (cmd === 'npx' && (npxResolutionFailure || npxShellMissing)) { + return { + stage, + pass: false, + exitCode: 2, + stderr: + "setup gap: 'npx' could not resolve the configured tool without installing it; " + + 'the inferred tool is not installed or unavailable offline', + }; } return null; } diff --git a/src/stages/visual.ts b/src/stages/visual.ts index ecf4c2b7..8fb36ba0 100644 --- a/src/stages/visual.ts +++ b/src/stages/visual.ts @@ -38,7 +38,7 @@ export function runVisual(opts: CommandStageOptions = {}): StageResult { const proc = execaSync(cmd, [...args], {cwd, reject: false}); // execaSync(reject:false) RETURNS (does not throw) on a missing binary; // detect ENOENT on the result so a missing runner skips, not false-fails. - const skip = missingToolSkip(STAGE, cmd, proc); + const skip = missingToolSkip(STAGE, cmd, proc, args); if (skip) return skip; // The runner RAN. Map its result to cladding's pass/fail/skip contract: // any non-zero exit → blocking fail (1), never the tool's raw 2 (= skip). diff --git a/tests/cli/doctor-hosts.test.ts b/tests/cli/doctor-hosts.test.ts index a1a24810..453b5850 100644 --- a/tests/cli/doctor-hosts.test.ts +++ b/tests/cli/doctor-hosts.test.ts @@ -31,6 +31,7 @@ import { type PromptResult, type PromptRunner, type SurfaceName, + buildPromptCommand, matrixGradesFence, parseHostOutput, parseServeToolsList, @@ -96,6 +97,28 @@ describe('parseHostOutput — zero-LLM sentinel matcher against committed transc } }); + test('a host rejection cannot pass by echoing the requested id or findings token', () => { + expect(parseHostOutput( + 'get-feature', + 'Both clad_get_feature MCP calls were rejected. Requested id: F-5283985e', + 'F-5283985e', + ).result).toBe('fail'); + expect(parseHostOutput( + 'run-check', + "Both clad_run_check MCP calls were rejected, so I don't have a findings count to report.", + ).result).toBe('fail'); + expect(parseHostOutput( + 'get-feature', + 'mcp: cladding/clad_get_feature (failed) user cancelled MCP tool call F-5283985e', + 'F-5283985e', + ).result).toBe('fail'); + expect(parseHostOutput( + 'get-feature', + 'F-5283985e (`clad_get_feature` was rejected by the host, so no payload was returned.)', + 'F-5283985e', + ).result).toBe('fail'); + }); + test('empty / whitespace output (timeout garbage) fails, never a silent pass', () => { expect(parseHostOutput('list-features', '').result).toBe('fail'); expect(parseHostOutput('run-check', ' \n\t ').result).toBe('fail'); @@ -115,6 +138,34 @@ describe('parseHostOutput — zero-LLM sentinel matcher against committed transc }); }); +describe('host command construction', () => { + test('Gemini uses its non-interactive project-aware prompt command', () => { + expect(buildPromptCommand('gemini', 'probe')).toEqual({ + command: 'gemini', + args: [ + '--skip-trust', + '--approval-mode', + 'plan', + '--policy', + '.cladding/host/gemini-doctor-policy.toml', + '--allowed-mcp-server-names', + 'cladding', + '-o', + 'text', + '-p', + 'probe', + ], + }); + }); + + test('Cursor stays read-only and relies on the exact project MCP allowlist', () => { + expect(buildPromptCommand('cursor', 'probe')).toEqual({ + command: 'cursor-agent', + args: ['-p', '--mode', 'ask', '--trust', '--approve-mcps', 'probe'], + }); + }); +}); + // ─── AC-87ebd442 · consent → ≤3 canned prompts/host, recorded pass/fail ────────── describe('runHostSmoke with consent — canned probing (AC-87ebd442)', () => { @@ -158,11 +209,12 @@ describe('runHostSmoke with consent — canned probing (AC-87ebd442)', () => { }); // ≤3 canned prompts per host CLI found on PATH. - for (const command of ['claude', 'agy', 'codex', 'cursor-agent']) { + for (const command of ['claude', 'gemini', 'agy', 'codex', 'cursor-agent']) { expect(calls.filter((c) => c.command === command)).toHaveLength(3); } // All three surfaces passed their sentinel → verified. expect(artifact.hosts.claude.grade).toBe('verified'); + expect(artifact.hosts.gemini.grade).toBe('verified'); expect(artifact.hosts.antigravity.grade).toBe('verified'); expect(artifact.hosts.codex.grade).toBe('verified'); expect(artifact.hosts.cursor.grade).toBe('verified'); @@ -220,7 +272,7 @@ describe('not-run honesty — absence never renders as a pass (AC-8dfa9cc4)', () test('no consent (binary present) → every prompt host not-run with the consent reason', () => { const artifact = runHostSmoke(dir, {consent: false, hasBinary: () => true, home, version: 'x'}); - for (const host of ['claude', 'antigravity', 'codex', 'cursor'] as const) { + for (const host of ['claude', 'gemini', 'antigravity', 'codex', 'cursor'] as const) { const rec = artifact.hosts[host]; expect(rec.grade).toBe('not-run'); expect(rec.reason).toMatch(/consent not given/i); @@ -231,7 +283,7 @@ describe('not-run honesty — absence never renders as a pass (AC-8dfa9cc4)', () test('binary absent from PATH → not-run "binary not on PATH", even with consent', () => { const artifact = runHostSmoke(dir, {consent: true, hasBinary: () => false, home}); - for (const host of ['claude', 'antigravity', 'codex', 'cursor'] as const) { + for (const host of ['claude', 'gemini', 'antigravity', 'codex', 'cursor'] as const) { expect(artifact.hosts[host].grade).toBe('not-run'); expect(artifact.hosts[host].reason).toMatch(/not on PATH/i); } @@ -287,6 +339,7 @@ function mkArtifact(over: Partial = {}): HostSmokeArtifact { {name: 'run-check', result: 'pass', sentinel: 'a drift verdict', evidence: 'RED 2 findings'}, ], }, + gemini: {grade: 'not-run', surfaces: [], reason: 'consent not given (set CLAD_HOST_SMOKE=1)'}, antigravity: {grade: 'not-run', surfaces: [], reason: 'consent not given (set CLAD_HOST_SMOKE=1)'}, codex: {grade: 'not-run', surfaces: [], reason: 'binary not on PATH'}, cursor: { @@ -307,17 +360,19 @@ describe('renderHostMatrix — pure matrix generator (AC-57ab708c)', () => { expect(md).toContain('Generated: 2026-07-01T12:00:00.000Z'); // Per-host rows carry the recorded result cells + grade. expect(md).toMatch(/\| claude \| pass \| pass \| pass \| — \| verified \|/); + expect(md).toMatch(/\| gemini \| — \| — \| — \| — \| not-run \|/); expect(md).toMatch(/\| cursor \| — \| — \| — \| pass \| wiring-ok \|/); // The machine-readable fence the detector reads. expect(md).toContain(matrixGradesFence(mkArtifact())); expect(md).toContain('Cursor additionally verifies'); }); - test('matrixGradesFence is the four host grades as a parseable JSON comment', () => { + test('matrixGradesFence includes every supported host as parseable JSON', () => { const fence = matrixGradesFence(mkArtifact()); const json = fence.replace('', ''); expect(JSON.parse(json)).toEqual({ claude: 'verified', + gemini: 'not-run', antigravity: 'not-run', codex: 'not-run', cursor: 'wiring-ok', @@ -367,6 +422,21 @@ describe('newest-artifact selection + --matrix-only (AC-57ab708c)', () => { expect(newest?.hosts.antigravity.reason).toMatch(/legacy artifact/i); }); + test('interim Antigravity-only artifacts load with an honest Gemini fallback', () => { + const auditDir = join(dir, '.cladding', 'audit'); + const interim = mkArtifact() as unknown as {version: string; generatedAt: string; hosts: Record}; + delete interim.hosts.gemini; + interim.generatedAt = '2026-08-02T00:00:00.000Z'; + writeFileSync(join(auditDir, 'host-smoke-2026-08-02.json'), JSON.stringify(interim, null, 2)); + + const newest = readNewestArtifact(dir); + + expect(newest?.hosts.gemini.grade).toBe('not-run'); + expect(newest?.hosts.gemini.reason).toMatch(/legacy artifact/i); + expect(newest?.hosts.antigravity.grade).toBe('not-run'); + expect(newest?.hosts.antigravity.reason).toMatch(/consent not given/i); + }); + test('--matrix-only regenerates from the newest artifact and is idempotent', () => { const exitSpy = vi.spyOn(process, 'exit').mockImplementation((() => undefined) as never); const stdoutSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true); diff --git a/tests/cli/init-onboarding-english-source.test.ts b/tests/cli/init-onboarding-english-source.test.ts index 8c6a9b6e..a74bb763 100644 --- a/tests/cli/init-onboarding-english-source.test.ts +++ b/tests/cli/init-onboarding-english-source.test.ts @@ -61,8 +61,8 @@ describe('init-onboarding-english-source (F-5cac007a)', () => { describe('AC-002 — renderSetupReport is English single-source', () => { const result = { projectRoot: '/tmp/project', - wiring: {runtime: 'created', shared_init_skill: 'created', claude: 'created', codex: 'created', antigravity: 'created', cursor: 'created'}, - legacyCleanup: {claude_plugin: 'unchanged', antigravity_plugin: 'unchanged', codex_skills: 'unchanged', codex_mcp: 'unchanged', cursor_mcp: 'unchanged'}, + wiring: {runtime: 'created', shared_init_skill: 'created', claude: 'created', codex: 'created', gemini: 'created', antigravity: 'created', cursor: 'created'}, + legacyCleanup: {claude_plugin: 'unchanged', gemini_extension: 'unchanged', antigravity_plugin: 'unchanged', codex_skills: 'unchanged', codex_mcp: 'unchanged', cursor_mcp: 'unchanged'}, errors: [], warnings: [], statusFile: '/tmp/status.json', @@ -72,7 +72,7 @@ describe('init-onboarding-english-source (F-5cac007a)', () => { } as const; test('the wiring report ends with an English "Next steps:" block, no Hangul', () => { - const detection = {claude: true, antigravity: false, codex: false, agents: false, cursor: false}; + const detection = {claude: true, gemini: false, antigravity: false, codex: false, agents: false, cursor: false}; const report = renderSetupReport(result, detection); expect(report).toContain('Next steps:'); expect(report).toContain('1. Start a new AI session in this project directory'); @@ -80,7 +80,7 @@ describe('init-onboarding-english-source (F-5cac007a)', () => { }); test('the "no AI tools detected" branch is English, no Hangul', () => { - const detection = {claude: false, antigravity: false, codex: false, agents: false, cursor: false}; + const detection = {claude: false, gemini: false, antigravity: false, codex: false, agents: false, cursor: false}; const report = renderSetupReport(result, detection); expect(report).toContain('project activation'); expect(HANGUL.test(report)).toBe(false); diff --git a/tests/cli/setup.test.ts b/tests/cli/setup.test.ts index 17c70294..b9e7c74f 100644 --- a/tests/cli/setup.test.ts +++ b/tests/cli/setup.test.ts @@ -23,7 +23,7 @@ describe('project-scoped runHostSetup', () => { writeFileSync(join(pkgRoot, 'package.json'), JSON.stringify({name: 'cladding', version: '0.9.0'})); writeFileSync( join(pkgRoot, 'plugins', 'codex', 'skills', 'init', 'SKILL.md'), - '---\ndescription: Use only when the user explicitly names Cladding and asks to initialize it.\n---\n\n# Cladding init\n', + '---\nname: init\ndescription: Use only when the user explicitly names Cladding and asks to initialize it.\n---\n\n# Cladding init\n', ); }); @@ -38,14 +38,21 @@ describe('project-scoped runHostSetup', () => { expect(result.errors).toEqual([]); expect(existsSync(join(project, '.codex', 'config.toml'))).toBe(true); + expect(existsSync(join(project, '.gemini', 'settings.json'))).toBe(true); expect(existsSync(join(project, '.agents', 'mcp_config.json'))).toBe(true); expect(existsSync(join(project, '.cursor', 'mcp.json'))).toBe(true); + expect(existsSync(join(project, '.cursor', 'cli.json'))).toBe(true); + expect(existsSync(join(project, '.cladding', 'host', 'gemini-doctor-policy.toml'))).toBe(true); expect(existsSync(join(project, '.mcp.json'))).toBe(true); expect(existsSync(join(project, '.agents', 'skills', 'cladding-init', 'SKILL.md'))).toBe(true); expect(existsSync(join(project, '.claude', 'skills', 'cladding-init', 'SKILL.md'))).toBe(true); + expect(existsSync(join(project, '.gemini', 'skills'))).toBe(false); + expect(readFileSync(join(project, '.agents', 'skills', 'cladding-init', 'SKILL.md'), 'utf8')) + .toContain('name: cladding-init'); expect(existsSync(join(project, '.cursor', 'skills', 'cladding-init', 'SKILL.md'))).toBe(true); expect(existsSync(join(home, '.agents'))).toBe(false); expect(existsSync(join(home, '.codex'))).toBe(false); + expect(existsSync(join(home, '.gemini'))).toBe(false); }); test('keeps machine-specific runtime state out of a Git worktree', async () => { @@ -63,12 +70,30 @@ describe('project-scoped runHostSetup', () => { await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); const codex = readFileSync(join(project, '.codex', 'config.toml'), 'utf8'); + const gemini = readFileSync(join(project, '.gemini', 'settings.json'), 'utf8'); const cursor = readFileSync(join(project, '.cursor', 'mcp.json'), 'utf8'); + const cursorCli = readFileSync(join(project, '.cursor', 'cli.json'), 'utf8'); const runtime = readFileSync(join(project, '.cladding', 'host', 'serve.cjs'), 'utf8'); + const geminiPolicy = readFileSync( + join(project, '.cladding', 'host', 'gemini-doctor-policy.toml'), + 'utf8', + ); expect(codex).toContain('.cladding/host/serve.cjs'); + expect(codex).toContain('default_tools_approval_mode = "writes"'); + expect(gemini).toContain('.cladding/host/serve.cjs'); expect(cursor).toContain('.cladding/host/serve.cjs'); + expect(cursorCli).toContain('Mcp(cladding:clad_list_features)'); + expect(cursorCli).toContain('Mcp(cladding:clad_get_feature)'); + expect(cursorCli).toContain('Mcp(cladding:clad_run_check)'); + expect(cursorCli).not.toContain('Mcp(cladding:*)'); + expect(JSON.parse(cursorCli).permissions.deny).toEqual([]); expect(codex).not.toContain(pkgRoot); expect(runtime).toContain(join(pkgRoot, 'dist', 'clad.js')); + expect(geminiPolicy).toContain('toolAnnotations = { readOnlyHint = true }'); + expect(geminiPolicy).toContain('modes = ["plan"]'); + expect(geminiPolicy).toContain('toolName = "exit_plan_mode"'); + expect(geminiPolicy).toMatch(/mcpName = "cladding"[\s\S]*toolName = "\*"[\s\S]*decision = "deny"/); + expect(geminiPolicy).not.toContain('yolo'); }); test('project runtime pins MCP and shell commands to the same engine', async () => { @@ -90,6 +115,7 @@ describe('project-scoped runHostSetup', () => { expect(second.wiring.runtime).toBe('unchanged'); expect(second.wiring.codex).toBe('unchanged'); + expect(second.wiring.gemini).toBe('unchanged'); expect(second.wiring.cursor).toBe('unchanged'); expect(getLastSetupVersion(project)).toBe('0.9.0'); expect(second.statusFile).toBe(join(resolve(project), '.cladding', 'setup-status.json')); @@ -101,9 +127,68 @@ describe('project-scoped runHostSetup', () => { expect(existsSync(join(project, '.codex', 'config.toml'))).toBe(true); expect(existsSync(join(project, '.agents', 'skills', 'cladding-init', 'SKILL.md'))).toBe(true); expect(existsSync(join(project, '.cursor'))).toBe(false); + expect(existsSync(join(project, '.cladding', 'host', 'gemini-doctor-policy.toml'))).toBe(false); + expect(existsSync(join(project, '.mcp.json'))).toBe(false); + }); + + test('Gemini-only setup writes the shared project skill and Gemini MCP settings only', async () => { + await runHostSetup({home, projectRoot: project, pkgRoot, hosts: ['gemini'], quiet: true, activate: false}); + + expect(existsSync(join(project, '.gemini', 'settings.json'))).toBe(true); + expect(existsSync(join(project, '.cladding', 'host', 'gemini-doctor-policy.toml'))).toBe(true); + expect(existsSync(join(project, '.agents', 'skills', 'cladding-init', 'SKILL.md'))).toBe(true); + expect(existsSync(join(project, '.codex'))).toBe(false); + expect(existsSync(join(project, '.cursor'))).toBe(false); expect(existsSync(join(project, '.mcp.json'))).toBe(false); }); + test('Gemini setup preserves unrelated settings and MCP servers', async () => { + mkdirSync(join(project, '.gemini'), {recursive: true}); + writeFileSync( + join(project, '.gemini', 'settings.json'), + JSON.stringify({theme: 'system', mcpServers: {other: {command: 'other'}}}), + ); + + await runHostSetup({home, projectRoot: project, pkgRoot, hosts: ['gemini'], quiet: true, activate: false}); + + const settings = JSON.parse(readFileSync(join(project, '.gemini', 'settings.json'), 'utf8')) as { + theme?: string; + mcpServers?: Record; + }; + expect(settings.theme).toBe('system'); + expect(settings.mcpServers?.other?.command).toBe('other'); + expect(settings.mcpServers?.cladding?.args).toEqual(['.cladding/host/serve.cjs']); + }); + + test('Gemini setup preserves a conflicting Cladding entry unless force is explicit', async () => { + mkdirSync(join(project, '.gemini'), {recursive: true}); + const settingsPath = join(project, '.gemini', 'settings.json'); + writeFileSync(settingsPath, JSON.stringify({mcpServers: {cladding: {command: 'custom'}}})); + + const safe = await runHostSetup({ + home, + projectRoot: project, + pkgRoot, + hosts: ['gemini'], + quiet: true, + activate: false, + }); + expect(safe.wiring.gemini).toBe('skipped-different'); + expect(readFileSync(settingsPath, 'utf8')).toContain('custom'); + + const forced = await runHostSetup({ + home, + projectRoot: project, + pkgRoot, + hosts: ['gemini'], + force: true, + quiet: true, + activate: false, + }); + expect(['created', 'rewired']).toContain(forced.wiring.gemini); + expect(readFileSync(settingsPath, 'utf8')).toContain('.cladding/host/serve.cjs'); + }); + test('preserves a conflicting user MCP entry unless force is explicit', async () => { mkdirSync(join(project, '.cursor'), {recursive: true}); writeFileSync(join(project, '.cursor', 'mcp.json'), JSON.stringify({mcpServers: {cladding: {command: 'custom'}}})); @@ -117,11 +202,43 @@ describe('project-scoped runHostSetup', () => { expect(readFileSync(join(project, '.cursor', 'mcp.json'), 'utf8')).toContain('.cladding/host/serve.cjs'); }); + test('Cursor permissions preserve unrelated allow and deny entries', async () => { + mkdirSync(join(project, '.cursor'), {recursive: true}); + writeFileSync( + join(project, '.cursor', 'cli.json'), + JSON.stringify({permissions: {allow: ['Shell(git)'], deny: ['Shell(rm)']}, theme: 'dark'}), + ); + + await runHostSetup({ + home, + projectRoot: project, + pkgRoot, + hosts: ['cursor'], + quiet: true, + activate: false, + }); + + const config = JSON.parse(readFileSync(join(project, '.cursor', 'cli.json'), 'utf8')) as { + permissions: {allow: string[]; deny: string[]}; + theme: string; + }; + expect(config.theme).toBe('dark'); + expect(config.permissions.deny).toEqual(['Shell(rm)']); + expect(config.permissions.allow).toEqual([ + 'Shell(git)', + 'Mcp(cladding:clad_list_features)', + 'Mcp(cladding:clad_get_feature)', + 'Mcp(cladding:clad_run_check)', + ]); + }); + test('removes only provably-owned legacy global wires', async () => { mkdirSync(join(home, '.agents', 'skills'), {recursive: true}); mkdirSync(join(home, '.gemini', 'config', 'plugins'), {recursive: true}); + mkdirSync(join(home, '.gemini', 'extensions'), {recursive: true}); symlinkSync(join(pkgRoot, 'plugins', 'codex', 'skills', 'init'), join(home, '.agents', 'skills', 'cladding-init')); symlinkSync(pkgRoot, join(home, '.gemini', 'config', 'plugins', 'cladding')); + symlinkSync(pkgRoot, join(home, '.gemini', 'extensions', 'cladding')); mkdirSync(join(home, '.codex'), {recursive: true}); writeFileSync( join(home, '.codex', 'config.toml'), @@ -131,9 +248,11 @@ describe('project-scoped runHostSetup', () => { const result = await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); expect(result.legacyCleanup.codex_skills).toBe('removed'); + expect(result.legacyCleanup.gemini_extension).toBe('removed'); expect(result.legacyCleanup.antigravity_plugin).toBe('removed'); expect(result.legacyCleanup.codex_mcp).toBe('removed'); expect(existsSync(join(home, '.agents', 'skills', 'cladding-init'))).toBe(false); + expect(existsSync(join(home, '.gemini', 'extensions', 'cladding'))).toBe(false); expect(readFileSync(join(home, '.codex', 'config.toml'), 'utf8')).toContain('other'); }); @@ -141,10 +260,14 @@ describe('project-scoped runHostSetup', () => { const custom = mkdtempSync(join(tmpdir(), 'custom-plugin-')); try { mkdirSync(join(home, '.agents', 'skills'), {recursive: true}); + mkdirSync(join(home, '.gemini', 'extensions'), {recursive: true}); symlinkSync(custom, join(home, '.agents', 'skills', 'cladding-custom')); + symlinkSync(custom, join(home, '.gemini', 'extensions', 'cladding')); const result = await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); expect(result.legacyCleanup.codex_skills).toBe('skipped-different'); + expect(result.legacyCleanup.gemini_extension).toBe('skipped-different'); expect(resolve(readlinkSync(join(home, '.agents', 'skills', 'cladding-custom')))).toBe(resolve(custom)); + expect(resolve(readlinkSync(join(home, '.gemini', 'extensions', 'cladding')))).toBe(resolve(custom)); } finally { rmSync(custom, {recursive: true, force: true}); } diff --git a/tests/cli/update.test.ts b/tests/cli/update.test.ts index 8fd53a70..d70b8246 100644 --- a/tests/cli/update.test.ts +++ b/tests/cli/update.test.ts @@ -26,6 +26,7 @@ describe('runUpdate', () => { test('no spec.yaml → re-wires only, isProject false, no project files written', async () => { const r = await runUpdate(dir, {wireHosts: okWire}); expect(r.isProject).toBe(false); + expect(r.claudeMd).toBe('n/a'); expect(r.agentsMd).toBe('n/a'); expect(r.code).toBe(0); }); @@ -36,13 +37,14 @@ describe('runUpdate', () => { expect(r.code).toBe(1); }); - test('fresh project → inventory written and AGENTS.md created without CLAUDE.md, code 0', async () => { + test('fresh project → inventory and both established host instruction surfaces are written', async () => { writeFileSync(join(dir, 'spec.yaml'), SPEC); const r = await runUpdate(dir, {wireHosts: okWire}); expect(r.isProject).toBe(true); expect(r.features).toBe(0); + expect(r.claudeMd).toBe('created'); expect(r.agentsMd).toBe('created'); - expect(existsSync(join(dir, 'CLAUDE.md'))).toBe(false); + expect(existsSync(join(dir, 'CLAUDE.md'))).toBe(true); expect(r.code).toBe(0); // inventory block was materialized into spec.yaml expect(readFileSync(join(dir, 'spec.yaml'), 'utf8')).toContain('inventory:'); @@ -52,6 +54,7 @@ describe('runUpdate', () => { writeFileSync(join(dir, 'spec.yaml'), SPEC); await runUpdate(dir, {wireHosts: okWire}); const r2 = await runUpdate(dir, {wireHosts: okWire}); + expect(r2.claudeMd).toBe('unchanged'); expect(r2.agentsMd).toBe('skipped-exists'); // existing, non-stale expect(r2.code).toBe(0); }); diff --git a/tests/init/skill-activation.test.ts b/tests/init/skill-activation.test.ts index 572788e5..9743eeca 100644 --- a/tests/init/skill-activation.test.ts +++ b/tests/init/skill-activation.test.ts @@ -9,6 +9,11 @@ const ACTIVATION_GUARD = 'Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects.'; describe('Cladding skill activation boundary', () => { + test('the canonical init skill name matches its parent directory', () => { + const initSkill = readFileSync(join('skills', 'init', 'SKILL.md'), 'utf8'); + expect(initSkill).toMatch(/^---\nname: init\ndescription: /); + }); + test('every non-init verb and persona description excludes unrelated uninitialized projects', () => { const verbFiles = readdirSync('skills') .filter((name) => name !== 'init') diff --git a/tests/serve/init-tools.test.ts b/tests/serve/init-tools.test.ts index 29ea1873..1776e1b3 100644 --- a/tests/serve/init-tools.test.ts +++ b/tests/serve/init-tools.test.ts @@ -101,6 +101,7 @@ describe('serve/server — natural-language init tools', () => { onboardingSource: 'host', }); expect(existsSync(join(dir, 'spec.yaml'))).toBe(true); + expect(readFileSync(join(dir, 'spec.yaml'), 'utf8')).toContain('onboarding_seeded: true'); expect(existsSync(join(dir, 'AGENTS.md'))).toBe(true); expect(existsSync(join(dir, 'CLAUDE.md'))).toBe(false); } finally { diff --git a/tests/serve/server.test.ts b/tests/serve/server.test.ts index 6abfc627..e4c20553 100644 --- a/tests/serve/server.test.ts +++ b/tests/serve/server.test.ts @@ -239,6 +239,24 @@ describe('serve/server — MCP read surface', () => { } }); + test('doctor surfaces advertise read-only MCP annotations', async () => { + const {client, cleanup} = await makePair(dir); + try { + const {tools} = await client.listTools(); + for (const name of ['clad_list_features', 'clad_get_feature', 'clad_run_check']) { + const tool = tools.find((candidate) => candidate.name === name); + expect(tool?.annotations).toMatchObject({ + readOnlyHint: true, + destructiveHint: false, + idempotentHint: true, + }); + } + expect(tools.find((tool) => tool.name === 'clad_init')?.annotations?.readOnlyHint).toBe(false); + } finally { + await cleanup(); + } + }); + test('clad_list_features slugSubstring filter (F-085, v0.3.10)', async () => { const {client, cleanup} = await makePair(dir); try { @@ -409,6 +427,27 @@ describe('serve/server — MCP read surface', () => { } }); + test('clad_create_feature keeps the established create-only request compatible', async () => { + const {client, cleanup} = await makePair(dir); + try { + const result = await client.callTool({ + name: 'clad_create_feature', + arguments: {slug: 'compatible-create', title: 'Compatible create', status: 'planned'}, + }); + expect(result.isError).not.toBe(true); + const payload = JSON.parse((result.content as Array<{type: string; text: string}>)[0].text) as { + path: string; + hint?: string; + designImpact?: unknown; + }; + expect(payload.hint).toContain('clad_link_capability'); + expect(payload.designImpact).toBeUndefined(); + expect(readFileSync(payload.path, 'utf8')).not.toContain('design_impact:'); + } finally { + await cleanup(); + } + }); + test('feature creation resolves additive design and gates structural design until review', async () => { const {client, cleanup} = await makePair(dir); try { diff --git a/tests/stages/capabilities-feature-mapping.test.ts b/tests/stages/capabilities-feature-mapping.test.ts index d0165650..8fd17b33 100644 --- a/tests/stages/capabilities-feature-mapping.test.ts +++ b/tests/stages/capabilities-feature-mapping.test.ts @@ -21,13 +21,18 @@ import { DEFAULT_MIN_FEATURES_FOR_CAPABILITY_BINDINGS, } from '../../src/stages/detectors/capabilities-feature-mapping.js'; -function writeSpec(dir: string, featureIds: readonly string[]): void { +function writeSpec( + dir: string, + featureIds: readonly string[], + onboardingSeeded = false, +): void { const features = featureIds .map((id) => ` - id: ${id}\n title: "f"\n status: planned\n modules: []\n acceptance_criteria:\n - id: AC-001\n ears: ubiquitous\n text: "x"`) .join('\n'); writeFileSync( join(dir, 'spec.yaml'), - `schema: "0.1"\nproject: {name: x, language: typescript}\nfeatures:\n${features || '[]'}\n`, + `schema: "0.1"\nproject: {name: x, language: typescript, onboarding_seeded: ${onboardingSeeded}}\n` + + `features:\n${features || '[]'}\n`, ); } @@ -101,7 +106,7 @@ describe('CAPABILITIES_FEATURE_MAPPING detector', () => { }); test('orphan capability below the maturity threshold → informational future intent', () => { - writeSpec(dir, ['F-001']); + writeSpec(dir, ['F-001'], true); writeCapabilities( dir, [ @@ -121,7 +126,7 @@ describe('CAPABILITIES_FEATURE_MAPPING detector', () => { }); test('capability without features field below the threshold → info (treated as future intent)', () => { - writeSpec(dir, ['F-001']); + writeSpec(dir, ['F-001'], true); writeCapabilities( dir, [ @@ -143,7 +148,7 @@ describe('CAPABILITIES_FEATURE_MAPPING detector', () => { {length: DEFAULT_MIN_FEATURES_FOR_CAPABILITY_BINDINGS}, (_, index) => `F-${String(index + 1).padStart(3, '0')}`, ); - writeSpec(dir, ids); + writeSpec(dir, ids, true); writeCapabilities( dir, [ @@ -185,7 +190,7 @@ describe('CAPABILITIES_FEATURE_MAPPING detector', () => { }); test('mixed findings: early orphan info + dangling error + unclaimed-feature info', () => { - writeSpec(dir, ['F-001', 'F-002']); + writeSpec(dir, ['F-001', 'F-002'], true); writeCapabilities( dir, [ @@ -216,6 +221,26 @@ describe('CAPABILITIES_FEATURE_MAPPING detector', () => { expect(bySev.info.some((f) => f.message.includes('F-002'))).toBe(true); }); + test('legacy project below the threshold retains the established orphan warning', () => { + writeSpec(dir, ['F-001']); + writeCapabilities( + dir, + [ + 'schema: "0.1"', + 'source: README.md', + 'capabilities:', + ' - id: unresolved-capability', + ' features: []', + '', + ].join('\n'), + ); + + const findings = capabilitiesFeatureMapping.run({cwd: dir}); + expect(findings.some((finding) => + finding.severity === 'warn' && finding.message.includes('unresolved-capability'), + )).toBe(true); + }); + test('malformed YAML → skip silently (other detectors flag corruption)', () => { writeSpec(dir, ['F-001']); writeCapabilities(dir, ':::: not valid yaml ::::'); diff --git a/tests/stages/detectors/deliverable-integrity.test.ts b/tests/stages/detectors/deliverable-integrity.test.ts index 4f09eda7..e2a39394 100644 --- a/tests/stages/detectors/deliverable-integrity.test.ts +++ b/tests/stages/detectors/deliverable-integrity.test.ts @@ -23,7 +23,13 @@ afterEach(() => { rmSync(dir, {recursive: true, force: true}); }); -function writeSpec(opts: {deliverable?: string; done?: boolean; modules?: boolean; featureCount?: number} = {}): void { +function writeSpec(opts: { + deliverable?: string; + done?: boolean; + modules?: boolean; + featureCount?: number; + onboardingSeeded?: boolean; +} = {}): void { const done = opts.done ?? true; const deliverable = opts.deliverable ?? ''; const modules = (opts.modules ?? true) ? ' modules: [src/x.ts]\n' : ''; @@ -38,7 +44,8 @@ function writeSpec(opts: {deliverable?: string; done?: boolean; modules?: boolea ).join(''); writeFileSync( join(dir, 'spec.yaml'), - `schema: "0.1"\nproject:\n name: t\n language: typescript\n${deliverable}` + + 'schema: "0.1"\nproject:\n name: t\n language: typescript\n' + + ` onboarding_seeded: ${opts.onboardingSeeded ?? false}\n${deliverable}` + `features:\n${features}`, ); } @@ -48,7 +55,7 @@ function run(): readonly {detector: string; severity: string; message: string}[] describe('DELIVERABLE_INTEGRITY detector', () => { test('INFO when an early project ships modules before declaring a deliverable', () => { - writeSpec(); + writeSpec({onboardingSeeded: true}); const findings = run(); expect(findings).toHaveLength(1); expect(findings[0].severity).toBe('info'); @@ -56,13 +63,20 @@ describe('DELIVERABLE_INTEGRITY detector', () => { }); test('WARN once a grown project still ships modules without a deliverable decision', () => { - writeSpec({featureCount: DEFAULT_MIN_FEATURES_FOR_DELIVERABLE}); + writeSpec({featureCount: DEFAULT_MIN_FEATURES_FOR_DELIVERABLE, onboardingSeeded: true}); const findings = run(); expect(findings).toHaveLength(1); expect(findings[0].severity).toBe('warn'); expect(findings[0].message).toMatch(/ship modules but project.deliverable is not declared/); }); + test('WARN for a legacy early project without an onboarding marker', () => { + writeSpec(); + const findings = run(); + expect(findings).toHaveLength(1); + expect(findings[0].severity).toBe('warn'); + }); + test('ERROR when deliverable.path is declared but missing on disk', () => { writeSpec({deliverable: ' deliverable:\n path: ./run\n'}); // no ./run written const findings = run(); diff --git a/tests/stages/scenario-coverage.test.ts b/tests/stages/scenario-coverage.test.ts index d7dc71a3..b1f264ab 100644 --- a/tests/stages/scenario-coverage.test.ts +++ b/tests/stages/scenario-coverage.test.ts @@ -26,7 +26,10 @@ import { scenarioCoverage, } from '../../src/stages/detectors/scenario-coverage.js'; -const SPEC_HEADER = 'schema: "0.1"\n' + 'project: {name: x, language: typescript}\n'; +function specHeader(onboardingSeeded = false): string { + return 'schema: "0.1"\n' + + `project: {name: x, language: typescript, onboarding_seeded: ${onboardingSeeded}}\n`; +} /** Render N minimal inline feature entries (status-blind: all 'planned'). */ function inlineFeatures(n: number): string { @@ -38,8 +41,8 @@ function inlineFeatures(n: number): string { } /** Write spec.yaml with N inline features into `dir`. */ -function writeSpec(dir: string, featureCount: number): void { - writeFileSync(join(dir, 'spec.yaml'), SPEC_HEADER + inlineFeatures(featureCount)); +function writeSpec(dir: string, featureCount: number, onboardingSeeded = false): void { + writeFileSync(join(dir, 'spec.yaml'), specHeader(onboardingSeeded) + inlineFeatures(featureCount)); } /** @@ -97,7 +100,7 @@ describe('SCENARIO_COVERAGE detector', () => { }); test('hollow scenario below threshold → exactly 1 informational future-intent finding', () => { - writeSpec(dir, 2); + writeSpec(dir, 2, true); writeScenario(dir, 1, []); // features: [] → hollow const findings = scenarioCoverage.run({cwd: dir}); // Check 1 cannot fire: only 2 features AND a scenario exists. @@ -108,6 +111,15 @@ describe('SCENARIO_COVERAGE detector', () => { expect(findings[0].path).toBe('spec/scenarios/'); }); + test('legacy project below threshold retains the established hollow-scenario warning', () => { + writeSpec(dir, 2); + writeScenario(dir, 1, []); + const findings = scenarioCoverage.run({cwd: dir}); + expect(findings).toHaveLength(1); + expect(findings[0].severity).toBe('warn'); + expect(findings[0].message).not.toContain('future onboarding intent'); + }); + test('two hollow scenarios at threshold: 8 features + 2 hollow scenarios → exactly 2 warns (no "no scenarios" finding)', () => { writeSpec(dir, 8); writeScenario(dir, 1, []); // hollow @@ -172,7 +184,7 @@ describe('SCENARIO_COVERAGE under-bound flow (check 3)', () => { // 3 features WITH slugs. writeFileSync( join(dir, 'spec.yaml'), - SPEC_HEADER + + specHeader() + 'features:\n' + ' - {id: F-001, slug: auth-register, title: t, status: planned}\n' + ' - {id: F-002, slug: auth-login, title: t, status: planned}\n' + diff --git a/tests/stages/spec-conformance.test.ts b/tests/stages/spec-conformance.test.ts index 269707f5..4fa47605 100644 --- a/tests/stages/spec-conformance.test.ts +++ b/tests/stages/spec-conformance.test.ts @@ -5,7 +5,16 @@ // directory otherwise, and maps a real oracle failure to a blocking exit 1 // (so GREEN can fail on latent non-conformance). execaSync is mocked. -import {mkdirSync, mkdtempSync, rmSync, writeFileSync} from 'node:fs'; +import { + existsSync, + mkdirSync, + mkdtempSync, + readFileSync, + rmSync, + statSync, + utimesSync, + writeFileSync, +} from 'node:fs'; import {tmpdir} from 'node:os'; import {join} from 'node:path'; import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'; @@ -62,6 +71,69 @@ describe('runSpecConformance (stage_2.3)', () => { expect(runSpecConformance({cwd: dir}).pass).toBe(true); }); + test('oracle-only run restores the prior full JUnit report byte-for-byte', () => { + seedTs(dir); + seedOracle(dir); + const report = join(dir, '.cladding', 'test-report.junit.xml'); + mkdirSync(join(dir, '.cladding'), {recursive: true}); + writeFileSync(report, '\n'); + const fixedTime = new Date('2026-07-15T00:00:00.000Z'); + utimesSync(report, fixedTime, fixedTime); + const original = readFileSync(report); + const originalMtime = statSync(report).mtimeMs; + execaSyncMock.mockImplementationOnce(() => { + writeFileSync(report, '\n'); + return {exitCode: 0, stdout: '', stderr: ''}; + }); + + expect(runSpecConformance({cwd: dir}).pass).toBe(true); + + expect(readFileSync(report)).toEqual(original); + expect(statSync(report).mtimeMs).toBe(originalMtime); + }); + + test('oracle-only run removes a conventional JUnit report that it alone created', () => { + seedTs(dir); + seedOracle(dir); + const report = join(dir, '.cladding', 'test-report.junit.xml'); + execaSyncMock.mockImplementationOnce(() => { + mkdirSync(join(dir, '.cladding'), {recursive: true}); + writeFileSync(report, '\n'); + return {exitCode: 0, stdout: '', stderr: ''}; + }); + + expect(runSpecConformance({cwd: dir}).pass).toBe(true); + + expect(existsSync(report)).toBe(false); + }); + + test('oracle-only run preserves both an explicit report and a framework-default report', () => { + seedTs(dir); + seedOracle(dir); + const configured = join(dir, 'reports', 'authoritative.xml'); + const conventional = join(dir, '.cladding', 'test-report.junit.xml'); + mkdirSync(join(dir, 'reports'), {recursive: true}); + mkdirSync(join(dir, '.cladding'), {recursive: true}); + writeFileSync( + join(dir, '.cladding', 'config.yaml'), + 'gate:\n test_report: reports/authoritative.xml\n', + ); + writeFileSync(configured, '\n'); + writeFileSync(conventional, '\n'); + const configuredBefore = readFileSync(configured); + const conventionalBefore = readFileSync(conventional); + execaSyncMock.mockImplementationOnce(() => { + writeFileSync(configured, '\n'); + writeFileSync(conventional, '\n'); + return {exitCode: 0, stdout: '', stderr: ''}; + }); + + expect(runSpecConformance({cwd: dir}).pass).toBe(true); + + expect(readFileSync(configured)).toEqual(configuredBefore); + expect(readFileSync(conventional)).toEqual(conventionalBefore); + }); + test('oracle present + suite fails → blocking exit 1 with stderr (GREEN can fail)', () => { seedTs(dir); seedOracle(dir); diff --git a/tests/stages/toolchain/gate-config.test.ts b/tests/stages/toolchain/gate-config.test.ts index 8468c635..0bfab82b 100644 --- a/tests/stages/toolchain/gate-config.test.ts +++ b/tests/stages/toolchain/gate-config.test.ts @@ -10,7 +10,12 @@ import {tmpdir} from 'node:os'; import {join} from 'node:path'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; -import {expandModuleTokens, readGateConfig} from '../../../src/stages/toolchain/gate-config.js'; +import { + expandModuleTokens, + readGateConfig, + resolveTestReportPath, + testReportCandidatePaths, +} from '../../../src/stages/toolchain/gate-config.js'; import type {GradleProject} from '../../../src/stages/toolchain/module-scope.js'; let dir: string; @@ -60,6 +65,32 @@ describe('readGateConfig', () => { }); }); +describe('test report paths', () => { + test('defaults preserve every conventional report candidate in detector order', () => { + expect(testReportCandidatePaths(dir)).toEqual([ + join(dir, 'test-report.junit.xml'), + join(dir, 'coverage', 'junit.xml'), + join(dir, '.cladding', 'test-report.junit.xml'), + ]); + }); + + test('an explicit report is first while conventional runner outputs remain protected', () => { + writeConfig('gate:\n test_report: reports/authoritative.xml\n'); + expect(testReportCandidatePaths(dir)).toEqual([ + join(dir, 'reports', 'authoritative.xml'), + join(dir, 'test-report.junit.xml'), + join(dir, 'coverage', 'junit.xml'), + join(dir, '.cladding', 'test-report.junit.xml'), + ]); + }); + + test('a missing explicit report does not silently fall back to a conventional report', () => { + writeConfig('gate:\n test_report: reports/missing.xml\n'); + writeFileSync(join(dir, 'test-report.junit.xml'), '\n'); + expect(resolveTestReportPath(dir)).toBeNull(); + }); +}); + describe('expandModuleTokens', () => { test('expands {modules:TASK} to one :project:task per project', () => { const out = expandModuleTokens(['./gradlew', '{modules:test}'], [A, B]); diff --git a/tests/stages/util.test.ts b/tests/stages/util.test.ts index 3e56b588..c957a48f 100644 --- a/tests/stages/util.test.ts +++ b/tests/stages/util.test.ts @@ -96,6 +96,30 @@ describe('missingToolSkip — ENOENT is the ONLY exit-2 (skip) path', () => { expect(r?.exitCode).toBe(2); }); + test('offline npx shell-level command miss → visible setup gap', () => { + const r = missingToolSkip('stage_x', 'npx', { + exitCode: 127, + stderr: '/bin/sh: vitest: command not found', + }, ['--offline', '--no-install', 'vitest', 'run']); + expect(r?.exitCode).toBe(2); + expect(r?.stderr).toContain('setup gap'); + expect(r?.stderr).toContain('not installed'); + }); + + test('missing helper inside a resolved npx tool remains a failure', () => { + expect(missingToolSkip('stage_x', 'npx', { + exitCode: 127, + stderr: '/bin/sh: project-helper: command not found', + }, ['--offline', '--no-install', 'vitest', 'run'])).toBeNull(); + }); + + test('shell-level command miss from a project-owned npm script remains a failure', () => { + expect(missingToolSkip('stage_x', 'npm', { + exitCode: 127, + stderr: '/bin/sh: project-helper: command not found', + })).toBeNull(); + }); + test('the same text from a project-owned npm script is still a real failure', () => { expect(missingToolSkip('stage_x', 'npm', { exitCode: 1, From b74a73b923f71a0fabf48d511bf43f2fee58c25d Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Thu, 16 Jul 2026 10:42:16 +0900 Subject: [PATCH 23/28] feat: prepare 0.9.0 natural-language onboarding release --- .claude-plugin/marketplace.json | 2 +- CHANGELOG.md | 35 +++ README.html | 6 +- README.ja.md | 8 +- README.ko.html | 6 +- README.ko.md | 5 +- README.md | 6 +- README.zh.md | 8 +- docs/setup.md | 3 + package-lock.json | 4 +- package.json | 5 +- .../claude-code/.claude-plugin/plugin.json | 2 +- plugins/claude-code/dist/clad.js | 260 +++++++++--------- plugins/codex/.codex-plugin/plugin.json | 2 +- plugins/gemini-cli/gemini-extension.json | 2 +- scripts/test-count.d.mts | 52 ++++ scripts/test-count.mjs | 140 ++++++++++ scripts/version-bump.mjs | 82 ++++-- spec.yaml | 4 +- .../natural-language-init-0f4dd6.yaml | 5 +- spec/features/self-count-guard-898783ee.yaml | 16 ++ spec/features/version-bump-script-6d943d.yaml | 18 +- spec/index.yaml | 4 +- src/cli/clad.ts | 2 +- src/serve/server.ts | 38 ++- tests/cli/clad.test.ts | 2 +- tests/scripts/test-count.test.ts | 27 ++ tests/scripts/version-bump.test.ts | 32 ++- tests/serve/init-tools.test.ts | 30 +- tests/serve/server.test.ts | 28 +- 30 files changed, 614 insertions(+), 220 deletions(-) create mode 100644 scripts/test-count.d.mts create mode 100644 scripts/test-count.mjs create mode 100644 tests/scripts/test-count.test.ts diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index dcc42728..67986288 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -9,7 +9,7 @@ "name": "claude-code", "source": "./plugins/claude-code", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Claude Code.", - "version": "0.8.3", + "version": "0.9.0", "author": { "name": "qwerfunch" }, diff --git a/CHANGELOG.md b/CHANGELOG.md index afeb89b6..0dba9573 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,41 @@ 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). +## [0.9.0] — Project-scoped natural-language onboarding (2026-07-16) + +**In one line:** apply Cladding from ordinary conversation without a shell command, while project-local discovery, a read-only preview, an exact approval phrase, and atomic recovery keep onboarding bounded. + +### MCP host (clad serve) + +- **Start from an idea, a complete UTF-8 planning document, or an existing codebase.** The host reuses the CLI onboarding engine, keeps the full document and observed source evidence, and asks at most three material follow-up questions only when decisions remain open. +- **Preview before any authored file changes.** Initialization requires the exact one-time phrase shown after validation and staging; malformed, stale, replayed, or partially applied drafts leave the project at its pre-apply content. +- **Resume across host restarts.** Process-per-turn hosts retain the exact staged draft in ignored project runtime state instead of reconstructing intent from an approval code. +- **Keep activation inside the selected project.** Setup no longer exposes Cladding tools to unrelated projects, removes only provably owned legacy global wiring, and uses the same project runtime for MCP and later shell validation. +- **Expose only the initialization bootstrap before `spec.yaml` exists.** The ordinary development tool surface becomes available after successful initialization. + +### Spec governance (4-tier SSoT) + +- **Onboarding now seeds capabilities and user journeys into the governed design.** Early generated links remain informational until the shared maturity threshold, while invalid references and under-bound flows still block. +- **Completed onboarding hands off to ordinary natural-language development** and distinguishes on-demand checks from opt-in hook or CI enforcement. + +### Gate and toolchain fidelity + +- **JavaScript projects follow their declared tools.** Custom scripts win; Jest, Vitest, ESLint, Biome, and Oxlint are selected from project evidence, and architecture checks include TSX, JSX, JavaScript, and TypeScript. +- **A missing runnable deliverable stays honest.** Safe declared entries run, broken entries block, and an early onboarding seed is not forced to invent an unsafe smoke command. +- **Verification evidence remains non-vacuous.** Done features must execute a passing declared test, spec-conformance oracles preserve full-suite evidence, and unavailable tools remain skips rather than false passes. + +### Also changed + +- The deterministic collector found nine onboarding commit subjects that do not name a spec feature. Their user-visible behavior is covered by the spec-backed notes above, but their commit-to-spec linkage remains absent. + +### 한국어 요약 + +**한 줄 요약:** 이제 셸 명령 없이 자연어로 Cladding을 적용할 수 있으며, 프로젝트 로컬 연결·읽기 전용 미리보기·정확한 승인 문구·원자적 복구가 온보딩 변경 범위를 지킵니다. + +- 아이디어·전체 UTF-8 기획 문서·기존 코드 중 어디서든 시작하고, 결정이 남은 경우에만 최대 3개의 핵심 질문을 받습니다. +- 초기화 전에는 준비용 MCP 도구 3개만 노출되며, 정확한 일회용 승인 문구로 적용한 뒤 전체 개발 도구가 열립니다. +- 호스트가 재시작돼도 검토한 초안을 그대로 적용하고, 실패·오래된 요청·재사용 요청은 프로젝트를 부분 변경 상태로 남기지 않습니다. + ## [0.8.3] — Agent loops that stop honestly, a guard against unverified "done", and a faster check (2026-07-12) This release helps you build AI agent loops that stop when the work is genuinely finished, closes a hole where a feature could look done without its tests ever running, makes the pre-push check faster, and ships native Japanese and Chinese documentation. diff --git a/README.html b/README.html index 70bda688..133460ef 100644 --- a/README.html +++ b/README.html @@ -233,7 +233,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -538,7 +538,7 @@

Status

version
-
v0.8.3
+
v0.9.0
2026-07
@@ -548,7 +548,7 @@

Status

tests
-
2522/2522
+
2556/2556
all pass
diff --git a/README.ja.md b/README.ja.md index f3d46bd0..2aa26a41 100644 --- a/README.ja.md +++ b/README.ja.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -258,17 +258,19 @@ clad setup # このプロジェクトだけに Cladding を接続 # 一つだけ選び、先頭の「#」を外して実行する: # codex # Codex # claude # Claude Code +# gemini # Gemini CLI # agy # Antigravity # cursor-agent # Cursor Agent ``` -`clad setup` は Claude Code・Codex・Antigravity・Cursor の接続を現在のプロジェクト内だけに作る。setup を実行していない別プロジェクトのモデルコンテキストには、Cladding の skill や MCP ツールは入らない。使用する AI ツールのコマンドを一つだけ実行し、Cursor IDE では `` をワークスペースとして開く。setup 後はこのフォルダから新しい AI セッションを開始する。Codex が Git リポジトリを初めて開いて信頼確認を表示した場合は承認する。信頼されるまで Codex はプロジェクト MCP 設定を意図的に読み込まない。 +`clad setup` は Claude Code・Codex・Gemini・Antigravity・Cursor の接続を現在のプロジェクト内だけに作る。setup を実行していない別プロジェクトのモデルコンテキストには、Cladding の skill や MCP ツールは入らない。使用する AI ツールのコマンドを一つだけ実行し、Cursor IDE では `` をワークスペースとして開く。setup 後はこのフォルダから新しい AI セッションを開始する。Codex や Gemini がプロジェクトの信頼確認を表示した場合は、それぞれの通常のセキュリティ境界に従って承認する。信頼されるまでプロジェクトローカルの MCP 設定は意図的に読み込まれない。 ### 3. Cladding を一度適用する 自分の出発点に合う依頼を AI ツールへ自然な言葉で伝える。 Cladding はまずプロジェクトを読み取り専用で調査する。AI が正確なファイル操作と一度限りの承認フレーズを示し、ユーザーが別の返信でそのフレーズをそのまま入力した場合にだけ初期化を開始する。プロジェクトを開いたり Cladding について質問したりするだけでは、ファイルは変更されない。 +この完全一致の手順は偶発的な適用を防ぐが、MCP はツール引数を実際にどのユーザーが作成したかを証明できない。そのため、悪意のある、または侵害されたホストに対するサンドボックスではない。 #### アイデアだけがある場合 @@ -337,7 +339,7 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.8.3(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2522 / 2522 | 15 段階 · 41 detectors | 255(251 done) | +| v0.9.0(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2556 / 2556 | 15 段階 · 41 detectors | 255(251 done) | 236 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック diff --git a/README.ko.html b/README.ko.html index 941818ab..05d434f7 100644 --- a/README.ko.html +++ b/README.ko.html @@ -275,7 +275,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -574,7 +574,7 @@

Status

version
-
v0.8.3
+
v0.9.0
2026-07
@@ -584,7 +584,7 @@

Status

tests
-
2522/2522
+
2556/2556
all pass
diff --git a/README.ko.md b/README.ko.md index eda7c120..b22799b7 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -269,6 +269,7 @@ clad setup # 이 프로젝트에만 AI 도구 연결 자신의 시작 상황에 맞는 요청을 AI 도구에 자연스럽게 말한다. Cladding은 먼저 프로젝트를 읽기 전용으로 조사한다. AI가 정확한 파일 작업과 일회용 승인 문구를 보여주며, 사용자가 별도 답변에서 그 문구를 그대로 입력해야만 초기화가 시작된다. 프로젝트를 열거나 Cladding에 관해 질문하는 것만으로는 어떤 파일도 변경되지 않는다. +이 정확 일치 단계는 우발적인 적용을 막지만, MCP는 도구 인자를 실제로 어느 사용자가 만들었는지 증명할 수 없다. 따라서 악의적이거나 침해된 호스트를 격리하는 샌드박스로 보아서는 안 된다. #### 아이디어만 있을 때 @@ -337,7 +338,7 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.8.3 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2522 / 2522 · all pass | 15 단계 · 41 detectors | 255 · 251 done · 자기 스펙 | +| v0.9.0 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2556 / 2556 · all pass | 15 단계 · 41 detectors | 255 · 251 done · 자기 스펙 | 236 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 diff --git a/README.md b/README.md index c53fc171..3bbeb866 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -273,6 +273,8 @@ Choose the starting point that fits and say it naturally in your AI tool. Cladding first inspects the project without changing it. Your AI shows the exact file operations and a one-time approval phrase; initialization begins only when you repeat that phrase in a separate reply. Opening a project or asking a question about Cladding never authorizes file changes. +This exact-match step prevents accidental application; MCP cannot prove which user produced a tool +argument, so it is not a sandbox against a malicious or compromised host. #### An idea, nothing else @@ -348,7 +350,7 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.8.3 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2522 / 2522 | 15 stages · 41 detectors | 255 (251 done) | +| v0.9.0 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2556 / 2556 | 15 stages · 41 detectors | 255 (251 done) | 236 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector diff --git a/README.zh.md b/README.zh.md index 7f08495b..3ce9d583 100644 --- a/README.zh.md +++ b/README.zh.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -254,17 +254,19 @@ clad setup # 只为这个项目连接 Cladding # 只选择一个,并删除行首的“#”后运行: # codex # Codex # claude # Claude Code +# gemini # Gemini CLI # agy # Antigravity # cursor-agent # Cursor Agent ``` -`clad setup` 只在当前项目内创建 Claude Code、Codex、Antigravity 和 Cursor 的连接。没有运行 setup 的其他项目,其模型上下文不会出现 Cladding skill 或 MCP 工具。只需运行自己所用 AI 工具对应的一条命令;使用 Cursor IDE 时,把 `` 作为工作区打开。setup 后请从此文件夹启动新的 AI 会话。Codex 首次打开 Git 仓库并询问是否信任项目时,请确认信任;在此之前,Codex 会有意忽略项目 MCP 配置。 +`clad setup` 只在当前项目内创建 Claude Code、Codex、Gemini、Antigravity 和 Cursor 的连接。没有运行 setup 的其他项目,其模型上下文不会出现 Cladding skill 或 MCP 工具。只需运行自己所用 AI 工具对应的一条命令;使用 Cursor IDE 时,把 `` 作为工作区打开。setup 后请从此文件夹启动新的 AI 会话。Codex 或 Gemini 询问是否信任项目时,请按照各自主机的正常安全边界确认;在此之前,项目本地 MCP 配置会被有意忽略。 ### 3. 为项目应用一次 Cladding 根据自己的起点,用自然语言告诉 AI 工具。 Cladding 会先以只读方式检查项目。AI 会展示准确的文件操作和一次性批准短语;只有当用户在单独回复中原样输入该短语时,初始化才会开始。仅仅打开项目或询问 Cladding 不会修改任何文件。 +这种精确匹配可防止意外应用,但 MCP 无法证明工具参数实际上由哪位用户提供;因此它不是隔离恶意或已受侵主机的沙箱。 #### 只有一个想法时 @@ -333,7 +335,7 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.8.3(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2522 / 2522 | 15 阶段 · 41 检测器 | 255(251 done) | +| v0.9.0(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2556 / 2556 | 15 阶段 · 41 检测器 | 255(251 done) | 234 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/docs/setup.md b/docs/setup.md index 8d500886..378315a8 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -66,6 +66,9 @@ Initialization never writes immediately from the first natural-language request. the planned file operations and shows a one-time approval phrase; only a separate user reply that exactly repeats that phrase authorizes the write step. Questions, paraphrases, merely opening a project, asking about Cladding, or running `clad setup` are not consent. +Exact matching prevents accidental application, but standard MCP does not prove which user produced +a tool argument. Treat the host as part of the trust boundary; this confirmation is not a sandbox +against a malicious or compromised host. | Host | Primary request | Optional explicit invocation | |---|---|---| diff --git a/package-lock.json b/package-lock.json index d2e2dffd..425017f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cladding", - "version": "0.8.3", + "version": "0.9.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cladding", - "version": "0.8.3", + "version": "0.9.0", "license": "MIT", "dependencies": { "@anthropic-ai/sdk": "^0.96.0", diff --git a/package.json b/package.json index 0a864023..d63f320f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.8.3", + "version": "0.9.0", "description": "Spec-driven verification layer for AI coding agents — Claude Code · Codex · Gemini · Antigravity · Cursor. Intent in before it writes, result verified against your spec after. Reference implementation of the Ironclad standard.", "type": "module", "license": "MIT", @@ -60,10 +60,11 @@ "test": "vitest run", "typecheck": "tsc --noEmit", "lint": "eslint .", - "build": "node scripts/build.mjs && node scripts/build-plugin.mjs", + "build": "node scripts/test-count.mjs --check && node scripts/build.mjs && node scripts/build-plugin.mjs", "build:plugin": "node scripts/build-plugin.mjs", "watch": "node --watch-path=./src scripts/build.mjs", "version-bump": "node scripts/version-bump.mjs", + "test-count": "node scripts/test-count.mjs", "prepare": "node -e \"require('node:fs').existsSync('dist/clad.js') || require('node:child_process').execSync('npm run build', {stdio: 'inherit'})\"", "prepublishOnly": "npm run build" }, diff --git a/plugins/claude-code/.claude-plugin/plugin.json b/plugins/claude-code/.claude-plugin/plugin.json index 43bbdcdd..9afa72c4 100644 --- a/plugins/claude-code/.claude-plugin/plugin.json +++ b/plugins/claude-code/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.8.3", + "version": "0.9.0", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Claude Code.", "author": { "name": "qwerfunch" diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 33851346..76b60cef 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -29,8 +29,8 @@ Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._life `),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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Vde(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=a4(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=a4(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=>Hde(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=lo.basename(e,lo.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(Ue.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 c4(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 MA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}FA.Command=jA;FA.useColor=MA});var p4=v(xn=>{var{Argument:u4}=py(),{Command:LA}=l4(),{CommanderError:Wde,InvalidArgumentError:d4}=Qd(),{Help:Kde}=OA(),{Option:f4}=CA();xn.program=new LA;xn.createCommand=t=>new LA(t);xn.createOption=(t,e)=>new f4(t,e);xn.createArgument=(t,e)=>new u4(t,e);xn.Command=LA;xn.Option=f4;xn.Argument=u4;xn.Help=Kde;xn.CommanderError=Wde;xn.InvalidArgumentError=d4;xn.InvalidOptionArgumentError=d4});var Ce=v(Xt=>{"use strict";var UA=Symbol.for("yaml.alias"),y4=Symbol.for("yaml.document"),hy=Symbol.for("yaml.map"),_4=Symbol.for("yaml.pair"),qA=Symbol.for("yaml.scalar"),gy=Symbol.for("yaml.seq"),uo=Symbol.for("yaml.node.type"),tfe=t=>!!t&&typeof t=="object"&&t[uo]===UA,rfe=t=>!!t&&typeof t=="object"&&t[uo]===y4,nfe=t=>!!t&&typeof t=="object"&&t[uo]===hy,ife=t=>!!t&&typeof t=="object"&&t[uo]===_4,b4=t=>!!t&&typeof t=="object"&&t[uo]===qA,ofe=t=>!!t&&typeof t=="object"&&t[uo]===gy;function v4(t){if(t&&typeof t=="object")switch(t[uo]){case hy:case gy:return!0}return!1}function sfe(t){if(t&&typeof t=="object")switch(t[uo]){case UA:case hy:case qA:case gy:return!0}return!1}var afe=t=>(b4(t)||v4(t))&&!!t.anchor;Xt.ALIAS=UA;Xt.DOC=y4;Xt.MAP=hy;Xt.NODE_TYPE=uo;Xt.PAIR=_4;Xt.SCALAR=qA;Xt.SEQ=gy;Xt.hasAnchor=afe;Xt.isAlias=tfe;Xt.isCollection=v4;Xt.isDocument=rfe;Xt.isMap=nfe;Xt.isNode=sfe;Xt.isPair=ife;Xt.isScalar=b4;Xt.isSeq=ofe});var ef=v(BA=>{"use strict";var zt=Ce(),Cr=Symbol("break visit"),S4=Symbol("skip children"),xi=Symbol("remove node");function yy(t,e){let r=w4(e);zt.isDocument(t)?Zc(null,t.contents,r,Object.freeze([t]))===xi&&(t.contents=null):Zc(null,t,r,Object.freeze([]))}yy.BREAK=Cr;yy.SKIP=S4;yy.REMOVE=xi;function Zc(t,e,r,n){let i=x4(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return $4(t,n,i),Zc(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var k4=Ce(),cfe=ef(),lfe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ufe=t=>t.replace(/[!,[\]{}]/g,e=>lfe[e]),tf=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+ufe(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&&k4.isNode(e.contents)){let o={};cfe.visit(e.contents,(s,a)=>{k4.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(` -`)}};tf.defaultYaml={explicit:!1,version:"1.2"};tf.defaultTags={"!!":"tag:yaml.org,2002:"};E4.Directives=tf});var by=v(rf=>{"use strict";var A4=Ce(),dfe=ef();function ffe(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 T4(t){let e=new Set;return dfe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function O4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function pfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=T4(t));let s=O4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(A4.isScalar(s.node)||A4.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}}rf.anchorIsValid=ffe;rf.anchorNames=T4;rf.createNodeAnchors=pfe;rf.findNewAnchor=O4});var GA=v(R4=>{"use strict";function nf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var mfe=Ce();function I4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>I4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!mfe.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}P4.toJS=I4});var vy=v(D4=>{"use strict";var hfe=GA(),C4=Ce(),gfe=Go(),ZA=class{constructor(e){Object.defineProperty(this,C4.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(!C4.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=gfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?hfe.applyReviver(o,{"":a},"",a):a}};D4.NodeBase=ZA});var of=v(N4=>{"use strict";var yfe=by(),_fe=ef(),Wc=Ce(),bfe=vy(),vfe=Go(),VA=class extends bfe.NodeBase{constructor(e){super(Wc.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=[],_fe.visit(e,{Node:(o,s)=>{(Wc.isAlias(s)||Wc.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||(vfe.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=Sy(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(yfe.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 Sy(t,e,r){if(Wc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Wc.isCollection(e)){let n=0;for(let i of e.items){let o=Sy(t,i,r);o>n&&(n=o)}return n}else if(Wc.isPair(e)){let n=Sy(t,e.key,r),i=Sy(t,e.value,r);return Math.max(n,i)}return 1}N4.Alias=VA});var Ct=v(WA=>{"use strict";var Sfe=Ce(),wfe=vy(),xfe=Go(),$fe=t=>!t||typeof t!="function"&&typeof t!="object",Zo=class extends wfe.NodeBase{constructor(e){super(Sfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:xfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Zo.BLOCK_FOLDED="BLOCK_FOLDED";Zo.BLOCK_LITERAL="BLOCK_LITERAL";Zo.PLAIN="PLAIN";Zo.QUOTE_DOUBLE="QUOTE_DOUBLE";Zo.QUOTE_SINGLE="QUOTE_SINGLE";WA.Scalar=Zo;WA.isScalarValue=$fe});var sf=v(M4=>{"use strict";var kfe=of(),ua=Ce(),j4=Ct(),Efe="tag:yaml.org,2002:";function Afe(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 Tfe(t,e,r){if(ua.isDocument(t)&&(t=t.contents),ua.isNode(t))return t;if(ua.isPair(t)){let d=r.schema[ua.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 kfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Efe+e.slice(2));let l=Afe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new j4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ua.MAP]:Symbol.iterator in Object(t)?s[ua.SEQ]:s[ua.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 j4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}M4.createNode=Tfe});var xy=v(wy=>{"use strict";var Ofe=sf(),$i=Ce(),Rfe=vy();function KA(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 Ofe.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 F4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,JA=class extends Rfe.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=>$i.isNode(n)||$i.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(F4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if($i.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,KA(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($i.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&&$i.isScalar(o)?o.value:o:$i.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!$i.isPair(r))return!1;let n=r.value;return n==null||e&&$i.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 $i.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($i.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,KA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};wy.Collection=JA;wy.collectionFromPath=KA;wy.isEmptyPath=F4});var af=v($y=>{"use strict";var Ife=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function YA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Pfe=(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 c4(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 MA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}FA.Command=jA;FA.useColor=MA});var p4=v($n=>{var{Argument:u4}=py(),{Command:LA}=l4(),{CommanderError:Wde,InvalidArgumentError:d4}=Qd(),{Help:Kde}=OA(),{Option:f4}=CA();$n.program=new LA;$n.createCommand=t=>new LA(t);$n.createOption=(t,e)=>new f4(t,e);$n.createArgument=(t,e)=>new u4(t,e);$n.Command=LA;$n.Option=f4;$n.Argument=u4;$n.Help=Kde;$n.CommanderError=Wde;$n.InvalidArgumentError=d4;$n.InvalidOptionArgumentError=d4});var Ce=v(Xt=>{"use strict";var UA=Symbol.for("yaml.alias"),y4=Symbol.for("yaml.document"),hy=Symbol.for("yaml.map"),_4=Symbol.for("yaml.pair"),qA=Symbol.for("yaml.scalar"),gy=Symbol.for("yaml.seq"),uo=Symbol.for("yaml.node.type"),tfe=t=>!!t&&typeof t=="object"&&t[uo]===UA,rfe=t=>!!t&&typeof t=="object"&&t[uo]===y4,nfe=t=>!!t&&typeof t=="object"&&t[uo]===hy,ife=t=>!!t&&typeof t=="object"&&t[uo]===_4,b4=t=>!!t&&typeof t=="object"&&t[uo]===qA,ofe=t=>!!t&&typeof t=="object"&&t[uo]===gy;function v4(t){if(t&&typeof t=="object")switch(t[uo]){case hy:case gy:return!0}return!1}function sfe(t){if(t&&typeof t=="object")switch(t[uo]){case UA:case hy:case qA:case gy:return!0}return!1}var afe=t=>(b4(t)||v4(t))&&!!t.anchor;Xt.ALIAS=UA;Xt.DOC=y4;Xt.MAP=hy;Xt.NODE_TYPE=uo;Xt.PAIR=_4;Xt.SCALAR=qA;Xt.SEQ=gy;Xt.hasAnchor=afe;Xt.isAlias=tfe;Xt.isCollection=v4;Xt.isDocument=rfe;Xt.isMap=nfe;Xt.isNode=sfe;Xt.isPair=ife;Xt.isScalar=b4;Xt.isSeq=ofe});var ef=v(BA=>{"use strict";var zt=Ce(),Cr=Symbol("break visit"),S4=Symbol("skip children"),xi=Symbol("remove node");function yy(t,e){let r=w4(e);zt.isDocument(t)?Zc(null,t.contents,r,Object.freeze([t]))===xi&&(t.contents=null):Zc(null,t,r,Object.freeze([]))}yy.BREAK=Cr;yy.SKIP=S4;yy.REMOVE=xi;function Zc(t,e,r,n){let i=x4(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return $4(t,n,i),Zc(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var k4=Ce(),cfe=ef(),lfe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ufe=t=>t.replace(/[!,[\]{}]/g,e=>lfe[e]),tf=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+ufe(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&&k4.isNode(e.contents)){let o={};cfe.visit(e.contents,(s,a)=>{k4.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(` +`)}};tf.defaultYaml={explicit:!1,version:"1.2"};tf.defaultTags={"!!":"tag:yaml.org,2002:"};E4.Directives=tf});var by=v(rf=>{"use strict";var A4=Ce(),dfe=ef();function ffe(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 T4(t){let e=new Set;return dfe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function O4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function pfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=T4(t));let s=O4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(A4.isScalar(s.node)||A4.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}}rf.anchorIsValid=ffe;rf.anchorNames=T4;rf.createNodeAnchors=pfe;rf.findNewAnchor=O4});var GA=v(R4=>{"use strict";function nf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var mfe=Ce();function I4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>I4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!mfe.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}P4.toJS=I4});var vy=v(D4=>{"use strict";var hfe=GA(),C4=Ce(),gfe=Go(),ZA=class{constructor(e){Object.defineProperty(this,C4.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(!C4.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=gfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?hfe.applyReviver(o,{"":a},"",a):a}};D4.NodeBase=ZA});var of=v(N4=>{"use strict";var yfe=by(),_fe=ef(),Wc=Ce(),bfe=vy(),vfe=Go(),VA=class extends bfe.NodeBase{constructor(e){super(Wc.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=[],_fe.visit(e,{Node:(o,s)=>{(Wc.isAlias(s)||Wc.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||(vfe.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=Sy(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(yfe.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 Sy(t,e,r){if(Wc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Wc.isCollection(e)){let n=0;for(let i of e.items){let o=Sy(t,i,r);o>n&&(n=o)}return n}else if(Wc.isPair(e)){let n=Sy(t,e.key,r),i=Sy(t,e.value,r);return Math.max(n,i)}return 1}N4.Alias=VA});var Ct=v(WA=>{"use strict";var Sfe=Ce(),wfe=vy(),xfe=Go(),$fe=t=>!t||typeof t!="function"&&typeof t!="object",Zo=class extends wfe.NodeBase{constructor(e){super(Sfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:xfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Zo.BLOCK_FOLDED="BLOCK_FOLDED";Zo.BLOCK_LITERAL="BLOCK_LITERAL";Zo.PLAIN="PLAIN";Zo.QUOTE_DOUBLE="QUOTE_DOUBLE";Zo.QUOTE_SINGLE="QUOTE_SINGLE";WA.Scalar=Zo;WA.isScalarValue=$fe});var sf=v(M4=>{"use strict";var kfe=of(),la=Ce(),j4=Ct(),Efe="tag:yaml.org,2002:";function Afe(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 Tfe(t,e,r){if(la.isDocument(t)&&(t=t.contents),la.isNode(t))return t;if(la.isPair(t)){let d=r.schema[la.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 kfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Efe+e.slice(2));let l=Afe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new j4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[la.MAP]:Symbol.iterator in Object(t)?s[la.SEQ]:s[la.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 j4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}M4.createNode=Tfe});var xy=v(wy=>{"use strict";var Ofe=sf(),$i=Ce(),Rfe=vy();function KA(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 Ofe.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 F4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,JA=class extends Rfe.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=>$i.isNode(n)||$i.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(F4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if($i.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,KA(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($i.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&&$i.isScalar(o)?o.value:o:$i.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!$i.isPair(r))return!1;let n=r.value;return n==null||e&&$i.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 $i.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($i.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,KA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};wy.Collection=JA;wy.collectionFromPath=KA;wy.isEmptyPath=F4});var af=v($y=>{"use strict";var Ife=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function YA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Pfe=(t,e,r)=>t.endsWith(` `)?YA(r,e):r.includes(` `)?` `+YA(r,e):(t.endsWith(" ")?"":" ")+r;$y.indentComment=YA;$y.lineComment=Pfe;$y.stringifyComment=Ife});var z4=v(cf=>{"use strict";var Cfe="flow",XA="block",ky="quoted";function Dfe(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===XA&&(h=L4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===ky&&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===` @@ -72,20 +72,20 @@ ${ff.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` ${r.indent}`}else if(!p&&fo.isCollection(e)){let T=w[0],A=w.indexOf(` `),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let ie=!1;if(D&&(T==="&"||T==="!")){let J=w.indexOf(" ");T==="&"&&J!==-1&&J{"use strict";var Z4=Ge("process");function Zfe(t,...e){t==="debug"&&console.log(...e)}function Vfe(t,e){(t==="debug"||t==="warn")&&(typeof Z4.emitWarning=="function"?Z4.emitWarning(e):console.warn(e))}rT.debug=Zfe;rT.warn=Vfe});var Cy=v(Py=>{"use strict";var Iy=Ce(),V4=Ct(),Oy="<<",Ry={identify:t=>t===Oy||typeof t=="symbol"&&t.description===Oy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new V4.Scalar(Symbol(Oy)),{addToJSMap:W4}),stringify:()=>Oy},Wfe=(t,e)=>(Ry.identify(e)||Iy.isScalar(e)&&(!e.type||e.type===V4.Scalar.PLAIN)&&Ry.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Ry.tag&&r.default);function W4(t,e,r){let n=K4(t,r);if(Iy.isSeq(n))for(let i of n.items)iT(t,e,i);else if(Array.isArray(n))for(let i of n)iT(t,e,i);else iT(t,e,n)}function iT(t,e,r){let n=K4(t,r);if(!Iy.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 K4(t,e){return t&&Iy.isAlias(e)?e.resolve(t.doc,t):e}Py.addMergeToJSMap=W4;Py.isMergeKey=Wfe;Py.merge=Ry});var sT=v(X4=>{"use strict";var Kfe=nT(),J4=Cy(),Jfe=df(),Y4=Ce(),oT=Go();function Yfe(t,e,{key:r,value:n}){if(Y4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(J4.isMergeKey(t,r))J4.addMergeToJSMap(t,e,n);else{let i=oT.toJS(r,"",t);if(e instanceof Map)e.set(i,oT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Xfe(r,i,t),s=oT.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 Xfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(Y4.isNode(t)&&r?.doc){let n=Jfe.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)+'..."'),Kfe.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)}X4.addPairToJSMap=Yfe});var Ko=v(aT=>{"use strict";var Q4=sf(),Qfe=G4(),epe=sT(),Dy=Ce();function tpe(t,e,r){let n=Q4.createNode(t,void 0,r),i=Q4.createNode(e,void 0,r);return new Ny(n,i)}var Ny=class t{constructor(e,r=null){Object.defineProperty(this,Dy.NODE_TYPE,{value:Dy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Dy.isNode(r)&&(r=r.clone(e)),Dy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return epe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Qfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};aT.Pair=Ny;aT.createPair=tpe});var cT=v(t6=>{"use strict";var da=Ce(),e6=df(),jy=af();function rpe(t,e,r){return(e.inFlow??t.flow?ipe:npe)(t,e,r)}function npe({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+=jy.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 Z4=Ge("process");function Zfe(t,...e){t==="debug"&&console.log(...e)}function Vfe(t,e){(t==="debug"||t==="warn")&&(typeof Z4.emitWarning=="function"?Z4.emitWarning(e):console.warn(e))}rT.debug=Zfe;rT.warn=Vfe});var Cy=v(Py=>{"use strict";var Iy=Ce(),V4=Ct(),Oy="<<",Ry={identify:t=>t===Oy||typeof t=="symbol"&&t.description===Oy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new V4.Scalar(Symbol(Oy)),{addToJSMap:W4}),stringify:()=>Oy},Wfe=(t,e)=>(Ry.identify(e)||Iy.isScalar(e)&&(!e.type||e.type===V4.Scalar.PLAIN)&&Ry.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Ry.tag&&r.default);function W4(t,e,r){let n=K4(t,r);if(Iy.isSeq(n))for(let i of n.items)iT(t,e,i);else if(Array.isArray(n))for(let i of n)iT(t,e,i);else iT(t,e,n)}function iT(t,e,r){let n=K4(t,r);if(!Iy.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 K4(t,e){return t&&Iy.isAlias(e)?e.resolve(t.doc,t):e}Py.addMergeToJSMap=W4;Py.isMergeKey=Wfe;Py.merge=Ry});var sT=v(X4=>{"use strict";var Kfe=nT(),J4=Cy(),Jfe=df(),Y4=Ce(),oT=Go();function Yfe(t,e,{key:r,value:n}){if(Y4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(J4.isMergeKey(t,r))J4.addMergeToJSMap(t,e,n);else{let i=oT.toJS(r,"",t);if(e instanceof Map)e.set(i,oT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Xfe(r,i,t),s=oT.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 Xfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(Y4.isNode(t)&&r?.doc){let n=Jfe.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)+'..."'),Kfe.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)}X4.addPairToJSMap=Yfe});var Ko=v(aT=>{"use strict";var Q4=sf(),Qfe=G4(),epe=sT(),Dy=Ce();function tpe(t,e,r){let n=Q4.createNode(t,void 0,r),i=Q4.createNode(e,void 0,r);return new Ny(n,i)}var Ny=class t{constructor(e,r=null){Object.defineProperty(this,Dy.NODE_TYPE,{value:Dy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Dy.isNode(r)&&(r=r.clone(e)),Dy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return epe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Qfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};aT.Pair=Ny;aT.createPair=tpe});var cT=v(t6=>{"use strict";var ua=Ce(),e6=df(),jy=af();function rpe(t,e,r){return(e.inFlow??t.flow?ipe:npe)(t,e,r)}function npe({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+=jy.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(` +`+jy.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function ipe({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+=jy.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 My({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=jy.indentComment(e(n),t);r.push(o.trimStart())}}t6.stringifyCollection=rpe});var Yo=v(uT=>{"use strict";var ope=cT(),spe=sT(),ape=xy(),Jo=Ce(),Fy=Ko(),cpe=Ct();function pf(t,e){let r=Jo.isScalar(e)?e.value:e;for(let n of t)if(Jo.isPair(n)&&(n.key===e||n.key===r||Jo.isScalar(n.key)&&n.key.value===r))return n}var lT=class extends ape.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Jo.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(Fy.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;Jo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Fy.Pair(e,e?.value):n=new Fy.Pair(e.key,e.value);let i=pf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Jo.isScalar(i.value)&&cpe.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=pf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=pf(this.items,e)?.value;return(!r&&Jo.isScalar(i)?i.value:i)??void 0}has(e){return!!pf(this.items,e)}set(e,r){this.add(new Fy.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)spe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Jo.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})),ope.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};uT.YAMLMap=lT;uT.findPair=pf});var Jc=v(n6=>{"use strict";var lpe=Ce(),r6=Yo(),upe={collection:"map",default:!0,nodeClass:r6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return lpe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>r6.YAMLMap.from(t,e,r)};n6.map=upe});var Xo=v(i6=>{"use strict";var dpe=sf(),fpe=cT(),ppe=xy(),zy=Ce(),mpe=Ct(),hpe=Go(),dT=class extends ppe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(zy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Ly(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Ly(e);if(typeof n!="number")return;let i=this.items[n];return!r&&zy.isScalar(i)?i.value:i}has(e){let r=Ly(e);return typeof r=="number"&&r=0?e:null}i6.YAMLSeq=dT});var Yc=v(s6=>{"use strict";var gpe=Ce(),o6=Xo(),ype={collection:"seq",default:!0,nodeClass:o6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return gpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>o6.YAMLSeq.from(t,e,r)};s6.seq=ype});var mf=v(a6=>{"use strict";var _pe=uf(),bpe={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),_pe.stringifyString(t,e,r,n)}};a6.string=bpe});var Uy=v(u6=>{"use strict";var c6=Ct(),l6={identify:t=>t==null,createNode:()=>new c6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new c6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&l6.test.test(t)?t:e.options.nullStr};u6.nullTag=l6});var fT=v(f6=>{"use strict";var vpe=Ct(),d6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new vpe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&d6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};f6.boolTag=d6});var Xc=v(p6=>{"use strict";function Spe({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}p6.stringifyNumber=Spe});var mT=v(qy=>{"use strict";var wpe=Ct(),pT=Xc(),xpe={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:pT.stringifyNumber},$pe={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():pT.stringifyNumber(t)}},kpe={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 wpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:pT.stringifyNumber};qy.float=kpe;qy.floatExp=$pe;qy.floatNaN=xpe});var gT=v(Hy=>{"use strict";var m6=Xc(),By=t=>typeof t=="bigint"||Number.isInteger(t),hT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function h6(t,e,r){let{value:n}=t;return By(n)&&n>=0?r+n.toString(e):m6.stringifyNumber(t)}var Epe={identify:t=>By(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>hT(t,2,8,r),stringify:t=>h6(t,8,"0o")},Ape={identify:By,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>hT(t,0,10,r),stringify:m6.stringifyNumber},Tpe={identify:t=>By(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>hT(t,2,16,r),stringify:t=>h6(t,16,"0x")};Hy.int=Ape;Hy.intHex=Tpe;Hy.intOct=Epe});var y6=v(g6=>{"use strict";var Ope=Jc(),Rpe=Uy(),Ipe=Yc(),Ppe=mf(),Cpe=fT(),yT=mT(),_T=gT(),Dpe=[Ope.map,Ipe.seq,Ppe.string,Rpe.nullTag,Cpe.boolTag,_T.intOct,_T.int,_T.intHex,yT.floatNaN,yT.floatExp,yT.float];g6.schema=Dpe});var v6=v(b6=>{"use strict";var Npe=Ct(),jpe=Jc(),Mpe=Yc();function _6(t){return typeof t=="bigint"||Number.isInteger(t)}var Gy=({value:t})=>JSON.stringify(t),Fpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Gy},{identify:t=>t==null,createNode:()=>new Npe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Gy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Gy},{identify:_6,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})=>_6(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:Gy}],Lpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},zpe=[jpe.map,Mpe.seq].concat(Fpe,Lpe);b6.schema=zpe});var vT=v(S6=>{"use strict";var hf=Ge("buffer"),bT=Ct(),Upe=uf(),qpe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof hf.Buffer=="function")return hf.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 Zy=Ce(),ST=Ko(),Bpe=Ct(),Hpe=Xo();function w6(t,e){if(Zy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new ST.Pair(new Bpe.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]=Zy.isPair(n)?n:new ST.Pair(n)}}else e("Expected a sequence for this tag");return t}function x6(t,e,r){let{replacer:n}=r,i=new Hpe.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(ST.createPair(a,c,r))}return i}var Gpe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:w6,createNode:x6};Vy.createPairs=x6;Vy.pairs=Gpe;Vy.resolvePairs=w6});var $T=v(xT=>{"use strict";var $6=Ce(),wT=Go(),gf=Yo(),Zpe=Xo(),k6=Wy(),fa=class t extends Zpe.YAMLSeq{constructor(){super(),this.add=gf.YAMLMap.prototype.add.bind(this),this.delete=gf.YAMLMap.prototype.delete.bind(this),this.get=gf.YAMLMap.prototype.get.bind(this),this.has=gf.YAMLMap.prototype.has.bind(this),this.set=gf.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($6.isPair(i)?(o=wT.toJS(i.key,"",r),s=wT.toJS(i.value,o,r)):o=wT.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=k6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};fa.tag="tag:yaml.org,2002:omap";var Vpe={collection:"seq",identify:t=>t instanceof Map,nodeClass:fa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=k6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)$6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new fa,r)},createNode:(t,e,r)=>fa.from(t,e,r)};xT.YAMLOMap=fa;xT.omap=Vpe});var R6=v(kT=>{"use strict";var E6=Ct();function A6({value:t,source:e},r){return e&&(t?T6:O6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var T6={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 E6.Scalar(!0),stringify:A6},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 E6.Scalar(!1),stringify:A6};kT.falseTag=O6;kT.trueTag=T6});var I6=v(Ky=>{"use strict";var Wpe=Ct(),ET=Xc(),Kpe={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:ET.stringifyNumber},Jpe={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():ET.stringifyNumber(t)}},Ype={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 Wpe.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:ET.stringifyNumber};Ky.float=Ype;Ky.floatExp=Jpe;Ky.floatNaN=Kpe});var C6=v(_f=>{"use strict";var P6=Xc(),yf=t=>typeof t=="bigint"||Number.isInteger(t);function Jy(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 AT(t,e,r){let{value:n}=t;if(yf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return P6.stringifyNumber(t)}var Xpe={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Jy(t,2,2,r),stringify:t=>AT(t,2,"0b")},Qpe={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Jy(t,1,8,r),stringify:t=>AT(t,8,"0")},eme={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Jy(t,0,10,r),stringify:P6.stringifyNumber},tme={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Jy(t,2,16,r),stringify:t=>AT(t,16,"0x")};_f.int=eme;_f.intBin=Xpe;_f.intHex=tme;_f.intOct=Qpe});var OT=v(TT=>{"use strict";var Qy=Ce(),Yy=Ko(),Xy=Yo(),pa=class t extends Xy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Qy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Yy.Pair(e.key,null):r=new Yy.Pair(e,null),Xy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Xy.findPair(this.items,e);return!r&&Qy.isPair(n)?Qy.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=Xy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Yy.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(Yy.createPair(s,null,n));return o}};pa.tag="tag:yaml.org,2002:set";var rme={collection:"map",identify:t=>t instanceof Set,nodeClass:pa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>pa.from(t,e,r),resolve(t,e){if(Qy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new pa,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};TT.YAMLSet=pa;TT.set=rme});var IT=v(e_=>{"use strict";var nme=Xc();function RT(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 nme.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 ime={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})=>RT(t,r),stringify:D6},ome={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=>RT(t,!1),stringify:D6},N6={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(N6.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=RT(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$/,"")??""};e_.floatTime=ome;e_.intTime=ime;e_.timestamp=N6});var F6=v(M6=>{"use strict";var sme=Jc(),ame=Uy(),cme=Yc(),lme=mf(),ume=vT(),j6=R6(),PT=I6(),t_=C6(),dme=Cy(),fme=$T(),pme=Wy(),mme=OT(),CT=IT(),hme=[sme.map,cme.seq,lme.string,ame.nullTag,j6.trueTag,j6.falseTag,t_.intBin,t_.intOct,t_.int,t_.intHex,PT.floatNaN,PT.floatExp,PT.float,ume.binary,dme.merge,fme.omap,pme.pairs,mme.set,CT.intTime,CT.floatTime,CT.timestamp];M6.schema=hme});var W6=v(jT=>{"use strict";var q6=Jc(),gme=Uy(),B6=Yc(),yme=mf(),_me=fT(),DT=mT(),NT=gT(),bme=y6(),vme=v6(),H6=vT(),bf=Cy(),G6=$T(),Z6=Wy(),L6=F6(),V6=OT(),r_=IT(),z6=new Map([["core",bme.schema],["failsafe",[q6.map,B6.seq,yme.string]],["json",vme.schema],["yaml11",L6.schema],["yaml-1.1",L6.schema]]),U6={binary:H6.binary,bool:_me.boolTag,float:DT.float,floatExp:DT.floatExp,floatNaN:DT.floatNaN,floatTime:r_.floatTime,int:NT.int,intHex:NT.intHex,intOct:NT.intOct,intTime:r_.intTime,map:q6.map,merge:bf.merge,null:gme.nullTag,omap:G6.omap,pairs:Z6.pairs,seq:B6.seq,set:V6.set,timestamp:r_.timestamp},Sme={"tag:yaml.org,2002:binary":H6.binary,"tag:yaml.org,2002:merge":bf.merge,"tag:yaml.org,2002:omap":G6.omap,"tag:yaml.org,2002:pairs":Z6.pairs,"tag:yaml.org,2002:set":V6.set,"tag:yaml.org,2002:timestamp":r_.timestamp};function wme(t,e,r){let n=z6.get(e);if(n&&!t)return r&&!n.includes(bf.merge)?n.concat(bf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(z6.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(bf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?U6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(U6).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},[])}jT.coreKnownTags=Sme;jT.getTags=wme});var LT=v(K6=>{"use strict";var MT=Ce(),xme=Jc(),$me=Yc(),kme=mf(),n_=W6(),Eme=(t,e)=>t.keye.key?1:0,FT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?n_.getTags(e,"compat"):e?n_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?n_.coreKnownTags:{},this.tags=n_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,MT.MAP,{value:xme.map}),Object.defineProperty(this,MT.SCALAR,{value:kme.string}),Object.defineProperty(this,MT.SEQ,{value:$me.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Eme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};K6.Schema=FT});var Y6=v(J6=>{"use strict";var Ame=Ce(),zT=df(),vf=af();function Tme(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=zT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(vf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Ame.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(vf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=zT.stringify(t.contents,i,()=>a=null,c);a&&(l+=vf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(zT.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]=Zy.isPair(n)?n:new ST.Pair(n)}}else e("Expected a sequence for this tag");return t}function x6(t,e,r){let{replacer:n}=r,i=new Hpe.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(ST.createPair(a,c,r))}return i}var Gpe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:w6,createNode:x6};Vy.createPairs=x6;Vy.pairs=Gpe;Vy.resolvePairs=w6});var $T=v(xT=>{"use strict";var $6=Ce(),wT=Go(),gf=Yo(),Zpe=Xo(),k6=Wy(),da=class t extends Zpe.YAMLSeq{constructor(){super(),this.add=gf.YAMLMap.prototype.add.bind(this),this.delete=gf.YAMLMap.prototype.delete.bind(this),this.get=gf.YAMLMap.prototype.get.bind(this),this.has=gf.YAMLMap.prototype.has.bind(this),this.set=gf.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($6.isPair(i)?(o=wT.toJS(i.key,"",r),s=wT.toJS(i.value,o,r)):o=wT.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=k6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};da.tag="tag:yaml.org,2002:omap";var Vpe={collection:"seq",identify:t=>t instanceof Map,nodeClass:da,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=k6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)$6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new da,r)},createNode:(t,e,r)=>da.from(t,e,r)};xT.YAMLOMap=da;xT.omap=Vpe});var R6=v(kT=>{"use strict";var E6=Ct();function A6({value:t,source:e},r){return e&&(t?T6:O6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var T6={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 E6.Scalar(!0),stringify:A6},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 E6.Scalar(!1),stringify:A6};kT.falseTag=O6;kT.trueTag=T6});var I6=v(Ky=>{"use strict";var Wpe=Ct(),ET=Xc(),Kpe={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:ET.stringifyNumber},Jpe={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():ET.stringifyNumber(t)}},Ype={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 Wpe.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:ET.stringifyNumber};Ky.float=Ype;Ky.floatExp=Jpe;Ky.floatNaN=Kpe});var C6=v(_f=>{"use strict";var P6=Xc(),yf=t=>typeof t=="bigint"||Number.isInteger(t);function Jy(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 AT(t,e,r){let{value:n}=t;if(yf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return P6.stringifyNumber(t)}var Xpe={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Jy(t,2,2,r),stringify:t=>AT(t,2,"0b")},Qpe={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Jy(t,1,8,r),stringify:t=>AT(t,8,"0")},eme={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Jy(t,0,10,r),stringify:P6.stringifyNumber},tme={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Jy(t,2,16,r),stringify:t=>AT(t,16,"0x")};_f.int=eme;_f.intBin=Xpe;_f.intHex=tme;_f.intOct=Qpe});var OT=v(TT=>{"use strict";var Qy=Ce(),Yy=Ko(),Xy=Yo(),fa=class t extends Xy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Qy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Yy.Pair(e.key,null):r=new Yy.Pair(e,null),Xy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Xy.findPair(this.items,e);return!r&&Qy.isPair(n)?Qy.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=Xy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Yy.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(Yy.createPair(s,null,n));return o}};fa.tag="tag:yaml.org,2002:set";var rme={collection:"map",identify:t=>t instanceof Set,nodeClass:fa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>fa.from(t,e,r),resolve(t,e){if(Qy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new fa,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};TT.YAMLSet=fa;TT.set=rme});var IT=v(e_=>{"use strict";var nme=Xc();function RT(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 nme.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 ime={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})=>RT(t,r),stringify:D6},ome={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=>RT(t,!1),stringify:D6},N6={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(N6.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=RT(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$/,"")??""};e_.floatTime=ome;e_.intTime=ime;e_.timestamp=N6});var F6=v(M6=>{"use strict";var sme=Jc(),ame=Uy(),cme=Yc(),lme=mf(),ume=vT(),j6=R6(),PT=I6(),t_=C6(),dme=Cy(),fme=$T(),pme=Wy(),mme=OT(),CT=IT(),hme=[sme.map,cme.seq,lme.string,ame.nullTag,j6.trueTag,j6.falseTag,t_.intBin,t_.intOct,t_.int,t_.intHex,PT.floatNaN,PT.floatExp,PT.float,ume.binary,dme.merge,fme.omap,pme.pairs,mme.set,CT.intTime,CT.floatTime,CT.timestamp];M6.schema=hme});var W6=v(jT=>{"use strict";var q6=Jc(),gme=Uy(),B6=Yc(),yme=mf(),_me=fT(),DT=mT(),NT=gT(),bme=y6(),vme=v6(),H6=vT(),bf=Cy(),G6=$T(),Z6=Wy(),L6=F6(),V6=OT(),r_=IT(),z6=new Map([["core",bme.schema],["failsafe",[q6.map,B6.seq,yme.string]],["json",vme.schema],["yaml11",L6.schema],["yaml-1.1",L6.schema]]),U6={binary:H6.binary,bool:_me.boolTag,float:DT.float,floatExp:DT.floatExp,floatNaN:DT.floatNaN,floatTime:r_.floatTime,int:NT.int,intHex:NT.intHex,intOct:NT.intOct,intTime:r_.intTime,map:q6.map,merge:bf.merge,null:gme.nullTag,omap:G6.omap,pairs:Z6.pairs,seq:B6.seq,set:V6.set,timestamp:r_.timestamp},Sme={"tag:yaml.org,2002:binary":H6.binary,"tag:yaml.org,2002:merge":bf.merge,"tag:yaml.org,2002:omap":G6.omap,"tag:yaml.org,2002:pairs":Z6.pairs,"tag:yaml.org,2002:set":V6.set,"tag:yaml.org,2002:timestamp":r_.timestamp};function wme(t,e,r){let n=z6.get(e);if(n&&!t)return r&&!n.includes(bf.merge)?n.concat(bf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(z6.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(bf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?U6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(U6).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},[])}jT.coreKnownTags=Sme;jT.getTags=wme});var LT=v(K6=>{"use strict";var MT=Ce(),xme=Jc(),$me=Yc(),kme=mf(),n_=W6(),Eme=(t,e)=>t.keye.key?1:0,FT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?n_.getTags(e,"compat"):e?n_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?n_.coreKnownTags:{},this.tags=n_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,MT.MAP,{value:xme.map}),Object.defineProperty(this,MT.SCALAR,{value:kme.string}),Object.defineProperty(this,MT.SEQ,{value:$me.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Eme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};K6.Schema=FT});var Y6=v(J6=>{"use strict";var Ame=Ce(),zT=df(),vf=af();function Tme(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=zT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(vf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Ame.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(vf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=zT.stringify(t.contents,i,()=>a=null,c);a&&(l+=vf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(zT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` `)?(r.push("..."),r.push(vf.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(vf.indentComment(o(c),"")))}return r.join(` `)+` -`}J6.stringifyDocument=Tme});var Sf=v(X6=>{"use strict";var Ome=of(),Qc=xy(),$n=Ce(),Rme=Ko(),Ime=Go(),Pme=LT(),Cme=Y6(),UT=by(),Dme=GA(),Nme=sf(),qT=HA(),BT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$n.NODE_TYPE,{value:$n.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 qT.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,{[$n.NODE_TYPE]:{value:$n.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=$n.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){el(this.contents)&&this.contents.add(e)}addIn(e,r){el(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=UT.anchorNames(this);e.anchor=!r||n.has(r)?UT.findNewAnchor(r||"a",n):r}return new Ome.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}=UT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Nme.createNode(e,u,m);return a&&$n.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 Rme.Pair(i,o)}delete(e){return el(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Qc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):el(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return $n.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Qc.isEmptyPath(e)?!r&&$n.isScalar(this.contents)?this.contents.value:this.contents:$n.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return $n.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Qc.isEmptyPath(e)?this.contents!==void 0:$n.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Qc.collectionFromPath(this.schema,[e],r):el(this.contents)&&this.contents.set(e,r)}setIn(e,r){Qc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Qc.collectionFromPath(this.schema,Array.from(e),r):el(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 qT.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 qT.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 Pme.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=Ime.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"?Dme.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 Cme.stringifyDocument(this,e)}};function el(t){if($n.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}X6.Document=BT});var $f=v(xf=>{"use strict";var wf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},HT=class extends wf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},GT=class extends wf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},jme=(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 +`}J6.stringifyDocument=Tme});var Sf=v(X6=>{"use strict";var Ome=of(),Qc=xy(),kn=Ce(),Rme=Ko(),Ime=Go(),Pme=LT(),Cme=Y6(),UT=by(),Dme=GA(),Nme=sf(),qT=HA(),BT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,kn.NODE_TYPE,{value:kn.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 qT.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,{[kn.NODE_TYPE]:{value:kn.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=kn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){el(this.contents)&&this.contents.add(e)}addIn(e,r){el(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=UT.anchorNames(this);e.anchor=!r||n.has(r)?UT.findNewAnchor(r||"a",n):r}return new Ome.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}=UT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Nme.createNode(e,u,m);return a&&kn.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 Rme.Pair(i,o)}delete(e){return el(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Qc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):el(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return kn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Qc.isEmptyPath(e)?!r&&kn.isScalar(this.contents)?this.contents.value:this.contents:kn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return kn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Qc.isEmptyPath(e)?this.contents!==void 0:kn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Qc.collectionFromPath(this.schema,[e],r):el(this.contents)&&this.contents.set(e,r)}setIn(e,r){Qc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Qc.collectionFromPath(this.schema,Array.from(e),r):el(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 qT.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 qT.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 Pme.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=Ime.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"?Dme.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 Cme.stringifyDocument(this,e)}};function el(t){if(kn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}X6.Document=BT});var $f=v(xf=>{"use strict";var wf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},HT=class extends wf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},GT=class extends wf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},jme=(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} @@ -127,7 +127,7 @@ ${l} `);)n===` `&&(r+=` `),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var vhe={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function She(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}}SB.resolveFlowScalar=hhe});var $B=v(xB=>{"use strict";var ma=Ce(),wB=Ct(),whe=QT(),xhe=tO();function $he(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?whe.resolveBlockScalar(t,e,n):xhe.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[ma.SCALAR]:c?l=khe(t.schema,i,c,r,n):e.type==="scalar"?l=Ehe(t,i,e,n):l=t.schema[ma.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ma.isScalar(d)?d:new wB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new wB.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 khe(t,e,r,n,i){if(r==="!")return t[ma.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[ma.SCALAR])}function Ehe({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[ma.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ma.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}xB.composeScalar=$he});var EB=v(kB=>{"use strict";function Ahe(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}kB.emptyScalarPosition=Ahe});var OB=v(nO=>{"use strict";var The=of(),Ohe=Ce(),Rhe=_B(),AB=$B(),Ihe=tl(),Phe=EB(),Che={composeNode:TB,composeEmptyNode:rO};function TB(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=Dhe(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=AB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Rhe.composeCollection(Che,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=rO(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&&(!Ohe.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 rO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Phe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=AB.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 Dhe({options:t},{offset:e,source:r,end:n},i){let o=new The.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=Ihe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}nO.composeEmptyNode=rO;nO.composeNode=TB});var PB=v(IB=>{"use strict";var Nhe=Sf(),RB=OB(),jhe=tl(),Mhe=kf();function Fhe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Nhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Mhe.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=jhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}IB.composeDoc=Fhe});var oO=v(NB=>{"use strict";var Lhe=Ge("process"),zhe=HA(),Uhe=Sf(),Ef=$f(),CB=Ce(),qhe=PB(),Bhe=tl();function Af(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 pa=Ce(),wB=Ct(),whe=QT(),xhe=tO();function $he(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?whe.resolveBlockScalar(t,e,n):xhe.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[pa.SCALAR]:c?l=khe(t.schema,i,c,r,n):e.type==="scalar"?l=Ehe(t,i,e,n):l=t.schema[pa.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=pa.isScalar(d)?d:new wB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new wB.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 khe(t,e,r,n,i){if(r==="!")return t[pa.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[pa.SCALAR])}function Ehe({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[pa.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[pa.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}xB.composeScalar=$he});var EB=v(kB=>{"use strict";function Ahe(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}kB.emptyScalarPosition=Ahe});var OB=v(nO=>{"use strict";var The=of(),Ohe=Ce(),Rhe=_B(),AB=$B(),Ihe=tl(),Phe=EB(),Che={composeNode:TB,composeEmptyNode:rO};function TB(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=Dhe(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=AB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Rhe.composeCollection(Che,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=rO(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&&(!Ohe.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 rO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Phe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=AB.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 Dhe({options:t},{offset:e,source:r,end:n},i){let o=new The.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=Ihe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}nO.composeEmptyNode=rO;nO.composeNode=TB});var PB=v(IB=>{"use strict";var Nhe=Sf(),RB=OB(),jhe=tl(),Mhe=kf();function Fhe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Nhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Mhe.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=jhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}IB.composeDoc=Fhe});var oO=v(NB=>{"use strict";var Lhe=Ge("process"),zhe=HA(),Uhe=Sf(),Ef=$f(),CB=Ce(),qhe=PB(),Bhe=tl();function Af(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=Af(r);o?this.warnings.push(new Ef.YAMLWarning(s,n,i)):this.errors.push(new Ef.YAMLParseError(s,n,i))},this.directives=new zhe.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} @@ -142,7 +142,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus `),n=e.substring(0,r),i=e.substring(r+1)+` `;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];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 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})}}}o_.createScalarToken=Whe;o_.resolveAsScalar=Vhe;o_.setScalarValue=Khe});var zB=v(LB=>{"use strict";var Yhe=t=>"type"in t?a_(t):s_(t);function a_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=a_(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+=a_(e)),r)for(let o of r)i+=o.source;return n&&(i+=a_(n)),i}LB.stringify=Yhe});var HB=v(BB=>{"use strict";var aO=Symbol("break visit"),Xhe=Symbol("skip children"),UB=Symbol("remove item");function ha(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),qB(Object.freeze([]),t,e)}ha.BREAK=aO;ha.SKIP=Xhe;ha.REMOVE=UB;ha.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};ha.parentCollection=(t,e)=>{let r=ha.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 qB(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 cO=FB(),Qhe=zB(),ege=HB(),lO="\uFEFF",uO="",dO="",fO="",tge=t=>!!t&&"items"in t,rge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function nge(t){switch(t){case lO:return"";case uO:return"";case dO:return"";case fO:return"";default:return JSON.stringify(t)}}function ige(t){switch(t){case lO:return"byte-order-mark";case uO:return"doc-mode";case dO:return"flow-error-end";case fO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}o_.createScalarToken=Whe;o_.resolveAsScalar=Vhe;o_.setScalarValue=Khe});var zB=v(LB=>{"use strict";var Yhe=t=>"type"in t?a_(t):s_(t);function a_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=a_(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+=a_(e)),r)for(let o of r)i+=o.source;return n&&(i+=a_(n)),i}LB.stringify=Yhe});var HB=v(BB=>{"use strict";var aO=Symbol("break visit"),Xhe=Symbol("skip children"),UB=Symbol("remove item");function ma(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),qB(Object.freeze([]),t,e)}ma.BREAK=aO;ma.SKIP=Xhe;ma.REMOVE=UB;ma.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};ma.parentCollection=(t,e)=>{let r=ma.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 qB(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 cO=FB(),Qhe=zB(),ege=HB(),lO="\uFEFF",uO="",dO="",fO="",tge=t=>!!t&&"items"in t,rge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function nge(t){switch(t){case lO:return"";case uO:return"";case dO:return"";case fO:return"";default:return JSON.stringify(t)}}function ige(t){switch(t){case lO:return"byte-order-mark";case uO:return"doc-mode";case dO:return"flow-error-end";case fO: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}Dr.createScalarToken=cO.createScalarToken;Dr.resolveAsScalar=cO.resolveAsScalar;Dr.setScalarValue=cO.setScalarValue;Dr.stringify=Qhe.stringify;Dr.visit=ege.visit;Dr.BOM=lO;Dr.DOCUMENT=uO;Dr.FLOW_END=dO;Dr.SCALAR=fO;Dr.isCollection=tge;Dr.isScalar=rge;Dr.prettyToken=nge;Dr.tokenType=ige});var hO=v(ZB=>{"use strict";var Tf=c_();function Wn(t){switch(t){case void 0:case" ":case` `:case"\r":case" ":return!0;default:return!1}}var GB=new Set("0123456789ABCDEFabcdef"),oge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),l_=new Set(",[]{}"),sge=new Set(` ,[]{} @@ -167,14 +167,14 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus `)+1;for(;r!==0;)this.onNewLine(this.offset+r),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)){d_(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(Qo(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(YB(r.key)&&!Qo(r.sep,"newline")){let s=rl(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(Qo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=rl(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]}):Qo(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&&!Qo(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)){d_(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||Qo(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=u_(n),o=rl(i);JB(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=u_(e),n=rl(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=u_(e),n=rl(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())}}};XB.Parser=_O});var nH=v(Rf=>{"use strict";var QB=oO(),lge=Sf(),Of=$f(),uge=nT(),dge=Ce(),fge=yO(),eH=bO();function tH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new fge.LineCounter||null,prettyErrors:e}}function pge(t,e={}){let{lineCounter:r,prettyErrors:n}=tH(e),i=new eH.Parser(r?.addNewLine),o=new QB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Of.prettifyError(t,r)),a.warnings.forEach(Of.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function rH(t,e={}){let{lineCounter:r,prettyErrors:n}=tH(e),i=new eH.Parser(r?.addNewLine),o=new QB.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 Of.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Of.prettifyError(t,r)),s.warnings.forEach(Of.prettifyError(t,r))),s}function mge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=rH(t,r);if(!i)return null;if(i.warnings.forEach(o=>uge.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 hge(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 dge.isDocument(t)&&!n?t.toString(r):new lge.Document(t,n,r).toString(r)}Rf.parse=mge;Rf.parseAllDocuments=pge;Rf.parseDocument=rH;Rf.stringify=hge});var Qt=v(Ze=>{"use strict";var gge=oO(),yge=Sf(),_ge=LT(),vO=$f(),bge=of(),es=Ce(),vge=Ko(),Sge=Ct(),wge=Yo(),xge=Xo(),$ge=c_(),kge=hO(),Ege=yO(),Age=bO(),f_=nH(),iH=ef();Ze.Composer=gge.Composer;Ze.Document=yge.Document;Ze.Schema=_ge.Schema;Ze.YAMLError=vO.YAMLError;Ze.YAMLParseError=vO.YAMLParseError;Ze.YAMLWarning=vO.YAMLWarning;Ze.Alias=bge.Alias;Ze.isAlias=es.isAlias;Ze.isCollection=es.isCollection;Ze.isDocument=es.isDocument;Ze.isMap=es.isMap;Ze.isNode=es.isNode;Ze.isPair=es.isPair;Ze.isScalar=es.isScalar;Ze.isSeq=es.isSeq;Ze.Pair=vge.Pair;Ze.Scalar=Sge.Scalar;Ze.YAMLMap=wge.YAMLMap;Ze.YAMLSeq=xge.YAMLSeq;Ze.CST=$ge;Ze.Lexer=kge.Lexer;Ze.LineCounter=Ege.LineCounter;Ze.Parser=Age.Parser;Ze.parse=f_.parse;Ze.parseAllDocuments=f_.parseAllDocuments;Ze.parseDocument=f_.parseDocument;Ze.stringify=f_.stringify;Ze.visit=iH.visit;Ze.visitAsync=iH.visitAsync});import{execFileSync as oH}from"node:child_process";import{existsSync as p_}from"node:fs";import{join as m_,resolve as Tge}from"node:path";function Oge(t){try{let e=oH("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Tge(t,e):null}catch{return null}}function SO(t){let e=Oge(t);if(!e)return null;try{if(p_(m_(e,"MERGE_HEAD")))return"merge";if(p_(m_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(p_(m_(e,"rebase-merge"))||p_(m_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ga(t){return SO(t)!==null}function wO(t,e){try{let r=oH("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 h_(t,e){return wO(t,e)!==null}var ya=y(()=>{"use strict"});import{execFileSync as Rge}from"node:child_process";import{existsSync as Ige,readFileSync as Pge}from"node:fs";import{join as cH}from"node:path";function If(t,e){return Rge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ts(t){try{let e=If(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 rs(t,e){Cge(t,e);let r=If(t,["rev-parse","HEAD"]).trim(),n=Dge(t,e);return{groups:Nge(t,n),head:r,inventory:{after:aH(y_(t,"spec.yaml")),before:aH(xO(t,e,"spec.yaml"))},since:e,unsharded_commits:Lge(t,e)}}function $O(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 Cge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!h_(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 Dge(t,e){let r=If(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=u_(e),n=rl(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=u_(e),n=rl(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())}}};XB.Parser=_O});var nH=v(Rf=>{"use strict";var QB=oO(),lge=Sf(),Of=$f(),uge=nT(),dge=Ce(),fge=yO(),eH=bO();function tH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new fge.LineCounter||null,prettyErrors:e}}function pge(t,e={}){let{lineCounter:r,prettyErrors:n}=tH(e),i=new eH.Parser(r?.addNewLine),o=new QB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Of.prettifyError(t,r)),a.warnings.forEach(Of.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function rH(t,e={}){let{lineCounter:r,prettyErrors:n}=tH(e),i=new eH.Parser(r?.addNewLine),o=new QB.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 Of.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Of.prettifyError(t,r)),s.warnings.forEach(Of.prettifyError(t,r))),s}function mge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=rH(t,r);if(!i)return null;if(i.warnings.forEach(o=>uge.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 hge(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 dge.isDocument(t)&&!n?t.toString(r):new lge.Document(t,n,r).toString(r)}Rf.parse=mge;Rf.parseAllDocuments=pge;Rf.parseDocument=rH;Rf.stringify=hge});var Qt=v(Ze=>{"use strict";var gge=oO(),yge=Sf(),_ge=LT(),vO=$f(),bge=of(),es=Ce(),vge=Ko(),Sge=Ct(),wge=Yo(),xge=Xo(),$ge=c_(),kge=hO(),Ege=yO(),Age=bO(),f_=nH(),iH=ef();Ze.Composer=gge.Composer;Ze.Document=yge.Document;Ze.Schema=_ge.Schema;Ze.YAMLError=vO.YAMLError;Ze.YAMLParseError=vO.YAMLParseError;Ze.YAMLWarning=vO.YAMLWarning;Ze.Alias=bge.Alias;Ze.isAlias=es.isAlias;Ze.isCollection=es.isCollection;Ze.isDocument=es.isDocument;Ze.isMap=es.isMap;Ze.isNode=es.isNode;Ze.isPair=es.isPair;Ze.isScalar=es.isScalar;Ze.isSeq=es.isSeq;Ze.Pair=vge.Pair;Ze.Scalar=Sge.Scalar;Ze.YAMLMap=wge.YAMLMap;Ze.YAMLSeq=xge.YAMLSeq;Ze.CST=$ge;Ze.Lexer=kge.Lexer;Ze.LineCounter=Ege.LineCounter;Ze.Parser=Age.Parser;Ze.parse=f_.parse;Ze.parseAllDocuments=f_.parseAllDocuments;Ze.parseDocument=f_.parseDocument;Ze.stringify=f_.stringify;Ze.visit=iH.visit;Ze.visitAsync=iH.visitAsync});import{execFileSync as oH}from"node:child_process";import{existsSync as p_}from"node:fs";import{join as m_,resolve as Tge}from"node:path";function Oge(t){try{let e=oH("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Tge(t,e):null}catch{return null}}function SO(t){let e=Oge(t);if(!e)return null;try{if(p_(m_(e,"MERGE_HEAD")))return"merge";if(p_(m_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(p_(m_(e,"rebase-merge"))||p_(m_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ha(t){return SO(t)!==null}function wO(t,e){try{let r=oH("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 h_(t,e){return wO(t,e)!==null}var ga=y(()=>{"use strict"});import{execFileSync as Rge}from"node:child_process";import{existsSync as Ige,readFileSync as Pge}from"node:fs";import{join as cH}from"node:path";function If(t,e){return Rge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ts(t){try{let e=If(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 rs(t,e){Cge(t,e);let r=If(t,["rev-parse","HEAD"]).trim(),n=Dge(t,e);return{groups:Nge(t,n),head:r,inventory:{after:aH(y_(t,"spec.yaml")),before:aH(xO(t,e,"spec.yaml"))},since:e,unsharded_commits:Lge(t,e)}}function $O(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 Cge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!h_(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 Dge(t,e){let r=If(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(!(!sH(c)&&!sH(a)))if(s.startsWith("A")){let l=g_(y_(t,c));if(!l)continue;l.status==="done"?n.push(nl(l,"added-as-done")):l.status==="archived"&&n.push(nl(l,"archived"))}else if(s.startsWith("D")){let l=g_(xO(t,e,a));l&&n.push(nl(l,"archived"))}else{let l=g_(y_(t,c));if(!l)continue;let d=g_(xO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(nl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(nl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(nl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function sH(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function nl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>$O(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function g_(t){if(t===null)return null;let e;try{e=(0,__.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 y_(t,e){let r=cH(t,e);if(!Ige(r))return null;try{return Pge(r,"utf8")}catch{return null}}function xO(t,e,r){try{return If(t,["show",`${e}:${r}`])}catch{return null}}function Nge(t,e){let r=jge(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 jge(t){let e=y_(t,cH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,__.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function aH(t){let e={};if(t!==null)try{let n=(0,__.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 Lge(t,e){let r=If(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);Mge.test(a)&&(Fge.test(a)||n.push({hash:s,subject:a}))}return n}var __,Mge,Fge,il=y(()=>{"use strict";__=St(Qt(),1);ya();Mge=/^(feat|fix)(\([^)]*\))?!?:/,Fge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as lH}from"node:child_process";import{appendFileSync as zge,existsSync as kO,mkdirSync as Uge,readFileSync as qge,renameSync as Bge,statSync as Hge}from"node:fs";import{userInfo as Gge}from"node:os";import{dirname as Zge,join as AO}from"node:path";function TO(t){return AO(t,uH,Vge)}function Xr(t,e){let r=TO(t),n=Zge(r);kO(n)||Uge(n,{recursive:!0});try{kO(r)&&Hge(r).size>Wge&&Bge(r,AO(n,dH))}catch{}zge(r,`${JSON.stringify(e)} +`)){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);Mge.test(a)&&(Fge.test(a)||n.push({hash:s,subject:a}))}return n}var __,Mge,Fge,il=y(()=>{"use strict";__=St(Qt(),1);ga();Mge=/^(feat|fix)(\([^)]*\))?!?:/,Fge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as lH}from"node:child_process";import{appendFileSync as zge,existsSync as kO,mkdirSync as Uge,readFileSync as qge,renameSync as Bge,statSync as Hge}from"node:fs";import{userInfo as Gge}from"node:os";import{dirname as Zge,join as AO}from"node:path";function TO(t){return AO(t,uH,Vge)}function Xr(t,e){let r=TO(t),n=Zge(r);kO(n)||Uge(n,{recursive:!0});try{kO(r)&&Hge(r).size>Wge&&Bge(r,AO(n,dH))}catch{}zge(r,`${JSON.stringify(e)} `,"utf8")}function EO(t){if(!kO(t))return[];let e=qge(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function _a(t){return EO(TO(t))}function b_(t){return[...EO(AO(t,uH,dH)),...EO(TO(t))]}function Qr(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 Kge(t){let e;try{e=lH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Gge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Jge(t){try{return lH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Pf(t,e){try{let r=_a(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Jge(t),i=Kge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Pf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var uH,Vge,dH,Wge,Nr=y(()=>{"use strict";uH=".cladding",Vge="events.log.jsonl",dH="events.log.1.jsonl",Wge=5*1024*1024});import{execFileSync as Yge}from"node:child_process";import{existsSync as fH,readdirSync as Xge,readFileSync as Qge,statSync as pH}from"node:fs";import{createHash as eye}from"node:crypto";import{join as OO}from"node:path";function ba(t){try{return Yge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function RO(t){let e=[],r=OO(t,"spec.yaml");fH(r)&&pH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=OO(t,"spec",i);if(!(!fH(o)||!pH(o).isDirectory()))for(let s of Xge(o))s.endsWith(".yaml")&&e.push(OO(o,s))}e.sort();let n=eye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Qge(i)),n.update("\0")}return n.digest("hex")}function v_(t,e){let r={featureId:e,gitHead:ba(t),specDigest:RO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function S_(t,e){let r=_a(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 w_(t,e,r,n){let i=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Cf=y(()=>{"use strict";Nr()});import{readFileSync as tye,statSync as rye}from"node:fs";import{extname as nye,resolve as IO,sep as iye}from"node:path";function en(t){return Math.ceil(t.length/4)}function aye(t,e){let r=IO(e),n=IO(r,t);return n===r||n.startsWith(r+iye)}function hH(t,e,r,n){if(!aye(t,e))return{path:t,omitted:"unsafe-path"};if(!oye.has(nye(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>mH)return{path:t,omitted:"too-large",bytes:o}}else{let l=IO(e,t);try{o=rye(l).size}catch{return{path:t,omitted:"missing"}}if(o>mH)return{path:t,omitted:"too-large",bytes:o};try{i=tye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(sye))return{path:t,omitted:"binary",bytes:o};let s=Math.max(0,Math.floor(r));if(i.length<=s)return{path:t,text:i,bytes:o};let a=` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ya(t){return EO(TO(t))}function b_(t){return[...EO(AO(t,uH,dH)),...EO(TO(t))]}function Qr(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 Kge(t){let e;try{e=lH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Gge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Jge(t){try{return lH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Pf(t,e){try{let r=ya(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Jge(t),i=Kge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Pf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var uH,Vge,dH,Wge,Nr=y(()=>{"use strict";uH=".cladding",Vge="events.log.jsonl",dH="events.log.1.jsonl",Wge=5*1024*1024});import{execFileSync as Yge}from"node:child_process";import{existsSync as fH,readdirSync as Xge,readFileSync as Qge,statSync as pH}from"node:fs";import{createHash as eye}from"node:crypto";import{join as OO}from"node:path";function _a(t){try{return Yge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function RO(t){let e=[],r=OO(t,"spec.yaml");fH(r)&&pH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=OO(t,"spec",i);if(!(!fH(o)||!pH(o).isDirectory()))for(let s of Xge(o))s.endsWith(".yaml")&&e.push(OO(o,s))}e.sort();let n=eye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Qge(i)),n.update("\0")}return n.digest("hex")}function v_(t,e){let r={featureId:e,gitHead:_a(t),specDigest:RO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function S_(t,e){let r=ya(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 w_(t,e,r,n){let i=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Cf=y(()=>{"use strict";Nr()});import{readFileSync as tye,statSync as rye}from"node:fs";import{extname as nye,resolve as IO,sep as iye}from"node:path";function en(t){return Math.ceil(t.length/4)}function aye(t,e){let r=IO(e),n=IO(r,t);return n===r||n.startsWith(r+iye)}function hH(t,e,r,n){if(!aye(t,e))return{path:t,omitted:"unsafe-path"};if(!oye.has(nye(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>mH)return{path:t,omitted:"too-large",bytes:o}}else{let l=IO(e,t);try{o=rye(l).size}catch{return{path:t,omitted:"missing"}}if(o>mH)return{path:t,omitted:"too-large",bytes:o};try{i=tye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(sye))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 oye,mH,sye,x_=y(()=>{"use strict";oye=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"]),mH=2e6,sye="\0"});function lye(t){for(let i of cye)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 PO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function uye(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??[])PO(e,s,o);for(let s of i.modules??[])PO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=lye(a);c&&PO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function kn(t){let e=gH.get(t);return e||(e=uye(t),gH.set(t,e)),e}var cye,gH,va=y(()=>{"use strict";cye=["derived:","fixture:","script:","self-dogfood:"];gH=new WeakMap});function CO(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 br(t,e,r={}){let n=r.depth??1/0,i=kn(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=dye(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=CO(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:DO(i)}}var Sa=y(()=>{"use strict";va()});function yH(t){return t.impacted.length}function k_(t,e,r={}){let n=r.initialDepth??$_.initialDepth,i=r.maxDepth??$_.maxDepth,o=r.coverageThreshold??$_.coverageThreshold,s=r.marginYieldThreshold??$_.marginYieldThreshold,a=kn(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=br(t,e,{depth:1});return"not_found"in b,b}let d=CO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=yH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var $_,NO=y(()=>{"use strict";Sa();va();$_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function fye(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 _H(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=fye(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 bH=y(()=>{"use strict"});function pye(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 ol(t,e){let r=pye(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=_H(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 E_=y(()=>{"use strict";bH()});import{existsSync as SH,readdirSync as mye,readFileSync as hye}from"node:fs";import{join as MO}from"node:path";function FO(t,e=yye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function _ye(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:FO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:FO(`done reverted \u2014 pre-push strict gate red${r}`)}}function vH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function bye(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 FO(n)}function vye(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)=>vH(m)-vH(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(-gye).map(_ye),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?bye(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 Sye(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 wye(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=Sye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function xye(t,e){let r=MO(t,".cladding","post-mortems");if(!SH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of mye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(wye(hye(MO(r,o),"utf8"),e,o))}catch{}return i}function wH(t,e){try{let r=b_(t),n=xye(t,e),i=SH(MO(t,".cladding","events.log.1.jsonl"));return vye(r,n,e,{truncated:i})}catch{return}}var gye,yye,xH=y(()=>{"use strict";Nr();gye=5,yye=120});function A_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function wa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:$ye,o=e,s,a=kn(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=ol(t,o);if("not_found"in c)return c;let l=c.focus,u=wH(n,l.id),d=a&&a.size>0?e:l.id,f=k_(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}},O=[...c.ancestors];for(;O.length>kye&&A_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Pe,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],ao={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(ao))>i},ie=m,J=h;if($(ie,J,0,0)){let se=br(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],ao=0;for(;Yt.length>Pe.size&&$(Yt,J,ao,0);)Yt=Yt.slice(0,-1),ao++;let vi=[...h],Yr=0;for(;$(Yt,vi,ao,Yr);){let de=-1;for(let co=vi.length-1;co>=0;co--)if(!Kt.has(vi[co])){de=co;break}if(de<0)break;vi.splice(de,1),Yr++}ie=Yt,J=vi,ao+Yr>0&&x.push(`breaks: omitted ${ao} feature(s) / ${Yr} test(s)`),$(ie,J,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Oe=D(ie,J),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Oe},P=C;if(u){let se={...C,prior_attempts:u};en(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var $ye,kye,T_=y(()=>{"use strict";x_();E_();NO();xH();Sa();va();$ye=3e3,kye=3});function Kn(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 Eye(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 $H(t,e,r="."){let n=kn(t),i=t.features??[],o=[];for(let f of i){let p=wa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=wa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=k_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:Eye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var sl,O_=y(()=>{"use strict";x_();NO();T_();va();sl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Aye,existsSync as LO,mkdirSync as Tye,readFileSync as kH}from"node:fs";import{dirname as Oye,join as Rye}from"node:path";function zO(t){return Rye(t,Iye,Pye)}function Cye(t,e){return{timestamp:new Date().toISOString(),head:ba(t),spec_digest:RO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function EH(t,e){try{let r=Cye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=UO(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=zO(t),s=Oye(o);return LO(s)||Tye(s,{recursive:!0}),Aye(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 oye,mH,sye,x_=y(()=>{"use strict";oye=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"]),mH=2e6,sye="\0"});function lye(t){for(let i of cye)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 PO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function uye(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??[])PO(e,s,o);for(let s of i.modules??[])PO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=lye(a);c&&PO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function En(t){let e=gH.get(t);return e||(e=uye(t),gH.set(t,e)),e}var cye,gH,ba=y(()=>{"use strict";cye=["derived:","fixture:","script:","self-dogfood:"];gH=new WeakMap});function CO(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 br(t,e,r={}){let n=r.depth??1/0,i=En(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=dye(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=CO(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:DO(i)}}var va=y(()=>{"use strict";ba()});function yH(t){return t.impacted.length}function k_(t,e,r={}){let n=r.initialDepth??$_.initialDepth,i=r.maxDepth??$_.maxDepth,o=r.coverageThreshold??$_.coverageThreshold,s=r.marginYieldThreshold??$_.marginYieldThreshold,a=En(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=br(t,e,{depth:1});return"not_found"in b,b}let d=CO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=yH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var $_,NO=y(()=>{"use strict";va();ba();$_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function fye(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 _H(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=fye(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 bH=y(()=>{"use strict"});function pye(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 ol(t,e){let r=pye(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=_H(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 E_=y(()=>{"use strict";bH()});import{existsSync as SH,readdirSync as mye,readFileSync as hye}from"node:fs";import{join as MO}from"node:path";function FO(t,e=yye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function _ye(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:FO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:FO(`done reverted \u2014 pre-push strict gate red${r}`)}}function vH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function bye(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 FO(n)}function vye(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)=>vH(m)-vH(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(-gye).map(_ye),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?bye(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 Sye(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 wye(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=Sye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function xye(t,e){let r=MO(t,".cladding","post-mortems");if(!SH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of mye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(wye(hye(MO(r,o),"utf8"),e,o))}catch{}return i}function wH(t,e){try{let r=b_(t),n=xye(t,e),i=SH(MO(t,".cladding","events.log.1.jsonl"));return vye(r,n,e,{truncated:i})}catch{return}}var gye,yye,xH=y(()=>{"use strict";Nr();gye=5,yye=120});function A_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function Sa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:$ye,o=e,s,a=En(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=ol(t,o);if("not_found"in c)return c;let l=c.focus,u=wH(n,l.id),d=a&&a.size>0?e:l.id,f=k_(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}},O=[...c.ancestors];for(;O.length>kye&&A_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Pe,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],ao={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(ao))>i},ie=m,J=h;if($(ie,J,0,0)){let se=br(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],ao=0;for(;Yt.length>Pe.size&&$(Yt,J,ao,0);)Yt=Yt.slice(0,-1),ao++;let vi=[...h],Yr=0;for(;$(Yt,vi,ao,Yr);){let de=-1;for(let co=vi.length-1;co>=0;co--)if(!Kt.has(vi[co])){de=co;break}if(de<0)break;vi.splice(de,1),Yr++}ie=Yt,J=vi,ao+Yr>0&&x.push(`breaks: omitted ${ao} feature(s) / ${Yr} test(s)`),$(ie,J,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Oe=D(ie,J),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Oe},P=C;if(u){let se={...C,prior_attempts:u};en(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var $ye,kye,T_=y(()=>{"use strict";x_();E_();NO();xH();va();ba();$ye=3e3,kye=3});function Kn(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 Eye(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 $H(t,e,r="."){let n=En(t),i=t.features??[],o=[];for(let f of i){let p=Sa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=Sa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=k_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:Eye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var sl,O_=y(()=>{"use strict";x_();NO();T_();ba();sl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Aye,existsSync as LO,mkdirSync as Tye,readFileSync as kH}from"node:fs";import{dirname as Oye,join as Rye}from"node:path";function zO(t){return Rye(t,Iye,Pye)}function Cye(t,e){return{timestamp:new Date().toISOString(),head:_a(t),spec_digest:RO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function EH(t,e){try{let r=Cye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=UO(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=zO(t),s=Oye(o);return LO(s)||Tye(s,{recursive:!0}),Aye(o,`${JSON.stringify(r)} `,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function AH(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 UO(t,e){let r=zO(t);if(!LO(r))return[];let n;try{n=kH(r,"utf8")}catch{return[]}let i=AH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function TH(t){let e=zO(t);if(!LO(e))return{snapshots:[],unreadable:!1};let r;try{r=kH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=AH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Df(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 OH(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?` (${Df(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(` ${sl}`),i.join(` `)}var Iye,Pye,Nf=y(()=>{"use strict";Cf();O_();Iye=".cladding",Pye="measure.jsonl"});import{existsSync as Dye}from"node:fs";import{join as Nye}from"node:path";function al(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}** (${jye[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(` @@ -182,12 +182,12 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus `);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 ${Df(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Df(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Df(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`,"",sl),r.join(` `)}function cl(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"} | ${Fye(l,r)} |`)}return n.join(` `)}function Fye(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 Mye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Dye(Nye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function ll(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),RH(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)RH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function RH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=$O(r);n&&t.push(`- ${n}`)}t.push("")}var jye,Mye,R_=y(()=>{"use strict";Nf();O_();il();jye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Mye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Lye}from"node:fs";function ki(t="./spec.yaml"){let e=Lye(t,"utf8");return(0,PH.parse)(e)}var PH,I_=y(()=>{"use strict";PH=St(Qt(),1)});var ns=v((jr,GO)=>{"use strict";var qO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+DH(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()};qO.prototype.toString=function(){return this.property+" "+this.message};var P_=jr.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};P_.prototype.addError=function(e){var r;if(typeof e=="string")r=new qO(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 qO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new xa(this);if(this.throwError)throw r;return r};P_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function zye(t,e){return e+": "+t.toString()+` -`}P_.prototype.toString=function(e){return this.errors.map(zye).join("")};Object.defineProperty(P_.prototype,"valid",{get:function(){return!this.errors.length}});GO.exports.ValidatorResultError=xa;function xa(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,xa),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}xa.prototype=new Error;xa.prototype.constructor=xa;xa.prototype.name="Validation Error";var CH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};CH.prototype=Object.create(Error.prototype,{constructor:{value:CH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var BO=jr.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+DH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};BO.prototype.resolve=function(e){return NH(this.base,e)};BO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=NH(this.base,i||"");var s=new BO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var DH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 Uye(t,e,r,n){typeof r=="object"?e[n]=HO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function qye(t,e,r){e[r]=t[r]}function Bye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=HO(t[n],e[n]):r[n]=e[n]}function HO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Uye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(qye.bind(null,t,n)),Object.keys(e).forEach(Bye.bind(null,t,e,n))),n}GO.exports.deepMerge=HO;jr.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 Hye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Hye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var NH=jr.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 LH=v((zXe,FH)=>{"use strict";var tn=ns(),Fe=tn.ValidatorResult,is=tn.SchemaError,ZO={};ZO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=ZO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 VO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new is("anyOf must be an array");if(!r.anyOf.some(VO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new is("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new is("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(VO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=VO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 WO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new is('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(WO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 is('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=WO(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 jH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 is('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&&jH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)jH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Gye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var KO=ns();JO.exports.SchemaScanResult=zH;function zH(t,e){this.id=t,this.ref=e}JO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=KO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=KO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!KO.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 UH=LH(),os=ns(),qH=C_().scan,BH=os.ValidatorResult,Zye=os.ValidatorResultError,jf=os.SchemaError,HH=os.SchemaContext,Vye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ei),this.attributes=Object.create(UH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=qH(r||Vye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=os.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}};Jt.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 Ei=Jt.prototype.types={};Ei.string=function(e){return typeof e=="string"};Ei.number=function(e){return typeof e=="number"&&isFinite(e)};Ei.integer=function(e){return typeof e=="number"&&e%1===0};Ei.boolean=function(e){return typeof e=="boolean"};Ei.array=function(e){return Array.isArray(e)};Ei.null=function(e){return e===null};Ei.date=function(e){return e instanceof Date};Ei.any=function(e){return!0};Ei.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};ZH.exports=Jt});var WH=v((BXe,po)=>{"use strict";var Wye=po.exports.Validator=VH();po.exports.ValidatorResult=ns().ValidatorResult;po.exports.ValidatorResultError=ns().ValidatorResultError;po.exports.ValidationError=ns().ValidationError;po.exports.SchemaError=ns().SchemaError;po.exports.SchemaScanResult=C_().SchemaScanResult;po.exports.scan=C_().scan;po.exports.validate=function(t,e,r){var n=new Wye;return n.validate(t,e,r)}});import{readFileSync as Kye}from"node:fs";import{dirname as Jye,join as Yye}from"node:path";import{fileURLToPath as Xye}from"node:url";function n_e(t){let e=r_e.validate(t,t_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function JH(t){let e=n_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`)}function RH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=$O(r);n&&t.push(`- ${n}`)}t.push("")}var jye,Mye,R_=y(()=>{"use strict";Nf();O_();il();jye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Mye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Lye}from"node:fs";function ki(t="./spec.yaml"){let e=Lye(t,"utf8");return(0,PH.parse)(e)}var PH,I_=y(()=>{"use strict";PH=St(Qt(),1)});var ns=v((jr,GO)=>{"use strict";var qO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+DH(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()};qO.prototype.toString=function(){return this.property+" "+this.message};var P_=jr.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};P_.prototype.addError=function(e){var r;if(typeof e=="string")r=new qO(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 qO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new wa(this);if(this.throwError)throw r;return r};P_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function zye(t,e){return e+": "+t.toString()+` +`}P_.prototype.toString=function(e){return this.errors.map(zye).join("")};Object.defineProperty(P_.prototype,"valid",{get:function(){return!this.errors.length}});GO.exports.ValidatorResultError=wa;function wa(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,wa),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}wa.prototype=new Error;wa.prototype.constructor=wa;wa.prototype.name="Validation Error";var CH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};CH.prototype=Object.create(Error.prototype,{constructor:{value:CH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var BO=jr.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+DH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};BO.prototype.resolve=function(e){return NH(this.base,e)};BO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=NH(this.base,i||"");var s=new BO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var DH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 Uye(t,e,r,n){typeof r=="object"?e[n]=HO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function qye(t,e,r){e[r]=t[r]}function Bye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=HO(t[n],e[n]):r[n]=e[n]}function HO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Uye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(qye.bind(null,t,n)),Object.keys(e).forEach(Bye.bind(null,t,e,n))),n}GO.exports.deepMerge=HO;jr.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 Hye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Hye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var NH=jr.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 LH=v((qXe,FH)=>{"use strict";var tn=ns(),Fe=tn.ValidatorResult,is=tn.SchemaError,ZO={};ZO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=ZO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 VO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new is("anyOf must be an array");if(!r.anyOf.some(VO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new is("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new is("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(VO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=VO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 WO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new is('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(WO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 is('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=WO(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 jH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 is('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&&jH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)jH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Gye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var KO=ns();JO.exports.SchemaScanResult=zH;function zH(t,e){this.id=t,this.ref=e}JO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=KO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=KO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!KO.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 UH=LH(),os=ns(),qH=C_().scan,BH=os.ValidatorResult,Zye=os.ValidatorResultError,jf=os.SchemaError,HH=os.SchemaContext,Vye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ei),this.attributes=Object.create(UH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=qH(r||Vye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=os.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}};Jt.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 Ei=Jt.prototype.types={};Ei.string=function(e){return typeof e=="string"};Ei.number=function(e){return typeof e=="number"&&isFinite(e)};Ei.integer=function(e){return typeof e=="number"&&e%1===0};Ei.boolean=function(e){return typeof e=="boolean"};Ei.array=function(e){return Array.isArray(e)};Ei.null=function(e){return e===null};Ei.date=function(e){return e instanceof Date};Ei.any=function(e){return!0};Ei.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};ZH.exports=Jt});var WH=v((GXe,po)=>{"use strict";var Wye=po.exports.Validator=VH();po.exports.ValidatorResult=ns().ValidatorResult;po.exports.ValidatorResultError=ns().ValidatorResultError;po.exports.ValidationError=ns().ValidationError;po.exports.SchemaError=ns().SchemaError;po.exports.SchemaScanResult=C_().SchemaScanResult;po.exports.scan=C_().scan;po.exports.validate=function(t,e,r){var n=new Wye;return n.validate(t,e,r)}});import{readFileSync as Kye}from"node:fs";import{dirname as Jye,join as Yye}from"node:path";import{fileURLToPath as Xye}from"node:url";function n_e(t){let e=r_e.validate(t,t_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function JH(t){let e=n_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var KH,Qye,e_e,t_e,r_e,YH=y(()=>{"use strict";KH=St(WH(),1),Qye=Jye(Xye(import.meta.url)),e_e=Yye(Qye,"schema.json"),t_e=JSON.parse(Kye(e_e,"utf8")),r_e=new KH.Validator});import{existsSync as YO,readdirSync as i_e}from"node:fs";import{dirname as o_e,join as $a,resolve as QH}from"node:path";function XH(t){return YO(t)?i_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ki($a(t,r))):[]}function ka(t,e){D_=e?{cwd:QH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return D_&&e==="spec.yaml"&&QH(t)===D_.cwd?D_.spec:s_e(t,e)}function s_e(t,e){let r=$a(t,e),n=ki(r),i=$a(t,o_e(e),"spec");if(!n.features||n.features.length===0){let o=XH($a(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=XH($a(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=$a(i,"architecture.yaml");YO(o)&&(n.architecture=ki(o))}if(!n.capabilities||n.capabilities.length===0){let o=$a(i,"capabilities.yaml");if(YO(o)){let s=ki(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return JH(n),n}var D_,qe=y(()=>{"use strict";I_();YH();D_=null});import ul from"node:process";function eR(){return!!ul.stdout.isTTY}function L(t,e,r=""){let n=eG[t],i=r?` ${r}`:"";eR()?ul.stdout.write(`${XO[t]}${n}${QO} ${e}${i} + `)}`)}var KH,Qye,e_e,t_e,r_e,YH=y(()=>{"use strict";KH=St(WH(),1),Qye=Jye(Xye(import.meta.url)),e_e=Yye(Qye,"schema.json"),t_e=JSON.parse(Kye(e_e,"utf8")),r_e=new KH.Validator});import{existsSync as YO,readdirSync as i_e}from"node:fs";import{dirname as o_e,join as xa,resolve as QH}from"node:path";function XH(t){return YO(t)?i_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ki(xa(t,r))):[]}function $a(t,e){D_=e?{cwd:QH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return D_&&e==="spec.yaml"&&QH(t)===D_.cwd?D_.spec:s_e(t,e)}function s_e(t,e){let r=xa(t,e),n=ki(r),i=xa(t,o_e(e),"spec");if(!n.features||n.features.length===0){let o=XH(xa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=XH(xa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=xa(i,"architecture.yaml");YO(o)&&(n.architecture=ki(o))}if(!n.capabilities||n.capabilities.length===0){let o=xa(i,"capabilities.yaml");if(YO(o)){let s=ki(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return JH(n),n}var D_,qe=y(()=>{"use strict";I_();YH();D_=null});import ul from"node:process";function eR(){return!!ul.stdout.isTTY}function L(t,e,r=""){let n=eG[t],i=r?` ${r}`:"";eR()?ul.stdout.write(`${XO[t]}${n}${QO} ${e}${i} `):ul.stdout.write(`${n} ${e}${i} -`)}function Mf(t,e,r=""){if(!eR())return;let n=r?` ${r}`:"";ul.stdout.write(`${tG}${XO.start}\xB7${QO} ${t} \xB7 ${e}${n}`)}function Ea(t,e,r=""){let n=eG[t],i=r?` ${r}`:"";eR()?ul.stdout.write(`${tG}${XO[t]}${n}${QO} ${e}${i} +`)}function Mf(t,e,r=""){if(!eR())return;let n=r?` ${r}`:"";ul.stdout.write(`${tG}${XO.start}\xB7${QO} ${t} \xB7 ${e}${n}`)}function ka(t,e,r=""){let n=eG[t],i=r?` ${r}`:"";eR()?ul.stdout.write(`${tG}${XO[t]}${n}${QO} ${e}${i} `):ul.stdout.write(`${n} ${e}${i} `)}var eG,XO,QO,tG,Ai=y(()=>{"use strict";eG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},XO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},QO="\x1B[0m",tG="\r\x1B[K"});import{createHash as wG}from"node:crypto";import{existsSync as F_e,readFileSync as nR,writeFileSync as L_e}from"node:fs";import{join as N_}from"node:path";function z_e(t,e){let r=wG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(nR(N_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function $G(t,e){let r=wG("sha256");try{r.update(nR(N_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ss(t){let e=N_(t,...xG);if(!F_e(e))return null;let r;try{r=nR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` `)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function j_(t){return t.features?.size??t.v1?.size??0}function M_(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)!==$G(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===z_e(e,n)?{state:"fresh"}:{state:"stale"}}function kG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${$G(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=U_e+`attested_modules: @@ -213,18 +213,18 @@ attested_features: # Content-anchored: survives fresh clones and squash/rebase. `});import{resolve as iR}from"node:path";function F_(t){as={cwd:iR(t),results:new Map}}function EG(t,e,r){!as||as.cwd!==iR(e)||as.results.set(t,r)}function L_(t,e){return!as||as.cwd!==iR(e)?null:as.results.get(t)??null}function z_(){as=null}var as,pl=y(()=>{"use strict";as=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 ho=y(()=>{});import{fileURLToPath as q_e}from"node:url";var ml,B_e,oR,sR,hl=y(()=>{ml=(t,e)=>{let r=sR(B_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},B_e=t=>oR(t)?t.toString():t,oR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,sR=t=>t instanceof URL?q_e(t):t});var U_,aR=y(()=>{ho();hl();U_=(t,e=[],r={})=>{let n=ml(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 H_e}from"node:string_decoder";var AG,TG,Ut,go,G_e,OG,Z_e,q_,RG,V_e,zf,W_e,cR,K_e,rn=y(()=>{({toString:AG}=Object.prototype),TG=t=>AG.call(t)==="[object ArrayBuffer]",Ut=t=>AG.call(t)==="[object Uint8Array]",go=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),G_e=new TextEncoder,OG=t=>G_e.encode(t),Z_e=new TextDecoder,q_=t=>Z_e.decode(t),RG=(t,e)=>V_e(t,e).join(""),V_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new H_e(e),n=t.map(o=>typeof o=="string"?OG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},zf=t=>t.length===1&&Ut(t[0])?t[0]:cR(W_e(t)),W_e=t=>t.map(e=>typeof e=="string"?OG(e):e),cR=t=>{let e=new Uint8Array(K_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},K_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as J_e}from"node:child_process";var DG,NG,Y_e,X_e,IG,Q_e,PG,CG,ebe,jG=y(()=>{ho();rn();DG=t=>Array.isArray(t)&&Array.isArray(t.raw),NG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Y_e({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,{}]},Y_e=({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}=X_e(i,t.raw[n]),c=PG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>CG(d)):[CG(l)];return PG(c,u,a)},X_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=IG.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)],CG=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 ebe(t);throw t instanceof J_e||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`)},ebe=({stdout:t})=>{if(typeof t=="string")return t;if(Ut(t))return q_(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 lR from"node:process";var Yn,B_,En,H_,yo=y(()=>{Yn=t=>B_.includes(t),B_=[lR.stdin,lR.stdout,lR.stderr],En=["stdin","stdout","stderr"],H_=t=>En[t]??`stdio[${t}]`});import{debuglog as tbe}from"node:util";var FG,uR,rbe,nbe,ibe,obe,MG,sbe,dR,abe,cbe,lbe,ube,fR,_o,bo=y(()=>{ho();yo();FG=t=>{let e={...t};for(let r of fR)e[r]=uR(t,r);return e},uR=(t,e)=>{let r=Array.from({length:rbe(t)+1}),n=nbe(t[e],r,e);return cbe(n,e)},rbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,En.length):En.length,nbe=(t,e,r)=>Ot(t)?ibe(t,e,r):e.fill(t),ibe=(t,e,r)=>{for(let n of Object.keys(t).sort(obe))for(let i of sbe(n,r,e))e[i]=t[n];return e},obe=(t,e)=>MG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,sbe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=dR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`]),Q_e={x:3,u:5},PG=(t,e,r)=>r||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],CG=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 ebe(t);throw t instanceof J_e||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`)},ebe=({stdout:t})=>{if(typeof t=="string")return t;if(Ut(t))return q_(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 lR from"node:process";var Yn,B_,An,H_,yo=y(()=>{Yn=t=>B_.includes(t),B_=[lR.stdin,lR.stdout,lR.stderr],An=["stdin","stdout","stderr"],H_=t=>An[t]??`stdio[${t}]`});import{debuglog as tbe}from"node:util";var FG,uR,rbe,nbe,ibe,obe,MG,sbe,dR,abe,cbe,lbe,ube,fR,_o,bo=y(()=>{ho();yo();FG=t=>{let e={...t};for(let r of fR)e[r]=uR(t,r);return e},uR=(t,e)=>{let r=Array.from({length:rbe(t)+1}),n=nbe(t[e],r,e);return cbe(n,e)},rbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,An.length):An.length,nbe=(t,e,r)=>Ot(t)?ibe(t,e,r):e.fill(t),ibe=(t,e,r)=>{for(let n of Object.keys(t).sort(obe))for(let i of sbe(n,r,e))e[i]=t[n];return e},obe=(t,e)=>MG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,sbe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=dR(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]},dR=t=>{if(t==="all")return t;if(En.includes(t))return En.indexOf(t);let e=abe.exec(t);if(e!==null)return Number(e[1])},abe=/^fd(\d+)$/,cbe=(t,e)=>t.map(r=>r===void 0?ube[e]:r),lbe=tbe("execa").enabled?"full":"none",ube={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:lbe,stripFinalNewline:!0},fR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],_o=(t,e)=>e==="ipc"?t.at(-1):t[e]});var gl,yl,LG,pR,dbe,G_,Z_,cs=y(()=>{bo();gl=({verbose:t},e)=>pR(t,e)!=="none",yl=({verbose:t},e)=>!["none","short"].includes(pR(t,e)),LG=({verbose:t},e)=>{let r=pR(t,e);return G_(r)?r:void 0},pR=(t,e)=>e===void 0?dbe(t):_o(t,e),dbe=t=>t.find(e=>G_(e))??Z_.findLast(e=>t.includes(e)),G_=t=>typeof t=="function",Z_=["none","short","full"]});import{platform as fbe}from"node:process";import{stripVTControlCharacters as pbe}from"node:util";var zG,Uf,UG,mbe,hbe,gbe,ybe,_be,bbe,vbe,V_=y(()=>{zG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>bbe(UG(o))).join(" ");return{command:n,escapedCommand:i}},Uf=t=>pbe(t).split(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},dR=t=>{if(t==="all")return t;if(An.includes(t))return An.indexOf(t);let e=abe.exec(t);if(e!==null)return Number(e[1])},abe=/^fd(\d+)$/,cbe=(t,e)=>t.map(r=>r===void 0?ube[e]:r),lbe=tbe("execa").enabled?"full":"none",ube={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:lbe,stripFinalNewline:!0},fR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],_o=(t,e)=>e==="ipc"?t.at(-1):t[e]});var gl,yl,LG,pR,dbe,G_,Z_,cs=y(()=>{bo();gl=({verbose:t},e)=>pR(t,e)!=="none",yl=({verbose:t},e)=>!["none","short"].includes(pR(t,e)),LG=({verbose:t},e)=>{let r=pR(t,e);return G_(r)?r:void 0},pR=(t,e)=>e===void 0?dbe(t):_o(t,e),dbe=t=>t.find(e=>G_(e))??Z_.findLast(e=>t.includes(e)),G_=t=>typeof t=="function",Z_=["none","short","full"]});import{platform as fbe}from"node:process";import{stripVTControlCharacters as pbe}from"node:util";var zG,Uf,UG,mbe,hbe,gbe,ybe,_be,bbe,vbe,V_=y(()=>{zG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>bbe(UG(o))).join(" ");return{command:n,escapedCommand:i}},Uf=t=>pbe(t).split(` `).map(e=>UG(e)).join(` -`),UG=t=>t.replaceAll(gbe,e=>mbe(e)),mbe=t=>{let e=ybe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=_be?`\\u${n.padStart(4,"0")}`:`\\U${n}`},hbe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},gbe=hbe(),ybe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},_be=65535,bbe=t=>vbe.test(t)?t:fbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,vbe=/^[\w./-]+$/});import qG from"node:process";function mR(){let{env:t}=qG,{TERM:e,TERM_PROGRAM:r}=t;return qG.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 BG=y(()=>{});var HG,GG,Sbe,wbe,xbe,$be,kbe,W_,V7e,ZG=y(()=>{BG();HG={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"},GG={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"},Sbe={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"},wbe={...HG,...GG},xbe={...HG,...Sbe},$be=mR(),kbe=$be?wbe:xbe,W_=kbe,V7e=Object.entries(GG)});import Ebe from"node:tty";var Abe,_e,J7e,VG,Y7e,X7e,Q7e,eQe,tQe,rQe,nQe,iQe,oQe,sQe,aQe,cQe,lQe,uQe,dQe,K_,fQe,pQe,mQe,hQe,gQe,yQe,_Qe,bQe,vQe,WG,SQe,KG,wQe,xQe,$Qe,kQe,EQe,AQe,TQe,OQe,RQe,IQe,PQe,hR=y(()=>{Abe=Ebe?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!Abe)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}},J7e=_e(0,0),VG=_e(1,22),Y7e=_e(2,22),X7e=_e(3,23),Q7e=_e(4,24),eQe=_e(53,55),tQe=_e(7,27),rQe=_e(8,28),nQe=_e(9,29),iQe=_e(30,39),oQe=_e(31,39),sQe=_e(32,39),aQe=_e(33,39),cQe=_e(34,39),lQe=_e(35,39),uQe=_e(36,39),dQe=_e(37,39),K_=_e(90,39),fQe=_e(40,49),pQe=_e(41,49),mQe=_e(42,49),hQe=_e(43,49),gQe=_e(44,49),yQe=_e(45,49),_Qe=_e(46,49),bQe=_e(47,49),vQe=_e(100,49),WG=_e(91,39),SQe=_e(92,39),KG=_e(93,39),wQe=_e(94,39),xQe=_e(95,39),$Qe=_e(96,39),kQe=_e(97,39),EQe=_e(101,49),AQe=_e(102,49),TQe=_e(103,49),OQe=_e(104,49),RQe=_e(105,49),IQe=_e(106,49),PQe=_e(107,49)});var JG=y(()=>{hR();hR()});var QG,Obe,J_,YG,Rbe,XG,Ibe,eZ=y(()=>{ZG();JG();QG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Obe(r),c=Rbe[t]({failed:o,reject:s,piped:n}),l=Ibe[t]({reject:s});return`${K_(`[${a}]`)} ${K_(`[${i}]`)} ${l(c)} ${l(e)}`},Obe=t=>`${J_(t.getHours(),2)}:${J_(t.getMinutes(),2)}:${J_(t.getSeconds(),2)}.${J_(t.getMilliseconds(),3)}`,J_=(t,e)=>String(t).padStart(e,"0"),YG=({failed:t,reject:e})=>t?e?W_.cross:W_.warning:W_.tick,Rbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:YG,duration:YG},XG=t=>t,Ibe={command:()=>VG,output:()=>XG,ipc:()=>XG,error:({reject:t})=>t?WG:KG,duration:()=>K_}});var tZ,Pbe,Cbe,rZ=y(()=>{cs();tZ=(t,e,r)=>{let n=LG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Pbe(i,o,n)).filter(i=>i!==void 0).map(i=>Cbe(i)).join("")},Pbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Cbe=t=>t.endsWith(` +`),UG=t=>t.replaceAll(gbe,e=>mbe(e)),mbe=t=>{let e=ybe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=_be?`\\u${n.padStart(4,"0")}`:`\\U${n}`},hbe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},gbe=hbe(),ybe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},_be=65535,bbe=t=>vbe.test(t)?t:fbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,vbe=/^[\w./-]+$/});import qG from"node:process";function mR(){let{env:t}=qG,{TERM:e,TERM_PROGRAM:r}=t;return qG.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 BG=y(()=>{});var HG,GG,Sbe,wbe,xbe,$be,kbe,W_,K7e,ZG=y(()=>{BG();HG={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"},GG={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"},Sbe={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"},wbe={...HG,...GG},xbe={...HG,...Sbe},$be=mR(),kbe=$be?wbe:xbe,W_=kbe,K7e=Object.entries(GG)});import Ebe from"node:tty";var Abe,_e,X7e,VG,Q7e,eQe,tQe,rQe,nQe,iQe,oQe,sQe,aQe,cQe,lQe,uQe,dQe,fQe,pQe,K_,mQe,hQe,gQe,yQe,_Qe,bQe,vQe,SQe,wQe,WG,xQe,KG,$Qe,kQe,EQe,AQe,TQe,OQe,RQe,IQe,PQe,CQe,DQe,hR=y(()=>{Abe=Ebe?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!Abe)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}},X7e=_e(0,0),VG=_e(1,22),Q7e=_e(2,22),eQe=_e(3,23),tQe=_e(4,24),rQe=_e(53,55),nQe=_e(7,27),iQe=_e(8,28),oQe=_e(9,29),sQe=_e(30,39),aQe=_e(31,39),cQe=_e(32,39),lQe=_e(33,39),uQe=_e(34,39),dQe=_e(35,39),fQe=_e(36,39),pQe=_e(37,39),K_=_e(90,39),mQe=_e(40,49),hQe=_e(41,49),gQe=_e(42,49),yQe=_e(43,49),_Qe=_e(44,49),bQe=_e(45,49),vQe=_e(46,49),SQe=_e(47,49),wQe=_e(100,49),WG=_e(91,39),xQe=_e(92,39),KG=_e(93,39),$Qe=_e(94,39),kQe=_e(95,39),EQe=_e(96,39),AQe=_e(97,39),TQe=_e(101,49),OQe=_e(102,49),RQe=_e(103,49),IQe=_e(104,49),PQe=_e(105,49),CQe=_e(106,49),DQe=_e(107,49)});var JG=y(()=>{hR();hR()});var QG,Obe,J_,YG,Rbe,XG,Ibe,eZ=y(()=>{ZG();JG();QG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Obe(r),c=Rbe[t]({failed:o,reject:s,piped:n}),l=Ibe[t]({reject:s});return`${K_(`[${a}]`)} ${K_(`[${i}]`)} ${l(c)} ${l(e)}`},Obe=t=>`${J_(t.getHours(),2)}:${J_(t.getMinutes(),2)}:${J_(t.getSeconds(),2)}.${J_(t.getMilliseconds(),3)}`,J_=(t,e)=>String(t).padStart(e,"0"),YG=({failed:t,reject:e})=>t?e?W_.cross:W_.warning:W_.tick,Rbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:YG,duration:YG},XG=t=>t,Ibe={command:()=>VG,output:()=>XG,ipc:()=>XG,error:({reject:t})=>t?WG:KG,duration:()=>K_}});var tZ,Pbe,Cbe,rZ=y(()=>{cs();tZ=(t,e,r)=>{let n=LG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Pbe(i,o,n)).filter(i=>i!==void 0).map(i=>Cbe(i)).join("")},Pbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Cbe=t=>t.endsWith(` `)?t:`${t} `});import{inspect as Dbe}from"node:util";var Ti,Nbe,jbe,Mbe,Y_,Fbe,_l=y(()=>{V_();eZ();rZ();Ti=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Nbe({type:t,result:i,verboseInfo:n}),s=jbe(e,o),a=tZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Nbe=({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}),jbe=(t,e)=>t.split(` -`).map(r=>Mbe({...e,message:r})),Mbe=t=>({verboseLine:QG(t),verboseObject:t}),Y_=t=>{let e=typeof t=="string"?t:Dbe(t);return Uf(e).replaceAll(" "," ".repeat(Fbe))},Fbe=2});var nZ,iZ=y(()=>{cs();_l();nZ=(t,e)=>{gl(e)&&Ti({type:"command",verboseMessage:t,verboseInfo:e})}});var oZ,Lbe,zbe,Ube,sZ=y(()=>{cs();oZ=(t,e,r)=>{Ube(t);let n=Lbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Lbe=t=>gl({verbose:t})?zbe++:void 0,zbe=0n,Ube=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(!Z_.includes(e)&&!G_(e)){let r=Z_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as aZ}from"node:process";var X_,gR,Q_=y(()=>{X_=()=>aZ.bigint(),gR=t=>Number(aZ.bigint()-t)/1e6});var eb,yR=y(()=>{iZ();sZ();Q_();V_();bo();eb=(t,e,r)=>{let n=X_(),{command:i,escapedCommand:o}=zG(t,e),s=uR(r,"verbose"),a=oZ(s,o,{...r});return nZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var fZ=v((iet,dZ)=>{dZ.exports=uZ;uZ.sync=Bbe;var cZ=Ge("fs");function qbe(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{gZ.exports=mZ;mZ.sync=Hbe;var pZ=Ge("fs");function mZ(t,e,r){pZ.stat(t,function(n,i){r(n,n?!1:hZ(i,e))})}function Hbe(t,e){return hZ(pZ.statSync(t),e)}function hZ(t,e){return t.isFile()&&Gbe(t,e)}function Gbe(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 bZ=v((aet,_Z)=>{var set=Ge("fs"),tb;process.platform==="win32"||global.TESTING_WINDOWS?tb=fZ():tb=yZ();_Z.exports=_R;_R.sync=Zbe;function _R(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){_R(t,e||{},function(o,s){o?i(o):n(s)})})}tb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Zbe(t,e){try{return tb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var EZ=v((cet,kZ)=>{var bl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",vZ=Ge("path"),Vbe=bl?";":":",SZ=bZ(),wZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),xZ=(t,e)=>{let r=e.colon||Vbe,n=t.match(/\//)||bl&&t.match(/\\/)?[""]:[...bl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=bl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=bl?i.split(r):[""];return bl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},$Z=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=xZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(wZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=vZ.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];SZ(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)},Wbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=xZ(t,e),o=[];for(let s=0;s{"use strict";var AZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};bR.exports=AZ;bR.exports.default=AZ});var PZ=v((det,IZ)=>{"use strict";var OZ=Ge("path"),Kbe=EZ(),Jbe=TZ();function RZ(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=Kbe.sync(t.command,{path:r[Jbe({env:r})],pathExt:e?OZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=OZ.resolve(i?t.options.cwd:"",s)),s}function Ybe(t){return RZ(t)||RZ(t,!0)}IZ.exports=Ybe});var CZ=v((fet,SR)=>{"use strict";var vR=/([()\][%!^"`<>&|;, *?])/g;function Xbe(t){return t=t.replace(vR,"^$1"),t}function Qbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(vR,"^$1"),e&&(t=t.replace(vR,"^$1")),t}SR.exports.command=Xbe;SR.exports.argument=Qbe});var NZ=v((pet,DZ)=>{"use strict";DZ.exports=/^#!(.*)/});var MZ=v((met,jZ)=>{"use strict";var eve=NZ();jZ.exports=(t="")=>{let e=t.match(eve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var LZ=v((het,FZ)=>{"use strict";var wR=Ge("fs"),tve=MZ();function rve(t){let r=Buffer.alloc(150),n;try{n=wR.openSync(t,"r"),wR.readSync(n,r,0,150,0),wR.closeSync(n)}catch{}return tve(r.toString())}FZ.exports=rve});var BZ=v((get,qZ)=>{"use strict";var nve=Ge("path"),zZ=PZ(),UZ=CZ(),ive=LZ(),ove=process.platform==="win32",sve=/\.(?:com|exe)$/i,ave=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function cve(t){t.file=zZ(t);let e=t.file&&ive(t.file);return e?(t.args.unshift(t.file),t.command=e,zZ(t)):t.file}function lve(t){if(!ove)return t;let e=cve(t),r=!sve.test(e);if(t.options.forceShell||r){let n=ave.test(e);t.command=nve.normalize(t.command),t.command=UZ.command(t.command),t.args=t.args.map(o=>UZ.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 uve(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:lve(n)}qZ.exports=uve});var ZZ=v((yet,GZ)=>{"use strict";var xR=process.platform==="win32";function $R(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 dve(t,e){if(!xR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=HZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function HZ(t,e){return xR&&t===1&&!e.file?$R(e.original,"spawn"):null}function fve(t,e){return xR&&t===1&&!e.file?$R(e.original,"spawnSync"):null}GZ.exports={hookChildProcess:dve,verifyENOENT:HZ,verifyENOENTSync:fve,notFoundError:$R}});var KZ=v((_et,vl)=>{"use strict";var VZ=Ge("child_process"),kR=BZ(),ER=ZZ();function WZ(t,e,r){let n=kR(t,e,r),i=VZ.spawn(n.command,n.args,n.options);return ER.hookChildProcess(i,n),i}function pve(t,e,r){let n=kR(t,e,r),i=VZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||ER.verifyENOENTSync(i.status,n),i}vl.exports=WZ;vl.exports.spawn=WZ;vl.exports.sync=pve;vl.exports._parse=kR;vl.exports._enoent=ER});function rb(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 JZ=y(()=>{});var YZ=y(()=>{});import{promisify as mve}from"node:util";import{execFile as hve,execFileSync as $et}from"node:child_process";import XZ from"node:path";import{fileURLToPath as gve}from"node:url";function nb(t){return t instanceof URL?gve(t):t}function QZ(t){return{*[Symbol.iterator](){let e=XZ.resolve(nb(t)),r;for(;r!==e;)yield e,r=e,e=XZ.resolve(e,"..")}}}var Aet,Tet,e9=y(()=>{YZ();Aet=mve(hve);Tet=10*1024*1024});import ib from"node:process";import Ta from"node:path";var yve,_ve,bve,t9,r9=y(()=>{JZ();e9();yve=({cwd:t=ib.cwd(),path:e=ib.env[rb()],preferLocal:r=!0,execPath:n=ib.execPath,addExecPath:i=!0}={})=>{let o=Ta.resolve(nb(t)),s=[],a=e.split(Ta.delimiter);return r&&_ve(s,a,o),i&&bve(s,a,n,o),e===""||e===Ta.delimiter?`${s.join(Ta.delimiter)}${e}`:[...s,e].join(Ta.delimiter)},_ve=(t,e,r)=>{for(let n of QZ(r)){let i=Ta.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},bve=(t,e,r,n)=>{let i=Ta.resolve(n,nb(r),"..");e.includes(i)||t.push(i)},t9=({env:t=ib.env,...e}={})=>{t={...t};let r=rb({env:t});return e.path=t[r],t[r]=yve(e),t}});var n9,Xn,i9,o9,s9,ob,qf,Bf,Oa=y(()=>{n9=(t,e,r)=>{let n=r?Bf:qf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},i9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,s9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},o9=t=>ob(t)&&s9 in t,s9=Symbol("isExecaError"),ob=t=>Object.prototype.toString.call(t)==="[object Error]",qf=class extends Error{};i9(qf,qf.name);Bf=class extends Error{};i9(Bf,Bf.name)});var a9,vve,c9,l9,u9=y(()=>{a9=()=>{let t=l9-c9+1;return Array.from({length:t},vve)},vve=(t,e)=>({name:`SIGRT${e+1}`,number:c9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),c9=34,l9=64});var d9,f9=y(()=>{d9=[{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 Sve}from"node:os";var AR,wve,p9=y(()=>{f9();u9();AR=()=>{let t=a9();return[...d9,...t].map(wve)},wve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Sve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as xve}from"node:os";var $ve,kve,m9,Eve,Ave,Tve,Get,h9=y(()=>{p9();$ve=()=>{let t=AR();return Object.fromEntries(t.map(kve))},kve=({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}],m9=$ve(),Eve=()=>{let t=AR(),e=65,r=Array.from({length:e},(n,i)=>Ave(i,t));return Object.assign({},...r)},Ave=(t,e)=>{let r=Tve(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}}},Tve=(t,e)=>{let r=e.find(({name:n})=>xve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Get=Eve()});import{constants as Hf}from"node:os";var y9,_9,b9,Ove,Rve,g9,Ive,TR,Pve,Cve,sb,Gf=y(()=>{h9();y9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return b9(t,e)},_9=t=>t===0?t:b9(t,"`subprocess.kill()`'s argument"),b9=(t,e)=>{if(Number.isInteger(t))return Ove(t,e);if(typeof t=="string")return Ive(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +`).map(r=>Mbe({...e,message:r})),Mbe=t=>({verboseLine:QG(t),verboseObject:t}),Y_=t=>{let e=typeof t=="string"?t:Dbe(t);return Uf(e).replaceAll(" "," ".repeat(Fbe))},Fbe=2});var nZ,iZ=y(()=>{cs();_l();nZ=(t,e)=>{gl(e)&&Ti({type:"command",verboseMessage:t,verboseInfo:e})}});var oZ,Lbe,zbe,Ube,sZ=y(()=>{cs();oZ=(t,e,r)=>{Ube(t);let n=Lbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Lbe=t=>gl({verbose:t})?zbe++:void 0,zbe=0n,Ube=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(!Z_.includes(e)&&!G_(e)){let r=Z_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as aZ}from"node:process";var X_,gR,Q_=y(()=>{X_=()=>aZ.bigint(),gR=t=>Number(aZ.bigint()-t)/1e6});var eb,yR=y(()=>{iZ();sZ();Q_();V_();bo();eb=(t,e,r)=>{let n=X_(),{command:i,escapedCommand:o}=zG(t,e),s=uR(r,"verbose"),a=oZ(s,o,{...r});return nZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var fZ=v((set,dZ)=>{dZ.exports=uZ;uZ.sync=Bbe;var cZ=Ge("fs");function qbe(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{gZ.exports=mZ;mZ.sync=Hbe;var pZ=Ge("fs");function mZ(t,e,r){pZ.stat(t,function(n,i){r(n,n?!1:hZ(i,e))})}function Hbe(t,e){return hZ(pZ.statSync(t),e)}function hZ(t,e){return t.isFile()&&Gbe(t,e)}function Gbe(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 bZ=v((uet,_Z)=>{var cet=Ge("fs"),tb;process.platform==="win32"||global.TESTING_WINDOWS?tb=fZ():tb=yZ();_Z.exports=_R;_R.sync=Zbe;function _R(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){_R(t,e||{},function(o,s){o?i(o):n(s)})})}tb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Zbe(t,e){try{return tb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var EZ=v((det,kZ)=>{var bl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",vZ=Ge("path"),Vbe=bl?";":":",SZ=bZ(),wZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),xZ=(t,e)=>{let r=e.colon||Vbe,n=t.match(/\//)||bl&&t.match(/\\/)?[""]:[...bl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=bl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=bl?i.split(r):[""];return bl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},$Z=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=xZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(wZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=vZ.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];SZ(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)},Wbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=xZ(t,e),o=[];for(let s=0;s{"use strict";var AZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};bR.exports=AZ;bR.exports.default=AZ});var PZ=v((pet,IZ)=>{"use strict";var OZ=Ge("path"),Kbe=EZ(),Jbe=TZ();function RZ(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=Kbe.sync(t.command,{path:r[Jbe({env:r})],pathExt:e?OZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=OZ.resolve(i?t.options.cwd:"",s)),s}function Ybe(t){return RZ(t)||RZ(t,!0)}IZ.exports=Ybe});var CZ=v((met,SR)=>{"use strict";var vR=/([()\][%!^"`<>&|;, *?])/g;function Xbe(t){return t=t.replace(vR,"^$1"),t}function Qbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(vR,"^$1"),e&&(t=t.replace(vR,"^$1")),t}SR.exports.command=Xbe;SR.exports.argument=Qbe});var NZ=v((het,DZ)=>{"use strict";DZ.exports=/^#!(.*)/});var MZ=v((get,jZ)=>{"use strict";var eve=NZ();jZ.exports=(t="")=>{let e=t.match(eve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var LZ=v((yet,FZ)=>{"use strict";var wR=Ge("fs"),tve=MZ();function rve(t){let r=Buffer.alloc(150),n;try{n=wR.openSync(t,"r"),wR.readSync(n,r,0,150,0),wR.closeSync(n)}catch{}return tve(r.toString())}FZ.exports=rve});var BZ=v((_et,qZ)=>{"use strict";var nve=Ge("path"),zZ=PZ(),UZ=CZ(),ive=LZ(),ove=process.platform==="win32",sve=/\.(?:com|exe)$/i,ave=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function cve(t){t.file=zZ(t);let e=t.file&&ive(t.file);return e?(t.args.unshift(t.file),t.command=e,zZ(t)):t.file}function lve(t){if(!ove)return t;let e=cve(t),r=!sve.test(e);if(t.options.forceShell||r){let n=ave.test(e);t.command=nve.normalize(t.command),t.command=UZ.command(t.command),t.args=t.args.map(o=>UZ.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 uve(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:lve(n)}qZ.exports=uve});var ZZ=v((bet,GZ)=>{"use strict";var xR=process.platform==="win32";function $R(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 dve(t,e){if(!xR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=HZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function HZ(t,e){return xR&&t===1&&!e.file?$R(e.original,"spawn"):null}function fve(t,e){return xR&&t===1&&!e.file?$R(e.original,"spawnSync"):null}GZ.exports={hookChildProcess:dve,verifyENOENT:HZ,verifyENOENTSync:fve,notFoundError:$R}});var KZ=v((vet,vl)=>{"use strict";var VZ=Ge("child_process"),kR=BZ(),ER=ZZ();function WZ(t,e,r){let n=kR(t,e,r),i=VZ.spawn(n.command,n.args,n.options);return ER.hookChildProcess(i,n),i}function pve(t,e,r){let n=kR(t,e,r),i=VZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||ER.verifyENOENTSync(i.status,n),i}vl.exports=WZ;vl.exports.spawn=WZ;vl.exports.sync=pve;vl.exports._parse=kR;vl.exports._enoent=ER});function rb(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 JZ=y(()=>{});var YZ=y(()=>{});import{promisify as mve}from"node:util";import{execFile as hve,execFileSync as Eet}from"node:child_process";import XZ from"node:path";import{fileURLToPath as gve}from"node:url";function nb(t){return t instanceof URL?gve(t):t}function QZ(t){return{*[Symbol.iterator](){let e=XZ.resolve(nb(t)),r;for(;r!==e;)yield e,r=e,e=XZ.resolve(e,"..")}}}var Oet,Ret,e9=y(()=>{YZ();Oet=mve(hve);Ret=10*1024*1024});import ib from"node:process";import Aa from"node:path";var yve,_ve,bve,t9,r9=y(()=>{JZ();e9();yve=({cwd:t=ib.cwd(),path:e=ib.env[rb()],preferLocal:r=!0,execPath:n=ib.execPath,addExecPath:i=!0}={})=>{let o=Aa.resolve(nb(t)),s=[],a=e.split(Aa.delimiter);return r&&_ve(s,a,o),i&&bve(s,a,n,o),e===""||e===Aa.delimiter?`${s.join(Aa.delimiter)}${e}`:[...s,e].join(Aa.delimiter)},_ve=(t,e,r)=>{for(let n of QZ(r)){let i=Aa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},bve=(t,e,r,n)=>{let i=Aa.resolve(n,nb(r),"..");e.includes(i)||t.push(i)},t9=({env:t=ib.env,...e}={})=>{t={...t};let r=rb({env:t});return e.path=t[r],t[r]=yve(e),t}});var n9,Xn,i9,o9,s9,ob,qf,Bf,Ta=y(()=>{n9=(t,e,r)=>{let n=r?Bf:qf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},i9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,s9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},o9=t=>ob(t)&&s9 in t,s9=Symbol("isExecaError"),ob=t=>Object.prototype.toString.call(t)==="[object Error]",qf=class extends Error{};i9(qf,qf.name);Bf=class extends Error{};i9(Bf,Bf.name)});var a9,vve,c9,l9,u9=y(()=>{a9=()=>{let t=l9-c9+1;return Array.from({length:t},vve)},vve=(t,e)=>({name:`SIGRT${e+1}`,number:c9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),c9=34,l9=64});var d9,f9=y(()=>{d9=[{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 Sve}from"node:os";var AR,wve,p9=y(()=>{f9();u9();AR=()=>{let t=a9();return[...d9,...t].map(wve)},wve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Sve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as xve}from"node:os";var $ve,kve,m9,Eve,Ave,Tve,Vet,h9=y(()=>{p9();$ve=()=>{let t=AR();return Object.fromEntries(t.map(kve))},kve=({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}],m9=$ve(),Eve=()=>{let t=AR(),e=65,r=Array.from({length:e},(n,i)=>Ave(i,t));return Object.assign({},...r)},Ave=(t,e)=>{let r=Tve(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}}},Tve=(t,e)=>{let r=e.find(({name:n})=>xve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Vet=Eve()});import{constants as Hf}from"node:os";var y9,_9,b9,Ove,Rve,g9,Ive,TR,Pve,Cve,sb,Gf=y(()=>{h9();y9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return b9(t,e)},_9=t=>t===0?t:b9(t,"`subprocess.kill()`'s argument"),b9=(t,e)=>{if(Number.isInteger(t))return Ove(t,e);if(typeof t=="string")return Ive(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. ${TR()}`)},Ove=(t,e)=>{if(g9.has(t))return g9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. ${TR()}`)},Rve=()=>new Map(Object.entries(Hf.signals).reverse().map(([t,e])=>[e,t])),g9=Rve(),Ive=(t,e)=>{if(t in Hf.signals)return t;throw t.toUpperCase()in Hf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. ${TR()}`)},TR=()=>`Available signal names: ${Pve()}. -Available signal numbers: ${Cve()}.`,Pve=()=>Object.keys(Hf.signals).sort().map(t=>`'${t}'`).join(", "),Cve=()=>[...new Set(Object.values(Hf.signals).sort((t,e)=>t-e))].join(", "),sb=t=>m9[t].description});import{setTimeout as Dve}from"node:timers/promises";var v9,Nve,S9,jve,Mve,Fve,OR,ab=y(()=>{Oa();Gf();v9=t=>{if(t===!1)return t;if(t===!0)return Nve;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},Nve=1e3*5,S9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=jve(s,a,r);Mve(l,n);let u=t(c);return Fve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},jve=(t,e,r)=>{let[n=r,i]=ob(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&&!ob(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:_9(n),error:i}},Mve=(t,e)=>{t!==void 0&&e.reject(t)},Fve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&OR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},OR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Dve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Lve}from"node:events";var cb,RR=y(()=>{cb=async(t,e)=>{t.aborted||await Lve(t,"abort",{signal:e})}});var w9,x9,zve,IR=y(()=>{RR();w9=({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)}`)},x9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[zve(t,e,n,i)],zve=async(t,e,r,{signal:n})=>{throw await cb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Sl,Uve,PR,$9,k9,lb,E9,A9,T9,O9,R9,I9,qve,Bve,Hve,Qn,Gve,ls,wl,xl=y(()=>{Sl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Uve(t,e,r),PR(t,e,n)},Uve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},PR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${ls(e)} has already exited or disconnected.`)},$9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${ls(t)} exited or disconnected.`)},k9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${ls(t)} is sending a message too, instead of listening to incoming messages. +Available signal numbers: ${Cve()}.`,Pve=()=>Object.keys(Hf.signals).sort().map(t=>`'${t}'`).join(", "),Cve=()=>[...new Set(Object.values(Hf.signals).sort((t,e)=>t-e))].join(", "),sb=t=>m9[t].description});import{setTimeout as Dve}from"node:timers/promises";var v9,Nve,S9,jve,Mve,Fve,OR,ab=y(()=>{Ta();Gf();v9=t=>{if(t===!1)return t;if(t===!0)return Nve;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},Nve=1e3*5,S9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=jve(s,a,r);Mve(l,n);let u=t(c);return Fve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},jve=(t,e,r)=>{let[n=r,i]=ob(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&&!ob(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:_9(n),error:i}},Mve=(t,e)=>{t!==void 0&&e.reject(t)},Fve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&OR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},OR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Dve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Lve}from"node:events";var cb,RR=y(()=>{cb=async(t,e)=>{t.aborted||await Lve(t,"abort",{signal:e})}});var w9,x9,zve,IR=y(()=>{RR();w9=({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)}`)},x9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[zve(t,e,n,i)],zve=async(t,e,r,{signal:n})=>{throw await cb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Sl,Uve,PR,$9,k9,lb,E9,A9,T9,O9,R9,I9,qve,Bve,Hve,Qn,Gve,ls,wl,xl=y(()=>{Sl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Uve(t,e,r),PR(t,e,n)},Uve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},PR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${ls(e)} has already exited or disconnected.`)},$9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${ls(t)} exited or disconnected.`)},k9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${ls(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([ @@ -234,30 +234,30 @@ const [receivedMessage] = await Promise.all([ It must be ${n} or "fd3", "fd4" (and so on). It is optional and defaults to "${i}".`)},Vve=(t,e,r,n)=>{let i=n[D9(t)];if(i===void 0)throw new TypeError(`"${Zf(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(`"${Zf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Zf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},C9=(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}=Wve(t,r);return`The "${i}: ${ub(o)}" option is incompatible with using "${Zf(n)}: ${ub(e)}". -Please set this option with "pipe" instead.`},Wve=(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,Zf=t=>t?"to":"from",ub=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Kve}from"node:events";var Ra,fb=y(()=>{Ra=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Kve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var pb,CR,mb,DR,N9,j9,Vf=y(()=>{pb=(t,e)=>{e&&CR(t)},CR=t=>{t.refCounted()},mb=(t,e)=>{e&&DR(t)},DR=t=>{t.unrefCounted()},N9=(t,e)=>{e&&(DR(t),DR(t))},j9=(t,e)=>{e&&(CR(t),CR(t))}});import{once as Jve}from"node:events";import{scheduler as Yve}from"node:timers/promises";var M9,F9,hb,L9=y(()=>{yb();Vf();gb();_b();M9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(U9(i)||B9(i))return;hb.has(t)||hb.set(t,[]);let o=hb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await q9(t,n,i),await Yve.yield();let s=await z9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},F9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{NR();let o=hb.get(t);for(;o?.length>0;)await Jve(n,"message:done");t.removeListener("message",i),j9(e,r),n.connected=!1,n.emit("disconnect")},hb=new WeakMap});import{EventEmitter as Xve}from"node:events";var ds,bb,Qve,vb,Wf=y(()=>{L9();Vf();ds=(t,e,r)=>{if(bb.has(t))return bb.get(t);let n=new Xve;return n.connected=!0,bb.set(t,n),Qve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},bb=new WeakMap,Qve=({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",F9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),N9(r,n)},vb=t=>{let e=bb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as eSe}from"node:events";var H9,tSe,G9,z9,U9,Z9,Sb,rSe,wb,V9,gb=y(()=>{$l();fb();kb();xl();Wf();yb();H9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ds(t,e,r),s=xb(t,o);return{id:tSe++,type:wb,message:n,hasListeners:s}},tSe=0n,G9=(t,e)=>{if(!(e?.type!==wb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Sb[r].resolve({isDeadlock:!0,hasListeners:!1})},z9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==wb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:V9,message:xb(e,i)};try{await $b({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},U9=t=>{if(t?.type!==V9)return!1;let{id:e,message:r}=t;return Sb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},Z9=async(t,e,r)=>{if(t?.type!==wb)return;let n=Oi();Sb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,rSe(e,r,i)]);o&&k9(r),s||E9(r)}finally{i.abort(),delete Sb[t.id]}},Sb={},rSe=async(t,e,{signal:r})=>{Ra(t,1,r),await eSe(t,"disconnect",{signal:r}),A9(e)},wb="execa:ipc:request",V9="execa:ipc:response"});var W9,K9,q9,Kf,xb,nSe,yb=y(()=>{$l();bo();us();gb();W9=(t,e,r)=>{Kf.has(t)||Kf.set(t,new Set);let n=Kf.get(t),i=Oi(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},K9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},q9=async(t,e,r)=>{for(;!xb(t,e)&&Kf.get(t)?.size>0;){let n=[...Kf.get(t)];G9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Kf=new WeakMap,xb=(t,e)=>e.listenerCount("message")>nSe(t),nSe=t=>Ri.has(t)&&!_o(Ri.get(t).options.buffer,"ipc")?1:0});import{promisify as iSe}from"node:util";var $b,oSe,MR,sSe,jR,kb=y(()=>{xl();yb();gb();$b=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Sl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),oSe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},oSe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=H9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=W9(t,s,o);try{await MR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw wl(t),c}finally{K9(a)}},MR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=sSe(t);try{await Promise.all([Z9(n,t,r),o(n)])}catch(s){throw R9({error:s,methodName:e,isSubprocess:r}),I9({error:s,methodName:e,isSubprocess:r,message:i}),s}},sSe=t=>{if(jR.has(t))return jR.get(t);let e=iSe(t.send.bind(t));return jR.set(t,e),e},jR=new WeakMap});import{scheduler as aSe}from"node:timers/promises";var Y9,X9,cSe,J9,B9,Q9,NR,FR,_b=y(()=>{kb();Wf();xl();Y9=(t,e)=>{let r="cancelSignal";return PR(r,!1,t.connected),MR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:Q9,message:e},message:e})},X9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await cSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),FR.signal),cSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!J9){if(J9=!0,!n){O9();return}if(e===null){NR();return}ds(t,e,r),await aSe.yield()}},J9=!1,B9=t=>t?.type!==Q9?!1:(FR.abort(t.message),!0),Q9="execa:ipc:cancel",NR=()=>{FR.abort(T9())},FR=new AbortController});var eV,tV,lSe,uSe,LR=y(()=>{RR();_b();ab();eV=({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.")}},tV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[lSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],lSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await cb(e,i);let o=uSe(e);throw await Y9(t,o),OR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},uSe=({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 dSe}from"node:timers/promises";var rV,nV,fSe,zR=y(()=>{Oa();rV=({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})`)},nV=(t,e,r,n)=>e===0||e===void 0?[]:[fSe(t,e,r,n)],fSe=async(t,e,r,{signal:n})=>{throw await dSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as pSe,execArgv as mSe}from"node:process";import iV from"node:path";var oV,sV,UR=y(()=>{hl();oV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},sV=(t,e,{node:r=!1,nodePath:n=pSe,nodeOptions:i=mSe.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=ml(n,'The "nodePath" option'),l=iV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(iV.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 hSe}from"node:v8";var aV,gSe,ySe,_Se,cV,qR=y(()=>{aV=({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`.");_Se[r](t)}},gSe=t=>{try{hSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},ySe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},_Se={advanced:gSe,json:ySe},cV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var uV,bSe,nn,BR,vSe,lV,Eb,Ia=y(()=>{uV=({encoding:t})=>{if(BR.has(t))return;let e=vSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Eb(t)}\`. +Please set this option with "pipe" instead.`},Wve=(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,Zf=t=>t?"to":"from",ub=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Kve}from"node:events";var Oa,fb=y(()=>{Oa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Kve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var pb,CR,mb,DR,N9,j9,Vf=y(()=>{pb=(t,e)=>{e&&CR(t)},CR=t=>{t.refCounted()},mb=(t,e)=>{e&&DR(t)},DR=t=>{t.unrefCounted()},N9=(t,e)=>{e&&(DR(t),DR(t))},j9=(t,e)=>{e&&(CR(t),CR(t))}});import{once as Jve}from"node:events";import{scheduler as Yve}from"node:timers/promises";var M9,F9,hb,L9=y(()=>{yb();Vf();gb();_b();M9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(U9(i)||B9(i))return;hb.has(t)||hb.set(t,[]);let o=hb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await q9(t,n,i),await Yve.yield();let s=await z9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},F9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{NR();let o=hb.get(t);for(;o?.length>0;)await Jve(n,"message:done");t.removeListener("message",i),j9(e,r),n.connected=!1,n.emit("disconnect")},hb=new WeakMap});import{EventEmitter as Xve}from"node:events";var ds,bb,Qve,vb,Wf=y(()=>{L9();Vf();ds=(t,e,r)=>{if(bb.has(t))return bb.get(t);let n=new Xve;return n.connected=!0,bb.set(t,n),Qve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},bb=new WeakMap,Qve=({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",F9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),N9(r,n)},vb=t=>{let e=bb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as eSe}from"node:events";var H9,tSe,G9,z9,U9,Z9,Sb,rSe,wb,V9,gb=y(()=>{$l();fb();kb();xl();Wf();yb();H9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ds(t,e,r),s=xb(t,o);return{id:tSe++,type:wb,message:n,hasListeners:s}},tSe=0n,G9=(t,e)=>{if(!(e?.type!==wb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Sb[r].resolve({isDeadlock:!0,hasListeners:!1})},z9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==wb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:V9,message:xb(e,i)};try{await $b({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},U9=t=>{if(t?.type!==V9)return!1;let{id:e,message:r}=t;return Sb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},Z9=async(t,e,r)=>{if(t?.type!==wb)return;let n=Oi();Sb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,rSe(e,r,i)]);o&&k9(r),s||E9(r)}finally{i.abort(),delete Sb[t.id]}},Sb={},rSe=async(t,e,{signal:r})=>{Oa(t,1,r),await eSe(t,"disconnect",{signal:r}),A9(e)},wb="execa:ipc:request",V9="execa:ipc:response"});var W9,K9,q9,Kf,xb,nSe,yb=y(()=>{$l();bo();us();gb();W9=(t,e,r)=>{Kf.has(t)||Kf.set(t,new Set);let n=Kf.get(t),i=Oi(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},K9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},q9=async(t,e,r)=>{for(;!xb(t,e)&&Kf.get(t)?.size>0;){let n=[...Kf.get(t)];G9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Kf=new WeakMap,xb=(t,e)=>e.listenerCount("message")>nSe(t),nSe=t=>Ri.has(t)&&!_o(Ri.get(t).options.buffer,"ipc")?1:0});import{promisify as iSe}from"node:util";var $b,oSe,MR,sSe,jR,kb=y(()=>{xl();yb();gb();$b=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Sl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),oSe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},oSe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=H9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=W9(t,s,o);try{await MR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw wl(t),c}finally{K9(a)}},MR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=sSe(t);try{await Promise.all([Z9(n,t,r),o(n)])}catch(s){throw R9({error:s,methodName:e,isSubprocess:r}),I9({error:s,methodName:e,isSubprocess:r,message:i}),s}},sSe=t=>{if(jR.has(t))return jR.get(t);let e=iSe(t.send.bind(t));return jR.set(t,e),e},jR=new WeakMap});import{scheduler as aSe}from"node:timers/promises";var Y9,X9,cSe,J9,B9,Q9,NR,FR,_b=y(()=>{kb();Wf();xl();Y9=(t,e)=>{let r="cancelSignal";return PR(r,!1,t.connected),MR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:Q9,message:e},message:e})},X9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await cSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),FR.signal),cSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!J9){if(J9=!0,!n){O9();return}if(e===null){NR();return}ds(t,e,r),await aSe.yield()}},J9=!1,B9=t=>t?.type!==Q9?!1:(FR.abort(t.message),!0),Q9="execa:ipc:cancel",NR=()=>{FR.abort(T9())},FR=new AbortController});var eV,tV,lSe,uSe,LR=y(()=>{RR();_b();ab();eV=({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.")}},tV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[lSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],lSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await cb(e,i);let o=uSe(e);throw await Y9(t,o),OR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},uSe=({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 dSe}from"node:timers/promises";var rV,nV,fSe,zR=y(()=>{Ta();rV=({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})`)},nV=(t,e,r,n)=>e===0||e===void 0?[]:[fSe(t,e,r,n)],fSe=async(t,e,r,{signal:n})=>{throw await dSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as pSe,execArgv as mSe}from"node:process";import iV from"node:path";var oV,sV,UR=y(()=>{hl();oV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},sV=(t,e,{node:r=!1,nodePath:n=pSe,nodeOptions:i=mSe.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=ml(n,'The "nodePath" option'),l=iV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(iV.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 hSe}from"node:v8";var aV,gSe,ySe,_Se,cV,qR=y(()=>{aV=({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`.");_Se[r](t)}},gSe=t=>{try{hSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},ySe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},_Se={advanced:gSe,json:ySe},cV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var uV,bSe,nn,BR,vSe,lV,Eb,Ra=y(()=>{uV=({encoding:t})=>{if(BR.has(t))return;let e=vSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Eb(t)}\`. Please rename it to ${Eb(e)}.`);let r=[...BR].map(n=>Eb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Eb(t)}\`. Please rename it to one of: ${r}.`)},bSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),BR=new Set([...bSe,...nn]),vSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in lV)return lV[e];if(BR.has(e))return e},lV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Eb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as SSe}from"node:fs";import wSe from"node:path";import xSe from"node:process";var dV,fV,pV,HR=y(()=>{hl();dV=(t=fV())=>{let e=ml(t,'The "cwd" option');return wSe.resolve(e)},fV=()=>{try{return xSe.cwd()}catch(t){throw t.message=`The current directory does not exist. ${t.message}`,t}},pV=(t,e)=>{if(e===fV())return t;let r;try{r=SSe(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 $Se from"node:path";import mV from"node:process";var hV,Ab,kSe,ESe,GR=y(()=>{hV=St(KZ(),1);r9();ab();Gf();IR();LR();zR();UR();qR();Ia();HR();hl();bo();Ab=(t,e,r)=>{r.cwd=dV(r.cwd);let[n,i,o]=sV(t,e,r),{command:s,args:a,options:c}=hV.default._parse(n,i,o),l=FG(c),u=kSe(l);return rV(u),uV(u),aV(u),w9(u),eV(u),u.shell=sR(u.shell),u.env=ESe(u),u.killSignal=y9(u.killSignal),u.forceKillAfterDelay=v9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),mV.platform==="win32"&&$Se.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},kSe=({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}),ESe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...mV.env,...t}:t;return r||n?t9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Tb,ZR=y(()=>{Tb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function El(t){if(typeof t=="string")return ASe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return TSe(t)}var ASe,TSe,gV,OSe,yV,RSe,VR=y(()=>{ASe=t=>t.at(-1)===gV?t.slice(0,t.at(-2)===yV?-2:-1):t,TSe=t=>t.at(-1)===OSe?t.subarray(0,t.at(-2)===RSe?-2:-1):t,gV=` -`,OSe=gV.codePointAt(0),yV="\r",RSe=yV.codePointAt(0)});function ei(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 WR(t,{checkOpen:e=!0}={}){return ei(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 Pa(t,{checkOpen:e=!0}={}){return ei(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 KR(t,e){return WR(t,e)&&Pa(t,e)}var Ca=y(()=>{});function _V(){return this[YR].next()}function bV(t){return this[YR].return(t)}function XR({preventCancel:t=!1}={}){let e=this.getReader(),r=new JR(e,t),n=Object.create(PSe);return n[YR]=r,n}var ISe,JR,YR,PSe,vV=y(()=>{ISe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),JR=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}}},YR=Symbol();Object.defineProperty(_V,"name",{value:"next"});Object.defineProperty(bV,"name",{value:"return"});PSe=Object.create(ISe,{next:{enumerable:!0,configurable:!0,writable:!0,value:_V},return:{enumerable:!0,configurable:!0,writable:!0,value:bV}})});var SV=y(()=>{});var wV=y(()=>{vV();SV()});var xV,CSe,DSe,NSe,Jf,QR=y(()=>{Ca();wV();xV=t=>{if(Pa(t,{checkOpen:!1})&&Jf.on!==void 0)return DSe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(CSe.call(t)==="[object ReadableStream]")return XR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:CSe}=Object.prototype,DSe=async function*(t){let e=new AbortController,r={};NSe(t,e,r);try{for await(let[n]of Jf.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()}},NSe=async(t,e,r)=>{try{await Jf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Jf={}});var Al,jSe,EV,$V,MSe,kV,Ii,Yf=y(()=>{QR();Al=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=xV(t),u=e();u.length=0;try{for await(let d of l){let f=MSe(d),p=r[f](d,u);EV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return jSe({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}},jSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&EV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},EV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){$V(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&$V(c,e,i,o),new Ii},$V=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},MSe=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=kV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&kV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:kV}=Object.prototype,Ii=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var vo,Xf,Ob,Rb,Ib,Pb=y(()=>{vo=t=>t,Xf=()=>{},Ob=({contents:t})=>t,Rb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Ib=t=>t.length});async function Cb(t,e){return Al(t,USe,e)}var FSe,LSe,zSe,USe,AV=y(()=>{Yf();Pb();FSe=()=>({contents:[]}),LSe=()=>1,zSe=(t,{contents:e})=>(e.push(t),e),USe={init:FSe,convertChunk:{string:vo,buffer:vo,arrayBuffer:vo,dataView:vo,typedArray:vo,others:vo},getSize:LSe,truncateChunk:Xf,addChunk:zSe,getFinalChunk:Xf,finalize:Ob}});async function Db(t,e){return Al(t,JSe,e)}var qSe,BSe,HSe,TV,OV,GSe,ZSe,VSe,WSe,IV,RV,KSe,PV,JSe,CV=y(()=>{Yf();Pb();qSe=()=>({contents:new ArrayBuffer(0)}),BSe=t=>HSe.encode(t),HSe=new TextEncoder,TV=t=>new Uint8Array(t),OV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),GSe=(t,e)=>t.slice(0,e),ZSe=(t,{contents:e,length:r},n)=>{let i=PV()?WSe(e,n):VSe(e,n);return new Uint8Array(i).set(t,r),i},VSe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(IV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},WSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:IV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},IV=t=>RV**Math.ceil(Math.log(t)/Math.log(RV)),RV=2,KSe=({contents:t,length:e})=>PV()?t:t.slice(0,e),PV=()=>"resize"in ArrayBuffer.prototype,JSe={init:qSe,convertChunk:{string:BSe,buffer:TV,arrayBuffer:TV,dataView:OV,typedArray:OV,others:Rb},getSize:Ib,truncateChunk:GSe,addChunk:ZSe,getFinalChunk:Xf,finalize:KSe}});async function jb(t,e){return Al(t,twe,e)}var YSe,Nb,XSe,QSe,ewe,twe,DV=y(()=>{Yf();Pb();YSe=()=>({contents:"",textDecoder:new TextDecoder}),Nb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),XSe=(t,{contents:e})=>e+t,QSe=(t,e)=>t.slice(0,e),ewe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},twe={init:YSe,convertChunk:{string:vo,buffer:Nb,arrayBuffer:Nb,dataView:Nb,typedArray:Nb,others:Rb},getSize:Ib,truncateChunk:QSe,addChunk:XSe,getFinalChunk:ewe,finalize:Ob}});var NV=y(()=>{AV();CV();DV();Yf()});import{on as rwe}from"node:events";import{finished as nwe}from"node:stream/promises";var Mb=y(()=>{QR();NV();Object.assign(Jf,{on:rwe,finished:nwe})});var jV,iwe,MV,FV,owe,LV,zV,Fb,Da=y(()=>{Mb();yo();bo();jV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ii))throw t;if(o==="all")return t;let s=iwe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},iwe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",MV=(t,e,r)=>{if(e.length!==r)return;let n=new Ii;throw n.maxBufferInfo={fdNumber:"ipc"},n},FV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=owe(t,e);return`Command's ${r} was larger than ${n} ${i}`},owe=(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=_o(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:H_(r),threshold:i,unit:n}},LV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Fb(r)),zV=(t,e,r)=>{if(!e)return t;let n=Fb(r);return t.length>n?t.slice(0,n):t},Fb=([,t])=>t});import{inspect as swe}from"node:util";var qV,awe,cwe,lwe,uwe,dwe,UV,BV=y(()=>{VR();rn();HR();V_();Da();Gf();Oa();qV=({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=awe({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=lwe(n,b),w=x===void 0?"":` +${t}`}});import $Se from"node:path";import mV from"node:process";var hV,Ab,kSe,ESe,GR=y(()=>{hV=St(KZ(),1);r9();ab();Gf();IR();LR();zR();UR();qR();Ra();HR();hl();bo();Ab=(t,e,r)=>{r.cwd=dV(r.cwd);let[n,i,o]=sV(t,e,r),{command:s,args:a,options:c}=hV.default._parse(n,i,o),l=FG(c),u=kSe(l);return rV(u),uV(u),aV(u),w9(u),eV(u),u.shell=sR(u.shell),u.env=ESe(u),u.killSignal=y9(u.killSignal),u.forceKillAfterDelay=v9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),mV.platform==="win32"&&$Se.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},kSe=({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}),ESe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...mV.env,...t}:t;return r||n?t9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Tb,ZR=y(()=>{Tb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function El(t){if(typeof t=="string")return ASe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return TSe(t)}var ASe,TSe,gV,OSe,yV,RSe,VR=y(()=>{ASe=t=>t.at(-1)===gV?t.slice(0,t.at(-2)===yV?-2:-1):t,TSe=t=>t.at(-1)===OSe?t.subarray(0,t.at(-2)===RSe?-2:-1):t,gV=` +`,OSe=gV.codePointAt(0),yV="\r",RSe=yV.codePointAt(0)});function ei(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 WR(t,{checkOpen:e=!0}={}){return ei(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 Ia(t,{checkOpen:e=!0}={}){return ei(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 KR(t,e){return WR(t,e)&&Ia(t,e)}var Pa=y(()=>{});function _V(){return this[YR].next()}function bV(t){return this[YR].return(t)}function XR({preventCancel:t=!1}={}){let e=this.getReader(),r=new JR(e,t),n=Object.create(PSe);return n[YR]=r,n}var ISe,JR,YR,PSe,vV=y(()=>{ISe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),JR=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}}},YR=Symbol();Object.defineProperty(_V,"name",{value:"next"});Object.defineProperty(bV,"name",{value:"return"});PSe=Object.create(ISe,{next:{enumerable:!0,configurable:!0,writable:!0,value:_V},return:{enumerable:!0,configurable:!0,writable:!0,value:bV}})});var SV=y(()=>{});var wV=y(()=>{vV();SV()});var xV,CSe,DSe,NSe,Jf,QR=y(()=>{Pa();wV();xV=t=>{if(Ia(t,{checkOpen:!1})&&Jf.on!==void 0)return DSe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(CSe.call(t)==="[object ReadableStream]")return XR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:CSe}=Object.prototype,DSe=async function*(t){let e=new AbortController,r={};NSe(t,e,r);try{for await(let[n]of Jf.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()}},NSe=async(t,e,r)=>{try{await Jf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Jf={}});var Al,jSe,EV,$V,MSe,kV,Ii,Yf=y(()=>{QR();Al=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=xV(t),u=e();u.length=0;try{for await(let d of l){let f=MSe(d),p=r[f](d,u);EV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return jSe({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}},jSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&EV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},EV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){$V(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&$V(c,e,i,o),new Ii},$V=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},MSe=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=kV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&kV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:kV}=Object.prototype,Ii=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var vo,Xf,Ob,Rb,Ib,Pb=y(()=>{vo=t=>t,Xf=()=>{},Ob=({contents:t})=>t,Rb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Ib=t=>t.length});async function Cb(t,e){return Al(t,USe,e)}var FSe,LSe,zSe,USe,AV=y(()=>{Yf();Pb();FSe=()=>({contents:[]}),LSe=()=>1,zSe=(t,{contents:e})=>(e.push(t),e),USe={init:FSe,convertChunk:{string:vo,buffer:vo,arrayBuffer:vo,dataView:vo,typedArray:vo,others:vo},getSize:LSe,truncateChunk:Xf,addChunk:zSe,getFinalChunk:Xf,finalize:Ob}});async function Db(t,e){return Al(t,JSe,e)}var qSe,BSe,HSe,TV,OV,GSe,ZSe,VSe,WSe,IV,RV,KSe,PV,JSe,CV=y(()=>{Yf();Pb();qSe=()=>({contents:new ArrayBuffer(0)}),BSe=t=>HSe.encode(t),HSe=new TextEncoder,TV=t=>new Uint8Array(t),OV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),GSe=(t,e)=>t.slice(0,e),ZSe=(t,{contents:e,length:r},n)=>{let i=PV()?WSe(e,n):VSe(e,n);return new Uint8Array(i).set(t,r),i},VSe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(IV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},WSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:IV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},IV=t=>RV**Math.ceil(Math.log(t)/Math.log(RV)),RV=2,KSe=({contents:t,length:e})=>PV()?t:t.slice(0,e),PV=()=>"resize"in ArrayBuffer.prototype,JSe={init:qSe,convertChunk:{string:BSe,buffer:TV,arrayBuffer:TV,dataView:OV,typedArray:OV,others:Rb},getSize:Ib,truncateChunk:GSe,addChunk:ZSe,getFinalChunk:Xf,finalize:KSe}});async function jb(t,e){return Al(t,twe,e)}var YSe,Nb,XSe,QSe,ewe,twe,DV=y(()=>{Yf();Pb();YSe=()=>({contents:"",textDecoder:new TextDecoder}),Nb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),XSe=(t,{contents:e})=>e+t,QSe=(t,e)=>t.slice(0,e),ewe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},twe={init:YSe,convertChunk:{string:vo,buffer:Nb,arrayBuffer:Nb,dataView:Nb,typedArray:Nb,others:Rb},getSize:Ib,truncateChunk:QSe,addChunk:XSe,getFinalChunk:ewe,finalize:Ob}});var NV=y(()=>{AV();CV();DV();Yf()});import{on as rwe}from"node:events";import{finished as nwe}from"node:stream/promises";var Mb=y(()=>{QR();NV();Object.assign(Jf,{on:rwe,finished:nwe})});var jV,iwe,MV,FV,owe,LV,zV,Fb,Ca=y(()=>{Mb();yo();bo();jV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ii))throw t;if(o==="all")return t;let s=iwe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},iwe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",MV=(t,e,r)=>{if(e.length!==r)return;let n=new Ii;throw n.maxBufferInfo={fdNumber:"ipc"},n},FV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=owe(t,e);return`Command's ${r} was larger than ${n} ${i}`},owe=(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=_o(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:H_(r),threshold:i,unit:n}},LV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Fb(r)),zV=(t,e,r)=>{if(!e)return t;let n=Fb(r);return t.length>n?t.slice(0,n):t},Fb=([,t])=>t});import{inspect as swe}from"node:util";var qV,awe,cwe,lwe,uwe,dwe,UV,BV=y(()=>{VR();rn();HR();V_();Ca();Gf();Ta();qV=({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=awe({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=lwe(n,b),w=x===void 0?"":` ${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>uwe(D)).join(` `)].map(D=>Uf(El(dwe(D)))).filter(Boolean).join(` `);return{originalMessage:x,shortMessage:O,message:A}},awe=({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=cwe(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?`${FV(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"},cwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",lwe=(t,e)=>{if(t instanceof Xn)return;let r=o9(t)?t.originalMessage:String(t?.message??t),n=Uf(pV(r,e));return n===""?void 0:n},uwe=t=>typeof t=="string"?t:swe(t),dwe=t=>Array.isArray(t)?t.map(e=>El(UV(e))).filter(Boolean).join(` -`):UV(t),UV=t=>typeof t=="string"?t:Ut(t)?q_(t):""});var Lb,Tl,Qf,fwe,HV,pwe,ep=y(()=>{Gf();Q_();Oa();BV();Lb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>HV({command:t,escapedCommand:e,cwd:o,durationMs:gR(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:[]}),Tl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Qf({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}),Qf=({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:O,signalDescription:T}=pwe(l,u),{originalMessage:A,shortMessage:D,message:$}=qV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),ie=n9(t,$,x);return Object.assign(ie,fwe({error:ie,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),ie},fwe=({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})=>HV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:gR(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:[]}),HV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),pwe=(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 mwe(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(GV(t*1e3)%1e3),nanoseconds:Math.trunc(GV(t*1e6)%1e3)}}function hwe(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 eI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return mwe(t);break}case"bigint":return hwe(t)}throw new TypeError("Expected a finite number or bigint")}var GV,ZV=y(()=>{GV=t=>Number.isFinite(t)?t:0});function tI(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+_we);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&gwe(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?" "+ywe(d,u):f;i.push(p)}},a=eI(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%bwe):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 gwe,ywe,_we,bwe,VV=y(()=>{ZV();gwe=t=>t===0||t===0n,ywe=(t,e)=>e===1||e===1n?t:`${t}s`,_we=1e-7,bwe=24n*60n*60n*1000n});var WV,KV=y(()=>{_l();WV=(t,e)=>{t.failed&&Ti({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var JV,vwe,YV=y(()=>{VV();cs();_l();KV();JV=(t,e)=>{gl(e)&&(WV(t,e),vwe(t,e))},vwe=(t,e)=>{let r=`(done in ${tI(t.durationMs)})`;Ti({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ol,zb=y(()=>{YV();Ol=(t,e,{reject:r})=>{if(JV(t,e),t.failed&&r)throw t;return t}});var eW,Swe,wwe,tW,rW,XV,xwe,rI,QV,Na,nW,$we,Ub,iW,kwe,Ewe,nI,oW,Awe,sW,qb,Twe,iI,Owe,Rwe,aW,An,Bb,oI,cW,lW,fs,vr=y(()=>{Ca();ho();rn();eW=(t,e)=>Na(t)?"asyncGenerator":nW(t)?"generator":Ub(t)?"fileUrl":kwe(t)?"filePath":Twe(t)?"webStream":ei(t,{checkOpen:!1})?"native":Ut(t)?"uint8Array":Owe(t)?"asyncIterable":Rwe(t)?"iterable":iI(t)?tW({transform:t},e):$we(t)?Swe(t,e):"native",Swe=(t,e)=>KR(t.transform,{checkOpen:!1})?wwe(t,e):iI(t.transform)?tW(t,e):xwe(t,e),wwe=(t,e)=>(rW(t,e,"Duplex stream"),"duplex"),tW=(t,e)=>(rW(t,e,"web TransformStream"),"webTransform"),rW=({final:t,binary:e,objectMode:r},n,i)=>{XV(t,`${n}.final`,i),XV(e,`${n}.binary`,i),rI(r,`${n}.objectMode`)},XV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},xwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!QV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(KR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(iI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!QV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return rI(r,`${i}.binary`),rI(n,`${i}.objectMode`),Na(t)||Na(e)?"asyncGenerator":"generator"},rI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},QV=t=>Na(t)||nW(t),Na=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",nW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",$we=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Ub=t=>Object.prototype.toString.call(t)==="[object URL]",iW=t=>Ub(t)&&t.protocol!=="file:",kwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Ewe.has(e))&&nI(t.file),Ewe=new Set(["file","append"]),nI=t=>typeof t=="string",oW=(t,e)=>t==="native"&&typeof e=="string"&&!Awe.has(e),Awe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),sW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",qb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Twe=t=>sW(t)||qb(t),iI=t=>sW(t?.readable)&&qb(t?.writable),Owe=t=>aW(t)&&typeof t[Symbol.asyncIterator]=="function",Rwe=t=>aW(t)&&typeof t[Symbol.iterator]=="function",aW=t=>typeof t=="object"&&t!==null,An=new Set(["generator","asyncGenerator","duplex","webTransform"]),Bb=new Set(["fileUrl","filePath","fileNumber"]),oI=new Set(["fileUrl","filePath"]),cW=new Set([...oI,"webStream","nodeStream"]),lW=new Set(["webTransform","duplex"]),fs={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,Iwe,Pwe,uW,aI=y(()=>{vr();sI=(t,e,r,n)=>n==="output"?Iwe(t,e,r):Pwe(t,e,r),Iwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Pwe=(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})=>An.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var dW,Cwe,Dwe,Nwe,jwe,Mwe,Fwe,fW=y(()=>{ho();Ia();vr();aI();dW=(t,e,r,n)=>[...t.filter(({type:i})=>!An.has(i)),...Cwe(t,e,r,n)],Cwe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>An.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Dwe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Fwe(o,r)},Dwe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Nwe({stdioItem:t,optionName:i}):e==="webTransform"?jwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Mwe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Nwe=({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}}},jwe=({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}}},Mwe=({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||nn.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}}},Fwe=(t,e)=>e==="input"?t.reverse():t});import cI from"node:process";var pW,Lwe,zwe,Rl,lI,mW,Uwe,qwe,hW=y(()=>{Ca();vr();pW=(t,e,r)=>{let n=t.map(i=>Lwe(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)??qwe},Lwe=({type:t,value:e},r)=>zwe[r]??mW[t](e),zwe=["input","output","output"],Rl=()=>{},lI=()=>"input",mW={generator:Rl,asyncGenerator:Rl,fileUrl:Rl,filePath:Rl,iterable:lI,asyncIterable:lI,uint8Array:lI,webStream:t=>qb(t)?"output":"input",nodeStream(t){return Pa(t,{checkOpen:!1})?WR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Rl,duplex:Rl,native(t){let e=Uwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return mW.nodeStream(t)}},Uwe=t=>{if([0,cI.stdin].includes(t))return"input";if([1,2,cI.stdout,cI.stderr].includes(t))return"output"},qwe="output"});var gW,yW=y(()=>{gW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var _W,Bwe,Hwe,bW,Gwe,Zwe,vW=y(()=>{yo();yW();cs();_W=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Bwe(t,n).map((a,c)=>bW(a,c));return o?Gwe(s,r,i):gW(s,e)},Bwe=(t,e)=>{if(t===void 0)return En.map(n=>e[n]);if(Hwe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${En.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,En.length);return Array.from({length:r},(n,i)=>t[i])},Hwe=t=>En.some(e=>t[e]!==void 0),bW=(t,e)=>Array.isArray(t)?t.map(r=>bW(r,e)):t??(e>=En.length?"ignore":"pipe"),Gwe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!yl(r,i)&&Zwe(n)?"ignore":n),Zwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Vwe}from"node:fs";import Wwe from"node:tty";var wW,Kwe,Jwe,Ywe,Xwe,SW,xW=y(()=>{Ca();yo();rn();us();wW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Kwe({stdioItem:t,fdNumber:n,direction:i}):Xwe({stdioItem:t,fdNumber:n}),Kwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Jwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Jwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Ywe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Wwe.isatty(i))throw new TypeError(`The \`${e}: ${ub(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:go(Vwe(i)),optionName:e}}},Ywe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=B_.indexOf(t);if(r!==-1)return r},Xwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:SW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:SW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,SW=(t,e,r)=>{let n=B_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var $W,Qwe,exe,txe,rxe,kW=y(()=>{Ca();rn();vr();$W=({input:t,inputFile:e},r)=>r===0?[...Qwe(t),...txe(e)]:[],Qwe=t=>t===void 0?[]:[{type:exe(t),value:t,optionName:"input"}],exe=t=>{if(Pa(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ut(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},txe=t=>t===void 0?[]:[{...rxe(t),optionName:"inputFile"}],rxe=t=>{if(Ub(t))return{type:"fileUrl",value:t};if(nI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var EW,AW,nxe,ixe,TW,oxe,sxe,OW,RW=y(()=>{vr();EW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),AW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=nxe(i,t);if(s.length!==0){if(o){ixe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(cW.has(t))return TW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});lW.has(t)&&sxe({otherStdioItems:s,type:t,value:e,optionName:r})}},nxe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),ixe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{oI.has(e)&&TW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},TW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>oxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return OW(s,n,e),i==="output"?o[0].stream:void 0},oxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,sxe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);OW(i,n,e)},OW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${fs[r]} that is the same.`)}});var Hb,axe,cxe,lxe,uxe,dxe,fxe,pxe,mxe,hxe,gxe,yxe,uI,_xe,Gb=y(()=>{yo();fW();aI();vr();hW();vW();xW();kW();RW();Hb=(t,e,r,n)=>{let o=_W(e,r,n).map((a,c)=>axe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=hxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>_xe(a)),s},axe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=H_(e),{stdioItems:o,isStdioArray:s}=cxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=pW(o,e,i),c=o.map(d=>wW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=dW(c,i,a,r),u=uW(l,a);return mxe(l,u),{direction:a,objectMode:u,stdioItems:l}},cxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>lxe(c,n)),...$W(r,e)],s=EW(o),a=s.length>1;return uxe(s,a,n),fxe(s),{stdioItems:s,isStdioArray:a}},lxe=(t,e)=>({type:eW(t,e),value:t,optionName:e}),uxe=(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(dxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},dxe=new Set(["ignore","ipc"]),fxe=t=>{for(let e of t)pxe(e)},pxe=({type:t,value:e,optionName:r})=>{if(iW(e))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme. +`):UV(t),UV=t=>typeof t=="string"?t:Ut(t)?q_(t):""});var Lb,Tl,Qf,fwe,HV,pwe,ep=y(()=>{Gf();Q_();Ta();BV();Lb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>HV({command:t,escapedCommand:e,cwd:o,durationMs:gR(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:[]}),Tl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Qf({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}),Qf=({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:O,signalDescription:T}=pwe(l,u),{originalMessage:A,shortMessage:D,message:$}=qV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),ie=n9(t,$,x);return Object.assign(ie,fwe({error:ie,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),ie},fwe=({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})=>HV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:gR(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:[]}),HV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),pwe=(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 mwe(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(GV(t*1e3)%1e3),nanoseconds:Math.trunc(GV(t*1e6)%1e3)}}function hwe(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 eI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return mwe(t);break}case"bigint":return hwe(t)}throw new TypeError("Expected a finite number or bigint")}var GV,ZV=y(()=>{GV=t=>Number.isFinite(t)?t:0});function tI(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+_we);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&gwe(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?" "+ywe(d,u):f;i.push(p)}},a=eI(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%bwe):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 gwe,ywe,_we,bwe,VV=y(()=>{ZV();gwe=t=>t===0||t===0n,ywe=(t,e)=>e===1||e===1n?t:`${t}s`,_we=1e-7,bwe=24n*60n*60n*1000n});var WV,KV=y(()=>{_l();WV=(t,e)=>{t.failed&&Ti({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var JV,vwe,YV=y(()=>{VV();cs();_l();KV();JV=(t,e)=>{gl(e)&&(WV(t,e),vwe(t,e))},vwe=(t,e)=>{let r=`(done in ${tI(t.durationMs)})`;Ti({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ol,zb=y(()=>{YV();Ol=(t,e,{reject:r})=>{if(JV(t,e),t.failed&&r)throw t;return t}});var eW,Swe,wwe,tW,rW,XV,xwe,rI,QV,Da,nW,$we,Ub,iW,kwe,Ewe,nI,oW,Awe,sW,qb,Twe,iI,Owe,Rwe,aW,Tn,Bb,oI,cW,lW,fs,vr=y(()=>{Pa();ho();rn();eW=(t,e)=>Da(t)?"asyncGenerator":nW(t)?"generator":Ub(t)?"fileUrl":kwe(t)?"filePath":Twe(t)?"webStream":ei(t,{checkOpen:!1})?"native":Ut(t)?"uint8Array":Owe(t)?"asyncIterable":Rwe(t)?"iterable":iI(t)?tW({transform:t},e):$we(t)?Swe(t,e):"native",Swe=(t,e)=>KR(t.transform,{checkOpen:!1})?wwe(t,e):iI(t.transform)?tW(t,e):xwe(t,e),wwe=(t,e)=>(rW(t,e,"Duplex stream"),"duplex"),tW=(t,e)=>(rW(t,e,"web TransformStream"),"webTransform"),rW=({final:t,binary:e,objectMode:r},n,i)=>{XV(t,`${n}.final`,i),XV(e,`${n}.binary`,i),rI(r,`${n}.objectMode`)},XV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},xwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!QV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(KR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(iI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!QV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return rI(r,`${i}.binary`),rI(n,`${i}.objectMode`),Da(t)||Da(e)?"asyncGenerator":"generator"},rI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},QV=t=>Da(t)||nW(t),Da=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",nW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",$we=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Ub=t=>Object.prototype.toString.call(t)==="[object URL]",iW=t=>Ub(t)&&t.protocol!=="file:",kwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Ewe.has(e))&&nI(t.file),Ewe=new Set(["file","append"]),nI=t=>typeof t=="string",oW=(t,e)=>t==="native"&&typeof e=="string"&&!Awe.has(e),Awe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),sW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",qb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Twe=t=>sW(t)||qb(t),iI=t=>sW(t?.readable)&&qb(t?.writable),Owe=t=>aW(t)&&typeof t[Symbol.asyncIterator]=="function",Rwe=t=>aW(t)&&typeof t[Symbol.iterator]=="function",aW=t=>typeof t=="object"&&t!==null,Tn=new Set(["generator","asyncGenerator","duplex","webTransform"]),Bb=new Set(["fileUrl","filePath","fileNumber"]),oI=new Set(["fileUrl","filePath"]),cW=new Set([...oI,"webStream","nodeStream"]),lW=new Set(["webTransform","duplex"]),fs={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,Iwe,Pwe,uW,aI=y(()=>{vr();sI=(t,e,r,n)=>n==="output"?Iwe(t,e,r):Pwe(t,e,r),Iwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Pwe=(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})=>Tn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var dW,Cwe,Dwe,Nwe,jwe,Mwe,Fwe,fW=y(()=>{ho();Ra();vr();aI();dW=(t,e,r,n)=>[...t.filter(({type:i})=>!Tn.has(i)),...Cwe(t,e,r,n)],Cwe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Tn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Dwe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Fwe(o,r)},Dwe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Nwe({stdioItem:t,optionName:i}):e==="webTransform"?jwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Mwe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Nwe=({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}}},jwe=({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}}},Mwe=({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||nn.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}}},Fwe=(t,e)=>e==="input"?t.reverse():t});import cI from"node:process";var pW,Lwe,zwe,Rl,lI,mW,Uwe,qwe,hW=y(()=>{Pa();vr();pW=(t,e,r)=>{let n=t.map(i=>Lwe(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)??qwe},Lwe=({type:t,value:e},r)=>zwe[r]??mW[t](e),zwe=["input","output","output"],Rl=()=>{},lI=()=>"input",mW={generator:Rl,asyncGenerator:Rl,fileUrl:Rl,filePath:Rl,iterable:lI,asyncIterable:lI,uint8Array:lI,webStream:t=>qb(t)?"output":"input",nodeStream(t){return Ia(t,{checkOpen:!1})?WR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Rl,duplex:Rl,native(t){let e=Uwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return mW.nodeStream(t)}},Uwe=t=>{if([0,cI.stdin].includes(t))return"input";if([1,2,cI.stdout,cI.stderr].includes(t))return"output"},qwe="output"});var gW,yW=y(()=>{gW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var _W,Bwe,Hwe,bW,Gwe,Zwe,vW=y(()=>{yo();yW();cs();_W=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Bwe(t,n).map((a,c)=>bW(a,c));return o?Gwe(s,r,i):gW(s,e)},Bwe=(t,e)=>{if(t===void 0)return An.map(n=>e[n]);if(Hwe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${An.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,An.length);return Array.from({length:r},(n,i)=>t[i])},Hwe=t=>An.some(e=>t[e]!==void 0),bW=(t,e)=>Array.isArray(t)?t.map(r=>bW(r,e)):t??(e>=An.length?"ignore":"pipe"),Gwe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!yl(r,i)&&Zwe(n)?"ignore":n),Zwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Vwe}from"node:fs";import Wwe from"node:tty";var wW,Kwe,Jwe,Ywe,Xwe,SW,xW=y(()=>{Pa();yo();rn();us();wW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Kwe({stdioItem:t,fdNumber:n,direction:i}):Xwe({stdioItem:t,fdNumber:n}),Kwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Jwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Jwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Ywe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Wwe.isatty(i))throw new TypeError(`The \`${e}: ${ub(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:go(Vwe(i)),optionName:e}}},Ywe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=B_.indexOf(t);if(r!==-1)return r},Xwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:SW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:SW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,SW=(t,e,r)=>{let n=B_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var $W,Qwe,exe,txe,rxe,kW=y(()=>{Pa();rn();vr();$W=({input:t,inputFile:e},r)=>r===0?[...Qwe(t),...txe(e)]:[],Qwe=t=>t===void 0?[]:[{type:exe(t),value:t,optionName:"input"}],exe=t=>{if(Ia(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ut(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},txe=t=>t===void 0?[]:[{...rxe(t),optionName:"inputFile"}],rxe=t=>{if(Ub(t))return{type:"fileUrl",value:t};if(nI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var EW,AW,nxe,ixe,TW,oxe,sxe,OW,RW=y(()=>{vr();EW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),AW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=nxe(i,t);if(s.length!==0){if(o){ixe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(cW.has(t))return TW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});lW.has(t)&&sxe({otherStdioItems:s,type:t,value:e,optionName:r})}},nxe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),ixe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{oI.has(e)&&TW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},TW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>oxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return OW(s,n,e),i==="output"?o[0].stream:void 0},oxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,sxe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);OW(i,n,e)},OW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${fs[r]} that is the same.`)}});var Hb,axe,cxe,lxe,uxe,dxe,fxe,pxe,mxe,hxe,gxe,yxe,uI,_xe,Gb=y(()=>{yo();fW();aI();vr();hW();vW();xW();kW();RW();Hb=(t,e,r,n)=>{let o=_W(e,r,n).map((a,c)=>axe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=hxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>_xe(a)),s},axe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=H_(e),{stdioItems:o,isStdioArray:s}=cxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=pW(o,e,i),c=o.map(d=>wW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=dW(c,i,a,r),u=uW(l,a);return mxe(l,u),{direction:a,objectMode:u,stdioItems:l}},cxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>lxe(c,n)),...$W(r,e)],s=EW(o),a=s.length>1;return uxe(s,a,n),fxe(s),{stdioItems:s,isStdioArray:a}},lxe=(t,e)=>({type:eW(t,e),value:t,optionName:e}),uxe=(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(dxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},dxe=new Set(["ignore","ipc"]),fxe=t=>{for(let e of t)pxe(e)},pxe=({type:t,value:e,optionName:r})=>{if(iW(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(oW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},mxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Bb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},hxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(gxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw uI(i),o}},gxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>yxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},yxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=AW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},uI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Yn(r)&&r.destroy()},_xe=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 IW}from"node:fs";var CW,Pi,bxe,DW,PW,vxe,NW=y(()=>{rn();Gb();vr();CW=(t,e)=>Hb(vxe,t,e,!0),Pi=({type:t,optionName:e})=>{DW(e,fs[t])},bxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&DW(t,`"${e}"`),{}),DW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},PW={generator(){},asyncGenerator:Pi,webStream:Pi,nodeStream:Pi,webTransform:Pi,duplex:Pi,asyncIterable:Pi,native:bxe},vxe={input:{...PW,fileUrl:({value:t})=>({contents:[go(IW(t))]}),filePath:({value:{file:t}})=>({contents:[go(IW(t))]}),fileNumber:Pi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...PW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Pi,string:Pi,uint8Array:Pi}}});var So,dI,tp=y(()=>{VR();So=(t,{stripFinalNewline:e},r)=>dI(e,r)&&t!==void 0&&!Array.isArray(t)?El(t):t,dI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Zb,pI,jW,MW,Sxe,wxe,xxe,FW,$xe,fI,kxe,Exe,Axe,Vb=y(()=>{Zb=(t,e,r,n)=>t||r?void 0:MW(e,n),pI=(t,e,r)=>r?t.flatMap(n=>jW(n,e)):jW(t,e),jW=(t,e)=>{let{transform:r,final:n}=MW(e,{});return[...r(t),...n()]},MW=(t,e)=>(e.previousChunks="",{transform:Sxe.bind(void 0,e,t),final:xxe.bind(void 0,e)}),Sxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=fI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=fI(n,r.slice(i+1))),t.previousChunks=n},wxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),xxe=function*({previousChunks:t}){t.length>0&&(yield t)},FW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:$xe.bind(void 0,n)},$xe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?kxe:Axe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},fI=(t,e)=>`${t}${e}`,kxe={windowsNewline:`\r `,unixNewline:` `,LF:` `,concatBytes:fI},Exe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Axe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Exe}});import{Buffer as Txe}from"node:buffer";var LW,Oxe,zW,Rxe,Ixe,UW,qW=y(()=>{rn();LW=(t,e)=>t?void 0:Oxe.bind(void 0,e),Oxe=function*(t,e){if(typeof e!="string"&&!Ut(e)&&!Txe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},zW=(t,e)=>t?Rxe.bind(void 0,e):Ixe.bind(void 0,e),Rxe=function*(t,e){UW(t,e),yield e},Ixe=function*(t,e){if(UW(t,e),typeof e!="string"&&!Ut(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},UW=(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 Pxe}from"node:buffer";import{StringDecoder as Cxe}from"node:string_decoder";var Wb,Dxe,Nxe,jxe,mI=y(()=>{rn();Wb=(t,e,r)=>{if(r)return;if(t)return{transform:Dxe.bind(void 0,new TextEncoder)};let n=new Cxe(e);return{transform:Nxe.bind(void 0,n),final:jxe.bind(void 0,n)}},Dxe=function*(t,e){Pxe.isBuffer(e)?yield go(e):typeof e=="string"?yield t.encode(e):yield e},Nxe=function*(t,e){yield Ut(e)?t.write(e):e},jxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as BW}from"node:util";var hI,Kb,HW,Mxe,GW,Fxe,ZW=y(()=>{hI=BW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Kb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Fxe}=e[r];for await(let i of n(t))yield*Kb(i,e,r+1)},HW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Mxe(r,Number(e),t)},Mxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Kb(n,r,e+1)},GW=BW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Fxe=function*(t){yield t}});var gI,VW,ja,rp,Lxe,zxe,yI=y(()=>{gI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},VW=(t,e)=>[...e.flatMap(r=>[...ja(r,t,0)]),...rp(t)],ja=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=zxe}=e[r];for(let i of n(t))yield*ja(i,e,r+1)},rp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Lxe(r,Number(e),t)},Lxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*ja(n,r,e+1)},zxe=function*(t){yield t}});import{Transform as Uxe,getDefaultHighWaterMark as WW}from"node:stream";var _I,Jb,KW,Yb=y(()=>{vr();Vb();qW();mI();ZW();yI();_I=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=KW(t,s,o),l=Na(e),u=Na(r),d=l?hI.bind(void 0,Kb,a):gI.bind(void 0,ja),f=l||u?hI.bind(void 0,HW,a):gI.bind(void 0,rp),p=l||u?GW.bind(void 0,a):void 0;return{stream:new Uxe({writableObjectMode:n,writableHighWaterMark:WW(n),readableObjectMode:i,readableHighWaterMark:WW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Jb=(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=KW(s,r,a);t=VW(c,t)}return t},KW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:LW(n,a)},Wb(r,s,n),Zb(r,o,n,c),{transform:t,final:e},{transform:zW(i,a)},FW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var JW,qxe,Bxe,Hxe,Gxe,YW=y(()=>{Yb();rn();vr();JW=(t,e)=>{for(let r of qxe(t))Bxe(t,r,e)},qxe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Bxe=(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 ${fs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Hxe(a,n));r.input=zf(s)},Hxe=(t,e)=>{let r=Jb(t,e,"utf8",!0);return Gxe(r),zf(r)},Gxe=t=>{let e=t.find(r=>typeof r!="string"&&!Ut(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 Xb,Zxe,Vxe,XW,QW,Wxe,e3,bI=y(()=>{Ia();vr();_l();cs();Xb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&yl(r,n)&&!nn.has(e)&&Zxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Vxe.has(o))||t.every(({type:i})=>An.has(i))),Zxe=t=>t===1||t===2,Vxe=new Set(["pipe","overlapped"]),XW=async(t,e,r,n)=>{for await(let i of t)Wxe(e)||e3(i,r,n)},QW=(t,e,r)=>{for(let n of t)e3(n,e,r)},Wxe=t=>t._readableState.pipes.length>0,e3=(t,e,r)=>{let n=Y_(t);Ti({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Kxe,appendFileSync as Jxe}from"node:fs";var t3,Yxe,Xxe,Qxe,e$e,t$e,r3=y(()=>{bI();Yb();Vb();rn();vr();Da();t3=({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)=>Yxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Yxe=({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=zV(t,o,d),p=go(f),{stdioItems:m,objectMode:h}=e[r],g=Xxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Qxe({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}},Xxe=(t,e,r,n)=>{try{return Jb(t,e,r,!1)}catch(i){return n.error=i,t}},Qxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:zf(t)};let s=RG(t,r);return n[o]?{serializedResult:s,finalResult:pI(s,!i[o],e)}:{serializedResult:s}},e$e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Xb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=pI(t,!1,s);try{QW(a,e,n)}catch(c){r.error??=c}},t$e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Bb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Jxe(n,t):(r.add(o),Kxe(n,t))}}});var n3,i3=y(()=>{rn();tp();n3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,So(e,r,"all")]:Array.isArray(e)?[So(t,r,"all"),...e]:Ut(t)&&Ut(e)?cR([t,e]):`${t}${e}`}});import{once as vI}from"node:events";var o3,r$e,s3,a3,n$e,SI,wI=y(()=>{Oa();o3=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([vI(t,"spawn"),vI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?s3(t):r.value},s3=async t=>{try{return await vI(t,"exit")}catch{return s3(t)}},a3=async t=>{let[e,r]=await t;if(!n$e(e,r)&&SI(e,r))throw new Xn;return[e,r]},n$e=(t,e)=>t===void 0&&e===void 0,SI=(t,e)=>t!==0||e!==null});var c3,i$e,l3=y(()=>{Oa();Da();wI();c3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=i$e(t,e,r),s=o?.code==="ETIMEDOUT",a=LV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},i$e=(t,e,r)=>t!==void 0?t:SI(e,r)?new Xn:void 0});import{spawnSync as o$e}from"node:child_process";var u3,s$e,a$e,c$e,Qb,l$e,u$e,d$e,f$e,d3=y(()=>{yR();GR();ZR();ep();zb();NW();tp();YW();r3();Da();i3();l3();u3=(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 Ol(d,c,l)},s$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=eb(t,e,r),a=a$e(r),{file:c,commandArguments:l,options:u}=Ab(t,e,a);c$e(u);let d=CW(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&&Qb("ipcInput"),t&&Qb("ipc: true"),r&&Qb("detached: true"),n&&Qb("cancelSignal")},Qb=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}=c3(c,r),{output:m,error:h=l}=t3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>So(_,r,S)),b=So(n3(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{JW(o,r);let a=d$e(r);return o$e(...Tb(t,e,a))}catch(a){return Tl({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:Fb(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?Lb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Qf({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 xI,on as p$e}from"node:events";var f3,m$e,h$e,g$e,y$e,p3=y(()=>{xl();Wf();Vf();f3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Sl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:vb(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})=>{pb(e,i);let o=ds(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 wl(t),a}finally{s.abort(),mb(e,i)}},h$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await xI(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 xI(t,"disconnect",{signal:r}),$9(e)},y$e=async(t,e,{signal:r})=>{let[n]=await xI(t,"strict:error",{signal:r});throw lb(n,e)}});import{once as h3,on as _$e}from"node:events";var g3,$I,b$e,v$e,S$e,m3,kI=y(()=>{xl();Wf();Vf();g3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>$I({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),$I=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Sl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:vb(t)}),pb(e,o);let s=ds(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 h3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},v$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await h3(t,"strict:error",{signal:r.signal});n.error=lb(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}))m3(s),yield c}catch{m3(s)}finally{o.abort(),mb(e,a),n||wl(t),i&&await t}},m3=({error:t})=>{if(t)throw t}});import y3 from"node:process";var _3,b3,v3,EI=y(()=>{kb();p3();kI();_b();_3=(t,{ipc:e})=>{Object.assign(t,v3(t,!1,e))},b3=()=>{let t=y3,e=!0,r=y3.channel!==void 0;return{...v3(t,e,r),getCancelSignal:X9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},v3=(t,e,r)=>({sendMessage:$b.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:f3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:g3.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 S3,A$e,np,T$e,O$e,R$e,I$e,w3=y(()=>{Gb();ep();zb();S3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{uI(n);let a=new w$e;A$e(a,n),Object.assign(a,{readable:T$e,writable:O$e,duplex:R$e});let c=Tl({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=np(),n=np(),i=np(),o=Array.from({length:e.length-3},np),s=np(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},np=()=>{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)=>Ol(t,e,r)});import{createReadStream as x3,createWriteStream as $3}from"node:fs";import{Buffer as P$e}from"node:buffer";import{Readable as ip,Writable as C$e,Duplex as D$e}from"node:stream";var E3,op,k3,N$e,A3=y(()=>{Yb();Gb();vr();E3=(t,e)=>Hb(N$e,t,e,!1),op=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${fs[t]}.`)},k3={fileNumber:op,generator:_I,asyncGenerator:_I,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:{...k3,fileUrl:({value:t})=>({stream:x3(t)}),filePath:({value:{file:t}})=>({stream:x3(t)}),webStream:({value:t})=>({stream:ip.fromWeb(t)}),iterable:({value:t})=>({stream:ip.from(t)}),asyncIterable:({value:t})=>({stream:ip.from(t)}),string:({value:t})=>({stream:ip.from(t)}),uint8Array:({value:t})=>({stream:ip.from(P$e.from(t))})},output:{...k3,fileUrl:({value:t})=>({stream:$3(t)}),filePath:({value:{file:t,append:e}})=>({stream:$3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:C$e.fromWeb(t)}),iterable:op,asyncIterable:op,string:op,uint8Array:op}}});import{on as j$e,once as T3}from"node:events";import{PassThrough as M$e,getDefaultHighWaterMark as F$e}from"node:stream";import{finished as I3}from"node:stream/promises";function Ma(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)TI(i);let e=t.some(({readableObjectMode:i})=>i),r=L$e(t,e),n=new AI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var L$e,AI,z$e,U$e,q$e,TI,B$e,H$e,G$e,Z$e,V$e,P3,C3,OI,D3,W$e,ev,O3,R3,tv=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)},AI=class extends M$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(TI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=z$e(this,this.#t,this.#o);let r=B$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(TI(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)=>{ev(t,O3);let n=new AbortController;try{await Promise.race([U$e(t,n),q$e(t,e,r,n)])}finally{n.abort(),ev(t,-O3)}},U$e=async(t,{signal:e})=>{try{await I3(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)},TI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},B$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{ev(t,R3);let a=new AbortController;try{await Promise.race([H$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(),ev(t,-R3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?OI(t):V$e(t))},H$e=async(t,e,{signal:r})=>{try{await t,r.aborted||OI(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 I3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;C3(s)?i.add(e):D3(t,s)}},Z$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await T3(t,i,{signal:o}),!t.readable)return T3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},V$e=t=>{t.writable&&t.end()},P3=(t,e)=>{C3(e)?OI(t):D3(t,e)},C3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",OI=t=>{(t.readable||t.writable)&&t.destroy()},D3=(t,e)=>{t.destroyed||(t.once("error",W$e),t.destroy(e))},W$e=()=>{},ev=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},O3=2,R3=1});import{finished as N3}from"node:stream/promises";var Il,K$e,RI,J$e,II,rv=y(()=>{yo();Il=(t,e)=>{t.pipe(e),K$e(t,e),J$e(t,e)},K$e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await N3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}RI(e)}},RI=t=>{t.writable&&t.end()},J$e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await N3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}II(t)}},II=t=>{t.readable&&t.destroy()}});var j3,Y$e,X$e,Q$e,e0e,t0e,M3=y(()=>{tv();yo();fb();vr();rv();j3=(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})=>An.has(c)))Y$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!An.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]:Ma(o);Il(s,i)}},Y$e=(t,e,r,n)=>{r==="output"?Il(t.stdio[n],e):Il(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;e0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},e0e=(t,{signal:e})=>{Yn(t)&&Ra(t,t0e,e)},t0e=2});var Fa,F3=y(()=>{Fa=[];Fa.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Fa.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Fa.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var nv,PI,CI,r0e,DI,iv,n0e,NI,jI,MI,L3,Tst,Ost,z3=y(()=>{F3();nv=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",PI=Symbol.for("signal-exit emitter"),CI=globalThis,r0e=Object.defineProperty.bind(Object),DI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(CI[PI])return CI[PI];r0e(CI,PI,{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}},iv=class{},n0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),NI=class extends iv{onExit(){return()=>{}}load(){}unload(){}},jI=class extends iv{#t=MI.platform==="win32"?"SIGINT":"SIGHUP";#r=new DI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Fa)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(!nv(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 Fa)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,Fa.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 nv(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"&&nv(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)}},MI=globalThis.process,{onExit:L3,load:Tst,unload:Ost}=n0e(nv(MI)?new jI(MI):new NI)});import{addAbortListener as i0e}from"node:events";var U3,q3=y(()=>{z3();U3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=L3(()=>{t.kill()});i0e(n,()=>{i()})}});var H3,o0e,s0e,B3,a0e,G3=y(()=>{aR();Q_();us();hl();H3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=X_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=o0e(r,n,i),{sourceStream:d,sourceError:f}=a0e(t,l),{options:p,fileDescriptors:m}=Ri.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},o0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=s0e(t,e,...r),a=db(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},s0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(B3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||oR(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]=U_(r,...n);return{destination:e(B3)(i,o,s),pipeOptions:s}}if(Ri.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}`)},B3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),a0e=(t,e)=>{try{return{sourceStream:kl(t,e)}}catch(r){return{sourceError:r}}}});var V3,c0e,FI,Z3,LI=y(()=>{ep();rv();V3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=c0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw FI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},c0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return II(t),n;if(e!==void 0)return RI(r),e},FI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Tl({error:t,command:Z3,escapedCommand:Z3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Z3="source.pipe(destination)"});var W3,K3=y(()=>{W3=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 l0e}from"node:stream/promises";var J3,u0e,d0e,f0e,ov,p0e,m0e,Y3=y(()=>{tv();fb();rv();J3=(t,e,r)=>{let n=ov.has(e)?d0e(t,e):u0e(t,e);return Ra(t,p0e,r.signal),Ra(e,m0e,r.signal),f0e(e),n},u0e=(t,e)=>{let r=Ma([t]);return Il(r,e),ov.set(e,r),r},d0e=(t,e)=>{let r=ov.get(e);return r.add(t),r},f0e=async t=>{try{await l0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}ov.delete(t)},ov=new WeakMap,p0e=2,m0e=1});import{aborted as h0e}from"node:util";var X3,g0e,Q3=y(()=>{LI();X3=(t,e)=>t===void 0?[]:[g0e(t,e)],g0e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await h0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw FI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var sv,y0e,_0e,eK=y(()=>{ho();G3();LI();K3();Y3();Q3();sv=(t,...e)=>{if(Ot(e[0]))return sv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=H3(t,...e),i=y0e({...n,destination:r});return i.pipe=sv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},y0e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=_0e(t,i);V3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=J3(e,o,d);return await Promise.race([W3(u),...X3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},_0e=(t,e)=>Promise.allSettled([t,e])});import{on as b0e}from"node:events";import{getDefaultHighWaterMark as v0e}from"node:stream";var av,S0e,zI,w0e,rK,UI,tK,x0e,$0e,cv=y(()=>{mI();Vb();yI();av=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return S0e(e,s),rK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},S0e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},zI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;w0e(e,s,t);let a=t.readableObjectMode&&!o;return rK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},w0e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},rK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=b0e(t,"data",{signal:e.signal,highWaterMark:tK,highWatermark:tK});return x0e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},UI=v0e(!0),tK=UI,x0e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=$0e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*ja(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*rp(a)}},$0e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Wb(t,r,!e),Zb(t,i,!n,{})].filter(Boolean)});import{setImmediate as k0e}from"node:timers/promises";var nK,E0e,A0e,T0e,qI,iK,BI=y(()=>{Mb();rn();bI();cv();Da();tp();nK=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=E0e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([A0e(t),d]);return}let f=dI(c,r),p=zI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([T0e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},E0e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Xb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=zI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await XW(a,t,r,o)},A0e=async t=>{await k0e(),t.readableFlowing===null&&t.resume()},T0e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Cb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Db(r,{maxBuffer:o})):await jb(r,{maxBuffer:o})}catch(a){return iK(jV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},qI=async t=>{try{return await t}catch(e){return iK(e)}},iK=({bufferedData:t})=>TG(t)?new Uint8Array(t):t});import{finished as O0e}from"node:stream/promises";var sp,R0e,I0e,P0e,C0e,D0e,HI,lv,oK,uv=y(()=>{sp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=R0e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],O0e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||C0e(a,e,r,n)}finally{s.abort()}},R0e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&I0e(t,r,n),n},I0e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{P0e(e,r),n.call(t,...i)}},P0e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},C0e=(t,e,r,n)=>{if(!D0e(t,e,r,n))throw t},D0e=(t,e,r,n=!0)=>r.propagating?oK(t)||lv(t):(r.propagating=!0,HI(r,e)===n?oK(t):lv(t)),HI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",lv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",oK=t=>t?.code==="EPIPE"});var sK,GI,ZI=y(()=>{BI();uv();sK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>GI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),GI=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=sp(t,e,l);if(HI(l,e)){await u;return}let[d]=await Promise.all([nK({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 aK,cK,N0e,j0e,VI=y(()=>{tv();ZI();aK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ma([t,e].filter(Boolean)):void 0,cK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>GI({...N0e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:j0e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),N0e=({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}},j0e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var lK,uK,dK=y(()=>{_l();cs();lK=t=>yl(t,"ipc"),uK=(t,e)=>{let r=Y_(t);Ti({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var fK,pK,mK=y(()=>{Da();dK();bo();kI();fK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=lK(o),a=_o(e,"ipc"),c=_o(r,"ipc");for await(let l of $I({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(MV(t,i,c),i.push(l)),s&&uK(l,o);return i},pK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as M0e}from"node:events";var hK,F0e,L0e,z0e,gK=y(()=>{Ca();zR();IR();LR();yo();vr();BI();mK();qR();VI();ZI();wI();uv();hK=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 _=o3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=sK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=cK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=fK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=F0e(h,t,S),D=L0e(m,S);try{return await Promise.race([Promise.all([{},a3(_),Promise.all(x),w,T,cV(t,d),...A,...D]),g,z0e(t,b),...nV(t,o,f,b),...x9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...tV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(ie=>qI(ie))),qI(w),pK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},F0e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:sp(n,i,r)),L0e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>sp(s,n,e,{isSameDirection:An.has(i),stopOnExit:i==="native"}))),z0e=async(t,{signal:e})=>{let[r]=await M0e(t,"error",{signal:e});throw r}});var yK,ap,Pl,dv=y(()=>{$l();yK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),ap=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Oi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Pl=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 _K}from"node:stream/promises";var WI,bK,KI,JI,fv,pv,YI=y(()=>{uv();WI=async t=>{if(t!==void 0)try{await KI(t)}catch{}},bK=async t=>{if(t!==void 0)try{await JI(t)}catch{}},KI=async t=>{await _K(t,{cleanup:!0,readable:!1,writable:!0})},JI=async t=>{await _K(t,{cleanup:!0,readable:!0,writable:!1})},fv=async(t,e)=>{if(await t,e)throw e},pv=(t,e,r)=>{r&&!lv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as U0e}from"node:stream";import{callbackify as q0e}from"node:util";var vK,XI,QI,eP,B0e,tP,rP,SK,nP=y(()=>{Ia();us();cv();$l();dv();YI();vK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=XI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=QI(a,s),{read:f,onStdoutDataDone:p}=eP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new U0e({read:f,destroy:q0e(rP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return tP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},XI=(t,e,r)=>{let n=kl(t,e),i=ap(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},QI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:UI},eP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Oi(),s=av({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){B0e(this,s,o)},onStdoutDataDone:o}},B0e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},tP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await JI(t),await n,await WI(i),await e,r.readable&&r.push(null)}catch(o){await WI(i),SK(r,o)}},rP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Pl(r,e)&&(SK(t,n),await fv(e,n))},SK=(t,e)=>{pv(t,t.readable,e)}});import{Writable as H0e}from"node:stream";import{callbackify as wK}from"node:util";var xK,iP,oP,G0e,Z0e,sP,aP,$K,cP=y(()=>{us();dv();YI();xK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=iP(t,r,e),s=new H0e({...oP(n,t,i),destroy:wK(aP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return sP(n,s),s},iP=(t,e,r)=>{let n=db(t,e),i=ap(r,n,"writableFinal"),o=ap(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},oP=(t,e,r)=>({write:G0e.bind(void 0,t),final:wK(Z0e.bind(void 0,t,e,r))}),G0e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Z0e=async(t,e,r)=>{await Pl(r,e)&&(t.writable&&t.end(),await e)},sP=async(t,e,r)=>{try{await KI(t),e.writable&&e.end()}catch(n){await bK(r),$K(e,n)}},aP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Pl(r,e),await Pl(n,e)&&($K(t,i),await fv(e,i))},$K=(t,e)=>{pv(t,t.writable,e)}});import{Duplex as V0e}from"node:stream";import{callbackify as W0e}from"node:util";var kK,K0e,EK=y(()=>{Ia();nP();cP();kK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=XI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=iP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=QI(c,a),{read:g,onStdoutDataDone:b}=eP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new V0e({read:g,...oP(u,t,d),destroy:W0e(K0e.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 tP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),sP(u,_,c),_},K0e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([rP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),aP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var lP,J0e,AK=y(()=>{Ia();us();cv();lP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=kl(t,r),a=av({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return J0e(a,s,t)},J0e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var TK,OK=y(()=>{dv();nP();cP();EK();AK();TK=(t,{encoding:e})=>{let r=yK();t.readable=vK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=xK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=kK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=lP.bind(void 0,t,e),t[Symbol.asyncIterator]=lP.bind(void 0,t,e,{})}});var RK,Y0e,X0e,IK=y(()=>{RK=(t,e)=>{for(let[r,n]of X0e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Y0e=(async()=>{})().constructor.prototype,X0e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Y0e,t)])});import{setMaxListeners as Q0e}from"node:events";import{spawn as eke}from"node:child_process";var PK,tke,rke,nke,ike,oke,CK=y(()=>{Mb();yR();GR();us();ZR();EI();ep();zb();w3();A3();tp();M3();ab();q3();eK();VI();gK();OK();$l();IK();PK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=tke(t,e,r),{subprocess:f,promise:p}=nke({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}),RK(f,p),Ri.set(f,{options:u,fileDescriptors:d}),f},tke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=eb(t,e,r),{file:a,commandArguments:c,options:l}=Ab(t,e,r),u=rke(l),d=E3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},rke=({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}},nke=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=eke(...Tb(t,e,r))}catch(m){return S3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Q0e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];j3(c,a,l),U3(c,r,l);let d={},f=Oi();c.kill=S9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=aK(c,r),TK(c,r),_3(c,r);let p=ike({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}},ike=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 hK({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)=>So(x,e,w)),_=So(h,e,"all"),S=oke({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ol(S,n,e)},oke=({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?Qf({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 Ii,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Lb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var mv,ske,ake,DK=y(()=>{ho();bo();mv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,ske(n,t[n],i)]));return{...t,...r}},ske=(t,e,r)=>ake.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,ake=new Set(["env",...fR])});var ps,cke,lke,NK=y(()=>{ho();aR();jG();d3();CK();DK();ps=(t,e,r,n)=>{let i=(s,a,c)=>ps(s,a,r,c),o=(...s)=>cke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},cke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,mv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=lke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?u3(a,c,l):PK(a,c,l,i)},lke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=DG(e)?NG(e,r):[e,...r],[s,a,c]=U_(...o),l=mv(mv(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 jK,MK,FK,uke,dke,LK=y(()=>{jK=({file:t,commandArguments:e})=>FK(t,e),MK=({file:t,commandArguments:e})=>({...FK(t,e),isSync:!0}),FK=(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]=uke(t);return{file:r,commandArguments:n}},uke=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(dke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},dke=/ +/g});var zK,UK,fke,qK,pke,BK,HK=y(()=>{zK=(t,e,r)=>{t.sync=e(fke,r),t.s=t.sync},UK=({options:t})=>qK(t),fke=({options:t})=>({...qK(t),isSync:!0}),qK=t=>({options:{...pke(t),...t}}),pke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},BK={preferLocal:!0}});var _lt,Ye,blt,vlt,Slt,wlt,xlt,$lt,klt,Elt,Mr=y(()=>{NK();LK();UR();HK();EI();_lt=ps(()=>({})),Ye=ps(()=>({isSync:!0})),blt=ps(jK),vlt=ps(MK),Slt=ps(oV),wlt=ps(UK,{},BK,zK),{sendMessage:xlt,getOneMessage:$lt,getEachMessage:klt,getCancelSignal:Elt}=b3()});import{existsSync as hv,statSync as mke}from"node:fs";import{dirname as uP,extname as hke,isAbsolute as GK,join as dP,relative as fP,resolve as gv,sep as gke}from"node:path";function yv(t){return t==="./gradlew"||t==="gradle"}function yke(t){return(hv(dP(t,"build.gradle.kts"))||hv(dP(t,"build.gradle")))&&hv(dP(t,"gradle.properties"))}function _ke(t,e){let n=fP(t,e).split(gke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ms(t,e){return t===":"?`:${e}`:`${t}:${e}`}function bke(t,e){let r=gv(t,e),n=r;hv(r)?mke(r).isFile()&&(n=uP(r)):hke(r)!==""&&(n=uP(r));let i=fP(t,n);if(i.startsWith("..")||GK(i))return null;let o=n;for(;;){if(yke(o))return o;if(gv(o)===gv(t))return null;let s=uP(o);if(s===o)return null;let a=fP(t,s);if(a.startsWith("..")||GK(a))return null;o=s}}function _v(t,e){let r=gv(t),n=new Map,i=[];for(let o of e){let s=bke(r,o);if(!s){i.push(o);continue}let a=_ke(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 bv=y(()=>{"use strict"});import{existsSync as mP,readFileSync as vke}from"node:fs";import{join as Cl}from"node:path";function Dl(t="."){let e=Cl(t,".cladding","config.yaml");if(!mP(e))return pP;try{let n=(0,ZK.parse)(vke(e,"utf8"))?.gate;if(!n)return pP;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 Ske){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 pP}}function VK(t="."){let e=Dl(t).testReport,r=e?[e,...hP]:hP;return[...new Set(r.map(n=>Cl(t,n)))]}function WK(t="."){let e=Dl(t).testReport;if(e){let r=Cl(t,e);return mP(r)?r:null}return hP.map(r=>Cl(t,r)).find(r=>mP(r))??null}function KK(t,e){let r=[],n=!1;for(let i of t){let o=wke.exec(i);if(o){n=!0;for(let s of e)r.push(ms(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 ZK,Ske,pP,hP,wke,cp=y(()=>{"use strict";ZK=St(Qt(),1);bv();Ske=["type","lint","test","coverage"],pP={scope:"feature"},hP=["test-report.junit.xml",Cl("coverage","junit.xml"),Cl(".cladding","test-report.junit.xml")];wke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as yP,readFileSync as JK,readdirSync as xke,statSync as $ke}from"node:fs";import{join as vv}from"node:path";function vP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=vv(t,e);if(yP(r))try{if(YK.test(JK(r,"utf8")))return!0}catch{}}return!1}function XK(t){try{return yP(t)&&YK.test(JK(t,"utf8"))}catch{return!1}}function QK(t,e=0){if(e>4||!yP(t))return!1;let r;try{r=xke(t)}catch{return!1}for(let n of r){let i=vv(t,n),o=!1;try{o=$ke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(QK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&XK(i))return!0}return!1}function Ake(t){if(vP(t))return!0;for(let e of kke)if(XK(vv(t,e)))return!0;for(let e of Eke)if(QK(vv(t,e)))return!0;return!1}function eJ(t="."){let e=Dl(t).coverage;return e||(Ake(t)?"kover":"jacoco")}function tJ(t="."){return _P[eJ(t)]}function rJ(t="."){return gP[eJ(t)]}var _P,gP,bP,YK,kke,Eke,Sv=y(()=>{"use strict";cp();_P={kover:"koverXmlReport",jacoco:"jacocoTestReport"},gP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},bP=[gP.kover,gP.jacoco],YK=/kover/i;kke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Eke=["buildSrc","build-logic"]});import{existsSync as up,readFileSync as iJ,readdirSync as oJ}from"node:fs";import{join as hs}from"node:path";function wP(t){return up(hs(t,"gradlew"))?"./gradlew":"gradle"}function Tke(t){let e=wP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[tJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Oke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(iJ(hs(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 Ike(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function Dke(t,e){for(let r of e)if(up(hs(t,r)))return r}function Nke(t,e){try{return oJ(t).find(n=>n.endsWith(e))}catch{return}}function Fke(t){try{return JSON.parse(iJ(hs(t,"package.json"),"utf8"))}catch{return{}}}function lp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function nJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function Lke(t,e,r){if(lp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of jke)if(n.configs.some(i=>up(hs(t,i))))return n.gate;if(Mke.some(n=>up(hs(t,n)))||r.eslintConfig!==void 0)return e}function Uke(t,e){return zke.some(r=>up(hs(t,r)))?!0:e.jest!==void 0}function qke(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 SP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function Bke(t,e){let r=Fke(t),n=e.lint?Lke(t,e.lint,r):void 0,i=n?{...e,lint:n}:SP(e,"lint"),o=lp(r,"test"),s=o?qke(o):void 0;return o&&!s?(i=SP(i,"coverage"),{...i,test:{cmd:"npm",args:["test"]},...lp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):s==="jest"||!o&&Uke(t,r)?{...i,test:{cmd:"npx",args:[...Ci,"jest"]},coverage:{cmd:"npx",args:[...Ci,"jest","--coverage"]}}:(s==="vitest"&&!lp(r,"coverage")&&!nJ(r,"@vitest/coverage-v8")&&!nJ(r,"@vitest/coverage-istanbul")?i=SP(i,"coverage"):s==="vitest"&&lp(r,"coverage")&&(i={...i,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),i)}function dt(t="."){for(let e of Pke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Nke(t,o):r=Dke(t,[o]),r)break;if(!r||e.requiresSource&&!Ike(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Bke(t,n):n;return{language:e.language,manifest:r,gates:i}}return Cke}var Ci,Rke,Pke,Cke,jke,Mke,zke,on=y(()=>{"use strict";Sv();Ci=["--offline","--no-install"];Rke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);Pke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Ci,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Ci,"eslint","."]},test:{cmd:"npx",args:[...Ci,"vitest","run"]},coverage:{cmd:"npx",args:[...Ci,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Ci,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Ci,"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:Tke},{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:Oke}],Cke={language:"unknown",manifest:"",gates:{}};jke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Ci,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Ci,"oxlint"]}}],Mke=["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"];zke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Hke,readFileSync as Gke}from"node:fs";import{join as Zke}from"node:path";function La(t){return t.code==="ENOENT"}function wv(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=(o||s||`exit ${i}`).slice(0,200);return sJ.test(o)||sJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function qt(t,e,r,n=[]){if(La(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 tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Nl(t,e){let r=Zke(t,"package.json");if(!Hke(r))return!1;try{return!!JSON.parse(Gke(r,"utf8")).scripts?.[e]}catch{return!1}}var sJ,Tn=y(()=>{"use strict";sJ=/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 Vke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:xv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Ye(n.cmd,[...n.args],{cwd:e,reject:!1});return La(i)?[{detector:xv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:wv(i,xv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var xv,za,$v=y(()=>{"use strict";Mr();on();Tn();xv="ARCHITECTURE_VIOLATION";za={name:xv,subprocess:!0,run:Vke}});function Wke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:kv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Ye(n.cmd,[...n.args],{cwd:e,reject:!1});return La(i)?[{detector:kv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:wv(i,kv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var kv,Ua,Ev=y(()=>{"use strict";Mr();on();Tn();kv="HARDCODED_SECRET";Ua={name:kv,subprocess:!0,run:Wke}});import{existsSync as xP,readdirSync as aJ}from"node:fs";import{join as Av}from"node:path";function Jke(t,e){let r=Av(t,e.path);if(!xP(r))return!0;if(e.isDirectory)try{return aJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Yke(t){let{cwd:e="."}=t,r=[];for(let i of Kke)Jke(e,i)&&r.push({detector:dp,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=Av(e,"spec.yaml");if(xP(n)){let i=eEe(n),o=i?null:Xke(e);if(i)r.push({detector:dp,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:dp,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=Qke(e);s&&r.push({detector:dp,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 Xke(t){for(let e of["spec/features","spec/scenarios"]){let r=Av(t,e);if(!xP(r))continue;let n;try{n=aJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ki(Av(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function Qke(t){try{return H(t),null}catch(e){return e.message}}function eEe(t){let e;try{e=ki(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var dp,Kke,cJ,lJ=y(()=>{"use strict";qe();I_();dp="ABSENCE_OF_GOVERNANCE",Kke=[{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}];cJ={name:dp,run:Yke}});function Tv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function $P(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=Tv(r)==="while",o=rEe.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 '${Tv(r)}'`}let n=tEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Tv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Tv(r)}'`:null}function nEe(t,e){let r=$P(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(...nEe(r,n));return e}var tEe,rEe,kP=y(()=>{"use strict";tEe={event:"when",state:"while",optional:"where",unwanted:"if"},rEe=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";qe()});function iEe(t){let{cwd:e="."}=t;return he(e,Ov,oEe)}function oEe(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:Ov,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:Ov,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Ov,dJ,fJ=y(()=>{"use strict";kP();wt();Ov="AC_DRIFT";dJ={name:Ov,run:iEe}});function Di(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return mJ[n]??pJ}var sEe,aEe,cEe,pJ,lEe,uEe,mJ,dEe,hJ,qa=y(()=>{"use strict";on();sEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,aEe=/^[ \t]*import\s+([\w.]+)/gm,cEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,pJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:sEe,importStyle:"relative"},lEe={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:aEe,importStyle:"dotted"},uEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:cEe,importStyle:"dotted"},mJ={typescript:pJ,kotlin:lEe,python:uEe},dEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],hJ=new Set([...Object.values(mJ).flatMap(t=>t?.extensions??[]),...dEe].map(t=>t.toLowerCase()))});import{existsSync as fEe,readFileSync as pEe,readdirSync as mEe,statSync as hEe}from"node:fs";import{join as yJ,relative as gJ}from"node:path";function gEe(t,e){if(!fEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=mEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=yJ(i,s),c;try{c=hEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function yEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function bEe(t){return _Ee.test(t)}function vEe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Di(e,r.project?.language),o=i.sourceRoots.flatMap(a=>gEe(yJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=pEe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";qe();qa();_J="AI_HINTS_FORBIDDEN_PATTERN";_Ee=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;bJ={name:_J,run:vEe}});function SEe(t){let{cwd:e="."}=t,r;try{r=H(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:SJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var SJ,wJ,xJ=y(()=>{"use strict";qe();SJ="AC_DUPLICATE_WITHIN_FEATURE";wJ={name:SJ,run:SEe}});import{createRequire as wEe}from"module";import{basename as xEe,dirname as AP,normalize as $Ee,relative as kEe,resolve as EEe,sep as EJ}from"path";import*as AEe from"fs";function TEe(t){let e=$Ee(t);return e.length>1&&e[e.length-1]===EJ&&(e=e.substring(0,e.length-1)),e}function AJ(t,e){return t.replace(OEe,e)}function IEe(t){return t==="/"||REe.test(t)}function EP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=EEe(t)),(n||o)&&(t=TEe(t)),t===".")return"";let s=t[t.length-1]!==i;return AJ(s?t+i:t,i)}function TJ(t,e){return e+t}function PEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:AJ(kEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function CEe(t){return t}function DEe(t,e,r){return e+t+r}function NEe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?PEe(t,e):n?TJ:CEe}function jEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function MEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function UEe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?MEe(t):jEe(t):n&&n.length?LEe:FEe:zEe}function VEe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?ZEe:r&&r.length?n?qEe:BEe:n?HEe:GEe}function JEe(t){return t.group?KEe:WEe}function QEe(t){return t.group?YEe:XEe}function rAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?tAe:eAe}function OJ(t,e,r){if(r.options.useRealPaths)return nAe(e,r);let n=AP(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=AP(n)}return r.symlinks.set(t,e),i>1}function nAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Rv(t,e,r,n){e(t&&!n?t:null,r)}function fAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?iAe:cAe:n?e?oAe:dAe:i?e?aAe:uAe:e?sAe:lAe}function hAe(t){return t?mAe:pAe}function bAe(t,e){return new Promise((r,n)=>{PJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function PJ(t,e,r){new IJ(t,e,r).start()}function vAe(t,e){return new IJ(t,e).start()}var $J,OEe,REe,FEe,LEe,zEe,qEe,BEe,HEe,GEe,ZEe,WEe,KEe,YEe,XEe,eAe,tAe,iAe,oAe,sAe,aAe,cAe,lAe,uAe,dAe,RJ,pAe,mAe,gAe,yAe,_Ae,IJ,kJ,CJ,DJ,NJ=y(()=>{$J=wEe(import.meta.url);OEe=/[\\/]/g;REe=/^[a-z]:[\\/]$/i;FEe=(t,e)=>{e.push(t||".")},LEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},zEe=()=>{};qEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},BEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},HEe=(t,e,r,n)=>{r.files++},GEe=(t,e)=>{e.push(t)},ZEe=()=>{};WEe=t=>t,KEe=()=>[""].slice(0,0);YEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},XEe=()=>{};eAe=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()&&OJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},tAe=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()&&OJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};iAe=t=>t.counts,oAe=t=>t.groups,sAe=t=>t.paths,aAe=t=>t.paths.slice(0,t.options.maxFiles),cAe=(t,e,r)=>(Rv(e,r,t.counts,t.options.suppressErrors),null),lAe=(t,e,r)=>(Rv(e,r,t.paths,t.options.suppressErrors),null),uAe=(t,e,r)=>(Rv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),dAe=(t,e,r)=>(Rv(e,r,t.groups,t.options.suppressErrors),null);RJ={withFileTypes:!0},pAe=(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||".",RJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},mAe=(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||".",RJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};gAe=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))}},yAe=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}},_Ae=class{aborted=!1;abort(){this.aborted=!0}},IJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=fAe(e,this.isSynchronous),this.root=EP(t,e),this.state={root:IEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new yAe,options:e,queue:new gAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new _Ae,fs:e.fs||AEe},this.joinPath=NEe(this.root,e),this.pushDirectory=UEe(this.root,e),this.pushFile=VEe(e),this.getArray=JEe(e),this.groupFiles=QEe(e),this.resolveSymlink=rAe(e,this.isSynchronous),this.walkDirectory=hAe(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(_=EP(_,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=xEe(_),x=EP(AP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};kJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return bAe(this.root,this.options)}withCallback(t){PJ(this.root,this.options,t)}sync(){return vAe(this.root,this.options)}},CJ=null;try{$J.resolve("picomatch"),CJ=$J("picomatch")}catch{}DJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:EJ,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 kJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new kJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||CJ;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 fp=v((Out,zJ)=>{"use strict";var jJ="[^\\\\/]",SAe="(?=.)",MJ="[^/]",TP="(?:\\/|$)",FJ="(?:^|\\/)",OP=`\\.{1,2}${TP}`,wAe="(?!\\.)",xAe=`(?!${FJ}${OP})`,$Ae=`(?!\\.{0,1}${TP})`,kAe=`(?!${OP})`,EAe="[^.\\/]",AAe=`${MJ}*?`,TAe="/",LJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:SAe,QMARK:MJ,END_ANCHOR:TP,DOTS_SLASH:OP,NO_DOT:wAe,NO_DOTS:xAe,NO_DOT_SLASH:$Ae,NO_DOTS_SLASH:kAe,QMARK_NO_DOT:EAe,STAR:AAe,START_ANCHOR:FJ,SEP:TAe},OAe={...LJ,SLASH_LITERAL:"[\\\\/]",QMARK:jJ,STAR:`${jJ}*?`,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:"\\"},RAe={__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"};zJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:RAe,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?OAe:LJ}}});var pp=v(Fr=>{"use strict";var{REGEX_BACKSLASH:IAe,REGEX_REMOVE_BACKSLASH:PAe,REGEX_SPECIAL_CHARS:CAe,REGEX_SPECIAL_CHARS_GLOBAL:DAe}=fp();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>CAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(DAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(IAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(PAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var WJ=v((Iut,VJ)=>{"use strict";var UJ=pp(),{CHAR_ASTERISK:RP,CHAR_AT:NAe,CHAR_BACKWARD_SLASH:mp,CHAR_COMMA:jAe,CHAR_DOT:IP,CHAR_EXCLAMATION_MARK:PP,CHAR_FORWARD_SLASH:ZJ,CHAR_LEFT_CURLY_BRACE:CP,CHAR_LEFT_PARENTHESES:DP,CHAR_LEFT_SQUARE_BRACKET:MAe,CHAR_PLUS:FAe,CHAR_QUESTION_MARK:qJ,CHAR_RIGHT_CURLY_BRACE:LAe,CHAR_RIGHT_PARENTHESES:BJ,CHAR_RIGHT_SQUARE_BRACKET:zAe}=fp(),HJ=t=>t===ZJ||t===mp,GJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},UAe=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,ie=()=>c.charCodeAt(l+1),J=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),Oe&&m===!0&&d>0?(Oe=c.slice(0,d),P=c.slice(d)):m===!0?(Oe="",P=c):Oe=c,Oe&&Oe!==""&&Oe!=="/"&&Oe!==c&&HJ(Oe.charCodeAt(Oe.length-1))&&(Oe=Oe.slice(0,-1)),r.unescape===!0&&(P&&(P=UJ.removeBackslashes(P)),Oe&&_===!0&&(Oe=UJ.removeBackslashes(Oe)));let Ir={prefix:C,input:t,start:u,base:Oe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,HJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var hp=fp(),sn=pp(),{MAX_LENGTH:Iv,POSIX_REGEX_SOURCE:qAe,REGEX_NON_SPECIAL_CHARS:BAe,REGEX_SPECIAL_CHARS_BACKREF:HAe,REPLACEMENTS:KJ}=hp,GAe=(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=>sn.escapeRegex(i)).join("..")}return r},jl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,JJ=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},ZAe=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},YJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(ZAe(e))return e.replace(/\\(.)/g,"$1")},VAe=t=>{let e=t.map(YJ).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}}}}},WAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=YJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},KAe=t=>{let e=0,r=t.trim(),n=NP(r);for(;n;)e++,r=n.body.trim(),n=NP(r);return e},JAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:hp.DEFAULT_MAX_EXTGLOB_RECURSION,n=JJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||VAe(n)))return{risky:!0};for(let i of n){let o=WAe(i);if(o)return{risky:!0,safeOutput:o};if(KAe(i)>r)return{risky:!0}}return{risky:!1}},jP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=KJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Iv,r.maxLength):Iv,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=hp.globChars(r.windows),l=hp.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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={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=sn.removePrefix(t,$),i=t.length;let ie=[],J=[],Oe=[],C=o,P,Ir=()=>$.index===i-1,se=$.peek=(B=1)=>t[$.index+B],Pe=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(B="",ht=0)=>{$.consumed+=B,$.index+=ht},Yt=B=>{$.output+=B.output!=null?B.output:B.value,dr(B.value)},ao=()=>{let B=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),$.start++,B++;return B%2===0?!1:($.negated=!0,$.start++,!0)},vi=B=>{$[B]++,Oe.push(B)},Yr=B=>{$[B]--,Oe.pop()},de=B=>{if(C.type==="globstar"){let ht=$.braces>0&&(B.type==="comma"||B.type==="brace"),q=B.extglob===!0||ie.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ht&&!q&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(ie.length&&B.type!=="paren"&&(ie[ie.length-1].inner+=B.value),(B.value||B.output)&&Yt(B),C&&C.type==="text"&&B.type==="text"){C.output=(C.output||C.value)+B.value,C.value+=B.value;return}B.prev=C,s.push(B),C=B},co=(B,ht)=>{let q={...l[ht],conditions:1,inner:""};q.prev=C,q.parens=$.parens,q.output=$.output,q.startIndex=$.index,q.tokensIndex=s.length;let Ae=(r.capture?"(":"")+q.open;vi("parens"),de({type:B,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Ae}),ie.push(q)},Tde=B=>{let ht=t.slice(B.startIndex,$.index+1),q=t.slice(B.startIndex+2,$.index),Ae=JAe(q,r);if((B.type==="plus"||B.type==="star")&&Ae.risky){let lt=Ae.safeOutput?(B.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,Si=s[B.tokensIndex];Si.type="text",Si.value=ht,Si.output=lt||sn.escapeRegex(ht);for(let wi=B.tokensIndex+1;wi1&&B.inner.includes("/")&&(lt=O(r)),(lt!==D||Ir()||/^\)+$/.test(Kt()))&&(ut=B.close=`)$))${lt}`),B.inner.includes("*")&&(Lt=Kt())&&/^\.[^\\/.]+$/.test(Lt)){let Si=jP(Lt,{...e,fastpaths:!1}).output;ut=B.close=`)${Si})${lt})`}B.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ht=t.replace(HAe,(q,Ae,ut,Lt,lt,Si)=>Lt==="\\"?(B=!0,q):Lt==="?"?Ae?Ae+Lt+(lt?_.repeat(lt.length):""):Si===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):Lt==="."?u.repeat(ut.length):Lt==="*"?Ae?Ae+Lt+(lt?D:""):D:Ae?q:`\\${q}`);return B===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=sn.wrapOutput(ht,$,e),$)}for(;!Ir();){if(P=Pe(),P==="\0")continue;if(P==="\\"){let q=se();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){P+="\\",de({type:"text",value:P});continue}let Ae=/^\\+/.exec(Kt()),ut=0;if(Ae&&Ae[0].length>2&&(ut=Ae[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Pe():P+=Pe(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let q=C.value.slice(1);if(q.includes("[")&&(C.posix=!0,q.includes(":"))){let Ae=C.value.lastIndexOf("["),ut=C.value.slice(0,Ae),Lt=C.value.slice(Ae+2),lt=qAe[Lt];if(lt){C.value=ut+lt,$.backtrack=!0,Pe(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Yt({value:P});continue}if($.quotes===1&&P!=='"'){P=sn.escapeRegex(P),C.value+=P,Yt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){vi("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(jl("opening","("));let q=ie[ie.length-1];if(q&&$.parens===q.parens+1){Tde(ie.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Yr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(jl("closing","]"));P=`\\${P}`}else vi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(jl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Yr("brackets");let q=C.value.slice(1);if(C.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(P=`/${P}`),C.value+=P,Yt({value:P}),r.literalBrackets===!1||sn.hasRegexChars(q))continue;let Ae=sn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Ae,C.value=Ae;continue}C.value=`(${a}${Ae}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){vi("braces");let q={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};J.push(q),de(q);continue}if(P==="}"){let q=J[J.length-1];if(r.nobrace===!0||!q){de({type:"text",value:P,output:P});continue}let Ae=")";if(q.dots===!0){let ut=s.slice(),Lt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&Lt.unshift(ut[lt].value);Ae=GAe(Lt,r),$.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let ut=$.output.slice(0,q.outputIndex),Lt=$.tokens.slice(q.tokensIndex);q.value=q.output="\\{",P=Ae="\\}",$.output=ut;for(let lt of Lt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Ae}),Yr("braces"),J.pop();continue}if(P==="|"){ie.length>0&&ie[ie.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let q=P,Ae=J[J.length-1];Ae&&Oe[Oe.length-1]==="braces"&&(Ae.comma=!0,q="|"),de({type:"comma",value:P,output:q});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let q=J[J.length-1];C.type="dots",C.output+=P,C.value+=P,q.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){co("qmark",P);continue}if(C&&C.type==="paren"){let Ae=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){co("negate",P);continue}if(r.nonegate!==!0&&$.index===0){ao();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){co("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let q=BAe.exec(Kt());q&&(P+=q[0],$.index+=q[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let B=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){co("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let q=C.prev,Ae=q.prev,ut=q.type==="slash"||q.type==="bos",Lt=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!ut||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(q.type==="comma"||q.type==="brace"),Si=ie.length&&(q.type==="pipe"||q.type==="paren");if(!ut&&q.type!=="paren"&&!lt&&!Si){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let wi=t[$.index+4];if(wi&&wi!=="/")break;B=B.slice(3),dr("/**",3)}if(q.type==="bos"&&Ir()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!Lt&&Ir()){$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=q.output+C.output,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&B[0]==="/"){let wi=B[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${wi})`,C.value+=P,$.output+=q.output+C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&B[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(jl("closing","]"));$.output=sn.escapeLast($.output,"["),Yr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(jl("closing",")"));$.output=sn.escapeLast($.output,"("),Yr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(jl("closing","}"));$.output=sn.escapeLast($.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let B of $.tokens)$.output+=B.output!=null?B.output:B.value,B.suffix&&($.output+=B.suffix)}return $};jP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Iv,r.maxLength):Iv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=KJ[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}=hp.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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};XJ.exports=jP});var r8=v((Cut,t8)=>{"use strict";var YAe=WJ(),MP=QJ(),e8=pp(),XAe=fp(),QAe=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=QAe(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?e8.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)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(e8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):MP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>YAe(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=MP.fastpaths(t,e)),i.output||(i=MP(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=XAe;t8.exports=Rt});var s8=v((Dut,o8)=>{"use strict";var n8=r8(),eTe=pp();function i8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:eTe.isWindows()}),n8(t,e,r)}Object.assign(i8,n8);o8.exports=i8});import{readdir as tTe,readdirSync as rTe,realpath as nTe,realpathSync as iTe,stat as oTe,statSync as sTe}from"fs";import{isAbsolute as aTe,posix as Ba,resolve as cTe}from"path";import{fileURLToPath as lTe}from"url";function fTe(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]===".."&&dTe.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=>Ba.relative(t,n)||".":n=>Ba.relative(t,`${e}/${n}`)||"."}function hTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ba.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function u8(t){var e;let r=Ml.default.scan(t,gTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function wTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Ml.default.scan(t);return r.isGlob||r.negated}function gp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function d8(t){return typeof t=="string"?[t]:t??[]}function FP(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=STe(o);s=aTe(s.replace($Te,""))?Ba.relative(a,s):Ba.normalize(s);let c=(i=xTe.exec(s))===null||i===void 0?void 0:i[0],l=u8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?Ba.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(FP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(FP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(FP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function ETe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=kTe(t,e,n);t.debug&&gp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(c8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Ml.default)(i.match,f),m=(0,Ml.default)(i.ignore,f),h=fTe(i.match,f),g=a8(r,d,o),b=o?g:a8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new DJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&gp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return gp(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&gp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&hTe(r,d)]}function ATe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function OTe(t){let e={...TTe,...t};return e.cwd=(e.cwd instanceof URL?lTe(e.cwd):cTe(e.cwd)).replace(c8,"/"),e.ignore=d8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||tTe,readdirSync:e.fs.readdirSync||rTe,realpath:e.fs.realpath||nTe,realpathSync:e.fs.realpathSync||iTe,stat:e.fs.stat||oTe,statSync:e.fs.statSync||sTe}),e.debug&&gp("globbing with options:",e),e}function RTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=uTe(t)||typeof t=="string",i=d8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=OTe(n?e:t);return i.length>0?ETe(o,i):[]}function gs(t,e){let[r,n]=RTe(t,e);return r?ATe(r.sync(),n):[]}var Ml,uTe,c8,l8,dTe,pTe,mTe,gTe,yTe,_Te,bTe,vTe,STe,xTe,$Te,TTe,yp=y(()=>{NJ();Ml=St(s8(),1),uTe=Array.isArray,c8=/\\/g,l8=process.platform==="win32",dTe=/^(\/?\.\.)+$/;pTe=/^[A-Z]:\/$/i,mTe=l8?t=>pTe.test(t):t=>t==="/";gTe={parts:!0};yTe=/(?t.replace(yTe,"\\$&"),vTe=t=>t.replace(_Te,"\\$&"),STe=l8?vTe:bTe;xTe=/^(\/?\.\.)+/,$Te=/\\(?=[()[\]{}!*+?@|])/g;TTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as _p,readFileSync as ITe,readdirSync as PTe,statSync as f8}from"node:fs";import{join as Ha}from"node:path";function CTe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Di(e,n),o=[],{layers:s,forbiddenImports:a}=LP(r);return(s.size>0||a.length>0)&&!_p(Ha(e,i.mainRoot))?[{detector:bp,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&&(DTe(e,i,s,o),NTe(e,i,s,o)),a.length>0&&jTe(e,i,a,o),o)}function LP(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 DTe(t,e,r,n){let i=e.mainRoot,o=Ha(t,i);if(_p(o))for(let s of PTe(o)){let a=Ha(o,s);f8(a).isDirectory()&&(r.has(s)||n.push({detector:bp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function NTe(t,e,r,n){let i=e.mainRoot,o=Ha(t,i);if(_p(o))for(let s of r){let a=Ha(o,s);_p(a)&&f8(a).isDirectory()||n.push({detector:bp,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 jTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ha(t,i,s.from);if(!_p(a))continue;let c=gs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ha(a,l),d;try{d=ITe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];MTe(p,s.to,e.importStyle)&&n.push({detector:bp,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 MTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var bp,p8,zP=y(()=>{"use strict";yp();qe();qa();bp="ARCHITECTURE_FROM_SPEC";p8={name:bp,run:CTe}});import{existsSync as FTe,readFileSync as LTe}from"node:fs";import{join as zTe}from"node:path";function qTe(t){let{cwd:e="."}=t,r=zTe(e,"spec/capabilities.yaml");if(!FTe(r))return[];let n;try{let u=LTe(r,"utf8"),d=m8.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=H(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";m8=St(Qt(),1);qe();Pv="CAPABILITIES_FEATURE_MAPPING",UTe=8;h8={name:Pv,run:qTe}});import{existsSync as BTe,readFileSync as HTe}from"node:fs";import{join as GTe}from"node:path";function ZTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function VTe(t){let{cwd:e="."}=t;return he(e,UP,r=>WTe(r,e))}function WTe(t,e){let r=Di(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=GTe(e,o);if(!BTe(s))continue;let a=HTe(s,"utf8");ZTe(a)||n.push({detector:UP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var UP,y8,_8=y(()=>{"use strict";qa();wt();UP="CONVENTION_DRIFT";y8={name:UP,run:VTe}});import{existsSync as qP,readFileSync as b8}from"node:fs";import{join as Cv}from"node:path";function KTe(t){return JSON.parse(t).total?.lines?.pct??0}function v8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function XTe(t,e){if(!yv(dt(t).gates.coverage?.cmd))return null;let r;try{r=_v(t,e)}catch(c){return[{detector:wo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=bP.find(d=>qP(Cv(c.dir,d)));if(!l){s.push(c.path);continue}let u=v8(b8(Cv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:wo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=S8(n,i);return a0?[{detector:wo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function QTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=XTe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Di(e,r),i=dt(e).language==="kotlin"?bP.find(a=>qP(Cv(e,a)))??rJ(e):n.coverageSummary,o=Cv(e,i);if(!qP(o))return[{detector:wo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=b8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?JTe(a):n.coverageFormat==="cobertura-xml"?YTe(a):KTe(a)}catch(a){return[{detector:wo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:wo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Dv?[]:[{detector:wo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Dv}%`}]}var wo,Dv,w8,x8=y(()=>{"use strict";qe();Sv();qa();bv();on();wo="COVERAGE_DROP",Dv=70;w8={name:wo,run:QTe}});import{existsSync as eOe}from"node:fs";import{join as tOe}from"node:path";function nOe(t){let{cwd:e="."}=t;return he(e,Nv,r=>iOe(r,e))}function iOe(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";wt();Nv="DELIVERABLE_INTEGRITY",rOe=8;$8={name:Nv,run:nOe}});function oOe(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:jv,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 sOe(t){let e=oOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:jv,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 aOe(t){let{cwd:e="."}=t;return he(e,jv,r=>sOe(r))}var jv,E8,A8=y(()=>{"use strict";wt();jv="SMOKE_PROBE_DEMAND";E8={name:jv,run:aOe}});function cOe(t){let{cwd:e="."}=t;return he(e,Mv,r=>lOe(r,e))}function lOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ss(e);if(n===null)return[{detector:Mv,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=M_(n,e,o);s.state!=="fresh"&&i.push({detector:Mv,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 Mv,Fv,BP=y(()=>{"use strict";fl();wt();Mv="STALE_ATTESTATION";Fv={name:Mv,run:cOe}});function uOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return dOe(r)}function dOe(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:T8,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 T8,Lv,HP=y(()=>{"use strict";qe();T8="DEPENDENCY_CYCLE";Lv={name:T8,run:uOe}});import{appendFileSync as fOe,existsSync as O8,mkdirSync as pOe,readFileSync as mOe}from"node:fs";import{dirname as hOe,join as gOe}from"node:path";function R8(t){return gOe(t,yOe,_Oe)}function I8(t){return GP.add(t),()=>GP.delete(t)}function Ga(t,e){let r=R8(t),n=hOe(r);O8(n)||pOe(n,{recursive:!0}),fOe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of GP)try{i(t,e)}catch{}}function On(t){let e=R8(t);if(!O8(e))return[];let r=mOe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var yOe,_Oe,GP,ti=y(()=>{"use strict";yOe=".cladding",_Oe="audit.log.jsonl";GP=new Set});import{existsSync as bOe}from"node:fs";import{join as vOe}from"node:path";function SOe(t){let{cwd:e="."}=t,r=On(e);if(r.length===0)return[{detector:ZP,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&&(bOe(vOe(e,i.artifact))||n.push({detector:ZP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var ZP,P8,C8=y(()=>{"use strict";ti();ZP="EVIDENCE_MISMATCH";P8={name:ZP,run:SOe}});import{existsSync as wOe,readFileSync as xOe}from"node:fs";import{join as $Oe}from"node:path";function kOe(t){let e=$Oe(t,M8);if(!wOe(e))return null;try{let n=((0,j8.parse)(xOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*N8(t,e){for(let r of t??[])r.startsWith(D8)&&(yield{ref:r,name:r.slice(D8.length),field:e})}function EOe(t){let{cwd:e="."}=t,r=kOe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:VP,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=[...N8(s.evidence_refs,"evidence_refs"),...N8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:VP,severity:"warn",path:M8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var j8,VP,D8,M8,F8,L8=y(()=>{"use strict";j8=St(Qt(),1);qe();VP="FIXTURE_REFERENCE_INVALID",D8="fixture:",M8="conformance/fixtures.yaml";F8={name:VP,run:EOe}});import{existsSync as Fl,readFileSync as WP}from"node:fs";import{join as Za}from"node:path";function AOe(t){return gs(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function vp(t){if(!Fl(t))return null;try{return JSON.parse(WP(t,"utf8"))}catch{return null}}function TOe(t,e){let r=Za(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(WP(r,"utf8"))}catch(c){e.push({detector:xo,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:xo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=AOe(t);s!==a&&e.push({detector:xo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function OOe(t,e){for(let r of z8){let n=Za(t,r.path);if(!Fl(n))continue;let i=vp(n);if(!i){e.push({detector:xo,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:xo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function ROe(t,e){let r=vp(Za(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of z8){let s=Za(t,o.path);if(!Fl(s))continue;let a=vp(s);a?.version&&a.version!==n&&e.push({detector:xo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Za(t,".claude-plugin","marketplace.json");if(Fl(i)){let o=vp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:xo,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 IOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function POe(t,e){let r=Za(t,"src","cli","clad.ts"),n=Za(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Fl(r)||!Fl(n))return;let i=IOe(WP(r,"utf8"));if(i.length===0)return;let s=vp(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:xo,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 COe(t){let{cwd:e="."}=t,r=[];return TOe(e,r),POe(e,r),OOe(e,r),ROe(e,r),r}var xo,z8,U8,q8=y(()=>{"use strict";yp();xo="HARNESS_INTEGRITY",z8=[{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"]}];U8={name:xo,run:COe}});import{existsSync as DOe,readFileSync as NOe}from"node:fs";import{join as jOe}from"node:path";function FOe(t){let{cwd:e="."}=t;return he(e,zv,r=>zOe(r,e))}function LOe(t){let e=jOe(t,"spec/capabilities.yaml");if(!DOe(e))return!1;try{let r=B8.default.parse(NOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function zOe(t,e){let r=t.features.length;if(r{"use strict";B8=St(Qt(),1);wt();zv="HOLLOW_GOVERNANCE",MOe=8;H8={name:zv,run:FOe}});import{existsSync as Z8,readFileSync as V8}from"node:fs";import{join as W8}from"node:path";function K8(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 BOe(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 HOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function GOe(t){let e=W8(t,"README.md"),r=W8(t,"docs","dogfood","matrix.md");if(!Z8(e)||!Z8(r))return[];let n=K8(V8(e,"utf8"),UOe),i=K8(V8(r,"utf8"),qOe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=HOe(a);if(c===null)continue;let l=i[s]??"not-run",u=BOe(l);u!==null&&c>u&&o.push({detector:J8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function ZOe(t){let{cwd:e="."}=t;return GOe(e)}var J8,UOe,qOe,Y8,X8=y(()=>{"use strict";J8="HOST_CLAIM_DRIFT",UOe=//,qOe=//;Y8={name:J8,run:ZOe}});function VOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return Q8(r.features.map(i=>i.id),"feature","spec/features/",n),Q8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function Q8(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:e5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var e5,t5,r5=y(()=>{"use strict";qe();e5="ID_COLLISION";t5={name:e5,run:VOe}});import{existsSync as Sp,readFileSync as KP,readdirSync as JP,statSync as WOe,writeFileSync as i5}from"node:fs";import{join as $o}from"node:path";function n5(t){if(!Sp(t))return 0;try{return JP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function KOe(t){if(!Sp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=JP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=$o(n,o),a;try{a=WOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function JOe(t){let e=$o(t,"spec","capabilities.yaml");if(!Sp(e))return 0;try{let r=Uv.default.parse(KP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ys(t="."){let e=n5($o(t,"spec","features")),r=n5($o(t,"spec","scenarios")),n=JOe(t),i=KOe($o(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Ll(t,e){let r=$o(t,"spec.yaml");if(!Sp(r))return;let n=KP(r,"utf8"),i=YOe(n,e);i!==n&&i5(r,i)}function YOe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as Pxe}from"node:buffer";import{StringDecoder as Cxe}from"node:string_decoder";var Wb,Dxe,Nxe,jxe,mI=y(()=>{rn();Wb=(t,e,r)=>{if(r)return;if(t)return{transform:Dxe.bind(void 0,new TextEncoder)};let n=new Cxe(e);return{transform:Nxe.bind(void 0,n),final:jxe.bind(void 0,n)}},Dxe=function*(t,e){Pxe.isBuffer(e)?yield go(e):typeof e=="string"?yield t.encode(e):yield e},Nxe=function*(t,e){yield Ut(e)?t.write(e):e},jxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as BW}from"node:util";var hI,Kb,HW,Mxe,GW,Fxe,ZW=y(()=>{hI=BW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Kb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Fxe}=e[r];for await(let i of n(t))yield*Kb(i,e,r+1)},HW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Mxe(r,Number(e),t)},Mxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Kb(n,r,e+1)},GW=BW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Fxe=function*(t){yield t}});var gI,VW,Na,rp,Lxe,zxe,yI=y(()=>{gI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},VW=(t,e)=>[...e.flatMap(r=>[...Na(r,t,0)]),...rp(t)],Na=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=zxe}=e[r];for(let i of n(t))yield*Na(i,e,r+1)},rp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Lxe(r,Number(e),t)},Lxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Na(n,r,e+1)},zxe=function*(t){yield t}});import{Transform as Uxe,getDefaultHighWaterMark as WW}from"node:stream";var _I,Jb,KW,Yb=y(()=>{vr();Vb();qW();mI();ZW();yI();_I=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=KW(t,s,o),l=Da(e),u=Da(r),d=l?hI.bind(void 0,Kb,a):gI.bind(void 0,Na),f=l||u?hI.bind(void 0,HW,a):gI.bind(void 0,rp),p=l||u?GW.bind(void 0,a):void 0;return{stream:new Uxe({writableObjectMode:n,writableHighWaterMark:WW(n),readableObjectMode:i,readableHighWaterMark:WW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Jb=(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=KW(s,r,a);t=VW(c,t)}return t},KW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:LW(n,a)},Wb(r,s,n),Zb(r,o,n,c),{transform:t,final:e},{transform:zW(i,a)},FW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var JW,qxe,Bxe,Hxe,Gxe,YW=y(()=>{Yb();rn();vr();JW=(t,e)=>{for(let r of qxe(t))Bxe(t,r,e)},qxe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Bxe=(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 ${fs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Hxe(a,n));r.input=zf(s)},Hxe=(t,e)=>{let r=Jb(t,e,"utf8",!0);return Gxe(r),zf(r)},Gxe=t=>{let e=t.find(r=>typeof r!="string"&&!Ut(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 Xb,Zxe,Vxe,XW,QW,Wxe,e3,bI=y(()=>{Ra();vr();_l();cs();Xb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&yl(r,n)&&!nn.has(e)&&Zxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Vxe.has(o))||t.every(({type:i})=>Tn.has(i))),Zxe=t=>t===1||t===2,Vxe=new Set(["pipe","overlapped"]),XW=async(t,e,r,n)=>{for await(let i of t)Wxe(e)||e3(i,r,n)},QW=(t,e,r)=>{for(let n of t)e3(n,e,r)},Wxe=t=>t._readableState.pipes.length>0,e3=(t,e,r)=>{let n=Y_(t);Ti({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Kxe,appendFileSync as Jxe}from"node:fs";var t3,Yxe,Xxe,Qxe,e$e,t$e,r3=y(()=>{bI();Yb();Vb();rn();vr();Ca();t3=({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)=>Yxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Yxe=({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=zV(t,o,d),p=go(f),{stdioItems:m,objectMode:h}=e[r],g=Xxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Qxe({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}},Xxe=(t,e,r,n)=>{try{return Jb(t,e,r,!1)}catch(i){return n.error=i,t}},Qxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:zf(t)};let s=RG(t,r);return n[o]?{serializedResult:s,finalResult:pI(s,!i[o],e)}:{serializedResult:s}},e$e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Xb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=pI(t,!1,s);try{QW(a,e,n)}catch(c){r.error??=c}},t$e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Bb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Jxe(n,t):(r.add(o),Kxe(n,t))}}});var n3,i3=y(()=>{rn();tp();n3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,So(e,r,"all")]:Array.isArray(e)?[So(t,r,"all"),...e]:Ut(t)&&Ut(e)?cR([t,e]):`${t}${e}`}});import{once as vI}from"node:events";var o3,r$e,s3,a3,n$e,SI,wI=y(()=>{Ta();o3=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([vI(t,"spawn"),vI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?s3(t):r.value},s3=async t=>{try{return await vI(t,"exit")}catch{return s3(t)}},a3=async t=>{let[e,r]=await t;if(!n$e(e,r)&&SI(e,r))throw new Xn;return[e,r]},n$e=(t,e)=>t===void 0&&e===void 0,SI=(t,e)=>t!==0||e!==null});var c3,i$e,l3=y(()=>{Ta();Ca();wI();c3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=i$e(t,e,r),s=o?.code==="ETIMEDOUT",a=LV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},i$e=(t,e,r)=>t!==void 0?t:SI(e,r)?new Xn:void 0});import{spawnSync as o$e}from"node:child_process";var u3,s$e,a$e,c$e,Qb,l$e,u$e,d$e,f$e,d3=y(()=>{yR();GR();ZR();ep();zb();NW();tp();YW();r3();Ca();i3();l3();u3=(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 Ol(d,c,l)},s$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=eb(t,e,r),a=a$e(r),{file:c,commandArguments:l,options:u}=Ab(t,e,a);c$e(u);let d=CW(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&&Qb("ipcInput"),t&&Qb("ipc: true"),r&&Qb("detached: true"),n&&Qb("cancelSignal")},Qb=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}=c3(c,r),{output:m,error:h=l}=t3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>So(_,r,S)),b=So(n3(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{JW(o,r);let a=d$e(r);return o$e(...Tb(t,e,a))}catch(a){return Tl({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:Fb(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?Lb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Qf({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 xI,on as p$e}from"node:events";var f3,m$e,h$e,g$e,y$e,p3=y(()=>{xl();Wf();Vf();f3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Sl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:vb(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})=>{pb(e,i);let o=ds(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 wl(t),a}finally{s.abort(),mb(e,i)}},h$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await xI(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 xI(t,"disconnect",{signal:r}),$9(e)},y$e=async(t,e,{signal:r})=>{let[n]=await xI(t,"strict:error",{signal:r});throw lb(n,e)}});import{once as h3,on as _$e}from"node:events";var g3,$I,b$e,v$e,S$e,m3,kI=y(()=>{xl();Wf();Vf();g3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>$I({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),$I=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Sl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:vb(t)}),pb(e,o);let s=ds(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 h3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},v$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await h3(t,"strict:error",{signal:r.signal});n.error=lb(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}))m3(s),yield c}catch{m3(s)}finally{o.abort(),mb(e,a),n||wl(t),i&&await t}},m3=({error:t})=>{if(t)throw t}});import y3 from"node:process";var _3,b3,v3,EI=y(()=>{kb();p3();kI();_b();_3=(t,{ipc:e})=>{Object.assign(t,v3(t,!1,e))},b3=()=>{let t=y3,e=!0,r=y3.channel!==void 0;return{...v3(t,e,r),getCancelSignal:X9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},v3=(t,e,r)=>({sendMessage:$b.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:f3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:g3.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 S3,A$e,np,T$e,O$e,R$e,I$e,w3=y(()=>{Gb();ep();zb();S3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{uI(n);let a=new w$e;A$e(a,n),Object.assign(a,{readable:T$e,writable:O$e,duplex:R$e});let c=Tl({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=np(),n=np(),i=np(),o=Array.from({length:e.length-3},np),s=np(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},np=()=>{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)=>Ol(t,e,r)});import{createReadStream as x3,createWriteStream as $3}from"node:fs";import{Buffer as P$e}from"node:buffer";import{Readable as ip,Writable as C$e,Duplex as D$e}from"node:stream";var E3,op,k3,N$e,A3=y(()=>{Yb();Gb();vr();E3=(t,e)=>Hb(N$e,t,e,!1),op=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${fs[t]}.`)},k3={fileNumber:op,generator:_I,asyncGenerator:_I,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:{...k3,fileUrl:({value:t})=>({stream:x3(t)}),filePath:({value:{file:t}})=>({stream:x3(t)}),webStream:({value:t})=>({stream:ip.fromWeb(t)}),iterable:({value:t})=>({stream:ip.from(t)}),asyncIterable:({value:t})=>({stream:ip.from(t)}),string:({value:t})=>({stream:ip.from(t)}),uint8Array:({value:t})=>({stream:ip.from(P$e.from(t))})},output:{...k3,fileUrl:({value:t})=>({stream:$3(t)}),filePath:({value:{file:t,append:e}})=>({stream:$3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:C$e.fromWeb(t)}),iterable:op,asyncIterable:op,string:op,uint8Array:op}}});import{on as j$e,once as T3}from"node:events";import{PassThrough as M$e,getDefaultHighWaterMark as F$e}from"node:stream";import{finished as I3}from"node:stream/promises";function ja(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)TI(i);let e=t.some(({readableObjectMode:i})=>i),r=L$e(t,e),n=new AI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var L$e,AI,z$e,U$e,q$e,TI,B$e,H$e,G$e,Z$e,V$e,P3,C3,OI,D3,W$e,ev,O3,R3,tv=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)},AI=class extends M$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(TI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=z$e(this,this.#t,this.#o);let r=B$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(TI(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)=>{ev(t,O3);let n=new AbortController;try{await Promise.race([U$e(t,n),q$e(t,e,r,n)])}finally{n.abort(),ev(t,-O3)}},U$e=async(t,{signal:e})=>{try{await I3(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)},TI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},B$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{ev(t,R3);let a=new AbortController;try{await Promise.race([H$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(),ev(t,-R3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?OI(t):V$e(t))},H$e=async(t,e,{signal:r})=>{try{await t,r.aborted||OI(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 I3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;C3(s)?i.add(e):D3(t,s)}},Z$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await T3(t,i,{signal:o}),!t.readable)return T3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},V$e=t=>{t.writable&&t.end()},P3=(t,e)=>{C3(e)?OI(t):D3(t,e)},C3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",OI=t=>{(t.readable||t.writable)&&t.destroy()},D3=(t,e)=>{t.destroyed||(t.once("error",W$e),t.destroy(e))},W$e=()=>{},ev=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},O3=2,R3=1});import{finished as N3}from"node:stream/promises";var Il,K$e,RI,J$e,II,rv=y(()=>{yo();Il=(t,e)=>{t.pipe(e),K$e(t,e),J$e(t,e)},K$e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await N3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}RI(e)}},RI=t=>{t.writable&&t.end()},J$e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await N3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}II(t)}},II=t=>{t.readable&&t.destroy()}});var j3,Y$e,X$e,Q$e,e0e,t0e,M3=y(()=>{tv();yo();fb();vr();rv();j3=(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})=>Tn.has(c)))Y$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Tn.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]:ja(o);Il(s,i)}},Y$e=(t,e,r,n)=>{r==="output"?Il(t.stdio[n],e):Il(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;e0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},e0e=(t,{signal:e})=>{Yn(t)&&Oa(t,t0e,e)},t0e=2});var Ma,F3=y(()=>{Ma=[];Ma.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ma.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ma.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var nv,PI,CI,r0e,DI,iv,n0e,NI,jI,MI,L3,Rst,Ist,z3=y(()=>{F3();nv=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",PI=Symbol.for("signal-exit emitter"),CI=globalThis,r0e=Object.defineProperty.bind(Object),DI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(CI[PI])return CI[PI];r0e(CI,PI,{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}},iv=class{},n0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),NI=class extends iv{onExit(){return()=>{}}load(){}unload(){}},jI=class extends iv{#t=MI.platform==="win32"?"SIGINT":"SIGHUP";#r=new DI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ma)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(!nv(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 Ma)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,Ma.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 nv(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"&&nv(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)}},MI=globalThis.process,{onExit:L3,load:Rst,unload:Ist}=n0e(nv(MI)?new jI(MI):new NI)});import{addAbortListener as i0e}from"node:events";var U3,q3=y(()=>{z3();U3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=L3(()=>{t.kill()});i0e(n,()=>{i()})}});var H3,o0e,s0e,B3,a0e,G3=y(()=>{aR();Q_();us();hl();H3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=X_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=o0e(r,n,i),{sourceStream:d,sourceError:f}=a0e(t,l),{options:p,fileDescriptors:m}=Ri.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},o0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=s0e(t,e,...r),a=db(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},s0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(B3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||oR(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]=U_(r,...n);return{destination:e(B3)(i,o,s),pipeOptions:s}}if(Ri.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}`)},B3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),a0e=(t,e)=>{try{return{sourceStream:kl(t,e)}}catch(r){return{sourceError:r}}}});var V3,c0e,FI,Z3,LI=y(()=>{ep();rv();V3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=c0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw FI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},c0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return II(t),n;if(e!==void 0)return RI(r),e},FI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Tl({error:t,command:Z3,escapedCommand:Z3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Z3="source.pipe(destination)"});var W3,K3=y(()=>{W3=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 l0e}from"node:stream/promises";var J3,u0e,d0e,f0e,ov,p0e,m0e,Y3=y(()=>{tv();fb();rv();J3=(t,e,r)=>{let n=ov.has(e)?d0e(t,e):u0e(t,e);return Oa(t,p0e,r.signal),Oa(e,m0e,r.signal),f0e(e),n},u0e=(t,e)=>{let r=ja([t]);return Il(r,e),ov.set(e,r),r},d0e=(t,e)=>{let r=ov.get(e);return r.add(t),r},f0e=async t=>{try{await l0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}ov.delete(t)},ov=new WeakMap,p0e=2,m0e=1});import{aborted as h0e}from"node:util";var X3,g0e,Q3=y(()=>{LI();X3=(t,e)=>t===void 0?[]:[g0e(t,e)],g0e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await h0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw FI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var sv,y0e,_0e,eK=y(()=>{ho();G3();LI();K3();Y3();Q3();sv=(t,...e)=>{if(Ot(e[0]))return sv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=H3(t,...e),i=y0e({...n,destination:r});return i.pipe=sv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},y0e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=_0e(t,i);V3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=J3(e,o,d);return await Promise.race([W3(u),...X3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},_0e=(t,e)=>Promise.allSettled([t,e])});import{on as b0e}from"node:events";import{getDefaultHighWaterMark as v0e}from"node:stream";var av,S0e,zI,w0e,rK,UI,tK,x0e,$0e,cv=y(()=>{mI();Vb();yI();av=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return S0e(e,s),rK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},S0e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},zI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;w0e(e,s,t);let a=t.readableObjectMode&&!o;return rK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},w0e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},rK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=b0e(t,"data",{signal:e.signal,highWaterMark:tK,highWatermark:tK});return x0e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},UI=v0e(!0),tK=UI,x0e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=$0e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Na(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*rp(a)}},$0e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Wb(t,r,!e),Zb(t,i,!n,{})].filter(Boolean)});import{setImmediate as k0e}from"node:timers/promises";var nK,E0e,A0e,T0e,qI,iK,BI=y(()=>{Mb();rn();bI();cv();Ca();tp();nK=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=E0e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([A0e(t),d]);return}let f=dI(c,r),p=zI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([T0e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},E0e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Xb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=zI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await XW(a,t,r,o)},A0e=async t=>{await k0e(),t.readableFlowing===null&&t.resume()},T0e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Cb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Db(r,{maxBuffer:o})):await jb(r,{maxBuffer:o})}catch(a){return iK(jV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},qI=async t=>{try{return await t}catch(e){return iK(e)}},iK=({bufferedData:t})=>TG(t)?new Uint8Array(t):t});import{finished as O0e}from"node:stream/promises";var sp,R0e,I0e,P0e,C0e,D0e,HI,lv,oK,uv=y(()=>{sp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=R0e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],O0e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||C0e(a,e,r,n)}finally{s.abort()}},R0e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&I0e(t,r,n),n},I0e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{P0e(e,r),n.call(t,...i)}},P0e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},C0e=(t,e,r,n)=>{if(!D0e(t,e,r,n))throw t},D0e=(t,e,r,n=!0)=>r.propagating?oK(t)||lv(t):(r.propagating=!0,HI(r,e)===n?oK(t):lv(t)),HI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",lv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",oK=t=>t?.code==="EPIPE"});var sK,GI,ZI=y(()=>{BI();uv();sK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>GI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),GI=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=sp(t,e,l);if(HI(l,e)){await u;return}let[d]=await Promise.all([nK({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 aK,cK,N0e,j0e,VI=y(()=>{tv();ZI();aK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?ja([t,e].filter(Boolean)):void 0,cK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>GI({...N0e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:j0e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),N0e=({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}},j0e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var lK,uK,dK=y(()=>{_l();cs();lK=t=>yl(t,"ipc"),uK=(t,e)=>{let r=Y_(t);Ti({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var fK,pK,mK=y(()=>{Ca();dK();bo();kI();fK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=lK(o),a=_o(e,"ipc"),c=_o(r,"ipc");for await(let l of $I({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(MV(t,i,c),i.push(l)),s&&uK(l,o);return i},pK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as M0e}from"node:events";var hK,F0e,L0e,z0e,gK=y(()=>{Pa();zR();IR();LR();yo();vr();BI();mK();qR();VI();ZI();wI();uv();hK=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 _=o3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=sK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=cK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=fK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=F0e(h,t,S),D=L0e(m,S);try{return await Promise.race([Promise.all([{},a3(_),Promise.all(x),w,T,cV(t,d),...A,...D]),g,z0e(t,b),...nV(t,o,f,b),...x9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...tV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(ie=>qI(ie))),qI(w),pK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},F0e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:sp(n,i,r)),L0e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>sp(s,n,e,{isSameDirection:Tn.has(i),stopOnExit:i==="native"}))),z0e=async(t,{signal:e})=>{let[r]=await M0e(t,"error",{signal:e});throw r}});var yK,ap,Pl,dv=y(()=>{$l();yK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),ap=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Oi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Pl=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 _K}from"node:stream/promises";var WI,bK,KI,JI,fv,pv,YI=y(()=>{uv();WI=async t=>{if(t!==void 0)try{await KI(t)}catch{}},bK=async t=>{if(t!==void 0)try{await JI(t)}catch{}},KI=async t=>{await _K(t,{cleanup:!0,readable:!1,writable:!0})},JI=async t=>{await _K(t,{cleanup:!0,readable:!0,writable:!1})},fv=async(t,e)=>{if(await t,e)throw e},pv=(t,e,r)=>{r&&!lv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as U0e}from"node:stream";import{callbackify as q0e}from"node:util";var vK,XI,QI,eP,B0e,tP,rP,SK,nP=y(()=>{Ra();us();cv();$l();dv();YI();vK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=XI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=QI(a,s),{read:f,onStdoutDataDone:p}=eP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new U0e({read:f,destroy:q0e(rP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return tP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},XI=(t,e,r)=>{let n=kl(t,e),i=ap(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},QI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:UI},eP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Oi(),s=av({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){B0e(this,s,o)},onStdoutDataDone:o}},B0e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},tP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await JI(t),await n,await WI(i),await e,r.readable&&r.push(null)}catch(o){await WI(i),SK(r,o)}},rP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Pl(r,e)&&(SK(t,n),await fv(e,n))},SK=(t,e)=>{pv(t,t.readable,e)}});import{Writable as H0e}from"node:stream";import{callbackify as wK}from"node:util";var xK,iP,oP,G0e,Z0e,sP,aP,$K,cP=y(()=>{us();dv();YI();xK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=iP(t,r,e),s=new H0e({...oP(n,t,i),destroy:wK(aP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return sP(n,s),s},iP=(t,e,r)=>{let n=db(t,e),i=ap(r,n,"writableFinal"),o=ap(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},oP=(t,e,r)=>({write:G0e.bind(void 0,t),final:wK(Z0e.bind(void 0,t,e,r))}),G0e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Z0e=async(t,e,r)=>{await Pl(r,e)&&(t.writable&&t.end(),await e)},sP=async(t,e,r)=>{try{await KI(t),e.writable&&e.end()}catch(n){await bK(r),$K(e,n)}},aP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Pl(r,e),await Pl(n,e)&&($K(t,i),await fv(e,i))},$K=(t,e)=>{pv(t,t.writable,e)}});import{Duplex as V0e}from"node:stream";import{callbackify as W0e}from"node:util";var kK,K0e,EK=y(()=>{Ra();nP();cP();kK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=XI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=iP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=QI(c,a),{read:g,onStdoutDataDone:b}=eP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new V0e({read:g,...oP(u,t,d),destroy:W0e(K0e.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 tP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),sP(u,_,c),_},K0e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([rP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),aP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var lP,J0e,AK=y(()=>{Ra();us();cv();lP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=kl(t,r),a=av({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return J0e(a,s,t)},J0e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var TK,OK=y(()=>{dv();nP();cP();EK();AK();TK=(t,{encoding:e})=>{let r=yK();t.readable=vK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=xK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=kK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=lP.bind(void 0,t,e),t[Symbol.asyncIterator]=lP.bind(void 0,t,e,{})}});var RK,Y0e,X0e,IK=y(()=>{RK=(t,e)=>{for(let[r,n]of X0e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Y0e=(async()=>{})().constructor.prototype,X0e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Y0e,t)])});import{setMaxListeners as Q0e}from"node:events";import{spawn as eke}from"node:child_process";var PK,tke,rke,nke,ike,oke,CK=y(()=>{Mb();yR();GR();us();ZR();EI();ep();zb();w3();A3();tp();M3();ab();q3();eK();VI();gK();OK();$l();IK();PK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=tke(t,e,r),{subprocess:f,promise:p}=nke({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}),RK(f,p),Ri.set(f,{options:u,fileDescriptors:d}),f},tke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=eb(t,e,r),{file:a,commandArguments:c,options:l}=Ab(t,e,r),u=rke(l),d=E3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},rke=({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}},nke=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=eke(...Tb(t,e,r))}catch(m){return S3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Q0e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];j3(c,a,l),U3(c,r,l);let d={},f=Oi();c.kill=S9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=aK(c,r),TK(c,r),_3(c,r);let p=ike({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}},ike=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 hK({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)=>So(x,e,w)),_=So(h,e,"all"),S=oke({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ol(S,n,e)},oke=({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?Qf({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 Ii,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Lb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var mv,ske,ake,DK=y(()=>{ho();bo();mv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,ske(n,t[n],i)]));return{...t,...r}},ske=(t,e,r)=>ake.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,ake=new Set(["env",...fR])});var ps,cke,lke,NK=y(()=>{ho();aR();jG();d3();CK();DK();ps=(t,e,r,n)=>{let i=(s,a,c)=>ps(s,a,r,c),o=(...s)=>cke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},cke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,mv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=lke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?u3(a,c,l):PK(a,c,l,i)},lke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=DG(e)?NG(e,r):[e,...r],[s,a,c]=U_(...o),l=mv(mv(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 jK,MK,FK,uke,dke,LK=y(()=>{jK=({file:t,commandArguments:e})=>FK(t,e),MK=({file:t,commandArguments:e})=>({...FK(t,e),isSync:!0}),FK=(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]=uke(t);return{file:r,commandArguments:n}},uke=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(dke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},dke=/ +/g});var zK,UK,fke,qK,pke,BK,HK=y(()=>{zK=(t,e,r)=>{t.sync=e(fke,r),t.s=t.sync},UK=({options:t})=>qK(t),fke=({options:t})=>({...qK(t),isSync:!0}),qK=t=>({options:{...pke(t),...t}}),pke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},BK={preferLocal:!0}});var vlt,Ye,Slt,wlt,xlt,$lt,klt,Elt,Alt,Tlt,Mr=y(()=>{NK();LK();UR();HK();EI();vlt=ps(()=>({})),Ye=ps(()=>({isSync:!0})),Slt=ps(jK),wlt=ps(MK),xlt=ps(oV),$lt=ps(UK,{},BK,zK),{sendMessage:klt,getOneMessage:Elt,getEachMessage:Alt,getCancelSignal:Tlt}=b3()});import{existsSync as hv,statSync as mke}from"node:fs";import{dirname as uP,extname as hke,isAbsolute as GK,join as dP,relative as fP,resolve as gv,sep as gke}from"node:path";function yv(t){return t==="./gradlew"||t==="gradle"}function yke(t){return(hv(dP(t,"build.gradle.kts"))||hv(dP(t,"build.gradle")))&&hv(dP(t,"gradle.properties"))}function _ke(t,e){let n=fP(t,e).split(gke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ms(t,e){return t===":"?`:${e}`:`${t}:${e}`}function bke(t,e){let r=gv(t,e),n=r;hv(r)?mke(r).isFile()&&(n=uP(r)):hke(r)!==""&&(n=uP(r));let i=fP(t,n);if(i.startsWith("..")||GK(i))return null;let o=n;for(;;){if(yke(o))return o;if(gv(o)===gv(t))return null;let s=uP(o);if(s===o)return null;let a=fP(t,s);if(a.startsWith("..")||GK(a))return null;o=s}}function _v(t,e){let r=gv(t),n=new Map,i=[];for(let o of e){let s=bke(r,o);if(!s){i.push(o);continue}let a=_ke(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 bv=y(()=>{"use strict"});import{existsSync as mP,readFileSync as vke}from"node:fs";import{join as Cl}from"node:path";function Dl(t="."){let e=Cl(t,".cladding","config.yaml");if(!mP(e))return pP;try{let n=(0,ZK.parse)(vke(e,"utf8"))?.gate;if(!n)return pP;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 Ske){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 pP}}function VK(t="."){let e=Dl(t).testReport,r=e?[e,...hP]:hP;return[...new Set(r.map(n=>Cl(t,n)))]}function WK(t="."){let e=Dl(t).testReport;if(e){let r=Cl(t,e);return mP(r)?r:null}return hP.map(r=>Cl(t,r)).find(r=>mP(r))??null}function KK(t,e){let r=[],n=!1;for(let i of t){let o=wke.exec(i);if(o){n=!0;for(let s of e)r.push(ms(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 ZK,Ske,pP,hP,wke,cp=y(()=>{"use strict";ZK=St(Qt(),1);bv();Ske=["type","lint","test","coverage"],pP={scope:"feature"},hP=["test-report.junit.xml",Cl("coverage","junit.xml"),Cl(".cladding","test-report.junit.xml")];wke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as yP,readFileSync as JK,readdirSync as xke,statSync as $ke}from"node:fs";import{join as vv}from"node:path";function vP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=vv(t,e);if(yP(r))try{if(YK.test(JK(r,"utf8")))return!0}catch{}}return!1}function XK(t){try{return yP(t)&&YK.test(JK(t,"utf8"))}catch{return!1}}function QK(t,e=0){if(e>4||!yP(t))return!1;let r;try{r=xke(t)}catch{return!1}for(let n of r){let i=vv(t,n),o=!1;try{o=$ke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(QK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&XK(i))return!0}return!1}function Ake(t){if(vP(t))return!0;for(let e of kke)if(XK(vv(t,e)))return!0;for(let e of Eke)if(QK(vv(t,e)))return!0;return!1}function eJ(t="."){let e=Dl(t).coverage;return e||(Ake(t)?"kover":"jacoco")}function tJ(t="."){return _P[eJ(t)]}function rJ(t="."){return gP[eJ(t)]}var _P,gP,bP,YK,kke,Eke,Sv=y(()=>{"use strict";cp();_P={kover:"koverXmlReport",jacoco:"jacocoTestReport"},gP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},bP=[gP.kover,gP.jacoco],YK=/kover/i;kke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Eke=["buildSrc","build-logic"]});import{existsSync as up,readFileSync as iJ,readdirSync as oJ}from"node:fs";import{join as hs}from"node:path";function wP(t){return up(hs(t,"gradlew"))?"./gradlew":"gradle"}function Tke(t){let e=wP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[tJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Oke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(iJ(hs(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 Ike(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function Dke(t,e){for(let r of e)if(up(hs(t,r)))return r}function Nke(t,e){try{return oJ(t).find(n=>n.endsWith(e))}catch{return}}function Fke(t){try{return JSON.parse(iJ(hs(t,"package.json"),"utf8"))}catch{return{}}}function lp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function nJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function Lke(t,e,r){if(lp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of jke)if(n.configs.some(i=>up(hs(t,i))))return n.gate;if(Mke.some(n=>up(hs(t,n)))||r.eslintConfig!==void 0)return e}function Uke(t,e){return zke.some(r=>up(hs(t,r)))?!0:e.jest!==void 0}function qke(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 SP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function Bke(t,e){let r=Fke(t),n=e.lint?Lke(t,e.lint,r):void 0,i=n?{...e,lint:n}:SP(e,"lint"),o=lp(r,"test"),s=o?qke(o):void 0;return o&&!s?(i=SP(i,"coverage"),{...i,test:{cmd:"npm",args:["test"]},...lp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):s==="jest"||!o&&Uke(t,r)?{...i,test:{cmd:"npx",args:[...Ci,"jest"]},coverage:{cmd:"npx",args:[...Ci,"jest","--coverage"]}}:(s==="vitest"&&!lp(r,"coverage")&&!nJ(r,"@vitest/coverage-v8")&&!nJ(r,"@vitest/coverage-istanbul")?i=SP(i,"coverage"):s==="vitest"&&lp(r,"coverage")&&(i={...i,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),i)}function dt(t="."){for(let e of Pke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Nke(t,o):r=Dke(t,[o]),r)break;if(!r||e.requiresSource&&!Ike(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Bke(t,n):n;return{language:e.language,manifest:r,gates:i}}return Cke}var Ci,Rke,Pke,Cke,jke,Mke,zke,on=y(()=>{"use strict";Sv();Ci=["--offline","--no-install"];Rke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);Pke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Ci,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Ci,"eslint","."]},test:{cmd:"npx",args:[...Ci,"vitest","run"]},coverage:{cmd:"npx",args:[...Ci,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Ci,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Ci,"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:Tke},{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:Oke}],Cke={language:"unknown",manifest:"",gates:{}};jke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Ci,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Ci,"oxlint"]}}],Mke=["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"];zke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Hke,readFileSync as Gke}from"node:fs";import{join as Zke}from"node:path";function Fa(t){return t.code==="ENOENT"}function wv(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=(o||s||`exit ${i}`).slice(0,200);return sJ.test(o)||sJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function qt(t,e,r,n=[]){if(Fa(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 tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Nl(t,e){let r=Zke(t,"package.json");if(!Hke(r))return!1;try{return!!JSON.parse(Gke(r,"utf8")).scripts?.[e]}catch{return!1}}var sJ,On=y(()=>{"use strict";sJ=/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 Vke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:xv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Ye(n.cmd,[...n.args],{cwd:e,reject:!1});return Fa(i)?[{detector:xv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:wv(i,xv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var xv,La,$v=y(()=>{"use strict";Mr();on();On();xv="ARCHITECTURE_VIOLATION";La={name:xv,subprocess:!0,run:Vke}});function Wke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:kv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Ye(n.cmd,[...n.args],{cwd:e,reject:!1});return Fa(i)?[{detector:kv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:wv(i,kv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var kv,za,Ev=y(()=>{"use strict";Mr();on();On();kv="HARDCODED_SECRET";za={name:kv,subprocess:!0,run:Wke}});import{existsSync as xP,readdirSync as aJ}from"node:fs";import{join as Av}from"node:path";function Jke(t,e){let r=Av(t,e.path);if(!xP(r))return!0;if(e.isDirectory)try{return aJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Yke(t){let{cwd:e="."}=t,r=[];for(let i of Kke)Jke(e,i)&&r.push({detector:dp,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=Av(e,"spec.yaml");if(xP(n)){let i=eEe(n),o=i?null:Xke(e);if(i)r.push({detector:dp,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:dp,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=Qke(e);s&&r.push({detector:dp,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 Xke(t){for(let e of["spec/features","spec/scenarios"]){let r=Av(t,e);if(!xP(r))continue;let n;try{n=aJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ki(Av(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function Qke(t){try{return H(t),null}catch(e){return e.message}}function eEe(t){let e;try{e=ki(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var dp,Kke,cJ,lJ=y(()=>{"use strict";qe();I_();dp="ABSENCE_OF_GOVERNANCE",Kke=[{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}];cJ={name:dp,run:Yke}});function Tv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function $P(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=Tv(r)==="while",o=rEe.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 '${Tv(r)}'`}let n=tEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Tv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Tv(r)}'`:null}function nEe(t,e){let r=$P(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(...nEe(r,n));return e}var tEe,rEe,kP=y(()=>{"use strict";tEe={event:"when",state:"while",optional:"where",unwanted:"if"},rEe=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";qe()});function iEe(t){let{cwd:e="."}=t;return he(e,Ov,oEe)}function oEe(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:Ov,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:Ov,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Ov,dJ,fJ=y(()=>{"use strict";kP();wt();Ov="AC_DRIFT";dJ={name:Ov,run:iEe}});function Di(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return mJ[n]??pJ}var sEe,aEe,cEe,pJ,lEe,uEe,mJ,dEe,hJ,Ua=y(()=>{"use strict";on();sEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,aEe=/^[ \t]*import\s+([\w.]+)/gm,cEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,pJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:sEe,importStyle:"relative"},lEe={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:aEe,importStyle:"dotted"},uEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:cEe,importStyle:"dotted"},mJ={typescript:pJ,kotlin:lEe,python:uEe},dEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],hJ=new Set([...Object.values(mJ).flatMap(t=>t?.extensions??[]),...dEe].map(t=>t.toLowerCase()))});import{existsSync as fEe,readFileSync as pEe,readdirSync as mEe,statSync as hEe}from"node:fs";import{join as yJ,relative as gJ}from"node:path";function gEe(t,e){if(!fEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=mEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=yJ(i,s),c;try{c=hEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function yEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function bEe(t){return _Ee.test(t)}function vEe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Di(e,r.project?.language),o=i.sourceRoots.flatMap(a=>gEe(yJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=pEe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";qe();Ua();_J="AI_HINTS_FORBIDDEN_PATTERN";_Ee=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;bJ={name:_J,run:vEe}});function SEe(t){let{cwd:e="."}=t,r;try{r=H(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:SJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var SJ,wJ,xJ=y(()=>{"use strict";qe();SJ="AC_DUPLICATE_WITHIN_FEATURE";wJ={name:SJ,run:SEe}});import{createRequire as wEe}from"module";import{basename as xEe,dirname as AP,normalize as $Ee,relative as kEe,resolve as EEe,sep as EJ}from"path";import*as AEe from"fs";function TEe(t){let e=$Ee(t);return e.length>1&&e[e.length-1]===EJ&&(e=e.substring(0,e.length-1)),e}function AJ(t,e){return t.replace(OEe,e)}function IEe(t){return t==="/"||REe.test(t)}function EP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=EEe(t)),(n||o)&&(t=TEe(t)),t===".")return"";let s=t[t.length-1]!==i;return AJ(s?t+i:t,i)}function TJ(t,e){return e+t}function PEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:AJ(kEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function CEe(t){return t}function DEe(t,e,r){return e+t+r}function NEe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?PEe(t,e):n?TJ:CEe}function jEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function MEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function UEe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?MEe(t):jEe(t):n&&n.length?LEe:FEe:zEe}function VEe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?ZEe:r&&r.length?n?qEe:BEe:n?HEe:GEe}function JEe(t){return t.group?KEe:WEe}function QEe(t){return t.group?YEe:XEe}function rAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?tAe:eAe}function OJ(t,e,r){if(r.options.useRealPaths)return nAe(e,r);let n=AP(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=AP(n)}return r.symlinks.set(t,e),i>1}function nAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Rv(t,e,r,n){e(t&&!n?t:null,r)}function fAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?iAe:cAe:n?e?oAe:dAe:i?e?aAe:uAe:e?sAe:lAe}function hAe(t){return t?mAe:pAe}function bAe(t,e){return new Promise((r,n)=>{PJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function PJ(t,e,r){new IJ(t,e,r).start()}function vAe(t,e){return new IJ(t,e).start()}var $J,OEe,REe,FEe,LEe,zEe,qEe,BEe,HEe,GEe,ZEe,WEe,KEe,YEe,XEe,eAe,tAe,iAe,oAe,sAe,aAe,cAe,lAe,uAe,dAe,RJ,pAe,mAe,gAe,yAe,_Ae,IJ,kJ,CJ,DJ,NJ=y(()=>{$J=wEe(import.meta.url);OEe=/[\\/]/g;REe=/^[a-z]:[\\/]$/i;FEe=(t,e)=>{e.push(t||".")},LEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},zEe=()=>{};qEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},BEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},HEe=(t,e,r,n)=>{r.files++},GEe=(t,e)=>{e.push(t)},ZEe=()=>{};WEe=t=>t,KEe=()=>[""].slice(0,0);YEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},XEe=()=>{};eAe=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()&&OJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},tAe=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()&&OJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};iAe=t=>t.counts,oAe=t=>t.groups,sAe=t=>t.paths,aAe=t=>t.paths.slice(0,t.options.maxFiles),cAe=(t,e,r)=>(Rv(e,r,t.counts,t.options.suppressErrors),null),lAe=(t,e,r)=>(Rv(e,r,t.paths,t.options.suppressErrors),null),uAe=(t,e,r)=>(Rv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),dAe=(t,e,r)=>(Rv(e,r,t.groups,t.options.suppressErrors),null);RJ={withFileTypes:!0},pAe=(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||".",RJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},mAe=(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||".",RJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};gAe=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))}},yAe=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}},_Ae=class{aborted=!1;abort(){this.aborted=!0}},IJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=fAe(e,this.isSynchronous),this.root=EP(t,e),this.state={root:IEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new yAe,options:e,queue:new gAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new _Ae,fs:e.fs||AEe},this.joinPath=NEe(this.root,e),this.pushDirectory=UEe(this.root,e),this.pushFile=VEe(e),this.getArray=JEe(e),this.groupFiles=QEe(e),this.resolveSymlink=rAe(e,this.isSynchronous),this.walkDirectory=hAe(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(_=EP(_,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=xEe(_),x=EP(AP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};kJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return bAe(this.root,this.options)}withCallback(t){PJ(this.root,this.options,t)}sync(){return vAe(this.root,this.options)}},CJ=null;try{$J.resolve("picomatch"),CJ=$J("picomatch")}catch{}DJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:EJ,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 kJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new kJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||CJ;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 fp=v((Iut,zJ)=>{"use strict";var jJ="[^\\\\/]",SAe="(?=.)",MJ="[^/]",TP="(?:\\/|$)",FJ="(?:^|\\/)",OP=`\\.{1,2}${TP}`,wAe="(?!\\.)",xAe=`(?!${FJ}${OP})`,$Ae=`(?!\\.{0,1}${TP})`,kAe=`(?!${OP})`,EAe="[^.\\/]",AAe=`${MJ}*?`,TAe="/",LJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:SAe,QMARK:MJ,END_ANCHOR:TP,DOTS_SLASH:OP,NO_DOT:wAe,NO_DOTS:xAe,NO_DOT_SLASH:$Ae,NO_DOTS_SLASH:kAe,QMARK_NO_DOT:EAe,STAR:AAe,START_ANCHOR:FJ,SEP:TAe},OAe={...LJ,SLASH_LITERAL:"[\\\\/]",QMARK:jJ,STAR:`${jJ}*?`,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:"\\"},RAe={__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"};zJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:RAe,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?OAe:LJ}}});var pp=v(Fr=>{"use strict";var{REGEX_BACKSLASH:IAe,REGEX_REMOVE_BACKSLASH:PAe,REGEX_SPECIAL_CHARS:CAe,REGEX_SPECIAL_CHARS_GLOBAL:DAe}=fp();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>CAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(DAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(IAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(PAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var WJ=v((Cut,VJ)=>{"use strict";var UJ=pp(),{CHAR_ASTERISK:RP,CHAR_AT:NAe,CHAR_BACKWARD_SLASH:mp,CHAR_COMMA:jAe,CHAR_DOT:IP,CHAR_EXCLAMATION_MARK:PP,CHAR_FORWARD_SLASH:ZJ,CHAR_LEFT_CURLY_BRACE:CP,CHAR_LEFT_PARENTHESES:DP,CHAR_LEFT_SQUARE_BRACKET:MAe,CHAR_PLUS:FAe,CHAR_QUESTION_MARK:qJ,CHAR_RIGHT_CURLY_BRACE:LAe,CHAR_RIGHT_PARENTHESES:BJ,CHAR_RIGHT_SQUARE_BRACKET:zAe}=fp(),HJ=t=>t===ZJ||t===mp,GJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},UAe=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,ie=()=>c.charCodeAt(l+1),J=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),Oe&&m===!0&&d>0?(Oe=c.slice(0,d),P=c.slice(d)):m===!0?(Oe="",P=c):Oe=c,Oe&&Oe!==""&&Oe!=="/"&&Oe!==c&&HJ(Oe.charCodeAt(Oe.length-1))&&(Oe=Oe.slice(0,-1)),r.unescape===!0&&(P&&(P=UJ.removeBackslashes(P)),Oe&&_===!0&&(Oe=UJ.removeBackslashes(Oe)));let Ir={prefix:C,input:t,start:u,base:Oe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,HJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var hp=fp(),sn=pp(),{MAX_LENGTH:Iv,POSIX_REGEX_SOURCE:qAe,REGEX_NON_SPECIAL_CHARS:BAe,REGEX_SPECIAL_CHARS_BACKREF:HAe,REPLACEMENTS:KJ}=hp,GAe=(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=>sn.escapeRegex(i)).join("..")}return r},jl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,JJ=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},ZAe=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},YJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(ZAe(e))return e.replace(/\\(.)/g,"$1")},VAe=t=>{let e=t.map(YJ).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}}}}},WAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=YJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},KAe=t=>{let e=0,r=t.trim(),n=NP(r);for(;n;)e++,r=n.body.trim(),n=NP(r);return e},JAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:hp.DEFAULT_MAX_EXTGLOB_RECURSION,n=JJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||VAe(n)))return{risky:!0};for(let i of n){let o=WAe(i);if(o)return{risky:!0,safeOutput:o};if(KAe(i)>r)return{risky:!0}}return{risky:!1}},jP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=KJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Iv,r.maxLength):Iv,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=hp.globChars(r.windows),l=hp.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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={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=sn.removePrefix(t,$),i=t.length;let ie=[],J=[],Oe=[],C=o,P,Ir=()=>$.index===i-1,se=$.peek=(B=1)=>t[$.index+B],Pe=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(B="",ht=0)=>{$.consumed+=B,$.index+=ht},Yt=B=>{$.output+=B.output!=null?B.output:B.value,dr(B.value)},ao=()=>{let B=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),$.start++,B++;return B%2===0?!1:($.negated=!0,$.start++,!0)},vi=B=>{$[B]++,Oe.push(B)},Yr=B=>{$[B]--,Oe.pop()},de=B=>{if(C.type==="globstar"){let ht=$.braces>0&&(B.type==="comma"||B.type==="brace"),q=B.extglob===!0||ie.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ht&&!q&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(ie.length&&B.type!=="paren"&&(ie[ie.length-1].inner+=B.value),(B.value||B.output)&&Yt(B),C&&C.type==="text"&&B.type==="text"){C.output=(C.output||C.value)+B.value,C.value+=B.value;return}B.prev=C,s.push(B),C=B},co=(B,ht)=>{let q={...l[ht],conditions:1,inner:""};q.prev=C,q.parens=$.parens,q.output=$.output,q.startIndex=$.index,q.tokensIndex=s.length;let Ae=(r.capture?"(":"")+q.open;vi("parens"),de({type:B,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Ae}),ie.push(q)},Tde=B=>{let ht=t.slice(B.startIndex,$.index+1),q=t.slice(B.startIndex+2,$.index),Ae=JAe(q,r);if((B.type==="plus"||B.type==="star")&&Ae.risky){let lt=Ae.safeOutput?(B.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,Si=s[B.tokensIndex];Si.type="text",Si.value=ht,Si.output=lt||sn.escapeRegex(ht);for(let wi=B.tokensIndex+1;wi1&&B.inner.includes("/")&&(lt=O(r)),(lt!==D||Ir()||/^\)+$/.test(Kt()))&&(ut=B.close=`)$))${lt}`),B.inner.includes("*")&&(Lt=Kt())&&/^\.[^\\/.]+$/.test(Lt)){let Si=jP(Lt,{...e,fastpaths:!1}).output;ut=B.close=`)${Si})${lt})`}B.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ht=t.replace(HAe,(q,Ae,ut,Lt,lt,Si)=>Lt==="\\"?(B=!0,q):Lt==="?"?Ae?Ae+Lt+(lt?_.repeat(lt.length):""):Si===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):Lt==="."?u.repeat(ut.length):Lt==="*"?Ae?Ae+Lt+(lt?D:""):D:Ae?q:`\\${q}`);return B===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=sn.wrapOutput(ht,$,e),$)}for(;!Ir();){if(P=Pe(),P==="\0")continue;if(P==="\\"){let q=se();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){P+="\\",de({type:"text",value:P});continue}let Ae=/^\\+/.exec(Kt()),ut=0;if(Ae&&Ae[0].length>2&&(ut=Ae[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Pe():P+=Pe(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let q=C.value.slice(1);if(q.includes("[")&&(C.posix=!0,q.includes(":"))){let Ae=C.value.lastIndexOf("["),ut=C.value.slice(0,Ae),Lt=C.value.slice(Ae+2),lt=qAe[Lt];if(lt){C.value=ut+lt,$.backtrack=!0,Pe(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Yt({value:P});continue}if($.quotes===1&&P!=='"'){P=sn.escapeRegex(P),C.value+=P,Yt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){vi("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(jl("opening","("));let q=ie[ie.length-1];if(q&&$.parens===q.parens+1){Tde(ie.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Yr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(jl("closing","]"));P=`\\${P}`}else vi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(jl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Yr("brackets");let q=C.value.slice(1);if(C.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(P=`/${P}`),C.value+=P,Yt({value:P}),r.literalBrackets===!1||sn.hasRegexChars(q))continue;let Ae=sn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Ae,C.value=Ae;continue}C.value=`(${a}${Ae}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){vi("braces");let q={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};J.push(q),de(q);continue}if(P==="}"){let q=J[J.length-1];if(r.nobrace===!0||!q){de({type:"text",value:P,output:P});continue}let Ae=")";if(q.dots===!0){let ut=s.slice(),Lt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&Lt.unshift(ut[lt].value);Ae=GAe(Lt,r),$.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let ut=$.output.slice(0,q.outputIndex),Lt=$.tokens.slice(q.tokensIndex);q.value=q.output="\\{",P=Ae="\\}",$.output=ut;for(let lt of Lt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Ae}),Yr("braces"),J.pop();continue}if(P==="|"){ie.length>0&&ie[ie.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let q=P,Ae=J[J.length-1];Ae&&Oe[Oe.length-1]==="braces"&&(Ae.comma=!0,q="|"),de({type:"comma",value:P,output:q});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let q=J[J.length-1];C.type="dots",C.output+=P,C.value+=P,q.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){co("qmark",P);continue}if(C&&C.type==="paren"){let Ae=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){co("negate",P);continue}if(r.nonegate!==!0&&$.index===0){ao();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){co("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let q=BAe.exec(Kt());q&&(P+=q[0],$.index+=q[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let B=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){co("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let q=C.prev,Ae=q.prev,ut=q.type==="slash"||q.type==="bos",Lt=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!ut||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(q.type==="comma"||q.type==="brace"),Si=ie.length&&(q.type==="pipe"||q.type==="paren");if(!ut&&q.type!=="paren"&&!lt&&!Si){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let wi=t[$.index+4];if(wi&&wi!=="/")break;B=B.slice(3),dr("/**",3)}if(q.type==="bos"&&Ir()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!Lt&&Ir()){$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=q.output+C.output,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&B[0]==="/"){let wi=B[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${wi})`,C.value+=P,$.output+=q.output+C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&B[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(jl("closing","]"));$.output=sn.escapeLast($.output,"["),Yr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(jl("closing",")"));$.output=sn.escapeLast($.output,"("),Yr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(jl("closing","}"));$.output=sn.escapeLast($.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let B of $.tokens)$.output+=B.output!=null?B.output:B.value,B.suffix&&($.output+=B.suffix)}return $};jP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Iv,r.maxLength):Iv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=KJ[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}=hp.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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};XJ.exports=jP});var r8=v((Nut,t8)=>{"use strict";var YAe=WJ(),MP=QJ(),e8=pp(),XAe=fp(),QAe=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=QAe(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?e8.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)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(e8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):MP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>YAe(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=MP.fastpaths(t,e)),i.output||(i=MP(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=XAe;t8.exports=Rt});var s8=v((jut,o8)=>{"use strict";var n8=r8(),eTe=pp();function i8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:eTe.isWindows()}),n8(t,e,r)}Object.assign(i8,n8);o8.exports=i8});import{readdir as tTe,readdirSync as rTe,realpath as nTe,realpathSync as iTe,stat as oTe,statSync as sTe}from"fs";import{isAbsolute as aTe,posix as qa,resolve as cTe}from"path";import{fileURLToPath as lTe}from"url";function fTe(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]===".."&&dTe.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=>qa.relative(t,n)||".":n=>qa.relative(t,`${e}/${n}`)||"."}function hTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=qa.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function u8(t){var e;let r=Ml.default.scan(t,gTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function wTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Ml.default.scan(t);return r.isGlob||r.negated}function gp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function d8(t){return typeof t=="string"?[t]:t??[]}function FP(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=STe(o);s=aTe(s.replace($Te,""))?qa.relative(a,s):qa.normalize(s);let c=(i=xTe.exec(s))===null||i===void 0?void 0:i[0],l=u8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?qa.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(FP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(FP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(FP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function ETe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=kTe(t,e,n);t.debug&&gp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(c8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Ml.default)(i.match,f),m=(0,Ml.default)(i.ignore,f),h=fTe(i.match,f),g=a8(r,d,o),b=o?g:a8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new DJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&gp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return gp(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&gp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&hTe(r,d)]}function ATe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function OTe(t){let e={...TTe,...t};return e.cwd=(e.cwd instanceof URL?lTe(e.cwd):cTe(e.cwd)).replace(c8,"/"),e.ignore=d8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||tTe,readdirSync:e.fs.readdirSync||rTe,realpath:e.fs.realpath||nTe,realpathSync:e.fs.realpathSync||iTe,stat:e.fs.stat||oTe,statSync:e.fs.statSync||sTe}),e.debug&&gp("globbing with options:",e),e}function RTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=uTe(t)||typeof t=="string",i=d8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=OTe(n?e:t);return i.length>0?ETe(o,i):[]}function gs(t,e){let[r,n]=RTe(t,e);return r?ATe(r.sync(),n):[]}var Ml,uTe,c8,l8,dTe,pTe,mTe,gTe,yTe,_Te,bTe,vTe,STe,xTe,$Te,TTe,yp=y(()=>{NJ();Ml=St(s8(),1),uTe=Array.isArray,c8=/\\/g,l8=process.platform==="win32",dTe=/^(\/?\.\.)+$/;pTe=/^[A-Z]:\/$/i,mTe=l8?t=>pTe.test(t):t=>t==="/";gTe={parts:!0};yTe=/(?t.replace(yTe,"\\$&"),vTe=t=>t.replace(_Te,"\\$&"),STe=l8?vTe:bTe;xTe=/^(\/?\.\.)+/,$Te=/\\(?=[()[\]{}!*+?@|])/g;TTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as _p,readFileSync as ITe,readdirSync as PTe,statSync as f8}from"node:fs";import{join as Ba}from"node:path";function CTe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Di(e,n),o=[],{layers:s,forbiddenImports:a}=LP(r);return(s.size>0||a.length>0)&&!_p(Ba(e,i.mainRoot))?[{detector:bp,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&&(DTe(e,i,s,o),NTe(e,i,s,o)),a.length>0&&jTe(e,i,a,o),o)}function LP(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 DTe(t,e,r,n){let i=e.mainRoot,o=Ba(t,i);if(_p(o))for(let s of PTe(o)){let a=Ba(o,s);f8(a).isDirectory()&&(r.has(s)||n.push({detector:bp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function NTe(t,e,r,n){let i=e.mainRoot,o=Ba(t,i);if(_p(o))for(let s of r){let a=Ba(o,s);_p(a)&&f8(a).isDirectory()||n.push({detector:bp,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 jTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ba(t,i,s.from);if(!_p(a))continue;let c=gs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ba(a,l),d;try{d=ITe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];MTe(p,s.to,e.importStyle)&&n.push({detector:bp,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 MTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var bp,p8,zP=y(()=>{"use strict";yp();qe();Ua();bp="ARCHITECTURE_FROM_SPEC";p8={name:bp,run:CTe}});import{existsSync as FTe,readFileSync as LTe}from"node:fs";import{join as zTe}from"node:path";function qTe(t){let{cwd:e="."}=t,r=zTe(e,"spec/capabilities.yaml");if(!FTe(r))return[];let n;try{let u=LTe(r,"utf8"),d=m8.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=H(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";m8=St(Qt(),1);qe();Pv="CAPABILITIES_FEATURE_MAPPING",UTe=8;h8={name:Pv,run:qTe}});import{existsSync as BTe,readFileSync as HTe}from"node:fs";import{join as GTe}from"node:path";function ZTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function VTe(t){let{cwd:e="."}=t;return he(e,UP,r=>WTe(r,e))}function WTe(t,e){let r=Di(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=GTe(e,o);if(!BTe(s))continue;let a=HTe(s,"utf8");ZTe(a)||n.push({detector:UP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var UP,y8,_8=y(()=>{"use strict";Ua();wt();UP="CONVENTION_DRIFT";y8={name:UP,run:VTe}});import{existsSync as qP,readFileSync as b8}from"node:fs";import{join as Cv}from"node:path";function KTe(t){return JSON.parse(t).total?.lines?.pct??0}function v8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function XTe(t,e){if(!yv(dt(t).gates.coverage?.cmd))return null;let r;try{r=_v(t,e)}catch(c){return[{detector:wo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=bP.find(d=>qP(Cv(c.dir,d)));if(!l){s.push(c.path);continue}let u=v8(b8(Cv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:wo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=S8(n,i);return a0?[{detector:wo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function QTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=XTe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Di(e,r),i=dt(e).language==="kotlin"?bP.find(a=>qP(Cv(e,a)))??rJ(e):n.coverageSummary,o=Cv(e,i);if(!qP(o))return[{detector:wo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=b8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?JTe(a):n.coverageFormat==="cobertura-xml"?YTe(a):KTe(a)}catch(a){return[{detector:wo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:wo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Dv?[]:[{detector:wo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Dv}%`}]}var wo,Dv,w8,x8=y(()=>{"use strict";qe();Sv();Ua();bv();on();wo="COVERAGE_DROP",Dv=70;w8={name:wo,run:QTe}});import{existsSync as eOe}from"node:fs";import{join as tOe}from"node:path";function nOe(t){let{cwd:e="."}=t;return he(e,Nv,r=>iOe(r,e))}function iOe(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";wt();Nv="DELIVERABLE_INTEGRITY",rOe=8;$8={name:Nv,run:nOe}});function oOe(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:jv,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 sOe(t){let e=oOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:jv,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 aOe(t){let{cwd:e="."}=t;return he(e,jv,r=>sOe(r))}var jv,E8,A8=y(()=>{"use strict";wt();jv="SMOKE_PROBE_DEMAND";E8={name:jv,run:aOe}});function cOe(t){let{cwd:e="."}=t;return he(e,Mv,r=>lOe(r,e))}function lOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ss(e);if(n===null)return[{detector:Mv,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=M_(n,e,o);s.state!=="fresh"&&i.push({detector:Mv,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 Mv,Fv,BP=y(()=>{"use strict";fl();wt();Mv="STALE_ATTESTATION";Fv={name:Mv,run:cOe}});function uOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return dOe(r)}function dOe(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:T8,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 T8,Lv,HP=y(()=>{"use strict";qe();T8="DEPENDENCY_CYCLE";Lv={name:T8,run:uOe}});import{appendFileSync as fOe,existsSync as O8,mkdirSync as pOe,readFileSync as mOe}from"node:fs";import{dirname as hOe,join as gOe}from"node:path";function R8(t){return gOe(t,yOe,_Oe)}function I8(t){return GP.add(t),()=>GP.delete(t)}function Ha(t,e){let r=R8(t),n=hOe(r);O8(n)||pOe(n,{recursive:!0}),fOe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of GP)try{i(t,e)}catch{}}function Rn(t){let e=R8(t);if(!O8(e))return[];let r=mOe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var yOe,_Oe,GP,ti=y(()=>{"use strict";yOe=".cladding",_Oe="audit.log.jsonl";GP=new Set});import{existsSync as bOe}from"node:fs";import{join as vOe}from"node:path";function SOe(t){let{cwd:e="."}=t,r=Rn(e);if(r.length===0)return[{detector:ZP,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&&(bOe(vOe(e,i.artifact))||n.push({detector:ZP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var ZP,P8,C8=y(()=>{"use strict";ti();ZP="EVIDENCE_MISMATCH";P8={name:ZP,run:SOe}});import{existsSync as wOe,readFileSync as xOe}from"node:fs";import{join as $Oe}from"node:path";function kOe(t){let e=$Oe(t,M8);if(!wOe(e))return null;try{let n=((0,j8.parse)(xOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*N8(t,e){for(let r of t??[])r.startsWith(D8)&&(yield{ref:r,name:r.slice(D8.length),field:e})}function EOe(t){let{cwd:e="."}=t,r=kOe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:VP,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=[...N8(s.evidence_refs,"evidence_refs"),...N8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:VP,severity:"warn",path:M8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var j8,VP,D8,M8,F8,L8=y(()=>{"use strict";j8=St(Qt(),1);qe();VP="FIXTURE_REFERENCE_INVALID",D8="fixture:",M8="conformance/fixtures.yaml";F8={name:VP,run:EOe}});import{existsSync as Fl,readFileSync as WP}from"node:fs";import{join as Ga}from"node:path";function AOe(t){return gs(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function vp(t){if(!Fl(t))return null;try{return JSON.parse(WP(t,"utf8"))}catch{return null}}function TOe(t,e){let r=Ga(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(WP(r,"utf8"))}catch(c){e.push({detector:xo,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:xo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=AOe(t);s!==a&&e.push({detector:xo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function OOe(t,e){for(let r of z8){let n=Ga(t,r.path);if(!Fl(n))continue;let i=vp(n);if(!i){e.push({detector:xo,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:xo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function ROe(t,e){let r=vp(Ga(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of z8){let s=Ga(t,o.path);if(!Fl(s))continue;let a=vp(s);a?.version&&a.version!==n&&e.push({detector:xo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ga(t,".claude-plugin","marketplace.json");if(Fl(i)){let o=vp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:xo,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 IOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function POe(t,e){let r=Ga(t,"src","cli","clad.ts"),n=Ga(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Fl(r)||!Fl(n))return;let i=IOe(WP(r,"utf8"));if(i.length===0)return;let s=vp(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:xo,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 COe(t){let{cwd:e="."}=t,r=[];return TOe(e,r),POe(e,r),OOe(e,r),ROe(e,r),r}var xo,z8,U8,q8=y(()=>{"use strict";yp();xo="HARNESS_INTEGRITY",z8=[{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"]}];U8={name:xo,run:COe}});import{existsSync as DOe,readFileSync as NOe}from"node:fs";import{join as jOe}from"node:path";function FOe(t){let{cwd:e="."}=t;return he(e,zv,r=>zOe(r,e))}function LOe(t){let e=jOe(t,"spec/capabilities.yaml");if(!DOe(e))return!1;try{let r=B8.default.parse(NOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function zOe(t,e){let r=t.features.length;if(r{"use strict";B8=St(Qt(),1);wt();zv="HOLLOW_GOVERNANCE",MOe=8;H8={name:zv,run:FOe}});import{existsSync as Z8,readFileSync as V8}from"node:fs";import{join as W8}from"node:path";function K8(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 BOe(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 HOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function GOe(t){let e=W8(t,"README.md"),r=W8(t,"docs","dogfood","matrix.md");if(!Z8(e)||!Z8(r))return[];let n=K8(V8(e,"utf8"),UOe),i=K8(V8(r,"utf8"),qOe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=HOe(a);if(c===null)continue;let l=i[s]??"not-run",u=BOe(l);u!==null&&c>u&&o.push({detector:J8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function ZOe(t){let{cwd:e="."}=t;return GOe(e)}var J8,UOe,qOe,Y8,X8=y(()=>{"use strict";J8="HOST_CLAIM_DRIFT",UOe=//,qOe=//;Y8={name:J8,run:ZOe}});function VOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return Q8(r.features.map(i=>i.id),"feature","spec/features/",n),Q8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function Q8(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:e5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var e5,t5,r5=y(()=>{"use strict";qe();e5="ID_COLLISION";t5={name:e5,run:VOe}});import{existsSync as Sp,readFileSync as KP,readdirSync as JP,statSync as WOe,writeFileSync as i5}from"node:fs";import{join as $o}from"node:path";function n5(t){if(!Sp(t))return 0;try{return JP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function KOe(t){if(!Sp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=JP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=$o(n,o),a;try{a=WOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function JOe(t){let e=$o(t,"spec","capabilities.yaml");if(!Sp(e))return 0;try{let r=Uv.default.parse(KP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ys(t="."){let e=n5($o(t,"spec","features")),r=n5($o(t,"spec","scenarios")),n=JOe(t),i=KOe($o(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Ll(t,e){let r=$o(t,"spec.yaml");if(!Sp(r))return;let n=KP(r,"utf8"),i=YOe(n,e);i!==n&&i5(r,i)}function YOe(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 @@ -270,14 +270,14 @@ ${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 Va(t="."){let e=$o(t,"spec","features");if(!Sp(e))return!1;let r=[];for(let i of JP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Uv.parse)(KP($o(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 Za(t="."){let e=$o(t,"spec","features");if(!Sp(e))return!1;let r=[];for(let i of JP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Uv.parse)(KP($o(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 i5($o(t,"spec","index.yaml"),n,"utf8"),!0}var Uv,wp=y(()=>{"use strict";Uv=St(Qt(),1)});import{existsSync as o5,readFileSync as s5,readdirSync as XOe}from"node:fs";import{join as YP}from"node:path";function QOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=ys(e),i=r.inventory;if(!i){let s=a5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return XP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...XP(e),{detector:xp,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 a5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:xp,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(...XP(e)),o}function XP(t){let e=YP(t,"spec","index.yaml"),r=YP(t,"spec","features");if(!o5(e)||!o5(r))return[];let n=new Map;try{for(let l of s5(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 XOe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=s5(YP(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:xp,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:xp,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 xp,a5,c5,l5=y(()=>{"use strict";wp();qe();xp="INVENTORY_DRIFT",a5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];c5={name:xp,run:QOe}});import{existsSync as eRe,readFileSync as tRe}from"node:fs";import{join as rRe}from"node:path";function iRe(t){let{cwd:e="."}=t,r=rRe(e,"src","spec","schema.json"),n=[];if(eRe(r)){let i;try{i=JSON.parse(tRe(r,"utf8"))}catch(o){n.push({detector:$p,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of nRe)i.required?.includes(o)||n.push({detector:$p,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:$p,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==u5&&n.push({detector:$p,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${u5}'`})}catch{}return n}var $p,nRe,u5,d5,f5=y(()=>{"use strict";qe();$p="META_INTEGRITY",nRe=["schema","project","features"],u5="0.1";d5={name:$p,run:iRe}});function oRe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return p5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),p5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function p5(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:m5,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 m5,h5,g5=y(()=>{"use strict";qe();m5="SLUG_CONFLICT";h5={name:m5,run:oRe}});function zl(t){return t==="planned"||t==="in_progress"}var qv=y(()=>{"use strict"});import{existsSync as sRe}from"node:fs";import{join as aRe}from"node:path";function cRe(t){let{cwd:e="."}=t;return he(e,Bv,r=>lRe(r,e))}function lRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=aRe(e,i);sRe(o)||r.push(uRe(n.id,i,n.status))}return r}function uRe(t,e,r){return zl(r)?{detector:Bv,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:Bv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Bv,Hv,QP=y(()=>{"use strict";qv();wt();Bv="MISSING_IMPLEMENTATION";Hv={name:Bv,run:cRe}});function dRe(t){let{cwd:e="."}=t;return he(e,eC,fRe)}function fRe(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:eC,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 eC,Gv,tC=y(()=>{"use strict";wt();eC="MISSING_TESTS";Gv={name:eC,run:dRe}});import{existsSync as pRe,readFileSync as mRe}from"node:fs";import{join as y5}from"node:path";function _5(t){if(pRe(t))try{return JSON.parse(mRe(t,"utf8"))}catch{return}}function _Re(t){let{cwd:e="."}=t,r=_5(y5(e,hRe)),n=_5(y5(e,gRe));if(!r||!n)return[{detector:rC,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>yRe&&i.push({detector:rC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var rC,hRe,gRe,yRe,b5,v5=y(()=>{"use strict";rC="PERFORMANCE_DRIFT",hRe="perf/baseline.json",gRe="perf/current.json",yRe=10;b5={name:rC,run:_Re}});import{existsSync as bRe}from"node:fs";import{join as vRe}from"node:path";function wRe(t){let{cwd:e="."}=t;return he(e,nC,r=>$Re(r,e))}function xRe(t,e){return(t.modules??[]).some(r=>bRe(vRe(e,r)))}function $Re(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||xRe(s,e)||r.push(s.id);let n=SRe;if(r.length<=n)return[];let i=r.slice(0,S5).join(", "),o=r.length>S5?", \u2026":"";return[{detector:nC,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 nC,SRe,S5,w5,x5=y(()=>{"use strict";wt();nC="PLANNED_BACKLOG",SRe=5,S5=8;w5={name:nC,run:wRe}});import{existsSync as kRe,readFileSync as ERe}from"node:fs";import{join as ARe}from"node:path";function RRe(t){let{cwd:e="."}=t;return he(e,iC,r=>IRe(r,e))}function IRe(t,e){if(t.features.lengthn.includes(i))?[{detector:iC,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 iC,TRe,ORe,$5,k5=y(()=>{"use strict";wt();iC="PROJECT_CONTEXT_DRIFT",TRe=8,ORe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];$5={name:iC,run:RRe}});function E5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Zv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function PRe(t){let{cwd:e="."}=t;return he(e,Zv,CRe)}function CRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...E5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Zv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...E5(e,n.features,`scenario ${n.id}.features`));return r}var Zv,Vv,oC=y(()=>{"use strict";wt();Zv="REFERENCE_INTEGRITY";Vv={name:Zv,run:PRe}});function kp(t=""){return new RegExp(DRe,t)}var DRe,sC=y(()=>{"use strict";DRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as NRe,readdirSync as jRe,readFileSync as MRe,statSync as FRe,writeFileSync as LRe}from"node:fs";import{dirname as zRe,join as Ep,normalize as URe,relative as qRe}from"node:path";function VRe(t){let e=[];for(let r of t.matchAll(ZRe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(kp("g"))??[])e.push(n);return[...new Set(e)].sort()}function WRe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function A5(t){return t.split("\\").join("/")}function KRe(t){return BRe.some(e=>t===e||t.startsWith(`${e}/`))}function JRe(t){let e=Ep(t,"docs");if(!NRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=jRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Ep(i,s),c;try{c=FRe(a)}catch{continue}let l=A5(qRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function YRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=URe(Ep(zRe(t),e));return A5(r)}function Ap(t="."){let e=[];for(let r of JRe(t)){let n;try{n=MRe(Ep(t,r),"utf8")}catch{continue}let i=WRe(n),o=VRe(i);if(KRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(HRe)?[]:i.match(kp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(GRe)){let d=YRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function T5(t="."){let e=Ap(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 LRe(Ep(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var BRe,HRe,GRe,ZRe,Wv=y(()=>{"use strict";sC();BRe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],HRe="clad-doc-links: ignore",GRe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,ZRe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as XRe}from"node:fs";import{join as QRe}from"node:path";function eIe(t){let{cwd:e="."}=t;return he(e,Kv,r=>tIe(r,e))}function tIe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Ap(e).docs){for(let o of i.doc_links)XRe(QRe(e,o))||n.push({detector:Kv,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:Kv,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 Kv,Jv,aC=y(()=>{"use strict";Wv();wt();Kv="DOC_LINK_INTEGRITY";Jv={name:Kv,run:eIe}});function rIe(t){let{cwd:e="."}=t;return he(e,Tp,r=>nIe(r))}function nIe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=O5,o=t.project.onboarding_seeded===!0&&!i;r>=O5&&n.length===0&&e.push({detector:Tp,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:Tp,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:Tp,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 Tp,O5,R5,I5=y(()=>{"use strict";wt();Tp="SCENARIO_COVERAGE",O5=8;R5={name:Tp,run:rIe}});import{createHash as iIe}from"node:crypto";function oIe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Op(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??P5),sample:oIe(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(P5),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Rp(t){return(t.features??[]).filter(e=>e.status==="done").length}function sIe(t,e){return e<=0?!1:e>=1?!0:parseInt(iIe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var P5,Yv=y(()=>{"use strict";P5=["unwanted"]});import{chmodSync as aIe,existsSync as D5,readFileSync as cIe,readdirSync as lIe,statSync as N5,unlinkSync as uIe,utimesSync as dIe,writeFileSync as fIe}from"node:fs";import{join as j5}from"node:path";import M5 from"node:process";function pIe(t){return VK(t).map(e=>{try{let r=N5(e);return r.isFile()?{path:e,body:cIe(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 mIe(t){let e=[];for(let r of t)if(!r.nonFile)try{if(r.body===void 0){if(!D5(r.path))continue;if(!N5(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}uIe(r.path);continue}fIe(r.path,r.body),r.mode!==void 0&&aIe(r.path,r.mode),r.atime&&r.mtime&&dIe(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function hIe(t){let e=!1,r=n=>{for(let i of lIe(n,{withFileTypes:!0})){if(e)return;let o=j5(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 cC(t={}){let{cwd:e="."}=t,r=j5(e,_s);if(!D5(r)||!hIe(r))return{stage:Wa,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${_s}/ \u2014 skipped`};let n=dt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Wa,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o;try{o=pIe(e)}catch(d){return{stage:Wa,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=Ye(i.cmd,c,{cwd:e,reject:!1})}catch(d){a=d}let l=mIe(o);if(l.length>0)return{stage:Wa,pass:!1,exitCode:1,stderr:`could not restore the full test report after the scoped oracle run: ${l.join("; ")}`};if(a||!s)return{stage:Wa,pass:!1,exitCode:1,stderr:`oracle runner failed to start: ${a?.message??"unknown error"}`};let u=qt(Wa,i.cmd,s,c);return u||tr(Wa,s)}var Wa,_s,gIe,lC=y(()=>{"use strict";Mr();on();cp();Tn();Wa="stage_2.3",_s="tests/oracle";gIe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${M5.argv[1]}`;if(gIe){let t=cC();console.log(JSON.stringify(t)),M5.exit(t.exitCode)}});import{existsSync as yIe}from"node:fs";import{join as _Ie}from"node:path";function bIe(t){let{cwd:e="."}=t;return he(e,ri,r=>vIe(r,e))}function vIe(t,e){let r=[],n=Op(t.project,Rp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?On(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(Ip(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:ri,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(!yIe(_Ie(e,f))){r.push({detector:ri,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:ri,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:ri,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:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ri,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:ri,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:ri,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:ri,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 ri,F5,L5=y(()=>{"use strict";ti();Yv();lC();wt();ri="SPEC_CONFORMANCE";F5={name:ri,run:bIe}});function SIe(t){let{cwd:e="."}=t,r=On(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=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>z5&&i.push({detector:uC,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${z5})`})}return i}var uC,z5,U5,q5=y(()=>{"use strict";ti();uC="STALE_EVIDENCE",z5=90;U5={name:uC,run:SIe}});import{existsSync as B5}from"node:fs";import{join as H5}from"node:path";function wIe(t){let{cwd:e="."}=t;return he(e,Ul,r=>xIe(r,e))}function xIe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Ul,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:Ul,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=>B5(H5(e,o)));i.length>0&&r.push({detector:Ul,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}zl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>B5(H5(e,i)))&&r.push({detector:Ul,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 Ul,Xv,dC=y(()=>{"use strict";qv();wt();Ul="STALE_SPECIFICATION";Xv={name:Ul,run:wIe}});import{existsSync as G5,statSync as Z5}from"node:fs";import{join as V5}from"node:path";function kIe(t,e){let r=0;for(let n of e){let i=V5(t,n);if(!G5(i))continue;let o=Z5(i).mtimeMs;o>r&&(r=o)}return r}function EIe(t){let{cwd:e="."}=t;return he(e,fC,r=>AIe(r,e))}function AIe(t,e){let r=Di(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=kIe(e,n);if(i===0)return[];let o=gs([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=V5(e,a);if(!G5(c))continue;let l=Z5(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>$Ie&&s.push({detector:fC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var fC,$Ie,Qv,pC=y(()=>{"use strict";yp();qa();wt();fC="STALE_TESTS",$Ie=30;Qv={name:fC,run:EIe}});import{existsSync as TIe}from"node:fs";import{join as OIe}from"node:path";function RIe(t){let{cwd:e="."}=t;return he(e,Pp,r=>IIe(r,e))}function IIe(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:Pp,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=>!TIe(OIe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:Pp,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:Pp,severity:zl(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 Pp,eS,mC=y(()=>{"use strict";qv();wt();Pp="STATUS_DRIFT";eS={name:Pp,run:RIe}});function PIe(t){let{cwd:e="."}=t;return he(e,tS,r=>CIe(r,e))}function CIe(t,e){let r=dt(e).language;return r==="unknown"?[{detector:tS,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:tS,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var tS,W5,K5=y(()=>{"use strict";on();wt();tS="TECH_STACK_MISMATCH";W5={name:tS,run:PIe}});function MIe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function FIe(t){let{cwd:e="."}=t;return he(e,hC,r=>LIe(r,e))}function LIe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=gs([...MIe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:hC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var hC,J5,DIe,NIe,jIe,rS,gC=y(()=>{"use strict";yp();zP();wt();hC="UNMAPPED_ARTIFACT",J5=["src/stages/**/*.ts","src/spec/**/*.ts"],DIe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},NIe={kotlin:"src/main/kotlin"},jIe=8;rS={name:hC,run:FIe}});import{existsSync as Y5}from"node:fs";import{join as X5}from"node:path";function UIe(t){return zIe.some(e=>t.startsWith(e))}function qIe(t){let{cwd:e="."}=t;return he(e,yC,r=>BIe(r,e))}function BIe(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(UIe(o))continue;let s=o.split("#",1)[0];Y5(X5(e,o))||s&&Y5(X5(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: -`}HP();aC();QP();tC();oC();BP();pC();mC();gC();_C();Gm();sC();qe();var EUe=[Gv,nS,Hv,rS,Vv,Jv,Lv,eS,Qv,Fv];function AUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=kp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function Px(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{ka(e,H(e))}catch{}try{for(let o of EUe){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 AUe(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{ka(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();qe();Ai();var OUe=new Set(["mermaid","dot","json","obsidian","html"]);function Yee(t={}){try{let e=t.format??"mermaid";if(!OUe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=gc(n,".");if(t.focus){let s=Ex(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=kx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Vee(i);for(let[c,l]of a){let u=TUe(s,c);xj(kj(u),{recursive:!0}),$j(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=Ix(i,Px(i,"."));xj(kj(t.out),{recursive:!0}),$j(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"?Zee(i):r==="json"?Rx(i):Gee(i);t.out?(xj(kj(t.out),{recursive:!0}),$j(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 Xee(){try{let t=gc(H(),".");process.stdout.write(Jee(Cx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Gm();import{createServer as RUe}from"node:http";import{existsSync as IUe,watch as PUe}from"node:fs";import{join as CUe}from"node:path";qe();Ai();function DUe(t={}){let e=t.cwd??".",r=new Set,n=()=>gc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}HP();aC();QP();tC();oC();BP();pC();mC();gC();_C();Gm();sC();qe();var EUe=[Gv,nS,Hv,rS,Vv,Jv,Lv,eS,Qv,Fv];function AUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=kp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function Px(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{$a(e,H(e))}catch{}try{for(let o of EUe){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 AUe(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{$a(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();qe();Ai();var OUe=new Set(["mermaid","dot","json","obsidian","html"]);function Yee(t={}){try{let e=t.format??"mermaid";if(!OUe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=hc(n,".");if(t.focus){let s=Ex(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=kx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Vee(i);for(let[c,l]of a){let u=TUe(s,c);xj(kj(u),{recursive:!0}),$j(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=Ix(i,Px(i,"."));xj(kj(t.out),{recursive:!0}),$j(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"?Zee(i):r==="json"?Rx(i):Gee(i);t.out?(xj(kj(t.out),{recursive:!0}),$j(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 Xee(){try{let t=hc(H(),".");process.stdout.write(Jee(Cx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Gm();import{createServer as RUe}from"node:http";import{existsSync as IUe,watch as PUe}from"node:fs";import{join as CUe}from"node:path";qe();Ai();function DUe(t={}){let e=t.cwd??".",r=new Set,n=()=>hc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh `)}catch{r.delete(u)}},o=RUe((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=Rx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Px(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=Ix(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=CUe(e,u);if(IUe(d))try{let f=PUe(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 Qee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await DUe({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 NUe=["stage_1.1","stage_2.1","stage_2.3"];function jUe(t){return(t.features??[]).filter(e=>e.status==="done")}function MUe(t,e){let r=jUe(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 ete(t,e){let r=[];for(let n of NUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=MUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}gS();import tte from"node:process";function FUe(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 Dx(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=FUe(n,t);i.pass||r.push(i)}return r}ti();var Ej="stage_4.1";function Aj(t={}){let{cwd:e="."}=t,r=On(e);if(r.length===0)return{stage:Ej,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Dx(r);if(n.length===0)return{stage:Ej,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Ej,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var LUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tte.argv[1]}`;if(LUe){let t=Aj();console.log(JSON.stringify(t)),tte.exit(t.exitCode)}pl();import{randomBytes as zUe}from"node:crypto";import{unlinkSync as UUe}from"node:fs";import{tmpdir as qUe}from"node:os";import{join as BUe,resolve as Tj}from"node:path";import HUe from"node:process";var qr=null;function rte(t){qr={cwd:Tj(t),run:null,jsonFile:null}}function nte(){return qr!==null}function ite(t,e){if(!qr||qr.cwd!==Tj(t))return null;if(qr.run)return qr.run;let r=BUe(qUe(),`clad-shared-vitest-${HUe.pid}-${zUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function ote(t){return!qr||qr.cwd!==Tj(t)?null:qr.run}function ste(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function ate(){let t=qr?.jsonFile;if(qr=null,t)try{UUe(t)}catch{}}Mr();import cte from"node:process";var Nx="stage_1.4";function Oj(t={}){let{cwd:e="."}=t,r;try{r=Ye("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Nx,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:Nx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Nx,pass:!0,exitCode:0}:{stage:Nx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var GUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${cte.argv[1]}`;if(GUe){let t=Oj();console.log(JSON.stringify(t)),cte.exit(t.exitCode)}Mr();import lte from"node:process";Zm();Tn();var jx="stage_2.2";function Rj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Do("coverage",t))}catch(c){return{stage:jx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:jx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=ote(e),s=o?o.proc:Ye(r,[...n],{cwd:e,reject:!1}),a=qt(jx,r,s,n);return a||tr(jx,s)}var WUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${lte.argv[1]}`;if(WUe){let t=Rj();console.log(JSON.stringify(t)),lte.exit(t.exitCode)}Dp();Ij();Mr();on();Tn();import dte from"node:process";var zx="stage_3.2";function Pj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:zx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Nl(e,o[o.length-1]))return{stage:zx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(zx,i,s,o);return a||tr(zx,s)}var dqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dte.argv[1]}`;if(dqe){let t=Pj();console.log(JSON.stringify(t)),dte.exit(t.exitCode)}Mr();qe();Tn();import{existsSync as fqe}from"node:fs";import{resolve as pte}from"node:path";import mte from"node:process";var ai="stage_2.4",Cj=5e3,pqe=3e4;function Dj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ai,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return hqe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ai,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ai,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=pte(e,r.path);if(!fqe(s))return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Cj,c;try{c=Ye(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=qt(ai,r.path,c);if(l)return l;if(c.timedOut)return{stage:ai,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:ai,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ai,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var fte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},mqe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function hqe(t,e,r){let n=Math.min(e.length*Cj,pqe),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(gqe(t,s,r))}return yqe(o)}function gqe(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("/")?pte(t,a):a,u=Cj,d;try{d=Ye(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(La(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 yqe(t){let e="skip";for(let o of t)fte[o.disposition]>fte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${mqe[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:ai,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ai,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var _qe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${mte.argv[1]}`;if(_qe){let t=Dj();console.log(JSON.stringify(t)),mte.exit(t.exitCode)}Mr();on();Tn();import hte from"node:process";var Ux="stage_3.1";function Nj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Ux,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Nl(e,o[o.length-1]))return{stage:Ux,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Ux,i,s,o);return a||tr(Ux,s)}var bqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hte.argv[1]}`;if(bqe){let t=Nj();console.log(JSON.stringify(t)),hte.exit(t.exitCode)}lC();jj();Mj();Mr();Fx();import{randomBytes as Eqe}from"node:crypto";import{unlinkSync as Aqe}from"node:fs";import{tmpdir as Tqe}from"node:os";import{join as Oqe}from"node:path";import Lj from"node:process";Zm();Tn();qe();import{readFileSync as wqe}from"node:fs";import{resolve as _te}from"node:path";function xqe(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=_te(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 $qe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function kqe(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=$qe(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(_te(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 Fj(t,e){try{let r=xqe(wqe(t,"utf8"));return r?kqe(H(e),r,e):[]}catch{return[]}}var Ki="stage_2.1";function bte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Rqe(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];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 Iqe(t,e,r){let n,i;try{({cmd:n,args:i}=Do("coverage",t))}catch{return null}if(!n||!i||!bte(n,i))return null;let o=n,s=i,a=ite(e,d=>Ye(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(qt(Ki,n,c,s))return null;let u=tr(Ki,c);if(ste(u)==="fallback")return null;if(r){let d=Fj(l,e);if(d.length>0)return{stage:Ki,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ki,pass:!0,exitCode:0}}function zj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Do("test",t))}catch(u){return{stage:Ki,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Ki,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=bte(n,i),a=r&&s;if(nte()&&s){let u=Iqe(t,e,a);if(u)return u}let c,l=i;a&&(c=Oqe(Tqe(),`clad-vitest-${Lj.pid}-${Eqe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Ye(n,[...l],{cwd:e,reject:!1}),d=qt(Ki,n,u,l);if(d)return d;let f=Au("unit",tr(Ki,u),u);if(r&&f.pass&&Rqe(u)){let p={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Ki,pass:!1,exitCode:1,findings:[p],stderr:p.message}}if(a&&f.pass&&c){let p=Fj(c,e);if(p.length>0)return{stage:Ki,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{Aqe(c)}catch{}}}var Pqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Lj.argv[1]}`;if(Pqe){let t=zj();console.log(JSON.stringify(t)),Lj.exit(t.exitCode)}Mr();on();Tn();import vte from"node:process";var Hx="stage_3.3";function Uj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Hx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Nl(e,o[o.length-1]))return{stage:Hx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Hx,i,s,o);return a||tr(Hx,s)}var Cqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${vte.argv[1]}`;if(Cqe){let t=Uj();console.log(JSON.stringify(t)),vte.exit(t.exitCode)}dC();Cf();ya();Bj();wp();Wv();var Ate=St(Qt(),1);import{existsSync as Hj,readFileSync as Hqe,readdirSync as Ete,statSync as Gqe,writeFileSync as Zqe}from"node:fs";import{basename as Jm,join as Ym,relative as kte}from"node:path";var Vqe=["self-dogfood:","fixture:","derived:"],Tte=/\.(test|spec)\.[jt]sx?$/;function Ote(t,e=t,r=[]){let n;try{n=Ete(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Ym(e,i);try{Gqe(o).isDirectory()?Ote(t,o,r):Tte.test(i)&&r.push(o)}catch{continue}}return r}function Rte(t="."){let e=Ym(t,"spec","features"),r=Ym(t,"tests"),n=[],i=[];if(!Hj(e)||!Hj(r))return{repaired:n,suggested:i};let o=Ote(r),s=new Map;for(let a of o){let c=kte(t,a).split("\\").join("/"),l=s.get(Jm(a))??[];l.push(c),s.set(Jm(a),l)}for(let a of Ete(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Ym(e,a),l,u;try{l=Hqe(c,"utf8"),u=(0,Ate.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(Vqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Hj(Ym(t,b)))continue;let _=s.get(Jm(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=>Jm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>kte(t,h).split("\\").join("/")).find(h=>{let g=Jm(h).replace(Tte,"");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 Qee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await DUe({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 NUe=["stage_1.1","stage_2.1","stage_2.3"];function jUe(t){return(t.features??[]).filter(e=>e.status==="done")}function MUe(t,e){let r=jUe(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 ete(t,e){let r=[];for(let n of NUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=MUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}gS();import tte from"node:process";function FUe(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 Dx(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=FUe(n,t);i.pass||r.push(i)}return r}ti();var Ej="stage_4.1";function Aj(t={}){let{cwd:e="."}=t,r=Rn(e);if(r.length===0)return{stage:Ej,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Dx(r);if(n.length===0)return{stage:Ej,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Ej,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var LUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tte.argv[1]}`;if(LUe){let t=Aj();console.log(JSON.stringify(t)),tte.exit(t.exitCode)}pl();import{randomBytes as zUe}from"node:crypto";import{unlinkSync as UUe}from"node:fs";import{tmpdir as qUe}from"node:os";import{join as BUe,resolve as Tj}from"node:path";import HUe from"node:process";var qr=null;function rte(t){qr={cwd:Tj(t),run:null,jsonFile:null}}function nte(){return qr!==null}function ite(t,e){if(!qr||qr.cwd!==Tj(t))return null;if(qr.run)return qr.run;let r=BUe(qUe(),`clad-shared-vitest-${HUe.pid}-${zUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function ote(t){return!qr||qr.cwd!==Tj(t)?null:qr.run}function ste(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function ate(){let t=qr?.jsonFile;if(qr=null,t)try{UUe(t)}catch{}}Mr();import cte from"node:process";var Nx="stage_1.4";function Oj(t={}){let{cwd:e="."}=t,r;try{r=Ye("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Nx,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:Nx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Nx,pass:!0,exitCode:0}:{stage:Nx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var GUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${cte.argv[1]}`;if(GUe){let t=Oj();console.log(JSON.stringify(t)),cte.exit(t.exitCode)}Mr();import lte from"node:process";Zm();On();var jx="stage_2.2";function Rj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Do("coverage",t))}catch(c){return{stage:jx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:jx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=ote(e),s=o?o.proc:Ye(r,[...n],{cwd:e,reject:!1}),a=qt(jx,r,s,n);return a||tr(jx,s)}var WUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${lte.argv[1]}`;if(WUe){let t=Rj();console.log(JSON.stringify(t)),lte.exit(t.exitCode)}Dp();Ij();Mr();on();On();import dte from"node:process";var zx="stage_3.2";function Pj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:zx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Nl(e,o[o.length-1]))return{stage:zx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(zx,i,s,o);return a||tr(zx,s)}var dqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dte.argv[1]}`;if(dqe){let t=Pj();console.log(JSON.stringify(t)),dte.exit(t.exitCode)}Mr();qe();On();import{existsSync as fqe}from"node:fs";import{resolve as pte}from"node:path";import mte from"node:process";var ai="stage_2.4",Cj=5e3,pqe=3e4;function Dj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ai,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return hqe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ai,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ai,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=pte(e,r.path);if(!fqe(s))return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Cj,c;try{c=Ye(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=qt(ai,r.path,c);if(l)return l;if(c.timedOut)return{stage:ai,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:ai,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ai,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var fte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},mqe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function hqe(t,e,r){let n=Math.min(e.length*Cj,pqe),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(gqe(t,s,r))}return yqe(o)}function gqe(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("/")?pte(t,a):a,u=Cj,d;try{d=Ye(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Fa(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 yqe(t){let e="skip";for(let o of t)fte[o.disposition]>fte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${mqe[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:ai,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ai,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var _qe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${mte.argv[1]}`;if(_qe){let t=Dj();console.log(JSON.stringify(t)),mte.exit(t.exitCode)}Mr();on();On();import hte from"node:process";var Ux="stage_3.1";function Nj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Ux,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Nl(e,o[o.length-1]))return{stage:Ux,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Ux,i,s,o);return a||tr(Ux,s)}var bqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hte.argv[1]}`;if(bqe){let t=Nj();console.log(JSON.stringify(t)),hte.exit(t.exitCode)}lC();jj();Mj();Mr();Fx();import{randomBytes as Eqe}from"node:crypto";import{unlinkSync as Aqe}from"node:fs";import{tmpdir as Tqe}from"node:os";import{join as Oqe}from"node:path";import Lj from"node:process";Zm();On();qe();import{readFileSync as wqe}from"node:fs";import{resolve as _te}from"node:path";function xqe(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=_te(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 $qe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function kqe(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=$qe(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(_te(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 Fj(t,e){try{let r=xqe(wqe(t,"utf8"));return r?kqe(H(e),r,e):[]}catch{return[]}}var Ki="stage_2.1";function bte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Rqe(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];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 Iqe(t,e,r){let n,i;try{({cmd:n,args:i}=Do("coverage",t))}catch{return null}if(!n||!i||!bte(n,i))return null;let o=n,s=i,a=ite(e,d=>Ye(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(qt(Ki,n,c,s))return null;let u=tr(Ki,c);if(ste(u)==="fallback")return null;if(r){let d=Fj(l,e);if(d.length>0)return{stage:Ki,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ki,pass:!0,exitCode:0}}function zj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Do("test",t))}catch(u){return{stage:Ki,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Ki,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=bte(n,i),a=r&&s;if(nte()&&s){let u=Iqe(t,e,a);if(u)return u}let c,l=i;a&&(c=Oqe(Tqe(),`clad-vitest-${Lj.pid}-${Eqe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Ye(n,[...l],{cwd:e,reject:!1}),d=qt(Ki,n,u,l);if(d)return d;let f=Au("unit",tr(Ki,u),u);if(r&&f.pass&&Rqe(u)){let p={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Ki,pass:!1,exitCode:1,findings:[p],stderr:p.message}}if(a&&f.pass&&c){let p=Fj(c,e);if(p.length>0)return{stage:Ki,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{Aqe(c)}catch{}}}var Pqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Lj.argv[1]}`;if(Pqe){let t=zj();console.log(JSON.stringify(t)),Lj.exit(t.exitCode)}Mr();on();On();import vte from"node:process";var Hx="stage_3.3";function Uj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Hx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Nl(e,o[o.length-1]))return{stage:Hx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Hx,i,s,o);return a||tr(Hx,s)}var Cqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${vte.argv[1]}`;if(Cqe){let t=Uj();console.log(JSON.stringify(t)),vte.exit(t.exitCode)}dC();Cf();ga();Bj();wp();Wv();var Ate=St(Qt(),1);import{existsSync as Hj,readFileSync as Hqe,readdirSync as Ete,statSync as Gqe,writeFileSync as Zqe}from"node:fs";import{basename as Jm,join as Ym,relative as kte}from"node:path";var Vqe=["self-dogfood:","fixture:","derived:"],Tte=/\.(test|spec)\.[jt]sx?$/;function Ote(t,e=t,r=[]){let n;try{n=Ete(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Ym(e,i);try{Gqe(o).isDirectory()?Ote(t,o,r):Tte.test(i)&&r.push(o)}catch{continue}}return r}function Rte(t="."){let e=Ym(t,"spec","features"),r=Ym(t,"tests"),n=[],i=[];if(!Hj(e)||!Hj(r))return{repaired:n,suggested:i};let o=Ote(r),s=new Map;for(let a of o){let c=kte(t,a).split("\\").join("/"),l=s.get(Jm(a))??[];l.push(c),s.set(Jm(a),l)}for(let a of Ete(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Ym(e,a),l,u;try{l=Hqe(c,"utf8"),u=(0,Ate.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(Vqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Hj(Ym(t,b)))continue;let _=s.get(Jm(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=>Jm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>kte(t,h).split("\\").join("/")).find(h=>{let g=Jm(h).replace(Tte,"");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&&Zqe(c,l,"utf8")}return{repaired:n,suggested:i}}fl();import{existsSync as Wqe,readFileSync as Kqe}from"node:fs";import{join as Jqe}from"node:path";function Yqe(t,e){let r=Jqe(t,e);if(!Wqe(r))return[];let n=[];for(let i of Kqe(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 Ite(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=>Yqe(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 Pte(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(` -`)}Yv();qe();Ai();ti();fl();var Gj=["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"],Xqe=[...Gj,"att"];function Qqe(t,e,r){if(e.startsWith("stage_4")){let n=On(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Dx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function e4e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":M_(e,r,t).state==="fresh"?"\u2713":"!"}function Wx(t,e="."){let r=ss(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Gj.map(o=>Qqe(i,o,e)),e4e(i,r,e)]}));return{columns:Xqe,rows:n}}function Cte(t,e=".",r={}){let n=r.internal??!1,i=Wx(t,e),o=[...Gj.map(c=>n?c.replace("stage_",""):t4e(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 t4e(t){return Aa(t).slice(0,3)}async function k8e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Kue(),Wue)),Promise.resolve().then(()=>(ede(),Que)),Promise.resolve().then(()=>(Wp(),i7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Mee(s),prepareInit:({cwd:s,mode:a,intent:c})=>Nee(s,a,c),initialize:lj,prepareClarify:(s,{cwd:a})=>jee(a,s),clarify:pj,resolveReview:(s,{cwd:a})=>Iee(s,{cwd:a})}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function E8e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await lj({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){V.stdout.write(`${JSON.stringify(n,null,2)} +`)}Yv();qe();Ai();ti();fl();var Gj=["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"],Xqe=[...Gj,"att"];function Qqe(t,e,r){if(e.startsWith("stage_4")){let n=Rn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Dx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function e4e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":M_(e,r,t).state==="fresh"?"\u2713":"!"}function Wx(t,e="."){let r=ss(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Gj.map(o=>Qqe(i,o,e)),e4e(i,r,e)]}));return{columns:Xqe,rows:n}}function Cte(t,e=".",r={}){let n=r.internal??!1,i=Wx(t,e),o=[...Gj.map(c=>n?c.replace("stage_",""):t4e(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 t4e(t){return Ea(t).slice(0,3)}async function A8e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Kue(),Wue)),Promise.resolve().then(()=>(ede(),Que)),Promise.resolve().then(()=>(Wp(),i7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Mee(s),prepareInit:({cwd:s,mode:a,intent:c})=>Nee(s,a,c),initialize:lj,prepareClarify:(s,{cwd:a})=>jee(a,s),clarify:pj,resolveReview:(s,{cwd:a})=>Iee(s,{cwd:a})}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function T8e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await lj({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){V.stdout.write(`${JSON.stringify(n,null,2)} `),V.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){V.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())V.stdout.write(` ${o+1}. ${s} @@ -917,30 +917,30 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&Zqe(c,l,"u `),V.stdout.write(` e.g. clad init payment SaaS for B2B `),V.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));V.exit(0)}async function A8e(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(()=>(kde(),$de)),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}`),V.stdout.write(`${JSON.stringify(n,null,2)} +`));V.exit(0)}async function O8e(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(()=>(kde(),$de)),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}`),V.stdout.write(`${JSON.stringify(n,null,2)} `);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>tR(l,s)),c=`${oG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&V.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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function T8e(t={}){try{let e=H();if(ga("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ys(".");Ll(".",r),Va("."),T5(".");let n=Yl(".");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=Rte(".");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=Vx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Xv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.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)`),V.exit(0);return}L("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){L("fail","sync",e.message),V.exit(1)}}function O8e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=v_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function R8e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=S_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}w_(".",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?V.stdout.write(`Run: git checkout ${r.gitHead} +`)}let o=n.stubsCreated.length>0;o&&L("fail","run",`produced ${n.stubsCreated.length} empty auto-stub(s) and implemented nothing \u2014 the headless code-author needs a real LLM transport (set ANTHROPIC_API_KEY) or use the host-delegated path (clad serve + your AI host). This run did NOT do the work.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function R8e(t={}){try{let e=H();if(ha("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ys(".");Ll(".",r),Za("."),T5(".");let n=Yl(".");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=Rte(".");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=Vx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Xv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.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)`),V.exit(0);return}L("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){L("fail","sync",e.message),V.exit(1)}}function I8e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=v_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function P8e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=S_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}w_(".",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?V.stdout.write(`Run: git checkout ${r.gitHead} `):V.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),V.exit(0)}async function I8e(t){let e=t.host&&t.host!=="all"?[t.host]:void 0,r=await HC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});V.exit(r.errors.length>0?1:0)}async function P8e(){L("note","update","reconciling the current project after the engine upgrade");let t=await $X(".",{wireHosts:async()=>(await HC({quiet:!0,projectRoot:"."})).errors.length});if(L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){L("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}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);V.stdout.write(` +`),V.exit(0)}async function C8e(t){let e=t.host&&t.host!=="all"?[t.host]:void 0,r=await HC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});V.exit(r.errors.length>0?1:0)}async function D8e(){L("note","update","reconciling the current project after the engine upgrade");let t=await $X(".",{wireHosts:async()=>(await HC({quiet:!0,projectRoot:"."})).errors.length});if(L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){L("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}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);V.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),SA({tier:"pre-commit",strict:!0}).anyFailed?V.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"),V.exit(t.code)}var C8e={"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 SA(t){let e=t.tier??"all",r=t.silent===!0,n=C8e[e];if(!n)return t.json&&!r?V.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",()=>Wm(i)],["stage_1.2",()=>Vm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",Oj],["stage_1.5",Qa],["stage_1.6",Up],["stage_2.1",()=>zj({...i,strict:t.strict})],["stage_2.2",()=>Rj(i)],["stage_2.3",cC],["stage_2.4",Dj],["stage_3.1",Nj],["stage_3.2",Pj],["stage_3.3",Uj],["stage_4.1",Aj],["stage_4.2",Km]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ii(d)?"fail":"skip",u=[];F_("."),rte(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Aa(d),h=dX(p);ii(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),ii(h)&&U8e(p))}}finally{z_(),ate()}if(t.strict)try{let d=H();for(let f of ete(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"||!ii(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=>ii(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(ga("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{kG(".",H())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function D8e(t){try{let e=H(),r=ol(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} -`),V.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),V.exit(1)}}function N8e(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} -`),V.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),V.exit(1)}}function j8e(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=iS(e,o=>{try{return Ade(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),V.exit(0)}catch(e){L("fail","infer-deps",e.message),V.exit(1)}}function M8e(t={}){try{if(t.sessions){zee(t);return}if(t.trend!==void 0&&t.trend!==!1){Uee(t);return}let e=H(),n=$H(e,o=>{try{return Ade(o,"utf8")}catch{return null}},"."),i=EH(".",n);if(t.json)V.stdout.write(`${JSON.stringify(n,null,2)} +`),SA({tier:"pre-commit",strict:!0}).anyFailed?V.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"),V.exit(t.code)}var N8e={"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 SA(t){let e=t.tier??"all",r=t.silent===!0,n=N8e[e];if(!n)return t.json&&!r?V.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",()=>Wm(i)],["stage_1.2",()=>Vm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",Oj],["stage_1.5",Xa],["stage_1.6",Up],["stage_2.1",()=>zj({...i,strict:t.strict})],["stage_2.2",()=>Rj(i)],["stage_2.3",cC],["stage_2.4",Dj],["stage_3.1",Nj],["stage_3.2",Pj],["stage_3.3",Uj],["stage_4.1",Aj],["stage_4.2",Km]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ii(d)?"fail":"skip",u=[];F_("."),rte(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ea(d),h=dX(p);ii(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),ii(h)&&B8e(p))}}finally{z_(),ate()}if(t.strict)try{let d=H();for(let f of ete(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"||!ii(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=>ii(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(ha("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{kG(".",H())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function j8e(t){try{let e=H(),r=ol(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} +`),V.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),V.exit(1)}}function M8e(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} +`),V.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),V.exit(1)}}function F8e(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=iS(e,o=>{try{return Ade(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),V.exit(0)}catch(e){L("fail","infer-deps",e.message),V.exit(1)}}function L8e(t={}){try{if(t.sessions){zee(t);return}if(t.trend!==void 0&&t.trend!==!1){Uee(t);return}let e=H(),n=$H(e,o=>{try{return Ade(o,"utf8")}catch{return null}},"."),i=EH(".",n);if(t.json)V.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)}`,` ${sl}`];V.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)")}V.exit(0)}catch(e){L("fail","measure",e.message),V.exit(1)}}function F8e(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),V.exit(1)}V.exitCode=SA({...t,focusModules:e}).worst}function L8e(t){let e=ZY(".",t,{checkStages:SA,onIndex:Va,gitOpInProgress:SO});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function z8e(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.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)")}V.exit(0)}catch(e){L("fail","measure",e.message),V.exit(1)}}function z8e(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),V.exit(1)}V.exitCode=SA({...t,focusModules:e}).worst}function U8e(t){let e=ZY(".",t,{checkStages:SA,onIndex:Za,gitOpInProgress:SO});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function q8e(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') `);let o=C5(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),V.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";V.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}V.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. `),V.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"),V.exit(1);return}let i=Ite(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`),V.exit(1);return}V.stdout.write(`${Pte(i)} -`),V.exit(0)}function U8e(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=Ede(Ff(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] +`),V.exit(0)}function B8e(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=Ede(Ff(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&V.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` `).find(r=>r.trim().length>0);e&&V.stdout.write(` ${Ede(e.trim(),160)} -`)}}function Ede(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function q8e(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(Wx(e,"."),null,2)} +`)}}function Ede(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function H8e(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(Wx(e,"."),null,2)} `),V.exitCode=0;return}V.stdout.write(`${Cte(e,".",{internal:t.internal})} -`),V.exit(0)}function B8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function H8e(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"),V.exit(1);return}let n;try{let i=H(e),o=Wx(i,e),s={gitHead:ba(e),version:Gl(),generatedAt:t.now??new Date().toISOString()},a=ll(i),c;try{let l=t.since??ts(e),u=rs(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:al(u),auditMarkdown:cl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=yG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),V.exit(1);return}try{$8e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}L("pass","bundle",`${r} \xB7 ${B8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function G8e(t){let e=zA(t);L("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function Z8e(){let t=new h4;t.name("clad").description("Reference Ironclad CLI").version("0.8.3"),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(E8e),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(A8e),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(T8e),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 all hosts (default) or one of: claude, codex, gemini, antigravity, cursor","all").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(I8e),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(P8e),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(F8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(O8e),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(L8e),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)=>z8e(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(R8e),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(q8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(D8e),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)=>N8e(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=>bX(r,{checkStages:SA})),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=>j8e(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=>M8e(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=>Yee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Xee()),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=>{Qee(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-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>mY(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=>H8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(G8e),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(uX),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(k8e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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){BY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}yY(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(Dee),t}var V8e=!!globalThis.__CLADDING_BUNDLED,W8e=V8e||import.meta.url===`file://${V.argv[1]}`;W8e&&Z8e().parse();export{C8e as TIER_STAGES,Z8e as createProgram,H8e as runBundleCommand,F8e as runCheckCommand,SA as runCheckStages,O8e as runCheckpointCommand,D8e as runContextCommand,L8e as runDoneCommand,N8e as runImpactCommand,j8e as runInferDepsCommand,E8e as runInitCommand,M8e as runMeasureCommand,z8e as runOracleCommand,R8e as runRollbackCommand,G8e as runRouteCommand,A8e as runRunCommand,k8e as runServeCommand,I8e as runSetupCommand,q8e as runStatusCommand,T8e as runSyncCommand,P8e as runUpdateCommand}; +`),V.exit(0)}function G8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function Z8e(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"),V.exit(1);return}let n;try{let i=H(e),o=Wx(i,e),s={gitHead:_a(e),version:Gl(),generatedAt:t.now??new Date().toISOString()},a=ll(i),c;try{let l=t.since??ts(e),u=rs(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:al(u),auditMarkdown:cl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=yG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),V.exit(1);return}try{E8e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}L("pass","bundle",`${r} \xB7 ${G8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function V8e(t){let e=zA(t);L("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function W8e(){let t=new h4;t.name("clad").description("Reference Ironclad CLI").version("0.9.0"),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(T8e),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(O8e),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(R8e),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 all hosts (default) or one of: claude, codex, gemini, antigravity, cursor","all").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(C8e),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(D8e),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(z8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(I8e),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(U8e),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)=>q8e(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(P8e),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(H8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(j8e),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)=>M8e(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=>bX(r,{checkStages:SA})),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=>F8e(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=>L8e(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=>Yee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Xee()),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=>{Qee(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-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>mY(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=>Z8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(V8e),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(uX),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(A8e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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){BY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}yY(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(Dee),t}var K8e=!!globalThis.__CLADDING_BUNDLED,J8e=K8e||import.meta.url===`file://${V.argv[1]}`;J8e&&W8e().parse();export{N8e as TIER_STAGES,W8e as createProgram,Z8e as runBundleCommand,z8e as runCheckCommand,SA as runCheckStages,I8e as runCheckpointCommand,j8e as runContextCommand,U8e as runDoneCommand,M8e as runImpactCommand,F8e as runInferDepsCommand,T8e as runInitCommand,L8e as runMeasureCommand,q8e as runOracleCommand,P8e as runRollbackCommand,V8e as runRouteCommand,O8e as runRunCommand,A8e as runServeCommand,C8e as runSetupCommand,H8e as runStatusCommand,R8e as runSyncCommand,D8e as runUpdateCommand}; diff --git a/plugins/codex/.codex-plugin/plugin.json b/plugins/codex/.codex-plugin/plugin.json index 7542c329..f2d4db20 100644 --- a/plugins/codex/.codex-plugin/plugin.json +++ b/plugins/codex/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.8.3", + "version": "0.9.0", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for OpenAI Codex CLI / IDE / cloud. Exposes spec validation, drift detection, the Iron Law stage runner, and 5 agent personas as Codex skills + an auto-launched MCP server.", "author": { "name": "qwerfunch", diff --git a/plugins/gemini-cli/gemini-extension.json b/plugins/gemini-cli/gemini-extension.json index e44a0f31..bf5cf111 100644 --- a/plugins/gemini-cli/gemini-extension.json +++ b/plugins/gemini-cli/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.8.3", + "version": "0.9.0", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Gemini CLI. Exposes spec validation, drift detection, 15 Iron Law stages, and 5 agent personas as custom commands + an auto-launched MCP server.", "contextFileName": "GEMINI.md", "mcpServers": { diff --git a/scripts/test-count.d.mts b/scripts/test-count.d.mts new file mode 100644 index 00000000..dbcac956 --- /dev/null +++ b/scripts/test-count.d.mts @@ -0,0 +1,52 @@ +/** A public all-pass claim represented as `[passed, total]`. */ +export type TestCountPair = readonly [number, number]; + +/** + * Extracts the badge and release-status claim pairs from a README variant. + * + * @param body README source text. + * @param kind README representation. + * @returns Public pass and total pairs. + */ +export function claimPairs(body: string, kind: 'markdown' | 'html'): TestCountPair[]; + +/** + * Validates a README variant against the collected test total. + * + * @param body README source text. + * @param kind README representation. + * @param expected Collected Vitest total. + * @param file Diagnostic file label. + * @throws When the public claim is missing, partial, or stale. + */ +export function checkClaimText( + body: string, + kind: 'markdown' | 'html', + expected: number, + file?: string, +): void; + +/** + * Rewrites both public claims in a validated README variant. + * + * @param body README source text. + * @param kind README representation. + * @param expected Collected Vitest total. + * @param file Diagnostic file label. + * @returns README text with both claims updated. + * @throws When the existing public claim is malformed or partial. + */ +export function rewriteClaimText( + body: string, + kind: 'markdown' | 'html', + expected: number, + file?: string, +): string; + +/** + * Returns the number of tests currently collected by Vitest. + * + * @returns Number of collected Vitest tests. + * @throws When collection fails or returns an empty suite. + */ +export function collectTestCount(): number; diff --git a/scripts/test-count.mjs b/scripts/test-count.mjs new file mode 100644 index 00000000..10dd35b3 --- /dev/null +++ b/scripts/test-count.mjs @@ -0,0 +1,140 @@ +#!/usr/bin/env node +// Cladding · public test-count consistency guard (F-898783ee). +// +// Public test totals are derived from Vitest collection rather than a manually +// remembered number. `--check` is release-safe and read-only; `--write` updates +// every published README variant only after all six claim sites validate. + +import {spawnSync} from 'node:child_process'; +import {readFileSync, writeFileSync} from 'node:fs'; +import {dirname, join, resolve} from 'node:path'; +import process from 'node:process'; +import {fileURLToPath} from 'node:url'; + +const ROOT = dirname(dirname(fileURLToPath(import.meta.url))); +const SITES = [ + {file: 'README.md', kind: 'markdown'}, + {file: 'README.ko.md', kind: 'markdown'}, + {file: 'README.ja.md', kind: 'markdown'}, + {file: 'README.zh.md', kind: 'markdown'}, + {file: 'README.html', kind: 'html'}, + {file: 'README.ko.html', kind: 'html'}, +]; + +const BADGE_RE = /tests-(\d+)%2F(\d+)-brightgreen/g; +const MARKDOWN_STATUS_RE = /\|\s*(\d+)\s*\/\s*(\d+)(?=\s*(?:\||·))/g; +const HTML_STATUS_RE = />(\d+)\/(\d+)<\/span>/g; + +/** + * Returns the two public pass/total pairs from one README variant. + * + * @param {string} body README source text. + * @param {'markdown'|'html'} kind README representation. + * @returns {Array<[number, number]>} Public pass and total pairs. + */ +export function claimPairs(body, kind) { + const badge = [...body.matchAll(BADGE_RE)].map((match) => [Number(match[1]), Number(match[2])]); + const statusPattern = kind === 'html' ? HTML_STATUS_RE : MARKDOWN_STATUS_RE; + const status = [...body.matchAll(statusPattern)].map((match) => [Number(match[1]), Number(match[2])]); + return [...badge, ...status]; +} + +/** + * Validates one README claim surface against the collected test count. + * + * @param {string} body README source text. + * @param {'markdown'|'html'} kind README representation. + * @param {number} expected Collected Vitest total. + * @param {string} file Diagnostic file label. + * @returns {void} + * @throws {Error} When the public claim is missing, partial, or stale. + */ +export function checkClaimText(body, kind, expected, file = '') { + const pairs = claimPairs(body, kind); + if (pairs.length !== 2) { + throw new Error(`${file}: expected one test badge and one status total; found ${pairs.length} claims`); + } + for (const [passed, total] of pairs) { + if (passed !== total) throw new Error(`${file}: public test claim is not all-pass (${passed}/${total})`); + if (total !== expected) throw new Error(`${file}: claims ${total} tests; Vitest collects ${expected}`); + } +} + +/** + * Rewrites one already-valid README claim surface to a new collected total. + * + * @param {string} body README source text. + * @param {'markdown'|'html'} kind README representation. + * @param {number} expected Collected Vitest total. + * @param {string} file Diagnostic file label. + * @returns {string} README text with both claims updated. + * @throws {Error} When the existing public claim is malformed or partial. + */ +export function rewriteClaimText(body, kind, expected, file = '') { + const pairs = claimPairs(body, kind); + if (pairs.length !== 2 || pairs.some(([passed, total]) => passed !== total)) { + throw new Error(`${file}: refusing to rewrite malformed or partial test-count claims`); + } + const statusPattern = kind === 'html' ? HTML_STATUS_RE : MARKDOWN_STATUS_RE; + const badgeUpdated = body.replace(BADGE_RE, `tests-${expected}%2F${expected}-brightgreen`); + return badgeUpdated.replace(statusPattern, (match) => { + if (kind === 'html') { + return `>${expected}/${expected}`; + } + return match.replace(/\d+\s*\/\s*\d+/, `${expected} / ${expected}`); + }); +} + +/** + * Collects the exact number of tests Vitest would execute without running them. + * + * @returns {number} Number of collected Vitest tests. + * @throws {Error} When collection fails or returns an empty suite. + */ +export function collectTestCount() { + const vitest = join(ROOT, 'node_modules', 'vitest', 'vitest.mjs'); + const result = spawnSync(process.execPath, [vitest, 'list', '--json'], { + cwd: ROOT, + encoding: 'utf8', + maxBuffer: 16 * 1024 * 1024, + }); + if (result.status !== 0) { + throw new Error(`Vitest collection failed: ${(result.stderr || result.stdout).trim()}`); + } + const collected = JSON.parse(result.stdout); + if (!Array.isArray(collected) || collected.length === 0) { + throw new Error('Vitest collection returned no tests'); + } + return collected.length; +} + +function main() { + const mode = process.argv[2] ?? '--check'; + if (!['--check', '--write'].includes(mode) || process.argv.length > 3) { + throw new Error('usage: node scripts/test-count.mjs [--check|--write]'); + } + const expected = collectTestCount(); + const bodies = new Map(); + for (const site of SITES) { + const body = readFileSync(join(ROOT, site.file), 'utf8'); + bodies.set(site.file, body); + if (mode === '--check') checkClaimText(body, site.kind, expected, site.file); + else rewriteClaimText(body, site.kind, expected, site.file); + } + if (mode === '--write') { + for (const site of SITES) { + const next = rewriteClaimText(bodies.get(site.file), site.kind, expected, site.file); + writeFileSync(join(ROOT, site.file), next, 'utf8'); + } + } + process.stdout.write(`cladding test-count: ${expected} tests · ${mode.slice(2)} passed\n`); +} + +if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) { + try { + main(); + } catch (error) { + process.stderr.write(`cladding test-count: ${(error).message}\n`); + process.exit(1); + } +} diff --git a/scripts/version-bump.mjs b/scripts/version-bump.mjs index 07968feb..f5e67625 100644 --- a/scripts/version-bump.mjs +++ b/scripts/version-bump.mjs @@ -1,7 +1,7 @@ #!/usr/bin/env node // Cladding · version bump script (v0.3.15, F-090). // -// Atomically bumps the version string across the nine files where +// Atomically bumps the version string across the eleven sites where // it lives so two contributors don't have to manually hand-edit each // location and risk drifting them. HARNESS_INTEGRITY already catches // post-hoc drift, but doing the bump in one shot avoids the catch @@ -14,7 +14,7 @@ // The script: // 1. validates the target version against SemVer (major.minor.patch) // 2. reads the current version from package.json -// 3. updates all nine sites with a literal string replace +// 3. validates all eleven sites before writing any file // 4. prints a summary of what changed // // It does NOT touch CHANGELOG.md, git, or run the build. Those are @@ -45,52 +45,64 @@ const SITES = [ /"version": "(\d+\.\d+\.\d+)"/, (v) => `"version": "${v}"`, ), - // 2. plugins/claude-code/.claude-plugin/plugin.json + // 2-3. package-lock.json — npm mirrors the root package version at the + // top level and in packages[""]. Both must move with package.json. + siteFor( + 'package-lock.json', + /\{\n "name": "cladding",\n "version": "(\d+\.\d+\.\d+)"/, + (v) => `{\n "name": "cladding",\n "version": "${v}"`, + ), + siteFor( + 'package-lock.json', + /"packages": \{\n "": \{\n "name": "cladding",\n "version": "(\d+\.\d+\.\d+)"/, + (v) => `"packages": {\n "": {\n "name": "cladding",\n "version": "${v}"`, + ), + // 4. plugins/claude-code/.claude-plugin/plugin.json // (root .claude-plugin/ holds marketplace.json; the Claude plugin - // manifest lives under plugins/claude-code/, mirroring codex at SITE 3. + // manifest lives under plugins/claude-code/, mirroring codex at SITE 5. // The old root path was stale and made `version-bump` error on the repo.) siteFor( 'plugins/claude-code/.claude-plugin/plugin.json', /"version": "(\d+\.\d+\.\d+)"/, (v) => `"version": "${v}"`, ), - // 3. plugins/codex/.codex-plugin/plugin.json + // 5. plugins/codex/.codex-plugin/plugin.json siteFor( 'plugins/codex/.codex-plugin/plugin.json', /"version": "(\d+\.\d+\.\d+)"/, (v) => `"version": "${v}"`, ), - // 4. plugins/gemini-cli/gemini-extension.json + // 6. plugins/gemini-cli/gemini-extension.json siteFor( 'plugins/gemini-cli/gemini-extension.json', /"version": "(\d+\.\d+\.\d+)"/, (v) => `"version": "${v}"`, ), - // 5. src/cli/clad.ts — `.version('X.Y.Z')` chain on commander Program + // 7. src/cli/clad.ts — `.version('X.Y.Z')` chain on commander Program siteFor( 'src/cli/clad.ts', /\.version\('(\d+\.\d+\.\d+)'\)/, (v) => `.version('${v}')`, ), - // 6. src/serve/server.ts — fallback `version: opts.version ?? 'X.Y.Z'` + // 8. src/serve/server.ts — fallback `version: opts.version ?? 'X.Y.Z'` siteFor( 'src/serve/server.ts', /version: opts\.version \?\? '(\d+\.\d+\.\d+)'/, (v) => `version: opts.version ?? '${v}'`, ), - // 7. tests/cli/clad.test.ts — `expect(program.version()).toBe('X.Y.Z')` + // 9. tests/cli/clad.test.ts — `expect(program.version()).toBe('X.Y.Z')` siteFor( 'tests/cli/clad.test.ts', /expect\(program\.version\(\)\)\.toBe\('(\d+\.\d+\.\d+)'\)/, (v) => `expect(program.version()).toBe('${v}')`, ), - // 8. spec.yaml — project.version (Tier A SSoT must track the binary) + // 10. spec.yaml — project.version (Tier A SSoT must track the binary) siteFor( 'spec.yaml', / version: "(\d+\.\d+\.\d+)"/, (v) => ` version: "${v}"`, ), - // 9. .claude-plugin/marketplace.json — the marketplace CATALOG entry the + // 11. .claude-plugin/marketplace.json — the marketplace CATALOG entry the // Claude Code host reads to detect "update available". Nested under // plugins[0].version; it is the only "version" key in the file, so the // shared anchor is unambiguous. It is NOT a HOST manifest, so @@ -120,13 +132,20 @@ function main() { const changes = []; const errors = []; + const originalBodies = new Map(); + const nextBodies = new Map(); for (const site of SITES) { let body; - try { - body = readFileSync(site.file, 'utf8'); - } catch (err) { - errors.push(`${site.file}: cannot read (${err.message})`); - continue; + if (nextBodies.has(site.file)) { + body = nextBodies.get(site.file); + } else { + try { + body = readFileSync(site.file, 'utf8'); + originalBodies.set(site.file, body); + } catch (err) { + errors.push(`${site.file}: cannot read (${err.message})`); + continue; + } } const match = site.anchor.exec(body); if (!match) { @@ -144,7 +163,7 @@ function main() { errors.push(`${site.file}: replacement matched anchor but produced no diff — bug in formatNew`); continue; } - writeFileSync(site.file, next, 'utf8'); + nextBodies.set(site.file, next); changes.push(`${site.file}: ${oldVersion} → ${newVersion}`); } @@ -154,7 +173,34 @@ function main() { for (const e of errors) process.stderr.write(` ${e}\n`); process.exit(1); } - process.stdout.write(`\ncladding version-bump: ${changes.length} files updated to ${newVersion}\n`); + let writtenFiles = 0; + const attemptedFiles = []; + try { + for (const [file, body] of nextBodies) { + if (body === originalBodies.get(file)) continue; + writeFileSync(file, body, 'utf8'); + attemptedFiles.push(file); + writtenFiles++; + } + } catch (error) { + const rollbackErrors = []; + for (const file of attemptedFiles.reverse()) { + try { + writeFileSync(file, originalBodies.get(file), 'utf8'); + } catch (rollbackError) { + rollbackErrors.push(`${file}: ${rollbackError.message}`); + } + } + process.stderr.write(`\nwrite failed; version files restored: ${error.message}\n`); + for (const rollbackError of rollbackErrors) { + process.stderr.write(` rollback failed — ${rollbackError}\n`); + } + process.exit(1); + } + process.stdout.write( + `\ncladding version-bump: ${changes.length} version sites checked; ` + + `${writtenFiles} files updated to ${newVersion}\n`, + ); } main(); diff --git a/spec.yaml b/spec.yaml index c2e58494..89d69eca 100644 --- a/spec.yaml +++ b/spec.yaml @@ -11,7 +11,7 @@ project: name: cladding language: typescript description: "Reference implementation of the Ironclad harness for AI-coupled software." - version: "0.8.3" + version: "0.9.0" repository: "https://github.com/qwerfunch/cladding" intent_summary: "Make AI-coupled development measurably safer and more honest — 41 drift detectors + 4-tier SSoT governance + A/B-measurable cladding-vs-vanilla evaluation." deliverable: @@ -57,4 +57,4 @@ inventory: features: 255 scenarios: 2 capabilities: 6 - test_files: 236 + test_files: 237 diff --git a/spec/features/natural-language-init-0f4dd6.yaml b/spec/features/natural-language-init-0f4dd6.yaml index 17a6436c..77e5899c 100644 --- a/spec/features/natural-language-init-0f4dd6.yaml +++ b/spec/features/natural-language-init-0f4dd6.yaml @@ -67,6 +67,7 @@ acceptance_criteria: the planning document is neither truncated nor mistaken for literal intent. test_refs: [ tests/serve/init-tools.test.ts ] + notes: "WHY: Node's permissive utf8 string decoder replaces malformed bytes; the MCP boundary uses a fatal UTF-8 decoder so a binary or corrupt document cannot silently become different intent." - id: AC-004 ears: event condition: when initialization adopts an existing project @@ -271,8 +272,10 @@ acceptance_criteria: [ tests/init/skill-activation.test.ts, tests/cli/setup.test.ts, - tests/serve/server.test.ts + tests/serve/server.test.ts, + tests/serve/init-tools.test.ts ] + notes: "WHY: hiding post-init MCP tools removes their descriptions from pre-init model context; rejecting only at execution time did not satisfy the narrow-bootstrap context boundary." - id: AC-018 ears: event condition: when project-scoped setup finds a legacy global Cladding integration diff --git a/spec/features/self-count-guard-898783ee.yaml b/spec/features/self-count-guard-898783ee.yaml index 3bd8355a..8f527524 100644 --- a/spec/features/self-count-guard-898783ee.yaml +++ b/spec/features/self-count-guard-898783ee.yaml @@ -4,6 +4,16 @@ title: "Self-consistency guard for public counts + doc drift repair" status: done modules: - tests/self-consistency.test.ts + - scripts/test-count.mjs + - scripts/test-count.d.mts + - tests/scripts/test-count.test.ts + - package.json + - README.md + - README.ko.md + - README.ja.md + - README.zh.md + - README.html + - README.ko.html - src/stages/detectors/README.md - docs/README.md - docs/img/en/ecosystem.svg @@ -33,3 +43,9 @@ acceptance_criteria: text: "docs/README.md tier index shall list every live doc under docs/ (adding the previously missing rows: glossary, feature-cycle, gate-scope, ssot-testing, knowledge-graph/design)." evidence_refs: ["docs/README.md"] notes: "WHY: the index omissions made live docs read as orphaned; several deletion candidates in the 2026-07 audit were misjudged dead partly because the index never listed them." + - id: AC-8ded2bb9 + ears: event + condition: "when Vitest's collected test total differs from a public README badge or release-status total" + text: "The release build shall fail with the file and collected total, while the explicit write mode shall update all six Markdown and HTML README variants only after every claim surface validates." + test_refs: ["tests/scripts/test-count.test.ts"] + notes: "WHY: the public 2522/2522 claim lagged the live 2551-test suite; deriving the number at build time prevents the reference implementation from publishing another stale all-pass total." diff --git a/spec/features/version-bump-script-6d943d.yaml b/spec/features/version-bump-script-6d943d.yaml index 3d81a0bd..03e7eead 100644 --- a/spec/features/version-bump-script-6d943d.yaml +++ b/spec/features/version-bump-script-6d943d.yaml @@ -1,17 +1,19 @@ id: F-6d943d slug: version-bump-script -title: Atomic version-bump script — single command for 7 sync sites (v0.3.15) +title: Atomic version-bump script — single command for 11 sync sites status: done modules: - scripts/version-bump.mjs - package.json + - package-lock.json + - tests/scripts/version-bump.test.ts depends_on: [F-080] acceptance_criteria: - id: AC-001 ears: ubiquitous - action: ship a single-command script that atomically bumps the cladding version across all seven sites where it lives - response: 'scripts/version-bump.mjs accepts a single SemVer argument (major.minor.patch) and replaces the literal version string in package.json, .claude-plugin/plugin.json, plugins/codex/.codex-plugin/plugin.json, plugins/gemini-cli/gemini-extension.json, src/cli/clad.ts, src/serve/server.ts, and tests/cli/clad.test.ts; prints a per-file summary; exits non-zero on any error' - text: The system shall ship scripts/version-bump.mjs that atomically bumps the cladding version across all seven sites where it lives (package.json · 3 host manifests · src/cli/clad.ts · src/serve/server.ts · tests/cli/clad.test.ts) so the manual seven-edit ritual collapses into a single command and the HARNESS_INTEGRITY drift risk is eliminated at the source. + action: ship a single-command script that atomically bumps the cladding version across all eleven sites where it lives + response: 'scripts/version-bump.mjs accepts a single SemVer argument (major.minor.patch), validates all 11 version sites across 10 files including both package-lock.json copies, and writes only after every site validates; prints a per-site summary; exits non-zero without partial writes on any error' + text: The system shall ship scripts/version-bump.mjs that atomically bumps the cladding version across all eleven sites where it lives, including both package-lock.json copies and every host manifest, so the manual edit ritual collapses into a single command and version drift is eliminated at the source. test_refs: [tests/scripts/version-bump.test.ts] - id: AC-002 ears: ubiquitous @@ -35,8 +37,8 @@ acceptance_criteria: test_refs: [tests/scripts/version-bump.test.ts] - id: AC-005 ears: state - condition: while one of the seven files has its anchor pattern broken (e.g. the version field renamed) - action: report which file is broken and exit non-zero without touching the other six - response: the script collects per-file errors and prints them under an `errors:` heading after the change summary; the other six files are bumped successfully but the exit code is non-zero so the user knows to investigate - text: While one of the seven files has its anchor pattern broken, the system shall report which file is broken and exit non-zero so a refactor that moves the version string is caught at the next bump rather than silently leaving one site stale. + condition: while one of the eleven version sites has its anchor pattern broken (e.g. the version field renamed) + action: report which file is broken and exit non-zero without writing any version-bearing file + response: the script validates every site before its write phase, prints errors under an `errors:` heading, leaves all 10 files unchanged, and exits non-zero + text: While one of the eleven version sites has its anchor pattern broken, the system shall report which file is broken and exit non-zero without partial writes, so a refactor that moves a version string cannot leave a half-bumped release. test_refs: [tests/scripts/version-bump.test.ts] diff --git a/spec/index.yaml b/spec/index.yaml index 77034cdf..35686c8c 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -154,7 +154,7 @@ features: F-67d2e9: {slug: strict-skip-policy, status: done, modules: 2} F-67e33f: {slug: spec-id-multi-dev-safety, status: done, modules: 7} F-6ba22c5c: {slug: value-telemetry, status: done, modules: 5} - F-6d943d: {slug: version-bump-script, status: done, modules: 2} + F-6d943d: {slug: version-bump-script, status: done, modules: 4} F-6e49fd24: {slug: inventory-churn-diet, status: done, modules: 1} F-6ed216f3: {slug: interactive-drift-profile, status: done, modules: 5} F-6f80e7: {slug: claude-code-dogfood, status: done, modules: 1} @@ -171,7 +171,7 @@ features: F-80d19d: {slug: setup-command, status: done, modules: 7} F-8234ec3c: {slug: graph-viewer-galaxy, status: archived, modules: 0} F-836a90: {slug: link-capability-tool, status: done, modules: 2} - F-898783ee: {slug: self-count-guard, status: done, modules: 7} + 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} F-9064ff: {slug: deliverable-smoke, status: done, modules: 8} diff --git a/src/cli/clad.ts b/src/cli/clad.ts index 933c6eed..704e35cb 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -1035,7 +1035,7 @@ export function runRouteCommand(prompt: string): void { */ export function createProgram(): Command { const program = new Command(); - program.name('clad').description('Reference Ironclad CLI').version('0.8.3'); + program.name('clad').description('Reference Ironclad CLI').version('0.9.0'); program .command('init [intent...]') diff --git a/src/serve/server.ts b/src/serve/server.ts index 6eb7a1aa..3b0bd719 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -23,6 +23,7 @@ import {createHash, randomUUID} from 'node:crypto'; import {readFileSync, existsSync, mkdirSync, realpathSync, readdirSync, rmSync, statSync, writeFileSync} from 'node:fs'; import {basename, dirname, extname, isAbsolute, join, relative, resolve, sep} from 'node:path'; import {fileURLToPath} from 'node:url'; +import {TextDecoder} from 'node:util'; import {deflateRawSync, inflateRawSync} from 'node:zlib'; import {tmpdir} from 'node:os'; @@ -173,7 +174,7 @@ export function buildServer(opts: ServerOptions = {}): McpServer { const server = new McpServer( { name: opts.name ?? 'cladding', - version: opts.version ?? '0.8.3', + version: opts.version ?? '0.9.0', }, { instructions: @@ -347,8 +348,12 @@ function engineShim(): string | null { const INTENT_FILE_EXTENSIONS = new Set(['.md', '.txt', '.yaml', '.yml', '.markdown']); -/** Resolves a planning document without permitting reads outside the project. */ -function projectIntentPath(cwd: string, requested: string): {path?: string; error?: string} { +/** + * Rejects ambiguous document paths and bytes before they reach the host model. + * + * @see spec/features/natural-language-init-0f4dd6.yaml AC-003 + */ +function projectIntentPath(cwd: string, requested: string): {path?: string; text?: string; error?: string} { if (!requested.trim()) return {error: 'document_path is required for document mode'}; if (isAbsolute(requested)) return {error: 'document_path must be relative to the connected project'}; const root = realpathSync(resolve(cwd)); @@ -369,11 +374,11 @@ function projectIntentPath(cwd: string, requested: string): {path?: string; erro return {error: 'planning document must be .md, .txt, .yaml, .yml, or .markdown'}; } try { - readFileSync(target, 'utf8'); + const text = new TextDecoder('utf-8', {fatal: true}).decode(readFileSync(target)); + return {path: rel, text}; } catch (error) { return {error: `planning document is not readable UTF-8 text: ${(error as Error).message}`}; } - return {path: rel}; } const hostDraftSchema = z.object({ @@ -591,6 +596,12 @@ function mcpPayload(payload: Record, isError = false): { function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOperations): void { const prepared = new Map(); + let initializedToolsRegistered = false; + const registerInitialized = (): void => { + if (initializedToolsRegistered) return; + initializedToolsRegistered = true; + registerInitializedTools(server, cwd, prepared, onboarding); + }; server.registerTool( 'clad_prepare_init', @@ -627,7 +638,7 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp if (args.mode === 'document') { const resolved = projectIntentPath(cwd, args.document_path ?? ''); if (resolved.error) return mcpPayload({status: 'invalid_request', changed: false, error: resolved.error}, true); - intent = readFileSync(join(cwd, resolved.path!), 'utf8'); + intent = resolved.text!; } if (args.mode === 'existing' && !intent) intent = 'Adopt Cladding into the observed existing project.'; const briefing = onboarding.prepareInit({cwd, mode: args.mode, intent}); @@ -771,10 +782,25 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp nextQuestion: questions[0] ?? null, remainingQuestions: questions.length, }; + registerInitialized(); return mcpPayload(payload); }, ); + if (existsSync(join(cwd, 'spec.yaml'))) registerInitialized(); +} + +/** + * Keeps ordinary development tool descriptions out of pre-init model context. + * + * @see spec/features/natural-language-init-0f4dd6.yaml AC-017 + */ +function registerInitializedTools( + server: McpServer, + cwd: string, + prepared: Map, + onboarding?: OnboardingOperations, +): void { server.registerTool( 'clad_prepare_clarify', { diff --git a/tests/cli/clad.test.ts b/tests/cli/clad.test.ts index 2312102d..3e54a8a5 100644 --- a/tests/cli/clad.test.ts +++ b/tests/cli/clad.test.ts @@ -561,7 +561,7 @@ describe('cli/clad — createProgram', () => { test('program version matches current package version', () => { const program = clad.createProgram(); - expect(program.version()).toBe('0.8.3'); + expect(program.version()).toBe('0.9.0'); }); }); diff --git a/tests/scripts/test-count.test.ts b/tests/scripts/test-count.test.ts new file mode 100644 index 00000000..6b92fb16 --- /dev/null +++ b/tests/scripts/test-count.test.ts @@ -0,0 +1,27 @@ +// Cladding · public test-count consistency guard (F-898783ee). + +import {describe, expect, test} from 'vitest'; + +import {checkClaimText, rewriteClaimText} from '../../scripts/test-count.mjs'; + +const markdown = 'tests\n| release | 10 / 10 | green |\n'; +const html = 'tests\n
10/10
\n'; + +describe('test-count.mjs (F-898783ee)', () => { + test('accepts matching Markdown and HTML claims', () => { + expect(() => checkClaimText(markdown, 'markdown', 10)).not.toThrow(); + expect(() => checkClaimText(html, 'html', 10)).not.toThrow(); + }); + + test('rejects a stale or partial public claim', () => { + expect(() => checkClaimText(markdown, 'markdown', 11)).toThrow(/collects 11/); + expect(() => checkClaimText(markdown.replace('10 / 10', '9 / 10'), 'markdown', 10)).toThrow(/not all-pass/); + }); + + test('rewrites both claims without changing surrounding content', () => { + const updated = rewriteClaimText(html, 'html', 12); + expect(updated).toContain('tests-12%2F12-brightgreen'); + expect(updated).toContain('>12/12'); + expect(() => checkClaimText(updated, 'html', 12)).not.toThrow(); + }); +}); diff --git a/tests/scripts/version-bump.test.ts b/tests/scripts/version-bump.test.ts index 179ba02f..ecf43b23 100644 --- a/tests/scripts/version-bump.test.ts +++ b/tests/scripts/version-bump.test.ts @@ -1,15 +1,15 @@ // Cladding · unit tests for scripts/version-bump.mjs (F-090) // // Tests run the script in a synthetic project tree (tmpdir with the -// nine version-bearing files at exactly the same relative paths the +// ten version-bearing files at exactly the same relative paths the // real script expects). Verifies: -// - all nine files updated atomically +// - all eleven version sites updated atomically // - idempotent (running with current version is a no-op) // - invalid SemVer rejected // - missing anchor in a file raises a clear error import {execFileSync, type ExecFileSyncOptions} from 'node:child_process'; -import {mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync} from 'node:fs'; +import {chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync} from 'node:fs'; import {tmpdir} from 'node:os'; import {join} from 'node:path'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; @@ -19,7 +19,11 @@ const SCRIPT_PATH = join(process.cwd(), 'scripts', 'version-bump.mjs'); function seedProject(dir: string, version: string): void { writeFileSync( join(dir, 'package.json'), - `{\n "name": "probe",\n "version": "${version}"\n}\n`, + `{\n "name": "cladding",\n "version": "${version}"\n}\n`, + ); + writeFileSync( + join(dir, 'package-lock.json'), + `{\n "name": "cladding",\n "version": "${version}",\n "lockfileVersion": 3,\n "packages": {\n "": {\n "name": "cladding",\n "version": "${version}"\n }\n }\n}\n`, ); mkdirSync(join(dir, 'plugins', 'claude-code', '.claude-plugin'), {recursive: true}); writeFileSync( @@ -92,13 +96,14 @@ describe('version-bump.mjs (F-090, v0.3.15)', () => { rmSync(dir, {recursive: true, force: true}); }); - test('happy path — bumps all nine files atomically', () => { + test('happy path — bumps all eleven version sites atomically', () => { seedProject(dir, '0.3.14'); const result = runScript(dir, ['0.3.15']); expect(result.status).toBe(0); - expect(result.stdout).toContain('9 files updated to 0.3.15'); + expect(result.stdout).toContain('11 version sites checked; 10 files updated to 0.3.15'); expect(readFileSync(join(dir, 'package.json'), 'utf8')).toContain('"version": "0.3.15"'); + expect(readFileSync(join(dir, 'package-lock.json'), 'utf8').match(/"version": "0\.3\.15"/g)).toHaveLength(2); expect(readFileSync(join(dir, 'plugins', 'claude-code', '.claude-plugin', 'plugin.json'), 'utf8')).toContain('"version": "0.3.15"'); expect(readFileSync(join(dir, 'plugins', 'codex', '.codex-plugin', 'plugin.json'), 'utf8')).toContain('"version": "0.3.15"'); expect(readFileSync(join(dir, 'plugins', 'gemini-cli', 'gemini-extension.json'), 'utf8')).toContain('"version": "0.3.15"'); @@ -145,5 +150,20 @@ describe('version-bump.mjs (F-090, v0.3.15)', () => { expect(result.status).not.toBe(0); expect(result.stderr).toContain('package.json'); expect(result.stderr).toContain('anchor'); + expect(readFileSync(join(dir, 'src', 'cli', 'clad.ts'), 'utf8')).toContain(".version('0.3.14')"); + }); + + test.skipIf(process.platform === 'win32')('a write failure restores files written earlier in the transaction', () => { + seedProject(dir, '0.3.14'); + const blocked = join(dir, 'plugins', 'codex', '.codex-plugin', 'plugin.json'); + chmodSync(blocked, 0o444); + const result = runScript(dir, ['0.3.15']); + chmodSync(blocked, 0o644); + + expect(result.status).not.toBe(0); + expect(result.stderr).toContain('version files restored'); + expect(readFileSync(join(dir, 'package.json'), 'utf8')).toContain('"version": "0.3.14"'); + expect(readFileSync(join(dir, 'package-lock.json'), 'utf8').match(/"version": "0\.3\.14"/g)).toHaveLength(2); + expect(readFileSync(blocked, 'utf8')).toContain('"version": "0.3.14"'); }); }); diff --git a/tests/serve/init-tools.test.ts b/tests/serve/init-tools.test.ts index 1776e1b3..41fb4e16 100644 --- a/tests/serve/init-tools.test.ts +++ b/tests/serve/init-tools.test.ts @@ -11,7 +11,7 @@ import {refineOnboarding, resolveOnboardingReview} from '../../src/cli/clarify.j import {prepareHostClarify, prepareHostInit, renderHostDraft} from '../../src/cli/host-onboarding.js'; import {runInit} from '../../src/cli/init.js'; import {captureArtifactDigests, loadState, saveState} from '../../src/cli/scan/onboarding-state.js'; -import {buildServer} from '../../src/serve/server.js'; +import {buildServer, TOOL_NAMES} from '../../src/serve/server.js'; interface Pair { readonly client: Client; @@ -81,6 +81,12 @@ describe('serve/server — natural-language init tools', () => { test('idea mode asks for intent before writing any project artifact', async () => { const {client, cleanup} = await makePair(dir); try { + const {tools} = await client.listTools(); + expect(tools.map((tool) => tool.name).sort()).toEqual([ + 'clad_init', + 'clad_prepare_init', + 'clad_stage_init', + ]); const result = await client.callTool({name: 'clad_prepare_init', arguments: {mode: 'idea'}}); expect(payload(result)).toMatchObject({status: 'needs_input', changed: false}); expect(readdirSync(dir)).toEqual([]); @@ -104,6 +110,8 @@ describe('serve/server — natural-language init tools', () => { expect(readFileSync(join(dir, 'spec.yaml'), 'utf8')).toContain('onboarding_seeded: true'); expect(existsSync(join(dir, 'AGENTS.md'))).toBe(true); expect(existsSync(join(dir, 'CLAUDE.md'))).toBe(false); + const {tools} = await client.listTools(); + expect(tools.map((tool) => tool.name).sort()).toEqual([...TOOL_NAMES].sort()); } finally { await cleanup(); } @@ -346,6 +354,24 @@ describe('serve/server — natural-language init tools', () => { } }); + test('document mode rejects malformed UTF-8 before preparing or writing', async () => { + mkdirSync(join(dir, 'docs')); + writeFileSync(join(dir, 'docs', 'plan.md'), Buffer.from([0xc3, 0x28])); + const {client, cleanup} = await makePair(dir); + try { + const result = await client.callTool({ + name: 'clad_prepare_init', + arguments: {mode: 'document', document_path: 'docs/plan.md'}, + }); + expect(result.isError).toBe(true); + expect(payload(result)).toMatchObject({status: 'invalid_request', changed: false}); + expect(payload(result).error).toMatch(/UTF-8/); + expect(existsSync(join(dir, 'spec.yaml'))).toBe(false); + } finally { + await cleanup(); + } + }); + test('existing mode forces observed scanning for a sparse codebase', async () => { mkdirSync(join(dir, 'src')); writeFileSync(join(dir, 'src', 'index.ts'), 'export const value = 1;\n'); @@ -412,6 +438,7 @@ describe('serve/server — natural-language init tools', () => { }); mkdirSync(join(dir, 'docs'), {recursive: true}); mkdirSync(join(dir, 'spec'), {recursive: true}); + writeFileSync(join(dir, 'spec.yaml'), 'schema: "0.1"\nproject:\n name: demo\n language: typescript\nfeatures: []\n'); writeFileSync(join(dir, 'docs', 'project-context.md'), '# Context\n'); writeFileSync(join(dir, 'spec', 'capabilities.yaml'), 'schema: "0.1"\ncapabilities: []\n'); writeFileSync(join(dir, 'spec', 'architecture.yaml'), 'version: "0.1"\nlayers: []\n'); @@ -447,6 +474,7 @@ describe('serve/server — natural-language init tools', () => { }); mkdirSync(join(dir, 'docs'), {recursive: true}); mkdirSync(join(dir, 'spec'), {recursive: true}); + writeFileSync(join(dir, 'spec.yaml'), 'schema: "0.1"\nproject:\n name: demo\n language: typescript\nfeatures: []\n'); writeFileSync(join(dir, 'docs', 'project-context.md'), '# Context\n'); writeFileSync(join(dir, 'spec', 'capabilities.yaml'), 'schema: "0.1"\ncapabilities: []\n'); writeFileSync(join(dir, 'spec', 'architecture.yaml'), 'version: "0.1"\nlayers: []\n'); diff --git a/tests/serve/server.test.ts b/tests/serve/server.test.ts index e4c20553..9e67f01c 100644 --- a/tests/serve/server.test.ts +++ b/tests/serve/server.test.ts @@ -196,33 +196,21 @@ describe('serve/server — MCP read surface', () => { } }); - test('read surfaces degrade gracefully when spec.yaml is absent (no crash)', async () => { - // A project that has not run `clad init` yet — spec.yaml is absent, so - // loadSpec throws. The read tools must return an isError reply (and the - // spec resource an error payload), not crash the MCP call. + test('a project without spec.yaml exposes only the initialization bootstrap', async () => { const bare = mkdtempSync(join(tmpdir(), 'clad-serve-bare-')); const {client, cleanup} = await makePair(bare); try { - const list = await client.callTool({name: 'clad_list_features', arguments: {}}); - expect(list.isError).toBe(true); - expect((list.content as Array<{text: string}>)[0].text).toContain('spec not loaded'); - - const get = await client.callTool({name: 'clad_get_feature', arguments: {id: 'F-001'}}); - expect(get.isError).toBe(true); + const {tools} = await client.listTools(); + expect(tools.map((tool) => tool.name).sort()).toEqual([ + 'clad_init', + 'clad_prepare_init', + 'clad_stage_init', + ]); const res = await client.readResource({uri: RESOURCE_URIS.spec}); const text = (res.contents as Array<{text: string}>)[0].text; expect(JSON.parse(text).error).toContain('spec not loaded'); - // F-c6a32fff: the four graph tools carry the same recovery guidance — - // they used to surface a raw ENOENT with no way forward. - for (const name of ['clad_get_context', 'clad_get_working_set', 'clad_get_impact', 'clad_get_graph']) { - const r = await client.callTool({name, arguments: name === 'clad_get_graph' ? {} : {query: 'F-001'}}); - expect(r.isError, `${name} must fail on an absent spec`).toBe(true); - const msg = (r.content as Array<{text: string}>)[0].text; - expect(msg, `${name} must carry the clad-init guidance`).toContain('clad init'); - } - const mutation = await client.callTool({ name: 'clad_create_feature', arguments: { @@ -231,7 +219,7 @@ describe('serve/server — MCP read surface', () => { }, }); expect(mutation.isError).toBe(true); - expect((mutation.content as Array<{text: string}>)[0].text).toContain('not_initialized'); + expect((mutation.content as Array<{text: string}>)[0].text).toMatch(/not found/i); expect(existsSync(join(bare, 'spec'))).toBe(false); } finally { await cleanup(); From 2bddc031fd09400be0c3020dc2bf9e33848fc283 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Thu, 16 Jul 2026 10:43:42 +0900 Subject: [PATCH 24/28] chore: refresh 0.9.0 verification attestation --- spec/attestation.yaml | 77 ++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 4271ba3c..31a0ebc3 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -14,17 +14,19 @@ # `clad check --tier=pre-push --strict`; the GREEN gate rewrites the truth. # Content-anchored: survives fresh clones and squash/rebase. attested_modules: - .claude-plugin/marketplace.json: 0dd39261bb5468e3 + .claude-plugin/marketplace.json: fc209569ca4e1d97 .claude/settings.json: d0bba3583aef0960 .github/workflows/ci.yml: 8ea99219cb80df60 .gitignore: 1294975ba3b47043 - CHANGELOG.md: d437104f3e6b98c3 + CHANGELOG.md: 704d913ae56b635a CLAUDE.md: d81d8832976cd5ee GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 227583ec95375954 - README.ko.html: 5ea397c6e72ff11b - README.ko.md: c23a202221cbcef4 - README.md: ee306d0c8277e943 + README.html: 411c7bbcf7311f8c + README.ja.md: d5add7a87f3ab816 + README.ko.html: 2c0015690f9d7c17 + README.ko.md: a48294f5266901b9 + README.md: 1ab8390ea0c2db80 + README.zh.md: 60ac64b898bc8f6c SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -37,10 +39,10 @@ attested_modules: docs/ab-evaluation/README.md: 2467808b9871dcf0 docs/ab-evaluation/case-doverunner-scale.md: 2a435b6855823d41 docs/ab-evaluation/case-efficiency-measurement.md: 348aca146a7b2faa - docs/ab-evaluation/case-existing-adoption.md: fc0997406abc7e61 + docs/ab-evaluation/case-existing-adoption.md: ec78b64f115d9c91 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: 4f9306412e40cee2 + docs/ab-evaluation/case-payment-saas.md: ca1a9a22b933c5cf docs/ab-evaluation/case-working-set-landmine.md: b4f44dc463e99722 docs/ab-evaluation/summary.md: 59e527a531f13209 docs/b1-adoption-protocol.md: a041d8ad5ba1447f @@ -52,7 +54,7 @@ attested_modules: docs/dogfood/antigravity-cli-2026-07-15.md: c7191d8548535998 docs/dogfood/claude-code-2026-05-20.md: 04870d41e75576d6 docs/dogfood/codex-cli-2026-07-15.md: 4ed02eed031aeda8 - docs/dogfood/cursor-agent-2026-07-15.md: 4639686e20d8e497 + docs/dogfood/cursor-agent-2026-07-15.md: a2f621fd0c3b57af docs/dogfood/gemini-cli-2026-05-20.md: 2da1ba66c4f108f0 docs/feature-cycle.md: b8c48c86d1f1e093 docs/glossary.md: 1f2acc81a22cdd3e @@ -62,23 +64,25 @@ attested_modules: docs/img/ko/relationship.svg: 9ec8fb2254978f37 docs/multi-provider-roadmap.md: 1e5cf27ea1b18d06 docs/refinement-backlog.md: 3e38d60bf987eef1 + docs/setup.md: d6103a17a31f2418 docs/spec-ids-multi-dev.md: 28d58e84879f58b1 - docs/ssot-model.md: ab7933a8ef7b89b8 + docs/ssot-model.md: 13ac491b15bd77cd docs/ssot-testing.md: abf3b2bd5acb29a1 - package.json: dadf1cd78af4d4a3 - plugins/claude-code/.claude-plugin/plugin.json: 7493e69dee9ae24d + package-lock.json: 84fce6dd31da5308 + package.json: fb5fc393fb3f5e49 + plugins/claude-code/.claude-plugin/plugin.json: 3ece00e95ac4e232 plugins/claude-code/agents/developer.md: 40af2943253f6c72 plugins/claude-code/agents/observability.md: 5ea8f14b1c9b4a61 plugins/claude-code/agents/orchestrator.md: 18f41e1dbfe6d95b plugins/claude-code/agents/planner.md: 934753c28d5f1287 plugins/claude-code/agents/reviewer.md: 9c4e095e60040473 - plugins/claude-code/commands/init.md: 6175a8492a6ee48c + plugins/claude-code/commands/init.md: bf567f3b4e22069a plugins/claude-code/hooks/hooks.json: 42321ead26fb1da8 - plugins/codex/.codex-plugin/plugin.json: e2898491a8fd62b8 + plugins/codex/.codex-plugin/plugin.json: 26d1bc595d1b996a plugins/codex/.mcp.json: 43e3f4b2af24aa18 plugins/codex/skills/check/SKILL.md: 455d912ce1d47b5a plugins/codex/skills/developer/SKILL.md: 40af2943253f6c72 - plugins/codex/skills/init/SKILL.md: 6175a8492a6ee48c + plugins/codex/skills/init/SKILL.md: bf567f3b4e22069a plugins/codex/skills/observability/SKILL.md: 5ea8f14b1c9b4a61 plugins/codex/skills/orchestrator/SKILL.md: 18f41e1dbfe6d95b plugins/codex/skills/planner/SKILL.md: 934753c28d5f1287 @@ -90,17 +94,19 @@ attested_modules: plugins/gemini-cli/GEMINI.md: ba08eaf2cd557a65 plugins/gemini-cli/commands/README.md: 3527d771578431bd plugins/gemini-cli/commands/init.toml: e44c7ead9bd927b2 - plugins/gemini-cli/gemini-extension.json: 47685e98f1f67e11 + plugins/gemini-cli/gemini-extension.json: 9d2f839716b55869 scripts/build-plugin.mjs: 7fabe2b6301b142a scripts/build.mjs: 3a4b204063024ef1 scripts/migrate-dogfood-v0.3.16.mjs: 1e265fb370019996 scripts/shard-spec.ts: 0c728bbc1e869421 - scripts/version-bump.mjs: 05a3aa76667ed9ce + scripts/test-count.d.mts: a392f5dea372a40e + scripts/test-count.mjs: aea2620221c8d5ff + scripts/version-bump.mjs: 770b066b8279db39 skills/check/SKILL.md: 455d912ce1d47b5a skills/checkpoint/SKILL.md: f723e8cfb8286a64 skills/clarify/SKILL.md: 5d08bbb821258d03 skills/doctor/SKILL.md: 6581c6c900c72d68 - skills/init/SKILL.md: 6175a8492a6ee48c + skills/init/SKILL.md: bf567f3b4e22069a skills/oracle/SKILL.md: 0986572a0a5604f6 skills/rollback/SKILL.md: d472dc3a562b347b skills/route/SKILL.md: 5958830fef280c67 @@ -108,7 +114,7 @@ attested_modules: skills/serve/SKILL.md: d65778260c663fbb skills/status/SKILL.md: 09faadc50b3449da skills/sync/SKILL.md: 775c0f990a52a3d9 - spec.yaml: 5554832234c04853 + spec.yaml: 59840b10bd055d32 spec/README.md: 7c257426396d435c spec/architecture.yaml: f0888480405a13a8 spec/features/: a4d0f0eb87fed960 @@ -141,16 +147,16 @@ attested_modules: src/cli: a4d0f0eb87fed960 src/cli/benchmark.ts: 77f84d2a898d724f src/cli/changelog.ts: 2de1adb009b89ab4 - src/cli/clad.ts: 85e7e3f59bddcd1d + src/cli/clad.ts: ccb15bd40fcaab03 src/cli/clarify.ts: 393cc93a6feb698a - src/cli/doctor-hosts.ts: 093bf18c79cf363f + src/cli/doctor-hosts.ts: d58d2580e76c09ed src/cli/doctor.ts: b98b955fe75e7f7e src/cli/done.ts: 02bd4397eaf34fa1 src/cli/graph-serve.ts: 23e6e389225d0f98 src/cli/graph.ts: bab410061b8c746a src/cli/hook.ts: 201f82f4c89e173f src/cli/host-onboarding.ts: b046571d4be7280c - src/cli/init.ts: 580469d8416910b4 + src/cli/init.ts: ccd14da690621d88 src/cli/intent-from-path.ts: e69862821d979f22 src/cli/measure.ts: 3a562f16589e26c2 src/cli/report.ts: 911f859b2446834b @@ -171,7 +177,7 @@ attested_modules: src/cli/scan/thresholds.ts: ec0047b894a6aa6a src/cli/scan/types.ts: ea0170aa88c1c14a src/cli/scan/walker.ts: 33e4448e365e47c6 - src/cli/update.ts: b342feb657e33418 + src/cli/update.ts: 26abe9f2e1d1e88f src/cli/verdict.ts: 7aa16b8739ab8e5f src/core/checkpoint.ts: 63300c2764533b6c src/core/git-ops.ts: 4544bde493a0628f @@ -199,7 +205,7 @@ attested_modules: src/init/agents-md.ts: 7dc05f6d82e5c3ce src/init/git-hook.ts: 4e02f177b3764ae8 src/init/host-instructions.ts: f6d10695ef0c4763 - src/init/host-setup.ts: 7567497d563ef587 + src/init/host-setup.ts: 83213a4bbed1e3bd src/optimizer: a4d0f0eb87fed960 src/optimizer/code-excerpt.ts: e2c4598efcd28d2a src/optimizer/context-slice.ts: b5864aaed1e7ae48 @@ -222,7 +228,7 @@ attested_modules: src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 - src/serve/server.ts: ce75e0c6989f1bc8 + src/serve/server.ts: a19d47091ca3b212 src/spec: a4d0f0eb87fed960 src/spec/attestation.ts: 294a1e99c42d4aef src/spec/cli.ts: 7a9bcd0f66677810 @@ -232,12 +238,12 @@ attested_modules: src/spec/feature-id.ts: 2b6335aac848a3de src/spec/inventory.ts: 2cd34dfb665f422f src/spec/load.ts: 9fe2fe74053bf7e3 - src/spec/new.ts: f9aa4466a8ce1dfd + src/spec/new.ts: 4c91f6d41acaab69 src/spec/parse.ts: 1eab9a28c9359a45 src/spec/reverse-index.ts: d8b003eb8f1918c8 - src/spec/schema.json: 7cc4674eb37ebea9 + src/spec/schema.json: 030d3741f2b38159 src/spec/test-ref-repair.ts: 5ce823b479aaaca3 - src/spec/types.ts: b97d69db856c78a5 + src/spec/types.ts: bd5833feabcdb787 src/spec/validate.ts: db88ca6512ab363a src/stages: a4d0f0eb87fed960 src/stages/README.md: c79d2bced8c8b8d8 @@ -254,10 +260,10 @@ attested_modules: src/stages/detectors/ai-hints-forbidden-pattern.ts: 96b225595ffd4d0a src/stages/detectors/architecture-from-spec.ts: ee36fa5f94a5be2a src/stages/detectors/architecture-violation.ts: b5035317a61e5ebe - src/stages/detectors/capabilities-feature-mapping.ts: 4a245767d091d6ff + src/stages/detectors/capabilities-feature-mapping.ts: fa245f053f98a78a src/stages/detectors/convention-drift.ts: 450cb86924dfcf82 src/stages/detectors/coverage-drop.ts: 809d13599596793e - src/stages/detectors/deliverable-integrity.ts: 40c4736774e9dfc6 + src/stages/detectors/deliverable-integrity.ts: d0fbc1dd05bd245a src/stages/detectors/dependency-cycle.ts: 873c8fdde00aa48b src/stages/detectors/doc-reference-integrity.ts: ac693db9c4bed946 src/stages/detectors/evidence-mismatch.ts: c633778b8f9ec0af @@ -277,7 +283,7 @@ attested_modules: src/stages/detectors/planned-backlog.ts: a6850576b00d4a44 src/stages/detectors/project-context-drift.ts: d3643f369537a8e8 src/stages/detectors/reference-integrity.ts: 8883766a4bf69c61 - src/stages/detectors/scenario-coverage.ts: 08bd9a808d9e85ed + src/stages/detectors/scenario-coverage.ts: 53f90149b1f152d6 src/stages/detectors/slug-conflict.ts: 5d9b8feec12dce07 src/stages/detectors/smoke-probe-demand.ts: 792b6d0d07f82a16 src/stages/detectors/spec-conformance.ts: 8c74460349f0acef @@ -302,11 +308,11 @@ attested_modules: src/stages/secret.ts: b90abc0e00c86219 src/stages/skip-policy.ts: 1a6412d708561cf0 src/stages/smoke.ts: cbe55596f6b0a49e - src/stages/spec-conformance.ts: 82efe2285dab6da1 + src/stages/spec-conformance.ts: 1e9b052a2a268d7a src/stages/test-run-cache.ts: 46df49ab73a1a72e src/stages/toolchain/coverage-tool.ts: 310883060ed6d92e src/stages/toolchain/detect.ts: 36d4947e5567bd5f - src/stages/toolchain/gate-config.ts: ef672fd9664f72c2 + src/stages/toolchain/gate-config.ts: 818a0a549d875581 src/stages/toolchain/language-config.ts: 65175718559b0710 src/stages/toolchain/module-scope.ts: 88358ec3b84eedd3 src/stages/toolchain/scoped-command.ts: f2dd6410c063279f @@ -329,7 +335,7 @@ attested_modules: tests/adapters/transport.test.ts: 68f22e9e8df7b813 tests/agents/loader.test.ts: a7df7b1c9a95d37d tests/cli/benchmark.test.ts: b4a87289605ee75f - tests/cli/clad.test.ts: c1c58f2581507eab + tests/cli/clad.test.ts: 19a2f5950d84da42 tests/cli/gate-golden-matrix.test.ts: 39cf615407a55abe tests/cli/init.test.ts: 3428a89708fc9330 tests/cli/intent-onboarding.test.ts: 0681b98ce2e74c22 @@ -368,6 +374,8 @@ attested_modules: tests/scenarios/ab/case-payment-saas.test.ts: 280404fbbfd0e6a3 tests/scenarios/existing-adoption-lifecycle.test.ts: c1641cbe818087df tests/scenarios/greenfield-lifecycle.test.ts: 434b58e6722aad1e + tests/scripts/test-count.test.ts: b00f58edc018f9d4 + tests/scripts/version-bump.test.ts: 560ec3095887f192 tests/self-consistency.test.ts: e7fbd651f0c60c4a tests/serve/description-budget.test.ts: e1501907eff9b923 tests/spec/ears.test.ts: e7385918da1d8c7a @@ -412,6 +420,7 @@ attested_modules: tests/stages/status-drift.test.ts: cff1092eeb23c268 tests/stages/tech-stack-mismatch.test.ts: 878436ffd2f94c97 tests/stages/toolchain.test.ts: 04e12be4ac1dee5c + tests/stages/toolchain/gate-config.test.ts: aef5813a6591b153 tests/stages/type.test.ts: b57cf7455cae3b32 tests/stages/uat.test.ts: 29c5bf3e7f3abc35 tests/stages/unit.test.ts: 97781210eb81bb25 From 2ad61feb1015d454b27c3db784d76c8d0ffacb08 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Thu, 16 Jul 2026 15:00:51 +0900 Subject: [PATCH 25/28] fix(onboarding): reconcile stale prose with the project-local model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - host-instructions.ts: drop the pre-0.9.0 'global home + npm postinstall' header claim; .mcp.json/.codex/config.toml are project-local via clad setup - update.ts: comments no longer call the host re-wire 'global'; note that wiring runs before the spec.yaml guard - orchestrator.md: insert the mandatory clad_stage_init step between prepare and the planned-changes display, matching skills/init/SKILL.md and the server's own prepare instruction (process-per-turn hosts dead-ended without it) - server.ts: clad_prepare_init is 'non-destructive', not 'read-only' — it persists a TTL'd consent-cache envelope (tmpdir tier before staging) Co-Authored-By: Claude Fable 5 --- plugins/antigravity/skills/orchestrator/SKILL.md | 2 +- plugins/claude-code/agents/orchestrator.md | 2 +- plugins/claude-code/dist/agents/orchestrator.md | 2 +- plugins/claude-code/dist/clad.js | 2 +- plugins/codex/skills/orchestrator/SKILL.md | 2 +- spec/attestation.yaml | 12 ++++++------ src/agents/orchestrator.md | 2 +- src/cli/update.ts | 13 ++++++++----- src/init/host-instructions.ts | 7 +++---- src/serve/server.ts | 11 +++++++---- 10 files changed, 30 insertions(+), 25 deletions(-) diff --git a/plugins/antigravity/skills/orchestrator/SKILL.md b/plugins/antigravity/skills/orchestrator/SKILL.md index 073305af..bf8d0c1e 100644 --- a/plugins/antigravity/skills/orchestrator/SKILL.md +++ b/plugins/antigravity/skills/orchestrator/SKILL.md @@ -29,7 +29,7 @@ You do NOT pre-load Tier C (conventions — developer's concern). 3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. 4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). 5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. -6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/stage/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, then call `clad_stage_init` with the preparation token and that draft *before* showing anything (staging validates the draft and stores only ignored runtime state, so process-per-turn hosts can apply later without re-sending it). Show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never stage and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. ## Feature cycle — one feature at a time diff --git a/plugins/claude-code/agents/orchestrator.md b/plugins/claude-code/agents/orchestrator.md index 073305af..bf8d0c1e 100644 --- a/plugins/claude-code/agents/orchestrator.md +++ b/plugins/claude-code/agents/orchestrator.md @@ -29,7 +29,7 @@ You do NOT pre-load Tier C (conventions — developer's concern). 3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. 4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). 5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. -6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/stage/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, then call `clad_stage_init` with the preparation token and that draft *before* showing anything (staging validates the draft and stores only ignored runtime state, so process-per-turn hosts can apply later without re-sending it). Show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never stage and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. ## Feature cycle — one feature at a time diff --git a/plugins/claude-code/dist/agents/orchestrator.md b/plugins/claude-code/dist/agents/orchestrator.md index 073305af..bf8d0c1e 100644 --- a/plugins/claude-code/dist/agents/orchestrator.md +++ b/plugins/claude-code/dist/agents/orchestrator.md @@ -29,7 +29,7 @@ You do NOT pre-load Tier C (conventions — developer's concern). 3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. 4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). 5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. -6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/stage/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, then call `clad_stage_init` with the preparation token and that draft *before* showing anything (staging validates the draft and stores only ignored runtime state, so process-per-turn hosts can apply later without re-sending it). Show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never stage and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. ## Feature cycle — one feature at a time diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 76b60cef..62d4aa7c 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -458,7 +458,7 @@ source: spec.yaml `});function Hc(t){let e=t.identity.timestamp??new Date().toISOString(),r=`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return{...t,id:r,identity:{...t.identity,timestamp:e}}}var fA=y(()=>{"use strict"});import{existsSync as pJe,mkdirSync as mJe,readFileSync as Tue,readdirSync as hJe,writeFileSync as Oue}from"node:fs";import{dirname as gJe,join as jq}from"node:path";function _Je(t,e){return`${yJe}/${t}.${e}.test.ts`}function bJe(t,e){let r=jq(t,"spec/features");if(!pJe(r))return null;for(let n of hJe(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))){let i=jq(r,n);try{if((0,so.parseDocument)(Tue(i,"utf8")).get("id")===e)return i}catch{}}return null}function vJe(t,e,r,n){let i=bJe(t,e);if(!i)return!1;let o=(0,so.parseDocument)(Tue(i,"utf8")),s=o.get("acceptance_criteria");if(!(0,so.isSeq)(s))return!1;let a=s.items.find(l=>(0,so.isMap)(l)&&l.get("id")===r);if(!a||!(0,so.isMap)(a))return!1;let c=a.get("oracle_refs",!0);if((0,so.isSeq)(c)){if(c.items.some(l=>((0,so.isMap)(l)?void 0:l.value)===n))return!0;c.add(n)}else a.set("oracle_refs",[n]);return Oue(i,String(o),"utf8"),!0}function Rue(t){let e=t.cwd??".",r=_Je(t.featureId,t.acId),n=jq(e,r);mJe(gJe(n),{recursive:!0}),Oue(n,t.body.endsWith(` `)?t.body:`${t.body} `,"utf8");let i=Hc({featureId:t.featureId,acId:t.acId,stage:"stage_2.3",identity:{author:"llm",name:t.authorName??"oracle-author"},kind:"oracle",content:`impl-blind oracle authored for ${t.featureId}.${t.acId} (blind=${t.blind===!0})`,artifact:r,readManifest:t.readManifest,blind:t.blind===!0});return Ha(e,i),vJe(e,t.featureId,t.acId,r)?{ok:!0,oraclePath:r,evidenceId:i.id}:{ok:!1,oraclePath:r,evidenceId:i.id,reason:`oracle + provenance written, but could not stamp oracle_refs (no shard for ${t.featureId}.${t.acId}) \u2014 add 'oracle_refs: [${r}]' to the AC manually`}}var so,yJe,Iue=y(()=>{"use strict";so=St(Qt(),1);ti();fA();yJe="tests/oracle"});var Wue={};Pr(Wue,{PERSONA_IDS:()=>zue,PERSONA_PROMPT_ALIASES:()=>Uue,RESOURCE_URIS:()=>aa,TOOL_NAMES:()=>RJe,buildServer:()=>IJe});import{spawnSync as Pue}from"node:child_process";import{createHash as uy,randomUUID as SJe}from"node:crypto";import{readFileSync as Gc,existsSync as xn,mkdirSync as Fq,realpathSync as Cue,readdirSync as Mue,rmSync as pA,statSync as yA,writeFileSync as Fue}from"node:fs";import{basename as wJe,dirname as mA,extname as xJe,isAbsolute as Due,join as Ft,relative as Lue,resolve as Lq,sep as $Je}from"node:path";import{fileURLToPath as kJe}from"node:url";import{TextDecoder as EJe}from"node:util";import{deflateRawSync as AJe,inflateRawSync as TJe}from"node:zlib";import{tmpdir as OJe}from"node:os";function IJe(t={}){let e=t.cwd??".",r=new lA({name:t.name??"cladding",version:t.version??"0.9.0"},{instructions:"For explicit Cladding onboarding, always call clad_prepare_init first, draft the requested structured data with the current host model, then call clad_stage_init before showing the planned changes. Wait for a separate user confirmation before calling clad_init with the confirmation verbatim. For each real user answer, call clad_prepare_clarify and then clad_clarify only after a new user message supplies the answer. Never infer an answer or call clarify during the initialization approval turn. Never run onboarding shell commands or request MCP sampling. Prepare tools are read-only; apply tools validate and write.",capabilities:{resources:{subscribe:!0}}});return qJe(r,e,t.onboarding),GJe(r,e),ZJe(r,e),PJe(r),CJe(r,e),r}function PJe(t){t.server.setRequestHandler(qz,async()=>({})),t.server.setRequestHandler(Bz,async()=>({}))}function CJe(t,e){I8(r=>{r===e&&t.server.sendResourceUpdated({uri:aa.audit})})}function ca(t){try{return{spec:H(t)}}catch(e){return{error:`cladding: spec not loaded \u2014 ${e.message}. Run \`clad init\` to scaffold spec.yaml first.`}}}function DJe(t){return"error"in ca(t)?"cladding: not_initialized \u2014 this project has host wiring but no valid spec.yaml; ordinary work must remain ordinary until the user explicitly requests Cladding initialization.":null}function sy(t){let e=DJe(t);return e?{isError:!0,content:[{type:"text",text:e}]}:null}function ay(t){try{let e=ni({cwd:t}),r=e.findings.filter(n=>n.severity!=="info").slice(0,3).map(n=>({detector:n.detector,severity:n.severity,message:n.message.slice(0,220)}));return e.pass?{pass:!0,findings:r}:{pass:!1,findings:r,next:"Resolve these findings, then verify with clad_run_gate (or `clad check --strict`) before `clad done`."}}catch{return{pass:!1,unavailable:!0,findings:[],next:"gate could not run \u2014 verify with `clad check --strict`."}}}function Mq(t,e,r,n,i){try{er(t,"working_set_served",{tool:e,query:r,resolved:n,...i??{}})}catch{}}function Nue(){let t=mA(kJe(import.meta.url));for(let r=0;r<5;r++){let n=Ft(t,"bin","clad");if(xn(n))return n;t=mA(t)}let e=process.argv[1];return e&&wJe(e)==="clad.js"&&xn(e)?e:null}function jJe(t,e){if(!e.trim())return{error:"document_path is required for document mode"};if(Due(e))return{error:"document_path must be relative to the connected project"};let r=Cue(Lq(t)),n=Lq(r,e);if(!xn(n))return{error:`planning document not found: ${e}`};let i;try{i=Cue(n)}catch(s){return{error:`planning document could not be resolved: ${s.message}`}}let o=Lue(r,i);if(o===".."||o.startsWith(`..${$Je}`)||Due(o))return{error:"planning document must stay inside the connected project"};if(!yA(i).isFile())return{error:"planning document must be a regular file"};if(!NJe.has(xJe(i).toLowerCase()))return{error:"planning document must be .md, .txt, .yaml, .yml, or .markdown"};try{let s=new EJe("utf-8",{fatal:!0}).decode(Gc(i));return{path:o,text:s}}catch(s){return{error:`planning document is not readable UTF-8 text: ${s.message}`}}}function que(t){let e=AJe(Buffer.from(JSON.stringify(t))).toString("base64url");return`v1.${uy("sha256").update(e).digest("hex").slice(0,24)}.${e}`}function Uq(t){let e=/^v1\.([a-f0-9]{24})\.([A-Za-z0-9_-]+)$/.exec(t);if(!e||uy("sha256").update(e[2]).digest("hex").slice(0,24)!==e[1])return null;try{let r=JSON.parse(TJe(Buffer.from(e[2],"base64url"),{maxOutputLength:hA}).toString("utf8"));return r.kind!=="init"&&r.kind!=="clarify"||typeof r.snapshot!="string"||typeof r.intent!="string"?null:r}catch{return null}}function gA(t,e,r=!1){let n=uy("sha256").update(`${Lq(t)}\0${e}`).digest("hex");return r?Ft(t,".cladding","host","onboarding-pending",`${n}.json`):Ft(OJe(),"cladding-onboarding-pending",`${n}.json`)}function qq(t,e,r,n,i){let o=gA(t,e,i!=null);Fq(mA(o),{recursive:!0,mode:448}),Fue(o,JSON.stringify({expiresAt:Date.now()+MJe,token:r,request:n,draft:i}),{mode:384})}function Bue(t,e){for(let r of[!0,!1]){let n=gA(t,e,r);try{let i=JSON.parse(Gc(n,"utf8"));if(!i.expiresAt||i.expiresAt{if(xn(n))for(let i of Mue(n,{withFileTypes:!0}).sort((o,s)=>o.name.localeCompare(s.name))){if(i.name===".git"||i.name===".cladding"||i.name==="node_modules")continue;let o=Ft(n,i.name),s=Lue(t,o);if(i.isDirectory())r(o);else if(i.isFile()){let a=yA(o);e.update(`${s}\0${a.size}\0${a.mtimeMs} -`)}}};return r(t),e.digest("hex")}function ly(t){let e=uy("sha256").update(LJe(t)),r=Ft(t,".cladding","onboarding","state.yaml");return e.update(xn(r)?Gc(r):Buffer.from("absent")),e.digest("hex")}function Zue(t,e){let r=new Map,n=new Set,i=o=>{let s=Ft(t,o);if(!xn(s))return;let a=yA(s);if(a.isFile()){r.set(o,Gc(s));return}if(a.isDirectory()){n.add(o);for(let c of Mue(s))i(Ft(o,c))}};for(let o of e)i(o);return{files:r,directories:n}}function Vue(t,e,r){for(let n of e)pA(Ft(t,n),{recursive:!0,force:!0});for(let n of[...r.directories].sort((i,o)=>i.length-o.length))Fq(Ft(t,n),{recursive:!0});for(let[n,i]of r.files)Fq(mA(Ft(t,n)),{recursive:!0}),Fue(Ft(t,n),i)}function zJe(t){return Zue(t,Gue)}function UJe(t,e){Vue(t,Gue,e)}function mt(t,e=!1){return{...e?{isError:!0}:{},structuredContent:t,content:[{type:"text",text:JSON.stringify(t,null,2)}]}}function qJe(t,e,r){let n=new Map,i=!1,o=()=>{i||(i=!0,BJe(t,e,n,r))};t.registerTool("clad_prepare_init",{title:"Prepare Cladding onboarding context",description:"Read-only first step for every explicit Cladding initialization request. Inspect the connected project, then use this tool result to draft the structured input for clad_init. Never run clad init in a shell.",inputSchema:{mode:E.enum(["idea","document","existing"]),intent:E.string().optional(),document_path:E.string().optional(),refresh:E.boolean().optional()},outputSchema:{status:E.string(),changed:E.boolean(),schemaVersion:E.number().optional(),token:E.string().optional(),prompt:E.string().optional(),request:E.object({mode:E.string(),intent:E.string()}).optional(),observation:E.record(E.string(),E.unknown()).optional(),question:E.string().optional(),error:E.string().optional(),plannedChanges:E.array(E.string()).optional(),confirmationQuestion:E.string().optional(),requiresSeparateUserConfirmation:E.boolean().optional(),approvalChallenge:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0}},async s=>{if(!r)return mt({status:"unavailable",changed:!1},!0);if(xn(Ft(e,"spec.yaml"))&&!s.refresh)return mt({status:"already_initialized",changed:!1});let a=s.intent?.trim()??"";if(s.mode==="idea"&&!a)return mt({status:"needs_input",changed:!1,question:"What kind of project are you building?"});if(s.mode==="document"){let p=jJe(e,s.document_path??"");if(p.error)return mt({status:"invalid_request",changed:!1,error:p.error},!0);a=p.text}s.mode==="existing"&&!a&&(a="Adopt Cladding into the observed existing project.");let c=r.prepareInit({cwd:e,mode:s.mode,intent:a}),l=FJe(),u=Number(c.observation.source_file_count??0),d={kind:"init",snapshot:ly(e),mode:s.mode,intent:a,refresh:s.refresh,approvalChallenge:l,scan:s.mode==="existing"||u>0},f=que(d);return n.set(f,d),qq(e,l,f,d),mt({status:"needs_confirmation",changed:!1,schemaVersion:1,token:f,prompt:c.prompt,request:c.request,observation:c.observation,plannedChanges:s.refresh?["Preserve authored files and write review proposals under .cladding/scan/.","Propose refreshed docs/project-context.md, spec/architecture.yaml, and spec/capabilities.yaml."]:["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 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."],confirmationQuestion:`To apply these changes, reply with the exact approval phrase: ${l}`,approvalChallenge:l,requiresSeparateUserConfirmation:!0})}),t.registerTool("clad_stage_init",{title:"Stage a Cladding onboarding draft for approval",description:"Validate and temporarily cache the host-model draft from clad_prepare_init before showing the approval phrase. This does not modify project files and lets a later host process apply the exact staged draft.",inputSchema:{token:E.string().min(1).max(hA),draft:zq},outputSchema:{status:E.string(),changed:E.boolean(),approvalChallenge:E.string().optional(),confirmationQuestion:E.string().optional(),error:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0}},async s=>{let a=n.get(s.token)??Uq(s.token);return!a||a.kind!=="init"||!a.approvalChallenge?mt({status:"invalid_token",changed:!1},!0):a.snapshot!==ly(e)?mt({status:"stale_preparation",changed:!1},!0):(qq(e,a.approvalChallenge,s.token,a,s.draft),mt({status:"staged",changed:!1,approvalChallenge:a.approvalChallenge,confirmationQuestion:`To apply these changes, reply with the exact approval phrase: ${a.approvalChallenge}`}))}),t.registerTool("clad_init",{title:"Apply a validated Cladding onboarding draft",description:"Write Cladding artifacts from the host model draft returned after clad_prepare_init. Use the one-time token when the host retained it; process-per-turn hosts may use the exact approval phrase through the short-lived project runtime cache. Copy the complete user message, including the APPLY CLADDING prefix, into confirmation. Malformed, stale, or replayed requests do not write files.",inputSchema:{token:E.string().min(1).max(hA).optional(),confirmation:E.string().regex(/^APPLY CLADDING [A-F0-9]{6}$/).describe("The complete separate user reply, verbatim, including the APPLY CLADDING prefix"),draft:zq.optional()},outputSchema:{status:E.string(),changed:E.boolean(),created:E.array(E.string()).optional(),skipped:E.array(E.string()).optional(),language:E.string().optional(),proposals:E.array(E.string()).optional(),clarifyingQuestions:E.array(E.string()).optional(),onboardingMode:E.enum(["greenfield","existing-adoption","mixed"]).optional(),onboardingSource:E.string().optional(),nextQuestion:E.string().nullable().optional(),remainingQuestions:E.number().optional(),error:E.string().optional(),confirmation:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1}},async s=>{let a=Bue(e,s.confirmation.trim()),c=(s.token?n.get(s.token)??Uq(s.token):null)??a?.request;if(!c||c.kind!=="init")return mt({status:"invalid_token",changed:!1},!0);if(!c.approvalChallenge||s.confirmation.trim()!==c.approvalChallenge)return mt({status:"confirmation_required",changed:!1,error:"The exact one-time approval phrase shown in the preview is required."},!0);if(c.snapshot!==ly(e))return mt({status:"stale_preparation",changed:!1},!0);if(!r)return mt({status:"unavailable",changed:!1},!0);let l=s.draft??a?.draft;if(!l)return mt({status:"draft_required",changed:!1,error:"No staged onboarding draft is available. Prepare and stage the draft again before approval."},!0);s.token&&n.delete(s.token),Hue(e,s.confirmation.trim());let u=r.renderDraft(l),d=zJe(e),f;try{f=await r.initialize({cwd:e,intent:c.intent,scan:c.scan?!0:void 0,hostDispatcher:async()=>u})}catch(h){return UJe(e,d),mt({status:"failed",changed:!1,error:`Initialization failed; all onboarding files were restored: ${h.message}`},!0)}let p=f.clarifyingQuestions??[],m={status:p.length>0?"needs_answers":"initialized",changed:!0,...f,onboardingSource:"host",confirmation:s.confirmation,nextQuestion:p[0]??null,remainingQuestions:p.length};return o(),mt(m)}),xn(Ft(e,"spec.yaml"))&&o()}function BJe(t,e,r,n){t.registerTool("clad_prepare_clarify",{title:"Prepare the next Cladding onboarding answer",description:"Use only after a new user message answers the displayed pending question. Pass that answer verbatim. Never call during the initialization approval turn and never invent an answer.",inputSchema:{answer:E.string().min(1)},outputSchema:{status:E.string(),changed:E.boolean(),schemaVersion:E.number().optional(),token:E.string().optional(),prompt:E.string().optional(),request:E.object({mode:E.string(),intent:E.string()}).optional(),observation:E.record(E.string(),E.unknown()).optional(),error:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0}},async i=>{if(!n)return mt({status:"unavailable",changed:!1},!0);let o=n.prepareClarify(i.answer,{cwd:e});if("error"in o)return mt({status:"invalid_state",changed:!1,error:o.error},!0);let s={kind:"clarify",snapshot:ly(e),mode:"idea",intent:o.request.intent,answer:i.answer},a=que(s);return r.set(a,s),qq(e,`clarify:${i.answer}`,a,s),mt({status:"needs_host_draft",changed:!1,schemaVersion:1,token:a,prompt:o.prompt,request:o.request,observation:o.observation})}),t.registerTool("clad_clarify",{title:"Answer the next Cladding onboarding question",description:"Apply a host-model refinement only for an answer supplied in a new user message after the pending question. Never call during the initialization approval turn; do not invent or alter the user answer.",inputSchema:{answer:E.string().min(1).describe("The user's answer, verbatim"),token:E.string().min(1).max(hA).optional(),draft:zq},outputSchema:{status:E.string(),changed:E.boolean(),cwd:E.string().optional(),answered:E.unknown().optional(),newQuestions:E.array(E.string()).optional(),mode:E.enum(["greenfield","existing-adoption","mixed"]).nullable().optional(),nextQuestion:E.string().nullable().optional(),remainingQuestions:E.number().optional(),refinementSource:E.string().optional(),pendingReview:E.array(E.string()).optional(),error:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1}},async i=>{let o=Bue(e,`clarify:${i.answer}`),s=(i.token?r.get(i.token)??Uq(i.token):null)??o?.request;if(!s||s.kind!=="clarify"||s.answer!==i.answer)return mt({status:"invalid_token",changed:!1},!0);if(s.snapshot!==ly(e))return mt({status:"stale_preparation",changed:!1},!0);if(!n)return mt({status:"unavailable",changed:!1},!0);i.token&&r.delete(i.token),Hue(e,`clarify:${i.answer}`);let a=n.renderDraft(i.draft),c=await n.clarify(i.answer,{cwd:e,hostDispatcher:async()=>a});return c.ok?mt({...c.report??{},changed:!0,refinementSource:"host"}):mt({status:"failed",changed:!1,error:c.error??"onboarding clarification failed"},!0)}),t.registerTool("clad_resolve_onboarding_review",{title:"Apply reviewed onboarding design proposals",description:"After showing proposal diffs and receiving explicit user approval, applies only the selected pending proposal targets. Never call this automatically; authored design is preserved until the user reviews it.",inputSchema:{targets:E.array(E.string()).min(1).describe("Exact active artifact paths returned in pendingReview.")},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1}},async i=>{if(!n)return mt({status:"unavailable",changed:!1},!0);let o=n.resolveReview(i.targets,{cwd:e});return mt({status:o.status??(o.ok?"resolved":"failed"),changed:o.changed,remaining:o.remaining,error:o.error},!o.ok)}),t.registerTool("clad_list_features",{title:"List cladding features",description:"List features from spec.yaml. Optionally filter by status or slug substring, and sort alphabetically (default) or by recent file mtime.",inputSchema:{statusFilter:E.enum(["planned","in_progress","done","archived"]).optional().describe("Limit to features with this status"),slugSubstring:E.string().optional().describe("Case-insensitive substring match on slug (e.g. 'auth')"),sort:E.enum(["alphabetical","recent"]).optional().describe("'alphabetical' (default \u2014 by id) or 'recent' (by file mtime, newest first)")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0}},async i=>{let o=ca(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let a=o.spec.features;if(i.statusFilter&&(a=a.filter(u=>u.status===i.statusFilter)),i.slugSubstring){let u=i.slugSubstring.toLowerCase();a=a.filter(d=>{let f=d.slug;return f?f.toLowerCase().includes(u):!1})}let l=(i.sort==="recent"?HJe(a,e):a).map(u=>({id:u.id,slug:u.slug,title:u.title,status:u.status}));return{content:[{type:"text",text:JSON.stringify({total:l.length,features:l},null,2)}]}}),t.registerTool("clad_get_feature",{title:"Get a cladding feature",description:'Returns one feature record by id (e.g. "F-049" or "F-a3f9c2") or by slug (e.g. "login-flow"). When a slug matches multiple features, all matches are returned.',inputSchema:{id:E.string().optional().describe('Feature id such as "F-049" or "F-a3f9c2"'),slug:E.string().optional().describe("Feature slug such as 'login-flow'")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0}},async i=>{if(!i.id&&!i.slug)return{isError:!0,content:[{type:"text",text:"provide either id or slug"}]};let o=ca(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=o.spec.features.filter(c=>!!(i.id&&c.id===i.id||i.slug&&c.slug===i.slug));if(s.length===0)return{isError:!0,content:[{type:"text",text:`no feature with ${i.id?`id "${i.id}"`:`slug "${i.slug}"`} found`}]};let a=s.length===1?s[0]:{matches:s};return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}),t.registerTool("clad_run_check",{title:"Run cladding drift check",description:"Runs `clad check` drift detection. Returns a TERSE report by default (pass, error/warn counts, top 3 blocking findings) to keep the agent loop cheap; pass verbose:true for every finding incl. info-severity + suggestions.",inputSchema:{strict:E.boolean().optional().describe("Treat warnings as errors when true"),verbose:E.boolean().optional().describe("Return the full report (all findings incl. info + suggestions) instead of the terse top-3 summary")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0}},async i=>{let o=ni({strict:i.strict,cwd:e});if(i.verbose)return{content:[{type:"text",text:JSON.stringify(o,null,2)}],isError:!o.pass};let s=o.findings??[],a=s.filter(d=>d.severity==="error"),c=s.filter(d=>d.severity==="warn"),l=(a.length>0?a:c).slice(0,3).map(d=>({detector:d.detector,severity:d.severity,message:d.message,...d.path?{path:d.path}:{},...d.line?{line:d.line}:{}})),u={stage:o.stage,pass:o.pass,errorCount:a.length,warnCount:c.length,findings:l,...a.length+c.length>l.length?{truncated:!0,hint:"call clad_run_check with verbose:true for all findings"}:{}};return{content:[{type:"text",text:JSON.stringify(u,null,2)}],isError:!o.pass}}),t.registerTool("clad_run_gate",{title:"Run the full Iron Law gate",description:"Runs the real `clad check` pipeline for a tier (default pre-commit for latency; pre-push runs type/lint/tests/coverage/conformance/smoke) and returns the untruncated JSON outcome. Strict by default \u2014 this is the verification surface; use clad_run_check for the cheap drift-only view.",inputSchema:{tier:E.enum(["pre-commit","pre-push","all"]).optional().describe("Stage tier (default pre-commit)"),strict:E.boolean().optional().describe("Promote warn findings to blocking (default true)")}},async i=>{let o=Nue();if(!o)return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Mt,error:"cladding engine shim (bin/clad) not found relative to the running server"})}]};let s=i.tier??"pre-commit",a=i.strict!==!1,c=Pue(o,["check",`--tier=${s}`,...a?["--strict"]:[],"--json"],{cwd:e,encoding:"utf8",timeout:3e5});try{let l=JSON.parse(c.stdout||"");return{isError:(l.worst??1)!==0,content:[{type:"text",text:JSON.stringify({schema_version:Mt,...l},null,2)}]}}catch{return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Mt,error:"gate produced no parseable JSON",stderr:(c.stderr??"").slice(0,400)})}]}}}),t.registerTool("clad_verdict",{title:"Poll the loop verdict",description:"One-poll loop decision over the real pre-push strict gate + feature statuses. Runs the gate ONCE and reduces it to {verdict, next_action, remaining} \u2014 call this INSTEAD OF clad_run_gate per loop turn, not in addition. verdict is one of DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP; DONE requires a green gate AND every feature done AND at least one non-liveness behavioral proof.",inputSchema:{tier:E.enum(["pre-commit","pre-push","all"]).optional().describe("Gate tier (default pre-push)")}},async i=>{let o=Nue();if(!o)return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Mt,error:"cladding engine shim (bin/clad) not found relative to the running server"})}]};let s=Pue(o,["verdict","--json",...i.tier?[`--tier=${i.tier}`]:[]],{cwd:e,encoding:"utf8",timeout:3e5});try{let a=JSON.parse(s.stdout||"");return{isError:!1,content:[{type:"text",text:JSON.stringify({schema_version:Mt,...a},null,2)}]}}catch{return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Mt,error:"verdict produced no parseable JSON",stderr:(s.stderr??"").slice(0,400)})}]}}}),t.registerTool("clad_get_context",{title:"Get the context slice for one feature",description:"Returns the working set for ONE feature in one call: the focus feature (full), its transitive depends_on ancestors (title+status), bound scenarios, the matching ai_hints patterns, and the union of the feature's test_refs. Look up by feature id (F-\u2026), slug, or a module path. Prefer this over reading shards by hand \u2014 dispatch the slice, never the whole spec.",inputSchema:{query:E.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/auth/login.ts)")}},async i=>{try{let o=ca(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=ol(o.spec,i.query),a="not_found"in s;return Mq(e,"clad_get_context",i.query,!a),{isError:a,content:[{type:"text",text:JSON.stringify({schema_version:Mt,...s},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_get_working_set",{title:"Get the token-budgeted working set for one feature (code + needs + breaks)",description:"Returns ONE token-budgeted working set for a feature/module: must_edit (focus + full ACs + the ACTUAL source code of its modules), needs (forward depends_on), breaks_if_changed (direct dependents + the regression test set), verify (scenarios + tests + oracle_refs + EARS unwanted/state high-risk ACs), guidance (ai_hints), and budget (what was clipped to fit). One call replaces reading the shard + opening each module file + grepping deps/tests. Look up by feature id (F-\u2026), slug, or module path.",inputSchema:{query:E.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/auth/login.ts)"),max_tokens:E.number().int().positive().max(2e4).optional().describe("Token budget for the payload (default 3000); distant deps then code then tests are clipped to fit")}},async i=>{try{let o=ca(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=Sa(o.spec,i.query,{cwd:e,maxTokens:i.max_tokens}),a="not_found"in s?null:{truncated:s.budget.truncated.length>0,sliceTokens:s.budget.used_tokens};return Mq(e,"clad_get_working_set",i.query,a!==null,a??void 0),{isError:"not_found"in s,content:[{type:"text",text:JSON.stringify({schema_version:Mt,...s},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_get_impact",{title:"Get the blast radius for a change (reverse / impact slice)",description:"Returns what a change to ONE feature or file could break: the transitive dependents (id+title+status), the scenarios bound to any of them, the deduped union of their test_refs (the regression set to re-run), and the modules in the radius. Look up by feature id (F-\u2026), slug, or a module path \u2014 a module fans out to ALL features that touch it. The backward complement of clad_get_context: forward = what this needs, impact = what depends on this. Prefer this over grepping to scope a safe refactor.",inputSchema:{query:E.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/spec/load.ts)"),max_depth:E.number().int().positive().max(6).optional().describe("Bound the dependent walk to N hops (default: unbounded \u2014 the full transitive radius)")}},async i=>{try{let o=ca(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=br(o.spec,i.query,{depth:i.max_depth}),a="not_found"in s;return Mq(e,"clad_get_impact",i.query,!a),{isError:a,content:[{type:"text",text:JSON.stringify({schema_version:Mt,...s},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_get_graph",{title:"Get the live knowledge graph (focused neighborhood, or a stats summary)",description:"With query: the focus node\u2019s N-hop neighborhood (typed nodes + edges; a path query unions its kind-twins). WITHOUT query: a compact stats summary (counts by kind + top hubs) \u2014 the full graph is tens of thousands of tokens, so use `clad graph export --format json` for a complete dump. Recomputed live, never stale. Node kinds + edge types: docs/knowledge-graph/design.md.",inputSchema:{query:E.string().optional().describe("Focus node: feature id (F-\u2026), slug, or module path. Omit for the stats summary."),max_depth:E.number().int().positive().max(6).optional().describe("Neighborhood radius around the focus node (default: full reachable subgraph from the focus)")}},async i=>{try{let o=ca(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=o.spec,a=hc(s,e);if(!i.query)return{content:[{type:"text",text:JSON.stringify({schema_version:Mt,summary:!0,stats:Cx(a),hint:"pass query (feature id, slug, or module path) for a neighborhood subgraph; `clad graph export --format json` dumps the full graph"},null,2)}]};let c=Ex(s,a,i.query);if(c.length===0)return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Mt,not_found:i.query,accepted_forms:["feature id (F-\u2026)","slug","module path"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); if the query is a file, fall back to normal code search"},null,2)}]};let l=kx(a,c,i.max_depth??1/0);return{content:[{type:"text",text:JSON.stringify({schema_version:Mt,...l},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_changelog",{title:"Collect shipped changes since a git ref (changelog manifest)",description:"The deterministic shipped-changes manifest for ..HEAD (default since: latest tag): done-feature shards grouped by capability, the inventory count diff, and feat:/fix: commits naming no feature id. For human release notes, render FROM the manifest \u2014 never invent a change it does not carry. Formats (manifest/markdown/audit/catalog): skills/changelog/SKILL.md.",inputSchema:{since:E.string().optional().describe("Git ref to diff from (default: latest tag via `git describe --tags --abbrev=0`)"),format:E.enum(["manifest","markdown","catalog","audit"]).optional().describe("Payload format (default 'manifest')")}},async i=>{try{let o=i.format??"manifest";if(o==="catalog"){let l=ll(H(e));return{content:[{type:"text",text:JSON.stringify({schema_version:Mt,format:o,content:l},null,2)}]}}let s=i.since??ts(e),a=rs(e,s);if(o==="manifest")return{content:[{type:"text",text:JSON.stringify({schema_version:Mt,...a},null,2)}]};let c=o==="audit"?cl(a,H(e),e):al(a);return{content:[{type:"text",text:JSON.stringify({schema_version:Mt,format:o,content:c},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_get_events",{title:"Get recent cladding events",description:"Reads .cladding/events.log and returns the most recent entries.",inputSchema:{limit:E.number().int().positive().max(500).optional().describe("Maximum entries to return (default 50)")}},async i=>{let o=i.limit??50,s=Ft(e,".cladding","events.log.jsonl");if(!xn(s))return{content:[{type:"text",text:JSON.stringify({events:[],note:"no events log yet"})}]};let l=Gc(s,"utf8").split(` +`)}}};return r(t),e.digest("hex")}function ly(t){let e=uy("sha256").update(LJe(t)),r=Ft(t,".cladding","onboarding","state.yaml");return e.update(xn(r)?Gc(r):Buffer.from("absent")),e.digest("hex")}function Zue(t,e){let r=new Map,n=new Set,i=o=>{let s=Ft(t,o);if(!xn(s))return;let a=yA(s);if(a.isFile()){r.set(o,Gc(s));return}if(a.isDirectory()){n.add(o);for(let c of Mue(s))i(Ft(o,c))}};for(let o of e)i(o);return{files:r,directories:n}}function Vue(t,e,r){for(let n of e)pA(Ft(t,n),{recursive:!0,force:!0});for(let n of[...r.directories].sort((i,o)=>i.length-o.length))Fq(Ft(t,n),{recursive:!0});for(let[n,i]of r.files)Fq(mA(Ft(t,n)),{recursive:!0}),Fue(Ft(t,n),i)}function zJe(t){return Zue(t,Gue)}function UJe(t,e){Vue(t,Gue,e)}function mt(t,e=!1){return{...e?{isError:!0}:{},structuredContent:t,content:[{type:"text",text:JSON.stringify(t,null,2)}]}}function qJe(t,e,r){let n=new Map,i=!1,o=()=>{i||(i=!0,BJe(t,e,n,r))};t.registerTool("clad_prepare_init",{title:"Prepare Cladding onboarding context",description:"Non-destructive first step for every explicit Cladding initialization request: writes no authored project files (only a TTL'd consent cache). Inspect the connected project, then use this tool result to draft the structured input for clad_init. Never run clad init in a shell.",inputSchema:{mode:E.enum(["idea","document","existing"]),intent:E.string().optional(),document_path:E.string().optional(),refresh:E.boolean().optional()},outputSchema:{status:E.string(),changed:E.boolean(),schemaVersion:E.number().optional(),token:E.string().optional(),prompt:E.string().optional(),request:E.object({mode:E.string(),intent:E.string()}).optional(),observation:E.record(E.string(),E.unknown()).optional(),question:E.string().optional(),error:E.string().optional(),plannedChanges:E.array(E.string()).optional(),confirmationQuestion:E.string().optional(),requiresSeparateUserConfirmation:E.boolean().optional(),approvalChallenge:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0}},async s=>{if(!r)return mt({status:"unavailable",changed:!1},!0);if(xn(Ft(e,"spec.yaml"))&&!s.refresh)return mt({status:"already_initialized",changed:!1});let a=s.intent?.trim()??"";if(s.mode==="idea"&&!a)return mt({status:"needs_input",changed:!1,question:"What kind of project are you building?"});if(s.mode==="document"){let p=jJe(e,s.document_path??"");if(p.error)return mt({status:"invalid_request",changed:!1,error:p.error},!0);a=p.text}s.mode==="existing"&&!a&&(a="Adopt Cladding into the observed existing project.");let c=r.prepareInit({cwd:e,mode:s.mode,intent:a}),l=FJe(),u=Number(c.observation.source_file_count??0),d={kind:"init",snapshot:ly(e),mode:s.mode,intent:a,refresh:s.refresh,approvalChallenge:l,scan:s.mode==="existing"||u>0},f=que(d);return n.set(f,d),qq(e,l,f,d),mt({status:"needs_confirmation",changed:!1,schemaVersion:1,token:f,prompt:c.prompt,request:c.request,observation:c.observation,plannedChanges:s.refresh?["Preserve authored files and write review proposals under .cladding/scan/.","Propose refreshed docs/project-context.md, spec/architecture.yaml, and spec/capabilities.yaml."]:["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 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."],confirmationQuestion:`To apply these changes, reply with the exact approval phrase: ${l}`,approvalChallenge:l,requiresSeparateUserConfirmation:!0})}),t.registerTool("clad_stage_init",{title:"Stage a Cladding onboarding draft for approval",description:"Validate and temporarily cache the host-model draft from clad_prepare_init before showing the approval phrase. This does not modify project files and lets a later host process apply the exact staged draft.",inputSchema:{token:E.string().min(1).max(hA),draft:zq},outputSchema:{status:E.string(),changed:E.boolean(),approvalChallenge:E.string().optional(),confirmationQuestion:E.string().optional(),error:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0}},async s=>{let a=n.get(s.token)??Uq(s.token);return!a||a.kind!=="init"||!a.approvalChallenge?mt({status:"invalid_token",changed:!1},!0):a.snapshot!==ly(e)?mt({status:"stale_preparation",changed:!1},!0):(qq(e,a.approvalChallenge,s.token,a,s.draft),mt({status:"staged",changed:!1,approvalChallenge:a.approvalChallenge,confirmationQuestion:`To apply these changes, reply with the exact approval phrase: ${a.approvalChallenge}`}))}),t.registerTool("clad_init",{title:"Apply a validated Cladding onboarding draft",description:"Write Cladding artifacts from the host model draft returned after clad_prepare_init. Use the one-time token when the host retained it; process-per-turn hosts may use the exact approval phrase through the short-lived project runtime cache. Copy the complete user message, including the APPLY CLADDING prefix, into confirmation. Malformed, stale, or replayed requests do not write files.",inputSchema:{token:E.string().min(1).max(hA).optional(),confirmation:E.string().regex(/^APPLY CLADDING [A-F0-9]{6}$/).describe("The complete separate user reply, verbatim, including the APPLY CLADDING prefix"),draft:zq.optional()},outputSchema:{status:E.string(),changed:E.boolean(),created:E.array(E.string()).optional(),skipped:E.array(E.string()).optional(),language:E.string().optional(),proposals:E.array(E.string()).optional(),clarifyingQuestions:E.array(E.string()).optional(),onboardingMode:E.enum(["greenfield","existing-adoption","mixed"]).optional(),onboardingSource:E.string().optional(),nextQuestion:E.string().nullable().optional(),remainingQuestions:E.number().optional(),error:E.string().optional(),confirmation:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1}},async s=>{let a=Bue(e,s.confirmation.trim()),c=(s.token?n.get(s.token)??Uq(s.token):null)??a?.request;if(!c||c.kind!=="init")return mt({status:"invalid_token",changed:!1},!0);if(!c.approvalChallenge||s.confirmation.trim()!==c.approvalChallenge)return mt({status:"confirmation_required",changed:!1,error:"The exact one-time approval phrase shown in the preview is required."},!0);if(c.snapshot!==ly(e))return mt({status:"stale_preparation",changed:!1},!0);if(!r)return mt({status:"unavailable",changed:!1},!0);let l=s.draft??a?.draft;if(!l)return mt({status:"draft_required",changed:!1,error:"No staged onboarding draft is available. Prepare and stage the draft again before approval."},!0);s.token&&n.delete(s.token),Hue(e,s.confirmation.trim());let u=r.renderDraft(l),d=zJe(e),f;try{f=await r.initialize({cwd:e,intent:c.intent,scan:c.scan?!0:void 0,hostDispatcher:async()=>u})}catch(h){return UJe(e,d),mt({status:"failed",changed:!1,error:`Initialization failed; all onboarding files were restored: ${h.message}`},!0)}let p=f.clarifyingQuestions??[],m={status:p.length>0?"needs_answers":"initialized",changed:!0,...f,onboardingSource:"host",confirmation:s.confirmation,nextQuestion:p[0]??null,remainingQuestions:p.length};return o(),mt(m)}),xn(Ft(e,"spec.yaml"))&&o()}function BJe(t,e,r,n){t.registerTool("clad_prepare_clarify",{title:"Prepare the next Cladding onboarding answer",description:"Use only after a new user message answers the displayed pending question. Pass that answer verbatim. Never call during the initialization approval turn and never invent an answer.",inputSchema:{answer:E.string().min(1)},outputSchema:{status:E.string(),changed:E.boolean(),schemaVersion:E.number().optional(),token:E.string().optional(),prompt:E.string().optional(),request:E.object({mode:E.string(),intent:E.string()}).optional(),observation:E.record(E.string(),E.unknown()).optional(),error:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0}},async i=>{if(!n)return mt({status:"unavailable",changed:!1},!0);let o=n.prepareClarify(i.answer,{cwd:e});if("error"in o)return mt({status:"invalid_state",changed:!1,error:o.error},!0);let s={kind:"clarify",snapshot:ly(e),mode:"idea",intent:o.request.intent,answer:i.answer},a=que(s);return r.set(a,s),qq(e,`clarify:${i.answer}`,a,s),mt({status:"needs_host_draft",changed:!1,schemaVersion:1,token:a,prompt:o.prompt,request:o.request,observation:o.observation})}),t.registerTool("clad_clarify",{title:"Answer the next Cladding onboarding question",description:"Apply a host-model refinement only for an answer supplied in a new user message after the pending question. Never call during the initialization approval turn; do not invent or alter the user answer.",inputSchema:{answer:E.string().min(1).describe("The user's answer, verbatim"),token:E.string().min(1).max(hA).optional(),draft:zq},outputSchema:{status:E.string(),changed:E.boolean(),cwd:E.string().optional(),answered:E.unknown().optional(),newQuestions:E.array(E.string()).optional(),mode:E.enum(["greenfield","existing-adoption","mixed"]).nullable().optional(),nextQuestion:E.string().nullable().optional(),remainingQuestions:E.number().optional(),refinementSource:E.string().optional(),pendingReview:E.array(E.string()).optional(),error:E.string().optional()},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1}},async i=>{let o=Bue(e,`clarify:${i.answer}`),s=(i.token?r.get(i.token)??Uq(i.token):null)??o?.request;if(!s||s.kind!=="clarify"||s.answer!==i.answer)return mt({status:"invalid_token",changed:!1},!0);if(s.snapshot!==ly(e))return mt({status:"stale_preparation",changed:!1},!0);if(!n)return mt({status:"unavailable",changed:!1},!0);i.token&&r.delete(i.token),Hue(e,`clarify:${i.answer}`);let a=n.renderDraft(i.draft),c=await n.clarify(i.answer,{cwd:e,hostDispatcher:async()=>a});return c.ok?mt({...c.report??{},changed:!0,refinementSource:"host"}):mt({status:"failed",changed:!1,error:c.error??"onboarding clarification failed"},!0)}),t.registerTool("clad_resolve_onboarding_review",{title:"Apply reviewed onboarding design proposals",description:"After showing proposal diffs and receiving explicit user approval, applies only the selected pending proposal targets. Never call this automatically; authored design is preserved until the user reviews it.",inputSchema:{targets:E.array(E.string()).min(1).describe("Exact active artifact paths returned in pendingReview.")},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1}},async i=>{if(!n)return mt({status:"unavailable",changed:!1},!0);let o=n.resolveReview(i.targets,{cwd:e});return mt({status:o.status??(o.ok?"resolved":"failed"),changed:o.changed,remaining:o.remaining,error:o.error},!o.ok)}),t.registerTool("clad_list_features",{title:"List cladding features",description:"List features from spec.yaml. Optionally filter by status or slug substring, and sort alphabetically (default) or by recent file mtime.",inputSchema:{statusFilter:E.enum(["planned","in_progress","done","archived"]).optional().describe("Limit to features with this status"),slugSubstring:E.string().optional().describe("Case-insensitive substring match on slug (e.g. 'auth')"),sort:E.enum(["alphabetical","recent"]).optional().describe("'alphabetical' (default \u2014 by id) or 'recent' (by file mtime, newest first)")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0}},async i=>{let o=ca(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let a=o.spec.features;if(i.statusFilter&&(a=a.filter(u=>u.status===i.statusFilter)),i.slugSubstring){let u=i.slugSubstring.toLowerCase();a=a.filter(d=>{let f=d.slug;return f?f.toLowerCase().includes(u):!1})}let l=(i.sort==="recent"?HJe(a,e):a).map(u=>({id:u.id,slug:u.slug,title:u.title,status:u.status}));return{content:[{type:"text",text:JSON.stringify({total:l.length,features:l},null,2)}]}}),t.registerTool("clad_get_feature",{title:"Get a cladding feature",description:'Returns one feature record by id (e.g. "F-049" or "F-a3f9c2") or by slug (e.g. "login-flow"). When a slug matches multiple features, all matches are returned.',inputSchema:{id:E.string().optional().describe('Feature id such as "F-049" or "F-a3f9c2"'),slug:E.string().optional().describe("Feature slug such as 'login-flow'")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0}},async i=>{if(!i.id&&!i.slug)return{isError:!0,content:[{type:"text",text:"provide either id or slug"}]};let o=ca(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=o.spec.features.filter(c=>!!(i.id&&c.id===i.id||i.slug&&c.slug===i.slug));if(s.length===0)return{isError:!0,content:[{type:"text",text:`no feature with ${i.id?`id "${i.id}"`:`slug "${i.slug}"`} found`}]};let a=s.length===1?s[0]:{matches:s};return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}),t.registerTool("clad_run_check",{title:"Run cladding drift check",description:"Runs `clad check` drift detection. Returns a TERSE report by default (pass, error/warn counts, top 3 blocking findings) to keep the agent loop cheap; pass verbose:true for every finding incl. info-severity + suggestions.",inputSchema:{strict:E.boolean().optional().describe("Treat warnings as errors when true"),verbose:E.boolean().optional().describe("Return the full report (all findings incl. info + suggestions) instead of the terse top-3 summary")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0}},async i=>{let o=ni({strict:i.strict,cwd:e});if(i.verbose)return{content:[{type:"text",text:JSON.stringify(o,null,2)}],isError:!o.pass};let s=o.findings??[],a=s.filter(d=>d.severity==="error"),c=s.filter(d=>d.severity==="warn"),l=(a.length>0?a:c).slice(0,3).map(d=>({detector:d.detector,severity:d.severity,message:d.message,...d.path?{path:d.path}:{},...d.line?{line:d.line}:{}})),u={stage:o.stage,pass:o.pass,errorCount:a.length,warnCount:c.length,findings:l,...a.length+c.length>l.length?{truncated:!0,hint:"call clad_run_check with verbose:true for all findings"}:{}};return{content:[{type:"text",text:JSON.stringify(u,null,2)}],isError:!o.pass}}),t.registerTool("clad_run_gate",{title:"Run the full Iron Law gate",description:"Runs the real `clad check` pipeline for a tier (default pre-commit for latency; pre-push runs type/lint/tests/coverage/conformance/smoke) and returns the untruncated JSON outcome. Strict by default \u2014 this is the verification surface; use clad_run_check for the cheap drift-only view.",inputSchema:{tier:E.enum(["pre-commit","pre-push","all"]).optional().describe("Stage tier (default pre-commit)"),strict:E.boolean().optional().describe("Promote warn findings to blocking (default true)")}},async i=>{let o=Nue();if(!o)return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Mt,error:"cladding engine shim (bin/clad) not found relative to the running server"})}]};let s=i.tier??"pre-commit",a=i.strict!==!1,c=Pue(o,["check",`--tier=${s}`,...a?["--strict"]:[],"--json"],{cwd:e,encoding:"utf8",timeout:3e5});try{let l=JSON.parse(c.stdout||"");return{isError:(l.worst??1)!==0,content:[{type:"text",text:JSON.stringify({schema_version:Mt,...l},null,2)}]}}catch{return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Mt,error:"gate produced no parseable JSON",stderr:(c.stderr??"").slice(0,400)})}]}}}),t.registerTool("clad_verdict",{title:"Poll the loop verdict",description:"One-poll loop decision over the real pre-push strict gate + feature statuses. Runs the gate ONCE and reduces it to {verdict, next_action, remaining} \u2014 call this INSTEAD OF clad_run_gate per loop turn, not in addition. verdict is one of DONE|ITERATE|ESCALATE|BLOCKED|BOOTSTRAP; DONE requires a green gate AND every feature done AND at least one non-liveness behavioral proof.",inputSchema:{tier:E.enum(["pre-commit","pre-push","all"]).optional().describe("Gate tier (default pre-push)")}},async i=>{let o=Nue();if(!o)return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Mt,error:"cladding engine shim (bin/clad) not found relative to the running server"})}]};let s=Pue(o,["verdict","--json",...i.tier?[`--tier=${i.tier}`]:[]],{cwd:e,encoding:"utf8",timeout:3e5});try{let a=JSON.parse(s.stdout||"");return{isError:!1,content:[{type:"text",text:JSON.stringify({schema_version:Mt,...a},null,2)}]}}catch{return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Mt,error:"verdict produced no parseable JSON",stderr:(s.stderr??"").slice(0,400)})}]}}}),t.registerTool("clad_get_context",{title:"Get the context slice for one feature",description:"Returns the working set for ONE feature in one call: the focus feature (full), its transitive depends_on ancestors (title+status), bound scenarios, the matching ai_hints patterns, and the union of the feature's test_refs. Look up by feature id (F-\u2026), slug, or a module path. Prefer this over reading shards by hand \u2014 dispatch the slice, never the whole spec.",inputSchema:{query:E.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/auth/login.ts)")}},async i=>{try{let o=ca(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=ol(o.spec,i.query),a="not_found"in s;return Mq(e,"clad_get_context",i.query,!a),{isError:a,content:[{type:"text",text:JSON.stringify({schema_version:Mt,...s},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_get_working_set",{title:"Get the token-budgeted working set for one feature (code + needs + breaks)",description:"Returns ONE token-budgeted working set for a feature/module: must_edit (focus + full ACs + the ACTUAL source code of its modules), needs (forward depends_on), breaks_if_changed (direct dependents + the regression test set), verify (scenarios + tests + oracle_refs + EARS unwanted/state high-risk ACs), guidance (ai_hints), and budget (what was clipped to fit). One call replaces reading the shard + opening each module file + grepping deps/tests. Look up by feature id (F-\u2026), slug, or module path.",inputSchema:{query:E.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/auth/login.ts)"),max_tokens:E.number().int().positive().max(2e4).optional().describe("Token budget for the payload (default 3000); distant deps then code then tests are clipped to fit")}},async i=>{try{let o=ca(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=Sa(o.spec,i.query,{cwd:e,maxTokens:i.max_tokens}),a="not_found"in s?null:{truncated:s.budget.truncated.length>0,sliceTokens:s.budget.used_tokens};return Mq(e,"clad_get_working_set",i.query,a!==null,a??void 0),{isError:"not_found"in s,content:[{type:"text",text:JSON.stringify({schema_version:Mt,...s},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_get_impact",{title:"Get the blast radius for a change (reverse / impact slice)",description:"Returns what a change to ONE feature or file could break: the transitive dependents (id+title+status), the scenarios bound to any of them, the deduped union of their test_refs (the regression set to re-run), and the modules in the radius. Look up by feature id (F-\u2026), slug, or a module path \u2014 a module fans out to ALL features that touch it. The backward complement of clad_get_context: forward = what this needs, impact = what depends on this. Prefer this over grepping to scope a safe refactor.",inputSchema:{query:E.string().describe("Feature id (F-\u2026), slug, or module path (e.g. src/spec/load.ts)"),max_depth:E.number().int().positive().max(6).optional().describe("Bound the dependent walk to N hops (default: unbounded \u2014 the full transitive radius)")}},async i=>{try{let o=ca(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=br(o.spec,i.query,{depth:i.max_depth}),a="not_found"in s;return Mq(e,"clad_get_impact",i.query,!a),{isError:a,content:[{type:"text",text:JSON.stringify({schema_version:Mt,...s},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_get_graph",{title:"Get the live knowledge graph (focused neighborhood, or a stats summary)",description:"With query: the focus node\u2019s N-hop neighborhood (typed nodes + edges; a path query unions its kind-twins). WITHOUT query: a compact stats summary (counts by kind + top hubs) \u2014 the full graph is tens of thousands of tokens, so use `clad graph export --format json` for a complete dump. Recomputed live, never stale. Node kinds + edge types: docs/knowledge-graph/design.md.",inputSchema:{query:E.string().optional().describe("Focus node: feature id (F-\u2026), slug, or module path. Omit for the stats summary."),max_depth:E.number().int().positive().max(6).optional().describe("Neighborhood radius around the focus node (default: full reachable subgraph from the focus)")}},async i=>{try{let o=ca(e);if("error"in o)return{isError:!0,content:[{type:"text",text:o.error}]};let s=o.spec,a=hc(s,e);if(!i.query)return{content:[{type:"text",text:JSON.stringify({schema_version:Mt,summary:!0,stats:Cx(a),hint:"pass query (feature id, slug, or module path) for a neighborhood subgraph; `clad graph export --format json` dumps the full graph"},null,2)}]};let c=Ex(s,a,i.query);if(c.length===0)return{isError:!0,content:[{type:"text",text:JSON.stringify({schema_version:Mt,not_found:i.query,accepted_forms:["feature id (F-\u2026)","slug","module path"],discovery:"grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); if the query is a file, fall back to normal code search"},null,2)}]};let l=kx(a,c,i.max_depth??1/0);return{content:[{type:"text",text:JSON.stringify({schema_version:Mt,...l},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_changelog",{title:"Collect shipped changes since a git ref (changelog manifest)",description:"The deterministic shipped-changes manifest for ..HEAD (default since: latest tag): done-feature shards grouped by capability, the inventory count diff, and feat:/fix: commits naming no feature id. For human release notes, render FROM the manifest \u2014 never invent a change it does not carry. Formats (manifest/markdown/audit/catalog): skills/changelog/SKILL.md.",inputSchema:{since:E.string().optional().describe("Git ref to diff from (default: latest tag via `git describe --tags --abbrev=0`)"),format:E.enum(["manifest","markdown","catalog","audit"]).optional().describe("Payload format (default 'manifest')")}},async i=>{try{let o=i.format??"manifest";if(o==="catalog"){let l=ll(H(e));return{content:[{type:"text",text:JSON.stringify({schema_version:Mt,format:o,content:l},null,2)}]}}let s=i.since??ts(e),a=rs(e,s);if(o==="manifest")return{content:[{type:"text",text:JSON.stringify({schema_version:Mt,...a},null,2)}]};let c=o==="audit"?cl(a,H(e),e):al(a);return{content:[{type:"text",text:JSON.stringify({schema_version:Mt,format:o,content:c},null,2)}]}}catch(o){return{isError:!0,content:[{type:"text",text:o.message}]}}}),t.registerTool("clad_get_events",{title:"Get recent cladding events",description:"Reads .cladding/events.log and returns the most recent entries.",inputSchema:{limit:E.number().int().positive().max(500).optional().describe("Maximum entries to return (default 50)")}},async i=>{let o=i.limit??50,s=Ft(e,".cladding","events.log.jsonl");if(!xn(s))return{content:[{type:"text",text:JSON.stringify({events:[],note:"no events log yet"})}]};let l=Gc(s,"utf8").split(` `).filter(u=>u.trim().length>0).slice(-o).map(u=>{try{return JSON.parse(u)}catch{return{unparseable:u.slice(0,200)}}});return{content:[{type:"text",text:JSON.stringify({events:l},null,2)}]}}),t.registerTool("clad_create_feature",{title:"Create a new cladding feature",description:"Creates spec/features/.yaml with an auto-generated F- id. Author the feature WITH its acceptance_criteria (and modules) in this one call \u2014 an AC-less feature is a hollow stub that governs nothing. Hash ids are collision-safe across concurrent branches; see docs/spec-ids-multi-dev.md.",inputSchema:{slug:E.string().regex(/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/).describe("Kebab-case slug \u2014 filename + spec.slug field (e.g. 'login-flow')"),title:E.string().optional().describe("Optional human-readable title; defaults to slug"),status:E.enum(["planned","in_progress","done","blocked","archived"]).optional().describe("Optional status; defaults to 'planned'"),modules:E.array(E.string()).optional().describe('Module paths the feature binds to (e.g. ["src/auth/login.ts"]).'),acceptance_criteria:E.array(E.object({ears:E.enum(["ubiquitous","event","state","optional","unwanted","complex"]).optional(),text:E.string().optional().describe('The "The system shall \u2026" statement.'),action:E.string().optional(),response:E.string().optional(),condition:E.string().optional().describe("Trigger/precondition for event/state EARS."),test_refs:E.array(E.string()).optional().describe("Paths to verifying tests."),evidence_refs:E.array(E.string()).optional(),notes:E.string().optional()})).optional().describe("Acceptance criteria authored now (ids auto-assigned AC-001\u2026). Strongly preferred over an empty feature \u2014 this is what makes the feature governable."),design_impact:E.discriminatedUnion("classification",[E.object({classification:E.literal("none"),rationale:E.string().min(1)}),E.object({classification:E.literal("additive"),rationale:E.string().min(1),capability:E.string().regex(/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/),capability_title:E.string().min(1).optional(),scenario:E.string().min(1).optional()}),E.object({classification:E.literal("structural"),rationale:E.string().min(1),artifacts:E.array(E.enum(["spec/architecture.yaml","spec/capabilities.yaml","docs/project-context.md"])).min(1)})]).optional().describe("Optional design-impact decision. Omit for the legacy-compatible create-only path; structural changes remain review_required until resolved.")}},async i=>{let o=sy(e);if(o)return o;let s=Zue(e,jue);try{let a=kue({slug:i.slug,title:i.title,status:i.status,modules:i.modules,acceptance_criteria:i.acceptance_criteria,design_impact:i.design_impact?{classification:i.design_impact.classification,rationale:i.design_impact.rationale,artifacts:i.design_impact.classification==="structural"?i.design_impact.artifacts:void 0}:void 0,cwd:e});i.design_impact?.classification==="additive"&&(Nq({capability:i.design_impact.capability,feature:a.id,title:i.design_impact.capability_title,cwd:e}),i.design_impact.scenario&&xue({scenario:i.design_impact.scenario,feature:a.id,cwd:e})),cy(e);let c=i.design_impact,l={schema_version:Mt,...a,gate:ay(e),...c?{designImpact:c.classification==="structural"?{status:"review_required",artifacts:c.artifacts,next:"Preview and apply the listed Tier-B design changes, then call clad_resolve_design_impact."}:{status:"resolved",classification:c.classification}}:{hint:`If this feature is user-facing, link it to a capability with clad_link_capability (capability: , feature: ${a.id}) so the Tier-B design SSoT grows with development instead of being left an empty seed.`}};return{content:[{type:"text",text:JSON.stringify(l,null,2)}]}}catch(a){return Vue(e,jue,s),{isError:!0,content:[{type:"text",text:a.message}]}}}),t.registerTool("clad_resolve_design_impact",{title:"Resolve a reviewed structural design impact",description:"Marks a feature structural design impact resolved only after the user-approved Tier-B changes have been applied. Do not call this merely to clear the gate; verify every artifact listed in the feature first.",inputSchema:{feature:E.string().describe("Feature id whose listed Tier-B design changes are now applied.")}},async i=>{let o=sy(e);if(o)return o;try{let s=$ue({feature:i.feature,cwd:e});return cy(e),{content:[{type:"text",text:JSON.stringify({schema_version:Mt,...s,gate:ay(e)},null,2)}]}}catch(s){return{isError:!0,content:[{type:"text",text:s.message}]}}}),t.registerTool("clad_author_oracle",{title:"Record an impl-blind spec-conformance oracle",description:"Records a host-authored conformance oracle for a feature AC + its impl-blind PROVENANCE, writes the test under tests/oracle/, and stamps oracle_refs so the SPEC_CONFORMANCE gate verifies it. cladding does NOT author the oracle. AUTHOR ONLY ACs on the policy worklist (`clad oracle --required`) \u2014 an empty worklist means do not author unless the user explicitly asks (out-of-policy recordings are labeled voluntary). FIRST run `clad oracle --ac ` for the spec-only brief; spawn a FRESH sub-agent given ONLY that brief (never the implementation); have it write the test; then call this with the body + the manifest of exactly what the sub-agent saw. Blindness is your discipline \u2014 the gate audits the manifest (manifest\u2229modules must be empty) and the author\u2260implementer identity, and records whether you attested a clean (blind) context.",inputSchema:{featureId:E.string().describe("The F- feature id."),acId:E.string().describe("The AC- the oracle verifies."),body:E.string().describe("The authored vitest oracle source (imports the module under test)."),readManifest:E.array(E.string()).describe("EXACTLY what the blind sub-agent was shown (the clad oracle brief: spec/AC + signatures). MUST NOT include an implementation file the feature owns."),blind:E.boolean().optional().describe("True only if the sub-agent saw the spec-only brief and nothing else."),authorName:E.string().optional().describe("Oracle author identity (sub-agent / model id) \u2014 must differ from the implementer for the gate to pass.")}},async i=>{let o=sy(e);if(o)return o;try{let s=Rue({featureId:i.featureId,acId:i.acId,body:i.body,readManifest:i.readManifest,blind:i.blind,authorName:i.authorName,cwd:e});cy(e);let a={};try{let c=H(e),l=Op(c.project,Rp(c)),d=c.features.find(f=>f.id===i.featureId)?.acceptance_criteria?.find(f=>f.id===i.acId);(!d||!Ip(l,i.featureId,d))&&(a={voluntary:!0,cost_note:"this AC is not on the project's oracle worklist (`clad oracle --required`) \u2014 recording anyway as voluntary; prefer policy-listed ACs to keep token spend inside the declared verification budget."})}catch{}return{content:[{type:"text",text:JSON.stringify({schema_version:Mt,...s,...a,gate:ay(e)},null,2)}],isError:!s.ok}}catch(s){return{isError:!0,content:[{type:"text",text:s.message}]}}}),t.registerTool("clad_create_scenario",{title:"Create a new cladding scenario",description:"Creates spec/scenarios/-.yaml with an auto-generated S- id. Same multi-dev safety property as clad_create_feature: two concurrent invocations on separate branches produce distinct hash ids by construction.",inputSchema:{slug:E.string().regex(/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/).describe("Kebab-case slug (e.g. 'checkout-happy-path')"),title:E.string().optional().describe("Optional human-readable title; defaults to slug"),flow:E.string().optional().describe("Prose user-journey flow (what the user does, step by step)."),features:E.array(E.string().regex(/^F-(\d{3,}|[a-f0-9]{6,})$/)).optional().describe("Optional list of feature ids the scenario touches")}},async i=>{let o=sy(e);if(o)return o;try{let s=Eue({slug:i.slug,title:i.title,flow:i.flow,features:i.features,cwd:e});return cy(e),{content:[{type:"text",text:JSON.stringify({schema_version:Mt,...s,gate:ay(e)},null,2)}]}}catch(s){return{isError:!0,content:[{type:"text",text:s.message}]}}}),t.registerTool("clad_link_capability",{title:"Link a feature to a capability",description:"Upserts a feature into spec/capabilities.yaml: creates the capability if absent, else appends the feature to its features[] (deduped). A capability is ACCUMULATIVE, so the verb is link, not create. Use this when a user-facing feature lands so the design tier grows with development instead of being left an empty seed.",inputSchema:{capability:E.string().regex(/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/).describe("Capability id (kebab-slug, e.g. 'auth'). Created if it does not exist yet."),feature:E.string().regex(/^F-(\d{3,}|[a-f0-9]{6,})$/).describe("Feature id to add to the capability"),title:E.string().optional().describe("Title, used only when the capability is newly created"),summary:E.string().optional().describe("Summary, used only when newly created"),surface:E.enum(["feature","platform","tool","infrastructure"]).optional().describe("Surface, used only when newly created")}},async i=>{let o=sy(e);if(o)return o;try{let s=Nq({capability:i.capability,feature:i.feature,title:i.title,summary:i.summary,surface:i.surface,cwd:e});return cy(e),{content:[{type:"text",text:JSON.stringify({schema_version:Mt,...s,gate:ay(e)},null,2)}]}}catch(s){return{isError:!0,content:[{type:"text",text:s.message}]}}})}function cy(t){try{if(xn(Ft(t,"spec.yaml"))){if(ha(t))return;Ll(t,ys(t)),Za(t),Vx(t)}}catch{}}function HJe(t,e){let r=Ft(e,"spec","features"),n=t.map(i=>{let o=i.slug,s=[o?Ft(r,`${o}-${i.id.slice(2)}.yaml`):null,Ft(r,`${i.id}.yaml`)].filter(c=>c!==null),a=0;for(let c of s)try{if(xn(c)){a=yA(c).mtimeMs;break}}catch{}return{feature:i,mtime:a}});return n.sort((i,o)=>o.mtime-i.mtime),n.map(i=>i.feature)}function GJe(t,e){t.registerResource("spec",aa.spec,{title:"Cladding spec",description:"The active spec.yaml \u2014 aggregated when sharded.",mimeType:"application/json"},async()=>{let r=ca(e),n="error"in r?JSON.stringify({error:r.error},null,2):JSON.stringify(r.spec,null,2);return{contents:[{uri:aa.spec,mimeType:"application/json",text:n}]}}),t.registerResource("events",aa.events,{title:"Cladding events log",description:"Raw JSONL stream of feature_activated, evidence_appended, gate_run, \u2026",mimeType:"application/x-ndjson"},async()=>{let r=Ft(e,".cladding","events.log.jsonl"),n=xn(r)?Gc(r,"utf8"):"";return{contents:[{uri:aa.events,mimeType:"application/x-ndjson",text:n}]}}),t.registerResource("audit",aa.audit,{title:"Cladding audit log",description:"HITL audit log \u2014 every persona dispatch and human signoff.",mimeType:"application/x-ndjson"},async()=>{let r=Ft(e,".cladding","audit.log.jsonl"),n=xn(r)?Gc(r,"utf8"):"";return{contents:[{uri:aa.audit,mimeType:"application/x-ndjson",text:n}]}})}function ZJe(t,e){let r=(n,i,o)=>{t.registerPrompt(n,{title:`Cladding persona \u2014 ${i}`,description:o,argsSchema:{featureId:E.string().optional().describe("Optional feature id to interpolate into the persona context")}},s=>{let a=ry(i),c=s.featureId?` Active feature: ${s.featureId} `:"";return{messages:[{role:"user",content:{type:"text",text:`${a.body}${c}`}}]}})};for(let n of zue)r(n,n,`Persona prompt body for the ${n} agent.`);for(let[n,i]of Object.entries(Uue))r(n,i,`Persona prompt body for the ${i} agent. (Renamed: '${n}' is now '${i}' in 0.6.0 \u2014 this alias is removed in 0.8.)`)}var zue,Uue,RJe,aa,Mt,NJe,zq,hA,MJe,Gue,jue,Kue=y(()=>{"use strict";yue();Ic();Oq();Iq();Nr();il();R_();ti();qe();Aue();Iue();Yv();Bj();wp();ga();E_();va();T_();Gm();wj();Dp();zue=["orchestrator","planner","reviewer","observability","developer"],Uue={librarian:"planner",specialists:"developer"},RJe=["clad_prepare_init","clad_stage_init","clad_init","clad_prepare_clarify","clad_clarify","clad_resolve_onboarding_review","clad_list_features","clad_get_feature","clad_run_check","clad_get_events","clad_create_feature","clad_resolve_design_impact","clad_create_scenario","clad_link_capability","clad_author_oracle","clad_run_gate","clad_verdict","clad_get_context","clad_get_working_set","clad_get_impact","clad_get_graph","clad_changelog"],aa={spec:"cladding://spec",events:"cladding://events",audit:"cladding://audit"};Mt=1;NJe=new Set([".md",".txt",".yaml",".yml",".markdown"]);zq=E.object({mode:E.enum(["greenfield","existing-adoption","mixed"]),project_context:E.object({why:E.string().min(1),problem:E.string().min(1),purpose:E.string().min(1)}),capabilities:E.array(E.object({id:E.string().min(1),title:E.string().min(1),summary:E.string().min(1),surface:E.enum(["feature","platform","tool","infrastructure"])})).min(3).max(8),architecture:E.object({layers:E.array(E.object({name:E.string().min(1),forbidden_imports:E.array(E.string())}))}),scenarios:E.array(E.object({slug:E.string().min(1),title:E.string().min(1),flow:E.string().min(1)})).min(1).max(3),questions:E.array(E.string().min(1)).max(3),ai_hints:E.record(E.string(),E.unknown()).optional()}),hA=1e6,MJe=1800*1e3;Gue=["spec.yaml",".gitignore","AGENTS.md","docs/conventions.md","docs/project-context.md","spec/architecture.yaml","spec/capabilities.yaml","spec/scenarios",".cladding/onboarding",".cladding/scan"],jue=["spec/features","spec/capabilities.yaml","spec/scenarios","spec.yaml","spec/index.yaml",".cladding/events.log.jsonl"]});function VJe(t){return mse.parse(JSON.parse(t))}function Jue(t){return JSON.stringify(t)+` diff --git a/plugins/codex/skills/orchestrator/SKILL.md b/plugins/codex/skills/orchestrator/SKILL.md index 073305af..bf8d0c1e 100644 --- a/plugins/codex/skills/orchestrator/SKILL.md +++ b/plugins/codex/skills/orchestrator/SKILL.md @@ -29,7 +29,7 @@ You do NOT pre-load Tier C (conventions — developer's concern). 3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. 4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). 5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. -6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/stage/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, then call `clad_stage_init` with the preparation token and that draft *before* showing anything (staging validates the draft and stores only ignored runtime state, so process-per-turn hosts can apply later without re-sending it). Show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never stage and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. ## Feature cycle — one feature at a time diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 31a0ebc3..ee28df9e 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -73,7 +73,7 @@ attested_modules: plugins/claude-code/.claude-plugin/plugin.json: 3ece00e95ac4e232 plugins/claude-code/agents/developer.md: 40af2943253f6c72 plugins/claude-code/agents/observability.md: 5ea8f14b1c9b4a61 - plugins/claude-code/agents/orchestrator.md: 18f41e1dbfe6d95b + plugins/claude-code/agents/orchestrator.md: 443c6e13ade590cf plugins/claude-code/agents/planner.md: 934753c28d5f1287 plugins/claude-code/agents/reviewer.md: 9c4e095e60040473 plugins/claude-code/commands/init.md: bf567f3b4e22069a @@ -84,7 +84,7 @@ attested_modules: plugins/codex/skills/developer/SKILL.md: 40af2943253f6c72 plugins/codex/skills/init/SKILL.md: bf567f3b4e22069a plugins/codex/skills/observability/SKILL.md: 5ea8f14b1c9b4a61 - plugins/codex/skills/orchestrator/SKILL.md: 18f41e1dbfe6d95b + plugins/codex/skills/orchestrator/SKILL.md: 443c6e13ade590cf plugins/codex/skills/planner/SKILL.md: 934753c28d5f1287 plugins/codex/skills/reviewer/SKILL.md: 9c4e095e60040473 plugins/codex/skills/run/SKILL.md: 9f95ff17d70c8dd1 @@ -139,7 +139,7 @@ attested_modules: src/agents/developer.md: 40af2943253f6c72 src/agents/loader.ts: 6d35560c47f9ae85 src/agents/observability.md: 5ea8f14b1c9b4a61 - src/agents/orchestrator.md: 18f41e1dbfe6d95b + src/agents/orchestrator.md: 443c6e13ade590cf src/agents/planner.md: 934753c28d5f1287 src/agents/reviewer.md: 9c4e095e60040473 src/changelog/collect.ts: a6c936a7b8c34e2a @@ -177,7 +177,7 @@ attested_modules: src/cli/scan/thresholds.ts: ec0047b894a6aa6a src/cli/scan/types.ts: ea0170aa88c1c14a src/cli/scan/walker.ts: 33e4448e365e47c6 - src/cli/update.ts: 26abe9f2e1d1e88f + src/cli/update.ts: c607b3e638533508 src/cli/verdict.ts: 7aa16b8739ab8e5f src/core/checkpoint.ts: 63300c2764533b6c src/core/git-ops.ts: 4544bde493a0628f @@ -204,7 +204,7 @@ attested_modules: src/hitl/identity.ts: 52ff84aa666f1dab src/init/agents-md.ts: 7dc05f6d82e5c3ce src/init/git-hook.ts: 4e02f177b3764ae8 - src/init/host-instructions.ts: f6d10695ef0c4763 + src/init/host-instructions.ts: b6dbb40fadbf4c2d src/init/host-setup.ts: 83213a4bbed1e3bd src/optimizer: a4d0f0eb87fed960 src/optimizer/code-excerpt.ts: e2c4598efcd28d2a @@ -228,7 +228,7 @@ attested_modules: src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 - src/serve/server.ts: a19d47091ca3b212 + src/serve/server.ts: c5bfc4e6caa09c15 src/spec: a4d0f0eb87fed960 src/spec/attestation.ts: 294a1e99c42d4aef src/spec/cli.ts: 7a9bcd0f66677810 diff --git a/src/agents/orchestrator.md b/src/agents/orchestrator.md index 073305af..bf8d0c1e 100644 --- a/src/agents/orchestrator.md +++ b/src/agents/orchestrator.md @@ -29,7 +29,7 @@ You do NOT pre-load Tier C (conventions — developer's concern). 3. **Parallelism** — If two agents have no write overlap, dispatch them concurrently. 4. **Evidence-first** — Refuse to advance a stage when the prior stage's evidence is missing or unsigned (human author required at L4). 5. **Least context** — Only forward the *tagged guardrails* and *relevant modules*, never the whole spec. -6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never prepare and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. +6. **Init + clarify policy (required)** — Use the host-neutral MCP prepare/stage/apply loop. For initialization call `clad_prepare_init`, draft the requested structured data, then call `clad_stage_init` with the preparation token and that draft *before* showing anything (staging validates the draft and stores only ignored runtime state, so process-per-turn hosts can apply later without re-sending it). Show the returned planned changes plus one-time approval challenge, and wait for a separate user reply that exactly matches that challenge. The original request, a question, or a paraphrase is not confirmation. Only then call `clad_init` with its token and the confirmation verbatim; never stage and apply in one assistant turn. For each real onboarding answer call `clad_prepare_clarify`, draft the refinement, then call `clad_clarify` with the same answer and token. Ask returned questions verbatim and never invent answers. Do not invoke onboarding through shell commands or MCP sampling. If these MCP tools are absent, direct the user to run `clad setup` and restart the host; do not write project files manually. ## Feature cycle — one feature at a time diff --git a/src/cli/update.ts b/src/cli/update.ts index 472ae9c8..c13c0a15 100644 --- a/src/cli/update.ts +++ b/src/cli/update.ts @@ -38,9 +38,10 @@ import {computeInventory, writeInventoryToSpecYaml, writeFeatureIndex} from '../ import {gitOperationInProgress} from '../core/git-ops.js'; /** - * Injected so `runUpdate` is unit-testable without touching the global home - * dir. The drift REPORT is deliberately NOT here — it is report-only and lives - * in the command wrapper, so `runUpdate` only ever does safe mutations. + * Injected so `runUpdate` is unit-testable without running the real host + * wiring (project-local since 0.9.0). The drift REPORT is deliberately NOT + * here — it is report-only and lives in the command wrapper, so `runUpdate` + * only ever does safe mutations. */ export interface UpdateDeps { /** Re-wire host channels (wraps `runHostSetup`); resolves to the wiring-error count. */ @@ -48,7 +49,7 @@ export interface UpdateDeps { } export interface UpdateResult { - /** False when `cwd` has no spec.yaml — only the global re-wire ran. */ + /** False when `cwd` has no spec.yaml — only the host re-wire ran. */ readonly isProject: boolean; /** Count of host channels that failed to wire (0 = clean). */ readonly wiringErrors: number; @@ -93,7 +94,9 @@ function mapAgentsMdResult(r: SpecAgentsMdResult): AgentsMdResult { * stricter-detector REPORT is the caller's job (report-only, never blocks). */ export async function runUpdate(cwd: string, deps: UpdateDeps): Promise { - // 1. Re-wire hosts (global, idempotent) — useful even outside a project. + // 1. Re-wire host channels into the project (idempotent, project-local + // since 0.9.0). Note: runs before the spec.yaml guard below, so update + // scaffolds host wiring into cwd even when it is not a cladding project. const wiringErrors = await deps.wireHosts(); if (!existsSync(join(cwd, 'spec.yaml'))) { diff --git a/src/init/host-instructions.ts b/src/init/host-instructions.ts index d5f85efc..fb35fca7 100644 --- a/src/init/host-instructions.ts +++ b/src/init/host-instructions.ts @@ -4,10 +4,9 @@ // • /AGENTS.md — cross-tool (Codex/Cursor/Continue/Copilot/Aider) // • /CLAUDE.md — Claude Code memory (idempotent append) // -// Does NOT write `.claude-plugin/plugin.json`, `.mcp.json`, or -// `.codex/config.toml` to the project — those live globally under the user's -// home directory and are populated by the npm postinstall hook (and the -// `clad init` fallback retry for users who ran with `--ignore-scripts`). +// Does NOT write `.mcp.json`, `.codex/config.toml`, or the other host MCP +// wiring files — those are project-local since 0.9.0 and are written by +// `clad setup` (src/init/host-setup.ts), never at npm install time. import { existsSync, readFileSync, writeFileSync } from 'node:fs'; import { join } from 'node:path'; diff --git a/src/serve/server.ts b/src/serve/server.ts index 3b0bd719..75f14865 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -414,12 +414,14 @@ const MAX_APPROVAL_ENVELOPE_BYTES = 1_000_000; const PREPARATION_TTL_MS = 30 * 60 * 1000; /** - * Carries read-only preparation state across host process restarts. + * Carries preparation state across host process restarts. * * The digest detects truncation/corruption; authorization still comes from the * separately displayed exact challenge. Workspace freshness makes a consumed - * envelope stale after the first successful write without prepare writing any - * hidden project state. + * envelope stale after the first successful write. Prepare writes no authored + * project files, but it does persist a TTL'd consent-cache envelope: under the + * OS temp dir (owner-only 0600) until a draft is staged, then under the + * ignored `.cladding/host/onboarding-pending/`. */ function encodePreparedOnboarding(request: PreparedOnboarding): string { const body = deflateRawSync(Buffer.from(JSON.stringify(request))).toString('base64url'); @@ -608,7 +610,8 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp { title: 'Prepare Cladding onboarding context', description: - 'Read-only first step for every explicit Cladding initialization request. Inspect the connected project, ' + + 'Non-destructive first step for every explicit Cladding initialization request: writes no authored project ' + + 'files (only a TTL\'d consent cache). Inspect the connected project, ' + 'then use this tool result to draft the structured input for clad_init. Never run clad init in a shell.', inputSchema: { mode: z.enum(['idea', 'document', 'existing']), From 79cbcfefa5dd10f937a92c922349cb546b1a6469 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Thu, 16 Jul 2026 16:35:37 +0900 Subject: [PATCH 26/28] fix(setup): close the 0.9.0 E2E campaign gate findings Live campaign against the packed 0.9.0 tarball across all five hosts surfaced these; each fix carries a regression test. - setup default now wires only detected hosts (spec AC-001 restored); --host all stays the explicit override, zero-detection warns and writes just the shared runtime - Antigravity: agy 1.1.2 never reads project MCP config (proved by negative control), so setup also writes the machine-wide ~/.gemini/config/plugins/cladding wire (engine-absolute launch, project resolved from session cwd); foreign dirs/symlinks preserved without --force; reported as the one project-local exception - clad update outside a project no longer wires hosts (13-file cwd pollution + reachable account-wide claude plugin uninstall) - staged onboarding drafts are schema-revalidated on apply; a tampered durable cache now returns draft_required instead of a raw TypeError - consent-cache staging sweeps expired envelopes (644 stale files had accumulated in the shared temp dir on the reference machine) - codex legacy cleanup splices the TOML section textually (user comments/formatting preserved, parse-verified with lossy fallback); cursor cleanup no longer leaves an orphan empty mcpServers - setup-command-80d19d shard rewritten to the project-scoped contract (all 12 test_refs were dangling since the 0.9.0 rewrite); docs/setup.md documents detection, the agy exception, codex headless approvals, and the refreshed per-host verification levels Co-Authored-By: Claude Fable 5 --- README.html | 4 +- README.ja.md | 4 +- README.ko.html | 4 +- README.ko.md | 4 +- README.md | 4 +- README.zh.md | 4 +- docs/setup.md | 48 +- plugins/claude-code/dist/clad.js | 779 ++++++++++++------------ spec/attestation.yaml | 23 +- spec/features/setup-command-80d19d.yaml | 199 +++--- spec/index.yaml | 2 +- src/cli/clad.ts | 15 +- src/cli/update.ts | 16 +- src/init/host-setup.ts | 134 +++- src/serve/server.ts | 38 +- tests/cli/setup.test.ts | 143 ++++- tests/cli/update.test.ts | 8 +- tests/serve/init-tools.test.ts | 44 ++ 18 files changed, 909 insertions(+), 564 deletions(-) diff --git a/README.html b/README.html index 133460ef..54a48112 100644 --- a/README.html +++ b/README.html @@ -233,7 +233,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -548,7 +548,7 @@

Status

tests
-
2556/2556
+
2566/2566
all pass
diff --git a/README.ja.md b/README.ja.md index 2aa26a41..33c293d9 100644 --- a/README.ja.md +++ b/README.ja.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -339,7 +339,7 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.0(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2556 / 2556 | 15 段階 · 41 detectors | 255(251 done) | +| v0.9.0(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2566 / 2566 | 15 段階 · 41 detectors | 255(251 done) | 236 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック diff --git a/README.ko.html b/README.ko.html index 05d434f7..94dd0c09 100644 --- a/README.ko.html +++ b/README.ko.html @@ -275,7 +275,7 @@

cladding

ironclad spec - tests + tests detectors license

@@ -584,7 +584,7 @@

Status

tests
-
2556/2556
+
2566/2566
all pass
diff --git a/README.ko.md b/README.ko.md index b22799b7..4f1e2630 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

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

ironclad spec - tests + tests detectors license

@@ -350,7 +350,7 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.0 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2556 / 2556 | 15 stages · 41 detectors | 255 (251 done) | +| v0.9.0 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2566 / 2566 | 15 stages · 41 detectors | 255 (251 done) | 236 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector diff --git a/README.zh.md b/README.zh.md index 3ce9d583..18c6f6c3 100644 --- a/README.zh.md +++ b/README.zh.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -335,7 +335,7 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.0(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2556 / 2556 | 15 阶段 · 41 检测器 | 255(251 done) | +| v0.9.0(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2566 / 2566 | 15 阶段 · 41 检测器 | 255(251 done) | 234 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/docs/setup.md b/docs/setup.md index 378315a8..994aa4be 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -14,12 +14,25 @@ the detail behind them: where each host is wired, how the MCP server works, and | Claude Code | `.claude/skills/cladding-init` + `.mcp.json` | | Codex CLI | `.agents/skills/cladding-init` + `.codex/config.toml` | | Gemini CLI | `.agents/skills/cladding-init` + `.gemini/settings.json` | -| Antigravity (`agy`) | `.agents/skills/cladding-init` + `.agents/mcp_config.json` | +| Antigravity (`agy`) | `.agents/skills/cladding-init` + `.agents/mcp_config.json` (forward-compat) + machine-wide `~/.gemini/config/plugins/cladding/` — see the Antigravity note below | | Cursor | `.cursor/skills/cladding-init` + `.cursor/mcp.json` + `.cursor/cli.json` read-only tool allowlist + bootstrap rule | The only machine-specific path lives in `.cladding/host/serve.cjs`, which is ignored project runtime state. Re-run setup on each developer machine. Host config files use the portable relative launcher path and preserve unrelated entries. With no arguments the launcher starts MCP; with arguments it forwards a normal CLI command to that exact same engine. Generated project guidance therefore uses `node .cladding/host/serve.cjs check --strict` and similar shell calls when the launcher exists, preventing a different global installation from silently validating the project with another build. -Codex loads `.codex/config.toml` only for a trusted Git repository. Accept Codex's normal project-trust prompt when opening the repository; this is a Codex security boundary and `clad setup` does not bypass or pre-approve it. +With no `--host` option, setup wires only the hosts whose home markers exist on the machine and +reports the rest as `not selected`; `clad setup --host all` forces every channel, `--host ` +exactly one. + +Codex loads `.codex/config.toml` only for a trusted Git repository. Accept Codex's normal project-trust prompt when opening the repository; this is a Codex security boundary and `clad setup` does not bypass or pre-approve it. One consequence for scripted use: the project config asks Codex to approve write-capable tools, and Cladding annotates its onboarding tools honestly as non-read-only, so non-interactive `codex exec` auto-denies the onboarding prepare/stage/apply calls. Interactive Codex simply shows its approval prompt; headless automation must pass Codex's own approvals-bypass flag. + +**Antigravity is the one deliberate exception to project-local activation.** `agy` 1.1.2 reads MCP +config only from machine-wide locations (`~/.gemini/config/mcp_config.json` or +`~/.gemini/config/plugins//`) — it does not load a project `.agents/mcp_config.json` +(verified live in the 0.9.0 campaign, including a negative control). Setup therefore also writes +`~/.gemini/config/plugins/cladding/{plugin.json,mcp_config.json}` with an engine-absolute launch; +agy spawns MCP servers with each session's working directory, so the single machine-wide wire stays +project-aware. The project file is kept for forward compatibility, and the setup report calls the +exception out. A foreign directory already at that path is preserved unless `--force` is given. Gemini likewise loads project skills and settings only after its normal folder-trust boundary is satisfied. Interactive use keeps that prompt intact; the explicitly consented doctor smoke uses Gemini's session-only trust override so a fresh verification fixture can exercise the project-local MCP connection without changing persistent trust settings. That smoke stays in Gemini Plan Mode and loads an ignored project policy permitting only the three @@ -31,21 +44,22 @@ Cladding tools retain Cursor's normal approval boundary. On upgrade, setup removes legacy global Cladding wires only when their ownership is provable. Ambiguous or hand-edited files are preserved and reported. If an old Claude user plugin remains, run `claude plugin uninstall claude-code@cladding --scope user --keep-data`. -**Verification level (honesty note).** Claude Code's MCP/runtime surfaces and real-time -intervention are verified through earlier real-usage campaigns; the natural-language onboarding -flow introduced in this release could not be re-run because the logged-in host reported its weekly -quota exhausted; project MCP handshake and tool discovery passed, but onboarding remains pending. -Gemini's project-local skill discovery and MCP connection passed in an isolated HOME, but the -available Google login was rejected before a model prompt could run, so its model surfaces remain -`not-run` rather than being promoted from structural evidence. -Codex CLI `0.144.3` is live-verified for idea, planning-document, existing-project, uninitialized -controls, and all three doctor surfaces. Antigravity `1.1.2` is live-verified for all three -onboarding cases plus both controls after disabling the legacy global plugin. Cursor Agent -`2026.07.09-a3815c0` is live-verified for the same five cases through project-local MCP wiring. -(The machine-readable -claim lives in the README's `clad:host-claims` fence, which `HOST_CLAIM_DRIFT` polices against -`docs/dogfood/matrix.md`; its `verified` grade covers the doctor surfaces listed in that matrix, -not every release-specific onboarding campaign.) +**Verification level (honesty note, 0.9.0 packed-tarball campaign).** Claude Code `2.1.211` is +live-verified end-to-end from a packed 0.9.0 install: project `.mcp.json` discovery behind the +per-project approval gate, the full natural-language consent flow (stop at preview, paraphrase +rejected, exact phrase applies), the clarify loop, and model-driven feature creation. Codex CLI +`0.144.4` is live-verified for the same consent flow in a trusted repository, including a +fresh-process apply that resolved the staged draft from the durable cache. Antigravity `1.1.2` is +live-verified for the consent flow and clarify loop, but only through the machine-wide wire — a +negative control proved it never reads the project MCP file, which is why setup writes the +machine-wide wire described above. Gemini's project-local MCP connection and tool registration are +structurally verified after folder trust; its model surfaces remain `not-run` because the available +individual-tier login is rejected by Gemini CLI (`IneligibleTierError`). Cursor Agent +`2026.07.09-a3815c0` passed structural verification (server ready, 22 tools enumerated, negative +control) but its model replay is `not-run` for this campaign (account usage limit). (The +machine-readable claim lives in the README's `clad:host-claims` fence, which `HOST_CLAIM_DRIFT` +polices against `docs/dogfood/matrix.md`; its `verified` grade covers the doctor surfaces listed in +that matrix, not every release-specific onboarding campaign.) ## About the MCP server diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 62d4aa7c..8b36ce6f 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 Ode=Object.create;var wA=Object.defineProperty;var Rde=Object.getOwnPropertyDescriptor;var Ide=Object.getOwnPropertyNames;var Pde=Object.getPrototypeOf,Cde=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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)wA(t,r,{get:e[r],enumerable:!0})},Dde=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ide(e))!Cde.call(t,i)&&i!==r&&wA(t,i,{get:()=>e[i],enumerable:!(n=Rde(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Ode(Pde(t)):{},Dde(e||!t||!t.__esModule?wA(r,"default",{value:t,enumerable:!0}):r,t));var Qd=v($A=>{var fy=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}},xA=class extends fy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};$A.CommanderError=fy;$A.InvalidArgumentError=xA});var py=v(EA=>{var{InvalidArgumentError:Nde}=Qd(),kA=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 Nde(`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 jde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}EA.Argument=kA;EA.humanReadableArgName=jde});var OA=v(TA=>{var{humanReadableArgName:Mde}=py(),AA=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=>Mde(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 r4(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)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pr=(t,e)=>{for(var r in e)$A(t,r,{get:e[r],enumerable:!0})},Nde=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Pde(e))!Dde.call(t,i)&&i!==r&&$A(t,i,{get:()=>e[i],enumerable:!(n=Ide(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Rde(Cde(t)):{},Nde(e||!t||!t.__esModule?$A(r,"default",{value:t,enumerable:!0}):r,t));var rf=v(EA=>{var yy=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}},kA=class extends yy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};EA.CommanderError=yy;EA.InvalidArgumentError=kA});var _y=v(TA=>{var{InvalidArgumentError:jde}=rf(),AA=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 jde(`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 Mde(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}TA.Argument=AA;TA.humanReadableArgName=Mde});var IA=v(RA=>{var{humanReadableArgName:Fde}=_y(),OA=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=>Fde(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 i4(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 r4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}TA.Help=AA;TA.stripColor=r4});var CA=v(PA=>{var{InvalidArgumentError:Fde}=Qd(),RA=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=Lde(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 Fde(`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?n4(this.name().replace(/^no-/,"")):n4(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}},IA=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 n4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Lde(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 i4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}RA.Help=OA;RA.stripColor=i4});var NA=v(DA=>{var{InvalidArgumentError:Lde}=rf(),PA=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=zde(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 Lde(`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}},CA=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 zde(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}}PA.Option=RA;PA.DualOptions=IA});var o4=v(i4=>{function zde(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 Ude(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=zde(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}}DA.Option=PA;DA.DualOptions=CA});var a4=v(s4=>{function Ude(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 qde(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=Ude(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]}?)`:""}i4.suggestSimilar=Ude});var l4=v(FA=>{var qde=Ge("node:events").EventEmitter,DA=Ge("node:child_process"),lo=Ge("node:path"),my=Ge("node:fs"),Ue=Ge("node:process"),{Argument:Bde,humanReadableArgName:Hde}=py(),{CommanderError:NA}=Qd(),{Help:Gde,stripColor:Zde}=OA(),{Option:s4,DualOptions:Vde}=CA(),{suggestSimilar:a4}=o4(),jA=class t extends qde{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=>Ue.stdout.write(r),writeErr:r=>Ue.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ue.stdout.isTTY?Ue.stdout.columns:void 0,getErrHelpWidth:()=>Ue.stderr.isTTY?Ue.stderr.columns:void 0,getOutHasColors:()=>MA()??(Ue.stdout.isTTY&&Ue.stdout.hasColors?.()),getErrHasColors:()=>MA()??(Ue.stderr.isTTY&&Ue.stderr.hasColors?.()),stripColor:r=>Zde(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 Gde,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 Bde(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 NA(e,r,n)),Ue.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 s4(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 s4)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){Ue.versions?.electron&&(r.from="electron");let i=Ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ue.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":Ue.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(my.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]}?)`:""}s4.suggestSimilar=qde});var d4=v(zA=>{var Bde=Ge("node:events").EventEmitter,jA=Ge("node:child_process"),uo=Ge("node:path"),by=Ge("node:fs"),qe=Ge("node:process"),{Argument:Hde,humanReadableArgName:Gde}=_y(),{CommanderError:MA}=rf(),{Help:Zde,stripColor:Vde}=IA(),{Option:c4,DualOptions:Wde}=NA(),{suggestSimilar:l4}=a4(),FA=class t extends Bde{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=>qe.stdout.write(r),writeErr:r=>qe.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>qe.stdout.isTTY?qe.stdout.columns:void 0,getErrHelpWidth:()=>qe.stderr.isTTY?qe.stderr.columns:void 0,getOutHasColors:()=>LA()??(qe.stdout.isTTY&&qe.stdout.hasColors?.()),getErrHasColors:()=>LA()??(qe.stderr.isTTY&&qe.stderr.hasColors?.()),stripColor:r=>Vde(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 Zde,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 Hde(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 MA(e,r,n)),qe.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 c4(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 c4)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){qe.versions?.electron&&(r.from="electron");let i=qe.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=qe.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":qe.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(by.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=lo.resolve(u,d);if(my.existsSync(f))return f;if(i.includes(lo.extname(d)))return;let p=i.find(m=>my.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=my.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=lo.resolve(lo.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=lo.basename(this._scriptPath,lo.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(lo.extname(s));let c;Ue.platform!=="win32"?n?(r.unshift(s),r=c4(Ue.execArgv).concat(r),c=DA.spawn(Ue.argv[0],r,{stdio:"inherit"})):c=DA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=c4(Ue.execArgv).concat(r),c=DA.spawn(Ue.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ue.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 NA(u,"commander.executeSubCommandAsync","(close)")):Ue.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)Ue.exit(1);else{let d=new NA(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=uo.resolve(u,d);if(by.existsSync(f))return f;if(i.includes(uo.extname(d)))return;let p=i.find(m=>by.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=by.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=uo.resolve(uo.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=uo.basename(this._scriptPath,uo.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(uo.extname(s));let c;qe.platform!=="win32"?n?(r.unshift(s),r=u4(qe.execArgv).concat(r),c=jA.spawn(qe.argv[0],r,{stdio:"inherit"})):c=jA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=u4(qe.execArgv).concat(r),c=jA.spawn(qe.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{qe.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 MA(u,"commander.executeSubCommandAsync","(close)")):qe.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)qe.exit(1);else{let d=new MA(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 Ue.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()}`,Ue.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Vde(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=a4(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=a4(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=>Hde(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=lo.basename(e,lo.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(Ue.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 qe.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()}`,qe.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Wde(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=l4(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=l4(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=>Gde(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=uo.basename(e,uo.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(qe.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 c4(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 MA(){if(Ue.env.NO_COLOR||Ue.env.FORCE_COLOR==="0"||Ue.env.FORCE_COLOR==="false")return!1;if(Ue.env.FORCE_COLOR||Ue.env.CLICOLOR_FORCE!==void 0)return!0}FA.Command=jA;FA.useColor=MA});var p4=v($n=>{var{Argument:u4}=py(),{Command:LA}=l4(),{CommanderError:Wde,InvalidArgumentError:d4}=Qd(),{Help:Kde}=OA(),{Option:f4}=CA();$n.program=new LA;$n.createCommand=t=>new LA(t);$n.createOption=(t,e)=>new f4(t,e);$n.createArgument=(t,e)=>new u4(t,e);$n.Command=LA;$n.Option=f4;$n.Argument=u4;$n.Help=Kde;$n.CommanderError=Wde;$n.InvalidArgumentError=d4;$n.InvalidOptionArgumentError=d4});var Ce=v(Xt=>{"use strict";var UA=Symbol.for("yaml.alias"),y4=Symbol.for("yaml.document"),hy=Symbol.for("yaml.map"),_4=Symbol.for("yaml.pair"),qA=Symbol.for("yaml.scalar"),gy=Symbol.for("yaml.seq"),uo=Symbol.for("yaml.node.type"),tfe=t=>!!t&&typeof t=="object"&&t[uo]===UA,rfe=t=>!!t&&typeof t=="object"&&t[uo]===y4,nfe=t=>!!t&&typeof t=="object"&&t[uo]===hy,ife=t=>!!t&&typeof t=="object"&&t[uo]===_4,b4=t=>!!t&&typeof t=="object"&&t[uo]===qA,ofe=t=>!!t&&typeof t=="object"&&t[uo]===gy;function v4(t){if(t&&typeof t=="object")switch(t[uo]){case hy:case gy:return!0}return!1}function sfe(t){if(t&&typeof t=="object")switch(t[uo]){case UA:case hy:case qA:case gy:return!0}return!1}var afe=t=>(b4(t)||v4(t))&&!!t.anchor;Xt.ALIAS=UA;Xt.DOC=y4;Xt.MAP=hy;Xt.NODE_TYPE=uo;Xt.PAIR=_4;Xt.SCALAR=qA;Xt.SEQ=gy;Xt.hasAnchor=afe;Xt.isAlias=tfe;Xt.isCollection=v4;Xt.isDocument=rfe;Xt.isMap=nfe;Xt.isNode=sfe;Xt.isPair=ife;Xt.isScalar=b4;Xt.isSeq=ofe});var ef=v(BA=>{"use strict";var zt=Ce(),Cr=Symbol("break visit"),S4=Symbol("skip children"),xi=Symbol("remove node");function yy(t,e){let r=w4(e);zt.isDocument(t)?Zc(null,t.contents,r,Object.freeze([t]))===xi&&(t.contents=null):Zc(null,t,r,Object.freeze([]))}yy.BREAK=Cr;yy.SKIP=S4;yy.REMOVE=xi;function Zc(t,e,r,n){let i=x4(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return $4(t,n,i),Zc(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var k4=Ce(),cfe=ef(),lfe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ufe=t=>t.replace(/[!,[\]{}]/g,e=>lfe[e]),tf=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+ufe(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&&k4.isNode(e.contents)){let o={};cfe.visit(e.contents,(s,a)=>{k4.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(` -`)}};tf.defaultYaml={explicit:!1,version:"1.2"};tf.defaultTags={"!!":"tag:yaml.org,2002:"};E4.Directives=tf});var by=v(rf=>{"use strict";var A4=Ce(),dfe=ef();function ffe(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 T4(t){let e=new Set;return dfe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function O4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function pfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=T4(t));let s=O4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(A4.isScalar(s.node)||A4.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}}rf.anchorIsValid=ffe;rf.anchorNames=T4;rf.createNodeAnchors=pfe;rf.findNewAnchor=O4});var GA=v(R4=>{"use strict";function nf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var mfe=Ce();function I4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>I4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!mfe.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}P4.toJS=I4});var vy=v(D4=>{"use strict";var hfe=GA(),C4=Ce(),gfe=Go(),ZA=class{constructor(e){Object.defineProperty(this,C4.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(!C4.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=gfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?hfe.applyReviver(o,{"":a},"",a):a}};D4.NodeBase=ZA});var of=v(N4=>{"use strict";var yfe=by(),_fe=ef(),Wc=Ce(),bfe=vy(),vfe=Go(),VA=class extends bfe.NodeBase{constructor(e){super(Wc.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=[],_fe.visit(e,{Node:(o,s)=>{(Wc.isAlias(s)||Wc.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||(vfe.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=Sy(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(yfe.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 Sy(t,e,r){if(Wc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Wc.isCollection(e)){let n=0;for(let i of e.items){let o=Sy(t,i,r);o>n&&(n=o)}return n}else if(Wc.isPair(e)){let n=Sy(t,e.key,r),i=Sy(t,e.value,r);return Math.max(n,i)}return 1}N4.Alias=VA});var Ct=v(WA=>{"use strict";var Sfe=Ce(),wfe=vy(),xfe=Go(),$fe=t=>!t||typeof t!="function"&&typeof t!="object",Zo=class extends wfe.NodeBase{constructor(e){super(Sfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:xfe.toJS(this.value,e,r)}toString(){return String(this.value)}};Zo.BLOCK_FOLDED="BLOCK_FOLDED";Zo.BLOCK_LITERAL="BLOCK_LITERAL";Zo.PLAIN="PLAIN";Zo.QUOTE_DOUBLE="QUOTE_DOUBLE";Zo.QUOTE_SINGLE="QUOTE_SINGLE";WA.Scalar=Zo;WA.isScalarValue=$fe});var sf=v(M4=>{"use strict";var kfe=of(),la=Ce(),j4=Ct(),Efe="tag:yaml.org,2002:";function Afe(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 Tfe(t,e,r){if(la.isDocument(t)&&(t=t.contents),la.isNode(t))return t;if(la.isPair(t)){let d=r.schema[la.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 kfe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Efe+e.slice(2));let l=Afe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new j4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[la.MAP]:Symbol.iterator in Object(t)?s[la.SEQ]:s[la.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 j4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}M4.createNode=Tfe});var xy=v(wy=>{"use strict";var Ofe=sf(),$i=Ce(),Rfe=vy();function KA(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 Ofe.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 F4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,JA=class extends Rfe.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=>$i.isNode(n)||$i.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(F4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if($i.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,KA(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($i.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&&$i.isScalar(o)?o.value:o:$i.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!$i.isPair(r))return!1;let n=r.value;return n==null||e&&$i.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 $i.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($i.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,KA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};wy.Collection=JA;wy.collectionFromPath=KA;wy.isEmptyPath=F4});var af=v($y=>{"use strict";var Ife=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function YA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Pfe=(t,e,r)=>t.endsWith(` -`)?YA(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 u4(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 LA(){if(qe.env.NO_COLOR||qe.env.FORCE_COLOR==="0"||qe.env.FORCE_COLOR==="false")return!1;if(qe.env.FORCE_COLOR||qe.env.CLICOLOR_FORCE!==void 0)return!0}zA.Command=FA;zA.useColor=LA});var h4=v($n=>{var{Argument:f4}=_y(),{Command:UA}=d4(),{CommanderError:Kde,InvalidArgumentError:p4}=rf(),{Help:Jde}=IA(),{Option:m4}=NA();$n.program=new UA;$n.createCommand=t=>new UA(t);$n.createOption=(t,e)=>new m4(t,e);$n.createArgument=(t,e)=>new f4(t,e);$n.Command=UA;$n.Option=m4;$n.Argument=f4;$n.Help=Jde;$n.CommanderError=Kde;$n.InvalidArgumentError=p4;$n.InvalidOptionArgumentError=p4});var De=v(Xt=>{"use strict";var BA=Symbol.for("yaml.alias"),b4=Symbol.for("yaml.document"),vy=Symbol.for("yaml.map"),v4=Symbol.for("yaml.pair"),HA=Symbol.for("yaml.scalar"),Sy=Symbol.for("yaml.seq"),fo=Symbol.for("yaml.node.type"),rfe=t=>!!t&&typeof t=="object"&&t[fo]===BA,nfe=t=>!!t&&typeof t=="object"&&t[fo]===b4,ife=t=>!!t&&typeof t=="object"&&t[fo]===vy,ofe=t=>!!t&&typeof t=="object"&&t[fo]===v4,S4=t=>!!t&&typeof t=="object"&&t[fo]===HA,sfe=t=>!!t&&typeof t=="object"&&t[fo]===Sy;function w4(t){if(t&&typeof t=="object")switch(t[fo]){case vy:case Sy:return!0}return!1}function afe(t){if(t&&typeof t=="object")switch(t[fo]){case BA:case vy:case HA:case Sy:return!0}return!1}var cfe=t=>(S4(t)||w4(t))&&!!t.anchor;Xt.ALIAS=BA;Xt.DOC=b4;Xt.MAP=vy;Xt.NODE_TYPE=fo;Xt.PAIR=v4;Xt.SCALAR=HA;Xt.SEQ=Sy;Xt.hasAnchor=cfe;Xt.isAlias=rfe;Xt.isCollection=w4;Xt.isDocument=nfe;Xt.isMap=ife;Xt.isNode=afe;Xt.isPair=ofe;Xt.isScalar=S4;Xt.isSeq=sfe});var nf=v(GA=>{"use strict";var zt=De(),Cr=Symbol("break visit"),x4=Symbol("skip children"),ki=Symbol("remove node");function wy(t,e){let r=$4(e);zt.isDocument(t)?Jc(null,t.contents,r,Object.freeze([t]))===ki&&(t.contents=null):Jc(null,t,r,Object.freeze([]))}wy.BREAK=Cr;wy.SKIP=x4;wy.REMOVE=ki;function Jc(t,e,r,n){let i=k4(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return E4(t,n,i),Jc(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o{"use strict";var A4=De(),lfe=nf(),ufe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},dfe=t=>t.replace(/[!,[\]{}]/g,e=>ufe[e]),of=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+dfe(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&&A4.isNode(e.contents)){let o={};lfe.visit(e.contents,(s,a)=>{A4.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(` +`)}};of.defaultYaml={explicit:!1,version:"1.2"};of.defaultTags={"!!":"tag:yaml.org,2002:"};T4.Directives=of});var $y=v(sf=>{"use strict";var O4=De(),ffe=nf();function pfe(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 R4(t){let e=new Set;return ffe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function I4(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function mfe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=R4(t));let s=I4(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(O4.isScalar(s.node)||O4.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}}sf.anchorIsValid=pfe;sf.anchorNames=R4;sf.createNodeAnchors=mfe;sf.findNewAnchor=I4});var VA=v(P4=>{"use strict";function af(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var hfe=De();function C4(t,e,r){if(Array.isArray(t))return t.map((n,i)=>C4(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!hfe.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}D4.toJS=C4});var ky=v(j4=>{"use strict";var gfe=VA(),N4=De(),yfe=Zo(),WA=class{constructor(e){Object.defineProperty(this,N4.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(!N4.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=yfe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?gfe.applyReviver(o,{"":a},"",a):a}};j4.NodeBase=WA});var cf=v(M4=>{"use strict";var _fe=$y(),bfe=nf(),Xc=De(),vfe=ky(),Sfe=Zo(),KA=class extends vfe.NodeBase{constructor(e){super(Xc.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=[],bfe.visit(e,{Node:(o,s)=>{(Xc.isAlias(s)||Xc.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||(Sfe.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=Ey(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(_fe.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 Ey(t,e,r){if(Xc.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Xc.isCollection(e)){let n=0;for(let i of e.items){let o=Ey(t,i,r);o>n&&(n=o)}return n}else if(Xc.isPair(e)){let n=Ey(t,e.key,r),i=Ey(t,e.value,r);return Math.max(n,i)}return 1}M4.Alias=KA});var Dt=v(JA=>{"use strict";var wfe=De(),xfe=ky(),$fe=Zo(),kfe=t=>!t||typeof t!="function"&&typeof t!="object",Vo=class extends xfe.NodeBase{constructor(e){super(wfe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:$fe.toJS(this.value,e,r)}toString(){return String(this.value)}};Vo.BLOCK_FOLDED="BLOCK_FOLDED";Vo.BLOCK_LITERAL="BLOCK_LITERAL";Vo.PLAIN="PLAIN";Vo.QUOTE_DOUBLE="QUOTE_DOUBLE";Vo.QUOTE_SINGLE="QUOTE_SINGLE";JA.Scalar=Vo;JA.isScalarValue=kfe});var lf=v(L4=>{"use strict";var Efe=cf(),da=De(),F4=Dt(),Afe="tag:yaml.org,2002:";function Tfe(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 Ofe(t,e,r){if(da.isDocument(t)&&(t=t.contents),da.isNode(t))return t;if(da.isPair(t)){let d=r.schema[da.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 Efe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Afe+e.slice(2));let l=Tfe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new F4.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[da.MAP]:Symbol.iterator in Object(t)?s[da.SEQ]:s[da.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 F4.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}L4.createNode=Ofe});var Ty=v(Ay=>{"use strict";var Rfe=lf(),Ei=De(),Ife=ky();function YA(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 Rfe.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 z4=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,XA=class extends Ife.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=>Ei.isNode(n)||Ei.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(z4(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Ei.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,YA(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(Ei.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&&Ei.isScalar(o)?o.value:o:Ei.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Ei.isPair(r))return!1;let n=r.value;return n==null||e&&Ei.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 Ei.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(Ei.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,YA(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Ay.Collection=XA;Ay.collectionFromPath=YA;Ay.isEmptyPath=z4});var uf=v(Oy=>{"use strict";var Pfe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function QA(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Cfe=(t,e,r)=>t.endsWith(` +`)?QA(r,e):r.includes(` `)?` -`+YA(r,e):(t.endsWith(" ")?"":" ")+r;$y.indentComment=YA;$y.lineComment=Pfe;$y.stringifyComment=Ife});var z4=v(cf=>{"use strict";var Cfe="flow",XA="block",ky="quoted";function Dfe(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===XA&&(h=L4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===ky&&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===XA&&(h=L4(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+QA(r,e):(t.endsWith(" ")?"":" ")+r;Oy.indentComment=QA;Oy.lineComment=Cfe;Oy.stringifyComment=Pfe});var q4=v(df=>{"use strict";var Dfe="flow",eT="block",Ry="quoted";function Nfe(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===eT&&(h=U4(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Ry&&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===eT&&(h=U4(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===ky){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 Vn=Ct(),Vo=z4(),Ay=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ty=t=>/^(%|---|\.\.\.)/m.test(t);function Nfe(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 lf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Ty(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===Ry){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 Wn=Dt(),Wo=q4(),Py=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Cy=t=>/^(%|---|\.\.\.)/m.test(t);function jfe(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 ff(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Cy(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(eT,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{O=!0});let A=Vo.foldFlowLines(`${_}${w}${p}`,l,Vo.FOLD_BLOCK,T);if(!O)return`>${x} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,T=Py(n,!0);s!=="folded"&&e!==Wn.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{O=!0});let A=Wo.foldFlowLines(`${_}${w}${p}`,l,Wo.FOLD_BLOCK,T);if(!O)return`>${x} ${l}${A}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function jfe(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 Kc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?Kc(o,e):Ey(t,e,r,n);if(!a&&!u&&i!==Vn.Scalar.PLAIN&&o.includes(` -`))return Ey(t,e,r,n);if(Ty(o)){if(c==="")return e.forceBlockIndent=!0,Ey(t,e,r,n);if(a&&c===l)return Kc(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 Kc(o,e)}return a?d:Vo.foldFlowLines(d,c,Vo.FOLD_FLOW,Ay(e,!1))}function Mfe(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!==Vn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Vn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Vn.Scalar.BLOCK_FOLDED:case Vn.Scalar.BLOCK_LITERAL:return i||o?Kc(s.value,e):Ey(s,e,r,n);case Vn.Scalar.QUOTE_DOUBLE:return lf(s.value,e);case Vn.Scalar.QUOTE_SINGLE:return QA(s.value,e);case Vn.Scalar.PLAIN:return jfe(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}U4.stringifyString=Mfe});var df=v(tT=>{"use strict";var Ffe=by(),Wo=Ce(),Lfe=af(),zfe=uf();function Ufe(t,e){let r=Object.assign({blockQuote:!0,commentString:Lfe.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 qfe(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(Wo.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 Bfe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Wo.isScalar(t)||Wo.isCollection(t))&&t.anchor;o&&Ffe.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 Hfe(t,e,r,n){if(Wo.isPair(t))return t.toString(e,r,n);if(Wo.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=Wo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=qfe(e.doc.schema.tags,o));let s=Bfe(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):Wo.isScalar(o)?zfe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Wo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}tT.createStringifyContext=Ufe;tT.stringify=Hfe});var G4=v(H4=>{"use strict";var fo=Ce(),q4=Ct(),B4=df(),ff=af();function Gfe({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=fo.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(fo.isCollection(t)||!fo.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||fo.isCollection(t)||(fo.isScalar(t)?t.type===q4.Scalar.BLOCK_FOLDED||t.type===q4.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=B4.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+=ff.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=ff.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=ff.lineComment(g,r.indent,l(f))));let b,_,S;fo.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&&fo.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&fo.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=B4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` +${l}${_}${r}${p}`}function Mfe(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 Qc(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?Qc(o,e):Iy(t,e,r,n);if(!a&&!u&&i!==Wn.Scalar.PLAIN&&o.includes(` +`))return Iy(t,e,r,n);if(Cy(o)){if(c==="")return e.forceBlockIndent=!0,Iy(t,e,r,n);if(a&&c===l)return Qc(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 Qc(o,e)}return a?d:Wo.foldFlowLines(d,c,Wo.FOLD_FLOW,Py(e,!1))}function Ffe(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!==Wn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Wn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Wn.Scalar.BLOCK_FOLDED:case Wn.Scalar.BLOCK_LITERAL:return i||o?Qc(s.value,e):Iy(s,e,r,n);case Wn.Scalar.QUOTE_DOUBLE:return ff(s.value,e);case Wn.Scalar.QUOTE_SINGLE:return tT(s.value,e);case Wn.Scalar.PLAIN:return Mfe(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}B4.stringifyString=Ffe});var mf=v(nT=>{"use strict";var Lfe=$y(),Ko=De(),zfe=uf(),Ufe=pf();function qfe(t,e){let r=Object.assign({blockQuote:!0,commentString:zfe.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 Bfe(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(Ko.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 Hfe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Ko.isScalar(t)||Ko.isCollection(t))&&t.anchor;o&&Lfe.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 Gfe(t,e,r,n){if(Ko.isPair(t))return t.toString(e,r,n);if(Ko.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=Ko.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Bfe(e.doc.schema.tags,o));let s=Hfe(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):Ko.isScalar(o)?Ufe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Ko.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} +${e.indent}${a}`:a}nT.createStringifyContext=qfe;nT.stringify=Gfe});var V4=v(Z4=>{"use strict";var po=De(),H4=Dt(),G4=mf(),hf=uf();function Zfe({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=po.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(po.isCollection(t)||!po.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||po.isCollection(t)||(po.isScalar(t)?t.type===H4.Scalar.BLOCK_FOLDED||t.type===H4.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=G4.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+=hf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=hf.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=hf.lineComment(g,r.indent,l(f))));let b,_,S;po.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&&po.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&po.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=G4.stringify(e,r,()=>x=!0,()=>h=!0),O=" ";if(f||b||_){if(O=b?` `:"",_){let T=l(_);O+=` -${ff.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` +${hf.indentComment(T,r.indent)}`}w===""&&!r.inFlow?O===` `&&S&&(O=` `):O+=` -${r.indent}`}else if(!p&&fo.isCollection(e)){let T=w[0],A=w.indexOf(` -`),D=A!==-1,$=r.inFlow??e.flow??e.items.length===0;if(D||!$){let ie=!1;if(D&&(T==="&"||T==="!")){let J=w.indexOf(" ");T==="&"&&J!==-1&&J{"use strict";var Z4=Ge("process");function Zfe(t,...e){t==="debug"&&console.log(...e)}function Vfe(t,e){(t==="debug"||t==="warn")&&(typeof Z4.emitWarning=="function"?Z4.emitWarning(e):console.warn(e))}rT.debug=Zfe;rT.warn=Vfe});var Cy=v(Py=>{"use strict";var Iy=Ce(),V4=Ct(),Oy="<<",Ry={identify:t=>t===Oy||typeof t=="symbol"&&t.description===Oy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new V4.Scalar(Symbol(Oy)),{addToJSMap:W4}),stringify:()=>Oy},Wfe=(t,e)=>(Ry.identify(e)||Iy.isScalar(e)&&(!e.type||e.type===V4.Scalar.PLAIN)&&Ry.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Ry.tag&&r.default);function W4(t,e,r){let n=K4(t,r);if(Iy.isSeq(n))for(let i of n.items)iT(t,e,i);else if(Array.isArray(n))for(let i of n)iT(t,e,i);else iT(t,e,n)}function iT(t,e,r){let n=K4(t,r);if(!Iy.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 K4(t,e){return t&&Iy.isAlias(e)?e.resolve(t.doc,t):e}Py.addMergeToJSMap=W4;Py.isMergeKey=Wfe;Py.merge=Ry});var sT=v(X4=>{"use strict";var Kfe=nT(),J4=Cy(),Jfe=df(),Y4=Ce(),oT=Go();function Yfe(t,e,{key:r,value:n}){if(Y4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(J4.isMergeKey(t,r))J4.addMergeToJSMap(t,e,n);else{let i=oT.toJS(r,"",t);if(e instanceof Map)e.set(i,oT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Xfe(r,i,t),s=oT.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 Xfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(Y4.isNode(t)&&r?.doc){let n=Jfe.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)+'..."'),Kfe.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)}X4.addPairToJSMap=Yfe});var Ko=v(aT=>{"use strict";var Q4=sf(),Qfe=G4(),epe=sT(),Dy=Ce();function tpe(t,e,r){let n=Q4.createNode(t,void 0,r),i=Q4.createNode(e,void 0,r);return new Ny(n,i)}var Ny=class t{constructor(e,r=null){Object.defineProperty(this,Dy.NODE_TYPE,{value:Dy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Dy.isNode(r)&&(r=r.clone(e)),Dy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return epe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Qfe.stringifyPair(this,e,r,n):JSON.stringify(this)}};aT.Pair=Ny;aT.createPair=tpe});var cT=v(t6=>{"use strict";var ua=Ce(),e6=df(),jy=af();function rpe(t,e,r){return(e.inFlow??t.flow?ipe:npe)(t,e,r)}function npe({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+=jy.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 W4=Ge("process");function Vfe(t,...e){t==="debug"&&console.log(...e)}function Wfe(t,e){(t==="debug"||t==="warn")&&(typeof W4.emitWarning=="function"?W4.emitWarning(e):console.warn(e))}iT.debug=Vfe;iT.warn=Wfe});var Fy=v(My=>{"use strict";var jy=De(),K4=Dt(),Dy="<<",Ny={identify:t=>t===Dy||typeof t=="symbol"&&t.description===Dy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new K4.Scalar(Symbol(Dy)),{addToJSMap:J4}),stringify:()=>Dy},Kfe=(t,e)=>(Ny.identify(e)||jy.isScalar(e)&&(!e.type||e.type===K4.Scalar.PLAIN)&&Ny.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Ny.tag&&r.default);function J4(t,e,r){let n=Y4(t,r);if(jy.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=Y4(t,r);if(!jy.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 Y4(t,e){return t&&jy.isAlias(e)?e.resolve(t.doc,t):e}My.addMergeToJSMap=J4;My.isMergeKey=Kfe;My.merge=Ny});var cT=v(e6=>{"use strict";var Jfe=oT(),X4=Fy(),Yfe=mf(),Q4=De(),aT=Zo();function Xfe(t,e,{key:r,value:n}){if(Q4.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(X4.isMergeKey(t,r))X4.addMergeToJSMap(t,e,n);else{let i=aT.toJS(r,"",t);if(e instanceof Map)e.set(i,aT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Qfe(r,i,t),s=aT.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 Qfe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(Q4.isNode(t)&&r?.doc){let n=Yfe.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)+'..."'),Jfe.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)}e6.addPairToJSMap=Xfe});var Jo=v(lT=>{"use strict";var t6=lf(),epe=V4(),tpe=cT(),Ly=De();function rpe(t,e,r){let n=t6.createNode(t,void 0,r),i=t6.createNode(e,void 0,r);return new zy(n,i)}var zy=class t{constructor(e,r=null){Object.defineProperty(this,Ly.NODE_TYPE,{value:Ly.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Ly.isNode(r)&&(r=r.clone(e)),Ly.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return tpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?epe.stringifyPair(this,e,r,n):JSON.stringify(this)}};lT.Pair=zy;lT.createPair=rpe});var uT=v(n6=>{"use strict";var fa=De(),r6=mf(),Uy=uf();function npe(t,e,r){return(e.inFlow??t.flow?ope:ipe)(t,e,r)}function ipe({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+=Uy.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+=jy.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?` +`+Uy.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function ope({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+=Uy.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 My({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=jy.indentComment(e(n),t);r.push(o.trimStart())}}t6.stringifyCollection=rpe});var Yo=v(uT=>{"use strict";var ope=cT(),spe=sT(),ape=xy(),Jo=Ce(),Fy=Ko(),cpe=Ct();function pf(t,e){let r=Jo.isScalar(e)?e.value:e;for(let n of t)if(Jo.isPair(n)&&(n.key===e||n.key===r||Jo.isScalar(n.key)&&n.key.value===r))return n}var lT=class extends ape.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Jo.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(Fy.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;Jo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Fy.Pair(e,e?.value):n=new Fy.Pair(e.key,e.value);let i=pf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Jo.isScalar(i.value)&&cpe.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=pf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=pf(this.items,e)?.value;return(!r&&Jo.isScalar(i)?i.value:i)??void 0}has(e){return!!pf(this.items,e)}set(e,r){this.add(new Fy.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)spe.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Jo.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})),ope.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};uT.YAMLMap=lT;uT.findPair=pf});var Jc=v(n6=>{"use strict";var lpe=Ce(),r6=Yo(),upe={collection:"map",default:!0,nodeClass:r6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return lpe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>r6.YAMLMap.from(t,e,r)};n6.map=upe});var Xo=v(i6=>{"use strict";var dpe=sf(),fpe=cT(),ppe=xy(),zy=Ce(),mpe=Ct(),hpe=Go(),dT=class extends ppe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(zy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Ly(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Ly(e);if(typeof n!="number")return;let i=this.items[n];return!r&&zy.isScalar(i)?i.value:i}has(e){let r=Ly(e);return typeof r=="number"&&r=0?e:null}i6.YAMLSeq=dT});var Yc=v(s6=>{"use strict";var gpe=Ce(),o6=Xo(),ype={collection:"seq",default:!0,nodeClass:o6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return gpe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>o6.YAMLSeq.from(t,e,r)};s6.seq=ype});var mf=v(a6=>{"use strict";var _pe=uf(),bpe={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),_pe.stringifyString(t,e,r,n)}};a6.string=bpe});var Uy=v(u6=>{"use strict";var c6=Ct(),l6={identify:t=>t==null,createNode:()=>new c6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new c6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&l6.test.test(t)?t:e.options.nullStr};u6.nullTag=l6});var fT=v(f6=>{"use strict";var vpe=Ct(),d6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new vpe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&d6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};f6.boolTag=d6});var Xc=v(p6=>{"use strict";function Spe({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}p6.stringifyNumber=Spe});var mT=v(qy=>{"use strict";var wpe=Ct(),pT=Xc(),xpe={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:pT.stringifyNumber},$pe={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():pT.stringifyNumber(t)}},kpe={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 wpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:pT.stringifyNumber};qy.float=kpe;qy.floatExp=$pe;qy.floatNaN=xpe});var gT=v(Hy=>{"use strict";var m6=Xc(),By=t=>typeof t=="bigint"||Number.isInteger(t),hT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function h6(t,e,r){let{value:n}=t;return By(n)&&n>=0?r+n.toString(e):m6.stringifyNumber(t)}var Epe={identify:t=>By(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>hT(t,2,8,r),stringify:t=>h6(t,8,"0o")},Ape={identify:By,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>hT(t,0,10,r),stringify:m6.stringifyNumber},Tpe={identify:t=>By(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>hT(t,2,16,r),stringify:t=>h6(t,16,"0x")};Hy.int=Ape;Hy.intHex=Tpe;Hy.intOct=Epe});var y6=v(g6=>{"use strict";var Ope=Jc(),Rpe=Uy(),Ipe=Yc(),Ppe=mf(),Cpe=fT(),yT=mT(),_T=gT(),Dpe=[Ope.map,Ipe.seq,Ppe.string,Rpe.nullTag,Cpe.boolTag,_T.intOct,_T.int,_T.intHex,yT.floatNaN,yT.floatExp,yT.float];g6.schema=Dpe});var v6=v(b6=>{"use strict";var Npe=Ct(),jpe=Jc(),Mpe=Yc();function _6(t){return typeof t=="bigint"||Number.isInteger(t)}var Gy=({value:t})=>JSON.stringify(t),Fpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Gy},{identify:t=>t==null,createNode:()=>new Npe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Gy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Gy},{identify:_6,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})=>_6(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:Gy}],Lpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},zpe=[jpe.map,Mpe.seq].concat(Fpe,Lpe);b6.schema=zpe});var vT=v(S6=>{"use strict";var hf=Ge("buffer"),bT=Ct(),Upe=uf(),qpe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof hf.Buffer=="function")return hf.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 Zy=Ce(),ST=Ko(),Bpe=Ct(),Hpe=Xo();function w6(t,e){if(Zy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new ST.Pair(new Bpe.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=Uy.indentComment(e(n),t);r.push(o.trimStart())}}n6.stringifyCollection=npe});var Xo=v(fT=>{"use strict";var spe=uT(),ape=cT(),cpe=Ty(),Yo=De(),By=Jo(),lpe=Dt();function gf(t,e){let r=Yo.isScalar(e)?e.value:e;for(let n of t)if(Yo.isPair(n)&&(n.key===e||n.key===r||Yo.isScalar(n.key)&&n.key.value===r))return n}var dT=class extends cpe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Yo.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(By.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;Yo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new By.Pair(e,e?.value):n=new By.Pair(e.key,e.value);let i=gf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Yo.isScalar(i.value)&&lpe.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=gf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=gf(this.items,e)?.value;return(!r&&Yo.isScalar(i)?i.value:i)??void 0}has(e){return!!gf(this.items,e)}set(e,r){this.add(new By.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)ape.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Yo.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})),spe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};fT.YAMLMap=dT;fT.findPair=gf});var el=v(o6=>{"use strict";var upe=De(),i6=Xo(),dpe={collection:"map",default:!0,nodeClass:i6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return upe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>i6.YAMLMap.from(t,e,r)};o6.map=dpe});var Qo=v(s6=>{"use strict";var fpe=lf(),ppe=uT(),mpe=Ty(),Gy=De(),hpe=Dt(),gpe=Zo(),pT=class extends mpe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Gy.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Hy(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Hy(e);if(typeof n!="number")return;let i=this.items[n];return!r&&Gy.isScalar(i)?i.value:i}has(e){let r=Hy(e);return typeof r=="number"&&r=0?e:null}s6.YAMLSeq=pT});var tl=v(c6=>{"use strict";var ype=De(),a6=Qo(),_pe={collection:"seq",default:!0,nodeClass:a6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return ype.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>a6.YAMLSeq.from(t,e,r)};c6.seq=_pe});var yf=v(l6=>{"use strict";var bpe=pf(),vpe={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),bpe.stringifyString(t,e,r,n)}};l6.string=vpe});var Zy=v(f6=>{"use strict";var u6=Dt(),d6={identify:t=>t==null,createNode:()=>new u6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new u6.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&d6.test.test(t)?t:e.options.nullStr};f6.nullTag=d6});var mT=v(m6=>{"use strict";var Spe=Dt(),p6={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Spe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&p6.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};m6.boolTag=p6});var rl=v(h6=>{"use strict";function wpe({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}h6.stringifyNumber=wpe});var gT=v(Vy=>{"use strict";var xpe=Dt(),hT=rl(),$pe={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},kpe={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():hT.stringifyNumber(t)}},Epe={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 xpe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:hT.stringifyNumber};Vy.float=Epe;Vy.floatExp=kpe;Vy.floatNaN=$pe});var _T=v(Ky=>{"use strict";var g6=rl(),Wy=t=>typeof t=="bigint"||Number.isInteger(t),yT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function y6(t,e,r){let{value:n}=t;return Wy(n)&&n>=0?r+n.toString(e):g6.stringifyNumber(t)}var Ape={identify:t=>Wy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>yT(t,2,8,r),stringify:t=>y6(t,8,"0o")},Tpe={identify:Wy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>yT(t,0,10,r),stringify:g6.stringifyNumber},Ope={identify:t=>Wy(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>yT(t,2,16,r),stringify:t=>y6(t,16,"0x")};Ky.int=Tpe;Ky.intHex=Ope;Ky.intOct=Ape});var b6=v(_6=>{"use strict";var Rpe=el(),Ipe=Zy(),Ppe=tl(),Cpe=yf(),Dpe=mT(),bT=gT(),vT=_T(),Npe=[Rpe.map,Ppe.seq,Cpe.string,Ipe.nullTag,Dpe.boolTag,vT.intOct,vT.int,vT.intHex,bT.floatNaN,bT.floatExp,bT.float];_6.schema=Npe});var w6=v(S6=>{"use strict";var jpe=Dt(),Mpe=el(),Fpe=tl();function v6(t){return typeof t=="bigint"||Number.isInteger(t)}var Jy=({value:t})=>JSON.stringify(t),Lpe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Jy},{identify:t=>t==null,createNode:()=>new jpe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Jy},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Jy},{identify:v6,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})=>v6(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:Jy}],zpe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Upe=[Mpe.map,Fpe.seq].concat(Lpe,zpe);S6.schema=Upe});var wT=v(x6=>{"use strict";var _f=Ge("buffer"),ST=Dt(),qpe=pf(),Bpe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof _f.Buffer=="function")return _f.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 Yy=De(),xT=Jo(),Hpe=Dt(),Gpe=Qo();function $6(t,e){if(Yy.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new xT.Pair(new Hpe.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]=Zy.isPair(n)?n:new ST.Pair(n)}}else e("Expected a sequence for this tag");return t}function x6(t,e,r){let{replacer:n}=r,i=new Hpe.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(ST.createPair(a,c,r))}return i}var Gpe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:w6,createNode:x6};Vy.createPairs=x6;Vy.pairs=Gpe;Vy.resolvePairs=w6});var $T=v(xT=>{"use strict";var $6=Ce(),wT=Go(),gf=Yo(),Zpe=Xo(),k6=Wy(),da=class t extends Zpe.YAMLSeq{constructor(){super(),this.add=gf.YAMLMap.prototype.add.bind(this),this.delete=gf.YAMLMap.prototype.delete.bind(this),this.get=gf.YAMLMap.prototype.get.bind(this),this.has=gf.YAMLMap.prototype.has.bind(this),this.set=gf.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($6.isPair(i)?(o=wT.toJS(i.key,"",r),s=wT.toJS(i.value,o,r)):o=wT.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=k6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};da.tag="tag:yaml.org,2002:omap";var Vpe={collection:"seq",identify:t=>t instanceof Map,nodeClass:da,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=k6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)$6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new da,r)},createNode:(t,e,r)=>da.from(t,e,r)};xT.YAMLOMap=da;xT.omap=Vpe});var R6=v(kT=>{"use strict";var E6=Ct();function A6({value:t,source:e},r){return e&&(t?T6:O6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var T6={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 E6.Scalar(!0),stringify:A6},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 E6.Scalar(!1),stringify:A6};kT.falseTag=O6;kT.trueTag=T6});var I6=v(Ky=>{"use strict";var Wpe=Ct(),ET=Xc(),Kpe={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:ET.stringifyNumber},Jpe={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():ET.stringifyNumber(t)}},Ype={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 Wpe.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:ET.stringifyNumber};Ky.float=Ype;Ky.floatExp=Jpe;Ky.floatNaN=Kpe});var C6=v(_f=>{"use strict";var P6=Xc(),yf=t=>typeof t=="bigint"||Number.isInteger(t);function Jy(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 AT(t,e,r){let{value:n}=t;if(yf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return P6.stringifyNumber(t)}var Xpe={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Jy(t,2,2,r),stringify:t=>AT(t,2,"0b")},Qpe={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Jy(t,1,8,r),stringify:t=>AT(t,8,"0")},eme={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Jy(t,0,10,r),stringify:P6.stringifyNumber},tme={identify:yf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Jy(t,2,16,r),stringify:t=>AT(t,16,"0x")};_f.int=eme;_f.intBin=Xpe;_f.intHex=tme;_f.intOct=Qpe});var OT=v(TT=>{"use strict";var Qy=Ce(),Yy=Ko(),Xy=Yo(),fa=class t extends Xy.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Qy.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Yy.Pair(e.key,null):r=new Yy.Pair(e,null),Xy.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Xy.findPair(this.items,e);return!r&&Qy.isPair(n)?Qy.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=Xy.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Yy.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(Yy.createPair(s,null,n));return o}};fa.tag="tag:yaml.org,2002:set";var rme={collection:"map",identify:t=>t instanceof Set,nodeClass:fa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>fa.from(t,e,r),resolve(t,e){if(Qy.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new fa,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};TT.YAMLSet=fa;TT.set=rme});var IT=v(e_=>{"use strict";var nme=Xc();function RT(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 nme.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 ime={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})=>RT(t,r),stringify:D6},ome={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=>RT(t,!1),stringify:D6},N6={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(N6.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=RT(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$/,"")??""};e_.floatTime=ome;e_.intTime=ime;e_.timestamp=N6});var F6=v(M6=>{"use strict";var sme=Jc(),ame=Uy(),cme=Yc(),lme=mf(),ume=vT(),j6=R6(),PT=I6(),t_=C6(),dme=Cy(),fme=$T(),pme=Wy(),mme=OT(),CT=IT(),hme=[sme.map,cme.seq,lme.string,ame.nullTag,j6.trueTag,j6.falseTag,t_.intBin,t_.intOct,t_.int,t_.intHex,PT.floatNaN,PT.floatExp,PT.float,ume.binary,dme.merge,fme.omap,pme.pairs,mme.set,CT.intTime,CT.floatTime,CT.timestamp];M6.schema=hme});var W6=v(jT=>{"use strict";var q6=Jc(),gme=Uy(),B6=Yc(),yme=mf(),_me=fT(),DT=mT(),NT=gT(),bme=y6(),vme=v6(),H6=vT(),bf=Cy(),G6=$T(),Z6=Wy(),L6=F6(),V6=OT(),r_=IT(),z6=new Map([["core",bme.schema],["failsafe",[q6.map,B6.seq,yme.string]],["json",vme.schema],["yaml11",L6.schema],["yaml-1.1",L6.schema]]),U6={binary:H6.binary,bool:_me.boolTag,float:DT.float,floatExp:DT.floatExp,floatNaN:DT.floatNaN,floatTime:r_.floatTime,int:NT.int,intHex:NT.intHex,intOct:NT.intOct,intTime:r_.intTime,map:q6.map,merge:bf.merge,null:gme.nullTag,omap:G6.omap,pairs:Z6.pairs,seq:B6.seq,set:V6.set,timestamp:r_.timestamp},Sme={"tag:yaml.org,2002:binary":H6.binary,"tag:yaml.org,2002:merge":bf.merge,"tag:yaml.org,2002:omap":G6.omap,"tag:yaml.org,2002:pairs":Z6.pairs,"tag:yaml.org,2002:set":V6.set,"tag:yaml.org,2002:timestamp":r_.timestamp};function wme(t,e,r){let n=z6.get(e);if(n&&!t)return r&&!n.includes(bf.merge)?n.concat(bf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(z6.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(bf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?U6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(U6).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},[])}jT.coreKnownTags=Sme;jT.getTags=wme});var LT=v(K6=>{"use strict";var MT=Ce(),xme=Jc(),$me=Yc(),kme=mf(),n_=W6(),Eme=(t,e)=>t.keye.key?1:0,FT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?n_.getTags(e,"compat"):e?n_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?n_.coreKnownTags:{},this.tags=n_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,MT.MAP,{value:xme.map}),Object.defineProperty(this,MT.SCALAR,{value:kme.string}),Object.defineProperty(this,MT.SEQ,{value:$me.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Eme:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};K6.Schema=FT});var Y6=v(J6=>{"use strict";var Ame=Ce(),zT=df(),vf=af();function Tme(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=zT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(vf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Ame.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(vf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=zT.stringify(t.contents,i,()=>a=null,c);a&&(l+=vf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(zT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(vf.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(vf.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=Yy.isPair(n)?n:new xT.Pair(n)}}else e("Expected a sequence for this tag");return t}function k6(t,e,r){let{replacer:n}=r,i=new Gpe.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(xT.createPair(a,c,r))}return i}var Zpe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:$6,createNode:k6};Xy.createPairs=k6;Xy.pairs=Zpe;Xy.resolvePairs=$6});var ET=v(kT=>{"use strict";var E6=De(),$T=Zo(),bf=Xo(),Vpe=Qo(),A6=Qy(),pa=class t extends Vpe.YAMLSeq{constructor(){super(),this.add=bf.YAMLMap.prototype.add.bind(this),this.delete=bf.YAMLMap.prototype.delete.bind(this),this.get=bf.YAMLMap.prototype.get.bind(this),this.has=bf.YAMLMap.prototype.has.bind(this),this.set=bf.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=$T.toJS(i.key,"",r),s=$T.toJS(i.value,o,r)):o=$T.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=A6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};pa.tag="tag:yaml.org,2002:omap";var Wpe={collection:"seq",identify:t=>t instanceof Map,nodeClass:pa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=A6.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 pa,r)},createNode:(t,e,r)=>pa.from(t,e,r)};kT.YAMLOMap=pa;kT.omap=Wpe});var P6=v(AT=>{"use strict";var T6=Dt();function O6({value:t,source:e},r){return e&&(t?R6:I6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var R6={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 T6.Scalar(!0),stringify:O6},I6={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 T6.Scalar(!1),stringify:O6};AT.falseTag=I6;AT.trueTag=R6});var C6=v(e_=>{"use strict";var Kpe=Dt(),TT=rl(),Jpe={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},Ype={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():TT.stringifyNumber(t)}},Xpe={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 Kpe.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:TT.stringifyNumber};e_.float=Xpe;e_.floatExp=Ype;e_.floatNaN=Jpe});var N6=v(Sf=>{"use strict";var D6=rl(),vf=t=>typeof t=="bigint"||Number.isInteger(t);function t_(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 OT(t,e,r){let{value:n}=t;if(vf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return D6.stringifyNumber(t)}var Qpe={identify:vf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>t_(t,2,2,r),stringify:t=>OT(t,2,"0b")},eme={identify:vf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>t_(t,1,8,r),stringify:t=>OT(t,8,"0")},tme={identify:vf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>t_(t,0,10,r),stringify:D6.stringifyNumber},rme={identify:vf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>t_(t,2,16,r),stringify:t=>OT(t,16,"0x")};Sf.int=tme;Sf.intBin=Qpe;Sf.intHex=rme;Sf.intOct=eme});var IT=v(RT=>{"use strict";var i_=De(),r_=Jo(),n_=Xo(),ma=class t extends n_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;i_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new r_.Pair(e.key,null):r=new r_.Pair(e,null),n_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=n_.findPair(this.items,e);return!r&&i_.isPair(n)?i_.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=n_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new r_.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(r_.createPair(s,null,n));return o}};ma.tag="tag:yaml.org,2002:set";var nme={collection:"map",identify:t=>t instanceof Set,nodeClass:ma,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>ma.from(t,e,r),resolve(t,e){if(i_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new ma,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};RT.YAMLSet=ma;RT.set=nme});var CT=v(o_=>{"use strict";var ime=rl();function PT(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 j6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return ime.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 ome={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})=>PT(t,r),stringify:j6},sme={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=>PT(t,!1),stringify:j6},M6={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(M6.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=PT(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$/,"")??""};o_.floatTime=sme;o_.intTime=ome;o_.timestamp=M6});var z6=v(L6=>{"use strict";var ame=el(),cme=Zy(),lme=tl(),ume=yf(),dme=wT(),F6=P6(),DT=C6(),s_=N6(),fme=Fy(),pme=ET(),mme=Qy(),hme=IT(),NT=CT(),gme=[ame.map,lme.seq,ume.string,cme.nullTag,F6.trueTag,F6.falseTag,s_.intBin,s_.intOct,s_.int,s_.intHex,DT.floatNaN,DT.floatExp,DT.float,dme.binary,fme.merge,pme.omap,mme.pairs,hme.set,NT.intTime,NT.floatTime,NT.timestamp];L6.schema=gme});var J6=v(FT=>{"use strict";var H6=el(),yme=Zy(),G6=tl(),_me=yf(),bme=mT(),jT=gT(),MT=_T(),vme=b6(),Sme=w6(),Z6=wT(),wf=Fy(),V6=ET(),W6=Qy(),U6=z6(),K6=IT(),a_=CT(),q6=new Map([["core",vme.schema],["failsafe",[H6.map,G6.seq,_me.string]],["json",Sme.schema],["yaml11",U6.schema],["yaml-1.1",U6.schema]]),B6={binary:Z6.binary,bool:bme.boolTag,float:jT.float,floatExp:jT.floatExp,floatNaN:jT.floatNaN,floatTime:a_.floatTime,int:MT.int,intHex:MT.intHex,intOct:MT.intOct,intTime:a_.intTime,map:H6.map,merge:wf.merge,null:yme.nullTag,omap:V6.omap,pairs:W6.pairs,seq:G6.seq,set:K6.set,timestamp:a_.timestamp},wme={"tag:yaml.org,2002:binary":Z6.binary,"tag:yaml.org,2002:merge":wf.merge,"tag:yaml.org,2002:omap":V6.omap,"tag:yaml.org,2002:pairs":W6.pairs,"tag:yaml.org,2002:set":K6.set,"tag:yaml.org,2002:timestamp":a_.timestamp};function xme(t,e,r){let n=q6.get(e);if(n&&!t)return r&&!n.includes(wf.merge)?n.concat(wf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(q6.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(wf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?B6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(B6).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},[])}FT.coreKnownTags=wme;FT.getTags=xme});var UT=v(Y6=>{"use strict";var LT=De(),$me=el(),kme=tl(),Eme=yf(),c_=J6(),Ame=(t,e)=>t.keye.key?1:0,zT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?c_.getTags(e,"compat"):e?c_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?c_.coreKnownTags:{},this.tags=c_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,LT.MAP,{value:$me.map}),Object.defineProperty(this,LT.SCALAR,{value:Eme.string}),Object.defineProperty(this,LT.SEQ,{value:kme.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Ame:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Y6.Schema=zT});var Q6=v(X6=>{"use strict";var Tme=De(),qT=mf(),xf=uf();function Ome(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=qT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(xf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Tme.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(xf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=qT.stringify(t.contents,i,()=>a=null,c);a&&(l+=xf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(qT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(xf.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(xf.indentComment(o(c),"")))}return r.join(` `)+` -`}J6.stringifyDocument=Tme});var Sf=v(X6=>{"use strict";var Ome=of(),Qc=xy(),kn=Ce(),Rme=Ko(),Ime=Go(),Pme=LT(),Cme=Y6(),UT=by(),Dme=GA(),Nme=sf(),qT=HA(),BT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,kn.NODE_TYPE,{value:kn.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 qT.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,{[kn.NODE_TYPE]:{value:kn.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=kn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){el(this.contents)&&this.contents.add(e)}addIn(e,r){el(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=UT.anchorNames(this);e.anchor=!r||n.has(r)?UT.findNewAnchor(r||"a",n):r}return new Ome.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}=UT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Nme.createNode(e,u,m);return a&&kn.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 Rme.Pair(i,o)}delete(e){return el(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Qc.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):el(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return kn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Qc.isEmptyPath(e)?!r&&kn.isScalar(this.contents)?this.contents.value:this.contents:kn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return kn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Qc.isEmptyPath(e)?this.contents!==void 0:kn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Qc.collectionFromPath(this.schema,[e],r):el(this.contents)&&this.contents.set(e,r)}setIn(e,r){Qc.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Qc.collectionFromPath(this.schema,Array.from(e),r):el(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 qT.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 qT.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 Pme.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=Ime.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"?Dme.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 Cme.stringifyDocument(this,e)}};function el(t){if(kn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}X6.Document=BT});var $f=v(xf=>{"use strict";var wf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},HT=class extends wf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},GT=class extends wf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},jme=(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 +`}X6.stringifyDocument=Ome});var $f=v(eB=>{"use strict";var Rme=cf(),nl=Ty(),kn=De(),Ime=Jo(),Pme=Zo(),Cme=UT(),Dme=Q6(),BT=$y(),Nme=VA(),jme=lf(),HT=ZA(),GT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,kn.NODE_TYPE,{value:kn.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 HT.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,{[kn.NODE_TYPE]:{value:kn.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=kn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){il(this.contents)&&this.contents.add(e)}addIn(e,r){il(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=BT.anchorNames(this);e.anchor=!r||n.has(r)?BT.findNewAnchor(r||"a",n):r}return new Rme.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}=BT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=jme.createNode(e,u,m);return a&&kn.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 Ime.Pair(i,o)}delete(e){return il(this.contents)?this.contents.delete(e):!1}deleteIn(e){return nl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):il(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return kn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return nl.isEmptyPath(e)?!r&&kn.isScalar(this.contents)?this.contents.value:this.contents:kn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return kn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return nl.isEmptyPath(e)?this.contents!==void 0:kn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=nl.collectionFromPath(this.schema,[e],r):il(this.contents)&&this.contents.set(e,r)}setIn(e,r){nl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=nl.collectionFromPath(this.schema,Array.from(e),r):il(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 HT.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 HT.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 Cme.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=Pme.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"?Nme.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 Dme.stringifyDocument(this,e)}};function il(t){if(kn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}eB.Document=GT});var Af=v(Ef=>{"use strict";var kf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},ZT=class extends kf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},VT=class extends kf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Mme=(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} -`}};xf.YAMLError=wf;xf.YAMLParseError=HT;xf.YAMLWarning=GT;xf.prettifyError=jme});var kf=v(Q6=>{"use strict";function Mme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}Q6.resolveProps=Mme});var i_=v(eB=>{"use strict";function ZT(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(ZT(e.key)||ZT(e.value))return!0}return!1;default:return!0}}eB.containsNewline=ZT});var VT=v(tB=>{"use strict";var Fme=i_();function Lme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Fme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}tB.flowIndentCheck=Lme});var WT=v(nB=>{"use strict";var rB=Ce();function zme(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||rB.isScalar(o)&&rB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}nB.mapIncludes=zme});var lB=v(cB=>{"use strict";var iB=Ko(),Ume=Yo(),oB=kf(),qme=i_(),sB=VT(),Bme=WT(),aB="All mapping items must start at the same column";function Hme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Ume.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=oB.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",aB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||qme.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",aB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&sB.flowIndentCheck(n.indent,f,i),r.atKey=!1,Bme.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=oB.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 Gme=Xo(),Zme=kf(),Vme=VT();function Wme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Gme.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=Zme.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&&Vme.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}uB.resolveBlockSeq=Wme});var tl=v(fB=>{"use strict";function Kme(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}}fB.resolveEnd=Kme});var gB=v(hB=>{"use strict";var Jme=Ce(),Yme=Ko(),pB=Yo(),Xme=Xo(),Qme=tl(),mB=kf(),ehe=i_(),the=WT(),KT="Block collections are not allowed within flow collections",JT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function rhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?pB.YAMLMap:Xme.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=Qme.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}hB.resolveFlowCollection=rhe});var _B=v(yB=>{"use strict";var nhe=Ce(),ihe=Ct(),ohe=Yo(),she=Xo(),ahe=lB(),che=dB(),lhe=gB();function YT(t,e,r,n,i,o){let s=r.type==="block-map"?ahe.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?che.resolveBlockSeq(t,e,r,n,o):lhe.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 uhe(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),YT(t,e,r,i,s)}let l=YT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=nhe.isNode(u)?u:new ihe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}yB.composeCollection=uhe});var QT=v(bB=>{"use strict";var XT=Ct();function dhe(t,e,r){let n=e.offset,i=fhe(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?XT.Scalar.BLOCK_FOLDED:XT.Scalar.BLOCK_LITERAL,s=e.source?phe(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?` +`}};Ef.YAMLError=kf;Ef.YAMLParseError=ZT;Ef.YAMLWarning=VT;Ef.prettifyError=Mme});var Tf=v(tB=>{"use strict";function Fme(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 A of t)switch(m&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&o(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&A.type!=="comment"&&A.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),A.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(h=A),u=!0;break;case"comment":{u||o(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=A.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=A.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=A.source,l=!0,p=!0,(g||b)&&(_=A),u=!0;break;case"anchor":g&&o(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&o(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=A,w??(w=A.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(A,"MULTIPLE_TAGS","A node can have at most one tag"),b=A,w??(w=A.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),x&&o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),x=A,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=A,l=!1,u=!1;break}default:o(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),l=!1,u=!1}let O=t[t.length-1],T=O?O.offset+O.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:T,start:w??T}}tB.resolveProps=Fme});var l_=v(rB=>{"use strict";function WT(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(WT(e.key)||WT(e.value))return!0}return!1;default:return!0}}rB.containsNewline=WT});var KT=v(nB=>{"use strict";var Lme=l_();function zme(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Lme.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}nB.flowIndentCheck=zme});var JT=v(oB=>{"use strict";var iB=De();function Ume(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||iB.isScalar(o)&&iB.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}oB.mapIncludes=Ume});var dB=v(uB=>{"use strict";var sB=Jo(),qme=Xo(),aB=Tf(),Bme=l_(),cB=KT(),Hme=JT(),lB="All mapping items must start at the same column";function Gme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??qme.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=aB.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",lB)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Bme.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",lB);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&cB.flowIndentCheck(n.indent,f,i),r.atKey=!1,Hme.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=aB.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 Zme=Qo(),Vme=Tf(),Wme=KT();function Kme({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Zme.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=Vme.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&&Wme.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}fB.resolveBlockSeq=Kme});var ol=v(mB=>{"use strict";function Jme(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}}mB.resolveEnd=Jme});var _B=v(yB=>{"use strict";var Yme=De(),Xme=Jo(),hB=Xo(),Qme=Qo(),ehe=ol(),gB=Tf(),the=l_(),rhe=JT(),YT="Block collections are not allowed within flow collections",XT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function nhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?hB.YAMLMap:Qme.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=ehe.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}yB.resolveFlowCollection=nhe});var vB=v(bB=>{"use strict";var ihe=De(),ohe=Dt(),she=Xo(),ahe=Qo(),che=dB(),lhe=pB(),uhe=_B();function QT(t,e,r,n,i,o){let s=r.type==="block-map"?che.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?lhe.resolveBlockSeq(t,e,r,n,o):uhe.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 dhe(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),QT(t,e,r,i,s)}let l=QT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=ihe.isNode(u)?u:new ohe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}bB.composeCollection=dhe});var tO=v(SB=>{"use strict";var eO=Dt();function fhe(t,e,r){let n=e.offset,i=phe(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?eO.Scalar.BLOCK_FOLDED:eO.Scalar.BLOCK_LITERAL,s=e.source?mhe(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,91 +112,91 @@ ${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 fhe({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 eO=Ct(),mhe=tl();function hhe(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=eO.Scalar.PLAIN,c=ghe(o,l);break;case"single-quoted-scalar":a=eO.Scalar.QUOTE_SINGLE,c=yhe(o,l);break;case"double-quoted-scalar":a=eO.Scalar.QUOTE_DOUBLE,c=_he(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=mhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function ghe(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}`),vB(t)}function yhe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),vB(t.slice(1,-1)).replace(/''/g,"'")}function vB(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var rO=Dt(),hhe=ol();function ghe(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=rO.Scalar.PLAIN,c=yhe(o,l);break;case"single-quoted-scalar":a=rO.Scalar.QUOTE_SINGLE,c=_he(o,l);break;case"double-quoted-scalar":a=rO.Scalar.QUOTE_DOUBLE,c=bhe(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=hhe.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function yhe(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}`),wB(t)}function _he(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),wB(t.slice(1,-1)).replace(/''/g,"'")}function wB(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 bhe(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 vhe(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 vhe={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function She(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}}SB.resolveFlowScalar=hhe});var $B=v(xB=>{"use strict";var pa=Ce(),wB=Ct(),whe=QT(),xhe=tO();function $he(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?whe.resolveBlockScalar(t,e,n):xhe.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[pa.SCALAR]:c?l=khe(t.schema,i,c,r,n):e.type==="scalar"?l=Ehe(t,i,e,n):l=t.schema[pa.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=pa.isScalar(d)?d:new wB.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new wB.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 khe(t,e,r,n,i){if(r==="!")return t[pa.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[pa.SCALAR])}function Ehe({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[pa.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[pa.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}xB.composeScalar=$he});var EB=v(kB=>{"use strict";function Ahe(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}kB.emptyScalarPosition=Ahe});var OB=v(nO=>{"use strict";var The=of(),Ohe=Ce(),Rhe=_B(),AB=$B(),Ihe=tl(),Phe=EB(),Che={composeNode:TB,composeEmptyNode:rO};function TB(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=Dhe(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=AB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Rhe.composeCollection(Che,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=rO(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&&(!Ohe.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 rO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Phe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=AB.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 Dhe({options:t},{offset:e,source:r,end:n},i){let o=new The.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=Ihe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}nO.composeEmptyNode=rO;nO.composeNode=TB});var PB=v(IB=>{"use strict";var Nhe=Sf(),RB=OB(),jhe=tl(),Mhe=kf();function Fhe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Nhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Mhe.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=jhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}IB.composeDoc=Fhe});var oO=v(NB=>{"use strict";var Lhe=Ge("process"),zhe=HA(),Uhe=Sf(),Ef=$f(),CB=Ce(),qhe=PB(),Bhe=tl();function Af(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 ha=De(),$B=Dt(),xhe=tO(),$he=nO();function khe(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?xhe.resolveBlockScalar(t,e,n):$he.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[ha.SCALAR]:c?l=Ehe(t.schema,i,c,r,n):e.type==="scalar"?l=Ahe(t,i,e,n):l=t.schema[ha.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ha.isScalar(d)?d:new $B.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new $B.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 Ehe(t,e,r,n,i){if(r==="!")return t[ha.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[ha.SCALAR])}function Ahe({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[ha.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ha.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}kB.composeScalar=khe});var TB=v(AB=>{"use strict";function The(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}AB.emptyScalarPosition=The});var IB=v(oO=>{"use strict";var Ohe=cf(),Rhe=De(),Ihe=vB(),OB=EB(),Phe=ol(),Che=TB(),Dhe={composeNode:RB,composeEmptyNode:iO};function RB(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=Nhe(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=OB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Ihe.composeCollection(Dhe,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=iO(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&&(!Rhe.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 iO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Che.emptyScalarPosition(e,r,n),indent:-1,source:""},d=OB.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 Nhe({options:t},{offset:e,source:r,end:n},i){let o=new Ohe.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=Phe.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}oO.composeEmptyNode=iO;oO.composeNode=RB});var DB=v(CB=>{"use strict";var jhe=$f(),PB=IB(),Mhe=ol(),Fhe=Tf();function Lhe(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new jhe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Fhe.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?PB.composeNode(l,i,u,s):PB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Mhe.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}CB.composeDoc=Lhe});var aO=v(MB=>{"use strict";var zhe=Ge("process"),Uhe=ZA(),qhe=$f(),Of=Af(),NB=De(),Bhe=DB(),Hhe=ol();function Rf(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 jB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=Af(r);o?this.warnings.push(new Ef.YAMLWarning(s,n,i)):this.errors.push(new Ef.YAMLParseError(s,n,i))},this.directives=new zhe.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(CB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];CB.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=Rf(r);o?this.warnings.push(new Of.YAMLWarning(s,n,i)):this.errors.push(new Of.YAMLParseError(s,n,i))},this.directives=new Uhe.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=jB(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(NB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];NB.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=Af(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=qhe.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 Ef.YAMLParseError(Af(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 Ef.YAMLParseError(Af(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Bhe.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 Ef.YAMLParseError(Af(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 Uhe.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}}};NB.Composer=iO});var FB=v(o_=>{"use strict";var Hhe=QT(),Ghe=tO(),Zhe=$f(),jB=uf();function Vhe(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 Zhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ghe.resolveFlowScalar(t,e,n);case"block-scalar":return Hhe.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Whe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=jB.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=Rf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Bhe.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 Of.YAMLParseError(Rf(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 Of.YAMLParseError(Rf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Hhe.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 Of.YAMLParseError(Rf(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 qhe.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}}};MB.Composer=sO});var zB=v(u_=>{"use strict";var Ghe=tO(),Zhe=nO(),Vhe=Af(),FB=pf();function Whe(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 Vhe.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Zhe.resolveFlowScalar(t,e,n);case"block-scalar":return Ghe.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Khe(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 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 Khe(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=jB.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">":Jhe(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 Jhe(t,e){let r=e.indexOf(` +`,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 Jhe(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">":Yhe(t,c);break;case'"':cO(t,c,"double-quoted-scalar");break;case"'":cO(t,c,"single-quoted-scalar");break;default:cO(t,c,"scalar")}}function Yhe(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 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})}}}o_.createScalarToken=Whe;o_.resolveAsScalar=Vhe;o_.setScalarValue=Khe});var zB=v(LB=>{"use strict";var Yhe=t=>"type"in t?a_(t):s_(t);function a_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=a_(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+=a_(e)),r)for(let o of r)i+=o.source;return n&&(i+=a_(n)),i}LB.stringify=Yhe});var HB=v(BB=>{"use strict";var aO=Symbol("break visit"),Xhe=Symbol("skip children"),UB=Symbol("remove item");function ma(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),qB(Object.freeze([]),t,e)}ma.BREAK=aO;ma.SKIP=Xhe;ma.REMOVE=UB;ma.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};ma.parentCollection=(t,e)=>{let r=ma.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 qB(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 cO=FB(),Qhe=zB(),ege=HB(),lO="\uFEFF",uO="",dO="",fO="",tge=t=>!!t&&"items"in t,rge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function nge(t){switch(t){case lO:return"";case uO:return"";case dO:return"";case fO:return"";default:return JSON.stringify(t)}}function ige(t){switch(t){case lO:return"byte-order-mark";case uO:return"doc-mode";case dO:return"flow-error-end";case fO: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}];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 cO(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})}}}u_.createScalarToken=Khe;u_.resolveAsScalar=Whe;u_.setScalarValue=Jhe});var qB=v(UB=>{"use strict";var Xhe=t=>"type"in t?f_(t):d_(t);function f_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=f_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=d_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=d_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=d_(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 d_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=f_(e)),r)for(let o of r)i+=o.source;return n&&(i+=f_(n)),i}UB.stringify=Xhe});var ZB=v(GB=>{"use strict";var lO=Symbol("break visit"),Qhe=Symbol("skip children"),BB=Symbol("remove item");function ga(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),HB(Object.freeze([]),t,e)}ga.BREAK=lO;ga.SKIP=Qhe;ga.REMOVE=BB;ga.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};ga.parentCollection=(t,e)=>{let r=ga.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 HB(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 uO=zB(),ege=qB(),tge=ZB(),dO="\uFEFF",fO="",pO="",mO="",rge=t=>!!t&&"items"in t,nge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function ige(t){switch(t){case dO:return"";case fO:return"";case pO:return"";case mO:return"";default:return JSON.stringify(t)}}function oge(t){switch(t){case dO:return"byte-order-mark";case fO:return"doc-mode";case pO:return"flow-error-end";case mO: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}Dr.createScalarToken=cO.createScalarToken;Dr.resolveAsScalar=cO.resolveAsScalar;Dr.setScalarValue=cO.setScalarValue;Dr.stringify=Qhe.stringify;Dr.visit=ege.visit;Dr.BOM=lO;Dr.DOCUMENT=uO;Dr.FLOW_END=dO;Dr.SCALAR=fO;Dr.isCollection=tge;Dr.isScalar=rge;Dr.prettyToken=nge;Dr.tokenType=ige});var hO=v(ZB=>{"use strict";var Tf=c_();function Wn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var GB=new Set("0123456789ABCDEFabcdef"),oge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),l_=new Set(",[]{}"),sge=new Set(` ,[]{} -\r `),pO=t=>!t||sge.has(t),mO=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}Dr.createScalarToken=uO.createScalarToken;Dr.resolveAsScalar=uO.resolveAsScalar;Dr.setScalarValue=uO.setScalarValue;Dr.stringify=ege.stringify;Dr.visit=tge.visit;Dr.BOM=dO;Dr.DOCUMENT=fO;Dr.FLOW_END=pO;Dr.SCALAR=mO;Dr.isCollection=rge;Dr.isScalar=nge;Dr.prettyToken=ige;Dr.tokenType=oge});var yO=v(WB=>{"use strict";var If=p_();function Kn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var VB=new Set("0123456789ABCDEFabcdef"),sge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),m_=new Set(",[]{}"),age=new Set(` ,[]{} +\r `),hO=t=>!t||age.has(t),gO=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==="...")&&Wn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Wn(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===":")&&Wn(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(pO),"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=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Kn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Kn(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===":")&&Kn(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(hO),"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=>Wn(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` +`,o)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Kn(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 Tf.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(Wn(o)||e&&l_.has(o))break;r=n}else if(Wn(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 If.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(Kn(o)||e&&m_.has(o))break;r=n}else if(Kn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&l_.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&l_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Tf.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(pO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Wn(n)||r&&l_.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(;!Wn(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(oge.has(r))r=this.buffer[++e];else if(r==="%"&&GB.has(this.buffer[e+1])&&GB.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&&m_.has(o))break;if(i===` +`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&m_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield If.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(hO),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Kn(n)||r&&m_.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(;!Kn(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(sge.has(r))r=this.buffer[++e];else if(r==="%"&&VB.has(this.buffer[e+1])&&VB.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)}};ZB.Lexer=mO});var yO=v(VB=>{"use strict";var gO=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 age=Ge("process"),WB=c_(),cge=hO();function Qo(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 d_(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"&&JB(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=gO});var bO=v(KB=>{"use strict";var _O=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 cge=Ge("process"),JB=p_(),lge=yO();function es(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 g_(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"&&XB(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&&YB(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(Qo(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(YB(r.key)&&!Qo(r.sep,"newline")){let s=rl(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(Qo(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=rl(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]}):Qo(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&&!Qo(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)){d_(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||Qo(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=u_(n),o=rl(i);JB(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)){g_(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(es(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(QB(r.key)&&!es(r.sep,"newline")){let s=sl(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(es(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=sl(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]}):es(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&&!es(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)){g_(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||es(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=h_(n),o=sl(i);XB(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=u_(e),n=rl(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=u_(e),n=rl(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())}}};XB.Parser=_O});var nH=v(Rf=>{"use strict";var QB=oO(),lge=Sf(),Of=$f(),uge=nT(),dge=Ce(),fge=yO(),eH=bO();function tH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new fge.LineCounter||null,prettyErrors:e}}function pge(t,e={}){let{lineCounter:r,prettyErrors:n}=tH(e),i=new eH.Parser(r?.addNewLine),o=new QB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Of.prettifyError(t,r)),a.warnings.forEach(Of.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function rH(t,e={}){let{lineCounter:r,prettyErrors:n}=tH(e),i=new eH.Parser(r?.addNewLine),o=new QB.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 Of.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Of.prettifyError(t,r)),s.warnings.forEach(Of.prettifyError(t,r))),s}function mge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=rH(t,r);if(!i)return null;if(i.warnings.forEach(o=>uge.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 hge(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 dge.isDocument(t)&&!n?t.toString(r):new lge.Document(t,n,r).toString(r)}Rf.parse=mge;Rf.parseAllDocuments=pge;Rf.parseDocument=rH;Rf.stringify=hge});var Qt=v(Ze=>{"use strict";var gge=oO(),yge=Sf(),_ge=LT(),vO=$f(),bge=of(),es=Ce(),vge=Ko(),Sge=Ct(),wge=Yo(),xge=Xo(),$ge=c_(),kge=hO(),Ege=yO(),Age=bO(),f_=nH(),iH=ef();Ze.Composer=gge.Composer;Ze.Document=yge.Document;Ze.Schema=_ge.Schema;Ze.YAMLError=vO.YAMLError;Ze.YAMLParseError=vO.YAMLParseError;Ze.YAMLWarning=vO.YAMLWarning;Ze.Alias=bge.Alias;Ze.isAlias=es.isAlias;Ze.isCollection=es.isCollection;Ze.isDocument=es.isDocument;Ze.isMap=es.isMap;Ze.isNode=es.isNode;Ze.isPair=es.isPair;Ze.isScalar=es.isScalar;Ze.isSeq=es.isSeq;Ze.Pair=vge.Pair;Ze.Scalar=Sge.Scalar;Ze.YAMLMap=wge.YAMLMap;Ze.YAMLSeq=xge.YAMLSeq;Ze.CST=$ge;Ze.Lexer=kge.Lexer;Ze.LineCounter=Ege.LineCounter;Ze.Parser=Age.Parser;Ze.parse=f_.parse;Ze.parseAllDocuments=f_.parseAllDocuments;Ze.parseDocument=f_.parseDocument;Ze.stringify=f_.stringify;Ze.visit=iH.visit;Ze.visitAsync=iH.visitAsync});import{execFileSync as oH}from"node:child_process";import{existsSync as p_}from"node:fs";import{join as m_,resolve as Tge}from"node:path";function Oge(t){try{let e=oH("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Tge(t,e):null}catch{return null}}function SO(t){let e=Oge(t);if(!e)return null;try{if(p_(m_(e,"MERGE_HEAD")))return"merge";if(p_(m_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(p_(m_(e,"rebase-merge"))||p_(m_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ha(t){return SO(t)!==null}function wO(t,e){try{let r=oH("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 h_(t,e){return wO(t,e)!==null}var ga=y(()=>{"use strict"});import{execFileSync as Rge}from"node:child_process";import{existsSync as Ige,readFileSync as Pge}from"node:fs";import{join as cH}from"node:path";function If(t,e){return Rge("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function ts(t){try{let e=If(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 rs(t,e){Cge(t,e);let r=If(t,["rev-parse","HEAD"]).trim(),n=Dge(t,e);return{groups:Nge(t,n),head:r,inventory:{after:aH(y_(t,"spec.yaml")),before:aH(xO(t,e,"spec.yaml"))},since:e,unsharded_commits:Lge(t,e)}}function $O(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 Cge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!h_(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 Dge(t,e){let r=If(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(!(!sH(c)&&!sH(a)))if(s.startsWith("A")){let l=g_(y_(t,c));if(!l)continue;l.status==="done"?n.push(nl(l,"added-as-done")):l.status==="archived"&&n.push(nl(l,"archived"))}else if(s.startsWith("D")){let l=g_(xO(t,e,a));l&&n.push(nl(l,"archived"))}else{let l=g_(y_(t,c));if(!l)continue;let d=g_(xO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(nl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(nl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(nl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function sH(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function nl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>$O(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function g_(t){if(t===null)return null;let e;try{e=(0,__.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 y_(t,e){let r=cH(t,e);if(!Ige(r))return null;try{return Pge(r,"utf8")}catch{return null}}function xO(t,e,r){try{return If(t,["show",`${e}:${r}`])}catch{return null}}function Nge(t,e){let r=jge(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 jge(t){let e=y_(t,cH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,__.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function aH(t){let e={};if(t!==null)try{let n=(0,__.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 Lge(t,e){let r=If(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);Mge.test(a)&&(Fge.test(a)||n.push({hash:s,subject:a}))}return n}var __,Mge,Fge,il=y(()=>{"use strict";__=St(Qt(),1);ga();Mge=/^(feat|fix)(\([^)]*\))?!?:/,Fge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as lH}from"node:child_process";import{appendFileSync as zge,existsSync as kO,mkdirSync as Uge,readFileSync as qge,renameSync as Bge,statSync as Hge}from"node:fs";import{userInfo as Gge}from"node:os";import{dirname as Zge,join as AO}from"node:path";function TO(t){return AO(t,uH,Vge)}function Xr(t,e){let r=TO(t),n=Zge(r);kO(n)||Uge(n,{recursive:!0});try{kO(r)&&Hge(r).size>Wge&&Bge(r,AO(n,dH))}catch{}zge(r,`${JSON.stringify(e)} -`,"utf8")}function EO(t){if(!kO(t))return[];let e=qge(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ya(t){return EO(TO(t))}function b_(t){return[...EO(AO(t,uH,dH)),...EO(TO(t))]}function Qr(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 Kge(t){let e;try{e=lH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Gge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Jge(t){try{return lH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Pf(t,e){try{let r=ya(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Jge(t),i=Kge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Pf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var uH,Vge,dH,Wge,Nr=y(()=>{"use strict";uH=".cladding",Vge="events.log.jsonl",dH="events.log.1.jsonl",Wge=5*1024*1024});import{execFileSync as Yge}from"node:child_process";import{existsSync as fH,readdirSync as Xge,readFileSync as Qge,statSync as pH}from"node:fs";import{createHash as eye}from"node:crypto";import{join as OO}from"node:path";function _a(t){try{return Yge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function RO(t){let e=[],r=OO(t,"spec.yaml");fH(r)&&pH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=OO(t,"spec",i);if(!(!fH(o)||!pH(o).isDirectory()))for(let s of Xge(o))s.endsWith(".yaml")&&e.push(OO(o,s))}e.sort();let n=eye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Qge(i)),n.update("\0")}return n.digest("hex")}function v_(t,e){let r={featureId:e,gitHead:_a(t),specDigest:RO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function S_(t,e){let r=ya(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 w_(t,e,r,n){let i=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var Cf=y(()=>{"use strict";Nr()});import{readFileSync as tye,statSync as rye}from"node:fs";import{extname as nye,resolve as IO,sep as iye}from"node:path";function en(t){return Math.ceil(t.length/4)}function aye(t,e){let r=IO(e),n=IO(r,t);return n===r||n.startsWith(r+iye)}function hH(t,e,r,n){if(!aye(t,e))return{path:t,omitted:"unsafe-path"};if(!oye.has(nye(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>mH)return{path:t,omitted:"too-large",bytes:o}}else{let l=IO(e,t);try{o=rye(l).size}catch{return{path:t,omitted:"missing"}}if(o>mH)return{path:t,omitted:"too-large",bytes:o};try{i=tye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(sye))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=h_(e),n=sl(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=h_(e),n=sl(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())}}};eH.Parser=vO});var oH=v(Cf=>{"use strict";var tH=aO(),uge=$f(),Pf=Af(),dge=oT(),fge=De(),pge=bO(),rH=SO();function nH(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new pge.LineCounter||null,prettyErrors:e}}function mge(t,e={}){let{lineCounter:r,prettyErrors:n}=nH(e),i=new rH.Parser(r?.addNewLine),o=new tH.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Pf.prettifyError(t,r)),a.warnings.forEach(Pf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function iH(t,e={}){let{lineCounter:r,prettyErrors:n}=nH(e),i=new rH.Parser(r?.addNewLine),o=new tH.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 Pf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Pf.prettifyError(t,r)),s.warnings.forEach(Pf.prettifyError(t,r))),s}function hge(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=iH(t,r);if(!i)return null;if(i.warnings.forEach(o=>dge.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 gge(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 fge.isDocument(t)&&!n?t.toString(r):new uge.Document(t,n,r).toString(r)}Cf.parse=hge;Cf.parseAllDocuments=mge;Cf.parseDocument=iH;Cf.stringify=gge});var Qt=v(Ze=>{"use strict";var yge=aO(),_ge=$f(),bge=UT(),wO=Af(),vge=cf(),ts=De(),Sge=Jo(),wge=Dt(),xge=Xo(),$ge=Qo(),kge=p_(),Ege=yO(),Age=bO(),Tge=SO(),y_=oH(),sH=nf();Ze.Composer=yge.Composer;Ze.Document=_ge.Document;Ze.Schema=bge.Schema;Ze.YAMLError=wO.YAMLError;Ze.YAMLParseError=wO.YAMLParseError;Ze.YAMLWarning=wO.YAMLWarning;Ze.Alias=vge.Alias;Ze.isAlias=ts.isAlias;Ze.isCollection=ts.isCollection;Ze.isDocument=ts.isDocument;Ze.isMap=ts.isMap;Ze.isNode=ts.isNode;Ze.isPair=ts.isPair;Ze.isScalar=ts.isScalar;Ze.isSeq=ts.isSeq;Ze.Pair=Sge.Pair;Ze.Scalar=wge.Scalar;Ze.YAMLMap=xge.YAMLMap;Ze.YAMLSeq=$ge.YAMLSeq;Ze.CST=kge;Ze.Lexer=Ege.Lexer;Ze.LineCounter=Age.LineCounter;Ze.Parser=Tge.Parser;Ze.parse=y_.parse;Ze.parseAllDocuments=y_.parseAllDocuments;Ze.parseDocument=y_.parseDocument;Ze.stringify=y_.stringify;Ze.visit=sH.visit;Ze.visitAsync=sH.visitAsync});import{execFileSync as aH}from"node:child_process";import{existsSync as __}from"node:fs";import{join as b_,resolve as Oge}from"node:path";function Rge(t){try{let e=aH("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Oge(t,e):null}catch{return null}}function xO(t){let e=Rge(t);if(!e)return null;try{if(__(b_(e,"MERGE_HEAD")))return"merge";if(__(b_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(__(b_(e,"rebase-merge"))||__(b_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function ya(t){return xO(t)!==null}function $O(t,e){try{let r=aH("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 v_(t,e){return $O(t,e)!==null}var _a=y(()=>{"use strict"});import{execFileSync as Ige}from"node:child_process";import{existsSync as Pge,readFileSync as Cge}from"node:fs";import{join as uH}from"node:path";function Df(t,e){return Ige("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function rs(t){try{let e=Df(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 ns(t,e){Dge(t,e);let r=Df(t,["rev-parse","HEAD"]).trim(),n=Nge(t,e);return{groups:jge(t,n),head:r,inventory:{after:lH(w_(t,"spec.yaml")),before:lH(kO(t,e,"spec.yaml"))},since:e,unsharded_commits:zge(t,e)}}function EO(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 Dge(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!v_(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 Nge(t,e){let r=Df(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(!(!cH(c)&&!cH(a)))if(s.startsWith("A")){let l=S_(w_(t,c));if(!l)continue;l.status==="done"?n.push(al(l,"added-as-done")):l.status==="archived"&&n.push(al(l,"archived"))}else if(s.startsWith("D")){let l=S_(kO(t,e,a));l&&n.push(al(l,"archived"))}else{let l=S_(w_(t,c));if(!l)continue;let d=S_(kO(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(al(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(al(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(al(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function cH(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function al(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>EO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function S_(t){if(t===null)return null;let e;try{e=(0,x_.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 w_(t,e){let r=uH(t,e);if(!Pge(r))return null;try{return Cge(r,"utf8")}catch{return null}}function kO(t,e,r){try{return Df(t,["show",`${e}:${r}`])}catch{return null}}function jge(t,e){let r=Mge(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 Mge(t){let e=w_(t,uH("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,x_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function lH(t){let e={};if(t!==null)try{let n=(0,x_.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 zge(t,e){let r=Df(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);Fge.test(a)&&(Lge.test(a)||n.push({hash:s,subject:a}))}return n}var x_,Fge,Lge,cl=y(()=>{"use strict";x_=St(Qt(),1);_a();Fge=/^(feat|fix)(\([^)]*\))?!?:/,Lge=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as dH}from"node:child_process";import{appendFileSync as Uge,existsSync as AO,mkdirSync as qge,readFileSync as Bge,renameSync as Hge,statSync as Gge}from"node:fs";import{userInfo as Zge}from"node:os";import{dirname as Vge,join as OO}from"node:path";function RO(t){return OO(t,fH,Wge)}function Xr(t,e){let r=RO(t),n=Vge(r);AO(n)||qge(n,{recursive:!0});try{AO(r)&&Gge(r).size>Kge&&Hge(r,OO(n,pH))}catch{}Uge(r,`${JSON.stringify(e)} +`,"utf8")}function TO(t){if(!AO(t))return[];let e=Bge(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ba(t){return TO(RO(t))}function $_(t){return[...TO(OO(t,fH,pH)),...TO(RO(t))]}function Qr(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 Jge(t){let e;try{e=dH("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Zge().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Yge(t){try{return dH("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Nf(t,e){try{let r=ba(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function er(t,e,r){try{let n=Yge(t),i=Jge(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=Nf(t,"gate_run");if(s&&s.payload.head===n&&s.payload.tier===r.tier&&s.payload.strict===r.strict&&s.payload.worst===r.worst)return}Xr(t,Qr(e,o))}catch{}}var fH,Wge,pH,Kge,Nr=y(()=>{"use strict";fH=".cladding",Wge="events.log.jsonl",pH="events.log.1.jsonl",Kge=5*1024*1024});import{execFileSync as Xge}from"node:child_process";import{existsSync as mH,readdirSync as Qge,readFileSync as eye,statSync as hH}from"node:fs";import{createHash as tye}from"node:crypto";import{join as IO}from"node:path";function va(t){try{return Xge("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function PO(t){let e=[],r=IO(t,"spec.yaml");mH(r)&&hH(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=IO(t,"spec",i);if(!(!mH(o)||!hH(o).isDirectory()))for(let s of Qge(o))s.endsWith(".yaml")&&e.push(IO(o,s))}e.sort();let n=tye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(eye(i)),n.update("\0")}return n.digest("hex")}function k_(t,e){let r={featureId:e,gitHead:va(t),specDigest:PO(t),timestamp:new Date().toISOString()};return Xr(t,Qr("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function E_(t,e){let r=ba(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 A_(t,e,r,n){let i=Qr("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Xr(t,i),i}var jf=y(()=>{"use strict";Nr()});import{readFileSync as rye,statSync as nye}from"node:fs";import{extname as iye,resolve as CO,sep as oye}from"node:path";function en(t){return Math.ceil(t.length/4)}function cye(t,e){let r=CO(e),n=CO(r,t);return n===r||n.startsWith(r+oye)}function yH(t,e,r,n){if(!cye(t,e))return{path:t,omitted:"unsafe-path"};if(!sye.has(iye(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>gH)return{path:t,omitted:"too-large",bytes:o}}else{let l=CO(e,t);try{o=nye(l).size}catch{return{path:t,omitted:"missing"}}if(o>gH)return{path:t,omitted:"too-large",bytes:o};try{i=rye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(aye))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 oye,mH,sye,x_=y(()=>{"use strict";oye=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"]),mH=2e6,sye="\0"});function lye(t){for(let i of cye)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 PO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function uye(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??[])PO(e,s,o);for(let s of i.modules??[])PO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=lye(a);c&&PO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function En(t){let e=gH.get(t);return e||(e=uye(t),gH.set(t,e)),e}var cye,gH,ba=y(()=>{"use strict";cye=["derived:","fixture:","script:","self-dogfood:"];gH=new WeakMap});function CO(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 br(t,e,r={}){let n=r.depth??1/0,i=En(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=dye(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=CO(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:DO(i)}}var va=y(()=>{"use strict";ba()});function yH(t){return t.impacted.length}function k_(t,e,r={}){let n=r.initialDepth??$_.initialDepth,i=r.maxDepth??$_.maxDepth,o=r.coverageThreshold??$_.coverageThreshold,s=r.marginYieldThreshold??$_.marginYieldThreshold,a=En(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=br(t,e,{depth:1});return"not_found"in b,b}let d=CO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=yH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var $_,NO=y(()=>{"use strict";va();ba();$_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function fye(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 _H(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=fye(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 bH=y(()=>{"use strict"});function pye(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 ol(t,e){let r=pye(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=_H(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 E_=y(()=>{"use strict";bH()});import{existsSync as SH,readdirSync as mye,readFileSync as hye}from"node:fs";import{join as MO}from"node:path";function FO(t,e=yye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function _ye(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:FO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:FO(`done reverted \u2014 pre-push strict gate red${r}`)}}function vH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function bye(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 FO(n)}function vye(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)=>vH(m)-vH(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(-gye).map(_ye),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?bye(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 Sye(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 wye(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=Sye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function xye(t,e){let r=MO(t,".cladding","post-mortems");if(!SH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of mye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(wye(hye(MO(r,o),"utf8"),e,o))}catch{}return i}function wH(t,e){try{let r=b_(t),n=xye(t,e),i=SH(MO(t,".cladding","events.log.1.jsonl"));return vye(r,n,e,{truncated:i})}catch{return}}var gye,yye,xH=y(()=>{"use strict";Nr();gye=5,yye=120});function A_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function Sa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:$ye,o=e,s,a=En(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=ol(t,o);if("not_found"in c)return c;let l=c.focus,u=wH(n,l.id),d=a&&a.size>0?e:l.id,f=k_(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}},O=[...c.ancestors];for(;O.length>kye&&A_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let D=(se,Pe)=>({impacted:se,regression_tests:Pe,...g?{radius:g}:{},...p?.ledger?{ledger:p.ledger}:{}}),$=(se,Pe,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],ao={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Pe),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(ao))>i},ie=m,J=h;if($(ie,J,0,0)){let se=br(t,d,{depth:1}),Pe=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Yt=[...m.filter(de=>Pe.has(de.id)),...m.filter(de=>!Pe.has(de.id))],ao=0;for(;Yt.length>Pe.size&&$(Yt,J,ao,0);)Yt=Yt.slice(0,-1),ao++;let vi=[...h],Yr=0;for(;$(Yt,vi,ao,Yr);){let de=-1;for(let co=vi.length-1;co>=0;co--)if(!Kt.has(vi[co])){de=co;break}if(de<0)break;vi.splice(de,1),Yr++}ie=Yt,J=vi,ao+Yr>0&&x.push(`breaks: omitted ${ao} feature(s) / ${Yr} test(s)`),$(ie,J,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let Oe=D(ie,J),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:Oe},P=C;if(u){let se={...C,prior_attempts:u};en(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var $ye,kye,T_=y(()=>{"use strict";x_();E_();NO();xH();va();ba();$ye=3e3,kye=3});function Kn(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 Eye(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 $H(t,e,r="."){let n=En(t),i=t.features??[],o=[];for(let f of i){let p=Sa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=Sa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=k_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Kn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Kn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Kn(a(c))*10)/10,medianShrinkTruncated:Math.round(Kn(a(l))*10)/10,medianStructuralRatio:Math.round(Kn(u)*100)/100,medianSliceTokens:Math.round(Kn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Kn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Kn(o.map(f=>f.searchDepth)),p95Depth:Eye(o.map(f=>f.searchDepth),95),medianEdges:Kn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Kn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Kn(o.map(f=>f.regressionTests))},features:o}}var sl,O_=y(()=>{"use strict";x_();NO();T_();ba();sl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Aye,existsSync as LO,mkdirSync as Tye,readFileSync as kH}from"node:fs";import{dirname as Oye,join as Rye}from"node:path";function zO(t){return Rye(t,Iye,Pye)}function Cye(t,e){return{timestamp:new Date().toISOString(),head:_a(t),spec_digest:RO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function EH(t,e){try{let r=Cye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=UO(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=zO(t),s=Oye(o);return LO(s)||Tye(s,{recursive:!0}),Aye(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function AH(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 UO(t,e){let r=zO(t);if(!LO(r))return[];let n;try{n=kH(r,"utf8")}catch{return[]}let i=AH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function TH(t){let e=zO(t);if(!LO(e))return{snapshots:[],unreadable:!1};let r;try{r=kH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=AH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Df(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 OH(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?` (${Df(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(` ${sl}`),i.join(` -`)}var Iye,Pye,Nf=y(()=>{"use strict";Cf();O_();Iye=".cladding",Pye="measure.jsonl"});import{existsSync as Dye}from"node:fs";import{join as Nye}from"node:path";function al(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}** (${jye[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 IH(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 ${Df(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Df(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Df(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`,"",sl),r.join(` -`)}function cl(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"} | ${Fye(l,r)} |`)}return n.join(` -`)}function Fye(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 Mye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Dye(Nye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function ll(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),RH(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)RH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function RH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=$O(r);n&&t.push(`- ${n}`)}t.push("")}var jye,Mye,R_=y(()=>{"use strict";Nf();O_();il();jye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Mye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as Lye}from"node:fs";function ki(t="./spec.yaml"){let e=Lye(t,"utf8");return(0,PH.parse)(e)}var PH,I_=y(()=>{"use strict";PH=St(Qt(),1)});var ns=v((jr,GO)=>{"use strict";var qO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+DH(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()};qO.prototype.toString=function(){return this.property+" "+this.message};var P_=jr.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};P_.prototype.addError=function(e){var r;if(typeof e=="string")r=new qO(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 qO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new wa(this);if(this.throwError)throw r;return r};P_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function zye(t,e){return e+": "+t.toString()+` -`}P_.prototype.toString=function(e){return this.errors.map(zye).join("")};Object.defineProperty(P_.prototype,"valid",{get:function(){return!this.errors.length}});GO.exports.ValidatorResultError=wa;function wa(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,wa),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}wa.prototype=new Error;wa.prototype.constructor=wa;wa.prototype.name="Validation Error";var CH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};CH.prototype=Object.create(Error.prototype,{constructor:{value:CH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var BO=jr.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+DH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};BO.prototype.resolve=function(e){return NH(this.base,e)};BO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=NH(this.base,i||"");var s=new BO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Jn=jr.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]+$/};Jn.regexp=Jn.regex;Jn.pattern=Jn.regex;Jn.ipv4=Jn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Jn[r]!==void 0){if(Jn[r]instanceof RegExp)return Jn[r].test(e);if(typeof Jn[r]=="function")return Jn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var DH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 Uye(t,e,r,n){typeof r=="object"?e[n]=HO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function qye(t,e,r){e[r]=t[r]}function Bye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=HO(t[n],e[n]):r[n]=e[n]}function HO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Uye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(qye.bind(null,t,n)),Object.keys(e).forEach(Bye.bind(null,t,e,n))),n}GO.exports.deepMerge=HO;jr.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 Hye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Hye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var NH=jr.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 LH=v((qXe,FH)=>{"use strict";var tn=ns(),Fe=tn.ValidatorResult,is=tn.SchemaError,ZO={};ZO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var Le=ZO.validators={};Le.type=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(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 VO(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}Le.anyOf=function(e,r,n,i){if(e===void 0)return null;var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i);if(!Array.isArray(r.anyOf))throw new is("anyOf must be an array");if(!r.anyOf.some(VO.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};Le.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new is("allOf must be an array");var o=new Fe(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};Le.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new is("oneOf must be an array");var o=new Fe(e,r,n,i),s=new Fe(e,r,n,i),a=r.oneOf.filter(VO.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};Le.if=function(e,r,n,i){if(e===void 0)return null;if(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=VO.call(this,e,n,i,null,r.if),s=new Fe(e,r,n,i),a;if(o){if(r.then===void 0)return;if(!tn.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(!tn.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 WO(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]}}Le.propertyNames=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(e,r,n,i),s=r.propertyNames!==void 0?r.propertyNames:{};if(!tn.isSchema(s))throw new is('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(WO(e,a)!==void 0){var c=this.validateSchema(a,s,n,i.makeChild(s));o.importErrors(c)}return o}};Le.properties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 is('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=WO(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 jH(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)}}Le.patternProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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 is('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&&jH.call(this,e,r,n,i,a,o)}return o}};Le.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var o=new Fe(e,r,n,i);for(var s in e)jH.call(this,e,r,n,i,s,o);return o}};Le.minProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.maxProperties=function(e,r,n,i){if(this.types.object(e)){var o=new Fe(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}};Le.items=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.items!==void 0){var s=new Fe(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}};Le.contains=function(e,r,n,i){var o=this;if(this.types.array(e)&&r.contains!==void 0){if(!tn.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var s=new Fe(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}};Le.minimum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.maximum=function(e,r,n,i){if(this.types.number(e)){var o=new Fe(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}};Le.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var o=new Fe(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}};Le.maxLength=function(e,r,n,i){if(this.types.string(e)){var o=new Fe(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}};Le.minItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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}};Le.maxItems=function(e,r,n,i){if(this.types.array(e)){var o=new Fe(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 Gye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var KO=ns();JO.exports.SchemaScanResult=zH;function zH(t,e){this.id=t,this.ref=e}JO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=KO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=KO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!KO.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 UH=LH(),os=ns(),qH=C_().scan,BH=os.ValidatorResult,Zye=os.ValidatorResultError,jf=os.SchemaError,HH=os.SchemaContext,Vye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ei),this.attributes=Object.create(UH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=qH(r||Vye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=os.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}};Jt.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 Ei=Jt.prototype.types={};Ei.string=function(e){return typeof e=="string"};Ei.number=function(e){return typeof e=="number"&&isFinite(e)};Ei.integer=function(e){return typeof e=="number"&&e%1===0};Ei.boolean=function(e){return typeof e=="boolean"};Ei.array=function(e){return Array.isArray(e)};Ei.null=function(e){return e===null};Ei.date=function(e){return e instanceof Date};Ei.any=function(e){return!0};Ei.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};ZH.exports=Jt});var WH=v((GXe,po)=>{"use strict";var Wye=po.exports.Validator=VH();po.exports.ValidatorResult=ns().ValidatorResult;po.exports.ValidatorResultError=ns().ValidatorResultError;po.exports.ValidationError=ns().ValidationError;po.exports.SchemaError=ns().SchemaError;po.exports.SchemaScanResult=C_().SchemaScanResult;po.exports.scan=C_().scan;po.exports.validate=function(t,e,r){var n=new Wye;return n.validate(t,e,r)}});import{readFileSync as Kye}from"node:fs";import{dirname as Jye,join as Yye}from"node:path";import{fileURLToPath as Xye}from"node:url";function n_e(t){let e=r_e.validate(t,t_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function JH(t){let e=n_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 sye,gH,aye,T_=y(()=>{"use strict";sye=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"]),gH=2e6,aye="\0"});function uye(t){for(let i of lye)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 DO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function dye(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??[])DO(e,s,o);for(let s of i.modules??[])DO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=uye(a);c&&DO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function En(t){let e=_H.get(t);return e||(e=dye(t),_H.set(t,e)),e}var lye,_H,Sa=y(()=>{"use strict";lye=["derived:","fixture:","script:","self-dogfood:"];_H=new WeakMap});function NO(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 br(t,e,r={}){let n=r.depth??1/0,i=En(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=fye(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=NO(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 wa=y(()=>{"use strict";Sa()});function bH(t){return t.impacted.length}function R_(t,e,r={}){let n=r.initialDepth??O_.initialDepth,i=r.maxDepth??O_.maxDepth,o=r.coverageThreshold??O_.coverageThreshold,s=r.marginYieldThreshold??O_.marginYieldThreshold,a=En(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=br(t,e,{depth:1});return"not_found"in b,b}let d=NO(l,a.dependents,1/0).size;if(d===0){let b=br(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 _=br(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=bH(_),x=S-p,w=S>0?x/S:0;f.push(w);let O=d>0?S/d:1,T=x===0&&b>n,A={frontierExhausted:T,coverage:O,marginalYields:[...f],totalKnownDependents:d};if(T)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:A};if(O>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:A};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var O_,MO=y(()=>{"use strict";wa();Sa();O_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function pye(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 vH(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=pye(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 SH=y(()=>{"use strict"});function mye(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 ll(t,e){let r=mye(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=vH(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 I_=y(()=>{"use strict";SH()});import{existsSync as xH,readdirSync as hye,readFileSync as gye}from"node:fs";import{join as LO}from"node:path";function zO(t,e=_ye){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function bye(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:zO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:zO(`done reverted \u2014 pre-push strict gate red${r}`)}}function wH(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function vye(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 zO(n)}function Sye(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)=>wH(m)-wH(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(-yye).map(bye),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?vye(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 FO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function wye(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 xye(t,e,r){let n=FO(t,/_Rolled back at_\s*`([^`]+)`/),i=FO(t,/Last failed gate:\s*`([^`]+)`/),o=FO(t,/Retry attempts:\s*(\d+)/),s=wye(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function $ye(t,e){let r=LO(t,".cladding","post-mortems");if(!xH(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of hye(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(xye(gye(LO(r,o),"utf8"),e,o))}catch{}return i}function $H(t,e){try{let r=$_(t),n=$ye(t,e),i=xH(LO(t,".cladding","events.log.1.jsonl"));return Sye(r,n,e,{truncated:i})}catch{return}}var yye,_ye,kH=y(()=>{"use strict";Nr();yye=5,_ye=120});function P_(t,e,r){return en(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function xa(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:kye,o=e,s,a=En(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=ll(t,o);if("not_found"in c)return c;let l=c.focus,u=$H(n,l.id),d=a&&a.size>0?e:l.id,f=R_(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}},O=[...c.ancestors];for(;O.length>Eye&&P_(w,O,[])>i;)O.pop();O.lengthi){x.push(`code: omitted ${se} (budget)`);continue}A.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}T>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}:{}}),$=(se,Ce,Kt,dr)=>{let Yt=Kt+dr>0?[`breaks: omitted ${Kt} feature(s) / ${dr} test(s)`]:[],co={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Yt]}};return en(JSON.stringify(co))>i},ie=m,K=h;if($(ie,K,0,0)){let se=br(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(de=>de.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Yt=[...m.filter(de=>Ce.has(de.id)),...m.filter(de=>!Ce.has(de.id))],co=0;for(;Yt.length>Ce.size&&$(Yt,K,co,0);)Yt=Yt.slice(0,-1),co++;let wi=[...h],Yr=0;for(;$(Yt,wi,co,Yr);){let de=-1;for(let lo=wi.length-1;lo>=0;lo--)if(!Kt.has(wi[lo])){de=lo;break}if(de<0)break;wi.splice(de,1),Yr++}ie=Yt,K=wi,co+Yr>0&&x.push(`breaks: omitted ${co} feature(s) / ${Yr} test(s)`),$(ie,K,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let xe=D(ie,K),C={...w,needs:O,must_edit:{...w.must_edit,code:A},breaks_if_changed:xe},P=C;if(u){let se={...C,prior_attempts:u};en(JSON.stringify(se))<=i?P=se:x.push("prior_attempts: omitted (budget)")}let Ir=en(JSON.stringify(P));return{...P,budget:{max_tokens:i,used_tokens:Ir,truncated:x}}}var kye,Eye,C_=y(()=>{"use strict";T_();I_();MO();kH();wa();Sa();kye=3e3,Eye=3});function Jn(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 Aye(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 EH(t,e,r="."){let n=En(t),i=t.features??[],o=[];for(let f of i){let p=xa(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=xa(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=R_(t,f.id),g=!("not_found"in h),b=en(JSON.stringify(p)),_="not_found"in m?b:en(JSON.stringify(m)),S=en(JSON.stringify(f));for(let O of f.modules??[]){let T=e(O);T&&(S+=en(T))}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(Jn(s)*1e3)/1e3,medianShrinkFactor:Math.round(Jn(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(Jn(a(c))*10)/10,medianShrinkTruncated:Math.round(Jn(a(l))*10)/10,medianStructuralRatio:Math.round(Jn(u)*100)/100,medianSliceTokens:Math.round(Jn(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Jn(o.map(f=>f.naiveTokens)))},search:{medianDepth:Jn(o.map(f=>f.searchDepth)),p95Depth:Aye(o.map(f=>f.searchDepth),95),medianEdges:Jn(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(Jn(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Jn(o.map(f=>f.regressionTests))},features:o}}var ul,D_=y(()=>{"use strict";T_();MO();C_();Sa();ul="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as Tye,existsSync as UO,mkdirSync as Oye,readFileSync as AH}from"node:fs";import{dirname as Rye,join as Iye}from"node:path";function qO(t){return Iye(t,Pye,Cye)}function Dye(t,e){return{timestamp:new Date().toISOString(),head:va(t),spec_digest:PO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function TH(t,e){try{let r=Dye(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=BO(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=qO(t),s=Rye(o);return UO(s)||Oye(s,{recursive:!0}),Tye(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function OH(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 BO(t,e){let r=qO(t);if(!UO(r))return[];let n;try{n=AH(r,"utf8")}catch{return[]}let i=OH(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function RH(t){let e=qO(t);if(!UO(e))return{snapshots:[],unreadable:!1};let r;try{r=AH(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=OH(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Mf(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 IH(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?` (${Mf(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(` ${ul}`),i.join(` +`)}var Pye,Cye,Ff=y(()=>{"use strict";jf();D_();Pye=".cladding",Cye="measure.jsonl"});import{existsSync as Nye}from"node:fs";import{join as jye}from"node:path";function dl(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}** (${Mye[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 CH(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 ${Mf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Mf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Mf(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`,"",ul),r.join(` +`)}function fl(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"} | ${Lye(l,r)} |`)}return n.join(` +`)}function Lye(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 Fye)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${Nye(jye(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function pl(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),PH(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)PH(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function PH(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=EO(r);n&&t.push(`- ${n}`)}t.push("")}var Mye,Fye,N_=y(()=>{"use strict";Ff();D_();cl();Mye={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};Fye=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as zye}from"node:fs";function Ai(t="./spec.yaml"){let e=zye(t,"utf8");return(0,DH.parse)(e)}var DH,j_=y(()=>{"use strict";DH=St(Qt(),1)});var is=v((jr,VO)=>{"use strict";var HO=jr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+jH(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()};HO.prototype.toString=function(){return this.property+" "+this.message};var M_=jr.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};M_.prototype.addError=function(e){var r;if(typeof e=="string")r=new HO(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 HO(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new $a(this);if(this.throwError)throw r;return r};M_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function Uye(t,e){return e+": "+t.toString()+` +`}M_.prototype.toString=function(e){return this.errors.map(Uye).join("")};Object.defineProperty(M_.prototype,"valid",{get:function(){return!this.errors.length}});VO.exports.ValidatorResultError=$a;function $a(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$a),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}$a.prototype=new Error;$a.prototype.constructor=$a;$a.prototype.name="Validation Error";var NH=jr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};NH.prototype=Object.create(Error.prototype,{constructor:{value:NH,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var GO=jr.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+jH(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};GO.prototype.resolve=function(e){return MH(this.base,e)};GO.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=MH(this.base,i||"");var s=new GO(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var Yn=jr.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]+$/};Yn.regexp=Yn.regex;Yn.pattern=Yn.regex;Yn.ipv4=Yn["ip-address"];jr.isFormat=function(e,r,n){if(typeof e=="string"&&Yn[r]!==void 0){if(Yn[r]instanceof RegExp)return Yn[r].test(e);if(typeof Yn[r]=="function")return Yn[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var jH=jr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};jr.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 qye(t,e,r,n){typeof r=="object"?e[n]=ZO(t[n],r):t.indexOf(r)===-1&&e.push(r)}function Bye(t,e,r){e[r]=t[r]}function Hye(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=ZO(t[n],e[n]):r[n]=e[n]}function ZO(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(qye.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(Bye.bind(null,t,n)),Object.keys(e).forEach(Hye.bind(null,t,e,n))),n}VO.exports.deepMerge=ZO;jr.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 Gye(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}jr.encodePath=function(e){return e.map(Gye).join("")};jr.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};jr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var MH=jr.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 UH=v((VXe,zH)=>{"use strict";var tn=is(),Le=tn.ValidatorResult,os=tn.SchemaError,WO={};WO.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=WO.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 KO(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 os("anyOf must be an array");if(!r.anyOf.some(KO.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 os("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 os("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(KO.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(!tn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=KO.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(!tn.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(!tn.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 JO(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(!tn.isSchema(s))throw new os('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(JO(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 os('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=JO(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 FH(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 os('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&&FH.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)FH.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(!tn.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 Zye(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var YO=is();XO.exports.SchemaScanResult=qH;function qH(t,e){this.id=t,this.ref=e}XO.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=YO.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=YO.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!YO.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 BH=UH(),ss=is(),HH=F_().scan,GH=ss.ValidatorResult,Vye=ss.ValidatorResultError,Lf=ss.SchemaError,ZH=ss.SchemaContext,Wye="/",Jt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ti),this.attributes=Object.create(BH.validators)};Jt.prototype.customFormats={};Jt.prototype.schemas=null;Jt.prototype.types=null;Jt.prototype.attributes=null;Jt.prototype.unresolvedRefs=null;Jt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=HH(r||Wye,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]};Jt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=ss.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Lf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Jt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Lf('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 Ti=Jt.prototype.types={};Ti.string=function(e){return typeof e=="string"};Ti.number=function(e){return typeof e=="number"&&isFinite(e)};Ti.integer=function(e){return typeof e=="number"&&e%1===0};Ti.boolean=function(e){return typeof e=="boolean"};Ti.array=function(e){return Array.isArray(e)};Ti.null=function(e){return e===null};Ti.date=function(e){return e instanceof Date};Ti.any=function(e){return!0};Ti.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};WH.exports=Jt});var JH=v((JXe,mo)=>{"use strict";var Kye=mo.exports.Validator=KH();mo.exports.ValidatorResult=is().ValidatorResult;mo.exports.ValidatorResultError=is().ValidatorResultError;mo.exports.ValidationError=is().ValidationError;mo.exports.SchemaError=is().SchemaError;mo.exports.SchemaScanResult=F_().SchemaScanResult;mo.exports.scan=F_().scan;mo.exports.validate=function(t,e,r){var n=new Kye;return n.validate(t,e,r)}});import{readFileSync as Jye}from"node:fs";import{dirname as Yye,join as Xye}from"node:path";import{fileURLToPath as Qye}from"node:url";function i_e(t){let e=n_e.validate(t,r_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function XH(t){let e=i_e(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var KH,Qye,e_e,t_e,r_e,YH=y(()=>{"use strict";KH=St(WH(),1),Qye=Jye(Xye(import.meta.url)),e_e=Yye(Qye,"schema.json"),t_e=JSON.parse(Kye(e_e,"utf8")),r_e=new KH.Validator});import{existsSync as YO,readdirSync as i_e}from"node:fs";import{dirname as o_e,join as xa,resolve as QH}from"node:path";function XH(t){return YO(t)?i_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>ki(xa(t,r))):[]}function $a(t,e){D_=e?{cwd:QH(t),spec:e}:null}function H(t=".",e="spec.yaml"){return D_&&e==="spec.yaml"&&QH(t)===D_.cwd?D_.spec:s_e(t,e)}function s_e(t,e){let r=xa(t,e),n=ki(r),i=xa(t,o_e(e),"spec");if(!n.features||n.features.length===0){let o=XH(xa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=XH(xa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=xa(i,"architecture.yaml");YO(o)&&(n.architecture=ki(o))}if(!n.capabilities||n.capabilities.length===0){let o=xa(i,"capabilities.yaml");if(YO(o)){let s=ki(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return JH(n),n}var D_,qe=y(()=>{"use strict";I_();YH();D_=null});import ul from"node:process";function eR(){return!!ul.stdout.isTTY}function L(t,e,r=""){let n=eG[t],i=r?` ${r}`:"";eR()?ul.stdout.write(`${XO[t]}${n}${QO} ${e}${i} -`):ul.stdout.write(`${n} ${e}${i} -`)}function Mf(t,e,r=""){if(!eR())return;let n=r?` ${r}`:"";ul.stdout.write(`${tG}${XO.start}\xB7${QO} ${t} \xB7 ${e}${n}`)}function ka(t,e,r=""){let n=eG[t],i=r?` ${r}`:"";eR()?ul.stdout.write(`${tG}${XO[t]}${n}${QO} ${e}${i} -`):ul.stdout.write(`${n} ${e}${i} -`)}var eG,XO,QO,tG,Ai=y(()=>{"use strict";eG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},XO={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},QO="\x1B[0m",tG="\r\x1B[K"});import{createHash as wG}from"node:crypto";import{existsSync as F_e,readFileSync as nR,writeFileSync as L_e}from"node:fs";import{join as N_}from"node:path";function z_e(t,e){let r=wG("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(nR(N_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function $G(t,e){let r=wG("sha256");try{r.update(nR(N_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ss(t){let e=N_(t,...xG);if(!F_e(e))return null;let r;try{r=nR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` -`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function j_(t){return t.features?.size??t.v1?.size??0}function M_(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)!==$G(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===z_e(e,n)?{state:"fresh"}:{state:"stale"}}function kG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${$G(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=U_e+`attested_modules: + `)}`)}var YH,e_e,t_e,r_e,n_e,QH=y(()=>{"use strict";YH=St(JH(),1),e_e=Yye(Qye(import.meta.url)),t_e=Xye(e_e,"schema.json"),r_e=JSON.parse(Jye(t_e,"utf8")),n_e=new YH.Validator});import{existsSync as QO,readdirSync as o_e}from"node:fs";import{dirname as s_e,join as ka,resolve as tG}from"node:path";function eG(t){return QO(t)?o_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ai(ka(t,r))):[]}function Ea(t,e){L_=e?{cwd:tG(t),spec:e}:null}function H(t=".",e="spec.yaml"){return L_&&e==="spec.yaml"&&tG(t)===L_.cwd?L_.spec:a_e(t,e)}function a_e(t,e){let r=ka(t,e),n=Ai(r),i=ka(t,s_e(e),"spec");if(!n.features||n.features.length===0){let o=eG(ka(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=eG(ka(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=ka(i,"architecture.yaml");QO(o)&&(n.architecture=Ai(o))}if(!n.capabilities||n.capabilities.length===0){let o=ka(i,"capabilities.yaml");if(QO(o)){let s=Ai(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return XH(n),n}var L_,Be=y(()=>{"use strict";j_();QH();L_=null});import ml from"node:process";function rR(){return!!ml.stdout.isTTY}function L(t,e,r=""){let n=rG[t],i=r?` ${r}`:"";rR()?ml.stdout.write(`${eR[t]}${n}${tR} ${e}${i} +`):ml.stdout.write(`${n} ${e}${i} +`)}function zf(t,e,r=""){if(!rR())return;let n=r?` ${r}`:"";ml.stdout.write(`${nG}${eR.start}\xB7${tR} ${t} \xB7 ${e}${n}`)}function Aa(t,e,r=""){let n=rG[t],i=r?` ${r}`:"";rR()?ml.stdout.write(`${nG}${eR[t]}${n}${tR} ${e}${i} +`):ml.stdout.write(`${n} ${e}${i} +`)}var rG,eR,tR,nG,Oi=y(()=>{"use strict";rG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},eR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},tR="\x1B[0m",nG="\r\x1B[K"});import{createHash as $G}from"node:crypto";import{existsSync as L_e,readFileSync as oR,writeFileSync as z_e}from"node:fs";import{join as z_}from"node:path";function U_e(t,e){let r=$G("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(oR(z_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function EG(t,e){let r=$G("sha256");try{r.update(oR(z_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function as(t){let e=z_(t,...kG);if(!L_e(e))return null;let r;try{r=oR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s="other";for(let a of r.split(` +`)){if(a==="attested:"){s="v1",n??=new Map;continue}if(a==="attested_modules:"){s="modules",i??=new Map;continue}if(a==="attested_features:"){s="features",o??=new Set;continue}if(!(a.startsWith("#")||a.trim()==="")){if(s==="v1"){let c=a.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);c&&n.set(c[1],c[2])}else if(s==="modules"){let c=a.match(/^ {2}(.+): ([0-9a-f]{16})$/);c&&i.set(c[1],c[2])}else if(s==="features"){let c=a.match(/^ {2}(F-[\w-]+): ok$/);c&&o.add(c[1])}}}return{v1:n,modules:i,features:o}}function U_(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)!==EG(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===U_e(e,n)?{state:"fresh"}:{state:"stale"}}function AG(t,e){let r=(e.features??[]).filter(a=>a.status==="done"&&(a.modules??[]).length>0);if(r.length===0)return!1;let n=new Set;for(let a of r)for(let c of a.modules??[])n.add(c);let i=[...n].sort().map(a=>` ${a}: ${EG(t,a)}`),o=r.map(a=>` ${a.id}: ok`).sort(),s=q_e+`attested_modules: `+i.join(` `)+` attested_features: `+o.join(` `)+` -`;return L_e(N_(t,...xG),s,"utf8"),!0}var xG,U_e,fl=y(()=>{"use strict";xG=["spec","attestation.yaml"];U_e=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return z_e(z_(t,...kG),s,"utf8"),!0}var kG,q_e,gl=y(()=>{"use strict";kG=["spec","attestation.yaml"];q_e=`# 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. # @@ -211,53 +211,53 @@ 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 iR}from"node:path";function F_(t){as={cwd:iR(t),results:new Map}}function EG(t,e,r){!as||as.cwd!==iR(e)||as.results.set(t,r)}function L_(t,e){return!as||as.cwd!==iR(e)?null:as.results.get(t)??null}function z_(){as=null}var as,pl=y(()=>{"use strict";as=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 ho=y(()=>{});import{fileURLToPath as q_e}from"node:url";var ml,B_e,oR,sR,hl=y(()=>{ml=(t,e)=>{let r=sR(B_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},B_e=t=>oR(t)?t.toString():t,oR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,sR=t=>t instanceof URL?q_e(t):t});var U_,aR=y(()=>{ho();hl();U_=(t,e=[],r={})=>{let n=ml(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 H_e}from"node:string_decoder";var AG,TG,Ut,go,G_e,OG,Z_e,q_,RG,V_e,zf,W_e,cR,K_e,rn=y(()=>{({toString:AG}=Object.prototype),TG=t=>AG.call(t)==="[object ArrayBuffer]",Ut=t=>AG.call(t)==="[object Uint8Array]",go=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),G_e=new TextEncoder,OG=t=>G_e.encode(t),Z_e=new TextDecoder,q_=t=>Z_e.decode(t),RG=(t,e)=>V_e(t,e).join(""),V_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new H_e(e),n=t.map(o=>typeof o=="string"?OG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},zf=t=>t.length===1&&Ut(t[0])?t[0]:cR(W_e(t)),W_e=t=>t.map(e=>typeof e=="string"?OG(e):e),cR=t=>{let e=new Uint8Array(K_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},K_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as J_e}from"node:child_process";var DG,NG,Y_e,X_e,IG,Q_e,PG,CG,ebe,jG=y(()=>{ho();rn();DG=t=>Array.isArray(t)&&Array.isArray(t.raw),NG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Y_e({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,{}]},Y_e=({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}=X_e(i,t.raw[n]),c=PG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>CG(d)):[CG(l)];return PG(c,u,a)},X_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=IG.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)],CG=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 ebe(t);throw t instanceof J_e||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`)},ebe=({stdout:t})=>{if(typeof t=="string")return t;if(Ut(t))return q_(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 lR from"node:process";var Yn,B_,An,H_,yo=y(()=>{Yn=t=>B_.includes(t),B_=[lR.stdin,lR.stdout,lR.stderr],An=["stdin","stdout","stderr"],H_=t=>An[t]??`stdio[${t}]`});import{debuglog as tbe}from"node:util";var FG,uR,rbe,nbe,ibe,obe,MG,sbe,dR,abe,cbe,lbe,ube,fR,_o,bo=y(()=>{ho();yo();FG=t=>{let e={...t};for(let r of fR)e[r]=uR(t,r);return e},uR=(t,e)=>{let r=Array.from({length:rbe(t)+1}),n=nbe(t[e],r,e);return cbe(n,e)},rbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,An.length):An.length,nbe=(t,e,r)=>Ot(t)?ibe(t,e,r):e.fill(t),ibe=(t,e,r)=>{for(let n of Object.keys(t).sort(obe))for(let i of sbe(n,r,e))e[i]=t[n];return e},obe=(t,e)=>MG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,sbe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=dR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as sR}from"node:path";function B_(t){cs={cwd:sR(t),results:new Map}}function TG(t,e,r){!cs||cs.cwd!==sR(e)||cs.results.set(t,r)}function H_(t,e){return!cs||cs.cwd!==sR(e)?null:cs.results.get(t)??null}function G_(){cs=null}var cs,yl=y(()=>{"use strict";cs=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 go=y(()=>{});import{fileURLToPath as B_e}from"node:url";var _l,H_e,aR,cR,bl=y(()=>{_l=(t,e)=>{let r=cR(H_e(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},H_e=t=>aR(t)?t.toString():t,aR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,cR=t=>t instanceof URL?B_e(t):t});var Z_,lR=y(()=>{go();bl();Z_=(t,e=[],r={})=>{let n=_l(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 G_e}from"node:string_decoder";var OG,RG,Ut,yo,Z_e,IG,V_e,V_,PG,W_e,Bf,K_e,uR,J_e,rn=y(()=>{({toString:OG}=Object.prototype),RG=t=>OG.call(t)==="[object ArrayBuffer]",Ut=t=>OG.call(t)==="[object Uint8Array]",yo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Z_e=new TextEncoder,IG=t=>Z_e.encode(t),V_e=new TextDecoder,V_=t=>V_e.decode(t),PG=(t,e)=>W_e(t,e).join(""),W_e=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new G_e(e),n=t.map(o=>typeof o=="string"?IG(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Bf=t=>t.length===1&&Ut(t[0])?t[0]:uR(K_e(t)),K_e=t=>t.map(e=>typeof e=="string"?IG(e):e),uR=t=>{let e=new Uint8Array(J_e(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},J_e=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Y_e}from"node:child_process";var jG,MG,X_e,Q_e,CG,ebe,DG,NG,tbe,FG=y(()=>{go();rn();jG=t=>Array.isArray(t)&&Array.isArray(t.raw),MG=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=X_e({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,{}]},X_e=({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}=Q_e(i,t.raw[n]),c=DG(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>NG(d)):[NG(l)];return DG(c,u,a)},Q_e=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=CG.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)],NG=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 tbe(t);throw t instanceof Y_e||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`)},tbe=({stdout:t})=>{if(typeof t=="string")return t;if(Ut(t))return V_(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 dR from"node:process";var Xn,W_,An,K_,_o=y(()=>{Xn=t=>W_.includes(t),W_=[dR.stdin,dR.stdout,dR.stderr],An=["stdin","stdout","stderr"],K_=t=>An[t]??`stdio[${t}]`});import{debuglog as rbe}from"node:util";var zG,fR,nbe,ibe,obe,sbe,LG,abe,pR,cbe,lbe,ube,dbe,mR,bo,vo=y(()=>{go();_o();zG=t=>{let e={...t};for(let r of mR)e[r]=fR(t,r);return e},fR=(t,e)=>{let r=Array.from({length:nbe(t)+1}),n=ibe(t[e],r,e);return lbe(n,e)},nbe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,An.length):An.length,ibe=(t,e,r)=>Ot(t)?obe(t,e,r):e.fill(t),obe=(t,e,r)=>{for(let n of Object.keys(t).sort(sbe))for(let i of abe(n,r,e))e[i]=t[n];return e},sbe=(t,e)=>LG(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,abe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=pR(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]},dR=t=>{if(t==="all")return t;if(An.includes(t))return An.indexOf(t);let e=abe.exec(t);if(e!==null)return Number(e[1])},abe=/^fd(\d+)$/,cbe=(t,e)=>t.map(r=>r===void 0?ube[e]:r),lbe=tbe("execa").enabled?"full":"none",ube={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:lbe,stripFinalNewline:!0},fR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],_o=(t,e)=>e==="ipc"?t.at(-1):t[e]});var gl,yl,LG,pR,dbe,G_,Z_,cs=y(()=>{bo();gl=({verbose:t},e)=>pR(t,e)!=="none",yl=({verbose:t},e)=>!["none","short"].includes(pR(t,e)),LG=({verbose:t},e)=>{let r=pR(t,e);return G_(r)?r:void 0},pR=(t,e)=>e===void 0?dbe(t):_o(t,e),dbe=t=>t.find(e=>G_(e))??Z_.findLast(e=>t.includes(e)),G_=t=>typeof t=="function",Z_=["none","short","full"]});import{platform as fbe}from"node:process";import{stripVTControlCharacters as pbe}from"node:util";var zG,Uf,UG,mbe,hbe,gbe,ybe,_be,bbe,vbe,V_=y(()=>{zG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>bbe(UG(o))).join(" ");return{command:n,escapedCommand:i}},Uf=t=>pbe(t).split(` -`).map(e=>UG(e)).join(` -`),UG=t=>t.replaceAll(gbe,e=>mbe(e)),mbe=t=>{let e=ybe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=_be?`\\u${n.padStart(4,"0")}`:`\\U${n}`},hbe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},gbe=hbe(),ybe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},_be=65535,bbe=t=>vbe.test(t)?t:fbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,vbe=/^[\w./-]+$/});import qG from"node:process";function mR(){let{env:t}=qG,{TERM:e,TERM_PROGRAM:r}=t;return qG.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 BG=y(()=>{});var HG,GG,Sbe,wbe,xbe,$be,kbe,W_,K7e,ZG=y(()=>{BG();HG={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"},GG={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"},Sbe={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"},wbe={...HG,...GG},xbe={...HG,...Sbe},$be=mR(),kbe=$be?wbe:xbe,W_=kbe,K7e=Object.entries(GG)});import Ebe from"node:tty";var Abe,_e,X7e,VG,Q7e,eQe,tQe,rQe,nQe,iQe,oQe,sQe,aQe,cQe,lQe,uQe,dQe,fQe,pQe,K_,mQe,hQe,gQe,yQe,_Qe,bQe,vQe,SQe,wQe,WG,xQe,KG,$Qe,kQe,EQe,AQe,TQe,OQe,RQe,IQe,PQe,CQe,DQe,hR=y(()=>{Abe=Ebe?.WriteStream?.prototype?.hasColors?.()??!1,_e=(t,e)=>{if(!Abe)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}},X7e=_e(0,0),VG=_e(1,22),Q7e=_e(2,22),eQe=_e(3,23),tQe=_e(4,24),rQe=_e(53,55),nQe=_e(7,27),iQe=_e(8,28),oQe=_e(9,29),sQe=_e(30,39),aQe=_e(31,39),cQe=_e(32,39),lQe=_e(33,39),uQe=_e(34,39),dQe=_e(35,39),fQe=_e(36,39),pQe=_e(37,39),K_=_e(90,39),mQe=_e(40,49),hQe=_e(41,49),gQe=_e(42,49),yQe=_e(43,49),_Qe=_e(44,49),bQe=_e(45,49),vQe=_e(46,49),SQe=_e(47,49),wQe=_e(100,49),WG=_e(91,39),xQe=_e(92,39),KG=_e(93,39),$Qe=_e(94,39),kQe=_e(95,39),EQe=_e(96,39),AQe=_e(97,39),TQe=_e(101,49),OQe=_e(102,49),RQe=_e(103,49),IQe=_e(104,49),PQe=_e(105,49),CQe=_e(106,49),DQe=_e(107,49)});var JG=y(()=>{hR();hR()});var QG,Obe,J_,YG,Rbe,XG,Ibe,eZ=y(()=>{ZG();JG();QG=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Obe(r),c=Rbe[t]({failed:o,reject:s,piped:n}),l=Ibe[t]({reject:s});return`${K_(`[${a}]`)} ${K_(`[${i}]`)} ${l(c)} ${l(e)}`},Obe=t=>`${J_(t.getHours(),2)}:${J_(t.getMinutes(),2)}:${J_(t.getSeconds(),2)}.${J_(t.getMilliseconds(),3)}`,J_=(t,e)=>String(t).padStart(e,"0"),YG=({failed:t,reject:e})=>t?e?W_.cross:W_.warning:W_.tick,Rbe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:YG,duration:YG},XG=t=>t,Ibe={command:()=>VG,output:()=>XG,ipc:()=>XG,error:({reject:t})=>t?WG:KG,duration:()=>K_}});var tZ,Pbe,Cbe,rZ=y(()=>{cs();tZ=(t,e,r)=>{let n=LG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Pbe(i,o,n)).filter(i=>i!==void 0).map(i=>Cbe(i)).join("")},Pbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Cbe=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},pR=t=>{if(t==="all")return t;if(An.includes(t))return An.indexOf(t);let e=cbe.exec(t);if(e!==null)return Number(e[1])},cbe=/^fd(\d+)$/,lbe=(t,e)=>t.map(r=>r===void 0?dbe[e]:r),ube=rbe("execa").enabled?"full":"none",dbe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:ube,stripFinalNewline:!0},mR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],bo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var vl,Sl,UG,hR,fbe,J_,Y_,ls=y(()=>{vo();vl=({verbose:t},e)=>hR(t,e)!=="none",Sl=({verbose:t},e)=>!["none","short"].includes(hR(t,e)),UG=({verbose:t},e)=>{let r=hR(t,e);return J_(r)?r:void 0},hR=(t,e)=>e===void 0?fbe(t):bo(t,e),fbe=t=>t.find(e=>J_(e))??Y_.findLast(e=>t.includes(e)),J_=t=>typeof t=="function",Y_=["none","short","full"]});import{platform as pbe}from"node:process";import{stripVTControlCharacters as mbe}from"node:util";var qG,Hf,BG,hbe,gbe,ybe,_be,bbe,vbe,Sbe,X_=y(()=>{qG=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>vbe(BG(o))).join(" ");return{command:n,escapedCommand:i}},Hf=t=>mbe(t).split(` +`).map(e=>BG(e)).join(` +`),BG=t=>t.replaceAll(ybe,e=>hbe(e)),hbe=t=>{let e=_be[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=bbe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},gbe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},ybe=gbe(),_be={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},bbe=65535,vbe=t=>Sbe.test(t)?t:pbe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Sbe=/^[\w./-]+$/});import HG from"node:process";function gR(){let{env:t}=HG,{TERM:e,TERM_PROGRAM:r}=t;return HG.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 GG=y(()=>{});var ZG,VG,wbe,xbe,$be,kbe,Ebe,Q_,eQe,WG=y(()=>{GG();ZG={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"},VG={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"},wbe={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"},xbe={...ZG,...VG},$be={...ZG,...wbe},kbe=gR(),Ebe=kbe?xbe:$be,Q_=Ebe,eQe=Object.entries(VG)});import Abe from"node:tty";var Tbe,be,nQe,KG,iQe,oQe,sQe,aQe,cQe,lQe,uQe,dQe,fQe,pQe,mQe,hQe,gQe,yQe,_Qe,eb,bQe,vQe,SQe,wQe,xQe,$Qe,kQe,EQe,AQe,JG,TQe,YG,OQe,RQe,IQe,PQe,CQe,DQe,NQe,jQe,MQe,FQe,LQe,yR=y(()=>{Tbe=Abe?.WriteStream?.prototype?.hasColors?.()??!1,be=(t,e)=>{if(!Tbe)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}},nQe=be(0,0),KG=be(1,22),iQe=be(2,22),oQe=be(3,23),sQe=be(4,24),aQe=be(53,55),cQe=be(7,27),lQe=be(8,28),uQe=be(9,29),dQe=be(30,39),fQe=be(31,39),pQe=be(32,39),mQe=be(33,39),hQe=be(34,39),gQe=be(35,39),yQe=be(36,39),_Qe=be(37,39),eb=be(90,39),bQe=be(40,49),vQe=be(41,49),SQe=be(42,49),wQe=be(43,49),xQe=be(44,49),$Qe=be(45,49),kQe=be(46,49),EQe=be(47,49),AQe=be(100,49),JG=be(91,39),TQe=be(92,39),YG=be(93,39),OQe=be(94,39),RQe=be(95,39),IQe=be(96,39),PQe=be(97,39),CQe=be(101,49),DQe=be(102,49),NQe=be(103,49),jQe=be(104,49),MQe=be(105,49),FQe=be(106,49),LQe=be(107,49)});var XG=y(()=>{yR();yR()});var tZ,Rbe,tb,QG,Ibe,eZ,Pbe,rZ=y(()=>{WG();XG();tZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Rbe(r),c=Ibe[t]({failed:o,reject:s,piped:n}),l=Pbe[t]({reject:s});return`${eb(`[${a}]`)} ${eb(`[${i}]`)} ${l(c)} ${l(e)}`},Rbe=t=>`${tb(t.getHours(),2)}:${tb(t.getMinutes(),2)}:${tb(t.getSeconds(),2)}.${tb(t.getMilliseconds(),3)}`,tb=(t,e)=>String(t).padStart(e,"0"),QG=({failed:t,reject:e})=>t?e?Q_.cross:Q_.warning:Q_.tick,Ibe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:QG,duration:QG},eZ=t=>t,Pbe={command:()=>KG,output:()=>eZ,ipc:()=>eZ,error:({reject:t})=>t?JG:YG,duration:()=>eb}});var nZ,Cbe,Dbe,iZ=y(()=>{ls();nZ=(t,e,r)=>{let n=UG(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Cbe(i,o,n)).filter(i=>i!==void 0).map(i=>Dbe(i)).join("")},Cbe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Dbe=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as Dbe}from"node:util";var Ti,Nbe,jbe,Mbe,Y_,Fbe,_l=y(()=>{V_();eZ();rZ();Ti=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Nbe({type:t,result:i,verboseInfo:n}),s=jbe(e,o),a=tZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Nbe=({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}),jbe=(t,e)=>t.split(` -`).map(r=>Mbe({...e,message:r})),Mbe=t=>({verboseLine:QG(t),verboseObject:t}),Y_=t=>{let e=typeof t=="string"?t:Dbe(t);return Uf(e).replaceAll(" "," ".repeat(Fbe))},Fbe=2});var nZ,iZ=y(()=>{cs();_l();nZ=(t,e)=>{gl(e)&&Ti({type:"command",verboseMessage:t,verboseInfo:e})}});var oZ,Lbe,zbe,Ube,sZ=y(()=>{cs();oZ=(t,e,r)=>{Ube(t);let n=Lbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Lbe=t=>gl({verbose:t})?zbe++:void 0,zbe=0n,Ube=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(!Z_.includes(e)&&!G_(e)){let r=Z_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as aZ}from"node:process";var X_,gR,Q_=y(()=>{X_=()=>aZ.bigint(),gR=t=>Number(aZ.bigint()-t)/1e6});var eb,yR=y(()=>{iZ();sZ();Q_();V_();bo();eb=(t,e,r)=>{let n=X_(),{command:i,escapedCommand:o}=zG(t,e),s=uR(r,"verbose"),a=oZ(s,o,{...r});return nZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var fZ=v((set,dZ)=>{dZ.exports=uZ;uZ.sync=Bbe;var cZ=Ge("fs");function qbe(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{gZ.exports=mZ;mZ.sync=Hbe;var pZ=Ge("fs");function mZ(t,e,r){pZ.stat(t,function(n,i){r(n,n?!1:hZ(i,e))})}function Hbe(t,e){return hZ(pZ.statSync(t),e)}function hZ(t,e){return t.isFile()&&Gbe(t,e)}function Gbe(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 bZ=v((uet,_Z)=>{var cet=Ge("fs"),tb;process.platform==="win32"||global.TESTING_WINDOWS?tb=fZ():tb=yZ();_Z.exports=_R;_R.sync=Zbe;function _R(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){_R(t,e||{},function(o,s){o?i(o):n(s)})})}tb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Zbe(t,e){try{return tb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var EZ=v((det,kZ)=>{var bl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",vZ=Ge("path"),Vbe=bl?";":":",SZ=bZ(),wZ=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),xZ=(t,e)=>{let r=e.colon||Vbe,n=t.match(/\//)||bl&&t.match(/\\/)?[""]:[...bl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=bl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=bl?i.split(r):[""];return bl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},$Z=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=xZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(wZ(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=vZ.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];SZ(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)},Wbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=xZ(t,e),o=[];for(let s=0;s{"use strict";var AZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};bR.exports=AZ;bR.exports.default=AZ});var PZ=v((pet,IZ)=>{"use strict";var OZ=Ge("path"),Kbe=EZ(),Jbe=TZ();function RZ(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=Kbe.sync(t.command,{path:r[Jbe({env:r})],pathExt:e?OZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=OZ.resolve(i?t.options.cwd:"",s)),s}function Ybe(t){return RZ(t)||RZ(t,!0)}IZ.exports=Ybe});var CZ=v((met,SR)=>{"use strict";var vR=/([()\][%!^"`<>&|;, *?])/g;function Xbe(t){return t=t.replace(vR,"^$1"),t}function Qbe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(vR,"^$1"),e&&(t=t.replace(vR,"^$1")),t}SR.exports.command=Xbe;SR.exports.argument=Qbe});var NZ=v((het,DZ)=>{"use strict";DZ.exports=/^#!(.*)/});var MZ=v((get,jZ)=>{"use strict";var eve=NZ();jZ.exports=(t="")=>{let e=t.match(eve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var LZ=v((yet,FZ)=>{"use strict";var wR=Ge("fs"),tve=MZ();function rve(t){let r=Buffer.alloc(150),n;try{n=wR.openSync(t,"r"),wR.readSync(n,r,0,150,0),wR.closeSync(n)}catch{}return tve(r.toString())}FZ.exports=rve});var BZ=v((_et,qZ)=>{"use strict";var nve=Ge("path"),zZ=PZ(),UZ=CZ(),ive=LZ(),ove=process.platform==="win32",sve=/\.(?:com|exe)$/i,ave=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function cve(t){t.file=zZ(t);let e=t.file&&ive(t.file);return e?(t.args.unshift(t.file),t.command=e,zZ(t)):t.file}function lve(t){if(!ove)return t;let e=cve(t),r=!sve.test(e);if(t.options.forceShell||r){let n=ave.test(e);t.command=nve.normalize(t.command),t.command=UZ.command(t.command),t.args=t.args.map(o=>UZ.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 uve(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:lve(n)}qZ.exports=uve});var ZZ=v((bet,GZ)=>{"use strict";var xR=process.platform==="win32";function $R(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 dve(t,e){if(!xR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=HZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function HZ(t,e){return xR&&t===1&&!e.file?$R(e.original,"spawn"):null}function fve(t,e){return xR&&t===1&&!e.file?$R(e.original,"spawnSync"):null}GZ.exports={hookChildProcess:dve,verifyENOENT:HZ,verifyENOENTSync:fve,notFoundError:$R}});var KZ=v((vet,vl)=>{"use strict";var VZ=Ge("child_process"),kR=BZ(),ER=ZZ();function WZ(t,e,r){let n=kR(t,e,r),i=VZ.spawn(n.command,n.args,n.options);return ER.hookChildProcess(i,n),i}function pve(t,e,r){let n=kR(t,e,r),i=VZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||ER.verifyENOENTSync(i.status,n),i}vl.exports=WZ;vl.exports.spawn=WZ;vl.exports.sync=pve;vl.exports._parse=kR;vl.exports._enoent=ER});function rb(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 JZ=y(()=>{});var YZ=y(()=>{});import{promisify as mve}from"node:util";import{execFile as hve,execFileSync as Eet}from"node:child_process";import XZ from"node:path";import{fileURLToPath as gve}from"node:url";function nb(t){return t instanceof URL?gve(t):t}function QZ(t){return{*[Symbol.iterator](){let e=XZ.resolve(nb(t)),r;for(;r!==e;)yield e,r=e,e=XZ.resolve(e,"..")}}}var Oet,Ret,e9=y(()=>{YZ();Oet=mve(hve);Ret=10*1024*1024});import ib from"node:process";import Aa from"node:path";var yve,_ve,bve,t9,r9=y(()=>{JZ();e9();yve=({cwd:t=ib.cwd(),path:e=ib.env[rb()],preferLocal:r=!0,execPath:n=ib.execPath,addExecPath:i=!0}={})=>{let o=Aa.resolve(nb(t)),s=[],a=e.split(Aa.delimiter);return r&&_ve(s,a,o),i&&bve(s,a,n,o),e===""||e===Aa.delimiter?`${s.join(Aa.delimiter)}${e}`:[...s,e].join(Aa.delimiter)},_ve=(t,e,r)=>{for(let n of QZ(r)){let i=Aa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},bve=(t,e,r,n)=>{let i=Aa.resolve(n,nb(r),"..");e.includes(i)||t.push(i)},t9=({env:t=ib.env,...e}={})=>{t={...t};let r=rb({env:t});return e.path=t[r],t[r]=yve(e),t}});var n9,Xn,i9,o9,s9,ob,qf,Bf,Ta=y(()=>{n9=(t,e,r)=>{let n=r?Bf:qf,i=t instanceof Xn?{}:{cause:t};return new n(e,i)},Xn=class extends Error{},i9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,s9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},o9=t=>ob(t)&&s9 in t,s9=Symbol("isExecaError"),ob=t=>Object.prototype.toString.call(t)==="[object Error]",qf=class extends Error{};i9(qf,qf.name);Bf=class extends Error{};i9(Bf,Bf.name)});var a9,vve,c9,l9,u9=y(()=>{a9=()=>{let t=l9-c9+1;return Array.from({length:t},vve)},vve=(t,e)=>({name:`SIGRT${e+1}`,number:c9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),c9=34,l9=64});var d9,f9=y(()=>{d9=[{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 Sve}from"node:os";var AR,wve,p9=y(()=>{f9();u9();AR=()=>{let t=a9();return[...d9,...t].map(wve)},wve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=Sve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as xve}from"node:os";var $ve,kve,m9,Eve,Ave,Tve,Vet,h9=y(()=>{p9();$ve=()=>{let t=AR();return Object.fromEntries(t.map(kve))},kve=({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}],m9=$ve(),Eve=()=>{let t=AR(),e=65,r=Array.from({length:e},(n,i)=>Ave(i,t));return Object.assign({},...r)},Ave=(t,e)=>{let r=Tve(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}}},Tve=(t,e)=>{let r=e.find(({name:n})=>xve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Vet=Eve()});import{constants as Hf}from"node:os";var y9,_9,b9,Ove,Rve,g9,Ive,TR,Pve,Cve,sb,Gf=y(()=>{h9();y9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return b9(t,e)},_9=t=>t===0?t:b9(t,"`subprocess.kill()`'s argument"),b9=(t,e)=>{if(Number.isInteger(t))return Ove(t,e);if(typeof t=="string")return Ive(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${TR()}`)},Ove=(t,e)=>{if(g9.has(t))return g9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${TR()}`)},Rve=()=>new Map(Object.entries(Hf.signals).reverse().map(([t,e])=>[e,t])),g9=Rve(),Ive=(t,e)=>{if(t in Hf.signals)return t;throw t.toUpperCase()in Hf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${TR()}`)},TR=()=>`Available signal names: ${Pve()}. -Available signal numbers: ${Cve()}.`,Pve=()=>Object.keys(Hf.signals).sort().map(t=>`'${t}'`).join(", "),Cve=()=>[...new Set(Object.values(Hf.signals).sort((t,e)=>t-e))].join(", "),sb=t=>m9[t].description});import{setTimeout as Dve}from"node:timers/promises";var v9,Nve,S9,jve,Mve,Fve,OR,ab=y(()=>{Ta();Gf();v9=t=>{if(t===!1)return t;if(t===!0)return Nve;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},Nve=1e3*5,S9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=jve(s,a,r);Mve(l,n);let u=t(c);return Fve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},jve=(t,e,r)=>{let[n=r,i]=ob(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&&!ob(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:_9(n),error:i}},Mve=(t,e)=>{t!==void 0&&e.reject(t)},Fve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&OR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},OR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Dve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as Lve}from"node:events";var cb,RR=y(()=>{cb=async(t,e)=>{t.aborted||await Lve(t,"abort",{signal:e})}});var w9,x9,zve,IR=y(()=>{RR();w9=({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)}`)},x9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[zve(t,e,n,i)],zve=async(t,e,r,{signal:n})=>{throw await cb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Sl,Uve,PR,$9,k9,lb,E9,A9,T9,O9,R9,I9,qve,Bve,Hve,Qn,Gve,ls,wl,xl=y(()=>{Sl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{Uve(t,e,r),PR(t,e,n)},Uve=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},PR=(t,e,r)=>{if(!r)throw new Error(`${Qn(t,e)} cannot be used: the ${ls(e)} has already exited or disconnected.`)},$9=t=>{throw new Error(`${Qn("getOneMessage",t)} could not complete: the ${ls(t)} exited or disconnected.`)},k9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${ls(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as Nbe}from"node:util";var Ri,jbe,Mbe,Fbe,rb,Lbe,wl=y(()=>{X_();rZ();iZ();Ri=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=jbe({type:t,result:i,verboseInfo:n}),s=Mbe(e,o),a=nZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},jbe=({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}),Mbe=(t,e)=>t.split(` +`).map(r=>Fbe({...e,message:r})),Fbe=t=>({verboseLine:tZ(t),verboseObject:t}),rb=t=>{let e=typeof t=="string"?t:Nbe(t);return Hf(e).replaceAll(" "," ".repeat(Lbe))},Lbe=2});var oZ,sZ=y(()=>{ls();wl();oZ=(t,e)=>{vl(e)&&Ri({type:"command",verboseMessage:t,verboseInfo:e})}});var aZ,zbe,Ube,qbe,cZ=y(()=>{ls();aZ=(t,e,r)=>{qbe(t);let n=zbe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},zbe=t=>vl({verbose:t})?Ube++:void 0,Ube=0n,qbe=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(!Y_.includes(e)&&!J_(e)){let r=Y_.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as lZ}from"node:process";var nb,_R,ib=y(()=>{nb=()=>lZ.bigint(),_R=t=>Number(lZ.bigint()-t)/1e6});var ob,bR=y(()=>{sZ();cZ();ib();X_();vo();ob=(t,e,r)=>{let n=nb(),{command:i,escapedCommand:o}=qG(t,e),s=fR(r,"verbose"),a=aZ(s,o,{...r});return oZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var mZ=v((fet,pZ)=>{pZ.exports=fZ;fZ.sync=Hbe;var uZ=Ge("fs");function Bbe(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{_Z.exports=gZ;gZ.sync=Gbe;var hZ=Ge("fs");function gZ(t,e,r){hZ.stat(t,function(n,i){r(n,n?!1:yZ(i,e))})}function Gbe(t,e){return yZ(hZ.statSync(t),e)}function yZ(t,e){return t.isFile()&&Zbe(t,e)}function Zbe(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 SZ=v((het,vZ)=>{var met=Ge("fs"),sb;process.platform==="win32"||global.TESTING_WINDOWS?sb=mZ():sb=bZ();vZ.exports=vR;vR.sync=Vbe;function vR(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){vR(t,e||{},function(o,s){o?i(o):n(s)})})}sb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Vbe(t,e){try{return sb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var TZ=v((get,AZ)=>{var xl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",wZ=Ge("path"),Wbe=xl?";":":",xZ=SZ(),$Z=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),kZ=(t,e)=>{let r=e.colon||Wbe,n=t.match(/\//)||xl&&t.match(/\\/)?[""]:[...xl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=xl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=xl?i.split(r):[""];return xl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},EZ=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=kZ(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d($Z(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=wZ.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)},Kbe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=kZ(t,e),o=[];for(let s=0;s{"use strict";var OZ=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};SR.exports=OZ;SR.exports.default=OZ});var DZ=v((_et,CZ)=>{"use strict";var IZ=Ge("path"),Jbe=TZ(),Ybe=RZ();function PZ(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=Jbe.sync(t.command,{path:r[Ybe({env:r})],pathExt:e?IZ.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=IZ.resolve(i?t.options.cwd:"",s)),s}function Xbe(t){return PZ(t)||PZ(t,!0)}CZ.exports=Xbe});var NZ=v((bet,xR)=>{"use strict";var wR=/([()\][%!^"`<>&|;, *?])/g;function Qbe(t){return t=t.replace(wR,"^$1"),t}function eve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(wR,"^$1"),e&&(t=t.replace(wR,"^$1")),t}xR.exports.command=Qbe;xR.exports.argument=eve});var MZ=v((vet,jZ)=>{"use strict";jZ.exports=/^#!(.*)/});var LZ=v((wet,FZ)=>{"use strict";var tve=MZ();FZ.exports=(t="")=>{let e=t.match(tve);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var UZ=v((xet,zZ)=>{"use strict";var $R=Ge("fs"),rve=LZ();function nve(t){let r=Buffer.alloc(150),n;try{n=$R.openSync(t,"r"),$R.readSync(n,r,0,150,0),$R.closeSync(n)}catch{}return rve(r.toString())}zZ.exports=nve});var GZ=v(($et,HZ)=>{"use strict";var ive=Ge("path"),qZ=DZ(),BZ=NZ(),ove=UZ(),sve=process.platform==="win32",ave=/\.(?:com|exe)$/i,cve=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function lve(t){t.file=qZ(t);let e=t.file&&ove(t.file);return e?(t.args.unshift(t.file),t.command=e,qZ(t)):t.file}function uve(t){if(!sve)return t;let e=lve(t),r=!ave.test(e);if(t.options.forceShell||r){let n=cve.test(e);t.command=ive.normalize(t.command),t.command=BZ.command(t.command),t.args=t.args.map(o=>BZ.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 dve(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:uve(n)}HZ.exports=dve});var WZ=v((ket,VZ)=>{"use strict";var kR=process.platform==="win32";function ER(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 fve(t,e){if(!kR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=ZZ(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function ZZ(t,e){return kR&&t===1&&!e.file?ER(e.original,"spawn"):null}function pve(t,e){return kR&&t===1&&!e.file?ER(e.original,"spawnSync"):null}VZ.exports={hookChildProcess:fve,verifyENOENT:ZZ,verifyENOENTSync:pve,notFoundError:ER}});var YZ=v((Eet,$l)=>{"use strict";var KZ=Ge("child_process"),AR=GZ(),TR=WZ();function JZ(t,e,r){let n=AR(t,e,r),i=KZ.spawn(n.command,n.args,n.options);return TR.hookChildProcess(i,n),i}function mve(t,e,r){let n=AR(t,e,r),i=KZ.spawnSync(n.command,n.args,n.options);return i.error=i.error||TR.verifyENOENTSync(i.status,n),i}$l.exports=JZ;$l.exports.spawn=JZ;$l.exports.sync=mve;$l.exports._parse=AR;$l.exports._enoent=TR});function ab(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 XZ=y(()=>{});var QZ=y(()=>{});import{promisify as hve}from"node:util";import{execFile as gve,execFileSync as Iet}from"node:child_process";import e9 from"node:path";import{fileURLToPath as yve}from"node:url";function cb(t){return t instanceof URL?yve(t):t}function t9(t){return{*[Symbol.iterator](){let e=e9.resolve(cb(t)),r;for(;r!==e;)yield e,r=e,e=e9.resolve(e,"..")}}}var Det,Net,r9=y(()=>{QZ();Det=hve(gve);Net=10*1024*1024});import lb from"node:process";import Oa from"node:path";var _ve,bve,vve,n9,i9=y(()=>{XZ();r9();_ve=({cwd:t=lb.cwd(),path:e=lb.env[ab()],preferLocal:r=!0,execPath:n=lb.execPath,addExecPath:i=!0}={})=>{let o=Oa.resolve(cb(t)),s=[],a=e.split(Oa.delimiter);return r&&bve(s,a,o),i&&vve(s,a,n,o),e===""||e===Oa.delimiter?`${s.join(Oa.delimiter)}${e}`:[...s,e].join(Oa.delimiter)},bve=(t,e,r)=>{for(let n of t9(r)){let i=Oa.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},vve=(t,e,r,n)=>{let i=Oa.resolve(n,cb(r),"..");e.includes(i)||t.push(i)},n9=({env:t=lb.env,...e}={})=>{t={...t};let r=ab({env:t});return e.path=t[r],t[r]=_ve(e),t}});var o9,Qn,s9,a9,c9,ub,Gf,Zf,Ra=y(()=>{o9=(t,e,r)=>{let n=r?Zf:Gf,i=t instanceof Qn?{}:{cause:t};return new n(e,i)},Qn=class extends Error{},s9=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,c9,{value:!0,writable:!1,enumerable:!1,configurable:!1})},a9=t=>ub(t)&&c9 in t,c9=Symbol("isExecaError"),ub=t=>Object.prototype.toString.call(t)==="[object Error]",Gf=class extends Error{};s9(Gf,Gf.name);Zf=class extends Error{};s9(Zf,Zf.name)});var l9,Sve,u9,d9,f9=y(()=>{l9=()=>{let t=d9-u9+1;return Array.from({length:t},Sve)},Sve=(t,e)=>({name:`SIGRT${e+1}`,number:u9+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),u9=34,d9=64});var p9,m9=y(()=>{p9=[{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 wve}from"node:os";var OR,xve,h9=y(()=>{m9();f9();OR=()=>{let t=l9();return[...p9,...t].map(xve)},xve=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=wve,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as $ve}from"node:os";var kve,Eve,g9,Ave,Tve,Ove,Xet,y9=y(()=>{h9();kve=()=>{let t=OR();return Object.fromEntries(t.map(Eve))},Eve=({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}],g9=kve(),Ave=()=>{let t=OR(),e=65,r=Array.from({length:e},(n,i)=>Tve(i,t));return Object.assign({},...r)},Tve=(t,e)=>{let r=Ove(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}}},Ove=(t,e)=>{let r=e.find(({name:n})=>$ve.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Xet=Ave()});import{constants as Vf}from"node:os";var b9,v9,S9,Rve,Ive,_9,Pve,RR,Cve,Dve,db,Wf=y(()=>{y9();b9=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return S9(t,e)},v9=t=>t===0?t:S9(t,"`subprocess.kill()`'s argument"),S9=(t,e)=>{if(Number.isInteger(t))return Rve(t,e);if(typeof t=="string")return Pve(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${RR()}`)},Rve=(t,e)=>{if(_9.has(t))return _9.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${RR()}`)},Ive=()=>new Map(Object.entries(Vf.signals).reverse().map(([t,e])=>[e,t])),_9=Ive(),Pve=(t,e)=>{if(t in Vf.signals)return t;throw t.toUpperCase()in Vf.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${RR()}`)},RR=()=>`Available signal names: ${Cve()}. +Available signal numbers: ${Dve()}.`,Cve=()=>Object.keys(Vf.signals).sort().map(t=>`'${t}'`).join(", "),Dve=()=>[...new Set(Object.values(Vf.signals).sort((t,e)=>t-e))].join(", "),db=t=>g9[t].description});import{setTimeout as Nve}from"node:timers/promises";var w9,jve,x9,Mve,Fve,Lve,IR,fb=y(()=>{Ra();Wf();w9=t=>{if(t===!1)return t;if(t===!0)return jve;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},jve=1e3*5,x9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=Mve(s,a,r);Fve(l,n);let u=t(c);return Lve({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},Mve=(t,e,r)=>{let[n=r,i]=ub(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&&!ub(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:v9(n),error:i}},Fve=(t,e)=>{t!==void 0&&e.reject(t)},Lve=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&IR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},IR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await Nve(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as zve}from"node:events";var pb,PR=y(()=>{pb=async(t,e)=>{t.aborted||await zve(t,"abort",{signal:e})}});var $9,k9,Uve,CR=y(()=>{PR();$9=({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)}`)},k9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[Uve(t,e,n,i)],Uve=async(t,e,r,{signal:n})=>{throw await pb(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var kl,qve,DR,E9,A9,mb,T9,O9,R9,I9,P9,C9,Bve,Hve,Gve,ei,Zve,us,El,Al=y(()=>{kl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{qve(t,e,r),DR(t,e,n)},qve=(t,e,r)=>{if(!r)throw new Error(`${ei(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},DR=(t,e,r)=>{if(!r)throw new Error(`${ei(t,e)} cannot be used: the ${us(e)} has already exited or disconnected.`)},E9=t=>{throw new Error(`${ei("getOneMessage",t)} could not complete: the ${us(t)} exited or disconnected.`)},A9=t=>{throw new Error(`${ei("sendMessage",t)} failed: the ${us(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([ - ${Qn("getOneMessage",t)}, - ${Qn("sendMessage",t,"message, {strict: true}")}, -]);`)},lb=(t,e)=>new Error(`${Qn("sendMessage",e)} failed when sending an acknowledgment response to the ${ls(e)}.`,{cause:t}),E9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${ls(t)} is not listening to incoming messages.`)},A9=t=>{throw new Error(`${Qn("sendMessage",t)} failed: the ${ls(t)} exited without listening to incoming messages.`)},T9=()=>new Error(`\`cancelSignal\` aborted: the ${ls(!0)} disconnected.`),O9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},R9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${Qn(e,r)} cannot be used: the ${ls(r)} is disconnecting.`,{cause:t})},I9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(qve(t))throw new Error(`${Qn(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},qve=({code:t,message:e})=>Bve.has(t)||Hve.some(r=>e.includes(r)),Bve=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Hve=["could not be cloned","circular structure","call stack size exceeded"],Qn=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Gve(e)}${t}(${r})`,Gve=t=>t?"":"subprocess.",ls=t=>t?"parent process":"subprocess",wl=t=>{t.connected&&t.disconnect()}});var Oi,$l=y(()=>{Oi=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var db,kl,Ri,P9,Zve,Vve,C9,Wve,D9,Zf,ub,us=y(()=>{bo();db=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=P9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(C9(o,e,n,!0));return s},kl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ri.get(t),o=P9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(C9(o,e,n,!1));return s},Ri=new WeakMap,P9=(t,e,r)=>{let n=Zve(e,r);return Vve(n,e,r,t),n},Zve=(t,e)=>{let r=dR(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(`"${Zf(e)}" must not be "${t}". + ${ei("getOneMessage",t)}, + ${ei("sendMessage",t,"message, {strict: true}")}, +]);`)},mb=(t,e)=>new Error(`${ei("sendMessage",e)} failed when sending an acknowledgment response to the ${us(e)}.`,{cause:t}),T9=t=>{throw new Error(`${ei("sendMessage",t)} failed: the ${us(t)} is not listening to incoming messages.`)},O9=t=>{throw new Error(`${ei("sendMessage",t)} failed: the ${us(t)} exited without listening to incoming messages.`)},R9=()=>new Error(`\`cancelSignal\` aborted: the ${us(!0)} disconnected.`),I9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},P9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ei(e,r)} cannot be used: the ${us(r)} is disconnecting.`,{cause:t})},C9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Bve(t))throw new Error(`${ei(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Bve=({code:t,message:e})=>Hve.has(t)||Gve.some(r=>e.includes(r)),Hve=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Gve=["could not be cloned","circular structure","call stack size exceeded"],ei=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Zve(e)}${t}(${r})`,Zve=t=>t?"":"subprocess.",us=t=>t?"parent process":"subprocess",El=t=>{t.connected&&t.disconnect()}});var Ii,Tl=y(()=>{Ii=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var gb,Ol,Pi,D9,Vve,Wve,N9,Kve,j9,Kf,hb,ds=y(()=>{vo();gb=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Pi.get(t),o=D9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(N9(o,e,n,!0));return s},Ol=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Pi.get(t),o=D9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(N9(o,e,n,!1));return s},Pi=new WeakMap,D9=(t,e,r)=>{let n=Vve(e,r);return Wve(n,e,r,t),n},Vve=(t,e)=>{let r=pR(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(`"${Kf(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},Vve=(t,e,r,n)=>{let i=n[D9(t)];if(i===void 0)throw new TypeError(`"${Zf(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(`"${Zf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Zf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},C9=(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}=Wve(t,r);return`The "${i}: ${ub(o)}" option is incompatible with using "${Zf(n)}: ${ub(e)}". -Please set this option with "pipe" instead.`},Wve=(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,Zf=t=>t?"to":"from",ub=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Kve}from"node:events";var Oa,fb=y(()=>{Oa=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Kve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var pb,CR,mb,DR,N9,j9,Vf=y(()=>{pb=(t,e)=>{e&&CR(t)},CR=t=>{t.refCounted()},mb=(t,e)=>{e&&DR(t)},DR=t=>{t.unrefCounted()},N9=(t,e)=>{e&&(DR(t),DR(t))},j9=(t,e)=>{e&&(CR(t),CR(t))}});import{once as Jve}from"node:events";import{scheduler as Yve}from"node:timers/promises";var M9,F9,hb,L9=y(()=>{yb();Vf();gb();_b();M9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(U9(i)||B9(i))return;hb.has(t)||hb.set(t,[]);let o=hb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await q9(t,n,i),await Yve.yield();let s=await z9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},F9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{NR();let o=hb.get(t);for(;o?.length>0;)await Jve(n,"message:done");t.removeListener("message",i),j9(e,r),n.connected=!1,n.emit("disconnect")},hb=new WeakMap});import{EventEmitter as Xve}from"node:events";var ds,bb,Qve,vb,Wf=y(()=>{L9();Vf();ds=(t,e,r)=>{if(bb.has(t))return bb.get(t);let n=new Xve;return n.connected=!0,bb.set(t,n),Qve({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},bb=new WeakMap,Qve=({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",F9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),N9(r,n)},vb=t=>{let e=bb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as eSe}from"node:events";var H9,tSe,G9,z9,U9,Z9,Sb,rSe,wb,V9,gb=y(()=>{$l();fb();kb();xl();Wf();yb();H9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=ds(t,e,r),s=xb(t,o);return{id:tSe++,type:wb,message:n,hasListeners:s}},tSe=0n,G9=(t,e)=>{if(!(e?.type!==wb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Sb[r].resolve({isDeadlock:!0,hasListeners:!1})},z9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==wb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:V9,message:xb(e,i)};try{await $b({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},U9=t=>{if(t?.type!==V9)return!1;let{id:e,message:r}=t;return Sb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},Z9=async(t,e,r)=>{if(t?.type!==wb)return;let n=Oi();Sb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,rSe(e,r,i)]);o&&k9(r),s||E9(r)}finally{i.abort(),delete Sb[t.id]}},Sb={},rSe=async(t,e,{signal:r})=>{Oa(t,1,r),await eSe(t,"disconnect",{signal:r}),A9(e)},wb="execa:ipc:request",V9="execa:ipc:response"});var W9,K9,q9,Kf,xb,nSe,yb=y(()=>{$l();bo();us();gb();W9=(t,e,r)=>{Kf.has(t)||Kf.set(t,new Set);let n=Kf.get(t),i=Oi(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},K9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},q9=async(t,e,r)=>{for(;!xb(t,e)&&Kf.get(t)?.size>0;){let n=[...Kf.get(t)];G9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Kf=new WeakMap,xb=(t,e)=>e.listenerCount("message")>nSe(t),nSe=t=>Ri.has(t)&&!_o(Ri.get(t).options.buffer,"ipc")?1:0});import{promisify as iSe}from"node:util";var $b,oSe,MR,sSe,jR,kb=y(()=>{xl();yb();gb();$b=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Sl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),oSe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},oSe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=H9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=W9(t,s,o);try{await MR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw wl(t),c}finally{K9(a)}},MR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=sSe(t);try{await Promise.all([Z9(n,t,r),o(n)])}catch(s){throw R9({error:s,methodName:e,isSubprocess:r}),I9({error:s,methodName:e,isSubprocess:r,message:i}),s}},sSe=t=>{if(jR.has(t))return jR.get(t);let e=iSe(t.send.bind(t));return jR.set(t,e),e},jR=new WeakMap});import{scheduler as aSe}from"node:timers/promises";var Y9,X9,cSe,J9,B9,Q9,NR,FR,_b=y(()=>{kb();Wf();xl();Y9=(t,e)=>{let r="cancelSignal";return PR(r,!1,t.connected),MR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:Q9,message:e},message:e})},X9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await cSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),FR.signal),cSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!J9){if(J9=!0,!n){O9();return}if(e===null){NR();return}ds(t,e,r),await aSe.yield()}},J9=!1,B9=t=>t?.type!==Q9?!1:(FR.abort(t.message),!0),Q9="execa:ipc:cancel",NR=()=>{FR.abort(T9())},FR=new AbortController});var eV,tV,lSe,uSe,LR=y(()=>{RR();_b();ab();eV=({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.")}},tV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[lSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],lSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await cb(e,i);let o=uSe(e);throw await Y9(t,o),OR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},uSe=({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 dSe}from"node:timers/promises";var rV,nV,fSe,zR=y(()=>{Ta();rV=({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})`)},nV=(t,e,r,n)=>e===0||e===void 0?[]:[fSe(t,e,r,n)],fSe=async(t,e,r,{signal:n})=>{throw await dSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Xn}});import{execPath as pSe,execArgv as mSe}from"node:process";import iV from"node:path";var oV,sV,UR=y(()=>{hl();oV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},sV=(t,e,{node:r=!1,nodePath:n=pSe,nodeOptions:i=mSe.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=ml(n,'The "nodePath" option'),l=iV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(iV.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 hSe}from"node:v8";var aV,gSe,ySe,_Se,cV,qR=y(()=>{aV=({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`.");_Se[r](t)}},gSe=t=>{try{hSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},ySe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},_Se={advanced:gSe,json:ySe},cV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var uV,bSe,nn,BR,vSe,lV,Eb,Ra=y(()=>{uV=({encoding:t})=>{if(BR.has(t))return;let e=vSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Eb(t)}\`. -Please rename it to ${Eb(e)}.`);let r=[...BR].map(n=>Eb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Eb(t)}\`. -Please rename it to one of: ${r}.`)},bSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),BR=new Set([...bSe,...nn]),vSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in lV)return lV[e];if(BR.has(e))return e},lV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Eb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as SSe}from"node:fs";import wSe from"node:path";import xSe from"node:process";var dV,fV,pV,HR=y(()=>{hl();dV=(t=fV())=>{let e=ml(t,'The "cwd" option');return wSe.resolve(e)},fV=()=>{try{return xSe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},pV=(t,e)=>{if(e===fV())return t;let r;try{r=SSe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},Wve=(t,e,r,n)=>{let i=n[j9(t)];if(i===void 0)throw new TypeError(`"${Kf(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(`"${Kf(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${Kf(r)}" must not be ${e}. It must be a writable stream, not readable.`)},N9=(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}=Kve(t,r);return`The "${i}: ${hb(o)}" option is incompatible with using "${Kf(n)}: ${hb(e)}". +Please set this option with "pipe" instead.`},Kve=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=j9(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]}},j9=t=>t==="all"?1:t,Kf=t=>t?"to":"from",hb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as Jve}from"node:events";var Ia,yb=y(()=>{Ia=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),Jve(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var _b,NR,bb,jR,M9,F9,Jf=y(()=>{_b=(t,e)=>{e&&NR(t)},NR=t=>{t.refCounted()},bb=(t,e)=>{e&&jR(t)},jR=t=>{t.unrefCounted()},M9=(t,e)=>{e&&(jR(t),jR(t))},F9=(t,e)=>{e&&(NR(t),NR(t))}});import{once as Yve}from"node:events";import{scheduler as Xve}from"node:timers/promises";var L9,z9,vb,U9=y(()=>{wb();Jf();Sb();xb();L9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(B9(i)||G9(i))return;vb.has(t)||vb.set(t,[]);let o=vb.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await H9(t,n,i),await Xve.yield();let s=await q9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},z9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{MR();let o=vb.get(t);for(;o?.length>0;)await Yve(n,"message:done");t.removeListener("message",i),F9(e,r),n.connected=!1,n.emit("disconnect")},vb=new WeakMap});import{EventEmitter as Qve}from"node:events";var fs,$b,eSe,kb,Yf=y(()=>{U9();Jf();fs=(t,e,r)=>{if($b.has(t))return $b.get(t);let n=new Qve;return n.connected=!0,$b.set(t,n),eSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},$b=new WeakMap,eSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=L9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",z9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),M9(r,n)},kb=t=>{let e=$b.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as tSe}from"node:events";var Z9,rSe,V9,q9,B9,W9,Eb,nSe,Ab,K9,Sb=y(()=>{Tl();yb();Rb();Al();Yf();wb();Z9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=fs(t,e,r),s=Tb(t,o);return{id:rSe++,type:Ab,message:n,hasListeners:s}},rSe=0n,V9=(t,e)=>{if(!(e?.type!==Ab||e.hasListeners))for(let{id:r}of t)r!==void 0&&Eb[r].resolve({isDeadlock:!0,hasListeners:!1})},q9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Ab||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:K9,message:Tb(e,i)};try{await Ob({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},B9=t=>{if(t?.type!==K9)return!1;let{id:e,message:r}=t;return Eb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},W9=async(t,e,r)=>{if(t?.type!==Ab)return;let n=Ii();Eb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,nSe(e,r,i)]);o&&A9(r),s||T9(r)}finally{i.abort(),delete Eb[t.id]}},Eb={},nSe=async(t,e,{signal:r})=>{Ia(t,1,r),await tSe(t,"disconnect",{signal:r}),O9(e)},Ab="execa:ipc:request",K9="execa:ipc:response"});var J9,Y9,H9,Xf,Tb,iSe,wb=y(()=>{Tl();vo();ds();Sb();J9=(t,e,r)=>{Xf.has(t)||Xf.set(t,new Set);let n=Xf.get(t),i=Ii(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},Y9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},H9=async(t,e,r)=>{for(;!Tb(t,e)&&Xf.get(t)?.size>0;){let n=[...Xf.get(t)];V9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},Xf=new WeakMap,Tb=(t,e)=>e.listenerCount("message")>iSe(t),iSe=t=>Pi.has(t)&&!bo(Pi.get(t).options.buffer,"ipc")?1:0});import{promisify as oSe}from"node:util";var Ob,sSe,LR,aSe,FR,Rb=y(()=>{Al();wb();Sb();Ob=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return kl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),sSe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},sSe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=Z9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=J9(t,s,o);try{await LR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw El(t),c}finally{Y9(a)}},LR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=aSe(t);try{await Promise.all([W9(n,t,r),o(n)])}catch(s){throw P9({error:s,methodName:e,isSubprocess:r}),C9({error:s,methodName:e,isSubprocess:r,message:i}),s}},aSe=t=>{if(FR.has(t))return FR.get(t);let e=oSe(t.send.bind(t));return FR.set(t,e),e},FR=new WeakMap});import{scheduler as cSe}from"node:timers/promises";var Q9,eV,lSe,X9,G9,tV,MR,zR,xb=y(()=>{Rb();Yf();Al();Q9=(t,e)=>{let r="cancelSignal";return DR(r,!1,t.connected),LR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:tV,message:e},message:e})},eV=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await lSe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),zR.signal),lSe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!X9){if(X9=!0,!n){I9();return}if(e===null){MR();return}fs(t,e,r),await cSe.yield()}},X9=!1,G9=t=>t?.type!==tV?!1:(zR.abort(t.message),!0),tV="execa:ipc:cancel",MR=()=>{zR.abort(R9())},zR=new AbortController});var rV,nV,uSe,dSe,UR=y(()=>{PR();xb();fb();rV=({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.")}},nV=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[uSe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],uSe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await pb(e,i);let o=dSe(e);throw await Q9(t,o),IR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},dSe=({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 fSe}from"node:timers/promises";var iV,oV,pSe,qR=y(()=>{Ra();iV=({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})`)},oV=(t,e,r,n)=>e===0||e===void 0?[]:[pSe(t,e,r,n)],pSe=async(t,e,r,{signal:n})=>{throw await fSe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new Qn}});import{execPath as mSe,execArgv as hSe}from"node:process";import sV from"node:path";var aV,cV,BR=y(()=>{bl();aV=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},cV=(t,e,{node:r=!1,nodePath:n=mSe,nodeOptions:i=hSe.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=_l(n,'The "nodePath" option'),l=sV.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(sV.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 gSe}from"node:v8";var lV,ySe,_Se,bSe,uV,HR=y(()=>{lV=({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`.");bSe[r](t)}},ySe=t=>{try{gSe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},_Se=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},bSe={advanced:ySe,json:_Se},uV=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var fV,vSe,nn,GR,SSe,dV,Ib,Pa=y(()=>{fV=({encoding:t})=>{if(GR.has(t))return;let e=SSe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${Ib(t)}\`. +Please rename it to ${Ib(e)}.`);let r=[...GR].map(n=>Ib(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${Ib(t)}\`. +Please rename it to one of: ${r}.`)},vSe=new Set(["utf8","utf16le"]),nn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),GR=new Set([...vSe,...nn]),SSe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in dV)return dV[e];if(GR.has(e))return e},dV={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},Ib=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as wSe}from"node:fs";import xSe from"node:path";import $Se from"node:process";var pV,mV,hV,ZR=y(()=>{bl();pV=(t=mV())=>{let e=_l(t,'The "cwd" option');return xSe.resolve(e)},mV=()=>{try{return $Se.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},hV=(t,e)=>{if(e===mV())return t;let r;try{r=wSe(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 $Se from"node:path";import mV from"node:process";var hV,Ab,kSe,ESe,GR=y(()=>{hV=St(KZ(),1);r9();ab();Gf();IR();LR();zR();UR();qR();Ra();HR();hl();bo();Ab=(t,e,r)=>{r.cwd=dV(r.cwd);let[n,i,o]=sV(t,e,r),{command:s,args:a,options:c}=hV.default._parse(n,i,o),l=FG(c),u=kSe(l);return rV(u),uV(u),aV(u),w9(u),eV(u),u.shell=sR(u.shell),u.env=ESe(u),u.killSignal=y9(u.killSignal),u.forceKillAfterDelay=v9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),mV.platform==="win32"&&$Se.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},kSe=({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}),ESe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...mV.env,...t}:t;return r||n?t9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Tb,ZR=y(()=>{Tb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function El(t){if(typeof t=="string")return ASe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return TSe(t)}var ASe,TSe,gV,OSe,yV,RSe,VR=y(()=>{ASe=t=>t.at(-1)===gV?t.slice(0,t.at(-2)===yV?-2:-1):t,TSe=t=>t.at(-1)===OSe?t.subarray(0,t.at(-2)===RSe?-2:-1):t,gV=` -`,OSe=gV.codePointAt(0),yV="\r",RSe=yV.codePointAt(0)});function ei(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 WR(t,{checkOpen:e=!0}={}){return ei(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 Ia(t,{checkOpen:e=!0}={}){return ei(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 KR(t,e){return WR(t,e)&&Ia(t,e)}var Pa=y(()=>{});function _V(){return this[YR].next()}function bV(t){return this[YR].return(t)}function XR({preventCancel:t=!1}={}){let e=this.getReader(),r=new JR(e,t),n=Object.create(PSe);return n[YR]=r,n}var ISe,JR,YR,PSe,vV=y(()=>{ISe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),JR=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}}},YR=Symbol();Object.defineProperty(_V,"name",{value:"next"});Object.defineProperty(bV,"name",{value:"return"});PSe=Object.create(ISe,{next:{enumerable:!0,configurable:!0,writable:!0,value:_V},return:{enumerable:!0,configurable:!0,writable:!0,value:bV}})});var SV=y(()=>{});var wV=y(()=>{vV();SV()});var xV,CSe,DSe,NSe,Jf,QR=y(()=>{Pa();wV();xV=t=>{if(Ia(t,{checkOpen:!1})&&Jf.on!==void 0)return DSe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(CSe.call(t)==="[object ReadableStream]")return XR.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:CSe}=Object.prototype,DSe=async function*(t){let e=new AbortController,r={};NSe(t,e,r);try{for await(let[n]of Jf.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()}},NSe=async(t,e,r)=>{try{await Jf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Jf={}});var Al,jSe,EV,$V,MSe,kV,Ii,Yf=y(()=>{QR();Al=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=xV(t),u=e();u.length=0;try{for await(let d of l){let f=MSe(d),p=r[f](d,u);EV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return jSe({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}},jSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&EV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},EV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){$V(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&$V(c,e,i,o),new Ii},$V=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},MSe=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=kV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&kV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:kV}=Object.prototype,Ii=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var vo,Xf,Ob,Rb,Ib,Pb=y(()=>{vo=t=>t,Xf=()=>{},Ob=({contents:t})=>t,Rb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Ib=t=>t.length});async function Cb(t,e){return Al(t,USe,e)}var FSe,LSe,zSe,USe,AV=y(()=>{Yf();Pb();FSe=()=>({contents:[]}),LSe=()=>1,zSe=(t,{contents:e})=>(e.push(t),e),USe={init:FSe,convertChunk:{string:vo,buffer:vo,arrayBuffer:vo,dataView:vo,typedArray:vo,others:vo},getSize:LSe,truncateChunk:Xf,addChunk:zSe,getFinalChunk:Xf,finalize:Ob}});async function Db(t,e){return Al(t,JSe,e)}var qSe,BSe,HSe,TV,OV,GSe,ZSe,VSe,WSe,IV,RV,KSe,PV,JSe,CV=y(()=>{Yf();Pb();qSe=()=>({contents:new ArrayBuffer(0)}),BSe=t=>HSe.encode(t),HSe=new TextEncoder,TV=t=>new Uint8Array(t),OV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),GSe=(t,e)=>t.slice(0,e),ZSe=(t,{contents:e,length:r},n)=>{let i=PV()?WSe(e,n):VSe(e,n);return new Uint8Array(i).set(t,r),i},VSe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(IV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},WSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:IV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},IV=t=>RV**Math.ceil(Math.log(t)/Math.log(RV)),RV=2,KSe=({contents:t,length:e})=>PV()?t:t.slice(0,e),PV=()=>"resize"in ArrayBuffer.prototype,JSe={init:qSe,convertChunk:{string:BSe,buffer:TV,arrayBuffer:TV,dataView:OV,typedArray:OV,others:Rb},getSize:Ib,truncateChunk:GSe,addChunk:ZSe,getFinalChunk:Xf,finalize:KSe}});async function jb(t,e){return Al(t,twe,e)}var YSe,Nb,XSe,QSe,ewe,twe,DV=y(()=>{Yf();Pb();YSe=()=>({contents:"",textDecoder:new TextDecoder}),Nb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),XSe=(t,{contents:e})=>e+t,QSe=(t,e)=>t.slice(0,e),ewe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},twe={init:YSe,convertChunk:{string:vo,buffer:Nb,arrayBuffer:Nb,dataView:Nb,typedArray:Nb,others:Rb},getSize:Ib,truncateChunk:QSe,addChunk:XSe,getFinalChunk:ewe,finalize:Ob}});var NV=y(()=>{AV();CV();DV();Yf()});import{on as rwe}from"node:events";import{finished as nwe}from"node:stream/promises";var Mb=y(()=>{QR();NV();Object.assign(Jf,{on:rwe,finished:nwe})});var jV,iwe,MV,FV,owe,LV,zV,Fb,Ca=y(()=>{Mb();yo();bo();jV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ii))throw t;if(o==="all")return t;let s=iwe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},iwe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",MV=(t,e,r)=>{if(e.length!==r)return;let n=new Ii;throw n.maxBufferInfo={fdNumber:"ipc"},n},FV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=owe(t,e);return`Command's ${r} was larger than ${n} ${i}`},owe=(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=_o(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:H_(r),threshold:i,unit:n}},LV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Fb(r)),zV=(t,e,r)=>{if(!e)return t;let n=Fb(r);return t.length>n?t.slice(0,n):t},Fb=([,t])=>t});import{inspect as swe}from"node:util";var qV,awe,cwe,lwe,uwe,dwe,UV,BV=y(()=>{VR();rn();HR();V_();Ca();Gf();Ta();qV=({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=awe({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=lwe(n,b),w=x===void 0?"":` -${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>uwe(D)).join(` -`)].map(D=>Uf(El(dwe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:O,message:A}},awe=({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=cwe(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?`${FV(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"},cwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",lwe=(t,e)=>{if(t instanceof Xn)return;let r=o9(t)?t.originalMessage:String(t?.message??t),n=Uf(pV(r,e));return n===""?void 0:n},uwe=t=>typeof t=="string"?t:swe(t),dwe=t=>Array.isArray(t)?t.map(e=>El(UV(e))).filter(Boolean).join(` -`):UV(t),UV=t=>typeof t=="string"?t:Ut(t)?q_(t):""});var Lb,Tl,Qf,fwe,HV,pwe,ep=y(()=>{Gf();Q_();Ta();BV();Lb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>HV({command:t,escapedCommand:e,cwd:o,durationMs:gR(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:[]}),Tl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>Qf({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}),Qf=({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:O,signalDescription:T}=pwe(l,u),{originalMessage:A,shortMessage:D,message:$}=qV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),ie=n9(t,$,x);return Object.assign(ie,fwe({error:ie,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),ie},fwe=({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})=>HV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:gR(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:[]}),HV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),pwe=(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 mwe(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(GV(t*1e3)%1e3),nanoseconds:Math.trunc(GV(t*1e6)%1e3)}}function hwe(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 eI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return mwe(t);break}case"bigint":return hwe(t)}throw new TypeError("Expected a finite number or bigint")}var GV,ZV=y(()=>{GV=t=>Number.isFinite(t)?t:0});function tI(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+_we);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&gwe(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?" "+ywe(d,u):f;i.push(p)}},a=eI(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%bwe):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 gwe,ywe,_we,bwe,VV=y(()=>{ZV();gwe=t=>t===0||t===0n,ywe=(t,e)=>e===1||e===1n?t:`${t}s`,_we=1e-7,bwe=24n*60n*60n*1000n});var WV,KV=y(()=>{_l();WV=(t,e)=>{t.failed&&Ti({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var JV,vwe,YV=y(()=>{VV();cs();_l();KV();JV=(t,e)=>{gl(e)&&(WV(t,e),vwe(t,e))},vwe=(t,e)=>{let r=`(done in ${tI(t.durationMs)})`;Ti({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ol,zb=y(()=>{YV();Ol=(t,e,{reject:r})=>{if(JV(t,e),t.failed&&r)throw t;return t}});var eW,Swe,wwe,tW,rW,XV,xwe,rI,QV,Da,nW,$we,Ub,iW,kwe,Ewe,nI,oW,Awe,sW,qb,Twe,iI,Owe,Rwe,aW,Tn,Bb,oI,cW,lW,fs,vr=y(()=>{Pa();ho();rn();eW=(t,e)=>Da(t)?"asyncGenerator":nW(t)?"generator":Ub(t)?"fileUrl":kwe(t)?"filePath":Twe(t)?"webStream":ei(t,{checkOpen:!1})?"native":Ut(t)?"uint8Array":Owe(t)?"asyncIterable":Rwe(t)?"iterable":iI(t)?tW({transform:t},e):$we(t)?Swe(t,e):"native",Swe=(t,e)=>KR(t.transform,{checkOpen:!1})?wwe(t,e):iI(t.transform)?tW(t,e):xwe(t,e),wwe=(t,e)=>(rW(t,e,"Duplex stream"),"duplex"),tW=(t,e)=>(rW(t,e,"web TransformStream"),"webTransform"),rW=({final:t,binary:e,objectMode:r},n,i)=>{XV(t,`${n}.final`,i),XV(e,`${n}.binary`,i),rI(r,`${n}.objectMode`)},XV=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},xwe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!QV(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(KR(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(iI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!QV(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return rI(r,`${i}.binary`),rI(n,`${i}.objectMode`),Da(t)||Da(e)?"asyncGenerator":"generator"},rI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},QV=t=>Da(t)||nW(t),Da=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",nW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",$we=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Ub=t=>Object.prototype.toString.call(t)==="[object URL]",iW=t=>Ub(t)&&t.protocol!=="file:",kwe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Ewe.has(e))&&nI(t.file),Ewe=new Set(["file","append"]),nI=t=>typeof t=="string",oW=(t,e)=>t==="native"&&typeof e=="string"&&!Awe.has(e),Awe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),sW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",qb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Twe=t=>sW(t)||qb(t),iI=t=>sW(t?.readable)&&qb(t?.writable),Owe=t=>aW(t)&&typeof t[Symbol.asyncIterator]=="function",Rwe=t=>aW(t)&&typeof t[Symbol.iterator]=="function",aW=t=>typeof t=="object"&&t!==null,Tn=new Set(["generator","asyncGenerator","duplex","webTransform"]),Bb=new Set(["fileUrl","filePath","fileNumber"]),oI=new Set(["fileUrl","filePath"]),cW=new Set([...oI,"webStream","nodeStream"]),lW=new Set(["webTransform","duplex"]),fs={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,Iwe,Pwe,uW,aI=y(()=>{vr();sI=(t,e,r,n)=>n==="output"?Iwe(t,e,r):Pwe(t,e,r),Iwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Pwe=(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})=>Tn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var dW,Cwe,Dwe,Nwe,jwe,Mwe,Fwe,fW=y(()=>{ho();Ra();vr();aI();dW=(t,e,r,n)=>[...t.filter(({type:i})=>!Tn.has(i)),...Cwe(t,e,r,n)],Cwe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Tn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Dwe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Fwe(o,r)},Dwe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Nwe({stdioItem:t,optionName:i}):e==="webTransform"?jwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Mwe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Nwe=({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}}},jwe=({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}}},Mwe=({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||nn.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}}},Fwe=(t,e)=>e==="input"?t.reverse():t});import cI from"node:process";var pW,Lwe,zwe,Rl,lI,mW,Uwe,qwe,hW=y(()=>{Pa();vr();pW=(t,e,r)=>{let n=t.map(i=>Lwe(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)??qwe},Lwe=({type:t,value:e},r)=>zwe[r]??mW[t](e),zwe=["input","output","output"],Rl=()=>{},lI=()=>"input",mW={generator:Rl,asyncGenerator:Rl,fileUrl:Rl,filePath:Rl,iterable:lI,asyncIterable:lI,uint8Array:lI,webStream:t=>qb(t)?"output":"input",nodeStream(t){return Ia(t,{checkOpen:!1})?WR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Rl,duplex:Rl,native(t){let e=Uwe(t);if(e!==void 0)return e;if(ei(t,{checkOpen:!1}))return mW.nodeStream(t)}},Uwe=t=>{if([0,cI.stdin].includes(t))return"input";if([1,2,cI.stdout,cI.stderr].includes(t))return"output"},qwe="output"});var gW,yW=y(()=>{gW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var _W,Bwe,Hwe,bW,Gwe,Zwe,vW=y(()=>{yo();yW();cs();_W=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Bwe(t,n).map((a,c)=>bW(a,c));return o?Gwe(s,r,i):gW(s,e)},Bwe=(t,e)=>{if(t===void 0)return An.map(n=>e[n]);if(Hwe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${An.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,An.length);return Array.from({length:r},(n,i)=>t[i])},Hwe=t=>An.some(e=>t[e]!==void 0),bW=(t,e)=>Array.isArray(t)?t.map(r=>bW(r,e)):t??(e>=An.length?"ignore":"pipe"),Gwe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!yl(r,i)&&Zwe(n)?"ignore":n),Zwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Vwe}from"node:fs";import Wwe from"node:tty";var wW,Kwe,Jwe,Ywe,Xwe,SW,xW=y(()=>{Pa();yo();rn();us();wW=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Kwe({stdioItem:t,fdNumber:n,direction:i}):Xwe({stdioItem:t,fdNumber:n}),Kwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Jwe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ei(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Jwe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Ywe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Wwe.isatty(i))throw new TypeError(`The \`${e}: ${ub(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:go(Vwe(i)),optionName:e}}},Ywe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=B_.indexOf(t);if(r!==-1)return r},Xwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:SW(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:SW(e,e,r),optionName:r}:ei(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,SW=(t,e,r)=>{let n=B_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var $W,Qwe,exe,txe,rxe,kW=y(()=>{Pa();rn();vr();$W=({input:t,inputFile:e},r)=>r===0?[...Qwe(t),...txe(e)]:[],Qwe=t=>t===void 0?[]:[{type:exe(t),value:t,optionName:"input"}],exe=t=>{if(Ia(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ut(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},txe=t=>t===void 0?[]:[{...rxe(t),optionName:"inputFile"}],rxe=t=>{if(Ub(t))return{type:"fileUrl",value:t};if(nI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var EW,AW,nxe,ixe,TW,oxe,sxe,OW,RW=y(()=>{vr();EW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),AW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=nxe(i,t);if(s.length!==0){if(o){ixe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(cW.has(t))return TW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});lW.has(t)&&sxe({otherStdioItems:s,type:t,value:e,optionName:r})}},nxe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),ixe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{oI.has(e)&&TW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},TW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>oxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return OW(s,n,e),i==="output"?o[0].stream:void 0},oxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,sxe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);OW(i,n,e)},OW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${fs[r]} that is the same.`)}});var Hb,axe,cxe,lxe,uxe,dxe,fxe,pxe,mxe,hxe,gxe,yxe,uI,_xe,Gb=y(()=>{yo();fW();aI();vr();hW();vW();xW();kW();RW();Hb=(t,e,r,n)=>{let o=_W(e,r,n).map((a,c)=>axe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=hxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>_xe(a)),s},axe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=H_(e),{stdioItems:o,isStdioArray:s}=cxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=pW(o,e,i),c=o.map(d=>wW({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=dW(c,i,a,r),u=uW(l,a);return mxe(l,u),{direction:a,objectMode:u,stdioItems:l}},cxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>lxe(c,n)),...$W(r,e)],s=EW(o),a=s.length>1;return uxe(s,a,n),fxe(s),{stdioItems:s,isStdioArray:a}},lxe=(t,e)=>({type:eW(t,e),value:t,optionName:e}),uxe=(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(dxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},dxe=new Set(["ignore","ipc"]),fxe=t=>{for(let e of t)pxe(e)},pxe=({type:t,value:e,optionName:r})=>{if(iW(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(oW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},mxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Bb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},hxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(gxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw uI(i),o}},gxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>yxe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},yxe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=AW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},uI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Yn(r)&&r.destroy()},_xe=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 IW}from"node:fs";var CW,Pi,bxe,DW,PW,vxe,NW=y(()=>{rn();Gb();vr();CW=(t,e)=>Hb(vxe,t,e,!0),Pi=({type:t,optionName:e})=>{DW(e,fs[t])},bxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&DW(t,`"${e}"`),{}),DW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},PW={generator(){},asyncGenerator:Pi,webStream:Pi,nodeStream:Pi,webTransform:Pi,duplex:Pi,asyncIterable:Pi,native:bxe},vxe={input:{...PW,fileUrl:({value:t})=>({contents:[go(IW(t))]}),filePath:({value:{file:t}})=>({contents:[go(IW(t))]}),fileNumber:Pi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...PW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Pi,string:Pi,uint8Array:Pi}}});var So,dI,tp=y(()=>{VR();So=(t,{stripFinalNewline:e},r)=>dI(e,r)&&t!==void 0&&!Array.isArray(t)?El(t):t,dI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Zb,pI,jW,MW,Sxe,wxe,xxe,FW,$xe,fI,kxe,Exe,Axe,Vb=y(()=>{Zb=(t,e,r,n)=>t||r?void 0:MW(e,n),pI=(t,e,r)=>r?t.flatMap(n=>jW(n,e)):jW(t,e),jW=(t,e)=>{let{transform:r,final:n}=MW(e,{});return[...r(t),...n()]},MW=(t,e)=>(e.previousChunks="",{transform:Sxe.bind(void 0,e,t),final:xxe.bind(void 0,e)}),Sxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=fI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=fI(n,r.slice(i+1))),t.previousChunks=n},wxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),xxe=function*({previousChunks:t}){t.length>0&&(yield t)},FW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:$xe.bind(void 0,n)},$xe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?kxe:Axe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},fI=(t,e)=>`${t}${e}`,kxe={windowsNewline:`\r +${t}`}});import kSe from"node:path";import gV from"node:process";var yV,Pb,ESe,ASe,VR=y(()=>{yV=St(YZ(),1);i9();fb();Wf();CR();UR();qR();BR();HR();Pa();ZR();bl();vo();Pb=(t,e,r)=>{r.cwd=pV(r.cwd);let[n,i,o]=cV(t,e,r),{command:s,args:a,options:c}=yV.default._parse(n,i,o),l=zG(c),u=ESe(l);return iV(u),fV(u),lV(u),$9(u),rV(u),u.shell=cR(u.shell),u.env=ASe(u),u.killSignal=b9(u.killSignal),u.forceKillAfterDelay=w9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!nn.has(u.encoding)&&u.buffer[f]),gV.platform==="win32"&&kSe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},ESe=({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}),ASe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...gV.env,...t}:t;return r||n?n9({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Cb,WR=y(()=>{Cb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Rl(t){if(typeof t=="string")return TSe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return OSe(t)}var TSe,OSe,_V,RSe,bV,ISe,KR=y(()=>{TSe=t=>t.at(-1)===_V?t.slice(0,t.at(-2)===bV?-2:-1):t,OSe=t=>t.at(-1)===RSe?t.subarray(0,t.at(-2)===ISe?-2:-1):t,_V=` +`,RSe=_V.codePointAt(0),bV="\r",ISe=bV.codePointAt(0)});function ti(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 JR(t,{checkOpen:e=!0}={}){return ti(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 Ca(t,{checkOpen:e=!0}={}){return ti(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 YR(t,e){return JR(t,e)&&Ca(t,e)}var Da=y(()=>{});function vV(){return this[QR].next()}function SV(t){return this[QR].return(t)}function eI({preventCancel:t=!1}={}){let e=this.getReader(),r=new XR(e,t),n=Object.create(CSe);return n[QR]=r,n}var PSe,XR,QR,CSe,wV=y(()=>{PSe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),XR=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}}},QR=Symbol();Object.defineProperty(vV,"name",{value:"next"});Object.defineProperty(SV,"name",{value:"return"});CSe=Object.create(PSe,{next:{enumerable:!0,configurable:!0,writable:!0,value:vV},return:{enumerable:!0,configurable:!0,writable:!0,value:SV}})});var xV=y(()=>{});var $V=y(()=>{wV();xV()});var kV,DSe,NSe,jSe,Qf,tI=y(()=>{Da();$V();kV=t=>{if(Ca(t,{checkOpen:!1})&&Qf.on!==void 0)return NSe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(DSe.call(t)==="[object ReadableStream]")return eI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:DSe}=Object.prototype,NSe=async function*(t){let e=new AbortController,r={};jSe(t,e,r);try{for await(let[n]of Qf.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()}},jSe=async(t,e,r)=>{try{await Qf.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},Qf={}});var Il,MSe,TV,EV,FSe,AV,Ci,ep=y(()=>{tI();Il=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=kV(t),u=e();u.length=0;try{for await(let d of l){let f=FSe(d),p=r[f](d,u);TV({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return MSe({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}},MSe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&TV({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},TV=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){EV(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&EV(c,e,i,o),new Ci},EV=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},FSe=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=AV.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&AV.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:AV}=Object.prototype,Ci=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var So,tp,Db,Nb,jb,Mb=y(()=>{So=t=>t,tp=()=>{},Db=({contents:t})=>t,Nb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},jb=t=>t.length});async function Fb(t,e){return Il(t,qSe,e)}var LSe,zSe,USe,qSe,OV=y(()=>{ep();Mb();LSe=()=>({contents:[]}),zSe=()=>1,USe=(t,{contents:e})=>(e.push(t),e),qSe={init:LSe,convertChunk:{string:So,buffer:So,arrayBuffer:So,dataView:So,typedArray:So,others:So},getSize:zSe,truncateChunk:tp,addChunk:USe,getFinalChunk:tp,finalize:Db}});async function Lb(t,e){return Il(t,YSe,e)}var BSe,HSe,GSe,RV,IV,ZSe,VSe,WSe,KSe,CV,PV,JSe,DV,YSe,NV=y(()=>{ep();Mb();BSe=()=>({contents:new ArrayBuffer(0)}),HSe=t=>GSe.encode(t),GSe=new TextEncoder,RV=t=>new Uint8Array(t),IV=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),ZSe=(t,e)=>t.slice(0,e),VSe=(t,{contents:e,length:r},n)=>{let i=DV()?KSe(e,n):WSe(e,n);return new Uint8Array(i).set(t,r),i},WSe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(CV(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},KSe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:CV(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},CV=t=>PV**Math.ceil(Math.log(t)/Math.log(PV)),PV=2,JSe=({contents:t,length:e})=>DV()?t:t.slice(0,e),DV=()=>"resize"in ArrayBuffer.prototype,YSe={init:BSe,convertChunk:{string:HSe,buffer:RV,arrayBuffer:RV,dataView:IV,typedArray:IV,others:Nb},getSize:jb,truncateChunk:ZSe,addChunk:VSe,getFinalChunk:tp,finalize:JSe}});async function Ub(t,e){return Il(t,rwe,e)}var XSe,zb,QSe,ewe,twe,rwe,jV=y(()=>{ep();Mb();XSe=()=>({contents:"",textDecoder:new TextDecoder}),zb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),QSe=(t,{contents:e})=>e+t,ewe=(t,e)=>t.slice(0,e),twe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},rwe={init:XSe,convertChunk:{string:So,buffer:zb,arrayBuffer:zb,dataView:zb,typedArray:zb,others:Nb},getSize:jb,truncateChunk:ewe,addChunk:QSe,getFinalChunk:twe,finalize:Db}});var MV=y(()=>{OV();NV();jV();ep()});import{on as nwe}from"node:events";import{finished as iwe}from"node:stream/promises";var qb=y(()=>{tI();MV();Object.assign(Qf,{on:nwe,finished:iwe})});var FV,owe,LV,zV,swe,UV,qV,Bb,Na=y(()=>{qb();_o();vo();FV=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof Ci))throw t;if(o==="all")return t;let s=owe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},owe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",LV=(t,e,r)=>{if(e.length!==r)return;let n=new Ci;throw n.maxBufferInfo={fdNumber:"ipc"},n},zV=(t,e)=>{let{streamName:r,threshold:n,unit:i}=swe(t,e);return`Command's ${r} was larger than ${n} ${i}`},swe=(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=bo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:K_(r),threshold:i,unit:n}},UV=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>Bb(r)),qV=(t,e,r)=>{if(!e)return t;let n=Bb(r);return t.length>n?t.slice(0,n):t},Bb=([,t])=>t});import{inspect as awe}from"node:util";var HV,cwe,lwe,uwe,dwe,fwe,BV,GV=y(()=>{KR();rn();ZR();X_();Na();Wf();Ra();HV=({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=cwe({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=uwe(n,b),w=x===void 0?"":` +${x}`,O=`${S}: ${a}${w}`,T=e===void 0?[t[2],t[1]]:[e],A=[O,...T,...t.slice(3),r.map(D=>dwe(D)).join(` +`)].map(D=>Hf(Rl(fwe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:O,message:A}},cwe=({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=lwe(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?`${zV(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${db(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},lwe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",uwe=(t,e)=>{if(t instanceof Qn)return;let r=a9(t)?t.originalMessage:String(t?.message??t),n=Hf(hV(r,e));return n===""?void 0:n},dwe=t=>typeof t=="string"?t:awe(t),fwe=t=>Array.isArray(t)?t.map(e=>Rl(BV(e))).filter(Boolean).join(` +`):BV(t),BV=t=>typeof t=="string"?t:Ut(t)?V_(t):""});var Hb,Pl,rp,pwe,ZV,mwe,np=y(()=>{Wf();ib();Ra();GV();Hb=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>ZV({command:t,escapedCommand:e,cwd:o,durationMs:_R(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:[]}),Pl=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>rp({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}),rp=({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:O,signalDescription:T}=mwe(l,u),{originalMessage:A,shortMessage:D,message:$}=HV({stdio:d,all:f,ipcOutput:p,originalError:t,signal:O,signalDescription:T,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),ie=o9(t,$,x);return Object.assign(ie,pwe({error:ie,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:O,signalDescription:T,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:A,shortMessage:D})),ie},pwe=({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})=>ZV({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:_R(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:[]}),ZV=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),mwe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:db(e);return{exitCode:r,signal:n,signalDescription:i}}});function hwe(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(VV(t*1e3)%1e3),nanoseconds:Math.trunc(VV(t*1e6)%1e3)}}function gwe(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 rI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return hwe(t);break}case"bigint":return gwe(t)}throw new TypeError("Expected a finite number or bigint")}var VV,WV=y(()=>{VV=t=>Number.isFinite(t)?t:0});function nI(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+bwe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&ywe(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?" "+_we(d,u):f;i.push(p)}},a=rI(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%vwe):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 ywe,_we,bwe,vwe,KV=y(()=>{WV();ywe=t=>t===0||t===0n,_we=(t,e)=>e===1||e===1n?t:`${t}s`,bwe=1e-7,vwe=24n*60n*60n*1000n});var JV,YV=y(()=>{wl();JV=(t,e)=>{t.failed&&Ri({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var XV,Swe,QV=y(()=>{KV();ls();wl();YV();XV=(t,e)=>{vl(e)&&(JV(t,e),Swe(t,e))},Swe=(t,e)=>{let r=`(done in ${nI(t.durationMs)})`;Ri({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Cl,Gb=y(()=>{QV();Cl=(t,e,{reject:r})=>{if(XV(t,e),t.failed&&r)throw t;return t}});var rW,wwe,xwe,nW,iW,eW,$we,iI,tW,ja,oW,kwe,Zb,sW,Ewe,Awe,oI,aW,Twe,cW,Vb,Owe,sI,Rwe,Iwe,lW,Tn,Wb,aI,uW,dW,ps,vr=y(()=>{Da();go();rn();rW=(t,e)=>ja(t)?"asyncGenerator":oW(t)?"generator":Zb(t)?"fileUrl":Ewe(t)?"filePath":Owe(t)?"webStream":ti(t,{checkOpen:!1})?"native":Ut(t)?"uint8Array":Rwe(t)?"asyncIterable":Iwe(t)?"iterable":sI(t)?nW({transform:t},e):kwe(t)?wwe(t,e):"native",wwe=(t,e)=>YR(t.transform,{checkOpen:!1})?xwe(t,e):sI(t.transform)?nW(t,e):$we(t,e),xwe=(t,e)=>(iW(t,e,"Duplex stream"),"duplex"),nW=(t,e)=>(iW(t,e,"web TransformStream"),"webTransform"),iW=({final:t,binary:e,objectMode:r},n,i)=>{eW(t,`${n}.final`,i),eW(e,`${n}.binary`,i),iI(r,`${n}.objectMode`)},eW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},$we=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!tW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(YR(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&&!tW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return iI(r,`${i}.binary`),iI(n,`${i}.objectMode`),ja(t)||ja(e)?"asyncGenerator":"generator"},iI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},tW=t=>ja(t)||oW(t),ja=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",oW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",kwe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),Zb=t=>Object.prototype.toString.call(t)==="[object URL]",sW=t=>Zb(t)&&t.protocol!=="file:",Ewe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Awe.has(e))&&oI(t.file),Awe=new Set(["file","append"]),oI=t=>typeof t=="string",aW=(t,e)=>t==="native"&&typeof e=="string"&&!Twe.has(e),Twe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),cW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",Vb=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Owe=t=>cW(t)||Vb(t),sI=t=>cW(t?.readable)&&Vb(t?.writable),Rwe=t=>lW(t)&&typeof t[Symbol.asyncIterator]=="function",Iwe=t=>lW(t)&&typeof t[Symbol.iterator]=="function",lW=t=>typeof t=="object"&&t!==null,Tn=new Set(["generator","asyncGenerator","duplex","webTransform"]),Wb=new Set(["fileUrl","filePath","fileNumber"]),aI=new Set(["fileUrl","filePath"]),uW=new Set([...aI,"webStream","nodeStream"]),dW=new Set(["webTransform","duplex"]),ps={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 cI,Pwe,Cwe,fW,lI=y(()=>{vr();cI=(t,e,r,n)=>n==="output"?Pwe(t,e,r):Cwe(t,e,r),Pwe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Cwe=(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}},fW=(t,e)=>{let r=t.findLast(({type:n})=>Tn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var pW,Dwe,Nwe,jwe,Mwe,Fwe,Lwe,mW=y(()=>{go();Pa();vr();lI();pW=(t,e,r,n)=>[...t.filter(({type:i})=>!Tn.has(i)),...Dwe(t,e,r,n)],Dwe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Tn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Nwe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Lwe(o,r)},Nwe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?jwe({stdioItem:t,optionName:i}):e==="webTransform"?Mwe({stdioItem:t,index:r,newTransforms:n,direction:o}):Fwe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),jwe=({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}}},Mwe=({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}=cI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Fwe=({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||nn.has(o),{writableObjectMode:f,readableObjectMode:p}=cI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Lwe=(t,e)=>e==="input"?t.reverse():t});import uI from"node:process";var hW,zwe,Uwe,Dl,dI,gW,qwe,Bwe,yW=y(()=>{Da();vr();hW=(t,e,r)=>{let n=t.map(i=>zwe(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)??Bwe},zwe=({type:t,value:e},r)=>Uwe[r]??gW[t](e),Uwe=["input","output","output"],Dl=()=>{},dI=()=>"input",gW={generator:Dl,asyncGenerator:Dl,fileUrl:Dl,filePath:Dl,iterable:dI,asyncIterable:dI,uint8Array:dI,webStream:t=>Vb(t)?"output":"input",nodeStream(t){return Ca(t,{checkOpen:!1})?JR(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Dl,duplex:Dl,native(t){let e=qwe(t);if(e!==void 0)return e;if(ti(t,{checkOpen:!1}))return gW.nodeStream(t)}},qwe=t=>{if([0,uI.stdin].includes(t))return"input";if([1,2,uI.stdout,uI.stderr].includes(t))return"output"},Bwe="output"});var _W,bW=y(()=>{_W=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var vW,Hwe,Gwe,SW,Zwe,Vwe,wW=y(()=>{_o();bW();ls();vW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Hwe(t,n).map((a,c)=>SW(a,c));return o?Zwe(s,r,i):_W(s,e)},Hwe=(t,e)=>{if(t===void 0)return An.map(n=>e[n]);if(Gwe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${An.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,An.length);return Array.from({length:r},(n,i)=>t[i])},Gwe=t=>An.some(e=>t[e]!==void 0),SW=(t,e)=>Array.isArray(t)?t.map(r=>SW(r,e)):t??(e>=An.length?"ignore":"pipe"),Zwe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Sl(r,i)&&Vwe(n)?"ignore":n),Vwe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Wwe}from"node:fs";import Kwe from"node:tty";var $W,Jwe,Ywe,Xwe,Qwe,xW,kW=y(()=>{Da();_o();rn();ds();$W=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Jwe({stdioItem:t,fdNumber:n,direction:i}):Qwe({stdioItem:t,fdNumber:n}),Jwe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Ywe({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(ti(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},Ywe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Xwe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Kwe.isatty(i))throw new TypeError(`The \`${e}: ${hb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:yo(Wwe(i)),optionName:e}}},Xwe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=W_.indexOf(t);if(r!==-1)return r},Qwe=({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}:ti(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,xW=(t,e,r)=>{let n=W_[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var EW,exe,txe,rxe,nxe,AW=y(()=>{Da();rn();vr();EW=({input:t,inputFile:e},r)=>r===0?[...exe(t),...rxe(e)]:[],exe=t=>t===void 0?[]:[{type:txe(t),value:t,optionName:"input"}],txe=t=>{if(Ca(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Ut(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},rxe=t=>t===void 0?[]:[{...nxe(t),optionName:"inputFile"}],nxe=t=>{if(Zb(t))return{type:"fileUrl",value:t};if(oI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var TW,OW,ixe,oxe,RW,sxe,axe,IW,PW=y(()=>{vr();TW=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),OW=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=ixe(i,t);if(s.length!==0){if(o){oxe({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(uW.has(t))return RW({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});dW.has(t)&&axe({otherStdioItems:s,type:t,value:e,optionName:r})}},ixe=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),oxe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{aI.has(e)&&RW({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},RW=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>sxe(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return IW(s,n,e),i==="output"?o[0].stream:void 0},sxe=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,axe=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);IW(i,n,e)},IW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${ps[r]} that is the same.`)}});var Kb,cxe,lxe,uxe,dxe,fxe,pxe,mxe,hxe,gxe,yxe,_xe,fI,bxe,Jb=y(()=>{_o();mW();lI();vr();yW();wW();kW();AW();PW();Kb=(t,e,r,n)=>{let o=vW(e,r,n).map((a,c)=>cxe({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=gxe({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>bxe(a)),s},cxe=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=K_(e),{stdioItems:o,isStdioArray:s}=lxe({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=hW(o,e,i),c=o.map(d=>$W({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=pW(c,i,a,r),u=fW(l,a);return hxe(l,u),{direction:a,objectMode:u,stdioItems:l}},lxe=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>uxe(c,n)),...EW(r,e)],s=TW(o),a=s.length>1;return dxe(s,a,n),pxe(s),{stdioItems:s,isStdioArray:a}},uxe=(t,e)=>({type:rW(t,e),value:t,optionName:e}),dxe=(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(fxe.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},fxe=new Set(["ignore","ipc"]),pxe=t=>{for(let e of t)mxe(e)},mxe=({type:t,value:e,optionName:r})=>{if(sW(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(aW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},hxe=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>Wb.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},gxe=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(yxe({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw fI(i),o}},yxe=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>_xe({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},_xe=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=OW({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},fI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!Xn(r)&&r.destroy()},bxe=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 CW}from"node:fs";var NW,Di,vxe,jW,DW,Sxe,MW=y(()=>{rn();Jb();vr();NW=(t,e)=>Kb(Sxe,t,e,!0),Di=({type:t,optionName:e})=>{jW(e,ps[t])},vxe=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&jW(t,`"${e}"`),{}),jW=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},DW={generator(){},asyncGenerator:Di,webStream:Di,nodeStream:Di,webTransform:Di,duplex:Di,asyncIterable:Di,native:vxe},Sxe={input:{...DW,fileUrl:({value:t})=>({contents:[yo(CW(t))]}),filePath:({value:{file:t}})=>({contents:[yo(CW(t))]}),fileNumber:Di,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...DW,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:Di,string:Di,uint8Array:Di}}});var wo,pI,ip=y(()=>{KR();wo=(t,{stripFinalNewline:e},r)=>pI(e,r)&&t!==void 0&&!Array.isArray(t)?Rl(t):t,pI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var Yb,hI,FW,LW,wxe,xxe,$xe,zW,kxe,mI,Exe,Axe,Txe,Xb=y(()=>{Yb=(t,e,r,n)=>t||r?void 0:LW(e,n),hI=(t,e,r)=>r?t.flatMap(n=>FW(n,e)):FW(t,e),FW=(t,e)=>{let{transform:r,final:n}=LW(e,{});return[...r(t),...n()]},LW=(t,e)=>(e.previousChunks="",{transform:wxe.bind(void 0,e,t),final:$xe.bind(void 0,e)}),wxe=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=mI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=mI(n,r.slice(i+1))),t.previousChunks=n},xxe=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),$xe=function*({previousChunks:t}){t.length>0&&(yield t)},zW=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:kxe.bind(void 0,n)},kxe=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?Exe:Txe;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},mI=(t,e)=>`${t}${e}`,Exe={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:fI},Exe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Axe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Exe}});import{Buffer as Txe}from"node:buffer";var LW,Oxe,zW,Rxe,Ixe,UW,qW=y(()=>{rn();LW=(t,e)=>t?void 0:Oxe.bind(void 0,e),Oxe=function*(t,e){if(typeof e!="string"&&!Ut(e)&&!Txe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},zW=(t,e)=>t?Rxe.bind(void 0,e):Ixe.bind(void 0,e),Rxe=function*(t,e){UW(t,e),yield e},Ixe=function*(t,e){if(UW(t,e),typeof e!="string"&&!Ut(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},UW=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:mI},Axe=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Txe={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Axe}});import{Buffer as Oxe}from"node:buffer";var UW,Rxe,qW,Ixe,Pxe,BW,HW=y(()=>{rn();UW=(t,e)=>t?void 0:Rxe.bind(void 0,e),Rxe=function*(t,e){if(typeof e!="string"&&!Ut(e)&&!Oxe.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},qW=(t,e)=>t?Ixe.bind(void 0,e):Pxe.bind(void 0,e),Ixe=function*(t,e){BW(t,e),yield e},Pxe=function*(t,e){if(BW(t,e),typeof e!="string"&&!Ut(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},BW=(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 Pxe}from"node:buffer";import{StringDecoder as Cxe}from"node:string_decoder";var Wb,Dxe,Nxe,jxe,mI=y(()=>{rn();Wb=(t,e,r)=>{if(r)return;if(t)return{transform:Dxe.bind(void 0,new TextEncoder)};let n=new Cxe(e);return{transform:Nxe.bind(void 0,n),final:jxe.bind(void 0,n)}},Dxe=function*(t,e){Pxe.isBuffer(e)?yield go(e):typeof e=="string"?yield t.encode(e):yield e},Nxe=function*(t,e){yield Ut(e)?t.write(e):e},jxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as BW}from"node:util";var hI,Kb,HW,Mxe,GW,Fxe,ZW=y(()=>{hI=BW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Kb=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Fxe}=e[r];for await(let i of n(t))yield*Kb(i,e,r+1)},HW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Mxe(r,Number(e),t)},Mxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Kb(n,r,e+1)},GW=BW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Fxe=function*(t){yield t}});var gI,VW,Na,rp,Lxe,zxe,yI=y(()=>{gI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},VW=(t,e)=>[...e.flatMap(r=>[...Na(r,t,0)]),...rp(t)],Na=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=zxe}=e[r];for(let i of n(t))yield*Na(i,e,r+1)},rp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Lxe(r,Number(e),t)},Lxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Na(n,r,e+1)},zxe=function*(t){yield t}});import{Transform as Uxe,getDefaultHighWaterMark as WW}from"node:stream";var _I,Jb,KW,Yb=y(()=>{vr();Vb();qW();mI();ZW();yI();_I=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=KW(t,s,o),l=Da(e),u=Da(r),d=l?hI.bind(void 0,Kb,a):gI.bind(void 0,Na),f=l||u?hI.bind(void 0,HW,a):gI.bind(void 0,rp),p=l||u?GW.bind(void 0,a):void 0;return{stream:new Uxe({writableObjectMode:n,writableHighWaterMark:WW(n),readableObjectMode:i,readableHighWaterMark:WW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},Jb=(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=KW(s,r,a);t=VW(c,t)}return t},KW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:LW(n,a)},Wb(r,s,n),Zb(r,o,n,c),{transform:t,final:e},{transform:zW(i,a)},FW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var JW,qxe,Bxe,Hxe,Gxe,YW=y(()=>{Yb();rn();vr();JW=(t,e)=>{for(let r of qxe(t))Bxe(t,r,e)},qxe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Bxe=(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 ${fs[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Hxe(a,n));r.input=zf(s)},Hxe=(t,e)=>{let r=Jb(t,e,"utf8",!0);return Gxe(r),zf(r)},Gxe=t=>{let e=t.find(r=>typeof r!="string"&&!Ut(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 Xb,Zxe,Vxe,XW,QW,Wxe,e3,bI=y(()=>{Ra();vr();_l();cs();Xb=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&yl(r,n)&&!nn.has(e)&&Zxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Vxe.has(o))||t.every(({type:i})=>Tn.has(i))),Zxe=t=>t===1||t===2,Vxe=new Set(["pipe","overlapped"]),XW=async(t,e,r,n)=>{for await(let i of t)Wxe(e)||e3(i,r,n)},QW=(t,e,r)=>{for(let n of t)e3(n,e,r)},Wxe=t=>t._readableState.pipes.length>0,e3=(t,e,r)=>{let n=Y_(t);Ti({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Kxe,appendFileSync as Jxe}from"node:fs";var t3,Yxe,Xxe,Qxe,e$e,t$e,r3=y(()=>{bI();Yb();Vb();rn();vr();Ca();t3=({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)=>Yxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Yxe=({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=zV(t,o,d),p=go(f),{stdioItems:m,objectMode:h}=e[r],g=Xxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=Qxe({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}},Xxe=(t,e,r,n)=>{try{return Jb(t,e,r,!1)}catch(i){return n.error=i,t}},Qxe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:zf(t)};let s=RG(t,r);return n[o]?{serializedResult:s,finalResult:pI(s,!i[o],e)}:{serializedResult:s}},e$e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Xb({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=pI(t,!1,s);try{QW(a,e,n)}catch(c){r.error??=c}},t$e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Bb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Jxe(n,t):(r.add(o),Kxe(n,t))}}});var n3,i3=y(()=>{rn();tp();n3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,So(e,r,"all")]:Array.isArray(e)?[So(t,r,"all"),...e]:Ut(t)&&Ut(e)?cR([t,e]):`${t}${e}`}});import{once as vI}from"node:events";var o3,r$e,s3,a3,n$e,SI,wI=y(()=>{Ta();o3=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([vI(t,"spawn"),vI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?s3(t):r.value},s3=async t=>{try{return await vI(t,"exit")}catch{return s3(t)}},a3=async t=>{let[e,r]=await t;if(!n$e(e,r)&&SI(e,r))throw new Xn;return[e,r]},n$e=(t,e)=>t===void 0&&e===void 0,SI=(t,e)=>t!==0||e!==null});var c3,i$e,l3=y(()=>{Ta();Ca();wI();c3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=i$e(t,e,r),s=o?.code==="ETIMEDOUT",a=LV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},i$e=(t,e,r)=>t!==void 0?t:SI(e,r)?new Xn:void 0});import{spawnSync as o$e}from"node:child_process";var u3,s$e,a$e,c$e,Qb,l$e,u$e,d$e,f$e,d3=y(()=>{yR();GR();ZR();ep();zb();NW();tp();YW();r3();Ca();i3();l3();u3=(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 Ol(d,c,l)},s$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=eb(t,e,r),a=a$e(r),{file:c,commandArguments:l,options:u}=Ab(t,e,a);c$e(u);let d=CW(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&&Qb("ipcInput"),t&&Qb("ipc: true"),r&&Qb("detached: true"),n&&Qb("cancelSignal")},Qb=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}=c3(c,r),{output:m,error:h=l}=t3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>So(_,r,S)),b=So(n3(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{JW(o,r);let a=d$e(r);return o$e(...Tb(t,e,a))}catch(a){return Tl({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:Fb(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?Lb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Qf({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 xI,on as p$e}from"node:events";var f3,m$e,h$e,g$e,y$e,p3=y(()=>{xl();Wf();Vf();f3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Sl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:vb(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})=>{pb(e,i);let o=ds(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 wl(t),a}finally{s.abort(),mb(e,i)}},h$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await xI(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 xI(t,"disconnect",{signal:r}),$9(e)},y$e=async(t,e,{signal:r})=>{let[n]=await xI(t,"strict:error",{signal:r});throw lb(n,e)}});import{once as h3,on as _$e}from"node:events";var g3,$I,b$e,v$e,S$e,m3,kI=y(()=>{xl();Wf();Vf();g3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>$I({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),$I=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Sl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:vb(t)}),pb(e,o);let s=ds(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 h3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},v$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await h3(t,"strict:error",{signal:r.signal});n.error=lb(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}))m3(s),yield c}catch{m3(s)}finally{o.abort(),mb(e,a),n||wl(t),i&&await t}},m3=({error:t})=>{if(t)throw t}});import y3 from"node:process";var _3,b3,v3,EI=y(()=>{kb();p3();kI();_b();_3=(t,{ipc:e})=>{Object.assign(t,v3(t,!1,e))},b3=()=>{let t=y3,e=!0,r=y3.channel!==void 0;return{...v3(t,e,r),getCancelSignal:X9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},v3=(t,e,r)=>({sendMessage:$b.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:f3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:g3.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 S3,A$e,np,T$e,O$e,R$e,I$e,w3=y(()=>{Gb();ep();zb();S3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{uI(n);let a=new w$e;A$e(a,n),Object.assign(a,{readable:T$e,writable:O$e,duplex:R$e});let c=Tl({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=np(),n=np(),i=np(),o=Array.from({length:e.length-3},np),s=np(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},np=()=>{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)=>Ol(t,e,r)});import{createReadStream as x3,createWriteStream as $3}from"node:fs";import{Buffer as P$e}from"node:buffer";import{Readable as ip,Writable as C$e,Duplex as D$e}from"node:stream";var E3,op,k3,N$e,A3=y(()=>{Yb();Gb();vr();E3=(t,e)=>Hb(N$e,t,e,!1),op=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${fs[t]}.`)},k3={fileNumber:op,generator:_I,asyncGenerator:_I,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:{...k3,fileUrl:({value:t})=>({stream:x3(t)}),filePath:({value:{file:t}})=>({stream:x3(t)}),webStream:({value:t})=>({stream:ip.fromWeb(t)}),iterable:({value:t})=>({stream:ip.from(t)}),asyncIterable:({value:t})=>({stream:ip.from(t)}),string:({value:t})=>({stream:ip.from(t)}),uint8Array:({value:t})=>({stream:ip.from(P$e.from(t))})},output:{...k3,fileUrl:({value:t})=>({stream:$3(t)}),filePath:({value:{file:t,append:e}})=>({stream:$3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:C$e.fromWeb(t)}),iterable:op,asyncIterable:op,string:op,uint8Array:op}}});import{on as j$e,once as T3}from"node:events";import{PassThrough as M$e,getDefaultHighWaterMark as F$e}from"node:stream";import{finished as I3}from"node:stream/promises";function ja(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)TI(i);let e=t.some(({readableObjectMode:i})=>i),r=L$e(t,e),n=new AI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var L$e,AI,z$e,U$e,q$e,TI,B$e,H$e,G$e,Z$e,V$e,P3,C3,OI,D3,W$e,ev,O3,R3,tv=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)},AI=class extends M$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(TI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=z$e(this,this.#t,this.#o);let r=B$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(TI(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)=>{ev(t,O3);let n=new AbortController;try{await Promise.race([U$e(t,n),q$e(t,e,r,n)])}finally{n.abort(),ev(t,-O3)}},U$e=async(t,{signal:e})=>{try{await I3(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)},TI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},B$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{ev(t,R3);let a=new AbortController;try{await Promise.race([H$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(),ev(t,-R3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?OI(t):V$e(t))},H$e=async(t,e,{signal:r})=>{try{await t,r.aborted||OI(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 I3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;C3(s)?i.add(e):D3(t,s)}},Z$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await T3(t,i,{signal:o}),!t.readable)return T3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},V$e=t=>{t.writable&&t.end()},P3=(t,e)=>{C3(e)?OI(t):D3(t,e)},C3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",OI=t=>{(t.readable||t.writable)&&t.destroy()},D3=(t,e)=>{t.destroyed||(t.once("error",W$e),t.destroy(e))},W$e=()=>{},ev=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},O3=2,R3=1});import{finished as N3}from"node:stream/promises";var Il,K$e,RI,J$e,II,rv=y(()=>{yo();Il=(t,e)=>{t.pipe(e),K$e(t,e),J$e(t,e)},K$e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await N3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}RI(e)}},RI=t=>{t.writable&&t.end()},J$e=async(t,e)=>{if(!(Yn(t)||Yn(e))){try{await N3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}II(t)}},II=t=>{t.readable&&t.destroy()}});var j3,Y$e,X$e,Q$e,e0e,t0e,M3=y(()=>{tv();yo();fb();vr();rv();j3=(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})=>Tn.has(c)))Y$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Tn.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]:ja(o);Il(s,i)}},Y$e=(t,e,r,n)=>{r==="output"?Il(t.stdio[n],e):Il(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;e0e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},e0e=(t,{signal:e})=>{Yn(t)&&Oa(t,t0e,e)},t0e=2});var Ma,F3=y(()=>{Ma=[];Ma.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ma.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ma.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var nv,PI,CI,r0e,DI,iv,n0e,NI,jI,MI,L3,Rst,Ist,z3=y(()=>{F3();nv=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",PI=Symbol.for("signal-exit emitter"),CI=globalThis,r0e=Object.defineProperty.bind(Object),DI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(CI[PI])return CI[PI];r0e(CI,PI,{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}},iv=class{},n0e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),NI=class extends iv{onExit(){return()=>{}}load(){}unload(){}},jI=class extends iv{#t=MI.platform==="win32"?"SIGINT":"SIGHUP";#r=new DI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ma)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(!nv(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 Ma)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,Ma.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 nv(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"&&nv(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)}},MI=globalThis.process,{onExit:L3,load:Rst,unload:Ist}=n0e(nv(MI)?new jI(MI):new NI)});import{addAbortListener as i0e}from"node:events";var U3,q3=y(()=>{z3();U3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=L3(()=>{t.kill()});i0e(n,()=>{i()})}});var H3,o0e,s0e,B3,a0e,G3=y(()=>{aR();Q_();us();hl();H3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=X_(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=o0e(r,n,i),{sourceStream:d,sourceError:f}=a0e(t,l),{options:p,fileDescriptors:m}=Ri.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},o0e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=s0e(t,e,...r),a=db(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},s0e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(B3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||oR(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]=U_(r,...n);return{destination:e(B3)(i,o,s),pipeOptions:s}}if(Ri.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}`)},B3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),a0e=(t,e)=>{try{return{sourceStream:kl(t,e)}}catch(r){return{sourceError:r}}}});var V3,c0e,FI,Z3,LI=y(()=>{ep();rv();V3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=c0e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw FI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},c0e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return II(t),n;if(e!==void 0)return RI(r),e},FI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Tl({error:t,command:Z3,escapedCommand:Z3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Z3="source.pipe(destination)"});var W3,K3=y(()=>{W3=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 l0e}from"node:stream/promises";var J3,u0e,d0e,f0e,ov,p0e,m0e,Y3=y(()=>{tv();fb();rv();J3=(t,e,r)=>{let n=ov.has(e)?d0e(t,e):u0e(t,e);return Oa(t,p0e,r.signal),Oa(e,m0e,r.signal),f0e(e),n},u0e=(t,e)=>{let r=ja([t]);return Il(r,e),ov.set(e,r),r},d0e=(t,e)=>{let r=ov.get(e);return r.add(t),r},f0e=async t=>{try{await l0e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}ov.delete(t)},ov=new WeakMap,p0e=2,m0e=1});import{aborted as h0e}from"node:util";var X3,g0e,Q3=y(()=>{LI();X3=(t,e)=>t===void 0?[]:[g0e(t,e)],g0e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await h0e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw FI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var sv,y0e,_0e,eK=y(()=>{ho();G3();LI();K3();Y3();Q3();sv=(t,...e)=>{if(Ot(e[0]))return sv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=H3(t,...e),i=y0e({...n,destination:r});return i.pipe=sv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},y0e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=_0e(t,i);V3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=J3(e,o,d);return await Promise.race([W3(u),...X3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},_0e=(t,e)=>Promise.allSettled([t,e])});import{on as b0e}from"node:events";import{getDefaultHighWaterMark as v0e}from"node:stream";var av,S0e,zI,w0e,rK,UI,tK,x0e,$0e,cv=y(()=>{mI();Vb();yI();av=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return S0e(e,s),rK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},S0e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},zI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;w0e(e,s,t);let a=t.readableObjectMode&&!o;return rK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},w0e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},rK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=b0e(t,"data",{signal:e.signal,highWaterMark:tK,highWatermark:tK});return x0e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},UI=v0e(!0),tK=UI,x0e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=$0e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Na(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*rp(a)}},$0e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Wb(t,r,!e),Zb(t,i,!n,{})].filter(Boolean)});import{setImmediate as k0e}from"node:timers/promises";var nK,E0e,A0e,T0e,qI,iK,BI=y(()=>{Mb();rn();bI();cv();Ca();tp();nK=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=E0e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([A0e(t),d]);return}let f=dI(c,r),p=zI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([T0e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},E0e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Xb({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=zI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await XW(a,t,r,o)},A0e=async t=>{await k0e(),t.readableFlowing===null&&t.resume()},T0e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Cb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Db(r,{maxBuffer:o})):await jb(r,{maxBuffer:o})}catch(a){return iK(jV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},qI=async t=>{try{return await t}catch(e){return iK(e)}},iK=({bufferedData:t})=>TG(t)?new Uint8Array(t):t});import{finished as O0e}from"node:stream/promises";var sp,R0e,I0e,P0e,C0e,D0e,HI,lv,oK,uv=y(()=>{sp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=R0e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],O0e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||C0e(a,e,r,n)}finally{s.abort()}},R0e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&I0e(t,r,n),n},I0e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{P0e(e,r),n.call(t,...i)}},P0e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},C0e=(t,e,r,n)=>{if(!D0e(t,e,r,n))throw t},D0e=(t,e,r,n=!0)=>r.propagating?oK(t)||lv(t):(r.propagating=!0,HI(r,e)===n?oK(t):lv(t)),HI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",lv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",oK=t=>t?.code==="EPIPE"});var sK,GI,ZI=y(()=>{BI();uv();sK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>GI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),GI=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=sp(t,e,l);if(HI(l,e)){await u;return}let[d]=await Promise.all([nK({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 aK,cK,N0e,j0e,VI=y(()=>{tv();ZI();aK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?ja([t,e].filter(Boolean)):void 0,cK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>GI({...N0e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:j0e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),N0e=({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}},j0e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var lK,uK,dK=y(()=>{_l();cs();lK=t=>yl(t,"ipc"),uK=(t,e)=>{let r=Y_(t);Ti({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var fK,pK,mK=y(()=>{Ca();dK();bo();kI();fK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=lK(o),a=_o(e,"ipc"),c=_o(r,"ipc");for await(let l of $I({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(MV(t,i,c),i.push(l)),s&&uK(l,o);return i},pK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as M0e}from"node:events";var hK,F0e,L0e,z0e,gK=y(()=>{Pa();zR();IR();LR();yo();vr();BI();mK();qR();VI();ZI();wI();uv();hK=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 _=o3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=sK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=cK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=fK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=F0e(h,t,S),D=L0e(m,S);try{return await Promise.race([Promise.all([{},a3(_),Promise.all(x),w,T,cV(t,d),...A,...D]),g,z0e(t,b),...nV(t,o,f,b),...x9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...tV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(ie=>qI(ie))),qI(w),pK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},F0e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:sp(n,i,r)),L0e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ei(o,{checkOpen:!1})&&!Yn(o)).map(({type:i,value:o,stream:s=o})=>sp(s,n,e,{isSameDirection:Tn.has(i),stopOnExit:i==="native"}))),z0e=async(t,{signal:e})=>{let[r]=await M0e(t,"error",{signal:e});throw r}});var yK,ap,Pl,dv=y(()=>{$l();yK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),ap=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Oi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Pl=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 _K}from"node:stream/promises";var WI,bK,KI,JI,fv,pv,YI=y(()=>{uv();WI=async t=>{if(t!==void 0)try{await KI(t)}catch{}},bK=async t=>{if(t!==void 0)try{await JI(t)}catch{}},KI=async t=>{await _K(t,{cleanup:!0,readable:!1,writable:!0})},JI=async t=>{await _K(t,{cleanup:!0,readable:!0,writable:!1})},fv=async(t,e)=>{if(await t,e)throw e},pv=(t,e,r)=>{r&&!lv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as U0e}from"node:stream";import{callbackify as q0e}from"node:util";var vK,XI,QI,eP,B0e,tP,rP,SK,nP=y(()=>{Ra();us();cv();$l();dv();YI();vK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=XI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=QI(a,s),{read:f,onStdoutDataDone:p}=eP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new U0e({read:f,destroy:q0e(rP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return tP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},XI=(t,e,r)=>{let n=kl(t,e),i=ap(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},QI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:UI},eP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Oi(),s=av({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){B0e(this,s,o)},onStdoutDataDone:o}},B0e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},tP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await JI(t),await n,await WI(i),await e,r.readable&&r.push(null)}catch(o){await WI(i),SK(r,o)}},rP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Pl(r,e)&&(SK(t,n),await fv(e,n))},SK=(t,e)=>{pv(t,t.readable,e)}});import{Writable as H0e}from"node:stream";import{callbackify as wK}from"node:util";var xK,iP,oP,G0e,Z0e,sP,aP,$K,cP=y(()=>{us();dv();YI();xK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=iP(t,r,e),s=new H0e({...oP(n,t,i),destroy:wK(aP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return sP(n,s),s},iP=(t,e,r)=>{let n=db(t,e),i=ap(r,n,"writableFinal"),o=ap(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},oP=(t,e,r)=>({write:G0e.bind(void 0,t),final:wK(Z0e.bind(void 0,t,e,r))}),G0e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Z0e=async(t,e,r)=>{await Pl(r,e)&&(t.writable&&t.end(),await e)},sP=async(t,e,r)=>{try{await KI(t),e.writable&&e.end()}catch(n){await bK(r),$K(e,n)}},aP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Pl(r,e),await Pl(n,e)&&($K(t,i),await fv(e,i))},$K=(t,e)=>{pv(t,t.writable,e)}});import{Duplex as V0e}from"node:stream";import{callbackify as W0e}from"node:util";var kK,K0e,EK=y(()=>{Ra();nP();cP();kK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=XI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=iP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=QI(c,a),{read:g,onStdoutDataDone:b}=eP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new V0e({read:g,...oP(u,t,d),destroy:W0e(K0e.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 tP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),sP(u,_,c),_},K0e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([rP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),aP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var lP,J0e,AK=y(()=>{Ra();us();cv();lP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=kl(t,r),a=av({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return J0e(a,s,t)},J0e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var TK,OK=y(()=>{dv();nP();cP();EK();AK();TK=(t,{encoding:e})=>{let r=yK();t.readable=vK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=xK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=kK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=lP.bind(void 0,t,e),t[Symbol.asyncIterator]=lP.bind(void 0,t,e,{})}});var RK,Y0e,X0e,IK=y(()=>{RK=(t,e)=>{for(let[r,n]of X0e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Y0e=(async()=>{})().constructor.prototype,X0e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Y0e,t)])});import{setMaxListeners as Q0e}from"node:events";import{spawn as eke}from"node:child_process";var PK,tke,rke,nke,ike,oke,CK=y(()=>{Mb();yR();GR();us();ZR();EI();ep();zb();w3();A3();tp();M3();ab();q3();eK();VI();gK();OK();$l();IK();PK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=tke(t,e,r),{subprocess:f,promise:p}=nke({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}),RK(f,p),Ri.set(f,{options:u,fileDescriptors:d}),f},tke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=eb(t,e,r),{file:a,commandArguments:c,options:l}=Ab(t,e,r),u=rke(l),d=E3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},rke=({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}},nke=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=eke(...Tb(t,e,r))}catch(m){return S3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Q0e(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];j3(c,a,l),U3(c,r,l);let d={},f=Oi();c.kill=S9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=aK(c,r),TK(c,r),_3(c,r);let p=ike({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}},ike=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 hK({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)=>So(x,e,w)),_=So(h,e,"all"),S=oke({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ol(S,n,e)},oke=({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?Qf({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 Ii,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Lb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var mv,ske,ake,DK=y(()=>{ho();bo();mv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,ske(n,t[n],i)]));return{...t,...r}},ske=(t,e,r)=>ake.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,ake=new Set(["env",...fR])});var ps,cke,lke,NK=y(()=>{ho();aR();jG();d3();CK();DK();ps=(t,e,r,n)=>{let i=(s,a,c)=>ps(s,a,r,c),o=(...s)=>cke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},cke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,mv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=lke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?u3(a,c,l):PK(a,c,l,i)},lke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=DG(e)?NG(e,r):[e,...r],[s,a,c]=U_(...o),l=mv(mv(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 jK,MK,FK,uke,dke,LK=y(()=>{jK=({file:t,commandArguments:e})=>FK(t,e),MK=({file:t,commandArguments:e})=>({...FK(t,e),isSync:!0}),FK=(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]=uke(t);return{file:r,commandArguments:n}},uke=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(dke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},dke=/ +/g});var zK,UK,fke,qK,pke,BK,HK=y(()=>{zK=(t,e,r)=>{t.sync=e(fke,r),t.s=t.sync},UK=({options:t})=>qK(t),fke=({options:t})=>({...qK(t),isSync:!0}),qK=t=>({options:{...pke(t),...t}}),pke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},BK={preferLocal:!0}});var vlt,Ye,Slt,wlt,xlt,$lt,klt,Elt,Alt,Tlt,Mr=y(()=>{NK();LK();UR();HK();EI();vlt=ps(()=>({})),Ye=ps(()=>({isSync:!0})),Slt=ps(jK),wlt=ps(MK),xlt=ps(oV),$lt=ps(UK,{},BK,zK),{sendMessage:klt,getOneMessage:Elt,getEachMessage:Alt,getCancelSignal:Tlt}=b3()});import{existsSync as hv,statSync as mke}from"node:fs";import{dirname as uP,extname as hke,isAbsolute as GK,join as dP,relative as fP,resolve as gv,sep as gke}from"node:path";function yv(t){return t==="./gradlew"||t==="gradle"}function yke(t){return(hv(dP(t,"build.gradle.kts"))||hv(dP(t,"build.gradle")))&&hv(dP(t,"gradle.properties"))}function _ke(t,e){let n=fP(t,e).split(gke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function ms(t,e){return t===":"?`:${e}`:`${t}:${e}`}function bke(t,e){let r=gv(t,e),n=r;hv(r)?mke(r).isFile()&&(n=uP(r)):hke(r)!==""&&(n=uP(r));let i=fP(t,n);if(i.startsWith("..")||GK(i))return null;let o=n;for(;;){if(yke(o))return o;if(gv(o)===gv(t))return null;let s=uP(o);if(s===o)return null;let a=fP(t,s);if(a.startsWith("..")||GK(a))return null;o=s}}function _v(t,e){let r=gv(t),n=new Map,i=[];for(let o of e){let s=bke(r,o);if(!s){i.push(o);continue}let a=_ke(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 bv=y(()=>{"use strict"});import{existsSync as mP,readFileSync as vke}from"node:fs";import{join as Cl}from"node:path";function Dl(t="."){let e=Cl(t,".cladding","config.yaml");if(!mP(e))return pP;try{let n=(0,ZK.parse)(vke(e,"utf8"))?.gate;if(!n)return pP;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 Ske){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 pP}}function VK(t="."){let e=Dl(t).testReport,r=e?[e,...hP]:hP;return[...new Set(r.map(n=>Cl(t,n)))]}function WK(t="."){let e=Dl(t).testReport;if(e){let r=Cl(t,e);return mP(r)?r:null}return hP.map(r=>Cl(t,r)).find(r=>mP(r))??null}function KK(t,e){let r=[],n=!1;for(let i of t){let o=wke.exec(i);if(o){n=!0;for(let s of e)r.push(ms(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 ZK,Ske,pP,hP,wke,cp=y(()=>{"use strict";ZK=St(Qt(),1);bv();Ske=["type","lint","test","coverage"],pP={scope:"feature"},hP=["test-report.junit.xml",Cl("coverage","junit.xml"),Cl(".cladding","test-report.junit.xml")];wke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as yP,readFileSync as JK,readdirSync as xke,statSync as $ke}from"node:fs";import{join as vv}from"node:path";function vP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=vv(t,e);if(yP(r))try{if(YK.test(JK(r,"utf8")))return!0}catch{}}return!1}function XK(t){try{return yP(t)&&YK.test(JK(t,"utf8"))}catch{return!1}}function QK(t,e=0){if(e>4||!yP(t))return!1;let r;try{r=xke(t)}catch{return!1}for(let n of r){let i=vv(t,n),o=!1;try{o=$ke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(QK(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&XK(i))return!0}return!1}function Ake(t){if(vP(t))return!0;for(let e of kke)if(XK(vv(t,e)))return!0;for(let e of Eke)if(QK(vv(t,e)))return!0;return!1}function eJ(t="."){let e=Dl(t).coverage;return e||(Ake(t)?"kover":"jacoco")}function tJ(t="."){return _P[eJ(t)]}function rJ(t="."){return gP[eJ(t)]}var _P,gP,bP,YK,kke,Eke,Sv=y(()=>{"use strict";cp();_P={kover:"koverXmlReport",jacoco:"jacocoTestReport"},gP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},bP=[gP.kover,gP.jacoco],YK=/kover/i;kke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Eke=["buildSrc","build-logic"]});import{existsSync as up,readFileSync as iJ,readdirSync as oJ}from"node:fs";import{join as hs}from"node:path";function wP(t){return up(hs(t,"gradlew"))?"./gradlew":"gradle"}function Tke(t){let e=wP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[tJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Oke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(iJ(hs(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 Ike(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function Dke(t,e){for(let r of e)if(up(hs(t,r)))return r}function Nke(t,e){try{return oJ(t).find(n=>n.endsWith(e))}catch{return}}function Fke(t){try{return JSON.parse(iJ(hs(t,"package.json"),"utf8"))}catch{return{}}}function lp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function nJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function Lke(t,e,r){if(lp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of jke)if(n.configs.some(i=>up(hs(t,i))))return n.gate;if(Mke.some(n=>up(hs(t,n)))||r.eslintConfig!==void 0)return e}function Uke(t,e){return zke.some(r=>up(hs(t,r)))?!0:e.jest!==void 0}function qke(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 SP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function Bke(t,e){let r=Fke(t),n=e.lint?Lke(t,e.lint,r):void 0,i=n?{...e,lint:n}:SP(e,"lint"),o=lp(r,"test"),s=o?qke(o):void 0;return o&&!s?(i=SP(i,"coverage"),{...i,test:{cmd:"npm",args:["test"]},...lp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):s==="jest"||!o&&Uke(t,r)?{...i,test:{cmd:"npx",args:[...Ci,"jest"]},coverage:{cmd:"npx",args:[...Ci,"jest","--coverage"]}}:(s==="vitest"&&!lp(r,"coverage")&&!nJ(r,"@vitest/coverage-v8")&&!nJ(r,"@vitest/coverage-istanbul")?i=SP(i,"coverage"):s==="vitest"&&lp(r,"coverage")&&(i={...i,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),i)}function dt(t="."){for(let e of Pke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=Nke(t,o):r=Dke(t,[o]),r)break;if(!r||e.requiresSource&&!Ike(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Bke(t,n):n;return{language:e.language,manifest:r,gates:i}}return Cke}var Ci,Rke,Pke,Cke,jke,Mke,zke,on=y(()=>{"use strict";Sv();Ci=["--offline","--no-install"];Rke=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);Pke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Ci,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Ci,"eslint","."]},test:{cmd:"npx",args:[...Ci,"vitest","run"]},coverage:{cmd:"npx",args:[...Ci,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Ci,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Ci,"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:Tke},{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:Oke}],Cke={language:"unknown",manifest:"",gates:{}};jke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Ci,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Ci,"oxlint"]}}],Mke=["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"];zke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Hke,readFileSync as Gke}from"node:fs";import{join as Zke}from"node:path";function Fa(t){return t.code==="ENOENT"}function wv(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=(o||s||`exit ${i}`).slice(0,200);return sJ.test(o)||sJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function qt(t,e,r,n=[]){if(Fa(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 tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Nl(t,e){let r=Zke(t,"package.json");if(!Hke(r))return!1;try{return!!JSON.parse(Gke(r,"utf8")).scripts?.[e]}catch{return!1}}var sJ,On=y(()=>{"use strict";sJ=/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 Vke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:xv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Ye(n.cmd,[...n.args],{cwd:e,reject:!1});return Fa(i)?[{detector:xv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:wv(i,xv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var xv,La,$v=y(()=>{"use strict";Mr();on();On();xv="ARCHITECTURE_VIOLATION";La={name:xv,subprocess:!0,run:Vke}});function Wke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:kv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Ye(n.cmd,[...n.args],{cwd:e,reject:!1});return Fa(i)?[{detector:kv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:wv(i,kv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var kv,za,Ev=y(()=>{"use strict";Mr();on();On();kv="HARDCODED_SECRET";za={name:kv,subprocess:!0,run:Wke}});import{existsSync as xP,readdirSync as aJ}from"node:fs";import{join as Av}from"node:path";function Jke(t,e){let r=Av(t,e.path);if(!xP(r))return!0;if(e.isDirectory)try{return aJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Yke(t){let{cwd:e="."}=t,r=[];for(let i of Kke)Jke(e,i)&&r.push({detector:dp,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=Av(e,"spec.yaml");if(xP(n)){let i=eEe(n),o=i?null:Xke(e);if(i)r.push({detector:dp,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:dp,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=Qke(e);s&&r.push({detector:dp,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 Xke(t){for(let e of["spec/features","spec/scenarios"]){let r=Av(t,e);if(!xP(r))continue;let n;try{n=aJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{ki(Av(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function Qke(t){try{return H(t),null}catch(e){return e.message}}function eEe(t){let e;try{e=ki(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var dp,Kke,cJ,lJ=y(()=>{"use strict";qe();I_();dp="ABSENCE_OF_GOVERNANCE",Kke=[{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}];cJ={name:dp,run:Yke}});function Tv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function $P(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=Tv(r)==="while",o=rEe.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 '${Tv(r)}'`}let n=tEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Tv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Tv(r)}'`:null}function nEe(t,e){let r=$P(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(...nEe(r,n));return e}var tEe,rEe,kP=y(()=>{"use strict";tEe={event:"when",state:"while",optional:"where",unwanted:"if"},rEe=/\bwhen\b/i});function he(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";qe()});function iEe(t){let{cwd:e="."}=t;return he(e,Ov,oEe)}function oEe(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:Ov,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:Ov,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Ov,dJ,fJ=y(()=>{"use strict";kP();wt();Ov="AC_DRIFT";dJ={name:Ov,run:iEe}});function Di(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return mJ[n]??pJ}var sEe,aEe,cEe,pJ,lEe,uEe,mJ,dEe,hJ,Ua=y(()=>{"use strict";on();sEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,aEe=/^[ \t]*import\s+([\w.]+)/gm,cEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,pJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:sEe,importStyle:"relative"},lEe={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:aEe,importStyle:"dotted"},uEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:cEe,importStyle:"dotted"},mJ={typescript:pJ,kotlin:lEe,python:uEe},dEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],hJ=new Set([...Object.values(mJ).flatMap(t=>t?.extensions??[]),...dEe].map(t=>t.toLowerCase()))});import{existsSync as fEe,readFileSync as pEe,readdirSync as mEe,statSync as hEe}from"node:fs";import{join as yJ,relative as gJ}from"node:path";function gEe(t,e){if(!fEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=mEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=yJ(i,s),c;try{c=hEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function yEe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function bEe(t){return _Ee.test(t)}function vEe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=Di(e,r.project?.language),o=i.sourceRoots.flatMap(a=>gEe(yJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=pEe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";qe();Ua();_J="AI_HINTS_FORBIDDEN_PATTERN";_Ee=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;bJ={name:_J,run:vEe}});function SEe(t){let{cwd:e="."}=t,r;try{r=H(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:SJ,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var SJ,wJ,xJ=y(()=>{"use strict";qe();SJ="AC_DUPLICATE_WITHIN_FEATURE";wJ={name:SJ,run:SEe}});import{createRequire as wEe}from"module";import{basename as xEe,dirname as AP,normalize as $Ee,relative as kEe,resolve as EEe,sep as EJ}from"path";import*as AEe from"fs";function TEe(t){let e=$Ee(t);return e.length>1&&e[e.length-1]===EJ&&(e=e.substring(0,e.length-1)),e}function AJ(t,e){return t.replace(OEe,e)}function IEe(t){return t==="/"||REe.test(t)}function EP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=EEe(t)),(n||o)&&(t=TEe(t)),t===".")return"";let s=t[t.length-1]!==i;return AJ(s?t+i:t,i)}function TJ(t,e){return e+t}function PEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:AJ(kEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function CEe(t){return t}function DEe(t,e,r){return e+t+r}function NEe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?PEe(t,e):n?TJ:CEe}function jEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function MEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function UEe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?MEe(t):jEe(t):n&&n.length?LEe:FEe:zEe}function VEe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?ZEe:r&&r.length?n?qEe:BEe:n?HEe:GEe}function JEe(t){return t.group?KEe:WEe}function QEe(t){return t.group?YEe:XEe}function rAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?tAe:eAe}function OJ(t,e,r){if(r.options.useRealPaths)return nAe(e,r);let n=AP(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=AP(n)}return r.symlinks.set(t,e),i>1}function nAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Rv(t,e,r,n){e(t&&!n?t:null,r)}function fAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?iAe:cAe:n?e?oAe:dAe:i?e?aAe:uAe:e?sAe:lAe}function hAe(t){return t?mAe:pAe}function bAe(t,e){return new Promise((r,n)=>{PJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function PJ(t,e,r){new IJ(t,e,r).start()}function vAe(t,e){return new IJ(t,e).start()}var $J,OEe,REe,FEe,LEe,zEe,qEe,BEe,HEe,GEe,ZEe,WEe,KEe,YEe,XEe,eAe,tAe,iAe,oAe,sAe,aAe,cAe,lAe,uAe,dAe,RJ,pAe,mAe,gAe,yAe,_Ae,IJ,kJ,CJ,DJ,NJ=y(()=>{$J=wEe(import.meta.url);OEe=/[\\/]/g;REe=/^[a-z]:[\\/]$/i;FEe=(t,e)=>{e.push(t||".")},LEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},zEe=()=>{};qEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},BEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},HEe=(t,e,r,n)=>{r.files++},GEe=(t,e)=>{e.push(t)},ZEe=()=>{};WEe=t=>t,KEe=()=>[""].slice(0,0);YEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},XEe=()=>{};eAe=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()&&OJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},tAe=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()&&OJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};iAe=t=>t.counts,oAe=t=>t.groups,sAe=t=>t.paths,aAe=t=>t.paths.slice(0,t.options.maxFiles),cAe=(t,e,r)=>(Rv(e,r,t.counts,t.options.suppressErrors),null),lAe=(t,e,r)=>(Rv(e,r,t.paths,t.options.suppressErrors),null),uAe=(t,e,r)=>(Rv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),dAe=(t,e,r)=>(Rv(e,r,t.groups,t.options.suppressErrors),null);RJ={withFileTypes:!0},pAe=(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||".",RJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},mAe=(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||".",RJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};gAe=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))}},yAe=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}},_Ae=class{aborted=!1;abort(){this.aborted=!0}},IJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=fAe(e,this.isSynchronous),this.root=EP(t,e),this.state={root:IEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new yAe,options:e,queue:new gAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new _Ae,fs:e.fs||AEe},this.joinPath=NEe(this.root,e),this.pushDirectory=UEe(this.root,e),this.pushFile=VEe(e),this.getArray=JEe(e),this.groupFiles=QEe(e),this.resolveSymlink=rAe(e,this.isSynchronous),this.walkDirectory=hAe(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(_=EP(_,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=xEe(_),x=EP(AP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};kJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return bAe(this.root,this.options)}withCallback(t){PJ(this.root,this.options,t)}sync(){return vAe(this.root,this.options)}},CJ=null;try{$J.resolve("picomatch"),CJ=$J("picomatch")}catch{}DJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:EJ,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 kJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new kJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||CJ;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 fp=v((Iut,zJ)=>{"use strict";var jJ="[^\\\\/]",SAe="(?=.)",MJ="[^/]",TP="(?:\\/|$)",FJ="(?:^|\\/)",OP=`\\.{1,2}${TP}`,wAe="(?!\\.)",xAe=`(?!${FJ}${OP})`,$Ae=`(?!\\.{0,1}${TP})`,kAe=`(?!${OP})`,EAe="[^.\\/]",AAe=`${MJ}*?`,TAe="/",LJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:SAe,QMARK:MJ,END_ANCHOR:TP,DOTS_SLASH:OP,NO_DOT:wAe,NO_DOTS:xAe,NO_DOT_SLASH:$Ae,NO_DOTS_SLASH:kAe,QMARK_NO_DOT:EAe,STAR:AAe,START_ANCHOR:FJ,SEP:TAe},OAe={...LJ,SLASH_LITERAL:"[\\\\/]",QMARK:jJ,STAR:`${jJ}*?`,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:"\\"},RAe={__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"};zJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:RAe,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?OAe:LJ}}});var pp=v(Fr=>{"use strict";var{REGEX_BACKSLASH:IAe,REGEX_REMOVE_BACKSLASH:PAe,REGEX_SPECIAL_CHARS:CAe,REGEX_SPECIAL_CHARS_GLOBAL:DAe}=fp();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>CAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(DAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(IAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(PAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var WJ=v((Cut,VJ)=>{"use strict";var UJ=pp(),{CHAR_ASTERISK:RP,CHAR_AT:NAe,CHAR_BACKWARD_SLASH:mp,CHAR_COMMA:jAe,CHAR_DOT:IP,CHAR_EXCLAMATION_MARK:PP,CHAR_FORWARD_SLASH:ZJ,CHAR_LEFT_CURLY_BRACE:CP,CHAR_LEFT_PARENTHESES:DP,CHAR_LEFT_SQUARE_BRACKET:MAe,CHAR_PLUS:FAe,CHAR_QUESTION_MARK:qJ,CHAR_RIGHT_CURLY_BRACE:LAe,CHAR_RIGHT_PARENTHESES:BJ,CHAR_RIGHT_SQUARE_BRACKET:zAe}=fp(),HJ=t=>t===ZJ||t===mp,GJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},UAe=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,ie=()=>c.charCodeAt(l+1),J=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),Oe&&m===!0&&d>0?(Oe=c.slice(0,d),P=c.slice(d)):m===!0?(Oe="",P=c):Oe=c,Oe&&Oe!==""&&Oe!=="/"&&Oe!==c&&HJ(Oe.charCodeAt(Oe.length-1))&&(Oe=Oe.slice(0,-1)),r.unescape===!0&&(P&&(P=UJ.removeBackslashes(P)),Oe&&_===!0&&(Oe=UJ.removeBackslashes(Oe)));let Ir={prefix:C,input:t,start:u,base:Oe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,HJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Pe=0;Pe{"use strict";var hp=fp(),sn=pp(),{MAX_LENGTH:Iv,POSIX_REGEX_SOURCE:qAe,REGEX_NON_SPECIAL_CHARS:BAe,REGEX_SPECIAL_CHARS_BACKREF:HAe,REPLACEMENTS:KJ}=hp,GAe=(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=>sn.escapeRegex(i)).join("..")}return r},jl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,JJ=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},ZAe=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},YJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(ZAe(e))return e.replace(/\\(.)/g,"$1")},VAe=t=>{let e=t.map(YJ).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}}}}},WAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=YJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},KAe=t=>{let e=0,r=t.trim(),n=NP(r);for(;n;)e++,r=n.body.trim(),n=NP(r);return e},JAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:hp.DEFAULT_MAX_EXTGLOB_RECURSION,n=JJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||VAe(n)))return{risky:!0};for(let i of n){let o=WAe(i);if(o)return{risky:!0,safeOutput:o};if(KAe(i)>r)return{risky:!0}}return{risky:!1}},jP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=KJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Iv,r.maxLength):Iv,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=hp.globChars(r.windows),l=hp.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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={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=sn.removePrefix(t,$),i=t.length;let ie=[],J=[],Oe=[],C=o,P,Ir=()=>$.index===i-1,se=$.peek=(B=1)=>t[$.index+B],Pe=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(B="",ht=0)=>{$.consumed+=B,$.index+=ht},Yt=B=>{$.output+=B.output!=null?B.output:B.value,dr(B.value)},ao=()=>{let B=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Pe(),$.start++,B++;return B%2===0?!1:($.negated=!0,$.start++,!0)},vi=B=>{$[B]++,Oe.push(B)},Yr=B=>{$[B]--,Oe.pop()},de=B=>{if(C.type==="globstar"){let ht=$.braces>0&&(B.type==="comma"||B.type==="brace"),q=B.extglob===!0||ie.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ht&&!q&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(ie.length&&B.type!=="paren"&&(ie[ie.length-1].inner+=B.value),(B.value||B.output)&&Yt(B),C&&C.type==="text"&&B.type==="text"){C.output=(C.output||C.value)+B.value,C.value+=B.value;return}B.prev=C,s.push(B),C=B},co=(B,ht)=>{let q={...l[ht],conditions:1,inner:""};q.prev=C,q.parens=$.parens,q.output=$.output,q.startIndex=$.index,q.tokensIndex=s.length;let Ae=(r.capture?"(":"")+q.open;vi("parens"),de({type:B,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Pe(),output:Ae}),ie.push(q)},Tde=B=>{let ht=t.slice(B.startIndex,$.index+1),q=t.slice(B.startIndex+2,$.index),Ae=JAe(q,r);if((B.type==="plus"||B.type==="star")&&Ae.risky){let lt=Ae.safeOutput?(B.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,Si=s[B.tokensIndex];Si.type="text",Si.value=ht,Si.output=lt||sn.escapeRegex(ht);for(let wi=B.tokensIndex+1;wi1&&B.inner.includes("/")&&(lt=O(r)),(lt!==D||Ir()||/^\)+$/.test(Kt()))&&(ut=B.close=`)$))${lt}`),B.inner.includes("*")&&(Lt=Kt())&&/^\.[^\\/.]+$/.test(Lt)){let Si=jP(Lt,{...e,fastpaths:!1}).output;ut=B.close=`)${Si})${lt})`}B.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ht=t.replace(HAe,(q,Ae,ut,Lt,lt,Si)=>Lt==="\\"?(B=!0,q):Lt==="?"?Ae?Ae+Lt+(lt?_.repeat(lt.length):""):Si===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):Lt==="."?u.repeat(ut.length):Lt==="*"?Ae?Ae+Lt+(lt?D:""):D:Ae?q:`\\${q}`);return B===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=sn.wrapOutput(ht,$,e),$)}for(;!Ir();){if(P=Pe(),P==="\0")continue;if(P==="\\"){let q=se();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){P+="\\",de({type:"text",value:P});continue}let Ae=/^\\+/.exec(Kt()),ut=0;if(Ae&&Ae[0].length>2&&(ut=Ae[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Pe():P+=Pe(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let q=C.value.slice(1);if(q.includes("[")&&(C.posix=!0,q.includes(":"))){let Ae=C.value.lastIndexOf("["),ut=C.value.slice(0,Ae),Lt=C.value.slice(Ae+2),lt=qAe[Lt];if(lt){C.value=ut+lt,$.backtrack=!0,Pe(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Yt({value:P});continue}if($.quotes===1&&P!=='"'){P=sn.escapeRegex(P),C.value+=P,Yt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){vi("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(jl("opening","("));let q=ie[ie.length-1];if(q&&$.parens===q.parens+1){Tde(ie.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Yr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(jl("closing","]"));P=`\\${P}`}else vi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(jl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Yr("brackets");let q=C.value.slice(1);if(C.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(P=`/${P}`),C.value+=P,Yt({value:P}),r.literalBrackets===!1||sn.hasRegexChars(q))continue;let Ae=sn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Ae,C.value=Ae;continue}C.value=`(${a}${Ae}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){vi("braces");let q={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};J.push(q),de(q);continue}if(P==="}"){let q=J[J.length-1];if(r.nobrace===!0||!q){de({type:"text",value:P,output:P});continue}let Ae=")";if(q.dots===!0){let ut=s.slice(),Lt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&Lt.unshift(ut[lt].value);Ae=GAe(Lt,r),$.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let ut=$.output.slice(0,q.outputIndex),Lt=$.tokens.slice(q.tokensIndex);q.value=q.output="\\{",P=Ae="\\}",$.output=ut;for(let lt of Lt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Ae}),Yr("braces"),J.pop();continue}if(P==="|"){ie.length>0&&ie[ie.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let q=P,Ae=J[J.length-1];Ae&&Oe[Oe.length-1]==="braces"&&(Ae.comma=!0,q="|"),de({type:"comma",value:P,output:q});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let q=J[J.length-1];C.type="dots",C.output+=P,C.value+=P,q.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){co("qmark",P);continue}if(C&&C.type==="paren"){let Ae=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){co("negate",P);continue}if(r.nonegate!==!0&&$.index===0){ao();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){co("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let q=BAe.exec(Kt());q&&(P+=q[0],$.index+=q[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let B=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){co("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let q=C.prev,Ae=q.prev,ut=q.type==="slash"||q.type==="bos",Lt=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!ut||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(q.type==="comma"||q.type==="brace"),Si=ie.length&&(q.type==="pipe"||q.type==="paren");if(!ut&&q.type!=="paren"&&!lt&&!Si){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let wi=t[$.index+4];if(wi&&wi!=="/")break;B=B.slice(3),dr("/**",3)}if(q.type==="bos"&&Ir()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!Lt&&Ir()){$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=q.output+C.output,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&B[0]==="/"){let wi=B[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${wi})`,C.value+=P,$.output+=q.output+C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&B[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Pe()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(jl("closing","]"));$.output=sn.escapeLast($.output,"["),Yr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(jl("closing",")"));$.output=sn.escapeLast($.output,"("),Yr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(jl("closing","}"));$.output=sn.escapeLast($.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let B of $.tokens)$.output+=B.output!=null?B.output:B.value,B.suffix&&($.output+=B.suffix)}return $};jP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Iv,r.maxLength):Iv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=KJ[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}=hp.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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};XJ.exports=jP});var r8=v((Nut,t8)=>{"use strict";var YAe=WJ(),MP=QJ(),e8=pp(),XAe=fp(),QAe=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=QAe(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?e8.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)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(e8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):MP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>YAe(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=MP.fastpaths(t,e)),i.output||(i=MP(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=XAe;t8.exports=Rt});var s8=v((jut,o8)=>{"use strict";var n8=r8(),eTe=pp();function i8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:eTe.isWindows()}),n8(t,e,r)}Object.assign(i8,n8);o8.exports=i8});import{readdir as tTe,readdirSync as rTe,realpath as nTe,realpathSync as iTe,stat as oTe,statSync as sTe}from"fs";import{isAbsolute as aTe,posix as qa,resolve as cTe}from"path";import{fileURLToPath as lTe}from"url";function fTe(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]===".."&&dTe.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=>qa.relative(t,n)||".":n=>qa.relative(t,`${e}/${n}`)||"."}function hTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=qa.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function u8(t){var e;let r=Ml.default.scan(t,gTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function wTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Ml.default.scan(t);return r.isGlob||r.negated}function gp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function d8(t){return typeof t=="string"?[t]:t??[]}function FP(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=STe(o);s=aTe(s.replace($Te,""))?qa.relative(a,s):qa.normalize(s);let c=(i=xTe.exec(s))===null||i===void 0?void 0:i[0],l=u8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?qa.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(FP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(FP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(FP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function ETe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=kTe(t,e,n);t.debug&&gp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(c8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Ml.default)(i.match,f),m=(0,Ml.default)(i.ignore,f),h=fTe(i.match,f),g=a8(r,d,o),b=o?g:a8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new DJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&gp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return gp(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&gp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&hTe(r,d)]}function ATe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function OTe(t){let e={...TTe,...t};return e.cwd=(e.cwd instanceof URL?lTe(e.cwd):cTe(e.cwd)).replace(c8,"/"),e.ignore=d8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||tTe,readdirSync:e.fs.readdirSync||rTe,realpath:e.fs.realpath||nTe,realpathSync:e.fs.realpathSync||iTe,stat:e.fs.stat||oTe,statSync:e.fs.statSync||sTe}),e.debug&&gp("globbing with options:",e),e}function RTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=uTe(t)||typeof t=="string",i=d8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=OTe(n?e:t);return i.length>0?ETe(o,i):[]}function gs(t,e){let[r,n]=RTe(t,e);return r?ATe(r.sync(),n):[]}var Ml,uTe,c8,l8,dTe,pTe,mTe,gTe,yTe,_Te,bTe,vTe,STe,xTe,$Te,TTe,yp=y(()=>{NJ();Ml=St(s8(),1),uTe=Array.isArray,c8=/\\/g,l8=process.platform==="win32",dTe=/^(\/?\.\.)+$/;pTe=/^[A-Z]:\/$/i,mTe=l8?t=>pTe.test(t):t=>t==="/";gTe={parts:!0};yTe=/(?t.replace(yTe,"\\$&"),vTe=t=>t.replace(_Te,"\\$&"),STe=l8?vTe:bTe;xTe=/^(\/?\.\.)+/,$Te=/\\(?=[()[\]{}!*+?@|])/g;TTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as _p,readFileSync as ITe,readdirSync as PTe,statSync as f8}from"node:fs";import{join as Ba}from"node:path";function CTe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=Di(e,n),o=[],{layers:s,forbiddenImports:a}=LP(r);return(s.size>0||a.length>0)&&!_p(Ba(e,i.mainRoot))?[{detector:bp,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&&(DTe(e,i,s,o),NTe(e,i,s,o)),a.length>0&&jTe(e,i,a,o),o)}function LP(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 DTe(t,e,r,n){let i=e.mainRoot,o=Ba(t,i);if(_p(o))for(let s of PTe(o)){let a=Ba(o,s);f8(a).isDirectory()&&(r.has(s)||n.push({detector:bp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function NTe(t,e,r,n){let i=e.mainRoot,o=Ba(t,i);if(_p(o))for(let s of r){let a=Ba(o,s);_p(a)&&f8(a).isDirectory()||n.push({detector:bp,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 jTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ba(t,i,s.from);if(!_p(a))continue;let c=gs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ba(a,l),d;try{d=ITe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];MTe(p,s.to,e.importStyle)&&n.push({detector:bp,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 MTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var bp,p8,zP=y(()=>{"use strict";yp();qe();Ua();bp="ARCHITECTURE_FROM_SPEC";p8={name:bp,run:CTe}});import{existsSync as FTe,readFileSync as LTe}from"node:fs";import{join as zTe}from"node:path";function qTe(t){let{cwd:e="."}=t,r=zTe(e,"spec/capabilities.yaml");if(!FTe(r))return[];let n;try{let u=LTe(r,"utf8"),d=m8.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=H(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";m8=St(Qt(),1);qe();Pv="CAPABILITIES_FEATURE_MAPPING",UTe=8;h8={name:Pv,run:qTe}});import{existsSync as BTe,readFileSync as HTe}from"node:fs";import{join as GTe}from"node:path";function ZTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function VTe(t){let{cwd:e="."}=t;return he(e,UP,r=>WTe(r,e))}function WTe(t,e){let r=Di(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=GTe(e,o);if(!BTe(s))continue;let a=HTe(s,"utf8");ZTe(a)||n.push({detector:UP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var UP,y8,_8=y(()=>{"use strict";Ua();wt();UP="CONVENTION_DRIFT";y8={name:UP,run:VTe}});import{existsSync as qP,readFileSync as b8}from"node:fs";import{join as Cv}from"node:path";function KTe(t){return JSON.parse(t).total?.lines?.pct??0}function v8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function XTe(t,e){if(!yv(dt(t).gates.coverage?.cmd))return null;let r;try{r=_v(t,e)}catch(c){return[{detector:wo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=bP.find(d=>qP(Cv(c.dir,d)));if(!l){s.push(c.path);continue}let u=v8(b8(Cv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:wo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=S8(n,i);return a0?[{detector:wo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function QTe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=XTe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=Di(e,r),i=dt(e).language==="kotlin"?bP.find(a=>qP(Cv(e,a)))??rJ(e):n.coverageSummary,o=Cv(e,i);if(!qP(o))return[{detector:wo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=b8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?JTe(a):n.coverageFormat==="cobertura-xml"?YTe(a):KTe(a)}catch(a){return[{detector:wo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:wo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Dv?[]:[{detector:wo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Dv}%`}]}var wo,Dv,w8,x8=y(()=>{"use strict";qe();Sv();Ua();bv();on();wo="COVERAGE_DROP",Dv=70;w8={name:wo,run:QTe}});import{existsSync as eOe}from"node:fs";import{join as tOe}from"node:path";function nOe(t){let{cwd:e="."}=t;return he(e,Nv,r=>iOe(r,e))}function iOe(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";wt();Nv="DELIVERABLE_INTEGRITY",rOe=8;$8={name:Nv,run:nOe}});function oOe(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:jv,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 sOe(t){let e=oOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:jv,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 aOe(t){let{cwd:e="."}=t;return he(e,jv,r=>sOe(r))}var jv,E8,A8=y(()=>{"use strict";wt();jv="SMOKE_PROBE_DEMAND";E8={name:jv,run:aOe}});function cOe(t){let{cwd:e="."}=t;return he(e,Mv,r=>lOe(r,e))}function lOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ss(e);if(n===null)return[{detector:Mv,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=M_(n,e,o);s.state!=="fresh"&&i.push({detector:Mv,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 Mv,Fv,BP=y(()=>{"use strict";fl();wt();Mv="STALE_ATTESTATION";Fv={name:Mv,run:cOe}});function uOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return dOe(r)}function dOe(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:T8,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 T8,Lv,HP=y(()=>{"use strict";qe();T8="DEPENDENCY_CYCLE";Lv={name:T8,run:uOe}});import{appendFileSync as fOe,existsSync as O8,mkdirSync as pOe,readFileSync as mOe}from"node:fs";import{dirname as hOe,join as gOe}from"node:path";function R8(t){return gOe(t,yOe,_Oe)}function I8(t){return GP.add(t),()=>GP.delete(t)}function Ha(t,e){let r=R8(t),n=hOe(r);O8(n)||pOe(n,{recursive:!0}),fOe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of GP)try{i(t,e)}catch{}}function Rn(t){let e=R8(t);if(!O8(e))return[];let r=mOe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var yOe,_Oe,GP,ti=y(()=>{"use strict";yOe=".cladding",_Oe="audit.log.jsonl";GP=new Set});import{existsSync as bOe}from"node:fs";import{join as vOe}from"node:path";function SOe(t){let{cwd:e="."}=t,r=Rn(e);if(r.length===0)return[{detector:ZP,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&&(bOe(vOe(e,i.artifact))||n.push({detector:ZP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var ZP,P8,C8=y(()=>{"use strict";ti();ZP="EVIDENCE_MISMATCH";P8={name:ZP,run:SOe}});import{existsSync as wOe,readFileSync as xOe}from"node:fs";import{join as $Oe}from"node:path";function kOe(t){let e=$Oe(t,M8);if(!wOe(e))return null;try{let n=((0,j8.parse)(xOe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*N8(t,e){for(let r of t??[])r.startsWith(D8)&&(yield{ref:r,name:r.slice(D8.length),field:e})}function EOe(t){let{cwd:e="."}=t,r=kOe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:VP,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=[...N8(s.evidence_refs,"evidence_refs"),...N8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:VP,severity:"warn",path:M8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var j8,VP,D8,M8,F8,L8=y(()=>{"use strict";j8=St(Qt(),1);qe();VP="FIXTURE_REFERENCE_INVALID",D8="fixture:",M8="conformance/fixtures.yaml";F8={name:VP,run:EOe}});import{existsSync as Fl,readFileSync as WP}from"node:fs";import{join as Ga}from"node:path";function AOe(t){return gs(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function vp(t){if(!Fl(t))return null;try{return JSON.parse(WP(t,"utf8"))}catch{return null}}function TOe(t,e){let r=Ga(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(WP(r,"utf8"))}catch(c){e.push({detector:xo,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:xo,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=AOe(t);s!==a&&e.push({detector:xo,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function OOe(t,e){for(let r of z8){let n=Ga(t,r.path);if(!Fl(n))continue;let i=vp(n);if(!i){e.push({detector:xo,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:xo,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function ROe(t,e){let r=vp(Ga(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of z8){let s=Ga(t,o.path);if(!Fl(s))continue;let a=vp(s);a?.version&&a.version!==n&&e.push({detector:xo,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ga(t,".claude-plugin","marketplace.json");if(Fl(i)){let o=vp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:xo,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 IOe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function POe(t,e){let r=Ga(t,"src","cli","clad.ts"),n=Ga(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Fl(r)||!Fl(n))return;let i=IOe(WP(r,"utf8"));if(i.length===0)return;let s=vp(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:xo,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 COe(t){let{cwd:e="."}=t,r=[];return TOe(e,r),POe(e,r),OOe(e,r),ROe(e,r),r}var xo,z8,U8,q8=y(()=>{"use strict";yp();xo="HARNESS_INTEGRITY",z8=[{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"]}];U8={name:xo,run:COe}});import{existsSync as DOe,readFileSync as NOe}from"node:fs";import{join as jOe}from"node:path";function FOe(t){let{cwd:e="."}=t;return he(e,zv,r=>zOe(r,e))}function LOe(t){let e=jOe(t,"spec/capabilities.yaml");if(!DOe(e))return!1;try{let r=B8.default.parse(NOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function zOe(t,e){let r=t.features.length;if(r{"use strict";B8=St(Qt(),1);wt();zv="HOLLOW_GOVERNANCE",MOe=8;H8={name:zv,run:FOe}});import{existsSync as Z8,readFileSync as V8}from"node:fs";import{join as W8}from"node:path";function K8(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 BOe(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 HOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function GOe(t){let e=W8(t,"README.md"),r=W8(t,"docs","dogfood","matrix.md");if(!Z8(e)||!Z8(r))return[];let n=K8(V8(e,"utf8"),UOe),i=K8(V8(r,"utf8"),qOe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=HOe(a);if(c===null)continue;let l=i[s]??"not-run",u=BOe(l);u!==null&&c>u&&o.push({detector:J8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function ZOe(t){let{cwd:e="."}=t;return GOe(e)}var J8,UOe,qOe,Y8,X8=y(()=>{"use strict";J8="HOST_CLAIM_DRIFT",UOe=//,qOe=//;Y8={name:J8,run:ZOe}});function VOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return Q8(r.features.map(i=>i.id),"feature","spec/features/",n),Q8((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function Q8(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:e5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var e5,t5,r5=y(()=>{"use strict";qe();e5="ID_COLLISION";t5={name:e5,run:VOe}});import{existsSync as Sp,readFileSync as KP,readdirSync as JP,statSync as WOe,writeFileSync as i5}from"node:fs";import{join as $o}from"node:path";function n5(t){if(!Sp(t))return 0;try{return JP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function KOe(t){if(!Sp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=JP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=$o(n,o),a;try{a=WOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function JOe(t){let e=$o(t,"spec","capabilities.yaml");if(!Sp(e))return 0;try{let r=Uv.default.parse(KP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function ys(t="."){let e=n5($o(t,"spec","features")),r=n5($o(t,"spec","scenarios")),n=JOe(t),i=KOe($o(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Ll(t,e){let r=$o(t,"spec.yaml");if(!Sp(r))return;let n=KP(r,"utf8"),i=YOe(n,e);i!==n&&i5(r,i)}function YOe(t,e){let r=t.includes(`\r + if (condition) { yield value; }`)}});import{Buffer as Cxe}from"node:buffer";import{StringDecoder as Dxe}from"node:string_decoder";var Qb,Nxe,jxe,Mxe,gI=y(()=>{rn();Qb=(t,e,r)=>{if(r)return;if(t)return{transform:Nxe.bind(void 0,new TextEncoder)};let n=new Dxe(e);return{transform:jxe.bind(void 0,n),final:Mxe.bind(void 0,n)}},Nxe=function*(t,e){Cxe.isBuffer(e)?yield yo(e):typeof e=="string"?yield t.encode(e):yield e},jxe=function*(t,e){yield Ut(e)?t.write(e):e},Mxe=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as GW}from"node:util";var yI,ev,ZW,Fxe,VW,Lxe,WW=y(()=>{yI=GW(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),ev=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Lxe}=e[r];for await(let i of n(t))yield*ev(i,e,r+1)},ZW=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*Fxe(r,Number(e),t)},Fxe=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*ev(n,r,e+1)},VW=GW(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),Lxe=function*(t){yield t}});var _I,KW,Ma,op,zxe,Uxe,bI=y(()=>{_I=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},KW=(t,e)=>[...e.flatMap(r=>[...Ma(r,t,0)]),...op(t)],Ma=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Uxe}=e[r];for(let i of n(t))yield*Ma(i,e,r+1)},op=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*zxe(r,Number(e),t)},zxe=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ma(n,r,e+1)},Uxe=function*(t){yield t}});import{Transform as qxe,getDefaultHighWaterMark as JW}from"node:stream";var vI,tv,YW,rv=y(()=>{vr();Xb();HW();gI();WW();bI();vI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=YW(t,s,o),l=ja(e),u=ja(r),d=l?yI.bind(void 0,ev,a):_I.bind(void 0,Ma),f=l||u?yI.bind(void 0,ZW,a):_I.bind(void 0,op),p=l||u?VW.bind(void 0,a):void 0;return{stream:new qxe({writableObjectMode:n,writableHighWaterMark:JW(n),readableObjectMode:i,readableHighWaterMark:JW(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},tv=(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=YW(s,r,a);t=KW(c,t)}return t},YW=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:UW(n,a)},Qb(r,s,n),Yb(r,o,n,c),{transform:t,final:e},{transform:qW(i,a)},zW({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var XW,Bxe,Hxe,Gxe,Zxe,QW=y(()=>{rv();rn();vr();XW=(t,e)=>{for(let r of Bxe(t))Hxe(t,r,e)},Bxe=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),Hxe=(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 ${ps[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>Gxe(a,n));r.input=Bf(s)},Gxe=(t,e)=>{let r=tv(t,e,"utf8",!0);return Zxe(r),Bf(r)},Zxe=t=>{let e=t.find(r=>typeof r!="string"&&!Ut(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 nv,Vxe,Wxe,e3,t3,Kxe,r3,SI=y(()=>{Pa();vr();wl();ls();nv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Sl(r,n)&&!nn.has(e)&&Vxe(n)&&(t.some(({type:i,value:o})=>i==="native"&&Wxe.has(o))||t.every(({type:i})=>Tn.has(i))),Vxe=t=>t===1||t===2,Wxe=new Set(["pipe","overlapped"]),e3=async(t,e,r,n)=>{for await(let i of t)Kxe(e)||r3(i,r,n)},t3=(t,e,r)=>{for(let n of t)r3(n,e,r)},Kxe=t=>t._readableState.pipes.length>0,r3=(t,e,r)=>{let n=rb(t);Ri({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as Jxe,appendFileSync as Yxe}from"node:fs";var n3,Xxe,Qxe,e0e,t0e,r0e,i3=y(()=>{SI();rv();Xb();rn();vr();Na();n3=({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)=>Xxe({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Xxe=({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=qV(t,o,d),p=yo(f),{stdioItems:m,objectMode:h}=e[r],g=Qxe([p],m,c,n),{serializedResult:b,finalResult:_=b}=e0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});t0e({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&&r0e(b,m,i),S}catch(x){return n.error=x,S}},Qxe=(t,e,r,n)=>{try{return tv(t,e,r,!1)}catch(i){return n.error=i,t}},e0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Bf(t)};let s=PG(t,r);return n[o]?{serializedResult:s,finalResult:hI(s,!i[o],e)}:{serializedResult:s}},t0e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!nv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=hI(t,!1,s);try{t3(a,e,n)}catch(c){r.error??=c}},r0e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Wb.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?Yxe(n,t):(r.add(o),Jxe(n,t))}}});var o3,s3=y(()=>{rn();ip();o3=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,wo(e,r,"all")]:Array.isArray(e)?[wo(t,r,"all"),...e]:Ut(t)&&Ut(e)?uR([t,e]):`${t}${e}`}});import{once as wI}from"node:events";var a3,n0e,c3,l3,i0e,xI,$I=y(()=>{Ra();a3=async(t,e)=>{let[r,n]=await n0e(t);return e.isForcefullyTerminated??=!1,[r,n]},n0e=async t=>{let[e,r]=await Promise.allSettled([wI(t,"spawn"),wI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?c3(t):r.value},c3=async t=>{try{return await wI(t,"exit")}catch{return c3(t)}},l3=async t=>{let[e,r]=await t;if(!i0e(e,r)&&xI(e,r))throw new Qn;return[e,r]},i0e=(t,e)=>t===void 0&&e===void 0,xI=(t,e)=>t!==0||e!==null});var u3,o0e,d3=y(()=>{Ra();Na();$I();u3=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=o0e(t,e,r),s=o?.code==="ETIMEDOUT",a=UV(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},o0e=(t,e,r)=>t!==void 0?t:xI(e,r)?new Qn:void 0});import{spawnSync as s0e}from"node:child_process";var f3,a0e,c0e,l0e,iv,u0e,d0e,f0e,p0e,p3=y(()=>{bR();VR();WR();np();Gb();MW();ip();QW();i3();Na();s3();d3();f3=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=a0e(t,e,r),d=u0e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Cl(d,c,l)},a0e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ob(t,e,r),a=c0e(r),{file:c,commandArguments:l,options:u}=Pb(t,e,a);l0e(u);let d=NW(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},c0e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,l0e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&iv("ipcInput"),t&&iv("ipc: true"),r&&iv("detached: true"),n&&iv("cancelSignal")},iv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},u0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=d0e({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}=u3(c,r),{output:m,error:h=l}=n3({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>wo(_,r,S)),b=wo(o3(m,r),r,"all");return p0e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},d0e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{XW(o,r);let a=f0e(r);return s0e(...Cb(t,e,a))}catch(a){return Pl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},f0e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Bb(e)}),p0e=({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?Hb({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):rp({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 kI,on as m0e}from"node:events";var m3,h0e,g0e,y0e,_0e,h3=y(()=>{Al();Yf();Jf();m3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(kl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:kb(t)}),h0e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),h0e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{_b(e,i);let o=fs(t,e,r),s=new AbortController;try{return await Promise.race([g0e(o,n,s),y0e(o,r,s),_0e(o,r,s)])}catch(a){throw El(t),a}finally{s.abort(),bb(e,i)}},g0e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await kI(t,"message",{signal:r});return n}for await(let[n]of m0e(t,"message",{signal:r}))if(e(n))return n},y0e=async(t,e,{signal:r})=>{await kI(t,"disconnect",{signal:r}),E9(e)},_0e=async(t,e,{signal:r})=>{let[n]=await kI(t,"strict:error",{signal:r});throw mb(n,e)}});import{once as y3,on as b0e}from"node:events";var _3,EI,v0e,S0e,w0e,g3,AI=y(()=>{Al();Yf();Jf();_3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>EI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),EI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{kl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:kb(t)}),_b(e,o);let s=fs(t,e,r),a=new AbortController,c={};return v0e(t,s,a),S0e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),w0e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},v0e=async(t,e,r)=>{try{await y3(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},S0e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await y3(t,"strict:error",{signal:r.signal});n.error=mb(i,e),r.abort()}catch{}},w0e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of b0e(r,"message",{signal:o.signal}))g3(s),yield c}catch{g3(s)}finally{o.abort(),bb(e,a),n||El(t),i&&await t}},g3=({error:t})=>{if(t)throw t}});import b3 from"node:process";var v3,S3,w3,TI=y(()=>{Rb();h3();AI();xb();v3=(t,{ipc:e})=>{Object.assign(t,w3(t,!1,e))},S3=()=>{let t=b3,e=!0,r=b3.channel!==void 0;return{...w3(t,e,r),getCancelSignal:eV.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},w3=(t,e,r)=>({sendMessage:Ob.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:m3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:_3.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as x0e}from"node:child_process";import{PassThrough as $0e,Readable as k0e,Writable as E0e,Duplex as A0e}from"node:stream";var x3,T0e,sp,O0e,R0e,I0e,P0e,$3=y(()=>{Jb();np();Gb();x3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{fI(n);let a=new x0e;T0e(a,n),Object.assign(a,{readable:O0e,writable:R0e,duplex:I0e});let c=Pl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=P0e(c,s,i);return{subprocess:a,promise:l}},T0e=(t,e)=>{let r=sp(),n=sp(),i=sp(),o=Array.from({length:e.length-3},sp),s=sp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},sp=()=>{let t=new $0e;return t.end(),t},O0e=()=>new k0e({read(){}}),R0e=()=>new E0e({write(){}}),I0e=()=>new A0e({read(){},write(){}}),P0e=async(t,e,r)=>Cl(t,e,r)});import{createReadStream as k3,createWriteStream as E3}from"node:fs";import{Buffer as C0e}from"node:buffer";import{Readable as ap,Writable as D0e,Duplex as N0e}from"node:stream";var T3,cp,A3,j0e,O3=y(()=>{rv();Jb();vr();T3=(t,e)=>Kb(j0e,t,e,!1),cp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ps[t]}.`)},A3={fileNumber:cp,generator:vI,asyncGenerator:vI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:N0e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},j0e={input:{...A3,fileUrl:({value:t})=>({stream:k3(t)}),filePath:({value:{file:t}})=>({stream:k3(t)}),webStream:({value:t})=>({stream:ap.fromWeb(t)}),iterable:({value:t})=>({stream:ap.from(t)}),asyncIterable:({value:t})=>({stream:ap.from(t)}),string:({value:t})=>({stream:ap.from(t)}),uint8Array:({value:t})=>({stream:ap.from(C0e.from(t))})},output:{...A3,fileUrl:({value:t})=>({stream:E3(t)}),filePath:({value:{file:t,append:e}})=>({stream:E3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:D0e.fromWeb(t)}),iterable:cp,asyncIterable:cp,string:cp,uint8Array:cp}}});import{on as M0e,once as R3}from"node:events";import{PassThrough as F0e,getDefaultHighWaterMark as L0e}from"node:stream";import{finished as C3}from"node:stream/promises";function Fa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)RI(i);let e=t.some(({readableObjectMode:i})=>i),r=z0e(t,e),n=new OI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var z0e,OI,U0e,q0e,B0e,RI,H0e,G0e,Z0e,V0e,W0e,D3,N3,II,j3,K0e,ov,I3,P3,sv=y(()=>{z0e=(t,e)=>{if(t.length===0)return L0e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},OI=class extends F0e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(RI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=U0e(this,this.#t,this.#o);let r=H0e({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(RI(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)}},U0e=async(t,e,r)=>{ov(t,I3);let n=new AbortController;try{await Promise.race([q0e(t,n),B0e(t,e,r,n)])}finally{n.abort(),ov(t,-I3)}},q0e=async(t,{signal:e})=>{try{await C3(t,{signal:e,cleanup:!0})}catch(r){throw D3(t,r),r}},B0e=async(t,e,r,{signal:n})=>{for await(let[i]of M0e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},RI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},H0e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{ov(t,P3);let a=new AbortController;try{await Promise.race([G0e(o,e,a),Z0e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),V0e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),ov(t,-P3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?II(t):W0e(t))},G0e=async(t,e,{signal:r})=>{try{await t,r.aborted||II(e)}catch(n){r.aborted||D3(e,n)}},Z0e=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;N3(s)?i.add(e):j3(t,s)}},V0e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await R3(t,i,{signal:o}),!t.readable)return R3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},W0e=t=>{t.writable&&t.end()},D3=(t,e)=>{N3(e)?II(t):j3(t,e)},N3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",II=t=>{(t.readable||t.writable)&&t.destroy()},j3=(t,e)=>{t.destroyed||(t.once("error",K0e),t.destroy(e))},K0e=()=>{},ov=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},I3=2,P3=1});import{finished as M3}from"node:stream/promises";var Nl,J0e,PI,Y0e,CI,av=y(()=>{_o();Nl=(t,e)=>{t.pipe(e),J0e(t,e),Y0e(t,e)},J0e=async(t,e)=>{if(!(Xn(t)||Xn(e))){try{await M3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}PI(e)}},PI=t=>{t.writable&&t.end()},Y0e=async(t,e)=>{if(!(Xn(t)||Xn(e))){try{await M3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}CI(t)}},CI=t=>{t.readable&&t.destroy()}});var F3,X0e,Q0e,e$e,t$e,r$e,L3=y(()=>{sv();_o();yb();vr();av();F3=(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})=>Tn.has(c)))X0e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Tn.has(c)))e$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]:Fa(o);Nl(s,i)}},X0e=(t,e,r,n)=>{r==="output"?Nl(t.stdio[n],e):Nl(e,t.stdio[n]);let i=Q0e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Q0e=["stdin","stdout","stderr"],e$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;t$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])},t$e=(t,{signal:e})=>{Xn(t)&&Ia(t,r$e,e)},r$e=2});var La,z3=y(()=>{La=[];La.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&La.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&La.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var cv,DI,NI,n$e,jI,lv,i$e,MI,FI,LI,U3,Nst,jst,q3=y(()=>{z3();cv=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",DI=Symbol.for("signal-exit emitter"),NI=globalThis,n$e=Object.defineProperty.bind(Object),jI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(NI[DI])return NI[DI];n$e(NI,DI,{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}},lv=class{},i$e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),MI=class extends lv{onExit(){return()=>{}}load(){}unload(){}},FI=class extends lv{#t=LI.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 La)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(!cv(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 La)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,La.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 cv(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"&&cv(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)}},LI=globalThis.process,{onExit:U3,load:Nst,unload:jst}=i$e(cv(LI)?new FI(LI):new MI)});import{addAbortListener as o$e}from"node:events";var B3,H3=y(()=>{q3();B3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=U3(()=>{t.kill()});o$e(n,()=>{i()})}});var Z3,s$e,a$e,G3,c$e,V3=y(()=>{lR();ib();ds();bl();Z3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=nb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=s$e(r,n,i),{sourceStream:d,sourceError:f}=c$e(t,l),{options:p,fileDescriptors:m}=Pi.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},s$e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=a$e(t,e,...r),a=gb(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},a$e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(G3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||aR(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]=Z_(r,...n);return{destination:e(G3)(i,o,s),pipeOptions:s}}if(Pi.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}`)},G3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),c$e=(t,e)=>{try{return{sourceStream:Ol(t,e)}}catch(r){return{sourceError:r}}}});var K3,l$e,zI,W3,UI=y(()=>{np();av();K3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=l$e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw zI({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},l$e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return CI(t),n;if(e!==void 0)return PI(r),e},zI=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Pl({error:t,command:W3,escapedCommand:W3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),W3="source.pipe(destination)"});var J3,Y3=y(()=>{J3=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 u$e}from"node:stream/promises";var X3,d$e,f$e,p$e,uv,m$e,h$e,Q3=y(()=>{sv();yb();av();X3=(t,e,r)=>{let n=uv.has(e)?f$e(t,e):d$e(t,e);return Ia(t,m$e,r.signal),Ia(e,h$e,r.signal),p$e(e),n},d$e=(t,e)=>{let r=Fa([t]);return Nl(r,e),uv.set(e,r),r},f$e=(t,e)=>{let r=uv.get(e);return r.add(t),r},p$e=async t=>{try{await u$e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}uv.delete(t)},uv=new WeakMap,m$e=2,h$e=1});import{aborted as g$e}from"node:util";var eK,y$e,tK=y(()=>{UI();eK=(t,e)=>t===void 0?[]:[y$e(t,e)],y$e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await g$e(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw zI({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var dv,_$e,b$e,rK=y(()=>{go();V3();UI();Y3();Q3();tK();dv=(t,...e)=>{if(Ot(e[0]))return dv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Z3(t,...e),i=_$e({...n,destination:r});return i.pipe=dv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},_$e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=b$e(t,i);K3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=X3(e,o,d);return await Promise.race([J3(u),...eK(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},b$e=(t,e)=>Promise.allSettled([t,e])});import{on as v$e}from"node:events";import{getDefaultHighWaterMark as S$e}from"node:stream";var fv,w$e,qI,x$e,iK,BI,nK,$$e,k$e,pv=y(()=>{gI();Xb();bI();fv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return w$e(e,s),iK({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},w$e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},qI=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;x$e(e,s,t);let a=t.readableObjectMode&&!o;return iK({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},x$e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},iK=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=v$e(t,"data",{signal:e.signal,highWaterMark:nK,highWatermark:nK});return $$e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},BI=S$e(!0),nK=BI,$$e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=k$e({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ma(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*op(a)}},k$e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Qb(t,r,!e),Yb(t,i,!n,{})].filter(Boolean)});import{setImmediate as E$e}from"node:timers/promises";var oK,A$e,T$e,O$e,HI,sK,GI=y(()=>{qb();rn();SI();pv();Na();ip();oK=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=A$e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([T$e(t),d]);return}let f=pI(c,r),p=qI({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([O$e({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},A$e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!nv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=qI({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await e3(a,t,r,o)},T$e=async t=>{await E$e(),t.readableFlowing===null&&t.resume()},O$e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Fb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Lb(r,{maxBuffer:o})):await Ub(r,{maxBuffer:o})}catch(a){return sK(FV({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},HI=async t=>{try{return await t}catch(e){return sK(e)}},sK=({bufferedData:t})=>RG(t)?new Uint8Array(t):t});import{finished as R$e}from"node:stream/promises";var lp,I$e,P$e,C$e,D$e,N$e,ZI,mv,aK,hv=y(()=>{lp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=I$e(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],R$e(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||D$e(a,e,r,n)}finally{s.abort()}},I$e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&P$e(t,r,n),n},P$e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{C$e(e,r),n.call(t,...i)}},C$e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},D$e=(t,e,r,n)=>{if(!N$e(t,e,r,n))throw t},N$e=(t,e,r,n=!0)=>r.propagating?aK(t)||mv(t):(r.propagating=!0,ZI(r,e)===n?aK(t):mv(t)),ZI=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",mv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",aK=t=>t?.code==="EPIPE"});var cK,VI,WI=y(()=>{GI();hv();cK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>VI({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),VI=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=lp(t,e,l);if(ZI(l,e)){await u;return}let[d]=await Promise.all([oK({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 lK,uK,j$e,M$e,KI=y(()=>{sv();WI();lK=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fa([t,e].filter(Boolean)):void 0,uK=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>VI({...j$e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:M$e(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),j$e=({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}},M$e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var dK,fK,pK=y(()=>{wl();ls();dK=t=>Sl(t,"ipc"),fK=(t,e)=>{let r=rb(t);Ri({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var mK,hK,gK=y(()=>{Na();pK();vo();AI();mK=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=dK(o),a=bo(e,"ipc"),c=bo(r,"ipc");for await(let l of EI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(LV(t,i,c),i.push(l)),s&&fK(l,o);return i},hK=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as F$e}from"node:events";var yK,L$e,z$e,U$e,_K=y(()=>{Da();qR();CR();UR();_o();vr();GI();gK();HR();KI();WI();$I();hv();yK=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 _=a3(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=cK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=uK({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),O=[],T=mK({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),A=L$e(h,t,S),D=z$e(m,S);try{return await Promise.race([Promise.all([{},l3(_),Promise.all(x),w,T,uV(t,d),...A,...D]),g,U$e(t,b),...oV(t,o,f,b),...k9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...nV({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},_,Promise.all(x.map(ie=>HI(ie))),HI(w),hK(T,O),Promise.allSettled(A),Promise.allSettled(D)])}},L$e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:lp(n,i,r)),z$e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>ti(o,{checkOpen:!1})&&!Xn(o)).map(({type:i,value:o,stream:s=o})=>lp(s,n,e,{isSameDirection:Tn.has(i),stopOnExit:i==="native"}))),U$e=async(t,{signal:e})=>{let[r]=await F$e(t,"error",{signal:e});throw r}});var bK,up,jl,gv=y(()=>{Tl();bK=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),up=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ii();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},jl=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 vK}from"node:stream/promises";var JI,SK,YI,XI,yv,_v,QI=y(()=>{hv();JI=async t=>{if(t!==void 0)try{await YI(t)}catch{}},SK=async t=>{if(t!==void 0)try{await XI(t)}catch{}},YI=async t=>{await vK(t,{cleanup:!0,readable:!1,writable:!0})},XI=async t=>{await vK(t,{cleanup:!0,readable:!0,writable:!1})},yv=async(t,e)=>{if(await t,e)throw e},_v=(t,e,r)=>{r&&!mv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as q$e}from"node:stream";import{callbackify as B$e}from"node:util";var wK,eP,tP,rP,H$e,nP,iP,xK,oP=y(()=>{Pa();ds();pv();Tl();gv();QI();wK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||nn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=eP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=tP(a,s),{read:f,onStdoutDataDone:p}=rP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new q$e({read:f,destroy:B$e(iP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return nP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},eP=(t,e,r)=>{let n=Ol(t,e),i=up(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},tP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:BI},rP=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ii(),s=fv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){H$e(this,s,o)},onStdoutDataDone:o}},H$e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},nP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await XI(t),await n,await JI(i),await e,r.readable&&r.push(null)}catch(o){await JI(i),xK(r,o)}},iP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await jl(r,e)&&(xK(t,n),await yv(e,n))},xK=(t,e)=>{_v(t,t.readable,e)}});import{Writable as G$e}from"node:stream";import{callbackify as $K}from"node:util";var kK,sP,aP,Z$e,V$e,cP,lP,EK,uP=y(()=>{ds();gv();QI();kK=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=sP(t,r,e),s=new G$e({...aP(n,t,i),destroy:$K(lP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return cP(n,s),s},sP=(t,e,r)=>{let n=gb(t,e),i=up(r,n,"writableFinal"),o=up(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},aP=(t,e,r)=>({write:Z$e.bind(void 0,t),final:$K(V$e.bind(void 0,t,e,r))}),Z$e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},V$e=async(t,e,r)=>{await jl(r,e)&&(t.writable&&t.end(),await e)},cP=async(t,e,r)=>{try{await YI(t),e.writable&&e.end()}catch(n){await SK(r),EK(e,n)}},lP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await jl(r,e),await jl(n,e)&&(EK(t,i),await yv(e,i))},EK=(t,e)=>{_v(t,t.writable,e)}});import{Duplex as W$e}from"node:stream";import{callbackify as K$e}from"node:util";var AK,J$e,TK=y(()=>{Pa();oP();uP();AK=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||nn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=eP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=sP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=tP(c,a),{read:g,onStdoutDataDone:b}=rP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new W$e({read:g,...aP(u,t,d),destroy:K$e(J$e.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 nP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),cP(u,_,c),_},J$e=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([iP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),lP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var dP,Y$e,OK=y(()=>{Pa();ds();pv();dP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||nn.has(e),s=Ol(t,r),a=fv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Y$e(a,s,t)},Y$e=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var RK,IK=y(()=>{gv();oP();uP();TK();OK();RK=(t,{encoding:e})=>{let r=bK();t.readable=wK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=kK.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=AK.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=dP.bind(void 0,t,e),t[Symbol.asyncIterator]=dP.bind(void 0,t,e,{})}});var PK,X$e,Q$e,CK=y(()=>{PK=(t,e)=>{for(let[r,n]of Q$e){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},X$e=(async()=>{})().constructor.prototype,Q$e=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(X$e,t)])});import{setMaxListeners as eke}from"node:events";import{spawn as tke}from"node:child_process";var DK,rke,nke,ike,oke,ske,NK=y(()=>{qb();bR();VR();ds();WR();TI();np();Gb();$3();O3();ip();L3();fb();H3();rK();KI();_K();IK();Tl();CK();DK=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=rke(t,e,r),{subprocess:f,promise:p}=ike({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=dv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),PK(f,p),Pi.set(f,{options:u,fileDescriptors:d}),f},rke=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ob(t,e,r),{file:a,commandArguments:c,options:l}=Pb(t,e,r),u=nke(l),d=T3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},nke=({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}},ike=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=tke(...Cb(t,e,r))}catch(m){return x3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;eke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];F3(c,a,l),B3(c,r,l);let d={},f=Ii();c.kill=x9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=lK(c,r),RK(c,r),v3(c,r);let p=oke({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}},oke=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 yK({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)=>wo(x,e,w)),_=wo(h,e,"all"),S=ske({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Cl(S,n,e)},ske=({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?rp({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 Ci,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Hb({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var bv,ake,cke,jK=y(()=>{go();vo();bv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,ake(n,t[n],i)]));return{...t,...r}},ake=(t,e,r)=>cke.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,cke=new Set(["env",...mR])});var ms,lke,uke,MK=y(()=>{go();lR();FG();p3();NK();jK();ms=(t,e,r,n)=>{let i=(s,a,c)=>ms(s,a,r,c),o=(...s)=>lke({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},lke=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,bv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=uke({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?f3(a,c,l):DK(a,c,l,i)},uke=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=jG(e)?MG(e,r):[e,...r],[s,a,c]=Z_(...o),l=bv(bv(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 FK,LK,zK,dke,fke,UK=y(()=>{FK=({file:t,commandArguments:e})=>zK(t,e),LK=({file:t,commandArguments:e})=>({...zK(t,e),isSync:!0}),zK=(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]=dke(t);return{file:r,commandArguments:n}},dke=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(fke)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},fke=/ +/g});var qK,BK,pke,HK,mke,GK,ZK=y(()=>{qK=(t,e,r)=>{t.sync=e(pke,r),t.s=t.sync},BK=({options:t})=>HK(t),pke=({options:t})=>({...HK(t),isSync:!0}),HK=t=>({options:{...mke(t),...t}}),mke=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},GK={preferLocal:!0}});var klt,Ye,Elt,Alt,Tlt,Olt,Rlt,Ilt,Plt,Clt,Mr=y(()=>{MK();UK();BR();ZK();TI();klt=ms(()=>({})),Ye=ms(()=>({isSync:!0})),Elt=ms(FK),Alt=ms(LK),Tlt=ms(aV),Olt=ms(BK,{},GK,qK),{sendMessage:Rlt,getOneMessage:Ilt,getEachMessage:Plt,getCancelSignal:Clt}=S3()});import{existsSync as vv,statSync as hke}from"node:fs";import{dirname as fP,extname as gke,isAbsolute as VK,join as pP,relative as mP,resolve as Sv,sep as yke}from"node:path";function wv(t){return t==="./gradlew"||t==="gradle"}function _ke(t){return(vv(pP(t,"build.gradle.kts"))||vv(pP(t,"build.gradle")))&&vv(pP(t,"gradle.properties"))}function bke(t,e){let n=mP(t,e).split(yke).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function hs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function vke(t,e){let r=Sv(t,e),n=r;vv(r)?hke(r).isFile()&&(n=fP(r)):gke(r)!==""&&(n=fP(r));let i=mP(t,n);if(i.startsWith("..")||VK(i))return null;let o=n;for(;;){if(_ke(o))return o;if(Sv(o)===Sv(t))return null;let s=fP(o);if(s===o)return null;let a=mP(t,s);if(a.startsWith("..")||VK(a))return null;o=s}}function xv(t,e){let r=Sv(t),n=new Map,i=[];for(let o of e){let s=vke(r,o);if(!s){i.push(o);continue}let a=bke(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 $v=y(()=>{"use strict"});import{existsSync as gP,readFileSync as Ske}from"node:fs";import{join as Ml}from"node:path";function Fl(t="."){let e=Ml(t,".cladding","config.yaml");if(!gP(e))return hP;try{let n=(0,WK.parse)(Ske(e,"utf8"))?.gate;if(!n)return hP;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 wke){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 hP}}function KK(t="."){let e=Fl(t).testReport,r=e?[e,...yP]:yP;return[...new Set(r.map(n=>Ml(t,n)))]}function JK(t="."){let e=Fl(t).testReport;if(e){let r=Ml(t,e);return gP(r)?r:null}return yP.map(r=>Ml(t,r)).find(r=>gP(r))??null}function YK(t,e){let r=[],n=!1;for(let i of t){let o=xke.exec(i);if(o){n=!0;for(let s of e)r.push(hs(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 WK,wke,hP,yP,xke,dp=y(()=>{"use strict";WK=St(Qt(),1);$v();wke=["type","lint","test","coverage"],hP={scope:"feature"},yP=["test-report.junit.xml",Ml("coverage","junit.xml"),Ml(".cladding","test-report.junit.xml")];xke=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as bP,readFileSync as XK,readdirSync as $ke,statSync as kke}from"node:fs";import{join as kv}from"node:path";function wP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=kv(t,e);if(bP(r))try{if(QK.test(XK(r,"utf8")))return!0}catch{}}return!1}function eJ(t){try{return bP(t)&&QK.test(XK(t,"utf8"))}catch{return!1}}function tJ(t,e=0){if(e>4||!bP(t))return!1;let r;try{r=$ke(t)}catch{return!1}for(let n of r){let i=kv(t,n),o=!1;try{o=kke(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(tJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&eJ(i))return!0}return!1}function Tke(t){if(wP(t))return!0;for(let e of Eke)if(eJ(kv(t,e)))return!0;for(let e of Ake)if(tJ(kv(t,e)))return!0;return!1}function rJ(t="."){let e=Fl(t).coverage;return e||(Tke(t)?"kover":"jacoco")}function nJ(t="."){return vP[rJ(t)]}function iJ(t="."){return _P[rJ(t)]}var vP,_P,SP,QK,Eke,Ake,Ev=y(()=>{"use strict";dp();vP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},_P={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},SP=[_P.kover,_P.jacoco],QK=/kover/i;Eke=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],Ake=["buildSrc","build-logic"]});import{existsSync as pp,readFileSync as sJ,readdirSync as aJ}from"node:fs";import{join as gs}from"node:path";function $P(t){return pp(gs(t,"gradlew"))?"./gradlew":"gradle"}function Oke(t){let e=$P(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[nJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function Rke(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(sJ(gs(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 Pke(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function Nke(t,e){for(let r of e)if(pp(gs(t,r)))return r}function jke(t,e){try{return aJ(t).find(n=>n.endsWith(e))}catch{return}}function Lke(t){try{return JSON.parse(sJ(gs(t,"package.json"),"utf8"))}catch{return{}}}function fp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function oJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function zke(t,e,r){if(fp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of Mke)if(n.configs.some(i=>pp(gs(t,i))))return n.gate;if(Fke.some(n=>pp(gs(t,n)))||r.eslintConfig!==void 0)return e}function qke(t,e){return Uke.some(r=>pp(gs(t,r)))?!0:e.jest!==void 0}function Bke(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 xP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function Hke(t,e){let r=Lke(t),n=e.lint?zke(t,e.lint,r):void 0,i=n?{...e,lint:n}:xP(e,"lint"),o=fp(r,"test"),s=o?Bke(o):void 0;return o&&!s?(i=xP(i,"coverage"),{...i,test:{cmd:"npm",args:["test"]},...fp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):s==="jest"||!o&&qke(t,r)?{...i,test:{cmd:"npx",args:[...Ni,"jest"]},coverage:{cmd:"npx",args:[...Ni,"jest","--coverage"]}}:(s==="vitest"&&!fp(r,"coverage")&&!oJ(r,"@vitest/coverage-v8")&&!oJ(r,"@vitest/coverage-istanbul")?i=xP(i,"coverage"):s==="vitest"&&fp(r,"coverage")&&(i={...i,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),i)}function dt(t="."){for(let e of Cke){let r;for(let o of e.manifests)if(o.startsWith(".")?r=jke(t,o):r=Nke(t,[o]),r)break;if(!r||e.requiresSource&&!Pke(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?Hke(t,n):n;return{language:e.language,manifest:r,gates:i}}return Dke}var Ni,Ike,Cke,Dke,Mke,Fke,Uke,on=y(()=>{"use strict";Ev();Ni=["--offline","--no-install"];Ike=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);Cke=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...Ni,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...Ni,"eslint","."]},test:{cmd:"npx",args:[...Ni,"vitest","run"]},coverage:{cmd:"npx",args:[...Ni,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...Ni,"secretlint","**/*"]},arch:{cmd:"npx",args:[...Ni,"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:Oke},{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:Rke}],Dke={language:"unknown",manifest:"",gates:{}};Mke=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...Ni,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...Ni,"oxlint"]}}],Fke=["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"];Uke=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as Gke,readFileSync as Zke}from"node:fs";import{join as Vke}from"node:path";function za(t){return t.code==="ENOENT"}function Av(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=(o||s||`exit ${i}`).slice(0,200);return cJ.test(o)||cJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function qt(t,e,r,n=[]){if(za(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 tr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Ll(t,e){let r=Vke(t,"package.json");if(!Gke(r))return!1;try{return!!JSON.parse(Zke(r,"utf8")).scripts?.[e]}catch{return!1}}var cJ,On=y(()=>{"use strict";cJ=/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 Wke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.arch;if(!n)return[{detector:Tv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Ye(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Tv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Av(i,Tv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Tv,Ua,Ov=y(()=>{"use strict";Mr();on();On();Tv="ARCHITECTURE_VIOLATION";Ua={name:Tv,subprocess:!0,run:Wke}});function Kke(t){let{cwd:e="."}=t,r=dt(e),n=r.gates.secret;if(!n)return[{detector:Rv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Ye(n.cmd,[...n.args],{cwd:e,reject:!1});return za(i)?[{detector:Rv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Av(i,Rv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Rv,qa,Iv=y(()=>{"use strict";Mr();on();On();Rv="HARDCODED_SECRET";qa={name:Rv,subprocess:!0,run:Kke}});import{existsSync as kP,readdirSync as lJ}from"node:fs";import{join as Pv}from"node:path";function Yke(t,e){let r=Pv(t,e.path);if(!kP(r))return!0;if(e.isDirectory)try{return lJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function Xke(t){let{cwd:e="."}=t,r=[];for(let i of Jke)Yke(e,i)&&r.push({detector:mp,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=Pv(e,"spec.yaml");if(kP(n)){let i=tEe(n),o=i?null:Qke(e);if(i)r.push({detector:mp,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:mp,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=eEe(e);s&&r.push({detector:mp,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 Qke(t){for(let e of["spec/features","spec/scenarios"]){let r=Pv(t,e);if(!kP(r))continue;let n;try{n=lJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ai(Pv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function eEe(t){try{return H(t),null}catch(e){return e.message}}function tEe(t){let e;try{e=Ai(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var mp,Jke,uJ,dJ=y(()=>{"use strict";Be();j_();mp="ABSENCE_OF_GOVERNANCE",Jke=[{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}];uJ={name:mp,run:Xke}});function Cv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function EP(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=Cv(r)==="while",o=nEe.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 '${Cv(r)}'`}let n=rEe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Cv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Cv(r)}'`:null}function iEe(t,e){let r=EP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function fJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...iEe(r,n));return e}var rEe,nEe,AP=y(()=>{"use strict";rEe={event:"when",state:"while",optional:"where",unwanted:"if"},nEe=/\bwhen\b/i});function ge(t,e,r){let n;try{n=H(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var wt=y(()=>{"use strict";Be()});function oEe(t){let{cwd:e="."}=t;return ge(e,Dv,sEe)}function sEe(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:Dv,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 fJ(t.features))e.push({detector:Dv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Dv,pJ,mJ=y(()=>{"use strict";AP();wt();Dv="AC_DRIFT";pJ={name:Dv,run:oEe}});function ji(t=".",e){let n=(e??"").trim().toLowerCase()||dt(t).language;return gJ[n]??hJ}var aEe,cEe,lEe,hJ,uEe,dEe,gJ,fEe,yJ,Ba=y(()=>{"use strict";on();aEe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,cEe=/^[ \t]*import\s+([\w.]+)/gm,lEe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,hJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:aEe,importStyle:"relative"},uEe={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:cEe,importStyle:"dotted"},dEe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:lEe,importStyle:"dotted"},gJ={typescript:hJ,kotlin:uEe,python:dEe},fEe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],yJ=new Set([...Object.values(gJ).flatMap(t=>t?.extensions??[]),...fEe].map(t=>t.toLowerCase()))});import{existsSync as pEe,readFileSync as mEe,readdirSync as hEe,statSync as gEe}from"node:fs";import{join as bJ,relative as _J}from"node:path";function yEe(t,e){if(!pEe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=hEe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=bJ(i,s),c;try{c=gEe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function _Ee(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function vEe(t){return bEe.test(t)}function SEe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=ji(e,r.project?.language),o=i.sourceRoots.flatMap(a=>yEe(bJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=mEe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Be();Ba();vJ="AI_HINTS_FORBIDDEN_PATTERN";bEe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;SJ={name:vJ,run:SEe}});function wEe(t){let{cwd:e="."}=t,r;try{r=H(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,$J,kJ=y(()=>{"use strict";Be();xJ="AC_DUPLICATE_WITHIN_FEATURE";$J={name:xJ,run:wEe}});import{createRequire as xEe}from"module";import{basename as $Ee,dirname as OP,normalize as kEe,relative as EEe,resolve as AEe,sep as TJ}from"path";import*as TEe from"fs";function OEe(t){let e=kEe(t);return e.length>1&&e[e.length-1]===TJ&&(e=e.substring(0,e.length-1)),e}function OJ(t,e){return t.replace(REe,e)}function PEe(t){return t==="/"||IEe.test(t)}function TP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=AEe(t)),(n||o)&&(t=OEe(t)),t===".")return"";let s=t[t.length-1]!==i;return OJ(s?t+i:t,i)}function RJ(t,e){return e+t}function CEe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:OJ(EEe(t,n),e.pathSeparator)+e.pathSeparator+r}}function DEe(t){return t}function NEe(t,e,r){return e+t+r}function jEe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?CEe(t,e):n?RJ:DEe}function MEe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function FEe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function qEe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?FEe(t):MEe(t):n&&n.length?zEe:LEe:UEe}function WEe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?VEe:r&&r.length?n?BEe:HEe:n?GEe:ZEe}function YEe(t){return t.group?JEe:KEe}function eAe(t){return t.group?XEe:QEe}function nAe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?rAe:tAe}function IJ(t,e,r){if(r.options.useRealPaths)return iAe(e,r);let n=OP(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=OP(n)}return r.symlinks.set(t,e),i>1}function iAe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Nv(t,e,r,n){e(t&&!n?t:null,r)}function pAe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?oAe:lAe:n?e?sAe:fAe:i?e?cAe:dAe:e?aAe:uAe}function gAe(t){return t?hAe:mAe}function vAe(t,e){return new Promise((r,n)=>{DJ(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function DJ(t,e,r){new CJ(t,e,r).start()}function SAe(t,e){return new CJ(t,e).start()}var EJ,REe,IEe,LEe,zEe,UEe,BEe,HEe,GEe,ZEe,VEe,KEe,JEe,XEe,QEe,tAe,rAe,oAe,sAe,aAe,cAe,lAe,uAe,dAe,fAe,PJ,mAe,hAe,yAe,_Ae,bAe,CJ,AJ,NJ,jJ,MJ=y(()=>{EJ=xEe(import.meta.url);REe=/[\\/]/g;IEe=/^[a-z]:[\\/]$/i;LEe=(t,e)=>{e.push(t||".")},zEe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},UEe=()=>{};BEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},HEe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},GEe=(t,e,r,n)=>{r.files++},ZEe=(t,e)=>{e.push(t)},VEe=()=>{};KEe=t=>t,JEe=()=>[""].slice(0,0);XEe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},QEe=()=>{};tAe=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()&&IJ(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},rAe=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()&&IJ(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};oAe=t=>t.counts,sAe=t=>t.groups,aAe=t=>t.paths,cAe=t=>t.paths.slice(0,t.options.maxFiles),lAe=(t,e,r)=>(Nv(e,r,t.counts,t.options.suppressErrors),null),uAe=(t,e,r)=>(Nv(e,r,t.paths,t.options.suppressErrors),null),dAe=(t,e,r)=>(Nv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),fAe=(t,e,r)=>(Nv(e,r,t.groups,t.options.suppressErrors),null);PJ={withFileTypes:!0},mAe=(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||".",PJ,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},hAe=(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||".",PJ)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};yAe=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))}},_Ae=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}},bAe=class{aborted=!1;abort(){this.aborted=!0}},CJ=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=pAe(e,this.isSynchronous),this.root=TP(t,e),this.state={root:PEe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new _Ae,options:e,queue:new yAe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new bAe,fs:e.fs||TEe},this.joinPath=jEe(this.root,e),this.pushDirectory=qEe(this.root,e),this.pushFile=WEe(e),this.getArray=YEe(e),this.groupFiles=eAe(e),this.resolveSymlink=nAe(e,this.isSynchronous),this.walkDirectory=gAe(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(_=TP(_,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=$Ee(_),x=TP(OP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};AJ=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return vAe(this.root,this.options)}withCallback(t){DJ(this.root,this.options,t)}sync(){return SAe(this.root,this.options)}},NJ=null;try{EJ.resolve("picomatch"),NJ=EJ("picomatch")}catch{}jJ=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:TJ,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 AJ(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new AJ(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||NJ;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 hp=v((jut,qJ)=>{"use strict";var FJ="[^\\\\/]",wAe="(?=.)",LJ="[^/]",RP="(?:\\/|$)",zJ="(?:^|\\/)",IP=`\\.{1,2}${RP}`,xAe="(?!\\.)",$Ae=`(?!${zJ}${IP})`,kAe=`(?!\\.{0,1}${RP})`,EAe=`(?!${IP})`,AAe="[^.\\/]",TAe=`${LJ}*?`,OAe="/",UJ={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:wAe,QMARK:LJ,END_ANCHOR:RP,DOTS_SLASH:IP,NO_DOT:xAe,NO_DOTS:$Ae,NO_DOT_SLASH:kAe,NO_DOTS_SLASH:EAe,QMARK_NO_DOT:AAe,STAR:TAe,START_ANCHOR:zJ,SEP:OAe},RAe={...UJ,SLASH_LITERAL:"[\\\\/]",QMARK:FJ,STAR:`${FJ}*?`,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:"\\"},IAe={__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"};qJ.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:IAe,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?RAe:UJ}}});var gp=v(Fr=>{"use strict";var{REGEX_BACKSLASH:PAe,REGEX_REMOVE_BACKSLASH:CAe,REGEX_SPECIAL_CHARS:DAe,REGEX_SPECIAL_CHARS_GLOBAL:NAe}=hp();Fr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Fr.hasRegexChars=t=>DAe.test(t);Fr.isRegexChar=t=>t.length===1&&Fr.hasRegexChars(t);Fr.escapeRegex=t=>t.replace(NAe,"\\$1");Fr.toPosixSlashes=t=>t.replace(PAe,"/");Fr.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};Fr.removeBackslashes=t=>t.replace(CAe,e=>e==="\\"?"":e);Fr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Fr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Fr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Fr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Fr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var JJ=v((Fut,KJ)=>{"use strict";var BJ=gp(),{CHAR_ASTERISK:PP,CHAR_AT:jAe,CHAR_BACKWARD_SLASH:yp,CHAR_COMMA:MAe,CHAR_DOT:CP,CHAR_EXCLAMATION_MARK:DP,CHAR_FORWARD_SLASH:WJ,CHAR_LEFT_CURLY_BRACE:NP,CHAR_LEFT_PARENTHESES:jP,CHAR_LEFT_SQUARE_BRACKET:FAe,CHAR_PLUS:LAe,CHAR_QUESTION_MARK:HJ,CHAR_RIGHT_CURLY_BRACE:zAe,CHAR_RIGHT_PARENTHESES:GJ,CHAR_RIGHT_SQUARE_BRACKET:UAe}=hp(),ZJ=t=>t===WJ||t===yp,VJ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},qAe=(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,O=0,T,A,D={value:"",depth:0,isGlob:!1},$=()=>l>=n,ie=()=>c.charCodeAt(l+1),K=()=>(T=A,c.charCodeAt(++l));for(;l0&&(C=c.slice(0,u),c=c.slice(u),d-=u),xe&&m===!0&&d>0?(xe=c.slice(0,d),P=c.slice(d)):m===!0?(xe="",P=c):xe=c,xe&&xe!==""&&xe!=="/"&&xe!==c&&ZJ(xe.charCodeAt(xe.length-1))&&(xe=xe.slice(0,-1)),r.unescape===!0&&(P&&(P=BJ.removeBackslashes(P)),xe&&_===!0&&(xe=BJ.removeBackslashes(xe)));let Ir={prefix:C,input:t,start:u,base:xe,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(Ir.maxDepth=0,ZJ(A)||s.push(D),Ir.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var _p=hp(),sn=gp(),{MAX_LENGTH:jv,POSIX_REGEX_SOURCE:BAe,REGEX_NON_SPECIAL_CHARS:HAe,REGEX_SPECIAL_CHARS_BACKREF:GAe,REPLACEMENTS:YJ}=_p,ZAe=(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=>sn.escapeRegex(i)).join("..")}return r},zl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,XJ=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},VAe=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},QJ=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(VAe(e))return e.replace(/\\(.)/g,"$1")},WAe=t=>{let e=t.map(QJ).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}}}}},KAe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=QJ(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?sn.escapeRegex(r[0]):`[${r.map(i=>sn.escapeRegex(i)).join("")}]`}*`},JAe=t=>{let e=0,r=t.trim(),n=MP(r);for(;n;)e++,r=n.body.trim(),n=MP(r);return e},YAe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:_p.DEFAULT_MAX_EXTGLOB_RECURSION,n=XJ(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||WAe(n)))return{risky:!0};for(let i of n){let o=KAe(i);if(o)return{risky:!0,safeOutput:o};if(JAe(i)>r)return{risky:!0}}return{risky:!1}},FP=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=YJ[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(jv,r.maxLength):jv,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=_p.globChars(r.windows),l=_p.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,O=B=>`(${a}(?:(?!${w}${B.dot?m:u}).)*?)`,T=r.dot?"":h,A=r.dot?_:S,D=r.bash===!0?O(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let $={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=sn.removePrefix(t,$),i=t.length;let ie=[],K=[],xe=[],C=o,P,Ir=()=>$.index===i-1,se=$.peek=(B=1)=>t[$.index+B],Ce=$.advance=()=>t[++$.index]||"",Kt=()=>t.slice($.index+1),dr=(B="",ht=0)=>{$.consumed+=B,$.index+=ht},Yt=B=>{$.output+=B.output!=null?B.output:B.value,dr(B.value)},co=()=>{let B=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),$.start++,B++;return B%2===0?!1:($.negated=!0,$.start++,!0)},wi=B=>{$[B]++,xe.push(B)},Yr=B=>{$[B]--,xe.pop()},de=B=>{if(C.type==="globstar"){let ht=$.braces>0&&(B.type==="comma"||B.type==="brace"),q=B.extglob===!0||ie.length&&(B.type==="pipe"||B.type==="paren");B.type!=="slash"&&B.type!=="paren"&&!ht&&!q&&($.output=$.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=D,$.output+=C.output)}if(ie.length&&B.type!=="paren"&&(ie[ie.length-1].inner+=B.value),(B.value||B.output)&&Yt(B),C&&C.type==="text"&&B.type==="text"){C.output=(C.output||C.value)+B.value,C.value+=B.value;return}B.prev=C,s.push(B),C=B},lo=(B,ht)=>{let q={...l[ht],conditions:1,inner:""};q.prev=C,q.parens=$.parens,q.output=$.output,q.startIndex=$.index,q.tokensIndex=s.length;let Oe=(r.capture?"(":"")+q.open;wi("parens"),de({type:B,value:ht,output:$.output?"":p}),de({type:"paren",extglob:!0,value:Ce(),output:Oe}),ie.push(q)},Ode=B=>{let ht=t.slice(B.startIndex,$.index+1),q=t.slice(B.startIndex+2,$.index),Oe=YAe(q,r);if((B.type==="plus"||B.type==="star")&&Oe.risky){let lt=Oe.safeOutput?(B.output?"":p)+(r.capture?`(${Oe.safeOutput})`:Oe.safeOutput):void 0,xi=s[B.tokensIndex];xi.type="text",xi.value=ht,xi.output=lt||sn.escapeRegex(ht);for(let $i=B.tokensIndex+1;$i1&&B.inner.includes("/")&&(lt=O(r)),(lt!==D||Ir()||/^\)+$/.test(Kt()))&&(ut=B.close=`)$))${lt}`),B.inner.includes("*")&&(Lt=Kt())&&/^\.[^\\/.]+$/.test(Lt)){let xi=FP(Lt,{...e,fastpaths:!1}).output;ut=B.close=`)${xi})${lt})`}B.prev.type==="bos"&&($.negatedExtglob=!0)}de({type:"paren",extglob:!0,value:P,output:ut}),Yr("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let B=!1,ht=t.replace(GAe,(q,Oe,ut,Lt,lt,xi)=>Lt==="\\"?(B=!0,q):Lt==="?"?Oe?Oe+Lt+(lt?_.repeat(lt.length):""):xi===0?A+(lt?_.repeat(lt.length):""):_.repeat(ut.length):Lt==="."?u.repeat(ut.length):Lt==="*"?Oe?Oe+Lt+(lt?D:""):D:Oe?q:`\\${q}`);return B===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,q=>q.length%2===0?"\\\\":q?"\\":"")),ht===t&&r.contains===!0?($.output=t,$):($.output=sn.wrapOutput(ht,$,e),$)}for(;!Ir();){if(P=Ce(),P==="\0")continue;if(P==="\\"){let q=se();if(q==="/"&&r.bash!==!0||q==="."||q===";")continue;if(!q){P+="\\",de({type:"text",value:P});continue}let Oe=/^\\+/.exec(Kt()),ut=0;if(Oe&&Oe[0].length>2&&(ut=Oe[0].length,$.index+=ut,ut%2!==0&&(P+="\\")),r.unescape===!0?P=Ce():P+=Ce(),$.brackets===0){de({type:"text",value:P});continue}}if($.brackets>0&&(P!=="]"||C.value==="["||C.value==="[^")){if(r.posix!==!1&&P===":"){let q=C.value.slice(1);if(q.includes("[")&&(C.posix=!0,q.includes(":"))){let Oe=C.value.lastIndexOf("["),ut=C.value.slice(0,Oe),Lt=C.value.slice(Oe+2),lt=BAe[Lt];if(lt){C.value=ut+lt,$.backtrack=!0,Ce(),!o.output&&s.indexOf(C)===1&&(o.output=p);continue}}}(P==="["&&se()!==":"||P==="-"&&se()==="]")&&(P=`\\${P}`),P==="]"&&(C.value==="["||C.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&C.value==="["&&(P="^"),C.value+=P,Yt({value:P});continue}if($.quotes===1&&P!=='"'){P=sn.escapeRegex(P),C.value+=P,Yt({value:P});continue}if(P==='"'){$.quotes=$.quotes===1?0:1,r.keepQuotes===!0&&de({type:"text",value:P});continue}if(P==="("){wi("parens"),de({type:"paren",value:P});continue}if(P===")"){if($.parens===0&&r.strictBrackets===!0)throw new SyntaxError(zl("opening","("));let q=ie[ie.length-1];if(q&&$.parens===q.parens+1){Ode(ie.pop());continue}de({type:"paren",value:P,output:$.parens?")":"\\)"}),Yr("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(zl("closing","]"));P=`\\${P}`}else wi("brackets");de({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){de({type:"text",value:P,output:`\\${P}`});continue}if($.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(zl("opening","["));de({type:"text",value:P,output:`\\${P}`});continue}Yr("brackets");let q=C.value.slice(1);if(C.posix!==!0&&q[0]==="^"&&!q.includes("/")&&(P=`/${P}`),C.value+=P,Yt({value:P}),r.literalBrackets===!1||sn.hasRegexChars(q))continue;let Oe=sn.escapeRegex(C.value);if($.output=$.output.slice(0,-C.value.length),r.literalBrackets===!0){$.output+=Oe,C.value=Oe;continue}C.value=`(${a}${Oe}|${C.value})`,$.output+=C.value;continue}if(P==="{"&&r.nobrace!==!0){wi("braces");let q={type:"brace",value:P,output:"(",outputIndex:$.output.length,tokensIndex:$.tokens.length};K.push(q),de(q);continue}if(P==="}"){let q=K[K.length-1];if(r.nobrace===!0||!q){de({type:"text",value:P,output:P});continue}let Oe=")";if(q.dots===!0){let ut=s.slice(),Lt=[];for(let lt=ut.length-1;lt>=0&&(s.pop(),ut[lt].type!=="brace");lt--)ut[lt].type!=="dots"&&Lt.unshift(ut[lt].value);Oe=ZAe(Lt,r),$.backtrack=!0}if(q.comma!==!0&&q.dots!==!0){let ut=$.output.slice(0,q.outputIndex),Lt=$.tokens.slice(q.tokensIndex);q.value=q.output="\\{",P=Oe="\\}",$.output=ut;for(let lt of Lt)$.output+=lt.output||lt.value}de({type:"brace",value:P,output:Oe}),Yr("braces"),K.pop();continue}if(P==="|"){ie.length>0&&ie[ie.length-1].conditions++,de({type:"text",value:P});continue}if(P===","){let q=P,Oe=K[K.length-1];Oe&&xe[xe.length-1]==="braces"&&(Oe.comma=!0,q="|"),de({type:"comma",value:P,output:q});continue}if(P==="/"){if(C.type==="dot"&&$.index===$.start+1){$.start=$.index+1,$.consumed="",$.output="",s.pop(),C=o;continue}de({type:"slash",value:P,output:f});continue}if(P==="."){if($.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let q=K[K.length-1];C.type="dots",C.output+=P,C.value+=P,q.dots=!0;continue}if($.braces+$.parens===0&&C.type!=="bos"&&C.type!=="slash"){de({type:"text",value:P,output:u});continue}de({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(C&&C.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){lo("qmark",P);continue}if(C&&C.type==="paren"){let Oe=se(),ut=P;(C.value==="("&&!/[!=<:]/.test(Oe)||Oe==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(ut=`\\${P}`),de({type:"text",value:P,output:ut});continue}if(r.dot!==!0&&(C.type==="slash"||C.type==="bos")){de({type:"qmark",value:P,output:S});continue}de({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){lo("negate",P);continue}if(r.nonegate!==!0&&$.index===0){co();continue}}if(P==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){lo("plus",P);continue}if(C&&C.value==="("||r.regex===!1){de({type:"plus",value:P,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||$.parens>0){de({type:"plus",value:P});continue}de({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){de({type:"at",extglob:!0,value:P,output:""});continue}de({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let q=HAe.exec(Kt());q&&(P+=q[0],$.index+=q[0].length),de({type:"text",value:P});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=P,C.output=D,$.backtrack=!0,$.globstar=!0,dr(P);continue}let B=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(B)){lo("star",P);continue}if(C.type==="star"){if(r.noglobstar===!0){dr(P);continue}let q=C.prev,Oe=q.prev,ut=q.type==="slash"||q.type==="bos",Lt=Oe&&(Oe.type==="star"||Oe.type==="globstar");if(r.bash===!0&&(!ut||B[0]&&B[0]!=="/")){de({type:"star",value:P,output:""});continue}let lt=$.braces>0&&(q.type==="comma"||q.type==="brace"),xi=ie.length&&(q.type==="pipe"||q.type==="paren");if(!ut&&q.type!=="paren"&&!lt&&!xi){de({type:"star",value:P,output:""});continue}for(;B.slice(0,3)==="/**";){let $i=t[$.index+4];if($i&&$i!=="/")break;B=B.slice(3),dr("/**",3)}if(q.type==="bos"&&Ir()){C.type="globstar",C.value+=P,C.output=O(r),$.output=C.output,$.globstar=!0,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&!Lt&&Ir()){$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=O(r)+(r.strictSlashes?")":"|$)"),C.value+=P,$.globstar=!0,$.output+=q.output+C.output,dr(P);continue}if(q.type==="slash"&&q.prev.type!=="bos"&&B[0]==="/"){let $i=B[1]!==void 0?"|$":"";$.output=$.output.slice(0,-(q.output+C.output).length),q.output=`(?:${q.output}`,C.type="globstar",C.output=`${O(r)}${f}|${f}${$i})`,C.value+=P,$.output+=q.output+C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}if(q.type==="bos"&&B[0]==="/"){C.type="globstar",C.value+=P,C.output=`(?:^|${f}|${O(r)}${f})`,$.output=C.output,$.globstar=!0,dr(P+Ce()),de({type:"slash",value:"/",output:""});continue}$.output=$.output.slice(0,-C.output.length),C.type="globstar",C.output=O(r),C.value+=P,$.output+=C.output,$.globstar=!0,dr(P);continue}let ht={type:"star",value:P,output:D};if(r.bash===!0){ht.output=".*?",(C.type==="bos"||C.type==="slash")&&(ht.output=T+ht.output),de(ht);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&r.regex===!0){ht.output=P,de(ht);continue}($.index===$.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?($.output+=g,C.output+=g):r.dot===!0?($.output+=b,C.output+=b):($.output+=T,C.output+=T),se()!=="*"&&($.output+=p,C.output+=p)),de(ht)}for(;$.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(zl("closing","]"));$.output=sn.escapeLast($.output,"["),Yr("brackets")}for(;$.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(zl("closing",")"));$.output=sn.escapeLast($.output,"("),Yr("parens")}for(;$.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(zl("closing","}"));$.output=sn.escapeLast($.output,"{"),Yr("braces")}if(r.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&de({type:"maybe_slash",value:"",output:`${f}?`}),$.backtrack===!0){$.output="";for(let B of $.tokens)$.output+=B.output!=null?B.output:B.value,B.suffix&&($.output+=B.suffix)}return $};FP.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(jv,r.maxLength):jv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=YJ[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}=_p.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=T=>T.noglobstar===!0?_:`(${g}(?:(?!${p}${T.dot?c:o}).)*?)`,x=T=>{switch(T){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 A=/^(.*?)\.(\w+)$/.exec(T);if(!A)return;let D=x(A[1]);return D?D+o+A[2]:void 0}}},w=sn.removePrefix(t,b),O=x(w);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};e8.exports=FP});var i8=v((zut,n8)=>{"use strict";var XAe=JJ(),LP=t8(),r8=gp(),QAe=hp(),eTe=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=eTe(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)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(r8.basename(t));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):LP(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>XAe(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=LP.fastpaths(t,e)),i.output||(i=LP(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=QAe;n8.exports=Rt});var c8=v((Uut,a8)=>{"use strict";var o8=i8(),tTe=gp();function s8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:tTe.isWindows()}),o8(t,e,r)}Object.assign(s8,o8);a8.exports=s8});import{readdir as rTe,readdirSync as nTe,realpath as iTe,realpathSync as oTe,stat as sTe,statSync as aTe}from"fs";import{isAbsolute as cTe,posix as Ha,resolve as lTe}from"path";import{fileURLToPath as uTe}from"url";function pTe(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]===".."&&fTe.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=>Ha.relative(t,n)||".":n=>Ha.relative(t,`${e}/${n}`)||"."}function gTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Ha.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function f8(t){var e;let r=Ul.default.scan(t,yTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function xTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Ul.default.scan(t);return r.isGlob||r.negated}function bp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function p8(t){return typeof t=="string"?[t]:t??[]}function zP(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=wTe(o);s=cTe(s.replace(kTe,""))?Ha.relative(a,s):Ha.normalize(s);let c=(i=$Te.exec(s))===null||i===void 0?void 0:i[0],l=f8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=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?Ha.join(o,...d):o}return s}function ETe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(zP(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(zP(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(zP(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function ATe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=ETe(t,e,n);t.debug&&bp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(u8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Ul.default)(i.match,f),m=(0,Ul.default)(i.ignore,f),h=pTe(i.match,f),g=l8(r,d,o),b=o?g:l8(r,d,!0),_=(w,O)=>{let T=b(O,!0);return T!=="."&&!h(T)||m(T)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new jJ({filters:[a?(w,O)=>{let T=g(w,O),A=p(T)&&!m(T);return A&&bp(`matched ${T}`),A}:(w,O)=>{let T=g(w,O);return p(T)&&!m(T)}],exclude:a?(w,O)=>{let T=_(w,O);return bp(`${T?"skipped":"crawling"} ${O}`),T}:_,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&&bp("internal properties:",{...n,root:d}),[x,r!==d&&!o&&gTe(r,d)]}function TTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function RTe(t){let e={...OTe,...t};return e.cwd=(e.cwd instanceof URL?uTe(e.cwd):lTe(e.cwd)).replace(u8,"/"),e.ignore=p8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||rTe,readdirSync:e.fs.readdirSync||nTe,realpath:e.fs.realpath||iTe,realpathSync:e.fs.realpathSync||oTe,stat:e.fs.stat||sTe,statSync:e.fs.statSync||aTe}),e.debug&&bp("globbing with options:",e),e}function ITe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=dTe(t)||typeof t=="string",i=p8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=RTe(n?e:t);return i.length>0?ATe(o,i):[]}function ys(t,e){let[r,n]=ITe(t,e);return r?TTe(r.sync(),n):[]}var Ul,dTe,u8,d8,fTe,mTe,hTe,yTe,_Te,bTe,vTe,STe,wTe,$Te,kTe,OTe,vp=y(()=>{MJ();Ul=St(c8(),1),dTe=Array.isArray,u8=/\\/g,d8=process.platform==="win32",fTe=/^(\/?\.\.)+$/;mTe=/^[A-Z]:\/$/i,hTe=d8?t=>mTe.test(t):t=>t==="/";yTe={parts:!0};_Te=/(?t.replace(_Te,"\\$&"),STe=t=>t.replace(bTe,"\\$&"),wTe=d8?STe:vTe;$Te=/^(\/?\.\.)+/,kTe=/\\(?=[()[\]{}!*+?@|])/g;OTe={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Sp,readFileSync as PTe,readdirSync as CTe,statSync as m8}from"node:fs";import{join as Ga}from"node:path";function DTe(t){let{cwd:e="."}=t,r,n;try{let c=H(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=ji(e,n),o=[],{layers:s,forbiddenImports:a}=UP(r);return(s.size>0||a.length>0)&&!Sp(Ga(e,i.mainRoot))?[{detector:wp,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&&(NTe(e,i,s,o),jTe(e,i,s,o)),a.length>0&&MTe(e,i,a,o),o)}function UP(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 NTe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(Sp(o))for(let s of CTe(o)){let a=Ga(o,s);m8(a).isDirectory()&&(r.has(s)||n.push({detector:wp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function jTe(t,e,r,n){let i=e.mainRoot,o=Ga(t,i);if(Sp(o))for(let s of r){let a=Ga(o,s);Sp(a)&&m8(a).isDirectory()||n.push({detector:wp,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 MTe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ga(t,i,s.from);if(!Sp(a))continue;let c=ys([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ga(a,l),d;try{d=PTe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];FTe(p,s.to,e.importStyle)&&n.push({detector:wp,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 FTe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var wp,h8,qP=y(()=>{"use strict";vp();Be();Ba();wp="ARCHITECTURE_FROM_SPEC";h8={name:wp,run:DTe}});import{existsSync as LTe,readFileSync as zTe}from"node:fs";import{join as UTe}from"node:path";function BTe(t){let{cwd:e="."}=t,r=UTe(e,"spec/capabilities.yaml");if(!LTe(r))return[];let n;try{let u=zTe(r,"utf8"),d=g8.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=H(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";g8=St(Qt(),1);Be();Mv="CAPABILITIES_FEATURE_MAPPING",qTe=8;y8={name:Mv,run:BTe}});import{existsSync as HTe,readFileSync as GTe}from"node:fs";import{join as ZTe}from"node:path";function VTe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function WTe(t){let{cwd:e="."}=t;return ge(e,BP,r=>KTe(r,e))}function KTe(t,e){let r=ji(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=ZTe(e,o);if(!HTe(s))continue;let a=GTe(s,"utf8");VTe(a)||n.push({detector:BP,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var BP,b8,v8=y(()=>{"use strict";Ba();wt();BP="CONVENTION_DRIFT";b8={name:BP,run:WTe}});import{existsSync as HP,readFileSync as S8}from"node:fs";import{join as Fv}from"node:path";function JTe(t){return JSON.parse(t).total?.lines?.pct??0}function w8(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function QTe(t,e){if(!wv(dt(t).gates.coverage?.cmd))return null;let r;try{r=xv(t,e)}catch(c){return[{detector:xo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=SP.find(d=>HP(Fv(c.dir,d)));if(!l){s.push(c.path);continue}let u=w8(S8(Fv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:xo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=x8(n,i);return a0?[{detector:xo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function eOe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=QTe(e,t.focusModules);if(a)return a}let r;try{r=H(e).project?.language}catch{}let n=ji(e,r),i=dt(e).language==="kotlin"?SP.find(a=>HP(Fv(e,a)))??iJ(e):n.coverageSummary,o=Fv(e,i);if(!HP(o))return[{detector:xo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=S8(o,"utf8");s=n.coverageFormat==="jacoco-xml"?YTe(a):n.coverageFormat==="cobertura-xml"?XTe(a):JTe(a)}catch(a){return[{detector:xo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:xo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Lv?[]:[{detector:xo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Lv}%`}]}var xo,Lv,$8,k8=y(()=>{"use strict";Be();Ev();Ba();$v();on();xo="COVERAGE_DROP",Lv=70;$8={name:xo,run:eOe}});import{existsSync as tOe}from"node:fs";import{join as rOe}from"node:path";function iOe(t){let{cwd:e="."}=t;return ge(e,zv,r=>oOe(r,e))}function oOe(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";wt();zv="DELIVERABLE_INTEGRITY",nOe=8;E8={name:zv,run:iOe}});function sOe(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:Uv,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 aOe(t){let e=sOe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Uv,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 cOe(t){let{cwd:e="."}=t;return ge(e,Uv,r=>aOe(r))}var Uv,T8,O8=y(()=>{"use strict";wt();Uv="SMOKE_PROBE_DEMAND";T8={name:Uv,run:cOe}});function lOe(t){let{cwd:e="."}=t;return ge(e,qv,r=>uOe(r,e))}function uOe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=as(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,Bv,GP=y(()=>{"use strict";gl();wt();qv="STALE_ATTESTATION";Bv={name:qv,run:lOe}});function dOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}return fOe(r)}function fOe(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:R8,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 R8,Hv,ZP=y(()=>{"use strict";Be();R8="DEPENDENCY_CYCLE";Hv={name:R8,run:dOe}});import{appendFileSync as pOe,existsSync as I8,mkdirSync as mOe,readFileSync as hOe}from"node:fs";import{dirname as gOe,join as yOe}from"node:path";function P8(t){return yOe(t,_Oe,bOe)}function C8(t){return VP.add(t),()=>VP.delete(t)}function Za(t,e){let r=P8(t),n=gOe(r);I8(n)||mOe(n,{recursive:!0}),pOe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of VP)try{i(t,e)}catch{}}function Rn(t){let e=P8(t);if(!I8(e))return[];let r=hOe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var _Oe,bOe,VP,ri=y(()=>{"use strict";_Oe=".cladding",bOe="audit.log.jsonl";VP=new Set});import{existsSync as vOe}from"node:fs";import{join as SOe}from"node:path";function wOe(t){let{cwd:e="."}=t,r=Rn(e);if(r.length===0)return[{detector:WP,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&&(vOe(SOe(e,i.artifact))||n.push({detector:WP,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var WP,D8,N8=y(()=>{"use strict";ri();WP="EVIDENCE_MISMATCH";D8={name:WP,run:wOe}});import{existsSync as xOe,readFileSync as $Oe}from"node:fs";import{join as kOe}from"node:path";function EOe(t){let e=kOe(t,L8);if(!xOe(e))return null;try{let n=((0,F8.parse)($Oe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*M8(t,e){for(let r of t??[])r.startsWith(j8)&&(yield{ref:r,name:r.slice(j8.length),field:e})}function AOe(t){let{cwd:e="."}=t,r=EOe(e);if(r===null)return[];let n;try{n=H(e)}catch(o){return[{detector:KP,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=[...M8(s.evidence_refs,"evidence_refs"),...M8(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:KP,severity:"warn",path:L8,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var F8,KP,j8,L8,z8,U8=y(()=>{"use strict";F8=St(Qt(),1);Be();KP="FIXTURE_REFERENCE_INVALID",j8="fixture:",L8="conformance/fixtures.yaml";z8={name:KP,run:AOe}});import{existsSync as ql,readFileSync as JP}from"node:fs";import{join as Va}from"node:path";function TOe(t){return ys(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function xp(t){if(!ql(t))return null;try{return JSON.parse(JP(t,"utf8"))}catch{return null}}function OOe(t,e){let r=Va(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(JP(r,"utf8"))}catch(c){e.push({detector:$o,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:$o,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=TOe(t);s!==a&&e.push({detector:$o,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function ROe(t,e){for(let r of q8){let n=Va(t,r.path);if(!ql(n))continue;let i=xp(n);if(!i){e.push({detector:$o,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:$o,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function IOe(t,e){let r=xp(Va(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of q8){let s=Va(t,o.path);if(!ql(s))continue;let a=xp(s);a?.version&&a.version!==n&&e.push({detector:$o,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Va(t,".claude-plugin","marketplace.json");if(ql(i)){let o=xp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:$o,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 POe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function COe(t,e){let r=Va(t,"src","cli","clad.ts"),n=Va(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!ql(r)||!ql(n))return;let i=POe(JP(r,"utf8"));if(i.length===0)return;let s=xp(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:$o,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 DOe(t){let{cwd:e="."}=t,r=[];return OOe(e,r),COe(e,r),ROe(e,r),IOe(e,r),r}var $o,q8,B8,H8=y(()=>{"use strict";vp();$o="HARNESS_INTEGRITY",q8=[{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"]}];B8={name:$o,run:DOe}});import{existsSync as NOe,readFileSync as jOe}from"node:fs";import{join as MOe}from"node:path";function LOe(t){let{cwd:e="."}=t;return ge(e,Gv,r=>UOe(r,e))}function zOe(t){let e=MOe(t,"spec/capabilities.yaml");if(!NOe(e))return!1;try{let r=G8.default.parse(jOe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function UOe(t,e){let r=t.features.length;if(r{"use strict";G8=St(Qt(),1);wt();Gv="HOLLOW_GOVERNANCE",FOe=8;Z8={name:Gv,run:LOe}});import{existsSync as W8,readFileSync as K8}from"node:fs";import{join as J8}from"node:path";function Y8(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 HOe(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 GOe(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function ZOe(t){let e=J8(t,"README.md"),r=J8(t,"docs","dogfood","matrix.md");if(!W8(e)||!W8(r))return[];let n=Y8(K8(e,"utf8"),qOe),i=Y8(K8(r,"utf8"),BOe);if(!n||!i)return[];let o=[];for(let[s,a]of Object.entries(n)){let c=GOe(a);if(c===null)continue;let l=i[s]??"not-run",u=HOe(l);u!==null&&c>u&&o.push({detector:X8,severity:"warn",path:"README.md",message:`README host-claims: '${s}' claims '${a}' but the newest matrix evidence is '${l}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${s}'.`})}return o}function VOe(t){let{cwd:e="."}=t;return ZOe(e)}var X8,qOe,BOe,Q8,e5=y(()=>{"use strict";X8="HOST_CLAIM_DRIFT",qOe=//,BOe=//;Q8={name:X8,run:VOe}});function WOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return t5(r.features.map(i=>i.id),"feature","spec/features/",n),t5((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function t5(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:r5,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var r5,n5,i5=y(()=>{"use strict";Be();r5="ID_COLLISION";n5={name:r5,run:WOe}});import{existsSync as $p,readFileSync as YP,readdirSync as XP,statSync as KOe,writeFileSync as s5}from"node:fs";import{join as ko}from"node:path";function o5(t){if(!$p(t))return 0;try{return XP(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function JOe(t){if(!$p(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=XP(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=ko(n,o),a;try{a=KOe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function YOe(t){let e=ko(t,"spec","capabilities.yaml");if(!$p(e))return 0;try{let r=Zv.default.parse(YP(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function _s(t="."){let e=o5(ko(t,"spec","features")),r=o5(ko(t,"spec","scenarios")),n=YOe(t),i=JOe(ko(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function Bl(t,e){let r=ko(t,"spec.yaml");if(!$p(r))return;let n=YP(r,"utf8"),i=XOe(n,e);i!==n&&s5(r,i)}function XOe(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 @@ -270,51 +270,51 @@ ${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 Za(t="."){let e=$o(t,"spec","features");if(!Sp(e))return!1;let r=[];for(let i of JP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Uv.parse)(KP($o(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 Wa(t="."){let e=ko(t,"spec","features");if(!$p(e))return!1;let r=[];for(let i of XP(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,Zv.parse)(YP(ko(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 i5($o(t,"spec","index.yaml"),n,"utf8"),!0}var Uv,wp=y(()=>{"use strict";Uv=St(Qt(),1)});import{existsSync as o5,readFileSync as s5,readdirSync as XOe}from"node:fs";import{join as YP}from"node:path";function QOe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=ys(e),i=r.inventory;if(!i){let s=a5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return XP(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...XP(e),{detector:xp,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 a5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:xp,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(...XP(e)),o}function XP(t){let e=YP(t,"spec","index.yaml"),r=YP(t,"spec","features");if(!o5(e)||!o5(r))return[];let n=new Map;try{for(let l of s5(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 XOe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=s5(YP(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:xp,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:xp,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 xp,a5,c5,l5=y(()=>{"use strict";wp();qe();xp="INVENTORY_DRIFT",a5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];c5={name:xp,run:QOe}});import{existsSync as eRe,readFileSync as tRe}from"node:fs";import{join as rRe}from"node:path";function iRe(t){let{cwd:e="."}=t,r=rRe(e,"src","spec","schema.json"),n=[];if(eRe(r)){let i;try{i=JSON.parse(tRe(r,"utf8"))}catch(o){n.push({detector:$p,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of nRe)i.required?.includes(o)||n.push({detector:$p,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:$p,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==u5&&n.push({detector:$p,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${u5}'`})}catch{}return n}var $p,nRe,u5,d5,f5=y(()=>{"use strict";qe();$p="META_INTEGRITY",nRe=["schema","project","features"],u5="0.1";d5={name:$p,run:iRe}});function oRe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return p5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),p5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function p5(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:m5,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 m5,h5,g5=y(()=>{"use strict";qe();m5="SLUG_CONFLICT";h5={name:m5,run:oRe}});function zl(t){return t==="planned"||t==="in_progress"}var qv=y(()=>{"use strict"});import{existsSync as sRe}from"node:fs";import{join as aRe}from"node:path";function cRe(t){let{cwd:e="."}=t;return he(e,Bv,r=>lRe(r,e))}function lRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=aRe(e,i);sRe(o)||r.push(uRe(n.id,i,n.status))}return r}function uRe(t,e,r){return zl(r)?{detector:Bv,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:Bv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Bv,Hv,QP=y(()=>{"use strict";qv();wt();Bv="MISSING_IMPLEMENTATION";Hv={name:Bv,run:cRe}});function dRe(t){let{cwd:e="."}=t;return he(e,eC,fRe)}function fRe(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:eC,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 eC,Gv,tC=y(()=>{"use strict";wt();eC="MISSING_TESTS";Gv={name:eC,run:dRe}});import{existsSync as pRe,readFileSync as mRe}from"node:fs";import{join as y5}from"node:path";function _5(t){if(pRe(t))try{return JSON.parse(mRe(t,"utf8"))}catch{return}}function _Re(t){let{cwd:e="."}=t,r=_5(y5(e,hRe)),n=_5(y5(e,gRe));if(!r||!n)return[{detector:rC,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>yRe&&i.push({detector:rC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var rC,hRe,gRe,yRe,b5,v5=y(()=>{"use strict";rC="PERFORMANCE_DRIFT",hRe="perf/baseline.json",gRe="perf/current.json",yRe=10;b5={name:rC,run:_Re}});import{existsSync as bRe}from"node:fs";import{join as vRe}from"node:path";function wRe(t){let{cwd:e="."}=t;return he(e,nC,r=>$Re(r,e))}function xRe(t,e){return(t.modules??[]).some(r=>bRe(vRe(e,r)))}function $Re(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||xRe(s,e)||r.push(s.id);let n=SRe;if(r.length<=n)return[];let i=r.slice(0,S5).join(", "),o=r.length>S5?", \u2026":"";return[{detector:nC,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 nC,SRe,S5,w5,x5=y(()=>{"use strict";wt();nC="PLANNED_BACKLOG",SRe=5,S5=8;w5={name:nC,run:wRe}});import{existsSync as kRe,readFileSync as ERe}from"node:fs";import{join as ARe}from"node:path";function RRe(t){let{cwd:e="."}=t;return he(e,iC,r=>IRe(r,e))}function IRe(t,e){if(t.features.lengthn.includes(i))?[{detector:iC,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 iC,TRe,ORe,$5,k5=y(()=>{"use strict";wt();iC="PROJECT_CONTEXT_DRIFT",TRe=8,ORe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];$5={name:iC,run:RRe}});function E5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Zv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function PRe(t){let{cwd:e="."}=t;return he(e,Zv,CRe)}function CRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...E5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Zv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...E5(e,n.features,`scenario ${n.id}.features`));return r}var Zv,Vv,oC=y(()=>{"use strict";wt();Zv="REFERENCE_INTEGRITY";Vv={name:Zv,run:PRe}});function kp(t=""){return new RegExp(DRe,t)}var DRe,sC=y(()=>{"use strict";DRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as NRe,readdirSync as jRe,readFileSync as MRe,statSync as FRe,writeFileSync as LRe}from"node:fs";import{dirname as zRe,join as Ep,normalize as URe,relative as qRe}from"node:path";function VRe(t){let e=[];for(let r of t.matchAll(ZRe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(kp("g"))??[])e.push(n);return[...new Set(e)].sort()}function WRe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function A5(t){return t.split("\\").join("/")}function KRe(t){return BRe.some(e=>t===e||t.startsWith(`${e}/`))}function JRe(t){let e=Ep(t,"docs");if(!NRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=jRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Ep(i,s),c;try{c=FRe(a)}catch{continue}let l=A5(qRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function YRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=URe(Ep(zRe(t),e));return A5(r)}function Ap(t="."){let e=[];for(let r of JRe(t)){let n;try{n=MRe(Ep(t,r),"utf8")}catch{continue}let i=WRe(n),o=VRe(i);if(KRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(HRe)?[]:i.match(kp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(GRe)){let d=YRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function T5(t="."){let e=Ap(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 LRe(Ep(t,"spec","_doc-links.yaml"),`${r.join(` +`;return s5(ko(t,"spec","index.yaml"),n,"utf8"),!0}var Zv,kp=y(()=>{"use strict";Zv=St(Qt(),1)});import{existsSync as a5,readFileSync as c5,readdirSync as QOe}from"node:fs";import{join as QP}from"node:path";function eRe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=_s(e),i=r.inventory;if(!i){let s=l5.filter(([c])=>(n[c]??0)>0);if(s.length===0)return eC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...eC(e),{detector:Ep,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 l5){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:Ep,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(...eC(e)),o}function eC(t){let e=QP(t,"spec","index.yaml"),r=QP(t,"spec","features");if(!a5(e)||!a5(r))return[];let n=new Map;try{for(let l of c5(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 QOe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=c5(QP(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:Ep,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:Ep,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 Ep,l5,u5,d5=y(()=>{"use strict";kp();Be();Ep="INVENTORY_DRIFT",l5=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];u5={name:Ep,run:eRe}});import{existsSync as tRe,readFileSync as rRe}from"node:fs";import{join as nRe}from"node:path";function oRe(t){let{cwd:e="."}=t,r=nRe(e,"src","spec","schema.json"),n=[];if(tRe(r)){let i;try{i=JSON.parse(rRe(r,"utf8"))}catch(o){n.push({detector:Ap,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of iRe)i.required?.includes(o)||n.push({detector:Ap,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Ap,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=H(e);i.schema!==f5&&n.push({detector:Ap,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${f5}'`})}catch{}return n}var Ap,iRe,f5,p5,m5=y(()=>{"use strict";Be();Ap="META_INTEGRITY",iRe=["schema","project","features"],f5="0.1";p5={name:Ap,run:oRe}});function sRe(t){let{cwd:e="."}=t,r;try{r=H(e)}catch{return[]}let n=[];return h5(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),h5((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function h5(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:g5,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 g5,y5,_5=y(()=>{"use strict";Be();g5="SLUG_CONFLICT";y5={name:g5,run:sRe}});function Hl(t){return t==="planned"||t==="in_progress"}var Vv=y(()=>{"use strict"});import{existsSync as aRe}from"node:fs";import{join as cRe}from"node:path";function lRe(t){let{cwd:e="."}=t;return ge(e,Wv,r=>uRe(r,e))}function uRe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=cRe(e,i);aRe(o)||r.push(dRe(n.id,i,n.status))}return r}function dRe(t,e,r){return Hl(r)?{detector:Wv,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:Wv,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var Wv,Kv,tC=y(()=>{"use strict";Vv();wt();Wv="MISSING_IMPLEMENTATION";Kv={name:Wv,run:lRe}});function fRe(t){let{cwd:e="."}=t;return ge(e,rC,pRe)}function pRe(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:rC,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 rC,Jv,nC=y(()=>{"use strict";wt();rC="MISSING_TESTS";Jv={name:rC,run:fRe}});import{existsSync as mRe,readFileSync as hRe}from"node:fs";import{join as b5}from"node:path";function v5(t){if(mRe(t))try{return JSON.parse(hRe(t,"utf8"))}catch{return}}function bRe(t){let{cwd:e="."}=t,r=v5(b5(e,gRe)),n=v5(b5(e,yRe));if(!r||!n)return[{detector:iC,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>_Re&&i.push({detector:iC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var iC,gRe,yRe,_Re,S5,w5=y(()=>{"use strict";iC="PERFORMANCE_DRIFT",gRe="perf/baseline.json",yRe="perf/current.json",_Re=10;S5={name:iC,run:bRe}});import{existsSync as vRe}from"node:fs";import{join as SRe}from"node:path";function xRe(t){let{cwd:e="."}=t;return ge(e,oC,r=>kRe(r,e))}function $Re(t,e){return(t.modules??[]).some(r=>vRe(SRe(e,r)))}function kRe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||$Re(s,e)||r.push(s.id);let n=wRe;if(r.length<=n)return[];let i=r.slice(0,x5).join(", "),o=r.length>x5?", \u2026":"";return[{detector:oC,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 oC,wRe,x5,$5,k5=y(()=>{"use strict";wt();oC="PLANNED_BACKLOG",wRe=5,x5=8;$5={name:oC,run:xRe}});import{existsSync as ERe,readFileSync as ARe}from"node:fs";import{join as TRe}from"node:path";function IRe(t){let{cwd:e="."}=t;return ge(e,sC,r=>PRe(r,e))}function PRe(t,e){if(t.features.lengthn.includes(i))?[{detector:sC,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 sC,ORe,RRe,E5,A5=y(()=>{"use strict";wt();sC="PROJECT_CONTEXT_DRIFT",ORe=8,RRe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];E5={name:sC,run:IRe}});function T5(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:Yv,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function CRe(t){let{cwd:e="."}=t;return ge(e,Yv,DRe)}function DRe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...T5(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:Yv,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...T5(e,n.features,`scenario ${n.id}.features`));return r}var Yv,Xv,aC=y(()=>{"use strict";wt();Yv="REFERENCE_INTEGRITY";Xv={name:Yv,run:CRe}});function Tp(t=""){return new RegExp(NRe,t)}var NRe,cC=y(()=>{"use strict";NRe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as jRe,readdirSync as MRe,readFileSync as FRe,statSync as LRe,writeFileSync as zRe}from"node:fs";import{dirname as URe,join as Op,normalize as qRe,relative as BRe}from"node:path";function WRe(t){let e=[];for(let r of t.matchAll(VRe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Tp("g"))??[])e.push(n);return[...new Set(e)].sort()}function KRe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function O5(t){return t.split("\\").join("/")}function JRe(t){return HRe.some(e=>t===e||t.startsWith(`${e}/`))}function YRe(t){let e=Op(t,"docs");if(!jRe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=MRe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Op(i,s),c;try{c=LRe(a)}catch{continue}let l=O5(BRe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function XRe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=qRe(Op(URe(t),e));return O5(r)}function Rp(t="."){let e=[];for(let r of YRe(t)){let n;try{n=FRe(Op(t,r),"utf8")}catch{continue}let i=KRe(n),o=WRe(i);if(JRe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(GRe)?[]:i.match(Tp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(ZRe)){let d=XRe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function R5(t="."){let e=Rp(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 zRe(Op(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var BRe,HRe,GRe,ZRe,Wv=y(()=>{"use strict";sC();BRe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],HRe="clad-doc-links: ignore",GRe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,ZRe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as XRe}from"node:fs";import{join as QRe}from"node:path";function eIe(t){let{cwd:e="."}=t;return he(e,Kv,r=>tIe(r,e))}function tIe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Ap(e).docs){for(let o of i.doc_links)XRe(QRe(e,o))||n.push({detector:Kv,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:Kv,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 Kv,Jv,aC=y(()=>{"use strict";Wv();wt();Kv="DOC_LINK_INTEGRITY";Jv={name:Kv,run:eIe}});function rIe(t){let{cwd:e="."}=t;return he(e,Tp,r=>nIe(r))}function nIe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=O5,o=t.project.onboarding_seeded===!0&&!i;r>=O5&&n.length===0&&e.push({detector:Tp,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:Tp,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:Tp,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 Tp,O5,R5,I5=y(()=>{"use strict";wt();Tp="SCENARIO_COVERAGE",O5=8;R5={name:Tp,run:rIe}});import{createHash as iIe}from"node:crypto";function oIe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Op(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??P5),sample:oIe(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(P5),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Rp(t){return(t.features??[]).filter(e=>e.status==="done").length}function sIe(t,e){return e<=0?!1:e>=1?!0:parseInt(iIe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var P5,Yv=y(()=>{"use strict";P5=["unwanted"]});import{chmodSync as aIe,existsSync as D5,readFileSync as cIe,readdirSync as lIe,statSync as N5,unlinkSync as uIe,utimesSync as dIe,writeFileSync as fIe}from"node:fs";import{join as j5}from"node:path";import M5 from"node:process";function pIe(t){return VK(t).map(e=>{try{let r=N5(e);return r.isFile()?{path:e,body:cIe(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 mIe(t){let e=[];for(let r of t)if(!r.nonFile)try{if(r.body===void 0){if(!D5(r.path))continue;if(!N5(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}uIe(r.path);continue}fIe(r.path,r.body),r.mode!==void 0&&aIe(r.path,r.mode),r.atime&&r.mtime&&dIe(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function hIe(t){let e=!1,r=n=>{for(let i of lIe(n,{withFileTypes:!0})){if(e)return;let o=j5(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 cC(t={}){let{cwd:e="."}=t,r=j5(e,_s);if(!D5(r)||!hIe(r))return{stage:Va,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${_s}/ \u2014 skipped`};let n=dt(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:Va,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let o;try{o=pIe(e)}catch(d){return{stage:Va,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=Ye(i.cmd,c,{cwd:e,reject:!1})}catch(d){a=d}let l=mIe(o);if(l.length>0)return{stage:Va,pass:!1,exitCode:1,stderr:`could not restore the full test report after the scoped oracle run: ${l.join("; ")}`};if(a||!s)return{stage:Va,pass:!1,exitCode:1,stderr:`oracle runner failed to start: ${a?.message??"unknown error"}`};let u=qt(Va,i.cmd,s,c);return u||tr(Va,s)}var Va,_s,gIe,lC=y(()=>{"use strict";Mr();on();cp();On();Va="stage_2.3",_s="tests/oracle";gIe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${M5.argv[1]}`;if(gIe){let t=cC();console.log(JSON.stringify(t)),M5.exit(t.exitCode)}});import{existsSync as yIe}from"node:fs";import{join as _Ie}from"node:path";function bIe(t){let{cwd:e="."}=t;return he(e,ri,r=>vIe(r,e))}function vIe(t,e){let r=[],n=Op(t.project,Rp(t)),i=n.reportOnly?"info":"error",o=n.mandateActive?Rn(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(Ip(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:ri,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(!yIe(_Ie(e,f))){r.push({detector:ri,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:ri,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:ri,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:ri,severity:"error",path:f,message:`${l.id}.${u.id} oracle '${f}' is NOT impl-blind: authored by the implementer ('${m}')`}):m||r.push({detector:ri,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:ri,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:ri,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:ri,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 ri,F5,L5=y(()=>{"use strict";ti();Yv();lC();wt();ri="SPEC_CONFORMANCE";F5={name:ri,run:bIe}});function SIe(t){let{cwd:e="."}=t,r=Rn(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=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>z5&&i.push({detector:uC,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${z5})`})}return i}var uC,z5,U5,q5=y(()=>{"use strict";ti();uC="STALE_EVIDENCE",z5=90;U5={name:uC,run:SIe}});import{existsSync as B5}from"node:fs";import{join as H5}from"node:path";function wIe(t){let{cwd:e="."}=t;return he(e,Ul,r=>xIe(r,e))}function xIe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:Ul,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:Ul,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=>B5(H5(e,o)));i.length>0&&r.push({detector:Ul,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}zl(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>B5(H5(e,i)))&&r.push({detector:Ul,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 Ul,Xv,dC=y(()=>{"use strict";qv();wt();Ul="STALE_SPECIFICATION";Xv={name:Ul,run:wIe}});import{existsSync as G5,statSync as Z5}from"node:fs";import{join as V5}from"node:path";function kIe(t,e){let r=0;for(let n of e){let i=V5(t,n);if(!G5(i))continue;let o=Z5(i).mtimeMs;o>r&&(r=o)}return r}function EIe(t){let{cwd:e="."}=t;return he(e,fC,r=>AIe(r,e))}function AIe(t,e){let r=Di(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=kIe(e,n);if(i===0)return[];let o=gs([...r.testGlobs],{cwd:e,dot:!1});if(o.length===0)return[];let s=[];for(let a of o){let c=V5(e,a);if(!G5(c))continue;let l=Z5(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>$Ie&&s.push({detector:fC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var fC,$Ie,Qv,pC=y(()=>{"use strict";yp();Ua();wt();fC="STALE_TESTS",$Ie=30;Qv={name:fC,run:EIe}});import{existsSync as TIe}from"node:fs";import{join as OIe}from"node:path";function RIe(t){let{cwd:e="."}=t;return he(e,Pp,r=>IIe(r,e))}function IIe(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:Pp,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=>!TIe(OIe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:Pp,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:Pp,severity:zl(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 Pp,eS,mC=y(()=>{"use strict";qv();wt();Pp="STATUS_DRIFT";eS={name:Pp,run:RIe}});function PIe(t){let{cwd:e="."}=t;return he(e,tS,r=>CIe(r,e))}function CIe(t,e){let r=dt(e).language;return r==="unknown"?[{detector:tS,severity:"info",message:"no manifest matched \u2014 language cannot be cross-checked"}]:t.project.language===r?[]:[{detector:tS,severity:"warn",message:`spec.project.language='${t.project.language}' but the manifest chain detects '${r}'`}]}var tS,W5,K5=y(()=>{"use strict";on();wt();tS="TECH_STACK_MISMATCH";W5={name:tS,run:PIe}});function MIe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function FIe(t){let{cwd:e="."}=t;return he(e,hC,r=>LIe(r,e))}function LIe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=gs([...MIe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:hC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var hC,J5,DIe,NIe,jIe,rS,gC=y(()=>{"use strict";yp();zP();wt();hC="UNMAPPED_ARTIFACT",J5=["src/stages/**/*.ts","src/spec/**/*.ts"],DIe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},NIe={kotlin:"src/main/kotlin"},jIe=8;rS={name:hC,run:FIe}});import{existsSync as Y5}from"node:fs";import{join as X5}from"node:path";function UIe(t){return zIe.some(e=>t.startsWith(e))}function qIe(t){let{cwd:e="."}=t;return he(e,yC,r=>BIe(r,e))}function BIe(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(UIe(o))continue;let s=o.split("#",1)[0];Y5(X5(e,o))||s&&Y5(X5(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 Cx(t){return`${JSON.stringify(t,null,2)} +`}function Kee(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?`[[${Gee(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(Zee);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(Zee);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}/${Gee(s)}.md`,`${a.join(` +`)}`)}return o}function Zee(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as AUe}from"node:fs";import{dirname as TUe,join as wj}from"node:path";import{fileURLToPath as OUe}from"node:url";var xj=TUe(OUe(import.meta.url));function Jee(t){for(let e of[wj(xj,"viewer",t),wj(xj,"..","graph","viewer",t),wj(xj,"..","..","dist","viewer",t)])try{return AUe(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function Yee(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -892,21 +895,21 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}HP();aC();QP();tC();oC();BP();pC();mC();gC();_C();Gm();sC();qe();var EUe=[Gv,nS,Hv,rS,Vv,Jv,Lv,eS,Qv,Fv];function AUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[ze.module(n),ze.test(n),ze.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=kp().exec(t.message??"");return r&&e.has(ze.feature(r[0]))?[ze.feature(r[0])]:[]}function Px(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{$a(e,H(e))}catch{}try{for(let o of EUe){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 AUe(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{$a(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();qe();Ai();var OUe=new Set(["mermaid","dot","json","obsidian","html"]);function Yee(t={}){try{let e=t.format??"mermaid";if(!OUe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=hc(n,".");if(t.focus){let s=Ex(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=kx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Vee(i);for(let[c,l]of a){let u=TUe(s,c);xj(kj(u),{recursive:!0}),$j(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=Ix(i,Px(i,"."));xj(kj(t.out),{recursive:!0}),$j(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"?Zee(i):r==="json"?Rx(i):Gee(i);t.out?(xj(kj(t.out),{recursive:!0}),$j(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 Xee(){try{let t=hc(H(),".");process.stdout.write(Jee(Cx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Gm();import{createServer as RUe}from"node:http";import{existsSync as IUe,watch as PUe}from"node:fs";import{join as CUe}from"node:path";qe();Ai();function DUe(t={}){let e=t.cwd??".",r=new Set,n=()=>hc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}ZP();lC();tC();nC();aC();GP();hC();gC();_C();vC();Km();cC();Be();var RUe=[Jv,cS,Kv,aS,Xv,tS,Hv,oS,iS,Bv];function IUe(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[Ue.module(n),Ue.test(n),Ue.doc(n)].filter(o=>e.has(o));if(i.length>0)return i}let r=Tp().exec(t.message??"");return r&&e.has(Ue.feature(r[0]))?[Ue.feature(r[0])]:[]}function Nx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ea(e,H(e))}catch{}try{for(let o of RUe){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 IUe(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{Ea(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}$j();Be();Oi();var CUe=new Set(["mermaid","dot","json","obsidian","html"]);function Qee(t={}){try{let e=t.format??"mermaid";if(!CUe.has(e)){L("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=H(),i=bc(n,".");if(t.focus){let s=Ox(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=Tx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Kee(i);for(let[c,l]of a){let u=PUe(s,c);kj(Aj(u),{recursive:!0}),Ej(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=Dx(i,Nx(i,"."));kj(Aj(t.out),{recursive:!0}),Ej(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"?Wee(i):r==="json"?Cx(i):Vee(i);t.out?(kj(Aj(t.out),{recursive:!0}),Ej(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 ete(){try{let t=bc(H(),".");process.stdout.write(Xee(jx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}Km();import{createServer as DUe}from"node:http";import{existsSync as NUe,watch as jUe}from"node:fs";import{join as MUe}from"node:path";Be();Oi();function FUe(t={}){let e=t.cwd??".",r=new Set,n=()=>bc(H(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=RUe((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=Rx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Px(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=DUe((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=Cx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Nx(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=Ix(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=CUe(e,u);if(IUe(d))try{let f=PUe(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=Dx(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=MUe(e,u);if(NUe(d))try{let f=jUe(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 Qee(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await DUe({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 NUe=["stage_1.1","stage_2.1","stage_2.3"];function jUe(t){return(t.features??[]).filter(e=>e.status==="done")}function MUe(t,e){let r=jUe(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 ete(t,e){let r=[];for(let n of NUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=MUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}gS();import tte from"node:process";function FUe(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 Dx(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=FUe(n,t);i.pass||r.push(i)}return r}ti();var Ej="stage_4.1";function Aj(t={}){let{cwd:e="."}=t,r=Rn(e);if(r.length===0)return{stage:Ej,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Dx(r);if(n.length===0)return{stage:Ej,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Ej,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var LUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tte.argv[1]}`;if(LUe){let t=Aj();console.log(JSON.stringify(t)),tte.exit(t.exitCode)}pl();import{randomBytes as zUe}from"node:crypto";import{unlinkSync as UUe}from"node:fs";import{tmpdir as qUe}from"node:os";import{join as BUe,resolve as Tj}from"node:path";import HUe from"node:process";var qr=null;function rte(t){qr={cwd:Tj(t),run:null,jsonFile:null}}function nte(){return qr!==null}function ite(t,e){if(!qr||qr.cwd!==Tj(t))return null;if(qr.run)return qr.run;let r=BUe(qUe(),`clad-shared-vitest-${HUe.pid}-${zUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function ote(t){return!qr||qr.cwd!==Tj(t)?null:qr.run}function ste(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function ate(){let t=qr?.jsonFile;if(qr=null,t)try{UUe(t)}catch{}}Mr();import cte from"node:process";var Nx="stage_1.4";function Oj(t={}){let{cwd:e="."}=t,r;try{r=Ye("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Nx,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:Nx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Nx,pass:!0,exitCode:0}:{stage:Nx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var GUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${cte.argv[1]}`;if(GUe){let t=Oj();console.log(JSON.stringify(t)),cte.exit(t.exitCode)}Mr();import lte from"node:process";Zm();On();var jx="stage_2.2";function Rj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Do("coverage",t))}catch(c){return{stage:jx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:jx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=ote(e),s=o?o.proc:Ye(r,[...n],{cwd:e,reject:!1}),a=qt(jx,r,s,n);return a||tr(jx,s)}var WUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${lte.argv[1]}`;if(WUe){let t=Rj();console.log(JSON.stringify(t)),lte.exit(t.exitCode)}Dp();Ij();Mr();on();On();import dte from"node:process";var zx="stage_3.2";function Pj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:zx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Nl(e,o[o.length-1]))return{stage:zx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(zx,i,s,o);return a||tr(zx,s)}var dqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dte.argv[1]}`;if(dqe){let t=Pj();console.log(JSON.stringify(t)),dte.exit(t.exitCode)}Mr();qe();On();import{existsSync as fqe}from"node:fs";import{resolve as pte}from"node:path";import mte from"node:process";var ai="stage_2.4",Cj=5e3,pqe=3e4;function Dj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:ai,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return hqe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:ai,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:ai,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=pte(e,r.path);if(!fqe(s))return{stage:ai,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Cj,c;try{c=Ye(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=qt(ai,r.path,c);if(l)return l;if(c.timedOut)return{stage:ai,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:ai,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:ai,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var fte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},mqe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function hqe(t,e,r){let n=Math.min(e.length*Cj,pqe),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(gqe(t,s,r))}return yqe(o)}function gqe(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("/")?pte(t,a):a,u=Cj,d;try{d=Ye(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Fa(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 yqe(t){let e="skip";for(let o of t)fte[o.disposition]>fte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${mqe[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:ai,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:ai,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var _qe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${mte.argv[1]}`;if(_qe){let t=Dj();console.log(JSON.stringify(t)),mte.exit(t.exitCode)}Mr();on();On();import hte from"node:process";var Ux="stage_3.1";function Nj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Ux,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Nl(e,o[o.length-1]))return{stage:Ux,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Ux,i,s,o);return a||tr(Ux,s)}var bqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hte.argv[1]}`;if(bqe){let t=Nj();console.log(JSON.stringify(t)),hte.exit(t.exitCode)}lC();jj();Mj();Mr();Fx();import{randomBytes as Eqe}from"node:crypto";import{unlinkSync as Aqe}from"node:fs";import{tmpdir as Tqe}from"node:os";import{join as Oqe}from"node:path";import Lj from"node:process";Zm();On();qe();import{readFileSync as wqe}from"node:fs";import{resolve as _te}from"node:path";function xqe(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=_te(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 $qe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function kqe(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=$qe(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(_te(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 Fj(t,e){try{let r=xqe(wqe(t,"utf8"));return r?kqe(H(e),r,e):[]}catch{return[]}}var Ki="stage_2.1";function bte(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Rqe(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];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 Iqe(t,e,r){let n,i;try{({cmd:n,args:i}=Do("coverage",t))}catch{return null}if(!n||!i||!bte(n,i))return null;let o=n,s=i,a=ite(e,d=>Ye(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(qt(Ki,n,c,s))return null;let u=tr(Ki,c);if(ste(u)==="fallback")return null;if(r){let d=Fj(l,e);if(d.length>0)return{stage:Ki,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ki,pass:!0,exitCode:0}}function zj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=Do("test",t))}catch(u){return{stage:Ki,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Ki,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=bte(n,i),a=r&&s;if(nte()&&s){let u=Iqe(t,e,a);if(u)return u}let c,l=i;a&&(c=Oqe(Tqe(),`clad-vitest-${Lj.pid}-${Eqe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Ye(n,[...l],{cwd:e,reject:!1}),d=qt(Ki,n,u,l);if(d)return d;let f=Au("unit",tr(Ki,u),u);if(r&&f.pass&&Rqe(u)){let p={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Ki,pass:!1,exitCode:1,findings:[p],stderr:p.message}}if(a&&f.pass&&c){let p=Fj(c,e);if(p.length>0)return{stage:Ki,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{Aqe(c)}catch{}}}var Pqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Lj.argv[1]}`;if(Pqe){let t=zj();console.log(JSON.stringify(t)),Lj.exit(t.exitCode)}Mr();on();On();import vte from"node:process";var Hx="stage_3.3";function Uj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Hx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Nl(e,o[o.length-1]))return{stage:Hx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Hx,i,s,o);return a||tr(Hx,s)}var Cqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${vte.argv[1]}`;if(Cqe){let t=Uj();console.log(JSON.stringify(t)),vte.exit(t.exitCode)}dC();Cf();ga();Bj();wp();Wv();var Ate=St(Qt(),1);import{existsSync as Hj,readFileSync as Hqe,readdirSync as Ete,statSync as Gqe,writeFileSync as Zqe}from"node:fs";import{basename as Jm,join as Ym,relative as kte}from"node:path";var Vqe=["self-dogfood:","fixture:","derived:"],Tte=/\.(test|spec)\.[jt]sx?$/;function Ote(t,e=t,r=[]){let n;try{n=Ete(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=Ym(e,i);try{Gqe(o).isDirectory()?Ote(t,o,r):Tte.test(i)&&r.push(o)}catch{continue}}return r}function Rte(t="."){let e=Ym(t,"spec","features"),r=Ym(t,"tests"),n=[],i=[];if(!Hj(e)||!Hj(r))return{repaired:n,suggested:i};let o=Ote(r),s=new Map;for(let a of o){let c=kte(t,a).split("\\").join("/"),l=s.get(Jm(a))??[];l.push(c),s.set(Jm(a),l)}for(let a of Ete(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=Ym(e,a),l,u;try{l=Hqe(c,"utf8"),u=(0,Ate.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(Vqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Hj(Ym(t,b)))continue;let _=s.get(Jm(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=>Jm(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>kte(t,h).split("\\").join("/")).find(h=>{let g=Jm(h).replace(Tte,"");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 tte(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await FUe({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 LUe=["stage_1.1","stage_2.1","stage_2.3"];function zUe(t){return(t.features??[]).filter(e=>e.status==="done")}function UUe(t,e){let r=zUe(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 rte(t,e){let r=[];for(let n of LUe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=UUe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}bS();import nte from"node:process";function qUe(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 Mx(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=qUe(n,t);i.pass||r.push(i)}return r}ri();var Tj="stage_4.1";function Oj(t={}){let{cwd:e="."}=t,r=Rn(e);if(r.length===0)return{stage:Tj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Mx(r);if(n.length===0)return{stage:Tj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Tj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var BUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${nte.argv[1]}`;if(BUe){let t=Oj();console.log(JSON.stringify(t)),nte.exit(t.exitCode)}yl();import{randomBytes as HUe}from"node:crypto";import{unlinkSync as GUe}from"node:fs";import{tmpdir as ZUe}from"node:os";import{join as VUe,resolve as Rj}from"node:path";import WUe from"node:process";var qr=null;function ite(t){qr={cwd:Rj(t),run:null,jsonFile:null}}function ote(){return qr!==null}function ste(t,e){if(!qr||qr.cwd!==Rj(t))return null;if(qr.run)return qr.run;let r=VUe(ZUe(),`clad-shared-vitest-${WUe.pid}-${HUe(6).toString("hex")}.json`);qr.jsonFile=r;let n=e(r);return qr.run={proc:n,jsonFile:r},qr.run}function ate(t){return!qr||qr.cwd!==Rj(t)?null:qr.run}function cte(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function lte(){let t=qr?.jsonFile;if(qr=null,t)try{GUe(t)}catch{}}Mr();import ute from"node:process";var Fx="stage_1.4";function Ij(t={}){let{cwd:e="."}=t,r;try{r=Ye("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Fx,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:Fx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Fx,pass:!0,exitCode:0}:{stage:Fx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var KUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ute.argv[1]}`;if(KUe){let t=Ij();console.log(JSON.stringify(t)),ute.exit(t.exitCode)}Mr();import dte from"node:process";Jm();On();var Lx="stage_2.2";function Pj(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=No("coverage",t))}catch(c){return{stage:Lx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Lx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=ate(e),s=o?o.proc:Ye(r,[...n],{cwd:e,reject:!1}),a=qt(Lx,r,s,n);return a||tr(Lx,s)}var XUe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dte.argv[1]}`;if(XUe){let t=Pj();console.log(JSON.stringify(t)),dte.exit(t.exitCode)}Mp();Cj();Mr();on();On();import pte from"node:process";var Bx="stage_3.2";function Dj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Bx,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Ll(e,o[o.length-1]))return{stage:Bx,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Bx,i,s,o);return a||tr(Bx,s)}var hqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${pte.argv[1]}`;if(hqe){let t=Dj();console.log(JSON.stringify(t)),pte.exit(t.exitCode)}Mr();Be();On();import{existsSync as gqe}from"node:fs";import{resolve as hte}from"node:path";import gte from"node:process";var li="stage_2.4",Nj=5e3,yqe=3e4;function jj(t={}){let{cwd:e="."}=t,r,n=[],i=!1,o=new Map;try{let p=H(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:li,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return bqe(e,n,{anyDone:i,featureStatus:o});if(!r)return{stage:li,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:li,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:li,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let s=hte(e,r.path);if(!gqe(s))return{stage:li,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??Nj,c;try{c=Ye(s,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(p){c=p}let l=qt(li,r.path,c);if(l)return l;if(c.timedOut)return{stage:li,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:li,pass:!0,exitCode:0,disposition:"liveness"};let f=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:li,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${f?` \u2014 ${f.slice(0,200)}`:""}`}}var mte={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},_qe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function bqe(t,e,r){let n=Math.min(e.length*Nj,yqe),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(vqe(t,s,r))}return Sqe(o)}function vqe(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("/")?hte(t,a):a,u=Nj,d;try{d=Ye(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(za(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 Sqe(t){let e="skip";for(let o of t)mte[o.disposition]>mte[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${_qe[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:li,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:li,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var wqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${gte.argv[1]}`;if(wqe){let t=jj();console.log(JSON.stringify(t)),gte.exit(t.exitCode)}Mr();on();On();import yte from"node:process";var Hx="stage_3.1";function Mj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Hx,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Ll(e,o[o.length-1]))return{stage:Hx,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Hx,i,s,o);return a||tr(Hx,s)}var xqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${yte.argv[1]}`;if(xqe){let t=Mj();console.log(JSON.stringify(t)),yte.exit(t.exitCode)}dC();Fj();Lj();Mr();Ux();import{randomBytes as Rqe}from"node:crypto";import{unlinkSync as Iqe}from"node:fs";import{tmpdir as Pqe}from"node:os";import{join as Cqe}from"node:path";import Uj from"node:process";Jm();On();Be();import{readFileSync as Eqe}from"node:fs";import{resolve as vte}from"node:path";function Aqe(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=vte(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 Tqe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function Oqe(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=Tqe(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(vte(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 zj(t,e){try{let r=Aqe(Eqe(t,"utf8"));return r?Oqe(H(e),r,e):[]}catch{return[]}}var Ji="stage_2.1";function Ste(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Dqe(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];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 Nqe(t,e,r){let n,i;try{({cmd:n,args:i}=No("coverage",t))}catch{return null}if(!n||!i||!Ste(n,i))return null;let o=n,s=i,a=ste(e,d=>Ye(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(qt(Ji,n,c,s))return null;let u=tr(Ji,c);if(cte(u)==="fallback")return null;if(r){let d=zj(l,e);if(d.length>0)return{stage:Ji,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ji,pass:!0,exitCode:0}}function qj(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,o;try{({cmd:n,args:i,language:o}=No("test",t))}catch(u){return{stage:Ji,pass:!1,exitCode:1,stderr:u.message}}if(!n||!i)return{stage:Ji,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`};let s=Ste(n,i),a=r&&s;if(ote()&&s){let u=Nqe(t,e,a);if(u)return u}let c,l=i;a&&(c=Cqe(Pqe(),`clad-vitest-${Uj.pid}-${Rqe(6).toString("hex")}.json`),l=[...i,"--reporter=default","--reporter=json",`--outputFile=${c}`]);try{let u=Ye(n,[...l],{cwd:e,reject:!1}),d=qt(Ji,n,u,l);if(d)return d;let f=Ru("unit",tr(Ji,u),u);if(r&&f.pass&&Dqe(u)){let p={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Ji,pass:!1,exitCode:1,findings:[p],stderr:p.message}}if(a&&f.pass&&c){let p=zj(c,e);if(p.length>0)return{stage:Ji,pass:!1,exitCode:1,findings:p,stderr:p[0].message}}return f}finally{if(c)try{Iqe(c)}catch{}}}var jqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Uj.argv[1]}`;if(jqe){let t=qj();console.log(JSON.stringify(t)),Uj.exit(t.exitCode)}Mr();on();On();import wte from"node:process";var Vx="stage_3.3";function Bj(t={}){let{cwd:e="."}=t,r=dt(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:Vx,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Ll(e,o[o.length-1]))return{stage:Vx,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ye(i,[...o],{cwd:e,reject:!1}),a=qt(Vx,i,s,o);return a||tr(Vx,s)}var Mqe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wte.argv[1]}`;if(Mqe){let t=Bj();console.log(JSON.stringify(t)),wte.exit(t.exitCode)}pC();jf();_a();Gj();kp();Qv();var Ote=St(Qt(),1);import{existsSync as Zj,readFileSync as Wqe,readdirSync as Tte,statSync as Kqe,writeFileSync as Jqe}from"node:fs";import{basename as eh,join as th,relative as Ate}from"node:path";var Yqe=["self-dogfood:","fixture:","derived:"],Rte=/\.(test|spec)\.[jt]sx?$/;function Ite(t,e=t,r=[]){let n;try{n=Tte(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=th(e,i);try{Kqe(o).isDirectory()?Ite(t,o,r):Rte.test(i)&&r.push(o)}catch{continue}}return r}function Pte(t="."){let e=th(t,"spec","features"),r=th(t,"tests"),n=[],i=[];if(!Zj(e)||!Zj(r))return{repaired:n,suggested:i};let o=Ite(r),s=new Map;for(let a of o){let c=Ate(t,a).split("\\").join("/"),l=s.get(eh(a))??[];l.push(c),s.set(eh(a),l)}for(let a of Tte(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=th(e,a),l,u;try{l=Wqe(c,"utf8"),u=(0,Ote.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(Yqe.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(Zj(th(t,b)))continue;let _=s.get(eh(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=>eh(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Ate(t,h).split("\\").join("/")).find(h=>{let g=eh(h).replace(Rte,"");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&&Zqe(c,l,"utf8")}return{repaired:n,suggested:i}}fl();import{existsSync as Wqe,readFileSync as Kqe}from"node:fs";import{join as Jqe}from"node:path";function Yqe(t,e){let r=Jqe(t,e);if(!Wqe(r))return[];let n=[];for(let i of Kqe(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 Ite(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=>Yqe(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 Pte(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(` -`)}Yv();qe();Ai();ti();fl();var Gj=["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"],Xqe=[...Gj,"att"];function Qqe(t,e,r){if(e.startsWith("stage_4")){let n=Rn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Dx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function e4e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":M_(e,r,t).state==="fresh"?"\u2713":"!"}function Wx(t,e="."){let r=ss(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Gj.map(o=>Qqe(i,o,e)),e4e(i,r,e)]}));return{columns:Xqe,rows:n}}function Cte(t,e=".",r={}){let n=r.internal??!1,i=Wx(t,e),o=[...Gj.map(c=>n?c.replace("stage_",""):t4e(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 t4e(t){return Ea(t).slice(0,3)}async function A8e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Kue(),Wue)),Promise.resolve().then(()=>(ede(),Que)),Promise.resolve().then(()=>(Wp(),i7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Mee(s),prepareInit:({cwd:s,mode:a,intent:c})=>Nee(s,a,c),initialize:lj,prepareClarify:(s,{cwd:a})=>jee(a,s),clarify:pj,resolveReview:(s,{cwd:a})=>Iee(s,{cwd:a})}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function T8e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await lj({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){V.stdout.write(`${JSON.stringify(n,null,2)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&Jqe(c,l,"utf8")}return{repaired:n,suggested:i}}gl();import{existsSync as Xqe,readFileSync as Qqe}from"node:fs";import{join as e4e}from"node:path";function t4e(t,e){let r=e4e(t,e);if(!Xqe(r))return[];let n=[];for(let i of Qqe(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 Cte(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=>t4e(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 Dte(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(` +`)}rS();Be();Oi();ri();gl();var Vj=["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"],r4e=[...Vj,"att"];function n4e(t,e,r){if(e.startsWith("stage_4")){let n=Rn(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Mx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function i4e(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 Yx(t,e="."){let r=as(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...Vj.map(o=>n4e(i,o,e)),i4e(i,r,e)]}));return{columns:r4e,rows:n}}function Nte(t,e=".",r={}){let n=r.internal??!1,i=Yx(t,e),o=[...Vj.map(c=>n?c.replace("stage_",""):o4e(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 o4e(t){return Ta(t).slice(0,3)}async function P8e(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Jue(),Kue)),Promise.resolve().then(()=>(tde(),ede)),Promise.resolve().then(()=>(Xp(),s7))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Lee(s),prepareInit:({cwd:s,mode:a,intent:c})=>Mee(s,a,c),initialize:dj,prepareClarify:(s,{cwd:a})=>Fee(a,s),clarify:hj,resolveReview:(s,{cwd:a})=>Cee(s,{cwd:a})}});n(i.server);let o=new r;V.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(o)}async function C8e(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await dj({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){V.stdout.write(`${JSON.stringify(n,null,2)} `),V.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){V.stdout.write(` \u{1F4A1} A few more details would sharpen the spec: `);for(let[o,s]of n.clarifyingQuestions.entries())V.stdout.write(` ${o+1}. ${s} @@ -917,30 +920,30 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&Zqe(c,l,"u `),V.stdout.write(` e.g. clad init payment SaaS for B2B `),V.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));V.exit(0)}async function O8e(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(()=>(kde(),$de)),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}`),V.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>tR(l,s)),c=`${oG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&V.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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function R8e(t={}){try{let e=H();if(ha("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=ys(".");Ll(".",r),Za("."),T5(".");let n=Yl(".");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=Rte(".");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=Vx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=Xv.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.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)`),V.exit(0);return}L("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){L("fail","sync",e.message),V.exit(1)}}function I8e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=v_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function P8e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=S_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}w_(".",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?V.stdout.write(`Run: git checkout ${r.gitHead} +`));V.exit(0)}async function D8e(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(()=>(Ede(),kde)),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}`),V.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=H(e.cwd??"."),a=n.featuresTouched.map(l=>nR(l,s)),c=`${aG(n.halt,s)} iter=${n.iterations} features=${a.length} stubs=${n.stubsCreated.length} gates=${n.gateRuns}`;L(i,"run",c),a.length>0&&V.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.`),V.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function N8e(t={}){try{let e=H();if(ya("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=_s(".");Bl(".",r),Wa("."),R5(".");let n=eu(".");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=Pte(".");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=Jx(".");o&&L("note","deliverable",`auto-detected entry '${o.path}' \u2014 the gate now smoke-tests it (stage_2.4). Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=nS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),V.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)`),V.exit(0);return}L("pass","sync",`${e.features.length} features valid`),V.exit(0)}catch(e){L("fail","sync",e.message),V.exit(1)}}function j8e(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),V.exit(2);return}let e=k_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),V.exit(0)}function M8e(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),V.exit(2);return}let r=E_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),V.exit(1);return}A_(".",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?V.stdout.write(`Run: git checkout ${r.gitHead} `):V.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),V.exit(0)}async function C8e(t){let e=t.host&&t.host!=="all"?[t.host]:void 0,r=await HC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});V.exit(r.errors.length>0?1:0)}async function D8e(){L("note","update","reconciling the current project after the engine upgrade");let t=await $X(".",{wireHosts:async()=>(await HC({quiet:!0,projectRoot:"."})).errors.length});if(L(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),!t.isProject){L("skip","spec","no spec.yaml here \u2014 run `clad init` to put this project under cladding"),V.exit(t.code);return}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);V.stdout.write(` +`),V.exit(0)}async function F8e(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await ZC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});V.exit(r.errors.length>0?1:0)}async function L8e(){L("note","update","reconciling the current project after the engine upgrade");let t=await EX(".",{wireHosts:async()=>(await ZC({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."),V.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);V.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),SA({tier:"pre-commit",strict:!0}).anyFailed?V.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"),V.exit(t.code)}var N8e={"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 SA(t){let e=t.tier??"all",r=t.silent===!0,n=N8e[e];if(!n)return t.json&&!r?V.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",()=>Wm(i)],["stage_1.2",()=>Vm(i)],["stage_1.3",()=>ni({...i,strict:t.strict})],["stage_1.4",Oj],["stage_1.5",Xa],["stage_1.6",Up],["stage_2.1",()=>zj({...i,strict:t.strict})],["stage_2.2",()=>Rj(i)],["stage_2.3",cC],["stage_2.4",Dj],["stage_3.1",Nj],["stage_3.2",Pj],["stage_3.3",Uj],["stage_4.1",Aj],["stage_4.2",Km]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":ii(d)?"fail":"skip",u=[];F_("."),rte(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ea(d),h=dX(p);ii(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),ii(h)&&B8e(p))}}finally{z_(),ate()}if(t.strict)try{let d=H();for(let f of ete(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"||!ii(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=>ii(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(ha("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{kG(".",H())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function j8e(t){try{let e=H(),r=ol(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} -`),V.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),V.exit(1)}}function M8e(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} -`),V.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),V.exit(1)}}function F8e(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=iS(e,o=>{try{return Ade(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),V.exit(0)}catch(e){L("fail","infer-deps",e.message),V.exit(1)}}function L8e(t={}){try{if(t.sessions){zee(t);return}if(t.trend!==void 0&&t.trend!==!1){Uee(t);return}let e=H(),n=$H(e,o=>{try{return Ade(o,"utf8")}catch{return null}},"."),i=EH(".",n);if(t.json)V.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)}`,` ${sl}`];V.stdout.write(`${c.join(` +`),xA({tier:"pre-commit",strict:!0}).anyFailed?V.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"),V.exit(t.code)}var z8e={"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 xA(t){let e=t.tier??"all",r=t.silent===!0,n=z8e[e];if(!n)return t.json&&!r?V.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",()=>Xm(i)],["stage_1.2",()=>Ym(i)],["stage_1.3",()=>ii({...i,strict:t.strict})],["stage_1.4",Ij],["stage_1.5",rc],["stage_1.6",Gp],["stage_2.1",()=>qj({...i,strict:t.strict})],["stage_2.2",()=>Pj(i)],["stage_2.3",uC],["stage_2.4",jj],["stage_3.1",Mj],["stage_3.2",Dj],["stage_3.3",Bj],["stage_4.1",Oj],["stage_4.2",Qm]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":si(d)?"fail":"skip",u=[];B_("."),ite(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ta(d),h=pX(p);si(h)&&(c=!0,a=Math.max(a,mX(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),si(h)&&W8e(p))}}finally{G_(),lte()}if(t.strict)try{let d=H();for(let f of rte(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"||!si(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=>si(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(ya("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{AG(".",H())&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}return t.json&&!r?V.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} +`):c&&!r&&V.stdout.write("\n\u2139 Run `clad doctor` for the event log, or `clad sync` to validate spec shards. Drift findings above name the offending detector.\n"),er(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c}),{worst:a,anyFailed:c,stages:u}}function U8e(t){try{let e=H(),r=ll(e,t);V.stdout.write(`${JSON.stringify(r,null,2)} +`),V.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),V.exit(1)}}function q8e(t,e={}){try{let r=H(),n=e.depth!==void 0?Number(e.depth):void 0,i=br(r,t,{depth:n});V.stdout.write(`${JSON.stringify(i,null,2)} +`),V.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),V.exit(1)}}function B8e(t={}){try{let e=H(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=lS(e,o=>{try{return Tde(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});V.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),V.exit(0)}catch(e){L("fail","infer-deps",e.message),V.exit(1)}}function H8e(t={}){try{if(t.sessions){qee(t);return}if(t.trend!==void 0&&t.trend!==!1){Bee(t);return}let e=H(),n=EH(e,o=>{try{return Tde(o,"utf8")}catch{return null}},"."),i=TH(".",n);if(t.json)V.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)}`,` ${ul}`];V.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)")}V.exit(0)}catch(e){L("fail","measure",e.message),V.exit(1)}}function z8e(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),V.exit(1)}V.exitCode=SA({...t,focusModules:e}).worst}function U8e(t){let e=ZY(".",t,{checkStages:SA,onIndex:Za,gitOpInProgress:SO});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function q8e(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=C5(n);if(o.length===0){V.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)")}V.exit(0)}catch(e){L("fail","measure",e.message),V.exit(1)}}function G8e(t){let e;if(t.feature)try{let n=(H().features??[]).find(i=>i.id===t.feature||i.slug===t.feature);n||(L("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),V.exit(1)),e=n.modules}catch(r){L("fail","check",r.message),V.exit(1)}V.exitCode=xA({...t,focusModules:e}).worst}function Z8e(t){let e=WY(".",t,{checkStages:xA,onIndex:Wa,gitOpInProgress:xO});L(e.ok?"pass":"fail",`done \xB7 ${t}`,e.reason),V.exit(e.code)}function V8e(t,e={}){let r=e.cwd??".",n;try{n=H(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),V.exit(1);return}if(e.required){t&&V.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let o=N5(n);if(o.length===0){V.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. `),V.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";V.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} `)}V.stdout.write(` ${o.length} AC(s) required, ${s.length} missing an oracle. -`),V.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"),V.exit(1);return}let i=Ite(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`),V.exit(1);return}V.stdout.write(`${Pte(i)} -`),V.exit(0)}function B8e(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=Ede(Ff(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] +`),V.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"),V.exit(1);return}let i=Cte(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`),V.exit(1);return}V.stdout.write(`${Dte(i)} +`),V.exit(0)}function W8e(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=Ade(Uf(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";V.stdout.write(` ${o}${s} [${i.detector}] `)}n.length>3&&V.stdout.write(` \u2026 and ${n.length-3} more finding(s) `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).find(r=>r.trim().length>0);e&&V.stdout.write(` ${Ede(e.trim(),160)} -`)}}function Ede(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function H8e(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(Wx(e,"."),null,2)} -`),V.exitCode=0;return}V.stdout.write(`${Cte(e,".",{internal:t.internal})} -`),V.exit(0)}function G8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function Z8e(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"),V.exit(1);return}let n;try{let i=H(e),o=Wx(i,e),s={gitHead:_a(e),version:Gl(),generatedAt:t.now??new Date().toISOString()},a=ll(i),c;try{let l=t.since??ts(e),u=rs(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:al(u),auditMarkdown:cl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=yG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),V.exit(1);return}try{E8e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}L("pass","bundle",`${r} \xB7 ${G8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function V8e(t){let e=zA(t);L("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function W8e(){let t=new h4;t.name("clad").description("Reference Ironclad CLI").version("0.9.0"),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(T8e),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(O8e),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(R8e),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 all hosts (default) or one of: claude, codex, gemini, antigravity, cursor","all").option("--force","replace an existing conflicting cladding-owned project entry").option("--quiet","suppress stdout output").action(C8e),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(D8e),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(z8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(I8e),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(U8e),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)=>q8e(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(P8e),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(H8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(j8e),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)=>M8e(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=>bX(r,{checkStages:SA})),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=>F8e(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=>L8e(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=>Yee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Xee()),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=>{Qee(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-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>mY(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=>Z8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(V8e),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(uX),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(A8e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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){BY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}yY(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(Dee),t}var K8e=!!globalThis.__CLADDING_BUNDLED,J8e=K8e||import.meta.url===`file://${V.argv[1]}`;J8e&&W8e().parse();export{N8e as TIER_STAGES,W8e as createProgram,Z8e as runBundleCommand,z8e as runCheckCommand,SA as runCheckStages,I8e as runCheckpointCommand,j8e as runContextCommand,U8e as runDoneCommand,M8e as runImpactCommand,F8e as runInferDepsCommand,T8e as runInitCommand,L8e as runMeasureCommand,q8e as runOracleCommand,P8e as runRollbackCommand,V8e as runRouteCommand,O8e as runRunCommand,A8e as runServeCommand,C8e as runSetupCommand,H8e as runStatusCommand,R8e as runSyncCommand,D8e as runUpdateCommand}; +`).find(r=>r.trim().length>0);e&&V.stdout.write(` ${Ade(e.trim(),160)} +`)}}function Ade(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function K8e(t){let e=H();if(t.json){V.stdout.write(`${JSON.stringify(Yx(e,"."),null,2)} +`),V.exitCode=0;return}V.stdout.write(`${Nte(e,".",{internal:t.internal})} +`),V.exit(0)}function J8e(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function Y8e(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"),V.exit(1);return}let n;try{let i=H(e),o=Yx(i,e),s={gitHead:va(e),version:Wl(),generatedAt:t.now??new Date().toISOString()},a=pl(i),c;try{let l=t.since??rs(e),u=ns(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:dl(u),auditMarkdown:fl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=bG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),V.exit(1);return}try{I8e(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),V.exit(1);return}L("pass","bundle",`${r} \xB7 ${J8e(Buffer.byteLength(n,"utf8"))}`),V.exit(0)}function X8e(t){let e=qA(t);L("note",`route \u2192 ${e}`,t),V.exit(e==="unknown"?1:0)}function Q8e(){let t=new y4;t.name("clad").description("Reference Ironclad CLI").version("0.9.0"),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(C8e),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(D8e),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(N8e),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(F8e),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(L8e),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(G8e),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(j8e),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(Z8e),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)=>V8e(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(M8e),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(K8e),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(U8e),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)=>q8e(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=>SX(r,{checkStages:xA})),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=>B8e(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=>H8e(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=>Qee(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>ete()),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=>{tte(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=>sG(r)),t.command("report").description("Render one deterministic review packet for a git range (F-f6cc5e5a) \u2014 spec-shard movement (from the changelog), changed source files resolved to their owning features via the reverse index, 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 four-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=>gY(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=>Y8e(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(X8e),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(fX),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(P8e),t.command("doctor").description("Summarise .cladding/events.log.jsonl \u2014 sentinel-miss frequency by phase/cause/fallback plus the top missed sentinels (LLM dispatcher health check)").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){GY({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}bY(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(jee),t}var e5e=!!globalThis.__CLADDING_BUNDLED,t5e=e5e||import.meta.url===`file://${V.argv[1]}`;t5e&&Q8e().parse();export{z8e as TIER_STAGES,Q8e as createProgram,Y8e as runBundleCommand,G8e as runCheckCommand,xA as runCheckStages,j8e as runCheckpointCommand,U8e as runContextCommand,Z8e as runDoneCommand,q8e as runImpactCommand,B8e as runInferDepsCommand,C8e as runInitCommand,H8e as runMeasureCommand,V8e as runOracleCommand,M8e as runRollbackCommand,X8e as runRouteCommand,D8e as runRunCommand,P8e as runServeCommand,F8e as runSetupCommand,K8e as runStatusCommand,N8e as runSyncCommand,L8e as runUpdateCommand}; diff --git a/spec/attestation.yaml b/spec/attestation.yaml index ee28df9e..5b873438 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -14,19 +14,18 @@ # `clad check --tier=pre-push --strict`; the GREEN gate rewrites the truth. # Content-anchored: survives fresh clones and squash/rebase. attested_modules: - .claude-plugin/marketplace.json: fc209569ca4e1d97 .claude/settings.json: d0bba3583aef0960 .github/workflows/ci.yml: 8ea99219cb80df60 .gitignore: 1294975ba3b47043 CHANGELOG.md: 704d913ae56b635a CLAUDE.md: d81d8832976cd5ee GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 411c7bbcf7311f8c - README.ja.md: d5add7a87f3ab816 - README.ko.html: 2c0015690f9d7c17 - README.ko.md: a48294f5266901b9 - README.md: 1ab8390ea0c2db80 - README.zh.md: 60ac64b898bc8f6c + README.html: ff98c3aaf8a6947f + README.ja.md: 299df920c0530e71 + README.ko.html: 35bde93f37db20eb + README.ko.md: 7f1394d857a95084 + README.md: 5ce3c24d66ff2ed9 + README.zh.md: 65dac6ea9c2308cc SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -64,7 +63,7 @@ attested_modules: docs/img/ko/relationship.svg: 9ec8fb2254978f37 docs/multi-provider-roadmap.md: 1e5cf27ea1b18d06 docs/refinement-backlog.md: 3e38d60bf987eef1 - docs/setup.md: d6103a17a31f2418 + docs/setup.md: a5c062651d267983 docs/spec-ids-multi-dev.md: 28d58e84879f58b1 docs/ssot-model.md: 13ac491b15bd77cd docs/ssot-testing.md: abf3b2bd5acb29a1 @@ -147,7 +146,7 @@ attested_modules: src/cli: a4d0f0eb87fed960 src/cli/benchmark.ts: 77f84d2a898d724f src/cli/changelog.ts: 2de1adb009b89ab4 - src/cli/clad.ts: ccb15bd40fcaab03 + src/cli/clad.ts: 00d049c7acb5f761 src/cli/clarify.ts: 393cc93a6feb698a src/cli/doctor-hosts.ts: d58d2580e76c09ed src/cli/doctor.ts: b98b955fe75e7f7e @@ -177,7 +176,7 @@ attested_modules: src/cli/scan/thresholds.ts: ec0047b894a6aa6a src/cli/scan/types.ts: ea0170aa88c1c14a src/cli/scan/walker.ts: 33e4448e365e47c6 - src/cli/update.ts: c607b3e638533508 + src/cli/update.ts: b0151396c9a0f6ca src/cli/verdict.ts: 7aa16b8739ab8e5f src/core/checkpoint.ts: 63300c2764533b6c src/core/git-ops.ts: 4544bde493a0628f @@ -205,7 +204,7 @@ attested_modules: src/init/agents-md.ts: 7dc05f6d82e5c3ce src/init/git-hook.ts: 4e02f177b3764ae8 src/init/host-instructions.ts: b6dbb40fadbf4c2d - src/init/host-setup.ts: 83213a4bbed1e3bd + src/init/host-setup.ts: aa953fda8e37a197 src/optimizer: a4d0f0eb87fed960 src/optimizer/code-excerpt.ts: e2c4598efcd28d2a src/optimizer/context-slice.ts: b5864aaed1e7ae48 @@ -228,7 +227,7 @@ attested_modules: src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 - src/serve/server.ts: c5bfc4e6caa09c15 + src/serve/server.ts: 4b2d0b94854d3fb5 src/spec: a4d0f0eb87fed960 src/spec/attestation.ts: 294a1e99c42d4aef src/spec/cli.ts: 7a9bcd0f66677810 diff --git a/spec/features/setup-command-80d19d.yaml b/spec/features/setup-command-80d19d.yaml index f44d69be..5bd857f2 100644 --- a/spec/features/setup-command-80d19d.yaml +++ b/spec/features/setup-command-80d19d.yaml @@ -1,103 +1,93 @@ id: F-80d19d slug: setup-command -title: "clad setup command — explicit host wire (replaces F-90d054 postinstall hook)" +title: "clad setup command — project-scoped host wire (0.9.0 model; replaced the 0.3.x global symlink wire)" status: done modules: - src/init/host-setup.ts - src/init/host-instructions.ts - src/cli/clad.ts - src/cli/init.ts - - plugins/claude-code/.claude-plugin/plugin.json - - .claude-plugin/marketplace.json - .claude/settings.json acceptance_criteria: - id: AC-001 ears: event - condition: when the user runs `clad setup` and one or more of the four supported AI tool home directories exist (`~/.claude/`, `~/.gemini/`, `~/.codex/`, `~/.agents/`) - action: wire only the detected channels (Claude plugin / Gemini extension / Codex skills / Codex MCP) and leave undetected hosts untouched - response: the user gets host channels wired exclusively for AI tools they actually have installed, with no surprise directories created in `$HOME` - text: When the user runs `clad setup` and one or more of the four supported AI - tool home directories exist, the system shall wire only the detected - channels and leave undetected hosts untouched, so the user gets host - channels wired exclusively for installed AI tools with no surprise - directories created in $HOME. - + condition: when the user runs `clad setup` with no `--host` option + action: wire only the host channels whose home markers exist on this machine (`~/.claude/`, `~/.codex/`, `~/.gemini/`, `~/.gemini/config` or `~/.gemini/antigravity-cli` for Antigravity, `~/.cursor/`), report the rest as `not selected`, and warn plus write only the shared project runtime when nothing is detected + response: projects gain wiring exclusively for AI tools the developer actually has; `--host all` remains the explicit way to force every channel + text: When the user runs `clad setup` with no `--host` option, the system + shall wire only the detected host channels and leave undetected hosts + untouched (warning when none are detected), so projects gain wiring only + for AI tools actually installed while `--host all` stays available as an + explicit override. test_refs: - - "tests/cli/setup.test.ts#wires only the host channels whose home directory exists" + - "tests/cli/setup.test.ts#writes only project-local host discovery files" + - "tests/cli/setup.test.ts#default detection wires nothing on a machine with no supported host" - id: AC-002 ears: state - condition: while every detected host channel is already wired to the current cladding root (target match) - action: report each channel as "already wired" and perform no filesystem changes - response: idempotent re-run prints a clean "Nothing to do" summary - text: While every detected host channel is already wired to the current - cladding root, the system shall report each channel as already wired and - perform no filesystem changes, so idempotent re-runs print a clean - summary without side effects. - + condition: while every selected host channel is already wired for the current engine root + action: report each channel as already ready and perform no filesystem changes + response: idempotent re-runs are safe and visibly no-ops + text: While every selected host channel is already wired for the current + engine root, the system shall report each channel as already ready and + perform no filesystem changes, so idempotent re-runs are safe. test_refs: - - "tests/cli/setup.test.ts#second run reports already-wired without re-creating links" + - "tests/cli/setup.test.ts#is idempotent and stores setup status under the project" - id: AC-003 ears: event condition: when the user runs `clad setup` after installing a new AI tool that was not detected on the previous run - action: wire only the newly detected channel (delta wire) while leaving previously wired channels untouched + action: wire only the newly detected channel while leaving previously wired channels untouched response: the new tool gets a cladding channel without re-touching the already-wired ones text: When the user runs `clad setup` after installing a new AI tool that was not detected on the previous run, the system shall wire only the newly detected channel while leaving previously wired channels untouched, so the new tool gets a cladding channel without re-touching the already-wired ones. - test_refs: - - "tests/cli/setup.test.ts#delta-wires a host that was not installed on the previous run" + - "tests/cli/setup.test.ts#delta-wires a host that appears after the first run, leaving wired ones untouched" - id: AC-004 ears: event - condition: when the user runs `clad setup` after upgrading cladding to a new version whose package root resolves to a different absolute path than the existing symlink target - action: replace the symlink target with the new cladding root (re-wire) - response: host channels point at the upgraded cladding without manual cleanup - text: When the user runs `clad setup` after upgrading cladding to a new - version whose package root differs from the existing symlink target, - the system shall replace the symlink target with the new cladding - root, so host channels point at the upgraded cladding without manual - cleanup. - + condition: when the user runs `clad setup` after upgrading cladding so the engine package root differs from the one baked into the project runtime launcher + action: regenerate `.cladding/host/serve.cjs` against the new engine root + response: host channels launch the upgraded engine without manual cleanup, because every host config points at the stable project-relative launcher + text: When the user runs `clad setup` after upgrading cladding so the + engine root differs from the one baked into the project runtime + launcher, the system shall regenerate `.cladding/host/serve.cjs` + against the new root, so host channels launch the upgraded engine + without manual cleanup. test_refs: - - "tests/cli/setup.test.ts#re-wires when the symlink target no longer matches the current cladding root" + - "tests/cli/setup.test.ts#re-wires the project runtime when the engine root changes (upgrade path)" - id: AC-005 ears: event - condition: when the user runs `clad setup` and one or more channel symlinks have been deleted (host AI may have reset its plugin directory, or the user removed them) - action: re-create the missing symlinks (same effect as a first-time wire for those channels) + condition: when the user runs `clad setup` and the project runtime launcher has been deleted + action: re-create the missing launcher (same effect as a first-time wire for that file) response: "`clad setup` works as a repair command without a separate flag" - text: When the user runs `clad setup` and one or more channel symlinks - have been deleted, the system shall re-create the missing symlinks, - so `clad setup` works as a repair command without a separate flag. - + text: When the user runs `clad setup` and the project runtime launcher has + been deleted, the system shall re-create it, so `clad setup` works as a + repair command without a separate flag. test_refs: - - "tests/cli/setup.test.ts#re-creates a missing symlink as a repair" + - "tests/cli/setup.test.ts#re-creates a deleted project runtime as a repair, no separate flag" - id: AC-006 ears: state - condition: while `clad init` runs in a project and no `~/.cladding/setup-status.json` exists (user never ran `clad setup`) - action: print a friendly skipped notice ("host channels not wired yet — run `clad setup` to enable `/cladding init` from Claude Code / Codex / Gemini") and continue with spec generation - response: missing host wire does not block spec creation; user is guided to the next step - text: While `clad init` runs and no setup-status.json exists, the system + condition: while `clad init` runs in a project whose `.cladding/setup-status.json` does not exist (the user never ran `clad setup` here) + action: print a friendly skipped notice naming `clad setup` and continue with spec generation + response: missing host wire does not block spec creation; the user is guided to the next step + text: While `clad init` runs and no project setup-status exists, the system shall print a friendly skipped notice naming `clad setup` and continue with spec generation, so missing host wire does not block spec creation and the user is guided to the next step. - test_refs: - - "tests/cli/setup.test.ts#hostWireNotice points at clad setup when no setup-status exists" + - "tests/cli/setup.test.ts#hostWireNotice guides toward clad setup and surfaces version skew without blocking" - id: AC-007 ears: state - condition: while `clad init` runs and the cladding binary version differs from the version recorded in `~/.cladding/setup-status.json` from the last `clad setup` run - action: print a friendly skipped notice that symlinks usually auto-follow but `clad setup` can be re-run to be sure, and continue with spec generation - response: version-skew is surfaced without blocking; the user can choose whether to re-run setup - text: While `clad init` runs and the cladding binary version differs from - the version recorded in setup-status.json, the system shall print a - friendly skipped notice and continue with spec generation, so version - skew is surfaced without blocking and the user can choose whether to - re-run setup. - + condition: while `clad init` runs and the engine version differs from the version recorded in the project's `.cladding/setup-status.json` + action: print a friendly notice suggesting `clad setup` be re-run in this project, and continue with spec generation + response: version skew is surfaced without blocking; the user chooses whether to refresh the wire + text: While `clad init` runs and the engine version differs from the + version recorded in the project's setup-status, the system shall print + a friendly notice and continue with spec generation, so version skew is + surfaced without blocking. test_refs: - - "tests/cli/setup.test.ts#hostWireNotice flags version skew between wire and binary" + - "tests/cli/setup.test.ts#hostWireNotice guides toward clad setup and surfaces version skew without blocking" - id: AC-008 ears: unwanted condition: if a user runs `npm install -g cladding` (or `--ignore-scripts`, or any npm install flavour) @@ -106,57 +96,56 @@ acceptance_criteria: text: If a user runs `npm install -g cladding`, the system shall not execute any host-wiring side effects during install, so `npm install` is pure binary installation with zero filesystem side effects in $HOME. - - test_refs: - - "tests/cli/setup.test.ts#importing host-setup does not wire anything on its own" + evidence_refs: + - package.json - id: AC-009 ears: unwanted - condition: if a channel link exists as a directory copy (Windows non-admin fallback) and its mtime/contents diverge from the cladding root (user may have customised in place) - action: emit a `skipped-different` / `conflict` notice in the report and refuse to overwrite unless `--force` is supplied - response: user customisations under host plugin directories are preserved unless the user explicitly opts in to overwrite - text: If a channel link is a directory copy and its contents diverge from - the cladding root, the system shall emit a conflict notice and refuse - to overwrite unless `--force` is supplied, so user customisations are - preserved unless explicitly overridden. - + condition: if a host config already carries a `cladding` MCP entry that setup does not recognize as its own launch shape + action: emit a `skipped-different` conflict notice and refuse to overwrite unless `--force` is supplied + response: user customisations are preserved unless the user explicitly opts in to overwrite + text: If a host config already carries a cladding MCP entry that setup + does not recognize as its own launch shape, the system shall emit a + conflict notice and refuse to overwrite unless `--force` is supplied, + so user customisations are preserved unless explicitly overridden. test_refs: - - "tests/cli/setup.test.ts#refuses to overwrite a non-symlink wire without --force" + - "tests/cli/setup.test.ts#preserves a conflicting user MCP entry unless force is explicit" + - "tests/cli/setup.test.ts#Gemini setup preserves a conflicting Cladding entry unless force is explicit" - id: AC-010 ears: event - condition: when `clad setup` finishes successfully (any combination of created / unchanged / rewired / copied / skipped-not-installed) - action: print a numbered "다음 단계" guidance block (open AI tool → cd to project → `/cladding init "..."` → start coding) as the last stdout block + condition: when `clad setup` finishes successfully (any combination of wired / already ready / not selected) + action: end the report with a numbered next-steps block (start a new AI session in the project → ask to apply Cladding → reply with the exact approval phrase → develop normally) response: the user always sees a concrete next-step recipe at the end of the report - text: When `clad setup` finishes successfully, the system shall print a - numbered "다음 단계" guidance block as the last stdout block, so the - user always sees a concrete next-step recipe at the end of the - report. - + text: When `clad setup` finishes successfully, the system shall end the + report with a numbered next-steps block, so the user always sees a + concrete next-step recipe. test_refs: - - "tests/cli/setup.test.ts#renderSetupReport ends with the numbered 다음 단계 guidance block" + - "tests/cli/setup.test.ts#report explains the project boundary and normal post-init development" - id: AC-011 ears: event - condition: when `clad setup` runs on a machine where `~/.cursor/` exists (Cursor IDE installed) - action: write or merge the `mcpServers.cladding` entry into `~/.cursor/mcp.json` (JSON merge, preserving other entries) so Cursor picks up cladding as an MCP server on restart - response: Cursor users get cladding wired without manual JSON edits - text: When `clad setup` runs and `~/.cursor/` exists, the system shall - merge `mcpServers.cladding = {command, args}` into `~/.cursor/mcp.json` - so Cursor users get cladding wired without manual JSON edits. - + condition: when `clad setup` wires the Cursor channel + action: write project-local `.cursor/mcp.json` (JSON merge preserving other entries), `.cursor/cli.json` read-only MCP permissions, the bootstrap rule, and the project skill copy + response: Cursor users get cladding wired per-project without manual JSON edits + text: When `clad setup` wires the Cursor channel, the system shall write + the project-local Cursor MCP config, permissions, bootstrap rule, and + skill copy while preserving unrelated entries, so Cursor users get + cladding wired per-project without manual JSON edits. test_refs: - - "tests/cli/setup.test.ts#wires Cursor mcp.json with the absolute engine, preserving existing servers" + - "tests/cli/setup.test.ts#Cursor permissions preserve unrelated allow and deny entries" + - "tests/cli/setup.test.ts#writes only project-local host discovery files" - id: AC-012 ears: event - condition: when `clad setup` finishes wiring a host channel AND the corresponding host CLI binary (claude / gemini) is on PATH - action: invoke the host's plugin activation command non-interactively (`claude plugin marketplace add` + `claude plugin install claude-code@cladding`, `gemini extensions link`); on failure fall back to printing the manual command in the activation hint - response: users with a host CLI binary on PATH get the plugin enabled in one command; users without one get a precise manual command - text: When `clad setup` finishes wiring a channel and the corresponding - host CLI binary is on PATH, the system shall invoke the host's plugin - activation command non-interactively, so users get the plugin enabled - in one command, and otherwise fall back to printing the manual command. - + condition: when `clad setup` runs on a machine that still carries pre-0.9.0 global wires (plugin symlinks, `~/.agents/skills/cladding-*`, `~/.codex/config.toml` / `~/.cursor/mcp.json` entries) + action: remove only the entries whose ownership is provable (symlink target inside a known cladding root, or a recognized launch shape), preserving everything else byte-for-byte where possible + response: legacy global installs migrate to the project-scoped model without destroying user configuration + text: When `clad setup` runs on a machine with pre-0.9.0 global wires, + the system shall remove only ownership-proven entries and preserve + everything else, so legacy installs migrate without destroying user + configuration. test_refs: - - "tests/cli/setup.test.ts#invokes the claude activator with the wired plugin path" - - "tests/cli/setup.test.ts#activate:false suppresses activation even when channels are wired" + - "tests/cli/setup.test.ts#removes only provably-owned legacy global wires" + - "tests/cli/setup.test.ts#preserves unowned global files with Cladding-like names" + - "tests/cli/setup.test.ts#codex legacy cleanup preserves user comments and formatting outside the cladding entry" + - "tests/cli/setup.test.ts#cursor legacy cleanup drops an emptied mcpServers object instead of leaving an orphan" - id: AC-013 ears: event condition: when `clad init` runs and a project-local AGENTS.md or CLAUDE.md exists that carries v0.3.x markers (e.g. `_meta.enrichment_status`, `first-task enrichment rule`, lone `clad_create_feature` MCP tool wording with no `clad` CLI qualifier) @@ -168,7 +157,6 @@ acceptance_criteria: replaces only the `## cladding` section while preserving outside content), so AI sessions do not surface stale guidance that confuses hosts where cladding is not wired as an MCP server. - test_refs: - "tests/init/host-instructions.test.ts#refreshes stale v0.3.x AGENTS.md without --force" - "tests/init/host-instructions.test.ts#refreshes only the ## cladding section when v0.3.x markers are present" @@ -182,6 +170,19 @@ acceptance_criteria: with `enabledPlugins["claude-code@cladding"] = true` so Claude Code activates the local cladding plugin on entry without a separate maintainer-only setup step. - evidence_refs: - - ".claude/settings.json" \ No newline at end of file + - ".claude/settings.json" + - id: AC-015 + ears: event + condition: when `clad setup` wires the Antigravity channel (agy reads MCP config only from machine-wide locations, never from the project — verified live in the 0.9.0 E2E campaign) + action: write the machine-wide wire at `~/.gemini/config/plugins/cladding/` with an engine-absolute launch (the project is still resolved from each session's working directory), keep the forward-compat project `.agents/mcp_config.json`, refuse to write through a surviving unowned symlink or over a foreign real directory without `--force`, and say so in the report + response: Antigravity actually connects to cladding, the single documented exception to project-local activation is loudly reported, and foreign installs are never clobbered + text: When `clad setup` wires the Antigravity channel, the system shall + write the machine-wide wire agy actually reads (engine-absolute launch; + project resolved per session working directory), keep the forward-compat + project file, refuse foreign or symlinked targets without `--force`, + and report the exception, so Antigravity connects without silently + breaking the project-local activation story. + test_refs: + - "tests/cli/setup.test.ts#writes only project-local host discovery files" + - "tests/cli/setup.test.ts#a foreign real directory at the antigravity plugin path is preserved and reported" diff --git a/spec/index.yaml b/spec/index.yaml index 35686c8c..1daf12cb 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -168,7 +168,7 @@ features: F-7ce18e: {slug: glossary-naming-convention, status: done, modules: 7} F-7fa4a7: {slug: mcp-sampling-dispatcher, status: done, modules: 1} F-803386ab: {slug: python-first-class, status: done, modules: 3} - F-80d19d: {slug: setup-command, status: done, modules: 7} + F-80d19d: {slug: setup-command, status: done, modules: 5} F-8234ec3c: {slug: graph-viewer-galaxy, status: archived, modules: 0} F-836a90: {slug: link-capability-tool, status: done, modules: 2} F-898783ee: {slug: self-count-guard, status: done, modules: 17} diff --git a/src/cli/clad.ts b/src/cli/clad.ts index 704e35cb..6cffdd98 100644 --- a/src/cli/clad.ts +++ b/src/cli/clad.ts @@ -390,9 +390,12 @@ export function runRollbackCommand(featureId: string, opts: {reason?: string} = /** Handler for `clad setup`. Activates Cladding only for one project. */ export async function runSetupCommand(opts: {force?: boolean; quiet?: boolean; project?: string; host?: string}): Promise { - const hosts = opts.host && opts.host !== 'all' - ? [opts.host as 'claude' | 'codex' | 'gemini' | 'antigravity' | 'cursor'] - : undefined; + // No --host → detected hosts only (spec AC-001); --host all → every channel. + const hosts = !opts.host + ? undefined + : opts.host === 'all' + ? (['claude', 'codex', 'gemini', 'antigravity', 'cursor'] as const).slice() + : [opts.host as 'claude' | 'codex' | 'gemini' | 'antigravity' | 'cursor']; const result = await runHostSetup({ force: opts.force, quiet: opts.quiet, @@ -420,12 +423,12 @@ export async function runUpdateCommand(): Promise { const r = await runUpdate('.', { wireHosts: async () => (await runHostSetup({quiet: true, projectRoot: '.'})).errors.length, }); - pulse(r.wiringErrors > 0 ? 'fail' : 'pass', 'hosts', r.wiringErrors > 0 ? `${r.wiringErrors} wiring error(s)` : 're-wired'); if (!r.isProject) { - pulse('skip', 'spec', 'no spec.yaml here — run `clad init` to put this project under cladding'); + pulse('skip', 'update', 'no spec.yaml here — nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one.'); process.exit(r.code); return; } + pulse(r.wiringErrors > 0 ? 'fail' : 'pass', 'hosts', r.wiringErrors > 0 ? `${r.wiringErrors} wiring error(s)` : 're-wired'); if (r.inventoryDeferred) { pulse('note', 'spec', `inventory + index writes deferred — git operation in progress; re-run \`clad update\` after it completes (${r.features} features seen).`); } else { @@ -1078,7 +1081,7 @@ export function createProgram(): Command { .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 all hosts (default) or one of: claude, codex, gemini, antigravity, cursor', 'all') + .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(runSetupCommand); diff --git a/src/cli/update.ts b/src/cli/update.ts index c13c0a15..51eb9d62 100644 --- a/src/cli/update.ts +++ b/src/cli/update.ts @@ -94,23 +94,25 @@ function mapAgentsMdResult(r: SpecAgentsMdResult): AgentsMdResult { * stricter-detector REPORT is the caller's job (report-only, never blocks). */ export async function runUpdate(cwd: string, deps: UpdateDeps): Promise { - // 1. Re-wire host channels into the project (idempotent, project-local - // since 0.9.0). Note: runs before the spec.yaml guard below, so update - // scaffolds host wiring into cwd even when it is not a cladding project. - const wiringErrors = await deps.wireHosts(); - + // 0. Outside a cladding project, write NOTHING: no host wiring into an + // arbitrary cwd, and no legacy-cleanup side effects (which include an + // account-wide `claude plugin uninstall`). Wiring belongs to projects. if (!existsSync(join(cwd, 'spec.yaml'))) { return { isProject: false, - wiringErrors, + wiringErrors: 0, claudeMd: 'n/a', agentsMd: 'n/a', features: 0, - code: wiringErrors > 0 ? 1 : 0, + code: 0, deprecations: [], }; } + // 1. Re-wire host channels into the project (idempotent, project-local + // since 0.9.0). + const wiringErrors = await deps.wireHosts(); + // 2. Reconcile the spec.yaml inventory snapshot (deterministic). Skip the // writes (keep the read-only count for the report) while a git operation // is in progress, so a merge/rebase sees no surprise derived-file edits. diff --git a/src/init/host-setup.ts b/src/init/host-setup.ts index 1d95453e..658b4411 100644 --- a/src/init/host-setup.ts +++ b/src/init/host-setup.ts @@ -198,6 +198,30 @@ function isKnownLaunch(value: unknown, roots: readonly string[]): boolean { return entry.command === 'node' && typeof args[0] === 'string' && roots.some((root) => pathInside(args[0] as string, root)); } +/** + * Deletes the `[mcp_servers.cladding]` section from the raw TOML text without + * re-serializing the document, so the user's comments, ordering, and formatting + * everywhere else survive. Returns null when the section boundaries cannot be + * identified textually (caller falls back to the lossy stringify path). + */ +function spliceTomlSection(raw: string, header: string): string | null { + const lines = raw.split('\n'); + const start = lines.findIndex((l) => l.trim() === header); + if (start === -1) return null; + let end = lines.length; + for (let i = start + 1; i < lines.length; i++) { + const t = lines[i].trim(); + if (t.startsWith('[') && !t.startsWith('#')) { + end = i; + break; + } + } + // Also drop blank lines directly above the removed section so no gap pile-up. + let cut = start; + while (cut > 0 && lines[cut - 1].trim() === '') cut--; + return [...lines.slice(0, cut), ...lines.slice(end)].join('\n'); +} + async function removeOwnedCodexMcp(home: string, roots: readonly string[]): Promise { const path = join(home, '.codex', 'config.toml'); const raw = readText(path); @@ -210,6 +234,20 @@ async function removeOwnedCodexMcp(home: string, roots: readonly string[]): Prom if (!isKnownLaunch(servers.cladding, roots)) return 'skipped-different'; delete servers.cladding; if (Object.keys(servers).length === 0) delete doc.mcp_servers; + // Prefer a text-level splice (preserves the user's comments/format across + // the rest of the file); verify by parsing before trusting it, and fall + // back to the canonical re-serialization only when the splice is unsound. + const spliced = spliceTomlSection(raw, '[mcp_servers.cladding]'); + if (spliced != null) { + try { + if (JSON.stringify(parse(spliced)) === JSON.stringify(doc)) { + writeFileSync(path, spliced, 'utf8'); + return 'removed'; + } + } catch { + // fall through to the stringify path + } + } writeFileSync(path, stringify(doc), 'utf8'); return 'removed'; } catch { @@ -227,6 +265,7 @@ function removeOwnedCursorMcp(home: string, roots: readonly string[]): ChannelRe if (!servers?.cladding) return 'unchanged'; if (!isKnownLaunch(servers.cladding, roots)) return 'skipped-different'; delete servers.cladding; + if (Object.keys(servers).length === 0) delete doc.mcpServers; writeFileSync(path, `${JSON.stringify(doc, null, 2)}\n`, 'utf8'); return 'removed'; } catch { @@ -234,6 +273,49 @@ function removeOwnedCursorMcp(home: string, roots: readonly string[]): ChannelRe } } +/** + * Antigravity (agy 1.1.x) reads MCP config ONLY from machine-wide locations + * (`~/.gemini/config/mcp_config.json` or `~/.gemini/config/plugins//`), + * never from the project — verified live in the 0.9.0 E2E campaign. It does + * spawn MCP servers with the session's working directory, so one machine-wide + * wire pointing at the engine stays project-aware. This is the one deliberate + * exception to project-local activation, and the setup report says so. + */ +function wireAntigravityGlobal(home: string, pkgRoot: string, force: boolean): ChannelResult { + const dir = join(home, '.gemini', 'config', 'plugins', 'cladding'); + // An unowned legacy symlink survived cleanup — never write through it. + if (isSymlink(dir)) return 'skipped-different'; + const launch = {command: 'node', args: [join(pkgRoot, 'dist', 'clad.js'), 'serve']}; + const mcp = mergeJsonMcp(join(dir, 'mcp_config.json'), launch, force); + if (mcp === 'skipped-different' || mcp === 'failed') return mcp; + const manifest = `${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’s working directory).', + }, null, 2)}\n`; + return combine([mcp, writeIfChanged(join(dir, 'plugin.json'), manifest)]); +} + +/** + * Legacy-cleanup gate for `~/.gemini/config/plugins/cladding`: the pre-0.9.0 + * install left a SYMLINK here (owned → removed); 0.9.0 setup writes a REAL + * directory as the managed Antigravity wire (recognized launch → kept). A real + * directory with an unrecognized launch is foreign and is never removed. + */ +function cleanupAntigravityPlugin(home: string, roots: readonly string[]): ChannelResult { + const dir = join(home, '.gemini', 'config', 'plugins', 'cladding'); + if (isSymlink(dir)) return removeOwnedSymlink(dir, roots); + const cfg = readText(join(dir, 'mcp_config.json')); + if (cfg == null) return 'unchanged'; + try { + const servers = (JSON.parse(cfg) as {mcpServers?: Record}).mcpServers; + if (servers?.cladding && !isKnownLaunch(servers.cladding, roots)) return 'skipped-different'; + return 'unchanged'; + } catch { + return 'skipped-different'; + } +} + function detectBinary(name: string): boolean { const command = platform() === 'win32' ? 'where' : 'which'; return spawnSync(command, [name], {stdio: 'ignore'}).status === 0; @@ -472,7 +554,10 @@ export async function runHostSetup(opts: SetupOptions = {}): Promise detected[h])); const force = opts.force ?? false; const statusFile = join(projectRoot, '.cladding', STATUS_FILENAME); const lastVersion = readLastSetupVersion(statusFile); @@ -496,6 +581,23 @@ export async function runHostSetup(opts: SetupOptions = {}): Promise` to wire explicitly', + }); + } for (const [step, state] of Object.entries(wiring)) collectIssue(state, step, errors, warnings); for (const [step, state] of Object.entries(legacyCleanup)) collectIssue(state, `legacy:${step}`, errors, warnings); @@ -586,6 +685,9 @@ export function renderSetupReport(result: SetupResult, _detection?: HostDetectio ` Antigravity → ${stateLabel(result.wiring.antigravity)}`, ` Cursor → ${stateLabel(result.wiring.cursor)}`, ]; + if (result.wiring.antigravity === 'created' || result.wiring.antigravity === 'rewired') { + lines.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).'); + } const cleaned = Object.values(result.legacyCleanup).filter((state) => state === 'removed').length; if (cleaned > 0) lines.push('', `Removed ${cleaned} legacy global Cladding wire(s).`); for (const warning of result.warnings) lines.push(` ! ${warning.step}: ${warning.message}`); diff --git a/src/serve/server.ts b/src/serve/server.ts index 75f14865..eebae42f 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -453,6 +453,30 @@ function pendingPreparationPath(cwd: string, key: string, durable = false): stri : join(tmpdir(), 'cladding-onboarding-pending', `${id}.json`); } +/** + * Removes every expired consent-cache envelope in `dir`, not just the current + * key's: abandoned prepare flows used to leave 0600 envelopes behind until the + * next same-key load — on a shared machine the temp tier accumulated hundreds. + */ +function purgeExpiredPreparations(dir: string): void { + let names: string[]; + try { + names = readdirSync(dir); + } catch { + return; + } + for (const name of names) { + if (!name.endsWith('.json')) continue; + const path = join(dir, name); + try { + const parsed = JSON.parse(readFileSync(path, 'utf8')) as {expiresAt?: number}; + if (!parsed.expiresAt || parsed.expiresAt < Date.now()) rmSync(path, {force: true}); + } catch { + rmSync(path, {force: true}); + } + } +} + function persistPendingPreparation( cwd: string, key: string, @@ -462,6 +486,7 @@ function persistPendingPreparation( ): void { const path = pendingPreparationPath(cwd, key, draft != null); mkdirSync(dirname(path), {recursive: true, mode: 0o700}); + purgeExpiredPreparations(dirname(path)); writeFileSync(path, JSON.stringify({expiresAt: Date.now() + PREPARATION_TTL_MS, token, request, draft}), {mode: 0o600}); } @@ -482,7 +507,18 @@ function loadPendingPreparation( rmSync(path, {force: true}); continue; } - return {token: parsed.token, request: parsed.request, draft: parsed.draft}; + if (parsed.draft !== undefined) { + // The durable cache crosses process boundaries, so a staged draft is + // re-validated on load — a tampered/corrupted cache must surface as + // draft_required, never reach renderDraft (AC-014 extension). + const revalidated = hostDraftSchema.safeParse(parsed.draft); + if (!revalidated.success) { + rmSync(path, {force: true}); + continue; + } + return {token: parsed.token, request: parsed.request, draft: revalidated.data}; + } + return {token: parsed.token, request: parsed.request}; } catch { // Try the other cache tier. A missing durable cache is normal before staging. } diff --git a/tests/cli/setup.test.ts b/tests/cli/setup.test.ts index b9e7c74f..465972d0 100644 --- a/tests/cli/setup.test.ts +++ b/tests/cli/setup.test.ts @@ -7,6 +7,7 @@ import {join, resolve} from 'node:path'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; import {getLastSetupVersion, renderSetupReport, runHostSetup} from '../../src/init/host-setup.js'; +import {hostWireNotice} from '../../src/cli/init.js'; describe('project-scoped runHostSetup', () => { let home: string; @@ -15,6 +16,11 @@ describe('project-scoped runHostSetup', () => { beforeEach(() => { home = mkdtempSync(join(tmpdir(), 'clad-home-')); + // Seed every host's home marker so default detection selects all five + // channels (AC-001: wire only detected hosts). + for (const marker of ['.claude', '.codex', join('.gemini', 'config'), '.cursor', '.agents']) { + mkdirSync(join(home, marker), {recursive: true}); + } project = mkdtempSync(join(tmpdir(), 'clad-project-')); pkgRoot = mkdtempSync(join(tmpdir(), 'clad-pkg-')); mkdirSync(join(pkgRoot, 'dist'), {recursive: true}); @@ -50,9 +56,34 @@ describe('project-scoped runHostSetup', () => { expect(readFileSync(join(project, '.agents', 'skills', 'cladding-init', 'SKILL.md'), 'utf8')) .toContain('name: cladding-init'); expect(existsSync(join(project, '.cursor', 'skills', 'cladding-init', 'SKILL.md'))).toBe(true); - expect(existsSync(join(home, '.agents'))).toBe(false); - expect(existsSync(join(home, '.codex'))).toBe(false); - expect(existsSync(join(home, '.gemini'))).toBe(false); + // Home gains ONLY the Antigravity machine-wide wire (agy reads no project + // MCP config — verified live); every other host stays project-local. + expect(existsSync(join(home, '.agents', 'skills'))).toBe(false); + expect(existsSync(join(home, '.codex', 'config.toml'))).toBe(false); + expect(existsSync(join(home, '.gemini', 'settings.json'))).toBe(false); + const agyWire = join(home, '.gemini', 'config', 'plugins', 'cladding'); + expect(existsSync(join(agyWire, 'plugin.json'))).toBe(true); + const agyMcp = JSON.parse(readFileSync(join(agyWire, 'mcp_config.json'), 'utf8')); + expect(agyMcp.mcpServers.cladding.args).toEqual([join(pkgRoot, 'dist', 'clad.js'), 'serve']); + }); + + test('default detection wires nothing on a machine with no supported host', async () => { + const bareHome = mkdtempSync(join(tmpdir(), 'clad-barehome-')); + try { + const result = await runHostSetup({home: bareHome, projectRoot: project, pkgRoot, quiet: true, activate: false}); + expect(result.wiring.claude).toBe('skipped-not-installed'); + expect(result.wiring.codex).toBe('skipped-not-installed'); + expect(result.wiring.gemini).toBe('skipped-not-installed'); + expect(result.wiring.antigravity).toBe('skipped-not-installed'); + expect(result.wiring.cursor).toBe('skipped-not-installed'); + expect(existsSync(join(project, '.codex'))).toBe(false); + expect(existsSync(join(project, '.cursor'))).toBe(false); + expect(result.warnings.some((w) => w.step === 'hosts')).toBe(true); + // The shared runtime still lands, so explicit wiring stays one command away. + expect(existsSync(join(project, '.cladding', 'host', 'serve.cjs'))).toBe(true); + } finally { + rmSync(bareHome, {recursive: true, force: true}); + } }); test('keeps machine-specific runtime state out of a Git worktree', async () => { @@ -256,6 +287,112 @@ describe('project-scoped runHostSetup', () => { expect(readFileSync(join(home, '.codex', 'config.toml'), 'utf8')).toContain('other'); }); + test('delta-wires a host that appears after the first run, leaving wired ones untouched', async () => { + rmSync(join(home, '.cursor'), {recursive: true, force: true}); + const first = await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); + expect(first.wiring.cursor).toBe('skipped-not-installed'); + expect(existsSync(join(project, '.cursor'))).toBe(false); + + mkdirSync(join(home, '.cursor'), {recursive: true}); + const second = await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); + expect(second.wiring.cursor).toBe('created'); + expect(second.wiring.codex).toBe('unchanged'); + expect(existsSync(join(project, '.cursor', 'mcp.json'))).toBe(true); + }); + + test('re-wires the project runtime when the engine root changes (upgrade path)', async () => { + await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); + const pkgRoot2 = mkdtempSync(join(tmpdir(), 'clad-pkg2-')); + try { + mkdirSync(join(pkgRoot2, 'dist'), {recursive: true}); + mkdirSync(join(pkgRoot2, 'plugins', 'codex', 'skills', 'init'), {recursive: true}); + writeFileSync(join(pkgRoot2, 'dist', 'clad.js'), 'process.stdout.write("v2");\n'); + writeFileSync(join(pkgRoot2, 'package.json'), JSON.stringify({name: 'cladding', version: '0.9.1'})); + writeFileSync(join(pkgRoot2, 'plugins', 'codex', 'skills', 'init', 'SKILL.md'), '---\nname: init\ndescription: x\n---\n'); + + const result = await runHostSetup({home, projectRoot: project, pkgRoot: pkgRoot2, quiet: true, activate: false}); + expect(result.wiring.runtime).toBe('rewired'); + expect(readFileSync(join(project, '.cladding', 'host', 'serve.cjs'), 'utf8')) + .toContain(join(pkgRoot2, 'dist', 'clad.js')); + } finally { + rmSync(pkgRoot2, {recursive: true, force: true}); + } + }); + + test('re-creates a deleted project runtime as a repair, no separate flag', async () => { + await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); + rmSync(join(project, '.cladding', 'host', 'serve.cjs')); + const result = await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); + expect(result.wiring.runtime).toBe('created'); + expect(existsSync(join(project, '.cladding', 'host', 'serve.cjs'))).toBe(true); + }); + + test('hostWireNotice guides toward clad setup and surfaces version skew without blocking', () => { + expect(hostWireNotice(null, '0.9.0')).toContain('clad setup'); + const skew = hostWireNotice('0.8.3', '0.9.0'); + expect(skew).toContain('0.8.3'); + expect(skew).toContain('0.9.0'); + expect(hostWireNotice('0.9.0', '0.9.0')).toBeNull(); + }); + + test('codex legacy cleanup preserves user comments and formatting outside the cladding entry', async () => { + mkdirSync(join(home, '.codex'), {recursive: true}); + const before = [ + '# precious top comment', + 'model = "gpt-x" # inline note', + '', + '[mcp_servers.other]', + 'command = "other"', + '', + '# cladding block below', + '[mcp_servers.cladding]', + 'command = "node"', + `args = [${JSON.stringify(join(pkgRoot, 'dist', 'clad.js'))}, "serve"]`, + '', + ].join('\n'); + writeFileSync(join(home, '.codex', 'config.toml'), before); + + const result = await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false, hosts: ['claude']}); + + expect(result.legacyCleanup.codex_mcp).toBe('removed'); + const after = readFileSync(join(home, '.codex', 'config.toml'), 'utf8'); + expect(after).toContain('# precious top comment'); + expect(after).toContain('model = "gpt-x" # inline note'); + expect(after).toContain('[mcp_servers.other]'); + // The section is gone; user prose (even a comment mentioning cladding) stays. + expect(after).not.toContain('[mcp_servers.cladding]'); + expect(after).not.toContain('dist/clad.js'); + expect(after).toContain('# cladding block below'); + }); + + test('cursor legacy cleanup drops an emptied mcpServers object instead of leaving an orphan', async () => { + mkdirSync(join(home, '.cursor'), {recursive: true}); + writeFileSync(join(home, '.cursor', 'mcp.json'), `${JSON.stringify({ + mcpServers: {cladding: {command: 'node', args: [join(pkgRoot, 'dist', 'clad.js'), 'serve']}}, + }, null, 2)}\n`); + + const result = await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false, hosts: ['claude']}); + + expect(result.legacyCleanup.cursor_mcp).toBe('removed'); + const after = JSON.parse(readFileSync(join(home, '.cursor', 'mcp.json'), 'utf8')); + expect(after.mcpServers).toBeUndefined(); + }); + + test('a foreign real directory at the antigravity plugin path is preserved and reported', async () => { + const dir = join(home, '.gemini', 'config', 'plugins', 'cladding'); + mkdirSync(dir, {recursive: true}); + writeFileSync(join(dir, 'mcp_config.json'), `${JSON.stringify({ + mcpServers: {cladding: {command: 'node', args: ['/somewhere/else/engine.js', 'serve']}}, + }, null, 2)}\n`); + + const result = await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false, hosts: ['antigravity']}); + + expect(result.legacyCleanup.antigravity_plugin).toBe('skipped-different'); + expect(result.wiring.antigravity).toBe('skipped-different'); + const kept = JSON.parse(readFileSync(join(dir, 'mcp_config.json'), 'utf8')); + expect(kept.mcpServers.cladding.args[0]).toBe('/somewhere/else/engine.js'); + }); + test('preserves unowned global files with Cladding-like names', async () => { const custom = mkdtempSync(join(tmpdir(), 'custom-plugin-')); try { diff --git a/tests/cli/update.test.ts b/tests/cli/update.test.ts index d70b8246..e436bb57 100644 --- a/tests/cli/update.test.ts +++ b/tests/cli/update.test.ts @@ -23,15 +23,19 @@ describe('runUpdate', () => { }); afterEach(() => rmSync(dir, {recursive: true, force: true})); - test('no spec.yaml → re-wires only, isProject false, no project files written', async () => { - const r = await runUpdate(dir, {wireHosts: okWire}); + test('no spec.yaml → nothing runs: no wiring call, isProject false, no writes', async () => { + let wireCalled = false; + const r = await runUpdate(dir, {wireHosts: async () => { wireCalled = true; return 0; }}); + expect(wireCalled).toBe(false); // wiring (and its legacy cleanup) must not fire outside a project expect(r.isProject).toBe(false); + expect(r.wiringErrors).toBe(0); expect(r.claudeMd).toBe('n/a'); expect(r.agentsMd).toBe('n/a'); expect(r.code).toBe(0); }); test('host wiring failure → exit code 1 (the one thing that blocks)', async () => { + writeFileSync(join(dir, 'spec.yaml'), SPEC); const r = await runUpdate(dir, {wireHosts: async () => 2}); expect(r.wiringErrors).toBe(2); expect(r.code).toBe(1); diff --git a/tests/serve/init-tools.test.ts b/tests/serve/init-tools.test.ts index 41fb4e16..fe3c7cdd 100644 --- a/tests/serve/init-tools.test.ts +++ b/tests/serve/init-tools.test.ts @@ -166,6 +166,50 @@ describe('serve/server — natural-language init tools', () => { } }); + test('a tampered staged draft is rejected as draft_required, never rendered', async () => { + const first = await makePair(dir); + const prepared = await prepare(first.client, {mode: 'idea', intent: 'B2B payment SaaS'}); + await first.client.callTool({name: 'clad_stage_init', arguments: {token: prepared.token, draft}}); + await first.cleanup(); + + const cacheDir = join(dir, '.cladding', 'host', 'onboarding-pending'); + const [entry] = readdirSync(cacheDir); + const cachePath = join(cacheDir, entry); + const cached = JSON.parse(readFileSync(cachePath, 'utf8')) as {draft: Record}; + cached.draft.project_context = null; // the crash-shape a raw renderDraft would hit + cached.draft.capabilities = 'garbage-not-an-array'; + writeFileSync(cachePath, JSON.stringify(cached)); + + const second = await makePair(dir); + try { + const result = await second.client.callTool({name: 'clad_init', arguments: { + confirmation: prepared.confirmation, + }}); + expect(result.isError).toBe(true); + expect(payload(result)).toMatchObject({status: 'draft_required', changed: false}); + expect(existsSync(join(dir, 'spec.yaml'))).toBe(false); + } finally { + await second.cleanup(); + } + }); + + test('staging sweeps expired consent-cache envelopes left by abandoned flows', async () => { + const cacheDir = join(dir, '.cladding', 'host', 'onboarding-pending'); + mkdirSync(cacheDir, {recursive: true}); + const stale = join(cacheDir, 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef.json'); + writeFileSync(stale, JSON.stringify({expiresAt: Date.now() - 60_000, token: 'x', request: {}})); + + const {client, cleanup} = await makePair(dir); + try { + const prepared = await prepare(client, {mode: 'idea', intent: 'B2B payment SaaS'}); + await client.callTool({name: 'clad_stage_init', arguments: {token: prepared.token, draft}}); + expect(existsSync(stale)).toBe(false); + expect(readdirSync(cacheDir).length).toBe(1); // only the live envelope remains + } finally { + await cleanup(); + } + }); + test('approval without a direct or staged draft fails closed', async () => { const first = await makePair(dir); const prepared = await prepare(first.client, {mode: 'document', document_path: (() => { From fbd602aa0349585d7bd7f966634f64e1914c98b5 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Thu, 16 Jul 2026 17:00:57 +0900 Subject: [PATCH 27/28] feat(doctor): 0.9.0 host-smoke matrix from the packed engine + repo re-wire MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - doctor probes match the project-local model: the consented Claude probe auto-approves the project .mcp.json server, the Antigravity probe runs in the project directory with agy's permissions bypass (it used to leave the project via --new-project), the Codex probe bypasses approvals (annotated non-read-only tools were auto-denied headlessly), and run-check gets a gate-sized timeout instead of grading slowness as failure - eslint ignores .cladding/ (machine-local runtime state; the regenerated host launcher tripped no-require-imports) - re-wire the repo itself post-migration: project-local wiring for all five hosts (this repo dogfoods the 0.9.0 model it ships) - docs/dogfood/matrix.md regenerated at 0.9.0 by the packed tarball: claude/codex/antigravity verified live (all three sentinel surfaces incl. the full gate), gemini fail (IneligibleTierError — account tier), cursor wiring pass + model surfaces fail (account usage limit); README host-claims fence synced to claim no more than the evidence - campaign report docs/dogfood/e2e-0.9.0-packed-2026-07-16.md + CHANGELOG section for the campaign-hardening fixes Co-Authored-By: Claude Fable 5 --- .agents/mcp_config.json | 10 +++ .agents/skills/cladding-init/SKILL.md | 28 ++++++++ .claude/skills/cladding-init/SKILL.md | 28 ++++++++ .codex/config.toml | 5 ++ .cursor/cli.json | 10 +++ .cursor/mcp.json | 10 +++ .cursor/rules/cladding-bootstrap.mdc | 7 ++ .cursor/skills/cladding-init/SKILL.md | 28 ++++++++ .gemini/settings.json | 10 +++ .mcp.json | 10 +++ CHANGELOG.md | 12 ++++ README.md | 2 +- docs/dogfood/e2e-0.9.0-packed-2026-07-16.md | 74 +++++++++++++++++++++ docs/dogfood/matrix.md | 19 +++--- eslint.config.js | 4 +- plugins/claude-code/dist/clad.js | 4 +- spec/attestation.yaml | 6 +- src/cli/doctor-hosts.ts | 31 ++++++--- 18 files changed, 270 insertions(+), 28 deletions(-) create mode 100644 .agents/mcp_config.json create mode 100644 .agents/skills/cladding-init/SKILL.md create mode 100644 .claude/skills/cladding-init/SKILL.md create mode 100644 .codex/config.toml create mode 100644 .cursor/cli.json create mode 100644 .cursor/mcp.json create mode 100644 .cursor/rules/cladding-bootstrap.mdc create mode 100644 .cursor/skills/cladding-init/SKILL.md create mode 100644 .gemini/settings.json create mode 100644 .mcp.json create mode 100644 docs/dogfood/e2e-0.9.0-packed-2026-07-16.md diff --git a/.agents/mcp_config.json b/.agents/mcp_config.json new file mode 100644 index 00000000..8b0e5a18 --- /dev/null +++ b/.agents/mcp_config.json @@ -0,0 +1,10 @@ +{ + "mcpServers": { + "cladding": { + "command": "node", + "args": [ + ".cladding/host/serve.cjs" + ] + } + } +} diff --git a/.agents/skills/cladding-init/SKILL.md b/.agents/skills/cladding-init/SKILL.md new file mode 100644 index 00000000..28e0fb25 --- /dev/null +++ b/.agents/skills/cladding-init/SKILL.md @@ -0,0 +1,28 @@ +--- +name: cladding-init +description: Use only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it; never use for an ordinary project creation or implementation request. Scaffold from an idea, planning document, or existing project through the MCP prepare/apply flow. +--- + +# Cladding init + +Use this workflow only when the user explicitly asks to initialize, adopt, or refresh Cladding. Opening a repository alone is not consent to initialize it. + +## Required host workflow + +If the current user message itself matches `APPLY CLADDING XXXXXX`, do not call prepare or stage again. Call `clad_init` once and copy the entire user message, including the `APPLY CLADDING` prefix, into `confirmation`. + +1. If a greenfield request has no project intent, ask for one short description. +2. Call `clad_prepare_init` with exactly one starting mode: + - `idea` with the user's description. + - `document` with a project-relative planning-document path. + - `existing` for an existing codebase; include an optional adoption goal. +3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model, then call `clad_stage_init` with the preparation token and that draft. Staging validates the draft and stores only ignored runtime state under `.cladding/host/`; it does not modify authored project files. +4. Show `plannedChanges`, the staged `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the entire reply verbatim as `confirmation`—never strip the `APPLY CLADDING` prefix. Include the draft and token when the host retained them; process-per-turn hosts may omit both because Cladding resolves the exact staged draft from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. +6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. + +Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. + +`clad_prepare_init` does not modify the workspace, and `clad_stage_init` writes only ignored runtime state. Never call stage and apply in the same assistant turn. Only `clad_init` writes authored artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. + +The raw CLI remains available for terminal, CI, offline, and explicitly configured SDK automation; it is not the primary host onboarding path. diff --git a/.claude/skills/cladding-init/SKILL.md b/.claude/skills/cladding-init/SKILL.md new file mode 100644 index 00000000..28e0fb25 --- /dev/null +++ b/.claude/skills/cladding-init/SKILL.md @@ -0,0 +1,28 @@ +--- +name: cladding-init +description: Use only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it; never use for an ordinary project creation or implementation request. Scaffold from an idea, planning document, or existing project through the MCP prepare/apply flow. +--- + +# Cladding init + +Use this workflow only when the user explicitly asks to initialize, adopt, or refresh Cladding. Opening a repository alone is not consent to initialize it. + +## Required host workflow + +If the current user message itself matches `APPLY CLADDING XXXXXX`, do not call prepare or stage again. Call `clad_init` once and copy the entire user message, including the `APPLY CLADDING` prefix, into `confirmation`. + +1. If a greenfield request has no project intent, ask for one short description. +2. Call `clad_prepare_init` with exactly one starting mode: + - `idea` with the user's description. + - `document` with a project-relative planning-document path. + - `existing` for an existing codebase; include an optional adoption goal. +3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model, then call `clad_stage_init` with the preparation token and that draft. Staging validates the draft and stores only ignored runtime state under `.cladding/host/`; it does not modify authored project files. +4. Show `plannedChanges`, the staged `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the entire reply verbatim as `confirmation`—never strip the `APPLY CLADDING` prefix. Include the draft and token when the host retained them; process-per-turn hosts may omit both because Cladding resolves the exact staged draft from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. +6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. + +Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. + +`clad_prepare_init` does not modify the workspace, and `clad_stage_init` writes only ignored runtime state. Never call stage and apply in the same assistant turn. Only `clad_init` writes authored artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. + +The raw CLI remains available for terminal, CI, offline, and explicitly configured SDK automation; it is not the primary host onboarding path. diff --git a/.codex/config.toml b/.codex/config.toml new file mode 100644 index 00000000..e4fc8293 --- /dev/null +++ b/.codex/config.toml @@ -0,0 +1,5 @@ +[mcp_servers.cladding] +command = "node" +args = [ ".cladding/host/serve.cjs" ] +description = "cladding MCP server (project-scoped by `clad setup`)" +default_tools_approval_mode = "writes" diff --git a/.cursor/cli.json b/.cursor/cli.json new file mode 100644 index 00000000..cdd5d86e --- /dev/null +++ b/.cursor/cli.json @@ -0,0 +1,10 @@ +{ + "permissions": { + "allow": [ + "Mcp(cladding:clad_list_features)", + "Mcp(cladding:clad_get_feature)", + "Mcp(cladding:clad_run_check)" + ], + "deny": [] + } +} diff --git a/.cursor/mcp.json b/.cursor/mcp.json new file mode 100644 index 00000000..8b0e5a18 --- /dev/null +++ b/.cursor/mcp.json @@ -0,0 +1,10 @@ +{ + "mcpServers": { + "cladding": { + "command": "node", + "args": [ + ".cladding/host/serve.cjs" + ] + } + } +} diff --git a/.cursor/rules/cladding-bootstrap.mdc b/.cursor/rules/cladding-bootstrap.mdc new file mode 100644 index 00000000..a243edb0 --- /dev/null +++ b/.cursor/rules/cladding-bootstrap.mdc @@ -0,0 +1,7 @@ +--- +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. diff --git a/.cursor/skills/cladding-init/SKILL.md b/.cursor/skills/cladding-init/SKILL.md new file mode 100644 index 00000000..28e0fb25 --- /dev/null +++ b/.cursor/skills/cladding-init/SKILL.md @@ -0,0 +1,28 @@ +--- +name: cladding-init +description: Use only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it; never use for an ordinary project creation or implementation request. Scaffold from an idea, planning document, or existing project through the MCP prepare/apply flow. +--- + +# Cladding init + +Use this workflow only when the user explicitly asks to initialize, adopt, or refresh Cladding. Opening a repository alone is not consent to initialize it. + +## Required host workflow + +If the current user message itself matches `APPLY CLADDING XXXXXX`, do not call prepare or stage again. Call `clad_init` once and copy the entire user message, including the `APPLY CLADDING` prefix, into `confirmation`. + +1. If a greenfield request has no project intent, ask for one short description. +2. Call `clad_prepare_init` with exactly one starting mode: + - `idea` with the user's description. + - `document` with a project-relative planning-document path. + - `existing` for an existing codebase; include an optional adoption goal. +3. Read the returned prompt and observations. Draft the structured object required by `clad_init` using the current host model, then call `clad_stage_init` with the preparation token and that draft. Staging validates the draft and stores only ignored runtime state under `.cladding/host/`; it does not modify authored project files. +4. Show `plannedChanges`, the staged `confirmationQuestion`, and its one-time `approvalChallenge` to the user, then stop and wait for a separate reply. The original initialization request is not confirmation. +5. Only when the user's separate reply exactly matches `approvalChallenge`, call `clad_init` with the entire reply verbatim as `confirmation`—never strip the `APPLY CLADDING` prefix. Include the draft and token when the host retained them; process-per-turn hosts may omit both because Cladding resolves the exact staged draft from its short-lived machine-local cache. Questions, paraphrases, and generic acknowledgements are not approval. +6. If `nextQuestion` is present, show it verbatim and end the assistant turn immediately. Never answer it, infer an answer, or call either clarify tool during the initialization-approval turn. Continue with the Cladding clarify workflow only after a new user message supplies the answer. If no question remains, report that ordinary development can begin. + +Do not run `clad init` in a shell from an AI-host onboarding session. Do not use MCP sampling. If the MCP tools are absent, tell the user to run `clad setup`, restart the AI host in the project directory, and stop without writing project files. + +`clad_prepare_init` does not modify the workspace, and `clad_stage_init` writes only ignored runtime state. Never call stage and apply in the same assistant turn. Only `clad_init` writes authored artifacts, after explicit user confirmation plus schema and freshness validation. A stale, malformed, or replayed apply request must be prepared again. + +The raw CLI remains available for terminal, CI, offline, and explicitly configured SDK automation; it is not the primary host onboarding path. diff --git a/.gemini/settings.json b/.gemini/settings.json new file mode 100644 index 00000000..8b0e5a18 --- /dev/null +++ b/.gemini/settings.json @@ -0,0 +1,10 @@ +{ + "mcpServers": { + "cladding": { + "command": "node", + "args": [ + ".cladding/host/serve.cjs" + ] + } + } +} diff --git a/.mcp.json b/.mcp.json new file mode 100644 index 00000000..8b0e5a18 --- /dev/null +++ b/.mcp.json @@ -0,0 +1,10 @@ +{ + "mcpServers": { + "cladding": { + "command": "node", + "args": [ + ".cladding/host/serve.cjs" + ] + } + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dba9573..00b81e63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,17 @@ Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). - **A missing runnable deliverable stays honest.** Safe declared entries run, broken entries block, and an early onboarding seed is not forced to invent an unsafe smoke command. - **Verification evidence remains non-vacuous.** Done features must execute a passing declared test, spec-conformance oracles preserve full-suite evidence, and unavailable tools remain skips rather than false passes. +### Hardened by the packed-tarball E2E campaign (2026-07-16) + +A live campaign installed the packed 0.9.0 tarball in isolation and drove real init scenarios through all five host CLIs (report: `docs/dogfood/e2e-0.9.0-packed-2026-07-16.md`). The consent boundary held on every host that ran; these defects were found and fixed: + +- **Setup wires only detected hosts by default.** Previously every project received all five hosts' config files regardless of what was installed; `clad setup --host all` remains the explicit override. +- **Antigravity actually connects now.** agy reads MCP config machine-wide only (a negative control proved the project file is never loaded), so setup also writes an ownership-guarded `~/.gemini/config/plugins/cladding/` wire — the one stated exception to project-local activation; sessions still resolve the project from their working directory. +- **`clad update` outside a cladding project writes nothing.** It used to scaffold host wiring into any directory and could reach an account-wide legacy plugin uninstall. +- **Abandoned onboarding preparations no longer accumulate.** Expired consent-cache envelopes are swept on staging (hundreds had piled up in the shared temp dir), and a tampered staged draft is now re-validated and rejected cleanly instead of surfacing a raw crash. +- **Legacy cleanup preserves your global config formatting.** The codex `config.toml` entry is now spliced out textually (comments and ordering survive, parse-verified), and cursor cleanup no longer leaves an orphan empty `mcpServers`. +- **`clad doctor --hosts` probes match the project-local model** (project-MCP approval for the consented Claude probe, project-directory Antigravity probe, Codex approvals bypass, and a realistic gate timeout). + ### Also changed - The deterministic collector found nine onboarding commit subjects that do not name a spec feature. Their user-visible behavior is covered by the spec-backed notes above, but their commit-to-spec linkage remains absent. @@ -38,6 +49,7 @@ Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). - 아이디어·전체 UTF-8 기획 문서·기존 코드 중 어디서든 시작하고, 결정이 남은 경우에만 최대 3개의 핵심 질문을 받습니다. - 초기화 전에는 준비용 MCP 도구 3개만 노출되며, 정확한 일회용 승인 문구로 적용한 뒤 전체 개발 도구가 열립니다. +- 실제 5개 호스트 CLI에 패키징된 tarball을 설치해 검증하는 E2E 캠페인을 거쳤습니다 — 설치된 호스트만 배선, Antigravity 연결 수리, 임시 파일 잔존 정리 등 캠페인이 찾은 결함을 모두 수정했습니다. - 호스트가 재시작돼도 검토한 초안을 그대로 적용하고, 실패·오래된 요청·재사용 요청은 프로젝트를 부분 변경 상태로 남기지 않습니다. ## [0.8.3] — Agent loops that stop honestly, a guard against unverified "done", and a faster check (2026-07-12) diff --git a/README.md b/README.md index 4fe728ce..b0f54e45 100644 --- a/README.md +++ b/README.md @@ -309,7 +309,7 @@ Implement email sign-in, including tests. There is nothing new to memorize. For host-specific invocation, stricter Git/CI enforcement, and verified host status, see [setup details](docs/setup.md). - + diff --git a/docs/dogfood/e2e-0.9.0-packed-2026-07-16.md b/docs/dogfood/e2e-0.9.0-packed-2026-07-16.md new file mode 100644 index 00000000..409ddc85 --- /dev/null +++ b/docs/dogfood/e2e-0.9.0-packed-2026-07-16.md @@ -0,0 +1,74 @@ +# 0.9.0 packed-tarball E2E campaign — 2026-07-16 + +- Engine under test: `cladding-0.9.0.tgz` packed from this branch, installed into an isolated npm + prefix (`clad --version` = 0.9.0; `dist/clad.js` sha256-identical to the repo build). The stale + global 0.8.3 at `/opt/homebrew` was never invoked. +- Scope: the project-local onboarding rewrite — deterministic CLI cells, per-host MCP source + isolation, live natural-language consent flows, and the legacy 0.8.3 → 0.9.0 real-home migration. +- Isolation: every `clad` cell ran under a sandbox `HOME` with LLM API keys unset; host CLIs ran + with their real authentication against throwaway projects, wrapped in before/after snapshots of + the six global config surfaces cladding may touch. + +## Deterministic cells (sandbox HOME, packed engine) — all passed + +| Cell | Result | +|---|---| +| Bare / Korean-intent / planning-doc / `--scan` init | scaffold correct; deterministic-stub warning loud; Korean preserved; authored files byte-unchanged with `.cladding/scan/*.proposal` divert | +| MCP consent protocol | exactly 3 bootstrap tools pre-init; paraphrase and well-formed-but-wrong challenge both rejected without writes; exact phrase applies and registers the full tool surface | +| Cross-process staging | prepare / stage / apply in three separate processes; bare-challenge apply resolved the staged draft from the durable cache | +| Tampered staged cache | never silently applied; workspace intact (initially surfaced as a raw TypeError — fixed, now `draft_required`, regression-tested) | +| Legacy migration (fixture home) | ownership-proven symlinks/entries removed; foreign entries semantically preserved; second run byte-identical; the account-wide `claude plugin uninstall` argv captured via a PATH shim | +| Global-config blast radius | exotic TOML (datetime / inline table / dotted keys) semantically preserved; unparseable file left byte-identical; comment destruction found → fixed via text-splice with parse-verification, regression-tested | +| Post-init dev flow | `clad_create_feature` (hash id) → `done` refused for real causes (missing test proof, no type checker, convention, architecture) → after fixes strict gate GREEN → `done` | +| Refresh boundary | `already_initialized` without the refresh flag; refresh apply left a hand-edited `spec.yaml` sha256-identical, content diverted to proposals | + +## Per-host verdicts (source-isolated) + +| Host | Wire read | Live consent flow | +|---|---|---| +| Claude Code 2.1.211 | project `.mcp.json` (held at per-project approval gate) | PASS — stop at preview, paraphrase refused, exact phrase applied; clarify loop; model-driven feature creation | +| Codex CLI 0.144.4 | project `.codex/config.toml` (trusted repo only; absent when untrusted) | PASS — full consent script plus a fresh-process apply from the durable cache | +| Antigravity 1.1.2 | **machine-wide only** — negative control proved the project `.agents/mcp_config.json` is never read | PASS via the machine-wide wire (engine build identical); consent + clarify loop | +| Gemini CLI 0.42.0 | project `.gemini/settings.json` after folder trust (Connected; tools registered) | not-run — `IneligibleTierError`, individual tier discontinued by Google | +| Cursor Agent 2026.07.09 | project `.cursor/mcp.json` (`ready`, 22 tools; vanishes when the file is renamed) | not-run — account usage limit | + +The consent boundary — the one property no unit test can enforce, because the approval token is an +integrity hash the model could forge — held on every host that ran: with all permission bypasses +enabled, no model applied on the initial request or on a "yes go ahead" paraphrase. + +## Defects found → fixed on this branch (each with a regression test) + +1. `clad setup` wired all five hosts regardless of what is installed, diverging from its own spec + (AC-001) whose twelve `test_refs` had all gone dangling in the 0.9.0 rewrite. Default now wires + detected hosts only; `--host all` stays explicit; the shard was rewritten to the project-scoped + contract with live test references. +2. Antigravity's project wire was a dead file (above). Setup now also writes the + `~/.gemini/config/plugins/cladding/` wire agy actually loads, ownership-guarded and reported as + the one deliberate exception to project-local activation. +3. `clad update` in a non-project directory scaffolded 13 host-wiring files and could reach the + account-wide `claude plugin uninstall`. It now writes nothing outside a cladding project. +4. Abandoned `clad_prepare_init` flows leaked 0600 consent-cache envelopes into the shared temp dir + (644 had accumulated on the reference machine). Staging now sweeps expired envelopes. +5. A tampered durable-cache draft reached `renderDraft` unvalidated (crash-shaped rejection). + Drafts are now schema-revalidated on load. +6. Codex legacy cleanup re-serialized the whole `~/.codex/config.toml`, destroying user comments; + Cursor cleanup left an orphan empty `mcpServers`. Both fixed (text splice with parse + verification; emptied-object removal). + +## Behavioral observations (host-side, not cladding defects) + +- Codex `exec` auto-denies the onboarding tools under the shipped `default_tools_approval_mode = + "writes"` because cladding annotates them honestly as non-read-only; interactive Codex shows a + normal approval prompt. Documented in `docs/setup.md`. +- With no MCP available and permission bypass on, the Antigravity model fabricated a plausible + feature id via shell workarounds — a live demonstration that behavioral transcripts are + inadmissible as wiring evidence without a source-isolating negative control. +- On Claude, one user reply was relayed verbatim into two distinct clarify questions (the first of + which it did not answer); the review-divert design contained the effect to proposals. + +## Real-home migration (consented) + +Executed with the packed engine from a scratch directory: legacy user-scope Claude plugin +uninstalled, 25 `~/.agents/skills/cladding-*` symlinks and the Gemini extension removed, the +`~/.codex/config.toml` entry excised (real-file diff was whitespace-only), the agy-imported plugin +directory correctly preserved and reported. Post-run residue scan showed only host-attributed churn. diff --git a/docs/dogfood/matrix.md b/docs/dogfood/matrix.md index fe517950..7d92f647 100644 --- a/docs/dogfood/matrix.md +++ b/docs/dogfood/matrix.md @@ -1,18 +1,18 @@ # Host support matrix - + -- Cladding version: `0.8.3` -- Generated: 2026-07-16T00:52:17+09:00 +- Cladding version: `0.9.0` +- Generated: 2026-07-16T07:48:44.436Z | Host | list-features | get-feature | run-check | wiring | Grade | |---|---|---|---|---|---| | claude | pass | pass | pass | — | verified | -| gemini | — | — | — | — | not-run | -| antigravity | pass | pass | pass | pass | verified | +| gemini | fail | fail | fail | — | fail | +| antigravity | pass | pass | pass | — | verified | | codex | pass | pass | pass | — | verified | -| cursor | pass | pass | pass | pass | verified | +| cursor | fail | fail | fail | pass | fail | **Legend** @@ -22,10 +22,7 @@ **Why not-run / fail** -- `claude`: doctor surfaces remain verified from the prior campaign; the 2026-07-15 onboarding rerun was blocked by host quota. -- `gemini`: isolated project-local skill discovery and MCP connectivity passed, but the current Google account returned `UNSUPPORTED_CLIENT` before a model prompt could run; see `gemini-cli-2026-07-16.md`. -- `antigravity`: project-scoped onboarding campaign passed; see `antigravity-cli-2026-07-15.md`. -- `codex`: project-scoped onboarding and all three surfaces passed; see `codex-cli-2026-07-15.md`. -- `cursor`: project-scoped onboarding and ordinary development passed in the recorded campaign; the account usage limit was reached before the corrected project read-only allowlist could be model-replayed, so no newer pass replaces that evidence. See `cursor-agent-2026-07-15.md`. +- `gemini`: list-features, get-feature, run-check failed — e:///opt/homebrew/Cellar/gemini-cli/0.42.0/libexec/lib/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:273233:5) at process.processTicksAndRejections (node:internal/process/task_queues:104:5) +- `cursor`: list-features, get-feature, run-check failed — exit 1: ActionRequiredError: You've hit your usage limit Get Cursor Pro for more Agent usage, unlimited Tab, and more. > Live grades land when a human runs `clad doctor --hosts` with consent (`CLAD_HOST_SMOKE=1` or `--yes`). Without consent this baseline records only what is checkable for free — Cursor wiring — and leaves all LLM-driven surfaces `not-run`. diff --git a/eslint.config.js b/eslint.config.js index a2e61cd8..7850bc9c 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -8,7 +8,9 @@ import tseslint from 'typescript-eslint'; export default tseslint.config( { - ignores: ['node_modules/**', 'dist/**', 'plugins/**/dist/**', 'src/graph/viewer/**'], + // .cladding/ is machine-local runtime state (e.g. the generated host + // launcher serve.cjs) — never authored source, so never linted. + ignores: ['node_modules/**', 'dist/**', 'plugins/**/dist/**', 'src/graph/viewer/**', '.cladding/**'], }, ...tseslint.configs.recommended, { diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 8b36ce6f..0204e8a0 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -645,11 +645,11 @@ name: ${i} `);return Qa(he(t,".cursor","rules","cladding-bootstrap.mdc"),e)}function Vl(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 NY(t){try{return JSON.parse(_S(t,"utf8")).cladding_version??null}catch{return null}}function OY(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 ZC(t={}){let e=t.home??IY(),r=Ss(t.projectRoot??process.cwd()),n=t.pkgRoot??jY(),i=t.version??MY(n),o=dCe(e),s=new Set(t.hosts??GPe.filter(K=>o[K])),a=t.force??!1,c=he(r,".cladding",BC),l=NY(c),u=[],d=[];hS(r),oCe(r);let f=[Qa(he(r,HC),nCe(n))];s.has("gemini")&&f.push(Qa(he(r,GC),iCe()));let p=Vl(f),m=he(n,"plugins","codex","skills","init"),h=s.has("codex")||s.has("gemini")||s.has("antigravity")?qC(m,he(r,".agents","skills","cladding-init"),a):"unchanged",g=sCe(),b=WPe(e,n),_=yS(he(e,".claude","plugins","cladding"),b),S=_==="removed"?rCe(t.activate??!0):"unchanged",x={claude_plugin:Vl([_,S]),gemini_extension:yS(he(e,".gemini","extensions","cladding"),b),antigravity_plugin:eCe(e,b),codex_skills:KPe(e,b),codex_mcp:await YPe(e,b),cursor_mcp:XPe(e,b)},w=s.has("codex")?await cCe(he(r,".codex","config.toml"),g,a):"skipped-not-installed",O=s.has("gemini")?Bp(he(r,".gemini","settings.json"),g,a):"skipped-not-installed",T=s.has("antigravity")?Vl([Bp(he(r,".agents","mcp_config.json"),g,a),QPe(e,n,a)]):"skipped-not-installed",A=s.has("claude")?Vl([qC(m,he(r,".claude","skills","cladding-init"),a),Bp(he(r,".mcp.json"),g,a)]):"skipped-not-installed",D=s.has("cursor")?Vl([qC(m,he(r,".cursor","skills","cladding-init"),a),Bp(he(r,".cursor","mcp.json"),g,a),aCe(he(r,".cursor","cli.json")),lCe(r)]):"skipped-not-installed",$={runtime:p,shared_init_skill:h,claude:A,codex:w,gemini:O,antigravity:T,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[K,xe]of Object.entries($))OY(xe,K,u,d);for(let[K,xe]of Object.entries(x))OY(xe,`legacy:${K}`,u,d);hS(vs(c)),Xa(c,`${JSON.stringify({project_root:r,cladding_root:n,cladding_version:i,last_run:new Date().toISOString()},null,2)} `,"utf8");let ie={projectRoot:r,wiring:$,legacyCleanup:x,errors:u,warnings:d,statusFile:c,cladding_root:n,cladding_version:i,last_setup_version:l};return t.quiet||process.stdout.write(`${uCe(ie)} `),ie}function qp(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-installed":return"not selected";case"skipped-different":return"preserved conflict";case"manual-required":return"manual cleanup required";default:return"failed"}}function uCe(t,e){let r=[`cladding setup \u2014 project activation: ${t.projectRoot}`,"",` Claude Code \u2192 ${qp(t.wiring.claude)}`,` Codex \u2192 ${qp(t.wiring.codex)}`,` Gemini CLI \u2192 ${qp(t.wiring.gemini)}`,` Antigravity \u2192 ${qp(t.wiring.antigravity)}`,` Cursor \u2192 ${qp(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 jY(){let t=HPe(import.meta.url),e=vs(t);for(let r=0;r<7;r++){try{if(JSON.parse(_S(he(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=vs(e)}return Ss(vs(t),"..")}function MY(t){try{return JSON.parse(_S(he(t,"package.json"),"utf8")).version??"unknown"}catch{return"unknown"}}function Wl(){let t=MY(jY());return t==="unknown"?null:t}function FY(t=process.cwd()){return NY(he(Ss(t),".cladding",BC))}function dCe(t=IY()){return{claude:In(he(t,".claude")),gemini:In(he(t,".gemini")),antigravity:In(he(t,".gemini","config"))||In(he(t,".gemini","antigravity-cli")),codex:In(he(t,".codex")),agents:In(he(t,".agents")),cursor:In(he(t,".cursor"))}}Be();Oi();var mCe=["claude","gemini","antigravity","codex","cursor"],Eo={"list-features":{pattern:/F-[0-9a-f]{6,8}/,label:"a real feature id (F-xxxxxx)"},"get-feature":{pattern:/F-[0-9a-f]{6,8}/,label:"the queried feature id echoed"},"run-check":{pattern:/\b[Dd]rift\b|\b[Ff]indings?\b|\bGREEN\b|\bRED\b/,label:"a drift verdict (drift/findings/GREEN/RED)"}};function Kl(t,e=200){let r=t.replace(/\s+/g," ").trim();return r.length<=e?r:r.slice(-e)}function hCe(t,e,r){if(/\b(?:MCP|tool|clad_[a-z0-9_]+)(?:\s+tool)?(?:\s+calls?)?[^.\n]{0,80}\b(?:rejected|denied|refused|cancelled|canceled|not approved)\b|\buser cancelle?d MCP tool call\b|\bno tool payload\b|\bdon't have a findings count\b|\bre-approve the cladding MCP tool\b/i.test(e))return{result:"fail",sentinel:Eo[t].label,evidence:Kl(e)};let i=Eo[t].pattern,o=Eo[t].label;return t==="get-feature"&&r&&(i=new RegExp(r),o=`the queried id ${r} echoed`),{result:i.test(e)?"pass":"fail",sentinel:o,evidence:Kl(e)}}var gCe={"list-features":()=>"Call the clad_list_features MCP tool and print exactly one feature id (format F-xxxxxxxx) from the result, nothing else.","get-feature":t=>`Call the clad_get_feature MCP tool for id ${t} and print that id verbatim.`,"run-check":()=>"Call the clad_run_check MCP tool and print the number of findings plus the word 'findings'."};function yCe(t,e){switch(t){case"claude":return{command:"claude",args:["-p",e,"--output-format","text"]};case"gemini":return{command:"gemini",args:["--skip-trust","--approval-mode","plan","--policy",GC,"--allowed-mcp-server-names","cladding","-o","text","-p",e]};case"antigravity":return{command:"agy",args:["--new-project","-p",e]};case"codex":return{command:"codex",args:["exec",e]};case"cursor":return{command:"cursor-agent",args:["-p","--mode","ask","--trust","--approve-mcps",e]}}}function _Ce(t){return t==="antigravity"?"agy":t==="cursor"?"cursor-agent":t}var LY=6e4,bCe=1e4;function vCe(t){let e=KC()==="win32"?"where":"which";return WC(e,[t],{stdio:"ignore"}).status===0}function SCe(t,e,r){let n=WC(t,[...e],{cwd:r.cwd,encoding:"utf8",timeout:r.timeoutMs,shell:KC()==="win32"});return{stdout:n.stdout??"",stderr:n.stderr??"",timedOut:n.signal==="SIGTERM"||n.error?.code==="ETIMEDOUT",code:n.status}}function wCe(t,e,r){let n=JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2024-11-05",capabilities:{},clientInfo:{name:"clad-doctor-hosts",version:"1"}}}),i=JSON.stringify({jsonrpc:"2.0",method:"notifications/initialized"}),o=JSON.stringify({jsonrpc:"2.0",id:2,method:"tools/list",params:{}}),s=`${n} +`)}function jY(){let t=HPe(import.meta.url),e=vs(t);for(let r=0;r<7;r++){try{if(JSON.parse(_S(he(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=vs(e)}return Ss(vs(t),"..")}function MY(t){try{return JSON.parse(_S(he(t,"package.json"),"utf8")).version??"unknown"}catch{return"unknown"}}function Wl(){let t=MY(jY());return t==="unknown"?null:t}function FY(t=process.cwd()){return NY(he(Ss(t),".cladding",BC))}function dCe(t=IY()){return{claude:In(he(t,".claude")),gemini:In(he(t,".gemini")),antigravity:In(he(t,".gemini","config"))||In(he(t,".gemini","antigravity-cli")),codex:In(he(t,".codex")),agents:In(he(t,".agents")),cursor:In(he(t,".cursor"))}}Be();Oi();var mCe=["claude","gemini","antigravity","codex","cursor"],Eo={"list-features":{pattern:/F-[0-9a-f]{6,8}/,label:"a real feature id (F-xxxxxx)"},"get-feature":{pattern:/F-[0-9a-f]{6,8}/,label:"the queried feature id echoed"},"run-check":{pattern:/\b[Dd]rift\b|\b[Ff]indings?\b|\bGREEN\b|\bRED\b/,label:"a drift verdict (drift/findings/GREEN/RED)"}};function Kl(t,e=200){let r=t.replace(/\s+/g," ").trim();return r.length<=e?r:r.slice(-e)}function hCe(t,e,r){if(/\b(?:MCP|tool|clad_[a-z0-9_]+)(?:\s+tool)?(?:\s+calls?)?[^.\n]{0,80}\b(?:rejected|denied|refused|cancelled|canceled|not approved)\b|\buser cancelle?d MCP tool call\b|\bno tool payload\b|\bdon't have a findings count\b|\bre-approve the cladding MCP tool\b/i.test(e))return{result:"fail",sentinel:Eo[t].label,evidence:Kl(e)};let i=Eo[t].pattern,o=Eo[t].label;return t==="get-feature"&&r&&(i=new RegExp(r),o=`the queried id ${r} echoed`),{result:i.test(e)?"pass":"fail",sentinel:o,evidence:Kl(e)}}var gCe={"list-features":()=>"Call the clad_list_features MCP tool and print exactly one feature id (format F-xxxxxxxx) from the result, nothing else.","get-feature":t=>`Call the clad_get_feature MCP tool for id ${t} and print that id verbatim.`,"run-check":()=>"Call the clad_run_check MCP tool and print the number of findings plus the word 'findings'."};function yCe(t,e){switch(t){case"claude":return{command:"claude",args:["-p",e,"--output-format","text","--settings",'{"enableAllProjectMcpServers":true}']};case"gemini":return{command:"gemini",args:["--skip-trust","--approval-mode","plan","--policy",GC,"--allowed-mcp-server-names","cladding","-o","text","-p",e]};case"antigravity":return{command:"agy",args:["--dangerously-skip-permissions","-p",e]};case"codex":return{command:"codex",args:["exec","--dangerously-bypass-approvals-and-sandbox",e]};case"cursor":return{command:"cursor-agent",args:["-p","--mode","ask","--trust","--approve-mcps",e]}}}function _Ce(t){return t==="antigravity"?"agy":t==="cursor"?"cursor-agent":t}var LY={"list-features":12e4,"get-feature":12e4,"run-check":3e5},bCe=1e4;function vCe(t){let e=KC()==="win32"?"where":"which";return WC(e,[t],{stdio:"ignore"}).status===0}function SCe(t,e,r){let n=WC(t,[...e],{cwd:r.cwd,encoding:"utf8",timeout:r.timeoutMs,shell:KC()==="win32"});return{stdout:n.stdout??"",stderr:n.stderr??"",timedOut:n.signal==="SIGTERM"||n.error?.code==="ETIMEDOUT",code:n.status}}function wCe(t,e,r){let n=JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2024-11-05",capabilities:{},clientInfo:{name:"clad-doctor-hosts",version:"1"}}}),i=JSON.stringify({jsonrpc:"2.0",method:"notifications/initialized"}),o=JSON.stringify({jsonrpc:"2.0",id:2,method:"tools/list",params:{}}),s=`${n} ${i} ${o} `,a=WC(t,[...e],{cwd:r,input:s,encoding:"utf8",timeout:bCe,shell:KC()==="win32"});return xCe(a.stdout??"",a.stderr??"")}function xCe(t,e=""){for(let r of t.split(` -`)){let n=r.trim();if(!n.startsWith("{"))continue;let i;try{i=JSON.parse(n)}catch{continue}let o=i;if(o.id!==2)continue;let s=o.result?.tools;if(Array.isArray(s)){let a=s.map(c=>c.name).filter(Boolean);return{ok:a.includes("clad_list_features"),toolCount:s.length,evidence:Kl(`tools/list \u2192 ${s.length} tools: ${a.slice(0,6).join(", ")}`)}}}return{ok:!1,toolCount:0,evidence:Kl(e||t||"no tools/list response from clad serve")}}function $Ce(t){try{return H(t).features?.[0]?.id??null}catch{return null}}function VC(t){return{grade:"not-run",surfaces:Object.keys(Eo).map(r=>({name:r,result:"not-run",sentinel:Eo[r].label,evidence:""})),reason:t}}function kCe(t,e,r,n){let i=[];for(let c of Object.keys(Eo)){if(c==="get-feature"&&!r){i.push({name:c,result:"not-run",sentinel:Eo[c].label,evidence:"no feature available to query (empty spec)"});continue}let l=gCe[c](r??""),{command:u,args:d}=yCe(t,l),f=n(u,d,{cwd:e,timeoutMs:LY});if(f.timedOut){i.push({name:c,result:"fail",sentinel:Eo[c].label,evidence:Kl(`timed out after ${LY/1e3}s: ${f.stderr||f.stdout}`)});continue}if(f.code!==0){i.push({name:c,result:"fail",sentinel:Eo[c].label,evidence:Kl(`exit ${f.code??"signal"}: ${f.stderr||f.stdout}`)});continue}let p=`${f.stdout} +`)){let n=r.trim();if(!n.startsWith("{"))continue;let i;try{i=JSON.parse(n)}catch{continue}let o=i;if(o.id!==2)continue;let s=o.result?.tools;if(Array.isArray(s)){let a=s.map(c=>c.name).filter(Boolean);return{ok:a.includes("clad_list_features"),toolCount:s.length,evidence:Kl(`tools/list \u2192 ${s.length} tools: ${a.slice(0,6).join(", ")}`)}}}return{ok:!1,toolCount:0,evidence:Kl(e||t||"no tools/list response from clad serve")}}function $Ce(t){try{return H(t).features?.[0]?.id??null}catch{return null}}function VC(t){return{grade:"not-run",surfaces:Object.keys(Eo).map(r=>({name:r,result:"not-run",sentinel:Eo[r].label,evidence:""})),reason:t}}function kCe(t,e,r,n){let i=[];for(let c of Object.keys(Eo)){if(c==="get-feature"&&!r){i.push({name:c,result:"not-run",sentinel:Eo[c].label,evidence:"no feature available to query (empty spec)"});continue}let l=gCe[c](r??""),{command:u,args:d}=yCe(t,l),f=n(u,d,{cwd:e,timeoutMs:LY[c]});if(f.timedOut){i.push({name:c,result:"fail",sentinel:Eo[c].label,evidence:Kl(`timed out after ${LY[c]/1e3}s: ${f.stderr||f.stdout}`)});continue}if(f.code!==0){i.push({name:c,result:"fail",sentinel:Eo[c].label,evidence:Kl(`exit ${f.code??"signal"}: ${f.stderr||f.stdout}`)});continue}let p=`${f.stdout} ${f.stderr}`,m=hCe(c,p,c==="get-feature"?r??void 0:void 0);i.push({name:c,result:m.result,sentinel:m.sentinel,evidence:m.evidence})}let o=i.some(c=>c.result==="fail"),s=i.some(c=>c.result==="pass");return{grade:o?"fail":s?"verified":"not-run",surfaces:i}}function ECe(t,e,r){let n=Mi(e,".cursor"),i=Mi(n,"mcp.json");if(!UY(i))return{grade:"not-run",surfaces:[],reason:"no project .cursor/mcp.json \u2014 run `clad setup` in this project"};let o;try{o=JSON.parse(BY(i,"utf8")).mcpServers?.cladding}catch{return{grade:"not-run",surfaces:[],reason:"project .cursor/mcp.json is not valid JSON"}}if(!o||typeof o.command!="string")return{grade:"not-run",surfaces:[],reason:"no Cladding entry in project .cursor/mcp.json \u2014 run `clad setup`"};let s=Array.isArray(o.args)?o.args:[],a=r(o.command,s,e),c={name:"wiring",result:a.ok?"pass":"fail",sentinel:"clad serve answers tools/list including clad_list_features",evidence:a.evidence};return a.ok?{grade:"wiring-ok",surfaces:[c]}:{grade:"wiring-fail",surfaces:[c],reason:"Cladding is wired in project .cursor/mcp.json but its launcher did not answer tools/list"}}function ACe(t,e={}){let r=e.consent??!1,n=e.home??pCe(),i=e.now??new Date,o=e.version??Wl()??"unknown",s=e.hasBinary??vCe,a=e.runPrompt??SCe,c=e.probeServe??wCe,l=$Ce(t),u={};for(let m of mCe)s(_Ce(m))?r?u[m]=kCe(m,t,l,a):u[m]=VC("consent not given (set CLAD_HOST_SMOKE=1)"):u[m]=VC("binary not on PATH");let d=u.cursor,f=ECe(n,t,c),p={grade:f.grade==="wiring-fail"?"fail":d.grade,surfaces:[...d.surfaces,...f.surfaces],...d.reason||f.reason?{reason:[d.reason,f.reason].filter(Boolean).join("; ")}:{}};return{version:o,generatedAt:i.toISOString(),hosts:{claude:u.claude,gemini:u.gemini,antigravity:u.antigravity,codex:u.codex,cursor:p}}}function TCe(t){let e={claude:t.hosts.claude.grade,gemini:t.hosts.gemini.grade,antigravity:t.hosts.antigravity.grade,codex:t.hosts.codex.grade,cursor:t.hosts.cursor.grade};return``}function tc(t,e){let r=t.surfaces.find(n=>n.name===e);return r?r.result:"\u2014"}function OCe(t){let{version:e,generatedAt:r,hosts:n}=t,i=[];i.push("# Host support matrix"),i.push(""),i.push(""),i.push(TCe(t)),i.push(""),i.push(`- Cladding version: \`${e}\``),i.push(`- Generated: ${r}`),i.push(""),i.push("| Host | list-features | get-feature | run-check | wiring | Grade |"),i.push("|---|---|---|---|---|---|");let o=(a,c)=>`| ${a} | ${tc(c,"list-features")} | ${tc(c,"get-feature")} | ${tc(c,"run-check")} | \u2014 | ${c.grade} |`;i.push(o("claude",n.claude)),i.push(o("gemini",n.gemini)),i.push(o("antigravity",n.antigravity)),i.push(o("codex",n.codex)),i.push(`| cursor | ${tc(n.cursor,"list-features")} | ${tc(n.cursor,"get-feature")} | ${tc(n.cursor,"run-check")} | ${tc(n.cursor,"wiring")} | ${n.cursor.grade} |`),i.push(""),i.push("**Legend**"),i.push(""),i.push("- `verified` \u2014 every probed surface passed its sentinel end-to-end."),i.push("- `wiring` \u2014 Cursor additionally verifies that its configured `clad serve` answers a tools list over stdio."),i.push("- `not-run` \u2014 absence of evidence (binary absent from PATH, no live-run consent, or host not wired here). Never rendered as a pass \u2014 the matrix records absence honestly."),i.push("");let s=RCe(t);if(s.length>0){i.push("**Why not-run / fail**"),i.push("");for(let[a,c]of s)i.push(`- \`${a}\`: ${c}`);i.push("")}return i.push("> Live grades land when a human runs `clad doctor --hosts` with consent (`CLAD_HOST_SMOKE=1` or `--yes`). Without consent this baseline records only what is checkable for free \u2014 Cursor wiring \u2014 and leaves all LLM-driven surfaces `not-run`."),i.push(""),i.join(` `)}function RCe(t){let e=[];for(let[r,n]of Object.entries(t.hosts)){n.reason&&e.push([r,n.reason]);let i=n.surfaces.filter(s=>s.result==="fail"),o=new Set;for(let s of i){if(o.has(s.evidence))continue;o.add(s.evidence);let a=i.filter(c=>c.evidence===s.evidence).map(c=>c.name);e.push([r,`${a.join(", ")} failed \u2014 ${s.evidence}`])}}return e}var JC=Mi(".cladding","audit"),ICe=Mi("docs","dogfood","matrix.md");function PCe(t,e){let r=e.slice(0,10);return Mi(t,JC,`host-smoke-${r}.json`)}function CCe(t,e){let r=PCe(t,e.generatedAt);return qY(Mi(t,JC),{recursive:!0}),HY(r,`${JSON.stringify(e,null,2)} `,"utf8"),r}function zY(t,e){let r=Mi(t,ICe);return qY(Mi(t,"docs","dogfood"),{recursive:!0}),HY(r,OCe(e),"utf8"),r}function DCe(t){let e=Mi(t,JC);if(!UY(e))return null;let r=fCe(e).filter(n=>n.startsWith("host-smoke-")&&n.endsWith(".json")).sort().reverse();for(let n of r)try{let i=JSON.parse(BY(Mi(e,n),"utf8"));if(typeof i.version!="string"||typeof i.generatedAt!="string"||!i.hosts)continue;let o=VC("legacy artifact predates this host probe; run `clad doctor --hosts --yes`"),s=i.hosts.claude,a=i.hosts.codex,c=i.hosts.cursor;if(!s||!a||!c)continue;return{version:i.version,generatedAt:i.generatedAt,hosts:{claude:s,gemini:i.hosts.gemini??o,antigravity:i.hosts.antigravity??o,codex:a,cursor:c}}}catch{continue}return null}function GY(t={}){let e=t.cwd??".";if(t.matrixOnly){let a=DCe(e);if(!a){L("note","doctor","no host-smoke artifact found \u2014 run `clad doctor --hosts` first"),ec.exit(0);return}let c=zY(e,a);L("pass","doctor",`matrix regenerated from newest artifact \u2192 ${c}`),ec.exit(0);return}let r=!!t.yes||ec.env.CLAD_HOST_SMOKE==="1",n=ACe(e,{consent:r,home:t.home}),i=CCe(e,n),o=zY(e,n),s=n.hosts;L(r?"pass":"note","doctor",r?`host smoke complete \u2192 ${i}`:"no live-run consent \u2014 LLM surfaces recorded not-run (set CLAD_HOST_SMOKE=1 to probe)"),ec.stdout.write(` claude: ${s.claude.grade} gemini: ${s.gemini.grade} antigravity: ${s.antigravity.grade} codex: ${s.codex.grade} cursor: ${s.cursor.grade} diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 5b873438..7d8e2c05 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -17,14 +17,14 @@ attested_modules: .claude/settings.json: d0bba3583aef0960 .github/workflows/ci.yml: 8ea99219cb80df60 .gitignore: 1294975ba3b47043 - CHANGELOG.md: 704d913ae56b635a + CHANGELOG.md: 1524903097b4f9b0 CLAUDE.md: d81d8832976cd5ee GOVERNANCE.md: 21cc28eaaf637a20 README.html: ff98c3aaf8a6947f README.ja.md: 299df920c0530e71 README.ko.html: 35bde93f37db20eb README.ko.md: 7f1394d857a95084 - README.md: 5ce3c24d66ff2ed9 + README.md: cef6c17062f7d728 README.zh.md: 65dac6ea9c2308cc SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 @@ -148,7 +148,7 @@ attested_modules: src/cli/changelog.ts: 2de1adb009b89ab4 src/cli/clad.ts: 00d049c7acb5f761 src/cli/clarify.ts: 393cc93a6feb698a - src/cli/doctor-hosts.ts: d58d2580e76c09ed + src/cli/doctor-hosts.ts: 1f0c2cec5a310b81 src/cli/doctor.ts: b98b955fe75e7f7e src/cli/done.ts: 02bd4397eaf34fa1 src/cli/graph-serve.ts: 23e6e389225d0f98 diff --git a/src/cli/doctor-hosts.ts b/src/cli/doctor-hosts.ts index 98bb2e70..b69279b5 100644 --- a/src/cli/doctor-hosts.ts +++ b/src/cli/doctor-hosts.ts @@ -171,17 +171,22 @@ export const SURFACE_PROMPTS: Readonly strin }; /** - * How each host CLI runs a single non-interactive prompt: - * - claude → `claude -p "" --output-format text` + * How each host CLI runs a single non-interactive prompt. The smoke only ever + * fires behind explicit consent (CLAD_HOST_SMOKE=1 / --yes), which is why the + * non-interactive approval bypasses below are acceptable here and nowhere else: + * a headless probe cannot answer a host's approval prompt, and each probed + * cladding tool is one of the three read-only doctor surfaces. + * - claude → `claude -p "" --output-format text --settings ` * - gemini → `gemini --skip-trust --approval-mode plan --policy -o text -p ""` - * - antigravity → `agy --new-project -p ""` - * - codex → `codex exec ""` (Codex's non-interactive one-shot analog) + * - antigravity → `agy --dangerously-skip-permissions -p ""` (in the project cwd — agy's + * machine-wide wire resolves the project from the session directory) + * - codex → `codex exec --dangerously-bypass-approvals-and-sandbox ""` * - cursor → `cursor-agent -p --mode ask --trust --approve-mcps ""` */ export function buildPromptCommand(host: PromptHost, prompt: string): {command: string; args: string[]} { switch (host) { case 'claude': - return {command: 'claude', args: ['-p', prompt, '--output-format', 'text']}; + return {command: 'claude', args: ['-p', prompt, '--output-format', 'text', '--settings', '{"enableAllProjectMcpServers":true}']}; case 'gemini': return { command: 'gemini', @@ -200,9 +205,9 @@ export function buildPromptCommand(host: PromptHost, prompt: string): {command: ], }; case 'antigravity': - return {command: 'agy', args: ['--new-project', '-p', prompt]}; + return {command: 'agy', args: ['--dangerously-skip-permissions', '-p', prompt]}; case 'codex': - return {command: 'codex', args: ['exec', prompt]}; + return {command: 'codex', args: ['exec', '--dangerously-bypass-approvals-and-sandbox', prompt]}; case 'cursor': return {command: 'cursor-agent', args: ['-p', '--mode', 'ask', '--trust', '--approve-mcps', prompt]}; } @@ -260,7 +265,13 @@ export interface HostSmokeOptions { readonly probeServe?: ServeProber; } -const PROMPT_TIMEOUT_MS = 60_000; +/** run-check executes the project's full gate inside the host turn — give it + * the room a real repository needs instead of grading slowness as failure. */ +const PROMPT_TIMEOUT_MS: Readonly> = { + 'list-features': 120_000, + 'get-feature': 120_000, + 'run-check': 300_000, +}; const SERVE_TIMEOUT_MS = 10_000; function defaultHasBinary(name: string): boolean { @@ -390,13 +401,13 @@ function probePromptHost( } const prompt = SURFACE_PROMPTS[name](featureId ?? ''); const {command, args} = buildPromptCommand(host, prompt); - const r = runPrompt(command, args, {cwd, timeoutMs: PROMPT_TIMEOUT_MS}); + const r = runPrompt(command, args, {cwd, timeoutMs: PROMPT_TIMEOUT_MS[name]}); if (r.timedOut) { surfaces.push({ name, result: 'fail', sentinel: SURFACE_SENTINELS[name].label, - evidence: tail(`timed out after ${PROMPT_TIMEOUT_MS / 1000}s: ${r.stderr || r.stdout}`), + evidence: tail(`timed out after ${PROMPT_TIMEOUT_MS[name] / 1000}s: ${r.stderr || r.stdout}`), }); continue; } From 1d599e1d898098960d3410794bc7404eff4c352c Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Thu, 16 Jul 2026 19:22:11 +0900 Subject: [PATCH 28/28] docs+cleanup: close the 0.9.0 final-verification audit findings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Four-way read-only audit (README 6 variants / docs tree / code residue / internal skills+personas+mirrors) before release. Core verdict was coherent; these are the residuals it surfaced. Docs: - README.html + README.ko.html were half-migrated and still taught the retired machine-wide wiring model ("does not create or modify project files", separate machine-level clad setup in Update) and re-introduced the removed background-verification-loop overclaim — ported the 0.9.0 Install/Update sections from the markdown, incl. the consent-phrase paragraph and the 5-host list - ja/zh READMEs: intro/table/wrapping still said 4 hosts (Gemini missing, contradicting their own setup blocks); zh test-file count 234→236 - all six variants: feature counts synced to the measured 255 total / 252 done (intro said 251-of-254, status said 251 done) - four md variants: clad setup sentence now says detected hosts and names Antigravity as the one machine-wide exception with a setup.md pointer - CLAUDE.md: version-bump covers eleven sites, not nine (two spots) - glossary: setup verb host list gains Antigravity; ssot-model: two leftover 'refine' verbs → clarify Internal instruction md: - serve skill advertised only 4 tools — now describes the full surface incl. the 0.9.0 onboarding trio and pre-init gating - src/agents/README: 6 personas (blind-author row added), real mirror targets (claude-code/codex/antigravity), dropped the nonexistent commands/clad.md and gemini per-verb claims - check skill: frozen '37/37 as of v0.6.1' and stale plugin.json path replaced with the recount mechanism; oracle skill description trimmed to the picker-budget; planner scenario-policy names the host MCP flow (and stays within its pinned persona budget) Code residue: - deleted resolveServeLaunch (orphaned by this branch) and the superseded writeAgentsMd + AGENTS_MD_TEMPLATE; the three tests pinning the dead template now pin the live spec-driven managed block, which carries the same interpreter-rule/anti-self-cert/feature-cycle literals - renamed 'skipped-not-installed' → 'skipped-not-selected' (the render label already said 'not selected') - setup-command AC-013 narrowed to the CLAUDE.md-only refresh reality; agent-interpreter-rule AC text names the managed block - knownRoots comment: home status file is a frozen pre-0.9.0 artifact - test-count badges resynced (2561 after removing 5 dead-template tests) Co-Authored-By: Claude Fable 5 --- CLAUDE.md | 4 +- README.html | 40 +++++----- README.ja.md | 14 ++-- README.ko.html | 36 ++++----- README.ko.md | 8 +- README.md | 12 +-- README.zh.md | 16 ++-- docs/glossary.md | 2 +- docs/ssot-model.md | 4 +- plugins/antigravity/skills/check/SKILL.md | 2 +- plugins/antigravity/skills/oracle/SKILL.md | 2 +- plugins/antigravity/skills/planner/SKILL.md | 2 +- plugins/antigravity/skills/serve/SKILL.md | 2 +- plugins/claude-code/agents/planner.md | 2 +- plugins/claude-code/dist/agents/README.md | 5 +- plugins/claude-code/dist/agents/planner.md | 2 +- plugins/claude-code/dist/clad.js | 16 ++-- plugins/codex/skills/check/SKILL.md | 2 +- plugins/codex/skills/oracle/SKILL.md | 2 +- plugins/codex/skills/planner/SKILL.md | 2 +- plugins/codex/skills/serve/SKILL.md | 2 +- skills/check/SKILL.md | 2 +- skills/oracle/SKILL.md | 2 +- skills/serve/SKILL.md | 2 +- spec/attestation.yaml | 40 +++++----- .../agent-interpreter-rule-723c81dd.yaml | 2 +- spec/features/setup-command-80d19d.yaml | 16 ++-- .../spec-driven-agents-md-a4085adf.yaml | 2 +- src/agents/README.md | 5 +- src/agents/planner.md | 2 +- src/init/host-instructions.ts | 76 +----------------- src/init/host-setup.ts | 37 ++++----- tests/agent-interpreter-rule.test.ts | 21 +++-- tests/claude-md-diet.test.ts | 17 ++-- tests/cli/setup.test.ts | 12 +-- tests/init/host-instructions.test.ts | 78 ++----------------- tests/instruction-led-language.test.ts | 22 +++--- 37 files changed, 193 insertions(+), 320 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 0a98634d..e3cf087d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -25,7 +25,7 @@ Files `F-082` ~ `F-090` were the *drift period* (authored after v0.3.9 but bypas ## Version bumps — use the script -Don't hand-edit version strings. There are nine sites (incl. `.claude-plugin/marketplace.json`, the marketplace *catalog* the Claude Code host reads to detect "update available"); missing one breaks `HARNESS_INTEGRITY` (which now also guards the marketplace catalog version). Run: +Don't hand-edit version strings. There are eleven sites (incl. `.claude-plugin/marketplace.json`, the marketplace *catalog* the Claude Code host reads to detect "update available"); missing one breaks `HARNESS_INTEGRITY` (which now also guards the marketplace catalog version). Run: ```bash npm run version-bump -- 0.3.X @@ -46,7 +46,7 @@ When you add a drift detector under `src/stages/detectors/`: A user-explicit instruction ("release vX.Y.Z") triggers the ritual: -1. `npm run version-bump -- X.Y.Z` (all nine sites) + `npm install` (refresh the committed `package-lock.json` to the new version — CI's `npm ci` fails on a stale lock) + `npm run build` + GREEN `npm test` / `clad check --strict` +1. `npm run version-bump -- X.Y.Z` (all eleven sites) + `npm install` (refresh the committed `package-lock.json` to the new version — CI's `npm ci` fails on a stale lock) + `npm run build` + GREEN `npm test` / `clad check --strict` 2. open a **PR `develop → main`** and merge it with the GitHub **"Create a merge commit"** button — NEVER squash, NEVER rebase (see the squash-ban below) 3. `git tag vX.Y.Z` on main's merge commit 4. push main + tag, then **back-merge `main → develop`** (`git checkout develop && git merge origin/main && git push`) so develop keeps the release commit in its ancestry — skip this and the next release PR phantom-conflicts diff --git a/README.html b/README.html index 54a48112..38cf2bbd 100644 --- a/README.html +++ b/README.html @@ -227,13 +227,13 @@

cladding

To trust AI with coding, an organization needs three things — that the code can be trusted, that it's traced, and that it holds up as you scale. cladding builds those three.
- True to its name (cladding = the outer layer), it wraps your host LLM (Claude Code · Codex · Antigravity · Cursor): before it starts, cladding feeds it the project's intent; after it finishes, cladding verifies the result with 41 detectors and a 15-stage gate. + True to its name (cladding = the outer layer), it wraps your host LLM (Claude Code · Codex · Gemini · Antigravity · Cursor): before it starts, cladding feeds it the project's intent; after it finishes, cladding verifies the result with 41 detectors and a 15-stage gate.

ironclad spec - tests + tests detectors license

@@ -269,7 +269,7 @@

cladding

- cladding builds itself with cladding too — 251 of its 254 features cleared this same gate, the first L4 implementation of the Ironclad standard. + cladding builds itself with cladding too — 252 of its 255 features cleared this same gate, the first L4 implementation of the Ironclad standard.

@@ -285,7 +285,7 @@

What changes

Ending a session in a failing stateexits as-is, forgotten next timethe exit is blocked once, the failing checks handed off as a repair card Two devs add a feature at the same timemerge conflicthash-8 IDs · separate files → 0 conflicts Who verifies the AI-written code?the AI that wrote it self-certifies (risky)an implementation-blind grader + the mechanical gate - Switching AI toolsreconfigure per toolone spec → 4 hosts wired automatically + Switching AI toolsreconfigure per toolone spec → 5 hosts wired automatically @@ -315,7 +315,7 @@

How cladding wraps your host LLM

After — verify the result: the 15-stage gate, 41 drift detectors, and an implementation-blind grader — an agent that checks the work against the spec with no tool to read the implementation, so it can't rubber-stamp what it wrote.

Real-time intervention (map injection · instant block · stop block) runs fully on Claude Code. - On Codex · Antigravity · Cursor the same verification runs through in-conversation tool calls plus the git · CI gate. + On Codex · Gemini · Antigravity · Cursor the same verification runs through in-conversation tool calls plus the git · CI gate.

@@ -482,27 +482,29 @@

Ecosystem

Install

1. Install once on your machine

-
npm install -g cladding   # the cladding CLI
-clad setup                # auto-wire your AI tools (Claude · Codex · Antigravity · Cursor)
+
npm install -g cladding   # install only the cladding CLI
-

Run both commands from any directory. clad setup connects the AI tools already installed on this machine; it does not create or modify project files. Run it again after adding another supported AI tool.

+

This command may be run from any directory. It does not add Cladding to any AI model's context.

-

2. Start your AI tool from the project

+

2. Activate one project, then start your AI tool

cd <project>
+clad setup                # connect Cladding only to this project
 
 # Choose exactly one and remove its leading '#':
 # codex          # Codex
 # claude         # Claude Code
+# gemini         # Gemini CLI
 # agy            # Antigravity
 # cursor-agent   # Cursor Agent
-

Use only the command for your AI tool. For Cursor IDE, open <project> as the workspace instead. Always start a new AI session after clad setup; changing directory alone is not enough.

+

clad setup connects the AI tools it detects on your machine (Claude Code, Codex, Gemini, Antigravity, Cursor) to this project only — Antigravity is the one exception, wired machine-wide because it reads no project-local MCP config (details in setup). It does not expose Cladding skills or MCP tools in projects where setup was not run. Use only the command for your AI tool; for Cursor IDE, open <project> as the workspace. Start a new AI session from this folder after setup so the host discovers the project-local connection. When Codex first opens a Git repository, approve its normal project-trust prompt; Codex intentionally ignores project MCP config until the repository is trusted.

3. Apply Cladding once

Choose the starting point that fits and say it naturally in your AI tool.

+

Cladding first inspects the project without changing it. Your AI shows the exact file operations and a one-time approval phrase; initialization begins only when you repeat that phrase in a separate reply. Opening a project or asking a question about Cladding never authorizes file changes. This exact-match step prevents accidental application; MCP cannot prove which user produced a tool argument, so it is not a sandbox against a malicious or compromised host.

An idea, nothing else

Start this B2B payment SaaS with Cladding.
-

The LLM analyzes the domain, creates the spec, docs, and policies, then asks 2–3 follow-up questions.

+

The LLM analyzes the domain and creates the spec, docs, and policies. It asks up to three follow-up questions only when an important product decision is still unresolved; a complete plan asks none.

A planning document

Apply Cladding using docs/plan.md.
@@ -512,7 +514,7 @@

An existing project

Analyze this project and apply Cladding.

Cladding scans the existing code and combines the observed patterns with your intent.

-

Once initialization is complete, keep developing in the same conversation. Ask for the next feature in plain language; the AI uses the generated spec and docs while cladding runs its verification loop in the background.

+

Once initialization is complete, keep developing in the same conversation. Ask for the next feature in plain language; the AI uses the generated spec and docs and keeps material design changes aligned as the project grows. Checks run when the host invokes them; use the optional Git hooks or CI gate when you want automatic enforcement.

Implement email sign-in, including tests.

There is nothing new to memorize. For host-specific invocation, stricter Git/CI enforcement, and verified host status, see setup details.

@@ -523,12 +525,10 @@

Ask your AI tool (recommended)

Update cladding to the latest version.

If the AI tool has terminal and global-install permission, it updates the CLI, refreshes host wiring, updates the current project, and explains any new drift. Otherwise, it shows the commands for you to approve or run.

Or update from the terminal

-
npm update -g cladding   # 1. get the new version
-clad setup                # 2. refresh this machine's AI-tool connections
-
-cd <project>              # 3. enter a Cladding project
-clad update               # 4. align that project with the installed version
-

Run the first two commands once per machine update. Run clad update in each Cladding project you want to upgrade. It preserves authored code, feature/spec content, and documentation; only derived data and Cladding-managed instruction blocks may be refreshed. If the new version reports drift, hand that result to your AI tool:

+
npm update -g cladding   # 1. get the new CLI version
+cd <project>              # 2. enter one Cladding project
+clad update               # 3. refresh its host wiring and derived state
+

Run clad update in each Cladding project you want to upgrade. It also performs the project-scoped setup refresh, so a separate clad setup is unnecessary. It preserves authored code, feature/spec content, and documentation; only derived data and Cladding-managed instruction blocks may be refreshed. If the new version reports drift, hand that result to your AI tool:

Reconcile the drift the update flagged.
@@ -548,7 +548,7 @@

Status

tests
-
2566/2566
+
2561/2561
all pass
@@ -559,7 +559,7 @@

Status

features
255
-
251 done · self-spec
+
252 done · self-spec
diff --git a/README.ja.md b/README.ja.md index 33c293d9..ca22b939 100644 --- a/README.ja.md +++ b/README.ja.md @@ -6,13 +6,13 @@

AI にコーディングを任せるには、組織に三つの条件が要る —
コードを信頼でき、その足跡をたどれ、規模が大きくなっても揺るがないこと。cladding はその三つを築く。

- その名(外装材)のとおりホスト LLM(Claude Code · Codex · Antigravity · Cursor)を包み込む — 作業を 始める前 に、cladding がプロジェクトの意図を渡し、作業を 終えた後 に、41 個の検出器と 15 段階のゲートで結果を検証する。 + その名(外装材)のとおりホスト LLM(Claude Code · Codex · Gemini · Antigravity · Cursor)を包み込む — 作業を 始める前 に、cladding がプロジェクトの意図を渡し、作業を 終えた後 に、41 個の検出器と 15 段階のゲートで結果を検証する。

ironclad spec - tests + tests detectors license

@@ -31,7 +31,7 @@ - **たどれる** — **出荷されたものは記録に残る**: 何を検証したかはコミットされた内容に刻まれ、誰がいつやったかはローカルのセッション台帳に、なぜかは spec に残る — だから引き継ぎもレビューも、掘り起こさずに済む。 - **拡張しても揺るがない** — 人と AI が増えれば、普通は衝突と乖離も増える。だが全員が一つの spec を基準に働くので、それらは自動でせき止められる — だから規模を広げても崩れない。 -cladding は **自分自身も cladding で作っている** — 254 個の feature のうち 251 個が同じゲートを通過した、[Ironclad](https://github.com/qwerfunch/ironclad) 標準を L4 で実装した最初の事例だ。 +cladding は **自分自身も cladding で作っている** — 255 個の feature のうち 252 個が同じゲートを通過した、[Ironclad](https://github.com/qwerfunch/ironclad) 標準を L4 で実装した最初の事例だ。 @@ -46,7 +46,7 @@ cladding は **自分自身も cladding で作っている** — 254 個の feat | **失敗した状態でセッションを終える** | そのまま終了し、次回には忘れられる | 終了を一度止め、失敗したチェックを修正カードとして引き継ぐ | | **二人が同時に feature を追加する** | merge conflict | hash-8 ID · ファイル分離 → 衝突 0 | | **AI が書いたコードは誰が検証する?** | 書いた AI が自分で検証する(危うい) | 実装を見ない採点者 + 機械的なゲート | -| **AI ツールを乗り換える** | ツールごとに再設定 | 1 つの spec → 4 つの host へ自動配線 | +| **AI ツールを乗り換える** | ツールごとに再設定 | 1 つの spec → 5 つの host へ自動配線 | ## 誰のためのものか @@ -66,7 +66,7 @@ cladding は **自分自身も cladding で作っている** — 254 個の feat **後 — 検証する:** 15 段階のゲート、41 個の乖離検出器、そして **実装を見ない採点者** — spec に照らして作業を検査するエージェントで、*実装を読む手段を一切持たない* ため、自分が書いたものにお墨付きを与えることはできない。 -リアルタイム介入(マップ注入 · 即時ブロック · 終了ブロック)は Claude Code ですべて動作する。Codex · Antigravity · Cursor では同じ検証を、会話中のツール呼び出しと git · CI のゲートで通す。 +リアルタイム介入(マップ注入 · 即時ブロック · 終了ブロック)は Claude Code ですべて動作する。Codex · Gemini · Antigravity · Cursor では同じ検証を、会話中のツール呼び出しと git · CI のゲートで通す。 @@ -263,7 +263,7 @@ clad setup # このプロジェクトだけに Cladding を接続 # cursor-agent # Cursor Agent ``` -`clad setup` は Claude Code・Codex・Gemini・Antigravity・Cursor の接続を現在のプロジェクト内だけに作る。setup を実行していない別プロジェクトのモデルコンテキストには、Cladding の skill や MCP ツールは入らない。使用する AI ツールのコマンドを一つだけ実行し、Cursor IDE では `` をワークスペースとして開く。setup 後はこのフォルダから新しい AI セッションを開始する。Codex や Gemini がプロジェクトの信頼確認を表示した場合は、それぞれの通常のセキュリティ境界に従って承認する。信頼されるまでプロジェクトローカルの MCP 設定は意図的に読み込まれない。 +`clad setup` はこのマシンで検出された AI ツール(Claude Code・Codex・Gemini・Antigravity・Cursor)を現在のプロジェクト内だけに接続する — ただし Antigravity はプロジェクトローカルの MCP 設定を読まないホストのため、唯一マシン単位で接続される(詳細は [setup ドキュメント](docs/setup.md))。setup を実行していない別プロジェクトのモデルコンテキストには、Cladding の skill や MCP ツールは入らない。使用する AI ツールのコマンドを一つだけ実行し、Cursor IDE では `` をワークスペースとして開く。setup 後はこのフォルダから新しい AI セッションを開始する。Codex や Gemini がプロジェクトの信頼確認を表示した場合は、それぞれの通常のセキュリティ境界に従って承認する。信頼されるまでプロジェクトローカルの MCP 設定は意図的に読み込まれない。 ### 3. Cladding を一度適用する @@ -339,7 +339,7 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.0(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2566 / 2566 | 15 段階 · 41 detectors | 255(251 done) | +| v0.9.0(2026-07) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2561 / 2561 | 15 段階 · 41 detectors | 255(252 done) | 236 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック diff --git a/README.ko.html b/README.ko.html index 94dd0c09..d2a07c1c 100644 --- a/README.ko.html +++ b/README.ko.html @@ -269,13 +269,13 @@

cladding

기업이 AI에게 코딩을 맡기려면 세 가지가 필요하다 —
믿을 수 있고, 추적되고, 규모가 커져도 흔들리지 않아야 한다. cladding이 그 셋을 만든다.

- cladding(외장재)이라는 이름 그대로, 호스트 LLM(Claude Code · Codex · Antigravity · Cursor)을 감싼다: 일을 시작하기 전엔 프로젝트의 의도를 넣어 주고, 마친 후엔 41개 검출기와 15단계 게이트로 결과를 검증한다. + cladding(외장재)이라는 이름 그대로, 호스트 LLM(Claude Code · Codex · Gemini · Antigravity · Cursor)을 감싼다: 일을 시작하기 전엔 프로젝트의 의도를 넣어 주고, 마친 후엔 41개 검출기와 15단계 게이트로 결과를 검증한다.

ironclad spec - tests + tests detectors license

@@ -302,7 +302,7 @@

cladding

- cladding은 자기 자신도 cladding으로 만든다 — 기능 254개 중 251개가 같은 게이트를 통과했고, Ironclad 표준을 L4로 구현한 첫 사례다. + cladding은 자기 자신도 cladding으로 만든다 — 기능 255개 중 252개가 같은 게이트를 통과했고, Ironclad 표준을 L4로 구현한 첫 사례다.

@@ -349,7 +349,7 @@

cladding이 호스트 LLM을 감싸는 방식

실시간 개입(지도 주입 · 즉시 차단 · 종료 차단)은 Claude Code에서 전부 동작한다. - Codex · Antigravity · Cursor에서는 같은 검증을 대화 속 도구 호출과 git·CI 관문으로 수행한다. + Codex · Gemini · Antigravity · Cursor에서는 같은 검증을 대화 속 도구 호출과 git·CI 관문으로 수행한다.

@@ -518,27 +518,29 @@

인접 도구와의 차이

Install

1. 컴퓨터에 한 번 설치하기

-
npm install -g cladding   # cladding CLI 설치
-clad setup                # AI 도구 자동 연결 (Claude · Codex · Antigravity · Cursor)
+
npm install -g cladding   # cladding CLI 설치
-

두 명령은 어느 디렉터리에서든 실행할 수 있다. clad setup은 이 컴퓨터에 이미 설치된 AI 도구를 연결할 뿐 프로젝트 파일을 만들거나 수정하지 않는다. 지원하는 AI 도구를 나중에 추가했다면 clad setup만 다시 실행한다.

+

이 단계는 어느 디렉터리에서 실행해도 된다. CLI만 설치하며 AI 도구에는 아직 Cladding 정보가 들어가지 않는다.

-

2. 프로젝트에서 AI 도구 실행하기

+

2. 사용할 프로젝트만 연결하고 AI 도구 실행하기

cd <project>
+clad setup                # 이 프로젝트에만 AI 도구 연결
 
 # 정확히 하나를 골라 앞의 '#'을 지우고 실행한다:
 # codex          # Codex
 # claude         # Claude Code
+# gemini         # Gemini CLI
 # agy            # Antigravity
 # cursor-agent   # Cursor Agent
-

자신이 사용하는 AI 도구의 명령 하나만 실행하면 된다. Cursor IDE는 <project> 폴더를 작업공간으로 연다. clad setup 뒤에는 반드시 AI 도구를 새 세션으로 시작한다. cd만 실행하고 끝내면 안 된다.

+

clad setup은 이 머신에서 감지된 AI 도구(Claude Code · Codex · Gemini · Antigravity · Cursor)를 현재 프로젝트에만 연결한다 — 단 Antigravity는 프로젝트-로컬 MCP 설정을 읽지 않는 호스트라 유일하게 머신 단위로 연결된다(자세한 내용은 setup 문서). 설정하지 않은 다른 프로젝트의 모델 컨텍스트에는 Cladding skill이나 MCP 도구가 들어가지 않는다. Cursor IDE는 <project> 폴더를 작업공간으로 연다. setup 뒤에는 반드시 이 폴더에서 AI 도구를 새 세션으로 시작한다. Codex와 Gemini가 프로젝트 신뢰 여부를 물으면 각 호스트의 정상 보안 경계에 따라 승인한다. 신뢰하기 전에는 프로젝트 로컬 MCP 설정이 의도적으로 적용되지 않는다.

3. 프로젝트에 Cladding 한 번 적용하기

자신의 시작 상황에 맞는 요청을 AI 도구에 자연스럽게 말한다.

+

Cladding은 먼저 프로젝트를 읽기 전용으로 조사한다. AI가 정확한 파일 작업과 일회용 승인 문구를 보여주며, 사용자가 별도 답변에서 그 문구를 그대로 입력해야만 초기화가 시작된다. 프로젝트를 열거나 Cladding에 관해 질문하는 것만으로는 어떤 파일도 변경되지 않는다. 이 정확 일치 단계는 우발적인 적용을 막지만, MCP는 도구 인자를 실제로 어느 사용자가 만들었는지 증명할 수 없다. 따라서 악의적이거나 침해된 호스트를 격리하는 샌드박스로 보아서는 안 된다.

아이디어만 있을 때

B2B 결제 SaaS를 cladding으로 시작해줘.
-

LLM이 도메인을 분석해 spec · 문서 · 정책을 만들고, 후속 질문 2–3개를 이어간다.

+

LLM이 도메인을 분석해 spec · 문서 · 정책을 만든다. 중요한 제품 결정이 실제로 비어 있을 때만 후속 질문을 최대 3개 하며, 완성된 기획에는 질문하지 않는다.

기획 문서가 있을 때

docs/plan.md를 기준으로 cladding을 적용해줘.
@@ -548,7 +550,7 @@

기존 프로젝트에 도입할 때

현재 코드를 분석해서 cladding을 적용해줘.

기존 코드를 스캔하고, 관찰한 패턴을 사용자의 intent와 결합한다.

-

초기화가 끝나면 같은 대화에서 바로 개발을 이어가면 된다. 다음 기능을 자연어로 요청하면 AI가 생성된 spec과 문서를 기준으로 개발하고, cladding은 배경에서 검증 루프를 실행한다.

+

초기화가 끝나면 같은 대화에서 바로 개발을 이어가면 된다. 다음 기능을 자연어로 요청하면 AI가 생성된 spec과 문서를 기준으로 개발하고, 중요한 설계 변경도 프로젝트 성장에 맞춰 함께 반영한다. 검사는 호스트가 호출할 때 실행되며, 자동 강제가 필요하면 선택형 Git hook이나 CI 게이트를 사용한다.

이메일 로그인 기능을 테스트까지 포함해서 구현해줘.

새로 외울 명령은 없다. 호스트별 명시 호출법, 더 강한 Git/CI 적용, 검증된 호스트 현황은 설치 상세에서 확인할 수 있다.

@@ -560,11 +562,9 @@

AI 도구에 요청하기 (추천)

AI 도구에 터미널 및 전역 설치 권한이 있으면 CLI 업데이트, 호스트 배선 갱신, 현재 프로젝트 업데이트를 수행하고 새로 발견한 어긋남을 설명한다. 권한이 없으면 승인하거나 직접 실행할 명령을 안내한다.

또는 터미널에서 직접 업데이트하기

npm update -g cladding   # 1. 새 버전 받기
-clad setup               # 2. 이 컴퓨터의 AI 도구 연결 갱신
-
-cd <project>             # 3. Cladding 프로젝트로 이동
-clad update              # 4. 프로젝트를 설치된 버전에 맞추기
-

앞의 두 명령은 컴퓨터에서 업데이트할 때 한 번만 실행한다. clad update는 업데이트하려는 각 Cladding 프로젝트에서 실행한다. 사용자가 작성한 코드 · 기능/스펙 본문 · 문서는 보존되며, 파생 데이터와 Cladding 관리 지침 블록만 갱신될 수 있다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다:

+cd <project> # 2. Cladding 프로젝트로 이동 +clad update # 3. 프로젝트 연결과 파생 데이터를 함께 갱신 +

clad update는 업데이트하려는 각 Cladding 프로젝트에서 실행한다. 프로젝트 전용 setup 갱신까지 함께 수행하므로 별도의 clad setup은 필요 없다. 사용자가 작성한 코드 · 기능/스펙 본문 · 문서는 보존되며, 파생 데이터와 Cladding 관리 지침 블록만 갱신될 수 있다. 새 버전이 어긋남을 발견하면 그 결과를 AI 도구에 넘기면 된다:

업데이트가 짚은 어긋남을 정리해줘.
@@ -584,7 +584,7 @@

Status

tests
-
2566/2566
+
2561/2561
all pass
@@ -595,7 +595,7 @@

Status

features
255
-
251 done · 자기 스펙
+
252 done · 자기 스펙
diff --git a/README.ko.md b/README.ko.md index 4f1e2630..427e761c 100644 --- a/README.ko.md +++ b/README.ko.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -31,7 +31,7 @@ - **추적** — **나간 것은 기록에 남는다**: 무엇을 검증했는지는 커밋된 내용에 새겨지고, 누가·언제는 로컬 세션 로그에, 왜는 스펙에 남아, 인수인계와 리뷰가 파헤치지 않아도 된다. - **확장** — 사람과 AI를 늘리면 보통 충돌과 어긋남도 함께 불어난다. 하지만 모두가 스펙 하나를 기준으로 일하니 그게 자동으로 걸린다 — 그래서 규모를 키워도 무너지지 않는다. -cladding은 **자기 자신도 cladding으로 만든다** — 기능 254개 중 251개가 같은 게이트를 통과했고, [Ironclad](https://github.com/qwerfunch/ironclad) 표준을 L4로 구현한 첫 사례다. +cladding은 **자기 자신도 cladding으로 만든다** — 기능 255개 중 252개가 같은 게이트를 통과했고, [Ironclad](https://github.com/qwerfunch/ironclad) 표준을 L4로 구현한 첫 사례다. @@ -262,7 +262,7 @@ clad setup # 이 프로젝트에만 AI 도구 연결 # cursor-agent # Cursor Agent ``` -`clad setup`은 현재 프로젝트에만 Claude Code · Codex · Gemini · Antigravity · Cursor 연결을 만든다. 설정하지 않은 다른 프로젝트의 모델 컨텍스트에는 Cladding skill이나 MCP 도구가 들어가지 않는다. Cursor IDE는 `` 폴더를 작업공간으로 연다. setup 뒤에는 반드시 이 폴더에서 AI 도구를 새 세션으로 시작한다. Codex와 Gemini가 프로젝트 신뢰 여부를 물으면 각 호스트의 정상 보안 경계에 따라 승인한다. 신뢰하기 전에는 프로젝트 로컬 MCP 설정이 의도적으로 적용되지 않는다. +`clad setup`은 이 머신에서 감지된 AI 도구(Claude Code · Codex · Gemini · Antigravity · Cursor)를 현재 프로젝트에만 연결한다 — 단 Antigravity는 프로젝트-로컬 MCP 설정을 읽지 않는 호스트라 유일하게 머신 단위로 연결된다(자세한 내용은 [setup 문서](docs/setup.md)). 설정하지 않은 다른 프로젝트의 모델 컨텍스트에는 Cladding skill이나 MCP 도구가 들어가지 않는다. Cursor IDE는 `` 폴더를 작업공간으로 연다. setup 뒤에는 반드시 이 폴더에서 AI 도구를 새 세션으로 시작한다. Codex와 Gemini가 프로젝트 신뢰 여부를 물으면 각 호스트의 정상 보안 경계에 따라 승인한다. 신뢰하기 전에는 프로젝트 로컬 MCP 설정이 의도적으로 적용되지 않는다. ### 3. 프로젝트에 Cladding 한 번 적용하기 @@ -338,7 +338,7 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.9.0 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2566 / 2566 · all pass | 15 단계 · 41 detectors | 255 · 251 done · 자기 스펙 | +| v0.9.0 · 2026-07 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2561 / 2561 · all pass | 15 단계 · 41 detectors | 255 · 252 done · 자기 스펙 | 236 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 diff --git a/README.md b/README.md index b0f54e45..5a874322 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

ironclad spec - tests + tests detectors license

@@ -31,7 +31,7 @@ So you can ship AI-written code held to **the same standard as human-written cod - **Traced** — **What shipped is on the record**: what was verified is stamped into committed content, who and when land in the local session ledger, and the why lives in the spec — so handoff and review skip the archaeology. - **Scales** — adding people and AIs would normally multiply conflicts and drift; because everyone works from one shared spec, those get caught automatically — so you can grow without it breaking down. -cladding builds **itself** with cladding too — 251 of its 254 features cleared this same gate, the first L4 implementation of the [Ironclad](https://github.com/qwerfunch/ironclad) standard. +cladding builds **itself** with cladding too — 252 of its 255 features cleared this same gate, the first L4 implementation of the [Ironclad](https://github.com/qwerfunch/ironclad) standard. @@ -259,8 +259,10 @@ clad setup # connect Cladding only to this project # cursor-agent # Cursor Agent ``` -`clad setup` creates project-local connections for Claude Code, Codex, Gemini, Antigravity, and Cursor. It -does not expose Cladding skills or MCP tools in projects where setup was not run. Use only the command +`clad setup` connects the AI tools it detects on your machine (Claude Code, Codex, Gemini, Antigravity, +Cursor) to this project only — Antigravity is the one exception, wired machine-wide because it reads no +project-local MCP config (details in [setup](docs/setup.md)). It does not expose Cladding skills or MCP +tools in projects where setup was not run. Use only the command for your AI tool; for Cursor IDE, open `` as the workspace. Start a new AI session from this folder after setup so the host discovers the project-local connection. When Codex first opens a Git repository, approve its normal project-trust prompt; Codex intentionally ignores project MCP config @@ -350,7 +352,7 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.0 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2566 / 2566 | 15 stages · 41 detectors | 255 (251 done) | +| v0.9.0 (2026-07) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2561 / 2561 | 15 stages · 41 detectors | 255 (252 done) | 236 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector diff --git a/README.zh.md b/README.zh.md index 18c6f6c3..92561978 100644 --- a/README.zh.md +++ b/README.zh.md @@ -6,13 +6,13 @@

要放心把编码交给 AI,一个组织需要三样东西 ——
代码可信、过程可追溯、规模扩张时依然稳固。cladding 把这三样一手做齐。

- 正如其名(cladding = 外覆层),它包裹住你的宿主 LLM(Claude Code · Codex · Antigravity · Cursor):在它动手之前,cladding 先把项目的意图喂给它;在它收尾之后,cladding 用 41 个检测器和 15 阶段门禁验证结果。 + 正如其名(cladding = 外覆层),它包裹住你的宿主 LLM(Claude Code · Codex · Gemini · Antigravity · Cursor):在它动手之前,cladding 先把项目的意图喂给它;在它收尾之后,cladding 用 41 个检测器和 15 阶段门禁验证结果。

ironclad spec - tests + tests detectors license

@@ -31,7 +31,7 @@ - **可追溯** —— **交付出去的一切都留有记录**:验证了什么,写进已提交的内容;谁、何时,记在本地会话账本;为什么,留在 spec —— 于是交接与评审无需考古,就能追溯每一个决定。 - **可扩展** —— 人和 AI 越多,通常冲突和漂移也越多。但所有人都以同一份 spec 为基准,这些会被自动挡下 —— 所以不断扩张也不会崩。 -cladding 连**自己**也是用 cladding 造的 —— 254 个 feature 里有 251 个通过了同一道门禁,成为 [Ironclad](https://github.com/qwerfunch/ironclad) 标准的首个 L4 实现。 +cladding 连**自己**也是用 cladding 造的 —— 255 个 feature 里有 252 个通过了同一道门禁,成为 [Ironclad](https://github.com/qwerfunch/ironclad) 标准的首个 L4 实现。 @@ -46,7 +46,7 @@ cladding 连**自己**也是用 cladding 造的 —— 254 个 feature 里有 25 | **在失败状态下结束会话** | 原样退出,下次就忘了 | 退出被拦一次,把失败的检查作为修复卡片交接下去 | | **两名开发者同时新增 feature** | 合并冲突 | 8 位 hash ID · 各自成文件 → 零冲突 | | **AI 写的代码谁来验证?** | 谁写谁自证(有风险) | 一个看不到实现的评分者 + 机械门禁 | -| **切换 AI 工具** | 每换一个工具就重配一次 | 一份 spec → 自动接通 4 个宿主 | +| **切换 AI 工具** | 每换一个工具就重配一次 | 一份 spec → 自动接通 5 个宿主 | ## 适合谁 @@ -66,7 +66,7 @@ cladding 连**自己**也是用 cladding 造的 —— 254 个 feature 里有 25 **之后 —— 验证结果:** 15 阶段门禁、41 个漂移检测器,外加一个**看不到实现的评分者** —— 这个智能体对照 spec 核查成果,却*没有任何读取实现的工具*,因此无法给自己写下的东西盖章放行。 -实时干预(注入地图 · 当场拦截 · 退出拦截)在 Claude Code 上全部可用。在 Codex · Antigravity · Cursor 上,同样的验证通过对话中的工具调用,再加 git · CI 门禁来完成。 +实时干预(注入地图 · 当场拦截 · 退出拦截)在 Claude Code 上全部可用。在 Codex · Gemini · Antigravity · Cursor 上,同样的验证通过对话中的工具调用,再加 git · CI 门禁来完成。 @@ -259,7 +259,7 @@ clad setup # 只为这个项目连接 Cladding # cursor-agent # Cursor Agent ``` -`clad setup` 只在当前项目内创建 Claude Code、Codex、Gemini、Antigravity 和 Cursor 的连接。没有运行 setup 的其他项目,其模型上下文不会出现 Cladding skill 或 MCP 工具。只需运行自己所用 AI 工具对应的一条命令;使用 Cursor IDE 时,把 `` 作为工作区打开。setup 后请从此文件夹启动新的 AI 会话。Codex 或 Gemini 询问是否信任项目时,请按照各自主机的正常安全边界确认;在此之前,项目本地 MCP 配置会被有意忽略。 +`clad setup` 只把本机检测到的 AI 工具(Claude Code、Codex、Gemini、Antigravity、Cursor)连接到当前项目 —— 唯一的例外是 Antigravity:它不读取项目本地的 MCP 配置,因此只能按机器级别连接(详见 [setup 文档](docs/setup.md))。没有运行 setup 的其他项目,其模型上下文不会出现 Cladding skill 或 MCP 工具。只需运行自己所用 AI 工具对应的一条命令;使用 Cursor IDE 时,把 `` 作为工作区打开。setup 后请从此文件夹启动新的 AI 会话。Codex 或 Gemini 询问是否信任项目时,请按照各自主机的正常安全边界确认;在此之前,项目本地 MCP 配置会被有意忽略。 ### 3. 为项目应用一次 Cladding @@ -335,9 +335,9 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.0(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2566 / 2566 | 15 阶段 · 41 检测器 | 255(251 done) | +| v0.9.0(2026-07) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2561 / 2561 | 15 阶段 · 41 检测器 | 255(252 done) | -234 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 +236 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 > **通往 Ironclad 1.0 之路** —— 只有当*两个独立实现都通过 L4 一致性测试夹具*时,1.0 才会锁定([GOVERNANCE § 1](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md))。cladding 是第一个。 diff --git a/docs/glossary.md b/docs/glossary.md index f098211a..91bff1a7 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -56,7 +56,7 @@ | `work` | removed (0.6.0) | Was a permanently not-implemented reserved stub (always exit 2) — dishonest surface; `run` owns the slot. | (제거됨) | | `serve` | stable | Start the MCP server over stdio. | MCP 서버 | | `oracle` | stable | Print the impl-blind authoring brief for a feature/AC. | 오라클 브리프 | -| `setup` | stable | Wire cladding into installed AI hosts (Claude/Codex/Gemini/Cursor). | 호스트 연결 | +| `setup` | stable | Wire cladding into detected AI hosts (Claude/Codex/Gemini/Antigravity/Cursor). | 호스트 연결 | | `update` | stable | Post-upgrade reconciliation (re-wire, sync, report-only drift). | 업그레이드 정리 | | `doctor` | stable | Diagnose dispatcher/telemetry health from the events log (brew/npm `doctor` convention). | 환경 진단 | | `checkpoint` | stable | Record a feature checkpoint event (git HEAD + spec digest). | 체크포인트 기록 | diff --git a/docs/ssot-model.md b/docs/ssot-model.md index 1626d26e..8d064616 100644 --- a/docs/ssot-model.md +++ b/docs/ssot-model.md @@ -45,7 +45,7 @@ Orphan artifacts get demoted (move to Tier D as historical reference) or removed |---|---|---|---| | `spec.yaml` | `clad_create_feature` / hand-edit | `spec/load.ts` → every detector + MCP server + CLI verbs | manual edit; `clad sync` validates | | `spec/features/-.yaml` | `clad_create_feature` | merged into `Spec.features[]` on load | manual edit + validation | -| `spec/scenarios/-.yaml` | `clad init ` onboarding (NEW v0.3.45) OR `clad_create_scenario` OR hand-edit | `REFERENCE_INTEGRITY` / `SLUG_CONFLICT` / `ID_COLLISION` / `SCENARIO_COVERAGE` detectors | onboarding 7th sentinel emits; refine refreshes; `clad_create_scenario` adds. *(`clad_create_feature` does NOT bind scenarios — corrected v0.4.x.)* | +| `spec/scenarios/-.yaml` | `clad init ` onboarding (NEW v0.3.45) OR `clad_create_scenario` OR hand-edit | `REFERENCE_INTEGRITY` / `SLUG_CONFLICT` / `ID_COLLISION` / `SCENARIO_COVERAGE` detectors | onboarding 7th sentinel emits; clarify refreshes; `clad_create_scenario` adds. *(`clad_create_feature` does NOT bind scenarios — corrected v0.4.x.)* | ### Tier B — Design SSoT @@ -53,7 +53,7 @@ Orphan artifacts get demoted (move to Tier D as historical reference) or removed |---|---|---|---| | `spec/architecture.yaml` | `clad init --scan` (observed) OR `clad init ` (LLM) OR `clad clarify` OR hand-edit | `ARCHITECTURE_FROM_SPEC` detector + `reviewer` (Layered Integrity guardrail) + `developer` (layer boundary check when placing modules) | re-scan diverts to `.cladding/scan/*.proposal` | | `spec/capabilities.yaml` | `clad init ` (LLM) OR `clad clarify` OR hand-edit | **schema-validated + merged into `Spec.capabilities` on load (v0.4.x, J2)** + `CAPABILITIES_FEATURE_MAPPING` (reference validity) + `HOLLOW_GOVERNANCE` (empty-tier guard, v0.4.x) | re-scan diverts to proposal | -| `docs/project-context.md` | `clad init` (template/LLM-refined) OR `clad clarify` OR hand-edit | AI personas (orchestrator/developer) as Why/What/Purpose context input + **scenario generator (NEW v0.3.45) uses prose for user-journey extraction** + human onboarding readers | LLM-refined on init/refine; hand-edits preserved between | +| `docs/project-context.md` | `clad init` (template/LLM-refined) OR `clad clarify` OR hand-edit | AI personas (orchestrator/developer) as Why/What/Purpose context input + **scenario generator (NEW v0.3.45) uses prose for user-journey extraction** + human onboarding readers | LLM-refined on init/clarify; hand-edits preserved between | ### Tier C — Derived / Observable diff --git a/plugins/antigravity/skills/check/SKILL.md b/plugins/antigravity/skills/check/SKILL.md index 176c33a2..fe7bb3ea 100644 --- a/plugins/antigravity/skills/check/SKILL.md +++ b/plugins/antigravity/skills/check/SKILL.md @@ -10,7 +10,7 @@ Run `clad check` from the project root. Runs the 15 Iron Law stages — Type / L - `1` — at least one stage actually failed (fix-required). - `2` — every result is skip (no fail-required input on the project yet). -`--strict` promotes warn-severity drift findings to error, matching the CI / pre-publish gate. The Drift stage runs every active detector under `src/stages/detectors/` (37/37 as of v0.6.1 — `npm run build:plugin` Phase D recounts and writes the integer into `.claude-plugin/plugin.json`). +`--strict` promotes warn-severity drift findings to error, matching the CI / pre-publish gate. The Drift stage runs every active detector under `src/stages/detectors/` — `npm run build:plugin` Phase D recounts them and writes the integer into each plugin manifest (e.g. `plugins/claude-code/.claude-plugin/plugin.json`), so the number is never hand-maintained. `--internal` shows stage codes (`stage_1.1`) instead of business names (`Type`). Default is the business-name surface; the audit log keeps internal ids regardless. diff --git a/plugins/antigravity/skills/oracle/SKILL.md b/plugins/antigravity/skills/oracle/SKILL.md index 889f0782..578e37ef 100644 --- a/plugins/antigravity/skills/oracle/SKILL.md +++ b/plugins/antigravity/skills/oracle/SKILL.md @@ -1,5 +1,5 @@ --- -description: Author an IMPL-BLIND spec-conformance oracle for a feature's acceptance criterion, so the gate verifies the code matches the SPEC (not just the author's own tests). cladding calls no LLM — YOU spawn a blind sub-agent from a spec-only brief, then record it. Author ONLY what `clad oracle --required` lists (the policy worklist) — an empty worklist means do not author unless the user explicitly asks; out-of-policy recordings are labeled voluntary and spend beyond the project's declared verification budget. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +description: Author an IMPL-BLIND spec-conformance oracle for an acceptance criterion the policy worklist (`clad oracle --required`) demands — an empty worklist means don't author unless the user explicitly asks. YOU spawn a blind sub-agent from a spec-only brief, then record it. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding oracle — impl-blind conformance authoring diff --git a/plugins/antigravity/skills/planner/SKILL.md b/plugins/antigravity/skills/planner/SKILL.md index 7967b1e1..7736e7b7 100644 --- a/plugins/antigravity/skills/planner/SKILL.md +++ b/plugins/antigravity/skills/planner/SKILL.md @@ -33,7 +33,7 @@ You do NOT read Tier C (conventions — developer owns it) or Tier D (audit — ### Scenarios policy (v0.3.45+) -Scenarios are **onboarding output**, not feature-creation side-effect. `clad init ` extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). Pre-v0.3.30 auto-extraction from code is deprecated. +Scenarios are **onboarding output**, not feature-creation side-effect. Onboarding (host MCP flow, or CLI `clad init `) extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). Pre-v0.3.30 auto-extraction from code is deprecated. ## Project policy — `spec.yaml::project.ai_hints` diff --git a/plugins/antigravity/skills/serve/SKILL.md b/plugins/antigravity/skills/serve/SKILL.md index 09450402..db8c10e1 100644 --- a/plugins/antigravity/skills/serve/SKILL.md +++ b/plugins/antigravity/skills/serve/SKILL.md @@ -6,7 +6,7 @@ description: Boot cladding as an MCP server over stdio. Use only when the user w Run `clad serve` from the project root. Boots an MCP server over stdio that exposes: -- **Tools**: `clad_list_features`, `clad_get_feature`, `clad_run_check`, `clad_get_events`. +- **Tools**: the full development surface (feature/graph/context queries, checks, gate, changelog) plus the natural-language onboarding flow — `clad_prepare_init` / `clad_stage_init` / `clad_init` and the clarify pair. Before `spec.yaml` exists only the three onboarding bootstrap tools are exposed. - **Resources**: `cladding://spec`, `cladding://events`, `cladding://audit`. - **Prompts**: 5 personas (orchestrator, planner, reviewer, observability, developer). - **Live audit notifications**: `notifications/resources/updated` fires for `cladding://audit` whenever a new evidence entry lands — a subscribed client can live-tail the audit log without polling. diff --git a/plugins/claude-code/agents/planner.md b/plugins/claude-code/agents/planner.md index 7967b1e1..7736e7b7 100644 --- a/plugins/claude-code/agents/planner.md +++ b/plugins/claude-code/agents/planner.md @@ -33,7 +33,7 @@ You do NOT read Tier C (conventions — developer owns it) or Tier D (audit — ### Scenarios policy (v0.3.45+) -Scenarios are **onboarding output**, not feature-creation side-effect. `clad init ` extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). Pre-v0.3.30 auto-extraction from code is deprecated. +Scenarios are **onboarding output**, not feature-creation side-effect. Onboarding (host MCP flow, or CLI `clad init `) extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). Pre-v0.3.30 auto-extraction from code is deprecated. ## Project policy — `spec.yaml::project.ai_hints` diff --git a/plugins/claude-code/dist/agents/README.md b/plugins/claude-code/dist/agents/README.md index db8e0af1..5b8c01c5 100644 --- a/plugins/claude-code/dist/agents/README.md +++ b/plugins/claude-code/dist/agents/README.md @@ -8,7 +8,7 @@ ironclad-track: T9 (multi-agent orchestrator) ## [CLAIM] -The 5 agent personas — orchestrator · planner (formerly `librarian`) · reviewer · observability · developer (formerly `specialists`) — each shipped as a Claude Code subagent (frontmatter + system prompt). Their canonical source lives in this directory; `npm run build:plugin` mirrors them into `agents/`, `plugins/codex/skills/`, and `plugins/gemini-cli/commands/`. +The 6 agent personas — orchestrator · planner (formerly `librarian`) · reviewer · observability · developer (formerly `specialists`) · blind-author — each shipped as a Claude Code subagent (frontmatter + system prompt). Their canonical source lives in this directory; `npm run build:plugin` mirrors them into `plugins/claude-code/agents/`, `plugins/codex/skills/`, and `plugins/antigravity/skills/`. ## [PERSONAS] @@ -21,6 +21,7 @@ Each persona's individual `.md` carries a "Sources (what you read, by Tier)" sec | `reviewer` | Philosophical guardrails; independent audit | Read, Bash | A + B + C + D evidence | (none — audit only) | | `observability` | Log + metrics analyst | Read, Bash | D only (events.log, audit.log, perf, coverage) | (reports only) | | `developer` | Implementer (code, tests, migrations) | Read, Write, Edit, Bash | B (project-context, architecture, capabilities) + C (conventions) + A (current feature slice) | stages/, tests/, hitl/ | +| `blind-author` | Impl-blind test/oracle author (no Read/Grep/Glob/Edit by construction) | Write, Bash | A (acceptance criteria + module signatures only — never the implementation) | tests/ (conformance oracles) | ## [INVOCATION_PRINCIPLES] @@ -56,4 +57,4 @@ Cross-boundary rules: ## [TBD] -- Routing config (`src/agents/routing.yaml`) with intent → agent mapping. `commands/clad.md` is the single user-facing verb manifest today; per-verb skills live under `skills//SKILL.md` (auto-mirrored to `commands/.md`, `plugins/codex/skills/.md`, `plugins/gemini-cli/commands/.md`). +- Routing config (`src/agents/routing.yaml`) with intent → agent mapping. Per-verb skills live under `skills//SKILL.md`, auto-mirrored to `plugins/codex/skills//` and `plugins/antigravity/skills//` (Gemini receives only the init command as `plugins/gemini-cli/commands/init.toml`). diff --git a/plugins/claude-code/dist/agents/planner.md b/plugins/claude-code/dist/agents/planner.md index 7967b1e1..7736e7b7 100644 --- a/plugins/claude-code/dist/agents/planner.md +++ b/plugins/claude-code/dist/agents/planner.md @@ -33,7 +33,7 @@ You do NOT read Tier C (conventions — developer owns it) or Tier D (audit — ### Scenarios policy (v0.3.45+) -Scenarios are **onboarding output**, not feature-creation side-effect. `clad init ` extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). Pre-v0.3.30 auto-extraction from code is deprecated. +Scenarios are **onboarding output**, not feature-creation side-effect. Onboarding (host MCP flow, or CLI `clad init `) extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). Pre-v0.3.30 auto-extraction from code is deprecated. ## Project policy — `spec.yaml::project.ai_hints` diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 0204e8a0..fe80975a 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -356,7 +356,7 @@ new Anthropic({ apiKey, dangerouslyAllowBrowser: true }); `,n=t.split(/\r?\n/),i=n.findIndex(a=>/^project:\s*$/.test(a));if(i<0)return t;let o=[" # Auto-detected by `clad sync` \u2014 the gate smoke-tests this entry (stage_2.4, calibrated to pass now). Set is_safe_to_smoke: false to opt out."," deliverable:",` path: ${JSON.stringify(e.path)}`,...e.smoke_args&&e.smoke_args.length>0?[` smoke_args: [${e.smoke_args.map(a=>JSON.stringify(a)).join(", ")}]`]:[],` is_safe_to_smoke: ${e.is_safe_to_smoke?"true":"false"}`];n.splice(i+1,0,...o);let s=n.join(` `);return r===`\r `?s.replace(/\n/g,`\r -`):s}function Jx(t="."){let e=Kx(t,"spec.yaml");if(!Wx(e))return null;let r=kte(e,"utf8");if(Ete(r))return null;let n=Zqe(t);if(!n)return null;let i=Vqe(r,n);return i!==r?(zqe(e,i),n):null}var qqe,xte,Bqe,Gj=y(()=>{"use strict";Mr();qqe=5e3,xte=12,Bqe=/\.(test|spec)\.[jt]sx?$|\.([jt]sx?|json|lock|md|ya?ml|html|css|map|d\.ts)$/i});var Re,jte,J,jo,rh=y(()=>{(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Re||(Re={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(jte||(jte={}));J=Re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),jo=t=>{switch(typeof t){case"undefined":return J.undefined;case"string":return J.string;case"number":return Number.isNaN(t)?J.nan:J.number;case"boolean":return J.boolean;case"function":return J.function;case"bigint":return J.bigint;case"symbol":return J.symbol;case"object":return Array.isArray(t)?J.array:t===null?J.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?J.promise:typeof Map<"u"&&t instanceof Map?J.map:typeof Set<"u"&&t instanceof Set?J.set:typeof Date<"u"&&t instanceof Date?J.date:J.object;default:return J.unknown}}});var F,bn,Xx=y(()=>{rh();F=Re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),bn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;cr.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};bn.create=t=>new bn(t)});var s4e,Is,Wj=y(()=>{Xx();rh();s4e=(t,e)=>{let r;switch(t.code){case F.invalid_type:t.received===J.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case F.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Re.jsonStringifyReplacer)}`;break;case F.unrecognized_keys:r=`Unrecognized key(s) in object: ${Re.joinValues(t.keys,", ")}`;break;case F.invalid_union:r="Invalid input";break;case F.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Re.joinValues(t.options)}`;break;case F.invalid_enum_value:r=`Invalid enum value. Expected ${Re.joinValues(t.options)}, received '${t.received}'`;break;case F.invalid_arguments:r="Invalid function arguments";break;case F.invalid_return_type:r="Invalid function return type";break;case F.invalid_date:r="Invalid date";break;case F.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Re.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case F.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case F.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case F.custom:r="Invalid input";break;case F.invalid_intersection_types:r="Intersection results could not be merged";break;case F.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case F.not_finite:r="Number must be finite";break;default:r=e.defaultError,Re.assertNever(t)}return{message:r}},Is=s4e});function nh(){return a4e}var a4e,Qx=y(()=>{Wj();a4e=Is});function G(t,e){let r=nh(),n=e0({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Is?void 0:Is].filter(i=>!!i)});t.common.issues.push(n)}var e0,pr,ce,Iu,$r,Kj,Jj,vc,ih,Yj=y(()=>{Qx();Wj();e0=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)a=l(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}};pr=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return ce;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ce;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},ce=Object.freeze({status:"aborted"}),Iu=t=>({status:"dirty",value:t}),$r=t=>({status:"valid",value:t}),Kj=t=>t.status==="aborted",Jj=t=>t.status==="dirty",vc=t=>t.status==="valid",ih=t=>typeof Promise<"u"&&t instanceof Promise});var Mte=y(()=>{});var te,Fte=y(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(te||(te={}))});function ye(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}function Ute(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function $4e(t){return new RegExp(`^${Ute(t)}$`)}function k4e(t){let e=`${zte}T${Ute(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function E4e(t,e){return!!((e==="v4"||!e)&&y4e.test(t)||(e==="v6"||!e)&&b4e.test(t))}function A4e(t,e){if(!p4e.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function T4e(t,e){return!!((e==="v4"||!e)&&_4e.test(t)||(e==="v6"||!e)&&v4e.test(t))}function O4e(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}function Pu(t){if(t instanceof vn){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=ui.create(Pu(n))}return new vn({...t._def,shape:()=>e})}else return t instanceof Cs?new Cs({...t._def,type:Pu(t.element)}):t instanceof ui?ui.create(Pu(t.unwrap())):t instanceof Lo?Lo.create(Pu(t.unwrap())):t instanceof Fo?Fo.create(t.items.map(e=>Pu(e))):t}function eM(t,e){let r=jo(t),n=jo(e);if(t===e)return{valid:!0,data:t};if(r===J.object&&n===J.object){let i=Re.objectKeys(e),o=Re.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let c=eM(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===J.array&&n===J.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o{Xx();Qx();Fte();Yj();rh();Mn=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Lte=(t,e)=>{if(vc(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new bn(t.common.issues);return this._error=r,this._error}}};$e=class{get description(){return this._def.description}_getType(e){return jo(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:jo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pr,ctx:{common:e.parent.common,data:e.data,parsedType:jo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(ih(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jo(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Lte(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jo(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return vc(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>vc(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jo(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(ih(i)?i:Promise.resolve(i));return Lte(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:F.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new di({schema:this,typeName:z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ui.create(this,this._def)}nullable(){return Lo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Cs.create(this)}promise(){return Sc.create(this,this._def)}or(e){return ju.create([this,e],this._def)}and(e){return Mu.create(this,e,this._def)}transform(e){return new di({...ye(this._def),schema:this,typeName:z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new qu({...ye(this._def),innerType:this,defaultValue:r,typeName:z.ZodDefault})}brand(){return new t0({typeName:z.ZodBranded,type:this,...ye(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Bu({...ye(this._def),innerType:this,catchValue:r,typeName:z.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return r0.create(this,e)}readonly(){return Hu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},c4e=/^c[^\s-]{8,}$/i,l4e=/^[0-9a-z]+$/,u4e=/^[0-9A-HJKMNP-TV-Z]{26}$/i,d4e=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,f4e=/^[a-z0-9_-]{21}$/i,p4e=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,m4e=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,h4e=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,g4e="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",y4e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_4e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,b4e=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,v4e=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,S4e=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,w4e=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,zte="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",x4e=new RegExp(`^${zte}$`);Cu=class t extends $e{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==J.string){let o=this._getOrReturnCtx(e);return G(o,{code:F.invalid_type,expected:J.string,received:o.parsedType}),ce}let n=new pr,i;for(let o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(i=this._getOrReturnCtx(e,i),G(i,{code:F.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.lengthe.test(i),{validation:r,code:F.invalid_string,...te.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...te.errToObj(e)})}url(e){return this._addCheck({kind:"url",...te.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...te.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...te.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...te.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...te.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...te.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...te.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...te.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...te.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...te.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...te.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...te.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...te.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...te.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...te.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...te.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...te.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...te.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...te.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...te.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...te.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...te.errToObj(r)})}nonempty(e){return this.min(1,te.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Cu({checks:[],typeName:z.ZodString,coerce:t?.coerce??!1,...ye(t)});oh=class t extends $e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==J.number){let o=this._getOrReturnCtx(e);return G(o,{code:F.invalid_type,expected:J.number,received:o.parsedType}),ce}let n,i=new pr;for(let o of this._def.checks)o.kind==="int"?Re.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:F.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),G(n,{code:F.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?O4e(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),G(n,{code:F.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:F.not_finite,message:o.message}),i.dirty()):Re.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,te.toString(r))}gt(e,r){return this.setLimit("min",e,!1,te.toString(r))}lte(e,r){return this.setLimit("max",e,!0,te.toString(r))}lt(e,r){return this.setLimit("max",e,!1,te.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:te.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:te.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:te.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:te.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:te.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:te.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:te.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:te.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:te.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:te.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&Re.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew oh({checks:[],typeName:z.ZodNumber,coerce:t?.coerce||!1,...ye(t)});sh=class t extends $e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==J.bigint)return this._getInvalidInput(e);let n,i=new pr;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),G(n,{code:F.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),G(n,{code:F.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Re.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return G(r,{code:F.invalid_type,expected:J.bigint,received:r.parsedType}),ce}gte(e,r){return this.setLimit("min",e,!0,te.toString(r))}gt(e,r){return this.setLimit("min",e,!1,te.toString(r))}lte(e,r){return this.setLimit("max",e,!0,te.toString(r))}lt(e,r){return this.setLimit("max",e,!1,te.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:te.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:te.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:te.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:te.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:te.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:te.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew sh({checks:[],typeName:z.ZodBigInt,coerce:t?.coerce??!1,...ye(t)});ah=class extends $e{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==J.boolean){let n=this._getOrReturnCtx(e);return G(n,{code:F.invalid_type,expected:J.boolean,received:n.parsedType}),ce}return $r(e.data)}};ah.create=t=>new ah({typeName:z.ZodBoolean,coerce:t?.coerce||!1,...ye(t)});ch=class t extends $e{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==J.date){let o=this._getOrReturnCtx(e);return G(o,{code:F.invalid_type,expected:J.date,received:o.parsedType}),ce}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return G(o,{code:F.invalid_date}),ce}let n=new pr,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(i=this._getOrReturnCtx(e,i),G(i,{code:F.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Re.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:te.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:te.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew ch({checks:[],coerce:t?.coerce||!1,typeName:z.ZodDate,...ye(t)});lh=class extends $e{_parse(e){if(this._getType(e)!==J.symbol){let n=this._getOrReturnCtx(e);return G(n,{code:F.invalid_type,expected:J.symbol,received:n.parsedType}),ce}return $r(e.data)}};lh.create=t=>new lh({typeName:z.ZodSymbol,...ye(t)});Du=class extends $e{_parse(e){if(this._getType(e)!==J.undefined){let n=this._getOrReturnCtx(e);return G(n,{code:F.invalid_type,expected:J.undefined,received:n.parsedType}),ce}return $r(e.data)}};Du.create=t=>new Du({typeName:z.ZodUndefined,...ye(t)});Nu=class extends $e{_parse(e){if(this._getType(e)!==J.null){let n=this._getOrReturnCtx(e);return G(n,{code:F.invalid_type,expected:J.null,received:n.parsedType}),ce}return $r(e.data)}};Nu.create=t=>new Nu({typeName:z.ZodNull,...ye(t)});uh=class extends $e{constructor(){super(...arguments),this._any=!0}_parse(e){return $r(e.data)}};uh.create=t=>new uh({typeName:z.ZodAny,...ye(t)});Ps=class extends $e{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $r(e.data)}};Ps.create=t=>new Ps({typeName:z.ZodUnknown,...ye(t)});Yi=class extends $e{_parse(e){let r=this._getOrReturnCtx(e);return G(r,{code:F.invalid_type,expected:J.never,received:r.parsedType}),ce}};Yi.create=t=>new Yi({typeName:z.ZodNever,...ye(t)});dh=class extends $e{_parse(e){if(this._getType(e)!==J.undefined){let n=this._getOrReturnCtx(e);return G(n,{code:F.invalid_type,expected:J.void,received:n.parsedType}),ce}return $r(e.data)}};dh.create=t=>new dh({typeName:z.ZodVoid,...ye(t)});Cs=class t extends $e{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==J.array)return G(r,{code:F.invalid_type,expected:J.array,received:r.parsedType}),ce;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.lengthi.maxLength.value&&(G(r,{code:F.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new Mn(r,s,r.path,a)))).then(s=>pr.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new Mn(r,s,r.path,a)));return pr.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:te.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:te.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:te.toString(r)}})}nonempty(e){return this.min(1,e)}};Cs.create=(t,e)=>new Cs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:z.ZodArray,...ye(e)});vn=class t extends $e{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Re.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==J.object){let l=this._getOrReturnCtx(e);return G(l,{code:F.invalid_type,expected:J.object,received:l.parsedType}),ce}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Yi&&this._def.unknownKeys==="strip"))for(let l in i.data)s.includes(l)||a.push(l);let c=[];for(let l of s){let u=o[l],d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Mn(i,d,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Yi){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")a.length>0&&(G(i,{code:F.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of a){let d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Mn(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,f=await u.value;l.push({key:d,value:f,alwaysSet:u.alwaysSet})}return l}).then(l=>pr.mergeObjectSync(n,l)):pr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return te.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:te.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:z.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Re.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Re.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Pu(this)}partial(e){let r={};for(let n of Re.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Re.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof ui;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return qte(Re.objectKeys(this.shape))}};vn.create=(t,e)=>new vn({shape:()=>t,unknownKeys:"strip",catchall:Yi.create(),typeName:z.ZodObject,...ye(e)});vn.strictCreate=(t,e)=>new vn({shape:()=>t,unknownKeys:"strict",catchall:Yi.create(),typeName:z.ZodObject,...ye(e)});vn.lazycreate=(t,e)=>new vn({shape:t,unknownKeys:"strip",catchall:Yi.create(),typeName:z.ZodObject,...ye(e)});ju=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new bn(a.ctx.common.issues));return G(r,{code:F.invalid_union,unionErrors:s}),ce}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new bn(c));return G(r,{code:F.invalid_union,unionErrors:a}),ce}}get options(){return this._def.options}};ju.create=(t,e)=>new ju({options:t,typeName:z.ZodUnion,...ye(e)});Mo=t=>t instanceof Fu?Mo(t.schema):t instanceof di?Mo(t.innerType()):t instanceof Lu?[t.value]:t instanceof zu?t.options:t instanceof Uu?Re.objectValues(t.enum):t instanceof qu?Mo(t._def.innerType):t instanceof Du?[void 0]:t instanceof Nu?[null]:t instanceof ui?[void 0,...Mo(t.unwrap())]:t instanceof Lo?[null,...Mo(t.unwrap())]:t instanceof t0||t instanceof Hu?Mo(t.unwrap()):t instanceof Bu?Mo(t._def.innerType):[],Qj=class t extends $e{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==J.object)return G(r,{code:F.invalid_type,expected:J.object,received:r.parsedType}),ce;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(G(r,{code:F.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ce)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=Mo(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:z.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...ye(n)})}};Mu=class extends $e{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(Kj(o)||Kj(s))return ce;let a=eM(o.value,s.value);return a.valid?((Jj(o)||Jj(s))&&r.dirty(),{status:r.value,value:a.data}):(G(n,{code:F.invalid_intersection_types}),ce)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Mu.create=(t,e,r)=>new Mu({left:t,right:e,typeName:z.ZodIntersection,...ye(r)});Fo=class t extends $e{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==J.array)return G(n,{code:F.invalid_type,expected:J.array,received:n.parsedType}),ce;if(n.data.lengththis._def.items.length&&(G(n,{code:F.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Mn(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>pr.mergeArray(r,s)):pr.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Fo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fo({items:t,typeName:z.ZodTuple,rest:null,...ye(e)})};tM=class t extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==J.object)return G(n,{code:F.invalid_type,expected:J.object,received:n.parsedType}),ce;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new Mn(n,a,n.path,a)),value:s._parse(new Mn(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?pr.mergeObjectAsync(r,i):pr.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof $e?new t({keyType:e,valueType:r,typeName:z.ZodRecord,...ye(n)}):new t({keyType:Cu.create(),valueType:e,typeName:z.ZodRecord,...ye(r)})}},fh=class extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==J.map)return G(n,{code:F.invalid_type,expected:J.map,received:n.parsedType}),ce;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],l)=>({key:i._parse(new Mn(n,a,n.path,[l,"key"])),value:o._parse(new Mn(n,c,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return ce;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(l.value,u.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return ce;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(l.value,u.value)}return{status:r.value,value:a}}}};fh.create=(t,e,r)=>new fh({valueType:e,keyType:t,typeName:z.ZodMap,...ye(r)});ph=class t extends $e{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==J.set)return G(n,{code:F.invalid_type,expected:J.set,received:n.parsedType}),ce;let i=this._def;i.minSize!==null&&n.data.sizei.maxSize.value&&(G(n,{code:F.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let l=new Set;for(let u of c){if(u.status==="aborted")return ce;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((c,l)=>o._parse(new Mn(n,c,n.path,l)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:te.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:te.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};ph.create=(t,e)=>new ph({valueType:t,minSize:null,maxSize:null,typeName:z.ZodSet,...ye(e)});rM=class t extends $e{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==J.function)return G(r,{code:F.invalid_type,expected:J.function,received:r.parsedType}),ce;function n(a,c){return e0({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,nh(),Is].filter(l=>!!l),issueData:{code:F.invalid_arguments,argumentsError:c}})}function i(a,c){return e0({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,nh(),Is].filter(l=>!!l),issueData:{code:F.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Sc){let a=this;return $r(async function(...c){let l=new bn([]),u=await a._def.args.parseAsync(c,o).catch(p=>{throw l.addIssue(n(c,p)),l}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,o).catch(p=>{throw l.addIssue(i(d,p)),l})})}else{let a=this;return $r(function(...c){let l=a._def.args.safeParse(c,o);if(!l.success)throw new bn([n(c,l.error)]);let u=Reflect.apply(s,this,l.data),d=a._def.returns.safeParse(u,o);if(!d.success)throw new bn([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Fo.create(e).rest(Ps.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Fo.create([]).rest(Ps.create()),returns:r||Ps.create(),typeName:z.ZodFunction,...ye(n)})}},Fu=class extends $e{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Fu.create=(t,e)=>new Fu({getter:t,typeName:z.ZodLazy,...ye(e)});Lu=class extends $e{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return G(r,{received:r.data,code:F.invalid_literal,expected:this._def.value}),ce}return{status:"valid",value:e.data}}get value(){return this._def.value}};Lu.create=(t,e)=>new Lu({value:t,typeName:z.ZodLiteral,...ye(e)});zu=class t extends $e{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return G(r,{expected:Re.joinValues(n),received:r.parsedType,code:F.invalid_type}),ce}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return G(r,{received:r.data,code:F.invalid_enum_value,options:n}),ce}return $r(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};zu.create=qte;Uu=class extends $e{_parse(e){let r=Re.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==J.string&&n.parsedType!==J.number){let i=Re.objectValues(r);return G(n,{expected:Re.joinValues(i),received:n.parsedType,code:F.invalid_type}),ce}if(this._cache||(this._cache=new Set(Re.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Re.objectValues(r);return G(n,{received:n.data,code:F.invalid_enum_value,options:i}),ce}return $r(e.data)}get enum(){return this._def.values}};Uu.create=(t,e)=>new Uu({values:t,typeName:z.ZodNativeEnum,...ye(e)});Sc=class extends $e{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==J.promise&&r.common.async===!1)return G(r,{code:F.invalid_type,expected:J.promise,received:r.parsedType}),ce;let n=r.parsedType===J.promise?r.data:Promise.resolve(r.data);return $r(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Sc.create=(t,e)=>new Sc({type:t,typeName:z.ZodPromise,...ye(e)});di=class extends $e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{G(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ce;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?ce:c.status==="dirty"?Iu(c.value):r.value==="dirty"?Iu(c.value):c});{if(r.value==="aborted")return ce;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ce:a.status==="dirty"?Iu(a.value):r.value==="dirty"?Iu(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ce:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ce:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!vc(s))return ce;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>vc(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ce);Re.assertNever(i)}};di.create=(t,e,r)=>new di({schema:t,typeName:z.ZodEffects,effect:e,...ye(r)});di.createWithPreprocess=(t,e,r)=>new di({schema:e,effect:{type:"preprocess",transform:t},typeName:z.ZodEffects,...ye(r)});ui=class extends $e{_parse(e){return this._getType(e)===J.undefined?$r(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ui.create=(t,e)=>new ui({innerType:t,typeName:z.ZodOptional,...ye(e)});Lo=class extends $e{_parse(e){return this._getType(e)===J.null?$r(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Lo.create=(t,e)=>new Lo({innerType:t,typeName:z.ZodNullable,...ye(e)});qu=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===J.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};qu.create=(t,e)=>new qu({innerType:t,typeName:z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ye(e)});Bu=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ih(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new bn(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Bu.create=(t,e)=>new Bu({innerType:t,typeName:z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ye(e)});mh=class extends $e{_parse(e){if(this._getType(e)!==J.nan){let n=this._getOrReturnCtx(e);return G(n,{code:F.invalid_type,expected:J.nan,received:n.parsedType}),ce}return{status:"valid",value:e.data}}};mh.create=t=>new mh({typeName:z.ZodNaN,...ye(t)});t0=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},r0=class t extends $e{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ce:o.status==="dirty"?(r.dirty(),Iu(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ce:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:z.ZodPipeline})}},Hu=class extends $e{_parse(e){let r=this._def.innerType._parse(e),n=i=>(vc(i)&&(i.value=Object.freeze(i.value)),i);return ih(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Hu.create=(t,e)=>new Hu({innerType:t,typeName:z.ZodReadonly,...ye(e)});Sxt={object:vn.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(z||(z={}));wxt=Cu.create,xxt=oh.create,$xt=mh.create,kxt=sh.create,Ext=ah.create,Axt=ch.create,Txt=lh.create,Oxt=Du.create,Rxt=Nu.create,Ixt=uh.create,Pxt=Ps.create,Cxt=Yi.create,Dxt=dh.create,Nxt=Cs.create,Bte=vn.create,jxt=vn.strictCreate,Mxt=ju.create,Fxt=Qj.create,Lxt=Mu.create,zxt=Fo.create,Uxt=tM.create,qxt=fh.create,Bxt=ph.create,Hxt=rM.create,Gxt=Fu.create,Zxt=Lu.create,Vxt=zu.create,Wxt=Uu.create,Kxt=Sc.create,Jxt=di.create,Yxt=ui.create,Xxt=Lo.create,Qxt=di.createWithPreprocess,e0t=r0.create});var Gte=y(()=>{Qx();Yj();Mte();rh();Hte();Xx()});var hh=y(()=>{Gte()});function k(t,e,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let l=s.prototype,u=Object.keys(l);for(let d=0;dr?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}function Tt(t){return t&&Object.assign(wc,t),wc}var Zte,nM,iM,fi,Ds,wc,xc=y(()=>{nM=Object.freeze({status:"aborted"});iM=Symbol("zod_brand"),fi=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ds=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(Zte=globalThis).__zod_globalConfig??(Zte.__zod_globalConfig={});wc=globalThis.__zod_globalConfig});var M={};Pr(M,{BIGINT_FORMAT_RANGES:()=>pM,Class:()=>sM,NUMBER_FORMAT_RANGES:()=>fM,aborted:()=>Fs,allowsEval:()=>lM,assert:()=>N4e,assertEqual:()=>I4e,assertIs:()=>C4e,assertNever:()=>D4e,assertNotEqual:()=>P4e,assignProp:()=>js,base64ToUint8Array:()=>ere,base64urlToUint8Array:()=>Z4e,cached:()=>Zu,captureStackTrace:()=>i0,cleanEnum:()=>G4e,cleanRegex:()=>_h,clone:()=>nr,cloneDef:()=>M4e,createTransparentProxy:()=>B4e,defineLazy:()=>ve,esc:()=>n0,escapeRegex:()=>Fn,explicitlyAborted:()=>mM,extend:()=>Jte,finalizeIssue:()=>kr,floatSafeRemainder:()=>aM,getElementAtPath:()=>F4e,getEnumValues:()=>yh,getLengthableOrigin:()=>Sh,getParsedType:()=>q4e,getSizableOrigin:()=>vh,hexToUint8Array:()=>W4e,isObject:()=>$c,isPlainObject:()=>Ms,issue:()=>Vu,joinValues:()=>R,jsonStringifyReplacer:()=>Gu,merge:()=>H4e,mergeDefs:()=>zo,normalizeParams:()=>U,nullish:()=>Ns,numKeys:()=>U4e,objectClone:()=>j4e,omit:()=>Kte,optionalKeys:()=>dM,parsedType:()=>j,partial:()=>Xte,pick:()=>Wte,prefixIssues:()=>Br,primitiveTypes:()=>uM,promiseAllObject:()=>L4e,propertyKeyTypes:()=>bh,randomString:()=>z4e,required:()=>Qte,safeExtend:()=>Yte,shallowClone:()=>o0,slugify:()=>cM,stringifyPrimitive:()=>N,uint8ArrayToBase64:()=>tre,uint8ArrayToBase64url:()=>V4e,uint8ArrayToHex:()=>K4e,unwrapMessage:()=>gh});function I4e(t){return t}function P4e(t){return t}function C4e(t){}function D4e(t){throw new Error("Unexpected value in exhaustive check")}function N4e(t){}function yh(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function R(t,e="|"){return t.map(r=>N(r)).join(e)}function Gu(t,e){return typeof e=="bigint"?e.toString():e}function Zu(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ns(t){return t==null}function _h(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function aM(t,e){let r=t/e,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)r?.[n],t):t}function L4e(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;oe};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function B4e(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,o){return e??(e=t()),Reflect.set(e,n,i,o)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function N(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function dM(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function Wte(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=zo(t._zod.def,{get shape(){let s={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(s[a]=r.shape[a])}return js(this,"shape",s),s},checks:[]});return nr(t,o)}function Kte(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=zo(t._zod.def,{get shape(){let s={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete s[a]}return js(this,"shape",s),s},checks:[]});return nr(t,o)}function Jte(t,e){if(!Ms(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let o=t._zod.def.shape;for(let s in e)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=zo(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return js(this,"shape",o),o}});return nr(t,i)}function Yte(t,e){if(!Ms(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=zo(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return js(this,"shape",n),n}});return nr(t,r)}function H4e(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=zo(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return js(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return nr(t,r)}function Xte(t,e,r){let i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=zo(e._zod.def,{get shape(){let a=e._zod.def.shape,c={...a};if(r)for(let l in r){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(c[l]=t?new t({type:"optional",innerType:a[l]}):a[l])}else for(let l in a)c[l]=t?new t({type:"optional",innerType:a[l]}):a[l];return js(this,"shape",c),c},checks:[]});return nr(e,s)}function Qte(t,e,r){let n=zo(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(let s in i)o[s]=new t({type:"nonoptional",innerType:i[s]});return js(this,"shape",o),o}});return nr(e,n)}function Fs(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function gh(t){return typeof t=="string"?t:t?.message}function kr(t,e,r){let n=t.message?t.message:gh(t.inst?._zod.def?.error?.(t))??gh(e?.error?.(t))??gh(r.customError?.(t))??gh(r.localeError?.(t))??"Invalid input",{inst:i,continue:o,input:s,...a}=t;return a.path??(a.path=[]),a.message=n,e?.reportInput&&(a.input=s),a}function vh(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Sh(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function j(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Vu(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function G4e(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function ere(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;ne.toString(16).padStart(2,"0")).join("")}var Vte,i0,lM,q4e,bh,uM,fM,pM,sM,ee=y(()=>{xc();Vte=Symbol("evaluating");i0="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};lM=Zu(()=>{if(wc.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});q4e=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},bh=new Set(["string","number","symbol"]),uM=new Set(["string","number","bigint","boolean","symbol","undefined"]);fM={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},pM={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};sM=class{constructor(...e){}}});function xh(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function $h(t,e=r=>r.message){let r={_errors:[]},n=(i,o=[])=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...o,...s.path]);else{let a=[...o,...s.path];if(a.length===0)r._errors.push(e(s));else{let c=r,l=0;for(;lr.message){let r={errors:[]},n=(i,o=[])=>{var s,a;for(let c of i.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>n({issues:l},[...o,...c.path]));else if(c.code==="invalid_key")n({issues:c.issues},[...o,...c.path]);else if(c.code==="invalid_element")n({issues:c.issues},[...o,...c.path]);else{let l=[...o,...c.path];if(l.length===0){r.errors.push(e(c));continue}let u=r,d=0;for(;dtypeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function gM(t){let e=[],r=[...t.issues].sort((n,i)=>(n.path??[]).length-(i.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${nre(n.path)}`);return e.join(` +`):s}function Jx(t="."){let e=Kx(t,"spec.yaml");if(!Wx(e))return null;let r=kte(e,"utf8");if(Ete(r))return null;let n=Zqe(t);if(!n)return null;let i=Vqe(r,n);return i!==r?(zqe(e,i),n):null}var qqe,xte,Bqe,Gj=y(()=>{"use strict";Mr();qqe=5e3,xte=12,Bqe=/\.(test|spec)\.[jt]sx?$|\.([jt]sx?|json|lock|md|ya?ml|html|css|map|d\.ts)$/i});var Re,jte,J,jo,rh=y(()=>{(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Re||(Re={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(jte||(jte={}));J=Re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),jo=t=>{switch(typeof t){case"undefined":return J.undefined;case"string":return J.string;case"number":return Number.isNaN(t)?J.nan:J.number;case"boolean":return J.boolean;case"function":return J.function;case"bigint":return J.bigint;case"symbol":return J.symbol;case"object":return Array.isArray(t)?J.array:t===null?J.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?J.promise:typeof Map<"u"&&t instanceof Map?J.map:typeof Set<"u"&&t instanceof Set?J.set:typeof Date<"u"&&t instanceof Date?J.date:J.object;default:return J.unknown}}});var F,bn,Xx=y(()=>{rh();F=Re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),bn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;cr.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};bn.create=t=>new bn(t)});var s4e,Is,Wj=y(()=>{Xx();rh();s4e=(t,e)=>{let r;switch(t.code){case F.invalid_type:t.received===J.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case F.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Re.jsonStringifyReplacer)}`;break;case F.unrecognized_keys:r=`Unrecognized key(s) in object: ${Re.joinValues(t.keys,", ")}`;break;case F.invalid_union:r="Invalid input";break;case F.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Re.joinValues(t.options)}`;break;case F.invalid_enum_value:r=`Invalid enum value. Expected ${Re.joinValues(t.options)}, received '${t.received}'`;break;case F.invalid_arguments:r="Invalid function arguments";break;case F.invalid_return_type:r="Invalid function return type";break;case F.invalid_date:r="Invalid date";break;case F.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Re.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case F.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case F.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case F.custom:r="Invalid input";break;case F.invalid_intersection_types:r="Intersection results could not be merged";break;case F.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case F.not_finite:r="Number must be finite";break;default:r=e.defaultError,Re.assertNever(t)}return{message:r}},Is=s4e});function nh(){return a4e}var a4e,Qx=y(()=>{Wj();a4e=Is});function G(t,e){let r=nh(),n=e0({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Is?void 0:Is].filter(i=>!!i)});t.common.issues.push(n)}var e0,pr,ce,Iu,$r,Kj,Jj,vc,ih,Yj=y(()=>{Qx();Wj();e0=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)a=l(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}};pr=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return ce;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ce;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},ce=Object.freeze({status:"aborted"}),Iu=t=>({status:"dirty",value:t}),$r=t=>({status:"valid",value:t}),Kj=t=>t.status==="aborted",Jj=t=>t.status==="dirty",vc=t=>t.status==="valid",ih=t=>typeof Promise<"u"&&t instanceof Promise});var Mte=y(()=>{});var te,Fte=y(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(te||(te={}))});function ye(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}function Ute(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function $4e(t){return new RegExp(`^${Ute(t)}$`)}function k4e(t){let e=`${zte}T${Ute(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function E4e(t,e){return!!((e==="v4"||!e)&&y4e.test(t)||(e==="v6"||!e)&&b4e.test(t))}function A4e(t,e){if(!p4e.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function T4e(t,e){return!!((e==="v4"||!e)&&_4e.test(t)||(e==="v6"||!e)&&v4e.test(t))}function O4e(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}function Pu(t){if(t instanceof vn){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=ui.create(Pu(n))}return new vn({...t._def,shape:()=>e})}else return t instanceof Cs?new Cs({...t._def,type:Pu(t.element)}):t instanceof ui?ui.create(Pu(t.unwrap())):t instanceof Lo?Lo.create(Pu(t.unwrap())):t instanceof Fo?Fo.create(t.items.map(e=>Pu(e))):t}function eM(t,e){let r=jo(t),n=jo(e);if(t===e)return{valid:!0,data:t};if(r===J.object&&n===J.object){let i=Re.objectKeys(e),o=Re.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let c=eM(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===J.array&&n===J.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o{Xx();Qx();Fte();Yj();rh();Mn=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Lte=(t,e)=>{if(vc(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new bn(t.common.issues);return this._error=r,this._error}}};$e=class{get description(){return this._def.description}_getType(e){return jo(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:jo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pr,ctx:{common:e.parent.common,data:e.data,parsedType:jo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(ih(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jo(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Lte(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jo(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return vc(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>vc(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jo(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(ih(i)?i:Promise.resolve(i));return Lte(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:F.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new di({schema:this,typeName:z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ui.create(this,this._def)}nullable(){return Lo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Cs.create(this)}promise(){return Sc.create(this,this._def)}or(e){return ju.create([this,e],this._def)}and(e){return Mu.create(this,e,this._def)}transform(e){return new di({...ye(this._def),schema:this,typeName:z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new qu({...ye(this._def),innerType:this,defaultValue:r,typeName:z.ZodDefault})}brand(){return new t0({typeName:z.ZodBranded,type:this,...ye(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Bu({...ye(this._def),innerType:this,catchValue:r,typeName:z.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return r0.create(this,e)}readonly(){return Hu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},c4e=/^c[^\s-]{8,}$/i,l4e=/^[0-9a-z]+$/,u4e=/^[0-9A-HJKMNP-TV-Z]{26}$/i,d4e=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,f4e=/^[a-z0-9_-]{21}$/i,p4e=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,m4e=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,h4e=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,g4e="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",y4e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_4e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,b4e=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,v4e=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,S4e=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,w4e=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,zte="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",x4e=new RegExp(`^${zte}$`);Cu=class t extends $e{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==J.string){let o=this._getOrReturnCtx(e);return G(o,{code:F.invalid_type,expected:J.string,received:o.parsedType}),ce}let n=new pr,i;for(let o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(i=this._getOrReturnCtx(e,i),G(i,{code:F.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.lengthe.test(i),{validation:r,code:F.invalid_string,...te.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...te.errToObj(e)})}url(e){return this._addCheck({kind:"url",...te.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...te.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...te.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...te.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...te.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...te.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...te.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...te.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...te.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...te.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...te.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...te.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...te.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...te.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...te.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...te.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...te.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...te.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...te.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...te.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...te.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...te.errToObj(r)})}nonempty(e){return this.min(1,te.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Cu({checks:[],typeName:z.ZodString,coerce:t?.coerce??!1,...ye(t)});oh=class t extends $e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==J.number){let o=this._getOrReturnCtx(e);return G(o,{code:F.invalid_type,expected:J.number,received:o.parsedType}),ce}let n,i=new pr;for(let o of this._def.checks)o.kind==="int"?Re.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:F.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),G(n,{code:F.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?O4e(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),G(n,{code:F.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:F.not_finite,message:o.message}),i.dirty()):Re.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,te.toString(r))}gt(e,r){return this.setLimit("min",e,!1,te.toString(r))}lte(e,r){return this.setLimit("max",e,!0,te.toString(r))}lt(e,r){return this.setLimit("max",e,!1,te.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:te.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:te.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:te.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:te.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:te.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:te.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:te.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:te.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:te.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:te.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&Re.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew oh({checks:[],typeName:z.ZodNumber,coerce:t?.coerce||!1,...ye(t)});sh=class t extends $e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==J.bigint)return this._getInvalidInput(e);let n,i=new pr;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),G(n,{code:F.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),G(n,{code:F.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Re.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return G(r,{code:F.invalid_type,expected:J.bigint,received:r.parsedType}),ce}gte(e,r){return this.setLimit("min",e,!0,te.toString(r))}gt(e,r){return this.setLimit("min",e,!1,te.toString(r))}lte(e,r){return this.setLimit("max",e,!0,te.toString(r))}lt(e,r){return this.setLimit("max",e,!1,te.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:te.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:te.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:te.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:te.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:te.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:te.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew sh({checks:[],typeName:z.ZodBigInt,coerce:t?.coerce??!1,...ye(t)});ah=class extends $e{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==J.boolean){let n=this._getOrReturnCtx(e);return G(n,{code:F.invalid_type,expected:J.boolean,received:n.parsedType}),ce}return $r(e.data)}};ah.create=t=>new ah({typeName:z.ZodBoolean,coerce:t?.coerce||!1,...ye(t)});ch=class t extends $e{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==J.date){let o=this._getOrReturnCtx(e);return G(o,{code:F.invalid_type,expected:J.date,received:o.parsedType}),ce}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return G(o,{code:F.invalid_date}),ce}let n=new pr,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(i=this._getOrReturnCtx(e,i),G(i,{code:F.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Re.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:te.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:te.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew ch({checks:[],coerce:t?.coerce||!1,typeName:z.ZodDate,...ye(t)});lh=class extends $e{_parse(e){if(this._getType(e)!==J.symbol){let n=this._getOrReturnCtx(e);return G(n,{code:F.invalid_type,expected:J.symbol,received:n.parsedType}),ce}return $r(e.data)}};lh.create=t=>new lh({typeName:z.ZodSymbol,...ye(t)});Du=class extends $e{_parse(e){if(this._getType(e)!==J.undefined){let n=this._getOrReturnCtx(e);return G(n,{code:F.invalid_type,expected:J.undefined,received:n.parsedType}),ce}return $r(e.data)}};Du.create=t=>new Du({typeName:z.ZodUndefined,...ye(t)});Nu=class extends $e{_parse(e){if(this._getType(e)!==J.null){let n=this._getOrReturnCtx(e);return G(n,{code:F.invalid_type,expected:J.null,received:n.parsedType}),ce}return $r(e.data)}};Nu.create=t=>new Nu({typeName:z.ZodNull,...ye(t)});uh=class extends $e{constructor(){super(...arguments),this._any=!0}_parse(e){return $r(e.data)}};uh.create=t=>new uh({typeName:z.ZodAny,...ye(t)});Ps=class extends $e{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $r(e.data)}};Ps.create=t=>new Ps({typeName:z.ZodUnknown,...ye(t)});Yi=class extends $e{_parse(e){let r=this._getOrReturnCtx(e);return G(r,{code:F.invalid_type,expected:J.never,received:r.parsedType}),ce}};Yi.create=t=>new Yi({typeName:z.ZodNever,...ye(t)});dh=class extends $e{_parse(e){if(this._getType(e)!==J.undefined){let n=this._getOrReturnCtx(e);return G(n,{code:F.invalid_type,expected:J.void,received:n.parsedType}),ce}return $r(e.data)}};dh.create=t=>new dh({typeName:z.ZodVoid,...ye(t)});Cs=class t extends $e{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==J.array)return G(r,{code:F.invalid_type,expected:J.array,received:r.parsedType}),ce;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.lengthi.maxLength.value&&(G(r,{code:F.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new Mn(r,s,r.path,a)))).then(s=>pr.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new Mn(r,s,r.path,a)));return pr.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:te.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:te.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:te.toString(r)}})}nonempty(e){return this.min(1,e)}};Cs.create=(t,e)=>new Cs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:z.ZodArray,...ye(e)});vn=class t extends $e{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Re.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==J.object){let l=this._getOrReturnCtx(e);return G(l,{code:F.invalid_type,expected:J.object,received:l.parsedType}),ce}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Yi&&this._def.unknownKeys==="strip"))for(let l in i.data)s.includes(l)||a.push(l);let c=[];for(let l of s){let u=o[l],d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Mn(i,d,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Yi){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")a.length>0&&(G(i,{code:F.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of a){let d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Mn(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,f=await u.value;l.push({key:d,value:f,alwaysSet:u.alwaysSet})}return l}).then(l=>pr.mergeObjectSync(n,l)):pr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return te.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:te.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:z.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Re.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Re.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Pu(this)}partial(e){let r={};for(let n of Re.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Re.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof ui;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return qte(Re.objectKeys(this.shape))}};vn.create=(t,e)=>new vn({shape:()=>t,unknownKeys:"strip",catchall:Yi.create(),typeName:z.ZodObject,...ye(e)});vn.strictCreate=(t,e)=>new vn({shape:()=>t,unknownKeys:"strict",catchall:Yi.create(),typeName:z.ZodObject,...ye(e)});vn.lazycreate=(t,e)=>new vn({shape:t,unknownKeys:"strip",catchall:Yi.create(),typeName:z.ZodObject,...ye(e)});ju=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new bn(a.ctx.common.issues));return G(r,{code:F.invalid_union,unionErrors:s}),ce}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new bn(c));return G(r,{code:F.invalid_union,unionErrors:a}),ce}}get options(){return this._def.options}};ju.create=(t,e)=>new ju({options:t,typeName:z.ZodUnion,...ye(e)});Mo=t=>t instanceof Fu?Mo(t.schema):t instanceof di?Mo(t.innerType()):t instanceof Lu?[t.value]:t instanceof zu?t.options:t instanceof Uu?Re.objectValues(t.enum):t instanceof qu?Mo(t._def.innerType):t instanceof Du?[void 0]:t instanceof Nu?[null]:t instanceof ui?[void 0,...Mo(t.unwrap())]:t instanceof Lo?[null,...Mo(t.unwrap())]:t instanceof t0||t instanceof Hu?Mo(t.unwrap()):t instanceof Bu?Mo(t._def.innerType):[],Qj=class t extends $e{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==J.object)return G(r,{code:F.invalid_type,expected:J.object,received:r.parsedType}),ce;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(G(r,{code:F.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ce)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=Mo(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:z.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...ye(n)})}};Mu=class extends $e{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(Kj(o)||Kj(s))return ce;let a=eM(o.value,s.value);return a.valid?((Jj(o)||Jj(s))&&r.dirty(),{status:r.value,value:a.data}):(G(n,{code:F.invalid_intersection_types}),ce)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Mu.create=(t,e,r)=>new Mu({left:t,right:e,typeName:z.ZodIntersection,...ye(r)});Fo=class t extends $e{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==J.array)return G(n,{code:F.invalid_type,expected:J.array,received:n.parsedType}),ce;if(n.data.lengththis._def.items.length&&(G(n,{code:F.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Mn(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>pr.mergeArray(r,s)):pr.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Fo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fo({items:t,typeName:z.ZodTuple,rest:null,...ye(e)})};tM=class t extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==J.object)return G(n,{code:F.invalid_type,expected:J.object,received:n.parsedType}),ce;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new Mn(n,a,n.path,a)),value:s._parse(new Mn(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?pr.mergeObjectAsync(r,i):pr.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof $e?new t({keyType:e,valueType:r,typeName:z.ZodRecord,...ye(n)}):new t({keyType:Cu.create(),valueType:e,typeName:z.ZodRecord,...ye(r)})}},fh=class extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==J.map)return G(n,{code:F.invalid_type,expected:J.map,received:n.parsedType}),ce;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],l)=>({key:i._parse(new Mn(n,a,n.path,[l,"key"])),value:o._parse(new Mn(n,c,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return ce;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(l.value,u.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return ce;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(l.value,u.value)}return{status:r.value,value:a}}}};fh.create=(t,e,r)=>new fh({valueType:e,keyType:t,typeName:z.ZodMap,...ye(r)});ph=class t extends $e{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==J.set)return G(n,{code:F.invalid_type,expected:J.set,received:n.parsedType}),ce;let i=this._def;i.minSize!==null&&n.data.sizei.maxSize.value&&(G(n,{code:F.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let l=new Set;for(let u of c){if(u.status==="aborted")return ce;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((c,l)=>o._parse(new Mn(n,c,n.path,l)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:te.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:te.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};ph.create=(t,e)=>new ph({valueType:t,minSize:null,maxSize:null,typeName:z.ZodSet,...ye(e)});rM=class t extends $e{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==J.function)return G(r,{code:F.invalid_type,expected:J.function,received:r.parsedType}),ce;function n(a,c){return e0({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,nh(),Is].filter(l=>!!l),issueData:{code:F.invalid_arguments,argumentsError:c}})}function i(a,c){return e0({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,nh(),Is].filter(l=>!!l),issueData:{code:F.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Sc){let a=this;return $r(async function(...c){let l=new bn([]),u=await a._def.args.parseAsync(c,o).catch(p=>{throw l.addIssue(n(c,p)),l}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,o).catch(p=>{throw l.addIssue(i(d,p)),l})})}else{let a=this;return $r(function(...c){let l=a._def.args.safeParse(c,o);if(!l.success)throw new bn([n(c,l.error)]);let u=Reflect.apply(s,this,l.data),d=a._def.returns.safeParse(u,o);if(!d.success)throw new bn([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Fo.create(e).rest(Ps.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Fo.create([]).rest(Ps.create()),returns:r||Ps.create(),typeName:z.ZodFunction,...ye(n)})}},Fu=class extends $e{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Fu.create=(t,e)=>new Fu({getter:t,typeName:z.ZodLazy,...ye(e)});Lu=class extends $e{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return G(r,{received:r.data,code:F.invalid_literal,expected:this._def.value}),ce}return{status:"valid",value:e.data}}get value(){return this._def.value}};Lu.create=(t,e)=>new Lu({value:t,typeName:z.ZodLiteral,...ye(e)});zu=class t extends $e{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return G(r,{expected:Re.joinValues(n),received:r.parsedType,code:F.invalid_type}),ce}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return G(r,{received:r.data,code:F.invalid_enum_value,options:n}),ce}return $r(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};zu.create=qte;Uu=class extends $e{_parse(e){let r=Re.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==J.string&&n.parsedType!==J.number){let i=Re.objectValues(r);return G(n,{expected:Re.joinValues(i),received:n.parsedType,code:F.invalid_type}),ce}if(this._cache||(this._cache=new Set(Re.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Re.objectValues(r);return G(n,{received:n.data,code:F.invalid_enum_value,options:i}),ce}return $r(e.data)}get enum(){return this._def.values}};Uu.create=(t,e)=>new Uu({values:t,typeName:z.ZodNativeEnum,...ye(e)});Sc=class extends $e{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==J.promise&&r.common.async===!1)return G(r,{code:F.invalid_type,expected:J.promise,received:r.parsedType}),ce;let n=r.parsedType===J.promise?r.data:Promise.resolve(r.data);return $r(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Sc.create=(t,e)=>new Sc({type:t,typeName:z.ZodPromise,...ye(e)});di=class extends $e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{G(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ce;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?ce:c.status==="dirty"?Iu(c.value):r.value==="dirty"?Iu(c.value):c});{if(r.value==="aborted")return ce;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ce:a.status==="dirty"?Iu(a.value):r.value==="dirty"?Iu(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ce:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ce:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!vc(s))return ce;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>vc(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ce);Re.assertNever(i)}};di.create=(t,e,r)=>new di({schema:t,typeName:z.ZodEffects,effect:e,...ye(r)});di.createWithPreprocess=(t,e,r)=>new di({schema:e,effect:{type:"preprocess",transform:t},typeName:z.ZodEffects,...ye(r)});ui=class extends $e{_parse(e){return this._getType(e)===J.undefined?$r(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ui.create=(t,e)=>new ui({innerType:t,typeName:z.ZodOptional,...ye(e)});Lo=class extends $e{_parse(e){return this._getType(e)===J.null?$r(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Lo.create=(t,e)=>new Lo({innerType:t,typeName:z.ZodNullable,...ye(e)});qu=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===J.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};qu.create=(t,e)=>new qu({innerType:t,typeName:z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ye(e)});Bu=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ih(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new bn(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Bu.create=(t,e)=>new Bu({innerType:t,typeName:z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ye(e)});mh=class extends $e{_parse(e){if(this._getType(e)!==J.nan){let n=this._getOrReturnCtx(e);return G(n,{code:F.invalid_type,expected:J.nan,received:n.parsedType}),ce}return{status:"valid",value:e.data}}};mh.create=t=>new mh({typeName:z.ZodNaN,...ye(t)});t0=class extends $e{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},r0=class t extends $e{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ce:o.status==="dirty"?(r.dirty(),Iu(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ce:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:z.ZodPipeline})}},Hu=class extends $e{_parse(e){let r=this._def.innerType._parse(e),n=i=>(vc(i)&&(i.value=Object.freeze(i.value)),i);return ih(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Hu.create=(t,e)=>new Hu({innerType:t,typeName:z.ZodReadonly,...ye(e)});vxt={object:vn.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(z||(z={}));Sxt=Cu.create,wxt=oh.create,xxt=mh.create,$xt=sh.create,kxt=ah.create,Ext=ch.create,Axt=lh.create,Txt=Du.create,Oxt=Nu.create,Rxt=uh.create,Ixt=Ps.create,Pxt=Yi.create,Cxt=dh.create,Dxt=Cs.create,Bte=vn.create,Nxt=vn.strictCreate,jxt=ju.create,Mxt=Qj.create,Fxt=Mu.create,Lxt=Fo.create,zxt=tM.create,Uxt=fh.create,qxt=ph.create,Bxt=rM.create,Hxt=Fu.create,Gxt=Lu.create,Zxt=zu.create,Vxt=Uu.create,Wxt=Sc.create,Kxt=di.create,Jxt=ui.create,Yxt=Lo.create,Xxt=di.createWithPreprocess,Qxt=r0.create});var Gte=y(()=>{Qx();Yj();Mte();rh();Hte();Xx()});var hh=y(()=>{Gte()});function k(t,e,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let l=s.prototype,u=Object.keys(l);for(let d=0;dr?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}function Tt(t){return t&&Object.assign(wc,t),wc}var Zte,nM,iM,fi,Ds,wc,xc=y(()=>{nM=Object.freeze({status:"aborted"});iM=Symbol("zod_brand"),fi=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ds=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(Zte=globalThis).__zod_globalConfig??(Zte.__zod_globalConfig={});wc=globalThis.__zod_globalConfig});var M={};Pr(M,{BIGINT_FORMAT_RANGES:()=>pM,Class:()=>sM,NUMBER_FORMAT_RANGES:()=>fM,aborted:()=>Fs,allowsEval:()=>lM,assert:()=>N4e,assertEqual:()=>I4e,assertIs:()=>C4e,assertNever:()=>D4e,assertNotEqual:()=>P4e,assignProp:()=>js,base64ToUint8Array:()=>ere,base64urlToUint8Array:()=>Z4e,cached:()=>Zu,captureStackTrace:()=>i0,cleanEnum:()=>G4e,cleanRegex:()=>_h,clone:()=>nr,cloneDef:()=>M4e,createTransparentProxy:()=>B4e,defineLazy:()=>ve,esc:()=>n0,escapeRegex:()=>Fn,explicitlyAborted:()=>mM,extend:()=>Jte,finalizeIssue:()=>kr,floatSafeRemainder:()=>aM,getElementAtPath:()=>F4e,getEnumValues:()=>yh,getLengthableOrigin:()=>Sh,getParsedType:()=>q4e,getSizableOrigin:()=>vh,hexToUint8Array:()=>W4e,isObject:()=>$c,isPlainObject:()=>Ms,issue:()=>Vu,joinValues:()=>R,jsonStringifyReplacer:()=>Gu,merge:()=>H4e,mergeDefs:()=>zo,normalizeParams:()=>U,nullish:()=>Ns,numKeys:()=>U4e,objectClone:()=>j4e,omit:()=>Kte,optionalKeys:()=>dM,parsedType:()=>j,partial:()=>Xte,pick:()=>Wte,prefixIssues:()=>Br,primitiveTypes:()=>uM,promiseAllObject:()=>L4e,propertyKeyTypes:()=>bh,randomString:()=>z4e,required:()=>Qte,safeExtend:()=>Yte,shallowClone:()=>o0,slugify:()=>cM,stringifyPrimitive:()=>N,uint8ArrayToBase64:()=>tre,uint8ArrayToBase64url:()=>V4e,uint8ArrayToHex:()=>K4e,unwrapMessage:()=>gh});function I4e(t){return t}function P4e(t){return t}function C4e(t){}function D4e(t){throw new Error("Unexpected value in exhaustive check")}function N4e(t){}function yh(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function R(t,e="|"){return t.map(r=>N(r)).join(e)}function Gu(t,e){return typeof e=="bigint"?e.toString():e}function Zu(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ns(t){return t==null}function _h(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function aM(t,e){let r=t/e,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)r?.[n],t):t}function L4e(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;oe};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function B4e(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,o){return e??(e=t()),Reflect.set(e,n,i,o)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function N(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function dM(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function Wte(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=zo(t._zod.def,{get shape(){let s={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(s[a]=r.shape[a])}return js(this,"shape",s),s},checks:[]});return nr(t,o)}function Kte(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=zo(t._zod.def,{get shape(){let s={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete s[a]}return js(this,"shape",s),s},checks:[]});return nr(t,o)}function Jte(t,e){if(!Ms(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let o=t._zod.def.shape;for(let s in e)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=zo(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return js(this,"shape",o),o}});return nr(t,i)}function Yte(t,e){if(!Ms(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=zo(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return js(this,"shape",n),n}});return nr(t,r)}function H4e(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=zo(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return js(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return nr(t,r)}function Xte(t,e,r){let i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=zo(e._zod.def,{get shape(){let a=e._zod.def.shape,c={...a};if(r)for(let l in r){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(c[l]=t?new t({type:"optional",innerType:a[l]}):a[l])}else for(let l in a)c[l]=t?new t({type:"optional",innerType:a[l]}):a[l];return js(this,"shape",c),c},checks:[]});return nr(e,s)}function Qte(t,e,r){let n=zo(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(let s in i)o[s]=new t({type:"nonoptional",innerType:i[s]});return js(this,"shape",o),o}});return nr(e,n)}function Fs(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function gh(t){return typeof t=="string"?t:t?.message}function kr(t,e,r){let n=t.message?t.message:gh(t.inst?._zod.def?.error?.(t))??gh(e?.error?.(t))??gh(r.customError?.(t))??gh(r.localeError?.(t))??"Invalid input",{inst:i,continue:o,input:s,...a}=t;return a.path??(a.path=[]),a.message=n,e?.reportInput&&(a.input=s),a}function vh(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Sh(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function j(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Vu(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function G4e(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function ere(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;ne.toString(16).padStart(2,"0")).join("")}var Vte,i0,lM,q4e,bh,uM,fM,pM,sM,ee=y(()=>{xc();Vte=Symbol("evaluating");i0="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};lM=Zu(()=>{if(wc.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});q4e=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},bh=new Set(["string","number","symbol"]),uM=new Set(["string","number","bigint","boolean","symbol","undefined"]);fM={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},pM={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};sM=class{constructor(...e){}}});function xh(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function $h(t,e=r=>r.message){let r={_errors:[]},n=(i,o=[])=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...o,...s.path]);else{let a=[...o,...s.path];if(a.length===0)r._errors.push(e(s));else{let c=r,l=0;for(;lr.message){let r={errors:[]},n=(i,o=[])=>{var s,a;for(let c of i.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>n({issues:l},[...o,...c.path]));else if(c.code==="invalid_key")n({issues:c.issues},[...o,...c.path]);else if(c.code==="invalid_element")n({issues:c.issues},[...o,...c.path]);else{let l=[...o,...c.path];if(l.length===0){r.errors.push(e(c));continue}let u=r,d=0;for(;dtypeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function gM(t){let e=[],r=[...t.issues].sort((n,i)=>(n.path??[]).length-(i.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${nre(n.path)}`);return e.join(` `)}var rre,wh,Hr,yM=y(()=>{xc();ee();rre=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Gu,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},wh=k("$ZodError",rre),Hr=k("$ZodError",rre,{Parent:Error})});var Wu,kc,Ku,Ec,Ju,Ls,Yu,zs,s0,ire,a0,ore,c0,sre,l0,are,u0,cre,d0,lre,f0,ure,p0,dre,_M=y(()=>{xc();yM();ee();Wu=t=>(e,r,n,i)=>{let o=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new fi;if(s.issues.length){let a=new(i?.Err??t)(s.issues.map(c=>kr(c,o,Tt())));throw i0(a,i?.callee),a}return s.value},kc=Wu(Hr),Ku=t=>async(e,r,n,i)=>{let o=n?{...n,async:!0}:{async:!0},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(i?.Err??t)(s.issues.map(c=>kr(c,o,Tt())));throw i0(a,i?.callee),a}return s.value},Ec=Ku(Hr),Ju=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new fi;return o.issues.length?{success:!1,error:new(t??wh)(o.issues.map(s=>kr(s,i,Tt())))}:{success:!0,data:o.value}},Ls=Ju(Hr),Yu=t=>async(e,r,n)=>{let i=n?{...n,async:!0}:{async:!0},o=e._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(s=>kr(s,i,Tt())))}:{success:!0,data:o.value}},zs=Yu(Hr),s0=t=>(e,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return Wu(t)(e,r,i)},ire=s0(Hr),a0=t=>(e,r,n)=>Wu(t)(e,r,n),ore=a0(Hr),c0=t=>async(e,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return Ku(t)(e,r,i)},sre=c0(Hr),l0=t=>async(e,r,n)=>Ku(t)(e,r,n),are=l0(Hr),u0=t=>(e,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return Ju(t)(e,r,i)},cre=u0(Hr),d0=t=>(e,r,n)=>Ju(t)(e,r,n),lre=d0(Hr),f0=t=>async(e,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return Yu(t)(e,r,i)},ure=f0(Hr),p0=t=>async(e,r,n)=>Yu(t)(e,r,n),dre=p0(Hr)});var Gr={};Pr(Gr,{base64:()=>DM,base64url:()=>m0,bigint:()=>UM,boolean:()=>BM,browserEmail:()=>i6e,cidrv4:()=>PM,cidrv6:()=>CM,cuid:()=>bM,cuid2:()=>vM,date:()=>MM,datetime:()=>LM,domain:()=>a6e,duration:()=>kM,e164:()=>jM,email:()=>AM,emoji:()=>TM,extendedDuration:()=>Y4e,guid:()=>EM,hex:()=>c6e,hostname:()=>s6e,html5Email:()=>t6e,httpProtocol:()=>NM,idnEmail:()=>n6e,integer:()=>qM,ipv4:()=>OM,ipv6:()=>RM,ksuid:()=>xM,lowercase:()=>ZM,mac:()=>IM,md5_base64:()=>u6e,md5_base64url:()=>d6e,md5_hex:()=>l6e,nanoid:()=>$M,null:()=>HM,number:()=>h0,rfc5322Email:()=>r6e,sha1_base64:()=>p6e,sha1_base64url:()=>m6e,sha1_hex:()=>f6e,sha256_base64:()=>g6e,sha256_base64url:()=>y6e,sha256_hex:()=>h6e,sha384_base64:()=>b6e,sha384_base64url:()=>v6e,sha384_hex:()=>_6e,sha512_base64:()=>w6e,sha512_base64url:()=>x6e,sha512_hex:()=>S6e,string:()=>zM,time:()=>FM,ulid:()=>SM,undefined:()=>GM,unicodeEmail:()=>fre,uppercase:()=>VM,uuid:()=>Ac,uuid4:()=>X4e,uuid6:()=>Q4e,uuid7:()=>e6e,xid:()=>wM});function TM(){return new RegExp(o6e,"u")}function mre(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function FM(t){return new RegExp(`^${mre(t)}$`)}function LM(t){let e=mre({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${pre}T(?:${n})$`)}function kh(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function Eh(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var bM,vM,SM,wM,xM,$M,kM,Y4e,EM,Ac,X4e,Q4e,e6e,AM,t6e,r6e,fre,n6e,i6e,o6e,OM,RM,IM,PM,CM,DM,m0,s6e,a6e,NM,jM,pre,MM,zM,UM,qM,h0,BM,HM,GM,ZM,VM,c6e,l6e,u6e,d6e,f6e,p6e,m6e,h6e,g6e,y6e,_6e,b6e,v6e,S6e,w6e,x6e,g0=y(()=>{ee();bM=/^[cC][0-9a-z]{6,}$/,vM=/^[0-9a-z]+$/,SM=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wM=/^[0-9a-vA-V]{20}$/,xM=/^[A-Za-z0-9]{27}$/,$M=/^[a-zA-Z0-9_-]{21}$/,kM=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Y4e=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,EM=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ac=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,X4e=Ac(4),Q4e=Ac(6),e6e=Ac(7),AM=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,t6e=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[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])?)*$/,r6e=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,fre=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,n6e=fre,i6e=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[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])?)*$/,o6e="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";OM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,RM=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,IM=t=>{let e=Fn(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},PM=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,CM=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,DM=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,m0=/^[A-Za-z0-9_-]*$/,s6e=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,a6e=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,NM=/^https?$/,jM=/^\+[1-9]\d{6,14}$/,pre="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",MM=new RegExp(`^${pre}$`);zM=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},UM=/^-?\d+n?$/,qM=/^-?\d+$/,h0=/^-?\d+(?:\.\d+)?$/,BM=/^(?:true|false)$/i,HM=/^null$/i,GM=/^undefined$/i,ZM=/^[^A-Z]*$/,VM=/^[^a-z]*$/,c6e=/^[0-9a-fA-F]*$/;l6e=/^[0-9a-fA-F]{32}$/,u6e=kh(22,"=="),d6e=Eh(22),f6e=/^[0-9a-fA-F]{40}$/,p6e=kh(27,"="),m6e=Eh(27),h6e=/^[0-9a-fA-F]{64}$/,g6e=kh(43,"="),y6e=Eh(43),_6e=/^[0-9a-fA-F]{96}$/,b6e=kh(64,""),v6e=Eh(64),S6e=/^[0-9a-fA-F]{128}$/,w6e=kh(86,"=="),x6e=Eh(86)});function hre(t,e,r){t.issues.length&&e.issues.push(...Br(r,t.issues))}var Qe,gre,y0,_0,WM,KM,JM,YM,XM,QM,eF,tF,rF,Xu,nF,iF,oF,sF,aF,cF,lF,uF,dF,b0=y(()=>{xc();g0();ee();Qe=k("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),gre={number:"number",bigint:"bigint",object:"date"},y0=k("$ZodCheckLessThan",(t,e)=>{Qe.init(t,e);let r=gre[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?n.value<=e.value:n.value{Qe.init(t,e);let r=gre[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),WM=k("$ZodCheckMultipleOf",(t,e)=>{Qe.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):aM(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),KM=k("$ZodCheckNumberFormat",(t,e)=>{Qe.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,o]=fM[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=i,a.maximum=o,r&&(a.pattern=qM)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}ao&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!e.abort})}}),JM=k("$ZodCheckBigIntFormat",(t,e)=>{Qe.init(t,e);let[r,n]=pM[e.format];t._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,o.minimum=r,o.maximum=n}),t._zod.check=i=>{let o=i.value;on&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!e.abort})}}),YM=k("$ZodCheckMaxSize",(t,e)=>{var r;Qe.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Ns(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let i=n.value;i.size<=e.maximum||n.issues.push({origin:vh(i),code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),XM=k("$ZodCheckMinSize",(t,e)=>{var r;Qe.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Ns(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;i.size>=e.minimum||n.issues.push({origin:vh(i),code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),QM=k("$ZodCheckSizeEquals",(t,e)=>{var r;Qe.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Ns(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.size,i.maximum=e.size,i.size=e.size}),t._zod.check=n=>{let i=n.value,o=i.size;if(o===e.size)return;let s=o>e.size;n.issues.push({origin:vh(i),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),eF=k("$ZodCheckMaxLength",(t,e)=>{var r;Qe.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Ns(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let i=n.value;if(i.length<=e.maximum)return;let s=Sh(i);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),tF=k("$ZodCheckMinLength",(t,e)=>{var r;Qe.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Ns(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let s=Sh(i);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),rF=k("$ZodCheckLengthEquals",(t,e)=>{var r;Qe.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!Ns(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{let i=n.value,o=i.length;if(o===e.length)return;let s=Sh(i),a=o>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Xu=k("$ZodCheckStringFormat",(t,e)=>{var r,n;Qe.init(t,e),t._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),nF=k("$ZodCheckRegex",(t,e)=>{Xu.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),iF=k("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=ZM),Xu.init(t,e)}),oF=k("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=VM),Xu.init(t,e)}),sF=k("$ZodCheckIncludes",(t,e)=>{Qe.init(t,e);let r=Fn(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),aF=k("$ZodCheckStartsWith",(t,e)=>{Qe.init(t,e);let r=new RegExp(`^${Fn(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),cF=k("$ZodCheckEndsWith",(t,e)=>{Qe.init(t,e);let r=new RegExp(`.*${Fn(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});lF=k("$ZodCheckProperty",(t,e)=>{Qe.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>hre(i,r,e.property));hre(n,r,e.property)}}),uF=k("$ZodCheckMimeType",(t,e)=>{Qe.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),dF=k("$ZodCheckOverwrite",(t,e)=>{Qe.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var Ah,fF=y(()=>{Ah=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(` `).filter(s=>s),i=Math.min(...n.map(s=>s.length-s.trimStart().length)),o=n.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,r=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new e(...r,i.join(` `))}}});var pF,mF=y(()=>{pF={major:4,minor:4,patch:3}});function vF(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function Pre(t){if(!m0.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return vF(r)}function Cre(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}function _re(t,e,r){t.issues.length&&e.issues.push(...Br(r,t.issues)),e.value[r]=t.value}function x0(t,e,r,n,i,o){let s=r in n;if(t.issues.length){if(i&&o&&!s)return;e.issues.push(...Br(r,t.issues))}if(!s&&!i){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?s&&(e.value[r]=void 0):e.value[r]=t.value}function Dre(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=dM(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function Nre(t,e,r,n,i,o){let s=[],a=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin==="optional",d=c.optout==="optional";for(let f in e){if(f==="__proto__"||a.has(f))continue;if(l==="never"){s.push(f);continue}let p=c.run({value:e[f],issues:[]},n);p instanceof Promise?t.push(p.then(m=>x0(m,r,f,e,u,d))):x0(p,r,f,e,u,d)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:o}),t.length?Promise.all(t).then(()=>r):r}function bre(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;let i=t.filter(o=>!Fs(o));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>kr(s,n,Tt())))}),e)}function vre(t,e,r,n){let i=t.filter(o=>o.issues.length===0);return i.length===1?(e.value=i[0].value,e):(i.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>kr(s,n,Tt())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}function hF(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Ms(t)&&Ms(e)){let r=Object.keys(e),n=Object.keys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(let o of n){let s=hF(t[o],e[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;na.l&&a.r).map(([a])=>a);if(o.length&&i&&t.issues.push({...i,keys:o}),Fs(t))return t;let s=hF(e.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return t.value=s.data,t}function wre(t,e){for(let r=t.length-1;r>=0;r--)if(t[r]._zod[e]!=="optional")return r+1;return 0}function xre(t,e,r){t.issues.length&&e.issues.push(...Br(r,t.issues)),e.value[r]=t.value}function $re(t,e,r,n,i){for(let o=0;o=i){e.value.length=o;break}e.issues.push(...Br(o,s.issues))}e.value[o]=s.value}for(let o=e.value.length-1;o>=n.length&&(r[o]._zod.optout==="optional"&&e.value[o]===void 0);o--)e.value.length=o;return e}function kre(t,e,r,n,i,o,s){t.issues.length&&(bh.has(typeof n)?r.issues.push(...Br(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:o,issues:t.issues.map(a=>kr(a,s,Tt()))})),e.issues.length&&(bh.has(typeof n)?r.issues.push(...Br(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:n,issues:e.issues.map(a=>kr(a,s,Tt()))})),r.value.set(t.value,e.value)}function Ere(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}function Are(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}function Tre(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function Ore(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function v0(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},r)}function S0(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let i=e.transform(t.value,t);return i instanceof Promise?i.then(o=>w0(t,o,e.out,r)):w0(t,i,e.out,r)}else{let i=e.reverseTransform(t.value,t);return i instanceof Promise?i.then(o=>w0(t,o,e.in,r)):w0(t,i,e.in,r)}}function w0(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}function Rre(t){return t.value=Object.freeze(t.value),t}function Ire(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(Vu(i))}}var ue,Us,We,$0,k0,E0,A0,T0,O0,R0,I0,P0,C0,D0,gF,yF,_F,bF,N0,j0,M0,F0,L0,z0,U0,q0,B0,H0,Th,G0,Qu,Oh,Z0,V0,W0,K0,J0,Y0,X0,Q0,e$,t$,r$,SF,ed,n$,i$,o$,Rh,s$,a$,c$,l$,u$,d$,f$,Ih,p$,m$,h$,g$,y$,_$,b$,v$,Ph,td,wF,S$,w$,x$,$$,k$,E$,xF=y(()=>{b0();xc();fF();_M();g0();ee();mF();ee();ue=k("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=pF;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let i of n)for(let o of i._zod.onattach)o(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let i=(s,a,c)=>{let l=Fs(s),u;for(let d of a){if(d._zod.def.when){if(mM(s)||!d._zod.def.when(s))continue}else if(l)continue;let f=s.issues.length,p=d._zod.check(s);if(p instanceof Promise&&c?.async===!1)throw new fi;if(u||p instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await p,s.issues.length!==f&&(l||(l=Fs(s,f)))});else{if(s.issues.length===f)continue;l||(l=Fs(s,f))}}return u?u.then(()=>s):s},o=(s,a,c)=>{if(Fs(s))return s.aborted=!0,s;let l=i(a,n,c);if(l instanceof Promise){if(c.async===!1)throw new fi;return l.then(u=>t._zod.parse(u,c))}return t._zod.parse(l,c)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let l=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(u=>o(u,s,a)):o(l,s,a)}let c=t._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new fi;return c.then(l=>i(l,n,a))}return i(c,n,a)}}ve(t,"~standard",()=>({validate:i=>{try{let o=Ls(t,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return zs(t,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Us=k("$ZodString",(t,e)=>{ue.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??zM(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),We=k("$ZodStringFormat",(t,e)=>{Xu.init(t,e),Us.init(t,e)}),$0=k("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=EM),We.init(t,e)}),k0=k("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Ac(n))}else e.pattern??(e.pattern=Ac());We.init(t,e)}),E0=k("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=AM),We.init(t,e)}),A0=k("$ZodURL",(t,e)=>{We.init(t,e),t._zod.check=r=>{try{let n=r.value.trim();if(!e.normalize&&e.protocol?.source===NM.source&&!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:t,continue:!e.abort});return}let i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),T0=k("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=TM()),We.init(t,e)}),O0=k("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=$M),We.init(t,e)}),R0=k("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=bM),We.init(t,e)}),I0=k("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=vM),We.init(t,e)}),P0=k("$ZodULID",(t,e)=>{e.pattern??(e.pattern=SM),We.init(t,e)}),C0=k("$ZodXID",(t,e)=>{e.pattern??(e.pattern=wM),We.init(t,e)}),D0=k("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=xM),We.init(t,e)}),gF=k("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=LM(e)),We.init(t,e)}),yF=k("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=MM),We.init(t,e)}),_F=k("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=FM(e)),We.init(t,e)}),bF=k("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=kM),We.init(t,e)}),N0=k("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=OM),We.init(t,e),t._zod.bag.format="ipv4"}),j0=k("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=RM),We.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),M0=k("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=IM(e.delimiter)),We.init(t,e),t._zod.bag.format="mac"}),F0=k("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=PM),We.init(t,e)}),L0=k("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=CM),We.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});z0=k("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=DM),We.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{vF(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});U0=k("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=m0),We.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{Pre(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),q0=k("$ZodE164",(t,e)=>{e.pattern??(e.pattern=jM),We.init(t,e)});B0=k("$ZodJWT",(t,e)=>{We.init(t,e),t._zod.check=r=>{Cre(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),H0=k("$ZodCustomStringFormat",(t,e)=>{We.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),Th=k("$ZodNumber",(t,e)=>{ue.init(t,e),t._zod.pattern=t._zod.bag.pattern??h0,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...o?{received:o}:{}}),r}}),G0=k("$ZodNumberFormat",(t,e)=>{KM.init(t,e),Th.init(t,e)}),Qu=k("$ZodBoolean",(t,e)=>{ue.init(t,e),t._zod.pattern=BM,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}}),Oh=k("$ZodBigInt",(t,e)=>{ue.init(t,e),t._zod.pattern=UM,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),Z0=k("$ZodBigIntFormat",(t,e)=>{JM.init(t,e),Oh.init(t,e)}),V0=k("$ZodSymbol",(t,e)=>{ue.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;return typeof i=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:t}),r}}),W0=k("$ZodUndefined",(t,e)=>{ue.init(t,e),t._zod.pattern=GM,t._zod.values=new Set([void 0]),t._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:t}),r}}),K0=k("$ZodNull",(t,e)=>{ue.init(t,e),t._zod.pattern=HM,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),r}}),J0=k("$ZodAny",(t,e)=>{ue.init(t,e),t._zod.parse=r=>r}),Y0=k("$ZodUnknown",(t,e)=>{ue.init(t,e),t._zod.parse=r=>r}),X0=k("$ZodNever",(t,e)=>{ue.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Q0=k("$ZodVoid",(t,e)=>{ue.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:t}),r}}),e$=k("$ZodDate",(t,e)=>{ue.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:t}),r}});t$=k("$ZodArray",(t,e)=>{ue.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),r;r.value=Array(i.length);let o=[];for(let s=0;s_re(l,r,s))):_re(c,r,s)}return o.length?Promise.all(o).then(()=>r):r}});r$=k("$ZodObject",(t,e)=>{if(ue.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=Zu(()=>Dre(e));ve(t._zod,"propValues",()=>{let a=e.shape,c={};for(let l in a){let u=a[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(let d of u.values)c[l].add(d)}}return c});let i=$c,o=e.catchall,s;t._zod.parse=(a,c)=>{s??(s=n.value);let l=a.value;if(!i(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:t}),a;a.value={};let u=[],d=s.shape;for(let f of s.keys){let p=d[f],m=p._zod.optin==="optional",h=p._zod.optout==="optional",g=p._zod.run({value:l[f],issues:[]},c);g instanceof Promise?u.push(g.then(b=>x0(b,a,f,l,m,h))):x0(g,a,f,l,m,h)}return o?Nre(u,l,a,c,n.value,t):u.length?Promise.all(u).then(()=>a):a}}),SF=k("$ZodObjectJIT",(t,e)=>{r$.init(t,e);let r=t._zod.parse,n=Zu(()=>Dre(e)),i=f=>{let p=new Ah(["shape","payload","ctx"]),m=n.value,h=S=>{let x=n0(S);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};p.write("const input = payload.value;");let g=Object.create(null),b=0;for(let S of m.keys)g[S]=`key_${b++}`;p.write("const newResult = {};");for(let S of m.keys){let x=g[S],w=n0(S),O=f[S],T=O?._zod?.optin==="optional",A=O?._zod?.optout==="optional";p.write(`const ${x} = ${h(S)};`),T&&A?p.write(` @@ -420,7 +420,7 @@ new Anthropic({ apiKey, dangerouslyAllowBrowser: true }); `)}p.write("payload.value = newResult;"),p.write("return payload;");let _=p.compile();return(S,x)=>_(f,S,x)},o,s=$c,a=!wc.jitless,l=a&&lM.value,u=e.catchall,d;t._zod.parse=(f,p)=>{d??(d=n.value);let m=f.value;return s(m)?a&&l&&p?.async===!1&&p.jitless!==!0?(o||(o=i(e.shape)),f=o(f,p),u?Nre([],m,f,p,d,t):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),f)}});ed=k("$ZodUnion",(t,e)=>{ue.init(t,e),ve(t._zod,"optin",()=>e.options.some(n=>n._zod.optin==="optional")?"optional":void 0),ve(t._zod,"optout",()=>e.options.some(n=>n._zod.optout==="optional")?"optional":void 0),ve(t._zod,"values",()=>{if(e.options.every(n=>n._zod.values))return new Set(e.options.flatMap(n=>Array.from(n._zod.values)))}),ve(t._zod,"pattern",()=>{if(e.options.every(n=>n._zod.pattern)){let n=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>_h(i.source)).join("|")})$`)}});let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(n,i)=>{if(r)return r(n,i);let o=!1,s=[];for(let a of e.options){let c=a._zod.run({value:n.value,issues:[]},i);if(c instanceof Promise)s.push(c),o=!0;else{if(c.issues.length===0)return c;s.push(c)}}return o?Promise.all(s).then(a=>bre(a,n,t,i)):bre(s,n,t,i)}});n$=k("$ZodXor",(t,e)=>{ed.init(t,e),e.inclusive=!1;let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(n,i)=>{if(r)return r(n,i);let o=!1,s=[];for(let a of e.options){let c=a._zod.run({value:n.value,issues:[]},i);c instanceof Promise?(s.push(c),o=!0):s.push(c)}return o?Promise.all(s).then(a=>vre(a,n,t,i)):vre(s,n,t,i)}}),i$=k("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,ed.init(t,e);let r=t._zod.parse;ve(t._zod,"propValues",()=>{let i={};for(let o of e.options){let s=o._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let[a,c]of Object.entries(s)){i[a]||(i[a]=new Set);for(let l of c)i[a].add(l)}}return i});let n=Zu(()=>{let i=e.options,o=new Map;for(let s of i){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let c of a){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,s)}}return o});t._zod.parse=(i,o)=>{let s=i.value;if(!$c(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),i;let a=n.value.get(s?.[e.discriminator]);return a?a._zod.run(i,o):e.unionFallback||o.direction==="backward"?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(n.value.keys()),input:s,path:[e.discriminator],inst:t}),i)}}),o$=k("$ZodIntersection",(t,e)=>{ue.init(t,e),t._zod.parse=(r,n)=>{let i=r.value,o=e.left._zod.run({value:i,issues:[]},n),s=e.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([c,l])=>Sre(r,c,l)):Sre(r,o,s)}});Rh=k("$ZodTuple",(t,e)=>{ue.init(t,e);let r=e.items;t._zod.parse=(n,i)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({input:o,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let s=[],a=wre(r,"optin"),c=wre(r,"optout");if(!e.rest){if(o.lengthr.length&&n.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:o,inst:t,origin:"array"})}let l=new Array(r.length);for(let u=0;u{l[u]=f})):l[u]=d}if(e.rest){let u=r.length-1,d=o.slice(r.length);for(let f of d){u++;let p=e.rest._zod.run({value:f,issues:[]},i);p instanceof Promise?s.push(p.then(m=>xre(m,n,u))):xre(p,n,u)}}return s.length?Promise.all(s).then(()=>$re(l,n,r,o,c)):$re(l,n,r,o,c)}});s$=k("$ZodRecord",(t,e)=>{ue.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!Ms(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),r;let o=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){a.add(typeof l=="number"?l.toString():l);let u=e.keyType._zod.run({value:l,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(p=>kr(p,n,Tt())),input:l,path:[l],inst:t});continue}let d=u.value,f=e.valueType._zod.run({value:i[l],issues:[]},n);f instanceof Promise?o.push(f.then(p=>{p.issues.length&&r.issues.push(...Br(l,p.issues)),r.value[d]=p.value})):(f.issues.length&&r.issues.push(...Br(l,f.issues)),r.value[d]=f.value)}let c;for(let l in i)a.has(l)||(c=c??[],c.push(l));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(i)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,a))continue;let c=e.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&h0.test(a)&&c.issues.length){let d=e.keyType._zod.run({value:Number(a),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){e.mode==="loose"?r.value[a]=i[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>kr(d,n,Tt())),input:a,path:[a],inst:t});continue}let u=e.valueType._zod.run({value:i[a],issues:[]},n);u instanceof Promise?o.push(u.then(d=>{d.issues.length&&r.issues.push(...Br(a,d.issues)),r.value[c.value]=d.value})):(u.issues.length&&r.issues.push(...Br(a,u.issues)),r.value[c.value]=u.value)}}return o.length?Promise.all(o).then(()=>r):r}}),a$=k("$ZodMap",(t,e)=>{ue.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:t}),r;let o=[];r.value=new Map;for(let[s,a]of i){let c=e.keyType._zod.run({value:s,issues:[]},n),l=e.valueType._zod.run({value:a,issues:[]},n);c instanceof Promise||l instanceof Promise?o.push(Promise.all([c,l]).then(([u,d])=>{kre(u,d,r,s,i,t,n)})):kre(c,l,r,s,i,t,n)}return o.length?Promise.all(o).then(()=>r):r}});c$=k("$ZodSet",(t,e)=>{ue.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:t,expected:"set",code:"invalid_type"}),r;let o=[];r.value=new Set;for(let s of i){let a=e.valueType._zod.run({value:s,issues:[]},n);a instanceof Promise?o.push(a.then(c=>Ere(c,r))):Ere(a,r)}return o.length?Promise.all(o).then(()=>r):r}});l$=k("$ZodEnum",(t,e)=>{ue.init(t,e);let r=yh(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>bh.has(typeof i)).map(i=>typeof i=="string"?Fn(i):i.toString()).join("|")})$`),t._zod.parse=(i,o)=>{let s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),u$=k("$ZodLiteral",(t,e)=>{if(ue.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?Fn(n):n?Fn(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,i)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),n}}),d$=k("$ZodFile",(t,e)=>{ue.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;return i instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:i,inst:t}),r}}),f$=k("$ZodTransform",(t,e)=>{ue.init(t,e),t._zod.optin="optional",t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ds(t.constructor.name);let i=e.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(r.value=s,r.fallback=!0,r));if(i instanceof Promise)throw new fi;return r.value=i,r.fallback=!0,r}});Ih=k("$ZodOptional",(t,e)=>{ue.init(t,e),t._zod.optin="optional",t._zod.optout="optional",ve(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ve(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${_h(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let i=r.value,o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Are(s,i)):Are(o,i)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),p$=k("$ZodExactOptional",(t,e)=>{Ih.init(t,e),ve(t._zod,"values",()=>e.innerType._zod.values),ve(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),m$=k("$ZodNullable",(t,e)=>{ue.init(t,e),ve(t._zod,"optin",()=>e.innerType._zod.optin),ve(t._zod,"optout",()=>e.innerType._zod.optout),ve(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${_h(r.source)}|null)$`):void 0}),ve(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),h$=k("$ZodDefault",(t,e)=>{ue.init(t,e),t._zod.optin="optional",ve(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>Tre(o,e)):Tre(i,e)}});g$=k("$ZodPrefault",(t,e)=>{ue.init(t,e),t._zod.optin="optional",ve(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),y$=k("$ZodNonOptional",(t,e)=>{ue.init(t,e),ve(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>Ore(o,t)):Ore(i,t)}});_$=k("$ZodSuccess",(t,e)=>{ue.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ds("ZodSuccess");let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.issues.length===0,r)):(r.value=i.issues.length===0,r)}}),b$=k("$ZodCatch",(t,e)=>{ue.init(t,e),t._zod.optin="optional",ve(t._zod,"optout",()=>e.innerType._zod.optout),ve(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>kr(s,n,Tt()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(o=>kr(o,n,Tt()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),v$=k("$ZodNaN",(t,e)=>{ue.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),Ph=k("$ZodPipe",(t,e)=>{ue.init(t,e),ve(t._zod,"values",()=>e.in._zod.values),ve(t._zod,"optin",()=>e.in._zod.optin),ve(t._zod,"optout",()=>e.out._zod.optout),ve(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=e.out._zod.run(r,n);return o instanceof Promise?o.then(s=>v0(s,e.in,n)):v0(o,e.in,n)}let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(o=>v0(o,e.out,n)):v0(i,e.out,n)}});td=k("$ZodCodec",(t,e)=>{ue.init(t,e),ve(t._zod,"values",()=>e.in._zod.values),ve(t._zod,"optin",()=>e.in._zod.optin),ve(t._zod,"optout",()=>e.out._zod.optout),ve(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(s=>S0(s,e,n)):S0(o,e,n)}else{let o=e.out._zod.run(r,n);return o instanceof Promise?o.then(s=>S0(s,e,n)):S0(o,e,n)}}});wF=k("$ZodPreprocess",(t,e)=>{Ph.init(t,e)}),S$=k("$ZodReadonly",(t,e)=>{ue.init(t,e),ve(t._zod,"propValues",()=>e.innerType._zod.propValues),ve(t._zod,"values",()=>e.innerType._zod.values),ve(t._zod,"optin",()=>e.innerType?._zod?.optin),ve(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(Rre):Rre(i)}});w$=k("$ZodTemplateLiteral",(t,e)=>{ue.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let i=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!i)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let o=i.startsWith("^")?1:0,s=i.endsWith("$")?i.length-1:i.length;r.push(i.slice(o,s))}else if(n===null||uM.has(typeof n))r.push(Fn(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,i)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"string",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),x$=k("$ZodFunction",(t,e)=>(ue.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let i=t._def.input?kc(t._def.input,n):n,o=Reflect.apply(r,this,i);return t._def.output?kc(t._def.output,o):o}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let i=t._def.input?await Ec(t._def.input,n):n,o=await Reflect.apply(r,this,i);return t._def.output?await Ec(t._def.output,o):o}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Rh({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),$$=k("$ZodPromise",(t,e)=>{ue.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(i=>e.innerType._zod.run({value:i,issues:[]},n))}),k$=k("$ZodLazy",(t,e)=>{ue.init(t,e),ve(t._zod,"innerType",()=>{let r=e;return r._cachedInner||(r._cachedInner=e.getter()),r._cachedInner}),ve(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),ve(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),ve(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),ve(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),E$=k("$ZodCustom",(t,e)=>{Qe.init(t,e),ue.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(o=>Ire(o,r,n,t));Ire(i,r,n,t)}})});function jre(){return{localeError:k6e()}}var k6e,Mre=y(()=>{ee();k6e=()=>{let t={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(i){return t[i]??null}let r={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${i.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`}case"invalid_value":return i.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${N(i.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${i.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${i.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${i.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${i.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${i.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${i.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${i.prefix}"`:o.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${o.suffix}"`:o.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${o.includes}"`:o.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${o.pattern}`:`${r[o.format]??i.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${i.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${i.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${i.keys.length>1?"\u0629":""}: ${R(i.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${i.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${i.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}}});function Fre(){return{localeError:E6e()}}var E6e,Lre=y(()=>{ee();E6e=()=>{let t={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(i){return t[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${i.expected}, daxil olan ${a}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o}, daxil olan ${a}`}case"invalid_value":return i.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${N(i.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${i.origin??"d\u0259y\u0259r"} ${o}${i.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${i.origin??"d\u0259y\u0259r"} ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${i.origin} ${o}${i.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${o.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:o.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${o.suffix}" il\u0259 bitm\u0259lidir`:o.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${o.includes}" daxil olmal\u0131d\u0131r`:o.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${o.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${r[o.format]??i.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${i.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${i.keys.length>1?"lar":""}: ${R(i.keys,", ")}`;case"invalid_key":return`${i.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${i.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}}});function zre(t,e,r,n){let i=Math.abs(t),o=i%10,s=i%100;return s>=11&&s<=19?n:o===1?e:o>=2&&o<=4?r:n}function Ure(){return{localeError:A6e()}}var A6e,qre=y(()=>{ee();A6e=()=>{let t={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(i){return t[i]??null}let r={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},n={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${i.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`}case"invalid_value":return i.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${N(i.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);if(s){let a=Number(i.maximum),c=zre(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${o}${i.maximum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);if(s){let a=Number(i.minimum),c=zre(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${o}${i.minimum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${r[o.format]??i.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${i.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${R(i.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${i.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${i.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}}});function Bre(){return{localeError:T6e()}}var T6e,Hre=y(()=>{ee();T6e=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function e(i){return t[i]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},n={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${i.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${N(i.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${i.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${i.minimum.toString()} ${s.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;if(o.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${o.prefix}"`;if(o.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${o.suffix}"`;if(o.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${o.includes}"`;if(o.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${o.pattern}`;let s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return o.format==="emoji"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="datetime"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="date"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),o.format==="time"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="duration"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${s} ${r[o.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${i.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${i.keys.length>1?"\u043E\u0432\u0435":""}: ${R(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${i.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}}});function Gre(){return{localeError:O6e()}}var O6e,Zre=y(()=>{ee();O6e=()=>{let t={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(i){return t[i]??null}let r={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${i.expected}, s'ha rebut ${a}`:`Tipus inv\xE0lid: s'esperava ${o}, s'ha rebut ${a}`}case"invalid_value":return i.values.length===1?`Valor inv\xE0lid: s'esperava ${N(i.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${R(i.values," o ")}`;case"too_big":{let o=i.inclusive?"com a m\xE0xim":"menys de",s=e(i.origin);return s?`Massa gran: s'esperava que ${i.origin??"el valor"} contingu\xE9s ${o} ${i.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${i.origin??"el valor"} fos ${o} ${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?"com a m\xEDnim":"m\xE9s de",s=e(i.origin);return s?`Massa petit: s'esperava que ${i.origin} contingu\xE9s ${o} ${i.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${i.origin} fos ${o} ${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${o.prefix}"`:o.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${o.suffix}"`:o.format==="includes"?`Format inv\xE0lid: ha d'incloure "${o.includes}"`:o.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${o.pattern}`:`Format inv\xE0lid per a ${r[o.format]??i.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${i.divisor}`;case"unrecognized_keys":return`Clau${i.keys.length>1?"s":""} no reconeguda${i.keys.length>1?"s":""}: ${R(i.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${i.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${i.origin}`;default:return"Entrada inv\xE0lida"}}}});function Vre(){return{localeError:R6e()}}var R6e,Wre=y(()=>{ee();R6e=()=>{let t={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(i){return t[i]??null}let r={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},n={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${i.expected}, obdr\u017Eeno ${a}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o}, obdr\u017Eeno ${a}`}case"invalid_value":return i.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${N(i.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${i.origin??"hodnota"} mus\xED m\xEDt ${o}${i.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${i.origin??"hodnota"} mus\xED b\xFDt ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${i.origin??"hodnota"} mus\xED m\xEDt ${o}${i.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${i.origin??"hodnota"} mus\xED b\xFDt ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${o.prefix}"`:o.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${o.suffix}"`:o.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${o.includes}"`:o.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${o.pattern}`:`Neplatn\xFD form\xE1t ${r[o.format]??i.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${i.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${R(i.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${i.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${i.origin}`;default:return"Neplatn\xFD vstup"}}}});function Kre(){return{localeError:I6e()}}var I6e,Jre=y(()=>{ee();I6e=()=>{let t={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function e(i){return t[i]??null}let r={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},n={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Ugyldigt input: forventede instanceof ${i.expected}, fik ${a}`:`Ugyldigt input: forventede ${o}, fik ${a}`}case"invalid_value":return i.values.length===1?`Ugyldig v\xE6rdi: forventede ${N(i.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin),a=n[i.origin]??i.origin;return s?`For stor: forventede ${a??"value"} ${s.verb} ${o} ${i.maximum.toString()} ${s.unit??"elementer"}`:`For stor: forventede ${a??"value"} havde ${o} ${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin),a=n[i.origin]??i.origin;return s?`For lille: forventede ${a} ${s.verb} ${o} ${i.minimum.toString()} ${s.unit}`:`For lille: forventede ${a} havde ${o} ${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Ugyldig streng: skal starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: skal ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: skal indeholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${r[o.format]??i.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${R(i.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${i.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${i.origin}`;default:return"Ugyldigt input"}}}});function Yre(){return{localeError:P6e()}}var P6e,Xre=y(()=>{ee();P6e=()=>{let t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(i){return t[i]??null}let r={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},n={nan:"NaN",number:"Zahl",array:"Array"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${i.expected}, erhalten ${a}`:`Ung\xFCltige Eingabe: erwartet ${o}, erhalten ${a}`}case"invalid_value":return i.values.length===1?`Ung\xFCltige Eingabe: erwartet ${N(i.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Zu gro\xDF: erwartet, dass ${i.origin??"Wert"} ${o}${i.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${i.origin??"Wert"} ${o}${i.maximum.toString()} ist`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Zu klein: erwartet, dass ${i.origin} ${o}${i.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${i.origin} ${o}${i.minimum.toString()} ist`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Ung\xFCltiger String: muss mit "${o.prefix}" beginnen`:o.format==="ends_with"?`Ung\xFCltiger String: muss mit "${o.suffix}" enden`:o.format==="includes"?`Ung\xFCltiger String: muss "${o.includes}" enthalten`:o.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${o.pattern} entsprechen`:`Ung\xFCltig: ${r[o.format]??i.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${i.divisor} sein`;case"unrecognized_keys":return`${i.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${R(i.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${i.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${i.origin}`;default:return"Ung\xFCltige Eingabe"}}}});function Qre(){return{localeError:C6e()}}var C6e,ene=y(()=>{ee();C6e=()=>{let t={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function e(i){return t[i]??null}let r={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return typeof i.expected=="string"&&/^[A-Z]/.test(i.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${i.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${o}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`}case"invalid_value":return i.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${N(i.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${o}${i.maximum.toString()} ${s.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${o}${i.minimum.toString()} ${s.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${o.prefix}"`:o.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${o.suffix}"`:o.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${o.includes}"`:o.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${o.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${r[o.format]??i.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${i.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${i.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${i.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${R(i.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${i.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${i.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}}});function A$(){return{localeError:D6e()}}var D6e,$F=y(()=>{ee();D6e=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(i){return t[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return`Invalid input: expected ${o}, received ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${N(i.values[0])}`:`Invalid option: expected one of ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Too big: expected ${i.origin??"value"} to have ${o}${i.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Too small: expected ${i.origin} to have ${o}${i.minimum.toString()} ${s.unit}`:`Too small: expected ${i.origin} to be ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${R(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(s=>`'${s}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}}});function tne(){return{localeError:N6e()}}var N6e,rne=y(()=>{ee();N6e=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(i){return t[i]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},n={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${i.expected}, ricevi\u011Dis ${a}`:`Nevalida enigo: atendi\u011Dis ${o}, ricevi\u011Dis ${a}`}case"invalid_value":return i.values.length===1?`Nevalida enigo: atendi\u011Dis ${N(i.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${o}${i.maximum.toString()} ${s.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Tro malgranda: atendi\u011Dis ke ${i.origin} havu ${o}${i.minimum.toString()} ${s.unit}`:`Tro malgranda: atendi\u011Dis ke ${i.origin} estu ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${r[o.format]??i.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${i.divisor}`;case"unrecognized_keys":return`Nekonata${i.keys.length>1?"j":""} \u015Dlosilo${i.keys.length>1?"j":""}: ${R(i.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${i.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${i.origin}`;default:return"Nevalida enigo"}}}});function nne(){return{localeError:j6e()}}var j6e,ine=y(()=>{ee();j6e=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(i){return t[i]??null}let r={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${i.expected}, recibido ${a}`:`Entrada inv\xE1lida: se esperaba ${o}, recibido ${a}`}case"invalid_value":return i.values.length===1?`Entrada inv\xE1lida: se esperaba ${N(i.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin),a=n[i.origin]??i.origin;return s?`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${o}${i.maximum.toString()} ${s.unit??"elementos"}`:`Demasiado grande: se esperaba que ${a??"valor"} fuera ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin),a=n[i.origin]??i.origin;return s?`Demasiado peque\xF1o: se esperaba que ${a} tuviera ${o}${i.minimum.toString()} ${s.unit}`:`Demasiado peque\xF1o: se esperaba que ${a} fuera ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${o.prefix}"`:o.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${o.suffix}"`:o.format==="includes"?`Cadena inv\xE1lida: debe incluir "${o.includes}"`:o.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${o.pattern}`:`Inv\xE1lido ${r[o.format]??i.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${i.divisor}`;case"unrecognized_keys":return`Llave${i.keys.length>1?"s":""} desconocida${i.keys.length>1?"s":""}: ${R(i.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${n[i.origin]??i.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${n[i.origin]??i.origin}`;default:return"Entrada inv\xE1lida"}}}});function one(){return{localeError:M6e()}}var M6e,sne=y(()=>{ee();M6e=()=>{let t={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(i){return t[i]??null}let r={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},n={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${i.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return i.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${N(i.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${R(i.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${i.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${i.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${i.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${i.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${i.origin} \u0628\u0627\u06CC\u062F ${o}${i.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${i.origin} \u0628\u0627\u06CC\u062F ${o}${i.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:o.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:o.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${o.includes}" \u0628\u0627\u0634\u062F`:o.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${o.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${r[o.format]??i.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${i.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${i.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${R(i.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${i.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${i.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}}});function ane(){return{localeError:F6e()}}var F6e,cne=y(()=>{ee();F6e=()=>{let t={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(i){return t[i]??null}let r={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Virheellinen tyyppi: odotettiin instanceof ${i.expected}, oli ${a}`:`Virheellinen tyyppi: odotettiin ${o}, oli ${a}`}case"invalid_value":return i.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${N(i.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${o}${i.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${o}${i.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${o.prefix}"`:o.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${o.suffix}"`:o.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${o.includes}"`:o.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${o.pattern}`:`Virheellinen ${r[o.format]??i.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${i.divisor} monikerta`;case"unrecognized_keys":return`${i.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${R(i.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}}});function lne(){return{localeError:L6e()}}var L6e,une=y(()=>{ee();L6e=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(i){return t[i]??null}let r={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},n={string:"cha\xEEne",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Entr\xE9e invalide : instanceof ${i.expected} attendu, ${a} re\xE7u`:`Entr\xE9e invalide : ${o} attendu, ${a} re\xE7u`}case"invalid_value":return i.values.length===1?`Entr\xE9e invalide : ${N(i.values[0])} attendu`:`Option invalide : une valeur parmi ${R(i.values,"|")} attendue`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Trop grand : ${n[i.origin]??"valeur"} doit ${s.verb} ${o}${i.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${n[i.origin]??"valeur"} doit \xEAtre ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Trop petit : ${n[i.origin]??"valeur"} doit ${s.verb} ${o}${i.minimum.toString()} ${s.unit}`:`Trop petit : ${n[i.origin]??"valeur"} doit \xEAtre ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${o.pattern}`:`${r[o.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${i.divisor}`;case"unrecognized_keys":return`Cl\xE9${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${R(i.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${i.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entr\xE9e invalide"}}}});function dne(){return{localeError:z6e()}}var z6e,fne=y(()=>{ee();z6e=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(i){return t[i]??null}let r={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Entr\xE9e invalide : attendu instanceof ${i.expected}, re\xE7u ${a}`:`Entr\xE9e invalide : attendu ${o}, re\xE7u ${a}`}case"invalid_value":return i.values.length===1?`Entr\xE9e invalide : attendu ${N(i.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"\u2264":"<",s=e(i.origin);return s?`Trop grand : attendu que ${i.origin??"la valeur"} ait ${o}${i.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${i.origin??"la valeur"} soit ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?"\u2265":">",s=e(i.origin);return s?`Trop petit : attendu que ${i.origin} ait ${o}${i.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${i.origin} soit ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${o.pattern}`:`${r[o.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${i.divisor}`;case"unrecognized_keys":return`Cl\xE9${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${R(i.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${i.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entr\xE9e invalide"}}}});function pne(){return{localeError:U6e()}}var U6e,mne=y(()=>{ee();U6e=()=>{let t={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},e={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=l=>l?t[l]:void 0,n=l=>{let u=r(l);return u?u.label:l??t.unknown.label},i=l=>`\u05D4${n(l)}`,o=l=>(r(l)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",s=l=>l?e[l]??null:null,a={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},c={nan:"NaN"};return l=>{switch(l.code){case"invalid_type":{let u=l.expected,d=c[u??""]??n(u),f=j(l.input),p=c[f]??t[f]?.label??f;return/^[A-Z]/.test(l.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${l.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`}case"invalid_value":{if(l.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${N(l.values[0])}`;let u=l.values.map(p=>N(p));if(l.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u[0]} \u05D0\u05D5 ${u[1]}`;let d=u[u.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let u=s(l.origin),d=i(l.origin??"value");if(l.origin==="string")return`${u?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${l.maximum.toString()} ${u?.unit??""} ${l.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(l.origin==="number"){let m=l.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${l.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${l.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(l.origin==="array"||l.origin==="set"){let m=l.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=l.inclusive?`${l.maximum} ${u?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${l.maximum} ${u?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=l.inclusive?"<=":"<",p=o(l.origin??"value");return u?.unit?`${u.longLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${l.maximum.toString()} ${u.unit}`:`${u?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${l.maximum.toString()}`}case"too_small":{let u=s(l.origin),d=i(l.origin??"value");if(l.origin==="string")return`${u?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${l.minimum.toString()} ${u?.unit??""} ${l.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(l.origin==="number"){let m=l.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${l.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${l.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(l.origin==="array"||l.origin==="set"){let m=l.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(l.minimum===1&&l.inclusive){let g=(l.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${g}`}let h=l.inclusive?`${l.minimum} ${u?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${l.minimum} ${u?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=l.inclusive?">=":">",p=o(l.origin??"value");return u?.unit?`${u.shortLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${l.minimum.toString()} ${u.unit}`:`${u?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${l.minimum.toString()}`}case"invalid_format":{let u=l;if(u.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${u.prefix}"`;if(u.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${u.suffix}"`;if(u.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${u.includes}"`;if(u.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${u.pattern}`;let d=a[u.format],f=d?.label??u.format,m=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${f} \u05DC\u05D0 ${m}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${l.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${l.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${l.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${R(l.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${i(l.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}}});function hne(){return{localeError:q6e()}}var q6e,gne=y(()=>{ee();q6e=()=>{let t={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function e(i){return t[i]??null}let r={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},n={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${i.expected}, a primljeno je ${a}`:`Neispravan unos: o\u010Dekuje se ${o}, a primljeno je ${a}`}case"invalid_value":return i.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${N(i.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin),a=n[i.origin]??i.origin;return s?`Preveliko: o\u010Dekivano da ${a??"vrijednost"} ima ${o}${i.maximum.toString()} ${s.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${a??"vrijednost"} bude ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin),a=n[i.origin]??i.origin;return s?`Premalo: o\u010Dekivano da ${a} ima ${o}${i.minimum.toString()} ${s.unit}`:`Premalo: o\u010Dekivano da ${a} bude ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${o.prefix}"`:o.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${o.suffix}"`:o.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${o.includes}"`:o.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${o.pattern}`:`Neispravna ${r[o.format]??i.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${i.divisor}`;case"unrecognized_keys":return`Neprepoznat${i.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${R(i.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${n[i.origin]??i.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${n[i.origin]??i.origin}`;default:return"Neispravan unos"}}}});function yne(){return{localeError:B6e()}}var B6e,_ne=y(()=>{ee();B6e=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(i){return t[i]??null}let r={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},n={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${i.expected}, a kapott \xE9rt\xE9k ${a}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o}, a kapott \xE9rt\xE9k ${a}`}case"invalid_value":return i.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${N(i.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`T\xFAl nagy: ${i.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${o}${i.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${i.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${i.origin} m\xE9rete t\xFAl kicsi ${o}${i.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${i.origin} t\xFAl kicsi ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\xC9rv\xE9nytelen string: "${o.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:o.format==="ends_with"?`\xC9rv\xE9nytelen string: "${o.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:o.format==="includes"?`\xC9rv\xE9nytelen string: "${o.includes}" \xE9rt\xE9ket kell tartalmaznia`:o.format==="regex"?`\xC9rv\xE9nytelen string: ${o.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${r[o.format]??i.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${i.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${i.keys.length>1?"s":""}: ${R(i.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${i.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${i.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}}});function bne(t,e,r){return Math.abs(t)===1?e:r}function rd(t){if(!t)return"";let e=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],r=t[t.length-1];return t+(e.includes(r)?"\u0576":"\u0568")}function vne(){return{localeError:H6e()}}var H6e,Sne=y(()=>{ee();H6e=()=>{let t={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function e(i){return t[i]??null}let r={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},n={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${i.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${o}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`}case"invalid_value":return i.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${N(i.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);if(s){let a=Number(i.maximum),c=bne(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${rd(i.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${i.maximum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${rd(i.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);if(s){let a=Number(i.minimum),c=bne(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${rd(i.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${i.minimum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${rd(i.origin)} \u056C\u056B\u0576\u056B ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${o.prefix}"-\u0578\u057E`:o.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${o.suffix}"-\u0578\u057E`:o.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${o.includes}"`:o.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${o.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${r[o.format]??i.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${i.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${i.keys.length>1?"\u0576\u0565\u0580":""}. ${R(i.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${rd(i.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${rd(i.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}}});function wne(){return{localeError:G6e()}}var G6e,xne=y(()=>{ee();G6e=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(i){return t[i]??null}let r={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Input tidak valid: diharapkan instanceof ${i.expected}, diterima ${a}`:`Input tidak valid: diharapkan ${o}, diterima ${a}`}case"invalid_value":return i.values.length===1?`Input tidak valid: diharapkan ${N(i.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Terlalu besar: diharapkan ${i.origin??"value"} memiliki ${o}${i.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${i.origin??"value"} menjadi ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Terlalu kecil: diharapkan ${i.origin} memiliki ${o}${i.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${i.origin} menjadi ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`String tidak valid: harus dimulai dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak valid: harus berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak valid: harus menyertakan "${o.includes}"`:o.format==="regex"?`String tidak valid: harus sesuai pola ${o.pattern}`:`${r[o.format]??i.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${i.keys.length>1?"s":""}: ${R(i.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${i.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${i.origin}`;default:return"Input tidak valid"}}}});function $ne(){return{localeError:Z6e()}}var Z6e,kne=y(()=>{ee();Z6e=()=>{let t={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function e(i){return t[i]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},n={nan:"NaN",number:"n\xFAmer",array:"fylki"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera instanceof ${i.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera ${o}`}case"invalid_value":return i.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${N(i.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin??"gildi"} hafi ${o}${i.maximum.toString()} ${s.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin??"gildi"} s\xE9 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin} hafi ${o}${i.minimum.toString()} ${s.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin} s\xE9 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${o.prefix}"`:o.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${o.suffix}"`:o.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${o.includes}"`:o.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${o.pattern}`:`Rangt ${r[o.format]??i.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${i.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${i.keys.length>1?"ir lyklar":"ur lykill"}: ${R(i.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${i.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${i.origin}`;default:return"Rangt gildi"}}}});function Ene(){return{localeError:V6e()}}var V6e,Ane=y(()=>{ee();V6e=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(i){return t[i]??null}let r={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"numero",array:"vettore"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Input non valido: atteso instanceof ${i.expected}, ricevuto ${a}`:`Input non valido: atteso ${o}, ricevuto ${a}`}case"invalid_value":return i.values.length===1?`Input non valido: atteso ${N(i.values[0])}`:`Opzione non valida: atteso uno tra ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Troppo grande: ${i.origin??"valore"} deve avere ${o}${i.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${i.origin??"valore"} deve essere ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Troppo piccolo: ${i.origin} deve avere ${o}${i.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${i.origin} deve essere ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Stringa non valida: deve iniziare con "${o.prefix}"`:o.format==="ends_with"?`Stringa non valida: deve terminare con "${o.suffix}"`:o.format==="includes"?`Stringa non valida: deve includere "${o.includes}"`:o.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${o.pattern}`:`Input non valido: ${r[o.format]??i.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${i.divisor}`;case"unrecognized_keys":return`Chiav${i.keys.length>1?"i":"e"} non riconosciut${i.keys.length>1?"e":"a"}: ${R(i.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${i.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${i.origin}`;default:return"Input non valido"}}}});function Tne(){return{localeError:W6e()}}var W6e,One=y(()=>{ee();W6e=()=>{let t={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(i){return t[i]??null}let r={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},n={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${i.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${o}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return i.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${N(i.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${R(i.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let o=i.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=e(i.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${i.origin??"\u5024"}\u306F${i.maximum.toString()}${s.unit??"\u8981\u7D20"}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${i.origin??"\u5024"}\u306F${i.maximum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let o=i.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=e(i.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${i.origin}\u306F${i.minimum.toString()}${s.unit}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${i.origin}\u306F${i.minimum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${o.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${r[o.format]??i.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${i.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${i.keys.length>1?"\u7FA4":""}: ${R(i.keys,"\u3001")}`;case"invalid_key":return`${i.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${i.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}}});function Rne(){return{localeError:K6e()}}var K6e,Ine=y(()=>{ee();K6e=()=>{let t={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function e(i){return t[i]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},n={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${i.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${o}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`}case"invalid_value":return i.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${N(i.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${R(i.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${s.verb} ${o}${i.maximum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin} ${s.verb} ${o}${i.minimum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin} \u10D8\u10E7\u10DD\u10E1 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.prefix}"-\u10D8\u10D7`:o.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.suffix}"-\u10D8\u10D7`:o.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${o.includes}"-\u10E1`:o.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${o.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[o.format]??i.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${i.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${i.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${R(i.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${i.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${i.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}}});function T$(){return{localeError:J6e()}}var J6e,kF=y(()=>{ee();J6e=()=>{let t={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(i){return t[i]??null}let r={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},n={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${i.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`}case"invalid_value":return i.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${N(i.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${i.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin} ${o} ${i.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin} ${o} ${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${o.prefix}"`:o.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${o.suffix}"`:o.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${o.includes}"`:o.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${o.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${r[o.format]??i.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${i.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${R(i.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${i.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${i.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}}});function Pne(){return T$()}var Cne=y(()=>{kF()});function Dne(){return{localeError:Y6e()}}var Y6e,Nne=y(()=>{ee();Y6e=()=>{let t={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(i){return t[i]??null}let r={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${i.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`}case"invalid_value":return i.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${N(i.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${R(i.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let o=i.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=o==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(i.origin),c=a?.unit??"\uC694\uC18C";return a?`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${i.maximum.toString()}${c} ${o}${s}`:`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${i.maximum.toString()} ${o}${s}`}case"too_small":{let o=i.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=o==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(i.origin),c=a?.unit??"\uC694\uC18C";return a?`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${i.minimum.toString()}${c} ${o}${s}`:`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${i.minimum.toString()} ${o}${s}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:o.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${o.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${r[o.format]??i.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${i.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${R(i.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${i.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${i.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}}});function jne(t){let e=Math.abs(t),r=e%10,n=e%100;return n>=11&&n<=19||r===0?"many":r===1?"one":"few"}function Mne(){return{localeError:X6e()}}var Ch,X6e,Fne=y(()=>{ee();Ch=t=>t.charAt(0).toUpperCase()+t.slice(1);X6e=()=>{let t={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function e(i,o,s,a){let c=t[i]??null;return c===null?c:{unit:c.unit[o],verb:c.verb[a][s?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},n={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Gautas tipas ${a}, o tik\u0117tasi - instanceof ${i.expected}`:`Gautas tipas ${a}, o tik\u0117tasi - ${o}`}case"invalid_value":return i.values.length===1?`Privalo b\u016Bti ${N(i.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${R(i.values,"|")} pasirinkim\u0173`;case"too_big":{let o=n[i.origin]??i.origin,s=e(i.origin,jne(Number(i.maximum)),i.inclusive??!1,"smaller");if(s?.verb)return`${Ch(o??i.origin??"reik\u0161m\u0117")} ${s.verb} ${i.maximum.toString()} ${s.unit??"element\u0173"}`;let a=i.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${Ch(o??i.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${i.maximum.toString()} ${s?.unit}`}case"too_small":{let o=n[i.origin]??i.origin,s=e(i.origin,jne(Number(i.minimum)),i.inclusive??!1,"bigger");if(s?.verb)return`${Ch(o??i.origin??"reik\u0161m\u0117")} ${s.verb} ${i.minimum.toString()} ${s.unit??"element\u0173"}`;let a=i.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${Ch(o??i.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${i.minimum.toString()} ${s?.unit}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${o.prefix}"`:o.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${o.includes}"`:o.format==="regex"?`Eilut\u0117 privalo atitikti ${o.pattern}`:`Neteisingas ${r[o.format]??i.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${i.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${i.keys.length>1?"i":"as"} rakt${i.keys.length>1?"ai":"as"}: ${R(i.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let o=n[i.origin]??i.origin;return`${Ch(o??i.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}}});function Lne(){return{localeError:Q6e()}}var Q6e,zne=y(()=>{ee();Q6e=()=>{let t={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(i){return t[i]??null}let r={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},n={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${i.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${N(i.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${o}${i.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin} \u0434\u0430 \u0438\u043C\u0430 ${o}${i.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${o.pattern}`:`Invalid ${r[o.format]??i.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${R(i.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${i.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${i.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}}});function Une(){return{localeError:eBe()}}var eBe,qne=y(()=>{ee();eBe=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(i){return t[i]??null}let r={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"nombor"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Input tidak sah: dijangka instanceof ${i.expected}, diterima ${a}`:`Input tidak sah: dijangka ${o}, diterima ${a}`}case"invalid_value":return i.values.length===1?`Input tidak sah: dijangka ${N(i.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Terlalu besar: dijangka ${i.origin??"nilai"} ${s.verb} ${o}${i.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${i.origin??"nilai"} adalah ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Terlalu kecil: dijangka ${i.origin} ${s.verb} ${o}${i.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${i.origin} adalah ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`String tidak sah: mesti bermula dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak sah: mesti mengandungi "${o.includes}"`:o.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${o.pattern}`:`${r[o.format]??i.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${R(i.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${i.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${i.origin}`;default:return"Input tidak sah"}}}});function Bne(){return{localeError:tBe()}}var tBe,Hne=y(()=>{ee();tBe=()=>{let t={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function e(i){return t[i]??null}let r={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},n={nan:"NaN",number:"getal"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Ongeldige invoer: verwacht instanceof ${i.expected}, ontving ${a}`:`Ongeldige invoer: verwacht ${o}, ontving ${a}`}case"invalid_value":return i.values.length===1?`Ongeldige invoer: verwacht ${N(i.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin),a=i.origin==="date"?"laat":i.origin==="string"?"lang":"groot";return s?`Te ${a}: verwacht dat ${i.origin??"waarde"} ${o}${i.maximum.toString()} ${s.unit??"elementen"} ${s.verb}`:`Te ${a}: verwacht dat ${i.origin??"waarde"} ${o}${i.maximum.toString()} is`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin),a=i.origin==="date"?"vroeg":i.origin==="string"?"kort":"klein";return s?`Te ${a}: verwacht dat ${i.origin} ${o}${i.minimum.toString()} ${s.unit} ${s.verb}`:`Te ${a}: verwacht dat ${i.origin} ${o}${i.minimum.toString()} is`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Ongeldige tekst: moet met "${o.prefix}" beginnen`:o.format==="ends_with"?`Ongeldige tekst: moet op "${o.suffix}" eindigen`:o.format==="includes"?`Ongeldige tekst: moet "${o.includes}" bevatten`:o.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`:`Ongeldig: ${r[o.format]??i.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${i.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${i.keys.length>1?"s":""}: ${R(i.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${i.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${i.origin}`;default:return"Ongeldige invoer"}}}});function Gne(){return{localeError:rBe()}}var rBe,Zne=y(()=>{ee();rBe=()=>{let t={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(i){return t[i]??null}let r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"tall",array:"liste"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Ugyldig input: forventet instanceof ${i.expected}, fikk ${a}`:`Ugyldig input: forventet ${o}, fikk ${a}`}case"invalid_value":return i.values.length===1?`Ugyldig verdi: forventet ${N(i.values[0])}`:`Ugyldig valg: forventet en av ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`For stor(t): forventet ${i.origin??"value"} til \xE5 ha ${o}${i.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${i.origin??"value"} til \xE5 ha ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`For lite(n): forventet ${i.origin} til \xE5 ha ${o}${i.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${i.origin} til \xE5 ha ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${r[o.format]??i.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${R(i.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${i.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${i.origin}`;default:return"Ugyldig input"}}}});function Vne(){return{localeError:nBe()}}var nBe,Wne=y(()=>{ee();nBe=()=>{let t={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(i){return t[i]??null}let r={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},n={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`F\xE2sit giren: umulan instanceof ${i.expected}, al\u0131nan ${a}`:`F\xE2sit giren: umulan ${o}, al\u0131nan ${a}`}case"invalid_value":return i.values.length===1?`F\xE2sit giren: umulan ${N(i.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Fazla b\xFCy\xFCk: ${i.origin??"value"}, ${o}${i.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${i.origin??"value"}, ${o}${i.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Fazla k\xFC\xE7\xFCk: ${i.origin}, ${o}${i.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${i.origin}, ${o}${i.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let o=i;return o.format==="starts_with"?`F\xE2sit metin: "${o.prefix}" ile ba\u015Flamal\u0131.`:o.format==="ends_with"?`F\xE2sit metin: "${o.suffix}" ile bitmeli.`:o.format==="includes"?`F\xE2sit metin: "${o.includes}" ihtiv\xE2 etmeli.`:o.format==="regex"?`F\xE2sit metin: ${o.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${r[o.format]??i.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${i.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${i.keys.length>1?"s":""}: ${R(i.keys,", ")}`;case"invalid_key":return`${i.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${i.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}}});function Kne(){return{localeError:iBe()}}var iBe,Jne=y(()=>{ee();iBe=()=>{let t={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(i){return t[i]??null}let r={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},n={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${i.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return i.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${N(i.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${R(i.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${i.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${i.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${i.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${i.maximum.toString()} \u0648\u064A`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${i.origin} \u0628\u0627\u06CC\u062F ${o}${i.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${i.origin} \u0628\u0627\u06CC\u062F ${o}${i.minimum.toString()} \u0648\u064A`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:o.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:o.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${o.includes}" \u0648\u0644\u0631\u064A`:o.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${o.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${r[o.format]??i.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${i.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${i.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${R(i.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${i.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${i.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}}});function Yne(){return{localeError:oBe()}}var oBe,Xne=y(()=>{ee();oBe=()=>{let t={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(i){return t[i]??null}let r={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},n={nan:"NaN",number:"liczba",array:"tablica"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${i.expected}, otrzymano ${a}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o}, otrzymano ${a}`}case"invalid_value":return i.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${N(i.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${i.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${i.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${o.prefix}"`:o.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${o.suffix}"`:o.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${o.includes}"`:o.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${o.pattern}`:`Nieprawid\u0142ow(y/a/e) ${r[o.format]??i.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${i.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${i.keys.length>1?"s":""}: ${R(i.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${i.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${i.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}}});function Qne(){return{localeError:sBe()}}var sBe,eie=y(()=>{ee();sBe=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(i){return t[i]??null}let r={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN",number:"n\xFAmero",null:"nulo"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Tipo inv\xE1lido: esperado instanceof ${i.expected}, recebido ${a}`:`Tipo inv\xE1lido: esperado ${o}, recebido ${a}`}case"invalid_value":return i.values.length===1?`Entrada inv\xE1lida: esperado ${N(i.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Muito grande: esperado que ${i.origin??"valor"} tivesse ${o}${i.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${i.origin??"valor"} fosse ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Muito pequeno: esperado que ${i.origin} tivesse ${o}${i.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${i.origin} fosse ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${o.prefix}"`:o.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${o.suffix}"`:o.format==="includes"?`Texto inv\xE1lido: deve incluir "${o.includes}"`:o.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${o.pattern}`:`${r[o.format]??i.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${i.divisor}`;case"unrecognized_keys":return`Chave${i.keys.length>1?"s":""} desconhecida${i.keys.length>1?"s":""}: ${R(i.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${i.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${i.origin}`;default:return"Campo inv\xE1lido"}}}});function tie(){return{localeError:aBe()}}var aBe,rie=y(()=>{ee();aBe=()=>{let t={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function e(i){return t[i]??null}let r={regex:"intrare",email:"adres\u0103 de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",jwt:"JWT",template_literal:"intrare"},n={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return`Intrare invalid\u0103: a\u0219teptat ${o}, primit ${a}`}case"invalid_value":return i.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${N(i.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Prea mare: a\u0219teptat ca ${i.origin??"valoarea"} ${s.verb} ${o}${i.maximum.toString()} ${s.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${i.origin??"valoarea"} s\u0103 fie ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Prea mic: a\u0219teptat ca ${i.origin} ${s.verb} ${o}${i.minimum.toString()} ${s.unit}`:`Prea mic: a\u0219teptat ca ${i.origin} s\u0103 fie ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${o.prefix}"`:o.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${o.suffix}"`:o.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${o.includes}"`:o.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${o.pattern}`:`Format invalid: ${r[o.format]??i.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${i.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${R(i.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${i.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${i.origin}`;default:return"Intrare invalid\u0103"}}}});function nie(t,e,r,n){let i=Math.abs(t),o=i%10,s=i%100;return s>=11&&s<=19?n:o===1?e:o>=2&&o<=4?r:n}function iie(){return{localeError:cBe()}}var cBe,oie=y(()=>{ee();cBe=()=>{let t={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(i){return t[i]??null}let r={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},n={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${i.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${N(i.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);if(s){let a=Number(i.maximum),c=nie(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${i.maximum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);if(s){let a=Number(i.minimum),c=nie(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${i.minimum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin} \u0431\u0443\u0434\u0435\u0442 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${r[o.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${i.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${i.keys.length>1?"\u0438":""}: ${R(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${i.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}}});function sie(){return{localeError:lBe()}}var lBe,aie=y(()=>{ee();lBe=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(i){return t[i]??null}let r={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},n={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${i.expected}, prejeto ${a}`:`Neveljaven vnos: pri\u010Dakovano ${o}, prejeto ${a}`}case"invalid_value":return i.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${N(i.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${i.origin??"vrednost"} imelo ${o}${i.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${i.origin??"vrednost"} ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${i.origin} imelo ${o}${i.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${o.prefix}"`:o.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${o.suffix}"`:o.format==="includes"?`Neveljaven niz: mora vsebovati "${o.includes}"`:o.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`:`Neveljaven ${r[o.format]??i.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${i.divisor}`;case"unrecognized_keys":return`Neprepoznan${i.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${R(i.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${i.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${i.origin}`;default:return"Neveljaven vnos"}}}});function cie(){return{localeError:uBe()}}var uBe,lie=y(()=>{ee();uBe=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(i){return t[i]??null}let r={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},n={nan:"NaN",number:"antal",array:"lista"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${i.expected}, fick ${a}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${o}, fick ${a}`}case"invalid_value":return i.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${N(i.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${o}${i.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${i.origin??"v\xE4rdet"} att ha ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${o}${i.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${o.prefix}"`:o.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${o.suffix}"`:o.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${o.includes}"`:o.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${o.pattern}"`:`Ogiltig(t) ${r[o.format]??i.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${R(i.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${i.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${i.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}}});function uie(){return{localeError:dBe()}}var dBe,die=y(()=>{ee();dBe=()=>{let t={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(i){return t[i]??null}let r={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${i.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`}case"invalid_value":return i.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${N(i.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${R(i.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${i.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${i.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin} ${o}${i.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin} ${o}${i.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${o.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${r[o.format]??i.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${i.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${i.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${R(i.keys,", ")}`;case"invalid_key":return`${i.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${i.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}}});function fie(){return{localeError:fBe()}}var fBe,pie=y(()=>{ee();fBe=()=>{let t={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(i){return t[i]??null}let r={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},n={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${i.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`}case"invalid_value":return i.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${N(i.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=e(i.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${i.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=e(i.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${i.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${o.prefix}"`:o.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${o.suffix}"`:o.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${o.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:o.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${o.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${r[o.format]??i.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${i.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${R(i.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${i.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${i.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}}});function mie(){return{localeError:pBe()}}var pBe,hie=y(()=>{ee();pBe=()=>{let t={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(i){return t[i]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${i.expected}, al\u0131nan ${a}`:`Ge\xE7ersiz de\u011Fer: beklenen ${o}, al\u0131nan ${a}`}case"invalid_value":return i.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${N(i.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${o}${i.maximum.toString()} ${s.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${o}${i.minimum.toString()} ${s.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[o.format]??i.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${i.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${i.keys.length>1?"lar":""}: ${R(i.keys,", ")}`;case"invalid_key":return`${i.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${i.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}}});function O$(){return{localeError:mBe()}}var mBe,EF=y(()=>{ee();mBe=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(i){return t[i]??null}let r={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},n={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${i.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${N(i.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${o}${i.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin} ${s.verb} ${o}${i.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin} \u0431\u0443\u0434\u0435 ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${r[o.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${i.keys.length>1?"\u0456":""}: ${R(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${i.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}}});function gie(){return O$()}var yie=y(()=>{EF()});function _ie(){return{localeError:hBe()}}var hBe,bie=y(()=>{ee();hBe=()=>{let t={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(i){return t[i]??null}let r={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},n={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${i.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return i.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${N(i.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${R(i.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${i.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${o}${i.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${i.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${o}${i.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${i.origin} \u06A9\u06D2 ${o}${i.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${i.origin} \u06A9\u0627 ${o}${i.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${o.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${r[o.format]??i.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${i.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${i.keys.length>1?"\u0632":""}: ${R(i.keys,"\u060C ")}`;case"invalid_key":return`${i.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${i.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}}});function vie(){return{localeError:gBe()}}var gBe,Sie=y(()=>{ee();gBe=()=>{let t={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function e(i){return t[i]??null}let r={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},n={nan:"NaN",number:"raqam",array:"massiv"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${i.expected}, qabul qilingan ${a}`:`Noto\u2018g\u2018ri kirish: kutilgan ${o}, qabul qilingan ${a}`}case"invalid_value":return i.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${N(i.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Juda katta: kutilgan ${i.origin??"qiymat"} ${o}${i.maximum.toString()} ${s.unit} ${s.verb}`:`Juda katta: kutilgan ${i.origin??"qiymat"} ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Juda kichik: kutilgan ${i.origin} ${o}${i.minimum.toString()} ${s.unit} ${s.verb}`:`Juda kichik: kutilgan ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${o.prefix}" bilan boshlanishi kerak`:o.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${o.suffix}" bilan tugashi kerak`:o.format==="includes"?`Noto\u2018g\u2018ri satr: "${o.includes}" ni o\u2018z ichiga olishi kerak`:o.format==="regex"?`Noto\u2018g\u2018ri satr: ${o.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${r[o.format]??i.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${i.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${i.keys.length>1?"lar":""}: ${R(i.keys,", ")}`;case"invalid_key":return`${i.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${i.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}}});function wie(){return{localeError:yBe()}}var yBe,xie=y(()=>{ee();yBe=()=>{let t={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(i){return t[i]??null}let r={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},n={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${i.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`}case"invalid_value":return i.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${N(i.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${i.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${o}${i.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${i.origin??"gi\xE1 tr\u1ECB"} ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${i.origin} ${s.verb} ${o}${i.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${o.prefix}"`:o.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${o.suffix}"`:o.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${o.includes}"`:o.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${o.pattern}`:`${r[o.format]??i.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${i.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${R(i.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${i.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${i.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}}});function $ie(){return{localeError:_Be()}}var _Be,kie=y(()=>{ee();_Be=()=>{let t={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(i){return t[i]??null}let r={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},n={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${i.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`}case"invalid_value":return i.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${N(i.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${i.origin??"\u503C"} ${o}${i.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${i.origin??"\u503C"} ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${i.origin} ${o}${i.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.prefix}" \u5F00\u5934`:o.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.suffix}" \u7ED3\u5C3E`:o.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${o.pattern}`:`\u65E0\u6548${r[o.format]??i.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${i.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${R(i.keys,", ")}`;case"invalid_key":return`${i.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${i.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}}});function Eie(){return{localeError:bBe()}}var bBe,Aie=y(()=>{ee();bBe=()=>{let t={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(i){return t[i]??null}let r={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${i.expected}\uFF0C\u4F46\u6536\u5230 ${a}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o}\uFF0C\u4F46\u6536\u5230 ${a}`}case"invalid_value":return i.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${N(i.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${i.origin??"\u503C"} \u61C9\u70BA ${o}${i.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${i.origin??"\u503C"} \u61C9\u70BA ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${i.origin} \u61C9\u70BA ${o}${i.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${i.origin} \u61C9\u70BA ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.prefix}" \u958B\u982D`:o.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.suffix}" \u7D50\u5C3E`:o.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${o.pattern}`:`\u7121\u6548\u7684 ${r[o.format]??i.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${i.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${i.keys.length>1?"\u5011":""}\uFF1A${R(i.keys,"\u3001")}`;case"invalid_key":return`${i.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${i.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}}});function Tie(){return{localeError:vBe()}}var vBe,Oie=y(()=>{ee();vBe=()=>{let t={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function e(i){return t[i]??null}let r={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},n={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,s=j(i.input),a=n[s]??s;return/^[A-Z]/.test(i.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${i.expected}, \xE0m\u1ECD\u0300 a r\xED ${a}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${o}, \xE0m\u1ECD\u0300 a r\xED ${a}`}case"invalid_value":return i.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${N(i.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${R(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",s=e(i.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${i.origin??"iye"} ${s.verb} ${o}${i.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${i.maximum}`}case"too_small":{let o=i.inclusive?">=":">",s=e(i.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${i.origin} ${s.verb} ${o}${i.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${i.minimum}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${o.prefix}"`:o.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${o.suffix}"`:o.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${o.includes}"`:o.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${o.pattern}`:`A\u1E63\xEC\u1E63e: ${r[o.format]??i.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${i.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${R(i.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${i.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${i.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}}});var nd={};Pr(nd,{ar:()=>jre,az:()=>Fre,be:()=>Ure,bg:()=>Bre,ca:()=>Gre,cs:()=>Vre,da:()=>Kre,de:()=>Yre,el:()=>Qre,en:()=>A$,eo:()=>tne,es:()=>nne,fa:()=>one,fi:()=>ane,fr:()=>lne,frCA:()=>dne,he:()=>pne,hr:()=>hne,hu:()=>yne,hy:()=>vne,id:()=>wne,is:()=>$ne,it:()=>Ene,ja:()=>Tne,ka:()=>Rne,kh:()=>Pne,km:()=>T$,ko:()=>Dne,lt:()=>Mne,mk:()=>Lne,ms:()=>Une,nl:()=>Bne,no:()=>Gne,ota:()=>Vne,pl:()=>Yne,ps:()=>Kne,pt:()=>Qne,ro:()=>tie,ru:()=>iie,sl:()=>sie,sv:()=>cie,ta:()=>uie,th:()=>fie,tr:()=>mie,ua:()=>gie,uk:()=>O$,ur:()=>_ie,uz:()=>vie,vi:()=>wie,yo:()=>Tie,zhCN:()=>$ie,zhTW:()=>Eie});var R$=y(()=>{Mre();Lre();qre();Hre();Zre();Wre();Jre();Xre();ene();$F();rne();ine();sne();cne();une();fne();mne();gne();_ne();Sne();xne();kne();Ane();One();Ine();Cne();kF();Nne();Fne();zne();qne();Hne();Zne();Wne();Jne();Xne();eie();rie();oie();aie();lie();die();pie();hie();yie();EF();bie();Sie();xie();kie();Aie();Oie()});function P$(){return new I$}var Rie,AF,TF,I$,ir,Dh=y(()=>{AF=Symbol("ZodOutput"),TF=Symbol("ZodInput"),I$=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};(Rie=globalThis).__zod_globalRegistry??(Rie.__zod_globalRegistry=P$());ir=globalThis.__zod_globalRegistry});function C$(t,e){return new t({type:"string",...U(e)})}function OF(t,e){return new t({type:"string",coerce:!0,...U(e)})}function Nh(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...U(e)})}function id(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...U(e)})}function jh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...U(e)})}function Mh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...U(e)})}function Fh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...U(e)})}function Lh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...U(e)})}function od(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...U(e)})}function zh(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...U(e)})}function Uh(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...U(e)})}function qh(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...U(e)})}function Bh(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...U(e)})}function Hh(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...U(e)})}function Gh(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...U(e)})}function Zh(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...U(e)})}function Vh(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...U(e)})}function Wh(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...U(e)})}function D$(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...U(e)})}function Kh(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...U(e)})}function Jh(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...U(e)})}function Yh(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...U(e)})}function Xh(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...U(e)})}function Qh(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...U(e)})}function eg(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...U(e)})}function IF(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...U(e)})}function PF(t,e){return new t({type:"string",format:"date",check:"string_format",...U(e)})}function CF(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...U(e)})}function DF(t,e){return new t({type:"string",format:"duration",check:"string_format",...U(e)})}function N$(t,e){return new t({type:"number",checks:[],...U(e)})}function NF(t,e){return new t({type:"number",coerce:!0,checks:[],...U(e)})}function j$(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...U(e)})}function M$(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...U(e)})}function F$(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...U(e)})}function L$(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...U(e)})}function z$(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...U(e)})}function U$(t,e){return new t({type:"boolean",...U(e)})}function jF(t,e){return new t({type:"boolean",coerce:!0,...U(e)})}function q$(t,e){return new t({type:"bigint",...U(e)})}function MF(t,e){return new t({type:"bigint",coerce:!0,...U(e)})}function B$(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...U(e)})}function H$(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...U(e)})}function G$(t,e){return new t({type:"symbol",...U(e)})}function Z$(t,e){return new t({type:"undefined",...U(e)})}function V$(t,e){return new t({type:"null",...U(e)})}function W$(t){return new t({type:"any"})}function K$(t){return new t({type:"unknown"})}function J$(t,e){return new t({type:"never",...U(e)})}function Y$(t,e){return new t({type:"void",...U(e)})}function X$(t,e){return new t({type:"date",...U(e)})}function FF(t,e){return new t({type:"date",coerce:!0,...U(e)})}function Q$(t,e){return new t({type:"nan",...U(e)})}function Xi(t,e){return new y0({check:"less_than",...U(e),value:t,inclusive:!1})}function Sn(t,e){return new y0({check:"less_than",...U(e),value:t,inclusive:!0})}function Qi(t,e){return new _0({check:"greater_than",...U(e),value:t,inclusive:!1})}function Er(t,e){return new _0({check:"greater_than",...U(e),value:t,inclusive:!0})}function ek(t){return Qi(0,t)}function tk(t){return Xi(0,t)}function rk(t){return Sn(0,t)}function nk(t){return Er(0,t)}function qs(t,e){return new WM({check:"multiple_of",...U(e),value:t})}function Bs(t,e){return new YM({check:"max_size",...U(e),maximum:t})}function eo(t,e){return new XM({check:"min_size",...U(e),minimum:t})}function Tc(t,e){return new QM({check:"size_equals",...U(e),size:t})}function Oc(t,e){return new eF({check:"max_length",...U(e),maximum:t})}function Uo(t,e){return new tF({check:"min_length",...U(e),minimum:t})}function Rc(t,e){return new rF({check:"length_equals",...U(e),length:t})}function sd(t,e){return new nF({check:"string_format",format:"regex",...U(e),pattern:t})}function ad(t){return new iF({check:"string_format",format:"lowercase",...U(t)})}function cd(t){return new oF({check:"string_format",format:"uppercase",...U(t)})}function ld(t,e){return new sF({check:"string_format",format:"includes",...U(e),includes:t})}function ud(t,e){return new aF({check:"string_format",format:"starts_with",...U(e),prefix:t})}function dd(t,e){return new cF({check:"string_format",format:"ends_with",...U(e),suffix:t})}function ik(t,e,r){return new lF({check:"property",property:t,schema:e,...U(r)})}function fd(t,e){return new uF({check:"mime_type",mime:t,...U(e)})}function pi(t){return new dF({check:"overwrite",tx:t})}function pd(t){return pi(e=>e.normalize(t))}function md(){return pi(t=>t.trim())}function hd(){return pi(t=>t.toLowerCase())}function gd(){return pi(t=>t.toUpperCase())}function yd(){return pi(t=>cM(t))}function LF(t,e,r){return new t({type:"array",element:e,...U(r)})}function wBe(t,e,r){return new t({type:"union",options:e,...U(r)})}function xBe(t,e,r){return new t({type:"union",options:e,inclusive:!1,...U(r)})}function $Be(t,e,r,n){return new t({type:"union",options:r,discriminator:e,...U(n)})}function kBe(t,e,r){return new t({type:"intersection",left:e,right:r})}function EBe(t,e,r,n){let i=r instanceof ue,o=i?n:r,s=i?r:null;return new t({type:"tuple",items:e,rest:s,...U(o)})}function ABe(t,e,r,n){return new t({type:"record",keyType:e,valueType:r,...U(n)})}function TBe(t,e,r,n){return new t({type:"map",keyType:e,valueType:r,...U(n)})}function OBe(t,e,r){return new t({type:"set",valueType:e,...U(r)})}function RBe(t,e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new t({type:"enum",entries:n,...U(r)})}function IBe(t,e,r){return new t({type:"enum",entries:e,...U(r)})}function PBe(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...U(r)})}function ok(t,e){return new t({type:"file",...U(e)})}function CBe(t,e){return new t({type:"transform",transform:e})}function DBe(t,e){return new t({type:"optional",innerType:e})}function NBe(t,e){return new t({type:"nullable",innerType:e})}function jBe(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():o0(r)}})}function MBe(t,e,r){return new t({type:"nonoptional",innerType:e,...U(r)})}function FBe(t,e){return new t({type:"success",innerType:e})}function LBe(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function zBe(t,e,r){return new t({type:"pipe",in:e,out:r})}function UBe(t,e){return new t({type:"readonly",innerType:e})}function qBe(t,e,r){return new t({type:"template_literal",parts:e,...U(r)})}function BBe(t,e){return new t({type:"lazy",getter:e})}function HBe(t,e){return new t({type:"promise",innerType:e})}function sk(t,e,r){let n=U(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function ak(t,e,r){return new t({type:"custom",check:"custom",fn:e,...U(r)})}function ck(t,e){let r=Iie(n=>(n.addIssue=i=>{if(typeof i=="string")n.issues.push(Vu(i,n.value,r._zod.def));else{let o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),n.issues.push(Vu(o))}},t(n.value,n)),e);return r}function Iie(t,e){let r=new Qe({check:"custom",...U(e)});return r._zod.check=t,r}function lk(t){let e=new Qe({check:"describe"});return e._zod.onattach=[r=>{let n=ir.get(r)??{};ir.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function uk(t){let e=new Qe({check:"meta"});return e._zod.onattach=[r=>{let n=ir.get(r)??{};ir.add(r,{...n,...t})}],e._zod.check=()=>{},e}function dk(t,e){let r=U(e),n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),i=i.map(p=>typeof p=="string"?p.toLowerCase():p));let o=new Set(n),s=new Set(i),a=t.Codec??td,c=t.Boolean??Qu,l=t.String??Us,u=new l({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new a({type:"pipe",in:u,out:d,transform:((p,m)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),o.has(h)?!0:s.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...s],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((p,m)=>p===!0?n[0]||"true":i[0]||"false"),error:r.error});return f}function Ic(t,e,r,n={}){let i=U(n),o={...U(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:a=>r.test(a),...i};return r instanceof RegExp&&(o.pattern=r),new t(o)}var RF,Pie=y(()=>{b0();Dh();xF();ee();RF={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function Hs(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??ir,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function Ve(t,e,r={path:[],schemaPath:[]}){var n;let i=t._zod.def,o=e.seen.get(t);if(o)return o.count++,r.schemaPath.includes(t)&&(o.cycle=r.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,s);let a=t._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,s.schema,u);else{let f=s.schema,p=e.processors[i.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);p(t,e,f,u)}let d=t._zod.parent;d&&(s.ref||(s.ref=d),Ve(d,e,u),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(s.schema,c),e.io==="input"&&Ar(t)&&(delete s.schema.examples,delete s.schema.default),e.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,e.seen.get(t).schema}function Gs(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let s of t.seen.entries()){let a=t.metadataRegistry.get(s[0])?.id;if(a){let c=n.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,s[0])}}let i=s=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(s[0])?.id,f=t.external.uri??(m=>m);if(d)return{ref:f(d)};let p=s[1].defId??s[1].schema.id??`schema${t.counter++}`;return s[1].defId=p,{defId:p,ref:`${f("__shared")}#/${a}/${p}`}}if(s[1]===r)return{ref:"#"};let l=`#/${a}/`,u=s[1].schema.id??`__schema${t.counter++}`;return{defId:u,ref:l+u}},o=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=i(s);a.def={...a.schema},l&&(a.defId=l);let u=a.schema;for(let d in u)delete u[d];u.$ref=c};if(t.cycles==="throw")for(let s of t.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/ -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of t.seen.entries()){let a=s[1];if(e===s[0]){o(s);continue}if(t.external){let l=t.external.registry.get(s[0])?.id;if(e!==s[0]&&l){o(s);continue}}if(t.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&t.reused==="ref"){o(s);continue}}}function Zs(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=t.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){n(d);let p=t.seen.get(d),m=p.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(m)):Object.assign(l,m),Object.assign(l,u),a._zod.parent===d)for(let g in l)g==="$ref"||g==="allOf"||g in u||delete l[g];if(m.$ref&&p.def)for(let g in l)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(l[g])===JSON.stringify(p.def[g])&&delete l[g]}let f=a._zod.parent;if(f&&f!==d){n(f);let p=t.seen.get(f);if(p?.schema.$ref&&(l.$ref=p.schema.$ref,p.def))for(let m in l)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(l[m])===JSON.stringify(p.def[m])&&delete l[m]}t.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};for(let a of[...t.seen.entries()].reverse())n(a[0]);let i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(a)}Object.assign(i,r.def??r.schema);let o=t.metadataRegistry.get(e)?.id;o!==void 0&&i.id===o&&delete i.id;let s=t.external?.defs??{};for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,s[c.defId]=c.def)}t.external||Object.keys(s).length>0&&(t.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:_d(e,"input",t.processors),output:_d(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ar(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ar(n.element,r);if(n.type==="set")return Ar(n.valueType,r);if(n.type==="lazy")return Ar(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Ar(n.innerType,r);if(n.type==="intersection")return Ar(n.left,r)||Ar(n.right,r);if(n.type==="record"||n.type==="map")return Ar(n.keyType,r)||Ar(n.valueType,r);if(n.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:Ar(n.in,r)||Ar(n.out,r);if(n.type==="object"){for(let i in n.shape)if(Ar(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(Ar(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(Ar(i,r))return!0;return!!(n.rest&&Ar(n.rest,r))}return!1}var zF,_d,tg=y(()=>{Dh();zF=(t,e={})=>r=>{let n=Hs({...r,processors:e});return Ve(t,n),Gs(n,t),Zs(n,t)},_d=(t,e,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},s=Hs({...i??{},target:o,io:e,processors:r});return Ve(t,s),Gs(s,t),Zs(s,t)}});function Pc(t,e){if("_idmap"in t){let n=t,i=Hs({...e,processors:fk}),o={};for(let c of n._idmap.entries()){let[l,u]=c;Ve(u,i)}let s={},a={registry:n,uri:e?.uri,defs:o};i.external=a;for(let c of n._idmap.entries()){let[l,u]=c;Gs(i,u),s[l]=Zs(i,u)}if(Object.keys(o).length>0){let c=i.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:o}}return{schemas:s}}let r=Hs({...e,processors:fk});return Ve(t,r),Gs(r,t),Zs(r,t)}var GBe,UF,qF,BF,HF,GF,ZF,VF,WF,KF,JF,YF,XF,QF,eL,tL,rL,nL,iL,oL,sL,aL,cL,lL,uL,dL,pk,fL,pL,mL,hL,gL,yL,_L,bL,vL,SL,wL,mk,xL,fk,bd=y(()=>{tg();ee();GBe={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},UF=(t,e,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:l}=t._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof s=="number"&&(i.maxLength=s),a&&(i.format=GBe[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let u=[...c];u.length===1?i.pattern=u[0].source:u.length>1&&(i.allOf=[...u.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},qF=(t,e,r,n)=>{let i=r,{minimum:o,maximum:s,format:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=t._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";let d=typeof u=="number"&&u>=(o??Number.NEGATIVE_INFINITY),f=typeof l=="number"&&l<=(s??Number.POSITIVE_INFINITY),p=e.target==="draft-04"||e.target==="openapi-3.0";d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof o=="number"&&(i.minimum=o),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof s=="number"&&(i.maximum=s),typeof c=="number"&&(i.multipleOf=c)},BF=(t,e,r,n)=>{r.type="boolean"},HF=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},GF=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},ZF=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},VF=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},WF=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},KF=(t,e,r,n)=>{r.not={}},JF=(t,e,r,n)=>{},YF=(t,e,r,n)=>{},XF=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},QF=(t,e,r,n)=>{let i=t._zod.def,o=yh(i.entries);o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),r.enum=o},eL=(t,e,r,n)=>{let i=t._zod.def,o=[];for(let s of i.values)if(s===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];r.type=s===null?"null":typeof s,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[s]:r.const=s}else o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),o.every(s=>typeof s=="boolean")&&(r.type="boolean"),o.every(s=>s===null)&&(r.type="null"),r.enum=o},tL=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},rL=(t,e,r,n)=>{let i=r,o=t._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},nL=(t,e,r,n)=>{let i=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:c}=t._zod.bag;s!==void 0&&(o.minLength=s),a!==void 0&&(o.maxLength=a),c?c.length===1?(o.contentMediaType=c[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=c.map(l=>({contentMediaType:l}))):Object.assign(i,o)},iL=(t,e,r,n)=>{r.type="boolean"},oL=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},sL=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},aL=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},cL=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},lL=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},uL=(t,e,r,n)=>{let i=r,o=t._zod.def,{minimum:s,maximum:a}=t._zod.bag;typeof s=="number"&&(i.minItems=s),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=Ve(o.element,e,{...n,path:[...n.path,"items"]})},dL=(t,e,r,n)=>{let i=r,o=t._zod.def;i.type="object",i.properties={};let s=o.shape;for(let l in s)i.properties[l]=Ve(s[l],e,{...n,path:[...n.path,"properties",l]});let a=new Set(Object.keys(s)),c=new Set([...a].filter(l=>{let u=o.shape[l]._zod;return e.io==="input"?u.optin===void 0:u.optout===void 0}));c.size>0&&(i.required=Array.from(c)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=Ve(o.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},pk=(t,e,r,n)=>{let i=t._zod.def,o=i.inclusive===!1,s=i.options.map((a,c)=>Ve(a,e,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=s:r.anyOf=s},fL=(t,e,r,n)=>{let i=t._zod.def,o=Ve(i.left,e,{...n,path:[...n.path,"allOf",0]}),s=Ve(i.right,e,{...n,path:[...n.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];r.allOf=c},pL=(t,e,r,n)=>{let i=r,o=t._zod.def;i.type="array";let s=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((f,p)=>Ve(f,e,{...n,path:[...n.path,s,p]})),l=o.rest?Ve(o.rest,e,{...n,path:[...n.path,a,...e.target==="openapi-3.0"?[o.items.length]:[]]}):null;e.target==="draft-2020-12"?(i.prefixItems=c,l&&(i.items=l)):e.target==="openapi-3.0"?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=t._zod.bag;typeof u=="number"&&(i.minItems=u),typeof d=="number"&&(i.maxItems=d)},mL=(t,e,r,n)=>{let i=r,o=t._zod.def;i.type="object";let s=o.keyType,c=s._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){let u=Ve(o.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let d of c)i.patternProperties[d.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=Ve(o.keyType,e,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=Ve(o.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let l=s._zod.values;if(l){let u=[...l].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(i.required=u)}},hL=(t,e,r,n)=>{let i=t._zod.def,o=Ve(i.innerType,e,n),s=e.seen.get(t);e.target==="openapi-3.0"?(s.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},gL=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType},yL=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},_L=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},bL=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},vL=(t,e,r,n)=>{let i=t._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s=e.io==="input"?o?i.out:i.in:i.out;Ve(s,e,n);let a=e.seen.get(t);a.ref=s},SL=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType,r.readOnly=!0},wL=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType},mk=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType},xL=(t,e,r,n)=>{let i=t._zod.innerType;Ve(i,e,n);let o=e.seen.get(t);o.ref=i},fk={string:UF,number:qF,boolean:BF,bigint:HF,symbol:GF,null:ZF,undefined:VF,void:WF,never:KF,any:JF,unknown:YF,date:XF,enum:QF,literal:eL,nan:tL,template_literal:rL,file:nL,success:iL,custom:oL,function:sL,transform:aL,map:cL,set:lL,array:uL,object:dL,union:pk,intersection:fL,tuple:pL,record:mL,nullable:hL,nonoptional:gL,default:yL,prefault:_L,catch:bL,pipe:vL,readonly:SL,promise:wL,optional:mk,lazy:xL}});var hk,Cie=y(()=>{bd();tg();hk=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let r=e?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Hs({processors:fk,target:r,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,r={path:[],schemaPath:[]}){return Ve(e,this.ctx,r)}emit(e,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),Gs(this.ctx,e);let n=Zs(this.ctx,e),{"~standard":i,...o}=n;return o}}});var Die={};var Nie=y(()=>{});var mi={};Pr(mi,{$ZodAny:()=>J0,$ZodArray:()=>t$,$ZodAsyncError:()=>fi,$ZodBase64:()=>z0,$ZodBase64URL:()=>U0,$ZodBigInt:()=>Oh,$ZodBigIntFormat:()=>Z0,$ZodBoolean:()=>Qu,$ZodCIDRv4:()=>F0,$ZodCIDRv6:()=>L0,$ZodCUID:()=>R0,$ZodCUID2:()=>I0,$ZodCatch:()=>b$,$ZodCheck:()=>Qe,$ZodCheckBigIntFormat:()=>JM,$ZodCheckEndsWith:()=>cF,$ZodCheckGreaterThan:()=>_0,$ZodCheckIncludes:()=>sF,$ZodCheckLengthEquals:()=>rF,$ZodCheckLessThan:()=>y0,$ZodCheckLowerCase:()=>iF,$ZodCheckMaxLength:()=>eF,$ZodCheckMaxSize:()=>YM,$ZodCheckMimeType:()=>uF,$ZodCheckMinLength:()=>tF,$ZodCheckMinSize:()=>XM,$ZodCheckMultipleOf:()=>WM,$ZodCheckNumberFormat:()=>KM,$ZodCheckOverwrite:()=>dF,$ZodCheckProperty:()=>lF,$ZodCheckRegex:()=>nF,$ZodCheckSizeEquals:()=>QM,$ZodCheckStartsWith:()=>aF,$ZodCheckStringFormat:()=>Xu,$ZodCheckUpperCase:()=>oF,$ZodCodec:()=>td,$ZodCustom:()=>E$,$ZodCustomStringFormat:()=>H0,$ZodDate:()=>e$,$ZodDefault:()=>h$,$ZodDiscriminatedUnion:()=>i$,$ZodE164:()=>q0,$ZodEmail:()=>E0,$ZodEmoji:()=>T0,$ZodEncodeError:()=>Ds,$ZodEnum:()=>l$,$ZodError:()=>wh,$ZodExactOptional:()=>p$,$ZodFile:()=>d$,$ZodFunction:()=>x$,$ZodGUID:()=>$0,$ZodIPv4:()=>N0,$ZodIPv6:()=>j0,$ZodISODate:()=>yF,$ZodISODateTime:()=>gF,$ZodISODuration:()=>bF,$ZodISOTime:()=>_F,$ZodIntersection:()=>o$,$ZodJWT:()=>B0,$ZodKSUID:()=>D0,$ZodLazy:()=>k$,$ZodLiteral:()=>u$,$ZodMAC:()=>M0,$ZodMap:()=>a$,$ZodNaN:()=>v$,$ZodNanoID:()=>O0,$ZodNever:()=>X0,$ZodNonOptional:()=>y$,$ZodNull:()=>K0,$ZodNullable:()=>m$,$ZodNumber:()=>Th,$ZodNumberFormat:()=>G0,$ZodObject:()=>r$,$ZodObjectJIT:()=>SF,$ZodOptional:()=>Ih,$ZodPipe:()=>Ph,$ZodPrefault:()=>g$,$ZodPreprocess:()=>wF,$ZodPromise:()=>$$,$ZodReadonly:()=>S$,$ZodRealError:()=>Hr,$ZodRecord:()=>s$,$ZodRegistry:()=>I$,$ZodSet:()=>c$,$ZodString:()=>Us,$ZodStringFormat:()=>We,$ZodSuccess:()=>_$,$ZodSymbol:()=>V0,$ZodTemplateLiteral:()=>w$,$ZodTransform:()=>f$,$ZodTuple:()=>Rh,$ZodType:()=>ue,$ZodULID:()=>P0,$ZodURL:()=>A0,$ZodUUID:()=>k0,$ZodUndefined:()=>W0,$ZodUnion:()=>ed,$ZodUnknown:()=>Y0,$ZodVoid:()=>Q0,$ZodXID:()=>C0,$ZodXor:()=>n$,$brand:()=>iM,$constructor:()=>k,$input:()=>TF,$output:()=>AF,Doc:()=>Ah,JSONSchema:()=>Die,JSONSchemaGenerator:()=>hk,NEVER:()=>nM,TimePrecision:()=>RF,_any:()=>W$,_array:()=>LF,_base64:()=>Yh,_base64url:()=>Xh,_bigint:()=>q$,_boolean:()=>U$,_catch:()=>LBe,_check:()=>Iie,_cidrv4:()=>Kh,_cidrv6:()=>Jh,_coercedBigint:()=>MF,_coercedBoolean:()=>jF,_coercedDate:()=>FF,_coercedNumber:()=>NF,_coercedString:()=>OF,_cuid:()=>qh,_cuid2:()=>Bh,_custom:()=>sk,_date:()=>X$,_decode:()=>a0,_decodeAsync:()=>l0,_default:()=>jBe,_discriminatedUnion:()=>$Be,_e164:()=>Qh,_email:()=>Nh,_emoji:()=>zh,_encode:()=>s0,_encodeAsync:()=>c0,_endsWith:()=>dd,_enum:()=>RBe,_file:()=>ok,_float32:()=>M$,_float64:()=>F$,_gt:()=>Qi,_gte:()=>Er,_guid:()=>id,_includes:()=>ld,_int:()=>j$,_int32:()=>L$,_int64:()=>B$,_intersection:()=>kBe,_ipv4:()=>Vh,_ipv6:()=>Wh,_isoDate:()=>PF,_isoDateTime:()=>IF,_isoDuration:()=>DF,_isoTime:()=>CF,_jwt:()=>eg,_ksuid:()=>Zh,_lazy:()=>BBe,_length:()=>Rc,_literal:()=>PBe,_lowercase:()=>ad,_lt:()=>Xi,_lte:()=>Sn,_mac:()=>D$,_map:()=>TBe,_max:()=>Sn,_maxLength:()=>Oc,_maxSize:()=>Bs,_mime:()=>fd,_min:()=>Er,_minLength:()=>Uo,_minSize:()=>eo,_multipleOf:()=>qs,_nan:()=>Q$,_nanoid:()=>Uh,_nativeEnum:()=>IBe,_negative:()=>tk,_never:()=>J$,_nonnegative:()=>nk,_nonoptional:()=>MBe,_nonpositive:()=>rk,_normalize:()=>pd,_null:()=>V$,_nullable:()=>NBe,_number:()=>N$,_optional:()=>DBe,_overwrite:()=>pi,_parse:()=>Wu,_parseAsync:()=>Ku,_pipe:()=>zBe,_positive:()=>ek,_promise:()=>HBe,_property:()=>ik,_readonly:()=>UBe,_record:()=>ABe,_refine:()=>ak,_regex:()=>sd,_safeDecode:()=>d0,_safeDecodeAsync:()=>p0,_safeEncode:()=>u0,_safeEncodeAsync:()=>f0,_safeParse:()=>Ju,_safeParseAsync:()=>Yu,_set:()=>OBe,_size:()=>Tc,_slugify:()=>yd,_startsWith:()=>ud,_string:()=>C$,_stringFormat:()=>Ic,_stringbool:()=>dk,_success:()=>FBe,_superRefine:()=>ck,_symbol:()=>G$,_templateLiteral:()=>qBe,_toLowerCase:()=>hd,_toUpperCase:()=>gd,_transform:()=>CBe,_trim:()=>md,_tuple:()=>EBe,_uint32:()=>z$,_uint64:()=>H$,_ulid:()=>Hh,_undefined:()=>Z$,_union:()=>wBe,_unknown:()=>K$,_uppercase:()=>cd,_url:()=>od,_uuid:()=>jh,_uuidv4:()=>Mh,_uuidv6:()=>Fh,_uuidv7:()=>Lh,_void:()=>Y$,_xid:()=>Gh,_xor:()=>xBe,clone:()=>nr,config:()=>Tt,createStandardJSONSchemaMethod:()=>_d,createToJSONSchemaMethod:()=>zF,decode:()=>ore,decodeAsync:()=>are,describe:()=>lk,encode:()=>ire,encodeAsync:()=>sre,extractDefs:()=>Gs,finalize:()=>Zs,flattenError:()=>xh,formatError:()=>$h,globalConfig:()=>wc,globalRegistry:()=>ir,initializeContext:()=>Hs,isValidBase64:()=>vF,isValidBase64URL:()=>Pre,isValidJWT:()=>Cre,locales:()=>nd,meta:()=>uk,parse:()=>kc,parseAsync:()=>Ec,prettifyError:()=>gM,process:()=>Ve,regexes:()=>Gr,registry:()=>P$,safeDecode:()=>lre,safeDecodeAsync:()=>dre,safeEncode:()=>cre,safeEncodeAsync:()=>ure,safeParse:()=>Ls,safeParseAsync:()=>zs,toDotPath:()=>nre,toJSONSchema:()=>Pc,treeifyError:()=>hM,util:()=>M,version:()=>pF});var mr=y(()=>{xc();_M();yM();xF();b0();mF();ee();g0();R$();Dh();fF();Pie();tg();bd();Cie();Nie()});var $L=y(()=>{mr()});function kL(t,e){let r={type:"object",shape:t??{},...U(e)};return new KBe(r)}var WBe,KBe,jie=y(()=>{mr();ee();$L();WBe=k("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");ue.init(t,e),t.def=e,t.type=e.type,t.parse=(r,n)=>kc(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Ls(t,r,n),t.parseAsync=async(r,n)=>Ec(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>zs(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),t.with=t.check,t.clone=(r,n)=>nr(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.apply=r=>r(t)}),KBe=k("ZodMiniObject",(t,e)=>{r$.init(t,e),WBe.init(t,e),ve(t,"shape",()=>e.shape)})});var Mie=y(()=>{});var Fie=y(()=>{});var Lie=y(()=>{});var zie=y(()=>{mr();$L();jie();Mie();bd();R$();Fie();Lie()});var EL=y(()=>{zie()});function Ln(t){return!!t._zod}function Cc(t){let e=Object.values(t);if(e.length===0)return kL({});let r=e.every(Ln),n=e.every(i=>!Ln(i));if(r)return kL(t);if(n)return Bte(t);throw new Error("Mixed Zod versions detected in object shape.")}function Vs(t,e){return Ln(t)?Ls(t,e):t.safeParse(e)}async function gk(t,e){return Ln(t)?await zs(t,e):await t.safeParseAsync(e)}function Ws(t){if(!t)return;let e;if(Ln(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function vd(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let n=Object.values(t);if(n.length>0&&n.every(i=>typeof i=="object"&&i!==null&&(i._def!==void 0||i._zod!==void 0||typeof i.parse=="function")))return Cc(t)}}if(Ln(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function yk(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function qie(t){return t.description}function Bie(t){if(Ln(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function _k(t){if(Ln(t)){let o=t._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var rg=y(()=>{hh();EL()});var bk={};Pr(bk,{endsWith:()=>dd,gt:()=>Qi,gte:()=>Er,includes:()=>ld,length:()=>Rc,lowercase:()=>ad,lt:()=>Xi,lte:()=>Sn,maxLength:()=>Oc,maxSize:()=>Bs,mime:()=>fd,minLength:()=>Uo,minSize:()=>eo,multipleOf:()=>qs,negative:()=>tk,nonnegative:()=>nk,nonpositive:()=>rk,normalize:()=>pd,overwrite:()=>pi,positive:()=>ek,property:()=>ik,regex:()=>sd,size:()=>Tc,slugify:()=>yd,startsWith:()=>ud,toLowerCase:()=>hd,toUpperCase:()=>gd,trim:()=>md,uppercase:()=>cd});var vk=y(()=>{mr()});var Ks={};Pr(Ks,{ZodISODate:()=>wk,ZodISODateTime:()=>Sk,ZodISODuration:()=>$k,ZodISOTime:()=>xk,date:()=>TL,datetime:()=>AL,duration:()=>RL,time:()=>OL});function AL(t){return IF(Sk,t)}function TL(t){return PF(wk,t)}function OL(t){return CF(xk,t)}function RL(t){return DF($k,t)}var Sk,wk,xk,$k,ng=y(()=>{mr();og();Sk=k("ZodISODateTime",(t,e)=>{gF.init(t,e),et.init(t,e)});wk=k("ZodISODate",(t,e)=>{yF.init(t,e),et.init(t,e)});xk=k("ZodISOTime",(t,e)=>{_F.init(t,e),et.init(t,e)});$k=k("ZodISODuration",(t,e)=>{bF.init(t,e),et.init(t,e)})});var Hie,XBe,Zr,IL=y(()=>{mr();mr();ee();Hie=(t,e)=>{wh.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>$h(t,r)},flatten:{value:r=>xh(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Gu,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Gu,2)}},isEmpty:{get(){return t.issues.length===0}}})},XBe=k("ZodError",Hie),Zr=k("ZodError",Hie,{Parent:Error})});var PL,CL,DL,NL,jL,ML,FL,LL,zL,UL,qL,BL,HL=y(()=>{mr();IL();PL=Wu(Zr),CL=Ku(Zr),DL=Ju(Zr),NL=Yu(Zr),jL=s0(Zr),ML=a0(Zr),FL=c0(Zr),LL=l0(Zr),zL=u0(Zr),UL=d0(Zr),qL=f0(Zr),BL=p0(Zr)});var ig={};Pr(ig,{ZodAny:()=>KL,ZodArray:()=>QL,ZodBase64:()=>zk,ZodBase64URL:()=>Uk,ZodBigInt:()=>Ad,ZodBigIntFormat:()=>Hk,ZodBoolean:()=>Ed,ZodCIDRv4:()=>Fk,ZodCIDRv6:()=>Lk,ZodCUID:()=>Ik,ZodCUID2:()=>Pk,ZodCatch:()=>bz,ZodCodec:()=>gg,ZodCustom:()=>yg,ZodCustomStringFormat:()=>$d,ZodDate:()=>dg,ZodDefault:()=>pz,ZodDiscriminatedUnion:()=>tz,ZodE164:()=>qk,ZodEmail:()=>Tk,ZodEmoji:()=>Ok,ZodEnum:()=>wd,ZodExactOptional:()=>uz,ZodFile:()=>cz,ZodFunction:()=>Oz,ZodGUID:()=>sg,ZodIPv4:()=>jk,ZodIPv6:()=>Mk,ZodIntersection:()=>rz,ZodJWT:()=>Bk,ZodKSUID:()=>Nk,ZodLazy:()=>Ez,ZodLiteral:()=>az,ZodMAC:()=>GL,ZodMap:()=>oz,ZodNaN:()=>Sz,ZodNanoID:()=>Rk,ZodNever:()=>YL,ZodNonOptional:()=>Vk,ZodNull:()=>WL,ZodNullable:()=>fz,ZodNumber:()=>kd,ZodNumberFormat:()=>Dc,ZodObject:()=>fg,ZodOptional:()=>Od,ZodPipe:()=>hg,ZodPrefault:()=>hz,ZodPreprocess:()=>wz,ZodPromise:()=>Tz,ZodReadonly:()=>xz,ZodRecord:()=>Sd,ZodSet:()=>sz,ZodString:()=>xd,ZodStringFormat:()=>et,ZodSuccess:()=>_z,ZodSymbol:()=>ZL,ZodTemplateLiteral:()=>kz,ZodTransform:()=>lz,ZodTuple:()=>nz,ZodType:()=>_e,ZodULID:()=>Ck,ZodURL:()=>lg,ZodUUID:()=>to,ZodUndefined:()=>VL,ZodUnion:()=>pg,ZodUnknown:()=>JL,ZodVoid:()=>XL,ZodXID:()=>Dk,ZodXor:()=>ez,_ZodString:()=>Ak,_default:()=>mz,_function:()=>Woe,any:()=>Ooe,array:()=>ke,base64:()=>foe,base64url:()=>poe,bigint:()=>$oe,boolean:()=>It,catch:()=>vz,check:()=>Koe,cidrv4:()=>uoe,cidrv6:()=>doe,codec:()=>Hoe,cuid:()=>roe,cuid2:()=>noe,custom:()=>Wk,date:()=>Ioe,describe:()=>Joe,discriminatedUnion:()=>mg,e164:()=>moe,email:()=>Zie,emoji:()=>eoe,enum:()=>sr,exactOptional:()=>dz,file:()=>zoe,float32:()=>voe,float64:()=>Soe,function:()=>Woe,guid:()=>Vie,hash:()=>boe,hex:()=>_oe,hostname:()=>yoe,httpUrl:()=>Qie,instanceof:()=>Xoe,int:()=>kk,int32:()=>woe,int64:()=>koe,intersection:()=>Td,invertCodec:()=>Goe,ipv4:()=>aoe,ipv6:()=>loe,json:()=>ese,jwt:()=>hoe,keyof:()=>Poe,ksuid:()=>soe,lazy:()=>Az,literal:()=>re,looseObject:()=>or,looseRecord:()=>joe,mac:()=>coe,map:()=>Moe,meta:()=>Yoe,nan:()=>Boe,nanoid:()=>toe,nativeEnum:()=>Loe,never:()=>Gk,nonoptional:()=>yz,null:()=>ug,nullable:()=>ag,nullish:()=>Uoe,number:()=>Me,object:()=>W,optional:()=>at,partialRecord:()=>Noe,pipe:()=>Ek,prefault:()=>gz,preprocess:()=>_g,promise:()=>Voe,readonly:()=>$z,record:()=>Ke,refine:()=>Rz,set:()=>Foe,strictObject:()=>Coe,string:()=>I,stringFormat:()=>goe,stringbool:()=>Qoe,success:()=>qoe,superRefine:()=>Iz,symbol:()=>Aoe,templateLiteral:()=>Zoe,transform:()=>Zk,tuple:()=>iz,uint32:()=>xoe,uint64:()=>Eoe,ulid:()=>ioe,undefined:()=>Toe,union:()=>rt,unknown:()=>tt,url:()=>Xie,uuid:()=>Wie,uuidv4:()=>Kie,uuidv6:()=>Jie,uuidv7:()=>Yie,void:()=>Roe,xid:()=>ooe,xor:()=>Doe});function cg(t,e,r){let n=Object.getPrototypeOf(t),i=Gie.get(n);if(i||(i=new Set,Gie.set(n,i)),!i.has(e)){i.add(e);for(let o in r){let s=r[o];Object.defineProperty(n,o,{configurable:!0,enumerable:!1,get(){let a=s.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}function I(t){return C$(xd,t)}function Zie(t){return Nh(Tk,t)}function Vie(t){return id(sg,t)}function Wie(t){return jh(to,t)}function Kie(t){return Mh(to,t)}function Jie(t){return Fh(to,t)}function Yie(t){return Lh(to,t)}function Xie(t){return od(lg,t)}function Qie(t){return od(lg,{protocol:Gr.httpProtocol,hostname:Gr.domain,...M.normalizeParams(t)})}function eoe(t){return zh(Ok,t)}function toe(t){return Uh(Rk,t)}function roe(t){return qh(Ik,t)}function noe(t){return Bh(Pk,t)}function ioe(t){return Hh(Ck,t)}function ooe(t){return Gh(Dk,t)}function soe(t){return Zh(Nk,t)}function aoe(t){return Vh(jk,t)}function coe(t){return D$(GL,t)}function loe(t){return Wh(Mk,t)}function uoe(t){return Kh(Fk,t)}function doe(t){return Jh(Lk,t)}function foe(t){return Yh(zk,t)}function poe(t){return Xh(Uk,t)}function moe(t){return Qh(qk,t)}function hoe(t){return eg(Bk,t)}function goe(t,e,r={}){return Ic($d,t,e,r)}function yoe(t){return Ic($d,"hostname",Gr.hostname,t)}function _oe(t){return Ic($d,"hex",Gr.hex,t)}function boe(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,i=Gr[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return Ic($d,n,i,e)}function Me(t){return N$(kd,t)}function kk(t){return j$(Dc,t)}function voe(t){return M$(Dc,t)}function Soe(t){return F$(Dc,t)}function woe(t){return L$(Dc,t)}function xoe(t){return z$(Dc,t)}function It(t){return U$(Ed,t)}function $oe(t){return q$(Ad,t)}function koe(t){return B$(Hk,t)}function Eoe(t){return H$(Hk,t)}function Aoe(t){return G$(ZL,t)}function Toe(t){return Z$(VL,t)}function ug(t){return V$(WL,t)}function Ooe(){return W$(KL)}function tt(){return K$(JL)}function Gk(t){return J$(YL,t)}function Roe(t){return Y$(XL,t)}function Ioe(t){return X$(dg,t)}function ke(t,e){return LF(QL,t,e)}function Poe(t){let e=t._zod.def.shape;return sr(Object.keys(e))}function W(t,e){let r={type:"object",shape:t??{},...M.normalizeParams(e)};return new fg(r)}function Coe(t,e){return new fg({type:"object",shape:t,catchall:Gk(),...M.normalizeParams(e)})}function or(t,e){return new fg({type:"object",shape:t,catchall:tt(),...M.normalizeParams(e)})}function rt(t,e){return new pg({type:"union",options:t,...M.normalizeParams(e)})}function Doe(t,e){return new ez({type:"union",options:t,inclusive:!1,...M.normalizeParams(e)})}function mg(t,e,r){return new tz({type:"union",options:e,discriminator:t,...M.normalizeParams(r)})}function Td(t,e){return new rz({type:"intersection",left:t,right:e})}function iz(t,e,r){let n=e instanceof ue,i=n?r:e,o=n?e:null;return new nz({type:"tuple",items:t,rest:o,...M.normalizeParams(i)})}function Ke(t,e,r){return!e||!e._zod?new Sd({type:"record",keyType:I(),valueType:t,...M.normalizeParams(e)}):new Sd({type:"record",keyType:t,valueType:e,...M.normalizeParams(r)})}function Noe(t,e,r){let n=nr(t);return n._zod.values=void 0,new Sd({type:"record",keyType:n,valueType:e,...M.normalizeParams(r)})}function joe(t,e,r){return new Sd({type:"record",keyType:t,valueType:e,mode:"loose",...M.normalizeParams(r)})}function Moe(t,e,r){return new oz({type:"map",keyType:t,valueType:e,...M.normalizeParams(r)})}function Foe(t,e){return new sz({type:"set",valueType:t,...M.normalizeParams(e)})}function sr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new wd({type:"enum",entries:r,...M.normalizeParams(e)})}function Loe(t,e){return new wd({type:"enum",entries:t,...M.normalizeParams(e)})}function re(t,e){return new az({type:"literal",values:Array.isArray(t)?t:[t],...M.normalizeParams(e)})}function zoe(t){return ok(cz,t)}function Zk(t){return new lz({type:"transform",transform:t})}function at(t){return new Od({type:"optional",innerType:t})}function dz(t){return new uz({type:"optional",innerType:t})}function ag(t){return new fz({type:"nullable",innerType:t})}function Uoe(t){return at(ag(t))}function mz(t,e){return new pz({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}function gz(t,e){return new hz({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}function yz(t,e){return new Vk({type:"nonoptional",innerType:t,...M.normalizeParams(e)})}function qoe(t){return new _z({type:"success",innerType:t})}function vz(t,e){return new bz({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}function Boe(t){return Q$(Sz,t)}function Ek(t,e){return new hg({type:"pipe",in:t,out:e})}function Hoe(t,e,r){return new gg({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}function Goe(t){let e=t._zod.def;return new gg({type:"pipe",in:e.out,out:e.in,transform:e.reverseTransform,reverseTransform:e.transform})}function $z(t){return new xz({type:"readonly",innerType:t})}function Zoe(t,e){return new kz({type:"template_literal",parts:t,...M.normalizeParams(e)})}function Az(t){return new Ez({type:"lazy",getter:t})}function Voe(t){return new Tz({type:"promise",innerType:t})}function Woe(t){return new Oz({type:"function",input:Array.isArray(t?.input)?iz(t?.input):t?.input??ke(tt()),output:t?.output??tt()})}function Koe(t){let e=new Qe({check:"custom"});return e._zod.check=t,e}function Wk(t,e){return sk(yg,t??(()=>!0),e)}function Rz(t,e={}){return ak(yg,t,e)}function Iz(t,e){return ck(t,e)}function Xoe(t,e={}){let r=new yg({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...M.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=n=>{n.value instanceof t||n.issues.push({code:"invalid_type",expected:t.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}function ese(t){let e=Az(()=>rt([I(t),Me(),It(),ug(),ke(e),Ke(I(),e)]));return e}function _g(t,e){return new wz({type:"pipe",in:Zk(t),out:e})}var Gie,_e,Ak,xd,et,Tk,sg,to,lg,Ok,Rk,Ik,Pk,Ck,Dk,Nk,jk,GL,Mk,Fk,Lk,zk,Uk,qk,Bk,$d,kd,Dc,Ed,Ad,Hk,ZL,VL,WL,KL,JL,YL,XL,dg,QL,fg,pg,ez,tz,rz,nz,Sd,oz,sz,wd,az,cz,lz,Od,uz,fz,pz,hz,Vk,_z,bz,Sz,hg,gg,wz,xz,kz,Ez,Tz,Oz,yg,Joe,Yoe,Qoe,og=y(()=>{mr();mr();bd();tg();vk();ng();HL();Gie=new WeakMap;_e=k("ZodType",(t,e)=>(ue.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:_d(t,"input"),output:_d(t,"output")}}),t.toJSONSchema=zF(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,n)=>PL(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>DL(t,r,n),t.parseAsync=async(r,n)=>CL(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>NL(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>jL(t,r,n),t.decode=(r,n)=>ML(t,r,n),t.encodeAsync=async(r,n)=>FL(t,r,n),t.decodeAsync=async(r,n)=>LL(t,r,n),t.safeEncode=(r,n)=>zL(t,r,n),t.safeDecode=(r,n)=>UL(t,r,n),t.safeEncodeAsync=async(r,n)=>qL(t,r,n),t.safeDecodeAsync=async(r,n)=>BL(t,r,n),cg(t,"ZodType",{check(...r){let n=this.def;return this.clone(M.mergeDefs(n,{checks:[...n.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return nr(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(Rz(r,n))},superRefine(r,n){return this.check(Iz(r,n))},overwrite(r){return this.check(pi(r))},optional(){return at(this)},exactOptional(){return dz(this)},nullable(){return ag(this)},nullish(){return at(ag(this))},nonoptional(r){return yz(this,r)},array(){return ke(this)},or(r){return rt([this,r])},and(r){return Td(this,r)},transform(r){return Ek(this,Zk(r))},default(r){return mz(this,r)},prefault(r){return gz(this,r)},catch(r){return vz(this,r)},pipe(r){return Ek(this,r)},readonly(){return $z(this)},describe(r){let n=this.clone();return ir.add(n,{description:r}),n},meta(...r){if(r.length===0)return ir.get(this);let n=this.clone();return ir.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){return ir.get(t)?.description},configurable:!0}),t)),Ak=k("_ZodString",(t,e)=>{Us.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(n,i,o)=>UF(t,n,i,o);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,cg(t,"_ZodString",{regex(...n){return this.check(sd(...n))},includes(...n){return this.check(ld(...n))},startsWith(...n){return this.check(ud(...n))},endsWith(...n){return this.check(dd(...n))},min(...n){return this.check(Uo(...n))},max(...n){return this.check(Oc(...n))},length(...n){return this.check(Rc(...n))},nonempty(...n){return this.check(Uo(1,...n))},lowercase(n){return this.check(ad(n))},uppercase(n){return this.check(cd(n))},trim(){return this.check(md())},normalize(...n){return this.check(pd(...n))},toLowerCase(){return this.check(hd())},toUpperCase(){return this.check(gd())},slugify(){return this.check(yd())}})}),xd=k("ZodString",(t,e)=>{Us.init(t,e),Ak.init(t,e),t.email=r=>t.check(Nh(Tk,r)),t.url=r=>t.check(od(lg,r)),t.jwt=r=>t.check(eg(Bk,r)),t.emoji=r=>t.check(zh(Ok,r)),t.guid=r=>t.check(id(sg,r)),t.uuid=r=>t.check(jh(to,r)),t.uuidv4=r=>t.check(Mh(to,r)),t.uuidv6=r=>t.check(Fh(to,r)),t.uuidv7=r=>t.check(Lh(to,r)),t.nanoid=r=>t.check(Uh(Rk,r)),t.guid=r=>t.check(id(sg,r)),t.cuid=r=>t.check(qh(Ik,r)),t.cuid2=r=>t.check(Bh(Pk,r)),t.ulid=r=>t.check(Hh(Ck,r)),t.base64=r=>t.check(Yh(zk,r)),t.base64url=r=>t.check(Xh(Uk,r)),t.xid=r=>t.check(Gh(Dk,r)),t.ksuid=r=>t.check(Zh(Nk,r)),t.ipv4=r=>t.check(Vh(jk,r)),t.ipv6=r=>t.check(Wh(Mk,r)),t.cidrv4=r=>t.check(Kh(Fk,r)),t.cidrv6=r=>t.check(Jh(Lk,r)),t.e164=r=>t.check(Qh(qk,r)),t.datetime=r=>t.check(AL(r)),t.date=r=>t.check(TL(r)),t.time=r=>t.check(OL(r)),t.duration=r=>t.check(RL(r))});et=k("ZodStringFormat",(t,e)=>{We.init(t,e),Ak.init(t,e)}),Tk=k("ZodEmail",(t,e)=>{E0.init(t,e),et.init(t,e)});sg=k("ZodGUID",(t,e)=>{$0.init(t,e),et.init(t,e)});to=k("ZodUUID",(t,e)=>{k0.init(t,e),et.init(t,e)});lg=k("ZodURL",(t,e)=>{A0.init(t,e),et.init(t,e)});Ok=k("ZodEmoji",(t,e)=>{T0.init(t,e),et.init(t,e)});Rk=k("ZodNanoID",(t,e)=>{O0.init(t,e),et.init(t,e)});Ik=k("ZodCUID",(t,e)=>{R0.init(t,e),et.init(t,e)});Pk=k("ZodCUID2",(t,e)=>{I0.init(t,e),et.init(t,e)});Ck=k("ZodULID",(t,e)=>{P0.init(t,e),et.init(t,e)});Dk=k("ZodXID",(t,e)=>{C0.init(t,e),et.init(t,e)});Nk=k("ZodKSUID",(t,e)=>{D0.init(t,e),et.init(t,e)});jk=k("ZodIPv4",(t,e)=>{N0.init(t,e),et.init(t,e)});GL=k("ZodMAC",(t,e)=>{M0.init(t,e),et.init(t,e)});Mk=k("ZodIPv6",(t,e)=>{j0.init(t,e),et.init(t,e)});Fk=k("ZodCIDRv4",(t,e)=>{F0.init(t,e),et.init(t,e)});Lk=k("ZodCIDRv6",(t,e)=>{L0.init(t,e),et.init(t,e)});zk=k("ZodBase64",(t,e)=>{z0.init(t,e),et.init(t,e)});Uk=k("ZodBase64URL",(t,e)=>{U0.init(t,e),et.init(t,e)});qk=k("ZodE164",(t,e)=>{q0.init(t,e),et.init(t,e)});Bk=k("ZodJWT",(t,e)=>{B0.init(t,e),et.init(t,e)});$d=k("ZodCustomStringFormat",(t,e)=>{H0.init(t,e),et.init(t,e)});kd=k("ZodNumber",(t,e)=>{Th.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(n,i,o)=>qF(t,n,i,o),cg(t,"ZodNumber",{gt(n,i){return this.check(Qi(n,i))},gte(n,i){return this.check(Er(n,i))},min(n,i){return this.check(Er(n,i))},lt(n,i){return this.check(Xi(n,i))},lte(n,i){return this.check(Sn(n,i))},max(n,i){return this.check(Sn(n,i))},int(n){return this.check(kk(n))},safe(n){return this.check(kk(n))},positive(n){return this.check(Qi(0,n))},nonnegative(n){return this.check(Er(0,n))},negative(n){return this.check(Xi(0,n))},nonpositive(n){return this.check(Sn(0,n))},multipleOf(n,i){return this.check(qs(n,i))},step(n,i){return this.check(qs(n,i))},finite(){return this}});let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});Dc=k("ZodNumberFormat",(t,e)=>{G0.init(t,e),kd.init(t,e)});Ed=k("ZodBoolean",(t,e)=>{Qu.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>BF(t,r,n,i)});Ad=k("ZodBigInt",(t,e)=>{Oh.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(n,i,o)=>HF(t,n,i,o),t.gte=(n,i)=>t.check(Er(n,i)),t.min=(n,i)=>t.check(Er(n,i)),t.gt=(n,i)=>t.check(Qi(n,i)),t.gte=(n,i)=>t.check(Er(n,i)),t.min=(n,i)=>t.check(Er(n,i)),t.lt=(n,i)=>t.check(Xi(n,i)),t.lte=(n,i)=>t.check(Sn(n,i)),t.max=(n,i)=>t.check(Sn(n,i)),t.positive=n=>t.check(Qi(BigInt(0),n)),t.negative=n=>t.check(Xi(BigInt(0),n)),t.nonpositive=n=>t.check(Sn(BigInt(0),n)),t.nonnegative=n=>t.check(Er(BigInt(0),n)),t.multipleOf=(n,i)=>t.check(qs(n,i));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});Hk=k("ZodBigIntFormat",(t,e)=>{Z0.init(t,e),Ad.init(t,e)});ZL=k("ZodSymbol",(t,e)=>{V0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>GF(t,r,n,i)});VL=k("ZodUndefined",(t,e)=>{W0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>VF(t,r,n,i)});WL=k("ZodNull",(t,e)=>{K0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>ZF(t,r,n,i)});KL=k("ZodAny",(t,e)=>{J0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>JF(t,r,n,i)});JL=k("ZodUnknown",(t,e)=>{Y0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>YF(t,r,n,i)});YL=k("ZodNever",(t,e)=>{X0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>KF(t,r,n,i)});XL=k("ZodVoid",(t,e)=>{Q0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>WF(t,r,n,i)});dg=k("ZodDate",(t,e)=>{e$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(n,i,o)=>XF(t,n,i,o),t.min=(n,i)=>t.check(Er(n,i)),t.max=(n,i)=>t.check(Sn(n,i));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});QL=k("ZodArray",(t,e)=>{t$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>uL(t,r,n,i),t.element=e.element,cg(t,"ZodArray",{min(r,n){return this.check(Uo(r,n))},nonempty(r){return this.check(Uo(1,r))},max(r,n){return this.check(Oc(r,n))},length(r,n){return this.check(Rc(r,n))},unwrap(){return this.element}})});fg=k("ZodObject",(t,e)=>{SF.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>dL(t,r,n,i),M.defineLazy(t,"shape",()=>e.shape),cg(t,"ZodObject",{keyof(){return sr(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:tt()})},loose(){return this.clone({...this._zod.def,catchall:tt()})},strict(){return this.clone({...this._zod.def,catchall:Gk()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return M.extend(this,r)},safeExtend(r){return M.safeExtend(this,r)},merge(r){return M.merge(this,r)},pick(r){return M.pick(this,r)},omit(r){return M.omit(this,r)},partial(...r){return M.partial(Od,this,r[0])},required(...r){return M.required(Vk,this,r[0])}})});pg=k("ZodUnion",(t,e)=>{ed.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>pk(t,r,n,i),t.options=e.options});ez=k("ZodXor",(t,e)=>{pg.init(t,e),n$.init(t,e),t._zod.processJSONSchema=(r,n,i)=>pk(t,r,n,i),t.options=e.options});tz=k("ZodDiscriminatedUnion",(t,e)=>{pg.init(t,e),i$.init(t,e)});rz=k("ZodIntersection",(t,e)=>{o$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>fL(t,r,n,i)});nz=k("ZodTuple",(t,e)=>{Rh.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>pL(t,r,n,i),t.rest=r=>t.clone({...t._zod.def,rest:r})});Sd=k("ZodRecord",(t,e)=>{s$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>mL(t,r,n,i),t.keyType=e.keyType,t.valueType=e.valueType});oz=k("ZodMap",(t,e)=>{a$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>cL(t,r,n,i),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(eo(...r)),t.nonempty=r=>t.check(eo(1,r)),t.max=(...r)=>t.check(Bs(...r)),t.size=(...r)=>t.check(Tc(...r))});sz=k("ZodSet",(t,e)=>{c$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>lL(t,r,n,i),t.min=(...r)=>t.check(eo(...r)),t.nonempty=r=>t.check(eo(1,r)),t.max=(...r)=>t.check(Bs(...r)),t.size=(...r)=>t.check(Tc(...r))});wd=k("ZodEnum",(t,e)=>{l$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(n,i,o)=>QF(t,n,i,o),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{let o={};for(let s of n)if(r.has(s))o[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new wd({...e,checks:[],...M.normalizeParams(i),entries:o})},t.exclude=(n,i)=>{let o={...e.entries};for(let s of n)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new wd({...e,checks:[],...M.normalizeParams(i),entries:o})}});az=k("ZodLiteral",(t,e)=>{u$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>eL(t,r,n,i),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});cz=k("ZodFile",(t,e)=>{d$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>nL(t,r,n,i),t.min=(r,n)=>t.check(eo(r,n)),t.max=(r,n)=>t.check(Bs(r,n)),t.mime=(r,n)=>t.check(fd(Array.isArray(r)?r:[r],n))});lz=k("ZodTransform",(t,e)=>{f$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>aL(t,r,n,i),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ds(t.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(M.issue(o,r.value,e));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(M.issue(s))}};let i=e.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});Od=k("ZodOptional",(t,e)=>{Ih.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>mk(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});uz=k("ZodExactOptional",(t,e)=>{p$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>mk(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});fz=k("ZodNullable",(t,e)=>{m$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>hL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});pz=k("ZodDefault",(t,e)=>{h$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>yL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});hz=k("ZodPrefault",(t,e)=>{g$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>_L(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});Vk=k("ZodNonOptional",(t,e)=>{y$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>gL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});_z=k("ZodSuccess",(t,e)=>{_$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>iL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});bz=k("ZodCatch",(t,e)=>{b$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>bL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});Sz=k("ZodNaN",(t,e)=>{v$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>tL(t,r,n,i)});hg=k("ZodPipe",(t,e)=>{Ph.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>vL(t,r,n,i),t.in=e.in,t.out=e.out});gg=k("ZodCodec",(t,e)=>{hg.init(t,e),td.init(t,e)});wz=k("ZodPreprocess",(t,e)=>{hg.init(t,e),wF.init(t,e)}),xz=k("ZodReadonly",(t,e)=>{S$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>SL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});kz=k("ZodTemplateLiteral",(t,e)=>{w$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>rL(t,r,n,i)});Ez=k("ZodLazy",(t,e)=>{k$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>xL(t,r,n,i),t.unwrap=()=>t._zod.def.getter()});Tz=k("ZodPromise",(t,e)=>{$$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>wL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});Oz=k("ZodFunction",(t,e)=>{x$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>sL(t,r,n,i)});yg=k("ZodCustom",(t,e)=>{E$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>oL(t,r,n,i)});Joe=lk,Yoe=uk;Qoe=(...t)=>dk({Codec:gg,Boolean:Ed,String:xd},...t)});function tHe(t){Tt({customError:t})}function rHe(){return Tt().customError}var eHe,Pz,tse=y(()=>{mr();eHe={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};Pz||(Pz={})});function iHe(t,e){let r=t.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function oHe(t,e){if(!t.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=t.slice(1).split("/").filter(Boolean);if(r.length===0)return e.rootSchema;let n=e.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let i=r[1];if(!i||!e.defs[i])throw new Error(`Reference not found: ${t}`);return e.defs[i]}throw new Error(`Reference not found: ${t}`)}function rse(t,e){if(t.not!==void 0){if(typeof t.not=="object"&&Object.keys(t.not).length===0)return Z.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(t.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(t.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(t.if!==void 0||t.then!==void 0||t.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(t.dependentSchemas!==void 0||t.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(t.$ref){let i=t.$ref;if(e.refs.has(i))return e.refs.get(i);if(e.processing.has(i))return Z.lazy(()=>{if(!e.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return e.refs.get(i)});e.processing.add(i);let o=oHe(i,e),s=hr(o,e);return e.refs.set(i,s),e.processing.delete(i),s}if(t.enum!==void 0){let i=t.enum;if(e.version==="openapi-3.0"&&t.nullable===!0&&i.length===1&&i[0]===null)return Z.null();if(i.length===0)return Z.never();if(i.length===1)return Z.literal(i[0]);if(i.every(s=>typeof s=="string"))return Z.enum(i);let o=i.map(s=>Z.literal(s));return o.length<2?o[0]:Z.union([o[0],o[1],...o.slice(2)])}if(t.const!==void 0)return Z.literal(t.const);let r=t.type;if(Array.isArray(r)){let i=r.map(o=>{let s={...t,type:o};return rse(s,e)});return i.length===0?Z.never():i.length===1?i[0]:Z.union(i)}if(!r)return Z.any();let n;switch(r){case"string":{let i=Z.string();if(t.format){let o=t.format;o==="email"?i=i.check(Z.email()):o==="uri"||o==="uri-reference"?i=i.check(Z.url()):o==="uuid"||o==="guid"?i=i.check(Z.uuid()):o==="date-time"?i=i.check(Z.iso.datetime()):o==="date"?i=i.check(Z.iso.date()):o==="time"?i=i.check(Z.iso.time()):o==="duration"?i=i.check(Z.iso.duration()):o==="ipv4"?i=i.check(Z.ipv4()):o==="ipv6"?i=i.check(Z.ipv6()):o==="mac"?i=i.check(Z.mac()):o==="cidr"?i=i.check(Z.cidrv4()):o==="cidr-v6"?i=i.check(Z.cidrv6()):o==="base64"?i=i.check(Z.base64()):o==="base64url"?i=i.check(Z.base64url()):o==="e164"?i=i.check(Z.e164()):o==="jwt"?i=i.check(Z.jwt()):o==="emoji"?i=i.check(Z.emoji()):o==="nanoid"?i=i.check(Z.nanoid()):o==="cuid"?i=i.check(Z.cuid()):o==="cuid2"?i=i.check(Z.cuid2()):o==="ulid"?i=i.check(Z.ulid()):o==="xid"?i=i.check(Z.xid()):o==="ksuid"&&(i=i.check(Z.ksuid()))}typeof t.minLength=="number"&&(i=i.min(t.minLength)),typeof t.maxLength=="number"&&(i=i.max(t.maxLength)),t.pattern&&(i=i.regex(new RegExp(t.pattern))),n=i;break}case"number":case"integer":{let i=r==="integer"?Z.number().int():Z.number();typeof t.minimum=="number"&&(i=i.min(t.minimum)),typeof t.maximum=="number"&&(i=i.max(t.maximum)),typeof t.exclusiveMinimum=="number"?i=i.gt(t.exclusiveMinimum):t.exclusiveMinimum===!0&&typeof t.minimum=="number"&&(i=i.gt(t.minimum)),typeof t.exclusiveMaximum=="number"?i=i.lt(t.exclusiveMaximum):t.exclusiveMaximum===!0&&typeof t.maximum=="number"&&(i=i.lt(t.maximum)),typeof t.multipleOf=="number"&&(i=i.multipleOf(t.multipleOf)),n=i;break}case"boolean":{n=Z.boolean();break}case"null":{n=Z.null();break}case"object":{let i={},o=t.properties||{},s=new Set(t.required||[]);for(let[c,l]of Object.entries(o)){let u=hr(l,e);i[c]=s.has(c)?u:u.optional()}if(t.propertyNames){let c=hr(t.propertyNames,e),l=t.additionalProperties&&typeof t.additionalProperties=="object"?hr(t.additionalProperties,e):Z.any();if(Object.keys(i).length===0){n=Z.record(c,l);break}let u=Z.object(i).passthrough(),d=Z.looseRecord(c,l);n=Z.intersection(u,d);break}if(t.patternProperties){let c=t.patternProperties,l=Object.keys(c),u=[];for(let f of l){let p=hr(c[f],e),m=Z.string().regex(new RegExp(f));u.push(Z.looseRecord(m,p))}let d=[];if(Object.keys(i).length>0&&d.push(Z.object(i).passthrough()),d.push(...u),d.length===0)n=Z.object({}).passthrough();else if(d.length===1)n=d[0];else{let f=Z.intersection(d[0],d[1]);for(let p=2;phr(c,e)),a=o&&typeof o=="object"&&!Array.isArray(o)?hr(o,e):void 0;a?n=Z.tuple(s).rest(a):n=Z.tuple(s),typeof t.minItems=="number"&&(n=n.check(Z.minLength(t.minItems))),typeof t.maxItems=="number"&&(n=n.check(Z.maxLength(t.maxItems)))}else if(Array.isArray(o)){let s=o.map(c=>hr(c,e)),a=t.additionalItems&&typeof t.additionalItems=="object"?hr(t.additionalItems,e):void 0;a?n=Z.tuple(s).rest(a):n=Z.tuple(s),typeof t.minItems=="number"&&(n=n.check(Z.minLength(t.minItems))),typeof t.maxItems=="number"&&(n=n.check(Z.maxLength(t.maxItems)))}else if(o!==void 0){let s=hr(o,e),a=Z.array(s);typeof t.minItems=="number"&&(a=a.min(t.minItems)),typeof t.maxItems=="number"&&(a=a.max(t.maxItems)),n=a}else n=Z.array(Z.any());break}default:throw new Error(`Unsupported type: ${r}`)}return n}function hr(t,e){if(typeof t=="boolean")return t?Z.any():Z.never();let r=rse(t,e),n=t.type||t.enum!==void 0||t.const!==void 0;if(t.anyOf&&Array.isArray(t.anyOf)){let a=t.anyOf.map(l=>hr(l,e)),c=Z.union(a);r=n?Z.intersection(r,c):c}if(t.oneOf&&Array.isArray(t.oneOf)){let a=t.oneOf.map(l=>hr(l,e)),c=Z.xor(a);r=n?Z.intersection(r,c):c}if(t.allOf&&Array.isArray(t.allOf))if(t.allOf.length===0)r=n?r:Z.any();else{let a=n?r:hr(t.allOf[0],e),c=n?0:1;for(let l=c;l0&&e.registry.add(r,i),t.description&&(r=r.describe(t.description)),r}function nse(t,e){if(typeof t=="boolean")return t?Z.any():Z.never();let r;try{r=JSON.parse(JSON.stringify(t))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=iHe(r,e?.defaultTarget),i=r.$defs||r.definitions||{},o={version:n,defs:i,refs:new Map,processing:new Set,rootSchema:r,registry:e?.registry??ir};return hr(r,o)}var Z,nHe,ise=y(()=>{Dh();vk();ng();og();Z={...ig,...bk,iso:Ks},nHe=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"])});var Cz={};Pr(Cz,{bigint:()=>lHe,boolean:()=>cHe,date:()=>uHe,number:()=>aHe,string:()=>sHe});function sHe(t){return OF(xd,t)}function aHe(t){return NF(kd,t)}function cHe(t){return jF(Ed,t)}function lHe(t){return MF(Ad,t)}function uHe(t){return FF(dg,t)}var ose=y(()=>{mr();og()});var E={};Pr(E,{$brand:()=>iM,$input:()=>TF,$output:()=>AF,NEVER:()=>nM,TimePrecision:()=>RF,ZodAny:()=>KL,ZodArray:()=>QL,ZodBase64:()=>zk,ZodBase64URL:()=>Uk,ZodBigInt:()=>Ad,ZodBigIntFormat:()=>Hk,ZodBoolean:()=>Ed,ZodCIDRv4:()=>Fk,ZodCIDRv6:()=>Lk,ZodCUID:()=>Ik,ZodCUID2:()=>Pk,ZodCatch:()=>bz,ZodCodec:()=>gg,ZodCustom:()=>yg,ZodCustomStringFormat:()=>$d,ZodDate:()=>dg,ZodDefault:()=>pz,ZodDiscriminatedUnion:()=>tz,ZodE164:()=>qk,ZodEmail:()=>Tk,ZodEmoji:()=>Ok,ZodEnum:()=>wd,ZodError:()=>XBe,ZodExactOptional:()=>uz,ZodFile:()=>cz,ZodFirstPartyTypeKind:()=>Pz,ZodFunction:()=>Oz,ZodGUID:()=>sg,ZodIPv4:()=>jk,ZodIPv6:()=>Mk,ZodISODate:()=>wk,ZodISODateTime:()=>Sk,ZodISODuration:()=>$k,ZodISOTime:()=>xk,ZodIntersection:()=>rz,ZodIssueCode:()=>eHe,ZodJWT:()=>Bk,ZodKSUID:()=>Nk,ZodLazy:()=>Ez,ZodLiteral:()=>az,ZodMAC:()=>GL,ZodMap:()=>oz,ZodNaN:()=>Sz,ZodNanoID:()=>Rk,ZodNever:()=>YL,ZodNonOptional:()=>Vk,ZodNull:()=>WL,ZodNullable:()=>fz,ZodNumber:()=>kd,ZodNumberFormat:()=>Dc,ZodObject:()=>fg,ZodOptional:()=>Od,ZodPipe:()=>hg,ZodPrefault:()=>hz,ZodPreprocess:()=>wz,ZodPromise:()=>Tz,ZodReadonly:()=>xz,ZodRealError:()=>Zr,ZodRecord:()=>Sd,ZodSet:()=>sz,ZodString:()=>xd,ZodStringFormat:()=>et,ZodSuccess:()=>_z,ZodSymbol:()=>ZL,ZodTemplateLiteral:()=>kz,ZodTransform:()=>lz,ZodTuple:()=>nz,ZodType:()=>_e,ZodULID:()=>Ck,ZodURL:()=>lg,ZodUUID:()=>to,ZodUndefined:()=>VL,ZodUnion:()=>pg,ZodUnknown:()=>JL,ZodVoid:()=>XL,ZodXID:()=>Dk,ZodXor:()=>ez,_ZodString:()=>Ak,_default:()=>mz,_function:()=>Woe,any:()=>Ooe,array:()=>ke,base64:()=>foe,base64url:()=>poe,bigint:()=>$oe,boolean:()=>It,catch:()=>vz,check:()=>Koe,cidrv4:()=>uoe,cidrv6:()=>doe,clone:()=>nr,codec:()=>Hoe,coerce:()=>Cz,config:()=>Tt,core:()=>mi,cuid:()=>roe,cuid2:()=>noe,custom:()=>Wk,date:()=>Ioe,decode:()=>ML,decodeAsync:()=>LL,describe:()=>Joe,discriminatedUnion:()=>mg,e164:()=>moe,email:()=>Zie,emoji:()=>eoe,encode:()=>jL,encodeAsync:()=>FL,endsWith:()=>dd,enum:()=>sr,exactOptional:()=>dz,file:()=>zoe,flattenError:()=>xh,float32:()=>voe,float64:()=>Soe,formatError:()=>$h,fromJSONSchema:()=>nse,function:()=>Woe,getErrorMap:()=>rHe,globalRegistry:()=>ir,gt:()=>Qi,gte:()=>Er,guid:()=>Vie,hash:()=>boe,hex:()=>_oe,hostname:()=>yoe,httpUrl:()=>Qie,includes:()=>ld,instanceof:()=>Xoe,int:()=>kk,int32:()=>woe,int64:()=>koe,intersection:()=>Td,invertCodec:()=>Goe,ipv4:()=>aoe,ipv6:()=>loe,iso:()=>Ks,json:()=>ese,jwt:()=>hoe,keyof:()=>Poe,ksuid:()=>soe,lazy:()=>Az,length:()=>Rc,literal:()=>re,locales:()=>nd,looseObject:()=>or,looseRecord:()=>joe,lowercase:()=>ad,lt:()=>Xi,lte:()=>Sn,mac:()=>coe,map:()=>Moe,maxLength:()=>Oc,maxSize:()=>Bs,meta:()=>Yoe,mime:()=>fd,minLength:()=>Uo,minSize:()=>eo,multipleOf:()=>qs,nan:()=>Boe,nanoid:()=>toe,nativeEnum:()=>Loe,negative:()=>tk,never:()=>Gk,nonnegative:()=>nk,nonoptional:()=>yz,nonpositive:()=>rk,normalize:()=>pd,null:()=>ug,nullable:()=>ag,nullish:()=>Uoe,number:()=>Me,object:()=>W,optional:()=>at,overwrite:()=>pi,parse:()=>PL,parseAsync:()=>CL,partialRecord:()=>Noe,pipe:()=>Ek,positive:()=>ek,prefault:()=>gz,preprocess:()=>_g,prettifyError:()=>gM,promise:()=>Voe,property:()=>ik,readonly:()=>$z,record:()=>Ke,refine:()=>Rz,regex:()=>sd,regexes:()=>Gr,registry:()=>P$,safeDecode:()=>UL,safeDecodeAsync:()=>BL,safeEncode:()=>zL,safeEncodeAsync:()=>qL,safeParse:()=>DL,safeParseAsync:()=>NL,set:()=>Foe,setErrorMap:()=>tHe,size:()=>Tc,slugify:()=>yd,startsWith:()=>ud,strictObject:()=>Coe,string:()=>I,stringFormat:()=>goe,stringbool:()=>Qoe,success:()=>qoe,superRefine:()=>Iz,symbol:()=>Aoe,templateLiteral:()=>Zoe,toJSONSchema:()=>Pc,toLowerCase:()=>hd,toUpperCase:()=>gd,transform:()=>Zk,treeifyError:()=>hM,trim:()=>md,tuple:()=>iz,uint32:()=>xoe,uint64:()=>Eoe,ulid:()=>ioe,undefined:()=>Toe,union:()=>rt,unknown:()=>tt,uppercase:()=>cd,url:()=>Xie,util:()=>M,uuid:()=>Wie,uuidv4:()=>Kie,uuidv6:()=>Jie,uuidv7:()=>Yie,void:()=>Roe,xid:()=>ooe,xor:()=>Doe});var Kk=y(()=>{mr();og();vk();IL();HL();tse();mr();$F();mr();bd();ise();R$();ng();ng();ose();Tt(A$())});var sse=y(()=>{Kk()});var ase=y(()=>{sse()});function $se(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function kse(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var Nz,cse,Js,Yk,Wt,lse,use,gEt,fHe,pHe,jz,wn,bg,dse,ar,zn,Un,cr,Xk,fse,Mz,pse,mse,Fz,vg,ae,Lz,hse,gse,yEt,Qk,mHe,eE,hHe,Sg,Rd,yse,gHe,yHe,_He,bHe,vHe,SHe,zz,wHe,xHe,Uz,tE,$He,kHe,rE,EHe,wg,xg,AHe,$g,Id,THe,kg,nE,iE,oE,_Et,sE,aE,cE,_se,bse,vse,qz,Sse,Eg,Pd,wse,OHe,lE,RHe,uE,IHe,Bz,PHe,dE,CHe,DHe,NHe,Hz,jHe,Gz,MHe,FHe,LHe,zHe,fE,UHe,qHe,pE,Zz,Vz,Wz,BHe,HHe,GHe,Kz,ZHe,VHe,WHe,KHe,JHe,xse,mE,YHe,hE,bEt,XHe,Cd,QHe,vEt,Ag,eGe,Jz,tGe,rGe,nGe,iGe,oGe,sGe,aGe,Jk,cGe,lGe,uGe,Tg,Yz,dGe,fGe,pGe,mGe,hGe,gGe,yGe,_Ge,bGe,vGe,SGe,wGe,xGe,$Ge,kGe,EGe,AGe,TGe,Dd,OGe,RGe,IGe,gE,PGe,CGe,DGe,Xz,NGe,SEt,wEt,xEt,$Et,kEt,EEt,ne,Dz,Nc=y(()=>{ase();Nz="2025-11-25",cse=[Nz,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Js="io.modelcontextprotocol/related-task",Yk="2.0",Wt=Wk(t=>t!==null&&(typeof t=="object"||typeof t=="function")),lse=rt([I(),Me().int()]),use=I(),gEt=or({ttl:Me().optional(),pollInterval:Me().optional()}),fHe=W({ttl:Me().optional()}),pHe=W({taskId:I()}),jz=or({progressToken:lse.optional(),[Js]:pHe.optional()}),wn=W({_meta:jz.optional()}),bg=wn.extend({task:fHe.optional()}),dse=t=>bg.safeParse(t).success,ar=W({method:I(),params:wn.loose().optional()}),zn=W({_meta:jz.optional()}),Un=W({method:I(),params:zn.loose().optional()}),cr=or({_meta:jz.optional()}),Xk=rt([I(),Me().int()]),fse=W({jsonrpc:re(Yk),id:Xk,...ar.shape}).strict(),Mz=t=>fse.safeParse(t).success,pse=W({jsonrpc:re(Yk),...Un.shape}).strict(),mse=t=>pse.safeParse(t).success,Fz=W({jsonrpc:re(Yk),id:Xk,result:cr}).strict(),vg=t=>Fz.safeParse(t).success;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(ae||(ae={}));Lz=W({jsonrpc:re(Yk),id:Xk.optional(),error:W({code:Me().int(),message:I(),data:tt().optional()})}).strict(),hse=t=>Lz.safeParse(t).success,gse=rt([fse,pse,Fz,Lz]),yEt=rt([Fz,Lz]),Qk=cr.strict(),mHe=zn.extend({requestId:Xk.optional(),reason:I().optional()}),eE=Un.extend({method:re("notifications/cancelled"),params:mHe}),hHe=W({src:I(),mimeType:I().optional(),sizes:ke(I()).optional(),theme:sr(["light","dark"]).optional()}),Sg=W({icons:ke(hHe).optional()}),Rd=W({name:I(),title:I().optional()}),yse=Rd.extend({...Rd.shape,...Sg.shape,version:I(),websiteUrl:I().optional(),description:I().optional()}),gHe=Td(W({applyDefaults:It().optional()}),Ke(I(),tt())),yHe=_g(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Td(W({form:gHe.optional(),url:Wt.optional()}),Ke(I(),tt()).optional())),_He=or({list:Wt.optional(),cancel:Wt.optional(),requests:or({sampling:or({createMessage:Wt.optional()}).optional(),elicitation:or({create:Wt.optional()}).optional()}).optional()}),bHe=or({list:Wt.optional(),cancel:Wt.optional(),requests:or({tools:or({call:Wt.optional()}).optional()}).optional()}),vHe=W({experimental:Ke(I(),Wt).optional(),sampling:W({context:Wt.optional(),tools:Wt.optional()}).optional(),elicitation:yHe.optional(),roots:W({listChanged:It().optional()}).optional(),tasks:_He.optional(),extensions:Ke(I(),Wt).optional()}),SHe=wn.extend({protocolVersion:I(),capabilities:vHe,clientInfo:yse}),zz=ar.extend({method:re("initialize"),params:SHe}),wHe=W({experimental:Ke(I(),Wt).optional(),logging:Wt.optional(),completions:Wt.optional(),prompts:W({listChanged:It().optional()}).optional(),resources:W({subscribe:It().optional(),listChanged:It().optional()}).optional(),tools:W({listChanged:It().optional()}).optional(),tasks:bHe.optional(),extensions:Ke(I(),Wt).optional()}),xHe=cr.extend({protocolVersion:I(),capabilities:wHe,serverInfo:yse,instructions:I().optional()}),Uz=Un.extend({method:re("notifications/initialized"),params:zn.optional()}),tE=ar.extend({method:re("ping"),params:wn.optional()}),$He=W({progress:Me(),total:at(Me()),message:at(I())}),kHe=W({...zn.shape,...$He.shape,progressToken:lse}),rE=Un.extend({method:re("notifications/progress"),params:kHe}),EHe=wn.extend({cursor:use.optional()}),wg=ar.extend({params:EHe.optional()}),xg=cr.extend({nextCursor:use.optional()}),AHe=sr(["working","input_required","completed","failed","cancelled"]),$g=W({taskId:I(),status:AHe,ttl:rt([Me(),ug()]),createdAt:I(),lastUpdatedAt:I(),pollInterval:at(Me()),statusMessage:at(I())}),Id=cr.extend({task:$g}),THe=zn.merge($g),kg=Un.extend({method:re("notifications/tasks/status"),params:THe}),nE=ar.extend({method:re("tasks/get"),params:wn.extend({taskId:I()})}),iE=cr.merge($g),oE=ar.extend({method:re("tasks/result"),params:wn.extend({taskId:I()})}),_Et=cr.loose(),sE=wg.extend({method:re("tasks/list")}),aE=xg.extend({tasks:ke($g)}),cE=ar.extend({method:re("tasks/cancel"),params:wn.extend({taskId:I()})}),_se=cr.merge($g),bse=W({uri:I(),mimeType:at(I()),_meta:Ke(I(),tt()).optional()}),vse=bse.extend({text:I()}),qz=I().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Sse=bse.extend({blob:qz}),Eg=sr(["user","assistant"]),Pd=W({audience:ke(Eg).optional(),priority:Me().min(0).max(1).optional(),lastModified:Ks.datetime({offset:!0}).optional()}),wse=W({...Rd.shape,...Sg.shape,uri:I(),description:at(I()),mimeType:at(I()),size:at(Me()),annotations:Pd.optional(),_meta:at(or({}))}),OHe=W({...Rd.shape,...Sg.shape,uriTemplate:I(),description:at(I()),mimeType:at(I()),annotations:Pd.optional(),_meta:at(or({}))}),lE=wg.extend({method:re("resources/list")}),RHe=xg.extend({resources:ke(wse)}),uE=wg.extend({method:re("resources/templates/list")}),IHe=xg.extend({resourceTemplates:ke(OHe)}),Bz=wn.extend({uri:I()}),PHe=Bz,dE=ar.extend({method:re("resources/read"),params:PHe}),CHe=cr.extend({contents:ke(rt([vse,Sse]))}),DHe=Un.extend({method:re("notifications/resources/list_changed"),params:zn.optional()}),NHe=Bz,Hz=ar.extend({method:re("resources/subscribe"),params:NHe}),jHe=Bz,Gz=ar.extend({method:re("resources/unsubscribe"),params:jHe}),MHe=zn.extend({uri:I()}),FHe=Un.extend({method:re("notifications/resources/updated"),params:MHe}),LHe=W({name:I(),description:at(I()),required:at(It())}),zHe=W({...Rd.shape,...Sg.shape,description:at(I()),arguments:at(ke(LHe)),_meta:at(or({}))}),fE=wg.extend({method:re("prompts/list")}),UHe=xg.extend({prompts:ke(zHe)}),qHe=wn.extend({name:I(),arguments:Ke(I(),I()).optional()}),pE=ar.extend({method:re("prompts/get"),params:qHe}),Zz=W({type:re("text"),text:I(),annotations:Pd.optional(),_meta:Ke(I(),tt()).optional()}),Vz=W({type:re("image"),data:qz,mimeType:I(),annotations:Pd.optional(),_meta:Ke(I(),tt()).optional()}),Wz=W({type:re("audio"),data:qz,mimeType:I(),annotations:Pd.optional(),_meta:Ke(I(),tt()).optional()}),BHe=W({type:re("tool_use"),name:I(),id:I(),input:Ke(I(),tt()),_meta:Ke(I(),tt()).optional()}),HHe=W({type:re("resource"),resource:rt([vse,Sse]),annotations:Pd.optional(),_meta:Ke(I(),tt()).optional()}),GHe=wse.extend({type:re("resource_link")}),Kz=rt([Zz,Vz,Wz,GHe,HHe]),ZHe=W({role:Eg,content:Kz}),VHe=cr.extend({description:I().optional(),messages:ke(ZHe)}),WHe=Un.extend({method:re("notifications/prompts/list_changed"),params:zn.optional()}),KHe=W({title:I().optional(),readOnlyHint:It().optional(),destructiveHint:It().optional(),idempotentHint:It().optional(),openWorldHint:It().optional()}),JHe=W({taskSupport:sr(["required","optional","forbidden"]).optional()}),xse=W({...Rd.shape,...Sg.shape,description:I().optional(),inputSchema:W({type:re("object"),properties:Ke(I(),Wt).optional(),required:ke(I()).optional()}).catchall(tt()),outputSchema:W({type:re("object"),properties:Ke(I(),Wt).optional(),required:ke(I()).optional()}).catchall(tt()).optional(),annotations:KHe.optional(),execution:JHe.optional(),_meta:Ke(I(),tt()).optional()}),mE=wg.extend({method:re("tools/list")}),YHe=xg.extend({tools:ke(xse)}),hE=cr.extend({content:ke(Kz).default([]),structuredContent:Ke(I(),tt()).optional(),isError:It().optional()}),bEt=hE.or(cr.extend({toolResult:tt()})),XHe=bg.extend({name:I(),arguments:Ke(I(),tt()).optional()}),Cd=ar.extend({method:re("tools/call"),params:XHe}),QHe=Un.extend({method:re("notifications/tools/list_changed"),params:zn.optional()}),vEt=W({autoRefresh:It().default(!0),debounceMs:Me().int().nonnegative().default(300)}),Ag=sr(["debug","info","notice","warning","error","critical","alert","emergency"]),eGe=wn.extend({level:Ag}),Jz=ar.extend({method:re("logging/setLevel"),params:eGe}),tGe=zn.extend({level:Ag,logger:I().optional(),data:tt()}),rGe=Un.extend({method:re("notifications/message"),params:tGe}),nGe=W({name:I().optional()}),iGe=W({hints:ke(nGe).optional(),costPriority:Me().min(0).max(1).optional(),speedPriority:Me().min(0).max(1).optional(),intelligencePriority:Me().min(0).max(1).optional()}),oGe=W({mode:sr(["auto","required","none"]).optional()}),sGe=W({type:re("tool_result"),toolUseId:I().describe("The unique identifier for the corresponding tool call."),content:ke(Kz).default([]),structuredContent:W({}).loose().optional(),isError:It().optional(),_meta:Ke(I(),tt()).optional()}),aGe=mg("type",[Zz,Vz,Wz]),Jk=mg("type",[Zz,Vz,Wz,BHe,sGe]),cGe=W({role:Eg,content:rt([Jk,ke(Jk)]),_meta:Ke(I(),tt()).optional()}),lGe=bg.extend({messages:ke(cGe),modelPreferences:iGe.optional(),systemPrompt:I().optional(),includeContext:sr(["none","thisServer","allServers"]).optional(),temperature:Me().optional(),maxTokens:Me().int(),stopSequences:ke(I()).optional(),metadata:Wt.optional(),tools:ke(xse).optional(),toolChoice:oGe.optional()}),uGe=ar.extend({method:re("sampling/createMessage"),params:lGe}),Tg=cr.extend({model:I(),stopReason:at(sr(["endTurn","stopSequence","maxTokens"]).or(I())),role:Eg,content:aGe}),Yz=cr.extend({model:I(),stopReason:at(sr(["endTurn","stopSequence","maxTokens","toolUse"]).or(I())),role:Eg,content:rt([Jk,ke(Jk)])}),dGe=W({type:re("boolean"),title:I().optional(),description:I().optional(),default:It().optional()}),fGe=W({type:re("string"),title:I().optional(),description:I().optional(),minLength:Me().optional(),maxLength:Me().optional(),format:sr(["email","uri","date","date-time"]).optional(),default:I().optional()}),pGe=W({type:sr(["number","integer"]),title:I().optional(),description:I().optional(),minimum:Me().optional(),maximum:Me().optional(),default:Me().optional()}),mGe=W({type:re("string"),title:I().optional(),description:I().optional(),enum:ke(I()),default:I().optional()}),hGe=W({type:re("string"),title:I().optional(),description:I().optional(),oneOf:ke(W({const:I(),title:I()})),default:I().optional()}),gGe=W({type:re("string"),title:I().optional(),description:I().optional(),enum:ke(I()),enumNames:ke(I()).optional(),default:I().optional()}),yGe=rt([mGe,hGe]),_Ge=W({type:re("array"),title:I().optional(),description:I().optional(),minItems:Me().optional(),maxItems:Me().optional(),items:W({type:re("string"),enum:ke(I())}),default:ke(I()).optional()}),bGe=W({type:re("array"),title:I().optional(),description:I().optional(),minItems:Me().optional(),maxItems:Me().optional(),items:W({anyOf:ke(W({const:I(),title:I()}))}),default:ke(I()).optional()}),vGe=rt([_Ge,bGe]),SGe=rt([gGe,yGe,vGe]),wGe=rt([SGe,dGe,fGe,pGe]),xGe=bg.extend({mode:re("form").optional(),message:I(),requestedSchema:W({type:re("object"),properties:Ke(I(),wGe),required:ke(I()).optional()})}),$Ge=bg.extend({mode:re("url"),message:I(),elicitationId:I(),url:I().url()}),kGe=rt([xGe,$Ge]),EGe=ar.extend({method:re("elicitation/create"),params:kGe}),AGe=zn.extend({elicitationId:I()}),TGe=Un.extend({method:re("notifications/elicitation/complete"),params:AGe}),Dd=cr.extend({action:sr(["accept","decline","cancel"]),content:_g(t=>t===null?void 0:t,Ke(I(),rt([I(),Me(),It(),ke(I())])).optional())}),OGe=W({type:re("ref/resource"),uri:I()}),RGe=W({type:re("ref/prompt"),name:I()}),IGe=wn.extend({ref:rt([RGe,OGe]),argument:W({name:I(),value:I()}),context:W({arguments:Ke(I(),I()).optional()}).optional()}),gE=ar.extend({method:re("completion/complete"),params:IGe});PGe=cr.extend({completion:or({values:ke(I()).max(100),total:at(Me().int()),hasMore:at(It())})}),CGe=W({uri:I().startsWith("file://"),name:I().optional(),_meta:Ke(I(),tt()).optional()}),DGe=ar.extend({method:re("roots/list"),params:wn.optional()}),Xz=cr.extend({roots:ke(CGe)}),NGe=Un.extend({method:re("notifications/roots/list_changed"),params:zn.optional()}),SEt=rt([tE,zz,gE,Jz,pE,fE,lE,uE,dE,Hz,Gz,Cd,mE,nE,oE,sE,cE]),wEt=rt([eE,rE,Uz,NGe,kg]),xEt=rt([Qk,Tg,Yz,Dd,Xz,iE,aE,Id]),$Et=rt([tE,uGe,EGe,DGe,nE,oE,sE,cE]),kEt=rt([eE,rE,rGe,FHe,DHe,QHe,WHe,kg,TGe]),EEt=rt([Qk,xHe,PGe,VHe,UHe,RHe,IHe,CHe,hE,YHe,iE,aE,Id]),ne=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===ae.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new Dz(i.elicitations,r)}return new t(e,r,n)}},Dz=class extends ne{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(ae.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}});function Ys(t){return t==="completed"||t==="failed"||t==="cancelled"}var Ese=y(()=>{});var Tse,Ase,Ose,yE=y(()=>{Tse=Symbol("Let zodToJsonSchema decide on which parser to use"),Ase={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Ose=t=>typeof t=="string"?{...Ase,name:t}:{...Ase,...t}});var Rse,Qz=y(()=>{yE();Rse=t=>{let e=Ose(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function e2(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Ie(t,e,r,n,i){t[e]=r,e2(t,e,n,i)}var Xs=y(()=>{});var _E,bE=y(()=>{_E=(t,e)=>{let r=0;for(;r{bE()});function Ise(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==z.ZodAny&&(r.items=le(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Ie(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Ie(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Ie(r,"minItems",t.exactLength.value,t.exactLength.message,e),Ie(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var t2=y(()=>{hh();Xs();Mt()});function Pse(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?Ie(r,"minimum",n.value,n.message,e):Ie(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Ie(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Ie(r,"maximum",n.value,n.message,e):Ie(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Ie(r,"maximum",n.value,n.message,e));break;case"multipleOf":Ie(r,"multipleOf",n.value,n.message,e);break}return r}var r2=y(()=>{Xs()});function Cse(){return{type:"boolean"}}var n2=y(()=>{});function vE(t,e){return le(t.type._def,e)}var SE=y(()=>{Mt()});var Dse,i2=y(()=>{Mt();Dse=(t,e)=>le(t.innerType._def,e)});function o2(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((i,o)=>o2(t,e,i))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return jGe(t,e)}}var jGe,s2=y(()=>{Xs();jGe=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":Ie(r,"minimum",n.value,n.message,e);break;case"max":Ie(r,"maximum",n.value,n.message,e);break}return r}});function Nse(t,e){return{...le(t.innerType._def,e),default:t.defaultValue()}}var a2=y(()=>{Mt()});function jse(t,e){return e.effectStrategy==="input"?le(t.schema._def,e):yt(e)}var c2=y(()=>{Mt();qn()});function Mse(t){return{type:"string",enum:Array.from(t.values)}}var l2=y(()=>{});function Fse(t,e){let r=[le(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),le(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(o=>!!o),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,i=[];return r.forEach(o=>{if(MGe(o))i.push(...o.allOf),o.unevaluatedProperties===void 0&&(n=void 0);else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:a,...c}=o;s=c}else n=void 0;i.push(s)}}),i.length?{allOf:i,...n}:void 0}var MGe,u2=y(()=>{Mt();MGe=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function Lse(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var d2=y(()=>{});function wE(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":Ie(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":Ie(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":gi(r,"email",n.message,e);break;case"format:idn-email":gi(r,"idn-email",n.message,e);break;case"pattern:zod":Tr(r,hi.email,n.message,e);break}break;case"url":gi(r,"uri",n.message,e);break;case"uuid":gi(r,"uuid",n.message,e);break;case"regex":Tr(r,n.regex,n.message,e);break;case"cuid":Tr(r,hi.cuid,n.message,e);break;case"cuid2":Tr(r,hi.cuid2,n.message,e);break;case"startsWith":Tr(r,RegExp(`^${p2(n.value,e)}`),n.message,e);break;case"endsWith":Tr(r,RegExp(`${p2(n.value,e)}$`),n.message,e);break;case"datetime":gi(r,"date-time",n.message,e);break;case"date":gi(r,"date",n.message,e);break;case"time":gi(r,"time",n.message,e);break;case"duration":gi(r,"duration",n.message,e);break;case"length":Ie(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),Ie(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Tr(r,RegExp(p2(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&gi(r,"ipv4",n.message,e),n.version!=="v4"&&gi(r,"ipv6",n.message,e);break}case"base64url":Tr(r,hi.base64url,n.message,e);break;case"jwt":Tr(r,hi.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Tr(r,hi.ipv4Cidr,n.message,e),n.version!=="v4"&&Tr(r,hi.ipv6Cidr,n.message,e);break}case"emoji":Tr(r,hi.emoji(),n.message,e);break;case"ulid":{Tr(r,hi.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{gi(r,"binary",n.message,e);break}case"contentEncoding:base64":{Ie(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Tr(r,hi.base64,n.message,e);break}}break}case"nanoid":Tr(r,hi.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function p2(t,e){return e.patternStrategy==="escape"?LGe(t):t}function LGe(t){let e="";for(let r=0;ri.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):Ie(t,"format",e,r,n)}function Tr(t,e,r,n){t.pattern||t.allOf?.some(i=>i.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:zse(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Ie(t,"pattern",zse(e,n),r,n)}function zse(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,i="",o=!1,s=!1,a=!1;for(let c=0;c1&&t.reused==="ref"){o(s);continue}}}function Zs(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=t.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){n(d);let p=t.seen.get(d),m=p.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(m)):Object.assign(l,m),Object.assign(l,u),a._zod.parent===d)for(let g in l)g==="$ref"||g==="allOf"||g in u||delete l[g];if(m.$ref&&p.def)for(let g in l)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(l[g])===JSON.stringify(p.def[g])&&delete l[g]}let f=a._zod.parent;if(f&&f!==d){n(f);let p=t.seen.get(f);if(p?.schema.$ref&&(l.$ref=p.schema.$ref,p.def))for(let m in l)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(l[m])===JSON.stringify(p.def[m])&&delete l[m]}t.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};for(let a of[...t.seen.entries()].reverse())n(a[0]);let i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(a)}Object.assign(i,r.def??r.schema);let o=t.metadataRegistry.get(e)?.id;o!==void 0&&i.id===o&&delete i.id;let s=t.external?.defs??{};for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,s[c.defId]=c.def)}t.external||Object.keys(s).length>0&&(t.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:_d(e,"input",t.processors),output:_d(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ar(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ar(n.element,r);if(n.type==="set")return Ar(n.valueType,r);if(n.type==="lazy")return Ar(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Ar(n.innerType,r);if(n.type==="intersection")return Ar(n.left,r)||Ar(n.right,r);if(n.type==="record"||n.type==="map")return Ar(n.keyType,r)||Ar(n.valueType,r);if(n.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:Ar(n.in,r)||Ar(n.out,r);if(n.type==="object"){for(let i in n.shape)if(Ar(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(Ar(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(Ar(i,r))return!0;return!!(n.rest&&Ar(n.rest,r))}return!1}var zF,_d,tg=y(()=>{Dh();zF=(t,e={})=>r=>{let n=Hs({...r,processors:e});return Ve(t,n),Gs(n,t),Zs(n,t)},_d=(t,e,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},s=Hs({...i??{},target:o,io:e,processors:r});return Ve(t,s),Gs(s,t),Zs(s,t)}});function Pc(t,e){if("_idmap"in t){let n=t,i=Hs({...e,processors:fk}),o={};for(let c of n._idmap.entries()){let[l,u]=c;Ve(u,i)}let s={},a={registry:n,uri:e?.uri,defs:o};i.external=a;for(let c of n._idmap.entries()){let[l,u]=c;Gs(i,u),s[l]=Zs(i,u)}if(Object.keys(o).length>0){let c=i.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:o}}return{schemas:s}}let r=Hs({...e,processors:fk});return Ve(t,r),Gs(r,t),Zs(r,t)}var GBe,UF,qF,BF,HF,GF,ZF,VF,WF,KF,JF,YF,XF,QF,eL,tL,rL,nL,iL,oL,sL,aL,cL,lL,uL,dL,pk,fL,pL,mL,hL,gL,yL,_L,bL,vL,SL,wL,mk,xL,fk,bd=y(()=>{tg();ee();GBe={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},UF=(t,e,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:l}=t._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof s=="number"&&(i.maxLength=s),a&&(i.format=GBe[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let u=[...c];u.length===1?i.pattern=u[0].source:u.length>1&&(i.allOf=[...u.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},qF=(t,e,r,n)=>{let i=r,{minimum:o,maximum:s,format:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=t._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";let d=typeof u=="number"&&u>=(o??Number.NEGATIVE_INFINITY),f=typeof l=="number"&&l<=(s??Number.POSITIVE_INFINITY),p=e.target==="draft-04"||e.target==="openapi-3.0";d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof o=="number"&&(i.minimum=o),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof s=="number"&&(i.maximum=s),typeof c=="number"&&(i.multipleOf=c)},BF=(t,e,r,n)=>{r.type="boolean"},HF=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},GF=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},ZF=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},VF=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},WF=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},KF=(t,e,r,n)=>{r.not={}},JF=(t,e,r,n)=>{},YF=(t,e,r,n)=>{},XF=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},QF=(t,e,r,n)=>{let i=t._zod.def,o=yh(i.entries);o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),r.enum=o},eL=(t,e,r,n)=>{let i=t._zod.def,o=[];for(let s of i.values)if(s===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];r.type=s===null?"null":typeof s,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[s]:r.const=s}else o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),o.every(s=>typeof s=="boolean")&&(r.type="boolean"),o.every(s=>s===null)&&(r.type="null"),r.enum=o},tL=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},rL=(t,e,r,n)=>{let i=r,o=t._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},nL=(t,e,r,n)=>{let i=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:c}=t._zod.bag;s!==void 0&&(o.minLength=s),a!==void 0&&(o.maxLength=a),c?c.length===1?(o.contentMediaType=c[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=c.map(l=>({contentMediaType:l}))):Object.assign(i,o)},iL=(t,e,r,n)=>{r.type="boolean"},oL=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},sL=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},aL=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},cL=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},lL=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},uL=(t,e,r,n)=>{let i=r,o=t._zod.def,{minimum:s,maximum:a}=t._zod.bag;typeof s=="number"&&(i.minItems=s),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=Ve(o.element,e,{...n,path:[...n.path,"items"]})},dL=(t,e,r,n)=>{let i=r,o=t._zod.def;i.type="object",i.properties={};let s=o.shape;for(let l in s)i.properties[l]=Ve(s[l],e,{...n,path:[...n.path,"properties",l]});let a=new Set(Object.keys(s)),c=new Set([...a].filter(l=>{let u=o.shape[l]._zod;return e.io==="input"?u.optin===void 0:u.optout===void 0}));c.size>0&&(i.required=Array.from(c)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=Ve(o.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},pk=(t,e,r,n)=>{let i=t._zod.def,o=i.inclusive===!1,s=i.options.map((a,c)=>Ve(a,e,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=s:r.anyOf=s},fL=(t,e,r,n)=>{let i=t._zod.def,o=Ve(i.left,e,{...n,path:[...n.path,"allOf",0]}),s=Ve(i.right,e,{...n,path:[...n.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];r.allOf=c},pL=(t,e,r,n)=>{let i=r,o=t._zod.def;i.type="array";let s=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((f,p)=>Ve(f,e,{...n,path:[...n.path,s,p]})),l=o.rest?Ve(o.rest,e,{...n,path:[...n.path,a,...e.target==="openapi-3.0"?[o.items.length]:[]]}):null;e.target==="draft-2020-12"?(i.prefixItems=c,l&&(i.items=l)):e.target==="openapi-3.0"?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=t._zod.bag;typeof u=="number"&&(i.minItems=u),typeof d=="number"&&(i.maxItems=d)},mL=(t,e,r,n)=>{let i=r,o=t._zod.def;i.type="object";let s=o.keyType,c=s._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){let u=Ve(o.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let d of c)i.patternProperties[d.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=Ve(o.keyType,e,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=Ve(o.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let l=s._zod.values;if(l){let u=[...l].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(i.required=u)}},hL=(t,e,r,n)=>{let i=t._zod.def,o=Ve(i.innerType,e,n),s=e.seen.get(t);e.target==="openapi-3.0"?(s.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},gL=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType},yL=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},_L=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},bL=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},vL=(t,e,r,n)=>{let i=t._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s=e.io==="input"?o?i.out:i.in:i.out;Ve(s,e,n);let a=e.seen.get(t);a.ref=s},SL=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType,r.readOnly=!0},wL=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType},mk=(t,e,r,n)=>{let i=t._zod.def;Ve(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType},xL=(t,e,r,n)=>{let i=t._zod.innerType;Ve(i,e,n);let o=e.seen.get(t);o.ref=i},fk={string:UF,number:qF,boolean:BF,bigint:HF,symbol:GF,null:ZF,undefined:VF,void:WF,never:KF,any:JF,unknown:YF,date:XF,enum:QF,literal:eL,nan:tL,template_literal:rL,file:nL,success:iL,custom:oL,function:sL,transform:aL,map:cL,set:lL,array:uL,object:dL,union:pk,intersection:fL,tuple:pL,record:mL,nullable:hL,nonoptional:gL,default:yL,prefault:_L,catch:bL,pipe:vL,readonly:SL,promise:wL,optional:mk,lazy:xL}});var hk,Cie=y(()=>{bd();tg();hk=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let r=e?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Hs({processors:fk,target:r,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,r={path:[],schemaPath:[]}){return Ve(e,this.ctx,r)}emit(e,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),Gs(this.ctx,e);let n=Zs(this.ctx,e),{"~standard":i,...o}=n;return o}}});var Die={};var Nie=y(()=>{});var mi={};Pr(mi,{$ZodAny:()=>J0,$ZodArray:()=>t$,$ZodAsyncError:()=>fi,$ZodBase64:()=>z0,$ZodBase64URL:()=>U0,$ZodBigInt:()=>Oh,$ZodBigIntFormat:()=>Z0,$ZodBoolean:()=>Qu,$ZodCIDRv4:()=>F0,$ZodCIDRv6:()=>L0,$ZodCUID:()=>R0,$ZodCUID2:()=>I0,$ZodCatch:()=>b$,$ZodCheck:()=>Qe,$ZodCheckBigIntFormat:()=>JM,$ZodCheckEndsWith:()=>cF,$ZodCheckGreaterThan:()=>_0,$ZodCheckIncludes:()=>sF,$ZodCheckLengthEquals:()=>rF,$ZodCheckLessThan:()=>y0,$ZodCheckLowerCase:()=>iF,$ZodCheckMaxLength:()=>eF,$ZodCheckMaxSize:()=>YM,$ZodCheckMimeType:()=>uF,$ZodCheckMinLength:()=>tF,$ZodCheckMinSize:()=>XM,$ZodCheckMultipleOf:()=>WM,$ZodCheckNumberFormat:()=>KM,$ZodCheckOverwrite:()=>dF,$ZodCheckProperty:()=>lF,$ZodCheckRegex:()=>nF,$ZodCheckSizeEquals:()=>QM,$ZodCheckStartsWith:()=>aF,$ZodCheckStringFormat:()=>Xu,$ZodCheckUpperCase:()=>oF,$ZodCodec:()=>td,$ZodCustom:()=>E$,$ZodCustomStringFormat:()=>H0,$ZodDate:()=>e$,$ZodDefault:()=>h$,$ZodDiscriminatedUnion:()=>i$,$ZodE164:()=>q0,$ZodEmail:()=>E0,$ZodEmoji:()=>T0,$ZodEncodeError:()=>Ds,$ZodEnum:()=>l$,$ZodError:()=>wh,$ZodExactOptional:()=>p$,$ZodFile:()=>d$,$ZodFunction:()=>x$,$ZodGUID:()=>$0,$ZodIPv4:()=>N0,$ZodIPv6:()=>j0,$ZodISODate:()=>yF,$ZodISODateTime:()=>gF,$ZodISODuration:()=>bF,$ZodISOTime:()=>_F,$ZodIntersection:()=>o$,$ZodJWT:()=>B0,$ZodKSUID:()=>D0,$ZodLazy:()=>k$,$ZodLiteral:()=>u$,$ZodMAC:()=>M0,$ZodMap:()=>a$,$ZodNaN:()=>v$,$ZodNanoID:()=>O0,$ZodNever:()=>X0,$ZodNonOptional:()=>y$,$ZodNull:()=>K0,$ZodNullable:()=>m$,$ZodNumber:()=>Th,$ZodNumberFormat:()=>G0,$ZodObject:()=>r$,$ZodObjectJIT:()=>SF,$ZodOptional:()=>Ih,$ZodPipe:()=>Ph,$ZodPrefault:()=>g$,$ZodPreprocess:()=>wF,$ZodPromise:()=>$$,$ZodReadonly:()=>S$,$ZodRealError:()=>Hr,$ZodRecord:()=>s$,$ZodRegistry:()=>I$,$ZodSet:()=>c$,$ZodString:()=>Us,$ZodStringFormat:()=>We,$ZodSuccess:()=>_$,$ZodSymbol:()=>V0,$ZodTemplateLiteral:()=>w$,$ZodTransform:()=>f$,$ZodTuple:()=>Rh,$ZodType:()=>ue,$ZodULID:()=>P0,$ZodURL:()=>A0,$ZodUUID:()=>k0,$ZodUndefined:()=>W0,$ZodUnion:()=>ed,$ZodUnknown:()=>Y0,$ZodVoid:()=>Q0,$ZodXID:()=>C0,$ZodXor:()=>n$,$brand:()=>iM,$constructor:()=>k,$input:()=>TF,$output:()=>AF,Doc:()=>Ah,JSONSchema:()=>Die,JSONSchemaGenerator:()=>hk,NEVER:()=>nM,TimePrecision:()=>RF,_any:()=>W$,_array:()=>LF,_base64:()=>Yh,_base64url:()=>Xh,_bigint:()=>q$,_boolean:()=>U$,_catch:()=>LBe,_check:()=>Iie,_cidrv4:()=>Kh,_cidrv6:()=>Jh,_coercedBigint:()=>MF,_coercedBoolean:()=>jF,_coercedDate:()=>FF,_coercedNumber:()=>NF,_coercedString:()=>OF,_cuid:()=>qh,_cuid2:()=>Bh,_custom:()=>sk,_date:()=>X$,_decode:()=>a0,_decodeAsync:()=>l0,_default:()=>jBe,_discriminatedUnion:()=>$Be,_e164:()=>Qh,_email:()=>Nh,_emoji:()=>zh,_encode:()=>s0,_encodeAsync:()=>c0,_endsWith:()=>dd,_enum:()=>RBe,_file:()=>ok,_float32:()=>M$,_float64:()=>F$,_gt:()=>Qi,_gte:()=>Er,_guid:()=>id,_includes:()=>ld,_int:()=>j$,_int32:()=>L$,_int64:()=>B$,_intersection:()=>kBe,_ipv4:()=>Vh,_ipv6:()=>Wh,_isoDate:()=>PF,_isoDateTime:()=>IF,_isoDuration:()=>DF,_isoTime:()=>CF,_jwt:()=>eg,_ksuid:()=>Zh,_lazy:()=>BBe,_length:()=>Rc,_literal:()=>PBe,_lowercase:()=>ad,_lt:()=>Xi,_lte:()=>Sn,_mac:()=>D$,_map:()=>TBe,_max:()=>Sn,_maxLength:()=>Oc,_maxSize:()=>Bs,_mime:()=>fd,_min:()=>Er,_minLength:()=>Uo,_minSize:()=>eo,_multipleOf:()=>qs,_nan:()=>Q$,_nanoid:()=>Uh,_nativeEnum:()=>IBe,_negative:()=>tk,_never:()=>J$,_nonnegative:()=>nk,_nonoptional:()=>MBe,_nonpositive:()=>rk,_normalize:()=>pd,_null:()=>V$,_nullable:()=>NBe,_number:()=>N$,_optional:()=>DBe,_overwrite:()=>pi,_parse:()=>Wu,_parseAsync:()=>Ku,_pipe:()=>zBe,_positive:()=>ek,_promise:()=>HBe,_property:()=>ik,_readonly:()=>UBe,_record:()=>ABe,_refine:()=>ak,_regex:()=>sd,_safeDecode:()=>d0,_safeDecodeAsync:()=>p0,_safeEncode:()=>u0,_safeEncodeAsync:()=>f0,_safeParse:()=>Ju,_safeParseAsync:()=>Yu,_set:()=>OBe,_size:()=>Tc,_slugify:()=>yd,_startsWith:()=>ud,_string:()=>C$,_stringFormat:()=>Ic,_stringbool:()=>dk,_success:()=>FBe,_superRefine:()=>ck,_symbol:()=>G$,_templateLiteral:()=>qBe,_toLowerCase:()=>hd,_toUpperCase:()=>gd,_transform:()=>CBe,_trim:()=>md,_tuple:()=>EBe,_uint32:()=>z$,_uint64:()=>H$,_ulid:()=>Hh,_undefined:()=>Z$,_union:()=>wBe,_unknown:()=>K$,_uppercase:()=>cd,_url:()=>od,_uuid:()=>jh,_uuidv4:()=>Mh,_uuidv6:()=>Fh,_uuidv7:()=>Lh,_void:()=>Y$,_xid:()=>Gh,_xor:()=>xBe,clone:()=>nr,config:()=>Tt,createStandardJSONSchemaMethod:()=>_d,createToJSONSchemaMethod:()=>zF,decode:()=>ore,decodeAsync:()=>are,describe:()=>lk,encode:()=>ire,encodeAsync:()=>sre,extractDefs:()=>Gs,finalize:()=>Zs,flattenError:()=>xh,formatError:()=>$h,globalConfig:()=>wc,globalRegistry:()=>ir,initializeContext:()=>Hs,isValidBase64:()=>vF,isValidBase64URL:()=>Pre,isValidJWT:()=>Cre,locales:()=>nd,meta:()=>uk,parse:()=>kc,parseAsync:()=>Ec,prettifyError:()=>gM,process:()=>Ve,regexes:()=>Gr,registry:()=>P$,safeDecode:()=>lre,safeDecodeAsync:()=>dre,safeEncode:()=>cre,safeEncodeAsync:()=>ure,safeParse:()=>Ls,safeParseAsync:()=>zs,toDotPath:()=>nre,toJSONSchema:()=>Pc,treeifyError:()=>hM,util:()=>M,version:()=>pF});var mr=y(()=>{xc();_M();yM();xF();b0();mF();ee();g0();R$();Dh();fF();Pie();tg();bd();Cie();Nie()});var $L=y(()=>{mr()});function kL(t,e){let r={type:"object",shape:t??{},...U(e)};return new KBe(r)}var WBe,KBe,jie=y(()=>{mr();ee();$L();WBe=k("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");ue.init(t,e),t.def=e,t.type=e.type,t.parse=(r,n)=>kc(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Ls(t,r,n),t.parseAsync=async(r,n)=>Ec(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>zs(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),t.with=t.check,t.clone=(r,n)=>nr(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.apply=r=>r(t)}),KBe=k("ZodMiniObject",(t,e)=>{r$.init(t,e),WBe.init(t,e),ve(t,"shape",()=>e.shape)})});var Mie=y(()=>{});var Fie=y(()=>{});var Lie=y(()=>{});var zie=y(()=>{mr();$L();jie();Mie();bd();R$();Fie();Lie()});var EL=y(()=>{zie()});function Ln(t){return!!t._zod}function Cc(t){let e=Object.values(t);if(e.length===0)return kL({});let r=e.every(Ln),n=e.every(i=>!Ln(i));if(r)return kL(t);if(n)return Bte(t);throw new Error("Mixed Zod versions detected in object shape.")}function Vs(t,e){return Ln(t)?Ls(t,e):t.safeParse(e)}async function gk(t,e){return Ln(t)?await zs(t,e):await t.safeParseAsync(e)}function Ws(t){if(!t)return;let e;if(Ln(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function vd(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let n=Object.values(t);if(n.length>0&&n.every(i=>typeof i=="object"&&i!==null&&(i._def!==void 0||i._zod!==void 0||typeof i.parse=="function")))return Cc(t)}}if(Ln(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function yk(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function qie(t){return t.description}function Bie(t){if(Ln(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function _k(t){if(Ln(t)){let o=t._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var rg=y(()=>{hh();EL()});var bk={};Pr(bk,{endsWith:()=>dd,gt:()=>Qi,gte:()=>Er,includes:()=>ld,length:()=>Rc,lowercase:()=>ad,lt:()=>Xi,lte:()=>Sn,maxLength:()=>Oc,maxSize:()=>Bs,mime:()=>fd,minLength:()=>Uo,minSize:()=>eo,multipleOf:()=>qs,negative:()=>tk,nonnegative:()=>nk,nonpositive:()=>rk,normalize:()=>pd,overwrite:()=>pi,positive:()=>ek,property:()=>ik,regex:()=>sd,size:()=>Tc,slugify:()=>yd,startsWith:()=>ud,toLowerCase:()=>hd,toUpperCase:()=>gd,trim:()=>md,uppercase:()=>cd});var vk=y(()=>{mr()});var Ks={};Pr(Ks,{ZodISODate:()=>wk,ZodISODateTime:()=>Sk,ZodISODuration:()=>$k,ZodISOTime:()=>xk,date:()=>TL,datetime:()=>AL,duration:()=>RL,time:()=>OL});function AL(t){return IF(Sk,t)}function TL(t){return PF(wk,t)}function OL(t){return CF(xk,t)}function RL(t){return DF($k,t)}var Sk,wk,xk,$k,ng=y(()=>{mr();og();Sk=k("ZodISODateTime",(t,e)=>{gF.init(t,e),et.init(t,e)});wk=k("ZodISODate",(t,e)=>{yF.init(t,e),et.init(t,e)});xk=k("ZodISOTime",(t,e)=>{_F.init(t,e),et.init(t,e)});$k=k("ZodISODuration",(t,e)=>{bF.init(t,e),et.init(t,e)})});var Hie,XBe,Zr,IL=y(()=>{mr();mr();ee();Hie=(t,e)=>{wh.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>$h(t,r)},flatten:{value:r=>xh(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Gu,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Gu,2)}},isEmpty:{get(){return t.issues.length===0}}})},XBe=k("ZodError",Hie),Zr=k("ZodError",Hie,{Parent:Error})});var PL,CL,DL,NL,jL,ML,FL,LL,zL,UL,qL,BL,HL=y(()=>{mr();IL();PL=Wu(Zr),CL=Ku(Zr),DL=Ju(Zr),NL=Yu(Zr),jL=s0(Zr),ML=a0(Zr),FL=c0(Zr),LL=l0(Zr),zL=u0(Zr),UL=d0(Zr),qL=f0(Zr),BL=p0(Zr)});var ig={};Pr(ig,{ZodAny:()=>KL,ZodArray:()=>QL,ZodBase64:()=>zk,ZodBase64URL:()=>Uk,ZodBigInt:()=>Ad,ZodBigIntFormat:()=>Hk,ZodBoolean:()=>Ed,ZodCIDRv4:()=>Fk,ZodCIDRv6:()=>Lk,ZodCUID:()=>Ik,ZodCUID2:()=>Pk,ZodCatch:()=>bz,ZodCodec:()=>gg,ZodCustom:()=>yg,ZodCustomStringFormat:()=>$d,ZodDate:()=>dg,ZodDefault:()=>pz,ZodDiscriminatedUnion:()=>tz,ZodE164:()=>qk,ZodEmail:()=>Tk,ZodEmoji:()=>Ok,ZodEnum:()=>wd,ZodExactOptional:()=>uz,ZodFile:()=>cz,ZodFunction:()=>Oz,ZodGUID:()=>sg,ZodIPv4:()=>jk,ZodIPv6:()=>Mk,ZodIntersection:()=>rz,ZodJWT:()=>Bk,ZodKSUID:()=>Nk,ZodLazy:()=>Ez,ZodLiteral:()=>az,ZodMAC:()=>GL,ZodMap:()=>oz,ZodNaN:()=>Sz,ZodNanoID:()=>Rk,ZodNever:()=>YL,ZodNonOptional:()=>Vk,ZodNull:()=>WL,ZodNullable:()=>fz,ZodNumber:()=>kd,ZodNumberFormat:()=>Dc,ZodObject:()=>fg,ZodOptional:()=>Od,ZodPipe:()=>hg,ZodPrefault:()=>hz,ZodPreprocess:()=>wz,ZodPromise:()=>Tz,ZodReadonly:()=>xz,ZodRecord:()=>Sd,ZodSet:()=>sz,ZodString:()=>xd,ZodStringFormat:()=>et,ZodSuccess:()=>_z,ZodSymbol:()=>ZL,ZodTemplateLiteral:()=>kz,ZodTransform:()=>lz,ZodTuple:()=>nz,ZodType:()=>_e,ZodULID:()=>Ck,ZodURL:()=>lg,ZodUUID:()=>to,ZodUndefined:()=>VL,ZodUnion:()=>pg,ZodUnknown:()=>JL,ZodVoid:()=>XL,ZodXID:()=>Dk,ZodXor:()=>ez,_ZodString:()=>Ak,_default:()=>mz,_function:()=>Woe,any:()=>Ooe,array:()=>ke,base64:()=>foe,base64url:()=>poe,bigint:()=>$oe,boolean:()=>It,catch:()=>vz,check:()=>Koe,cidrv4:()=>uoe,cidrv6:()=>doe,codec:()=>Hoe,cuid:()=>roe,cuid2:()=>noe,custom:()=>Wk,date:()=>Ioe,describe:()=>Joe,discriminatedUnion:()=>mg,e164:()=>moe,email:()=>Zie,emoji:()=>eoe,enum:()=>sr,exactOptional:()=>dz,file:()=>zoe,float32:()=>voe,float64:()=>Soe,function:()=>Woe,guid:()=>Vie,hash:()=>boe,hex:()=>_oe,hostname:()=>yoe,httpUrl:()=>Qie,instanceof:()=>Xoe,int:()=>kk,int32:()=>woe,int64:()=>koe,intersection:()=>Td,invertCodec:()=>Goe,ipv4:()=>aoe,ipv6:()=>loe,json:()=>ese,jwt:()=>hoe,keyof:()=>Poe,ksuid:()=>soe,lazy:()=>Az,literal:()=>re,looseObject:()=>or,looseRecord:()=>joe,mac:()=>coe,map:()=>Moe,meta:()=>Yoe,nan:()=>Boe,nanoid:()=>toe,nativeEnum:()=>Loe,never:()=>Gk,nonoptional:()=>yz,null:()=>ug,nullable:()=>ag,nullish:()=>Uoe,number:()=>Me,object:()=>W,optional:()=>at,partialRecord:()=>Noe,pipe:()=>Ek,prefault:()=>gz,preprocess:()=>_g,promise:()=>Voe,readonly:()=>$z,record:()=>Ke,refine:()=>Rz,set:()=>Foe,strictObject:()=>Coe,string:()=>I,stringFormat:()=>goe,stringbool:()=>Qoe,success:()=>qoe,superRefine:()=>Iz,symbol:()=>Aoe,templateLiteral:()=>Zoe,transform:()=>Zk,tuple:()=>iz,uint32:()=>xoe,uint64:()=>Eoe,ulid:()=>ioe,undefined:()=>Toe,union:()=>rt,unknown:()=>tt,url:()=>Xie,uuid:()=>Wie,uuidv4:()=>Kie,uuidv6:()=>Jie,uuidv7:()=>Yie,void:()=>Roe,xid:()=>ooe,xor:()=>Doe});function cg(t,e,r){let n=Object.getPrototypeOf(t),i=Gie.get(n);if(i||(i=new Set,Gie.set(n,i)),!i.has(e)){i.add(e);for(let o in r){let s=r[o];Object.defineProperty(n,o,{configurable:!0,enumerable:!1,get(){let a=s.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}function I(t){return C$(xd,t)}function Zie(t){return Nh(Tk,t)}function Vie(t){return id(sg,t)}function Wie(t){return jh(to,t)}function Kie(t){return Mh(to,t)}function Jie(t){return Fh(to,t)}function Yie(t){return Lh(to,t)}function Xie(t){return od(lg,t)}function Qie(t){return od(lg,{protocol:Gr.httpProtocol,hostname:Gr.domain,...M.normalizeParams(t)})}function eoe(t){return zh(Ok,t)}function toe(t){return Uh(Rk,t)}function roe(t){return qh(Ik,t)}function noe(t){return Bh(Pk,t)}function ioe(t){return Hh(Ck,t)}function ooe(t){return Gh(Dk,t)}function soe(t){return Zh(Nk,t)}function aoe(t){return Vh(jk,t)}function coe(t){return D$(GL,t)}function loe(t){return Wh(Mk,t)}function uoe(t){return Kh(Fk,t)}function doe(t){return Jh(Lk,t)}function foe(t){return Yh(zk,t)}function poe(t){return Xh(Uk,t)}function moe(t){return Qh(qk,t)}function hoe(t){return eg(Bk,t)}function goe(t,e,r={}){return Ic($d,t,e,r)}function yoe(t){return Ic($d,"hostname",Gr.hostname,t)}function _oe(t){return Ic($d,"hex",Gr.hex,t)}function boe(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,i=Gr[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return Ic($d,n,i,e)}function Me(t){return N$(kd,t)}function kk(t){return j$(Dc,t)}function voe(t){return M$(Dc,t)}function Soe(t){return F$(Dc,t)}function woe(t){return L$(Dc,t)}function xoe(t){return z$(Dc,t)}function It(t){return U$(Ed,t)}function $oe(t){return q$(Ad,t)}function koe(t){return B$(Hk,t)}function Eoe(t){return H$(Hk,t)}function Aoe(t){return G$(ZL,t)}function Toe(t){return Z$(VL,t)}function ug(t){return V$(WL,t)}function Ooe(){return W$(KL)}function tt(){return K$(JL)}function Gk(t){return J$(YL,t)}function Roe(t){return Y$(XL,t)}function Ioe(t){return X$(dg,t)}function ke(t,e){return LF(QL,t,e)}function Poe(t){let e=t._zod.def.shape;return sr(Object.keys(e))}function W(t,e){let r={type:"object",shape:t??{},...M.normalizeParams(e)};return new fg(r)}function Coe(t,e){return new fg({type:"object",shape:t,catchall:Gk(),...M.normalizeParams(e)})}function or(t,e){return new fg({type:"object",shape:t,catchall:tt(),...M.normalizeParams(e)})}function rt(t,e){return new pg({type:"union",options:t,...M.normalizeParams(e)})}function Doe(t,e){return new ez({type:"union",options:t,inclusive:!1,...M.normalizeParams(e)})}function mg(t,e,r){return new tz({type:"union",options:e,discriminator:t,...M.normalizeParams(r)})}function Td(t,e){return new rz({type:"intersection",left:t,right:e})}function iz(t,e,r){let n=e instanceof ue,i=n?r:e,o=n?e:null;return new nz({type:"tuple",items:t,rest:o,...M.normalizeParams(i)})}function Ke(t,e,r){return!e||!e._zod?new Sd({type:"record",keyType:I(),valueType:t,...M.normalizeParams(e)}):new Sd({type:"record",keyType:t,valueType:e,...M.normalizeParams(r)})}function Noe(t,e,r){let n=nr(t);return n._zod.values=void 0,new Sd({type:"record",keyType:n,valueType:e,...M.normalizeParams(r)})}function joe(t,e,r){return new Sd({type:"record",keyType:t,valueType:e,mode:"loose",...M.normalizeParams(r)})}function Moe(t,e,r){return new oz({type:"map",keyType:t,valueType:e,...M.normalizeParams(r)})}function Foe(t,e){return new sz({type:"set",valueType:t,...M.normalizeParams(e)})}function sr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new wd({type:"enum",entries:r,...M.normalizeParams(e)})}function Loe(t,e){return new wd({type:"enum",entries:t,...M.normalizeParams(e)})}function re(t,e){return new az({type:"literal",values:Array.isArray(t)?t:[t],...M.normalizeParams(e)})}function zoe(t){return ok(cz,t)}function Zk(t){return new lz({type:"transform",transform:t})}function at(t){return new Od({type:"optional",innerType:t})}function dz(t){return new uz({type:"optional",innerType:t})}function ag(t){return new fz({type:"nullable",innerType:t})}function Uoe(t){return at(ag(t))}function mz(t,e){return new pz({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}function gz(t,e){return new hz({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}function yz(t,e){return new Vk({type:"nonoptional",innerType:t,...M.normalizeParams(e)})}function qoe(t){return new _z({type:"success",innerType:t})}function vz(t,e){return new bz({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}function Boe(t){return Q$(Sz,t)}function Ek(t,e){return new hg({type:"pipe",in:t,out:e})}function Hoe(t,e,r){return new gg({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}function Goe(t){let e=t._zod.def;return new gg({type:"pipe",in:e.out,out:e.in,transform:e.reverseTransform,reverseTransform:e.transform})}function $z(t){return new xz({type:"readonly",innerType:t})}function Zoe(t,e){return new kz({type:"template_literal",parts:t,...M.normalizeParams(e)})}function Az(t){return new Ez({type:"lazy",getter:t})}function Voe(t){return new Tz({type:"promise",innerType:t})}function Woe(t){return new Oz({type:"function",input:Array.isArray(t?.input)?iz(t?.input):t?.input??ke(tt()),output:t?.output??tt()})}function Koe(t){let e=new Qe({check:"custom"});return e._zod.check=t,e}function Wk(t,e){return sk(yg,t??(()=>!0),e)}function Rz(t,e={}){return ak(yg,t,e)}function Iz(t,e){return ck(t,e)}function Xoe(t,e={}){let r=new yg({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...M.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=n=>{n.value instanceof t||n.issues.push({code:"invalid_type",expected:t.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}function ese(t){let e=Az(()=>rt([I(t),Me(),It(),ug(),ke(e),Ke(I(),e)]));return e}function _g(t,e){return new wz({type:"pipe",in:Zk(t),out:e})}var Gie,_e,Ak,xd,et,Tk,sg,to,lg,Ok,Rk,Ik,Pk,Ck,Dk,Nk,jk,GL,Mk,Fk,Lk,zk,Uk,qk,Bk,$d,kd,Dc,Ed,Ad,Hk,ZL,VL,WL,KL,JL,YL,XL,dg,QL,fg,pg,ez,tz,rz,nz,Sd,oz,sz,wd,az,cz,lz,Od,uz,fz,pz,hz,Vk,_z,bz,Sz,hg,gg,wz,xz,kz,Ez,Tz,Oz,yg,Joe,Yoe,Qoe,og=y(()=>{mr();mr();bd();tg();vk();ng();HL();Gie=new WeakMap;_e=k("ZodType",(t,e)=>(ue.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:_d(t,"input"),output:_d(t,"output")}}),t.toJSONSchema=zF(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,n)=>PL(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>DL(t,r,n),t.parseAsync=async(r,n)=>CL(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>NL(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>jL(t,r,n),t.decode=(r,n)=>ML(t,r,n),t.encodeAsync=async(r,n)=>FL(t,r,n),t.decodeAsync=async(r,n)=>LL(t,r,n),t.safeEncode=(r,n)=>zL(t,r,n),t.safeDecode=(r,n)=>UL(t,r,n),t.safeEncodeAsync=async(r,n)=>qL(t,r,n),t.safeDecodeAsync=async(r,n)=>BL(t,r,n),cg(t,"ZodType",{check(...r){let n=this.def;return this.clone(M.mergeDefs(n,{checks:[...n.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return nr(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(Rz(r,n))},superRefine(r,n){return this.check(Iz(r,n))},overwrite(r){return this.check(pi(r))},optional(){return at(this)},exactOptional(){return dz(this)},nullable(){return ag(this)},nullish(){return at(ag(this))},nonoptional(r){return yz(this,r)},array(){return ke(this)},or(r){return rt([this,r])},and(r){return Td(this,r)},transform(r){return Ek(this,Zk(r))},default(r){return mz(this,r)},prefault(r){return gz(this,r)},catch(r){return vz(this,r)},pipe(r){return Ek(this,r)},readonly(){return $z(this)},describe(r){let n=this.clone();return ir.add(n,{description:r}),n},meta(...r){if(r.length===0)return ir.get(this);let n=this.clone();return ir.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){return ir.get(t)?.description},configurable:!0}),t)),Ak=k("_ZodString",(t,e)=>{Us.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(n,i,o)=>UF(t,n,i,o);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,cg(t,"_ZodString",{regex(...n){return this.check(sd(...n))},includes(...n){return this.check(ld(...n))},startsWith(...n){return this.check(ud(...n))},endsWith(...n){return this.check(dd(...n))},min(...n){return this.check(Uo(...n))},max(...n){return this.check(Oc(...n))},length(...n){return this.check(Rc(...n))},nonempty(...n){return this.check(Uo(1,...n))},lowercase(n){return this.check(ad(n))},uppercase(n){return this.check(cd(n))},trim(){return this.check(md())},normalize(...n){return this.check(pd(...n))},toLowerCase(){return this.check(hd())},toUpperCase(){return this.check(gd())},slugify(){return this.check(yd())}})}),xd=k("ZodString",(t,e)=>{Us.init(t,e),Ak.init(t,e),t.email=r=>t.check(Nh(Tk,r)),t.url=r=>t.check(od(lg,r)),t.jwt=r=>t.check(eg(Bk,r)),t.emoji=r=>t.check(zh(Ok,r)),t.guid=r=>t.check(id(sg,r)),t.uuid=r=>t.check(jh(to,r)),t.uuidv4=r=>t.check(Mh(to,r)),t.uuidv6=r=>t.check(Fh(to,r)),t.uuidv7=r=>t.check(Lh(to,r)),t.nanoid=r=>t.check(Uh(Rk,r)),t.guid=r=>t.check(id(sg,r)),t.cuid=r=>t.check(qh(Ik,r)),t.cuid2=r=>t.check(Bh(Pk,r)),t.ulid=r=>t.check(Hh(Ck,r)),t.base64=r=>t.check(Yh(zk,r)),t.base64url=r=>t.check(Xh(Uk,r)),t.xid=r=>t.check(Gh(Dk,r)),t.ksuid=r=>t.check(Zh(Nk,r)),t.ipv4=r=>t.check(Vh(jk,r)),t.ipv6=r=>t.check(Wh(Mk,r)),t.cidrv4=r=>t.check(Kh(Fk,r)),t.cidrv6=r=>t.check(Jh(Lk,r)),t.e164=r=>t.check(Qh(qk,r)),t.datetime=r=>t.check(AL(r)),t.date=r=>t.check(TL(r)),t.time=r=>t.check(OL(r)),t.duration=r=>t.check(RL(r))});et=k("ZodStringFormat",(t,e)=>{We.init(t,e),Ak.init(t,e)}),Tk=k("ZodEmail",(t,e)=>{E0.init(t,e),et.init(t,e)});sg=k("ZodGUID",(t,e)=>{$0.init(t,e),et.init(t,e)});to=k("ZodUUID",(t,e)=>{k0.init(t,e),et.init(t,e)});lg=k("ZodURL",(t,e)=>{A0.init(t,e),et.init(t,e)});Ok=k("ZodEmoji",(t,e)=>{T0.init(t,e),et.init(t,e)});Rk=k("ZodNanoID",(t,e)=>{O0.init(t,e),et.init(t,e)});Ik=k("ZodCUID",(t,e)=>{R0.init(t,e),et.init(t,e)});Pk=k("ZodCUID2",(t,e)=>{I0.init(t,e),et.init(t,e)});Ck=k("ZodULID",(t,e)=>{P0.init(t,e),et.init(t,e)});Dk=k("ZodXID",(t,e)=>{C0.init(t,e),et.init(t,e)});Nk=k("ZodKSUID",(t,e)=>{D0.init(t,e),et.init(t,e)});jk=k("ZodIPv4",(t,e)=>{N0.init(t,e),et.init(t,e)});GL=k("ZodMAC",(t,e)=>{M0.init(t,e),et.init(t,e)});Mk=k("ZodIPv6",(t,e)=>{j0.init(t,e),et.init(t,e)});Fk=k("ZodCIDRv4",(t,e)=>{F0.init(t,e),et.init(t,e)});Lk=k("ZodCIDRv6",(t,e)=>{L0.init(t,e),et.init(t,e)});zk=k("ZodBase64",(t,e)=>{z0.init(t,e),et.init(t,e)});Uk=k("ZodBase64URL",(t,e)=>{U0.init(t,e),et.init(t,e)});qk=k("ZodE164",(t,e)=>{q0.init(t,e),et.init(t,e)});Bk=k("ZodJWT",(t,e)=>{B0.init(t,e),et.init(t,e)});$d=k("ZodCustomStringFormat",(t,e)=>{H0.init(t,e),et.init(t,e)});kd=k("ZodNumber",(t,e)=>{Th.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(n,i,o)=>qF(t,n,i,o),cg(t,"ZodNumber",{gt(n,i){return this.check(Qi(n,i))},gte(n,i){return this.check(Er(n,i))},min(n,i){return this.check(Er(n,i))},lt(n,i){return this.check(Xi(n,i))},lte(n,i){return this.check(Sn(n,i))},max(n,i){return this.check(Sn(n,i))},int(n){return this.check(kk(n))},safe(n){return this.check(kk(n))},positive(n){return this.check(Qi(0,n))},nonnegative(n){return this.check(Er(0,n))},negative(n){return this.check(Xi(0,n))},nonpositive(n){return this.check(Sn(0,n))},multipleOf(n,i){return this.check(qs(n,i))},step(n,i){return this.check(qs(n,i))},finite(){return this}});let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});Dc=k("ZodNumberFormat",(t,e)=>{G0.init(t,e),kd.init(t,e)});Ed=k("ZodBoolean",(t,e)=>{Qu.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>BF(t,r,n,i)});Ad=k("ZodBigInt",(t,e)=>{Oh.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(n,i,o)=>HF(t,n,i,o),t.gte=(n,i)=>t.check(Er(n,i)),t.min=(n,i)=>t.check(Er(n,i)),t.gt=(n,i)=>t.check(Qi(n,i)),t.gte=(n,i)=>t.check(Er(n,i)),t.min=(n,i)=>t.check(Er(n,i)),t.lt=(n,i)=>t.check(Xi(n,i)),t.lte=(n,i)=>t.check(Sn(n,i)),t.max=(n,i)=>t.check(Sn(n,i)),t.positive=n=>t.check(Qi(BigInt(0),n)),t.negative=n=>t.check(Xi(BigInt(0),n)),t.nonpositive=n=>t.check(Sn(BigInt(0),n)),t.nonnegative=n=>t.check(Er(BigInt(0),n)),t.multipleOf=(n,i)=>t.check(qs(n,i));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});Hk=k("ZodBigIntFormat",(t,e)=>{Z0.init(t,e),Ad.init(t,e)});ZL=k("ZodSymbol",(t,e)=>{V0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>GF(t,r,n,i)});VL=k("ZodUndefined",(t,e)=>{W0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>VF(t,r,n,i)});WL=k("ZodNull",(t,e)=>{K0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>ZF(t,r,n,i)});KL=k("ZodAny",(t,e)=>{J0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>JF(t,r,n,i)});JL=k("ZodUnknown",(t,e)=>{Y0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>YF(t,r,n,i)});YL=k("ZodNever",(t,e)=>{X0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>KF(t,r,n,i)});XL=k("ZodVoid",(t,e)=>{Q0.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>WF(t,r,n,i)});dg=k("ZodDate",(t,e)=>{e$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(n,i,o)=>XF(t,n,i,o),t.min=(n,i)=>t.check(Er(n,i)),t.max=(n,i)=>t.check(Sn(n,i));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});QL=k("ZodArray",(t,e)=>{t$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>uL(t,r,n,i),t.element=e.element,cg(t,"ZodArray",{min(r,n){return this.check(Uo(r,n))},nonempty(r){return this.check(Uo(1,r))},max(r,n){return this.check(Oc(r,n))},length(r,n){return this.check(Rc(r,n))},unwrap(){return this.element}})});fg=k("ZodObject",(t,e)=>{SF.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>dL(t,r,n,i),M.defineLazy(t,"shape",()=>e.shape),cg(t,"ZodObject",{keyof(){return sr(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:tt()})},loose(){return this.clone({...this._zod.def,catchall:tt()})},strict(){return this.clone({...this._zod.def,catchall:Gk()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return M.extend(this,r)},safeExtend(r){return M.safeExtend(this,r)},merge(r){return M.merge(this,r)},pick(r){return M.pick(this,r)},omit(r){return M.omit(this,r)},partial(...r){return M.partial(Od,this,r[0])},required(...r){return M.required(Vk,this,r[0])}})});pg=k("ZodUnion",(t,e)=>{ed.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>pk(t,r,n,i),t.options=e.options});ez=k("ZodXor",(t,e)=>{pg.init(t,e),n$.init(t,e),t._zod.processJSONSchema=(r,n,i)=>pk(t,r,n,i),t.options=e.options});tz=k("ZodDiscriminatedUnion",(t,e)=>{pg.init(t,e),i$.init(t,e)});rz=k("ZodIntersection",(t,e)=>{o$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>fL(t,r,n,i)});nz=k("ZodTuple",(t,e)=>{Rh.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>pL(t,r,n,i),t.rest=r=>t.clone({...t._zod.def,rest:r})});Sd=k("ZodRecord",(t,e)=>{s$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>mL(t,r,n,i),t.keyType=e.keyType,t.valueType=e.valueType});oz=k("ZodMap",(t,e)=>{a$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>cL(t,r,n,i),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(eo(...r)),t.nonempty=r=>t.check(eo(1,r)),t.max=(...r)=>t.check(Bs(...r)),t.size=(...r)=>t.check(Tc(...r))});sz=k("ZodSet",(t,e)=>{c$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>lL(t,r,n,i),t.min=(...r)=>t.check(eo(...r)),t.nonempty=r=>t.check(eo(1,r)),t.max=(...r)=>t.check(Bs(...r)),t.size=(...r)=>t.check(Tc(...r))});wd=k("ZodEnum",(t,e)=>{l$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(n,i,o)=>QF(t,n,i,o),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{let o={};for(let s of n)if(r.has(s))o[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new wd({...e,checks:[],...M.normalizeParams(i),entries:o})},t.exclude=(n,i)=>{let o={...e.entries};for(let s of n)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new wd({...e,checks:[],...M.normalizeParams(i),entries:o})}});az=k("ZodLiteral",(t,e)=>{u$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>eL(t,r,n,i),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});cz=k("ZodFile",(t,e)=>{d$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>nL(t,r,n,i),t.min=(r,n)=>t.check(eo(r,n)),t.max=(r,n)=>t.check(Bs(r,n)),t.mime=(r,n)=>t.check(fd(Array.isArray(r)?r:[r],n))});lz=k("ZodTransform",(t,e)=>{f$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>aL(t,r,n,i),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ds(t.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(M.issue(o,r.value,e));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(M.issue(s))}};let i=e.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});Od=k("ZodOptional",(t,e)=>{Ih.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>mk(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});uz=k("ZodExactOptional",(t,e)=>{p$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>mk(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});fz=k("ZodNullable",(t,e)=>{m$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>hL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});pz=k("ZodDefault",(t,e)=>{h$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>yL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});hz=k("ZodPrefault",(t,e)=>{g$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>_L(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});Vk=k("ZodNonOptional",(t,e)=>{y$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>gL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});_z=k("ZodSuccess",(t,e)=>{_$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>iL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});bz=k("ZodCatch",(t,e)=>{b$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>bL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});Sz=k("ZodNaN",(t,e)=>{v$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>tL(t,r,n,i)});hg=k("ZodPipe",(t,e)=>{Ph.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>vL(t,r,n,i),t.in=e.in,t.out=e.out});gg=k("ZodCodec",(t,e)=>{hg.init(t,e),td.init(t,e)});wz=k("ZodPreprocess",(t,e)=>{hg.init(t,e),wF.init(t,e)}),xz=k("ZodReadonly",(t,e)=>{S$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>SL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});kz=k("ZodTemplateLiteral",(t,e)=>{w$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>rL(t,r,n,i)});Ez=k("ZodLazy",(t,e)=>{k$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>xL(t,r,n,i),t.unwrap=()=>t._zod.def.getter()});Tz=k("ZodPromise",(t,e)=>{$$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>wL(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});Oz=k("ZodFunction",(t,e)=>{x$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>sL(t,r,n,i)});yg=k("ZodCustom",(t,e)=>{E$.init(t,e),_e.init(t,e),t._zod.processJSONSchema=(r,n,i)=>oL(t,r,n,i)});Joe=lk,Yoe=uk;Qoe=(...t)=>dk({Codec:gg,Boolean:Ed,String:xd},...t)});function tHe(t){Tt({customError:t})}function rHe(){return Tt().customError}var eHe,Pz,tse=y(()=>{mr();eHe={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};Pz||(Pz={})});function iHe(t,e){let r=t.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function oHe(t,e){if(!t.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=t.slice(1).split("/").filter(Boolean);if(r.length===0)return e.rootSchema;let n=e.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let i=r[1];if(!i||!e.defs[i])throw new Error(`Reference not found: ${t}`);return e.defs[i]}throw new Error(`Reference not found: ${t}`)}function rse(t,e){if(t.not!==void 0){if(typeof t.not=="object"&&Object.keys(t.not).length===0)return Z.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(t.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(t.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(t.if!==void 0||t.then!==void 0||t.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(t.dependentSchemas!==void 0||t.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(t.$ref){let i=t.$ref;if(e.refs.has(i))return e.refs.get(i);if(e.processing.has(i))return Z.lazy(()=>{if(!e.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return e.refs.get(i)});e.processing.add(i);let o=oHe(i,e),s=hr(o,e);return e.refs.set(i,s),e.processing.delete(i),s}if(t.enum!==void 0){let i=t.enum;if(e.version==="openapi-3.0"&&t.nullable===!0&&i.length===1&&i[0]===null)return Z.null();if(i.length===0)return Z.never();if(i.length===1)return Z.literal(i[0]);if(i.every(s=>typeof s=="string"))return Z.enum(i);let o=i.map(s=>Z.literal(s));return o.length<2?o[0]:Z.union([o[0],o[1],...o.slice(2)])}if(t.const!==void 0)return Z.literal(t.const);let r=t.type;if(Array.isArray(r)){let i=r.map(o=>{let s={...t,type:o};return rse(s,e)});return i.length===0?Z.never():i.length===1?i[0]:Z.union(i)}if(!r)return Z.any();let n;switch(r){case"string":{let i=Z.string();if(t.format){let o=t.format;o==="email"?i=i.check(Z.email()):o==="uri"||o==="uri-reference"?i=i.check(Z.url()):o==="uuid"||o==="guid"?i=i.check(Z.uuid()):o==="date-time"?i=i.check(Z.iso.datetime()):o==="date"?i=i.check(Z.iso.date()):o==="time"?i=i.check(Z.iso.time()):o==="duration"?i=i.check(Z.iso.duration()):o==="ipv4"?i=i.check(Z.ipv4()):o==="ipv6"?i=i.check(Z.ipv6()):o==="mac"?i=i.check(Z.mac()):o==="cidr"?i=i.check(Z.cidrv4()):o==="cidr-v6"?i=i.check(Z.cidrv6()):o==="base64"?i=i.check(Z.base64()):o==="base64url"?i=i.check(Z.base64url()):o==="e164"?i=i.check(Z.e164()):o==="jwt"?i=i.check(Z.jwt()):o==="emoji"?i=i.check(Z.emoji()):o==="nanoid"?i=i.check(Z.nanoid()):o==="cuid"?i=i.check(Z.cuid()):o==="cuid2"?i=i.check(Z.cuid2()):o==="ulid"?i=i.check(Z.ulid()):o==="xid"?i=i.check(Z.xid()):o==="ksuid"&&(i=i.check(Z.ksuid()))}typeof t.minLength=="number"&&(i=i.min(t.minLength)),typeof t.maxLength=="number"&&(i=i.max(t.maxLength)),t.pattern&&(i=i.regex(new RegExp(t.pattern))),n=i;break}case"number":case"integer":{let i=r==="integer"?Z.number().int():Z.number();typeof t.minimum=="number"&&(i=i.min(t.minimum)),typeof t.maximum=="number"&&(i=i.max(t.maximum)),typeof t.exclusiveMinimum=="number"?i=i.gt(t.exclusiveMinimum):t.exclusiveMinimum===!0&&typeof t.minimum=="number"&&(i=i.gt(t.minimum)),typeof t.exclusiveMaximum=="number"?i=i.lt(t.exclusiveMaximum):t.exclusiveMaximum===!0&&typeof t.maximum=="number"&&(i=i.lt(t.maximum)),typeof t.multipleOf=="number"&&(i=i.multipleOf(t.multipleOf)),n=i;break}case"boolean":{n=Z.boolean();break}case"null":{n=Z.null();break}case"object":{let i={},o=t.properties||{},s=new Set(t.required||[]);for(let[c,l]of Object.entries(o)){let u=hr(l,e);i[c]=s.has(c)?u:u.optional()}if(t.propertyNames){let c=hr(t.propertyNames,e),l=t.additionalProperties&&typeof t.additionalProperties=="object"?hr(t.additionalProperties,e):Z.any();if(Object.keys(i).length===0){n=Z.record(c,l);break}let u=Z.object(i).passthrough(),d=Z.looseRecord(c,l);n=Z.intersection(u,d);break}if(t.patternProperties){let c=t.patternProperties,l=Object.keys(c),u=[];for(let f of l){let p=hr(c[f],e),m=Z.string().regex(new RegExp(f));u.push(Z.looseRecord(m,p))}let d=[];if(Object.keys(i).length>0&&d.push(Z.object(i).passthrough()),d.push(...u),d.length===0)n=Z.object({}).passthrough();else if(d.length===1)n=d[0];else{let f=Z.intersection(d[0],d[1]);for(let p=2;phr(c,e)),a=o&&typeof o=="object"&&!Array.isArray(o)?hr(o,e):void 0;a?n=Z.tuple(s).rest(a):n=Z.tuple(s),typeof t.minItems=="number"&&(n=n.check(Z.minLength(t.minItems))),typeof t.maxItems=="number"&&(n=n.check(Z.maxLength(t.maxItems)))}else if(Array.isArray(o)){let s=o.map(c=>hr(c,e)),a=t.additionalItems&&typeof t.additionalItems=="object"?hr(t.additionalItems,e):void 0;a?n=Z.tuple(s).rest(a):n=Z.tuple(s),typeof t.minItems=="number"&&(n=n.check(Z.minLength(t.minItems))),typeof t.maxItems=="number"&&(n=n.check(Z.maxLength(t.maxItems)))}else if(o!==void 0){let s=hr(o,e),a=Z.array(s);typeof t.minItems=="number"&&(a=a.min(t.minItems)),typeof t.maxItems=="number"&&(a=a.max(t.maxItems)),n=a}else n=Z.array(Z.any());break}default:throw new Error(`Unsupported type: ${r}`)}return n}function hr(t,e){if(typeof t=="boolean")return t?Z.any():Z.never();let r=rse(t,e),n=t.type||t.enum!==void 0||t.const!==void 0;if(t.anyOf&&Array.isArray(t.anyOf)){let a=t.anyOf.map(l=>hr(l,e)),c=Z.union(a);r=n?Z.intersection(r,c):c}if(t.oneOf&&Array.isArray(t.oneOf)){let a=t.oneOf.map(l=>hr(l,e)),c=Z.xor(a);r=n?Z.intersection(r,c):c}if(t.allOf&&Array.isArray(t.allOf))if(t.allOf.length===0)r=n?r:Z.any();else{let a=n?r:hr(t.allOf[0],e),c=n?0:1;for(let l=c;l0&&e.registry.add(r,i),t.description&&(r=r.describe(t.description)),r}function nse(t,e){if(typeof t=="boolean")return t?Z.any():Z.never();let r;try{r=JSON.parse(JSON.stringify(t))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=iHe(r,e?.defaultTarget),i=r.$defs||r.definitions||{},o={version:n,defs:i,refs:new Map,processing:new Set,rootSchema:r,registry:e?.registry??ir};return hr(r,o)}var Z,nHe,ise=y(()=>{Dh();vk();ng();og();Z={...ig,...bk,iso:Ks},nHe=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"])});var Cz={};Pr(Cz,{bigint:()=>lHe,boolean:()=>cHe,date:()=>uHe,number:()=>aHe,string:()=>sHe});function sHe(t){return OF(xd,t)}function aHe(t){return NF(kd,t)}function cHe(t){return jF(Ed,t)}function lHe(t){return MF(Ad,t)}function uHe(t){return FF(dg,t)}var ose=y(()=>{mr();og()});var E={};Pr(E,{$brand:()=>iM,$input:()=>TF,$output:()=>AF,NEVER:()=>nM,TimePrecision:()=>RF,ZodAny:()=>KL,ZodArray:()=>QL,ZodBase64:()=>zk,ZodBase64URL:()=>Uk,ZodBigInt:()=>Ad,ZodBigIntFormat:()=>Hk,ZodBoolean:()=>Ed,ZodCIDRv4:()=>Fk,ZodCIDRv6:()=>Lk,ZodCUID:()=>Ik,ZodCUID2:()=>Pk,ZodCatch:()=>bz,ZodCodec:()=>gg,ZodCustom:()=>yg,ZodCustomStringFormat:()=>$d,ZodDate:()=>dg,ZodDefault:()=>pz,ZodDiscriminatedUnion:()=>tz,ZodE164:()=>qk,ZodEmail:()=>Tk,ZodEmoji:()=>Ok,ZodEnum:()=>wd,ZodError:()=>XBe,ZodExactOptional:()=>uz,ZodFile:()=>cz,ZodFirstPartyTypeKind:()=>Pz,ZodFunction:()=>Oz,ZodGUID:()=>sg,ZodIPv4:()=>jk,ZodIPv6:()=>Mk,ZodISODate:()=>wk,ZodISODateTime:()=>Sk,ZodISODuration:()=>$k,ZodISOTime:()=>xk,ZodIntersection:()=>rz,ZodIssueCode:()=>eHe,ZodJWT:()=>Bk,ZodKSUID:()=>Nk,ZodLazy:()=>Ez,ZodLiteral:()=>az,ZodMAC:()=>GL,ZodMap:()=>oz,ZodNaN:()=>Sz,ZodNanoID:()=>Rk,ZodNever:()=>YL,ZodNonOptional:()=>Vk,ZodNull:()=>WL,ZodNullable:()=>fz,ZodNumber:()=>kd,ZodNumberFormat:()=>Dc,ZodObject:()=>fg,ZodOptional:()=>Od,ZodPipe:()=>hg,ZodPrefault:()=>hz,ZodPreprocess:()=>wz,ZodPromise:()=>Tz,ZodReadonly:()=>xz,ZodRealError:()=>Zr,ZodRecord:()=>Sd,ZodSet:()=>sz,ZodString:()=>xd,ZodStringFormat:()=>et,ZodSuccess:()=>_z,ZodSymbol:()=>ZL,ZodTemplateLiteral:()=>kz,ZodTransform:()=>lz,ZodTuple:()=>nz,ZodType:()=>_e,ZodULID:()=>Ck,ZodURL:()=>lg,ZodUUID:()=>to,ZodUndefined:()=>VL,ZodUnion:()=>pg,ZodUnknown:()=>JL,ZodVoid:()=>XL,ZodXID:()=>Dk,ZodXor:()=>ez,_ZodString:()=>Ak,_default:()=>mz,_function:()=>Woe,any:()=>Ooe,array:()=>ke,base64:()=>foe,base64url:()=>poe,bigint:()=>$oe,boolean:()=>It,catch:()=>vz,check:()=>Koe,cidrv4:()=>uoe,cidrv6:()=>doe,clone:()=>nr,codec:()=>Hoe,coerce:()=>Cz,config:()=>Tt,core:()=>mi,cuid:()=>roe,cuid2:()=>noe,custom:()=>Wk,date:()=>Ioe,decode:()=>ML,decodeAsync:()=>LL,describe:()=>Joe,discriminatedUnion:()=>mg,e164:()=>moe,email:()=>Zie,emoji:()=>eoe,encode:()=>jL,encodeAsync:()=>FL,endsWith:()=>dd,enum:()=>sr,exactOptional:()=>dz,file:()=>zoe,flattenError:()=>xh,float32:()=>voe,float64:()=>Soe,formatError:()=>$h,fromJSONSchema:()=>nse,function:()=>Woe,getErrorMap:()=>rHe,globalRegistry:()=>ir,gt:()=>Qi,gte:()=>Er,guid:()=>Vie,hash:()=>boe,hex:()=>_oe,hostname:()=>yoe,httpUrl:()=>Qie,includes:()=>ld,instanceof:()=>Xoe,int:()=>kk,int32:()=>woe,int64:()=>koe,intersection:()=>Td,invertCodec:()=>Goe,ipv4:()=>aoe,ipv6:()=>loe,iso:()=>Ks,json:()=>ese,jwt:()=>hoe,keyof:()=>Poe,ksuid:()=>soe,lazy:()=>Az,length:()=>Rc,literal:()=>re,locales:()=>nd,looseObject:()=>or,looseRecord:()=>joe,lowercase:()=>ad,lt:()=>Xi,lte:()=>Sn,mac:()=>coe,map:()=>Moe,maxLength:()=>Oc,maxSize:()=>Bs,meta:()=>Yoe,mime:()=>fd,minLength:()=>Uo,minSize:()=>eo,multipleOf:()=>qs,nan:()=>Boe,nanoid:()=>toe,nativeEnum:()=>Loe,negative:()=>tk,never:()=>Gk,nonnegative:()=>nk,nonoptional:()=>yz,nonpositive:()=>rk,normalize:()=>pd,null:()=>ug,nullable:()=>ag,nullish:()=>Uoe,number:()=>Me,object:()=>W,optional:()=>at,overwrite:()=>pi,parse:()=>PL,parseAsync:()=>CL,partialRecord:()=>Noe,pipe:()=>Ek,positive:()=>ek,prefault:()=>gz,preprocess:()=>_g,prettifyError:()=>gM,promise:()=>Voe,property:()=>ik,readonly:()=>$z,record:()=>Ke,refine:()=>Rz,regex:()=>sd,regexes:()=>Gr,registry:()=>P$,safeDecode:()=>UL,safeDecodeAsync:()=>BL,safeEncode:()=>zL,safeEncodeAsync:()=>qL,safeParse:()=>DL,safeParseAsync:()=>NL,set:()=>Foe,setErrorMap:()=>tHe,size:()=>Tc,slugify:()=>yd,startsWith:()=>ud,strictObject:()=>Coe,string:()=>I,stringFormat:()=>goe,stringbool:()=>Qoe,success:()=>qoe,superRefine:()=>Iz,symbol:()=>Aoe,templateLiteral:()=>Zoe,toJSONSchema:()=>Pc,toLowerCase:()=>hd,toUpperCase:()=>gd,transform:()=>Zk,treeifyError:()=>hM,trim:()=>md,tuple:()=>iz,uint32:()=>xoe,uint64:()=>Eoe,ulid:()=>ioe,undefined:()=>Toe,union:()=>rt,unknown:()=>tt,uppercase:()=>cd,url:()=>Xie,util:()=>M,uuid:()=>Wie,uuidv4:()=>Kie,uuidv6:()=>Jie,uuidv7:()=>Yie,void:()=>Roe,xid:()=>ooe,xor:()=>Doe});var Kk=y(()=>{mr();og();vk();IL();HL();tse();mr();$F();mr();bd();ise();R$();ng();ng();ose();Tt(A$())});var sse=y(()=>{Kk()});var ase=y(()=>{sse()});function $se(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function kse(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var Nz,cse,Js,Yk,Wt,lse,use,hEt,fHe,pHe,jz,wn,bg,dse,ar,zn,Un,cr,Xk,fse,Mz,pse,mse,Fz,vg,ae,Lz,hse,gse,gEt,Qk,mHe,eE,hHe,Sg,Rd,yse,gHe,yHe,_He,bHe,vHe,SHe,zz,wHe,xHe,Uz,tE,$He,kHe,rE,EHe,wg,xg,AHe,$g,Id,THe,kg,nE,iE,oE,yEt,sE,aE,cE,_se,bse,vse,qz,Sse,Eg,Pd,wse,OHe,lE,RHe,uE,IHe,Bz,PHe,dE,CHe,DHe,NHe,Hz,jHe,Gz,MHe,FHe,LHe,zHe,fE,UHe,qHe,pE,Zz,Vz,Wz,BHe,HHe,GHe,Kz,ZHe,VHe,WHe,KHe,JHe,xse,mE,YHe,hE,_Et,XHe,Cd,QHe,bEt,Ag,eGe,Jz,tGe,rGe,nGe,iGe,oGe,sGe,aGe,Jk,cGe,lGe,uGe,Tg,Yz,dGe,fGe,pGe,mGe,hGe,gGe,yGe,_Ge,bGe,vGe,SGe,wGe,xGe,$Ge,kGe,EGe,AGe,TGe,Dd,OGe,RGe,IGe,gE,PGe,CGe,DGe,Xz,NGe,vEt,SEt,wEt,xEt,$Et,kEt,ne,Dz,Nc=y(()=>{ase();Nz="2025-11-25",cse=[Nz,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Js="io.modelcontextprotocol/related-task",Yk="2.0",Wt=Wk(t=>t!==null&&(typeof t=="object"||typeof t=="function")),lse=rt([I(),Me().int()]),use=I(),hEt=or({ttl:Me().optional(),pollInterval:Me().optional()}),fHe=W({ttl:Me().optional()}),pHe=W({taskId:I()}),jz=or({progressToken:lse.optional(),[Js]:pHe.optional()}),wn=W({_meta:jz.optional()}),bg=wn.extend({task:fHe.optional()}),dse=t=>bg.safeParse(t).success,ar=W({method:I(),params:wn.loose().optional()}),zn=W({_meta:jz.optional()}),Un=W({method:I(),params:zn.loose().optional()}),cr=or({_meta:jz.optional()}),Xk=rt([I(),Me().int()]),fse=W({jsonrpc:re(Yk),id:Xk,...ar.shape}).strict(),Mz=t=>fse.safeParse(t).success,pse=W({jsonrpc:re(Yk),...Un.shape}).strict(),mse=t=>pse.safeParse(t).success,Fz=W({jsonrpc:re(Yk),id:Xk,result:cr}).strict(),vg=t=>Fz.safeParse(t).success;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(ae||(ae={}));Lz=W({jsonrpc:re(Yk),id:Xk.optional(),error:W({code:Me().int(),message:I(),data:tt().optional()})}).strict(),hse=t=>Lz.safeParse(t).success,gse=rt([fse,pse,Fz,Lz]),gEt=rt([Fz,Lz]),Qk=cr.strict(),mHe=zn.extend({requestId:Xk.optional(),reason:I().optional()}),eE=Un.extend({method:re("notifications/cancelled"),params:mHe}),hHe=W({src:I(),mimeType:I().optional(),sizes:ke(I()).optional(),theme:sr(["light","dark"]).optional()}),Sg=W({icons:ke(hHe).optional()}),Rd=W({name:I(),title:I().optional()}),yse=Rd.extend({...Rd.shape,...Sg.shape,version:I(),websiteUrl:I().optional(),description:I().optional()}),gHe=Td(W({applyDefaults:It().optional()}),Ke(I(),tt())),yHe=_g(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Td(W({form:gHe.optional(),url:Wt.optional()}),Ke(I(),tt()).optional())),_He=or({list:Wt.optional(),cancel:Wt.optional(),requests:or({sampling:or({createMessage:Wt.optional()}).optional(),elicitation:or({create:Wt.optional()}).optional()}).optional()}),bHe=or({list:Wt.optional(),cancel:Wt.optional(),requests:or({tools:or({call:Wt.optional()}).optional()}).optional()}),vHe=W({experimental:Ke(I(),Wt).optional(),sampling:W({context:Wt.optional(),tools:Wt.optional()}).optional(),elicitation:yHe.optional(),roots:W({listChanged:It().optional()}).optional(),tasks:_He.optional(),extensions:Ke(I(),Wt).optional()}),SHe=wn.extend({protocolVersion:I(),capabilities:vHe,clientInfo:yse}),zz=ar.extend({method:re("initialize"),params:SHe}),wHe=W({experimental:Ke(I(),Wt).optional(),logging:Wt.optional(),completions:Wt.optional(),prompts:W({listChanged:It().optional()}).optional(),resources:W({subscribe:It().optional(),listChanged:It().optional()}).optional(),tools:W({listChanged:It().optional()}).optional(),tasks:bHe.optional(),extensions:Ke(I(),Wt).optional()}),xHe=cr.extend({protocolVersion:I(),capabilities:wHe,serverInfo:yse,instructions:I().optional()}),Uz=Un.extend({method:re("notifications/initialized"),params:zn.optional()}),tE=ar.extend({method:re("ping"),params:wn.optional()}),$He=W({progress:Me(),total:at(Me()),message:at(I())}),kHe=W({...zn.shape,...$He.shape,progressToken:lse}),rE=Un.extend({method:re("notifications/progress"),params:kHe}),EHe=wn.extend({cursor:use.optional()}),wg=ar.extend({params:EHe.optional()}),xg=cr.extend({nextCursor:use.optional()}),AHe=sr(["working","input_required","completed","failed","cancelled"]),$g=W({taskId:I(),status:AHe,ttl:rt([Me(),ug()]),createdAt:I(),lastUpdatedAt:I(),pollInterval:at(Me()),statusMessage:at(I())}),Id=cr.extend({task:$g}),THe=zn.merge($g),kg=Un.extend({method:re("notifications/tasks/status"),params:THe}),nE=ar.extend({method:re("tasks/get"),params:wn.extend({taskId:I()})}),iE=cr.merge($g),oE=ar.extend({method:re("tasks/result"),params:wn.extend({taskId:I()})}),yEt=cr.loose(),sE=wg.extend({method:re("tasks/list")}),aE=xg.extend({tasks:ke($g)}),cE=ar.extend({method:re("tasks/cancel"),params:wn.extend({taskId:I()})}),_se=cr.merge($g),bse=W({uri:I(),mimeType:at(I()),_meta:Ke(I(),tt()).optional()}),vse=bse.extend({text:I()}),qz=I().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Sse=bse.extend({blob:qz}),Eg=sr(["user","assistant"]),Pd=W({audience:ke(Eg).optional(),priority:Me().min(0).max(1).optional(),lastModified:Ks.datetime({offset:!0}).optional()}),wse=W({...Rd.shape,...Sg.shape,uri:I(),description:at(I()),mimeType:at(I()),size:at(Me()),annotations:Pd.optional(),_meta:at(or({}))}),OHe=W({...Rd.shape,...Sg.shape,uriTemplate:I(),description:at(I()),mimeType:at(I()),annotations:Pd.optional(),_meta:at(or({}))}),lE=wg.extend({method:re("resources/list")}),RHe=xg.extend({resources:ke(wse)}),uE=wg.extend({method:re("resources/templates/list")}),IHe=xg.extend({resourceTemplates:ke(OHe)}),Bz=wn.extend({uri:I()}),PHe=Bz,dE=ar.extend({method:re("resources/read"),params:PHe}),CHe=cr.extend({contents:ke(rt([vse,Sse]))}),DHe=Un.extend({method:re("notifications/resources/list_changed"),params:zn.optional()}),NHe=Bz,Hz=ar.extend({method:re("resources/subscribe"),params:NHe}),jHe=Bz,Gz=ar.extend({method:re("resources/unsubscribe"),params:jHe}),MHe=zn.extend({uri:I()}),FHe=Un.extend({method:re("notifications/resources/updated"),params:MHe}),LHe=W({name:I(),description:at(I()),required:at(It())}),zHe=W({...Rd.shape,...Sg.shape,description:at(I()),arguments:at(ke(LHe)),_meta:at(or({}))}),fE=wg.extend({method:re("prompts/list")}),UHe=xg.extend({prompts:ke(zHe)}),qHe=wn.extend({name:I(),arguments:Ke(I(),I()).optional()}),pE=ar.extend({method:re("prompts/get"),params:qHe}),Zz=W({type:re("text"),text:I(),annotations:Pd.optional(),_meta:Ke(I(),tt()).optional()}),Vz=W({type:re("image"),data:qz,mimeType:I(),annotations:Pd.optional(),_meta:Ke(I(),tt()).optional()}),Wz=W({type:re("audio"),data:qz,mimeType:I(),annotations:Pd.optional(),_meta:Ke(I(),tt()).optional()}),BHe=W({type:re("tool_use"),name:I(),id:I(),input:Ke(I(),tt()),_meta:Ke(I(),tt()).optional()}),HHe=W({type:re("resource"),resource:rt([vse,Sse]),annotations:Pd.optional(),_meta:Ke(I(),tt()).optional()}),GHe=wse.extend({type:re("resource_link")}),Kz=rt([Zz,Vz,Wz,GHe,HHe]),ZHe=W({role:Eg,content:Kz}),VHe=cr.extend({description:I().optional(),messages:ke(ZHe)}),WHe=Un.extend({method:re("notifications/prompts/list_changed"),params:zn.optional()}),KHe=W({title:I().optional(),readOnlyHint:It().optional(),destructiveHint:It().optional(),idempotentHint:It().optional(),openWorldHint:It().optional()}),JHe=W({taskSupport:sr(["required","optional","forbidden"]).optional()}),xse=W({...Rd.shape,...Sg.shape,description:I().optional(),inputSchema:W({type:re("object"),properties:Ke(I(),Wt).optional(),required:ke(I()).optional()}).catchall(tt()),outputSchema:W({type:re("object"),properties:Ke(I(),Wt).optional(),required:ke(I()).optional()}).catchall(tt()).optional(),annotations:KHe.optional(),execution:JHe.optional(),_meta:Ke(I(),tt()).optional()}),mE=wg.extend({method:re("tools/list")}),YHe=xg.extend({tools:ke(xse)}),hE=cr.extend({content:ke(Kz).default([]),structuredContent:Ke(I(),tt()).optional(),isError:It().optional()}),_Et=hE.or(cr.extend({toolResult:tt()})),XHe=bg.extend({name:I(),arguments:Ke(I(),tt()).optional()}),Cd=ar.extend({method:re("tools/call"),params:XHe}),QHe=Un.extend({method:re("notifications/tools/list_changed"),params:zn.optional()}),bEt=W({autoRefresh:It().default(!0),debounceMs:Me().int().nonnegative().default(300)}),Ag=sr(["debug","info","notice","warning","error","critical","alert","emergency"]),eGe=wn.extend({level:Ag}),Jz=ar.extend({method:re("logging/setLevel"),params:eGe}),tGe=zn.extend({level:Ag,logger:I().optional(),data:tt()}),rGe=Un.extend({method:re("notifications/message"),params:tGe}),nGe=W({name:I().optional()}),iGe=W({hints:ke(nGe).optional(),costPriority:Me().min(0).max(1).optional(),speedPriority:Me().min(0).max(1).optional(),intelligencePriority:Me().min(0).max(1).optional()}),oGe=W({mode:sr(["auto","required","none"]).optional()}),sGe=W({type:re("tool_result"),toolUseId:I().describe("The unique identifier for the corresponding tool call."),content:ke(Kz).default([]),structuredContent:W({}).loose().optional(),isError:It().optional(),_meta:Ke(I(),tt()).optional()}),aGe=mg("type",[Zz,Vz,Wz]),Jk=mg("type",[Zz,Vz,Wz,BHe,sGe]),cGe=W({role:Eg,content:rt([Jk,ke(Jk)]),_meta:Ke(I(),tt()).optional()}),lGe=bg.extend({messages:ke(cGe),modelPreferences:iGe.optional(),systemPrompt:I().optional(),includeContext:sr(["none","thisServer","allServers"]).optional(),temperature:Me().optional(),maxTokens:Me().int(),stopSequences:ke(I()).optional(),metadata:Wt.optional(),tools:ke(xse).optional(),toolChoice:oGe.optional()}),uGe=ar.extend({method:re("sampling/createMessage"),params:lGe}),Tg=cr.extend({model:I(),stopReason:at(sr(["endTurn","stopSequence","maxTokens"]).or(I())),role:Eg,content:aGe}),Yz=cr.extend({model:I(),stopReason:at(sr(["endTurn","stopSequence","maxTokens","toolUse"]).or(I())),role:Eg,content:rt([Jk,ke(Jk)])}),dGe=W({type:re("boolean"),title:I().optional(),description:I().optional(),default:It().optional()}),fGe=W({type:re("string"),title:I().optional(),description:I().optional(),minLength:Me().optional(),maxLength:Me().optional(),format:sr(["email","uri","date","date-time"]).optional(),default:I().optional()}),pGe=W({type:sr(["number","integer"]),title:I().optional(),description:I().optional(),minimum:Me().optional(),maximum:Me().optional(),default:Me().optional()}),mGe=W({type:re("string"),title:I().optional(),description:I().optional(),enum:ke(I()),default:I().optional()}),hGe=W({type:re("string"),title:I().optional(),description:I().optional(),oneOf:ke(W({const:I(),title:I()})),default:I().optional()}),gGe=W({type:re("string"),title:I().optional(),description:I().optional(),enum:ke(I()),enumNames:ke(I()).optional(),default:I().optional()}),yGe=rt([mGe,hGe]),_Ge=W({type:re("array"),title:I().optional(),description:I().optional(),minItems:Me().optional(),maxItems:Me().optional(),items:W({type:re("string"),enum:ke(I())}),default:ke(I()).optional()}),bGe=W({type:re("array"),title:I().optional(),description:I().optional(),minItems:Me().optional(),maxItems:Me().optional(),items:W({anyOf:ke(W({const:I(),title:I()}))}),default:ke(I()).optional()}),vGe=rt([_Ge,bGe]),SGe=rt([gGe,yGe,vGe]),wGe=rt([SGe,dGe,fGe,pGe]),xGe=bg.extend({mode:re("form").optional(),message:I(),requestedSchema:W({type:re("object"),properties:Ke(I(),wGe),required:ke(I()).optional()})}),$Ge=bg.extend({mode:re("url"),message:I(),elicitationId:I(),url:I().url()}),kGe=rt([xGe,$Ge]),EGe=ar.extend({method:re("elicitation/create"),params:kGe}),AGe=zn.extend({elicitationId:I()}),TGe=Un.extend({method:re("notifications/elicitation/complete"),params:AGe}),Dd=cr.extend({action:sr(["accept","decline","cancel"]),content:_g(t=>t===null?void 0:t,Ke(I(),rt([I(),Me(),It(),ke(I())])).optional())}),OGe=W({type:re("ref/resource"),uri:I()}),RGe=W({type:re("ref/prompt"),name:I()}),IGe=wn.extend({ref:rt([RGe,OGe]),argument:W({name:I(),value:I()}),context:W({arguments:Ke(I(),I()).optional()}).optional()}),gE=ar.extend({method:re("completion/complete"),params:IGe});PGe=cr.extend({completion:or({values:ke(I()).max(100),total:at(Me().int()),hasMore:at(It())})}),CGe=W({uri:I().startsWith("file://"),name:I().optional(),_meta:Ke(I(),tt()).optional()}),DGe=ar.extend({method:re("roots/list"),params:wn.optional()}),Xz=cr.extend({roots:ke(CGe)}),NGe=Un.extend({method:re("notifications/roots/list_changed"),params:zn.optional()}),vEt=rt([tE,zz,gE,Jz,pE,fE,lE,uE,dE,Hz,Gz,Cd,mE,nE,oE,sE,cE]),SEt=rt([eE,rE,Uz,NGe,kg]),wEt=rt([Qk,Tg,Yz,Dd,Xz,iE,aE,Id]),xEt=rt([tE,uGe,EGe,DGe,nE,oE,sE,cE]),$Et=rt([eE,rE,rGe,FHe,DHe,QHe,WHe,kg,TGe]),kEt=rt([Qk,xHe,PGe,VHe,UHe,RHe,IHe,CHe,hE,YHe,iE,aE,Id]),ne=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===ae.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new Dz(i.elicitations,r)}return new t(e,r,n)}},Dz=class extends ne{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(ae.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}});function Ys(t){return t==="completed"||t==="failed"||t==="cancelled"}var Ese=y(()=>{});var Tse,Ase,Ose,yE=y(()=>{Tse=Symbol("Let zodToJsonSchema decide on which parser to use"),Ase={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Ose=t=>typeof t=="string"?{...Ase,name:t}:{...Ase,...t}});var Rse,Qz=y(()=>{yE();Rse=t=>{let e=Ose(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function e2(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Ie(t,e,r,n,i){t[e]=r,e2(t,e,n,i)}var Xs=y(()=>{});var _E,bE=y(()=>{_E=(t,e)=>{let r=0;for(;r{bE()});function Ise(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==z.ZodAny&&(r.items=le(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Ie(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Ie(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Ie(r,"minItems",t.exactLength.value,t.exactLength.message,e),Ie(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var t2=y(()=>{hh();Xs();Mt()});function Pse(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?Ie(r,"minimum",n.value,n.message,e):Ie(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Ie(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Ie(r,"maximum",n.value,n.message,e):Ie(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Ie(r,"maximum",n.value,n.message,e));break;case"multipleOf":Ie(r,"multipleOf",n.value,n.message,e);break}return r}var r2=y(()=>{Xs()});function Cse(){return{type:"boolean"}}var n2=y(()=>{});function vE(t,e){return le(t.type._def,e)}var SE=y(()=>{Mt()});var Dse,i2=y(()=>{Mt();Dse=(t,e)=>le(t.innerType._def,e)});function o2(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((i,o)=>o2(t,e,i))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return jGe(t,e)}}var jGe,s2=y(()=>{Xs();jGe=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":Ie(r,"minimum",n.value,n.message,e);break;case"max":Ie(r,"maximum",n.value,n.message,e);break}return r}});function Nse(t,e){return{...le(t.innerType._def,e),default:t.defaultValue()}}var a2=y(()=>{Mt()});function jse(t,e){return e.effectStrategy==="input"?le(t.schema._def,e):yt(e)}var c2=y(()=>{Mt();qn()});function Mse(t){return{type:"string",enum:Array.from(t.values)}}var l2=y(()=>{});function Fse(t,e){let r=[le(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),le(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(o=>!!o),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,i=[];return r.forEach(o=>{if(MGe(o))i.push(...o.allOf),o.unevaluatedProperties===void 0&&(n=void 0);else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:a,...c}=o;s=c}else n=void 0;i.push(s)}}),i.length?{allOf:i,...n}:void 0}var MGe,u2=y(()=>{Mt();MGe=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function Lse(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var d2=y(()=>{});function wE(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":Ie(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":Ie(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":gi(r,"email",n.message,e);break;case"format:idn-email":gi(r,"idn-email",n.message,e);break;case"pattern:zod":Tr(r,hi.email,n.message,e);break}break;case"url":gi(r,"uri",n.message,e);break;case"uuid":gi(r,"uuid",n.message,e);break;case"regex":Tr(r,n.regex,n.message,e);break;case"cuid":Tr(r,hi.cuid,n.message,e);break;case"cuid2":Tr(r,hi.cuid2,n.message,e);break;case"startsWith":Tr(r,RegExp(`^${p2(n.value,e)}`),n.message,e);break;case"endsWith":Tr(r,RegExp(`${p2(n.value,e)}$`),n.message,e);break;case"datetime":gi(r,"date-time",n.message,e);break;case"date":gi(r,"date",n.message,e);break;case"time":gi(r,"time",n.message,e);break;case"duration":gi(r,"duration",n.message,e);break;case"length":Ie(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),Ie(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Tr(r,RegExp(p2(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&gi(r,"ipv4",n.message,e),n.version!=="v4"&&gi(r,"ipv6",n.message,e);break}case"base64url":Tr(r,hi.base64url,n.message,e);break;case"jwt":Tr(r,hi.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Tr(r,hi.ipv4Cidr,n.message,e),n.version!=="v4"&&Tr(r,hi.ipv6Cidr,n.message,e);break}case"emoji":Tr(r,hi.emoji(),n.message,e);break;case"ulid":{Tr(r,hi.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{gi(r,"binary",n.message,e);break}case"contentEncoding:base64":{Ie(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Tr(r,hi.base64,n.message,e);break}}break}case"nanoid":Tr(r,hi.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function p2(t,e){return e.patternStrategy==="escape"?LGe(t):t}function LGe(t){let e="";for(let r=0;ri.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):Ie(t,"format",e,r,n)}function Tr(t,e,r,n){t.pattern||t.allOf?.some(i=>i.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:zse(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Ie(t,"pattern",zse(e,n),r,n)}function zse(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,i="",o=!1,s=!1,a=!1;for(let c=0;c1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,Pe.addCodeArg)(r,i));return r.push("}"),new Pe._Code(r)}if(e,r,n){if(this._blockNode(new Mc(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Mc(e))}else(){return this._elseNode(new Nd)}endIf(){return this._endBlockNode(Mc,Nd)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new W2(e),r)}forRange(e,r,n,i,o=this.opts.es5?yi.varKinds.var:yi.varKinds.let){let s=this._scope.toName(e);return this._for(new K2(o,s,r,n),()=>i(s))}forOf(e,r,n,i=yi.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=r instanceof Pe.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Pe._)`${s}.length`,a=>{this.var(o,(0,Pe._)`${s}[${a}]`),n(o)})}return this._for(new PE("of",i,o,r),()=>n(o))}forIn(e,r,n,i=this.opts.es5?yi.varKinds.var:yi.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Pe._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new PE("in",i,o,r),()=>n(o))}endFor(){return this._endBlockNode(Fc)}label(e){return this._leafNode(new B2(e))}break(e){return this._leafNode(new H2(e))}return(e){let r=new Ng;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ng)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new J2;if(this._blockNode(i),this.code(e),r){let o=this.name("e");this._currNode=i.catch=new jg(o),r(o)}return n&&(this._currNode=i.finally=new Mg,this.code(n)),this._endBlockNode(jg,Mg)}throw(e){return this._leafNode(new G2(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Pe.nil,n,i){return this._blockNode(new Dg(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Dg)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Mc))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ee.CodeGen=Y2;function Lc(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function CE(t,e){return e instanceof Pe._CodeOrName?Lc(t,e.names):t}function jd(t,e,r){if(t instanceof Pe.Name)return n(t);if(!i(t))return t;return new Pe._Code(t._items.reduce((o,s)=>(s instanceof Pe.Name&&(s=n(s)),s instanceof Pe._Code?o.push(...s._items):o.push(s),o),[]));function n(o){let s=r[o.str];return s===void 0||e[o.str]!==1?o:(delete e[o.str],s)}function i(o){return o instanceof Pe._Code&&o._items.some(s=>s instanceof Pe.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function tZe(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function fae(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Pe._)`!${X2(t)}`}Ee.not=fae;var rZe=pae(Ee.operators.AND);function nZe(...t){return t.reduce(rZe)}Ee.and=nZe;var iZe=pae(Ee.operators.OR);function oZe(...t){return t.reduce(iZe)}Ee.or=oZe;function pae(t){return(e,r)=>e===Pe.nil?r:r===Pe.nil?e:(0,Pe._)`${X2(e)} ${t} ${X2(r)}`}function X2(t){return t instanceof Pe.Name?t:(0,Pe._)`(${t})`}});var Ne=v(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.checkStrictMode=Te.getErrorPath=Te.Type=Te.useFunc=Te.setEvaluated=Te.evaluatedPropsToName=Te.mergeEvaluated=Te.eachItem=Te.unescapeJsonPointer=Te.escapeJsonPointer=Te.escapeFragment=Te.unescapeFragment=Te.schemaRefOrVal=Te.schemaHasRulesButRef=Te.schemaHasRules=Te.checkUnknownRules=Te.alwaysValidSchema=Te.toHash=void 0;var ct=we(),sZe=Pg();function aZe(t){let e={};for(let r of t)e[r]=!0;return e}Te.toHash=aZe;function cZe(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(gae(t,e),!yae(e,t.self.RULES.all))}Te.alwaysValidSchema=cZe;function gae(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let o in e)i[o]||vae(t,`unknown keyword: "${o}"`)}Te.checkUnknownRules=gae;function yae(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Te.schemaHasRules=yae;function lZe(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Te.schemaHasRulesButRef=lZe;function uZe({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ct._)`${r}`}return(0,ct._)`${t}${e}${(0,ct.getProperty)(n)}`}Te.schemaRefOrVal=uZe;function dZe(t){return _ae(decodeURIComponent(t))}Te.unescapeFragment=dZe;function fZe(t){return encodeURIComponent(eU(t))}Te.escapeFragment=fZe;function eU(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Te.escapeJsonPointer=eU;function _ae(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Te.unescapeJsonPointer=_ae;function pZe(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Te.eachItem=pZe;function mae({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,o,s,a)=>{let c=s===void 0?o:s instanceof ct.Name?(o instanceof ct.Name?t(i,o,s):e(i,o,s),s):o instanceof ct.Name?(e(i,s,o),o):r(o,s);return a===ct.Name&&!(c instanceof ct.Name)?n(i,c):c}}Te.mergeEvaluated={props:mae({mergeNames:(t,e,r)=>t.if((0,ct._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,ct._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,ct._)`${r} || {}`).code((0,ct._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,ct._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,ct._)`${r} || {}`),tU(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:bae}),items:mae({mergeNames:(t,e,r)=>t.if((0,ct._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,ct._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,ct._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,ct._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function bae(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,ct._)`{}`);return e!==void 0&&tU(t,r,e),r}Te.evaluatedPropsToName=bae;function tU(t,e,r){Object.keys(r).forEach(n=>t.assign((0,ct._)`${e}${(0,ct.getProperty)(n)}`,!0))}Te.setEvaluated=tU;var hae={};function mZe(t,e){return t.scopeValue("func",{ref:e,code:hae[e.code]||(hae[e.code]=new sZe._Code(e.code))})}Te.useFunc=mZe;var Q2;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Q2||(Te.Type=Q2={}));function hZe(t,e,r){if(t instanceof ct.Name){let n=e===Q2.Num;return r?n?(0,ct._)`"[" + ${t} + "]"`:(0,ct._)`"['" + ${t} + "']"`:n?(0,ct._)`"/" + ${t}`:(0,ct._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ct.getProperty)(t).toString():"/"+eU(t)}Te.getErrorPath=hZe;function vae(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Te.checkStrictMode=vae});var Ho=v(rU=>{"use strict";Object.defineProperty(rU,"__esModule",{value:!0});var gr=we(),gZe={data:new gr.Name("data"),valCxt:new gr.Name("valCxt"),instancePath:new gr.Name("instancePath"),parentData:new gr.Name("parentData"),parentDataProperty:new gr.Name("parentDataProperty"),rootData:new gr.Name("rootData"),dynamicAnchors:new gr.Name("dynamicAnchors"),vErrors:new gr.Name("vErrors"),errors:new gr.Name("errors"),this:new gr.Name("this"),self:new gr.Name("self"),scope:new gr.Name("scope"),json:new gr.Name("json"),jsonPos:new gr.Name("jsonPos"),jsonLen:new gr.Name("jsonLen"),jsonPart:new gr.Name("jsonPart")};rU.default=gZe});var Fg=v(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.extendErrors=yr.resetErrorsCount=yr.reportExtraError=yr.reportError=yr.keyword$DataError=yr.keywordError=void 0;var je=we(),NE=Ne(),Or=Ho();yr.keywordError={message:({keyword:t})=>(0,je.str)`must pass "${t}" keyword validation`};yr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,je.str)`"${t}" keyword must be ${e} ($data)`:(0,je.str)`"${t}" keyword is invalid ($data)`};function yZe(t,e=yr.keywordError,r,n){let{it:i}=t,{gen:o,compositeRule:s,allErrors:a}=i,c=xae(t,e,r);n??(s||a)?Sae(o,c):wae(i,(0,je._)`[${c}]`)}yr.reportError=yZe;function _Ze(t,e=yr.keywordError,r){let{it:n}=t,{gen:i,compositeRule:o,allErrors:s}=n,a=xae(t,e,r);Sae(i,a),o||s||wae(n,Or.default.vErrors)}yr.reportExtraError=_Ze;function bZe(t,e){t.assign(Or.default.errors,e),t.if((0,je._)`${Or.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,je._)`${Or.default.vErrors}.length`,e),()=>t.assign(Or.default.vErrors,null)))}yr.resetErrorsCount=bZe;function vZe({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:o}){if(i===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",i,Or.default.errors,a=>{t.const(s,(0,je._)`${Or.default.vErrors}[${a}]`),t.if((0,je._)`${s}.instancePath === undefined`,()=>t.assign((0,je._)`${s}.instancePath`,(0,je.strConcat)(Or.default.instancePath,o.errorPath))),t.assign((0,je._)`${s}.schemaPath`,(0,je.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,je._)`${s}.schema`,r),t.assign((0,je._)`${s}.data`,n))})}yr.extendErrors=vZe;function Sae(t,e){let r=t.const("err",e);t.if((0,je._)`${Or.default.vErrors} === null`,()=>t.assign(Or.default.vErrors,(0,je._)`[${r}]`),(0,je._)`${Or.default.vErrors}.push(${r})`),t.code((0,je._)`${Or.default.errors}++`)}function wae(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,je._)`new ${t.ValidationError}(${e})`):(r.assign((0,je._)`${n}.errors`,e),r.return(!1))}var zc={keyword:new je.Name("keyword"),schemaPath:new je.Name("schemaPath"),params:new je.Name("params"),propertyName:new je.Name("propertyName"),message:new je.Name("message"),schema:new je.Name("schema"),parentSchema:new je.Name("parentSchema")};function xae(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,je._)`{}`:SZe(t,e,r)}function SZe(t,e,r={}){let{gen:n,it:i}=t,o=[wZe(i,r),xZe(t,r)];return $Ze(t,e,o),n.object(...o)}function wZe({errorPath:t},{instancePath:e}){let r=e?(0,je.str)`${t}${(0,NE.getErrorPath)(e,NE.Type.Str)}`:t;return[Or.default.instancePath,(0,je.strConcat)(Or.default.instancePath,r)]}function xZe({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,je.str)`${e}/${t}`;return r&&(i=(0,je.str)`${i}${(0,NE.getErrorPath)(r,NE.Type.Str)}`),[zc.schemaPath,i]}function $Ze(t,{params:e,message:r},n){let{keyword:i,data:o,schemaValue:s,it:a}=t,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;n.push([zc.keyword,i],[zc.params,typeof e=="function"?e(t):e||(0,je._)`{}`]),c.messages&&n.push([zc.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([zc.schema,s],[zc.parentSchema,(0,je._)`${u}${d}`],[Or.default.data,o]),l&&n.push([zc.propertyName,l])}});var kae=v(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});Md.boolOrEmptySchema=Md.topBoolOrEmptySchema=void 0;var kZe=Fg(),EZe=we(),AZe=Ho(),TZe={message:"boolean schema is false"};function OZe(t){let{gen:e,schema:r,validateName:n}=t;r===!1?$ae(t,!1):typeof r=="object"&&r.$async===!0?e.return(AZe.default.data):(e.assign((0,EZe._)`${n}.errors`,null),e.return(!0))}Md.topBoolOrEmptySchema=OZe;function RZe(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),$ae(t)):r.var(e,!0)}Md.boolOrEmptySchema=RZe;function $ae(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,kZe.reportError)(i,TZe,void 0,e)}});var nU=v(Fd=>{"use strict";Object.defineProperty(Fd,"__esModule",{value:!0});Fd.getRules=Fd.isJSONType=void 0;var IZe=["string","number","integer","boolean","null","object","array"],PZe=new Set(IZe);function CZe(t){return typeof t=="string"&&PZe.has(t)}Fd.isJSONType=CZe;function DZe(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Fd.getRules=DZe});var iU=v(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.shouldUseRule=ea.shouldUseGroup=ea.schemaHasRulesForType=void 0;function NZe({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Eae(t,n)}ea.schemaHasRulesForType=NZe;function Eae(t,e){return e.rules.some(r=>Aae(t,r))}ea.shouldUseGroup=Eae;function Aae(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ea.shouldUseRule=Aae});var Lg=v(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.reportTypeError=_r.checkDataTypes=_r.checkDataType=_r.coerceAndCheckDataType=_r.getJSONTypes=_r.getSchemaTypes=_r.DataType=void 0;var jZe=nU(),MZe=iU(),FZe=Fg(),Se=we(),Tae=Ne(),Ld;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Ld||(_r.DataType=Ld={}));function LZe(t){let e=Oae(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}_r.getSchemaTypes=LZe;function Oae(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(jZe.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}_r.getJSONTypes=Oae;function zZe(t,e){let{gen:r,data:n,opts:i}=t,o=UZe(e,i.coerceTypes),s=e.length>0&&!(o.length===0&&e.length===1&&(0,MZe.schemaHasRulesForType)(t,e[0]));if(s){let a=sU(e,n,i.strictNumbers,Ld.Wrong);r.if(a,()=>{o.length?qZe(t,e,o):aU(t)})}return s}_r.coerceAndCheckDataType=zZe;var Rae=new Set(["string","number","integer","boolean","null"]);function UZe(t,e){return e?t.filter(r=>Rae.has(r)||e==="array"&&r==="array"):[]}function qZe(t,e,r){let{gen:n,data:i,opts:o}=t,s=n.let("dataType",(0,Se._)`typeof ${i}`),a=n.let("coerced",(0,Se._)`undefined`);o.coerceTypes==="array"&&n.if((0,Se._)`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,Se._)`${i}[0]`).assign(s,(0,Se._)`typeof ${i}`).if(sU(e,i,o.strictNumbers),()=>n.assign(a,i))),n.if((0,Se._)`${a} !== undefined`);for(let l of r)(Rae.has(l)||l==="array"&&o.coerceTypes==="array")&&c(l);n.else(),aU(t),n.endIf(),n.if((0,Se._)`${a} !== undefined`,()=>{n.assign(i,a),BZe(t,a)});function c(l){switch(l){case"string":n.elseIf((0,Se._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,Se._)`"" + ${i}`).elseIf((0,Se._)`${i} === null`).assign(a,(0,Se._)`""`);return;case"number":n.elseIf((0,Se._)`${s} == "boolean" || ${i} === null || (${s} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,Se._)`+${i}`);return;case"integer":n.elseIf((0,Se._)`${s} === "boolean" || ${i} === null || (${s} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(a,(0,Se._)`+${i}`);return;case"boolean":n.elseIf((0,Se._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(a,!1).elseIf((0,Se._)`${i} === "true" || ${i} === 1`).assign(a,!0);return;case"null":n.elseIf((0,Se._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(a,null);return;case"array":n.elseIf((0,Se._)`${s} === "string" || ${s} === "number" - || ${s} === "boolean" || ${i} === null`).assign(a,(0,Se._)`[${i}]`)}}}function BZe({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Se._)`${e} !== undefined`,()=>t.assign((0,Se._)`${e}[${r}]`,n))}function oU(t,e,r,n=Ld.Correct){let i=n===Ld.Correct?Se.operators.EQ:Se.operators.NEQ,o;switch(t){case"null":return(0,Se._)`${e} ${i} null`;case"array":o=(0,Se._)`Array.isArray(${e})`;break;case"object":o=(0,Se._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=s((0,Se._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=s();break;default:return(0,Se._)`typeof ${e} ${i} ${t}`}return n===Ld.Correct?o:(0,Se.not)(o);function s(a=Se.nil){return(0,Se.and)((0,Se._)`typeof ${e} == "number"`,a,r?(0,Se._)`isFinite(${e})`:Se.nil)}}_r.checkDataType=oU;function sU(t,e,r,n){if(t.length===1)return oU(t[0],e,r,n);let i,o=(0,Tae.toHash)(t);if(o.array&&o.object){let s=(0,Se._)`typeof ${e} != "object"`;i=o.null?s:(0,Se._)`!${e} || ${s}`,delete o.null,delete o.array,delete o.object}else i=Se.nil;o.number&&delete o.integer;for(let s in o)i=(0,Se.and)(i,oU(s,e,r,n));return i}_r.checkDataTypes=sU;var HZe={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Se._)`{type: ${t}}`:(0,Se._)`{type: ${e}}`};function aU(t){let e=GZe(t);(0,FZe.reportError)(e,HZe)}_r.reportTypeError=aU;function GZe(t){let{gen:e,data:r,schema:n}=t,i=(0,Tae.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var Pae=v(jE=>{"use strict";Object.defineProperty(jE,"__esModule",{value:!0});jE.assignDefaults=void 0;var zd=we(),ZZe=Ne();function VZe(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)Iae(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,o)=>Iae(t,o,i.default))}jE.assignDefaults=VZe;function Iae(t,e,r){let{gen:n,compositeRule:i,data:o,opts:s}=t;if(r===void 0)return;let a=(0,zd._)`${o}${(0,zd.getProperty)(e)}`;if(i){(0,ZZe.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,zd._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,zd._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,zd._)`${a} = ${(0,zd.stringify)(r)}`)}});var Hn=v(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.validateUnion=nt.validateArray=nt.usePattern=nt.callValidateCode=nt.schemaProperties=nt.allSchemaProperties=nt.noPropertyInData=nt.propertyInData=nt.isOwnProperty=nt.hasPropFunc=nt.reportMissingProp=nt.checkMissingProp=nt.checkReportMissingProp=void 0;var ft=we(),cU=Ne(),ta=Ho(),WZe=Ne();function KZe(t,e){let{gen:r,data:n,it:i}=t;r.if(uU(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,ft._)`${e}`},!0),t.error()})}nt.checkReportMissingProp=KZe;function JZe({gen:t,data:e,it:{opts:r}},n,i){return(0,ft.or)(...n.map(o=>(0,ft.and)(uU(t,e,o,r.ownProperties),(0,ft._)`${i} = ${o}`)))}nt.checkMissingProp=JZe;function YZe(t,e){t.setParams({missingProperty:e},!0),t.error()}nt.reportMissingProp=YZe;function Cae(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ft._)`Object.prototype.hasOwnProperty`})}nt.hasPropFunc=Cae;function lU(t,e,r){return(0,ft._)`${Cae(t)}.call(${e}, ${r})`}nt.isOwnProperty=lU;function XZe(t,e,r,n){let i=(0,ft._)`${e}${(0,ft.getProperty)(r)} !== undefined`;return n?(0,ft._)`${i} && ${lU(t,e,r)}`:i}nt.propertyInData=XZe;function uU(t,e,r,n){let i=(0,ft._)`${e}${(0,ft.getProperty)(r)} === undefined`;return n?(0,ft.or)(i,(0,ft.not)(lU(t,e,r))):i}nt.noPropertyInData=uU;function Dae(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}nt.allSchemaProperties=Dae;function QZe(t,e){return Dae(e).filter(r=>!(0,cU.alwaysValidSchema)(t,e[r]))}nt.schemaProperties=QZe;function e9e({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:s},a,c,l){let u=l?(0,ft._)`${t}, ${e}, ${n}${i}`:e,d=[[ta.default.instancePath,(0,ft.strConcat)(ta.default.instancePath,o)],[ta.default.parentData,s.parentData],[ta.default.parentDataProperty,s.parentDataProperty],[ta.default.rootData,ta.default.rootData]];s.opts.dynamicRef&&d.push([ta.default.dynamicAnchors,ta.default.dynamicAnchors]);let f=(0,ft._)`${u}, ${r.object(...d)}`;return c!==ft.nil?(0,ft._)`${a}.call(${c}, ${f})`:(0,ft._)`${a}(${f})`}nt.callValidateCode=e9e;var t9e=(0,ft._)`new RegExp`;function r9e({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,o=i(r,n);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,ft._)`${i.code==="new RegExp"?t9e:(0,WZe.useFunc)(t,i)}(${r}, ${n})`})}nt.usePattern=r9e;function n9e(t){let{gen:e,data:r,keyword:n,it:i}=t,o=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(o,!0),s(()=>e.break()),o;function s(a){let c=e.const("len",(0,ft._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:n,dataProp:l,dataPropType:cU.Type.Num},o),e.if((0,ft.not)(o),a)})}}nt.validateArray=n9e;function i9e(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,cU.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,l)=>{let u=t.subschema({keyword:n,schemaProp:l,compositeRule:!0},a);e.assign(s,(0,ft._)`${s} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,ft.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}nt.validateUnion=i9e});var Mae=v(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.validateKeywordUsage=ro.validSchemaType=ro.funcKeywordCode=ro.macroKeywordCode=void 0;var Rr=we(),Uc=Ho(),o9e=Hn(),s9e=Fg();function a9e(t,e){let{gen:r,keyword:n,schema:i,parentSchema:o,it:s}=t,a=e.macro.call(s.self,i,o,s),c=jae(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:Rr.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}ro.macroKeywordCode=a9e;function c9e(t,e){var r;let{gen:n,keyword:i,schema:o,parentSchema:s,$data:a,it:c}=t;u9e(c,e);let l=!a&&e.compile?e.compile.call(c.self,o,s,c):e.validate,u=jae(n,i,l),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&Nae(t),g(()=>t.error());else{let b=e.async?p():m();e.modifying&&Nae(t),g(()=>l9e(t,b))}}function p(){let b=n.let("ruleErrs",null);return n.try(()=>h((0,Rr._)`await `),_=>n.assign(d,!1).if((0,Rr._)`${_} instanceof ${c.ValidationError}`,()=>n.assign(b,(0,Rr._)`${_}.errors`),()=>n.throw(_))),b}function m(){let b=(0,Rr._)`${u}.errors`;return n.assign(b,null),h(Rr.nil),b}function h(b=e.async?(0,Rr._)`await `:Rr.nil){let _=c.opts.passContext?Uc.default.this:Uc.default.self,S=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Rr._)`${b}${(0,o9e.callValidateCode)(t,u,_,S)}`,e.modifying)}function g(b){var _;n.if((0,Rr.not)((_=e.valid)!==null&&_!==void 0?_:d),b)}}ro.funcKeywordCode=c9e;function Nae(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Rr._)`${n.parentData}[${n.parentDataProperty}]`))}function l9e(t,e){let{gen:r}=t;r.if((0,Rr._)`Array.isArray(${e})`,()=>{r.assign(Uc.default.vErrors,(0,Rr._)`${Uc.default.vErrors} === null ? ${e} : ${Uc.default.vErrors}.concat(${e})`).assign(Uc.default.errors,(0,Rr._)`${Uc.default.vErrors}.length`),(0,s9e.extendErrors)(t)},()=>t.error())}function u9e({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function jae(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Rr.stringify)(r)})}function d9e(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}ro.validSchemaType=d9e;function f9e({schema:t,opts:e,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");let s=i.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[o])){let c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}ro.validateKeywordUsage=f9e});var Lae=v(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.extendSubschemaMode=ra.extendSubschemaData=ra.getSubschema=void 0;var no=we(),Fae=Ne();function p9e(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,no._)`${t.schemaPath}${(0,no.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,no._)`${t.schemaPath}${(0,no.getProperty)(e)}${(0,no.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Fae.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}ra.getSubschema=p9e;function m9e(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:s}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=e,f=a.let("data",(0,no._)`${e.data}${(0,no.getProperty)(r)}`,!0);c(f),t.errorPath=(0,no.str)`${l}${(0,Fae.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,no._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let l=i instanceof no.Name?i:a.let("data",i,!0);c(l),s!==void 0&&(t.propertyName=s)}o&&(t.dataTypes=o);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}ra.extendSubschemaData=m9e;function h9e(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}ra.extendSubschemaMode=h9e});var dU=v((qOt,zae)=>{"use strict";zae.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var s=o[i];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var qae=v((BOt,Uae)=>{"use strict";var na=Uae.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};ME(e,n,i,t,"",t)};na.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};na.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};na.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};na.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function ME(t,e,r,n,i,o,s,a,c,l){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,o,s,a,c,l);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in na.arrayKeywords)for(var f=0;f{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.getSchemaRefs=Kr.resolveUrl=Kr.normalizeId=Kr._getFullPath=Kr.getFullPath=Kr.inlineRef=void 0;var y9e=Ne(),_9e=dU(),b9e=qae(),v9e=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function S9e(t,e=!0){return typeof t=="boolean"?!0:e===!0?!fU(t):e?Bae(t)<=e:!1}Kr.inlineRef=S9e;var w9e=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function fU(t){for(let e in t){if(w9e.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(fU)||typeof r=="object"&&fU(r))return!0}return!1}function Bae(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!v9e.has(r)&&(typeof t[r]=="object"&&(0,y9e.eachItem)(t[r],n=>e+=Bae(n)),e===1/0))return 1/0}return e}function Hae(t,e="",r){r!==!1&&(e=Ud(e));let n=t.parse(e);return Gae(t,n)}Kr.getFullPath=Hae;function Gae(t,e){return t.serialize(e).split("#")[0]+"#"}Kr._getFullPath=Gae;var x9e=/#\/?$/;function Ud(t){return t?t.replace(x9e,""):""}Kr.normalizeId=Ud;function $9e(t,e,r){return r=Ud(r),t.resolve(e,r)}Kr.resolveUrl=$9e;var k9e=/^[a-z_][-a-z0-9._]*$/i;function E9e(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=Ud(t[r]||e),o={"":i},s=Hae(n,i,!1),a={},c=new Set;return b9e(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=s+f,g=o[m];typeof d[r]=="string"&&(g=b.call(this,d[r])),_.call(this,d.$anchor),_.call(this,d.$dynamicAnchor),o[f]=g;function b(S){let x=this.opts.uriResolver.resolve;if(S=Ud(g?x(g,S):S),c.has(S))throw u(S);c.add(S);let w=this.refs[S];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?l(d,w.schema,S):S!==Ud(h)&&(S[0]==="#"?(l(d,a[S],S),a[S]=d):this.refs[S]=h),S}function _(S){if(typeof S=="string"){if(!k9e.test(S))throw new Error(`invalid anchor "${S}"`);b.call(this,`#${S}`)}}}),a;function l(d,f,p){if(f!==void 0&&!_9e(d,f))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Kr.getSchemaRefs=E9e});var Bg=v(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.getData=ia.KeywordCxt=ia.validateFunctionCode=void 0;var Jae=kae(),Zae=Lg(),mU=iU(),FE=Lg(),A9e=Pae(),qg=Mae(),pU=Lae(),oe=we(),pe=Ho(),T9e=zg(),Go=Ne(),Ug=Fg();function O9e(t){if(Qae(t)&&(ece(t),Xae(t))){P9e(t);return}Yae(t,()=>(0,Jae.topBoolOrEmptySchema)(t))}ia.validateFunctionCode=O9e;function Yae({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},o){i.code.es5?t.func(e,(0,oe._)`${pe.default.data}, ${pe.default.valCxt}`,n.$async,()=>{t.code((0,oe._)`"use strict"; ${Vae(r,i)}`),I9e(t,i),t.code(o)}):t.func(e,(0,oe._)`${pe.default.data}, ${R9e(i)}`,n.$async,()=>t.code(Vae(r,i)).code(o))}function R9e(t){return(0,oe._)`{${pe.default.instancePath}="", ${pe.default.parentData}, ${pe.default.parentDataProperty}, ${pe.default.rootData}=${pe.default.data}${t.dynamicRef?(0,oe._)`, ${pe.default.dynamicAnchors}={}`:oe.nil}}={}`}function I9e(t,e){t.if(pe.default.valCxt,()=>{t.var(pe.default.instancePath,(0,oe._)`${pe.default.valCxt}.${pe.default.instancePath}`),t.var(pe.default.parentData,(0,oe._)`${pe.default.valCxt}.${pe.default.parentData}`),t.var(pe.default.parentDataProperty,(0,oe._)`${pe.default.valCxt}.${pe.default.parentDataProperty}`),t.var(pe.default.rootData,(0,oe._)`${pe.default.valCxt}.${pe.default.rootData}`),e.dynamicRef&&t.var(pe.default.dynamicAnchors,(0,oe._)`${pe.default.valCxt}.${pe.default.dynamicAnchors}`)},()=>{t.var(pe.default.instancePath,(0,oe._)`""`),t.var(pe.default.parentData,(0,oe._)`undefined`),t.var(pe.default.parentDataProperty,(0,oe._)`undefined`),t.var(pe.default.rootData,pe.default.data),e.dynamicRef&&t.var(pe.default.dynamicAnchors,(0,oe._)`{}`)})}function P9e(t){let{schema:e,opts:r,gen:n}=t;Yae(t,()=>{r.$comment&&e.$comment&&rce(t),M9e(t),n.let(pe.default.vErrors,null),n.let(pe.default.errors,0),r.unevaluated&&C9e(t),tce(t),z9e(t)})}function C9e(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,oe._)`${r}.evaluated`),e.if((0,oe._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,oe._)`${t.evaluated}.props`,(0,oe._)`undefined`)),e.if((0,oe._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,oe._)`${t.evaluated}.items`,(0,oe._)`undefined`))}function Vae(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,oe._)`/*# sourceURL=${r} */`:oe.nil}function D9e(t,e){if(Qae(t)&&(ece(t),Xae(t))){N9e(t,e);return}(0,Jae.boolOrEmptySchema)(t,e)}function Xae({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function Qae(t){return typeof t.schema!="boolean"}function N9e(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&rce(t),F9e(t),L9e(t);let o=n.const("_errs",pe.default.errors);tce(t,o),n.var(e,(0,oe._)`${o} === ${pe.default.errors}`)}function ece(t){(0,Go.checkUnknownRules)(t),j9e(t)}function tce(t,e){if(t.opts.jtd)return Wae(t,[],!1,e);let r=(0,Zae.getSchemaTypes)(t.schema),n=(0,Zae.coerceAndCheckDataType)(t,r);Wae(t,r,!n,e)}function j9e(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Go.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function M9e(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Go.checkStrictMode)(t,"default is ignored in the schema root")}function F9e(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,T9e.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function L9e(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function rce({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let o=r.$comment;if(i.$comment===!0)t.code((0,oe._)`${pe.default.self}.logger.log(${o})`);else if(typeof i.$comment=="function"){let s=(0,oe.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,oe._)`${pe.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function z9e(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=t;r.$async?e.if((0,oe._)`${pe.default.errors} === 0`,()=>e.return(pe.default.data),()=>e.throw((0,oe._)`new ${i}(${pe.default.vErrors})`)):(e.assign((0,oe._)`${n}.errors`,pe.default.vErrors),o.unevaluated&&U9e(t),e.return((0,oe._)`${pe.default.errors} === 0`))}function U9e({gen:t,evaluated:e,props:r,items:n}){r instanceof oe.Name&&t.assign((0,oe._)`${e}.props`,r),n instanceof oe.Name&&t.assign((0,oe._)`${e}.items`,n)}function Wae(t,e,r,n){let{gen:i,schema:o,data:s,allErrors:a,opts:c,self:l}=t,{RULES:u}=l;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Go.schemaHasRulesButRef)(o,u))){i.block(()=>ice(t,"$ref",u.all.$ref.definition));return}c.jtd||q9e(t,e),i.block(()=>{for(let f of u.rules)d(f);d(u.post)});function d(f){(0,mU.shouldUseGroup)(o,f)&&(f.type?(i.if((0,FE.checkDataType)(f.type,s,c.strictNumbers)),Kae(t,f),e.length===1&&e[0]===f.type&&r&&(i.else(),(0,FE.reportTypeError)(t)),i.endIf()):Kae(t,f),a||i.if((0,oe._)`${pe.default.errors} === ${n||0}`))}}function Kae(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,A9e.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,mU.shouldUseRule)(n,o)&&ice(t,o.keyword,o.definition,e.type)})}function q9e(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(B9e(t,e),t.opts.allowUnionTypes||H9e(t,e),G9e(t,t.dataTypes))}function B9e(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{nce(t.dataTypes,r)||hU(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),V9e(t,e)}}function H9e(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&hU(t,"use allowUnionTypes to allow union type keyword")}function G9e(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,mU.shouldUseRule)(t.schema,i)){let{type:o}=i.definition;o.length&&!o.some(s=>Z9e(e,s))&&hU(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function Z9e(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function nce(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function V9e(t,e){let r=[];for(let n of t.dataTypes)nce(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function hU(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Go.checkStrictMode)(t,e,t.opts.strictTypes)}var LE=class{constructor(e,r,n){if((0,qg.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Go.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",oce(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,qg.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",pe.default.errors))}result(e,r,n){this.failResult((0,oe.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,oe.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,oe._)`${r} !== undefined && (${(0,oe.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Ug.reportExtraError:Ug.reportError)(this,this.def.error,r)}$dataError(){(0,Ug.reportError)(this,this.def.$dataError||Ug.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ug.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=oe.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=oe.nil,r=oe.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:o,def:s}=this;n.if((0,oe.or)((0,oe._)`${i} === undefined`,r)),e!==oe.nil&&n.assign(e,!0),(o.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==oe.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:o}=this;return(0,oe.or)(s(),a());function s(){if(n.length){if(!(r instanceof oe.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,oe._)`${(0,FE.checkDataTypes)(c,r,o.opts.strictNumbers,FE.DataType.Wrong)}`}return oe.nil}function a(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,oe._)`!${c}(${r})`}return oe.nil}}subschema(e,r){let n=(0,pU.getSubschema)(this.it,e);(0,pU.extendSubschemaData)(n,this.it,e),(0,pU.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return D9e(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Go.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Go.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,oe.Name)),!0}};ia.KeywordCxt=LE;function ice(t,e,r,n){let i=new LE(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,qg.funcKeywordCode)(i,r):"macro"in r?(0,qg.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,qg.funcKeywordCode)(i,r)}var W9e=/^\/(?:[^~]|~0|~1)*$/,K9e=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function oce(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,o;if(t==="")return pe.default.rootData;if(t[0]==="/"){if(!W9e.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,o=pe.default.rootData}else{let l=K9e.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+l[1];if(i=l[2],i==="#"){if(u>=e)throw new Error(c("property/index",u));return n[e-u]}if(u>e)throw new Error(c("data",u));if(o=r[e-u],!i)return o}let s=o,a=i.split("/");for(let l of a)l&&(o=(0,oe._)`${o}${(0,oe.getProperty)((0,Go.unescapeJsonPointer)(l))}`,s=(0,oe._)`${s} && ${o}`);return s;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}ia.getData=oce});var zE=v(yU=>{"use strict";Object.defineProperty(yU,"__esModule",{value:!0});var gU=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};yU.default=gU});var Hg=v(vU=>{"use strict";Object.defineProperty(vU,"__esModule",{value:!0});var _U=zg(),bU=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,_U.resolveUrl)(e,r,n),this.missingSchema=(0,_U.normalizeId)((0,_U.getFullPath)(e,this.missingRef))}};vU.default=bU});var qE=v(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.resolveSchema=Gn.getCompilingSchema=Gn.resolveRef=Gn.compileSchema=Gn.SchemaEnv=void 0;var _i=we(),J9e=zE(),qc=Ho(),bi=zg(),sce=Ne(),Y9e=Bg(),qd=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,bi.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Gn.SchemaEnv=qd;function wU(t){let e=ace.call(this,t);if(e)return e;let r=(0,bi.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:o}=this.opts,s=new _i.CodeGen(this.scope,{es5:n,lines:i,ownProperties:o}),a;t.$async&&(a=s.scopeValue("Error",{ref:J9e.default,code:(0,_i._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");t.validateName=c;let l={gen:s,allErrors:this.opts.allErrors,data:qc.default.data,parentData:qc.default.parentData,parentDataProperty:qc.default.parentDataProperty,dataNames:[qc.default.data],dataPathArr:[_i.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,_i.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:_i.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,_i._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,Y9e.validateFunctionCode)(l),s.optimize(this.opts.code.optimize);let d=s.toString();u=`${s.scopeRefs(qc.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${qc.default.self}`,`${qc.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=l;p.evaluated={props:m instanceof _i.Name?void 0:m,items:h instanceof _i.Name?void 0:h,dynamicProps:m instanceof _i.Name,dynamicItems:h instanceof _i.Name},p.source&&(p.source.evaluated=(0,_i.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}Gn.compileSchema=wU;function X9e(t,e,r){var n;r=(0,bi.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let o=tVe.call(this,t,r);if(o===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(o=new qd({schema:s,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=Q9e.call(this,o)}Gn.resolveRef=X9e;function Q9e(t){return(0,bi.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:wU.call(this,t)}function ace(t){for(let e of this._compilations)if(eVe(e,t))return e}Gn.getCompilingSchema=ace;function eVe(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function tVe(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||UE.call(this,t,e)}function UE(t,e){let r=this.opts.uriResolver.parse(e),n=(0,bi._getFullPath)(this.opts.uriResolver,r),i=(0,bi.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return SU.call(this,r,t);let o=(0,bi.normalizeId)(n),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=UE.call(this,t,s);return typeof a?.schema!="object"?void 0:SU.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||wU.call(this,s),o===(0,bi.normalizeId)(e)){let{schema:a}=s,{schemaId:c}=this.opts,l=a[c];return l&&(i=(0,bi.resolveUrl)(this.opts.uriResolver,i,l)),new qd({schema:a,schemaId:c,root:t,baseId:i})}return SU.call(this,r,s)}}Gn.resolveSchema=UE;var rVe=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function SU(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,sce.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!rVe.has(a)&&l&&(e=(0,bi.resolveUrl)(this.opts.uriResolver,e,l))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,sce.schemaHasRulesButRef)(r,this.RULES)){let a=(0,bi.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=UE.call(this,n,a)}let{schemaId:s}=this.opts;if(o=o||new qd({schema:r,schemaId:s,root:n,baseId:e}),o.schema!==o.root.schema)return o}});var cce=v((KOt,nVe)=>{nVe.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var kU=v((JOt,mce)=>{"use strict";var iVe=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),uce=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),xU=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),dce=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),oVe=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function $U(t){let e="",r=0,n=0;for(n=0;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var sVe=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function lce(t){return t.length=0,!0}function aVe(t,e,r){if(t.length){let n=$U(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function cVe(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],o=!1,s=!1,a=aVe;for(let c=0;c7){r.error=!0;break}c>0&&t[c-1]===":"&&(o=!0),n.push(":");continue}else if(l==="%"){if(!a(i,n,r))break;a=lce}else{i.push(l);continue}}return i.length&&(a===lce?r.zone=i.join(""):s?n.push(i.join("")):n.push($U(i))),r.address=n.join(""),r}function fce(t){if(lVe(t,":")<2)return{host:t,isIPV6:!1};let e=cVe(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function lVe(t,e){let r=0;for(let n=0;ndVe[n])}function mVe(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let n=0;n{"use strict";var{isUUID:_Ve}=kU(),bVe=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,vVe=["http","https","ws","wss","urn","urn:uuid"];function SVe(t){return vVe.indexOf(t)!==-1}function EU(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function hce(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function gce(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function wVe(t){return t.secure=EU(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function xVe(t){if((t.port===(EU(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function $Ve(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(bVe);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,o=AU(i);t.path=void 0,o&&(t=o.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function kVe(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,o=AU(i);o&&(t=o.serialize(t,e));let s=t,a=t.nss;return s.path=`${n||e.nid}:${a}`,e.skipEscape=!0,s}function EVe(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!_Ve(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function AVe(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var yce={scheme:"http",domainHost:!0,parse:hce,serialize:gce},TVe={scheme:"https",domainHost:yce.domainHost,parse:hce,serialize:gce},BE={scheme:"ws",domainHost:!0,parse:wVe,serialize:xVe},OVe={scheme:"wss",domainHost:BE.domainHost,parse:BE.parse,serialize:BE.serialize},RVe={scheme:"urn",parse:$Ve,serialize:kVe,skipNormalize:!0},IVe={scheme:"urn:uuid",parse:EVe,serialize:AVe,skipNormalize:!0},HE={http:yce,https:TVe,ws:BE,wss:OVe,urn:RVe,"urn:uuid":IVe};Object.setPrototypeOf(HE,null);function AU(t){return t&&(HE[t]||HE[t.toLowerCase()])||void 0}_ce.exports={wsIsSecure:EU,SCHEMES:HE,isValidSchemeName:SVe,getSchemeHandler:AU}});var kce=v((XOt,GE)=>{"use strict";var{normalizeIPv6:PVe,removeDotSegments:Gg,recomposeAuthority:CVe,normalizePercentEncoding:DVe,normalizePathEncoding:NVe,escapePreservingEscapes:jVe,reescapeHostDelimiters:MVe,isIPv4:FVe,nonSimpleDomain:LVe}=kU(),{SCHEMES:zVe,getSchemeHandler:Sce}=bce();function UVe(t,e){return typeof t=="string"?t=ZVe(t,e):typeof t=="object"&&(t=Bd(Bc(t,e),e)),t}function qVe(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=wce(Bd(t,n),Bd(e,n),n,!0);return n.skipEscape=!0,Bc(i,n)}function wce(t,e,r,n){let i={};return n||(t=Bd(Bc(t,r),r),e=Bd(Bc(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Gg(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Gg(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=Gg(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=Gg(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function BVe(t,e,r){let n=vce(t,r),i=vce(e,r);return n!==void 0&&i!==void 0&&n.toLowerCase()===i.toLowerCase()}function Bc(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],o=Sce(n.scheme||r.scheme);o&&o.serialize&&o.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=DVe(r.path):(r.path=jVe(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let s=CVe(r);if(s!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(s),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(a=Gg(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),i.push(a)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var HVe=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function GVe(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function xce(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let s=t.match(HVe);if(s){n.scheme=s[1],n.userinfo=s[3],n.host=s[4],n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=s[7],n.fragment=s[8],isNaN(n.port)&&(n.port=s[5]);let a=GVe(n,s);if(a!==void 0&&(n.error=n.error||a,i=!0),n.host)if(FVe(n.host)===!1){let u=PVe(n.host);n.host=u.host.toLowerCase(),o=u.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let c=Sce(r.scheme||n.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&n.host&&(r.domainHost||c&&c.domainHost)&&o===!1&&LVe(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(l){n.error=n.error||"Host's domain name can not be converted to ASCII: "+l}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=MVe(unescape(n.host),o))),n.path&&(n.path=NVe(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}c&&c.parse&&c.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:i}}function Bd(t,e){return xce(t,e).parsed}function ZVe(t,e){return $ce(t,e).normalized}function $ce(t,e){let{parsed:r,malformedAuthorityOrPort:n}=xce(t,e);return{normalized:n?t:Bc(r,e),malformedAuthorityOrPort:n}}function vce(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:n}=$ce(t,e);return n?void 0:r}if(typeof t=="object")return Bc(t,e)}var TU={SCHEMES:zVe,normalize:UVe,resolve:qVe,resolveComponent:wce,equal:BVe,serialize:Bc,parse:Bd};GE.exports=TU;GE.exports.default=TU;GE.exports.fastUri=TU});var Ace=v(OU=>{"use strict";Object.defineProperty(OU,"__esModule",{value:!0});var Ece=kce();Ece.code='require("ajv/dist/runtime/uri").default';OU.default=Ece});var Nce=v(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.CodeGen=lr.Name=lr.nil=lr.stringify=lr.str=lr._=lr.KeywordCxt=void 0;var VVe=Bg();Object.defineProperty(lr,"KeywordCxt",{enumerable:!0,get:function(){return VVe.KeywordCxt}});var Hd=we();Object.defineProperty(lr,"_",{enumerable:!0,get:function(){return Hd._}});Object.defineProperty(lr,"str",{enumerable:!0,get:function(){return Hd.str}});Object.defineProperty(lr,"stringify",{enumerable:!0,get:function(){return Hd.stringify}});Object.defineProperty(lr,"nil",{enumerable:!0,get:function(){return Hd.nil}});Object.defineProperty(lr,"Name",{enumerable:!0,get:function(){return Hd.Name}});Object.defineProperty(lr,"CodeGen",{enumerable:!0,get:function(){return Hd.CodeGen}});var WVe=zE(),Pce=Hg(),KVe=nU(),Zg=qE(),JVe=we(),Vg=zg(),ZE=Lg(),IU=Ne(),Tce=cce(),YVe=Ace(),Cce=(t,e)=>new RegExp(t,e);Cce.code="new RegExp";var XVe=["removeAdditional","useDefaults","coerceTypes"],QVe=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),eWe={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},tWe={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Oce=200;function rWe(t){var e,r,n,i,o,s,a,c,l,u,d,f,p,m,h,g,b,_,S,x,w,O,T,A,D;let $=t.strict,ie=(e=t.code)===null||e===void 0?void 0:e.optimize,K=ie===!0||ie===void 0?1:ie||0,xe=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Cce,C=(i=t.uriResolver)!==null&&i!==void 0?i:YVe.default;return{strictSchema:(s=(o=t.strictSchema)!==null&&o!==void 0?o:$)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:$)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:$)!==null&&u!==void 0?u:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:$)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:$)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:K,regExp:xe}:{optimize:K,regExp:xe},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:Oce,loopEnum:(g=t.loopEnum)!==null&&g!==void 0?g:Oce,meta:(b=t.meta)!==null&&b!==void 0?b:!0,messages:(_=t.messages)!==null&&_!==void 0?_:!0,inlineRefs:(S=t.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(x=t.schemaId)!==null&&x!==void 0?x:"$id",addUsedSchema:(w=t.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(O=t.validateSchema)!==null&&O!==void 0?O:!0,validateFormats:(T=t.validateFormats)!==null&&T!==void 0?T:!0,unicodeRegExp:(A=t.unicodeRegExp)!==null&&A!==void 0?A:!0,int32range:(D=t.int32range)!==null&&D!==void 0?D:!0,uriResolver:C}}var Wg=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...rWe(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new JVe.ValueScope({scope:{},prefixes:QVe,es5:r,lines:n}),this.logger=cWe(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,KVe.getRules)(),Rce.call(this,eWe,e,"NOT SUPPORTED"),Rce.call(this,tWe,e,"DEPRECATED","warn"),this._metaOpts=sWe.call(this),e.formats&&iWe.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&oWe.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),nWe.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=Tce;n==="id"&&(i={...Tce},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(u,d){await o.call(this,u.$schema);let f=this._addSchema(u,d);return f.validate||s.call(this,f)}async function o(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof Pce.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await o.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,i);return this}let o;if(typeof e=="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,Vg.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return i}getSchema(e){let r;for(;typeof(r=Ice.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new Zg.SchemaEnv({schema:{},schemaId:n});if(r=Zg.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Ice.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Vg.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(uWe.call(this,n,r),!r)return(0,IU.eachItem)(n,o=>RU.call(this,o)),this;fWe.call(this,r);let i={...r,type:(0,ZE.getJSONTypes)(r.type),schemaType:(0,ZE.getJSONTypes)(r.schemaType)};return(0,IU.eachItem)(n,i.type.length===0?o=>RU.call(this,o,i):o=>i.type.forEach(s=>RU.call(this,o,i,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(o=>o.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,o)=>i+r+o)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let o=i.split("/").slice(1),s=e;for(let a of o)s=s[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=s[a];l&&u&&(s[a]=Dce(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Vg.normalizeId)(s||n);let l=Vg.getSchemaRefs.call(this,e,n);return c=new Zg.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:l}),this._cache.set(c.schema,c),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Zg.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Zg.compileSchema.call(this,e)}finally{this.opts=r}}};Wg.ValidationError=WVe.default;Wg.MissingRefError=Pce.default;lr.default=Wg;function Rce(t,e,r,n="error"){for(let i in t){let o=i;o in e&&this.logger[n](`${r}: option ${i}. ${t[o]}`)}}function Ice(t){return t=(0,Vg.normalizeId)(t),this.schemas[t]||this.refs[t]}function nWe(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function iWe(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function oWe(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function sWe(){let t={...this.opts};for(let e of XVe)delete t[e];return t}var aWe={log(){},warn(){},error(){}};function cWe(t){if(t===!1)return aWe;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var lWe=/^[a-z_$][a-z0-9_$:-]*$/i;function uWe(t,e){let{RULES:r}=this;if((0,IU.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!lWe.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function RU(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=i?o.post:o.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,ZE.getJSONTypes)(e.type),schemaType:(0,ZE.getJSONTypes)(e.schemaType)}};e.before?dWe.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function dWe(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function fWe(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Dce(e)),t.validateSchema=this.compile(e,!0))}var pWe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Dce(t){return{anyOf:[t,pWe]}}});var jce=v(PU=>{"use strict";Object.defineProperty(PU,"__esModule",{value:!0});var mWe={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};PU.default=mWe});var zce=v(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.callRef=Hc.getValidate=void 0;var hWe=Hg(),Mce=Hn(),Jr=we(),Gd=Ho(),Fce=qE(),VE=Ne(),gWe={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:o,validateName:s,opts:a,self:c}=n,{root:l}=o;if((r==="#"||r==="#/")&&i===l.baseId)return d();let u=Fce.resolveRef.call(c,l,i,r);if(u===void 0)throw new hWe.default(n.opts.uriResolver,i,r);if(u instanceof Fce.SchemaEnv)return f(u);return p(u);function d(){if(o===l)return WE(t,s,o,o.$async);let m=e.scopeValue("root",{ref:l});return WE(t,(0,Jr._)`${m}.validate`,l,l.$async)}function f(m){let h=Lce(t,m);WE(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Jr.stringify)(m)}:{ref:m}),g=e.name("valid"),b=t.subschema({schema:m,dataTypes:[],schemaPath:Jr.nil,topSchemaRef:h,errSchemaPath:r},g);t.mergeEvaluated(b),t.ok(g)}}};function Lce(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Jr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Hc.getValidate=Lce;function WE(t,e,r,n){let{gen:i,it:o}=t,{allErrors:s,schemaEnv:a,opts:c}=o,l=c.passContext?Gd.default.this:Jr.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=i.let("valid");i.try(()=>{i.code((0,Jr._)`await ${(0,Mce.callValidateCode)(t,e,l)}`),p(e),s||i.assign(m,!0)},h=>{i.if((0,Jr._)`!(${h} instanceof ${o.ValidationError})`,()=>i.throw(h)),f(h),s||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,Mce.callValidateCode)(t,e,l),()=>p(e),()=>f(e))}function f(m){let h=(0,Jr._)`${m}.errors`;i.assign(Gd.default.vErrors,(0,Jr._)`${Gd.default.vErrors} === null ? ${h} : ${Gd.default.vErrors}.concat(${h})`),i.assign(Gd.default.errors,(0,Jr._)`${Gd.default.vErrors}.length`)}function p(m){var h;if(!o.opts.unevaluated)return;let g=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(o.props=VE.mergeEvaluated.props(i,g.props,o.props));else{let b=i.var("props",(0,Jr._)`${m}.evaluated.props`);o.props=VE.mergeEvaluated.props(i,b,o.props,Jr.Name)}if(o.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(o.items=VE.mergeEvaluated.items(i,g.items,o.items));else{let b=i.var("items",(0,Jr._)`${m}.evaluated.items`);o.items=VE.mergeEvaluated.items(i,b,o.items,Jr.Name)}}}Hc.callRef=WE;Hc.default=gWe});var Uce=v(CU=>{"use strict";Object.defineProperty(CU,"__esModule",{value:!0});var yWe=jce(),_We=zce(),bWe=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",yWe.default,_We.default];CU.default=bWe});var qce=v(DU=>{"use strict";Object.defineProperty(DU,"__esModule",{value:!0});var KE=we(),oa=KE.operators,JE={maximum:{okStr:"<=",ok:oa.LTE,fail:oa.GT},minimum:{okStr:">=",ok:oa.GTE,fail:oa.LT},exclusiveMaximum:{okStr:"<",ok:oa.LT,fail:oa.GTE},exclusiveMinimum:{okStr:">",ok:oa.GT,fail:oa.LTE}},vWe={message:({keyword:t,schemaCode:e})=>(0,KE.str)`must be ${JE[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,KE._)`{comparison: ${JE[t].okStr}, limit: ${e}}`},SWe={keyword:Object.keys(JE),type:"number",schemaType:"number",$data:!0,error:vWe,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,KE._)`${r} ${JE[e].fail} ${n} || isNaN(${r})`)}};DU.default=SWe});var Bce=v(NU=>{"use strict";Object.defineProperty(NU,"__esModule",{value:!0});var Kg=we(),wWe={message:({schemaCode:t})=>(0,Kg.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Kg._)`{multipleOf: ${t}}`},xWe={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:wWe,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,o=i.opts.multipleOfPrecision,s=e.let("res"),a=o?(0,Kg._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,Kg._)`${s} !== parseInt(${s})`;t.fail$data((0,Kg._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};NU.default=xWe});var Gce=v(jU=>{"use strict";Object.defineProperty(jU,"__esModule",{value:!0});function Hce(t){let e=t.length,r=0,n=0,i;for(;n=55296&&i<=56319&&n{"use strict";Object.defineProperty(MU,"__esModule",{value:!0});var Gc=we(),$We=Ne(),kWe=Gce(),EWe={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Gc.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Gc._)`{limit: ${t}}`},AWe={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:EWe,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,o=e==="maxLength"?Gc.operators.GT:Gc.operators.LT,s=i.opts.unicode===!1?(0,Gc._)`${r}.length`:(0,Gc._)`${(0,$We.useFunc)(t.gen,kWe.default)}(${r})`;t.fail$data((0,Gc._)`${s} ${o} ${n}`)}};MU.default=AWe});var Vce=v(FU=>{"use strict";Object.defineProperty(FU,"__esModule",{value:!0});var TWe=Hn(),OWe=Ne(),Zd=we(),RWe={message:({schemaCode:t})=>(0,Zd.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Zd._)`{pattern: ${t}}`},IWe={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:RWe,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:o,it:s}=t,a=s.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=s.opts.code,l=c.code==="new RegExp"?(0,Zd._)`new RegExp`:(0,OWe.useFunc)(e,c),u=e.let("valid");e.try(()=>e.assign(u,(0,Zd._)`${l}(${o}, ${a}).test(${r})`),()=>e.assign(u,!1)),t.fail$data((0,Zd._)`!${u}`)}else{let c=(0,TWe.usePattern)(t,i);t.fail$data((0,Zd._)`!${c}.test(${r})`)}}};FU.default=IWe});var Wce=v(LU=>{"use strict";Object.defineProperty(LU,"__esModule",{value:!0});var Jg=we(),PWe={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Jg.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Jg._)`{limit: ${t}}`},CWe={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:PWe,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?Jg.operators.GT:Jg.operators.LT;t.fail$data((0,Jg._)`Object.keys(${r}).length ${i} ${n}`)}};LU.default=CWe});var Kce=v(zU=>{"use strict";Object.defineProperty(zU,"__esModule",{value:!0});var Yg=Hn(),Xg=we(),DWe=Ne(),NWe={message:({params:{missingProperty:t}})=>(0,Xg.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Xg._)`{missingProperty: ${t}}`},jWe={keyword:"required",type:"object",schemaType:"array",$data:!0,error:NWe,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:o,it:s}=t,{opts:a}=s;if(!o&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?l():u(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let g=s.schemaEnv.baseId+s.errSchemaPath,b=`required property "${h}" is not defined at "${g}" (strictRequired)`;(0,DWe.checkStrictMode)(s,b,s.opts.strictRequired)}}function l(){if(c||o)t.block$data(Xg.nil,d);else for(let p of r)(0,Yg.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(c||o){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,Yg.checkMissingProp)(t,r,p)),(0,Yg.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Yg.noPropertyInData)(e,i,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,Yg.propertyInData)(e,i,p,a.ownProperties)),e.if((0,Xg.not)(m),()=>{t.error(),e.break()})},Xg.nil)}}};zU.default=jWe});var Jce=v(UU=>{"use strict";Object.defineProperty(UU,"__esModule",{value:!0});var Qg=we(),MWe={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Qg.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Qg._)`{limit: ${t}}`},FWe={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:MWe,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Qg.operators.GT:Qg.operators.LT;t.fail$data((0,Qg._)`${r}.length ${i} ${n}`)}};UU.default=FWe});var YE=v(qU=>{"use strict";Object.defineProperty(qU,"__esModule",{value:!0});var Yce=dU();Yce.code='require("ajv/dist/runtime/equal").default';qU.default=Yce});var Xce=v(HU=>{"use strict";Object.defineProperty(HU,"__esModule",{value:!0});var BU=Lg(),ur=we(),LWe=Ne(),zWe=YE(),UWe={message:({params:{i:t,j:e}})=>(0,ur.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,ur._)`{i: ${t}, j: ${e}}`},qWe={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:UWe,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:o,schemaCode:s,it:a}=t;if(!n&&!i)return;let c=e.let("valid"),l=o.items?(0,BU.getSchemaTypes)(o.items):[];t.block$data(c,u,(0,ur._)`${s} === false`),t.ok(c);function u(){let m=e.let("i",(0,ur._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,ur._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function f(m,h){let g=e.name("item"),b=(0,BU.checkDataTypes)(l,g,a.opts.strictNumbers,BU.DataType.Wrong),_=e.const("indices",(0,ur._)`{}`);e.for((0,ur._)`;${m}--;`,()=>{e.let(g,(0,ur._)`${r}[${m}]`),e.if(b,(0,ur._)`continue`),l.length>1&&e.if((0,ur._)`typeof ${g} == "string"`,(0,ur._)`${g} += "_"`),e.if((0,ur._)`typeof ${_}[${g}] == "number"`,()=>{e.assign(h,(0,ur._)`${_}[${g}]`),t.error(),e.assign(c,!1).break()}).code((0,ur._)`${_}[${g}] = ${m}`)})}function p(m,h){let g=(0,LWe.useFunc)(e,zWe.default),b=e.name("outer");e.label(b).for((0,ur._)`;${m}--;`,()=>e.for((0,ur._)`${h} = ${m}; ${h}--;`,()=>e.if((0,ur._)`${g}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(b)})))}}};HU.default=qWe});var Qce=v(ZU=>{"use strict";Object.defineProperty(ZU,"__esModule",{value:!0});var GU=we(),BWe=Ne(),HWe=YE(),GWe={message:"must be equal to constant",params:({schemaCode:t})=>(0,GU._)`{allowedValue: ${t}}`},ZWe={keyword:"const",$data:!0,error:GWe,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:o}=t;n||o&&typeof o=="object"?t.fail$data((0,GU._)`!${(0,BWe.useFunc)(e,HWe.default)}(${r}, ${i})`):t.fail((0,GU._)`${o} !== ${r}`)}};ZU.default=ZWe});var ele=v(VU=>{"use strict";Object.defineProperty(VU,"__esModule",{value:!0});var ey=we(),VWe=Ne(),WWe=YE(),KWe={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,ey._)`{allowedValues: ${t}}`},JWe={keyword:"enum",schemaType:"array",$data:!0,error:KWe,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:o,it:s}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=s.opts.loopEnum,c,l=()=>c??(c=(0,VWe.useFunc)(e,WWe.default)),u;if(a||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=e.const("vSchema",o);u=(0,ey.or)(...i.map((m,h)=>f(p,h)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",o,p=>e.if((0,ey._)`${l()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function f(p,m){let h=i[m];return typeof h=="object"&&h!==null?(0,ey._)`${l()}(${r}, ${p}[${m}])`:(0,ey._)`${r} === ${h}`}}};VU.default=JWe});var tle=v(WU=>{"use strict";Object.defineProperty(WU,"__esModule",{value:!0});var YWe=qce(),XWe=Bce(),QWe=Zce(),e3e=Vce(),t3e=Wce(),r3e=Kce(),n3e=Jce(),i3e=Xce(),o3e=Qce(),s3e=ele(),a3e=[YWe.default,XWe.default,QWe.default,e3e.default,t3e.default,r3e.default,n3e.default,i3e.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},o3e.default,s3e.default];WU.default=a3e});var JU=v(ty=>{"use strict";Object.defineProperty(ty,"__esModule",{value:!0});ty.validateAdditionalItems=void 0;var Zc=we(),KU=Ne(),c3e={message:({params:{len:t}})=>(0,Zc.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Zc._)`{limit: ${t}}`},l3e={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:c3e,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,KU.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}rle(t,n)}};function rle(t,e){let{gen:r,schema:n,data:i,keyword:o,it:s}=t;s.items=!0;let a=r.const("len",(0,Zc._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Zc._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,KU.alwaysValidSchema)(s,n)){let l=r.var("valid",(0,Zc._)`${a} <= ${e.length}`);r.if((0,Zc.not)(l),()=>c(l)),t.ok(l)}function c(l){r.forRange("i",e.length,a,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:KU.Type.Num},l),s.allErrors||r.if((0,Zc.not)(l),()=>r.break())})}}ty.validateAdditionalItems=rle;ty.default=l3e});var YU=v(ry=>{"use strict";Object.defineProperty(ry,"__esModule",{value:!0});ry.validateTuple=void 0;var nle=we(),XE=Ne(),u3e=Hn(),d3e={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return ile(t,"additionalItems",e);r.items=!0,!(0,XE.alwaysValidSchema)(r,e)&&t.ok((0,u3e.validateArray)(t))}};function ile(t,e,r=t.schema){let{gen:n,parentSchema:i,data:o,keyword:s,it:a}=t;u(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=XE.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),l=n.const("len",(0,nle._)`${o}.length`);r.forEach((d,f)=>{(0,XE.alwaysValidSchema)(a,d)||(n.if((0,nle._)`${l} > ${f}`,()=>t.subschema({keyword:s,schemaProp:f,dataProp:f},c)),t.ok(c))});function u(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let g=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,XE.checkStrictMode)(a,g,f.strictTuples)}}}ry.validateTuple=ile;ry.default=d3e});var ole=v(XU=>{"use strict";Object.defineProperty(XU,"__esModule",{value:!0});var f3e=YU(),p3e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,f3e.validateTuple)(t,"items")};XU.default=p3e});var ale=v(QU=>{"use strict";Object.defineProperty(QU,"__esModule",{value:!0});var sle=we(),m3e=Ne(),h3e=Hn(),g3e=JU(),y3e={message:({params:{len:t}})=>(0,sle.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,sle._)`{limit: ${t}}`},_3e={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:y3e,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,m3e.alwaysValidSchema)(n,e)&&(i?(0,g3e.validateAdditionalItems)(t,i):t.ok((0,h3e.validateArray)(t)))}};QU.default=_3e});var cle=v(eq=>{"use strict";Object.defineProperty(eq,"__esModule",{value:!0});var Zn=we(),QE=Ne(),b3e={message:({params:{min:t,max:e}})=>e===void 0?(0,Zn.str)`must contain at least ${t} valid item(s)`:(0,Zn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Zn._)`{minContains: ${t}}`:(0,Zn._)`{minContains: ${t}, maxContains: ${e}}`},v3e={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:b3e,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t,s,a,{minContains:c,maxContains:l}=n;o.opts.next?(s=c===void 0?1:c,a=l):s=1;let u=e.const("len",(0,Zn._)`${i}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,QE.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,QE.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,QE.alwaysValidSchema)(o,r)){let h=(0,Zn._)`${u} >= ${s}`;a!==void 0&&(h=(0,Zn._)`${h} && ${u} <= ${a}`),t.pass(h);return}o.items=!0;let d=e.name("valid");a===void 0&&s===1?p(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,Zn._)`${i}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),g=e.let("count",0);p(h,()=>e.if(h,()=>m(g)))}function p(h,g){e.forRange("i",0,u,b=>{t.subschema({keyword:"contains",dataProp:b,dataPropType:QE.Type.Num,compositeRule:!0},h),g()})}function m(h){e.code((0,Zn._)`${h}++`),a===void 0?e.if((0,Zn._)`${h} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,Zn._)`${h} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,Zn._)`${h} >= ${s}`,()=>e.assign(d,!0)))}}};eq.default=v3e});var dle=v(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.validateSchemaDeps=io.validatePropertyDeps=io.error=void 0;var tq=we(),S3e=Ne(),ny=Hn();io.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,tq.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,tq._)`{property: ${t}, + || ${s} === "boolean" || ${i} === null`).assign(a,(0,Se._)`[${i}]`)}}}function BZe({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Se._)`${e} !== undefined`,()=>t.assign((0,Se._)`${e}[${r}]`,n))}function oU(t,e,r,n=Ld.Correct){let i=n===Ld.Correct?Se.operators.EQ:Se.operators.NEQ,o;switch(t){case"null":return(0,Se._)`${e} ${i} null`;case"array":o=(0,Se._)`Array.isArray(${e})`;break;case"object":o=(0,Se._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=s((0,Se._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=s();break;default:return(0,Se._)`typeof ${e} ${i} ${t}`}return n===Ld.Correct?o:(0,Se.not)(o);function s(a=Se.nil){return(0,Se.and)((0,Se._)`typeof ${e} == "number"`,a,r?(0,Se._)`isFinite(${e})`:Se.nil)}}_r.checkDataType=oU;function sU(t,e,r,n){if(t.length===1)return oU(t[0],e,r,n);let i,o=(0,Tae.toHash)(t);if(o.array&&o.object){let s=(0,Se._)`typeof ${e} != "object"`;i=o.null?s:(0,Se._)`!${e} || ${s}`,delete o.null,delete o.array,delete o.object}else i=Se.nil;o.number&&delete o.integer;for(let s in o)i=(0,Se.and)(i,oU(s,e,r,n));return i}_r.checkDataTypes=sU;var HZe={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Se._)`{type: ${t}}`:(0,Se._)`{type: ${e}}`};function aU(t){let e=GZe(t);(0,FZe.reportError)(e,HZe)}_r.reportTypeError=aU;function GZe(t){let{gen:e,data:r,schema:n}=t,i=(0,Tae.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var Pae=v(jE=>{"use strict";Object.defineProperty(jE,"__esModule",{value:!0});jE.assignDefaults=void 0;var zd=we(),ZZe=Ne();function VZe(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)Iae(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,o)=>Iae(t,o,i.default))}jE.assignDefaults=VZe;function Iae(t,e,r){let{gen:n,compositeRule:i,data:o,opts:s}=t;if(r===void 0)return;let a=(0,zd._)`${o}${(0,zd.getProperty)(e)}`;if(i){(0,ZZe.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,zd._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,zd._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,zd._)`${a} = ${(0,zd.stringify)(r)}`)}});var Hn=v(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.validateUnion=nt.validateArray=nt.usePattern=nt.callValidateCode=nt.schemaProperties=nt.allSchemaProperties=nt.noPropertyInData=nt.propertyInData=nt.isOwnProperty=nt.hasPropFunc=nt.reportMissingProp=nt.checkMissingProp=nt.checkReportMissingProp=void 0;var ft=we(),cU=Ne(),ta=Ho(),WZe=Ne();function KZe(t,e){let{gen:r,data:n,it:i}=t;r.if(uU(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,ft._)`${e}`},!0),t.error()})}nt.checkReportMissingProp=KZe;function JZe({gen:t,data:e,it:{opts:r}},n,i){return(0,ft.or)(...n.map(o=>(0,ft.and)(uU(t,e,o,r.ownProperties),(0,ft._)`${i} = ${o}`)))}nt.checkMissingProp=JZe;function YZe(t,e){t.setParams({missingProperty:e},!0),t.error()}nt.reportMissingProp=YZe;function Cae(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ft._)`Object.prototype.hasOwnProperty`})}nt.hasPropFunc=Cae;function lU(t,e,r){return(0,ft._)`${Cae(t)}.call(${e}, ${r})`}nt.isOwnProperty=lU;function XZe(t,e,r,n){let i=(0,ft._)`${e}${(0,ft.getProperty)(r)} !== undefined`;return n?(0,ft._)`${i} && ${lU(t,e,r)}`:i}nt.propertyInData=XZe;function uU(t,e,r,n){let i=(0,ft._)`${e}${(0,ft.getProperty)(r)} === undefined`;return n?(0,ft.or)(i,(0,ft.not)(lU(t,e,r))):i}nt.noPropertyInData=uU;function Dae(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}nt.allSchemaProperties=Dae;function QZe(t,e){return Dae(e).filter(r=>!(0,cU.alwaysValidSchema)(t,e[r]))}nt.schemaProperties=QZe;function e9e({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:s},a,c,l){let u=l?(0,ft._)`${t}, ${e}, ${n}${i}`:e,d=[[ta.default.instancePath,(0,ft.strConcat)(ta.default.instancePath,o)],[ta.default.parentData,s.parentData],[ta.default.parentDataProperty,s.parentDataProperty],[ta.default.rootData,ta.default.rootData]];s.opts.dynamicRef&&d.push([ta.default.dynamicAnchors,ta.default.dynamicAnchors]);let f=(0,ft._)`${u}, ${r.object(...d)}`;return c!==ft.nil?(0,ft._)`${a}.call(${c}, ${f})`:(0,ft._)`${a}(${f})`}nt.callValidateCode=e9e;var t9e=(0,ft._)`new RegExp`;function r9e({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,o=i(r,n);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,ft._)`${i.code==="new RegExp"?t9e:(0,WZe.useFunc)(t,i)}(${r}, ${n})`})}nt.usePattern=r9e;function n9e(t){let{gen:e,data:r,keyword:n,it:i}=t,o=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(o,!0),s(()=>e.break()),o;function s(a){let c=e.const("len",(0,ft._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:n,dataProp:l,dataPropType:cU.Type.Num},o),e.if((0,ft.not)(o),a)})}}nt.validateArray=n9e;function i9e(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,cU.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,l)=>{let u=t.subschema({keyword:n,schemaProp:l,compositeRule:!0},a);e.assign(s,(0,ft._)`${s} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,ft.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}nt.validateUnion=i9e});var Mae=v(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.validateKeywordUsage=ro.validSchemaType=ro.funcKeywordCode=ro.macroKeywordCode=void 0;var Rr=we(),Uc=Ho(),o9e=Hn(),s9e=Fg();function a9e(t,e){let{gen:r,keyword:n,schema:i,parentSchema:o,it:s}=t,a=e.macro.call(s.self,i,o,s),c=jae(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:Rr.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}ro.macroKeywordCode=a9e;function c9e(t,e){var r;let{gen:n,keyword:i,schema:o,parentSchema:s,$data:a,it:c}=t;u9e(c,e);let l=!a&&e.compile?e.compile.call(c.self,o,s,c):e.validate,u=jae(n,i,l),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&Nae(t),g(()=>t.error());else{let b=e.async?p():m();e.modifying&&Nae(t),g(()=>l9e(t,b))}}function p(){let b=n.let("ruleErrs",null);return n.try(()=>h((0,Rr._)`await `),_=>n.assign(d,!1).if((0,Rr._)`${_} instanceof ${c.ValidationError}`,()=>n.assign(b,(0,Rr._)`${_}.errors`),()=>n.throw(_))),b}function m(){let b=(0,Rr._)`${u}.errors`;return n.assign(b,null),h(Rr.nil),b}function h(b=e.async?(0,Rr._)`await `:Rr.nil){let _=c.opts.passContext?Uc.default.this:Uc.default.self,S=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Rr._)`${b}${(0,o9e.callValidateCode)(t,u,_,S)}`,e.modifying)}function g(b){var _;n.if((0,Rr.not)((_=e.valid)!==null&&_!==void 0?_:d),b)}}ro.funcKeywordCode=c9e;function Nae(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Rr._)`${n.parentData}[${n.parentDataProperty}]`))}function l9e(t,e){let{gen:r}=t;r.if((0,Rr._)`Array.isArray(${e})`,()=>{r.assign(Uc.default.vErrors,(0,Rr._)`${Uc.default.vErrors} === null ? ${e} : ${Uc.default.vErrors}.concat(${e})`).assign(Uc.default.errors,(0,Rr._)`${Uc.default.vErrors}.length`),(0,s9e.extendErrors)(t)},()=>t.error())}function u9e({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function jae(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Rr.stringify)(r)})}function d9e(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}ro.validSchemaType=d9e;function f9e({schema:t,opts:e,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");let s=i.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[o])){let c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}ro.validateKeywordUsage=f9e});var Lae=v(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.extendSubschemaMode=ra.extendSubschemaData=ra.getSubschema=void 0;var no=we(),Fae=Ne();function p9e(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,no._)`${t.schemaPath}${(0,no.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,no._)`${t.schemaPath}${(0,no.getProperty)(e)}${(0,no.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Fae.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}ra.getSubschema=p9e;function m9e(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:s}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=e,f=a.let("data",(0,no._)`${e.data}${(0,no.getProperty)(r)}`,!0);c(f),t.errorPath=(0,no.str)`${l}${(0,Fae.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,no._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let l=i instanceof no.Name?i:a.let("data",i,!0);c(l),s!==void 0&&(t.propertyName=s)}o&&(t.dataTypes=o);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}ra.extendSubschemaData=m9e;function h9e(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}ra.extendSubschemaMode=h9e});var dU=v((UOt,zae)=>{"use strict";zae.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var s=o[i];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var qae=v((qOt,Uae)=>{"use strict";var na=Uae.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};ME(e,n,i,t,"",t)};na.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};na.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};na.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};na.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function ME(t,e,r,n,i,o,s,a,c,l){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,o,s,a,c,l);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in na.arrayKeywords)for(var f=0;f{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.getSchemaRefs=Kr.resolveUrl=Kr.normalizeId=Kr._getFullPath=Kr.getFullPath=Kr.inlineRef=void 0;var y9e=Ne(),_9e=dU(),b9e=qae(),v9e=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function S9e(t,e=!0){return typeof t=="boolean"?!0:e===!0?!fU(t):e?Bae(t)<=e:!1}Kr.inlineRef=S9e;var w9e=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function fU(t){for(let e in t){if(w9e.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(fU)||typeof r=="object"&&fU(r))return!0}return!1}function Bae(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!v9e.has(r)&&(typeof t[r]=="object"&&(0,y9e.eachItem)(t[r],n=>e+=Bae(n)),e===1/0))return 1/0}return e}function Hae(t,e="",r){r!==!1&&(e=Ud(e));let n=t.parse(e);return Gae(t,n)}Kr.getFullPath=Hae;function Gae(t,e){return t.serialize(e).split("#")[0]+"#"}Kr._getFullPath=Gae;var x9e=/#\/?$/;function Ud(t){return t?t.replace(x9e,""):""}Kr.normalizeId=Ud;function $9e(t,e,r){return r=Ud(r),t.resolve(e,r)}Kr.resolveUrl=$9e;var k9e=/^[a-z_][-a-z0-9._]*$/i;function E9e(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=Ud(t[r]||e),o={"":i},s=Hae(n,i,!1),a={},c=new Set;return b9e(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=s+f,g=o[m];typeof d[r]=="string"&&(g=b.call(this,d[r])),_.call(this,d.$anchor),_.call(this,d.$dynamicAnchor),o[f]=g;function b(S){let x=this.opts.uriResolver.resolve;if(S=Ud(g?x(g,S):S),c.has(S))throw u(S);c.add(S);let w=this.refs[S];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?l(d,w.schema,S):S!==Ud(h)&&(S[0]==="#"?(l(d,a[S],S),a[S]=d):this.refs[S]=h),S}function _(S){if(typeof S=="string"){if(!k9e.test(S))throw new Error(`invalid anchor "${S}"`);b.call(this,`#${S}`)}}}),a;function l(d,f,p){if(f!==void 0&&!_9e(d,f))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Kr.getSchemaRefs=E9e});var Bg=v(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.getData=ia.KeywordCxt=ia.validateFunctionCode=void 0;var Jae=kae(),Zae=Lg(),mU=iU(),FE=Lg(),A9e=Pae(),qg=Mae(),pU=Lae(),oe=we(),pe=Ho(),T9e=zg(),Go=Ne(),Ug=Fg();function O9e(t){if(Qae(t)&&(ece(t),Xae(t))){P9e(t);return}Yae(t,()=>(0,Jae.topBoolOrEmptySchema)(t))}ia.validateFunctionCode=O9e;function Yae({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},o){i.code.es5?t.func(e,(0,oe._)`${pe.default.data}, ${pe.default.valCxt}`,n.$async,()=>{t.code((0,oe._)`"use strict"; ${Vae(r,i)}`),I9e(t,i),t.code(o)}):t.func(e,(0,oe._)`${pe.default.data}, ${R9e(i)}`,n.$async,()=>t.code(Vae(r,i)).code(o))}function R9e(t){return(0,oe._)`{${pe.default.instancePath}="", ${pe.default.parentData}, ${pe.default.parentDataProperty}, ${pe.default.rootData}=${pe.default.data}${t.dynamicRef?(0,oe._)`, ${pe.default.dynamicAnchors}={}`:oe.nil}}={}`}function I9e(t,e){t.if(pe.default.valCxt,()=>{t.var(pe.default.instancePath,(0,oe._)`${pe.default.valCxt}.${pe.default.instancePath}`),t.var(pe.default.parentData,(0,oe._)`${pe.default.valCxt}.${pe.default.parentData}`),t.var(pe.default.parentDataProperty,(0,oe._)`${pe.default.valCxt}.${pe.default.parentDataProperty}`),t.var(pe.default.rootData,(0,oe._)`${pe.default.valCxt}.${pe.default.rootData}`),e.dynamicRef&&t.var(pe.default.dynamicAnchors,(0,oe._)`${pe.default.valCxt}.${pe.default.dynamicAnchors}`)},()=>{t.var(pe.default.instancePath,(0,oe._)`""`),t.var(pe.default.parentData,(0,oe._)`undefined`),t.var(pe.default.parentDataProperty,(0,oe._)`undefined`),t.var(pe.default.rootData,pe.default.data),e.dynamicRef&&t.var(pe.default.dynamicAnchors,(0,oe._)`{}`)})}function P9e(t){let{schema:e,opts:r,gen:n}=t;Yae(t,()=>{r.$comment&&e.$comment&&rce(t),M9e(t),n.let(pe.default.vErrors,null),n.let(pe.default.errors,0),r.unevaluated&&C9e(t),tce(t),z9e(t)})}function C9e(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,oe._)`${r}.evaluated`),e.if((0,oe._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,oe._)`${t.evaluated}.props`,(0,oe._)`undefined`)),e.if((0,oe._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,oe._)`${t.evaluated}.items`,(0,oe._)`undefined`))}function Vae(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,oe._)`/*# sourceURL=${r} */`:oe.nil}function D9e(t,e){if(Qae(t)&&(ece(t),Xae(t))){N9e(t,e);return}(0,Jae.boolOrEmptySchema)(t,e)}function Xae({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function Qae(t){return typeof t.schema!="boolean"}function N9e(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&rce(t),F9e(t),L9e(t);let o=n.const("_errs",pe.default.errors);tce(t,o),n.var(e,(0,oe._)`${o} === ${pe.default.errors}`)}function ece(t){(0,Go.checkUnknownRules)(t),j9e(t)}function tce(t,e){if(t.opts.jtd)return Wae(t,[],!1,e);let r=(0,Zae.getSchemaTypes)(t.schema),n=(0,Zae.coerceAndCheckDataType)(t,r);Wae(t,r,!n,e)}function j9e(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Go.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function M9e(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Go.checkStrictMode)(t,"default is ignored in the schema root")}function F9e(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,T9e.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function L9e(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function rce({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let o=r.$comment;if(i.$comment===!0)t.code((0,oe._)`${pe.default.self}.logger.log(${o})`);else if(typeof i.$comment=="function"){let s=(0,oe.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,oe._)`${pe.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function z9e(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=t;r.$async?e.if((0,oe._)`${pe.default.errors} === 0`,()=>e.return(pe.default.data),()=>e.throw((0,oe._)`new ${i}(${pe.default.vErrors})`)):(e.assign((0,oe._)`${n}.errors`,pe.default.vErrors),o.unevaluated&&U9e(t),e.return((0,oe._)`${pe.default.errors} === 0`))}function U9e({gen:t,evaluated:e,props:r,items:n}){r instanceof oe.Name&&t.assign((0,oe._)`${e}.props`,r),n instanceof oe.Name&&t.assign((0,oe._)`${e}.items`,n)}function Wae(t,e,r,n){let{gen:i,schema:o,data:s,allErrors:a,opts:c,self:l}=t,{RULES:u}=l;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Go.schemaHasRulesButRef)(o,u))){i.block(()=>ice(t,"$ref",u.all.$ref.definition));return}c.jtd||q9e(t,e),i.block(()=>{for(let f of u.rules)d(f);d(u.post)});function d(f){(0,mU.shouldUseGroup)(o,f)&&(f.type?(i.if((0,FE.checkDataType)(f.type,s,c.strictNumbers)),Kae(t,f),e.length===1&&e[0]===f.type&&r&&(i.else(),(0,FE.reportTypeError)(t)),i.endIf()):Kae(t,f),a||i.if((0,oe._)`${pe.default.errors} === ${n||0}`))}}function Kae(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,A9e.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,mU.shouldUseRule)(n,o)&&ice(t,o.keyword,o.definition,e.type)})}function q9e(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(B9e(t,e),t.opts.allowUnionTypes||H9e(t,e),G9e(t,t.dataTypes))}function B9e(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{nce(t.dataTypes,r)||hU(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),V9e(t,e)}}function H9e(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&hU(t,"use allowUnionTypes to allow union type keyword")}function G9e(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,mU.shouldUseRule)(t.schema,i)){let{type:o}=i.definition;o.length&&!o.some(s=>Z9e(e,s))&&hU(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function Z9e(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function nce(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function V9e(t,e){let r=[];for(let n of t.dataTypes)nce(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function hU(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Go.checkStrictMode)(t,e,t.opts.strictTypes)}var LE=class{constructor(e,r,n){if((0,qg.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Go.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",oce(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,qg.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",pe.default.errors))}result(e,r,n){this.failResult((0,oe.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,oe.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,oe._)`${r} !== undefined && (${(0,oe.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Ug.reportExtraError:Ug.reportError)(this,this.def.error,r)}$dataError(){(0,Ug.reportError)(this,this.def.$dataError||Ug.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ug.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=oe.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=oe.nil,r=oe.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:o,def:s}=this;n.if((0,oe.or)((0,oe._)`${i} === undefined`,r)),e!==oe.nil&&n.assign(e,!0),(o.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==oe.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:o}=this;return(0,oe.or)(s(),a());function s(){if(n.length){if(!(r instanceof oe.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,oe._)`${(0,FE.checkDataTypes)(c,r,o.opts.strictNumbers,FE.DataType.Wrong)}`}return oe.nil}function a(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,oe._)`!${c}(${r})`}return oe.nil}}subschema(e,r){let n=(0,pU.getSubschema)(this.it,e);(0,pU.extendSubschemaData)(n,this.it,e),(0,pU.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return D9e(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Go.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Go.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,oe.Name)),!0}};ia.KeywordCxt=LE;function ice(t,e,r,n){let i=new LE(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,qg.funcKeywordCode)(i,r):"macro"in r?(0,qg.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,qg.funcKeywordCode)(i,r)}var W9e=/^\/(?:[^~]|~0|~1)*$/,K9e=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function oce(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,o;if(t==="")return pe.default.rootData;if(t[0]==="/"){if(!W9e.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,o=pe.default.rootData}else{let l=K9e.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+l[1];if(i=l[2],i==="#"){if(u>=e)throw new Error(c("property/index",u));return n[e-u]}if(u>e)throw new Error(c("data",u));if(o=r[e-u],!i)return o}let s=o,a=i.split("/");for(let l of a)l&&(o=(0,oe._)`${o}${(0,oe.getProperty)((0,Go.unescapeJsonPointer)(l))}`,s=(0,oe._)`${s} && ${o}`);return s;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}ia.getData=oce});var zE=v(yU=>{"use strict";Object.defineProperty(yU,"__esModule",{value:!0});var gU=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};yU.default=gU});var Hg=v(vU=>{"use strict";Object.defineProperty(vU,"__esModule",{value:!0});var _U=zg(),bU=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,_U.resolveUrl)(e,r,n),this.missingSchema=(0,_U.normalizeId)((0,_U.getFullPath)(e,this.missingRef))}};vU.default=bU});var qE=v(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.resolveSchema=Gn.getCompilingSchema=Gn.resolveRef=Gn.compileSchema=Gn.SchemaEnv=void 0;var _i=we(),J9e=zE(),qc=Ho(),bi=zg(),sce=Ne(),Y9e=Bg(),qd=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,bi.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Gn.SchemaEnv=qd;function wU(t){let e=ace.call(this,t);if(e)return e;let r=(0,bi.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:o}=this.opts,s=new _i.CodeGen(this.scope,{es5:n,lines:i,ownProperties:o}),a;t.$async&&(a=s.scopeValue("Error",{ref:J9e.default,code:(0,_i._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");t.validateName=c;let l={gen:s,allErrors:this.opts.allErrors,data:qc.default.data,parentData:qc.default.parentData,parentDataProperty:qc.default.parentDataProperty,dataNames:[qc.default.data],dataPathArr:[_i.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,_i.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:_i.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,_i._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,Y9e.validateFunctionCode)(l),s.optimize(this.opts.code.optimize);let d=s.toString();u=`${s.scopeRefs(qc.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${qc.default.self}`,`${qc.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=l;p.evaluated={props:m instanceof _i.Name?void 0:m,items:h instanceof _i.Name?void 0:h,dynamicProps:m instanceof _i.Name,dynamicItems:h instanceof _i.Name},p.source&&(p.source.evaluated=(0,_i.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}Gn.compileSchema=wU;function X9e(t,e,r){var n;r=(0,bi.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let o=tVe.call(this,t,r);if(o===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(o=new qd({schema:s,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=Q9e.call(this,o)}Gn.resolveRef=X9e;function Q9e(t){return(0,bi.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:wU.call(this,t)}function ace(t){for(let e of this._compilations)if(eVe(e,t))return e}Gn.getCompilingSchema=ace;function eVe(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function tVe(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||UE.call(this,t,e)}function UE(t,e){let r=this.opts.uriResolver.parse(e),n=(0,bi._getFullPath)(this.opts.uriResolver,r),i=(0,bi.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return SU.call(this,r,t);let o=(0,bi.normalizeId)(n),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=UE.call(this,t,s);return typeof a?.schema!="object"?void 0:SU.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||wU.call(this,s),o===(0,bi.normalizeId)(e)){let{schema:a}=s,{schemaId:c}=this.opts,l=a[c];return l&&(i=(0,bi.resolveUrl)(this.opts.uriResolver,i,l)),new qd({schema:a,schemaId:c,root:t,baseId:i})}return SU.call(this,r,s)}}Gn.resolveSchema=UE;var rVe=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function SU(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,sce.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!rVe.has(a)&&l&&(e=(0,bi.resolveUrl)(this.opts.uriResolver,e,l))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,sce.schemaHasRulesButRef)(r,this.RULES)){let a=(0,bi.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=UE.call(this,n,a)}let{schemaId:s}=this.opts;if(o=o||new qd({schema:r,schemaId:s,root:n,baseId:e}),o.schema!==o.root.schema)return o}});var cce=v((WOt,nVe)=>{nVe.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var kU=v((KOt,mce)=>{"use strict";var iVe=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),uce=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),xU=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),dce=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),oVe=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function $U(t){let e="",r=0,n=0;for(n=0;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var sVe=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function lce(t){return t.length=0,!0}function aVe(t,e,r){if(t.length){let n=$U(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function cVe(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],o=!1,s=!1,a=aVe;for(let c=0;c7){r.error=!0;break}c>0&&t[c-1]===":"&&(o=!0),n.push(":");continue}else if(l==="%"){if(!a(i,n,r))break;a=lce}else{i.push(l);continue}}return i.length&&(a===lce?r.zone=i.join(""):s?n.push(i.join("")):n.push($U(i))),r.address=n.join(""),r}function fce(t){if(lVe(t,":")<2)return{host:t,isIPV6:!1};let e=cVe(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function lVe(t,e){let r=0;for(let n=0;ndVe[n])}function mVe(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let n=0;n{"use strict";var{isUUID:_Ve}=kU(),bVe=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,vVe=["http","https","ws","wss","urn","urn:uuid"];function SVe(t){return vVe.indexOf(t)!==-1}function EU(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function hce(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function gce(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function wVe(t){return t.secure=EU(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function xVe(t){if((t.port===(EU(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function $Ve(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(bVe);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,o=AU(i);t.path=void 0,o&&(t=o.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function kVe(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,o=AU(i);o&&(t=o.serialize(t,e));let s=t,a=t.nss;return s.path=`${n||e.nid}:${a}`,e.skipEscape=!0,s}function EVe(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!_Ve(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function AVe(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var yce={scheme:"http",domainHost:!0,parse:hce,serialize:gce},TVe={scheme:"https",domainHost:yce.domainHost,parse:hce,serialize:gce},BE={scheme:"ws",domainHost:!0,parse:wVe,serialize:xVe},OVe={scheme:"wss",domainHost:BE.domainHost,parse:BE.parse,serialize:BE.serialize},RVe={scheme:"urn",parse:$Ve,serialize:kVe,skipNormalize:!0},IVe={scheme:"urn:uuid",parse:EVe,serialize:AVe,skipNormalize:!0},HE={http:yce,https:TVe,ws:BE,wss:OVe,urn:RVe,"urn:uuid":IVe};Object.setPrototypeOf(HE,null);function AU(t){return t&&(HE[t]||HE[t.toLowerCase()])||void 0}_ce.exports={wsIsSecure:EU,SCHEMES:HE,isValidSchemeName:SVe,getSchemeHandler:AU}});var kce=v((YOt,GE)=>{"use strict";var{normalizeIPv6:PVe,removeDotSegments:Gg,recomposeAuthority:CVe,normalizePercentEncoding:DVe,normalizePathEncoding:NVe,escapePreservingEscapes:jVe,reescapeHostDelimiters:MVe,isIPv4:FVe,nonSimpleDomain:LVe}=kU(),{SCHEMES:zVe,getSchemeHandler:Sce}=bce();function UVe(t,e){return typeof t=="string"?t=ZVe(t,e):typeof t=="object"&&(t=Bd(Bc(t,e),e)),t}function qVe(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=wce(Bd(t,n),Bd(e,n),n,!0);return n.skipEscape=!0,Bc(i,n)}function wce(t,e,r,n){let i={};return n||(t=Bd(Bc(t,r),r),e=Bd(Bc(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Gg(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=Gg(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=Gg(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=Gg(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function BVe(t,e,r){let n=vce(t,r),i=vce(e,r);return n!==void 0&&i!==void 0&&n.toLowerCase()===i.toLowerCase()}function Bc(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],o=Sce(n.scheme||r.scheme);o&&o.serialize&&o.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=DVe(r.path):(r.path=jVe(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let s=CVe(r);if(s!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(s),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(a=Gg(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),i.push(a)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var HVe=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function GVe(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function xce(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let s=t.match(HVe);if(s){n.scheme=s[1],n.userinfo=s[3],n.host=s[4],n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=s[7],n.fragment=s[8],isNaN(n.port)&&(n.port=s[5]);let a=GVe(n,s);if(a!==void 0&&(n.error=n.error||a,i=!0),n.host)if(FVe(n.host)===!1){let u=PVe(n.host);n.host=u.host.toLowerCase(),o=u.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let c=Sce(r.scheme||n.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&n.host&&(r.domainHost||c&&c.domainHost)&&o===!1&&LVe(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(l){n.error=n.error||"Host's domain name can not be converted to ASCII: "+l}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=MVe(unescape(n.host),o))),n.path&&(n.path=NVe(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}c&&c.parse&&c.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:i}}function Bd(t,e){return xce(t,e).parsed}function ZVe(t,e){return $ce(t,e).normalized}function $ce(t,e){let{parsed:r,malformedAuthorityOrPort:n}=xce(t,e);return{normalized:n?t:Bc(r,e),malformedAuthorityOrPort:n}}function vce(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:n}=$ce(t,e);return n?void 0:r}if(typeof t=="object")return Bc(t,e)}var TU={SCHEMES:zVe,normalize:UVe,resolve:qVe,resolveComponent:wce,equal:BVe,serialize:Bc,parse:Bd};GE.exports=TU;GE.exports.default=TU;GE.exports.fastUri=TU});var Ace=v(OU=>{"use strict";Object.defineProperty(OU,"__esModule",{value:!0});var Ece=kce();Ece.code='require("ajv/dist/runtime/uri").default';OU.default=Ece});var Nce=v(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.CodeGen=lr.Name=lr.nil=lr.stringify=lr.str=lr._=lr.KeywordCxt=void 0;var VVe=Bg();Object.defineProperty(lr,"KeywordCxt",{enumerable:!0,get:function(){return VVe.KeywordCxt}});var Hd=we();Object.defineProperty(lr,"_",{enumerable:!0,get:function(){return Hd._}});Object.defineProperty(lr,"str",{enumerable:!0,get:function(){return Hd.str}});Object.defineProperty(lr,"stringify",{enumerable:!0,get:function(){return Hd.stringify}});Object.defineProperty(lr,"nil",{enumerable:!0,get:function(){return Hd.nil}});Object.defineProperty(lr,"Name",{enumerable:!0,get:function(){return Hd.Name}});Object.defineProperty(lr,"CodeGen",{enumerable:!0,get:function(){return Hd.CodeGen}});var WVe=zE(),Pce=Hg(),KVe=nU(),Zg=qE(),JVe=we(),Vg=zg(),ZE=Lg(),IU=Ne(),Tce=cce(),YVe=Ace(),Cce=(t,e)=>new RegExp(t,e);Cce.code="new RegExp";var XVe=["removeAdditional","useDefaults","coerceTypes"],QVe=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),eWe={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},tWe={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Oce=200;function rWe(t){var e,r,n,i,o,s,a,c,l,u,d,f,p,m,h,g,b,_,S,x,w,O,T,A,D;let $=t.strict,ie=(e=t.code)===null||e===void 0?void 0:e.optimize,K=ie===!0||ie===void 0?1:ie||0,xe=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Cce,C=(i=t.uriResolver)!==null&&i!==void 0?i:YVe.default;return{strictSchema:(s=(o=t.strictSchema)!==null&&o!==void 0?o:$)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:$)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:$)!==null&&u!==void 0?u:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:$)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:$)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:K,regExp:xe}:{optimize:K,regExp:xe},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:Oce,loopEnum:(g=t.loopEnum)!==null&&g!==void 0?g:Oce,meta:(b=t.meta)!==null&&b!==void 0?b:!0,messages:(_=t.messages)!==null&&_!==void 0?_:!0,inlineRefs:(S=t.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(x=t.schemaId)!==null&&x!==void 0?x:"$id",addUsedSchema:(w=t.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(O=t.validateSchema)!==null&&O!==void 0?O:!0,validateFormats:(T=t.validateFormats)!==null&&T!==void 0?T:!0,unicodeRegExp:(A=t.unicodeRegExp)!==null&&A!==void 0?A:!0,int32range:(D=t.int32range)!==null&&D!==void 0?D:!0,uriResolver:C}}var Wg=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...rWe(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new JVe.ValueScope({scope:{},prefixes:QVe,es5:r,lines:n}),this.logger=cWe(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,KVe.getRules)(),Rce.call(this,eWe,e,"NOT SUPPORTED"),Rce.call(this,tWe,e,"DEPRECATED","warn"),this._metaOpts=sWe.call(this),e.formats&&iWe.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&oWe.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),nWe.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=Tce;n==="id"&&(i={...Tce},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(u,d){await o.call(this,u.$schema);let f=this._addSchema(u,d);return f.validate||s.call(this,f)}async function o(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof Pce.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await o.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,i);return this}let o;if(typeof e=="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,Vg.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return i}getSchema(e){let r;for(;typeof(r=Ice.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new Zg.SchemaEnv({schema:{},schemaId:n});if(r=Zg.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Ice.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Vg.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(uWe.call(this,n,r),!r)return(0,IU.eachItem)(n,o=>RU.call(this,o)),this;fWe.call(this,r);let i={...r,type:(0,ZE.getJSONTypes)(r.type),schemaType:(0,ZE.getJSONTypes)(r.schemaType)};return(0,IU.eachItem)(n,i.type.length===0?o=>RU.call(this,o,i):o=>i.type.forEach(s=>RU.call(this,o,i,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(o=>o.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,o)=>i+r+o)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let o=i.split("/").slice(1),s=e;for(let a of o)s=s[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=s[a];l&&u&&(s[a]=Dce(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Vg.normalizeId)(s||n);let l=Vg.getSchemaRefs.call(this,e,n);return c=new Zg.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:l}),this._cache.set(c.schema,c),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Zg.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Zg.compileSchema.call(this,e)}finally{this.opts=r}}};Wg.ValidationError=WVe.default;Wg.MissingRefError=Pce.default;lr.default=Wg;function Rce(t,e,r,n="error"){for(let i in t){let o=i;o in e&&this.logger[n](`${r}: option ${i}. ${t[o]}`)}}function Ice(t){return t=(0,Vg.normalizeId)(t),this.schemas[t]||this.refs[t]}function nWe(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function iWe(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function oWe(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function sWe(){let t={...this.opts};for(let e of XVe)delete t[e];return t}var aWe={log(){},warn(){},error(){}};function cWe(t){if(t===!1)return aWe;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var lWe=/^[a-z_$][a-z0-9_$:-]*$/i;function uWe(t,e){let{RULES:r}=this;if((0,IU.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!lWe.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function RU(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=i?o.post:o.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,ZE.getJSONTypes)(e.type),schemaType:(0,ZE.getJSONTypes)(e.schemaType)}};e.before?dWe.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function dWe(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function fWe(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Dce(e)),t.validateSchema=this.compile(e,!0))}var pWe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Dce(t){return{anyOf:[t,pWe]}}});var jce=v(PU=>{"use strict";Object.defineProperty(PU,"__esModule",{value:!0});var mWe={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};PU.default=mWe});var zce=v(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.callRef=Hc.getValidate=void 0;var hWe=Hg(),Mce=Hn(),Jr=we(),Gd=Ho(),Fce=qE(),VE=Ne(),gWe={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:o,validateName:s,opts:a,self:c}=n,{root:l}=o;if((r==="#"||r==="#/")&&i===l.baseId)return d();let u=Fce.resolveRef.call(c,l,i,r);if(u===void 0)throw new hWe.default(n.opts.uriResolver,i,r);if(u instanceof Fce.SchemaEnv)return f(u);return p(u);function d(){if(o===l)return WE(t,s,o,o.$async);let m=e.scopeValue("root",{ref:l});return WE(t,(0,Jr._)`${m}.validate`,l,l.$async)}function f(m){let h=Lce(t,m);WE(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Jr.stringify)(m)}:{ref:m}),g=e.name("valid"),b=t.subschema({schema:m,dataTypes:[],schemaPath:Jr.nil,topSchemaRef:h,errSchemaPath:r},g);t.mergeEvaluated(b),t.ok(g)}}};function Lce(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Jr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Hc.getValidate=Lce;function WE(t,e,r,n){let{gen:i,it:o}=t,{allErrors:s,schemaEnv:a,opts:c}=o,l=c.passContext?Gd.default.this:Jr.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=i.let("valid");i.try(()=>{i.code((0,Jr._)`await ${(0,Mce.callValidateCode)(t,e,l)}`),p(e),s||i.assign(m,!0)},h=>{i.if((0,Jr._)`!(${h} instanceof ${o.ValidationError})`,()=>i.throw(h)),f(h),s||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,Mce.callValidateCode)(t,e,l),()=>p(e),()=>f(e))}function f(m){let h=(0,Jr._)`${m}.errors`;i.assign(Gd.default.vErrors,(0,Jr._)`${Gd.default.vErrors} === null ? ${h} : ${Gd.default.vErrors}.concat(${h})`),i.assign(Gd.default.errors,(0,Jr._)`${Gd.default.vErrors}.length`)}function p(m){var h;if(!o.opts.unevaluated)return;let g=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(o.props=VE.mergeEvaluated.props(i,g.props,o.props));else{let b=i.var("props",(0,Jr._)`${m}.evaluated.props`);o.props=VE.mergeEvaluated.props(i,b,o.props,Jr.Name)}if(o.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(o.items=VE.mergeEvaluated.items(i,g.items,o.items));else{let b=i.var("items",(0,Jr._)`${m}.evaluated.items`);o.items=VE.mergeEvaluated.items(i,b,o.items,Jr.Name)}}}Hc.callRef=WE;Hc.default=gWe});var Uce=v(CU=>{"use strict";Object.defineProperty(CU,"__esModule",{value:!0});var yWe=jce(),_We=zce(),bWe=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",yWe.default,_We.default];CU.default=bWe});var qce=v(DU=>{"use strict";Object.defineProperty(DU,"__esModule",{value:!0});var KE=we(),oa=KE.operators,JE={maximum:{okStr:"<=",ok:oa.LTE,fail:oa.GT},minimum:{okStr:">=",ok:oa.GTE,fail:oa.LT},exclusiveMaximum:{okStr:"<",ok:oa.LT,fail:oa.GTE},exclusiveMinimum:{okStr:">",ok:oa.GT,fail:oa.LTE}},vWe={message:({keyword:t,schemaCode:e})=>(0,KE.str)`must be ${JE[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,KE._)`{comparison: ${JE[t].okStr}, limit: ${e}}`},SWe={keyword:Object.keys(JE),type:"number",schemaType:"number",$data:!0,error:vWe,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,KE._)`${r} ${JE[e].fail} ${n} || isNaN(${r})`)}};DU.default=SWe});var Bce=v(NU=>{"use strict";Object.defineProperty(NU,"__esModule",{value:!0});var Kg=we(),wWe={message:({schemaCode:t})=>(0,Kg.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Kg._)`{multipleOf: ${t}}`},xWe={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:wWe,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,o=i.opts.multipleOfPrecision,s=e.let("res"),a=o?(0,Kg._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,Kg._)`${s} !== parseInt(${s})`;t.fail$data((0,Kg._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};NU.default=xWe});var Gce=v(jU=>{"use strict";Object.defineProperty(jU,"__esModule",{value:!0});function Hce(t){let e=t.length,r=0,n=0,i;for(;n=55296&&i<=56319&&n{"use strict";Object.defineProperty(MU,"__esModule",{value:!0});var Gc=we(),$We=Ne(),kWe=Gce(),EWe={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Gc.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Gc._)`{limit: ${t}}`},AWe={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:EWe,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,o=e==="maxLength"?Gc.operators.GT:Gc.operators.LT,s=i.opts.unicode===!1?(0,Gc._)`${r}.length`:(0,Gc._)`${(0,$We.useFunc)(t.gen,kWe.default)}(${r})`;t.fail$data((0,Gc._)`${s} ${o} ${n}`)}};MU.default=AWe});var Vce=v(FU=>{"use strict";Object.defineProperty(FU,"__esModule",{value:!0});var TWe=Hn(),OWe=Ne(),Zd=we(),RWe={message:({schemaCode:t})=>(0,Zd.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Zd._)`{pattern: ${t}}`},IWe={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:RWe,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:o,it:s}=t,a=s.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=s.opts.code,l=c.code==="new RegExp"?(0,Zd._)`new RegExp`:(0,OWe.useFunc)(e,c),u=e.let("valid");e.try(()=>e.assign(u,(0,Zd._)`${l}(${o}, ${a}).test(${r})`),()=>e.assign(u,!1)),t.fail$data((0,Zd._)`!${u}`)}else{let c=(0,TWe.usePattern)(t,i);t.fail$data((0,Zd._)`!${c}.test(${r})`)}}};FU.default=IWe});var Wce=v(LU=>{"use strict";Object.defineProperty(LU,"__esModule",{value:!0});var Jg=we(),PWe={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Jg.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Jg._)`{limit: ${t}}`},CWe={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:PWe,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?Jg.operators.GT:Jg.operators.LT;t.fail$data((0,Jg._)`Object.keys(${r}).length ${i} ${n}`)}};LU.default=CWe});var Kce=v(zU=>{"use strict";Object.defineProperty(zU,"__esModule",{value:!0});var Yg=Hn(),Xg=we(),DWe=Ne(),NWe={message:({params:{missingProperty:t}})=>(0,Xg.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Xg._)`{missingProperty: ${t}}`},jWe={keyword:"required",type:"object",schemaType:"array",$data:!0,error:NWe,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:o,it:s}=t,{opts:a}=s;if(!o&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?l():u(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let g=s.schemaEnv.baseId+s.errSchemaPath,b=`required property "${h}" is not defined at "${g}" (strictRequired)`;(0,DWe.checkStrictMode)(s,b,s.opts.strictRequired)}}function l(){if(c||o)t.block$data(Xg.nil,d);else for(let p of r)(0,Yg.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(c||o){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,Yg.checkMissingProp)(t,r,p)),(0,Yg.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Yg.noPropertyInData)(e,i,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,Yg.propertyInData)(e,i,p,a.ownProperties)),e.if((0,Xg.not)(m),()=>{t.error(),e.break()})},Xg.nil)}}};zU.default=jWe});var Jce=v(UU=>{"use strict";Object.defineProperty(UU,"__esModule",{value:!0});var Qg=we(),MWe={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Qg.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Qg._)`{limit: ${t}}`},FWe={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:MWe,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Qg.operators.GT:Qg.operators.LT;t.fail$data((0,Qg._)`${r}.length ${i} ${n}`)}};UU.default=FWe});var YE=v(qU=>{"use strict";Object.defineProperty(qU,"__esModule",{value:!0});var Yce=dU();Yce.code='require("ajv/dist/runtime/equal").default';qU.default=Yce});var Xce=v(HU=>{"use strict";Object.defineProperty(HU,"__esModule",{value:!0});var BU=Lg(),ur=we(),LWe=Ne(),zWe=YE(),UWe={message:({params:{i:t,j:e}})=>(0,ur.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,ur._)`{i: ${t}, j: ${e}}`},qWe={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:UWe,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:o,schemaCode:s,it:a}=t;if(!n&&!i)return;let c=e.let("valid"),l=o.items?(0,BU.getSchemaTypes)(o.items):[];t.block$data(c,u,(0,ur._)`${s} === false`),t.ok(c);function u(){let m=e.let("i",(0,ur._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,ur._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function f(m,h){let g=e.name("item"),b=(0,BU.checkDataTypes)(l,g,a.opts.strictNumbers,BU.DataType.Wrong),_=e.const("indices",(0,ur._)`{}`);e.for((0,ur._)`;${m}--;`,()=>{e.let(g,(0,ur._)`${r}[${m}]`),e.if(b,(0,ur._)`continue`),l.length>1&&e.if((0,ur._)`typeof ${g} == "string"`,(0,ur._)`${g} += "_"`),e.if((0,ur._)`typeof ${_}[${g}] == "number"`,()=>{e.assign(h,(0,ur._)`${_}[${g}]`),t.error(),e.assign(c,!1).break()}).code((0,ur._)`${_}[${g}] = ${m}`)})}function p(m,h){let g=(0,LWe.useFunc)(e,zWe.default),b=e.name("outer");e.label(b).for((0,ur._)`;${m}--;`,()=>e.for((0,ur._)`${h} = ${m}; ${h}--;`,()=>e.if((0,ur._)`${g}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(b)})))}}};HU.default=qWe});var Qce=v(ZU=>{"use strict";Object.defineProperty(ZU,"__esModule",{value:!0});var GU=we(),BWe=Ne(),HWe=YE(),GWe={message:"must be equal to constant",params:({schemaCode:t})=>(0,GU._)`{allowedValue: ${t}}`},ZWe={keyword:"const",$data:!0,error:GWe,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:o}=t;n||o&&typeof o=="object"?t.fail$data((0,GU._)`!${(0,BWe.useFunc)(e,HWe.default)}(${r}, ${i})`):t.fail((0,GU._)`${o} !== ${r}`)}};ZU.default=ZWe});var ele=v(VU=>{"use strict";Object.defineProperty(VU,"__esModule",{value:!0});var ey=we(),VWe=Ne(),WWe=YE(),KWe={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,ey._)`{allowedValues: ${t}}`},JWe={keyword:"enum",schemaType:"array",$data:!0,error:KWe,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:o,it:s}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=s.opts.loopEnum,c,l=()=>c??(c=(0,VWe.useFunc)(e,WWe.default)),u;if(a||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=e.const("vSchema",o);u=(0,ey.or)(...i.map((m,h)=>f(p,h)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",o,p=>e.if((0,ey._)`${l()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function f(p,m){let h=i[m];return typeof h=="object"&&h!==null?(0,ey._)`${l()}(${r}, ${p}[${m}])`:(0,ey._)`${r} === ${h}`}}};VU.default=JWe});var tle=v(WU=>{"use strict";Object.defineProperty(WU,"__esModule",{value:!0});var YWe=qce(),XWe=Bce(),QWe=Zce(),e3e=Vce(),t3e=Wce(),r3e=Kce(),n3e=Jce(),i3e=Xce(),o3e=Qce(),s3e=ele(),a3e=[YWe.default,XWe.default,QWe.default,e3e.default,t3e.default,r3e.default,n3e.default,i3e.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},o3e.default,s3e.default];WU.default=a3e});var JU=v(ty=>{"use strict";Object.defineProperty(ty,"__esModule",{value:!0});ty.validateAdditionalItems=void 0;var Zc=we(),KU=Ne(),c3e={message:({params:{len:t}})=>(0,Zc.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Zc._)`{limit: ${t}}`},l3e={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:c3e,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,KU.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}rle(t,n)}};function rle(t,e){let{gen:r,schema:n,data:i,keyword:o,it:s}=t;s.items=!0;let a=r.const("len",(0,Zc._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Zc._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,KU.alwaysValidSchema)(s,n)){let l=r.var("valid",(0,Zc._)`${a} <= ${e.length}`);r.if((0,Zc.not)(l),()=>c(l)),t.ok(l)}function c(l){r.forRange("i",e.length,a,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:KU.Type.Num},l),s.allErrors||r.if((0,Zc.not)(l),()=>r.break())})}}ty.validateAdditionalItems=rle;ty.default=l3e});var YU=v(ry=>{"use strict";Object.defineProperty(ry,"__esModule",{value:!0});ry.validateTuple=void 0;var nle=we(),XE=Ne(),u3e=Hn(),d3e={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return ile(t,"additionalItems",e);r.items=!0,!(0,XE.alwaysValidSchema)(r,e)&&t.ok((0,u3e.validateArray)(t))}};function ile(t,e,r=t.schema){let{gen:n,parentSchema:i,data:o,keyword:s,it:a}=t;u(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=XE.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),l=n.const("len",(0,nle._)`${o}.length`);r.forEach((d,f)=>{(0,XE.alwaysValidSchema)(a,d)||(n.if((0,nle._)`${l} > ${f}`,()=>t.subschema({keyword:s,schemaProp:f,dataProp:f},c)),t.ok(c))});function u(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let g=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,XE.checkStrictMode)(a,g,f.strictTuples)}}}ry.validateTuple=ile;ry.default=d3e});var ole=v(XU=>{"use strict";Object.defineProperty(XU,"__esModule",{value:!0});var f3e=YU(),p3e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,f3e.validateTuple)(t,"items")};XU.default=p3e});var ale=v(QU=>{"use strict";Object.defineProperty(QU,"__esModule",{value:!0});var sle=we(),m3e=Ne(),h3e=Hn(),g3e=JU(),y3e={message:({params:{len:t}})=>(0,sle.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,sle._)`{limit: ${t}}`},_3e={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:y3e,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,m3e.alwaysValidSchema)(n,e)&&(i?(0,g3e.validateAdditionalItems)(t,i):t.ok((0,h3e.validateArray)(t)))}};QU.default=_3e});var cle=v(eq=>{"use strict";Object.defineProperty(eq,"__esModule",{value:!0});var Zn=we(),QE=Ne(),b3e={message:({params:{min:t,max:e}})=>e===void 0?(0,Zn.str)`must contain at least ${t} valid item(s)`:(0,Zn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Zn._)`{minContains: ${t}}`:(0,Zn._)`{minContains: ${t}, maxContains: ${e}}`},v3e={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:b3e,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t,s,a,{minContains:c,maxContains:l}=n;o.opts.next?(s=c===void 0?1:c,a=l):s=1;let u=e.const("len",(0,Zn._)`${i}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,QE.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,QE.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,QE.alwaysValidSchema)(o,r)){let h=(0,Zn._)`${u} >= ${s}`;a!==void 0&&(h=(0,Zn._)`${h} && ${u} <= ${a}`),t.pass(h);return}o.items=!0;let d=e.name("valid");a===void 0&&s===1?p(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,Zn._)`${i}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),g=e.let("count",0);p(h,()=>e.if(h,()=>m(g)))}function p(h,g){e.forRange("i",0,u,b=>{t.subschema({keyword:"contains",dataProp:b,dataPropType:QE.Type.Num,compositeRule:!0},h),g()})}function m(h){e.code((0,Zn._)`${h}++`),a===void 0?e.if((0,Zn._)`${h} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,Zn._)`${h} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,Zn._)`${h} >= ${s}`,()=>e.assign(d,!0)))}}};eq.default=v3e});var dle=v(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.validateSchemaDeps=io.validatePropertyDeps=io.error=void 0;var tq=we(),S3e=Ne(),ny=Hn();io.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,tq.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,tq._)`{property: ${t}, missingProperty: ${n}, depsCount: ${e}, - deps: ${r}}`};var w3e={keyword:"dependencies",type:"object",schemaType:"object",error:io.error,code(t){let[e,r]=x3e(t);lle(t,e),ule(t,r)}};function x3e({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function lle(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let c=(0,ny.propertyInData)(r,n,s,i.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(c,()=>{for(let l of a)(0,ny.checkReportMissingProp)(t,l)}):(r.if((0,tq._)`${c} && (${(0,ny.checkMissingProp)(t,a,o)})`),(0,ny.reportMissingProp)(t,o),r.else())}}io.validatePropertyDeps=lle;function ule(t,e=t.schema){let{gen:r,data:n,keyword:i,it:o}=t,s=r.name("valid");for(let a in e)(0,S3e.alwaysValidSchema)(o,e[a])||(r.if((0,ny.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:a},s);t.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),t.ok(s))}io.validateSchemaDeps=ule;io.default=w3e});var ple=v(rq=>{"use strict";Object.defineProperty(rq,"__esModule",{value:!0});var fle=we(),$3e=Ne(),k3e={message:"property name must be valid",params:({params:t})=>(0,fle._)`{propertyName: ${t.propertyName}}`},E3e={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:k3e,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,$3e.alwaysValidSchema)(i,r))return;let o=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),e.if((0,fle.not)(o),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(o)}};rq.default=E3e});var iq=v(nq=>{"use strict";Object.defineProperty(nq,"__esModule",{value:!0});var eA=Hn(),vi=we(),A3e=Ho(),tA=Ne(),T3e={message:"must NOT have additional properties",params:({params:t})=>(0,vi._)`{additionalProperty: ${t.additionalProperty}}`},O3e={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:T3e,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,tA.alwaysValidSchema)(s,r))return;let l=(0,eA.allSchemaProperties)(n.properties),u=(0,eA.allSchemaProperties)(n.patternProperties);d(),t.ok((0,vi._)`${o} === ${A3e.default.errors}`);function d(){e.forIn("key",i,g=>{!l.length&&!u.length?m(g):e.if(f(g),()=>m(g))})}function f(g){let b;if(l.length>8){let _=(0,tA.schemaRefOrVal)(s,n.properties,"properties");b=(0,eA.isOwnProperty)(e,_,g)}else l.length?b=(0,vi.or)(...l.map(_=>(0,vi._)`${g} === ${_}`)):b=vi.nil;return u.length&&(b=(0,vi.or)(b,...u.map(_=>(0,vi._)`${(0,eA.usePattern)(t,_)}.test(${g})`))),(0,vi.not)(b)}function p(g){e.code((0,vi._)`delete ${i}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(g);return}if(r===!1){t.setParams({additionalProperty:g}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,tA.alwaysValidSchema)(s,r)){let b=e.name("valid");c.removeAdditional==="failing"?(h(g,b,!1),e.if((0,vi.not)(b),()=>{t.reset(),p(g)})):(h(g,b),a||e.if((0,vi.not)(b),()=>e.break()))}}function h(g,b,_){let S={keyword:"additionalProperties",dataProp:g,dataPropType:tA.Type.Str};_===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(S,b)}}};nq.default=O3e});var gle=v(sq=>{"use strict";Object.defineProperty(sq,"__esModule",{value:!0});var R3e=Bg(),mle=Hn(),oq=Ne(),hle=iq(),I3e={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&hle.default.code(new R3e.KeywordCxt(o,hle.default,"additionalProperties"));let s=(0,mle.allSchemaProperties)(r);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=oq.mergeEvaluated.props(e,(0,oq.toHash)(s),o.props));let a=s.filter(d=>!(0,oq.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)l(d)?u(d):(e.if((0,mle.propertyInData)(e,i,d,o.opts.ownProperties)),u(d),o.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function l(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};sq.default=I3e});var vle=v(aq=>{"use strict";Object.defineProperty(aq,"__esModule",{value:!0});var yle=Hn(),rA=we(),_le=Ne(),ble=Ne(),P3e={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:o}=t,{opts:s}=o,a=(0,yle.allSchemaProperties)(r),c=a.filter(h=>(0,_le.alwaysValidSchema)(o,r[h]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=s.strictSchema&&!s.allowMatchingProperties&&i.properties,u=e.name("valid");o.props!==!0&&!(o.props instanceof rA.Name)&&(o.props=(0,ble.evaluatedPropsToName)(e,o.props));let{props:d}=o;f();function f(){for(let h of a)l&&p(h),o.allErrors?m(h):(e.var(u,!0),m(h),e.if(u))}function p(h){for(let g in l)new RegExp(h).test(g)&&(0,_le.checkStrictMode)(o,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,g=>{e.if((0,rA._)`${(0,yle.usePattern)(t,h)}.test(${g})`,()=>{let b=c.includes(h);b||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:ble.Type.Str},u),o.opts.unevaluated&&d!==!0?e.assign((0,rA._)`${d}[${g}]`,!0):!b&&!o.allErrors&&e.if((0,rA.not)(u),()=>e.break())})})}}};aq.default=P3e});var Sle=v(cq=>{"use strict";Object.defineProperty(cq,"__esModule",{value:!0});var C3e=Ne(),D3e={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,C3e.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};cq.default=D3e});var wle=v(lq=>{"use strict";Object.defineProperty(lq,"__esModule",{value:!0});var N3e=Hn(),j3e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:N3e.validateUnion,error:{message:"must match a schema in anyOf"}};lq.default=j3e});var xle=v(uq=>{"use strict";Object.defineProperty(uq,"__esModule",{value:!0});var nA=we(),M3e=Ne(),F3e={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,nA._)`{passingSchemas: ${t.passing}}`},L3e={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:F3e,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let o=r,s=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(l),t.result(s,()=>t.reset(),()=>t.error(!0));function l(){o.forEach((u,d)=>{let f;(0,M3e.alwaysValidSchema)(i,u)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,nA._)`${c} && ${s}`).assign(s,!1).assign(a,(0,nA._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(s,!0),e.assign(a,d),f&&t.mergeEvaluated(f,nA.Name)})})}}};uq.default=L3e});var $le=v(dq=>{"use strict";Object.defineProperty(dq,"__esModule",{value:!0});var z3e=Ne(),U3e={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((o,s)=>{if((0,z3e.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:s},i);t.ok(i),t.mergeEvaluated(a)})}};dq.default=U3e});var Ale=v(fq=>{"use strict";Object.defineProperty(fq,"__esModule",{value:!0});var iA=we(),Ele=Ne(),q3e={message:({params:t})=>(0,iA.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,iA._)`{failingKeyword: ${t.ifClause}}`},B3e={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:q3e,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,Ele.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=kle(n,"then"),o=kle(n,"else");if(!i&&!o)return;let s=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),i&&o){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,l("then",u),l("else",u))}else i?e.if(a,l("then")):e.if((0,iA.not)(a),l("else"));t.pass(s,()=>t.error(!0));function c(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function l(u,d){return()=>{let f=t.subschema({keyword:u},a);e.assign(s,a),t.mergeValidEvaluated(f,s),d?e.assign(d,(0,iA._)`${u}`):t.setParams({ifClause:u})}}}};function kle(t,e){let r=t.schema[e];return r!==void 0&&!(0,Ele.alwaysValidSchema)(t,r)}fq.default=B3e});var Tle=v(pq=>{"use strict";Object.defineProperty(pq,"__esModule",{value:!0});var H3e=Ne(),G3e={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,H3e.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};pq.default=G3e});var Ole=v(mq=>{"use strict";Object.defineProperty(mq,"__esModule",{value:!0});var Z3e=JU(),V3e=ole(),W3e=YU(),K3e=ale(),J3e=cle(),Y3e=dle(),X3e=ple(),Q3e=iq(),eKe=gle(),tKe=vle(),rKe=Sle(),nKe=wle(),iKe=xle(),oKe=$le(),sKe=Ale(),aKe=Tle();function cKe(t=!1){let e=[rKe.default,nKe.default,iKe.default,oKe.default,sKe.default,aKe.default,X3e.default,Q3e.default,Y3e.default,eKe.default,tKe.default];return t?e.push(V3e.default,K3e.default):e.push(Z3e.default,W3e.default),e.push(J3e.default),e}mq.default=cKe});var Rle=v(hq=>{"use strict";Object.defineProperty(hq,"__esModule",{value:!0});var Pt=we(),lKe={message:({schemaCode:t})=>(0,Pt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Pt._)`{format: ${t}}`},uKe={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:lKe,code(t,e){let{gen:r,data:n,$data:i,schema:o,schemaCode:s,it:a}=t,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;i?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Pt._)`${m}[${s}]`),g=r.let("fType"),b=r.let("format");r.if((0,Pt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(g,(0,Pt._)`${h}.type || "string"`).assign(b,(0,Pt._)`${h}.validate`),()=>r.assign(g,(0,Pt._)`"string"`).assign(b,h)),t.fail$data((0,Pt.or)(_(),S()));function _(){return c.strictSchema===!1?Pt.nil:(0,Pt._)`${s} && !${b}`}function S(){let x=u.$async?(0,Pt._)`(${h}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,Pt._)`${b}(${n})`,w=(0,Pt._)`(typeof ${b} == "function" ? ${x} : ${b}.test(${n}))`;return(0,Pt._)`${b} && ${b} !== true && ${g} === ${e} && !${w}`}}function p(){let m=d.formats[o];if(!m){_();return}if(m===!0)return;let[h,g,b]=S(m);h===e&&t.pass(x());function _(){if(c.strictSchema===!1){d.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function S(w){let O=w instanceof RegExp?(0,Pt.regexpCode)(w):c.code.formats?(0,Pt._)`${c.code.formats}${(0,Pt.getProperty)(o)}`:void 0,T=r.scopeValue("formats",{key:o,ref:w,code:O});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,Pt._)`${T}.validate`]:["string",w,T]}function x(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Pt._)`await ${b}(${n})`}return typeof g=="function"?(0,Pt._)`${b}(${n})`:(0,Pt._)`${b}.test(${n})`}}}};hq.default=uKe});var Ile=v(gq=>{"use strict";Object.defineProperty(gq,"__esModule",{value:!0});var dKe=Rle(),fKe=[dKe.default];gq.default=fKe});var Ple=v(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.contentVocabulary=Vd.metadataVocabulary=void 0;Vd.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Vd.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Dle=v(yq=>{"use strict";Object.defineProperty(yq,"__esModule",{value:!0});var pKe=Uce(),mKe=tle(),hKe=Ole(),gKe=Ile(),Cle=Ple(),yKe=[pKe.default,mKe.default,(0,hKe.default)(),gKe.default,Cle.metadataVocabulary,Cle.contentVocabulary];yq.default=yKe});var jle=v(oA=>{"use strict";Object.defineProperty(oA,"__esModule",{value:!0});oA.DiscrError=void 0;var Nle;(function(t){t.Tag="tag",t.Mapping="mapping"})(Nle||(oA.DiscrError=Nle={}))});var Fle=v(bq=>{"use strict";Object.defineProperty(bq,"__esModule",{value:!0});var Wd=we(),_q=jle(),Mle=qE(),_Ke=Hg(),bKe=Ne(),vKe={message:({params:{discrError:t,tagName:e}})=>t===_q.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Wd._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},SKe={keyword:"discriminator",type:"object",schemaType:"object",error:vKe,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:o}=t,{oneOf:s}=i;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),l=e.const("tag",(0,Wd._)`${r}${(0,Wd.getProperty)(a)}`);e.if((0,Wd._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:_q.DiscrError.Tag,tag:l,tagName:a})),t.ok(c);function u(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,Wd._)`${l} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:_q.DiscrError.Mapping,tag:l,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(h,Wd.Name),m}function f(){var p;let m={},h=b(i),g=!0;for(let x=0;x{wKe.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var Sq=v((pt,vq)=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.MissingRefError=pt.ValidationError=pt.CodeGen=pt.Name=pt.nil=pt.stringify=pt.str=pt._=pt.KeywordCxt=pt.Ajv=void 0;var xKe=Nce(),$Ke=Dle(),kKe=Fle(),zle=Lle(),EKe=["/properties"],sA="http://json-schema.org/draft-07/schema",Kd=class extends xKe.default{_addVocabularies(){super._addVocabularies(),$Ke.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(kKe.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(zle,EKe):zle;this.addMetaSchema(e,sA,!1),this.refs["http://json-schema.org/schema"]=sA}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(sA)?sA:void 0)}};pt.Ajv=Kd;vq.exports=pt=Kd;vq.exports.Ajv=Kd;Object.defineProperty(pt,"__esModule",{value:!0});pt.default=Kd;var AKe=Bg();Object.defineProperty(pt,"KeywordCxt",{enumerable:!0,get:function(){return AKe.KeywordCxt}});var Jd=we();Object.defineProperty(pt,"_",{enumerable:!0,get:function(){return Jd._}});Object.defineProperty(pt,"str",{enumerable:!0,get:function(){return Jd.str}});Object.defineProperty(pt,"stringify",{enumerable:!0,get:function(){return Jd.stringify}});Object.defineProperty(pt,"nil",{enumerable:!0,get:function(){return Jd.nil}});Object.defineProperty(pt,"Name",{enumerable:!0,get:function(){return Jd.Name}});Object.defineProperty(pt,"CodeGen",{enumerable:!0,get:function(){return Jd.CodeGen}});var TKe=zE();Object.defineProperty(pt,"ValidationError",{enumerable:!0,get:function(){return TKe.default}});var OKe=Hg();Object.defineProperty(pt,"MissingRefError",{enumerable:!0,get:function(){return OKe.default}})});var Wle=v(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.formatNames=so.fastFormats=so.fullFormats=void 0;function oo(t,e){return{validate:t,compare:e}}so.fullFormats={date:oo(Hle,kq),time:oo(xq(!0),Eq),"date-time":oo(Ule(!0),Zle),"iso-time":oo(xq(),Gle),"iso-date-time":oo(Ule(),Vle),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:NKe,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-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-f]{1,4}:){5}(((:[0-9a-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-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-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-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-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-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-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-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-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-f]{1,4}){1,7})|((:[0-9a-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}))|:)))$/i,regex:qKe,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:jKe,int32:{type:"number",validate:LKe},int64:{type:"number",validate:zKe},float:{type:"number",validate:Ble},double:{type:"number",validate:Ble},password:!0,binary:!0};so.fastFormats={...so.fullFormats,date:oo(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,kq),time:oo(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Eq),"date-time":oo(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Zle),"iso-time":oo(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Gle),"iso-date-time":oo(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Vle),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};so.formatNames=Object.keys(so.fullFormats);function RKe(t){return t%4===0&&(t%100!==0||t%400===0)}var IKe=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,PKe=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Hle(t){let e=IKe.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&RKe(r)?29:PKe[n])}function kq(t,e){if(t&&e)return t>e?1:t23||u>59||t&&!a)return!1;if(i<=23&&o<=59&&s<60)return!0;let d=o-u*c,f=i-l*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&s<61}}function Eq(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function Gle(t,e){if(!(t&&e))return;let r=wq.exec(t),n=wq.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t=MKe}function zKe(t){return Number.isInteger(t)}function Ble(){return!0}var UKe=/[^\\]\\Z/;function qKe(t){if(UKe.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Kle=v(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.formatLimitDefinition=void 0;var BKe=Sq(),Si=we(),sa=Si.operators,aA={formatMaximum:{okStr:"<=",ok:sa.LTE,fail:sa.GT},formatMinimum:{okStr:">=",ok:sa.GTE,fail:sa.LT},formatExclusiveMaximum:{okStr:"<",ok:sa.LT,fail:sa.GTE},formatExclusiveMinimum:{okStr:">",ok:sa.GT,fail:sa.LTE}},HKe={message:({keyword:t,schemaCode:e})=>(0,Si.str)`should be ${aA[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Si._)`{comparison: ${aA[t].okStr}, limit: ${e}}`};Yd.formatLimitDefinition={keyword:Object.keys(aA),type:"string",schemaType:"string",$data:!0,error:HKe,code(t){let{gen:e,data:r,schemaCode:n,keyword:i,it:o}=t,{opts:s,self:a}=o;if(!s.validateFormats)return;let c=new BKe.KeywordCxt(o,a.RULES.all.format.definition,"format");c.$data?l():u();function l(){let f=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),p=e.const("fmt",(0,Si._)`${f}[${c.schemaCode}]`);t.fail$data((0,Si.or)((0,Si._)`typeof ${p} != "object"`,(0,Si._)`${p} instanceof RegExp`,(0,Si._)`typeof ${p}.compare != "function"`,d(p)))}function u(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${i}": format "${f}" does not define "compare" function`);let m=e.scopeValue("formats",{key:f,ref:p,code:s.code.formats?(0,Si._)`${s.code.formats}${(0,Si.getProperty)(f)}`:void 0});t.fail$data(d(m))}function d(f){return(0,Si._)`${f}.compare(${r}, ${n}) ${aA[i].fail} 0`}},dependencies:["format"]};var GKe=t=>(t.addKeyword(Yd.formatLimitDefinition),t);Yd.default=GKe});var Qle=v((iy,Xle)=>{"use strict";Object.defineProperty(iy,"__esModule",{value:!0});var Xd=Wle(),ZKe=Kle(),Aq=we(),Jle=new Aq.Name("fullFormats"),VKe=new Aq.Name("fastFormats"),Tq=(t,e={keywords:!0})=>{if(Array.isArray(e))return Yle(t,e,Xd.fullFormats,Jle),t;let[r,n]=e.mode==="fast"?[Xd.fastFormats,VKe]:[Xd.fullFormats,Jle],i=e.formats||Xd.formatNames;return Yle(t,i,r,n),e.keywords&&(0,ZKe.default)(t),t};Tq.get=(t,e="full")=>{let n=(e==="fast"?Xd.fastFormats:Xd.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function Yle(t,e,r,n){var i,o;(i=(o=t.opts.code).formats)!==null&&i!==void 0||(o.formats=(0,Aq._)`require("ajv-formats/dist/formats").${n}`);for(let s of e)t.addFormat(s,r[s])}Xle.exports=iy=Tq;Object.defineProperty(iy,"__esModule",{value:!0});iy.default=Tq});function WKe(){let t=new eue.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,tue.default)(t),t}var eue,tue,cA,rue=y(()=>{eue=St(Sq(),1),tue=St(Qle(),1);cA=class{constructor(e){this._ajv=e??WKe()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}});var lA,nue=y(()=>{Nc();lA=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}createMessageStream(e,r){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages[e.messages.length-1],o=Array.isArray(i.content)?i.content:[i.content],s=o.some(u=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],l=c.some(u=>u.type==="tool_use");if(s){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!l)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){let u=new Set(c.filter(f=>f.type==="tool_use").map(f=>f.id)),d=new Set(o.filter(f=>f.type==="tool_result").map(f=>f.toolUseId));if(u.size!==d.size||![...u].every(f=>d.has(f)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Tg,r)}elicitInputStream(e,r){let n=this._server.getClientCapabilities(),i=e.mode??"form";switch(i){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let o=i==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},Dd,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}}});function iue(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function oue(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var sue=y(()=>{});var uA,aue=y(()=>{lae();Nc();rue();rg();nue();sue();uA=class extends AE{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ag.options.map((n,i)=>[n,i])),this.isMessageIgnored=(n,i)=>{let o=this._loggingLevels.get(i);return o?this.LOG_LEVEL_SEVERITY.get(n)this._oninitialize(n)),this.setNotificationHandler(Uz,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Jz,async(n,i)=>{let o=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=n.params,a=Ag.safeParse(s);return a.success&&this._loggingLevels.set(o,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new lA(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=cae(this._capabilities,e)}setRequestHandler(e,r){let i=Ws(e)?.method;if(!i)throw new Error("Schema is missing a method literal");let o;if(Ln(i)){let a=i;o=a._zod?.def?.value??a.value}else{let a=i;o=a._def?.value??a.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");if(o==="tools/call"){let a=async(c,l)=>{let u=Vs(Cd,c);if(!u.success){let m=u.error instanceof Error?u.error.message:String(u.error);throw new ne(ae.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=u.data,f=await Promise.resolve(r(c,l));if(d.task){let m=Vs(Id,f);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new ne(ae.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let p=Vs(hE,f);if(!p.success){let m=p.error instanceof Error?p.error.message:String(p.error);throw new ne(ae.InvalidParams,`Invalid tools/call result: ${m}`)}return p.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){oue(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&iue(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:cse.includes(r)?r:Nz,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Qk)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],i=Array.isArray(n.content)?n.content:[n.content],o=i.some(l=>l.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=s?Array.isArray(s.content)?s.content:[s.content]:[],c=a.some(l=>l.type==="tool_use");if(o){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let l=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),u=new Set(i.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==u.size||![...l].every(d=>u.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Yz,r):this.request({method:"sampling/createMessage",params:e},Tg,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=e;return this.request({method:"elicitation/create",params:i},Dd,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:i},Dd,r);if(o.action==="accept"&&o.content&&i.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(i.requestedSchema)(o.content);if(!a.valid)throw new ne(ae.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(s){throw s instanceof ne?s:new ne(ae.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return o}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Xz,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}});function Oq(t){return!!t&&typeof t=="object"&&lue in t}function uue(t){return t[lue]?.complete}var lue,cue,due=y(()=>{lue=Symbol.for("mcp.completable");(function(t){t.Completable="McpCompletable"})(cue||(cue={}))});var fue=y(()=>{});function JKe(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!KKe.test(t)){let r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,i,o)=>o.indexOf(n)===i);return e.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function YKe(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Rq(t){let e=JKe(t);return YKe(t,e.warnings),e.isValid}var KKe,pue=y(()=>{KKe=/^[A-Za-z0-9._-]{1,128}$/});var dA,mue=y(()=>{dA=class{constructor(e){this._mcpServer=e}registerToolTask(e,r,n){let i={taskSupport:"required",...r.execution};if(i.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,i,r._meta,n)}}});var Iq=y(()=>{Kk();Kk()});function yue(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function _ue(t){return"_def"in t||"_zod"in t||yue(t)}function Pq(t){return typeof t!="object"||t===null||_ue(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(yue)}function hue(t){if(t){if(Pq(t))return Cc(t);if(!_ue(t))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return t}}function QKe(t){let e=Ws(t);return e?Object.entries(e).map(([r,n])=>{let i=qie(n),o=Bie(n);return{name:r,description:i,required:!o}}):[]}function aa(t){let r=Ws(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=_k(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function gue(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var fA,XKe,oy,bue=y(()=>{aue();rg();N2();Nc();due();fue();pue();mue();Iq();fA=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new uA(e,r)}get experimental(){return this._experimental||(this._experimental={tasks:new dA(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(aa(mE)),this.server.assertCanSetRequestHandler(aa(Cd)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(mE,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let n={name:e,title:r.title,description:r.description,inputSchema:(()=>{let i=vd(r.inputSchema);return i?P2(i,{strictUnions:!0,pipeStrategy:"input"}):XKe})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let i=vd(r.outputSchema);i&&(n.outputSchema=P2(i,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(Cd,async(e,r)=>{try{let n=this._registeredTools[e.params.name];if(!n)throw new ne(ae.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new ne(ae.InvalidParams,`Tool ${e.params.name} disabled`);let i=!!e.params.task,o=n.execution?.taskSupport,s="createTask"in n.handler;if((o==="required"||o==="optional")&&!s)throw new ne(ae.InternalError,`Tool ${e.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!i)throw new ne(ae.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!i&&s)return await this.handleAutomaticTaskPolling(n,e,r);let a=await this.validateToolInput(n,e.params.arguments,e.params.name),c=await this.executeToolHandler(n,a,r);return i||await this.validateToolOutput(n,c,e.params.name),c}catch(n){if(n instanceof ne&&n.code===ae.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,r,n){if(!e.inputSchema)return;let o=vd(e.inputSchema)??e.inputSchema,s=await gk(o,r);if(!s.success){let a="error"in s?s.error:"Unknown error",c=yk(a);throw new ne(ae.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${c}`)}return s.data}async validateToolOutput(e,r,n){if(!e.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new ne(ae.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let i=vd(e.outputSchema),o=await gk(i,r.structuredContent);if(!o.success){let s="error"in o?o.error:"Unknown error",a=yk(s);throw new ne(ae.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${a}`)}}async executeToolHandler(e,r,n){let i=e.handler;if("createTask"in i){if(!n.taskStore)throw new Error("No task store provided.");let s={...n,taskStore:n.taskStore};if(e.inputSchema){let a=i;return await Promise.resolve(a.createTask(r,s))}else{let a=i;return await Promise.resolve(a.createTask(s))}}if(e.inputSchema){let s=i;return await Promise.resolve(s(r,n))}else{let s=i;return await Promise.resolve(s(n))}}async handleAutomaticTaskPolling(e,r,n){if(!n.taskStore)throw new Error("No task store provided for task-capable tool.");let i=await this.validateToolInput(e,r.params.arguments,r.params.name),o=e.handler,s={...n,taskStore:n.taskStore},a=i?await Promise.resolve(o.createTask(i,s)):await Promise.resolve(o.createTask(s)),c=a.task.taskId,l=a.task,u=l.pollInterval??5e3;for(;l.status!=="completed"&&l.status!=="failed"&&l.status!=="cancelled";){await new Promise(f=>setTimeout(f,u));let d=await n.taskStore.getTask(c);if(!d)throw new ne(ae.InternalError,`Task ${c} not found during polling`);l=d}return await n.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(aa(gE)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(gE,async e=>{switch(e.params.ref.type){case"ref/prompt":return $se(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return kse(e),this.handleResourceCompletion(e,e.params.ref);default:throw new ne(ae.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let n=this._registeredPrompts[r.name];if(!n)throw new ne(ae.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new ne(ae.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return oy;let o=Ws(n.argsSchema)?.[e.params.argument.name];if(!Oq(o))return oy;let s=uue(o);if(!s)return oy;let a=await s(e.params.argument.value,e.params.context);return gue(a)}async handleResourceCompletion(e,r){let n=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return oy;throw new ne(ae.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let i=n.resourceTemplate.completeCallback(e.params.argument.name);if(!i)return oy;let o=await i(e.params.argument.value,e.params.context);return gue(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(aa(lE)),this.server.assertCanSetRequestHandler(aa(uE)),this.server.assertCanSetRequestHandler(aa(dE)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(lE,async(e,r)=>{let n=Object.entries(this._registeredResources).filter(([o,s])=>s.enabled).map(([o,s])=>({uri:o,name:s.name,...s.metadata})),i=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let s=await o.resourceTemplate.listCallback(r);for(let a of s.resources)i.push({...o.metadata,...a})}return{resources:[...n,...i]}}),this.server.setRequestHandler(uE,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(dE,async(e,r)=>{let n=new URL(e.params.uri),i=this._registeredResources[n.toString()];if(i){if(!i.enabled)throw new ne(ae.InvalidParams,`Resource ${n} disabled`);return i.readCallback(n,r)}for(let o of Object.values(this._registeredResourceTemplates)){let s=o.resourceTemplate.uriTemplate.match(n.toString());if(s)return o.readCallback(n,s,r)}throw new ne(ae.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(aa(fE)),this.server.assertCanSetRequestHandler(aa(pE)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(fE,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?QKe(r.argsSchema):void 0}))})),this.server.setRequestHandler(pE,async(e,r)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new ne(ae.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new ne(ae.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let i=vd(n.argsSchema),o=await gk(i,e.params.arguments);if(!o.success){let c="error"in o?o.error:"Unknown error",l=yk(c);throw new ne(ae.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${l}`)}let s=o.data,a=n.callback;return await Promise.resolve(a(s,r))}else{let i=n.callback;return await Promise.resolve(i(r))}}),this._promptHandlersInitialized=!0)}resource(e,r,...n){let i;typeof n[0]=="object"&&(i=n.shift());let o=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(e,void 0,r,i,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,void 0,r,i,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(e,r,n,i){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let o=this._createRegisteredResource(e,n.title,r,n,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,n.title,r,n,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,r,n,i,o){let s={name:e,title:r,metadata:i,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=s)),typeof a.name<"u"&&(s.name=a.name),typeof a.title<"u"&&(s.title=a.title),typeof a.metadata<"u"&&(s.metadata=a.metadata),typeof a.callback<"u"&&(s.readCallback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=s,s}_createRegisteredResourceTemplate(e,r,n,i,o){let s={resourceTemplate:n,title:r,metadata:i,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==e&&(delete this._registeredResourceTemplates[e],l.name&&(this._registeredResourceTemplates[l.name]=s)),typeof l.title<"u"&&(s.title=l.title),typeof l.template<"u"&&(s.resourceTemplate=l.template),typeof l.metadata<"u"&&(s.metadata=l.metadata),typeof l.callback<"u"&&(s.readCallback=l.callback),typeof l.enabled<"u"&&(s.enabled=l.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(l=>!!n.completeCallback(l))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(e,r,n,i,o){let s={title:r,description:n,argsSchema:i===void 0?void 0:Cc(i),callback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=s)),typeof a.title<"u"&&(s.title=a.title),typeof a.description<"u"&&(s.description=a.description),typeof a.argsSchema<"u"&&(s.argsSchema=Cc(a.argsSchema)),typeof a.callback<"u"&&(s.callback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=s,i&&Object.values(i).some(c=>{let l=c instanceof Od?c._def?.innerType:c;return Oq(l)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(e,r,n,i,o,s,a,c,l){Rq(e);let u={title:r,description:n,inputSchema:hue(i),outputSchema:hue(o),annotations:s,execution:a,_meta:c,handler:l,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(typeof d.name=="string"&&Rq(d.name),delete this._registeredTools[e],d.name&&(this._registeredTools[d.name]=u)),typeof d.title<"u"&&(u.title=d.title),typeof d.description<"u"&&(u.description=d.description),typeof d.paramsSchema<"u"&&(u.inputSchema=Cc(d.paramsSchema)),typeof d.outputSchema<"u"&&(u.outputSchema=Cc(d.outputSchema)),typeof d.callback<"u"&&(u.handler=d.callback),typeof d.annotations<"u"&&(u.annotations=d.annotations),typeof d._meta<"u"&&(u._meta=d._meta),typeof d.enabled<"u"&&(u.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let n,i,o,s;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let c=r[0];if(Pq(c))i=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Pq(r[0])&&(s=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(l=>typeof l=="object"&&l!==null))throw new Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=r.shift()}}let a=r[0];return this._createRegisteredTool(e,void 0,n,i,o,s,{taskSupport:"forbidden"},void 0,a)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:i,description:o,inputSchema:s,outputSchema:a,annotations:c,_meta:l}=r;return this._createRegisteredTool(e,i,o,s,a,c,{taskSupport:"forbidden"},l,n)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let i;r.length>1&&(i=r.shift());let o=r[0],s=this._createRegisteredPrompt(e,void 0,n,i,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:i,description:o,argsSchema:s}=r,a=this._createRegisteredPrompt(e,i,o,s,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},XKe={type:"object",properties:{}};oy={completion:{values:[],hasMore:!1}}});import{readFileSync as eJe,existsSync as Sue}from"node:fs";import{dirname as tJe,join as pA}from"node:path";import{fileURLToPath as rJe}from"node:url";function sy(t,e){let r=iJe[t];r&&process.stderr.write(`cladding: persona '${t}' is now '${r}' \u2014 the old id is removed in 0.8 + deps: ${r}}`};var w3e={keyword:"dependencies",type:"object",schemaType:"object",error:io.error,code(t){let[e,r]=x3e(t);lle(t,e),ule(t,r)}};function x3e({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function lle(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let c=(0,ny.propertyInData)(r,n,s,i.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(c,()=>{for(let l of a)(0,ny.checkReportMissingProp)(t,l)}):(r.if((0,tq._)`${c} && (${(0,ny.checkMissingProp)(t,a,o)})`),(0,ny.reportMissingProp)(t,o),r.else())}}io.validatePropertyDeps=lle;function ule(t,e=t.schema){let{gen:r,data:n,keyword:i,it:o}=t,s=r.name("valid");for(let a in e)(0,S3e.alwaysValidSchema)(o,e[a])||(r.if((0,ny.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:a},s);t.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),t.ok(s))}io.validateSchemaDeps=ule;io.default=w3e});var ple=v(rq=>{"use strict";Object.defineProperty(rq,"__esModule",{value:!0});var fle=we(),$3e=Ne(),k3e={message:"property name must be valid",params:({params:t})=>(0,fle._)`{propertyName: ${t.propertyName}}`},E3e={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:k3e,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,$3e.alwaysValidSchema)(i,r))return;let o=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),e.if((0,fle.not)(o),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(o)}};rq.default=E3e});var iq=v(nq=>{"use strict";Object.defineProperty(nq,"__esModule",{value:!0});var eA=Hn(),vi=we(),A3e=Ho(),tA=Ne(),T3e={message:"must NOT have additional properties",params:({params:t})=>(0,vi._)`{additionalProperty: ${t.additionalProperty}}`},O3e={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:T3e,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,tA.alwaysValidSchema)(s,r))return;let l=(0,eA.allSchemaProperties)(n.properties),u=(0,eA.allSchemaProperties)(n.patternProperties);d(),t.ok((0,vi._)`${o} === ${A3e.default.errors}`);function d(){e.forIn("key",i,g=>{!l.length&&!u.length?m(g):e.if(f(g),()=>m(g))})}function f(g){let b;if(l.length>8){let _=(0,tA.schemaRefOrVal)(s,n.properties,"properties");b=(0,eA.isOwnProperty)(e,_,g)}else l.length?b=(0,vi.or)(...l.map(_=>(0,vi._)`${g} === ${_}`)):b=vi.nil;return u.length&&(b=(0,vi.or)(b,...u.map(_=>(0,vi._)`${(0,eA.usePattern)(t,_)}.test(${g})`))),(0,vi.not)(b)}function p(g){e.code((0,vi._)`delete ${i}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(g);return}if(r===!1){t.setParams({additionalProperty:g}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,tA.alwaysValidSchema)(s,r)){let b=e.name("valid");c.removeAdditional==="failing"?(h(g,b,!1),e.if((0,vi.not)(b),()=>{t.reset(),p(g)})):(h(g,b),a||e.if((0,vi.not)(b),()=>e.break()))}}function h(g,b,_){let S={keyword:"additionalProperties",dataProp:g,dataPropType:tA.Type.Str};_===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(S,b)}}};nq.default=O3e});var gle=v(sq=>{"use strict";Object.defineProperty(sq,"__esModule",{value:!0});var R3e=Bg(),mle=Hn(),oq=Ne(),hle=iq(),I3e={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&hle.default.code(new R3e.KeywordCxt(o,hle.default,"additionalProperties"));let s=(0,mle.allSchemaProperties)(r);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=oq.mergeEvaluated.props(e,(0,oq.toHash)(s),o.props));let a=s.filter(d=>!(0,oq.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)l(d)?u(d):(e.if((0,mle.propertyInData)(e,i,d,o.opts.ownProperties)),u(d),o.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function l(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};sq.default=I3e});var vle=v(aq=>{"use strict";Object.defineProperty(aq,"__esModule",{value:!0});var yle=Hn(),rA=we(),_le=Ne(),ble=Ne(),P3e={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:o}=t,{opts:s}=o,a=(0,yle.allSchemaProperties)(r),c=a.filter(h=>(0,_le.alwaysValidSchema)(o,r[h]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=s.strictSchema&&!s.allowMatchingProperties&&i.properties,u=e.name("valid");o.props!==!0&&!(o.props instanceof rA.Name)&&(o.props=(0,ble.evaluatedPropsToName)(e,o.props));let{props:d}=o;f();function f(){for(let h of a)l&&p(h),o.allErrors?m(h):(e.var(u,!0),m(h),e.if(u))}function p(h){for(let g in l)new RegExp(h).test(g)&&(0,_le.checkStrictMode)(o,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,g=>{e.if((0,rA._)`${(0,yle.usePattern)(t,h)}.test(${g})`,()=>{let b=c.includes(h);b||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:ble.Type.Str},u),o.opts.unevaluated&&d!==!0?e.assign((0,rA._)`${d}[${g}]`,!0):!b&&!o.allErrors&&e.if((0,rA.not)(u),()=>e.break())})})}}};aq.default=P3e});var Sle=v(cq=>{"use strict";Object.defineProperty(cq,"__esModule",{value:!0});var C3e=Ne(),D3e={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,C3e.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};cq.default=D3e});var wle=v(lq=>{"use strict";Object.defineProperty(lq,"__esModule",{value:!0});var N3e=Hn(),j3e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:N3e.validateUnion,error:{message:"must match a schema in anyOf"}};lq.default=j3e});var xle=v(uq=>{"use strict";Object.defineProperty(uq,"__esModule",{value:!0});var nA=we(),M3e=Ne(),F3e={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,nA._)`{passingSchemas: ${t.passing}}`},L3e={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:F3e,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let o=r,s=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(l),t.result(s,()=>t.reset(),()=>t.error(!0));function l(){o.forEach((u,d)=>{let f;(0,M3e.alwaysValidSchema)(i,u)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,nA._)`${c} && ${s}`).assign(s,!1).assign(a,(0,nA._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(s,!0),e.assign(a,d),f&&t.mergeEvaluated(f,nA.Name)})})}}};uq.default=L3e});var $le=v(dq=>{"use strict";Object.defineProperty(dq,"__esModule",{value:!0});var z3e=Ne(),U3e={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((o,s)=>{if((0,z3e.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:s},i);t.ok(i),t.mergeEvaluated(a)})}};dq.default=U3e});var Ale=v(fq=>{"use strict";Object.defineProperty(fq,"__esModule",{value:!0});var iA=we(),Ele=Ne(),q3e={message:({params:t})=>(0,iA.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,iA._)`{failingKeyword: ${t.ifClause}}`},B3e={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:q3e,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,Ele.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=kle(n,"then"),o=kle(n,"else");if(!i&&!o)return;let s=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),i&&o){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,l("then",u),l("else",u))}else i?e.if(a,l("then")):e.if((0,iA.not)(a),l("else"));t.pass(s,()=>t.error(!0));function c(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function l(u,d){return()=>{let f=t.subschema({keyword:u},a);e.assign(s,a),t.mergeValidEvaluated(f,s),d?e.assign(d,(0,iA._)`${u}`):t.setParams({ifClause:u})}}}};function kle(t,e){let r=t.schema[e];return r!==void 0&&!(0,Ele.alwaysValidSchema)(t,r)}fq.default=B3e});var Tle=v(pq=>{"use strict";Object.defineProperty(pq,"__esModule",{value:!0});var H3e=Ne(),G3e={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,H3e.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};pq.default=G3e});var Ole=v(mq=>{"use strict";Object.defineProperty(mq,"__esModule",{value:!0});var Z3e=JU(),V3e=ole(),W3e=YU(),K3e=ale(),J3e=cle(),Y3e=dle(),X3e=ple(),Q3e=iq(),eKe=gle(),tKe=vle(),rKe=Sle(),nKe=wle(),iKe=xle(),oKe=$le(),sKe=Ale(),aKe=Tle();function cKe(t=!1){let e=[rKe.default,nKe.default,iKe.default,oKe.default,sKe.default,aKe.default,X3e.default,Q3e.default,Y3e.default,eKe.default,tKe.default];return t?e.push(V3e.default,K3e.default):e.push(Z3e.default,W3e.default),e.push(J3e.default),e}mq.default=cKe});var Rle=v(hq=>{"use strict";Object.defineProperty(hq,"__esModule",{value:!0});var Pt=we(),lKe={message:({schemaCode:t})=>(0,Pt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Pt._)`{format: ${t}}`},uKe={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:lKe,code(t,e){let{gen:r,data:n,$data:i,schema:o,schemaCode:s,it:a}=t,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;i?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Pt._)`${m}[${s}]`),g=r.let("fType"),b=r.let("format");r.if((0,Pt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(g,(0,Pt._)`${h}.type || "string"`).assign(b,(0,Pt._)`${h}.validate`),()=>r.assign(g,(0,Pt._)`"string"`).assign(b,h)),t.fail$data((0,Pt.or)(_(),S()));function _(){return c.strictSchema===!1?Pt.nil:(0,Pt._)`${s} && !${b}`}function S(){let x=u.$async?(0,Pt._)`(${h}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,Pt._)`${b}(${n})`,w=(0,Pt._)`(typeof ${b} == "function" ? ${x} : ${b}.test(${n}))`;return(0,Pt._)`${b} && ${b} !== true && ${g} === ${e} && !${w}`}}function p(){let m=d.formats[o];if(!m){_();return}if(m===!0)return;let[h,g,b]=S(m);h===e&&t.pass(x());function _(){if(c.strictSchema===!1){d.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function S(w){let O=w instanceof RegExp?(0,Pt.regexpCode)(w):c.code.formats?(0,Pt._)`${c.code.formats}${(0,Pt.getProperty)(o)}`:void 0,T=r.scopeValue("formats",{key:o,ref:w,code:O});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,Pt._)`${T}.validate`]:["string",w,T]}function x(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Pt._)`await ${b}(${n})`}return typeof g=="function"?(0,Pt._)`${b}(${n})`:(0,Pt._)`${b}.test(${n})`}}}};hq.default=uKe});var Ile=v(gq=>{"use strict";Object.defineProperty(gq,"__esModule",{value:!0});var dKe=Rle(),fKe=[dKe.default];gq.default=fKe});var Ple=v(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.contentVocabulary=Vd.metadataVocabulary=void 0;Vd.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Vd.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Dle=v(yq=>{"use strict";Object.defineProperty(yq,"__esModule",{value:!0});var pKe=Uce(),mKe=tle(),hKe=Ole(),gKe=Ile(),Cle=Ple(),yKe=[pKe.default,mKe.default,(0,hKe.default)(),gKe.default,Cle.metadataVocabulary,Cle.contentVocabulary];yq.default=yKe});var jle=v(oA=>{"use strict";Object.defineProperty(oA,"__esModule",{value:!0});oA.DiscrError=void 0;var Nle;(function(t){t.Tag="tag",t.Mapping="mapping"})(Nle||(oA.DiscrError=Nle={}))});var Fle=v(bq=>{"use strict";Object.defineProperty(bq,"__esModule",{value:!0});var Wd=we(),_q=jle(),Mle=qE(),_Ke=Hg(),bKe=Ne(),vKe={message:({params:{discrError:t,tagName:e}})=>t===_q.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Wd._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},SKe={keyword:"discriminator",type:"object",schemaType:"object",error:vKe,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:o}=t,{oneOf:s}=i;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),l=e.const("tag",(0,Wd._)`${r}${(0,Wd.getProperty)(a)}`);e.if((0,Wd._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:_q.DiscrError.Tag,tag:l,tagName:a})),t.ok(c);function u(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,Wd._)`${l} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:_q.DiscrError.Mapping,tag:l,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(h,Wd.Name),m}function f(){var p;let m={},h=b(i),g=!0;for(let x=0;x{wKe.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var Sq=v((pt,vq)=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.MissingRefError=pt.ValidationError=pt.CodeGen=pt.Name=pt.nil=pt.stringify=pt.str=pt._=pt.KeywordCxt=pt.Ajv=void 0;var xKe=Nce(),$Ke=Dle(),kKe=Fle(),zle=Lle(),EKe=["/properties"],sA="http://json-schema.org/draft-07/schema",Kd=class extends xKe.default{_addVocabularies(){super._addVocabularies(),$Ke.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(kKe.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(zle,EKe):zle;this.addMetaSchema(e,sA,!1),this.refs["http://json-schema.org/schema"]=sA}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(sA)?sA:void 0)}};pt.Ajv=Kd;vq.exports=pt=Kd;vq.exports.Ajv=Kd;Object.defineProperty(pt,"__esModule",{value:!0});pt.default=Kd;var AKe=Bg();Object.defineProperty(pt,"KeywordCxt",{enumerable:!0,get:function(){return AKe.KeywordCxt}});var Jd=we();Object.defineProperty(pt,"_",{enumerable:!0,get:function(){return Jd._}});Object.defineProperty(pt,"str",{enumerable:!0,get:function(){return Jd.str}});Object.defineProperty(pt,"stringify",{enumerable:!0,get:function(){return Jd.stringify}});Object.defineProperty(pt,"nil",{enumerable:!0,get:function(){return Jd.nil}});Object.defineProperty(pt,"Name",{enumerable:!0,get:function(){return Jd.Name}});Object.defineProperty(pt,"CodeGen",{enumerable:!0,get:function(){return Jd.CodeGen}});var TKe=zE();Object.defineProperty(pt,"ValidationError",{enumerable:!0,get:function(){return TKe.default}});var OKe=Hg();Object.defineProperty(pt,"MissingRefError",{enumerable:!0,get:function(){return OKe.default}})});var Wle=v(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.formatNames=so.fastFormats=so.fullFormats=void 0;function oo(t,e){return{validate:t,compare:e}}so.fullFormats={date:oo(Hle,kq),time:oo(xq(!0),Eq),"date-time":oo(Ule(!0),Zle),"iso-time":oo(xq(),Gle),"iso-date-time":oo(Ule(),Vle),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:NKe,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-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-f]{1,4}:){5}(((:[0-9a-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-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-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-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-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-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-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-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-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-f]{1,4}){1,7})|((:[0-9a-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}))|:)))$/i,regex:qKe,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:jKe,int32:{type:"number",validate:LKe},int64:{type:"number",validate:zKe},float:{type:"number",validate:Ble},double:{type:"number",validate:Ble},password:!0,binary:!0};so.fastFormats={...so.fullFormats,date:oo(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,kq),time:oo(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Eq),"date-time":oo(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Zle),"iso-time":oo(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Gle),"iso-date-time":oo(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Vle),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};so.formatNames=Object.keys(so.fullFormats);function RKe(t){return t%4===0&&(t%100!==0||t%400===0)}var IKe=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,PKe=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Hle(t){let e=IKe.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&RKe(r)?29:PKe[n])}function kq(t,e){if(t&&e)return t>e?1:t23||u>59||t&&!a)return!1;if(i<=23&&o<=59&&s<60)return!0;let d=o-u*c,f=i-l*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&s<61}}function Eq(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function Gle(t,e){if(!(t&&e))return;let r=wq.exec(t),n=wq.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t=MKe}function zKe(t){return Number.isInteger(t)}function Ble(){return!0}var UKe=/[^\\]\\Z/;function qKe(t){if(UKe.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Kle=v(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.formatLimitDefinition=void 0;var BKe=Sq(),Si=we(),sa=Si.operators,aA={formatMaximum:{okStr:"<=",ok:sa.LTE,fail:sa.GT},formatMinimum:{okStr:">=",ok:sa.GTE,fail:sa.LT},formatExclusiveMaximum:{okStr:"<",ok:sa.LT,fail:sa.GTE},formatExclusiveMinimum:{okStr:">",ok:sa.GT,fail:sa.LTE}},HKe={message:({keyword:t,schemaCode:e})=>(0,Si.str)`should be ${aA[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Si._)`{comparison: ${aA[t].okStr}, limit: ${e}}`};Yd.formatLimitDefinition={keyword:Object.keys(aA),type:"string",schemaType:"string",$data:!0,error:HKe,code(t){let{gen:e,data:r,schemaCode:n,keyword:i,it:o}=t,{opts:s,self:a}=o;if(!s.validateFormats)return;let c=new BKe.KeywordCxt(o,a.RULES.all.format.definition,"format");c.$data?l():u();function l(){let f=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),p=e.const("fmt",(0,Si._)`${f}[${c.schemaCode}]`);t.fail$data((0,Si.or)((0,Si._)`typeof ${p} != "object"`,(0,Si._)`${p} instanceof RegExp`,(0,Si._)`typeof ${p}.compare != "function"`,d(p)))}function u(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${i}": format "${f}" does not define "compare" function`);let m=e.scopeValue("formats",{key:f,ref:p,code:s.code.formats?(0,Si._)`${s.code.formats}${(0,Si.getProperty)(f)}`:void 0});t.fail$data(d(m))}function d(f){return(0,Si._)`${f}.compare(${r}, ${n}) ${aA[i].fail} 0`}},dependencies:["format"]};var GKe=t=>(t.addKeyword(Yd.formatLimitDefinition),t);Yd.default=GKe});var Qle=v((iy,Xle)=>{"use strict";Object.defineProperty(iy,"__esModule",{value:!0});var Xd=Wle(),ZKe=Kle(),Aq=we(),Jle=new Aq.Name("fullFormats"),VKe=new Aq.Name("fastFormats"),Tq=(t,e={keywords:!0})=>{if(Array.isArray(e))return Yle(t,e,Xd.fullFormats,Jle),t;let[r,n]=e.mode==="fast"?[Xd.fastFormats,VKe]:[Xd.fullFormats,Jle],i=e.formats||Xd.formatNames;return Yle(t,i,r,n),e.keywords&&(0,ZKe.default)(t),t};Tq.get=(t,e="full")=>{let n=(e==="fast"?Xd.fastFormats:Xd.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function Yle(t,e,r,n){var i,o;(i=(o=t.opts.code).formats)!==null&&i!==void 0||(o.formats=(0,Aq._)`require("ajv-formats/dist/formats").${n}`);for(let s of e)t.addFormat(s,r[s])}Xle.exports=iy=Tq;Object.defineProperty(iy,"__esModule",{value:!0});iy.default=Tq});function WKe(){let t=new eue.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,tue.default)(t),t}var eue,tue,cA,rue=y(()=>{eue=St(Sq(),1),tue=St(Qle(),1);cA=class{constructor(e){this._ajv=e??WKe()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}});var lA,nue=y(()=>{Nc();lA=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}createMessageStream(e,r){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages[e.messages.length-1],o=Array.isArray(i.content)?i.content:[i.content],s=o.some(u=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],l=c.some(u=>u.type==="tool_use");if(s){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!l)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){let u=new Set(c.filter(f=>f.type==="tool_use").map(f=>f.id)),d=new Set(o.filter(f=>f.type==="tool_result").map(f=>f.toolUseId));if(u.size!==d.size||![...u].every(f=>d.has(f)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Tg,r)}elicitInputStream(e,r){let n=this._server.getClientCapabilities(),i=e.mode??"form";switch(i){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let o=i==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},Dd,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}}});function iue(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function oue(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var sue=y(()=>{});var uA,aue=y(()=>{lae();Nc();rue();rg();nue();sue();uA=class extends AE{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ag.options.map((n,i)=>[n,i])),this.isMessageIgnored=(n,i)=>{let o=this._loggingLevels.get(i);return o?this.LOG_LEVEL_SEVERITY.get(n)this._oninitialize(n)),this.setNotificationHandler(Uz,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Jz,async(n,i)=>{let o=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=n.params,a=Ag.safeParse(s);return a.success&&this._loggingLevels.set(o,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new lA(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=cae(this._capabilities,e)}setRequestHandler(e,r){let i=Ws(e)?.method;if(!i)throw new Error("Schema is missing a method literal");let o;if(Ln(i)){let a=i;o=a._zod?.def?.value??a.value}else{let a=i;o=a._def?.value??a.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");if(o==="tools/call"){let a=async(c,l)=>{let u=Vs(Cd,c);if(!u.success){let m=u.error instanceof Error?u.error.message:String(u.error);throw new ne(ae.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=u.data,f=await Promise.resolve(r(c,l));if(d.task){let m=Vs(Id,f);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new ne(ae.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let p=Vs(hE,f);if(!p.success){let m=p.error instanceof Error?p.error.message:String(p.error);throw new ne(ae.InvalidParams,`Invalid tools/call result: ${m}`)}return p.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){oue(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&iue(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:cse.includes(r)?r:Nz,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Qk)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],i=Array.isArray(n.content)?n.content:[n.content],o=i.some(l=>l.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=s?Array.isArray(s.content)?s.content:[s.content]:[],c=a.some(l=>l.type==="tool_use");if(o){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let l=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),u=new Set(i.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==u.size||![...l].every(d=>u.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Yz,r):this.request({method:"sampling/createMessage",params:e},Tg,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=e;return this.request({method:"elicitation/create",params:i},Dd,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:i},Dd,r);if(o.action==="accept"&&o.content&&i.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(i.requestedSchema)(o.content);if(!a.valid)throw new ne(ae.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(s){throw s instanceof ne?s:new ne(ae.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return o}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Xz,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}});function Oq(t){return!!t&&typeof t=="object"&&lue in t}function uue(t){return t[lue]?.complete}var lue,cue,due=y(()=>{lue=Symbol.for("mcp.completable");(function(t){t.Completable="McpCompletable"})(cue||(cue={}))});var fue=y(()=>{});function JKe(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!KKe.test(t)){let r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,i,o)=>o.indexOf(n)===i);return e.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function YKe(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Rq(t){let e=JKe(t);return YKe(t,e.warnings),e.isValid}var KKe,pue=y(()=>{KKe=/^[A-Za-z0-9._-]{1,128}$/});var dA,mue=y(()=>{dA=class{constructor(e){this._mcpServer=e}registerToolTask(e,r,n){let i={taskSupport:"required",...r.execution};if(i.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,i,r._meta,n)}}});var Iq=y(()=>{Kk();Kk()});function yue(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function _ue(t){return"_def"in t||"_zod"in t||yue(t)}function Pq(t){return typeof t!="object"||t===null||_ue(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(yue)}function hue(t){if(t){if(Pq(t))return Cc(t);if(!_ue(t))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return t}}function QKe(t){let e=Ws(t);return e?Object.entries(e).map(([r,n])=>{let i=qie(n),o=Bie(n);return{name:r,description:i,required:!o}}):[]}function aa(t){let r=Ws(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=_k(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function gue(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var fA,XKe,oy,bue=y(()=>{aue();rg();N2();Nc();due();fue();pue();mue();Iq();fA=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new uA(e,r)}get experimental(){return this._experimental||(this._experimental={tasks:new dA(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(aa(mE)),this.server.assertCanSetRequestHandler(aa(Cd)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(mE,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let n={name:e,title:r.title,description:r.description,inputSchema:(()=>{let i=vd(r.inputSchema);return i?P2(i,{strictUnions:!0,pipeStrategy:"input"}):XKe})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let i=vd(r.outputSchema);i&&(n.outputSchema=P2(i,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(Cd,async(e,r)=>{try{let n=this._registeredTools[e.params.name];if(!n)throw new ne(ae.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new ne(ae.InvalidParams,`Tool ${e.params.name} disabled`);let i=!!e.params.task,o=n.execution?.taskSupport,s="createTask"in n.handler;if((o==="required"||o==="optional")&&!s)throw new ne(ae.InternalError,`Tool ${e.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!i)throw new ne(ae.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!i&&s)return await this.handleAutomaticTaskPolling(n,e,r);let a=await this.validateToolInput(n,e.params.arguments,e.params.name),c=await this.executeToolHandler(n,a,r);return i||await this.validateToolOutput(n,c,e.params.name),c}catch(n){if(n instanceof ne&&n.code===ae.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,r,n){if(!e.inputSchema)return;let o=vd(e.inputSchema)??e.inputSchema,s=await gk(o,r);if(!s.success){let a="error"in s?s.error:"Unknown error",c=yk(a);throw new ne(ae.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${c}`)}return s.data}async validateToolOutput(e,r,n){if(!e.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new ne(ae.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let i=vd(e.outputSchema),o=await gk(i,r.structuredContent);if(!o.success){let s="error"in o?o.error:"Unknown error",a=yk(s);throw new ne(ae.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${a}`)}}async executeToolHandler(e,r,n){let i=e.handler;if("createTask"in i){if(!n.taskStore)throw new Error("No task store provided.");let s={...n,taskStore:n.taskStore};if(e.inputSchema){let a=i;return await Promise.resolve(a.createTask(r,s))}else{let a=i;return await Promise.resolve(a.createTask(s))}}if(e.inputSchema){let s=i;return await Promise.resolve(s(r,n))}else{let s=i;return await Promise.resolve(s(n))}}async handleAutomaticTaskPolling(e,r,n){if(!n.taskStore)throw new Error("No task store provided for task-capable tool.");let i=await this.validateToolInput(e,r.params.arguments,r.params.name),o=e.handler,s={...n,taskStore:n.taskStore},a=i?await Promise.resolve(o.createTask(i,s)):await Promise.resolve(o.createTask(s)),c=a.task.taskId,l=a.task,u=l.pollInterval??5e3;for(;l.status!=="completed"&&l.status!=="failed"&&l.status!=="cancelled";){await new Promise(f=>setTimeout(f,u));let d=await n.taskStore.getTask(c);if(!d)throw new ne(ae.InternalError,`Task ${c} not found during polling`);l=d}return await n.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(aa(gE)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(gE,async e=>{switch(e.params.ref.type){case"ref/prompt":return $se(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return kse(e),this.handleResourceCompletion(e,e.params.ref);default:throw new ne(ae.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let n=this._registeredPrompts[r.name];if(!n)throw new ne(ae.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new ne(ae.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return oy;let o=Ws(n.argsSchema)?.[e.params.argument.name];if(!Oq(o))return oy;let s=uue(o);if(!s)return oy;let a=await s(e.params.argument.value,e.params.context);return gue(a)}async handleResourceCompletion(e,r){let n=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return oy;throw new ne(ae.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let i=n.resourceTemplate.completeCallback(e.params.argument.name);if(!i)return oy;let o=await i(e.params.argument.value,e.params.context);return gue(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(aa(lE)),this.server.assertCanSetRequestHandler(aa(uE)),this.server.assertCanSetRequestHandler(aa(dE)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(lE,async(e,r)=>{let n=Object.entries(this._registeredResources).filter(([o,s])=>s.enabled).map(([o,s])=>({uri:o,name:s.name,...s.metadata})),i=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let s=await o.resourceTemplate.listCallback(r);for(let a of s.resources)i.push({...o.metadata,...a})}return{resources:[...n,...i]}}),this.server.setRequestHandler(uE,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(dE,async(e,r)=>{let n=new URL(e.params.uri),i=this._registeredResources[n.toString()];if(i){if(!i.enabled)throw new ne(ae.InvalidParams,`Resource ${n} disabled`);return i.readCallback(n,r)}for(let o of Object.values(this._registeredResourceTemplates)){let s=o.resourceTemplate.uriTemplate.match(n.toString());if(s)return o.readCallback(n,s,r)}throw new ne(ae.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(aa(fE)),this.server.assertCanSetRequestHandler(aa(pE)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(fE,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?QKe(r.argsSchema):void 0}))})),this.server.setRequestHandler(pE,async(e,r)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new ne(ae.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new ne(ae.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let i=vd(n.argsSchema),o=await gk(i,e.params.arguments);if(!o.success){let c="error"in o?o.error:"Unknown error",l=yk(c);throw new ne(ae.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${l}`)}let s=o.data,a=n.callback;return await Promise.resolve(a(s,r))}else{let i=n.callback;return await Promise.resolve(i(r))}}),this._promptHandlersInitialized=!0)}resource(e,r,...n){let i;typeof n[0]=="object"&&(i=n.shift());let o=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(e,void 0,r,i,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,void 0,r,i,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(e,r,n,i){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let o=this._createRegisteredResource(e,n.title,r,n,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,n.title,r,n,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,r,n,i,o){let s={name:e,title:r,metadata:i,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=s)),typeof a.name<"u"&&(s.name=a.name),typeof a.title<"u"&&(s.title=a.title),typeof a.metadata<"u"&&(s.metadata=a.metadata),typeof a.callback<"u"&&(s.readCallback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=s,s}_createRegisteredResourceTemplate(e,r,n,i,o){let s={resourceTemplate:n,title:r,metadata:i,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==e&&(delete this._registeredResourceTemplates[e],l.name&&(this._registeredResourceTemplates[l.name]=s)),typeof l.title<"u"&&(s.title=l.title),typeof l.template<"u"&&(s.resourceTemplate=l.template),typeof l.metadata<"u"&&(s.metadata=l.metadata),typeof l.callback<"u"&&(s.readCallback=l.callback),typeof l.enabled<"u"&&(s.enabled=l.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(l=>!!n.completeCallback(l))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(e,r,n,i,o){let s={title:r,description:n,argsSchema:i===void 0?void 0:Cc(i),callback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=s)),typeof a.title<"u"&&(s.title=a.title),typeof a.description<"u"&&(s.description=a.description),typeof a.argsSchema<"u"&&(s.argsSchema=Cc(a.argsSchema)),typeof a.callback<"u"&&(s.callback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=s,i&&Object.values(i).some(c=>{let l=c instanceof Od?c._def?.innerType:c;return Oq(l)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(e,r,n,i,o,s,a,c,l){Rq(e);let u={title:r,description:n,inputSchema:hue(i),outputSchema:hue(o),annotations:s,execution:a,_meta:c,handler:l,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(typeof d.name=="string"&&Rq(d.name),delete this._registeredTools[e],d.name&&(this._registeredTools[d.name]=u)),typeof d.title<"u"&&(u.title=d.title),typeof d.description<"u"&&(u.description=d.description),typeof d.paramsSchema<"u"&&(u.inputSchema=Cc(d.paramsSchema)),typeof d.outputSchema<"u"&&(u.outputSchema=Cc(d.outputSchema)),typeof d.callback<"u"&&(u.handler=d.callback),typeof d.annotations<"u"&&(u.annotations=d.annotations),typeof d._meta<"u"&&(u._meta=d._meta),typeof d.enabled<"u"&&(u.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let n,i,o,s;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let c=r[0];if(Pq(c))i=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Pq(r[0])&&(s=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(l=>typeof l=="object"&&l!==null))throw new Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=r.shift()}}let a=r[0];return this._createRegisteredTool(e,void 0,n,i,o,s,{taskSupport:"forbidden"},void 0,a)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:i,description:o,inputSchema:s,outputSchema:a,annotations:c,_meta:l}=r;return this._createRegisteredTool(e,i,o,s,a,c,{taskSupport:"forbidden"},l,n)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let i;r.length>1&&(i=r.shift());let o=r[0],s=this._createRegisteredPrompt(e,void 0,n,i,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:i,description:o,argsSchema:s}=r,a=this._createRegisteredPrompt(e,i,o,s,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},XKe={type:"object",properties:{}};oy={completion:{values:[],hasMore:!1}}});import{readFileSync as eJe,existsSync as Sue}from"node:fs";import{dirname as tJe,join as pA}from"node:path";import{fileURLToPath as rJe}from"node:url";function sy(t,e){let r=iJe[t];r&&process.stderr.write(`cladding: persona '${t}' is now '${r}' \u2014 the old id is removed in 0.8 `);let n=r??t,i=oJe(n,e),o=vue.get(i);if(o)return o;if(!Sue(i))throw new Error(`agents/${n}.md not found at ${i}`);let s=sJe(n,eJe(i,"utf8"));return vue.set(i,s),s}function oJe(t,e){if(e)return pA(e,"agents",`${t}.md`);let r=tJe(rJe(import.meta.url)),n=[pA(r,`${t}.md`),pA(r,"agents",`${t}.md`),pA(r,"..","plugins","claude-code","agents",`${t}.md`)];return n.find(i=>Sue(i))??n[1]}function sJe(t,e){let{frontmatter:r,body:n}=aJe(e),i=cJe(r.capabilities);return{id:r.name??t,body:n.trim(),capabilities:i}}function aJe(t){if(!t.startsWith(`--- `))return{frontmatter:{},body:t};let e=t.indexOf(` --- @@ -625,7 +625,7 @@ Recent dispatcher errors (most recent first) `);for(let a of r.recentErrors)xt.stdout.write(` \xB7 ${a} `)}xt.stdout.write(` `),xt.stdout.write(`Tune your host: raise max_tokens, switch model, or check MCP transport health. -`)}}function RC(t){let e=Object.entries(t).filter(([,r])=>r>0);return e.length===0?"(none)":e.sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>`${r}=${n}`).join(" ")}import{spawnSync as WC}from"node:child_process";import{existsSync as UY,mkdirSync as qY,readFileSync as BY,readdirSync as fCe,writeFileSync as HY}from"node:fs";import{homedir as pCe,platform as KC}from"node:os";import{join as Mi}from"node:path";import ec from"node:process";import{cpSync as jPe,existsSync as In,lstatSync as MPe,mkdirSync as FPe,readFileSync as _S,readlinkSync as LPe,readdirSync as zPe,rmSync as RY,statSync as qht,writeFileSync as Xa}from"node:fs";import{homedir as IY,platform as PY}from"node:os";import{basename as UPe,dirname as vs,isAbsolute as qPe,join as he,relative as BPe,resolve as Ss}from"node:path";import{fileURLToPath as HPe}from"node:url";import{spawnSync as CY}from"node:child_process";var BC="setup-status.json",HC=he(".cladding","host","serve.cjs"),GC=".cladding/host/gemini-doctor-policy.toml",GPe=["claude","codex","gemini","antigravity","cursor"],ZPe=["Mcp(cladding:clad_list_features)","Mcp(cladding:clad_get_feature)","Mcp(cladding:clad_run_check)"];function hS(t){FPe(t,{recursive:!0})}function oi(t){try{return _S(t,"utf8")}catch{return null}}function Qa(t,e){let r=oi(t);return r===e?"unchanged":(hS(vs(t)),Xa(t,e,"utf8"),r==null?"created":"rewired")}function gS(t){try{return MPe(t).isSymbolicLink()}catch{return!1}}function VPe(t){try{return Ss(vs(t),LPe(t))}catch{return null}}function DY(t,e){let r=BPe(Ss(e),Ss(t));return r===""||!r.startsWith("..")&&!qPe(r)}function WPe(t,e){let r=[Ss(e)],n=oi(he(t,".cladding",BC));if(n)try{let i=JSON.parse(n);typeof i.cladding_root=="string"&&r.push(Ss(i.cladding_root))}catch{}return[...new Set(r)]}function yS(t,e){if(!In(t)&&!gS(t))return"unchanged";if(!gS(t))return"skipped-different";let r=VPe(t);if(!r||!e.some(n=>DY(r,n)))return"skipped-different";try{return RY(t,{force:!0}),"removed"}catch{return"failed"}}function KPe(t,e){let r=he(t,".agents","skills");if(!In(r))return"unchanged";let n=0,i=0;for(let o of zPe(r)){if(!o.startsWith("cladding-"))continue;let s=yS(he(r,o),e);s==="removed"&&n++,s==="skipped-different"&&i++}return i>0?"skipped-different":n>0?"removed":"unchanged"}function Hp(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]===HC?!0:r.command==="node"&&typeof n[0]=="string"&&e.some(i=>DY(n[0],i))}function JPe(t,e){let r=t.split(` +`)}}function RC(t){let e=Object.entries(t).filter(([,r])=>r>0);return e.length===0?"(none)":e.sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>`${r}=${n}`).join(" ")}import{spawnSync as WC}from"node:child_process";import{existsSync as UY,mkdirSync as qY,readFileSync as BY,readdirSync as fCe,writeFileSync as HY}from"node:fs";import{homedir as pCe,platform as KC}from"node:os";import{join as Mi}from"node:path";import ec from"node:process";import{cpSync as jPe,existsSync as In,lstatSync as MPe,mkdirSync as FPe,readFileSync as _S,readlinkSync as LPe,readdirSync as zPe,rmSync as RY,writeFileSync as Xa}from"node:fs";import{homedir as IY,platform as PY}from"node:os";import{basename as UPe,dirname as vs,isAbsolute as qPe,join as he,relative as BPe,resolve as Ss}from"node:path";import{fileURLToPath as HPe}from"node:url";import{spawnSync as CY}from"node:child_process";var BC="setup-status.json",HC=he(".cladding","host","serve.cjs"),GC=".cladding/host/gemini-doctor-policy.toml",GPe=["claude","codex","gemini","antigravity","cursor"],ZPe=["Mcp(cladding:clad_list_features)","Mcp(cladding:clad_get_feature)","Mcp(cladding:clad_run_check)"];function hS(t){FPe(t,{recursive:!0})}function oi(t){try{return _S(t,"utf8")}catch{return null}}function Qa(t,e){let r=oi(t);return r===e?"unchanged":(hS(vs(t)),Xa(t,e,"utf8"),r==null?"created":"rewired")}function gS(t){try{return MPe(t).isSymbolicLink()}catch{return!1}}function VPe(t){try{return Ss(vs(t),LPe(t))}catch{return null}}function DY(t,e){let r=BPe(Ss(e),Ss(t));return r===""||!r.startsWith("..")&&!qPe(r)}function WPe(t,e){let r=[Ss(e)],n=oi(he(t,".cladding",BC));if(n)try{let i=JSON.parse(n);typeof i.cladding_root=="string"&&r.push(Ss(i.cladding_root))}catch{}return[...new Set(r)]}function yS(t,e){if(!In(t)&&!gS(t))return"unchanged";if(!gS(t))return"skipped-different";let r=VPe(t);if(!r||!e.some(n=>DY(r,n)))return"skipped-different";try{return RY(t,{force:!0}),"removed"}catch{return"failed"}}function KPe(t,e){let r=he(t,".agents","skills");if(!In(r))return"unchanged";let n=0,i=0;for(let o of zPe(r)){if(!o.startsWith("cladding-"))continue;let s=yS(he(r,o),e);s==="removed"&&n++,s==="skipped-different"&&i++}return i>0?"skipped-different":n>0?"removed":"unchanged"}function Hp(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]===HC?!0:r.command==="node"&&typeof n[0]=="string"&&e.some(i=>DY(n[0],i))}function JPe(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 YPe(t,e){let r=he(t,".codex","config.toml"),n=oi(r);if(n==null)return"unchanged";try{let{parse:i,stringify:o}=await Promise.resolve().then(()=>(UC(),zC)),s=i(n),a=s.mcp_servers;if(!a?.cladding)return"unchanged";if(!Hp(a.cladding,e))return"skipped-different";delete a.cladding,Object.keys(a).length===0&&delete s.mcp_servers;let c=JPe(n,"[mcp_servers.cladding]");if(c!=null)try{if(JSON.stringify(i(c))===JSON.stringify(s))return Xa(r,c,"utf8"),"removed"}catch{}return Xa(r,o(s),"utf8"),"removed"}catch{return"failed"}}function XPe(t,e){let r=he(t,".cursor","mcp.json"),n=oi(r);if(n==null)return"unchanged";try{let i=JSON.parse(n),o=i.mcpServers;return o?.cladding?Hp(o.cladding,e)?(delete o.cladding,Object.keys(o).length===0&&delete i.mcpServers,Xa(r,`${JSON.stringify(i,null,2)} `,"utf8"),"removed"):"skipped-different":"unchanged"}catch{return"failed"}}function QPe(t,e,r){let n=he(t,".gemini","config","plugins","cladding");if(gS(n))return"skipped-different";let i={command:"node",args:[he(e,"dist","clad.js"),"serve"]},o=Bp(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)} @@ -642,9 +642,9 @@ name: ${i} `);if(In(e)){let s=oi(he(e,"SKILL.md"));if(s===o)return"unchanged";if(!r&&s!=null&&!s.includes("# Cladding init"))return"skipped-different";RY(e,{recursive:!0,force:!0})}return hS(vs(e)),jPe(t,e,{recursive:!0,dereference:!0}),Xa(he(e,"SKILL.md"),o,"utf8"),"created"}function Bp(t,e,r){try{let n=oi(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&&!Hp(s,[])?"skipped-different":(o.cladding=a,Qa(t,`${JSON.stringify(i,null,2)} `))}catch{return"failed"}}function aCe(t){try{let e=oi(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 ZPe)l.includes(u)||l.push(u);return l.length===a.length&&s!==void 0?"unchanged":(i.allow=l,i.deny=c,r.permissions=i,Qa(t,`${JSON.stringify(r,null,2)} `))}catch{return"failed"}}async function cCe(t,e,r){try{let{parse:n,stringify:i}=await Promise.resolve().then(()=>(UC(),zC)),o=oi(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&&!Hp(c,[])?"skipped-different":(a.cladding=l,Qa(t,i(s)))}catch{return"failed"}}function lCe(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 Qa(he(t,".cursor","rules","cladding-bootstrap.mdc"),e)}function Vl(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 NY(t){try{return JSON.parse(_S(t,"utf8")).cladding_version??null}catch{return null}}function OY(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 ZC(t={}){let e=t.home??IY(),r=Ss(t.projectRoot??process.cwd()),n=t.pkgRoot??jY(),i=t.version??MY(n),o=dCe(e),s=new Set(t.hosts??GPe.filter(K=>o[K])),a=t.force??!1,c=he(r,".cladding",BC),l=NY(c),u=[],d=[];hS(r),oCe(r);let f=[Qa(he(r,HC),nCe(n))];s.has("gemini")&&f.push(Qa(he(r,GC),iCe()));let p=Vl(f),m=he(n,"plugins","codex","skills","init"),h=s.has("codex")||s.has("gemini")||s.has("antigravity")?qC(m,he(r,".agents","skills","cladding-init"),a):"unchanged",g=sCe(),b=WPe(e,n),_=yS(he(e,".claude","plugins","cladding"),b),S=_==="removed"?rCe(t.activate??!0):"unchanged",x={claude_plugin:Vl([_,S]),gemini_extension:yS(he(e,".gemini","extensions","cladding"),b),antigravity_plugin:eCe(e,b),codex_skills:KPe(e,b),codex_mcp:await YPe(e,b),cursor_mcp:XPe(e,b)},w=s.has("codex")?await cCe(he(r,".codex","config.toml"),g,a):"skipped-not-installed",O=s.has("gemini")?Bp(he(r,".gemini","settings.json"),g,a):"skipped-not-installed",T=s.has("antigravity")?Vl([Bp(he(r,".agents","mcp_config.json"),g,a),QPe(e,n,a)]):"skipped-not-installed",A=s.has("claude")?Vl([qC(m,he(r,".claude","skills","cladding-init"),a),Bp(he(r,".mcp.json"),g,a)]):"skipped-not-installed",D=s.has("cursor")?Vl([qC(m,he(r,".cursor","skills","cladding-init"),a),Bp(he(r,".cursor","mcp.json"),g,a),aCe(he(r,".cursor","cli.json")),lCe(r)]):"skipped-not-installed",$={runtime:p,shared_init_skill:h,claude:A,codex:w,gemini:O,antigravity:T,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[K,xe]of Object.entries($))OY(xe,K,u,d);for(let[K,xe]of Object.entries(x))OY(xe,`legacy:${K}`,u,d);hS(vs(c)),Xa(c,`${JSON.stringify({project_root:r,cladding_root:n,cladding_version:i,last_run:new Date().toISOString()},null,2)} +`);return Qa(he(t,".cursor","rules","cladding-bootstrap.mdc"),e)}function Vl(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 NY(t){try{return JSON.parse(_S(t,"utf8")).cladding_version??null}catch{return null}}function OY(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 ZC(t={}){let e=t.home??IY(),r=Ss(t.projectRoot??process.cwd()),n=t.pkgRoot??jY(),i=t.version??MY(n),o=dCe(e),s=new Set(t.hosts??GPe.filter(K=>o[K])),a=t.force??!1,c=he(r,".cladding",BC),l=NY(c),u=[],d=[];hS(r),oCe(r);let f=[Qa(he(r,HC),nCe(n))];s.has("gemini")&&f.push(Qa(he(r,GC),iCe()));let p=Vl(f),m=he(n,"plugins","codex","skills","init"),h=s.has("codex")||s.has("gemini")||s.has("antigravity")?qC(m,he(r,".agents","skills","cladding-init"),a):"unchanged",g=sCe(),b=WPe(e,n),_=yS(he(e,".claude","plugins","cladding"),b),S=_==="removed"?rCe(t.activate??!0):"unchanged",x={claude_plugin:Vl([_,S]),gemini_extension:yS(he(e,".gemini","extensions","cladding"),b),antigravity_plugin:eCe(e,b),codex_skills:KPe(e,b),codex_mcp:await YPe(e,b),cursor_mcp:XPe(e,b)},w=s.has("codex")?await cCe(he(r,".codex","config.toml"),g,a):"skipped-not-selected",O=s.has("gemini")?Bp(he(r,".gemini","settings.json"),g,a):"skipped-not-selected",T=s.has("antigravity")?Vl([Bp(he(r,".agents","mcp_config.json"),g,a),QPe(e,n,a)]):"skipped-not-selected",A=s.has("claude")?Vl([qC(m,he(r,".claude","skills","cladding-init"),a),Bp(he(r,".mcp.json"),g,a)]):"skipped-not-selected",D=s.has("cursor")?Vl([qC(m,he(r,".cursor","skills","cladding-init"),a),Bp(he(r,".cursor","mcp.json"),g,a),aCe(he(r,".cursor","cli.json")),lCe(r)]):"skipped-not-selected",$={runtime:p,shared_init_skill:h,claude:A,codex:w,gemini:O,antigravity:T,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[K,xe]of Object.entries($))OY(xe,K,u,d);for(let[K,xe]of Object.entries(x))OY(xe,`legacy:${K}`,u,d);hS(vs(c)),Xa(c,`${JSON.stringify({project_root:r,cladding_root:n,cladding_version:i,last_run:new Date().toISOString()},null,2)} `,"utf8");let ie={projectRoot:r,wiring:$,legacyCleanup:x,errors:u,warnings:d,statusFile:c,cladding_root:n,cladding_version:i,last_setup_version:l};return t.quiet||process.stdout.write(`${uCe(ie)} -`),ie}function qp(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-installed":return"not selected";case"skipped-different":return"preserved conflict";case"manual-required":return"manual cleanup required";default:return"failed"}}function uCe(t,e){let r=[`cladding setup \u2014 project activation: ${t.projectRoot}`,"",` Claude Code \u2192 ${qp(t.wiring.claude)}`,` Codex \u2192 ${qp(t.wiring.codex)}`,` Gemini CLI \u2192 ${qp(t.wiring.gemini)}`,` Antigravity \u2192 ${qp(t.wiring.antigravity)}`,` Cursor \u2192 ${qp(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(` +`),ie}function qp(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 uCe(t,e){let r=[`cladding setup \u2014 project activation: ${t.projectRoot}`,"",` Claude Code \u2192 ${qp(t.wiring.claude)}`,` Codex \u2192 ${qp(t.wiring.codex)}`,` Gemini CLI \u2192 ${qp(t.wiring.gemini)}`,` Antigravity \u2192 ${qp(t.wiring.antigravity)}`,` Cursor \u2192 ${qp(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 jY(){let t=HPe(import.meta.url),e=vs(t);for(let r=0;r<7;r++){try{if(JSON.parse(_S(he(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=vs(e)}return Ss(vs(t),"..")}function MY(t){try{return JSON.parse(_S(he(t,"package.json"),"utf8")).version??"unknown"}catch{return"unknown"}}function Wl(){let t=MY(jY());return t==="unknown"?null:t}function FY(t=process.cwd()){return NY(he(Ss(t),".cladding",BC))}function dCe(t=IY()){return{claude:In(he(t,".claude")),gemini:In(he(t,".gemini")),antigravity:In(he(t,".gemini","config"))||In(he(t,".gemini","antigravity-cli")),codex:In(he(t,".codex")),agents:In(he(t,".agents")),cursor:In(he(t,".cursor"))}}Be();Oi();var mCe=["claude","gemini","antigravity","codex","cursor"],Eo={"list-features":{pattern:/F-[0-9a-f]{6,8}/,label:"a real feature id (F-xxxxxx)"},"get-feature":{pattern:/F-[0-9a-f]{6,8}/,label:"the queried feature id echoed"},"run-check":{pattern:/\b[Dd]rift\b|\b[Ff]indings?\b|\bGREEN\b|\bRED\b/,label:"a drift verdict (drift/findings/GREEN/RED)"}};function Kl(t,e=200){let r=t.replace(/\s+/g," ").trim();return r.length<=e?r:r.slice(-e)}function hCe(t,e,r){if(/\b(?:MCP|tool|clad_[a-z0-9_]+)(?:\s+tool)?(?:\s+calls?)?[^.\n]{0,80}\b(?:rejected|denied|refused|cancelled|canceled|not approved)\b|\buser cancelle?d MCP tool call\b|\bno tool payload\b|\bdon't have a findings count\b|\bre-approve the cladding MCP tool\b/i.test(e))return{result:"fail",sentinel:Eo[t].label,evidence:Kl(e)};let i=Eo[t].pattern,o=Eo[t].label;return t==="get-feature"&&r&&(i=new RegExp(r),o=`the queried id ${r} echoed`),{result:i.test(e)?"pass":"fail",sentinel:o,evidence:Kl(e)}}var gCe={"list-features":()=>"Call the clad_list_features MCP tool and print exactly one feature id (format F-xxxxxxxx) from the result, nothing else.","get-feature":t=>`Call the clad_get_feature MCP tool for id ${t} and print that id verbatim.`,"run-check":()=>"Call the clad_run_check MCP tool and print the number of findings plus the word 'findings'."};function yCe(t,e){switch(t){case"claude":return{command:"claude",args:["-p",e,"--output-format","text","--settings",'{"enableAllProjectMcpServers":true}']};case"gemini":return{command:"gemini",args:["--skip-trust","--approval-mode","plan","--policy",GC,"--allowed-mcp-server-names","cladding","-o","text","-p",e]};case"antigravity":return{command:"agy",args:["--dangerously-skip-permissions","-p",e]};case"codex":return{command:"codex",args:["exec","--dangerously-bypass-approvals-and-sandbox",e]};case"cursor":return{command:"cursor-agent",args:["-p","--mode","ask","--trust","--approve-mcps",e]}}}function _Ce(t){return t==="antigravity"?"agy":t==="cursor"?"cursor-agent":t}var LY={"list-features":12e4,"get-feature":12e4,"run-check":3e5},bCe=1e4;function vCe(t){let e=KC()==="win32"?"where":"which";return WC(e,[t],{stdio:"ignore"}).status===0}function SCe(t,e,r){let n=WC(t,[...e],{cwd:r.cwd,encoding:"utf8",timeout:r.timeoutMs,shell:KC()==="win32"});return{stdout:n.stdout??"",stderr:n.stderr??"",timedOut:n.signal==="SIGTERM"||n.error?.code==="ETIMEDOUT",code:n.status}}function wCe(t,e,r){let n=JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2024-11-05",capabilities:{},clientInfo:{name:"clad-doctor-hosts",version:"1"}}}),i=JSON.stringify({jsonrpc:"2.0",method:"notifications/initialized"}),o=JSON.stringify({jsonrpc:"2.0",id:2,method:"tools/list",params:{}}),s=`${n} ${i} ${o} @@ -724,7 +724,7 @@ ${l}`)}if(o.length>=PX)break}if(o.length>=PX)break}o.length>0&&r.push({layer:n,s `).slice(0,80).join(` `),testPath:s?.relPath,testContent:s?s.content.split(` `).slice(0,60).join(` -`):void 0})}return e.sort((r,n)=>r.layer.localeCompare(n.layer)),e}import{existsSync as cn,readFileSync as S1,readdirSync as BX,statSync as ws}from"node:fs";import{basename as HX,dirname as Eyt,join as wr,relative as w1,sep as x1}from"node:path";var UDe=["src","lib","app","pkg","cmd","internal"],qDe=["packages","apps","crates"];function $1(t){if(t.override&&t.override.length>0)return t.override.map(n=>Li(t.cwd,n,void 0,"cli-override")).filter(n=>n!==null);let e=BDe(t.cwd);if(e.length>0)return e;let r=KDe(t.cwd);return r.length>0?r:[]}function Li(t,e,r,n){let i=wr(t,e);return!cn(i)||!ws(i).isDirectory()?null:{absPath:i,relPath:w1(t,i).split(x1).join("/"),workspaceName:r,source:n}}function BDe(t){let e=[];return e.push(...GDe(t)),e.push(...ZDe(t)),e.push(...VDe(t)),e.push(...WDe(t)),e.push(...HDe(t)),k1(e)}function HDe(t){if(!["build.gradle.kts","build.gradle","pom.xml"].some(n=>cn(wr(t,n))))return[];let r=[];for(let n of["src/main/kotlin","src/main/java","src/test/kotlin","src/test/java"]){let i=Li(t,n,void 0,"manifest");i&&r.push(i)}return r}function GDe(t){let e=wr(t,"package.json");if(!cn(e))return[];let r;try{r=JSON.parse(S1(e,"utf8"))}catch{return[]}let n=Array.isArray(r.workspaces)?r.workspaces:r.workspaces&&typeof r.workspaces=="object"&&"packages"in r.workspaces?r.workspaces.packages??[]:[];if(n.length===0)return[];let i=[];for(let o of n){let s=JDe(t,o);for(let a of s){let c=wr(a.abs,"src"),l=cn(c)&&ws(c).isDirectory()?c:a.abs,u=Li(t,w1(t,l).split(x1).join("/"),a.name,"manifest");u&&i.push(u)}}return i}function ZDe(t){let e=wr(t,"pyproject.toml");if(!cn(e))return[];let r=S1(e,"utf8"),n=[];for(let i of r.matchAll(/include\s*=\s*['"]([\w./-]+)['"]/g)){let o=Li(t,i[1],void 0,"manifest");o&&n.push(o)}for(let i of r.matchAll(/packages\s*=\s*\[([^\]]*)\]/g))for(let o of i[1].matchAll(/['"]([\w./-]+)['"]/g)){let s=Li(t,o[1],void 0,"manifest");s&&n.push(s)}return k1(n)}function VDe(t){let e=wr(t,"Cargo.toml");if(!cn(e))return[];let r=S1(e,"utf8"),n=[],i=r.match(/\[workspace\][\s\S]*?members\s*=\s*\[([^\]]*)\]/);if(i){for(let s of i[1].matchAll(/['"]([\w./-]+)['"]/g)){let a=s[1],c=wr(t,a,"src"),l=cn(c)?`${a}/src`:a,u=Li(t,l,HX(a),"manifest");u&&n.push(u)}return n}let o=Li(t,"src",void 0,"manifest");return o?[o]:[]}function WDe(t){let e=wr(t,"go.mod");if(!cn(e))return[];let r=[];for(let n of["cmd","internal","pkg"]){let i=Li(t,n,void 0,"manifest");i&&r.push(i)}return r}function KDe(t){let e=[];for(let r of UDe){let n=Li(t,r,void 0,"heuristic");n&&e.push(n)}for(let r of qDe){let n=wr(t,r);if(!(!cn(n)||!ws(n).isDirectory()))for(let i of BX(n)){if(i.startsWith("."))continue;let o=wr(n,i);if(!ws(o).isDirectory())continue;let s=wr(o,"src"),a=cn(s)&&ws(s).isDirectory()?s:o,c=w1(t,a).split(x1).join("/"),l=Li(t,c,i,"heuristic");l&&e.push(l)}}return k1(e)}function k1(t){let e=new Set,r=[];for(let n of t)e.has(n.absPath)||(e.add(n.absPath),r.push(n));return r}function JDe(t,e){if(!e.includes("*")){let a=wr(t,e);return!cn(a)||!ws(a).isDirectory()?[]:[{abs:a,name:HX(a)}]}let r=e.split("/"),n=r.findIndex(a=>a.includes("*"));if(n===-1)return[];let i=wr(t,...r.slice(0,n));if(!cn(i)||!ws(i).isDirectory())return[];let o=r.slice(n+1).join("/"),s=[];for(let a of BX(i)){if(a.startsWith("."))continue;let c=o?wr(i,a,o):wr(i,a);!cn(c)||!ws(c).isDirectory()||s.push({abs:c,name:a})}return s}function GX(t){return[]}import{extname as ZX}from"node:path";function VX(t,e){let r={};for(let i of t){let o=g1[ZX(i.path)]??"other";r[o]=(r[o]??0)+1}let n=null;for(let i of Object.entries(r))(!n||i[1]>n[1])&&(n=i);return{filesScanned:t.length,languagesSeen:Array.from(new Set(t.map(i=>ZX(i.path)))).sort(),languageCounts:r,dominantLanguage:n?.[0]??"unknown",sourceRoot:e}}import{readdirSync as YDe,readFileSync as XDe,statSync as QDe}from"node:fs";import{basename as WX,extname as YX,join as eNe,relative as tNe}from"node:path";function E1(t,e){let r=YX(t),n=t.slice(0,t.length-r.length);return e.has(n)||e.has(n.toLowerCase())}function A1(t){let e=t.root,r=t.extensions??f1,n=new Set(t.ignore??p1),i=t.maxFiles??500,o=t.perDirCap??50,s=t.entrypoints??h1,a=[],c=[e];for(;c.length>0&&a.length{let g=E1(WX(m),s)?0:1,b=E1(WX(h),s)?0:1;return g!==b?g-b:m.localeCompare(h)});let p=0;for(let m of d){if(a.length>=i||p>=o)break;let h=XDe(m,"utf8");a.push({path:m,relPath:tNe(e,m),content:h,loc:h.split(` +`):void 0})}return e.sort((r,n)=>r.layer.localeCompare(n.layer)),e}import{existsSync as cn,readFileSync as S1,readdirSync as BX,statSync as ws}from"node:fs";import{basename as HX,dirname as kyt,join as wr,relative as w1,sep as x1}from"node:path";var UDe=["src","lib","app","pkg","cmd","internal"],qDe=["packages","apps","crates"];function $1(t){if(t.override&&t.override.length>0)return t.override.map(n=>Li(t.cwd,n,void 0,"cli-override")).filter(n=>n!==null);let e=BDe(t.cwd);if(e.length>0)return e;let r=KDe(t.cwd);return r.length>0?r:[]}function Li(t,e,r,n){let i=wr(t,e);return!cn(i)||!ws(i).isDirectory()?null:{absPath:i,relPath:w1(t,i).split(x1).join("/"),workspaceName:r,source:n}}function BDe(t){let e=[];return e.push(...GDe(t)),e.push(...ZDe(t)),e.push(...VDe(t)),e.push(...WDe(t)),e.push(...HDe(t)),k1(e)}function HDe(t){if(!["build.gradle.kts","build.gradle","pom.xml"].some(n=>cn(wr(t,n))))return[];let r=[];for(let n of["src/main/kotlin","src/main/java","src/test/kotlin","src/test/java"]){let i=Li(t,n,void 0,"manifest");i&&r.push(i)}return r}function GDe(t){let e=wr(t,"package.json");if(!cn(e))return[];let r;try{r=JSON.parse(S1(e,"utf8"))}catch{return[]}let n=Array.isArray(r.workspaces)?r.workspaces:r.workspaces&&typeof r.workspaces=="object"&&"packages"in r.workspaces?r.workspaces.packages??[]:[];if(n.length===0)return[];let i=[];for(let o of n){let s=JDe(t,o);for(let a of s){let c=wr(a.abs,"src"),l=cn(c)&&ws(c).isDirectory()?c:a.abs,u=Li(t,w1(t,l).split(x1).join("/"),a.name,"manifest");u&&i.push(u)}}return i}function ZDe(t){let e=wr(t,"pyproject.toml");if(!cn(e))return[];let r=S1(e,"utf8"),n=[];for(let i of r.matchAll(/include\s*=\s*['"]([\w./-]+)['"]/g)){let o=Li(t,i[1],void 0,"manifest");o&&n.push(o)}for(let i of r.matchAll(/packages\s*=\s*\[([^\]]*)\]/g))for(let o of i[1].matchAll(/['"]([\w./-]+)['"]/g)){let s=Li(t,o[1],void 0,"manifest");s&&n.push(s)}return k1(n)}function VDe(t){let e=wr(t,"Cargo.toml");if(!cn(e))return[];let r=S1(e,"utf8"),n=[],i=r.match(/\[workspace\][\s\S]*?members\s*=\s*\[([^\]]*)\]/);if(i){for(let s of i[1].matchAll(/['"]([\w./-]+)['"]/g)){let a=s[1],c=wr(t,a,"src"),l=cn(c)?`${a}/src`:a,u=Li(t,l,HX(a),"manifest");u&&n.push(u)}return n}let o=Li(t,"src",void 0,"manifest");return o?[o]:[]}function WDe(t){let e=wr(t,"go.mod");if(!cn(e))return[];let r=[];for(let n of["cmd","internal","pkg"]){let i=Li(t,n,void 0,"manifest");i&&r.push(i)}return r}function KDe(t){let e=[];for(let r of UDe){let n=Li(t,r,void 0,"heuristic");n&&e.push(n)}for(let r of qDe){let n=wr(t,r);if(!(!cn(n)||!ws(n).isDirectory()))for(let i of BX(n)){if(i.startsWith("."))continue;let o=wr(n,i);if(!ws(o).isDirectory())continue;let s=wr(o,"src"),a=cn(s)&&ws(s).isDirectory()?s:o,c=w1(t,a).split(x1).join("/"),l=Li(t,c,i,"heuristic");l&&e.push(l)}}return k1(e)}function k1(t){let e=new Set,r=[];for(let n of t)e.has(n.absPath)||(e.add(n.absPath),r.push(n));return r}function JDe(t,e){if(!e.includes("*")){let a=wr(t,e);return!cn(a)||!ws(a).isDirectory()?[]:[{abs:a,name:HX(a)}]}let r=e.split("/"),n=r.findIndex(a=>a.includes("*"));if(n===-1)return[];let i=wr(t,...r.slice(0,n));if(!cn(i)||!ws(i).isDirectory())return[];let o=r.slice(n+1).join("/"),s=[];for(let a of BX(i)){if(a.startsWith("."))continue;let c=o?wr(i,a,o):wr(i,a);!cn(c)||!ws(c).isDirectory()||s.push({abs:c,name:a})}return s}function GX(t){return[]}import{extname as ZX}from"node:path";function VX(t,e){let r={};for(let i of t){let o=g1[ZX(i.path)]??"other";r[o]=(r[o]??0)+1}let n=null;for(let i of Object.entries(r))(!n||i[1]>n[1])&&(n=i);return{filesScanned:t.length,languagesSeen:Array.from(new Set(t.map(i=>ZX(i.path)))).sort(),languageCounts:r,dominantLanguage:n?.[0]??"unknown",sourceRoot:e}}import{readdirSync as YDe,readFileSync as XDe,statSync as QDe}from"node:fs";import{basename as WX,extname as YX,join as eNe,relative as tNe}from"node:path";function E1(t,e){let r=YX(t),n=t.slice(0,t.length-r.length);return e.has(n)||e.has(n.toLowerCase())}function A1(t){let e=t.root,r=t.extensions??f1,n=new Set(t.ignore??p1),i=t.maxFiles??500,o=t.perDirCap??50,s=t.entrypoints??h1,a=[],c=[e];for(;c.length>0&&a.length{let g=E1(WX(m),s)?0:1,b=E1(WX(h),s)?0:1;return g!==b?g-b:m.localeCompare(h)});let p=0;for(let m of d){if(a.length>=i||p>=o)break;let h=XDe(m,"utf8");a.push({path:m,relPath:tNe(e,m),content:h,loc:h.split(` `).length}),p++}f.sort();for(let m of f)c.push(m)}return a}Nr();function Jp(t,e){if(t)try{Xr(t,Qr("sentinel_miss",e))}catch{}}var XX="";function QX(t){let e=t.conventions,r=t.examples.map(a=>`### ${a.layer} \u2014 ${a.modulePath} \`\`\` diff --git a/plugins/codex/skills/check/SKILL.md b/plugins/codex/skills/check/SKILL.md index 176c33a2..fe7bb3ea 100644 --- a/plugins/codex/skills/check/SKILL.md +++ b/plugins/codex/skills/check/SKILL.md @@ -10,7 +10,7 @@ Run `clad check` from the project root. Runs the 15 Iron Law stages — Type / L - `1` — at least one stage actually failed (fix-required). - `2` — every result is skip (no fail-required input on the project yet). -`--strict` promotes warn-severity drift findings to error, matching the CI / pre-publish gate. The Drift stage runs every active detector under `src/stages/detectors/` (37/37 as of v0.6.1 — `npm run build:plugin` Phase D recounts and writes the integer into `.claude-plugin/plugin.json`). +`--strict` promotes warn-severity drift findings to error, matching the CI / pre-publish gate. The Drift stage runs every active detector under `src/stages/detectors/` — `npm run build:plugin` Phase D recounts them and writes the integer into each plugin manifest (e.g. `plugins/claude-code/.claude-plugin/plugin.json`), so the number is never hand-maintained. `--internal` shows stage codes (`stage_1.1`) instead of business names (`Type`). Default is the business-name surface; the audit log keeps internal ids regardless. diff --git a/plugins/codex/skills/oracle/SKILL.md b/plugins/codex/skills/oracle/SKILL.md index 889f0782..578e37ef 100644 --- a/plugins/codex/skills/oracle/SKILL.md +++ b/plugins/codex/skills/oracle/SKILL.md @@ -1,5 +1,5 @@ --- -description: Author an IMPL-BLIND spec-conformance oracle for a feature's acceptance criterion, so the gate verifies the code matches the SPEC (not just the author's own tests). cladding calls no LLM — YOU spawn a blind sub-agent from a spec-only brief, then record it. Author ONLY what `clad oracle --required` lists (the policy worklist) — an empty worklist means do not author unless the user explicitly asks; out-of-policy recordings are labeled voluntary and spend beyond the project's declared verification budget. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +description: Author an IMPL-BLIND spec-conformance oracle for an acceptance criterion the policy worklist (`clad oracle --required`) demands — an empty worklist means don't author unless the user explicitly asks. YOU spawn a blind sub-agent from a spec-only brief, then record it. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding oracle — impl-blind conformance authoring diff --git a/plugins/codex/skills/planner/SKILL.md b/plugins/codex/skills/planner/SKILL.md index 7967b1e1..7736e7b7 100644 --- a/plugins/codex/skills/planner/SKILL.md +++ b/plugins/codex/skills/planner/SKILL.md @@ -33,7 +33,7 @@ You do NOT read Tier C (conventions — developer owns it) or Tier D (audit — ### Scenarios policy (v0.3.45+) -Scenarios are **onboarding output**, not feature-creation side-effect. `clad init ` extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). Pre-v0.3.30 auto-extraction from code is deprecated. +Scenarios are **onboarding output**, not feature-creation side-effect. Onboarding (host MCP flow, or CLI `clad init `) extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). Pre-v0.3.30 auto-extraction from code is deprecated. ## Project policy — `spec.yaml::project.ai_hints` diff --git a/plugins/codex/skills/serve/SKILL.md b/plugins/codex/skills/serve/SKILL.md index 09450402..db8c10e1 100644 --- a/plugins/codex/skills/serve/SKILL.md +++ b/plugins/codex/skills/serve/SKILL.md @@ -6,7 +6,7 @@ description: Boot cladding as an MCP server over stdio. Use only when the user w Run `clad serve` from the project root. Boots an MCP server over stdio that exposes: -- **Tools**: `clad_list_features`, `clad_get_feature`, `clad_run_check`, `clad_get_events`. +- **Tools**: the full development surface (feature/graph/context queries, checks, gate, changelog) plus the natural-language onboarding flow — `clad_prepare_init` / `clad_stage_init` / `clad_init` and the clarify pair. Before `spec.yaml` exists only the three onboarding bootstrap tools are exposed. - **Resources**: `cladding://spec`, `cladding://events`, `cladding://audit`. - **Prompts**: 5 personas (orchestrator, planner, reviewer, observability, developer). - **Live audit notifications**: `notifications/resources/updated` fires for `cladding://audit` whenever a new evidence entry lands — a subscribed client can live-tail the audit log without polling. diff --git a/skills/check/SKILL.md b/skills/check/SKILL.md index 176c33a2..fe7bb3ea 100644 --- a/skills/check/SKILL.md +++ b/skills/check/SKILL.md @@ -10,7 +10,7 @@ Run `clad check` from the project root. Runs the 15 Iron Law stages — Type / L - `1` — at least one stage actually failed (fix-required). - `2` — every result is skip (no fail-required input on the project yet). -`--strict` promotes warn-severity drift findings to error, matching the CI / pre-publish gate. The Drift stage runs every active detector under `src/stages/detectors/` (37/37 as of v0.6.1 — `npm run build:plugin` Phase D recounts and writes the integer into `.claude-plugin/plugin.json`). +`--strict` promotes warn-severity drift findings to error, matching the CI / pre-publish gate. The Drift stage runs every active detector under `src/stages/detectors/` — `npm run build:plugin` Phase D recounts them and writes the integer into each plugin manifest (e.g. `plugins/claude-code/.claude-plugin/plugin.json`), so the number is never hand-maintained. `--internal` shows stage codes (`stage_1.1`) instead of business names (`Type`). Default is the business-name surface; the audit log keeps internal ids regardless. diff --git a/skills/oracle/SKILL.md b/skills/oracle/SKILL.md index 889f0782..578e37ef 100644 --- a/skills/oracle/SKILL.md +++ b/skills/oracle/SKILL.md @@ -1,5 +1,5 @@ --- -description: Author an IMPL-BLIND spec-conformance oracle for a feature's acceptance criterion, so the gate verifies the code matches the SPEC (not just the author's own tests). cladding calls no LLM — YOU spawn a blind sub-agent from a spec-only brief, then record it. Author ONLY what `clad oracle --required` lists (the policy worklist) — an empty worklist means do not author unless the user explicitly asks; out-of-policy recordings are labeled voluntary and spend beyond the project's declared verification budget. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. +description: Author an IMPL-BLIND spec-conformance oracle for an acceptance criterion the policy worklist (`clad oracle --required`) demands — an empty worklist means don't author unless the user explicitly asks. YOU spawn a blind sub-agent from a spec-only brief, then record it. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. --- # Cladding oracle — impl-blind conformance authoring diff --git a/skills/serve/SKILL.md b/skills/serve/SKILL.md index 09450402..db8c10e1 100644 --- a/skills/serve/SKILL.md +++ b/skills/serve/SKILL.md @@ -6,7 +6,7 @@ description: Boot cladding as an MCP server over stdio. Use only when the user w Run `clad serve` from the project root. Boots an MCP server over stdio that exposes: -- **Tools**: `clad_list_features`, `clad_get_feature`, `clad_run_check`, `clad_get_events`. +- **Tools**: the full development surface (feature/graph/context queries, checks, gate, changelog) plus the natural-language onboarding flow — `clad_prepare_init` / `clad_stage_init` / `clad_init` and the clarify pair. Before `spec.yaml` exists only the three onboarding bootstrap tools are exposed. - **Resources**: `cladding://spec`, `cladding://events`, `cladding://audit`. - **Prompts**: 5 personas (orchestrator, planner, reviewer, observability, developer). - **Live audit notifications**: `notifications/resources/updated` fires for `cladding://audit` whenever a new evidence entry lands — a subscribed client can live-tail the audit log without polling. diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 7d8e2c05..533e67e2 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -18,14 +18,14 @@ attested_modules: .github/workflows/ci.yml: 8ea99219cb80df60 .gitignore: 1294975ba3b47043 CHANGELOG.md: 1524903097b4f9b0 - CLAUDE.md: d81d8832976cd5ee + CLAUDE.md: 16212c1749e6005d GOVERNANCE.md: 21cc28eaaf637a20 - README.html: ff98c3aaf8a6947f - README.ja.md: 299df920c0530e71 - README.ko.html: 35bde93f37db20eb - README.ko.md: 7f1394d857a95084 - README.md: cef6c17062f7d728 - README.zh.md: 65dac6ea9c2308cc + README.html: dd6c44fc6c151ad4 + README.ja.md: d4de131ac59941f8 + README.ko.html: a494606ab7bfce8e + README.ko.md: 45c1a27b3f25c983 + README.md: 5831410ed5c38337 + README.zh.md: a6aef09c240f2b62 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -56,7 +56,7 @@ attested_modules: docs/dogfood/cursor-agent-2026-07-15.md: a2f621fd0c3b57af docs/dogfood/gemini-cli-2026-05-20.md: 2da1ba66c4f108f0 docs/feature-cycle.md: b8c48c86d1f1e093 - docs/glossary.md: 1f2acc81a22cdd3e + docs/glossary.md: 9e897b963c3aa88f docs/img/en/ecosystem.svg: ed14d1d17f088b00 docs/img/en/relationship.svg: c7a24203925b4664 docs/img/ko/ecosystem.svg: 2b7341576c2af0a8 @@ -65,7 +65,7 @@ attested_modules: docs/refinement-backlog.md: 3e38d60bf987eef1 docs/setup.md: a5c062651d267983 docs/spec-ids-multi-dev.md: 28d58e84879f58b1 - docs/ssot-model.md: 13ac491b15bd77cd + docs/ssot-model.md: 66b9439e2f71ac4b docs/ssot-testing.md: abf3b2bd5acb29a1 package-lock.json: 84fce6dd31da5308 package.json: fb5fc393fb3f5e49 @@ -73,21 +73,21 @@ attested_modules: plugins/claude-code/agents/developer.md: 40af2943253f6c72 plugins/claude-code/agents/observability.md: 5ea8f14b1c9b4a61 plugins/claude-code/agents/orchestrator.md: 443c6e13ade590cf - plugins/claude-code/agents/planner.md: 934753c28d5f1287 + plugins/claude-code/agents/planner.md: 5750002ebdfb43f1 plugins/claude-code/agents/reviewer.md: 9c4e095e60040473 plugins/claude-code/commands/init.md: bf567f3b4e22069a plugins/claude-code/hooks/hooks.json: 42321ead26fb1da8 plugins/codex/.codex-plugin/plugin.json: 26d1bc595d1b996a plugins/codex/.mcp.json: 43e3f4b2af24aa18 - plugins/codex/skills/check/SKILL.md: 455d912ce1d47b5a + plugins/codex/skills/check/SKILL.md: 6a665422af510e72 plugins/codex/skills/developer/SKILL.md: 40af2943253f6c72 plugins/codex/skills/init/SKILL.md: bf567f3b4e22069a plugins/codex/skills/observability/SKILL.md: 5ea8f14b1c9b4a61 plugins/codex/skills/orchestrator/SKILL.md: 443c6e13ade590cf - plugins/codex/skills/planner/SKILL.md: 934753c28d5f1287 + plugins/codex/skills/planner/SKILL.md: 5750002ebdfb43f1 plugins/codex/skills/reviewer/SKILL.md: 9c4e095e60040473 plugins/codex/skills/run/SKILL.md: 9f95ff17d70c8dd1 - plugins/codex/skills/serve/SKILL.md: d65778260c663fbb + plugins/codex/skills/serve/SKILL.md: f08bbdbbfeb05041 plugins/codex/skills/status/SKILL.md: 09faadc50b3449da plugins/codex/skills/sync/SKILL.md: 775c0f990a52a3d9 plugins/gemini-cli/GEMINI.md: ba08eaf2cd557a65 @@ -101,16 +101,16 @@ attested_modules: scripts/test-count.d.mts: a392f5dea372a40e scripts/test-count.mjs: aea2620221c8d5ff scripts/version-bump.mjs: 770b066b8279db39 - skills/check/SKILL.md: 455d912ce1d47b5a + skills/check/SKILL.md: 6a665422af510e72 skills/checkpoint/SKILL.md: f723e8cfb8286a64 skills/clarify/SKILL.md: 5d08bbb821258d03 skills/doctor/SKILL.md: 6581c6c900c72d68 skills/init/SKILL.md: bf567f3b4e22069a - skills/oracle/SKILL.md: 0986572a0a5604f6 + skills/oracle/SKILL.md: 11e111ac0a4963c1 skills/rollback/SKILL.md: d472dc3a562b347b skills/route/SKILL.md: 5958830fef280c67 skills/run/SKILL.md: 9f95ff17d70c8dd1 - skills/serve/SKILL.md: d65778260c663fbb + skills/serve/SKILL.md: f08bbdbbfeb05041 skills/status/SKILL.md: 09faadc50b3449da skills/sync/SKILL.md: 775c0f990a52a3d9 spec.yaml: 59840b10bd055d32 @@ -133,13 +133,13 @@ attested_modules: src/adapters/sdk/anthropic.ts: 9debe5cc61f039f1 src/adapters/types.ts: f8e5643231a13e8d src/agents: a4d0f0eb87fed960 - src/agents/README.md: 9f41809958439db2 + src/agents/README.md: b9fe459af1d36e8d src/agents/blind-author.md: e9d2977f9879d3f9 src/agents/developer.md: 40af2943253f6c72 src/agents/loader.ts: 6d35560c47f9ae85 src/agents/observability.md: 5ea8f14b1c9b4a61 src/agents/orchestrator.md: 443c6e13ade590cf - src/agents/planner.md: 934753c28d5f1287 + src/agents/planner.md: 5750002ebdfb43f1 src/agents/reviewer.md: 9c4e095e60040473 src/changelog/collect.ts: a6c936a7b8c34e2a src/changelog/render.ts: 83dd2d95f24ca68c @@ -203,8 +203,8 @@ attested_modules: src/hitl/identity.ts: 52ff84aa666f1dab src/init/agents-md.ts: 7dc05f6d82e5c3ce src/init/git-hook.ts: 4e02f177b3764ae8 - src/init/host-instructions.ts: b6dbb40fadbf4c2d - src/init/host-setup.ts: aa953fda8e37a197 + src/init/host-instructions.ts: 7a066c646f0b6133 + src/init/host-setup.ts: 158cc9306a746da1 src/optimizer: a4d0f0eb87fed960 src/optimizer/code-excerpt.ts: e2c4598efcd28d2a src/optimizer/context-slice.ts: b5864aaed1e7ae48 diff --git a/spec/features/agent-interpreter-rule-723c81dd.yaml b/spec/features/agent-interpreter-rule-723c81dd.yaml index 38d09642..0144b761 100644 --- a/spec/features/agent-interpreter-rule-723c81dd.yaml +++ b/spec/features/agent-interpreter-rule-723c81dd.yaml @@ -13,7 +13,7 @@ modules: acceptance_criteria: - id: AC-ad928912 ears: ubiquitous - text: "The injected CLAUDE.md section and the AGENTS.md template shall carry an interpreter rule: when reporting to the user, translate cladding terms into plain words in the user's own language and never lead with internal ids — with both freshness literals preserved verbatim." + text: "The injected CLAUDE.md section and the spec-driven AGENTS.md managed block shall carry an interpreter rule: when reporting to the user, translate cladding terms into plain words in the user's own language and never lead with internal ids — with both freshness literals preserved verbatim." notes: "## Why\nThe adopter screenshot shows the agent saying 'Shard AC 3개 추가 완료' — cladding's injected instructions teach shard-vocabulary and nothing tells the agent to translate. The rule is the third layer: hooks render plain (U2), cards drop jargon (U3), and the agent's own sentences translate (U4)." test_refs: [tests/agent-interpreter-rule.test.ts] - id: AC-6bf501f8 diff --git a/spec/features/setup-command-80d19d.yaml b/spec/features/setup-command-80d19d.yaml index 5bd857f2..049d0250 100644 --- a/spec/features/setup-command-80d19d.yaml +++ b/spec/features/setup-command-80d19d.yaml @@ -148,17 +148,15 @@ acceptance_criteria: - "tests/cli/setup.test.ts#cursor legacy cleanup drops an emptied mcpServers object instead of leaving an orphan" - id: AC-013 ears: event - condition: when `clad init` runs and a project-local AGENTS.md or CLAUDE.md exists that carries v0.3.x markers (e.g. `_meta.enrichment_status`, `first-task enrichment rule`, lone `clad_create_feature` MCP tool wording with no `clad` CLI qualifier) - action: refresh the stale file in place (AGENTS.md replaced wholesale; CLAUDE.md replaces only the `## cladding` section while preserving user content outside that marker block) + condition: when `clad init` runs and a project-local CLAUDE.md exists whose `## cladding` section carries v0.3.x markers (e.g. `_meta.enrichment_status`, `first-task enrichment rule`, lone `clad_create_feature` MCP tool wording with no `clad` CLI qualifier) + action: refresh only the `## cladding` section in place while preserving user content outside that marker block (AGENTS.md is handled separately by the spec-driven managed block, which treats markerless files as user-owned and never rewrites them wholesale) response: AI sessions opened in projects scaffolded by older cladding versions do not surface stale "use the MCP tool" guidance that triggers spurious MCP-server prompts in hosts where cladding is not wired as an MCP server (e.g. Claude Code) - text: When `clad init` runs and an existing AGENTS.md or CLAUDE.md carries - v0.3.x markers, the system shall refresh the stale file in place - without requiring `--force` (AGENTS.md replaced wholesale; CLAUDE.md - replaces only the `## cladding` section while preserving outside - content), so AI sessions do not surface stale guidance that confuses - hosts where cladding is not wired as an MCP server. + text: When `clad init` runs and an existing CLAUDE.md `## cladding` + section carries v0.3.x markers, the system shall refresh that section + in place without requiring `--force` while preserving user content + outside the marker block, so AI sessions do not surface stale guidance + that confuses hosts where cladding is not wired as an MCP server. test_refs: - - "tests/init/host-instructions.test.ts#refreshes stale v0.3.x AGENTS.md without --force" - "tests/init/host-instructions.test.ts#refreshes only the ## cladding section when v0.3.x markers are present" - id: AC-014 ears: state diff --git a/spec/features/spec-driven-agents-md-a4085adf.yaml b/spec/features/spec-driven-agents-md-a4085adf.yaml index 9e96bdc6..15fec3b7 100644 --- a/spec/features/spec-driven-agents-md-a4085adf.yaml +++ b/spec/features/spec-driven-agents-md-a4085adf.yaml @@ -11,7 +11,7 @@ acceptance_criteria: ears: state condition: "while an adopting project's spec declares project.ai_hints" text: "While an adopting project's spec declares project.ai_hints, clad init and clad sync shall render the AGENTS.md managed block from that spec — the project's test framework, primary branch, forbidden and preferred patterns, and preferred persona — instead of a static template." - notes: "Today src/init/host-instructions.ts writes a static AGENTS_MD_TEMPLATE with zero spec interpolation. Source fields: spec.yaml::project.ai_hints (F-5b9f9f/F-32b1e0) + project name/intent." + notes: "Historical: pre-0.9.0 host-instructions.ts wrote a static template with zero spec interpolation; it was removed once this managed block became the sole AGENTS.md writer. Source fields: spec.yaml::project.ai_hints (F-5b9f9f/F-32b1e0) + project name/intent." - id: AC-2c8b5f61 test_refs: - tests/init/agents-md.test.ts diff --git a/src/agents/README.md b/src/agents/README.md index db8e0af1..5b8c01c5 100644 --- a/src/agents/README.md +++ b/src/agents/README.md @@ -8,7 +8,7 @@ ironclad-track: T9 (multi-agent orchestrator) ## [CLAIM] -The 5 agent personas — orchestrator · planner (formerly `librarian`) · reviewer · observability · developer (formerly `specialists`) — each shipped as a Claude Code subagent (frontmatter + system prompt). Their canonical source lives in this directory; `npm run build:plugin` mirrors them into `agents/`, `plugins/codex/skills/`, and `plugins/gemini-cli/commands/`. +The 6 agent personas — orchestrator · planner (formerly `librarian`) · reviewer · observability · developer (formerly `specialists`) · blind-author — each shipped as a Claude Code subagent (frontmatter + system prompt). Their canonical source lives in this directory; `npm run build:plugin` mirrors them into `plugins/claude-code/agents/`, `plugins/codex/skills/`, and `plugins/antigravity/skills/`. ## [PERSONAS] @@ -21,6 +21,7 @@ Each persona's individual `.md` carries a "Sources (what you read, by Tier)" sec | `reviewer` | Philosophical guardrails; independent audit | Read, Bash | A + B + C + D evidence | (none — audit only) | | `observability` | Log + metrics analyst | Read, Bash | D only (events.log, audit.log, perf, coverage) | (reports only) | | `developer` | Implementer (code, tests, migrations) | Read, Write, Edit, Bash | B (project-context, architecture, capabilities) + C (conventions) + A (current feature slice) | stages/, tests/, hitl/ | +| `blind-author` | Impl-blind test/oracle author (no Read/Grep/Glob/Edit by construction) | Write, Bash | A (acceptance criteria + module signatures only — never the implementation) | tests/ (conformance oracles) | ## [INVOCATION_PRINCIPLES] @@ -56,4 +57,4 @@ Cross-boundary rules: ## [TBD] -- Routing config (`src/agents/routing.yaml`) with intent → agent mapping. `commands/clad.md` is the single user-facing verb manifest today; per-verb skills live under `skills//SKILL.md` (auto-mirrored to `commands/.md`, `plugins/codex/skills/.md`, `plugins/gemini-cli/commands/.md`). +- Routing config (`src/agents/routing.yaml`) with intent → agent mapping. Per-verb skills live under `skills//SKILL.md`, auto-mirrored to `plugins/codex/skills//` and `plugins/antigravity/skills//` (Gemini receives only the init command as `plugins/gemini-cli/commands/init.toml`). diff --git a/src/agents/planner.md b/src/agents/planner.md index 7967b1e1..7736e7b7 100644 --- a/src/agents/planner.md +++ b/src/agents/planner.md @@ -33,7 +33,7 @@ You do NOT read Tier C (conventions — developer owns it) or Tier D (audit — ### Scenarios policy (v0.3.45+) -Scenarios are **onboarding output**, not feature-creation side-effect. `clad init ` extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). Pre-v0.3.30 auto-extraction from code is deprecated. +Scenarios are **onboarding output**, not feature-creation side-effect. Onboarding (host MCP flow, or CLI `clad init `) extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). Pre-v0.3.30 auto-extraction from code is deprecated. ## Project policy — `spec.yaml::project.ai_hints` diff --git a/src/init/host-instructions.ts b/src/init/host-instructions.ts index fb35fca7..ddda2c65 100644 --- a/src/init/host-instructions.ts +++ b/src/init/host-instructions.ts @@ -1,9 +1,12 @@ // F-90d054 — project-local host AI instruction writers. // // Writes: -// • /AGENTS.md — cross-tool (Codex/Cursor/Continue/Copilot/Aider) // • /CLAUDE.md — Claude Code memory (idempotent append) // +// AGENTS.md is NOT written here anymore: the spec-driven managed block +// (src/init/agents-md.ts, F-a4085adf) replaced the old static template, and a +// markerless file is treated as user-owned and never rewritten. +// // Does NOT write `.mcp.json`, `.codex/config.toml`, or the other host MCP // wiring files — those are project-local since 0.9.0 and are written by // `clad setup` (src/init/host-setup.ts), never at npm install time. @@ -11,55 +14,6 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs'; import { join } from 'node:path'; -export const AGENTS_MD_TEMPLATE = `# AGENTS.md - -This project is managed by **cladding** — the Spec-Anchored Agent Harness. - -## Single Source of Truth - -- \`spec.yaml\` is the authoritative spec (Tier A). Code must conform. -- \`spec/features/-.yaml\` holds individual feature shards. - Never hand-author \`F-NNN\` filenames — ask cladding via the \`clad\` - CLI (or, when your host has cladding wired as an MCP server, - \`clad_create_feature\`). -- \`docs/project-context.md\` is the Tier B design SSoT. -- Run \`clad check --strict\` to verify spec ↔ code drift across every - drift detector. - -## Feature cycle — one at a time - -Work ONE feature end-to-end before starting the next: author its shard -**with** \`acceptance_criteria\` (+ \`modules\`) → implement → author its -tests in a separate context → mark it done with \`clad done \` -(it sets \`status: done\` ONLY when \`clad check --tier=pre-push --strict\` -is GREEN, reverting otherwise) → only then the next feature. Do NOT author -feature shards ahead of the code, and do NOT hand-write \`status: done\`. -Independent features (no shared \`modules\`) may run as parallel instances -of this same cycle. Enforced by the \`PLANNED_BACKLOG\` detector; rationale -in \`docs/feature-cycle.md\`. - -## Persona separation (anti-self-cert) - -The agent that writes a unit of work must not be the agent that signs off -on it. planner writes spec, reviewer audits, developer implements. - -## Speak the user's language - -When you report progress to the user, translate cladding's vocabulary into -plain words in the user's own language — a shard is a spec entry, an -attestation is a signed sign-off, a detector finding is what drifted and why -it matters. This includes cladding's own gate and hook messages: relay them in -the user's language, by meaning, rather than echoing the raw text. Never lead -with an internal id (\`F-…\`, \`AC-…\`, \`stage_X.Y\`): name the feature and the -plain outcome instead. - -## More - -See \`CLAUDE.md\` for Claude Code-specific memory, and -\`spec/architecture.yaml\` for the layer / \`forbidden_imports\` invariants -enforced by \`ARCHITECTURE_FROM_SPEC\`. -`; - export const CLAUDE_MD_SECTION_MARKER = '## cladding'; export const CLAUDE_MD_SECTION = `## cladding @@ -133,28 +87,6 @@ export type ClaudeMdResult = | 'unchanged' | 'refreshed-stale'; -export function writeAgentsMd( - targetDir: string, - opts: { readonly force?: boolean } = {}, -): AgentsMdResult { - const path = join(targetDir, 'AGENTS.md'); - const existed = existsSync(path); - if (!existed) { - writeFileSync(path, AGENTS_MD_TEMPLATE); - return 'created'; - } - if (opts.force) { - writeFileSync(path, AGENTS_MD_TEMPLATE); - return 'overwritten'; - } - const existing = readFileSync(path, 'utf8'); - if (isStaleInstructions(existing)) { - writeFileSync(path, AGENTS_MD_TEMPLATE); - return 'refreshed-stale'; - } - return 'skipped-exists'; -} - export function writeClaudeMdSection( targetDir: string, opts: { readonly force?: boolean } = {}, diff --git a/src/init/host-setup.ts b/src/init/host-setup.ts index 658b4411..dfe87fe7 100644 --- a/src/init/host-setup.ts +++ b/src/init/host-setup.ts @@ -14,7 +14,6 @@ import { readlinkSync, readdirSync, rmSync, - statSync, writeFileSync, } from 'node:fs'; import {homedir, platform} from 'node:os'; @@ -28,7 +27,7 @@ export type ChannelResult = | 'rewired' | 'removed' | 'skipped-different' - | 'skipped-not-installed' + | 'skipped-not-selected' | 'manual-required' | 'failed'; @@ -145,6 +144,13 @@ function pathInside(path: string, root: string): boolean { return delta === '' || (!delta.startsWith('..') && !isAbsolute(delta)); } +/** + * Ownership roots for legacy-cleanup gating. The HOME-tier status file is a + * frozen pre-0.9.0 artifact: only the old global installer wrote it, 0.9.0+ + * setup writes the PROJECT-tier status file and never updates the home one — + * it is read here purely so wires created by that old install stay provably + * ours across engine moves. + */ function knownRoots(home: string, pkgRoot: string): string[] { const roots = [resolve(pkgRoot)]; const legacy = readText(join(home, '.cladding', STATUS_FILENAME)); @@ -392,12 +398,6 @@ function ignoreLocalRuntime(projectRoot: string): void { writeFileSync(exclude, `${current}${separator}${missing.join('\n')}\n`, 'utf8'); } -/** Retained for callers that need the direct engine launch shape. */ -export function resolveServeLaunch(pkgRoot: string): {command: string; args: string[]} { - const engine = join(pkgRoot, 'dist', 'clad.js'); - return existsSync(engine) ? {command: 'node', args: [engine, 'serve']} : {command: 'clad', args: ['serve']}; -} - function mcpLaunch(): {command: string; args: string[]} { return {command: 'node', args: [RUNTIME_RELATIVE]}; } @@ -600,10 +600,10 @@ export async function runHostSetup(opts: SetupOptions = {}): Promise { +describe('AC-ad928912 · CLAUDE_MD_SECTION + the AGENTS.md managed block carry the interpreter rule', () => { test('CLAUDE_MD_SECTION leads with the "Speak the user\'s language" anchor', () => { expect(CLAUDE_MD_SECTION).toContain("**Speak the user's language**"); }); @@ -66,15 +71,15 @@ describe('AC-ad928912 · CLAUDE_MD_SECTION + AGENTS_MD_TEMPLATE carry the interp expect(flat).toContain('plain words'); }); - test('AGENTS_MD_TEMPLATE carries the equivalent "Speak the user\'s language" section', () => { - expect(AGENTS_MD_TEMPLATE).toContain("## Speak the user's language"); - const flat = norm(AGENTS_MD_TEMPLATE); + test('the AGENTS.md managed block carries the equivalent "Speak the user\'s language" section', () => { + expect(AGENTS_MD_BLOCK).toContain("## Speak the user's language"); + const flat = norm(AGENTS_MD_BLOCK); expect(flat).toMatch(USERS_OWN_LANGUAGE); expect(flat).toMatch(NEVER_LEAD_WITH_IDS); }); test('both freshness literals survive verbatim in both templates', () => { - for (const tpl of [CLAUDE_MD_SECTION, AGENTS_MD_TEMPLATE]) { + for (const tpl of [CLAUDE_MD_SECTION, AGENTS_MD_BLOCK]) { expect(tpl).toContain('anti-self-cert'); expect(tpl).toContain('Feature cycle — one at a time'); } @@ -82,7 +87,7 @@ describe('AC-ad928912 · CLAUDE_MD_SECTION + AGENTS_MD_TEMPLATE carry the interp test('round trip holds: a freshly emitted section of either template is NOT stale (no re-sync churn)', () => { expect(isStaleInstructions(CLAUDE_MD_SECTION)).toBe(false); - expect(isStaleInstructions(AGENTS_MD_TEMPLATE)).toBe(false); + expect(isStaleInstructions(AGENTS_MD_BLOCK)).toBe(false); }); test('CLAUDE_MD_SECTION stays under the 1250-byte ceiling (measured in bytes, not UTF-16 code units)', () => { diff --git a/tests/claude-md-diet.test.ts b/tests/claude-md-diet.test.ts index bac68358..643c2311 100644 --- a/tests/claude-md-diet.test.ts +++ b/tests/claude-md-diet.test.ts @@ -19,7 +19,10 @@ import {readFileSync} from 'node:fs'; import {join} from 'node:path'; import {describe, expect, test} from 'vitest'; -import {AGENTS_MD_TEMPLATE, CLAUDE_MD_SECTION, isStaleInstructions} from '../src/init/host-instructions.js'; +import {CLAUDE_MD_SECTION, isStaleInstructions} from '../src/init/host-instructions.js'; +import {renderAgentsMdManagedBlock} from '../src/init/agents-md.js'; + +const AGENTS_MD_BLOCK = renderAgentsMdManagedBlock(null); const ROOT = process.cwd(); const read = (rel: string): string => readFileSync(join(ROOT, rel), 'utf8'); @@ -33,12 +36,12 @@ describe('AC-b07dce5d · both freshness literals survive verbatim in the emitted expect(CLAUDE_MD_SECTION).toContain('Feature cycle — one at a time'); }); - // Symmetric pin: AGENTS_MD_TEMPLATE is out of scope for the diet but carries - // the same signature literal today (checked directly, not assumed) — if a - // future edit drops it there too, isStaleInstructions would misjudge a - // cladding-authored AGENTS.md as arbitrary user prose and never re-sync it. - test('AGENTS_MD_TEMPLATE also carries the anti-self-cert signature literal', () => { - expect(AGENTS_MD_TEMPLATE).toContain('anti-self-cert'); + // Symmetric pin: the spec-driven AGENTS.md managed block is out of scope for + // the diet but carries the same signature literal today (checked directly, + // not assumed) — the anti-self-cert wording is the cross-host freshness + // signature shared by both instruction surfaces. + test('the AGENTS.md managed block also carries the anti-self-cert signature literal', () => { + expect(AGENTS_MD_BLOCK).toContain('anti-self-cert'); }); }); diff --git a/tests/cli/setup.test.ts b/tests/cli/setup.test.ts index 465972d0..f04c57e3 100644 --- a/tests/cli/setup.test.ts +++ b/tests/cli/setup.test.ts @@ -71,11 +71,11 @@ describe('project-scoped runHostSetup', () => { const bareHome = mkdtempSync(join(tmpdir(), 'clad-barehome-')); try { const result = await runHostSetup({home: bareHome, projectRoot: project, pkgRoot, quiet: true, activate: false}); - expect(result.wiring.claude).toBe('skipped-not-installed'); - expect(result.wiring.codex).toBe('skipped-not-installed'); - expect(result.wiring.gemini).toBe('skipped-not-installed'); - expect(result.wiring.antigravity).toBe('skipped-not-installed'); - expect(result.wiring.cursor).toBe('skipped-not-installed'); + expect(result.wiring.claude).toBe('skipped-not-selected'); + expect(result.wiring.codex).toBe('skipped-not-selected'); + expect(result.wiring.gemini).toBe('skipped-not-selected'); + expect(result.wiring.antigravity).toBe('skipped-not-selected'); + expect(result.wiring.cursor).toBe('skipped-not-selected'); expect(existsSync(join(project, '.codex'))).toBe(false); expect(existsSync(join(project, '.cursor'))).toBe(false); expect(result.warnings.some((w) => w.step === 'hosts')).toBe(true); @@ -290,7 +290,7 @@ describe('project-scoped runHostSetup', () => { test('delta-wires a host that appears after the first run, leaving wired ones untouched', async () => { rmSync(join(home, '.cursor'), {recursive: true, force: true}); const first = await runHostSetup({home, projectRoot: project, pkgRoot, quiet: true, activate: false}); - expect(first.wiring.cursor).toBe('skipped-not-installed'); + expect(first.wiring.cursor).toBe('skipped-not-selected'); expect(existsSync(join(project, '.cursor'))).toBe(false); mkdirSync(join(home, '.cursor'), {recursive: true}); diff --git a/tests/init/host-instructions.test.ts b/tests/init/host-instructions.test.ts index 6416947c..fcdf49eb 100644 --- a/tests/init/host-instructions.test.ts +++ b/tests/init/host-instructions.test.ts @@ -4,83 +4,19 @@ // and AC-010 (CLAUDE.md `## cladding` section appended idempotently when // present). -import {existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync} from 'node:fs'; +import {mkdtempSync, readFileSync, rmSync, writeFileSync} from 'node:fs'; import {tmpdir} from 'node:os'; import {join} from 'node:path'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; +import {renderAgentsMdManagedBlock} from '../../src/init/agents-md.js'; import { - AGENTS_MD_TEMPLATE, - CLAUDE_MD_SECTION, + CLAUDE_MD_SECTION, CLAUDE_MD_SECTION_MARKER, isStaleInstructions, - writeAgentsMd, writeClaudeMdSection, } from '../../src/init/host-instructions.js'; -describe('writeAgentsMd (F-90d054 AC-008)', () => { - let dir: string; - beforeEach(() => { - dir = mkdtempSync(join(tmpdir(), 'clad-host-instr-')); - }); - afterEach(() => { - rmSync(dir, {recursive: true, force: true}); - }); - - test('creates AGENTS.md when absent', () => { - const r = writeAgentsMd(dir); - expect(r).toBe('created'); - expect(existsSync(join(dir, 'AGENTS.md'))).toBe(true); - expect(readFileSync(join(dir, 'AGENTS.md'), 'utf8')).toBe(AGENTS_MD_TEMPLATE); - }); - - test('skips when AGENTS.md already exists (no --force)', () => { - writeFileSync(join(dir, 'AGENTS.md'), '# user-authored\n'); - const r = writeAgentsMd(dir); - expect(r).toBe('skipped-exists'); - expect(readFileSync(join(dir, 'AGENTS.md'), 'utf8')).toBe('# user-authored\n'); - }); - - test('overwrites when --force', () => { - writeFileSync(join(dir, 'AGENTS.md'), '# user-authored\n'); - const r = writeAgentsMd(dir, {force: true}); - expect(r).toBe('overwritten'); - expect(readFileSync(join(dir, 'AGENTS.md'), 'utf8')).toBe(AGENTS_MD_TEMPLATE); - }); - - // F-80d19d (v0.4.0) — removed F-90d054's `enrichment_status` rule from the - // AGENTS.md template since project-scope plugin auto-activation now - // guarantees an AI session at `clad init` time. - - test('refreshes stale v0.3.x AGENTS.md without --force', () => { - const stale = [ - '# AGENTS.md', - '', - 'This project is managed by **cladding**.', - '', - '## cladding — first-task enrichment rule', - '', - 'If `spec.yaml._meta.enrichment_status` equals "pending", run enrichment.', - '', - '- Never hand-author `F-NNN` filenames — use `clad_create_feature` MCP', - ' tool.', - '', - ].join('\n'); - writeFileSync(join(dir, 'AGENTS.md'), stale); - const r = writeAgentsMd(dir); - expect(r).toBe('refreshed-stale'); - expect(readFileSync(join(dir, 'AGENTS.md'), 'utf8')).toBe(AGENTS_MD_TEMPLATE); - }); - - test('does not refresh AGENTS.md that lacks v0.3.x markers', () => { - const userBody = '# AGENTS.md\n\nMy own notes — nothing about cladding.\n'; - writeFileSync(join(dir, 'AGENTS.md'), userBody); - const r = writeAgentsMd(dir); - expect(r).toBe('skipped-exists'); - expect(readFileSync(join(dir, 'AGENTS.md'), 'utf8')).toBe(userBody); - }); -}); - describe('writeClaudeMdSection (F-90d054 AC-009 + AC-010)', () => { let dir: string; beforeEach(() => { @@ -187,8 +123,8 @@ describe('isStaleInstructions', () => { ).toBe(true); }); - test('does not flag the v0.4.0 conditional wording', () => { - expect(isStaleInstructions(AGENTS_MD_TEMPLATE)).toBe(false); + test('does not flag the current emitted surfaces (no re-sync churn)', () => { + expect(isStaleInstructions(renderAgentsMdManagedBlock(null))).toBe(false); expect(isStaleInstructions(CLAUDE_MD_SECTION)).toBe(false); }); @@ -205,8 +141,8 @@ describe('isStaleInstructions', () => { expect(isStaleInstructions(preCadence)).toBe(true); }); - test('both v0.4.x templates carry the feature-cycle cadence marker', () => { - expect(AGENTS_MD_TEMPLATE).toContain('Feature cycle — one at a time'); + test('both emitted surfaces carry the feature-cycle cadence marker', () => { + expect(renderAgentsMdManagedBlock(null)).toContain('Feature cycle — one at a time'); expect(CLAUDE_MD_SECTION).toContain('Feature cycle — one at a time'); }); diff --git a/tests/instruction-led-language.test.ts b/tests/instruction-led-language.test.ts index b12aab15..6cda393b 100644 --- a/tests/instruction-led-language.test.ts +++ b/tests/instruction-led-language.test.ts @@ -11,7 +11,7 @@ // a hardcoded count), templates carry no locale parameter, and // the plain-lead-first render order is unchanged. // AC-ddb938fb — the interpreter instruction (CLAUDE_MD_SECTION + -// AGENTS_MD_TEMPLATE) explicitly directs the agent to relay +// AGENTS_MD_BLOCK) explicitly directs the agent to relay // cladding's own gate/hook messages by meaning, both freshness // literals survive, and the size guard is respected. // AC-3f34759a — unwanted-behaviour: no locale-machinery symbol may reappear @@ -55,7 +55,11 @@ import {join, relative} from 'node:path'; import {describe, expect, test} from 'vitest'; import {allDetectors} from '../src/stages/detectors/index.js'; -import {AGENTS_MD_TEMPLATE, CLAUDE_MD_SECTION, isStaleInstructions} from '../src/init/host-instructions.js'; +import {CLAUDE_MD_SECTION, isStaleInstructions} from '../src/init/host-instructions.js'; +import {renderAgentsMdManagedBlock} from '../src/init/agents-md.js'; + +// Live 0.9.0 surface for cross-host guidance (replaced AGENTS_MD_BLOCK). +const AGENTS_MD_BLOCK = renderAgentsMdManagedBlock(null); import { DETECTOR_PLAIN, doneRefusalLead, @@ -169,17 +173,17 @@ describe('AC-71ce42e5 — English-only catalog + templates, no locale machinery, // AC-ddb938fb — interpreter relay clause, freshness literals, size guard. // ═══════════════════════════════════════════════════════════════════════ describe('AC-ddb938fb — interpreter relay clause, freshness literals, size guard', () => { - const GATE_AND_HOOK = /gate and hook messages/i; - const RELAY_BY_MEANING = /relay them(?: in the user's language,)? by meaning/i; + const GATE_AND_HOOK = /gate(?:\/| and )hook messages/i; + const RELAY_BY_MEANING = /relay (?:them|gate\/hook messages)(?: in the user's language,)? by meaning/i; test('CLAUDE_MD_SECTION explicitly directs relaying cladding\'s own gate/hook messages, by meaning', () => { expect(CLAUDE_MD_SECTION).toMatch(GATE_AND_HOOK); expect(norm(CLAUDE_MD_SECTION)).toMatch(RELAY_BY_MEANING); }); - test('AGENTS_MD_TEMPLATE carries the equivalent relay clause', () => { - expect(AGENTS_MD_TEMPLATE).toMatch(GATE_AND_HOOK); - expect(norm(AGENTS_MD_TEMPLATE)).toMatch(RELAY_BY_MEANING); + test('the AGENTS.md managed block carries the equivalent relay clause', () => { + expect(AGENTS_MD_BLOCK).toMatch(GATE_AND_HOOK); + expect(norm(AGENTS_MD_BLOCK)).toMatch(RELAY_BY_MEANING); }); test('planted-needle control: a stub anchor lacking the relay clause misses; the real sentence matches (both patterns)', () => { @@ -197,7 +201,7 @@ describe('AC-ddb938fb — interpreter relay clause, freshness literals, size gua }); test('both freshness literals survive verbatim in both templates', () => { - for (const tpl of [CLAUDE_MD_SECTION, AGENTS_MD_TEMPLATE]) { + for (const tpl of [CLAUDE_MD_SECTION, AGENTS_MD_BLOCK]) { expect(tpl).toContain('anti-self-cert'); expect(tpl).toContain('Feature cycle — one at a time'); } @@ -205,7 +209,7 @@ describe('AC-ddb938fb — interpreter relay clause, freshness literals, size gua test('round trip holds: a freshly emitted section of either template is NOT stale (no re-sync churn)', () => { expect(isStaleInstructions(CLAUDE_MD_SECTION)).toBe(false); - expect(isStaleInstructions(AGENTS_MD_TEMPLATE)).toBe(false); + expect(isStaleInstructions(AGENTS_MD_BLOCK)).toBe(false); }); test('CLAUDE_MD_SECTION stays under the ceiling declared in tests/claude-md-diet.test.ts (derived, not a duplicated magic number)', () => {