Compare commits

...
19 Commits
Author SHA1 Message Date
yunyingk b950e2b562 Merge pull request #38 from yunyingk/codex/release-v0.10.10
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
🚀 Release / 🚀 Build & Publish GitHub Release (push) Has been cancelled
🚀 Release / 📦 Sync Gitea Mirror (push) Has been cancelled
Release v0.10.10: Remove default cwd enterprises loading and add global test-dir config
2026-09-07 15:27:25 +08:00
gitea b5cc7c874e Release v0.10.10: Remove default cwd enterprises loading and add global test-dir config 2026-09-07 15:26:21 +08:00
yunyingk 878e53ac81 Merge pull request #37 from yunyingk/codex/release-v0.10.9
🚀 Release / 🚀 Build & Publish GitHub Release (push) Has been cancelled
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
🚀 Release / 📦 Sync Gitea Mirror (push) Has been cancelled
Release v0.10.9: Purge legacy MCP code, decouple CLI commands, and clean unused exports
2026-09-04 19:09:19 +08:00
gitea edafe033dc Release v0.10.9: Purge legacy MCP code, decouple CLI commands, and clean unused exports 2026-09-04 19:08:16 +08:00
yunyingk d525087b97 Merge pull request #36 from yunyingk/codex/release-v0.10.8
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
🚀 Release / 🚀 Build & Publish GitHub Release (push) Has been cancelled
🚀 Release / 📦 Sync Gitea Mirror (push) Has been cancelled
Release v0.10.8: Approval run attachments extraction and download command
2026-09-04 18:50:05 +08:00
gitea c5381e2c66 Release v0.10.8: Approval run attachments extraction and download command 2026-09-04 18:48:40 +08:00
gitea e9b66f787b Add approval-runs attachments download and Hose format extraction 2026-09-04 18:48:03 +08:00
yunyingk f64f2b8385 Merge pull request #34 from yunyingk/codex/release-v0.10.7
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
🚀 Release / 🚀 Build & Publish GitHub Release (push) Has been cancelled
🚀 Release / 📦 Sync Gitea Mirror (push) Has been cancelled
Release v0.10.7: Local rules workspace, daemon HTTP server, and global stop
2026-09-04 18:09:49 +08:00
gitea cba3098654 docs: document global stop command and shutdown route in changelog 2026-09-04 18:08:13 +08:00
gitea f9b8b06647 Add global seal-use stop command and shutdown HTTP route 2026-09-04 17:58:30 +08:00
gitea 37580dac44 Release v0.10.7: Local rules workspace and daemon HTTP server 2026-09-04 17:54:47 +08:00
gitea f183cc8294 Add persistent HTTP server to background service daemon 2026-09-04 17:53:40 +08:00
gitea 13ed555bbb Add local approval rules workspace and offline linting 2026-09-04 17:45:46 +08:00
yunyingk 39bbf4d7c0 Merge pull request #33 from yunyingk/codex/release-v0.10.6
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
🚀 Release / 🚀 Build & Publish GitHub Release (push) Has been cancelled
🚀 Release / 📦 Sync Gitea Mirror (push) Has been cancelled
Release v0.10.6: Webhook material pack import
2026-09-03 15:32:08 +08:00
gitea 64819d86cb Release v0.10.6: Webhook material pack import 2026-09-03 15:30:43 +08:00
yunyingk 4b1833409e Merge pull request #32 from yunyingk/codex/issue-27-webhook-material-pack
Add Webhook material pack import
2026-09-03 15:27:44 +08:00
gitea 77ae7d4dca Add Webhook material pack import 2026-09-03 15:26:43 +08:00
yunyingk 1299d70777 Merge pull request #31 from yunyingk/codex/release-v0.10.5
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
🚀 Release / 🚀 Build & Publish GitHub Release (push) Has been cancelled
🚀 Release / 📦 Sync Gitea Mirror (push) Has been cancelled
Release v0.10.5: Intelligent HoseCloud sync discovery, actionable guidance, and --auto support (Fixes #26)
2026-09-03 11:42:54 +08:00
gitea 0a3c984018 Release v0.10.5: Intelligent HoseCloud sync discovery, actionable guidance, and --auto support (Fixes #26) 2026-09-03 11:41:56 +08:00
48 changed files with 2957 additions and 611 deletions

No files matched your search

+4
View File
@@ -14,4 +14,8 @@ enterprises/*.json
# Local generated reports and exported deliverables.
.local/
.apifox/
exports/
scripts/export-*.ts
# Local custom linters
linters/
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "seal-use",
"version": "0.10.4",
"version": "0.10.10",
"description": "Seal Use tenant operations: approval-run diagnosis, minimal rule remediation, delegation links, Hose/合思 authorization, users, rules, billing, and search.",
"author": {
"name": "yingqing"
+65
View File
@@ -5,6 +5,71 @@ All notable changes to `seal-use` will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.10.10] - 2026-09-07
### Changed & Fixed
- **Enterprise Config Resolution Isolation**:
- Removed default loading of `./enterprises` from the current working directory (`cwd`), ensuring local repo files never unintentionally leak or override user enterprise configs.
- Candidate enterprise directories now strictly default to user global configuration directories (`~/.config/seal-use/enterprises`, `~/.config/seal-home/enterprises`) unless an explicit environment variable or test directory is configured.
- **Global Test Enterprises Directory Configuration**:
- Added `testEnterprisesDir` field to `GlobalConfigSchema`.
- Added `seal-use config test-dir [<path>|--clear]` command to safely configure or clear a dedicated test enterprise directory without impacting normal user operations.
- Included `testEnterprisesDir` in global configuration summaries and candidate directory listings.
## [0.10.9] - 2026-09-04
### Refactored & Purged
- **MCP Legacy Code Purge & Strict CLI-First Architecture**:
- Removed obsolete intermediate MCP definitions (`sealMcpTools`, `mcpDirectToolNames`, `sealActionNames`, `sealActionAliases`, `runSealAction`, `sealActionHelp`, `findSealMcpTool`) from `src/domains/seal/tools.ts`.
- Removed mistakenly registered `seal_approval_run_attachments_download` tool definition and aliases from `tools.ts`.
- Decoupled `seal-use approval-runs attachments` (inspection & download) CLI commands to invoke pure domain functions in `src/domains/seal/attachments.ts` directly, bypassing the legacy tool runner.
- Purged obsolete "Fine-Grained Tools" lists from `README.md` and `skills/seal-use/references/cli.md`, reinforcing the CLI-First contract where agents execute `seal-use <command>` directly or via the single `seal_cli` MCP tool.
- **Repository-Wide Dead Code & Unused Export Cleanup**:
- Eliminated duplicate enterprise directory export aliases in `src/core/config/loader.ts`.
- Converted internal helpers in `src/core/embedded-skill.ts`, `src/cli/printer.ts`, `src/cli/commands/auth.ts`, `src/domains/seal/linter/loader.ts`, `src/domains/seal/material-pack/validate.ts`, and `src/core/auth/seal.ts` to private module functions.
## [0.10.8] - 2026-09-04
### Added & Enhanced
- **Approval Run Attachments Extraction Compatibility (Issue #35)**:
- Generalized `extractApprovalRunAttachments` to inspect `document.fields[].type === "ATTACHMENT"` arrays with nested `value[]` collections, properly recognizing HoseCloud/Seal 2026 flattened attachment fields that previously resolved to `count: 0`.
- Extracted comprehensive metadata including `ossSignedUrl`, `token` (automatically parsing embedded `fileId` and object `key`), `ossFileSize`, `mimeType`, and preserved parent field labels as `sourceField`.
- Added `hasSignedUrl` and `ossFileSize` to compact summary outputs without exposing raw signed URLs.
- **New Attachments Download Command (Issue #35)**:
- Added `seal-use approval-runs attachments download <recordId> [--name <pattern>] [--all] [--out-dir <path>]` CLI command.
- Prioritizes direct `ossSignedUrl` links from the run record and verifies downloaded file size against `ossFileSize`.
- Automatically sanitizes sensitive temporary signatures in CLI logging (`?[MASKED]`) to prevent credential leakage in build/agent transcripts.
- Implemented graceful error recovery for expired temporary URLs (HTTP 403) or missing links, reporting diagnostics for failed items while allowing valid attachments to complete without interruption.
## [0.10.7] - 2026-09-04
### Added & Enhanced
- **Local Approval Rules Workspace & Offline Linting**:
- Added `seal-use rules pull` (`seal_approval_rules_pull`) to export remote draft or published version rules to a local JSON file (defaults to `./rules.local.json`), eliminating unwanted mutations to remote drafts.
- Added `seal-use rules lint --file <path>` to execute rule quality and execution checks completely offline with zero network requests and zero dirty version records in the remote backend. Supports quality score gates (`--min-score`) and operates seamlessly even without configured enterprise credentials.
- Added `seal-use rules push` (`seal_approval_rules_push`) to apply refined local rules to the remote draft with preview (`--dry-run`), confirmation (`--yes`), and optional single-step formal release publishing (`--publish`).
- **Persistent HTTP Companion Daemon in Background Service**:
- Embedded the HTTP API server into `seal-use service run`, allowing `seal-use service start` to run as a detached background daemon with persistent HTTP service (serving `/docs`, `/openapi.json`, and `POST /api/cli`).
- Added `seal-use service logs` (`--lines <N>`) to easily inspect service background activity.
- Enhanced `seal-use service status` to track active host, port, and URL via daemon metadata state.
- Optimized `parseJsonBody` and CLI runner concurrency with standing command bypasses to prevent process queue blocks.
- Added top-level `seal-use stop` command, intuitive service aliases (`seal-use service kill|down|shutdown`), and `POST /shutdown` HTTP endpoint to gracefully terminate the background daemon from any terminal or script.
## [0.10.6] - 2026-09-03
### Added & Enhanced
- **Inbound Webhook Material Pack Import (Issue #27)**: Added local preview and push workflows for SealAI material packs, including strict ZIP/XLSX validation, normalized approval-document parsing, attachment upload, and HMAC-signed Webhook delivery.
- **CLI and MCP Support**: Added `seal-use webhook material-pack preview|push` and the `seal_webhook_material_pack` tool, while keeping the existing simulation `material_pack` flow separate.
- **Test-Enterprise Verification**: Verified the new push path against the configured test enterprise with official sample materials; customer enterprise data was not used.
## [0.10.5] - 2026-09-03
### Added & Enhanced
- **Intelligent HoseCloud Sync Discovery & Actionable Guidance (Issue #26)**: In `seal-use deploy hosecloud sync` and `deploy hosecloud get`, when `<sign-key>` is omitted, the CLI dynamically discovers all active HoseCloud integration configs for the tenant and renders structured cards on `stderr` with 1-click copy commands (e.g. `👉 同步命令: seal-use deploy hosecloud sync <signKey> --corp <corpId>`).
- **Single-Config Fast Track (`--auto`)**: Added `--auto` (and `--yes`) flag to `deploy hosecloud sync`. When a tenant has exactly one configured HoseCloud integration, `--auto` automatically locks and syncs without requiring manual `signKey` extraction.
- **Enhanced Empty State & Diagnostic Hints**: If a tenant has zero HoseCloud integrations configured, clearly prompts the user with next-step configuration command `seal-use deploy hosecloud configure ...`.
- **Updated Reference Documentation**: Updated `skills/seal-use/references/hose-enterprise-deploy.md` and CLI references with `--auto` and dynamic discovery patterns.
## [0.10.4] - 2026-09-03
### Added & Enhanced
+12 -21
View File
@@ -257,29 +257,20 @@ The MCP server advertises exactly one tool, `seal_cli`:
It runs the same CLI dispatcher as the global binary, so read operations, write operations, `config`, `service`, and `update` remain available. Write-operation confirmations and explicit enterprise-ID rules continue to be defined by this skill.
## CLI Tools
## CLI-First Architecture
These tools remain available to the CLI:
All Agent and automation capabilities are accessed through standard `seal-use <command>` CLI invocations (or through the single `seal_cli` MCP tool passing the command string). Internal domain services output pure, parseable JSON on `stdout`, with human diagnostics and suggestions routed to `stderr`.
- `seal_source_config`: resolve current Seal enterprise config from the configured source.
- `seal_approval_runs_search`: search approval run history and optional bridge rows.
- `seal_session_get`: current Seal Bearer session and expiration.
- `seal_approval_rules_list`: current draft approval rules. Use `{"countOnly":true}` or `{"fields":["id"],"limit":0}` to return only `{"count":...}`; use `fields` for lightweight projections when rule descriptions are not needed.
- `seal_approval_rule_create`, `seal_approval_rule_update`, `seal_approval_rule_delete`: maintain approval rules.
- `seal_approval_rule_versions_list`, `seal_approval_rule_version_publish`: read and publish rule versions.
- `seal_approval_rule_get`: fetch one rule from a published version by `versionNumber` plus `code` such as `#0038`, or by `recordId` plus `runtimeId` such as `rule-205`.
- `seal_approval_documents_list`, `seal_approval_document_get`, `seal_approval_document_create`, `seal_approval_document_update`: maintain approval documents.
- `seal_approval_style_preferences_get`, `seal_approval_style_preferences_update`: read and update approval style preferences.
- `seal_approval_runs_summary`: summarize approval runs by local date and timezone. Use this for daily questions such as "what approval records did Tawen have today"; it returns status/task-mode counts and compact records.
- `seal_approval_run_get`: fetch one approval run. Pass `summary:true` or `fields` such as `"metadata"` or `"document.fields,result.summary"` to avoid returning full document, pipeline, and AI output payloads.
- `seal_approval_run_pick`: locate likely approval run records by document number, batch, latest flag, and optional field projection.
- `seal_approval_run_cited_rules_get`: extract rules cited or matched by the AI result, including runtime ID/code, version, scope, strictness, analysis, result, and findings when present.
- `seal_approval_run_document_summary_get`: return key document fields, invoice/attachment summary, AI result, and manual result.
- `seal_approval_run_attachments_get`: return attachment and invoice file metadata for one run without the full document or rule result; use `summary:true` for the smallest list.
- `seal_approval_run_result_get`: return one run result, with `{"summary":true}` for decision, summary, risk point count, matched rule count, trace ID, and record ID only.
- `seal_approval_run_url_get`: return the Hose enterprise assist URL, optionally with the original document URL for an approval run by `recordId`, `sourceDocumentSN`, or `sourceDocumentId`.
- `seal_simulation_batch_records_get`: read records from one simulation batch via `api/v1/simulation/batch/{batchId}/records`.
- `seal_approval_run_langfuse_bridge_get`: resolve approval run records to Langfuse lookup hints. It prefers `sourceExtendData._langfuseTraceId`; if that is missing, it returns `hosecloud-{sourceDocumentSN}` as the session fallback.
Key CLI command groups:
- **`seal-use corps ...`**: enterprise tenant management, onboarding, switching, and assistance link intake.
- **`seal-use auth ...`**: authentication diagnostics and Hose provisional authorization links.
- **`seal-use rules ...`**: rule listing, workspace pull/push, offline linting, version publishing, and clearing.
- **`seal-use approval-runs ...`**: run history search, summary by date, detail extraction, attachment inspection & download, cited rules, and Langfuse trace bridge.
- **`seal-use simulation ...`**: test simulation batch creation, polling wait, specifications, and cleanup.
- **`seal-use deploy ...`**: HoseCloud review node requirement inspection, status check, configuration, and sync.
- **`seal-use preference ...`**: decision preferences and thinking depth policies.
- **`seal-use webhook ...`**: webhook integration CRUD and material pack testing.
- **`seal-use service ...`**: persistent daemon service management with embedded HTTP server.
For rule list commands, prefer `seal-use rules count --corp <corpId>` or `seal-use rules list --corp <corpId> --summary` before requesting full rule descriptions. `seal-use rules list` protects large outputs and asks for `--summary`, `--count`, or explicit `--full` when the response would be too large.
+198 -1
View File
@@ -5,11 +5,16 @@
"": {
"dependencies": {
"@modelcontextprotocol/sdk": "^1.29.0",
"exceljs": "^4.4.0",
"iconv-lite": "^0.7.3",
"ky": "^2.0.2",
"pinyin-pro": "^3.29.3",
"yauzl": "^3.4.0",
"zod": "^4.4.3",
},
"devDependencies": {
"@types/bun": "^1.3.14",
"@types/yauzl": "^3.4.0",
"bun-types": "^1.3.14",
"typescript": "^5.9.3",
"yaml": "^2.9.0",
@@ -17,6 +22,10 @@
},
},
"packages": {
"@fast-csv/format": ["@fast-csv/format@4.3.5", "", { "dependencies": { "@types/node": "^14.0.1", "lodash.escaperegexp": "^4.1.2", "lodash.isboolean": "^3.0.3", "lodash.isequal": "^4.5.0", "lodash.isfunction": "^3.0.9", "lodash.isnil": "^4.0.0" } }, "sha512-8iRn6QF3I8Ak78lNAa+Gdl5MJJBM5vRHivFtMRUWINdevNo00K7OXxS2PshawLKTejVwieIlPmK5YlLu6w4u8A=="],
"@fast-csv/parse": ["@fast-csv/parse@4.3.6", "", { "dependencies": { "@types/node": "^14.0.1", "lodash.escaperegexp": "^4.1.2", "lodash.groupby": "^4.6.0", "lodash.isfunction": "^3.0.9", "lodash.isnil": "^4.0.0", "lodash.isundefined": "^3.0.1", "lodash.uniq": "^4.5.0" } }, "sha512-uRsLYksqpbDmWaSmzvJcuApSEe38+6NQZBUsuAyMZKqHxH0g1wcJgsKUvN3WC8tewaqFjBMMGrkHmC+T7k8LvA=="],
"@hono/node-server": ["@hono/node-server@1.19.14", "", { "peerDependencies": { "hono": "^4" } }, "sha512-GwtvgtXxnWsucXvbQXkRgqksiH2Qed37H9xHZocE5sA3N8O8O8/8FA3uclQXxXVzc9XBZuEOMK7+r02FmSpHtw=="],
"@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.29.0", "", { "dependencies": { "@hono/node-server": "^1.19.9", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.2.1", "express-rate-limit": "^8.2.1", "hono": "^4.11.4", "jose": "^6.1.3", "json-schema-typed": "^8.0.2", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.25 || ^4.0", "zod-to-json-schema": "^3.25.1" }, "peerDependencies": { "@cfworker/json-schema": "^4.1.1" }, "optionalPeers": ["@cfworker/json-schema"] }, "sha512-zo37mZA9hJWpULgkRpowewez1y6ML5GsXJPY8FI0tBBCd77HEvza4jDqRKOXgHNn867PVGCyTdzqpz0izu5ZjQ=="],
@@ -25,14 +34,44 @@
"@types/node": ["@types/node@25.9.1", "", { "dependencies": { "undici-types": ">=7.24.0 <7.24.7" } }, "sha512-xfrlY7UD5rMJk3ZVJP8BNzS28J36YJg+xp+LPXV1TdWxr8uMH5A860QNxYDGQe/ylDSgjxE52Q9VnO7p75tJxg=="],
"@types/yauzl": ["@types/yauzl@3.4.0", "", { "dependencies": { "@types/node": "*" } }, "sha512-NRPn5w6h8dhcnmx3YIRQcqMywY/+nND/uOkJessedcrowO3C0AssHp3tMJpxKAwOhFOo0OV1y9VtsC5hbKKBAw=="],
"accepts": ["accepts@2.0.0", "", { "dependencies": { "mime-types": "^3.0.0", "negotiator": "^1.0.0" } }, "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng=="],
"ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
"ajv-formats": ["ajv-formats@3.0.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ=="],
"archiver": ["archiver@5.3.2", "", { "dependencies": { "archiver-utils": "^2.1.0", "async": "^3.2.4", "buffer-crc32": "^0.2.1", "readable-stream": "^3.6.0", "readdir-glob": "^1.1.2", "tar-stream": "^2.2.0", "zip-stream": "^4.1.0" } }, "sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw=="],
"archiver-utils": ["archiver-utils@2.1.0", "", { "dependencies": { "glob": "^7.1.4", "graceful-fs": "^4.2.0", "lazystream": "^1.0.0", "lodash.defaults": "^4.2.0", "lodash.difference": "^4.5.0", "lodash.flatten": "^4.4.0", "lodash.isplainobject": "^4.0.6", "lodash.union": "^4.6.0", "normalize-path": "^3.0.0", "readable-stream": "^2.0.0" } }, "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw=="],
"async": ["async@3.2.6", "", {}, "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA=="],
"balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
"base64-js": ["base64-js@1.5.1", "", {}, "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="],
"big-integer": ["big-integer@1.6.52", "", {}, "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg=="],
"binary": ["binary@0.3.0", "", { "dependencies": { "buffers": "~0.1.1", "chainsaw": "~0.1.0" } }, "sha512-D4H1y5KYwpJgK8wk1Cue5LLPgmwHKYSChkbspQg5JtVuR5ulGckxfR62H3AE9UDkdMC8yyXlqYihuz3Aqg2XZg=="],
"bl": ["bl@4.1.0", "", { "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w=="],
"bluebird": ["bluebird@3.4.7", "", {}, "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA=="],
"body-parser": ["body-parser@2.2.2", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^1.0.5", "debug": "^4.4.3", "http-errors": "^2.0.0", "iconv-lite": "^0.7.0", "on-finished": "^2.4.1", "qs": "^6.14.1", "raw-body": "^3.0.1", "type-is": "^2.0.1" } }, "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA=="],
"brace-expansion": ["brace-expansion@2.1.4", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg=="],
"buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="],
"buffer-crc32": ["buffer-crc32@0.2.13", "", {}, "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ=="],
"buffer-indexof-polyfill": ["buffer-indexof-polyfill@1.0.2", "", {}, "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A=="],
"buffers": ["buffers@0.1.1", "", {}, "sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ=="],
"bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
"bytes": ["bytes@3.1.2", "", {}, "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="],
@@ -41,6 +80,12 @@
"call-bound": ["call-bound@1.0.4", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" } }, "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg=="],
"chainsaw": ["chainsaw@0.1.0", "", { "dependencies": { "traverse": ">=0.3.0 <0.4" } }, "sha512-75kWfWt6MEKNC8xYXIdRpDehRYY/tNSgwKaJq+dbbDcxORuVrrQ+SEHoWsniVn9XPYfP4gmdWIeDk/4YNp1rNQ=="],
"compress-commons": ["compress-commons@4.1.2", "", { "dependencies": { "buffer-crc32": "^0.2.13", "crc32-stream": "^4.0.2", "normalize-path": "^3.0.0", "readable-stream": "^3.6.0" } }, "sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg=="],
"concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="],
"content-disposition": ["content-disposition@1.1.0", "", {}, "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g=="],
"content-type": ["content-type@1.0.5", "", {}, "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA=="],
@@ -49,20 +94,32 @@
"cookie-signature": ["cookie-signature@1.2.2", "", {}, "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg=="],
"core-util-is": ["core-util-is@1.0.3", "", {}, "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="],
"cors": ["cors@2.8.6", "", { "dependencies": { "object-assign": "^4", "vary": "^1" } }, "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw=="],
"crc-32": ["crc-32@1.2.2", "", { "bin": { "crc32": "bin/crc32.njs" } }, "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ=="],
"crc32-stream": ["crc32-stream@4.0.3", "", { "dependencies": { "crc-32": "^1.2.0", "readable-stream": "^3.4.0" } }, "sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw=="],
"cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
"dayjs": ["dayjs@1.11.23", "", {}, "sha512-QDTCU0M0MxR3hQfnlDJfwekQiaanm1ubOD231u73WBckQ/fsamwRLiE2GBz6D3a/xF1NgfiDLJjXBa1hYOYTtQ=="],
"debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
"depd": ["depd@2.0.0", "", {}, "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="],
"dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
"duplexer2": ["duplexer2@0.1.4", "", { "dependencies": { "readable-stream": "^2.0.2" } }, "sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA=="],
"ee-first": ["ee-first@1.1.1", "", {}, "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="],
"encodeurl": ["encodeurl@2.0.0", "", {}, "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg=="],
"end-of-stream": ["end-of-stream@1.4.5", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg=="],
"es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="],
"es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],
@@ -77,10 +134,14 @@
"eventsource-parser": ["eventsource-parser@3.1.0", "", {}, "sha512-kJezFj9YFAMLeORyi7aCLxLbD5/qWMQnoMVlVPyHIll7lgRJCc3JVln9Vgl9nwQi0YkMnhdGTMNn7CkRRAptMg=="],
"exceljs": ["exceljs@4.4.0", "", { "dependencies": { "archiver": "^5.0.0", "dayjs": "^1.8.34", "fast-csv": "^4.3.1", "jszip": "^3.10.1", "readable-stream": "^3.6.0", "saxes": "^5.0.1", "tmp": "^0.2.0", "unzipper": "^0.10.11", "uuid": "^8.3.0" } }, "sha512-XctvKaEMaj1Ii9oDOqbW/6e1gXknSY4g/aLCDicOXqBE4M0nRWkUu0PTp++UPNzoFY12BNHMfs/VadKIS6llvg=="],
"express": ["express@5.2.1", "", { "dependencies": { "accepts": "^2.0.0", "body-parser": "^2.2.1", "content-disposition": "^1.0.0", "content-type": "^1.0.5", "cookie": "^0.7.1", "cookie-signature": "^1.2.1", "debug": "^4.4.0", "depd": "^2.0.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "finalhandler": "^2.1.0", "fresh": "^2.0.0", "http-errors": "^2.0.0", "merge-descriptors": "^2.0.0", "mime-types": "^3.0.0", "on-finished": "^2.4.1", "once": "^1.4.0", "parseurl": "^1.3.3", "proxy-addr": "^2.0.7", "qs": "^6.14.0", "range-parser": "^1.2.1", "router": "^2.2.0", "send": "^1.1.0", "serve-static": "^2.2.0", "statuses": "^2.0.1", "type-is": "^2.0.1", "vary": "^1.1.2" } }, "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw=="],
"express-rate-limit": ["express-rate-limit@8.5.2", "", { "dependencies": { "ip-address": "^10.2.0" }, "peerDependencies": { "express": ">= 4.11" } }, "sha512-5Kb34ipNX694DH48vN9irak1Qx30nb0PLYHXfJgw4YEjiC3ZEmZJhwOp+VfiCYwFzvFTdB9QkArYS5kXa2cx2A=="],
"fast-csv": ["fast-csv@4.3.6", "", { "dependencies": { "@fast-csv/format": "4.3.5", "@fast-csv/parse": "4.3.6" } }, "sha512-2RNSpuwwsJGP0frGsOmTb9oUF+VkFSM4SyLTDgwf2ciHWTarN0lQTC+F2f/t5J9QjW+c65VFIAAu85GsvMIusw=="],
"fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="],
"fast-uri": ["fast-uri@3.1.2", "", {}, "sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ=="],
@@ -91,14 +152,24 @@
"fresh": ["fresh@2.0.0", "", {}, "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A=="],
"fs-constants": ["fs-constants@1.0.0", "", {}, "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="],
"fs.realpath": ["fs.realpath@1.0.0", "", {}, "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="],
"fstream": ["fstream@1.0.12", "", { "dependencies": { "graceful-fs": "^4.1.2", "inherits": "~2.0.0", "mkdirp": ">=0.5 0", "rimraf": "2" } }, "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg=="],
"function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
"get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="],
"get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="],
"glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="],
"gopd": ["gopd@1.2.0", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="],
"graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="],
"has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="],
"hasown": ["hasown@2.0.4", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A=="],
@@ -107,7 +178,13 @@
"http-errors": ["http-errors@2.0.1", "", { "dependencies": { "depd": "~2.0.0", "inherits": "~2.0.4", "setprototypeof": "~1.2.0", "statuses": "~2.0.2", "toidentifier": "~1.0.1" } }, "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ=="],
"iconv-lite": ["iconv-lite@0.7.2", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw=="],
"iconv-lite": ["iconv-lite@0.7.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ=="],
"ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
"immediate": ["immediate@3.0.6", "", {}, "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="],
"inflight": ["inflight@1.0.6", "", { "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA=="],
"inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
@@ -117,6 +194,8 @@
"is-promise": ["is-promise@4.0.0", "", {}, "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="],
"isarray": ["isarray@1.0.0", "", {}, "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="],
"isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
"jose": ["jose@6.2.3", "", {}, "sha512-YYVDInQKFJfR/xa3ojUTl8c2KoTwiL1R5Wg9YCydwH0x0B9grbzlg5HC7mMjCtUJjbQ/YnGEZIhI5tCgfTb4Hw=="],
@@ -125,8 +204,42 @@
"json-schema-typed": ["json-schema-typed@8.0.2", "", {}, "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA=="],
"jszip": ["jszip@3.10.1", "", { "dependencies": { "lie": "~3.3.0", "pako": "~1.0.2", "readable-stream": "~2.3.6", "setimmediate": "^1.0.5" } }, "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g=="],
"ky": ["ky@2.0.2", "", {}, "sha512-/GmXpo9F9W+f8n4Ivr2iH+7h7wL7jLbLKWkMlpflcCRb6kGjBfTlASEXaZ9qUgNTn4VgS0P2pwxxzQ4EM6Ulgg=="],
"lazystream": ["lazystream@1.0.1", "", { "dependencies": { "readable-stream": "^2.0.5" } }, "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw=="],
"lie": ["lie@3.3.0", "", { "dependencies": { "immediate": "~3.0.5" } }, "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ=="],
"listenercount": ["listenercount@1.0.1", "", {}, "sha512-3mk/Zag0+IJxeDrxSgaDPy4zZ3w05PRZeJNnlWhzFz5OkX49J4krc+A8X2d2M69vGMBEX0uyl8M+W+8gH+kBqQ=="],
"lodash.defaults": ["lodash.defaults@4.2.0", "", {}, "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ=="],
"lodash.difference": ["lodash.difference@4.5.0", "", {}, "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA=="],
"lodash.escaperegexp": ["lodash.escaperegexp@4.1.2", "", {}, "sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw=="],
"lodash.flatten": ["lodash.flatten@4.4.0", "", {}, "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g=="],
"lodash.groupby": ["lodash.groupby@4.6.0", "", {}, "sha512-5dcWxm23+VAoz+awKmBaiBvzox8+RqMgFhi7UvX9DHZr2HdxHXM/Wrf8cfKpsW37RNrvtPn6hSwNqurSILbmJw=="],
"lodash.isboolean": ["lodash.isboolean@3.0.3", "", {}, "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg=="],
"lodash.isequal": ["lodash.isequal@4.5.0", "", {}, "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ=="],
"lodash.isfunction": ["lodash.isfunction@3.0.9", "", {}, "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw=="],
"lodash.isnil": ["lodash.isnil@4.0.0", "", {}, "sha512-up2Mzq3545mwVnMhTDMdfoG1OurpA/s5t88JmQX809eH3C8491iu2sfKhTfhQtKY78oPNhiaHJUpT/dUDAAtng=="],
"lodash.isplainobject": ["lodash.isplainobject@4.0.6", "", {}, "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA=="],
"lodash.isundefined": ["lodash.isundefined@3.0.1", "", {}, "sha512-MXB1is3s899/cD8jheYYE2V9qTHwKvt+npCwpD+1Sxm3Q3cECXCiYHjeHWXNwr6Q0SOBPrYUDxendrO6goVTEA=="],
"lodash.union": ["lodash.union@4.6.0", "", {}, "sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw=="],
"lodash.uniq": ["lodash.uniq@4.5.0", "", {}, "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ=="],
"math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
"media-typer": ["media-typer@1.1.0", "", {}, "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw=="],
@@ -137,10 +250,16 @@
"mime-types": ["mime-types@3.0.2", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A=="],
"minimatch": ["minimatch@5.1.9", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw=="],
"mkdirp": ["mkdirp@3.0.1", "", { "bin": { "mkdirp": "dist/cjs/src/bin.js" } }, "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg=="],
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
"negotiator": ["negotiator@1.0.0", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="],
"normalize-path": ["normalize-path@3.0.0", "", {}, "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="],
"object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="],
"object-inspect": ["object-inspect@1.13.4", "", {}, "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew=="],
@@ -149,14 +268,24 @@
"once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
"pako": ["pako@1.0.11", "", {}, "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="],
"parseurl": ["parseurl@1.3.3", "", {}, "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="],
"path-is-absolute": ["path-is-absolute@1.0.1", "", {}, "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg=="],
"path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="],
"path-to-regexp": ["path-to-regexp@8.4.2", "", {}, "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA=="],
"pend": ["pend@1.2.0", "", {}, "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg=="],
"pinyin-pro": ["pinyin-pro@3.29.3", "", {}, "sha512-+UU9bx6vfDw8amOJGHm0TE0rdQl8VPylsDWviQ5OOQ3e+on1xRP4OqDbiDuMT5OISgvfl/Y6ez1BBRaIP80GLQ=="],
"pkce-challenge": ["pkce-challenge@5.0.1", "", {}, "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ=="],
"process-nextick-args": ["process-nextick-args@2.0.1", "", {}, "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="],
"proxy-addr": ["proxy-addr@2.0.7", "", { "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg=="],
"qs": ["qs@6.15.2", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw=="],
@@ -165,16 +294,28 @@
"raw-body": ["raw-body@3.0.2", "", { "dependencies": { "bytes": "~3.1.2", "http-errors": "~2.0.1", "iconv-lite": "~0.7.0", "unpipe": "~1.0.0" } }, "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA=="],
"readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
"readdir-glob": ["readdir-glob@1.1.3", "", { "dependencies": { "minimatch": "^5.1.0" } }, "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA=="],
"require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="],
"rimraf": ["rimraf@2.7.1", "", { "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "./bin.js" } }, "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w=="],
"router": ["router@2.2.0", "", { "dependencies": { "debug": "^4.4.0", "depd": "^2.0.0", "is-promise": "^4.0.0", "parseurl": "^1.3.3", "path-to-regexp": "^8.0.0" } }, "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ=="],
"safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="],
"safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],
"saxes": ["saxes@5.0.1", "", { "dependencies": { "xmlchars": "^2.2.0" } }, "sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw=="],
"send": ["send@1.2.1", "", { "dependencies": { "debug": "^4.4.3", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "fresh": "^2.0.0", "http-errors": "^2.0.1", "mime-types": "^3.0.2", "ms": "^2.1.3", "on-finished": "^2.4.1", "range-parser": "^1.2.1", "statuses": "^2.0.2" } }, "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ=="],
"serve-static": ["serve-static@2.2.1", "", { "dependencies": { "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "parseurl": "^1.3.3", "send": "^1.2.0" } }, "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw=="],
"setimmediate": ["setimmediate@1.0.5", "", {}, "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="],
"setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="],
"shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
@@ -191,8 +332,16 @@
"statuses": ["statuses@2.0.2", "", {}, "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw=="],
"string_decoder": ["string_decoder@1.3.0", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="],
"tar-stream": ["tar-stream@2.2.0", "", { "dependencies": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", "fs-constants": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^3.1.1" } }, "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ=="],
"tmp": ["tmp@0.2.7", "", {}, "sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw=="],
"toidentifier": ["toidentifier@1.0.1", "", {}, "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="],
"traverse": ["traverse@0.3.9", "", {}, "sha512-iawgk0hLP3SxGKDfnDJf8wTz4p2qImnyihM5Hh/sGvQ3K37dPi/w8sRhdNIxYA1TwFwc5mDhIJq+O0RsvXBKdQ=="],
"type-is": ["type-is@2.1.0", "", { "dependencies": { "content-type": "^2.0.0", "media-typer": "^1.1.0", "mime-types": "^3.0.0" } }, "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA=="],
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
@@ -201,18 +350,66 @@
"unpipe": ["unpipe@1.0.0", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="],
"unzipper": ["unzipper@0.10.14", "", { "dependencies": { "big-integer": "^1.6.17", "binary": "~0.3.0", "bluebird": "~3.4.1", "buffer-indexof-polyfill": "~1.0.0", "duplexer2": "~0.1.4", "fstream": "^1.0.12", "graceful-fs": "^4.2.2", "listenercount": "~1.0.1", "readable-stream": "~2.3.6", "setimmediate": "~1.0.4" } }, "sha512-ti4wZj+0bQTiX2KmKWuwj7lhV+2n//uXEotUmGuQqrbVZSEGFMbI68+c6JCQ8aAmUWYvtHEz2A8K6wXvueR/6g=="],
"util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="],
"uuid": ["uuid@8.3.2", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="],
"vary": ["vary@1.1.2", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="],
"which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
"wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
"xmlchars": ["xmlchars@2.2.0", "", {}, "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw=="],
"yaml": ["yaml@2.9.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA=="],
"yauzl": ["yauzl@3.4.0", "", { "dependencies": { "pend": "~1.2.0" } }, "sha512-jIH9yLR9wqr0wOS0TpBvo/g/2UgZH5qePVbjgRliiF0BYvOZyaBknKsF+x9Iht0O6sqgnB93rCICdOZFecJuDw=="],
"zip-stream": ["zip-stream@4.1.1", "", { "dependencies": { "archiver-utils": "^3.0.4", "compress-commons": "^4.1.2", "readable-stream": "^3.6.0" } }, "sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ=="],
"zod": ["zod@4.4.3", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="],
"zod-to-json-schema": ["zod-to-json-schema@3.25.2", "", { "peerDependencies": { "zod": "^3.25.28 || ^4" } }, "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA=="],
"@fast-csv/format/@types/node": ["@types/node@14.18.63", "", {}, "sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ=="],
"@fast-csv/parse/@types/node": ["@types/node@14.18.63", "", {}, "sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ=="],
"archiver-utils/readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="],
"body-parser/iconv-lite": ["iconv-lite@0.7.2", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw=="],
"duplexer2/readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="],
"glob/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="],
"jszip/readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="],
"lazystream/readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="],
"raw-body/iconv-lite": ["iconv-lite@0.7.2", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw=="],
"string_decoder/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],
"type-is/content-type": ["content-type@2.0.0", "", {}, "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ=="],
"unzipper/readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="],
"zip-stream/archiver-utils": ["archiver-utils@3.0.4", "", { "dependencies": { "glob": "^7.2.3", "graceful-fs": "^4.2.0", "lazystream": "^1.0.0", "lodash.defaults": "^4.2.0", "lodash.difference": "^4.5.0", "lodash.flatten": "^4.4.0", "lodash.isplainobject": "^4.0.6", "lodash.union": "^4.6.0", "normalize-path": "^3.0.0", "readable-stream": "^3.6.0" } }, "sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw=="],
"archiver-utils/readable-stream/string_decoder": ["string_decoder@1.1.1", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="],
"duplexer2/readable-stream/string_decoder": ["string_decoder@1.1.1", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="],
"glob/minimatch/brace-expansion": ["brace-expansion@1.1.18", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw=="],
"jszip/readable-stream/string_decoder": ["string_decoder@1.1.1", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="],
"lazystream/readable-stream/string_decoder": ["string_decoder@1.1.1", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="],
"unzipper/readable-stream/string_decoder": ["string_decoder@1.1.1", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="],
}
}
+331 -80
View File
@@ -1,82 +1,319 @@
import{createRequire as ay}from"node:module";var _y=Object.create;var{getPrototypeOf:Zy,defineProperty:O$,getOwnPropertyNames:My}=Object;var zy=Object.prototype.hasOwnProperty;function Cy(n){return this[n]}var Ry,hy,$0=(n,i,r)=>{var o=n!=null&&typeof n==="object";if(o){var t=i?Ry??=new WeakMap:hy??=new WeakMap,u=t.get(n);if(u)return u}r=n!=null?_y(Zy(n)):{};let e=i||!n||!n.__esModule?O$(r,"default",{value:n,enumerable:!0}):r;for(let l of My(n))if(!zy.call(e,l))O$(e,l,{get:Cy.bind(n,l),enumerable:!0});if(o)t.set(n,e);return e};var H=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports);var my=(n)=>n;function xy(n,i){this[n]=my.bind(null,i)}var Fi=(n,i)=>{for(var r in i)O$(n,r,{get:i[r],enumerable:!0,configurable:!0,set:xy.bind(i,r)})};var I0=ay(import.meta.url);var ru=H((TD)=>{Object.defineProperty(TD,"__esModule",{value:!0});TD.regexpCode=TD.getEsmExportName=TD.getProperty=TD.safeStringify=TD.stringify=TD.strConcat=TD.addCodeArg=TD.str=TD._=TD.nil=TD._Code=TD.Name=TD.IDENTIFIER=TD._CodeOrName=void 0;class Zl{}TD._CodeOrName=Zl;TD.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Jr extends Zl{constructor(n){super();if(!TD.IDENTIFIER.test(n))throw Error("CodeGen: name must be a valid identifier");this.str=n}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}TD.Name=Jr;class fi extends Zl{constructor(n){super();this._items=typeof n==="string"?[n]:n}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let n=this._items[0];return n===""||n==='""'}get str(){var n;return(n=this._str)!==null&&n!==void 0?n:this._str=this._items.reduce((i,r)=>`${i}${r}`,"")}get names(){var n;return(n=this._names)!==null&&n!==void 0?n:this._names=this._items.reduce((i,r)=>{if(r instanceof Jr)i[r.str]=(i[r.str]||0)+1;return i},{})}}TD._Code=fi;TD.nil=new fi("");function BD(n,...i){let r=[n[0]],o=0;while(o<i.length)Kc(r,i[o]),r.push(n[++o]);return new fi(r)}TD._=BD;var Fc=new fi("+");function PD(n,...i){let r=[tu(n[0])],o=0;while(o<i.length)r.push(Fc),Kc(r,i[o]),r.push(Fc,tu(n[++o]));return AJ(r),new fi(r)}TD.str=PD;function Kc(n,i){if(i instanceof fi)n.push(...i._items);else if(i instanceof Jr)n.push(i);else n.push(OJ(i))}TD.addCodeArg=Kc;function AJ(n){let i=1;while(i<n.length-1){if(n[i]===Fc){let r=kJ(n[i-1],n[i+1]);if(r!==void 0){n.splice(i-1,3,r);continue}n[i++]="+"}i++}}function kJ(n,i){if(i==='""')return n;if(n==='""')return i;if(typeof n=="string"){if(i instanceof Jr||n[n.length-1]!=='"')return;if(typeof i!="string")return`${n.slice(0,-1)}${i}"`;if(i[0]==='"')return n.slice(0,-1)+i.slice(1);return}if(typeof i=="string"&&i[0]==='"'&&!(n instanceof Jr))return`"${n}${i.slice(1)}`;return}function dJ(n,i){return i.emptyStr()?n:n.emptyStr()?i:PD`${n}${i}`}TD.strConcat=dJ;function OJ(n){return typeof n=="number"||typeof n=="boolean"||n===null?n:tu(Array.isArray(n)?n.join(","):n)}function LJ(n){return new fi(tu(n))}TD.stringify=LJ;function tu(n){return JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}TD.safeStringify=tu;function NJ(n){return typeof n=="string"&&TD.IDENTIFIER.test(n)?new fi(`.${n}`):BD`[${n}]`}TD.getProperty=NJ;function yJ(n){if(typeof n=="string"&&TD.IDENTIFIER.test(n))return new fi(`${n}`);throw Error(`CodeGen: invalid export name: ${n}, use explicit $id name mapping`)}TD.getEsmExportName=yJ;function GJ(n){return new fi(n.toString())}TD.regexpCode=GJ});var Ec=H((_D)=>{Object.defineProperty(_D,"__esModule",{value:!0});_D.ValueScope=_D.ValueScopeName=_D.Scope=_D.varKinds=_D.UsedValueState=void 0;var sn=ru();class VD extends Error{constructor(n){super(`CodeGen: "code" for ${n} not defined`);this.value=n.value}}var zl;(function(n){n[n.Started=0]="Started",n[n.Completed=1]="Completed"})(zl||(_D.UsedValueState=zl={}));_D.varKinds={const:new sn.Name("const"),let:new sn.Name("let"),var:new sn.Name("var")};class Pc{constructor({prefixes:n,parent:i}={}){this._names={},this._prefixes=n,this._parent=i}toName(n){return n instanceof sn.Name?n:this.name(n)}name(n){return new sn.Name(this._newName(n))}_newName(n){let i=this._names[n]||this._nameGroup(n);return`${n}${i.index++}`}_nameGroup(n){var i,r;if(((r=(i=this._parent)===null||i===void 0?void 0:i._prefixes)===null||r===void 0?void 0:r.has(n))||this._prefixes&&!this._prefixes.has(n))throw Error(`CodeGen: prefix "${n}" is not allowed in this scope`);return this._names[n]={prefix:n,index:0}}}_D.Scope=Pc;class Tc extends sn.Name{constructor(n,i){super(i);this.prefix=n}setValue(n,{property:i,itemIndex:r}){this.value=n,this.scopePath=sn._`.${new sn.Name(i)}[${r}]`}}_D.ValueScopeName=Tc;var TJ=sn._`\n`;class qD extends Pc{constructor(n){super(n);this._values={},this._scope=n.scope,this.opts={...n,_n:n.lines?TJ:sn.nil}}get(){return this._scope}name(n){return new Tc(n,this._newName(n))}value(n,i){var r;if(i.ref===void 0)throw Error("CodeGen: ref must be passed in value");let o=this.toName(n),{prefix:t}=o,u=(r=i.key)!==null&&r!==void 0?r:i.ref,e=this._values[t];if(e){let I=e.get(u);if(I)return I}else e=this._values[t]=newLine truncated
`:""},this._extScope=n,this._scope=new ci.Scope({parent:n}),this._nodes=[new xD]}toString(){return this._root.render(this.opts)}name(n){return this._scope.name(n)}scopeName(n){return this._extScope.name(n)}scopeValue(n,i){let r=this._extScope.value(n,i);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(n,i){return this._extScope.getValue(n,i)}scopeRefs(n){return this._extScope.scopeRefs(n,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(n,i,r,o){let t=this._scope.toName(i);if(r!==void 0&&o)this._constants[t.str]=r;return this._leafNode(new MD(n,t,r)),t}const(n,i,r){return this._def(ci.varKinds.const,n,i,r)}let(n,i,r){return this._def(ci.varKinds.let,n,i,r)}var(n,i,r){return this._def(ci.varKinds.var,n,i,r)}assign(n,i,r){return this._leafNode(new _c(n,i,r))}add(n,i){return this._leafNode(new zD(n,ni.operators.ADD,i))}code(n){if(typeof n=="function")n();else if(n!==s.nil)this._leafNode(new mD(n));return this}object(...n){let i=["{"];for(let[r,o]of n){if(i.length>1)i.push(",");if(i.push(r),r!==o||this.opts.es5)i.push(":"),(0,s.addCodeArg)(i,o)}return i.push("}"),new s._Code(i)}if(n,i,r){if(this._blockNode(new Ei(n)),i&&r)this.code(i).else().code(r).endIf();else if(i)this.code(i).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(n){return this._elseNode(new Ei(n))}else(){return this._elseNode(new ou)}endIf(){return this._endBlockNode(Ei,ou)}_for(n,i){if(this._blockNode(n),i)this.code(i).endFor();return this}for(n,i){return this._for(new aD(n),i)}forRange(n,i,r,o,t=this.opts.es5?ci.varKinds.var:ci.varKinds.let){let u=this._scope.toName(n);return this._for(new sD(t,u,i,r),()=>o(u))}forOf(n,i,r,o=ci.varKinds.const){let t=this._scope.toName(n);if(this.opts.es5){let u=i instanceof s.Name?i:this.var("_arr",i);return this.forRange("_i",0,s._`${u}.length`,(e)=>{this.var(t,s._`${u}[${e}]`),r(t)})}return this._for(new Vc("of",o,t,i),()=>r(t))}forIn(n,i,r,o=this.opts.es5?ci.varKinds.var:ci.varKinds.const){if(this.opts.ownProperties)return this.forOf(n,s._`Object.keys(${i})`,r);let t=this._scope.toName(n);return this._for(new Vc("in",o,t,i),()=>r(t))}endFor(){return this._endBlockNode(Xr)}label(n){return this._leafNode(new CD(n))}break(n){return this._leafNode(new RD(n))}return(n){let i=new Rl;if(this._blockNode(i),this.code(n),i.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Rl)}try(n,i,r){if(!i&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new n1;if(this._blockNode(o),this.code(n),i){let t=this.name("e");this._currNode=o.catch=new hl(t),i(t)}if(r)this._currNode=o.finally=new ml,this.code(r);return this._endBlockNode(hl,ml)}throw(n){return this._leafNode(new hD(n))}block(n,i){if(this._blockStarts.push(this._nodes.length),n)this.code(n).endBlock(i);return this}endBlock(n){let i=this._blockStarts.pop();if(i===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-i;if(r<0||n!==void 0&&r!==n)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${n} expected`);return this._nodes.length=i,this}func(n,i=s.nil,r,o){if(this._blockNode(new Cl(n,i,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(Cl)}optimize(n=1){while(n-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(n){return this._currNode.nodes.push(n),this}_blockNode(n){this._currNode.nodes.push(n),this._nodes.push(n)}_endBlockNode(n,i){let r=this._currNode;if(r instanceof n||i&&r instanceof i)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${i?`${n.kind}/${i.kind}`:n.kind}"`)}_elseNode(n){let i=this._currNode;if(!(i instanceof Ei))throw Error('CodeGen: "else" without "if"');return this._currNode=i.else=n,this}get _root(){return this._nodes[0]}get _currNode(){let n=this._nodes;return n[n.length-1]}set _currNode(n){let i=this._nodes;i[i.length-1]=n}}ni.CodeGen=i1;function Yt(n,i){for(let r in i)n[r]=(n[r]||0)+(i[r]||0);return n}function xl(n,i){return i instanceof s._CodeOrName?Yt(n,i.names):n}function Hr(n,i,r){if(n instanceof s.Name)return o(n);if(!t(n))return n;return new s._Code(n._items.reduce((u,e)=>{if(e instanceof s.Name)e=o(e);if(e instanceof s._Code)u.push(...e._items);else u.push(e);return u},[]));function o(u){let e=r[u.str];if(e===void 0||i[u.str]!==1)return u;return delete i[u.str],e}function t(u){return u instanceof s._Code&&u._items.some((e)=>e instanceof s.Name&&i[e.str]===1&&r[e.str]!==void 0)}}function _J(n,i){for(let r in i)n[r]=(n[r]||0)-(i[r]||0)}function t1(n){return typeof n=="boolean"||typeof n=="number"||n===null?!n:s._`!${qc(n)}`}ni.not=t1;var ZJ=r1(ni.operators.AND);function MJ(...n){return n.reduce(ZJ)}ni.and=MJ;var zJ=r1(ni.operators.OR);function CJ(...n){return n.reduce(zJ)}ni.or=CJ;function r1(n){return(i,r)=>i===s.nil?r:r===s.nil?i:s._`${qc(i)} ${n} ${qc(r)}`}function qc(n){return n instanceof s.Name?n:s._`(${n})`}});var tn=H((b1)=>{Object Line truncated
|| (${e} == "string" && ${t} && ${t} == +${t})`).assign(l,C._`+${t}`);return;case"integer":o.elseIf(C._`${e} === "boolean" || ${t} === null
|| (${e} === "string" && ${t} && ${t} == +${t} && !(${t} % 1))`).assign(l,C._`+${t}`);return;case"boolean":o.elseIf(C._`${t} === "false" || ${t} === 0 || ${t} === null`).assign(l,!1).elseIf(C._`${t} === "true" || ${t} === 1`).assign(l,!0);return;case"null":o.elseIf(C._`${t} === "" || ${t} === 0 || ${t} === false`),o.assign(l,null);return;case"array":o.elseIf(C._`${e} === "string" || ${e} === "number"
|| ${e} === "boolean" || ${t} === null`).assign(l,C._`[${t}]`)}}}function e8({gen:n,parentData:i,parentDataProperty:r},o){n.if(C._`${i} !== undefined`,()=>n.assign(C._`${i}[${r}]`,o))}function mc(n,i,r,o=Yr.Correct){let t=o===Yr.Correct?C.operators.EQ:C.operators.NEQ,u;switch(n){case"null":return C._`${i} ${t} null`;case"array":u=C._`Array.isArray(${i})`;break;case"object":u=C._`${i} && typeof ${i} == "object" && !Array.isArray(${i})`;break;case"integer":u=e(C._`!(${i} % 1) && !isNaN(${i})`);break;case"number":u=e();break;default:return C._`typeof ${i} ${t} ${n}`}return o===Yr.Correct?u:(0,C.not)(u);function e(l=C.nil){return(0,C.and)(C._`typeof ${i} == "number"`,l,r?C._`isFinite(${i})`:C.nil)}}Y1.checkDataType=mc;function xc(n,i,r,o){if(n.length===1)return mc(n[0],i,r,o);let t,u=(0,J1.toHash)(n);if(u.array&&u.object){let e=C._`typeof ${i} != "object"`;t=u.null?e:C._`!${i} || ${e}`,delete u.null,delete u.array,delete u.object}else t=C.nil;if(u.number)delete u.integer;for(let e in u)t=(0,C.and)(t,mc(e,i,r,o));return t}Y1.checkDataTypes=xc;var l8={message:({schema:n})=>`must be ${n}`,params:({schema:n,schemaValue:i})=>typeof n=="string"?C._`{type: ${n}}`:C._`{type: ${i}}`};function ac(n){let i=v8(n);(0,i8.reportError)(i,l8)}Y1.reportTypeError=ac;function v8(n){let{gen:i,data:r,schema:o}=n,t=(0,J1.schemaRefOrVal)(n,o,"type");return{gen:i,keyword:"type",data:r,schema:o.type,schemaCode:t,schemaValue:t,parentSchema:o,params:{},it:n}}});var P1=H((K1)=>{Object.defineProperty(K1,"__esModule",{value:!0});K1.assignDefaults=void 0;var Qr=R(),c8=tn();function U8(n,i){let{properties:r,items:o}=n.schema;if(i==="object"&&r)for(let t in r)F1(n,t,r[t].default);else if(i==="array"&&Array.isArray(o))o.forEach((t,u)=>F1(n,u,t.default))}K1.assignDefaults=U8;function F1(n,i,r){let{gen:o,compositeRule:t,data:u,opts:e}=n;if(r===void 0)return;let l=Qr._`${u}${(0,Qr.getProperty)(i)}`;if(t){(0,c8.checkStrictMode)(n,`default is ignored for: ${l}`);return}let $=Qr._`${l} === undefined`;if(e.useDefaults==="empty")$=Qr._`${$} || ${l} === null || ${l} === ""`;o.if($,Qr._`${l} = ${(0,Qr.stringify)(r)}`)}});var gi=H((V1)=>{Object.defineProperty(V1,"__esModule",{value:!0});V1.validateUnion=V1.validateArray=V1.usePattern=V1.callValidateCode=V1.schemaProperties=V1.allSchemaProperties=V1.noPropertyInData=V1.propertyInData=V1.isOwnProperty=V1.hasPropFunc=V1.reportMissingProp=V1.checkMissingProp=V1.checkReportMissingProp=void 0;var Dn=R(),sc=tn(),gt=Vi(),D8=tn();function S8(n,i){let{gen:r,data:o,it:t}=n;r.if(i6(r,o,i,t.opts.ownProperties),()=>{n.setParams({missingProperty:Dn._`${i}`},!0),n.error()})}V1.checkReportMissingProp=S8;function A8({gen:n,data:i,it:{opts:r}},o,t){return(0,Dn.or)(...o.map((u)=>(0,Dn.and)(i6(n,i,u,r.ownProperties),Dn._`${t} = ${u}`)))}V1.checkMissingProp=A8;function k8(n,i){n.setParams({missingProperty:i},!0),n.error()}V1.reportMissingProp=k8;function T1(n){return n.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Dn._`Object.prototype.hasOwnProperty`})}V1.hasPropFunc=T1;function n6(n,i,r){return Dn._`${T1(n)}.call(${i}, ${r})`}V1.isOwnProperty=n6;function d8(n,i,r,o){let t=Dn._`${i}${(0,Dn.getProperty)(r)} !== undefined`;return o?Dn._`${t} && ${n6(n,i,r)}`:t}V1.propertyInData=d8;function i6(n,i,r,o){let t=Dn._`${i}${(0,Dn.getProperty)(r)} === undefined`;return o?(0,Dn.or)(t,(0,Dn.not)(n6(n,i,r))):t}V1.noPropertyInData=i6;function E1(n){return n?Object.keys(n).filter((i)=>i!=="__proto__"):[]}V1.allSchemaProperties=E1;function O8(n,i){return E1(i).filter((r)=>!(0,sc.alwaysValidSchema)(n,i[r]))}V1.schemaProperties=O8;function L8({schemaCode:n,data:i,it:{gen:r,topSchemaRef:o,schemaPath:t,errorPath:u},it:e},l,$,I){let g=I?Dn._`${n}, ${i}, ${o}${t}`:i,b=[[gt.default.instancePath,(0,Dn.strConcat)(gt.default.instancePath,u)],[gt.default.parentData,e.parentData],[gt.default.parentDataProperty,e.parentDataProperty],[gt.default.rootData,gt.default.rootData]];if(e.opts.dynamicRef)b.push([gt.default.dynamicAnchors,gt.default.dynamicAnchors]);let w=Dn._`${g}, ${r.object(...b)}`;return $!==Dn.nil?Dn._`${l}.call(${$}, ${w})`:Dn._`${l}(${w})`}V1.callValidateCode=L8;var N8=Dn._`new RegExp`;function y8({gen:n,it:{opts:i}},r){let o=i.unicodeRegExp?"u":"",{regExp:t}=i.code,u=t(r,o);return n.scopeValue("pattern",{key:u.toString(),ref:u,code:Dn._`${t.code==="new RegExp"?N8:(0,D8.useFunc)(n,t)}(${r}, ${o})`})}V1.usePattern=y8;function G8(n){let{gen:i,data:r,keyword:o,it:t}=n,u=i.name("valid");if(t.allErrors){let l=i.let("valid",!0);return e(()=>i.assign(l,!1)),l}return i.var(u,!0),e(()=>i.break()),u;function e(l){let $=i.const("len",Dn._`${r}.length`);i.forRange("i",0,$,(I)=>{n.subschema({keyword:o,dataProp:I,dataPropType:sc.Type.Num},u),i.if((0,Dn.not)(u),l)})}}V1.validateArray=G8;function W8(n){let{gen:i,schema:r,keyword:o,it:t}=n;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some(($)=>(0,sc.alwaysValidSchema)(t,$))&&!t.opts.unevaluated)return;let e=i.let("valid",!1),l=i.name("_valid");i.block(()=>r. Line truncated
missingProperty: ${o},
depsCount: ${i},
deps: ${r}}`};var z7={keyword:"dependencies",type:"object",schemaType:"object",error:ok.error,code(n){let[i,r]=C7(n);tk(n,i),rk(n,r)}};function C7({schema:n}){let i={},r={};for(let o in n){if(o==="__proto__")continue;let t=Array.isArray(n[o])?i:r;t[o]=n[o]}return[i,r]}function tk(n,i=n.schema){let{gen:r,data:o,it:t}=n;if(Object.keys(i).length===0)return;let u=r.let("missing");for(let e in i){let l=i[e];if(l.length===0)continue;let $=(0,Ou.propertyInData)(r,o,e,t.opts.ownProperties);if(n.setParams({property:e,depsCount:l.length,deps:l.join(", ")}),t.allErrors)r.if($,()=>{for(let I of l)(0,Ou.checkReportMissingProp)(n,I)});else r.if(N6._`${$} && (${(0,Ou.checkMissingProp)(n,l,u)})`),(0,Ou.reportMissingProp)(n,u),r.else()}}ok.validatePropertyDeps=tk;function rk(n,i=n.schema){let{gen:r,data:o,keyword:t,it:u}=n,e=r.name("valid");for(let l in i){if((0,M7.alwaysValidSchema)(u,i[l]))continue;r.if((0,Ou.propertyInData)(r,o,l,u.opts.ownProperties),()=>{let $=n.subschema({keyword:t,schemaProp:l},e);n.mergeValidEvaluated($,e)},()=>r.var(e,!0)),n.ok(e)}}ok.validateSchemaDeps=rk;ok.default=z7});var Ik=H(($k)=>{Object.defineProperty($k,"__esModule",{value:!0});var vk=R(),m7=tn(),x7={message:"property name must be valid",params:({params:n})=>vk._`{propertyName: ${n.propertyName}}`},a7={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:x7,code(n){let{gen:i,schema:r,data:o,it:t}=n;if((0,m7.alwaysValidSchema)(t,r))return;let u=i.name("valid");i.forIn("key",o,(e)=>{n.setParams({propertyName:e}),n.subschema({keyword:"propertyNames",data:e,dataTypes:["string"],propertyName:e,compositeRule:!0},u),i.if((0,vk.not)(u),()=>{if(n.error(!0),!t.allErrors)i.break()})}),n.ok(u)}};$k.default=a7});var y6=H((gk)=>{Object.defineProperty(gk,"__esModule",{value:!0});var Av=gi(),Si=R(),n5=Vi(),kv=tn(),i5={message:"must NOT have additional properties",params:({params:n})=>Si._`{additionalProperty: ${n.additionalProperty}}`},t5={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:i5,code(n){let{gen:i,schema:r,parentSchema:o,data:t,errsCount:u,it:e}=n;if(!u)throw Error("ajv implementation error");let{allErrors:l,opts:$}=e;if(e.props=!0,$.removeAdditional!=="all"&&(0,kv.alwaysValidSchema)(e,r))return;let I=(0,Av.allSchemaProperties)(o.properties),g=(0,Av.allSchemaProperties)(o.patternProperties);b(),n.ok(Si._`${u} === ${n5.default.errors}`);function b(){i.forIn("key",t,(d)=>{if(!I.length&&!g.length)c(d);else i.if(w(d),()=>c(d))})}function w(d){let O;if(I.length>8){let F=(0,kv.schemaRefOrVal)(e,o.properties,"properties");O=(0,Av.isOwnProperty)(i,F,d)}else if(I.length)O=(0,Si.or)(...I.map((F)=>Si._`${d} === ${F}`));else O=Si.nil;if(g.length)O=(0,Si.or)(O,...g.map((F)=>Si._`${(0,Av.usePattern)(n,F)}.test(${d})`));return(0,Si.not)(O)}function f(d){i.code(Si._`delete ${t}[${d}]`)}function c(d){if($.removeAdditional==="all"||$.removeAdditional&&r===!1){f(d);return}if(r===!1){if(n.setParams({additionalProperty:d}),n.error(),!l)i.break();return}if(typeof r=="object"&&!(0,kv.alwaysValidSchema)(e,r)){let O=i.name("valid");if($.removeAdditional==="failing")S(d,O,!1),i.if((0,Si.not)(O),()=>{n.reset(),f(d)});else if(S(d,O),!l)i.if((0,Si.not)(O),()=>i.break())}}function S(d,O,F){let Q={keyword:"additionalProperties",dataProp:d,dataPropType:kv.Type.Str};if(F===!1)Object.assign(Q,{compositeRule:!0,createErrors:!1,allErrors:!1});n.subschema(Q,O)}}};gk.default=t5});var ck=H((fk)=>{Object.defineProperty(fk,"__esModule",{value:!0});var o5=Iu(),bk=gi(),G6=tn(),wk=y6(),u5={keyword:"properties",type:"object",schemaType:"object",code(n){let{gen:i,schema:r,parentSchema:o,data:t,it:u}=n;if(u.opts.removeAdditional==="all"&&o.additionalProperties===void 0)wk.default.code(new o5.KeywordCxt(u,wk.default,"additionalProperties"));let e=(0,bk.allSchemaProperties)(r);for(let b of e)u.definedProperties.add(b);if(u.opts.unevaluated&&e.length&&u.props!==!0)u.props=G6.mergeEvaluated.props(i,(0,G6.toHash)(e),u.props);let l=e.filter((b)=>!(0,G6.alwaysValidSchema)(u,r[b]));if(l.length===0)return;let $=i.name("valid");for(let b of l){if(I(b))g(b);else{if(i.if((0,bk.propertyInData)(i,t,b,u.opts.ownProperties)),g(b),!u.allErrors)i.else().var($,!0);i.endIf()}n.it.definedProperties.add(b),n.ok($)}function I(b){return u.opts.useDefaults&&!u.compositeRule&&r[b].default!==void 0}function g(b){n.subschema({keyword:"properties",schemaProp:b,dataProp:b},$)}}};fk.default=u5});var kk=H((Ak)=>{Object.defineProperty(Ak,"__esModule",{value:!0});var Uk=gi(),dv=R(),Dk=tn(),Sk=tn(),l5={keyword:"patternProperties",type:"object",schemaType:"object",code(n){let{gen:i,schema:r,data:o,parentSchema:t,it:u}=n,{opts:e}=u,l=(0,Uk.allSchemaProperties)(r),$=l.filter((S)=>(0,Dk.alwaysValidSchema)(u,r[S]));if(l.length===0||$.length===l.length&&(!u.opts.unevaluated||u.props===!0))return;let I=e.strictSchema&&!e.allowMatchingProperties&&t.properties,g=i.name("valid");if(u.props!==!0&&!(u.props instanceof dv.Name))u.props=(0,Sk. Line truncated
`)}var mt=(n)=>(i,r,o,t)=>{let u=o?{...o,async:!1}:{async:!1},e=i._zod.run({value:r,issues:[]},u);if(e instanceof Promise)throw new Ni;if(e.issues.length){let l=new(t?.Err??n)(e.issues.map(($)=>Zn($,u,dn())));throw ie(l,t?.callee),l}return e.value},wo=mt(xn),xt=(n)=>async(i,r,o,t)=>{let u=o?{...o,async:!0}:{async:!0},e=i._zod.run({value:r,issues:[]},u);if(e instanceof Promise)e=await e;if(e.issues.length){let l=new(t?.Err??n)(e.issues.map(($)=>Zn($,u,dn())));throw ie(l,t?.callee),l}return e.value},fo=xt(xn),at=(n)=>(i,r,o)=>{let t=o?{...o,async:!1}:{async:!1},u=i._zod.run({value:r,issues:[]},t);if(u instanceof Promise)throw new Ni;return u.issues.length?{success:!1,error:new(n??Io)(u.issues.map((e)=>Zn(e,t,dn())))}:{success:!0,data:u.value}},st=at(xn),nr=(n)=>async(i,r,o)=>{let t=o?{...o,async:!0}:{async:!0},u=i._zod.run({value:r,issues:[]},t);if(u instanceof Promise)u=await u;return u.issues.length?{success:!1,error:new n(u.issues.map((e)=>Zn(e,t,dn())))}:{success:!0,data:u.value}},co=nr(xn),te=(n)=>(i,r,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return mt(n)(i,r,t)},S0=te(xn),re=(n)=>(i,r,o)=>{return mt(n)(i,r,o)},A0=re(xn),oe=(n)=>async(i,r,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return xt(n)(i,r,t)},k0=oe(xn),ue=(n)=>async(i,r,o)=>{return xt(n)(i,r,o)},d0=ue(xn),ee=(n)=>(i,r,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return at(n)(i,r,t)},O0=ee(xn),le=(n)=>(i,r,o)=>{return at(n)(i,r,o)},L0=le(xn),ve=(n)=>async(i,r,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return nr(n)(i,r,t)},N0=ve(xn),$e=(n)=>async(i,r,o)=>{return nr(n)(i,r,o)},y0=$e(xn);var ui={};Fi(ui,{xid:()=>E$,uuid7:()=>jG,uuid6:()=>WG,uuid4:()=>GG,uuid:()=>Wt,uppercase:()=>gI,unicodeEmail:()=>G0,undefined:()=>$I,ulid:()=>T$,time:()=>tI,string:()=>oI,sha512_hex:()=>hG,sha512_base64url:()=>xG,sha512_base64:()=>mG,sha384_hex:()=>zG,sha384_base64url:()=>RG,sha384_base64:()=>CG,sha256_hex:()=>_G,sha256_base64url:()=>MG,sha256_base64:()=>ZG,sha1_hex:()=>EG,sha1_base64url:()=>qG,sha1_base64:()=>VG,rfc5322Email:()=>JG,number:()=>Uo,null:()=>vI,nanoid:()=>q$,md5_hex:()=>BG,md5_base64url:()=>TG,md5_base64:()=>PG,mac:()=>h$,lowercase:()=>II,ksuid:()=>V$,ipv6:()=>R$,ipv4:()=>C$,integer:()=>eI,idnEmail:()=>XG,httpProtocol:()=>s$,html5Email:()=>pG,hostname:()=>QG,hex:()=>KG,guid:()=>Z$,extendedDuration:()=>yG,emoji:()=>z$,email:()=>M$,e164:()=>nI,duration:()=>_$,domain:()=>FG,datetime:()=>rI,date:()=>iI,cuid2:()=>P$,cuid:()=>B$,cidrv6:()=>x$,cidrv4:()=>m$,browserEmail:()=>HG,boolean:()=>lI,bigint:()=>uI,base64url:()=>Ie,base64:()=>a$});var B$=/^[cC][0-9a-z]{6,}$/,P$=/^[0-9a-z]+$/,T$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,E$=/^[0-9a-vA-V]{20}$/,V$=/^[A-Za-z0-9]{27}$/,q$=/^[a-zA-Z0-9_-]{21}$/,_$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,yG=/^[-+]?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)?)??$/,Z$=/^([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})$/,Wt=(n)=>{if(!n)return/^([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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},GG=Wt(4),WG=Wt(6),jG=Wt(7),M$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,pG=/^[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])?)*$/,JG=/^(([^<>()\[\]\\.,;:\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,}))$/,G0=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,XG=G0,HG=/^[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])?)*$/,YG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function z$(){return new RegExp(YG,"u")}var C$=/^(?:(?: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])$/,R$=/^(([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}|:))$/,h$=(n)=>{let i=vi(n??":");return new RegExp(`^(?:[0-9A-F]{2}${i}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${i}){5}[0-9a-f]{2}$`)},m$=/^((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-Line truncated
`).filter((u)=>u),o=Math.min(...r.map((u)=>u.length-u.trimStart().length)),t=r.map((u)=>u.slice(o)).map((u)=>" ".repeat(this.indent*2)+u);for(let u of t)this.content.push(u)}compile(){let n=Function,i=this?.args,o=[...(this?.content??[""]).map((t)=>` ${t}`)];return new n(...i,o.join(`
`))}}var JI={major:4,minor:4,patch:3};var T=D("$ZodType",(n,i)=>{var r;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=JI;let o=[...n._zod.def.checks??[]];if(n._zod.traits.has("$ZodCheck"))o.unshift(n);for(let t of o)for(let u of t._zod.onattach)u(n);if(o.length===0)(r=n._zod).deferred??(r.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{let t=(e,l,$)=>{let I=ai(e),g;for(let b of l){if(b._zod.def.when){if(Q$(e))continue;if(!b._zod.def.when(e))continue}else if(I)continue;let w=e.issues.length,f=b._zod.check(e);if(f instanceof Promise&&$?.async===!1)throw new Ni;if(g||f instanceof Promise)g=(g??Promise.resolve()).then(async()=>{if(await f,e.issues.length===w)return;if(!I)I=ai(e,w)});else{if(e.issues.length===w)continue;if(!I)I=ai(e,w)}}if(g)return g.then(()=>{return e});return e},u=(e,l,$)=>{if(ai(e))return e.aborted=!0,e;let I=t(l,o,$);if(I instanceof Promise){if($.async===!1)throw new Ni;return I.then((g)=>n._zod.parse(g,$))}return n._zod.parse(I,$)};n._zod.run=(e,l)=>{if(l.skipChecks)return n._zod.parse(e,l);if(l.direction==="backward"){let I=n._zod.parse({value:e.value,issues:[]},{...l,skipChecks:!0});if(I instanceof Promise)return I.then((g)=>{return u(g,e,l)});return u(I,e,l)}let $=n._zod.parse(e,l);if($ instanceof Promise){if(l.async===!1)throw new Ni;return $.then((I)=>t(I,o,l))}return t($,o,l)}}h(n,"~standard",()=>({validate:(t)=>{try{let u=st(n,t);return u.success?{value:u.data}:{issues:u.error?.issues}}catch(u){return co(n,t).then((e)=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),jt=D("$ZodString",(n,i)=>{T.init(n,i),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??oI(n._zod.bag),n._zod.parse=(r,o)=>{if(i.coerce)try{r.value=String(r.value)}catch(t){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:n}),r}}),$n=D("$ZodStringFormat",(n,i)=>{ir.init(n,i),jt.init(n,i)}),HI=D("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=Z$),$n.init(n,i)}),YI=D("$ZodUUID",(n,i)=>{if(i.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(o===void 0)throw Error(`Invalid UUID version: "${i.version}"`);i.pattern??(i.pattern=Wt(o))}else i.pattern??(i.pattern=Wt());$n.init(n,i)}),QI=D("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=M$),$n.init(n,i)}),FI=D("$ZodURL",(n,i)=>{$n.init(n,i),n._zod.check=(r)=>{try{let o=r.value.trim();if(!i.normalize&&i.protocol?.source===s$.source){if(!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:n,continue:!i.abort});return}}let t=new URL(o);if(i.hostname){if(i.hostname.lastIndex=0,!i.hostname.test(t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:r.value,inst:n,continue:!i.abort})}if(i.protocol){if(i.protocol.lastIndex=0,!i.protocol.test(t.protocol.endsWith(":")?t.protocol.slice(0,-1):t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:r.value,inst:n,continue:!i.abort})}if(i.normalize)r.value=t.href;else r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:n,continue:!i.abort})}}}),KI=D("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=z$()),$n.init(n,i)}),BI=D("$ZodNanoID",(n,i)=>{i.pattern??(i.pattern=q$),$n.init(n,i)}),PI=D("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=B$),$n.init(n,i)}),TI=D("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=P$),$n.init(n,i)}),EI=D("$ZodULID",(n,i)=>{i.pattern??(i.pattern=T$),$n.init(n,i)}),VI=D("$ZodXID",(n,i)=>{i.pattern??(i.pattern=E$),$n.init(n,i)}),qI=D("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=V$),$n.init(n,i)}),_I=D("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=rI(i)),$n.init(n,i)}),ZI=D("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=iI),$n.init(n,i)}),MI=D("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=tI(i)),$n.init(n,i)}),zI=D("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=_$),$n.init(n,i)}),CI=D("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=C$),$n.init(n,i),n._zod.bag.format="ipv4"}),RI=D("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=R$),$n.init(n,i),n._zod.bag.format="ipv6",n._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:n,continue:!i.abort})}}}),hI=D("$ZodMAC",(n,i)=>{i.pattern??(i.pattern=h$(i.delimiter)),$n.init(n,i),n._zod.bag.format="mac"}),mI=D("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=m$),$n.init(n,i)}),xI=D("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=x$),$n.init(n,i),n._zod.check=(r)=>{let o=r.value.split("/");try{if(o.length!==2)throw Error();let[t,u]=o;if(!u)throw Error();let e=Number(u);if(`${e}`!==u)throw Error();if(e<0||e>128)throw Error();new URL(`http://[${t}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:n,continue:!i.abort})}}});function aI(n){if(n==="")return!0;if(/\s/.test(n))return!1;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}var Line truncated
if (${W}.issues.length) {
if (${L} in input) {
payload.issues = payload.issues.concat(${W}.issues.map(iss => ({
import{createRequire as VD0}from"node:module";var UD0=Object.create;var{getPrototypeOf:YD0,defineProperty:SL,getOwnPropertyNames:JD0}=Object;var QD0=Object.prototype.hasOwnProperty;function KD0($){return this[$]}var zD0,wD0,hY=($,q,I)=>{var U=$!=null&&typeof $==="object";if(U){var Y=q?zD0??=new WeakMap:wD0??=new WeakMap,J=Y.get($);if(J)return J}I=$!=null?UD0(YD0($)):{};let Q=q||!$||!$.__esModule?SL(I,"default",{value:$,enumerable:!0}):I;for(let K of JD0($))if(!QD0.call(Q,K))SL(Q,K,{get:KD0.bind($,K),enumerable:!0});if(U)Y.set($,Q);return Q};var O=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);var GD0=($)=>$;function HD0($,q){this[$]=GD0.bind(null,q)}var l8=($,q)=>{for(var I in q)SL($,I,{get:q[I],enumerable:!0,configurable:!0,set:HD0.bind(q,I)})};var o=VD0(import.meta.url);var _J=O((pf)=>{Object.defineProperty(pf,"__esModule",{value:!0});pf.regexpCode=pf.getEsmExportName=pf.getProperty=pf.safeStringify=pf.stringify=pf.strConcat=pf.addCodeArg=pf.str=pf._=pf.nil=pf._Code=pf.Name=pf.IDENTIFIER=pf._CodeOrName=void 0;class hG{}pf._CodeOrName=hG;pf.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class mq extends hG{constructor($){super();if(!pf.IDENTIFIER.test($))throw Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}pf.Name=mq;class x$ extends hG{constructor($){super();this._items=typeof $==="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((q,I)=>`${q}${I}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((q,I)=>{if(I instanceof mq)q[I.str]=(q[I.str]||0)+1;return q},{})}}pf._Code=x$;pf.nil=new x$("");function nf($,...q){let I=[$[0]],U=0;while(U<q.length)mP(I,q[U]),I.push($[++U]);return new x$(I)}pf._=nf;var lP=new x$("+");function bf($,...q){let I=[CJ($[0])],U=0;while(U<q.length)I.push(lP),mP(I,q[U]),I.push(lP,CJ($[++U]));return hF0(I),new x$(I)}pf.str=bf;function mP($,q){if(q instanceof x$)$.push(...q._items);else if(q instanceof mq)$.push(q);else $.push(uF0(q))}pf.addCodeArg=mP;function hF0($){let q=1;while(q<$.length-1){if($[q]===lP){let I=SF0($[q-1],$[q+1]);if(I!==void 0){$.splice(q-1,3,I);continue}$[q++]="+"}q++}}function SF0($,q){if(q==='""')return $;if($==='""')return q;if(typeof $=="string"){if(q instanceof mq||$[$.length-1]!=='"')return;if(typeof q!="string")return`${$.slice(0,-1)}${q}"`;if(q[0]==='"')return $.slice(0,-1)+q.slice(1);return}if(typeof q=="string"&&q[0]==='"'&&!($ instanceof mq))return`"${$}${q.slice(1)}`;return}function yF0($,q){return q.emptyStr()?$:$.emptyStr()?q:bf`${$}${q}`}pf.strConcat=yF0;function uF0($){return typeof $=="number"||typeof $=="boolean"||$===null?$:CJ(Array.isArray($)?$.join(","):$)}function xF0($){return new x$(CJ($))}pf.stringify=xF0;function CJ($){return JSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}pf.safeStringify=CJ;function kF0($){return typeof $=="string"&&pf.IDENTIFIER.test($)?new x$(`.${$}`):nf`[${$}]`}pf.getProperty=kF0;function fF0($){if(typeof $=="string"&&pf.IDENTIFIER.test($))return new x$(`${$}`);throw Error(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}pf.getEsmExportName=fF0;function nF0($){return new x$($.toString())}pf.regexpCode=nF0});var aP=O((mf)=>{Object.defineProperty(mf,"__esModule",{value:!0});mf.ValueScope=mf.ValueScopeName=mf.Scope=mf.varKinds=mf.UsedValueState=void 0;var k6=_J();class df extends Error{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}var yG;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(yG||(mf.UsedValueState=yG={}));mf.varKinds={const:new k6.Name("const"),let:new k6.Name("let"),var:new k6.Name("var")};class rP{constructor({prefixes:$,parent:q}={}){this._names={},this._prefixes=$,this._parent=q}toName($){return $ instanceof k6.Name?$:this.name($)}name($){return new k6.Name(this._newName($))}_newName($){let q=this._names[$]||this._nameGroup($);return`${$}${q.index++}`}_nameGroup($){var q,I;if(((I=(q=this._parent)===null||q===void 0?void 0:q._prefixes)===null||I===void 0?void 0:I.has($))||this._prefixes&&!this._prefixes.has($))throw Error(`CodeGen: prefix "${$}" is not allowed in this scope`);return this._names[$]={prefix:$,index:0}}}mf.Scope=rP;class tP extends k6.Name{constructor($,q){super(q);this.prefix=$}setValue($,{property:q,itemIndex:I}){this.value=$,this.scopePath=k6._`.${new k6.Name(q)}[${I}]`}}mf.ValueScopeName=tP;var eF0=k6._`\n`;class lf extends rP{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?eF0:k6.nil}}get(){return this._scope}name($){return new tP($,this._newName($))}value($,q){var I;if(q.ref===void 0)throw Error("CodeGen: ref must be passed in value");let U=this.toName($),{prefix:Y}=U,J=(I=q.key)!==null&&I!==void 0?I:q.ref,Q=this._values[Y];if(Q){let w=Q.get(J);if(Line truncated
`:""},this._extScope=$,this._scope=new k$.Scope({parent:$}),this._nodes=[new qn]}toString(){return this._root.render(this.opts)}name($){return this._scope.name($)}scopeName($){return this._extScope.name($)}scopeValue($,q){let I=this._extScope.value($,q);return(this._values[I.prefix]||(this._values[I.prefix]=new Set)).add(I),I}getScopeValue($,q){return this._extScope.getValue($,q)}scopeRefs($){return this._extScope.scopeRefs($,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def($,q,I,U){let Y=this._scope.toName(q);if(I!==void 0&&U)this._constants[Y.str]=I;return this._leafNode(new rf($,Y,I)),Y}const($,q,I){return this._def(k$.varKinds.const,$,q,I)}let($,q,I){return this._def(k$.varKinds.let,$,q,I)}var($,q,I){return this._def(k$.varKinds.var,$,q,I)}assign($,q,I){return this._leafNode(new $T($,q,I))}add($,q){return this._leafNode(new tf($,f6.operators.ADD,q))}code($){if(typeof $=="function")$();else if($!==U1.nil)this._leafNode(new $n($));return this}object(...$){let q=["{"];for(let[I,U]of $){if(q.length>1)q.push(",");if(q.push(I),I!==U||this.opts.es5)q.push(":"),(0,U1.addCodeArg)(q,U)}return q.push("}"),new U1._Code(q)}if($,q,I){if(this._blockNode(new a8($)),q&&I)this.code(q).else().code(I).endIf();else if(q)this.code(q).endIf();else if(I)throw Error('CodeGen: "else" body without "then" body');return this}elseIf($){return this._elseNode(new a8($))}else(){return this._elseNode(new hJ)}endIf(){return this._endBlockNode(a8,hJ)}_for($,q){if(this._blockNode($),q)this.code(q).endFor();return this}for($,q){return this._for(new In($),q)}forRange($,q,I,U,Y=this.opts.es5?k$.varKinds.var:k$.varKinds.let){let J=this._scope.toName($);return this._for(new Un(Y,J,q,I),()=>U(J))}forOf($,q,I,U=k$.varKinds.const){let Y=this._scope.toName($);if(this.opts.es5){let J=q instanceof U1.Name?q:this.var("_arr",q);return this.forRange("_i",0,U1._`${J}.length`,(Q)=>{this.var(Y,U1._`${J}[${Q}]`),I(Y)})}return this._for(new sP("of",U,Y,q),()=>I(Y))}forIn($,q,I,U=this.opts.es5?k$.varKinds.var:k$.varKinds.const){if(this.opts.ownProperties)return this.forOf($,U1._`Object.keys(${q})`,I);let Y=this._scope.toName($);return this._for(new sP("in",U,Y,q),()=>I(Y))}endFor(){return this._endBlockNode(oq)}label($){return this._leafNode(new af($))}break($){return this._leafNode(new sf($))}return($){let q=new xG;if(this._blockNode(q),this.code($),q.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(xG)}try($,q,I){if(!q&&!I)throw Error('CodeGen: "try" without "catch" and "finally"');let U=new Yn;if(this._blockNode(U),this.code($),q){let Y=this.name("e");this._currNode=U.catch=new kG(Y),q(Y)}if(I)this._currNode=U.finally=new fG,this.code(I);return this._endBlockNode(kG,fG)}throw($){return this._leafNode(new ef($))}block($,q){if(this._blockStarts.push(this._nodes.length),$)this.code($).endBlock(q);return this}endBlock($){let q=this._blockStarts.pop();if(q===void 0)throw Error("CodeGen: not in self-balancing block");let I=this._nodes.length-q;if(I<0||$!==void 0&&I!==$)throw Error(`CodeGen: wrong number of nodes: ${I} vs ${$} expected`);return this._nodes.length=q,this}func($,q=U1.nil,I,U){if(this._blockNode(new uG($,q,I)),U)this.code(U).endFunc();return this}endFunc(){return this._endBlockNode(uG)}optimize($=1){while($-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode($){return this._currNode.nodes.push($),this}_blockNode($){this._currNode.nodes.push($),this._nodes.push($)}_endBlockNode($,q){let I=this._currNode;if(I instanceof $||q&&I instanceof q)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${q?`${$.kind}/${q.kind}`:$.kind}"`)}_elseNode($){let q=this._currNode;if(!(q instanceof a8))throw Error('CodeGen: "else" without "if"');return this._currNode=q.else=$,this}get _root(){return this._nodes[0]}get _currNode(){let $=this._nodes;return $[$.length-1]}set _currNode($){let q=this._nodes;q[q.length-1]=$}}f6.CodeGen=Jn;function B7($,q){for(let I in q)$[I]=($[I]||0)+(q[I]||0);return $}function nG($,q){return q instanceof U1._CodeOrName?B7($,q.names):$}function rq($,q,I){if($ instanceof U1.Name)return U($);if(!Y($))return $;return new U1._Code($._items.reduce((J,Q)=>{if(Q instanceof U1.Name)Q=U(Q);if(Q instanceof U1._Code)J.push(...Q._items);else J.push(Q);return J},[]));function U(J){let Q=I[J.str];if(Q===void 0||q[J.str]!==1)return J;return delete q[J.str],Q}function Y(J){return J instanceof U1._Code&&J._items.some((Q)=>Q instanceof U1.Name&&q[Q.str]===1&&I[Q.str]!==void 0)}}function UM0($,q){for(let I in q)$[I]=($[I]||0)-(q[I]||0)}function Qn($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:U1._`!${eP($)}`}f6.not=Qn;var YM0=Kn(f6.operators.AND);function JM0(...$){return $.reduce(YM0)}f6.and=JM0;var QM0=Kn(f6.operators.OR);function KM0(...$){return $.reduce(QM0)}f6.or=KM0;function Kn($){return(q,I)=>q===U1.nil?I:I===U1.nil?q:U1._`${eP(q)} ${$} ${eP(I)}`}function eP($){return $ instanceof U1.Name?$:U1._`(${Line truncated
|| (${Q} == "string" && ${Y} && ${Y} == +${Y})`).assign(K,d0._`+${Y}`);return;case"integer":U.elseIf(d0._`${Q} === "boolean" || ${Y} === null
|| (${Q} === "string" && ${Y} && ${Y} == +${Y} && !(${Y} % 1))`).assign(K,d0._`+${Y}`);return;case"boolean":U.elseIf(d0._`${Y} === "false" || ${Y} === 0 || ${Y} === null`).assign(K,!1).elseIf(d0._`${Y} === "true" || ${Y} === 1`).assign(K,!0);return;case"null":U.elseIf(d0._`${Y} === "" || ${Y} === 0 || ${Y} === false`),U.assign(K,null);return;case"array":U.elseIf(d0._`${Q} === "string" || ${Q} === "number"
|| ${Q} === "boolean" || ${Y} === null`).assign(K,d0._`[${Y}]`)}}}function FA0({gen:$,parentData:q,parentDataProperty:I},U){$.if(d0._`${q} !== undefined`,()=>$.assign(d0._`${q}[${I}]`,U))}function KT($,q,I,U=tq.Correct){let Y=U===tq.Correct?d0.operators.EQ:d0.operators.NEQ,J;switch($){case"null":return d0._`${q} ${Y} null`;case"array":J=d0._`Array.isArray(${q})`;break;case"object":J=d0._`${q} && typeof ${q} == "object" && !Array.isArray(${q})`;break;case"integer":J=Q(d0._`!(${q} % 1) && !isNaN(${q})`);break;case"number":J=Q();break;default:return d0._`typeof ${q} ${Y} ${$}`}return U===tq.Correct?J:(0,d0.not)(J);function Q(K=d0.nil){return(0,d0.and)(d0._`typeof ${q} == "number"`,K,I?d0._`isFinite(${q})`:d0.nil)}}xn.checkDataType=KT;function zT($,q,I,U){if($.length===1)return KT($[0],q,I,U);let Y,J=(0,Sn.toHash)($);if(J.array&&J.object){let Q=d0._`typeof ${q} != "object"`;Y=J.null?Q:d0._`!${q} || ${Q}`,delete J.null,delete J.array,delete J.object}else Y=d0.nil;if(J.number)delete J.integer;for(let Q in J)Y=(0,d0.and)(Y,KT(Q,q,I,U));return Y}xn.checkDataTypes=zT;var MA0={message:({schema:$})=>`must be ${$}`,params:({schema:$,schemaValue:q})=>typeof $=="string"?d0._`{type: ${$}}`:d0._`{type: ${q}}`};function wT($){let q=AA0($);(0,XA0.reportError)(q,MA0)}xn.reportTypeError=wT;function AA0($){let{gen:q,data:I,schema:U}=$,Y=(0,Sn.schemaRefOrVal)($,U,"type");return{gen:q,keyword:"type",data:I,schema:U.type,schemaCode:Y,schemaValue:Y,parentSchema:U,params:{},it:$}}});var pn=O((nn)=>{Object.defineProperty(nn,"__esModule",{value:!0});nn.assignDefaults=void 0;var aq=m0(),RA0=z1();function vA0($,q){let{properties:I,items:U}=$.schema;if(q==="object"&&I)for(let Y in I)fn($,Y,I[Y].default);else if(q==="array"&&Array.isArray(U))U.forEach((Y,J)=>fn($,J,Y.default))}nn.assignDefaults=vA0;function fn($,q,I){let{gen:U,compositeRule:Y,data:J,opts:Q}=$;if(I===void 0)return;let K=aq._`${J}${(0,aq.getProperty)(q)}`;if(Y){(0,RA0.checkStrictMode)($,`default is ignored for: ${K}`);return}let z=aq._`${K} === undefined`;if(Q.useDefaults==="empty")z=aq._`${z} || ${K} === null || ${K} === ""`;U.if(z,aq._`${K} = ${(0,aq.stringify)(I)}`)}});var O$=O((ln)=>{Object.defineProperty(ln,"__esModule",{value:!0});ln.validateUnion=ln.validateArray=ln.usePattern=ln.callValidateCode=ln.schemaProperties=ln.allSchemaProperties=ln.noPropertyInData=ln.propertyInData=ln.isOwnProperty=ln.hasPropFunc=ln.reportMissingProp=ln.checkMissingProp=ln.checkReportMissingProp=void 0;var l1=m0(),GT=z1(),z9=s8(),CA0=z1();function _A0($,q){let{gen:I,data:U,it:Y}=$;I.if(VT(I,U,q,Y.opts.ownProperties),()=>{$.setParams({missingProperty:l1._`${q}`},!0),$.error()})}ln.checkReportMissingProp=_A0;function hA0({gen:$,data:q,it:{opts:I}},U,Y){return(0,l1.or)(...U.map((J)=>(0,l1.and)(VT($,q,J,I.ownProperties),l1._`${Y} = ${J}`)))}ln.checkMissingProp=hA0;function SA0($,q){$.setParams({missingProperty:q},!0),$.error()}ln.reportMissingProp=SA0;function cn($){return $.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:l1._`Object.prototype.hasOwnProperty`})}ln.hasPropFunc=cn;function HT($,q,I){return l1._`${cn($)}.call(${q}, ${I})`}ln.isOwnProperty=HT;function yA0($,q,I,U){let Y=l1._`${q}${(0,l1.getProperty)(I)} !== undefined`;return U?l1._`${Y} && ${HT($,q,I)}`:Y}ln.propertyInData=yA0;function VT($,q,I,U){let Y=l1._`${q}${(0,l1.getProperty)(I)} === undefined`;return U?(0,l1.or)(Y,(0,l1.not)(HT($,q,I))):Y}ln.noPropertyInData=VT;function dn($){return $?Object.keys($).filter((q)=>q!=="__proto__"):[]}ln.allSchemaProperties=dn;function uA0($,q){return dn(q).filter((I)=>!(0,GT.alwaysValidSchema)($,q[I]))}ln.schemaProperties=uA0;function xA0({schemaCode:$,data:q,it:{gen:I,topSchemaRef:U,schemaPath:Y,errorPath:J},it:Q},K,z,w){let G=w?l1._`${$}, ${q}, ${U}${Y}`:q,H=[[z9.default.instancePath,(0,l1.strConcat)(z9.default.instancePath,J)],[z9.default.parentData,Q.parentData],[z9.default.parentDataProperty,Q.parentDataProperty],[z9.default.rootData,z9.default.rootData]];if(Q.opts.dynamicRef)H.push([z9.default.dynamicAnchors,z9.default.dynamicAnchors]);let V=l1._`${G}, ${I.object(...H)}`;return z!==l1.nil?l1._`${K}.call(${z}, ${V})`:l1._`${K}(${V})`}ln.callValidateCode=xA0;var kA0=l1._`new RegExp`;function fA0({gen:$,it:{opts:q}},I){let U=q.unicodeRegExp?"u":"",{regExp:Y}=q.code,J=Y(I,U);return $.scopeValue("pattern",{key:J.toString(),ref:J,code:l1._`${Y.code==="new RegExp"?kA0:(0,CA0.useFunc)($,Y)}(${I}, ${U})`})}ln.usePattern=fA0;function nA0($){let{gen:q,data:I,keyword:U,it:Y}=$,J=q.name("valid");if(Y.allErrors){let K=q.let("valid",!0);return Q(()=>q.assign(K,!1)),K}return q.var(J,!0),Q(()=>q.break()),J;function Q(K){let z=q.const("len",l1._`${I}.length`);q.forRange("i",0,z,(w)=>{$.subschema({keyword:U,dataProp:w,dataPropType:GT.Type.Num},J),q.if((0,l1.not)(J),K)})}}ln.validateArray=nA0;function bA0($){let{gen:q,schema:I,keyword:U,it:Y}=$;if(!Array.isArray(I))throw Error("ajv implementation error");if(I.some((z)=>(0,GT.alwaysValidSchema)(Y,z))&&!Y.opts.unevaluated)return;le Line truncated
missingProperty: ${U},
depsCount: ${q},
deps: ${I}}`};var Qj0={keyword:"dependencies",type:"object",schemaType:"object",error:wp.error,code($){let[q,I]=Kj0($);Kp($,q),zp($,I)}};function Kj0({schema:$}){let q={},I={};for(let U in $){if(U==="__proto__")continue;let Y=Array.isArray($[U])?q:I;Y[U]=$[U]}return[q,I]}function Kp($,q=$.schema){let{gen:I,data:U,it:Y}=$;if(Object.keys(q).length===0)return;let J=I.let("missing");for(let Q in q){let K=q[Q];if(K.length===0)continue;let z=(0,aJ.propertyInData)(I,U,Q,Y.opts.ownProperties);if($.setParams({property:Q,depsCount:K.length,deps:K.join(", ")}),Y.allErrors)I.if(z,()=>{for(let w of K)(0,aJ.checkReportMissingProp)($,w)});else I.if(yT._`${z} && (${(0,aJ.checkMissingProp)($,K,J)})`),(0,aJ.reportMissingProp)($,J),I.else()}}wp.validatePropertyDeps=Kp;function zp($,q=$.schema){let{gen:I,data:U,keyword:Y,it:J}=$,Q=I.name("valid");for(let K in q){if((0,Jj0.alwaysValidSchema)(J,q[K]))continue;I.if((0,aJ.propertyInData)(I,U,K,J.opts.ownProperties),()=>{let z=$.subschema({keyword:Y,schemaProp:K},Q);$.mergeValidEvaluated(z,Q)},()=>I.var(Q,!0)),$.ok(Q)}}wp.validateSchemaDeps=zp;wp.default=Qj0});var Xp=O((Zp)=>{Object.defineProperty(Zp,"__esModule",{value:!0});var Wp=m0(),Gj0=z1(),Hj0={message:"property name must be valid",params:({params:$})=>Wp._`{propertyName: ${$.propertyName}}`},Vj0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Hj0,code($){let{gen:q,schema:I,data:U,it:Y}=$;if((0,Gj0.alwaysValidSchema)(Y,I))return;let J=q.name("valid");q.forIn("key",U,(Q)=>{$.setParams({propertyName:Q}),$.subschema({keyword:"propertyNames",data:Q,dataTypes:["string"],propertyName:Q,compositeRule:!0},J),q.if((0,Wp.not)(J),()=>{if($.error(!0),!Y.allErrors)q.break()})}),$.ok(J)}};Zp.default=Vj0});var uT=O((Dp)=>{Object.defineProperty(Dp,"__esModule",{value:!0});var zH=O$(),b$=m0(),Zj0=s8(),wH=z1(),Xj0={message:"must NOT have additional properties",params:({params:$})=>b$._`{additionalProperty: ${$.additionalProperty}}`},Dj0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Xj0,code($){let{gen:q,schema:I,parentSchema:U,data:Y,errsCount:J,it:Q}=$;if(!J)throw Error("ajv implementation error");let{allErrors:K,opts:z}=Q;if(Q.props=!0,z.removeAdditional!=="all"&&(0,wH.alwaysValidSchema)(Q,I))return;let w=(0,zH.allSchemaProperties)(U.properties),G=(0,zH.allSchemaProperties)(U.patternProperties);H(),$.ok(b$._`${J} === ${Zj0.default.errors}`);function H(){q.forIn("key",Y,(L)=>{if(!w.length&&!G.length)X(L);else q.if(V(L),()=>X(L))})}function V(L){let N;if(w.length>8){let E=(0,wH.schemaRefOrVal)(Q,U.properties,"properties");N=(0,zH.isOwnProperty)(q,E,L)}else if(w.length)N=(0,b$.or)(...w.map((E)=>b$._`${L} === ${E}`));else N=b$.nil;if(G.length)N=(0,b$.or)(N,...G.map((E)=>b$._`${(0,zH.usePattern)($,E)}.test(${L})`));return(0,b$.not)(N)}function W(L){q.code(b$._`delete ${Y}[${L}]`)}function X(L){if(z.removeAdditional==="all"||z.removeAdditional&&I===!1){W(L);return}if(I===!1){if($.setParams({additionalProperty:L}),$.error(),!K)q.break();return}if(typeof I=="object"&&!(0,wH.alwaysValidSchema)(Q,I)){let N=q.name("valid");if(z.removeAdditional==="failing")D(L,N,!1),q.if((0,b$.not)(N),()=>{$.reset(),W(L)});else if(D(L,N),!K)q.if((0,b$.not)(N),()=>q.break())}}function D(L,N,E){let T={keyword:"additionalProperties",dataProp:L,dataPropType:wH.Type.Str};if(E===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(T,N)}}};Dp.default=Dj0});var Fp=O((Np)=>{Object.defineProperty(Np,"__esModule",{value:!0});var Oj0=fJ(),Lp=O$(),xT=z1(),Op=uT(),Nj0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:q,schema:I,parentSchema:U,data:Y,it:J}=$;if(J.opts.removeAdditional==="all"&&U.additionalProperties===void 0)Op.default.code(new Oj0.KeywordCxt(J,Op.default,"additionalProperties"));let Q=(0,Lp.allSchemaProperties)(I);for(let H of Q)J.definedProperties.add(H);if(J.opts.unevaluated&&Q.length&&J.props!==!0)J.props=xT.mergeEvaluated.props(q,(0,xT.toHash)(Q),J.props);let K=Q.filter((H)=>!(0,xT.alwaysValidSchema)(J,I[H]));if(K.length===0)return;let z=q.name("valid");for(let H of K){if(w(H))G(H);else{if(q.if((0,Lp.propertyInData)(q,Y,H,J.opts.ownProperties)),G(H),!J.allErrors)q.else().var(z,!0);q.endIf()}$.it.definedProperties.add(H),$.ok(z)}function w(H){return J.opts.useDefaults&&!J.compositeRule&&I[H].default!==void 0}function G(H){$.subschema({keyword:"properties",schemaProp:H,dataProp:H},z)}}};Np.default=Nj0});var Ep=O((Tp)=>{Object.defineProperty(Tp,"__esModule",{value:!0});var Mp=O$(),GH=m0(),Ap=z1(),Pp=z1(),Mj0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:q,schema:I,data:U,parentSchema:Y,it:J}=$,{opts:Q}=J,K=(0,Mp.allSchemaProperties)(I),z=K.filter((D)=>(0,Ap.alwaysValidSchema)(J,I[D]));if(K.length===0||z.length===K.length&&(!J.opts.unevaluated||J.props===!0))return;let w=Q.strictSchema&&!Q.allowMatchingProperties&&Y.properties,G=q.name("valid");if(J.props!==!0&&!(J.props instanceo Line truncated
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� ­ﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�`},ibm864:"cp864",csibm864:"cp864",cp865:{type:"_sbcs",chars:"ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñѪº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "},ibm865:"cp865",csibm865:"cp865",cp866:{type:"_sbcs",chars:"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ "},ibm866:"cp866",csibm866:"cp866",cp869:{type:"_sbcs",chars:"������Ά�·¬¦‘’Έ―ΉΊΪΌ��ΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»░▒▓│┤ΚΛΜΝ╣║╗╝ΞΟ┐└┴┬├─┼ΠΡ╚╔╩╦╠═╬ΣΤΥΦΧΨΩαβγ┘┌█▄δε▀ζηθικλμνξοπρσςτ΄­±υφχ§ψ΅°¨ωϋΰώ■ "},ibm869:"cp869",csibm869:"cp869",cp922:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®‾°±²³´µ·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖרÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ"},ibm922:"cp922",csibm922:"cp922",cp1046:{type:"_sbcs",chars:"ﺈ×÷ﹱˆ■│─┐┌└┘ﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ ¤ﺋﺑﺗﺛﺟﺣ،­ﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟﻵﻷﻹﻻﻣﻧﻬﻩ�"},ibm1046:"cp1046",csibm1046:"cp1046",cp1124:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂҐЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђґєѕіїјљњћќ§ўџ"},ibm1124:"cp1124",csibm1124:"cp1124",cp1125:{type:"_sbcs",chars:"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёҐґЄєІіЇї·√№¤■ "},ibm1125:"cp1125",csibm1125:"cp1125",cp1129:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§œ©ª«¬­®¯°±²³Ÿµ·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"},ibm1129:"cp1129",csibm1129:"cp1129",cp1133:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ���ຯະາຳິີຶືຸູຼັົຽ���ເແໂໃໄ່້໊໋໌ໍໆ�ໜໝ₭����������������໐໑໒໓໔໕໖໗໘໙��¢¬¦�"},ibm1133:"cp1133",csibm1133:"cp1133",cp1161:{type:"_sbcs",chars:"��������������������������������่กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋€฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛¢¬¦ "},ibm1161:"cp1161",csibm1161:"cp1161",cp1162:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"},ibm1162:"cp1162",csibm1162:"cp1162",cp1163:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥¦§œ©ª«¬­®¯°±²³Ÿµ·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"},ibm1163:"cp1163",csiLine truncated
\v\f\r\x0E\x0F\x10ỨỰỲỶỸÝỴ\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ`},georgianacademy:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ"},georgianps:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"},pt154:{type:"_sbcs",chars:"ҖҒӮғ„…ҶҮҲүҠӢҢҚҺҸҗ‘’“”•–—ҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө·ё№ә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"},viscii:{type:"_sbcs",chars:`\x00\x01Ẳ\x03\x04ẴẪ\x07\b
\v\f\r\x0E\x0F\x10\x11\x12\x13Ỷ\x15\x16\x17\x18Ỹ\x1A\x1B\x1C\x1DỴ\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ`},iso646cn:{type:"_sbcs",chars:`\x00\x01\x02\x03\x04\x05\x06\x07\b
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������`},iso646jp:{type:"_sbcs",chars:`\x00\x01\x02\x03\x04\x05\x06\x07\b
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_\`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������`},hproman8:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¾—¼½ªº«■»±�"},macintosh:{type:"_sbcs",chars:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"},ascii:{type:"_sbcs",chars:"��������������������������������������������������������������������������������������������������������������������������������"},tis620:{type:"_sbcs",chars:"���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"}}});var ym=O((K_0)=>{var Bg=J5().Buffer;K_0._dbcs=K5;var s4=-1,Sm=-2,A$=-10,B6=-1000,EI=Array(256),OQ=-1;for(LQ=0;LQ<256;LQ++)EI[LQ]=s4;var LQ;function K5($,q){if(this.encodingName=$.encodingName,!$)throw Error("DBCS codec is called without the data.");if(!$.table)throw Error("Encoding '"+this.encodingName+"' has no data.");var I=$.table();this.decodeTables=[],this.decodeTables[0]=EI.slice(0),this.decodeTableSeq=[];for(var U=0;U<I.length;U++)this._addDecodeChunk(I[U]);if(typeof $.gb18030==="function"){this.gb18030=$.gb18030();var Y=this.decodeTables.length;this.decodeTables.push(EI.slice(0));var J=this.decodeTables.length;this.decodeTables.push(EI.slice(0));var Q=this.decodeTables[0];for(var U=129;U<=254;U++){var K=this.decodeTables[B6-Q[U]];for(var z=48;z<=57;z++){if(K[z]===s4)K[z]=B6-Y;else if(K[z]>B6)throw Error("gb18030 decode tables conflict at byte 2");var w=this.decodeTables[B6-K[z]];for(var G=129;G<=254;G++){if(w[G]===s4)w[G]=B6-J;else if(w[G]===B6-J)continue;else if(w[G]>B6)throw Error("gb18030 decode tables conflict at byte 3");var H=this.decodeTables[B6-w[G]];for(var V=48;V<=57;V++)if(H[V]===s4)H[V]=Sm}}}}this.defaultCharUnicode=q.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var W={};if($.encodeSkipVals)for(var U=0;U<$.encodeSkipVals.length;U++){var X=$.encodeSkipVals[U];if(typeof X==="number")W[X]=!0;else for(var z=X.from;z<=X.to;z++)W[z]=!0}if(this._fillEncodeTable(0,0,W),$.encodeAdd){for(var D in $.encodeAdd)if(Object.prototype.hasOwnProperty.call($.encodeAdd,D))this._setEncodeChar(D.charCodeAt(0),$.encodeAdd[D])}if(this.defCharSB=this.encodeTable[0][q.defaultCharSingleByte.charCodeAt(0)],this.defCharSB===s4)this.defCharSB=this.encodeTable[0]["?"];if(this.defCharSB===s4)this.defCharSB=63}K5.prototype.encoder=QV;K5.prototype.decoder=Rg;K5.prototype._getDecodeTrieNode=function($){var q=[];for(;$>0;$>>>=8)q.push($&255);if(q.length==0)q.push(0);var I=this.decodeTables[0];for(var U=q.length-1;U>0;U--){var Y=I[q[U]];if(Y==s4)I[q[U]]=B6-this.decodeTables.length,this.decodeTables.push(I=EI.slice(0));else if(Y<=B6)I=this.decodeTables[B6-Y];else throw Error("Overwrite byte in "+this.encodingName+", addr: "+$.toString(16))}return I};K5.prototype._addDecodeChunk=function($){var q=parseInt($[0],16),I=this._getDecodeTrieNode(q);q=q&255;for(var U=1;U<$.length;U++){var Y=$[U];if(typeof Y==="string")for(var J=0;J<Y.length;){var Q=Y.charCodeAt(J++);if(Q>=55296&&Q<56320){var K=Y.charCodeAt(J++);if(K>=56320&&K<57344)I[q++]=65536+(Q-55296)*1024+(K-56320);else throw Error("Incorrect surrogate pair in "+this.encodingName+" at chunk "+$[0])}else if(Q>4080&&Q<=4095){var z=4095-Q+2,w=[];for(var G=0;G<z;G++)w.push(Y.charCodeAt(J++));I[q++]=A$-this.decodeTableSeq.length,this.decodeTableSeq.push(w)}else I[q++]=Q}else if(typeof Y==="number"){var H=I[q-1]+1;for(var J=0;J<Y;J++)I[q++]=H++}else throw Error("Incorrect type '"+typeof Y+"' given in "+this.encodingName+" at chunk "+$[0])}if(q>255)throw Error("Incorrect chunk in "+this.encodinLine truncated
\x00`,p+=p1(f,2),p+=K.magic,p+=p1(L,2),p+=p1(N,2),p+=p1(h.crc32,4),p+=p1(h.compressedSize,4),p+=p1(h.uncompressedSize,4),p+=p1(w.length,2),p+=p1(E.length,2);var C=QW.LOCAL_FILE_HEADER+p+w+E,n=QW.CENTRAL_FILE_HEADER+p1(t,2)+p+p1(V.length,2)+"\x00\x00\x00\x00"+p1(S,4)+p1(U,4)+w+E+V;return{fileRecord:C,dirRecord:n}},Wf0=function($,q,I,U,Y){var J="",Q=mI.transformTo("string",Y(U));return J=QW.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+p1($,2)+p1($,2)+p1(q,4)+p1(I,4)+p1(Q.length,2)+Q,J},Zf0=function($){var q="";return q=QW.DATA_DESCRIPTOR+p1($.crc32,4)+p1($.compressedSize,4)+p1($.uncompressedSize,4),q};function o$($,q,I,U){oI.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=q,this.zipPlatform=I,this.encodeFileName=U,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}mI.inherits(o$,oI);o$.prototype.push=function($){var q=$.meta.percent||0,I=this.entriesCount,U=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,oI.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:I?(q+100*(I-U-1))/I:100}})};o$.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var q=this.streamFiles&&!$.file.dir;if(q){var I=Cs($,q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:I.fileRecord,meta:{percent:0}})}else this.accumulate=!0};o$.prototype.closedSource=function($){this.accumulate=!1;var q=this.streamFiles&&!$.file.dir,I=Cs($,q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(I.dirRecord),q)this.push({data:Zf0($),meta:{percent:100}});else{this.push({data:I.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};o$.prototype.flush=function(){var $=this.bytesWritten;for(var q=0;q<this.dirRecords.length;q++)this.push({data:this.dirRecords[q],meta:{percent:100}});var I=this.bytesWritten-$,U=Wf0(this.dirRecords.length,I,$,this.zipComment,this.encodeFileName);this.push({data:U,meta:{percent:100}})};o$.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};o$.prototype.registerPrevious=function($){this._sources.push($);var q=this;return $.on("data",function(I){q.processChunk(I)}),$.on("end",function(){if(q.closedSource(q.previous.streamInfo),q._sources.length)q.prepareNextSource();else q.end()}),$.on("error",function(I){q.error(I)}),this};o$.prototype.resume=function(){if(!oI.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};o$.prototype.error=function($){var q=this._sources;if(!oI.prototype.error.call(this,$))return!1;for(var I=0;I<q.length;I++)try{q[I].error($)}catch(U){}return!0};o$.prototype.lock=function(){oI.prototype.lock.call(this);var $=this._sources;for(var q=0;q<$.length;q++)$[q].lock()};_s.exports=o$});var Ss=O((Of0)=>{var Xf0=LB(),Df0=hs(),Lf0=function($,q){var I=$||q,U=Xf0[I];if(!U)throw Error(I+" is not a valid compression method !");return U};Of0.generateWorker=function($,q,I){var U=new Df0(q.streamFiles,I,q.platform,q.encodeFileName),Y=0;try{$.forEach(function(J,Q){Y++;var K=Lf0(Q.options.compression,q.compression),z=Q.options.compressionOptions||q.compressionOptions||{},w=Q.dir,G=Q.date;Q._compressWorker(K,z).withStreamInfo("file",{name:J,dir:w,date:G,comment:Q.comment||"",unixPermissions:Q.unixPermissions,dosPermissions:Q.dosPermissions}).pipe(U)}),U.entriesCount=Y}catch(J){U.error(J)}return U}});var us=O((bP1,ys)=>{var Ff0=w4(),KW=U$();function Y2($,q){KW.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(q)}Ff0.inherits(Y2,KW);Y2.prototype._bindStream=function($){var q=this;this._stream=$,$.pause(),$.on("data",function(I){q.push({data:I,meta:{percent:0}})}).on("error",function(I){if(q.isPaused)this.generatedError=I;else q.error(I)}).on("end",function(){if(q.isPaused)q._upstreamEnded=!0;else q.end()})};Y2.prototype.pause=function(){if(!KW.prototype.pause.call(this))return!1;return this._stream.pause(),!0};Y2.prototype.resume=function(){if(!KW.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};ys.exports=Y2});var ls=O((iP1,ds)=>{var Mf0=xI(),J2=w4(),ns=U$(),Af0=Pj(),bs=Tj(),xs=iV(),Pf0=kt(),Tf0=Ss(),ks=xQ(),Ef0=us(),is=function($,q,I){var U=J2.getTypeOf(q),Y,J=J2.extend(I||{},bs);if(J.date=J.date||new Date,J.compression!==null)J.compression=J.compression.toUpperCase();if(typeof J.unixPermissions==="string")J.unixPermissions=parseInt(J.unixPermissions,8);if(J.unixPermissions&&J.unixPermissions&16384)J.dir=!0;if(J.dosPermissions&&J.dosPermissions&16)J.dir=!0;if(J. Line truncated
`)}openNode($,q){let I=this.tos,U=this._xml;if(I&&this.open)U.push(">");this._stack.push($),U.push("<"),U.push($),qR(U,q),this.leaf=!0,this.open=!0}addAttribute($,q){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(q!==void 0)u00(this._xml,$,q)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");qR(this._xml,$)}writeText($){let q=this._xml;if(this.open)q.push(">"),this.open=!1;this.leaf=!1,q.push(y00.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),q=this._xml;if(this.leaf)q.push("/>");else q.push("</"),q.push($),q.push(">");this.open=!1,this.leaf=!1}leafNode($,q,I){if(this.openNode($,q),I!==void 0)this.writeText(I);this.closeNode()}closeAll(){while(this._stack.length)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let $=this._rollbacks.pop();if(this._xml.length>$.xml)this._xml.splice($.xml,this._xml.length-$.xml);if(this._stack.length>$.stack)this._stack.splice($.stack,this._stack.length-$.stack);this.leaf=$.leaf,this.open=$.open}get xml(){return this.closeAll(),this._xml.join("")}}IR.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};x00.exports=IR});var UR=O((Di0)=>{var k00=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Xi0($){if(typeof $==="string")return $;if(k00)return k00.decode($);return $.toString()}Di0.bufferToString=Xi0});var p00=O((n00)=>{Object.defineProperty(n00,"__esModule",{value:!0});n00.CHAR=`
\r -퟿-�\uD800\uDC00-\uDBFF\uDFFF`;n00.S=` \r
`;n00.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";n00.NAME_CHAR="-"+n00.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";n00.CHAR_RE=new RegExp("^["+n00.CHAR+"]$","u");n00.S_RE=new RegExp("^["+n00.S+"]+$","u");n00.NAME_START_CHAR_RE=new RegExp("^["+n00.NAME_START_CHAR+"]$","u");n00.NAME_CHAR_RE=new RegExp("^["+n00.NAME_CHAR+"]$","u");n00.NAME_RE=new RegExp("^["+n00.NAME_START_CHAR+"]["+n00.NAME_CHAR+"]*$","u");n00.NMTOKEN_RE=new RegExp("^["+n00.NAME_CHAR+"]+$","u");var YR=9,JR=10,QR=13,KR=32;n00.S_LIST=[KR,JR,QR,YR];function Oi0($){return $>=KR&&$<=55295||$===JR||$===QR||$===YR||$>=57344&&$<=65533||$>=65536&&$<=1114111}n00.isChar=Oi0;function Ni0($){return $===KR||$===JR||$===QR||$===YR}n00.isS=Ni0;function f00($){return $>=65&&$<=90||$>=97&&$<=122||$===58||$===95||$===8204||$===8205||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}n00.isNameStartChar=f00;function Fi0($){return f00($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}n00.isNameChar=Fi0});var e00=O((r00)=>{Object.defineProperty(r00,"__esModule",{value:!0});r00.CHAR="\x01-퟿-�\uD800\uDC00-\uDBFF\uDFFF";r00.RESTRICTED_CHAR="\x01-\b\v\f\x0E-\x1F-„†-Ÿ";r00.S=` \r
`;r00.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";r00.NAME_CHAR="-"+r00.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";r00.CHAR_RE=new RegExp("^["+r00.CHAR+"]$","u");r00.RESTRICTED_CHAR_RE=new RegExp("^["+r00.RESTRICTED_CHAR+"]$","u");r00.S_RE=new RegExp("^["+r00.S+"]+$","u");r00.NAME_START_CHAR_RE=new RegExp("^["+r00.NAME_START_CHAR+"]$","u");r00.NAME_CHAR_RE=new RegExp("^["+r00.NAME_CHAR+"]$","u");r00.NAME_RE=new RegExp("^["+r00.NAME_START_CHAR+"]["+r00.NAME_CHAR+"]*$","u");r00.NMTOKEN_RE=new RegExp("^["+r00.NAME_CHAR+"]+$","u");var c00=9,d00=10,l00=13,m00=32;r00.S_LIST=[m00,d00,l00,c00];function _i0($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}r00.isChar=_i0;function hi0($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}r00.isRestrictedChar=hi0;function Si0($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}r00.isCharAndNotRestricted=Si0;function yi0($){return $===m00||$===d00||$===l00||$===c00}r00.isS=yi0;function o00($){return $>=65&&$<=90||$>=97&&$<=122||$===58||$===95||$===8204||$===8205||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}r00.isNameStartChar=o00;function ui0($){return o00($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}r00.isNameChar=ui0});var I10=O((q10)=>{Object.defineProperty(q10,"__esModule",{value:!0});q10.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";q10.NC_NAME_CHAR="-"+q10.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";q10.NC_NAME_START_CHAR_RE=new RegExp("^["+q10.NC_NAME_START_CHAR+"]$","u");q10.NC_NAME_CHAR_RE=new RegExp("^["+q10.NC_NAME_CHAR+"]$","u");q10.NC_NAME_RE=new RegExp("^["+q10.NC_NAME_START_CHAR+"]["+q10.NC_NAME_CHAR+"]*$","u");function $10($){return $>=65&&$<=90||$===95||$>=97&&$<=122||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8204&&$<=8205||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}q10.isNCNameStartChar=$10;function ai0($){return $10($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}q10.isNCNameChar=ai0});var T10=O((P10)=>{Object.defineProperty(P10,"__esModule",{value:!0});var JU=p00(),Up0=e00(),MR=I10(),d6=JU.isS,Yp0=JU.isChar,O2=JU.isNameStartChar,U10=JU.isNameChar,L10=JU.S_LIST,Jp0=JU.NAME_RE,Qp0=Up0.isChar,Kp0=MR.isNCNameStartChar,zp0=MR.isNCNameChar,wp0=MR.NC_NAME_RE,uW="http://www.w3.org/XML/1998/namespace",YU="http://www.w3.org/2000/xmlns/",Gp0={__proto__:null,xml:uW,xmlns:YU},Hp0={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},Y4=-1,v8=-2,Y10=0,Vp0=1,wR=2,Wp0=3,qU=4,Zp0=5,Xp0=6,Dp0=7,GR=8,Lp0=9,Op0=10,Np0=11,Fp0=12,v6=13,CW=14,HR=15,Mp0=16,VR=17,Ap0=18,Pp0=19,WR=20,Tp0=21,Ep0=22,gp0=23,J10=24,ZR=25,_W=26,Q10=27,jp0=28,Bp0=29,K10=30,Rp0=31,vp0=32,w3=33,Cp0=34,XR=35,N2=36,DR=37,_p0=38,z10=39,w10=40,hp0=41,G10=42,Sp0=43,yp0=44,LR=9,t$=10,OR=13,H10=32,V10=33,O10=34,F2=38,N10=39,hW=45,SW=47,up0=59,_9=60,IU=61,S4=62,I6=63,F10=91,UU=93,W10=133,Z10=8232,yW=($)=>$===O10||$===N10,M10=[O10,N10],xp0=[...M10,F10,S4],kp0=[...M10,_9,UU],fp0=[IU,I6,...L10],np0=[...L10,S4,F2,_9];function FR($,q,I){switch(q){case"xml":if(I!==uW)$.fail(`xml prefix must be bound to ${uW}.`);break;case"xmlns":if(I!==YU)$.fail(`xmlns prefix must be bound to ${YU}.`);break;default:}switch(I){case YU:$.fail(q===""?`the default namespace may not be set to ${I}.`:`may not assign a prefix (even "xmlns") to the URI ${YU}.`);break;case uW:switch(q){case"xml":break;case"":$.fail(`the default namespace may not be set to ${I}.`);break;default:$.fail("may not assign the xml namespace to another prefix.")}break;default:}}function bp0($,q){for(let I of Object.keys(q))FR($,I,q[I])}var ip0=($)=>wp0.test($),pp0=($)=>Jp0.test($),G3=0,X10=1,NR=2;P10.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var D10={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};class A10{constructor($){this.opt=$!==null&&$!==void 0?$:{},this.fragmentOpt=!!this.opt.fragment;let q=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,q){this.nameStartCheck=Kp0,this.nameCheck=zp0,this.isName=ip0,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},Gp0);let I=this.opt.additionalNamesp Line truncated
`,q=this.i}}captureToChar($){let{i:q}=this,{chunk:I}=this;while(!0){let U=this.getCode();switch(U){case v8:this.text+=`${I.slice(q,this.prevI)}
`,q=this.i,U=t$;break;case Y4:return this.text+=I.slice(q),!1;default:}if(U===$)return this.text+=I.slice(q,this.prevI),!0}}captureNameChars(){let{chunk:$,i:q}=this;while(!0){let I=this.getCode();if(I===Y4)return this.name+=$.slice(q),Y4;if(!U10(I))return this.name+=$.slice(q,this.prevI),I===v8?t$:I}}skipSpaces(){while(!0){let $=this.getCodeNorm();if($===Y4||!d6($))return $}}setXMLVersion($){if(this.currentXMLVersion=$,$==="1.0")this.isChar=Yp0,this.getCode=this.getCode10;else this.isChar=Qp0,this.getCode=this.getCode11}sBegin(){if(this.chunk.charCodeAt(0)===65279)this.i++,this.column++;this.state=Vp0}sBeginWhitespace(){let $=this.i,q=this.skipSpaces();if(this.prevI!==$)this.xmlDeclPossible=!1;switch(q){case _9:if(this.state=HR,this.text.length!==0)throw Error("no-empty text at start");break;case Y4:break;default:this.unget(),this.state=v6,this.xmlDeclPossible=!1}}sDoctype(){var $;let q=this.captureTo(xp0);switch(q){case S4:{($=this.doctypeHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=v6,this.doctype=!0;break}case Y4:break;default:if(this.text+=String.fromCodePoint(q),q===F10)this.state=qU;else if(yW(q))this.state=Wp0,this.q=q}}sDoctypeQuote(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.q=null,this.state=wR}sDTD(){let $=this.captureTo(kp0);if($===Y4)return;if(this.text+=String.fromCodePoint($),$===UU)this.state=wR;else if($===_9)this.state=Xp0;else if(yW($))this.state=Zp0,this.q=$}sDTDQuoted(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.state=qU,this.q=null}sDTDOpenWaka(){let $=this.getCodeNorm();switch(this.text+=String.fromCodePoint($),$){case V10:this.state=Dp0,this.openWakaBang="";break;case I6:this.state=Np0;break;default:this.state=qU}}sDTDOpenWakaBang(){let $=String.fromCodePoint(this.getCodeNorm()),q=this.openWakaBang+=$;if(this.text+=$,q!=="-")this.state=q==="--"?GR:qU,this.openWakaBang=""}sDTDComment(){if(this.captureToChar(hW))this.text+="-",this.state=Lp0}sDTDCommentEnding(){let $=this.getCodeNorm();this.text+=String.fromCodePoint($),this.state=$===hW?Op0:GR}sDTDCommentEnded(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===S4)this.state=qU;else this.fail("malformed comment."),this.state=GR}sDTDPI(){if(this.captureToChar(I6))this.text+="?",this.state=Fp0}sDTDPIEnding(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===S4)this.state=qU}sText(){if(this.tags.length!==0)this.handleTextInRoot();else this.handleTextOutsideRoot()}sEntity(){let{i:$}=this,{chunk:q}=this;$:while(!0)switch(this.getCode()){case v8:this.entity+=`${q.slice($,this.prevI)}
`,$=this.i;break;case up0:{let{entityReturnState:I}=this,U=this.entity+q.slice($,this.prevI);this.state=I;let Y;if(U==="")this.fail("empty entity name."),Y="&;";else Y=this.parseEntity(U),this.entity="";if(I!==v6||this.textHandler!==void 0)this.text+=Y;break $}case Y4:this.entity+=q.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(O2($))this.state=Cp0,this.unget(),this.xmlDeclPossible=!1;else switch($){case SW:this.state=Sp0,this.xmlDeclPossible=!1;break;case V10:this.state=Mp0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case I6:this.state=gp0;break;default:this.fail("disallowed character in tag name"),this.state=v6,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0;this.state=WR,this.openWakaBang="";break;case"--":this.state=VR,this.openWakaBang="";break;case"DOCTYPE":if(this.state=wR,this.doctype||this.sawRoot)this.fail("inappropriately located doctype declaration.");this.openWakaBang="";break;default:if(this.openWakaBang.length>=7)this.fail("incorrect syntax.")}}sComment(){if(this.captureToChar(hW))this.state=Ap0}sCommentEnding(){var $;let q=this.getCodeNorm();if(q===hW)this.state=Pp0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(q)}`,this.state=VR}sCommentEnded(){let $=this.getCodeNorm();if($!==S4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=VR;else this.state=v6}sCData(){if(this.captureToChar(UU))this.state=Tp0}sCDataEnding(){let $=this.getCodeNorm();if($===UU)this.state=Ep0;else this.text+=`]${String.fromCodePoint($)}`,this.state=WR}sCDataEnding2(){var $;let q=this.getCodeNorm();switch(q){case S4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=v6;break}case UU:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(q)}`,this.state=WR}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=J10;else if($===I6||d6($))this.fail("processing instruction without a target."),this.state=$===I6?_W:ZR;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=J10}sPIRest(){let{chunk:$,i:q}=this;while(!0){let I=this.getCodeNorm();if(I===Y4){this.piTarget+=$.slice(q);return}if(!this.nameCheck(I)){this.piTarget+=$.slice(q,this.prevI);let U=I===I6;if(U||d6(I))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=U?w3:Q10}else this.state=U?_W:ZR;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(I);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===I6)this.state=_W;else if(!d6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(I6))this.state=_W}sPIEnding(){var $;let q=this.getCodeNorm();if(q===S4){let{piTarget:I}=this;if(I.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:I,body:this.text}),this.piTarget=this.text="",this.state=v6}else if(q===I6)this.text+="?";else this.text+=`?${String.fromCodePoint(q)}`,this.state=ZR;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===I6){this.state=w3;return}if($!==Y4)this.state=jp0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(fp0);if($===I6){this.state=w3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(d6($)||$===IU))return;if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=$===IU?K10:Bp0}sXMLDeclEq(){let $=this.getCodeNorm();if($===I6){this.state=w3,this.fail("XML declaration is incomplete.");return}if(d6($))return;if($!==IU)this.fail("value required.");this.state=K10}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===I6){this.state=w3,this.fail("XML declaration is incomplete.");return}if(d6($))return;if(!yW($))this.fail("value must be quoted."),this.q=H10;else this.q=$;this.state=Rp0}sXMLDeclValue(){let $=this.captureTo([this.q,I6]);if($===I6){this.state=w3,this.text="",this.fail("XML declaration is incomplete.");return}if($===Y4)return;let q=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let I=q;if(this.xmlDecl.version=I,!/^1\.[0-9]+$/.test(I))this.fail("ver Line truncated
`;$=this.i,q=G3;break;case Y4:if(U!==void 0)this.text+=I.slice($);break $;default:q=G3}this.forbiddenState=q}handleTextOutsideRoot(){let{i:$}=this,{chunk:q,textHandler:I}=this,U=!1;$:while(!0){let Y=this.getCode();switch(Y){case _9:{if(this.state=HR,I!==void 0){let{text:J}=this,Q=q.slice($,this.prevI);if(J.length!==0)I(J+Q),this.text="";else if(Q.length!==0)I(Q)}break $}case F2:if(this.state=CW,this.entityReturnState=v6,I!==void 0)this.text+=q.slice($,this.prevI);U=!0;break $;case v8:if(I!==void 0)this.text+=`${q.slice($,this.prevI)}
`;$=this.i;break;case Y4:if(I!==void 0)this.text+=q.slice($);break $;default:if(!d6(Y))U=!0}}if(!U)return;if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0}pushAttribNS($,q){var I;let{prefix:U,local:Y}=this.qname($),J={name:$,prefix:U,local:Y,value:q};if(this.attribList.push(J),(I=this.attributeHandler)===null||I===void 0||I.call(this,J),U==="xmlns"){let Q=q.trim();if(this.currentXMLVersion==="1.0"&&Q==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[Y]=Q,FR(this,Y,Q)}else if($==="xmlns"){let Q=q.trim();this.topNS[""]=Q,FR(this,"",Q)}}pushAttribPlain($,q){var I;let U={name:$,value:q};this.attribList.push(U),(I=this.attributeHandler)===null||I===void 0||I.call(this,U)}end(){var $,q;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:I}=this;while(I.length>0){let Y=I.pop();this.fail(`unclosed tag: ${Y.name}`)}if(this.state!==Y10&&this.state!==v6)this.fail("unexpected end.");let{text:U}=this;if(U.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,U),this.text="";return this._closed=!0,(q=this.endHandler)===null||q===void 0||q.call(this),this._init(),this}resolve($){var q,I;let U=this.topNS[$];if(U!==void 0)return U;let{tags:Y}=this;for(let J=Y.length-1;J>=0;J--)if(U=Y[J].ns[$],U!==void 0)return U;if(U=this.ns[$],U!==void 0)return U;return(I=(q=this.opt).resolvePrefix)===null||I===void 0?void 0:I.call(q,$)}qname($){let q=$.indexOf(":");if(q===-1)return{prefix:"",local:$};let I=$.slice(q+1),U=$.slice(0,q);if(U===""||I===""||I.includes(":"))this.fail(`malformed name: ${$}.`);return{prefix:U,local:I}}processAttribsNS(){var $;let{attribList:q}=this,I=this.tag;{let{prefix:J,local:Q}=this.qname(I.name);I.prefix=J,I.local=Q;let K=I.uri=($=this.resolve(J))!==null&&$!==void 0?$:"";if(J!==""){if(J==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(K==="")this.fail(`unbound namespace prefix: ${JSON.stringify(J)}.`),I.uri=J}}if(q.length===0)return;let{attributes:U}=I,Y=new Set;for(let J of q){let{name:Q,prefix:K,local:z}=J,w,G;if(K==="")w=Q==="xmlns"?YU:"",G=Q;else{if(w=this.resolve(K),w===void 0)this.fail(`unbound namespace prefix: ${JSON.stringify(K)}.`),w=K;G=`{${w}}${z}`}if(Y.has(G))this.fail(`duplicate attribute: ${G}.`);Y.add(G),J.uri=w,U[Q]=J}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,q=this.tag.attributes;for(let{name:I,value:U}of $){if(q[I]!==void 0)this.fail(`duplicate attribute: ${I}.`);q[I]=U}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:q}=this,I=this.tag;I.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,I),q.push(I),this.state=v6,this.name=""}openSelfClosingTag(){var $,q,I;this.processAttribs();let{tags:U}=this,Y=this.tag;if(Y.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,Y),(q=this.closeTagHandler)===null||q===void 0||q.call(this,Y),(this.tag=(I=U[U.length-1])!==null&&I!==void 0?I:null)===null)this.closedRoot=!0;this.state=v6,this.name=""}closeTag(){let{tags:$,name:q}=this;if(this.state=v6,this.name="",q===""){this.fail("weird empty close tag."),this.text+="</>";return}let I=this.closeTagHandler,U=$.length;while(U-- >0){let Y=this.tag=$.pop();if(this.topNS=Y.ns,I===null||I===void 0||I(Y),Y.name===q)break;this.fail("unexpected close tag.")}if(U===0)this.closedRoot=!0;else if(U<0)this.fail(`unmatched closing tag: ${q}.`),this.text+=`</${q}>`}parseEntity($){if($[0]!=="#"){let I=this.ENTITIES[$];if(I!==void 0)return I;return this.fail(this.isName($)?"undefined entity.":"disallowed character in entity name."),`&${$};`}let q=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))q=parseInt($.slice(2),16);else if(/^#[0-9]+$/.test($))q=parseInt($.slice(1),10);if(!this.isChar(q))return this.fail("malformed character entity."),`&${$};`;return String.fromCodePoint(q)}}P10.SaxesParser=A10});var M2=O((ET1,E10)=>{var{SaxesParser:lp0}=T10(),{PassThrough:mp0}=X6(),{bufferToString:op0}=UR();E10.exports=async function*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(new mp0);let q=new lp0,I;q.on("error",(Y)=>{I=Y});let U=[];q.on("opentag",(Y)=>U.push({eventType:"opentag",value:Y})),q.on("text",(Y)=>U.push({eventType:"text",value:Y})),q.on("closetag",(Y)=>U.push({eventType:"closetag",value:Y}));for await(let Y of $){if(q.write(op0(Y)),I)throw I;yield U,U=[]}}});var Z0=O((gT1,g10)=>{var rp0=M2(),tp0=q6();class QU{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,q){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($ instanceof QU)$.reset();else if($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}async parse($){for await(let q of $)for(let{eventType:I,value:U}of q)if(I==="opentag")this.parseOpen(U);else if(I==="text")this.parseText(U);else if(I==="closetag"){if(!this.parseClose(U.name))return thLine truncated
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <a:fillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:Line truncated
`,this.quote='"',this.escape=this.quote,this.quoteColumns=!1,this.quoteHeaders=this.quoteColumns,this.headers=null,this.includeEndRowDelimiter=!1,this.writeBOM=!1,this.BOM="\uFEFF",this.alwaysWriteHeaders=!1,Object.assign(this,$||{}),typeof($===null||$===void 0?void 0:$.quoteHeaders)>"u")this.quoteHeaders=this.quoteColumns;if(($===null||$===void 0?void 0:$.quote)===!0)this.quote='"';else if(($===null||$===void 0?void 0:$.quote)===!1)this.quote="";if(typeof($===null||$===void 0?void 0:$.escape)!=="string")this.escape=this.quote;this.shouldWriteHeaders=!!this.headers&&((q=$.writeHeaders)!==null&&q!==void 0?q:!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}I70.FormatterOptions=q70});var XZ=O((ag1,K70)=>{var Qt0="[object AsyncFunction]",Kt0="[object Function]",zt0="[object GeneratorFunction]",wt0="[object Null]",Gt0="[object Proxy]",Ht0="[object Undefined]",Vt0=typeof global=="object"&&global&&global.Object===Object&&global,Wt0=typeof self=="object"&&self&&self.Object===Object&&self,Zt0=Vt0||Wt0||Function("return this")(),J70=Object.prototype,Xt0=J70.hasOwnProperty,Q70=J70.toString,Y70=Zt0.Symbol,L3=Y70?Y70.toStringTag:void 0;function Dt0($){if($==null)return $===void 0?Ht0:wt0;return L3&&L3 in Object($)?Lt0($):Ot0($)}function Lt0($){var q=Xt0.call($,L3),I=$[L3];try{$[L3]=void 0;var U=!0}catch(J){}var Y=Q70.call($);if(U)if(q)$[L3]=I;else delete $[L3];return Y}function Ot0($){return Q70.call($)}function Nt0($){if(!Ft0($))return!1;var q=Dt0($);return q==Kt0||q==zt0||q==Qt0||q==Gt0}function Ft0($){var q=typeof $;return $!=null&&(q=="object"||q=="function")}K70.exports=Nt0});var i70=O((DZ,DU)=>{var Mt0=200,cv="__lodash_hash_undefined__",TZ=1,N70=2,F70=9007199254740991,LZ="[object Arguments]",xv="[object Array]",At0="[object AsyncFunction]",M70="[object Boolean]",A70="[object Date]",P70="[object Error]",T70="[object Function]",Pt0="[object GeneratorFunction]",OZ="[object Map]",E70="[object Number]",Tt0="[object Null]",XU="[object Object]",z70="[object Promise]",Et0="[object Proxy]",g70="[object RegExp]",NZ="[object Set]",j70="[object String]",gt0="[object Symbol]",jt0="[object Undefined]",kv="[object WeakMap]",B70="[object ArrayBuffer]",FZ="[object DataView]",Bt0="[object Float32Array]",Rt0="[object Float64Array]",vt0="[object Int8Array]",Ct0="[object Int16Array]",_t0="[object Int32Array]",ht0="[object Uint8Array]",St0="[object Uint8ClampedArray]",yt0="[object Uint16Array]",ut0="[object Uint32Array]",xt0=/[\\^$.*+?()[\]{}|]/g,kt0=/^\[object .+?Constructor\]$/,ft0=/^(?:0|[1-9]\d*)$/,o1={};o1[Bt0]=o1[Rt0]=o1[vt0]=o1[Ct0]=o1[_t0]=o1[ht0]=o1[St0]=o1[yt0]=o1[ut0]=!0;o1[LZ]=o1[xv]=o1[B70]=o1[M70]=o1[FZ]=o1[A70]=o1[P70]=o1[T70]=o1[OZ]=o1[E70]=o1[XU]=o1[g70]=o1[NZ]=o1[j70]=o1[kv]=!1;var R70=typeof global=="object"&&global&&global.Object===Object&&global,nt0=typeof self=="object"&&self&&self.Object===Object&&self,M5=R70||nt0||Function("return this")(),v70=typeof DZ=="object"&&DZ&&!DZ.nodeType&&DZ,w70=v70&&typeof DU=="object"&&DU&&!DU.nodeType&&DU,C70=w70&&w70.exports===v70,Sv=C70&&R70.process,G70=function(){try{return Sv&&Sv.binding&&Sv.binding("util")}catch($){}}(),H70=G70&&G70.isTypedArray;function bt0($,q){var I=-1,U=$==null?0:$.length,Y=0,J=[];while(++I<U){var Q=$[I];if(q(Q,I,$))J[Y++]=Q}return J}function it0($,q){var I=-1,U=q.length,Y=$.length;while(++I<U)$[Y+I]=q[I];return $}function pt0($,q){var I=-1,U=$==null?0:$.length;while(++I<U)if(q($[I],I,$))return!0;return!1}function ct0($,q){var I=-1,U=Array($);while(++I<$)U[I]=q(I);return U}function dt0($){return function(q){return $(q)}}function lt0($,q){return $.has(q)}function mt0($,q){return $==null?void 0:$[q]}function ot0($){var q=-1,I=Array($.size);return $.forEach(function(U,Y){I[++q]=[Y,U]}),I}function rt0($,q){return function(I){return $(q(I))}}function tt0($){var q=-1,I=Array($.size);return $.forEach(function(U){I[++q]=U}),I}var at0=Array.prototype,st0=Function.prototype,EZ=Object.prototype,yv=M5["__core-js_shared__"],_70=st0.toString,_8=EZ.hasOwnProperty,V70=function(){var $=/[^.]+$/.exec(yv&&yv.keys&&yv.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),h70=EZ.toString,et0=RegExp("^"+_70.call(_8).replace(xt0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),W70=C70?M5.Buffer:void 0,MZ=M5.Symbol,Z70=M5.Uint8Array,S70=EZ.propertyIsEnumerable,$a0=at0.splice,O3=MZ?MZ.toStringTag:void 0,X70=Object.getOwnPropertySymbols,qa0=W70?W70.isBuffer:void 0,Ia0=rt0(Object.keys,Object),fv=LU(M5,"DataView"),B2=LU(M5,"Map"),nv=LU(M5,"Promise"),bv=LU(M5,"Set"),iv=LU(M5,"WeakMap"),R2=LU(Object,"create"),Ua0=M3(fv),Ya0=M3(B2),Ja0=M3(nv),Qa0=M3(bv),Ka0=M3(iv),D70=MZ?MZ.prototype:void 0,uv=D70?D70.valueOf:void 0;function N3($){var q=-1,I=$==null?0:$.length;this.clear();while(++q<I){var U=$[q];this.set(U[0],U[1])}}function za0(){this.__data__=R2?R2(null):{},this.size=0}function wa0($){var q=this.has($)&&delete this.__data__[$];return this.size-=q?1:0,q}function Ga0($){var q=this.__data Line truncated
]`;this.ESCAPE_REGEXP=new RegExp(q)}set headers($){this._headers=$}shouldQuote($,q){let I=q?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(Ds0.default(I))return I;if(Array.isArray(I))return I[$];if(this._headers!==null)return I[this._headers[$]];return!1}format($,q,I){let U=`${Ls0.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:Y}=this;if(Y.quote!==""){if(U.indexOf(Y.quote)!==-1)return this.quoteField(U.replace(this.REPLACE_REGEXP,Y.escapedQuote))}if(U.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(q,I))return this.quoteField(U);return U}quoteField($){let{quote:q}=this.formatterOptions;return`${q}${$}${q}`}}OU.FieldFormatter=a70});var rv=O((s70)=>{Object.defineProperty(s70,"__esModule",{value:!0});s70.isSyncTransform=void 0;s70.isSyncTransform=($)=>$.length===1});var q30=O((NU)=>{var $30=NU&&NU.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(NU,"__esModule",{value:!0});NU.RowFormatter=void 0;var Ns0=$30(XZ()),Fs0=$30(i70()),Ms0=ov(),As0=rv();class A3{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new Ms0.FieldFormatter($),this.headers=$.headers,this.shouldWriteHeaders=$.shouldWriteHeaders,this.hasWrittenHeaders=!1,this.headers!==null)this.fieldFormatter.headers=this.headers;if($.transform)this.rowTransform=$.transform}static isRowHashArray($){if(Array.isArray($))return Array.isArray($[0])&&$[0].length===2;return!1}static isRowArray($){return Array.isArray($)&&!this.isRowHashArray($)}static gatherHeaders($){if(A3.isRowHashArray($))return $.map((q)=>q[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(As0.isSyncTransform($))return(q,I)=>{let U=null;try{U=$(q)}catch(Y){return I(Y)}return I(null,U)};return(q,I)=>{$(q,I)}}set rowTransform($){if(!Ns0.default($))throw TypeError("The transform should be a function");this._rowTransform=A3.createTransform($)}format($,q){this.callTransformer($,(I,U)=>{if(I)return q(I);if(!$)return q(null);let Y=[];if(U){let{shouldFormatColumns:J,headers:Q}=this.checkHeaders(U);if(this.shouldWriteHeaders&&Q&&!this.hasWrittenHeaders)Y.push(this.formatColumns(Q,!0)),this.hasWrittenHeaders=!0;if(J){let K=this.gatherColumns(U);Y.push(this.formatColumns(K,!1))}}return q(null,Y)})}finish($){let q=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));q.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)q.push(this.formatterOptions.rowDelimiter);return $(null,q)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let q=A3.gatherHeaders($);if(this.headers=q,this.fieldFormatter.headers=q,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!Fs0.default(q,$),headers:q}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((q)=>$[q]);if(A3.isRowHashArray($))return this.headers.map((q,I)=>{let U=$[I];if(U)return U[1];return""});if(A3.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((q,I)=>$[I])}callTransformer($,q){if(!this._rowTransform)return q(null,$);return this._rowTransform($,q)}formatColumns($,q){let I=$.map((Y,J)=>this.fieldFormatter.format(Y,J,q)).join(this.formatterOptions.delimiter),{rowCount:U}=this;if(this.rowCount+=1,U)return[this.formatterOptions.rowDelimiter,I].join("");return I}}NU.RowFormatter=A3});var I30=O((BZ)=>{Object.defineProperty(BZ,"__esModule",{value:!0});BZ.FieldFormatter=BZ.RowFormatter=void 0;var Ps0=q30();Object.defineProperty(BZ,"RowFormatter",{enumerable:!0,get:function(){return Ps0.RowFormatter}});var Ts0=ov();Object.defineProperty(BZ,"FieldFormatter",{enumerable:!0,get:function(){return Ts0.FieldFormatter}})});var tv=O((Y30)=>{Object.defineProperty(Y30,"__esModule",{value:!0});Y30.CsvFormatterStream=void 0;var gs0=o("stream"),js0=I30();class U30 extends gs0.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new js0.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,q,I){let U=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(Y,J)=>{if(Y)return U=!0,I(Y);if(J)J.forEach((Q)=>{this.push(Buffer.from(Q,"utf8"))});return U=!0,I()})}catch(Y){if(U)throw Y;I(Y)}}_flush($){this.rowFormatter.finish((q,I)=>{if(q)return $(q);if(I)I.forEach((U)=>{this.push(Buffer.from(U,"utf8"))});return $()})}}Y30.CsvFormatterStream=U30});var K30=O((D1)=>{var Q30=D1&&D1.__createBinding||(Object.create?function($,q,I,U){if(U===void 0)U=I;Object.defineProperty($,U,{enumerable:!0,get:function(){return q[I]}})}:function($,q,I,U){if(U===void 0)U=I;$[U]=q[I]}),Bs0=D1&&D1.__setModuleDefault||(Object.create?function($,q){Ob Line truncated
`||q===`\r
`}static isTokenCarriageReturn($,q){return $.token===q.carriageReturn}static isTokenComment($,q){return q.supportsComments&&!!$&&$.token===q.comment}static isTokenEscapeCharacter($,q){return $.token===q.escapeChar}static isTokenQuote($,q){return $.token===q.quote}static isTokenDelimiter($,q){return $.token===q.delimiter}}zq0.Token=Kq0});var FC=O((Vq0)=>{Object.defineProperty(Vq0,"__esModule",{value:!0});Vq0.Scanner=void 0;var Gq0=p9(),u11=/((?:\r\n)|\n|\r)/;class Hq0{constructor($){this.cursor=0,this.line=$.line,this.lineLength=this.line.length,this.parserOptions=$.parserOptions,this.hasMoreData=$.hasMoreData,this.cursor=$.cursor||0}get hasMoreCharacters(){return this.lineLength>this.cursor}get nextNonSpaceToken(){let{lineFromCursor:$}=this,q=this.parserOptions.NEXT_TOKEN_REGEXP;if($.search(q)===-1)return null;let I=q.exec($);if(I==null)return null;let U=I[1],Y=this.cursor+(I.index||0);return new Gq0.Token({token:U,startCursor:Y,endCursor:Y+U.length-1})}get nextCharacterToken(){let{cursor:$,lineLength:q}=this;if(q<=$)return null;return new Gq0.Token({token:this.line[$],startCursor:$,endCursor:$})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let $=u11.exec(this.lineFromCursor);if(!$){if(this.hasMoreData)return null;return this.cursor=this.lineLength,this}return this.cursor+=($.index||0)+$[0].length,this}advanceTo($){return this.cursor=$,this}advanceToToken($){return this.cursor=$.startCursor,this}advancePastToken($){return this.cursor=$.endCursor+1,this}truncateToCursor(){return this.line=this.lineFromCursor,this.lineLength=this.line.length,this.cursor=0,this}}Vq0.Scanner=Hq0});var aZ=O((Xq0)=>{Object.defineProperty(Xq0,"__esModule",{value:!0});Xq0.ColumnFormatter=void 0;class Zq0{constructor($){if($.trim)this.format=(q)=>q.trim();else if($.ltrim)this.format=(q)=>q.trimLeft();else if($.rtrim)this.format=(q)=>q.trimRight();else this.format=(q)=>q}}Xq0.ColumnFormatter=Zq0});var MC=O((Nq0)=>{Object.defineProperty(Nq0,"__esModule",{value:!0});Nq0.NonQuotedColumnParser=void 0;var x11=aZ(),Lq0=p9();class Oq0{constructor($){this.parserOptions=$,this.columnFormatter=new x11.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let{parserOptions:q}=this,I=[],U=$.nextCharacterToken;for(;U;U=$.nextCharacterToken){if(Lq0.Token.isTokenDelimiter(U,q)||Lq0.Token.isTokenRowDelimiter(U))break;I.push(U.token),$.advancePastToken(U)}return this.columnFormatter.format(I.join(""))}}Nq0.NonQuotedColumnParser=Oq0});var AC=O((Aq0)=>{Object.defineProperty(Aq0,"__esModule",{value:!0});Aq0.QuotedColumnParser=void 0;var k11=aZ(),vU=p9();class Mq0{constructor($){this.parserOptions=$,this.columnFormatter=new k11.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let q=$.cursor,{foundClosingQuote:I,col:U}=this.gatherDataBetweenQuotes($);if(!I){if($.advanceTo(q),!$.hasMoreData)throw Error(`Parse Error: missing closing: '${this.parserOptions.quote||""}' in line: at '${$.lineFromCursor.replace(/[\r\n]/g,"\\n'")}'`);return null}return this.checkForMalformedColumn($),U}gatherDataBetweenQuotes($){let{parserOptions:q}=this,I=!1,U=!1,Y=[],J=$.nextCharacterToken;for(;!U&&J!==null;J=$.nextCharacterToken){let Q=vU.Token.isTokenQuote(J,q);if(!I&&Q)I=!0;else if(I)if(vU.Token.isTokenEscapeCharacter(J,q)){$.advancePastToken(J);let K=$.nextCharacterToken;if(K!==null&&(vU.Token.isTokenQuote(K,q)||vU.Token.isTokenEscapeCharacter(K,q)))Y.push(K.token),J=K;else if(Q)U=!0;else Y.push(J.token)}else if(Q)U=!0;else Y.push(J.token);$.advancePastToken(J)}return{col:this.columnFormatter.format(Y.join("")),foundClosingQuote:U}}checkForMalformedColumn($){let{parserOptions:q}=this,{nextNonSpaceToken:I}=$;if(I){let U=vU.Token.isTokenDelimiter(I,q),Y=vU.Token.isTokenRowDelimiter(I);if(!(U||Y)){let J=$.lineFromCursor.substr(0,10).replace(/[\r\n]/g,"\\n'");throw Error(`Parse Error: expected: '${q.escapedDelimiter}' OR new line got: '${I.token}'. at '${J}`)}$.advanceToToken(I)}else if(!$.hasMoreData)$.advancePastLine()}}Aq0.QuotedColumnParser=Mq0});var jq0=O((Eq0)=>{Object.defineProperty(Eq0,"__esModule",{value:!0});Eq0.ColumnParser=void 0;var f11=MC(),n11=AC(),b11=p9();class Tq0{constructor($){this.parserOptions=$,this.quotedColumnParser=new n11.QuotedColumnParser($),this.nonQuotedColumnParser=new f11.NonQuotedColumnParser($)}parse($){let{nextNonSpaceToken:q}=$;if(q!==null&&b11.Token.isTokenQuote(q,this.parserOptions))return $.advanceToToken(q),this.quotedColumnParser.parse($);return this.nonQuotedColumnParser.parse($)}}Eq0.ColumnParser=Tq0});var PC=O((CU)=>{Object.defineProperty(CU,"__esModule",{value:!0});CU.ColumnFormatter=CU.QuotedColumnParser=CU.NonQuotedColumnParser=CU.ColumnParser=void 0;var i11=jq0();Object.defineProperty(CU,"ColumnParser",{enumerable:!0,get:function(){return i11.ColumnParser}});var p11=MC();Object.defineProperty(CU,"NonQuotedColumnParser",{enumerable:!0,get:function(){return p11.NonQuotedColumnParser}});var c11=AC();Object.defineProperty(CU,"QuotedColumnParser",{enumerable:!0,get:function(){re Line truncated
%s`,k,k,W,U);let h=W.type==="*"?fC:W.type==="?"?iC:"\\"+W.type;Y=!0,U=U.slice(0,W.reStart)+h+"\\("+k}if(T(),J)U+="\\\\";let P=y41[U.charAt(0)];for(let k=K.length-1;k>-1;k--){let h=K[k],f=U.slice(0,h.reStart),S=U.slice(h.reStart,h.reEnd-8),t=U.slice(h.reEnd),p=U.slice(h.reEnd-8,h.reEnd)+t,C=f.split(")").length,n=f.split("(").length-C,b=t;for(let g=0;g<n;g++)b=b.replace(/\)[+*?]?/,"");t=b;let J0=t===""&&q!==nC?"(?:$|\\/)":"";U=f+S+t+J0+p}if(U!==""&&Y)U="(?=.)"+U;if(P)U=N()+U;if(q===nC)return[U,Y];if(I.nocase&&!Y)Y=$.toUpperCase()!==$.toLowerCase();if(!Y)return x41($);let B=I.nocase?"i":"";try{return Object.assign(new RegExp("^"+U+"$",B),{_glob:$,_src:U})}catch(k){return new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let $=this.set;if(!$.length)return this.regexp=!1,this.regexp;let q=this.options,I=q.noglobstar?fC:q.dot?h41:S41,U=q.nocase?"i":"",Y=$.map((J)=>{return J=J.map((Q)=>typeof Q==="string"?f41(Q):Q===C6?C6:Q._src).reduce((Q,K)=>{if(!(Q[Q.length-1]===C6&&K===C6))Q.push(K);return Q},[]),J.forEach((Q,K)=>{if(Q!==C6||J[K-1]===C6)return;if(K===0)if(J.length>1)J[K+1]="(?:\\/|"+I+"\\/)?"+J[K+1];else J[K]=I;else if(K===J.length-1)J[K-1]+="(?:\\/|"+I+")?";else J[K-1]+="(?:\\/|\\/"+I+"\\/)"+J[K+1],J[K+1]=C6}),J.filter((Q)=>Q!==C6).join("/")}).join("|");if(Y="^(?:"+Y+")$",this.negate)Y="^(?!"+Y+").*$";try{this.regexp=new RegExp(Y,U)}catch(J){this.regexp=!1}return this.regexp}match($,q=this.partial){if(this.debug("match",$,this.pattern),this.comment)return!1;if(this.empty)return $==="";if($==="/"&&q)return!0;let I=this.options;if(bC.sep!=="/")$=$.split(bC.sep).join("/");$=$.split(NI0),this.debug(this.pattern,"split",$);let U=this.set;this.debug(this.pattern,"set",U);let Y;for(let J=$.length-1;J>=0;J--)if(Y=$[J],Y)break;for(let J=0;J<U.length;J++){let Q=U[J],K=$;if(I.matchBase&&Q.length===1)K=[Y];if(this.matchOne(K,Q,q)){if(I.flipNegate)return!0;return!this.negate}}if(I.flipNegate)return!1;return this.negate}static defaults($){return Q$.defaults($).Minimatch}}Q$.Minimatch=x2});var jI0=O((QB1,gI0)=>{gI0.exports=EI0;var dC=o("fs"),{EventEmitter:b41}=o("events"),{Minimatch:cC}=AI0(),{resolve:i41}=o("path");function p41($,q){return new Promise((I,U)=>{dC.readdir($,{withFileTypes:!0},(Y,J)=>{if(Y)switch(Y.code){case"ENOTDIR":if(q)U(Y);else I([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":I([]);break;case"ELOOP":default:U(Y);break}else I(J)})})}function PI0($,q){return new Promise((I,U)=>{(q?dC.stat:dC.lstat)($,(J,Q)=>{if(J)switch(J.code){case"ENOENT":if(q)I(PI0($,!1));else I(null);break;default:I(null);break}else I(Q)})})}async function*TI0($,q,I,U,Y,J){let Q=await p41(q+$,J);for(let K of Q){let z=K.name;if(z===void 0)z=K,U=!0;let w=$+"/"+z,G=w.slice(1),H=q+"/"+G,V=null;if(U||I)V=await PI0(H,I);if(!V&&K.name!==void 0)V=K;if(V===null)V={isDirectory:()=>!1};if(V.isDirectory()){if(!Y(G))yield{relative:G,absolute:H,stats:V},yield*TI0(w,q,I,U,Y,!1)}else yield{relative:G,absolute:H,stats:V}}}async function*c41($,q,I,U){yield*TI0("",$,q,I,U,!0)}function d41($){return{pattern:$.pattern,dot:!!$.dot,noglobstar:!!$.noglobstar,matchBase:!!$.matchBase,nocase:!!$.nocase,ignore:$.ignore,skip:$.skip,follow:!!$.follow,stat:!!$.stat,nodir:!!$.nodir,mark:!!$.mark,silent:!!$.silent,absolute:!!$.absolute}}class lC extends b41{constructor($,q,I){super();if(typeof q==="function")I=q,q=null;if(this.options=d41(q||{}),this.matchers=[],this.options.pattern){let U=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=U.map((Y)=>new cC(Y,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let U=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=U.map((Y)=>new cC(Y,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let U=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=U.map((Y)=>new cC(Y,{dot:!0}))}if(this.iterator=c41(i41($||"."),this.options.follow,this.options.stat,this._shouldSkipDirectory.bind(this)),this.paused=!1,this.inactive=!1,this.aborted=!1,I)this._matches=[],this.on("match",(U)=>this._matches.push(this.options.absolute?U.absolute:U.relative)),this.on("error",(U)=>I(U)),this.on("end",()=>I(null,this._matches));setTimeout(()=>this._next(),0)}_shouldSkipDirectory($){return this.skipMatchers.some((q)=>q.match($))}_fileMatches($,q){let I=$+(q?"/":"");return(this.matchers.length===0||this.matchers.some((U)=>U.match(I)))&&!this.ignoreMatchers.some((U)=>U.match(I))&&(!this.options.nodir||!q)}_next(){if(!this.paused&&!this.aborted)this.iterator.next().then(($)=>{if(!$.done){let q=$.value.stats.isDirectory();if(this._fileMatches($.value.relative,q)){let I=$.value.relative,U=$.value.absolute;if(this.options.mark&&q)I+="/",U+="/";if(this.options.stat)this.emit("match",{relative:I,absolute:U,stat:$.value.stats});else this.emit("match",{relative:I,ab Line truncated
`,v);v=$0===-1?A.length:$0}else if(i!==-1&&A[v]==="/"&&A[v+1]==="*"){let $0=A.indexOf("*/",v);if($0!==-1)v=$0+2,i=A.indexOf("*/",v);else j+=A[v],v++}else j+=A[v],v++;return j}function d8(A){let j=V$(A.toString()),v=j.match(H$);if(!v)v=j.match(S$);if(!v)throw Error(`could not parse args in autoInject
Source:
`+j);let[,i]=v;return i.replace(/\s/g,"").split(c8).map(($0)=>$0.replace(y$,"").trim())}function s6(A,j){var v={};return Object.keys(A).forEach((i)=>{var $0=A[i],I0,Q0=W($0),z0=!Q0&&$0.length===1||Q0&&$0.length===0;if(Array.isArray($0))I0=[...$0],$0=I0.pop(),v[i]=I0.concat(I0.length>0?V0:$0);else if(z0)v[i]=$0;else{if(I0=d8($0),$0.length===0&&!Q0&&I0.length===0)throw Error("autoInject task functions require explicit parameters.");if(!Q0)I0.pop();v[i]=I0.concat(V0)}function V0(j0,I1){var V1=I0.map((Q1)=>j0[Q1]);V1.push(I1),L($0)(...V1)}}),C4(v,j)}class D7{constructor(){this.head=this.tail=null,this.length=0}removeLink(A){if(A.prev)A.prev.next=A.next;else this.head=A.next;if(A.next)A.next.prev=A.prev;else this.tail=A.prev;return A.prev=A.next=null,this.length-=1,A}empty(){while(this.head)this.shift();return this}insertAfter(A,j){if(j.prev=A,j.next=A.next,A.next)A.next.prev=j;else this.tail=j;A.next=j,this.length+=1}insertBefore(A,j){if(j.prev=A.prev,j.next=A,A.prev)A.prev.next=j;else this.head=j;A.prev=j,this.length+=1}unshift(A){if(this.head)this.insertBefore(this.head,A);else e6(this,A)}push(A){if(this.tail)this.insertAfter(this.tail,A);else e6(this,A)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){var A=this.head;while(A)yield A.data,A=A.next}remove(A){var j=this.head;while(j){var{next:v}=j;if(A(j))this.removeLink(j);j=v}return this}}function e6(A,j){A.length=1,A.head=A.tail=j}function c5(A,j,v){if(j==null)j=1;else if(j===0)throw RangeError("Concurrency must not be zero");var i=L(A),$0=0,I0=[];let Q0={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function z0(h0,E0){Q0[h0].push(E0)}function V0(h0,E0){let S0=(...K1)=>{j0(h0,S0),E0(...K1)};Q0[h0].push(S0)}function j0(h0,E0){if(!h0)return Object.keys(Q0).forEach((S0)=>Q0[S0]=[]);if(!E0)return Q0[h0]=[];Q0[h0]=Q0[h0].filter((S0)=>S0!==E0)}function I1(h0,...E0){Q0[h0].forEach((S0)=>S0(...E0))}var V1=!1;function Q1(h0,E0,S0,K1){if(K1!=null&&typeof K1!=="function")throw Error("task callback must be a function");W1.started=!0;var q4,f4;function Z$(O7,..._Y){if(O7)return S0?f4(O7):q4();if(_Y.length<=1)return q4(_Y[0]);q4(_Y)}var wq=W1._createTaskItem(h0,S0?Z$:K1||Z$);if(E0)W1._tasks.unshift(wq);else W1._tasks.push(wq);if(!V1)V1=!0,w(()=>{V1=!1,W1.process()});if(S0||!K1)return new Promise((O7,_Y)=>{q4=O7,f4=_Y})}function W$(h0){return function(E0,...S0){$0-=1;for(var K1=0,q4=h0.length;K1<q4;K1++){var f4=h0[K1],Z$=I0.indexOf(f4);if(Z$===0)I0.shift();else if(Z$>0)I0.splice(Z$,1);if(f4.callback(E0,...S0),E0!=null)I1("error",E0,f4.data)}if($0<=W1.concurrency-W1.buffer)I1("unsaturated");if(W1.idle())I1("drain");W1.process()}}function zq(h0){if(h0.length===0&&W1.idle())return w(()=>I1("drain")),!0;return!1}let L7=(h0)=>(E0)=>{if(!E0)return new Promise((S0,K1)=>{V0(h0,(q4,f4)=>{if(q4)return K1(q4);S0(f4)})});j0(h0),z0(h0,E0)};var CY=!1,W1={_tasks:new D7,_createTaskItem(h0,E0){return{data:h0,callback:E0}},*[Symbol.iterator](){yield*W1._tasks[Symbol.iterator]()},concurrency:j,payload:v,buffer:j/4,started:!1,paused:!1,push(h0,E0){if(Array.isArray(h0)){if(zq(h0))return;return h0.map((S0)=>Q1(S0,!1,!1,E0))}return Q1(h0,!1,!1,E0)},pushAsync(h0,E0){if(Array.isArray(h0)){if(zq(h0))return;return h0.map((S0)=>Q1(S0,!1,!0,E0))}return Q1(h0,!1,!0,E0)},kill(){j0(),W1._tasks.empty()},unshift(h0,E0){if(Array.isArray(h0)){if(zq(h0))return;return h0.map((S0)=>Q1(S0,!0,!1,E0))}return Q1(h0,!0,!1,E0)},unshiftAsync(h0,E0){if(Array.isArray(h0)){if(zq(h0))return;return h0.map((S0)=>Q1(S0,!0,!0,E0))}return Q1(h0,!0,!0,E0)},remove(h0){W1._tasks.remove(h0)},process(){if(CY)return;CY=!0;while(!W1.paused&&$0<W1.concurrency&&W1._tasks.length){var h0=[],E0=[],S0=W1._tasks.length;if(W1.payload)S0=Math.min(S0,W1.payload);for(var K1=0;K1<S0;K1++){var q4=W1._tasks.shift();h0.push(q4),I0.push(q4),E0.push(q4.data)}if($0+=1,W1._tasks.length===0)I1("empty");if($0===W1.concurrency)I1("saturated");var f4=C(W$(h0));i(E0,f4)}CY=!1},length(){return W1._tasks.length},running(){return $0},workersList(){return I0},idle(){return W1._tasks.length+$0===0},pause(){W1.paused=!0},resume(){if(W1.paused===!1)return;W1.paused=!1,w(W1.process)}};return Object.defineProperties(W1,{saturated:{writable:!1,value:L7("saturated")},unsaturated:{writable:!1,value:L7("unsaturated")},empty:{writable:!1,value:L7("empty")},drain:{writable:!1,value:L7("drain")},error:{writable:!1,value:L7("error")}}),W1}function P0(A,j){return c5(A,1,j)}function r(A,j,v){return c5(A,j,v)}function F(A,j,v,i){i=k(i);var $0=L(v);return l0(A,(I0,Q0,z0)=>{$0(j,I0,(V0,j0)=>{j=j0,z0(V0)})},(I0)=>i(I0,j))}var M=N(F,4);function R(...A){var j=A.map(L);return function(...v){var i=this,$0=v[v.length-1];if(typeof $0=="function")v.pop();else $0=J4();return M(j,v,(I0,Q0,z0)=>{Q0.apply(i,I0.concat((V0,...j0)=>{z0(V0,j0)}))},(I0,Q0)=>$0(I0,...Q0)),$0[C1]}}function y(...A){return R(...A.reverse())}function s(A,j,v,i){return T(b(j),A,v,i)}var c=N(s,4);function e( Line truncated
GFS4: `),console.error($)};if(!H4[Y6]){if(mC=global[Y6]||[],kI0(H4,mC),H4.close=function($){function q(I,U){return $.call(H4,I,function(Y){if(!Y)xI0();if(typeof U==="function")U.apply(this,arguments)})}return Object.defineProperty(q,KX,{value:$}),q}(H4.close),H4.closeSync=function($){function q(I){$.apply(H4,arguments),xI0()}return Object.defineProperty(q,KX,{value:$}),q}(H4.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){g3(H4[Y6]),o("assert").equal(H4[Y6].length,0)})}var mC;if(!global[Y6])kI0(global,H4[Y6]);tC.exports=oC($61(H4));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!H4.__patched)tC.exports=oC(H4),H4.__patched=!0;function oC($){s41($),$.gracefulify=oC,$.createReadStream=B,$.createWriteStream=k;var q=$.readFile;$.readFile=I;function I(S,t,p){if(typeof t==="function")p=t,t=null;return C(S,t,p);function C(n,b,J0,g){return q(n,b,function(u){if(u&&(u.code==="EMFILE"||u.code==="ENFILE"))SU([C,[n,b,J0],u,g||Date.now(),Date.now()]);else if(typeof J0==="function")J0.apply(this,arguments)})}}var U=$.writeFile;$.writeFile=Y;function Y(S,t,p,C){if(typeof p==="function")C=p,p=null;return n(S,t,p,C);function n(b,J0,g,u,d){return U(b,J0,g,function(a){if(a&&(a.code==="EMFILE"||a.code==="ENFILE"))SU([n,[b,J0,g,u],a,d||Date.now(),Date.now()]);else if(typeof u==="function")u.apply(this,arguments)})}}var J=$.appendFile;if(J)$.appendFile=Q;function Q(S,t,p,C){if(typeof p==="function")C=p,p=null;return n(S,t,p,C);function n(b,J0,g,u,d){return J(b,J0,g,function(a){if(a&&(a.code==="EMFILE"||a.code==="ENFILE"))SU([n,[b,J0,g,u],a,d||Date.now(),Date.now()]);else if(typeof u==="function")u.apply(this,arguments)})}}var K=$.copyFile;if(K)$.copyFile=z;function z(S,t,p,C){if(typeof p==="function")C=p,p=0;return n(S,t,p,C);function n(b,J0,g,u,d){return K(b,J0,g,function(a){if(a&&(a.code==="EMFILE"||a.code==="ENFILE"))SU([n,[b,J0,g,u],a,d||Date.now(),Date.now()]);else if(typeof u==="function")u.apply(this,arguments)})}}var w=$.readdir;$.readdir=H;var G=/^v[0-5]\./;function H(S,t,p){if(typeof t==="function")p=t,t=null;var C=G.test(process.version)?function(J0,g,u,d){return w(J0,n(J0,g,u,d))}:function(J0,g,u,d){return w(J0,g,n(J0,g,u,d))};return C(S,t,p);function n(b,J0,g,u){return function(d,a){if(d&&(d.code==="EMFILE"||d.code==="ENFILE"))SU([C,[b,J0,g],d,u||Date.now(),Date.now()]);else{if(a&&a.sort)a.sort();if(typeof g==="function")g.call(this,d,a)}}}}if(process.version.substr(0,4)==="v0.8"){var V=e41($);N=V.ReadStream,T=V.WriteStream}var W=$.ReadStream;if(W)N.prototype=Object.create(W.prototype),N.prototype.open=E;var X=$.WriteStream;if(X)T.prototype=Object.create(X.prototype),T.prototype.open=P;Object.defineProperty($,"ReadStream",{get:function(){return N},set:function(S){N=S},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return T},set:function(S){T=S},enumerable:!0,configurable:!0});var D=N;Object.defineProperty($,"FileReadStream",{get:function(){return D},set:function(S){D=S},enumerable:!0,configurable:!0});var L=T;Object.defineProperty($,"FileWriteStream",{get:function(){return L},set:function(S){L=S},enumerable:!0,configurable:!0});function N(S,t){if(this instanceof N)return W.apply(this,arguments),this;else return N.apply(Object.create(N.prototype),arguments)}function E(){var S=this;f(S.path,S.flags,S.mode,function(t,p){if(t){if(S.autoClose)S.destroy();S.emit("error",t)}else S.fd=p,S.emit("open",p),S.read()})}function T(S,t){if(this instanceof T)return X.apply(this,arguments),this;else return T.apply(Object.create(T.prototype),arguments)}function P(){var S=this;f(S.path,S.flags,S.mode,function(t,p){if(t)S.destroy(),S.emit("error",t);else S.fd=p,S.emit("open",p)})}function B(S,t){return new $.ReadStream(S,t)}function k(S,t){return new $.WriteStream(S,t)}var h=$.open;$.open=f;function f(S,t,p,C){if(typeof p==="function")C=p,p=null;return n(S,t,p,C);function n(b,J0,g,u,d){return h(b,J0,g,function(a,K0){if(a&&(a.code==="EMFILE"||a.code==="ENFILE"))SU([n,[b,J0,g,u],a,d||Date.now(),Date.now()]);else if(typeof u==="function")u.apply(this,arguments)})}}return $}function SU($){g3("ENQUEUE",$[0].name,$[1]),H4[Y6].push($),rC()}var QX;function xI0(){var $=Date.now();for(var q=0;q<H4[Y6].length;++q)if(H4[Y6][q].length>2)H4[Y6][q][3]=$,H4[Y6][q][4]=$;rC()}function rC(){if(clearTimeout(QX),QX=void 0,H4[Y6].length===0)return;var $=H4[Y6].shift(),q=$[0],I=$[1],U=$[2],Y=$[3],J=$[4];if(Y===void 0)g3("RETRY",q.name,I),q.apply(null,I);else if(Date.now()-Y>=60000){g3("TIMEOUT",q.name,I);var Q=I.pop();if(typeof Q==="function")Q.call(null,U)}else{var K=Date.now()-J,z=Math.max(J-Y,1),w=Math.min(z*1.2,100);if(K>=w)g3("RETRY",q.name,I),q.apply(null,I.concat([Y]));else H4[Y6].push($)}if(QX===void 0)QX=setTimeout(rC,0)}});var nI0=O((HB1,aC)=>{function I61($,q){if(!($ instanceof q))throw TypeError("Cannot call a class as a function")}var fI0=M4().Buffer,k2=o("util");function U61($,q,I){$.copy(q,I)}aC.exports=function(){function $(){I61(this,$),this.head=null,this.tail=null,th Line truncated
* normalize-path <https://github.com/jonschlinkert/normalize-path>
*
* Copyright (c) 2014-2018, Jon Schlinkert.
* Released under the MIT License.
*/gU0.exports=function($,q){if(typeof $!=="string")throw TypeError("expected path to be a string");if($==="\\"||$==="/")return"/";var I=$.length;if(I<=1)return $;var U="";if(I>4&&$[3]==="\\"){var Y=$[2];if((Y==="?"||Y===".")&&$.slice(0,2)==="\\\\")$=$.slice(2),U="//"}var J=$.split(/[/\\]+/);if(q!==!1&&J[J.length-1]==="")J.pop();return U+J.join("/")}});var L_=O((PB1,hU0)=>{var BU0=9007199254740991,w$1="[object Arguments]",G$1="[object Function]",H$1="[object GeneratorFunction]",V$1=/^(?:0|[1-9]\d*)$/;function RU0($,q,I){switch(I.length){case 0:return $.call(q);case 1:return $.call(q,I[0]);case 2:return $.call(q,I[0],I[1]);case 3:return $.call(q,I[0],I[1],I[2])}return $.apply(q,I)}function W$1($,q){var I=-1,U=Array($);while(++I<$)U[I]=q(I);return U}var m2=Object.prototype,o2=m2.hasOwnProperty,vU0=m2.toString,Z$1=m2.propertyIsEnumerable,jU0=Math.max;function X$1($,q){var I=E$1($)||T$1($)?W$1($.length,String):[],U=I.length,Y=!!U;for(var J in $)if((q||o2.call($,J))&&!(Y&&(J=="length"||_U0(J,U))))I.push(J);return I}function D$1($,q,I,U){if($===void 0||Z_($,m2[I])&&!o2.call(U,I))return q;return $}function L$1($,q,I){var U=$[q];if(!(o2.call($,q)&&Z_(U,I))||I===void 0&&!(q in $))$[q]=I}function O$1($){if(!D_($))return P$1($);var q=A$1($),I=[];for(var U in $)if(!(U=="constructor"&&(q||!o2.call($,U))))I.push(U);return I}function CU0($,q){return q=jU0(q===void 0?$.length-1:q,0),function(){var I=arguments,U=-1,Y=jU0(I.length-q,0),J=Array(Y);while(++U<Y)J[U]=I[q+U];U=-1;var Q=Array(q+1);while(++U<q)Q[U]=I[U];return Q[q]=J,RU0($,this,Q)}}function N$1($,q,I,U){I||(I={});var Y=-1,J=q.length;while(++Y<J){var Q=q[Y],K=U?U(I[Q],$[Q],Q,I,$):void 0;L$1(I,Q,K===void 0?$[Q]:K)}return I}function F$1($){return CU0(function(q,I){var U=-1,Y=I.length,J=Y>1?I[Y-1]:void 0,Q=Y>2?I[2]:void 0;if(J=$.length>3&&typeof J=="function"?(Y--,J):void 0,Q&&M$1(I[0],I[1],Q))J=Y<3?void 0:J,Y=1;q=Object(q);while(++U<Y){var K=I[U];if(K)$(q,K,U,J)}return q})}function _U0($,q){return q=q==null?BU0:q,!!q&&(typeof $=="number"||V$1.test($))&&($>-1&&$%1==0&&$<q)}function M$1($,q,I){if(!D_(I))return!1;var U=typeof q;if(U=="number"?X_(I)&&_U0(q,I.length):U=="string"&&(q in I))return Z_(I[q],$);return!1}function A$1($){var q=$&&$.constructor,I=typeof q=="function"&&q.prototype||m2;return $===I}function P$1($){var q=[];if($!=null)for(var I in Object($))q.push(I);return q}function Z_($,q){return $===q||$!==$&&q!==q}function T$1($){return g$1($)&&o2.call($,"callee")&&(!Z$1.call($,"callee")||vU0.call($)==w$1)}var E$1=Array.isArray;function X_($){return $!=null&&B$1($.length)&&!j$1($)}function g$1($){return R$1($)&&X_($)}function j$1($){var q=D_($)?vU0.call($):"";return q==G$1||q==H$1}function B$1($){return typeof $=="number"&&$>-1&&$%1==0&&$<=BU0}function D_($){var q=typeof $;return!!$&&(q=="object"||q=="function")}function R$1($){return!!$&&typeof $=="object"}var v$1=F$1(function($,q,I,U){N$1(q,_$1(q),$,U)}),C$1=CU0(function($){return $.push(void 0,D$1),RU0(v$1,void 0,$)});function _$1($){return X_($)?X$1($,!0):O$1($)}hU0.exports=C$1});var yU0=O((TB1,O_)=>{function h$1($,q){if(!($ instanceof q))throw TypeError("Cannot call a class as a function")}var SU0=M4().Buffer,r2=o("util");function S$1($,q,I){$.copy(q,I)}O_.exports=function(){function $(){h$1(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(I){var U={data:I,next:null};if(this.length>0)this.tail.next=U;else this.head=U;this.tail=U,++this.length},$.prototype.unshift=function(I){var U={data:I,next:this.head};if(this.length===0)this.tail=U;this.head=U,++this.length},$.prototype.shift=function(){if(this.length===0)return;var I=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,I},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(I){if(this.length===0)return"";var U=this.head,Y=""+U.data;while(U=U.next)Y+=I+U.data;return Y},$.prototype.concat=function(I){if(this.length===0)return SU0.alloc(0);var U=SU0.allocUnsafe(I>>>0),Y=this.head,J=0;while(Y)S$1(Y.data,U,J),J+=Y.data.length,Y=Y.next;return U},$}();if(r2&&r2.inspect&&r2.inspect.custom)O_.exports.prototype[r2.inspect.custom]=function(){var $=r2.inspect({length:this.length});return this.constructor.name+" "+$}});var N_=O((EB1,uU0)=>{var FX=F4();function y$1($,q){var I=this,U=this._readableState&&this._readableState.destroyed,Y=this._writableState&&this._writableState.destroyed;if(U||Y){if(q)q($);else if($){if(!this._writableState)FX.nextTick(MX,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,FX.nextTick(MX,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(J){if(!q&&J){if(!I._writableState)FX.nextTick(MX,I,J);else if(!I._writableState.errorEmitted)I._writableState.errorEmitted=!0,FX.nextTick(MX,I,J)}else if(q)q(J)}),this}function u$1(){if(this._readableState)this._readable Line truncated
%s`,B,B,E,U);var k=E.type==="*"?Uh:E.type==="?"?Ih:"\\"+E.type;Y=!0,U=U.slice(0,E.reStart)+k+"\\("+B}if(X(),J)U+="\\\\";var h=!1;switch(U.charAt(0)){case"[":case".":case"(":h=!0}for(var f=K.length-1;f>-1;f--){var S=K[f],t=U.slice(0,S.reStart),p=U.slice(S.reStart,S.reEnd-8),C=U.slice(S.reEnd-8,S.reEnd),n=U.slice(S.reEnd);C+=n;var b=t.split("(").length-1,J0=n;for(D=0;D<b;D++)J0=J0.replace(/\)[+*?]?/,"");n=J0;var g="";if(n===""&&q!==xX)g="$";var u=t+p+n+g+C;U=u}if(U!==""&&Y)U="(?=.)"+U;if(h)U=V+U;if(q===xX)return[U,Y];if(!Y)return q31($);var d=I.nocase?"i":"";try{var a=new RegExp("^"+U+"$",d)}catch(K0){return new RegExp("$.")}return a._glob=$,a._src=U,a}K$.makeRe=function($,q){return new j4($,q||{}).makeRe()};j4.prototype.makeRe=$31;function $31(){if(this.regexp||this.regexp===!1)return this.regexp;var $=this.set;if(!$.length)return this.regexp=!1,this.regexp;var q=this.options,I=q.noglobstar?Uh:q.dot?l71:m71,U=q.nocase?"i":"",Y=$.map(function(J){return J.map(function(Q){return Q===S3?I:typeof Q==="string"?I31(Q):Q._src}).join("\\/")}).join("|");if(Y="^(?:"+Y+")$",this.negate)Y="^(?!"+Y+").*$";try{this.regexp=new RegExp(Y,U)}catch(J){this.regexp=!1}return this.regexp}K$.match=function($,q,I){I=I||{};var U=new j4(q,I);if($=$.filter(function(Y){return U.match(Y)}),U.options.nonull&&!$.length)$.push(q);return $};j4.prototype.match=function(q,I){if(typeof I>"u")I=this.partial;if(this.debug("match",q,this.pattern),this.comment)return!1;if(this.empty)return q==="";if(q==="/"&&I)return!0;var U=this.options;if(KK.sep!=="/")q=q.split(KK.sep).join("/");q=q.split(GJ0),this.debug(this.pattern,"split",q);var Y=this.set;this.debug(this.pattern,"set",Y);var J,Q;for(Q=q.length-1;Q>=0;Q--)if(J=q[Q],J)break;for(Q=0;Q<Y.length;Q++){var K=Y[Q],z=q;if(U.matchBase&&K.length===1)z=[J];var w=this.matchOne(z,K,I);if(w){if(U.flipNegate)return!0;return!this.negate}}if(U.flipNegate)return!1;return this.negate};j4.prototype.matchOne=function($,q,I){if(q.indexOf(S3)!==-1)return this._matchGlobstar($,q,I,0,0);return this._matchOne($,q,I,0,0)};j4.prototype._matchGlobstar=function($,q,I,U,Y){var J,Q=-1;for(J=Y;J<q.length;J++)if(q[J]===S3){Q=J;break}var K=-1;for(J=q.length-1;J>=0;J--)if(q[J]===S3){K=J;break}var z=q.slice(Y,Q),w=I?q.slice(Q+1):q.slice(Q+1,K),G=I?[]:q.slice(K+1);if(z.length){var H=$.slice(U,U+z.length);if(!this._matchOne(H,z,I,0,0))return!1;U+=z.length}var V=0;if(G.length){if(G.length+U>$.length)return!1;var W=$.length-G.length;if(this._matchOne($,G,I,W,0))V=G.length;else{if($[$.length-1]!==""||U+G.length===$.length)return!1;if(W--,!this._matchOne($,G,I,W,0))return!1;V=G.length+1}}if(!w.length){var X=!!V;for(J=U;J<$.length-V;J++){var D=String($[J]);if(X=!0,D==="."||D===".."||!this.options.dot&&D.charAt(0)===".")return!1}return I||X}var L=[[[],0]],N=L[0],E=0,T=[0];for(var P=0;P<w.length;P++){var B=w[P];if(B===S3)T.push(E),N=[[],0],L.push(N);else N[0].push(B),E++}var k=L.length-1,h=$.length-V;for(var f=0;f<L.length;f++)L[f][1]=h-(T[k--]+L[f][0].length);return!!this._matchGlobStarBodySections($,L,U,0,I,0,!!V)};j4.prototype._matchGlobStarBodySections=function($,q,I,U,Y,J,Q){var K=q[U];if(!K){for(var z=I;z<$.length;z++){Q=!0;var w=$[z];if(w==="."||w===".."||!this.options.dot&&w.charAt(0)===".")return!1}return Q}var G=K[0],H=K[1];while(I<=H){var V=this._matchOne($.slice(0,I+G.length),G,Y,I,0);if(V&&J<this.maxGlobstarRecursion){var W=this._matchGlobStarBodySections($,q,I+G.length,U+1,Y,J+1,Q);if(W!==!1)return W}var w=$[I];if(w==="."||w===".."||!this.options.dot&&w.charAt(0)===".")return!1;I++}return Y||null};j4.prototype._matchOne=function($,q,I,U,Y){var J,Q,K,z;for(J=U,Q=Y,K=$.length,z=q.length;J<K&&Q<z;J++,Q++){this.debug("matchOne loop");var w=q[Q],G=$[J];if(this.debug(q,w,G),w===!1||w===S3)return!1;var H;if(typeof w==="string")H=G===w,this.debug("string match",w,G,H);else H=G.match(w),this.debug("pattern match",w,G,H);if(!H)return!1}if(J===K&&Q===z)return!0;else if(J===K)return I;else if(Q===z)return J===K-1&&$[J]==="";throw Error("wtf?")};function q31($){return $.replace(/\\(.)/g,"$1")}function I31($){return $.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var bX=O((cB1,nX)=>{function WJ0($){return $.charAt(0)==="/"}function ZJ0($){var q=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,I=q.exec($),U=I[1]||"",Y=Boolean(U&&U.charAt(1)!==":");return Boolean(I[2]||Y)}nX.exports=process.platform==="win32"?ZJ0:WJ0;nX.exports.posix=WJ0;nX.exports.win32=ZJ0});var Jh=O((V31)=>{V31.setopts=z31;V31.ownProp=XJ0;V31.makeAbs=zK;V31.finish=w31;V31.mark=G31;V31.isIgnored=LJ0;V31.childrenIgnored=H31;function XJ0($,q){return Object.prototype.hasOwnProperty.call($,q)}var U31=o("fs"),mU=o("path"),Y31=fX(),DJ0=bX(),Yh=Y31.Minimatch;function J31($,q){return $.localeCompare(q,"en")}function Q31($,q){if($.ignore=q.ignore||[],!Array.isArray($.ignore))$.ignore=[$.ignore];if($.ignore.length)$.ignore=$.ignore.map(K31)}function K31($){var q=null;if($.slice(-3)==="/**"){var I=$.replace(/(\/\*\*)+$/,"");q=new Yh(I,{dot:!0})}return{matcher Line truncated
See: https://github.com/isaacs/node-glob/issues/167`);return new y4($,q).found}function y4($,q){if(!$)throw Error("must provide pattern");if(typeof q==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof y4))return new y4($,q);if(M31(this,$,q),this.noprocess)return this;var I=this.minimatch.set.length;this.matches=Array(I);for(var U=0;U<I;U++)this._process(this.minimatch.set[U],U,!1);this._finish()}y4.prototype._finish=function(){if(NJ0.ok(this instanceof y4),this.realpath){var $=this;this.matches.forEach(function(q,I){var U=$.matches[I]=Object.create(null);for(var Y in q)try{Y=$._makeAbs(Y);var J=F31.realpathSync(Y,$.realpathCache);U[J]=!0}catch(Q){if(Q.syscall==="stat")U[$._makeAbs(Y)]=!0;else throw Q}})}y3.finish(this)};y4.prototype._process=function($,q,I){NJ0.ok(this instanceof y4);var U=0;while(typeof $[U]==="string")U++;var Y;switch(U){case $.length:this._processSimple($.join("/"),q);return;case 0:Y=null;break;default:Y=$.slice(0,U).join("/");break}var J=$.slice(U),Q;if(Y===null)Q=".";else if(iX(Y)||iX($.map(function(w){return typeof w==="string"?w:"[*]"}).join("/"))){if(!Y||!iX(Y))Y="/"+Y;Q=Y}else Q=Y;var K=this._makeAbs(Q);if(A31(this,Q))return;var z=J[0]===OJ0.GLOBSTAR;if(z)this._processGlobStar(Y,Q,K,J,q,I);else this._processReaddir(Y,Q,K,J,q,I)};y4.prototype._processReaddir=function($,q,I,U,Y,J){var Q=this._readdir(I,J);if(!Q)return;var K=U[0],z=!!this.minimatch.negate,w=K._glob,G=this.dot||w.charAt(0)===".",H=[];for(var V=0;V<Q.length;V++){var W=Q[V];if(W.charAt(0)!=="."||G){var X;if(z&&!$)X=!W.match(K);else X=W.match(K);if(X)H.push(W)}}var D=H.length;if(D===0)return;if(U.length===1&&!this.mark&&!this.stat){if(!this.matches[Y])this.matches[Y]=Object.create(null);for(var V=0;V<D;V++){var W=H[V];if($)if($.slice(-1)!=="/")W=$+"/"+W;else W=$+W;if(W.charAt(0)==="/"&&!this.nomount)W=Qh.join(this.root,W);this._emitMatch(Y,W)}return}U.shift();for(var V=0;V<D;V++){var W=H[V],L;if($)L=[$,W];else L=[W];this._process(L.concat(U),Y,J)}};y4.prototype._emitMatch=function($,q){if(P31(this,q))return;var I=this._makeAbs(q);if(this.mark)q=this._mark(q);if(this.absolute)q=I;if(this.matches[$][q])return;if(this.nodir){var U=this.cache[I];if(U==="DIR"||Array.isArray(U))return}if(this.matches[$][q]=!0,this.stat)this._stat(q)};y4.prototype._readdirInGlobStar=function($){if(this.follow)return this._readdir($,!1);var q,I,U;try{I=this.fs.lstatSync($)}catch(J){if(J.code==="ENOENT")return null}var Y=I&&I.isSymbolicLink();if(this.symlinks[$]=Y,!Y&&I&&!I.isDirectory())this.cache[$]="FILE";else q=this._readdir($,!1);return q};y4.prototype._readdir=function($,q){var I;if(q&&!Kh(this.symlinks,$))return this._readdirInGlobStar($);if(Kh(this.cache,$)){var U=this.cache[$];if(!U||U==="FILE")return null;if(Array.isArray(U))return U}try{return this._readdirEntries($,this.fs.readdirSync($))}catch(Y){return this._readdirError($,Y),null}};y4.prototype._readdirEntries=function($,q){if(!this.mark&&!this.stat)for(var I=0;I<q.length;I++){var U=q[I];if($==="/")U=$+U;else U=$+"/"+U;this.cache[U]=!0}return this.cache[$]=q,q};y4.prototype._readdirError=function($,q){switch(q.code){case"ENOTSUP":case"ENOTDIR":var I=this._makeAbs($);if(this.cache[I]="FILE",I===this.cwdAbs){var U=Error(q.code+" invalid cwd "+this.cwd);throw U.path=this.cwd,U.code=q.code,U}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs($)]=!1;break;default:if(this.cache[this._makeAbs($)]=!1,this.strict)throw q;if(!this.silent)console.error("glob error",q);break}};y4.prototype._processGlobStar=function($,q,I,U,Y,J){var Q=this._readdir(I,J);if(!Q)return;var K=U.slice(1),z=$?[$]:[],w=z.concat(K);this._process(w,Y,!1);var G=Q.length,H=this.symlinks[I];if(H&&J)return;for(var V=0;V<G;V++){var W=Q[V];if(W.charAt(0)==="."&&!this.dot)continue;var X=z.concat(Q[V],K);this._process(X,Y,!0);var D=z.concat(Q[V],U);this._process(D,Y,!0)}};y4.prototype._processSimple=function($,q){var I=this._stat($);if(!this.matches[q])this.matches[q]=Object.create(null);if(!I)return;if($&&iX($)&&!this.nomount){var U=/[\/\\]$/.test($);if($.charAt(0)==="/")$=Qh.join(this.root,$);else if($=Qh.resolve(this.root,$),U)$+="/"}if(process.platform==="win32")$=$.replace(/\\/g,"/");this._emitMatch(q,$)};y4.prototype._stat=function($){var q=this._makeAbs($),I=$.slice(-1)==="/";if($.length>this.maxLength)return!1;if(!this.stat&&Kh(this.cache,q)){var Q=this.cache[q];if(Array.isArray(Q))Q="DIR";if(!I||Q==="DIR")return Q;if(I&&Q==="FILE")return!1}var U,Y=this.statCache[q];if(!Y){var J;try{J=this.fs.lstatSync(q)}catch(K){if(K&&(K.code==="ENOENT"||K.code==="ENOTDIR"))return this.statCache[q]=!1,!1}if(J&&J.isSymbolicLink())try{Y=this.fs.statSync(q)}catch(K){Y=J}else Y=J}this.statCache[q]=Y;var Q=!0;if(Y)Q=Y.isDirectory()?"DIR":"FILE";if(this.cache[q]=this.cache[q]||Q,I&&Q==="FILE")return!1;return Q};y4.prototype._mark=function($){return y3.mark(this,$)};y4.prototype._makeAbs=function($){return y3.makeAbs(this,$)}});var zh=O((tB1,TJ0)=>{TJ0.exports=PJ0;function PJ0($,q){if($&&q)return PJ0($)(q);if(typeof $!=="function")throw TypeError("need wrapper function");return Object.keys($).forEach(function(U){I[U]=$[U]}),I;f Line truncated
`);if($.linkname)q+=nh(" linkpath="+$.linkname+`
`);var I=$.pax;if(I)for(var U in I)q+=nh(" "+U+"="+I[U]+`
`);return Buffer.from(q)};fq1.decodePax=function($){var q={};while($.length){var I=0;while(I<$.length&&$[I]!==32)I++;var U=parseInt($.slice(0,I).toString(),10);if(!U)return q;var Y=$.slice(I+1,U-1).toString(),J=Y.indexOf("=");if(J===-1)return q;q[Y.slice(0,J)]=Y.slice(J+1),$=$.slice(U)}return q};fq1.encode=function($){var q=Bq1(512),I=$.name,U="";if($.typeflag===5&&I[I.length-1]!=="/")I+="/";if(Buffer.byteLength(I)!==I.length)return null;while(Buffer.byteLength(I)>100){var Y=I.indexOf("/");if(Y===-1)return null;U+=U?"/"+I.slice(0,Y):I.slice(0,Y),I=I.slice(Y+1)}if(Buffer.byteLength(I)>100||Buffer.byteLength(U)>155)return null;if($.linkname&&Buffer.byteLength($.linkname)>100)return null;if(q.write(I),q.write(e9($.mode&Sq1,6),100),q.write(e9($.uid,6),108),q.write(e9($.gid,6),116),q.write(e9($.size,11),124),q.write(e9($.mtime.getTime()/1000|0,11),136),q[156]=iQ0+xq1($.type),$.linkname)q.write($.linkname,157);if(pQ0.copy(q,ZK),Cq1.copy(q,bh),$.uname)q.write($.uname,265);if($.gname)q.write($.gname,297);if(q.write(e9($.devmajor||0,6),329),q.write(e9($.devminor||0,6),337),U)q.write(U,345);return q.write(e9(dQ0(q),6),148),q};fq1.decode=function($,q,I){var U=$[156]===0?0:$[156]-iQ0,Y=aU($,0,100,q),J=$7($,100,8),Q=$7($,108,8),K=$7($,116,8),z=$7($,124,12),w=$7($,136,12),G=uq1(U),H=$[157]===0?null:aU($,157,100,q),V=aU($,265,32),W=aU($,297,32),X=$7($,329,8),D=$7($,337,8),L=dQ0($);if(L===256)return null;if(L!==$7($,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(pQ0.compare($,ZK,ZK+6)===0){if($[345])Y=aU($,345,155,q)+"/"+Y}else if(_q1.compare($,ZK,ZK+6)===0&&hq1.compare($,bh,bh+2)===0);else if(!I)throw Error("Invalid tar header: unknown format.");if(U===0&&Y&&Y[Y.length-1]==="/")U=5;return{name:Y,mode:J,uid:Q,gid:K,size:z,mtime:new Date(1000*w),type:G,linkname:H,uname:V,gname:W,devmajor:X,devminor:D}}});var sQ0=O((CR1,aQ0)=>{var mQ0=o("util"),dq1=bQ0(),XK=ih(),oQ0=X6().Writable,rQ0=X6().PassThrough,tQ0=function(){},lQ0=function($){return $&=511,$&&512-$},lq1=function($,q){var I=new rX($,q);return I.end(),I},mq1=function($,q){if(q.path)$.name=q.path;if(q.linkpath)$.linkname=q.linkpath;if(q.size)$.size=parseInt(q.size,10);return $.pax=q,$},rX=function($,q){this._parent=$,this.offset=q,rQ0.call(this,{autoDestroy:!1})};mQ0.inherits(rX,rQ0);rX.prototype.destroy=function($){this._parent.destroy($)};var C5=function($){if(!(this instanceof C5))return new C5($);oQ0.call(this,$),$=$||{},this._offset=0,this._buffer=dq1(),this._missing=0,this._partial=!1,this._onparse=tQ0,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var q=this,I=q._buffer,U=function(){q._continue()},Y=function(V){if(q._locked=!1,V)return q.destroy(V);if(!q._stream)U()},J=function(){q._stream=null;var V=lQ0(q._header.size);if(V)q._parse(V,Q);else q._parse(512,H);if(!q._locked)U()},Q=function(){q._buffer.consume(lQ0(q._header.size)),q._parse(512,H),U()},K=function(){var V=q._header.size;q._paxGlobal=XK.decodePax(I.slice(0,V)),I.consume(V),J()},z=function(){var V=q._header.size;if(q._pax=XK.decodePax(I.slice(0,V)),q._paxGlobal)q._pax=Object.assign({},q._paxGlobal,q._pax);I.consume(V),J()},w=function(){var V=q._header.size;this._gnuLongPath=XK.decodeLongPath(I.slice(0,V),$.filenameEncoding),I.consume(V),J()},G=function(){var V=q._header.size;this._gnuLongLinkPath=XK.decodeLongPath(I.slice(0,V),$.filenameEncoding),I.consume(V),J()},H=function(){var V=q._offset,W;try{W=q._header=XK.decode(I.slice(0,512),$.filenameEncoding,$.allowUnknownFormat)}catch(X){q.emit("error",X)}if(I.consume(512),!W){q._parse(512,H),U();return}if(W.type==="gnu-long-path"){q._parse(W.size,w),U();return}if(W.type==="gnu-long-link-path"){q._parse(W.size,G),U();return}if(W.type==="pax-global-header"){q._parse(W.size,K),U();return}if(W.type==="pax-header"){q._parse(W.size,z),U();return}if(q._gnuLongPath)W.name=q._gnuLongPath,q._gnuLongPath=null;if(q._gnuLongLinkPath)W.linkname=q._gnuLongLinkPath,q._gnuLongLinkPath=null;if(q._pax)q._header=W=mq1(W,q._pax),q._pax=null;if(q._locked=!0,!W.size||W.type==="directory"){q._parse(512,H),q.emit("entry",W,lq1(q,V),Y);return}q._stream=new rX(q,V),q.emit("entry",W,q._stream,Y),q._parse(W.size,J),U()};this._onheader=H,this._parse(512,H)};mQ0.inherits(C5,oQ0);C5.prototype.destroy=function($){if(this._destroyed)return;if(this._destroyed=!0,$)this.emit("error",$);if(this.emit("close"),this._stream)this._stream.emit("close")};C5.prototype._parse=function($,q){if(this._destroyed)return;if(this._offset+=$,this._missing=$,q===this._onheader)this._partial=!1;this._onparse=q};C5.prototype._continue=function(){if(this._destroyed)return;var $=this._cb;if(this._cb=tQ0,this._overflow)this._write(this._overflow,void 0,$);else $()};C5.prototype._write=function($,q,I){if(this._destroyed)return;var U=this._stream,Y=this._buffer,J=this._missing;if($.length)this._partial=!0;if($.length<J){ Line truncated
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`)}_writeRelationship($){if(!this.count)this._writeOpen();let q=`rId${++this.count}`;if($.TargetMode)this.stream.write(`<Relationship Id="${q}" Type="${$.Type}" Target="${VI1.xmlEncode($.Target)}" TargetMode="${$.TargetMode}"/>`);else this.stream.write(`<Relationship Id="${q}" Type="${$.Type}" Target="${$.Target}"/>`);return q}_writeClose(){this.stream.write("</Relationships>")}}T20.exports=P20});var v20=O((bR1,R20)=>{var g20=q6(),j20=u9(),ZI1=z4(),XI1=Mv(),DI1=Pv();class B20{constructor($,q,I){this.id=I.id,this.count=0,this._worksheet=$,this._workbook=I.workbook,this._sheetRelsWriter=q}get commentsStream(){if(!this._commentsStream)this._commentsStream=this._workbook._openStream(`/xl/comments${this.id}.xml`);return this._commentsStream}get vmlStream(){if(!this._vmlStream)this._vmlStream=this._workbook._openStream(`xl/drawings/vmlDrawing${this.id}.vml`);return this._vmlStream}_addRelationships(){let $={Type:j20.Comments,Target:`../comments${this.id}.xml`};this._sheetRelsWriter.addRelationship($);let q={Type:j20.VmlDrawing,Target:`../drawings/vmlDrawing${this.id}.vml`};this.vmlRelId=this._sheetRelsWriter.addRelationship(q)}_addCommentRefs(){this._workbook.commentRefs.push({commentName:`comments${this.id}`,vmlDrawing:`vmlDrawing${this.id}`})}_writeOpen(){this.commentsStream.write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><authors><author>Author</author></authors><commentList>'),this.vmlStream.write('<?xml version="1.0" encoding="UTF-8"?><xml xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:x="urn:schemas-microsoft-com:office:excel"><o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1" /></o:shapelayout><v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter" /><v:path gradientshapeok="t" o:connecttype="rect" /></v:shapetype>')}_writeComment($,q){let I=new XI1,U=new g20;I.render(U,$),this.commentsStream.write(U.xml);let Y=new DI1,J=new g20;Y.render(J,$,q),this.vmlStream.write(J.xml)}_writeClose(){this.commentsStream.write("</commentList></comments>"),this.vmlStream.write("</xml>")}addComments($){if($&&$.length){if(!this.startedData)this._worksheet.comments=[],this._writeOpen(),this._addRelationships(),this._addCommentRefs(),this.startedData=!0;$.forEach((q)=>{q.refAddress=ZI1.decodeAddress(q.ref)}),$.forEach((q)=>{this._writeComment(q,this.count),this.count+=1})}}commit(){if(this.count)this._writeClose(),this.commentsStream.end(),this.vmlStream.end()}}R20.exports=B20});var u20=O((iR1,y20)=>{var LI1=Z4(),OI1=u9(),dh=z4(),C20=fg(),_20=w5(),NI1=$R(),h20=WV(),lh=XV(),FI1=E20(),MI1=v20(),AI1=xg(),b4=new NI1,mh=h9(),PI1=rR(),TI1=tR(),EI1=aR(),gI1=dR(),jI1=pR(),BI1=lR(),RI1=sR(),vI1=eR(),CI1=$v(),_I1=qv(),hI1=Iv(),SI1=Uv(),yI1=zv(),uI1=Jv(),xI1=Yv(),i4={dataValidations:new PI1,sheetProperties:new TI1,sheetFormatProperties:new EI1,columns:new mh({tag:"cols",length:!1,childXform:new gI1}),row:new jI1,hyperlinks:new mh({tag:"hyperlinks",length:!1,childXform:new BI1}),sheetViews:new mh({tag:"sheetViews",length:!1,childXform:new RI1}),sheetProtection:new vI1,pageMargins:new CI1,pageSeteup:new _I1,autoFilter:new hI1,picture:new SI1,conditionalFormattings:new yI1,headerFooter:new uI1,rowBreaks:new xI1};class S20{constructor($){this.id=$.id,this.name=$.name||`Sheet${this.id}`,this.state=$.state||"visible",this._rows=[],this._columns=null,this._keys={},this._merges=[],this._merges.add=function(){},this._sheetRelsWriter=new FI1($),this._sheetCommentsWriter=new MI1(this,this._sheetRelsWriter,$),this._dimensions=new _20,this._rowZero=1,this.committed=!1,this.dataValidations=new AI1,this._formulae={},this._siFormulae=0,this.conditionalFormatting=[],this.rowBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,outlineLevelCol:0,outlineLevelRow:0},$.properties),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},$.headerFooter),this.pageSetup=Object.assign({},{margins:{left:0.7,right:0.7,top:0.75,bottom:0.75,header:0.3,footer:0.3},orientation:"portrait",horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!!($.pageSetup&&($.pageSetup.fitToWidth||$.pageSetup.fitToHeight)&&!$.pageSetup.scale),pageOrder:"downThenOver",blackAndWhite:!1,draft:!1,cellComments:"None",errors:"displayed",scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},$.pageSetup),this.useSharedStrings=$.useSharedStrings||!1,this._workbook=$.workbook,this.hasComments=!1,this._views=$.views||[],this.autoFilter=$.autoFilter||null,this._media=[],this.sheetProtection=null,this._writeOpenWorksheet(),this.startedData=!1}get Line truncated
See http://goo.gl/MqrFmX
`)},HS=VS.getNativePromise();if(VS.isNode&&typeof MutationObserver>"u")WS=global.setImmediate,ZS=process.nextTick,p3=VS.isRecentNode?function($){WS.call(global,$)}:function($){ZS.call(process,$)};else if(typeof HS==="function"&&typeof HS.resolve==="function")XS=HS.resolve(),p3=function($){XS.then($)};else if(typeof MutationObserver<"u"&&!(typeof window<"u"&&window.navigator&&(window.navigator.standalone||window.cordova)))p3=function(){var $=document.createElement("div"),q={attributes:!0},I=!1,U=document.createElement("div"),Y=new MutationObserver(function(){$.classList.toggle("foo"),I=!1});Y.observe(U,q);var J=function(){if(I)return;I=!0,U.classList.toggle("foo")};return function(K){var z=new MutationObserver(function(){z.disconnect(),K()});z.observe($,q),J()}}();else if(typeof setImmediate<"u")p3=function($){setImmediate($)};else if(typeof setTimeout<"u")p3=function($){setTimeout($,0)};else p3=BU1;var WS,ZS,XS;XK0.exports=p3});var OK0=O(($v1,LK0)=>{function RU1($,q,I,U,Y){for(var J=0;J<Y;++J)I[J+U]=$[J+q],$[J+q]=void 0}function U7($){this._capacity=$,this._length=0,this._front=0}U7.prototype._willBeOverCapacity=function($){return this._capacity<$};U7.prototype._pushOne=function($){var q=this.length();this._checkCapacity(q+1);var I=this._front+q&this._capacity-1;this[I]=$,this._length=q+1};U7.prototype.push=function($,q,I){var U=this.length()+3;if(this._willBeOverCapacity(U)){this._pushOne($),this._pushOne(q),this._pushOne(I);return}var Y=this._front+U-3;this._checkCapacity(U);var J=this._capacity-1;this[Y+0&J]=$,this[Y+1&J]=q,this[Y+2&J]=I,this._length=U};U7.prototype.shift=function(){var $=this._front,q=this[$];return this[$]=void 0,this._front=$+1&this._capacity-1,this._length--,q};U7.prototype.length=function(){return this._length};U7.prototype._checkCapacity=function($){if(this._capacity<$)this._resizeTo(this._capacity<<1)};U7.prototype._resizeTo=function($){var q=this._capacity;this._capacity=$;var I=this._front,U=this._length,Y=I+U&q-1;RU1(this,0,this,q,Y)};LK0.exports=U7});var EK0=O((qv1,DS)=>{var PK0;try{throw Error()}catch($){PK0=$}var vU1=DK0(),NK0=OK0(),TK0=n1();function p4(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new NK0(16),this._normalQueue=new NK0(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var $=this;this.drainQueues=function(){$._drainQueues()},this._schedule=vU1}p4.prototype.setScheduler=function($){var q=this._schedule;return this._schedule=$,this._customScheduler=!0,q};p4.prototype.hasCustomScheduler=function(){return this._customScheduler};p4.prototype.enableTrampoline=function(){this._trampolineEnabled=!0};p4.prototype.disableTrampolineIfNecessary=function(){if(TK0.hasDevTools)this._trampolineEnabled=!1};p4.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues};p4.prototype.fatalError=function($,q){if(q)process.stderr.write("Fatal "+($ instanceof Error?$.stack:$)+`
`),process.exit(2);else this.throwLater($)};p4.prototype.throwLater=function($,q){if(arguments.length===1)q=$,$=function(){throw q};if(typeof setTimeout<"u")setTimeout(function(){$(q)},0);else try{this._schedule(function(){$(q)})}catch(I){throw Error(`No async scheduler available
See http://goo.gl/MqrFmX
`)}};function FK0($,q,I){this._lateQueue.push($,q,I),this._queueTick()}function MK0($,q,I){this._normalQueue.push($,q,I),this._queueTick()}function AK0($){this._normalQueue._pushOne($),this._queueTick()}if(!TK0.hasDevTools)p4.prototype.invokeLater=FK0,p4.prototype.invoke=MK0,p4.prototype.settlePromises=AK0;else p4.prototype.invokeLater=function($,q,I){if(this._trampolineEnabled)FK0.call(this,$,q,I);else this._schedule(function(){setTimeout(function(){$.call(q,I)},100)})},p4.prototype.invoke=function($,q,I){if(this._trampolineEnabled)MK0.call(this,$,q,I);else this._schedule(function(){$.call(q,I)})},p4.prototype.settlePromises=function($){if(this._trampolineEnabled)AK0.call(this,$);else this._schedule(function(){$._settlePromises()})};p4.prototype._drainQueue=function($){while($.length()>0){var q=$.shift();if(typeof q!=="function"){q._settlePromises();continue}var I=$.shift(),U=$.shift();q.call(I,U)}};p4.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)};p4.prototype._queueTick=function(){if(!this._isTickUsed)this._isTickUsed=!0,this._schedule(this.drainQueues)};p4.prototype._reset=function(){this._isTickUsed=!1};DS.exports=p4;DS.exports.firstLineError=PK0});var h5=O((Iv1,BK0)=>{var NS=i3(),CU1=NS.freeze,gK0=n1(),jK0=gK0.inherits,IY=gK0.notEnumerableProp;function UY($,q){function I(U){if(!(this instanceof I))return new I(U);if(IY(this,"message",typeof U==="string"?U:q),IY(this,"name",$),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else Error.call(this)}return jK0(I,Error),I}var LS,OS,_U1=UY("Warning","warning"),hU1=UY("CancellationError","cancellation error"),SU1=UY("TimeoutError","timeout error"),MK=UY("AggregateError","aggregate error");try{LS=TypeError,OS=RangeError}catch($){LS=UY("TypeError","type error"),OS=UY("RangeError","range error")}var YD="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");for(c3=0;c3<YD.length;++c3)if(typeof Array.prototype[YD[c3]]==="function")MK.prototype[YD[c3]]=Array.prototype[YD[c3]];var c3;NS.defineProperty(MK.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0});MK.prototype.isOperational=!0;var JD=0;MK.prototype.toString=function(){var $=Array(JD*4+1).join(" "),q=`
`+$+`AggregateError of:
`;JD++,$=Array(JD*4+1).join(" ");for(var I=0;I<this.length;++I){var U=this[I]===this?"[Circular AggregateError]":this[I]+"",Y=U.split(`
`);for(var J=0;J<Y.length;++J)Y[J]=$+Y[J];U=Y.join(`
`),q+=U+`
`}return JD--,q};function FK($){if(!(this instanceof FK))return new FK($);if(IY(this,"name","OperationalError"),IY(this,"message",$),this.cause=$,this.isOperational=!0,$ instanceof Error)IY(this,"message",$.message),IY(this,"stack",$.stack);else if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}jK0(FK,Error);var d3=Error.__BluebirdErrorTypes__;if(!d3)d3=CU1({CancellationError:hU1,TimeoutError:SU1,OperationalError:FK,RejectionError:FK,AggregateError:MK}),NS.defineProperty(Error,"__BluebirdErrorTypes__",{value:d3,writable:!1,enumerable:!1,configurable:!1});BK0.exports={Error,TypeError:LS,RangeError:OS,CancellationError:d3.CancellationError,OperationalError:d3.OperationalError,TimeoutError:d3.TimeoutError,AggregateError:d3.AggregateError,Warning:_U1}});var vK0=O((Uv1,RK0)=>{RK0.exports=function($,q){var I=n1(),U=I.errorObj,Y=I.isObject;function J(H,V){if(Y(H)){if(H instanceof $)return H;var W=K(H);if(W===U){if(V)V._pushContext();var X=$.reject(W.e);if(V)V._popContext();return X}else if(typeof W==="function"){if(w(H)){var X=new $(q);return H._then(X._fulfill,X._reject,void 0,X,null),X}return G(H,W,V)}}return H}function Q(H){return H.then}function K(H){try{return Q(H)}catch(V){return U.e=V,U}}var z={}.hasOwnProperty;function w(H){try{return z.call(H,"_promise0")}catch(V){return!1}}function G(H,V,W){var X=new $(q),D=X;if(W)W._pushContext();if(X._captureStackTrace(),W)W._popContext();var L=!0,N=I.tryCatch(V).call(H,E,T);if(L=!1,X&&N===U)X._rejectCallback(N.e,!0,!0),X=null;function E(P){if(!X)return;X._resolveCallback(P),X=null}function T(P){if(!X)return;X._rejectCallback(P,L,!0),X=null}return D}return J}});var _K0=O((Yv1,CK0)=>{CK0.exports=function($,q,I,U,Y){var J=n1(),Q=J.isArray;function K(w){switch(w){case-2:return[];case-3:return{}}}function z(w){var G=this._promise=new $(q);if(w instanceof $)G._propagateFrom(w,3);G._setOnCancel(this),this._values=w,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return J.inherits(z,Y),z.prototype.length=function(){return this._length},z.prototype.promise=function(){return this._promise},z.prototype._init=function w(G,H){var V=I(this._values,this._promise);if(V instanceof $){V=V._target();var W=V._bitField;if(this._values=V,(W&50397184)===0)return this._promise._setAsyncGuaranteed(),V._then(w,this._reject,void 0,this,H);else if((W&33554432)!==0)V=V._value();else if((W&16777216)!==0)return this._reject(V._reason());else return this._cancel()}if(V=J.asArray(V),V===null){var X=U("expecting an array or an iterable object but got "+J.classString(V)).reason();this._promise._rejectCallback(X,!1);return}if(V.length===0){if(H===-5)this._resolveEmptyArray();else this._resolve(K(H));return}this._iterate(V)},z.prototype._iterate=function(w){var G=this.getActualLength(w.length);this._length=G,this._values=this.shouldCopyValues()?Array(G):this._values;var H=this._promise,V=!1,W=null;for(var X=0;X<G;++X){var D=I(w[X],H);if(D instanceof $)D=D._target(),W=D._bitField;else W=null;if(V){if(W!==null)D.suppressUnhandledRejections()}else if(W!==null)if((W&50397184)===0)D._proxy(this,X),this._values[X]=D;else if((W&33554432)!==0)V=this._promiseFulfilled(D._value(),X);else if((W&16777216)!==0)V=this._promiseRejected(D._reason(),X);else V=this._promiseCancelled(X);else V=this._promiseFulfilled(D,X)}if(!V)H._setAsyncGuaranteed()},z.prototype._isResolved=function(){return this._values===null},z.prototype._resolve=function(w){this._values=null,this._promise._fulfill(w)},z.prototype._cancel=function(){if(this._isResolved()||!this._promise._isCancellable())return;this._values=null,this._promise._cancel()},z.prototype._reject=function(w){this._values=null,this._promise._rejectCallback(w,!1)},z.prototype._promiseFulfilled=function(w,G){this._values[G]=w;var H=++this._totalResolved;if(H>=this._length)return this._resolve(this._values),!0;return!1},z.prototype._promiseCancelled=function(){return this._cancel(),!0},z.prototype._promiseRejected=function(w){return this._totalResolved++,this._reject(w),!0},z.prototype._resultCancelled=function(){if(this._isResolved())return;var w=this._values;if(this._cancel(),w instanceof $)w.cancel();else for(var G=0;G<w.length;++G)if(w[G]instanceof $)w[G].cancel()},z.prototype.shouldCopyValues=function(){return!0},z.prototype.getActualLength=function(w){return w},z}});var SK0=O((Jv1,hK0)=>{hK0.exports=function($){var q=!1,I=[];$.prototype._promiseCreated=function(){},$.prototype._pushContext=function(){},$.prototype._popContext=function(){return null},$._peekContext=$.prototype._peekContext=function(){};function U(){this._trace=new U.CapturedTrace(J())}U.prototype._pushContext=function(){if(this._trace!==void 0)this._trace._promiseCreated=null,I.push(this._trace)},U.prototype._popContext=function(){if(this._trace!==void 0){var Q=I.pop(),K=Q._promiseCreated;return Q._promiseCreated=null,K}return null};function Y(){if(q)return new U}function J(){var Q=I.length-1;if(Q>=0)return I[Q];return}return U.CapturedTrace=null,U.create=Y,U.deactivateLong Line truncated
See http://goo.gl/MqrFmX
`);if(!P0.longStackTraces&&y$()){var r=$.prototype._captureStackTrace,F=$.prototype._attachExtraTrace;P0.longStackTraces=!0,P=function(){if(U.haveItemsQueued()&&!P0.longStackTraces)throw Error(`cannot enable long stack traces after promises have been created
See http://goo.gl/MqrFmX
`);$.prototype._captureStackTrace=r,$.prototype._attachExtraTrace=F,q.deactivateLongStackTraces(),U.enableTrampoline(),P0.longStackTraces=!1},$.prototype._captureStackTrace=K0,$.prototype._attachExtraTrace=G0,q.activateLongStackTraces(),U.disableTrampolineIfNecessary()}},$.hasLongStackTraces=function(){return P0.longStackTraces&&y$()};var B=function(){try{if(typeof CustomEvent==="function"){var r=new CustomEvent("CustomEvent");return J.global.dispatchEvent(r),function(F,M){var R=new CustomEvent(F.toLowerCase(),{detail:M,cancelable:!0});return!J.global.dispatchEvent(R)}}else if(typeof Event==="function"){var r=new Event("CustomEvent");return J.global.dispatchEvent(r),function(M,R){var y=new Event(M.toLowerCase(),{cancelable:!0});return y.detail=R,!J.global.dispatchEvent(y)}}else{var r=document.createEvent("CustomEvent");return r.initCustomEvent("testingtheevent",!1,!0,{}),J.global.dispatchEvent(r),function(M,R){var y=document.createEvent("CustomEvent");return y.initCustomEvent(M.toLowerCase(),!1,!0,R),!J.global.dispatchEvent(y)}}}catch(F){}return function(){return!1}}(),k=function(){if(J.isNode)return function(){return process.emit.apply(process,arguments)};else{if(!J.global)return function(){return!1};return function(r){var F="on"+r.toLowerCase(),M=J.global[F];if(!M)return!1;return M.apply(J.global,[].slice.call(arguments,1)),!0}}}();function h(r,F){return{promise:F}}var f={promiseCreated:h,promiseFulfilled:h,promiseRejected:h,promiseResolved:h,promiseCancelled:h,promiseChained:function(r,F,M){return{promise:F,child:M}},warning:function(r,F){return{warning:F}},unhandledRejection:function(r,F,M){return{reason:F,promise:M}},rejectionHandled:h},S=function(r){var F=!1;try{F=k.apply(null,arguments)}catch(R){U.throwLater(R),F=!0}var M=!1;try{M=B(r,f[r].apply(null,arguments))}catch(R){U.throwLater(R),M=!0}return M||F};$.config=function(r){if(r=Object(r),"longStackTraces"in r){if(r.longStackTraces)$.longStackTraces();else if(!r.longStackTraces&&$.hasLongStackTraces())P()}if("warnings"in r){var F=r.warnings;if(P0.warnings=!!F,T=P0.warnings,J.isObject(F)){if("wForgottenReturn"in F)T=!!F.wForgottenReturn}}if("cancellation"in r&&r.cancellation&&!P0.cancellation){if(U.haveItemsQueued())throw Error("cannot enable cancellation after promises are in use");$.prototype._clearCancellationData=J0,$.prototype._propagateFrom=g,$.prototype._onCancel=n,$.prototype._setOnCancel=b,$.prototype._attachCancellationCallback=C,$.prototype._execute=p,d=g,P0.cancellation=!0}if("monitoring"in r){if(r.monitoring&&!P0.monitoring)P0.monitoring=!0,$.prototype._fireEvent=S;else if(!r.monitoring&&P0.monitoring)P0.monitoring=!1,$.prototype._fireEvent=t}return $};function t(){return!1}$.prototype._fireEvent=t,$.prototype._execute=function(r,F,M){try{r(F,M)}catch(R){return R}},$.prototype._onCancel=function(){},$.prototype._setOnCancel=function(r){},$.prototype._attachCancellationCallback=function(r){},$.prototype._captureStackTrace=function(){},$.prototype._attachExtraTrace=function(){},$.prototype._clearCancellationData=function(){},$.prototype._propagateFrom=function(r,F){};function p(r,F,M){var R=this;try{r(F,M,function(y){if(typeof y!=="function")throw TypeError("onCancel must be a function, got: "+J.toString(y));R._attachCancellationCallback(y)})}catch(y){return y}}function C(r){if(!this._isCancellable())return this;var F=this._onCancel();if(F!==void 0)if(J.isArray(F))F.push(r);else this._setOnCancel([F,r]);else this._setOnCancel(r)}function n(){return this._onCancelField}function b(r){this._onCancelField=r}function J0(){this._cancellationParent=void 0,this._onCancelField=void 0}function g(r,F){if((F&1)!==0){this._cancellationParent=r;var M=r._branchesRemainingToCancel;if(M===void 0)M=0;r._branchesRemainingToCancel=M+1}if((F&2)!==0&&r._isBound())this._setBoundTo(r._boundTo)}function u(r,F){if((F&2)!==0&&r._isBound())this._setBoundTo(r._boundTo)}var d=u;function a(){var r=this._boundTo;if(r!==void 0){if(r instanceof $)if(r.isFulfilled())return r.value();else return}return r}function K0(){this._trace=new e6(this._peekContext())}function G0(r,F){if(Q(r)){var M=this._trace;if(M!==void 0){if(F)M=M._parent}if(M!==void 0)M.attachExtraTrace(r);else if(!r.__stackCleaned__){var R=J4(r);J.notEnumerableProp(r,"stack",R.message+`
`+R.stack.join(`
`)),J.notEnumerableProp(r,"__stackCleaned__",!0)}}}function M0(r,F,M,R,y){if(r===void 0&&F!==null&&T){if(y!==void 0&&y._returnedNonUndefined())return;if((R._bitField&65535)===0)return;if(M)M=M+" ";var s="",c="";if(F._trace){var e=F._trace.stack.split(`
`),U0=J1(e);for(var w0=U0.length-1;w0>=0;--w0){var g0=U0[w0];if(!G.test(g0)){var x0=g0.match(H);if(x0)s="at "+x0[1]+":"+x0[2]+":"+x0[3]+" ";break}}if(U0.length>0){var y0=U0[0];for(var w0=0;w0<e.length;++w0)if(e[w0]===y0){if(w0>0)c=`
`+e[w0-1];break}}}var q1="a promise was created in a "+M+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+c;R._warn(q1,!0,F)}}function v0(r,F){var M=r+" is deprecated and will be removed in a future version.";if(F)M+=" Use "+F+" instead.";return R1(M)}function R1(r,F,M){if(!P0.warnings)return;var R=new Y(r),y;if(F)M._attachExtraTrace(R);else if(P0.longStackTraces&&(y=$._peekContext()))y.attachExtraTrace(R);else{var s=J4(R);R.stack=s.message+`
`+s.stack.join(`
`)}if(!S("warning",R))C4(R,"",!0)}function l0(r,F){for(var M=0;M<F.length-1;++M)F[M].push("From previous event:"),F[M]=F[M].join(`
`);if(M<F.length)F[M]=F[M].join(`
`);return r+`
`+F.join(`
`)}function O1(r){for(var F=0;F<r.length;++F)if(r[F].length===0||F+1<r.length&&r[F][0]===r[F+1][0])r.splice(F,1),F--}function N1(r){var F=r[0];for(var M=1;M<r.length;++M){var R=r[M],y=F.length-1,s=F[y],c=-1;for(var e=R.length-1;e>=0;--e)if(R[e]===s){c=e;break}for(var e=c;e>=0;--e){var U0=R[e];if(F[y]===U0)F.pop(),y--;else break}F=R}}function J1(r){var F=[];for(var M=0;M<r.length;++M){var R=r[M],y=R===" (No stack trace)"||V.test(R),s=y&&V$(R);if(y&&!s){if(X&&R.charAt(0)!==" ")R=" "+R;F.push(R)}}return F}function C1(r){var F=r.stack.replace(/\s+$/g,"").split(`
`);for(var M=0;M<F.length;++M){var R=F[M];if(R===" (No stack trace)"||V.test(R))break}if(M>0&&r.name!="SyntaxError")F=F.slice(M);return F}function J4(r){var F=r.stack,M=r.toString();return F=typeof F==="string"&&F.length>0?C1(r):[" (No stack trace)"],{message:M,stack:r.name=="SyntaxError"?F:J1(F)}}function C4(r,F,M){if(typeof console<"u"){var R;if(J.isObject(r)){var y=r.stack;R=F+W(y,r)}else R=F+String(r);if(typeof D==="function")D(R,M);else if(typeof console.log==="function"||typeof console.log==="object")console.log(R)}}function H$(r,F,M,R){var y=!1;try{if(typeof F==="function")if(y=!0,r==="rejectionHandled")F(R);else F(M,R)}catch(s){U.throwLater(s)}if(r==="unhandledRejection"){if(!S(r,M,R)&&!y)C4(M,"Unhandled rejection ")}else S(r,R)}function S$(r){var F;if(typeof r==="function")F="[function "+(r.name||"anonymous")+"]";else{F=r&&typeof r.toString==="function"?r.toString():J.toString(r);var M=/\[object [a-zA-Z0-9$_]+\]/;if(M.test(F))try{var R=JSON.stringify(r);F=R}catch(y){}if(F.length===0)F="(empty array)"}return"(<"+c8(F)+">, no stack trace)"}function c8(r){var F=41;if(r.length<F)return r;return r.substr(0,F-3)+"..."}function y$(){return typeof c5==="function"}var V$=function(){return!1},d8=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function s6(r){var F=r.match(d8);if(F)return{fileName:F[1],line:parseInt(F[2],10)}}function D7(r,F){if(!y$())return;var M=r.stack.split(`
`),R=F.stack.split(`
`),y=-1,s=-1,c,e;for(var U0=0;U0<M.length;++U0){var w0=s6(M[U0]);if(w0){c=w0.fileName,y=w0.line;break}}for(var U0=0;U0<R.length;++U0){var w0=s6(R[U0]);if(w0){e=w0.fileName,s=w0.line;break}}if(y<0||s<0||!c||!e||c!==e||y>=s)return;V$=function(g0){if(w.test(g0))return!0;var x0=s6(g0);if(x0){if(x0.fileName===c&&(y<=x0.line&&x0.line<=s))return!0}return!1}}function e6(r){this._parent=r,this._promisesCreated=0;var F=this._length=1+(r===void 0?0:r._length);if(c5(this,e6),F>32)this.uncycle()}J.inherits(e6,Error),q.CapturedTrace=e6,e6.prototype.uncycle=function(){var r=this._length;if(r<2)return;var F=[],M={};for(var R=0,y=this;y!==void 0;++R)F.push(y),y=y._parent;r=this._length=R;for(var R=r-1;R>=0;--R){var s=F[R].stack;if(M[s]===void 0)M[s]=R}for(var R=0;R<r;++R){var c=F[R].stack,e=M[c];if(e!==void 0&&e!==R){if(e>0)F[e-1]._parent=void 0,F[e-1]._length=1;F[R]._parent=void 0,F[R]._length=1;var U0=R>0?F[R-1]:this;if(e<r-1)U0._parent=F[e+1],U0._parent.uncycle(),U0._length=U0._parent._length+1;else U0._parent=void 0,U0._length=1;var w0=U0._length+1;for(var g0=R-2;g0>=0;--g0)F[g0]._length=w0,w0++;return}}},e6.prototype.attachExtraTrace=function(r){if(r.__stackCleaned__)return;this.uncycle();var F=J4(r),M=F.message,R=[F.stack],y=this;while(y!==void 0)R.push(J1(y.stack.split(`
`))),y=y._parent;N1(R),O1(R),J.notEnumerableProp(r,"stack",l0(M,R)),J.notEnumerableProp(r,"__stackCleaned__",!0)};var c5=function(){var F=/^\s*at\s*/,M=function(c,e){if(typeof c==="string")return c;if(e.name!==void 0&&e.message!==void 0)return e.toString();return S$(e)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6,V=F,W=M;var R=Error.captureStackTrace;return V$=function(c){return w.test(c)},function(c,e){Error.stackTraceLimit+=6,R(c,e),Error.stackTraceLimit-=6}}var y=Error();if(typeof y.stack==="string"&&y.stack.split(`
`)[0].indexOf("stackDetection@")>=0)return V=/@/,W=M,X=!0,function(e){e.stack=Error().stack};var s;try{throw Error()}catch(c){s="stack"in c}if(!("stack"in y)&&s&&typeof Error.stackTraceLimit==="number")return V=F,W=M,function(e){Error.stackTraceLimit+=6;try{throw Error()}catch(U0){e.stack=U0.stack}Error.stackTraceLimit-=6};return W=function(c,e){if(typeof c==="string")return c;if((typeof e==="object"||typeof e==="function")&&e.name!==void 0&&e.message!==void 0)return e.toString();return S$(e)},null}([]);if(typeof console<"u"&&typeof console.warn<"u"){if(D=function(r){console.warn(r)},J.isNode&&process.stderr.isTTY)D=function(r,F){var M=F?"\x1B[33m":"\x1B[31m";console.warn(M+r+`\x1B[0m
`)};else if(!J.isNode&&typeof Error().stack==="string")D=function(r,F){console.warn("%c"+r,F?"color: darkorange":"color: red")}}var P0={warnings:N,longStackTraces:!1,cancellation:!1,monitoring:!1};if(E)$.longStackTraces();return{longStackTraces:function(){return P0.longStackTraces},warnings:function(){return P0.warnings},cancellation:function(){return P0.cancellation},monitoring:function(){return P0.monitoring},propagateFromFunction:function(){return d},boundValueFunction:function(){return a},checkForgottenReturns:M0,setBounds:D7,warn:R1,deprecated:v0,CapturedTrace:e6,fireDomEvent:B,fireGlobalEvent:k}}});var kK0=O((Kv1,xK0)=>{xK0.exports=function($,q){var I=n1(),U=$.CancellationError,Y=I.errorObj;function J(H,V,W){this.promise=H,this.type=V,this.handler=W,this.called=!1,this.cancelPromise=null}J.prototype.isFinallyHandler=function(){return this.type===0};function Q(H){this.finallyHandler=H}Q.prototype._resultCancelled=function(){K(this.finallyHandler)};function K(H,V){if(H.cancelPromise!=null){if(arguments.length>1)H.cancelPromise._reject(V);else H.cancelPromise._cancel();return H.cancelPromise=null,!0}return!1}function z(){return G.call(this,this.promise._target()._settledValue())}function w(H){if(K(this,H))return;return Y.e=H,Y}function G(H){var V=this.promise,W=this.handler;if(!this.called){this.called=!0;var X=this.isFinallyHandler()?W.call(V._boundValue()):W.call(V._boundValue(),H);if(X!==void 0){V._setReturnedNonUndefined();var D=q(X,V);if(D instanceof $){if(this.cancelPromise!=null){if(D._isCancelled()){var L=new U("late cancellation observer");return V._attachExtraTrace(L),Y.e=L,Y}else if(D.isPending())D._attachCancellationCallback(new Q(this))}return D._then(z,w,void 0,this,void 0)}}}if(V.isRejected())return K(this),Y.e=H,Y;else return K(this),H}return $.prototype._passThrough=function(H,V,W,X){if(typeof H!=="function")return this.then();return this._then(W,X,void 0,new J(this,V,H),void 0)},$.prototype.lastly=$.prototype.finally=function(H){return this._passThrough(H,0,G,G)},$.prototype.tap=function(H){return this._passThrough(H,1,G)},J}});var nK0=O((zv1,fK0)=>{fK0.exports=function($){var q=n1(),I=i3().keys,U=q.tryCatch,Y=q.errorObj;function J(Q,K,z){return function(w){var G=z._boundValue();$:for(var H=0;H<Q.length;++H){var V=Q[H];if(V===Error||V!=null&&V.prototype instanceof Error){if(w instanceof V)return U(K).call(G,w)}else if(typeof V==="function"){var W=U(V).call(G,w);if(W===Y)return W;else if(W)return U(K).call(G,w)}else if(q.isObject(w)){var X=I(V);for(var D=0;D<X.length;++D){var L=X[D];if(V[L]!=w[L])continue $}return U(K).call(G,w)}}return $}}return J}});var FS=O((wv1,pK0)=>{var bK0=n1(),yU1=bK0.maybeWrapAsError,uU1=h5(),xU1=uU1.OperationalError,iK0=i3();function kU1($){return $ instanceof Error&&iK0.getPrototypeOf($)===Error.prototype}var fU1=/^(?:name|message|stack|cause)$/;function nU1($){var q;if(kU1($)){q=new xU1($),q.name=$.name,q.message=$.message,q.stack=$.stack;var I=iK0.keys($);for(var U=0;U<I.length;++U){var Y=I[U];if(!fU1.test(Y))q[Y]=$[Y]}return q}return bK0.markAsOriginatingFromRejection($),$}function bU1($,q){return function(I,U){if($===null)return;if(I){var Y=nU1(yU1(I));$._attachExtraTrace(Y),$._reject(Y)}else if(!q)$._fulfill(U);else{var J=arguments.length,Q=Array(Math.max(J-1,0));for(var K=1;K<J;++K)Q[K-1]=arguments[K];$._fulfill(Q)}$=null}}pK0.exports=bU1});var dK0=O((Gv1,cK0)=>{cK0.exports=function($,q,I,U,Y){var J=n1(),Q=J.tryCatch;$.method=function(K){if(typeof K!=="function")throw new $.TypeError("expecting a function but got "+J.classString(K));return function(){var z=new $(q);z._captureStackTrace(),z._pushContext();var w=Q(K).apply(this,arguments),G=z._popContext();return Y.checkForgottenReturns(w,G,"Promise.method",z),z._resolveFromSyncValue(w),z}},$.attempt=$.try=function(K){if(typeof K!=="function")return U("expecting a function but got "+J.classString(K));var z=new $(q);z._captureStackTrace(),z._pushContext();var w;if(arguments.length>1){Y.deprecated("calling Promise.try with more than 1 argument");var G=arguments[1],H=arguments[2];w=J.isArray(G)?Q(K).apply(H,G):Q(K).call(H,G)}else w=Q(K)();var V=z._popContext();return Y.checkForgottenReturns(w,V,"Promise.try",z),z._resolveFromSyncValue(w),z},$.prototype._resolveFromSyncValue=function(K){if(K===J.errorObj)this._rejectCallback(K.e,!1);else this._resolveCallback(K,!0)}}});var mK0=O((Hv1,lK0)=>{lK0.exports=function($,q,I,U){var Y=!1,J=function(w,G){this._reject(G)},Q=function(w,G){G.promiseRejectionQueued=!0,G.bindingPromise._then(J,J,null,this,w)},K=function(w,G){if((this._bitField&50397184)===0)this._resolveCallback(G.target)},z=function(w,G){if(!G.promiseRejectionQueued)this._reject(w)};$.prototype.bind=function(w){if(!Y)Y=!0,$.prototype._propagateFrom=U.propagateFromFunction(),$.prototype._boundValue=U.boundValueFunction();var G=I(w),H=new $(q);H._propagateFrom(this,1);var V=this._target();if(H._setBoundTo(G),G instanceof $){var W={promiseRejectionQueued:!1,promise:H,target:V,bindingPromise:G};V._then(q,Q,voi Line truncated
See http://goo.gl/MqrFmX
`);return this._settledValue()},U=q.prototype.error=q.prototype.reason=function(){if(!this.isRejected())throw TypeError(`cannot get rejection reason of a non-rejected promise
See http://goo.gl/MqrFmX
`);return this._settledValue()},Y=q.prototype.isFulfilled=function(){return(this._bitField&33554432)!==0},J=q.prototype.isRejected=function(){return(this._bitField&16777216)!==0},Q=q.prototype.isPending=function(){return(this._bitField&50397184)===0},K=q.prototype.isResolved=function(){return(this._bitField&50331648)!==0};q.prototype.isCancelled=function(){return(this._bitField&8454144)!==0},$.prototype.__isCancelled=function(){return(this._bitField&65536)===65536},$.prototype._isCancelled=function(){return this._target().__isCancelled()},$.prototype.isCancelled=function(){return(this._target()._bitField&8454144)!==0},$.prototype.isPending=function(){return Q.call(this._target())},$.prototype.isRejected=function(){return J.call(this._target())},$.prototype.isFulfilled=function(){return Y.call(this._target())},$.prototype.isResolved=function(){return K.call(this._target())},$.prototype.value=function(){return I.call(this._target())},$.prototype.reason=function(){var z=this._target();return z._unsetRejectionIsUnhandled(),U.call(z)},$.prototype._value=function(){return this._settledValue()},$.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},$.PromiseInspection=q}});var qz0=O((Xv1,$z0)=>{$z0.exports=function($,q,I,U,Y,J){var Q=n1(),K=Q.canEvaluate,z=Q.tryCatch,w=Q.errorObj,G;if(K){var H=function(E){return Function("value","holder",`
'use strict';
holder.pIndex = value;
holder.checkFulfillment(this);
`.replace(/Index/g,E))},V=function(E){return Function("promise","holder",`
'use strict';
holder.pIndex = promise;
`.replace(/Index/g,E))},W=function(E){var T=Array(E);for(var P=0;P<T.length;++P)T[P]="this.p"+(P+1);var B=T.join(" = ")+" = null;",k=`var promise;
`+T.map(function(t){return`
promise = `+t+`;
if (promise instanceof Promise) {
promise.cancel();
}
`}).join(`
`),h=T.join(", "),f="Holder$"+E,S=`return function(tryCatch, errorObj, Promise, async) {
'use strict';
function [TheName](fn) {
[TheProperties]
this.fn = fn;
this.asyncNeeded = true;
this.now = 0;
}
[TheName].prototype._callFunction = function(promise) {
promise._pushContext();
var ret = tryCatch(this.fn)([ThePassedArguments]);
promise._popContext();
if (ret === errorObj) {
promise._rejectCallback(ret.e, false);
} else {
promise._resolveCallback(ret);
}
};
[TheName].prototype.checkFulfillment = function(promise) {
var now = ++this.now;
if (now === [TheTotal]) {
if (this.asyncNeeded) {
async.invoke(this._callFunction, this, promise);
} else {
this._callFunction(promise);
}
}
};
[TheName].prototype._resultCancelled = function() {
[CancellationCode]
};
return [TheName];
}(tryCatch, errorObj, Promise, async);
`;return S=S.replace(/\[TheName\]/g,f).replace(/\[TheTotal\]/g,E).replace(/\[ThePassedArguments\]/g,h).replace(/\[TheProperties\]/g,B).replace(/\[CancellationCode\]/g,k),Function("tryCatch","errorObj","Promise","async",S)(z,w,$,Y)},X=[],D=[],L=[];for(var N=0;N<8;++N)X.push(W(N+1)),D.push(H(N+1)),L.push(V(N+1));G=function(E){this._reject(E)}}$.join=function(){var E=arguments.length-1,T;if(E>0&&typeof arguments[E]==="function"){if(T=arguments[E],E<=8&&K){var b=new $(U);b._captureStackTrace();var P=X[E-1],B=new P(T),k=D;for(var h=0;h<E;++h){var f=I(arguments[h],b);if(f instanceof $){f=f._target();var S=f._bitField;if((S&50397184)===0)f._then(k[h],G,void 0,b,B),L[h](f,B),B.asyncNeeded=!1;else if((S&33554432)!==0)k[h].call(b,f._value(),B);else if((S&16777216)!==0)b._reject(f._reason());else b._cancel()}else k[h].call(b,f,B)}if(!b._isFateSealed()){if(B.asyncNeeded){var t=J();if(t!==null)B.fn=Q.domainBind(t,B.fn)}b._setAsyncGuaranteed(),b._setOnCancel(B)}return b}}var p=arguments.length,C=Array(p);for(var n=0;n<p;++n)C[n]=arguments[n];if(T)C.pop();var b=new q(C).promise();return T!==void 0?b.spread(T):b}}});var Uz0=O((Dv1,Iz0)=>{Iz0.exports=function($,q,I,U,Y,J){var Q=$._getDomain,K=n1(),z=K.tryCatch,w=K.errorObj,G=$._async;function H(W,X,D,L){this.constructor$(W),this._promise._captureStackTrace();var N=Q();this._callback=N===null?X:K.domainBind(N,X),this._preservedValues=L===Y?Array(this.length()):null,this._limit=D,this._inFlight=0,this._queue=[],G.invoke(this._asyncInit,this,void 0)}K.inherits(H,q),H.prototype._asyncInit=function(){this._init$(void 0,-2)},H.prototype._init=function(){},H.prototype._promiseFulfilled=function(W,X){var D=this._values,L=this.length(),N=this._preservedValues,E=this._limit;if(X<0){if(X=X*-1-1,D[X]=W,E>=1){if(this._inFlight--,this._drainQueue(),this._isResolved())return!0}}else{if(E>=1&&this._inFlight>=E)return D[X]=W,this._queue.push(X),!1;if(N!==null)N[X]=W;var T=this._promise,P=this._callback,B=T._boundValue();T._pushContext();var k=z(P).call(B,W,X,L),h=T._popContext();if(J.checkForgottenReturns(k,h,N!==null?"Promise.filter":"Promise.map",T),k===w)return this._reject(k.e),!0;var f=U(k,this._promise);if(f instanceof $){f=f._target();var S=f._bitField;if((S&50397184)===0){if(E>=1)this._inFlight++;return D[X]=f,f._proxy(this,(X+1)*-1),!1}else if((S&33554432)!==0)k=f._value();else if((S&16777216)!==0)return this._reject(f._reason()),!0;else return this._cancel(),!0}D[X]=k}var t=++this._totalResolved;if(t>=L){if(N!==null)this._filter(D,N);else this._resolve(D);return!0}return!1},H.prototype._drainQueue=function(){var W=this._queue,X=this._limit,D=this._values;while(W.length>0&&this._inFlight<X){if(this._isResolved())return;var L=W.pop();this._promiseFulfilled(D[L],L)}},H.prototype._filter=function(W,X){var D=X.length,L=Array(D),N=0;for(var E=0;E<D;++E)if(W[E])L[N++]=X[E];L.length=N,this._resolve(L)},H.prototype.preservedValues=function(){return this._preservedValues};function V(W,X,D,L){if(typeof X!=="function")return I("expecting a function but got "+K.classString(X));var N=0;if(D!==void 0)if(typeof D==="object"&&D!==null){if(typeof D.concurrency!=="number")return $.reject(TypeError("'concurrency' must be a number but it is "+K.classString(D.concurrency)));N=D.concurrency}else return $.reject(TypeError("options argument must be an object but it is "+K.classString(D)));return N=typeof N==="number"&&isFinite(N)&&N>=1?N:0,new H(W,X,N,L).promise()}$.prototype.map=function(W,X){return V(this,W,X,null)},$.map=function(W,X,D,L){return V(W,X,D,L)}}});var Jz0=O((Lv1,Yz0)=>{var MS=Object.create;if(MS)QD=MS(null),KD=MS(null),QD[" size"]=KD[" size"]=0;var QD,KD;Yz0.exports=function($){var q=n1(),I=q.canEvaluate,U=q.isIdentifier,Y,J,Q=function(W){return Function("ensureMethod",`
return function(obj) {
'use strict'
var len = this.length;
ensureMethod(obj, 'methodName');
switch(len) {
case 1: return obj.methodName(this[0]);
case 2: return obj.methodName(this[0], this[1]);
case 3: return obj.methodName(this[0], this[1], this[2]);
case 0: return obj.methodName();
default:
return obj.methodName.apply(obj, this);
}
};
`.replace(/methodName/g,W))(w)},K=function(W){return Function("obj",`
'use strict';
return obj.propertyName;
`.replace("propertyName",W))},z=function(W,X,D){var L=D[W];if(typeof L!=="function"){if(!U(W))return null;if(L=X(W),D[W]=L,D[" size"]++,D[" size"]>512){var N=Object.keys(D);for(var E=0;E<256;++E)delete D[N[E]];D[" size"]=N.length-256}}return L};Y=function(W){return z(W,Q,QD)},J=function(W){return z(W,K,KD)};function w(W,X){var D;if(W!=null)D=W[X];if(typeof D!=="function"){var L="Object "+q.classString(W)+" has no method '"+q.toString(X)+"'";throw new $.TypeError(L)}return D}function G(W){var X=this.pop(),D=w(W,X);return D.apply(W,this)}$.prototype.call=function(W){var X=arguments.length,D=Array(Math.max(X-1,0));for(var L=1;L<X;++L)D[L-1]=arguments[L];if(I){var N=Y(W);if(N!==null)return this._then(N,void 0,void 0,D,void 0)}return D.push(W),this._then(G,void 0,void 0,D,void 0)};function H(W){return W[this]}function V(W){var X=+this;if(X<0)X=Math.max(0,X+W.length);return W[X]}$.prototype.get=function(W){var X=typeof W==="number",D;if(!X)if(I){var L=J(W);D=L!==null?L:H}else D=H;else D=V;return this._then(D,void 0,void 0,W,void 0)}}});var Kz0=O((Ov1,Qz0)=>{Qz0.exports=function($,q,I,U,Y,J){var Q=n1(),K=h5().TypeError,z=n1().inherits,w=Q.errorObj,G=Q.tryCatch,H={};function V(T){setTimeout(function(){throw T},0)}function W(T){var P=I(T);if(P!==T&&typeof T._isDisposable==="function"&&typeof T._getDisposer==="function"&&T._isDisposable())P._setDisposable(T._getDisposer());return P}function X(T,P){var B=0,k=T.length,h=new $(Y);function f(){if(B>=k)return h._fulfill();var S=W(T[B++]);if(S instanceof $&&S._isDisposable()){try{S=I(S._getDisposer().tryDispose(P),T.promise)}catch(t){return V(t)}if(S instanceof $)return S._then(f,V,null,null,null)}f()}return f(),h}function D(T,P,B){this._data=T,this._promise=P,this._context=B}D.prototype.data=function(){return this._data},D.prototype.promise=function(){return this._promise},D.prototype.resource=function(){if(this.promise().isFulfilled())return this.promise().value();return H},D.prototype.tryDispose=function(T){var P=this.resource(),B=this._context;if(B!==void 0)B._pushContext();var k=P!==H?this.doDispose(P,T):null;if(B!==void 0)B._popContext();return this._promise._unsetDisposable(),this._data=null,k},D.isDisposer=function(T){return T!=null&&typeof T.resource==="function"&&typeof T.tryDispose==="function"};function L(T,P,B){this.constructor$(T,P,B)}z(L,D),L.prototype.doDispose=function(T,P){var B=this.data();return B.call(T,T,P)};function N(T){if(D.isDisposer(T))return this.resources[this.index]._setDisposable(T),T.promise();return T}function E(T){this.length=T,this.promise=null,this[T-1]=null}E.prototype._resultCancelled=function(){var T=this.length;for(var P=0;P<T;++P){var B=this[P];if(B instanceof $)B.cancel()}},$.using=function(){var T=arguments.length;if(T<2)return q("you must pass at least 2 arguments to Promise.using");var P=arguments[T-1];if(typeof P!=="function")return q("expecting a function but got "+Q.classString(P));var B,k=!0;if(T===2&&Array.isArray(arguments[0]))B=arguments[0],T=B.length,k=!1;else B=arguments,T--;var h=new E(T);for(var f=0;f<T;++f){var S=B[f];if(D.isDisposer(S)){var t=S;S=S.promise(),S._setDisposable(t)}else{var p=I(S);if(p instanceof $)S=p._then(N,null,null,{resources:h,index:f},void 0)}h[f]=S}var C=Array(h.length);for(var f=0;f<C.length;++f)C[f]=$.resolve(h[f]).reflect();var n=$.all(C).then(function(J0){for(var g=0;g<J0.length;++g){var u=J0[g];if(u.isRejected())return w.e=u.error(),w;else if(!u.isFulfilled()){n.cancel();return}J0[g]=u.value()}b._pushContext(),P=G(P);var d=k?P.apply(void 0,J0):P(J0),a=b._popContext();return J.checkForgottenReturns(d,a,"Promise.using",b),d}),b=n.lastly(function(){var J0=new $.PromiseInspection(n);return X(h,J0)});return h.promise=b,b._setOnCancel(h),b},$.prototype._setDisposable=function(T){this._bitField=this._bitField|131072,this._disposer=T},$.prototype._isDisposable=function(){return(this._bitField&131072)>0},$.prototype._getDisposer=function(){return this._disposer},$.prototype._unsetDisposable=function(){this._bitField=this._bitField&-131073,this._disposer=void 0},$.prototype.disposer=function(T){if(typeof T==="function")return new L(T,this,U());throw new K}}});var wz0=O((Nv1,zz0)=>{zz0.exports=function($,q,I){var U=n1(),Y=$.TimeoutError;function J(H){this.handle=H}J.prototype._resultCancelled=function(){clearTimeout(this.handle)};var Q=function(H){return K(+this).thenReturn(H)},K=$.delay=function(H,V){var W,X;if(V!==void 0){if(W=$.resolve(V)._then(Q,null,null,H,void 0),I.cancellation()&&V instanceof $)W._setOnCancel(V)}else{if(W=new $(q),X=setTimeout(function(){W._fulfill()},+H),I.cancellation())W._setOnCancel(new J(X));W._captureStackTrace()}return W._setAsyncGuaranteed(),W};$.prototype.delay=function(H){return K(H,this)};var z=function(H,V,W){var X;if(typeof V!=="string")if(V instanceof Error)X=V;else X=new Y("operation timed out");else X=new Y(V);if(U.markAsOriginatingFromRejection(X),H._attachExtraTrace(X),H._reject(X),W!=null)W.cancel()};function w(H){return clearTimeout(this.handle),H}f Line truncated
See http://goo.gl/MqrFmX
`.replace("%s",L)+`From coroutine:
`+this._stack.split(`
`).slice(1,-7).join(`
`)));return}}N=N._target();var E=N._bitField;if((E&50397184)===0)this._yieldedPromise=N,N._proxy(this,null);else if((E&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,N._value());else if((E&16777216)!==0)$._async.invoke(this._promiseRejected,this,N._reason());else this._promiseCancelled()}},$.coroutine=function(X,D){if(typeof X!=="function")throw new K(`generatorFunction must be a function
See http://goo.gl/MqrFmX
`);var L=Object(D).yieldHandler,N=W,E=Error().stack;return function(){var T=X.apply(this,arguments),P=new N(void 0,void 0,L,E),B=P.promise();return P._generator=T,P._promiseFulfilled(void 0),B}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new K("expecting a function but got "+z.classString(X));H.push(X)},$.spawn=function(X){if(J.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return q(`generatorFunction must be a function
See http://goo.gl/MqrFmX
`);var D=new W(X,this),L=D.promise();return D._run($.spawn),L}}});var Wz0=O((Mv1,Vz0)=>{Vz0.exports=function($){var q=n1(),I=$._async,U=q.tryCatch,Y=q.errorObj;function J(z,w){var G=this;if(!q.isArray(z))return Q.call(G,z,w);var H=U(w).apply(G._boundValue(),[null].concat(z));if(H===Y)I.throwLater(H.e)}function Q(z,w){var G=this,H=G._boundValue(),V=z===void 0?U(w).call(H,null):U(w).call(H,null,z);if(V===Y)I.throwLater(V.e)}function K(z,w){var G=this;if(!z){var H=Error(z+"");H.cause=z,z=H}var V=U(w).call(G._boundValue(),z);if(V===Y)I.throwLater(V.e)}$.prototype.asCallback=$.prototype.nodeify=function(z,w){if(typeof z=="function"){var G=Q;if(w!==void 0&&Object(w).spread)G=J;this._then(G,K,void 0,this,z)}return this}}});var Xz0=O((Av1,Zz0)=>{Zz0.exports=function($,q){var I={},U=n1(),Y=FS(),J=U.withAppended,Q=U.maybeWrapAsError,K=U.canEvaluate,z=h5().TypeError,w="Async",G={__isPromisified__:!0},H=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],V=new RegExp("^(?:"+H.join("|")+")$"),W=function(n){return U.isIdentifier(n)&&n.charAt(0)!=="_"&&n!=="constructor"};function X(n){return!V.test(n)}function D(n){try{return n.__isPromisified__===!0}catch(b){return!1}}function L(n,b,J0){var g=U.getDataPropertyOrDefault(n,b+J0,G);return g?D(g):!1}function N(n,b,J0){for(var g=0;g<n.length;g+=2){var u=n[g];if(J0.test(u)){var d=u.replace(J0,"");for(var a=0;a<n.length;a+=2)if(n[a]===d)throw new z(`Cannot promisify an API that has normal methods with '%s'-suffix
See http://goo.gl/MqrFmX
`.replace("%s",b))}}}function E(n,b,J0,g){var u=U.inheritedDataKeys(n),d=[];for(var a=0;a<u.length;++a){var K0=u[a],G0=n[K0],M0=g===W?!0:W(K0,G0,n);if(typeof G0==="function"&&!D(G0)&&!L(n,K0,b)&&g(K0,G0,n,M0))d.push(K0,G0)}return N(d,b,J0),d}var T=function(n){return n.replace(/([$])/,"\\$")},P,B=function(n){var b=[n],J0=Math.max(0,n-1-3);for(var g=n-1;g>=J0;--g)b.push(g);for(var g=n+1;g<=3;++g)b.push(g);return b},k=function(n){return U.filledRange(n,"_arg","")},h=function(n){return U.filledRange(Math.max(n,3),"_arg","")},f=function(n){if(typeof n.length==="number")return Math.max(Math.min(n.length,1024),0);return 0};P=function(n,b,J0,g,u,d){var a=Math.max(0,f(g)-1),K0=B(a),G0=typeof n==="string"||b===I;function M0(O1){var N1=k(O1).join(", "),J1=O1>0?", ":"",C1;if(G0)C1=`ret = callback.call(this, {{args}}, nodeback); break;
`;else C1=b===void 0?`ret = callback({{args}}, nodeback); break;
`:`ret = callback.call(receiver, {{args}}, nodeback); break;
`;return C1.replace("{{args}}",N1).replace(", ",J1)}function v0(){var O1="";for(var N1=0;N1<K0.length;++N1)O1+="case "+K0[N1]+":"+M0(K0[N1]);return O1+=`
default:
var args = new Array(len + 1);
var i = 0;
for (var i = 0; i < len; ++i) {
args[i] = arguments[i];
}
args[i] = nodeback;
[CodeForCall]
break;
`.replace("[CodeForCall]",G0?`ret = callback.apply(this, args);
`:`ret = callback.apply(receiver, args);
`),O1}var R1=typeof n==="string"?"this != null ? this['"+n+"'] : fn":"fn",l0=`'use strict';
var ret = function (Parameters) {
'use strict';
var len = arguments.length;
var promise = new Promise(INTERNAL);
promise._captureStackTrace();
var nodeback = nodebackForPromise(promise, `+d+`);
var ret;
var callback = tryCatch([GetFunctionCode]);
switch(len) {
[CodeForSwitchCase]
}
if (ret === errorObj) {
promise._rejectCallback(maybeWrapAsError(ret.e), true, true);
}
if (!promise._isFateSealed()) promise._setAsyncGuaranteed();
return promise;
};
notEnumerableProp(ret, '__isPromisified__', true);
return ret;
`.replace("[CodeForSwitchCase]",v0()).replace("[GetFunctionCode]",R1);return l0=l0.replace("Parameters",h(a)),Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",l0)($,g,b,J,Q,Y,U.tryCatch,U.errorObj,U.notEnumerableProp,q)};function S(n,b,J0,g,u,d){var a=function(){return this}(),K0=n;if(typeof K0==="string")n=g;function G0(){var M0=b;if(b===I)M0=this;var v0=new $(q);v0._captureStackTrace();var R1=typeof K0==="string"&&this!==a?this[K0]:n,l0=Y(v0,d);try{R1.apply(M0,J(arguments,l0))}catch(O1){v0._rejectCallback(Q(O1),!0,!0)}if(!v0._isFateSealed())v0._setAsyncGuaranteed();return v0}return U.notEnumerableProp(G0,"__isPromisified__",!0),G0}var t=K?P:S;function p(n,b,J0,g,u){var d=new RegExp(T(b)+"$"),a=E(n,b,d,J0);for(var K0=0,G0=a.length;K0<G0;K0+=2){var M0=a[K0],v0=a[K0+1],R1=M0+b;if(g===t)n[R1]=t(M0,I,M0,v0,b,u);else{var l0=g(v0,function(){return t(M0,I,M0,v0,b,u)});U.notEnumerableProp(l0,"__isPromisified__",!0),n[R1]=l0}}return U.toFastProperties(n),n}function C(n,b,J0){return t(n,b,void 0,n,null,J0)}$.promisify=function(n,b){if(typeof n!=="function")throw new z("expecting a function but got "+U.classString(n));if(D(n))return n;b=Object(b);var J0=b.context===void 0?I:b.context,g=!!b.multiArgs,u=C(n,J0,g);return U.copyDescriptors(n,u,X),u},$.promisifyAll=function(n,b){if(typeof n!=="function"&&typeof n!=="object")throw new z(`the target of promisifyAll must be an object or a function
See http://goo.gl/MqrFmX
`);b=Object(b);var J0=!!b.multiArgs,g=b.suffix;if(typeof g!=="string")g=w;var u=b.filter;if(typeof u!=="function")u=W;var d=b.promisifier;if(typeof d!=="function")d=t;if(!U.isIdentifier(g))throw RangeError(`suffix must be a valid identifier
See http://goo.gl/MqrFmX
`);var a=U.inheritedDataKeys(n);for(var K0=0;K0<a.length;++K0){var G0=n[a[K0]];if(a[K0]!=="constructor"&&U.isClass(G0))p(G0.prototype,g,u,d,J0),p(G0,g,u,d,J0)}return p(n,g,u,d,J0)}}});var Lz0=O((Pv1,Dz0)=>{Dz0.exports=function($,q,I,U){var Y=n1(),J=Y.isObject,Q=i3(),K;if(typeof Map==="function")K=Map;var z=function(){var V=0,W=0;function X(D,L){this[V]=D,this[V+W]=L,V++}return function(L){W=L.size,V=0;var N=Array(L.size*2);return L.forEach(X,N),N}}(),w=function(V){var W=new K,X=V.length/2|0;for(var D=0;D<X;++D){var L=V[X+D],N=V[D];W.set(L,N)}return W};function G(V){var W=!1,X;if(K!==void 0&&V instanceof K)X=z(V),W=!0;else{var D=Q.keys(V),L=D.length;X=Array(L*2);for(var N=0;N<L;++N){var E=D[N];X[N]=V[E],X[N+L]=E}}this.constructor$(X),this._isMap=W,this._init$(void 0,-3)}Y.inherits(G,q),G.prototype._init=function(){},G.prototype._promiseFulfilled=function(V,W){this._values[W]=V;var X=++this._totalResolved;if(X>=this._length){var D;if(this._isMap)D=w(this._values);else{D={};var L=this.length();for(var N=0,E=this.length();N<E;++N)D[this._values[N+L]]=this._values[N]}return this._resolve(D),!0}return!1},G.prototype.shouldCopyValues=function(){return!1},G.prototype.getActualLength=function(V){return V>>1};function H(V){var W,X=I(V);if(!J(X))return U(`cannot await properties of a non-object
See http://goo.gl/MqrFmX
`);else if(X instanceof $)W=X._then($.props,void 0,void 0,void 0,void 0);else W=new G(X).promise();if(X instanceof $)W._propagateFrom(X,2);return W}$.prototype.props=function(){return H(this)},$.props=function(V){return H(V)}}});var Nz0=O((Tv1,Oz0)=>{Oz0.exports=function($,q,I,U){var Y=n1(),J=function(K){return K.then(function(z){return Q(z,K)})};function Q(K,z){var w=I(K);if(w instanceof $)return J(w);else if(K=Y.asArray(K),K===null)return U("expecting an array or an iterable object but got "+Y.classString(K));var G=new $(q);if(z!==void 0)G._propagateFrom(z,3);var{_fulfill:H,_reject:V}=G;for(var W=0,X=K.length;W<X;++W){var D=K[W];if(D===void 0&&!(W in K))continue;$.cast(D)._then(H,V,void 0,G,null)}return G}$.race=function(K){return Q(K,void 0)},$.prototype.race=function(){return Q(this,void 0)}}});var Mz0=O((Ev1,Fz0)=>{Fz0.exports=function($,q,I,U,Y,J){var Q=$._getDomain,K=n1(),z=K.tryCatch;function w(X,D,L,N){this.constructor$(X);var E=Q();if(this._fn=E===null?D:K.domainBind(E,D),L!==void 0)L=$.resolve(L),L._attachCancellationCallback(this);if(this._initialValue=L,this._currentCancellable=null,N===Y)this._eachValues=Array(this._length);else if(N===0)this._eachValues=null;else this._eachValues=void 0;this._promise._captureStackTrace(),this._init$(void 0,-5)}K.inherits(w,q),w.prototype._gotAccum=function(X){if(this._eachValues!==void 0&&this._eachValues!==null&&X!==Y)this._eachValues.push(X)},w.prototype._eachComplete=function(X){if(this._eachValues!==null)this._eachValues.push(X);return this._eachValues},w.prototype._init=function(){},w.prototype._resolveEmptyArray=function(){this._resolve(this._eachValues!==void 0?this._eachValues:this._initialValue)},w.prototype.shouldCopyValues=function(){return!1},w.prototype._resolve=function(X){this._promise._resolveCallback(X),this._values=null},w.prototype._resultCancelled=function(X){if(X===this._initialValue)return this._cancel();if(this._isResolved())return;if(this._resultCancelled$(),this._currentCancellable instanceof $)this._currentCancellable.cancel();if(this._initialValue instanceof $)this._initialValue.cancel()},w.prototype._iterate=function(X){this._values=X;var D,L,N=X.length;if(this._initialValue!==void 0)D=this._initialValue,L=0;else D=$.resolve(X[0]),L=1;if(this._currentCancellable=D,!D.isRejected())for(;L<N;++L){var E={accum:null,value:X[L],index:L,length:N,array:this};D=D._then(V,void 0,void 0,E,void 0)}if(this._eachValues!==void 0)D=D._then(this._eachComplete,void 0,void 0,this,void 0);D._then(G,G,void 0,D,this)},$.prototype.reduce=function(X,D){return H(this,X,D,null)},$.reduce=function(X,D,L,N){return H(X,D,L,N)};function G(X,D){if(this.isFulfilled())D._resolve(X);else D._reject(X)}function H(X,D,L,N){if(typeof D!=="function")return I("expecting a function but got "+K.classString(D));var E=new w(X,D,L,N);return E.promise()}function V(X){this.accum=X,this.array._gotAccum(X);var D=U(this.value,this.array._promise);if(D instanceof $)return this.array._currentCancellable=D,D._then(W,void 0,void 0,this,void 0);else return W.call(this,D)}function W(X){var D=this.array,L=D._promise,N=z(D._fn);L._pushContext();var E;if(D._eachValues!==void 0)E=N.call(L._boundValue(),X,this.index,this.length);else E=N.call(L._boundValue(),this.accum,X,this.index,this.length);if(E instanceof $)D._currentCancellable=E;var T=L._popContext();return J.checkForgottenReturns(E,T,D._eachValues!==void 0?"Promise.each":"Promise.reduce",L),E}}});var Pz0=O((gv1,Az0)=>{Az0.exports=function($,q,I){var U=$.PromiseInspection,Y=n1();function J(Q){this.constructor$(Q)}Y.inherits(J,q),J.prototype._promiseResolved=function(Q,K){this._values[Q]=K;var z=++this._totalResolved;if(z>=this._length)return this._resolve(this._values),!0;return!1},J.prototype._promiseFulfilled=function(Q,K){var z=new U;return z._bitField=33554432,z._settledValueField=Q,this._promiseResolved(K,z)},J.prototype._promiseRejected=function(Q,K){var z=new U;return z._bitField=16777216,z._settledValueField=Q,this._promiseResolved(K,z)},$.settle=function(Q){return I.deprecated(".settle()",".reflect()"),new J(Q).promise()},$.prototype.settle=function(){return $.settle(this)}}});var Ez0=O((jv1,Tz0)=>{Tz0.exports=function($,q,I){var U=n1(),Y=h5().RangeError,J=h5().AggregateError,Q=U.isArray,K={};function z(G){this.constructor$(G),this._howMany=0,this._unwrap=!1,this._initialized=!1}U.inherits(z,q),z.prototype._init=function(){if(!this._initialized)return;if(this._howMany===0){this._resolve([]);return}this._init$(void 0,-5);var G=Q(this._values);if(!this._isResolved()&&G&&this._howMany>this._canPossiblyFulfill())this._reject(this._getRangeError(this.length()))},z.prototype.init=function(){this._initialized=!0,this._init()},z.prototype.setUnwrap=function(){this._unwrap=!0},z.prototype.howMany=function(){return this._howMany},z.prototype.setHowMany=function(G){this._howMany=G},z.prototype._promiseFulfilled=function(G){if(this._addFulfilled(G),this._fulfilled()===this.howMany()){if(this._values.length=this.howMany(),this.howMany()= Line truncated
See http://goo.gl/MqrFmX
`);var V=new z(G),W=V.promise();return V.setHowMany(H),V.init(),W}$.some=function(G,H){return w(G,H)},$.prototype.some=function(G){return w(this,G)},$._SomePromiseArray=z}});var jz0=O((Bv1,gz0)=>{gz0.exports=function($,q){var I=$.map;$.prototype.filter=function(U,Y){return I(this,U,Y,q)},$.filter=function(U,Y,J){return I(U,Y,J,q)}}});var Rz0=O((Rv1,Bz0)=>{Bz0.exports=function($,q){var{reduce:I,all:U}=$;function Y(){return U(this)}function J(Q,K){return I(Q,K,q,q)}$.prototype.each=function(Q){return I(this,Q,q,0)._then(Y,void 0,void 0,this,void 0)},$.prototype.mapSeries=function(Q){return I(this,Q,q,q)},$.each=function(Q,K){return I(Q,K,q,0)._then(Y,void 0,void 0,Q,void 0)},$.mapSeries=J}});var Cz0=O((vv1,vz0)=>{vz0.exports=function($){var q=$._SomePromiseArray;function I(U){var Y=new q(U),J=Y.promise();return Y.setHowMany(1),Y.setUnwrap(),Y.init(),J}$.any=function(U){return I(U)},$.prototype.any=function(){return I(this)}}});var _z0=O((Cv1,AS)=>{AS.exports=function(){var $=function(){return new H(`circular promise resolution chain
See http://goo.gl/MqrFmX
`)},q=function(){return new C.PromiseInspection(this._target())},I=function(g){return C.reject(new H(g))};function U(){}var Y={},J=n1(),Q;if(J.isNode)Q=function(){var g=process.domain;if(g===void 0)g=null;return g};else Q=function(){return null};J.notEnumerableProp(C,"_getDomain",Q);var K=i3(),z=EK0(),w=new z;K.defineProperty(C,"_async",{value:w});var G=h5(),H=C.TypeError=G.TypeError;C.RangeError=G.RangeError;var V=C.CancellationError=G.CancellationError;C.TimeoutError=G.TimeoutError,C.OperationalError=G.OperationalError,C.RejectionError=G.OperationalError,C.AggregateError=G.AggregateError;var W=function(){},X={},D={},L=vK0()(C,W),N=_K0()(C,W,L,I,U),E=SK0()(C),T=E.create,P=uK0()(C,E),B=P.CapturedTrace,k=kK0()(C,L),h=nK0()(D),f=FS(),S=J.errorObj,t=J.tryCatch;function p(g,u){if(typeof u!=="function")throw new H("expecting a function but got "+J.classString(u));if(g.constructor!==C)throw new H(`the promise constructor cannot be invoked directly
See http://goo.gl/MqrFmX
`)}function C(g){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,g!==W)p(this,g),this._resolveFromExecutor(g);this._promiseCreated(),this._fireEvent("promiseCreated",this)}C.prototype.toString=function(){return"[object Promise]"},C.prototype.caught=C.prototype.catch=function(g){var u=arguments.length;if(u>1){var d=Array(u-1),a=0,K0;for(K0=0;K0<u-1;++K0){var G0=arguments[K0];if(J.isObject(G0))d[a++]=G0;else return I("expecting an object but got A catch statement predicate "+J.classString(G0))}return d.length=a,g=arguments[K0],this.then(void 0,h(d,g,this))}return this.then(void 0,g)},C.prototype.reflect=function(){return this._then(q,q,void 0,this,void 0)},C.prototype.then=function(g,u){if(P.warnings()&&arguments.length>0&&typeof g!=="function"&&typeof u!=="function"){var d=".then() only accepts functions but was passed: "+J.classString(g);if(arguments.length>1)d+=", "+J.classString(u);this._warn(d)}return this._then(g,u,void 0,void 0,void 0)},C.prototype.done=function(g,u){var d=this._then(g,u,void 0,void 0,void 0);d._setIsFinal()},C.prototype.spread=function(g){if(typeof g!=="function")return I("expecting a function but got "+J.classString(g));return this.all()._then(g,void 0,void 0,X,void 0)},C.prototype.toJSON=function(){var g={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())g.fulfillmentValue=this.value(),g.isFulfilled=!0;else if(this.isRejected())g.rejectionReason=this.reason(),g.isRejected=!0;return g},C.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new N(this).promise()},C.prototype.error=function(g){return this.caught(J.originatesFromRejection,g)},C.getNewLibraryCopy=AS.exports,C.is=function(g){return g instanceof C},C.fromNode=C.fromCallback=function(g){var u=new C(W);u._captureStackTrace();var d=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,a=t(g)(f(u,d));if(a===S)u._rejectCallback(a.e,!0);if(!u._isFateSealed())u._setAsyncGuaranteed();return u},C.all=function(g){return new N(g).promise()},C.cast=function(g){var u=L(g);if(!(u instanceof C))u=new C(W),u._captureStackTrace(),u._setFulfilled(),u._rejectionHandler0=g;return u},C.resolve=C.fulfilled=C.cast,C.reject=C.rejected=function(g){var u=new C(W);return u._captureStackTrace(),u._rejectCallback(g,!0),u},C.setScheduler=function(g){if(typeof g!=="function")throw new H("expecting a function but got "+J.classString(g));return w.setScheduler(g)},C.prototype._then=function(g,u,d,a,K0){var G0=K0!==void 0,M0=G0?K0:new C(W),v0=this._target(),R1=v0._bitField;if(!G0){if(M0._propagateFrom(this,3),M0._captureStackTrace(),a===void 0&&(this._bitField&2097152)!==0)if((R1&50397184)!==0)a=this._boundValue();else a=v0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,M0)}var l0=Q();if((R1&50397184)!==0){var O1,N1,J1=v0._settlePromiseCtx;if((R1&33554432)!==0)N1=v0._rejectionHandler0,O1=g;else if((R1&16777216)!==0)N1=v0._fulfillmentHandler0,O1=u,v0._unsetRejectionIsUnhandled();else J1=v0._settlePromiseLateCancellationObserver,N1=new V("late cancellation observer"),v0._attachExtraTrace(N1),O1=u;w.invoke(J1,v0,{handler:l0===null?O1:typeof O1==="function"&&J.domainBind(l0,O1),promise:M0,receiver:a,value:N1})}else v0._addCallbacks(g,u,M0,a,l0);return M0},C.prototype._length=function(){return this._bitField&65535},C.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},C.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},C.prototype._setLength=function(g){this._bitField=this._bitField&-65536|g&65535},C.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},C.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},C.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},C.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},C.prototype._isFinal=function(){return(this._bitField&4194304)>0},C.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},C.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},C.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},C.prototype._setAsyncGuaranteed=function(){if(w.hasCustomScheduler())return;this._bitField=this._bitField|134217728},C.prototype._receiverAt=function(g){var u=g===0?this._receiver0:this[g*4-4+3];if(u===Y)return;else if(u===void 0&&this._isBound())return this._boundValue();return u},C.prototype._promiseAt=function(g){return this[g*4-4+2]},C.prototype._fulfillmentHandlerAt=function(g){return this[g*4-4+0]},C.prototype._rejectionHandlerAt=function(g){return this[g*4-4+1]},C.prototype._boundValue=function(){},C.prototype._migrateCallback0=function(g){var{_bit Line truncated
path = %s
syscall = %s
fstream_type = %s
fstream_path = %s
fstream_unc_path = %s
fstream_class = %s
fstream_stack =
%s
`,q||"UNKNOWN",U.stack,U.path,U.syscall,U.fstream_type,U.fstream_path,U.fstream_unc_path,U.fstream_class,U.fstream_stack.join(`
`));else I.emit("warn",U)};Q7.prototype.info=function($,q){this.emit("info",$,q)};Q7.prototype.error=function($,q,I){var U=HG0($,q,this);if(I)throw U;else this.emit("error",U)};function HG0($,q,I){if(!($ instanceof Error))$=Error($);if($.code=$.code||q,$.path=$.path||I.path,$.fstream_type=$.fstream_type||I.type,$.fstream_path=$.fstream_path||I.path,I._path!==I.path)$.fstream_unc_path=$.fstream_unc_path||I._path;if(I.linkpath)$.fstream_linkpath=$.fstream_linkpath||I.linkpath;return $.fstream_class=$.fstream_class||I.constructor.name,$.fstream_stack=$.fstream_stack||Error().stack.split(/\n/).slice(3).map(function(U){return U.replace(/^ {4}at /,"")}),$}});var cK=O((KC1,WG0)=>{WG0.exports=FQ1;function FQ1($){var q=["Directory","File","SymbolicLink","Link","BlockDevice","CharacterDevice","FIFO","Socket"],I;if($.type&&q.indexOf($.type)!==-1)return $[$.type]=!0,$.type;for(var U=0,Y=q.length;U<Y;U++){I=q[U];var J=$[I]||$["is"+I];if(typeof J==="function")J=J.call($);if(J)return $[I]=!0,$.type=I,I}return null}});var zy=O((zC1,ZG0)=>{ZG0.exports=dK;var MQ1=o6(),AQ1=n0(),Ky=a3();AQ1(dK,Ky);function dK($){var q=this;if(!(q instanceof dK))throw Error("LinkReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="SymbolicLink"&&$.SymbolicLink))throw Error("Non-link type "+$.type);Ky.call(q,$)}dK.prototype._stat=function($){var q=this;MQ1.readlink(q._path,function(I,U){if(I)return q.error(I);q.linkpath=q.props.linkpath=U,q.emit("linkpath",U),Ky.prototype._stat.call(q,$)})};dK.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Gy=O((wC1,LG0)=>{LG0.exports=b8;var DG0=o6(),PQ1=n0(),lK=o("path"),wy=a3(),XG0=o("assert").ok;PQ1(b8,wy);function b8($){var q=this;if(!(q instanceof b8))throw Error("DirReader must be called as constructor.");if($.type!=="Directory"||!$.Directory)throw Error("Non-directory type "+$.type);if(q.entries=null,q._index=-1,q._paused=!1,q._length=-1,$.sort)this.sort=$.sort;wy.call(this,$)}b8.prototype._getEntries=function(){var $=this;if($._gotEntries)return;$._gotEntries=!0,DG0.readdir($._path,function(q,I){if(q)return $.error(q);if($.entries=I,$.emit("entries",I),$._paused)$.once("resume",U);else U();function U(){if($._length=$.entries.length,typeof $.sort==="function")$.entries=$.entries.sort($.sort.bind($));$._read()}})};b8.prototype._read=function(){var $=this;if(!$.entries)return $._getEntries();if($._paused||$._currentEntry||$._aborted)return;if($._index++,$._index>=$.entries.length){if(!$._ended)$._ended=!0,$.emit("end"),$.emit("close");return}var q=lK.resolve($._path,$.entries[$._index]);XG0(q!==$._path),XG0($.entries[$._index]),$._currentEntry=q,DG0[$.props.follow?"stat":"lstat"](q,function(I,U){if(I)return $.error(I);var Y=$._proxy||$;U.path=q,U.basename=lK.basename(q),U.dirname=lK.dirname(q);var J=$.getChildProps.call(Y,U);J.path=q,J.basename=lK.basename(q),J.dirname=lK.dirname(q);var Q=wy(J,U);$._currentEntry=Q,Q.on("pause",function(w){if(!$._paused&&!Q._disowned)$.pause(w)}),Q.on("resume",function(w){if($._paused&&!Q._disowned)$.resume(w)}),Q.on("stat",function(w){if($.emit("_entryStat",Q,w),Q._aborted)return;if(Q._paused)Q.once("resume",function(){$.emit("entryStat",Q,w)});else $.emit("entryStat",Q,w)}),Q.on("ready",function w(){if($._paused)return Q.pause($),$.once("resume",w);if(Q.type==="Socket")$.emit("socket",Q);else $.emitEntry(Q)});var K=!1;Q.on("close",z),Q.on("disown",z);function z(){if(K)return;if(K=!0,$.emit("childEnd",Q),$.emit("entryEnd",Q),$._currentEntry=null,!$._paused)$._read()}Q.on("error",function(w){if(Q._swallowErrors)$.warn(w),Q.emit("end"),Q.emit("close");else $.emit("error",w)}),["child","childEnd","warn"].forEach(function(w){Q.on(w,$.emit.bind($,w))})})};b8.prototype.disown=function($){if($.emit("beforeDisown"),$._disowned=!0,$.parent=$.root=null,$===this._currentEntry)this._currentEntry=null;$.emit("disown")};b8.prototype.getChildProps=function(){return{depth:this.depth+1,root:this.root||this,parent:this,follow:this.follow,filter:this.filter,sort:this.props.sort,hardlinks:this.props.hardlinks}};b8.prototype.pause=function($){var q=this;if(q._paused)return;if($=$||q,q._paused=!0,q._currentEntry&&q._currentEntry.pause)q._currentEntry.pause($);q.emit("pause",$)};b8.prototype.resume=function($){var q=this;if(!q._paused)return;if($=$||q,q._paused=!1,q.emit("resume",$),q._paused)return;if(q._currentEntry){if(q._currentEntry.resume)q._currentEntry.resume($)}else q._read()};b8.prototype.emitEntry=function($){this.emit("entry",$),this.emit("child",$)}});var Hy=O((GC1,MG0)=>{MG0.exports=s3;var TQ1=o6(),EQ1=n0(),OG0=a3(),NG0={EOF:!0},FG0={CLOSE:!0};EQ1(s3,OG0);function s3($){var q=this;if(!(q instanceof s3))throw Error("FileReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="File"&&$.File))throw Error("Non-file type "+$.type);q._buffer=[],q._bytesEmitted=0,OG0.call(q,$)}s3.prototype._getStream=function(){var $=this,q=$._stream=TQ1.createReadStream($._path,$.pro Line truncated
expect: `+$.props.size+`
actual: `+$._bytesEmitted)}),q.on("close",function(){if($._paused||$._buffer.length)$._buffer.push(FG0),$._read();else $.emit("close")}),q.on("error",function(I){$.emit("error",I)}),$._read()};s3.prototype._read=function(){var $=this;if($._paused)return;if(!$._stream)return $._getStream();if($._buffer.length){var q=$._buffer;for(var I=0,U=q.length;I<U;I++){var Y=q[I];if(Y===NG0)$.emit("end");else if(Y===FG0)$.emit("close");else $.emit("data",Y);if($._paused){$._buffer=q.slice(I);return}}$._buffer.length=0}};s3.prototype.pause=function($){var q=this;if(q._paused)return;if($=$||q,q._paused=!0,q._stream)q._stream.pause();q.emit("pause",$)};s3.prototype.resume=function($){var q=this;if(!q._paused)return;if($=$||q,q.emit("resume",$),q._paused=!1,q._stream)q._stream.resume();q._read()}});var TG0=O((HC1,PG0)=>{PG0.exports=hD;var gQ1=n0(),AG0=a3();gQ1(hD,AG0);function hD($){var q=this;if(!(q instanceof hD))throw Error("SocketReader must be called as constructor.");if(!($.type==="Socket"&&$.Socket))throw Error("Non-socket type "+$.type);AG0.call(q,$)}hD.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Wy=O((VC1,EG0)=>{EG0.exports=e3;var Vy=a3(),jQ1=cK(),BQ1=n0(),RQ1=o6();BQ1(e3,Vy);function e3($){var q=this;if(!(q instanceof e3))throw Error("ProxyReader must be called as constructor.");q.props=$,q._buffer=[],q.ready=!1,Vy.call(q,$)}e3.prototype._stat=function(){var $=this,q=$.props,I=q.follow?"stat":"lstat";RQ1[I](q.path,function(U,Y){var J;if(U||!Y)J="File";else J=jQ1(Y);q[J]=!0,q.type=$.type=J,$._old=Y,$._addProxy(Vy(q,Y))})};e3.prototype._addProxy=function($){var q=this;if(q._proxyTarget)return q.error("proxy already set");q._proxyTarget=$,$._proxy=q,["error","data","end","close","linkpath","entry","entryEnd","child","childEnd","warn","stat"].forEach(function(U){$.on(U,q.emit.bind(q,U))}),q.emit("proxy",$),$.on("ready",function(){q.ready=!0,q.emit("ready")});var I=q._buffer;q._buffer.length=0,I.forEach(function(U){$[U[0]].apply($,U[1])})};e3.prototype.pause=function(){return this._proxyTarget?this._proxyTarget.pause():!1};e3.prototype.resume=function(){return this._proxyTarget?this._proxyTarget.resume():!1}});var a3=O((WC1,BG0)=>{BG0.exports=I8;var vQ1=o6(),CQ1=o("stream").Stream,_Q1=n0(),Zy=o("path"),Xy=cK(),SD=I8.hardLinks={},gG0=_D();_Q1(I8,gG0);var jG0=zy();function I8($,q){var I=this;if(!(I instanceof I8))return new I8($,q);if(typeof $==="string")$={path:$};var U,Y;if($.type&&typeof $.type==="function")U=$.type,Y=U;else U=Xy($),Y=I8;if(q&&!U)U=Xy(q),$[U]=!0,$.type=U;switch(U){case"Directory":Y=Gy();break;case"Link":case"File":Y=Hy();break;case"SymbolicLink":Y=jG0;break;case"Socket":Y=TG0();break;case null:Y=Wy();break}if(!(I instanceof Y))return new Y($);if(gG0.call(I),!$.path)I.error("Must provide a path",null,!0);if(I.readable=!0,I.writable=!1,I.type=U,I.props=$,I.depth=$.depth=$.depth||0,I.parent=$.parent||null,I.root=$.root||$.parent&&$.parent.root||I,I._path=I.path=Zy.resolve($.path),process.platform==="win32"){if(I.path=I._path=I.path.replace(/\?/g,"_"),I._path.length>=260)I._swallowErrors=!0,I._path="\\\\?\\"+I.path.replace(/\//g,"\\")}if(I.basename=$.basename=Zy.basename(I.path),I.dirname=$.dirname=Zy.dirname(I.path),$.parent=$.root=null,I.size=$.size,I.filter=typeof $.filter==="function"?$.filter:null,$.sort==="alpha")$.sort=hQ1;I._stat(q)}function hQ1($,q){return $===q?0:$.toLowerCase()>q.toLowerCase()?1:$.toLowerCase()<q.toLowerCase()?-1:$>q?1:-1}I8.prototype._stat=function($){var q=this,I=q.props,U=I.follow?"stat":"lstat";if($)process.nextTick(Y.bind(null,null,$));else vQ1[U](q._path,Y);function Y(J,Q){if(J)return q.error(J);if(Object.keys(Q).forEach(function(W){I[W]=Q[W]}),q.size!==void 0&&I.size!==q.size)return q.error("incorrect size");q.size=I.size;var K=Xy(I),z=I.hardlinks!==!1;if(z&&K!=="Directory"&&I.nlink&&I.nlink>1){var w=I.dev+":"+I.ino;if(SD[w]===q._path||!SD[w])SD[w]=q._path;else K=q.type=q.props.type="Link",q.Link=q.props.Link=!0,q.linkpath=q.props.linkpath=SD[w],q._stat=q._read=jG0.prototype._read}if(q.type&&q.type!==K)q.error("Unexpected type: "+K);if(q.filter){var G=q._proxy||q;if(!q.filter.call(G,G,I)){if(!q._disowned)q.abort(),q.emit("end"),q.emit("close");return}}var H=["_stat","stat","ready"],V=0;(function W(){if(q._aborted){q.emit("end"),q.emit("close");return}if(q._paused&&q.type!=="Directory"){q.once("resume",W);return}var X=H[V++];if(!X)return q._read();q.emit(X,I),W()})()}};I8.prototype.pipe=function($){var q=this;if(typeof $.add==="function")q.on("entry",function(I){var U=$.add(I);if(U===!1)q.pause()});return CQ1.prototype.pipe.apply(this,arguments)};I8.prototype.pause=function($){if(this._paused=!0,$=$||this,this.emit("pause",$),this._stream)this._stream.pause($)};I8.prototype.resume=function($){if(this._paused=!1,$=$||this,this.emit("resume",$),this._stream)this._stream.resume($);this._read()};I8.prototype._read=function(){this.error("Cannot read unknown type: "+this.type)}});var Ny=O((ZC1,uG0)=>{u Line truncated
expect: `+$.size+`
actual: `+$._bytesWritten);dD.prototype._finish.call($)}});var vy=O((_C1,EH0)=>{EH0.exports=H7;var Ry=XY(),Q21=cK(),K21=n0(),z21=pD(),w21=o("fs");K21(H7,Ry);function H7($){var q=this;if(!(q instanceof H7))throw Error("ProxyWriter must be called as constructor.");q.props=$,q._needDrain=!1,Ry.call(q,$)}H7.prototype._stat=function(){var $=this,q=$.props,I=q.follow?"stat":"lstat";w21[I](q.path,function(U,Y){var J;if(U||!Y)J="File";else J=Q21(Y);q[J]=!0,q.type=$.type=J,$._old=Y,$._addProxy(Ry(q,Y))})};H7.prototype._addProxy=function($){var q=this;if(q._proxy)return q.error("proxy already set");q._proxy=$,["ready","error","close","pipe","drain","warn"].forEach(function(U){$.on(U,q.emit.bind(q,U))}),q.emit("proxy",$);var I=q._buffer;if(I.forEach(function(U){$[U[0]].apply($,U[1])}),q._buffer.length=0,q._needsDrain)q.emit("drain")};H7.prototype.add=function($){if(z21($),!this._proxy)return this._buffer.push(["add",[$]]),this._needDrain=!0,!1;return this._proxy.add($)};H7.prototype.write=function($){if(!this._proxy)return this._buffer.push(["write",[$]]),this._needDrain=!0,!1;return this._proxy.write($)};H7.prototype.end=function($){if(!this._proxy)return this._buffer.push(["end",[$]]),!1;return this._proxy.end($)}});var XY=O((hC1,SH0)=>{SH0.exports=h$;var _$=o6(),G21=n0(),H21=Ny(),V21=Ty(),tK=o("path"),jH0=process.platform==="win32"?0:process.umask(),BH0=cK(),RH0=_D();G21(h$,RH0);h$.dirmode=parseInt("0777",8)&~jH0;h$.filemode=parseInt("0666",8)&~jH0;var W21=gy(),Z21=jy(),X21=By(),D21=vy();function h$($,q){var I=this;if(typeof $==="string")$={path:$};var U=BH0($),Y=h$;switch(U){case"Directory":Y=W21;break;case"File":Y=X21;break;case"Link":case"SymbolicLink":Y=Z21;break;case null:default:Y=D21;break}if(!(I instanceof Y))return new Y($);if(RH0.call(I),!$.path)I.error("Must provide a path",null,!0);if(I.type=$.type,I.props=$,I.depth=$.depth||0,I.clobber=$.clobber===!1?$.clobber:!0,I.parent=$.parent||null,I.root=$.root||$.parent&&$.parent.root||I,I._path=I.path=tK.resolve($.path),process.platform==="win32"){if(I.path=I._path=I.path.replace(/\?/g,"_"),I._path.length>=260)I._swallowErrors=!0,I._path="\\\\?\\"+I.path.replace(/\//g,"\\")}if(I.basename=tK.basename($.path),I.dirname=tK.dirname($.path),I.linkpath=$.linkpath||null,$.parent=$.root=null,I.size=$.size,typeof $.mode==="string")$.mode=parseInt($.mode,8);I.readable=!1,I.writable=!0,I._buffer=[],I.ready=!1,I.filter=typeof $.filter==="function"?$.filter:null,I._stat(q)}h$.prototype._create=function(){var $=this;_$[$.props.follow?"stat":"lstat"]($._path,function(q){if(q)return $.warn("Cannot create "+$._path+`
Unsupported type: `+$.type,"ENOTSUP");$._finish()})};h$.prototype._stat=function($){var q=this,I=q.props,U=I.follow?"stat":"lstat",Y=q._proxy||q;if($)J(null,$);else _$[U](q._path,J);function J(Q,K){if(q.filter&&!q.filter.call(Y,Y,K)){q._aborted=!0,q.emit("end"),q.emit("close");return}if(Q||!K)return Cy(q);q._old=K;var z=BH0(K);if(z!==q.type||q.type==="File"&&K.nlink>1)return H21(q._path,function(w){if(w)return q.error(w);q._old=null,Cy(q)});Cy(q)}};function Cy($){V21(tK.dirname($._path),h$.dirmode,function(q,I){if(q)return $.error(q);return $._madeDir=I,$._create()})}function vH0($,q,I,U,Y){var J=q.mode,Q=q.follow||$.type!=="SymbolicLink"?"chmod":"lchmod";if(!_$[Q])return Y();if(typeof J!=="number")return Y();var K=I.mode&parseInt("0777",8);if(J=J&parseInt("0777",8),J===K)return Y();_$[Q](U,J,Y)}function CH0($,q,I,U,Y){if(process.platform==="win32")return Y();if(!process.getuid||process.getuid()!==0)return Y();if(typeof q.uid!=="number"&&typeof q.gid!=="number")return Y();if(I.uid===q.uid&&I.gid===q.gid)return Y();var J=$.props.follow||$.type!=="SymbolicLink"?"chown":"lchown";if(!_$[J])return Y();if(typeof q.uid!=="number")q.uid=I.uid;if(typeof q.gid!=="number")q.gid=I.gid;_$[J](U,q.uid,q.gid,Y)}function _H0($,q,I,U,Y){if(!_$.utimes||process.platform==="win32")return Y();var J=q.follow||$.type!=="SymbolicLink"?"utimes":"lutimes";if(J==="lutimes"&&!_$[J])J="utimes";if(!_$[J])return Y();var{atime:Q,mtime:K}=I,z=q.atime,w=q.mtime;if(z===void 0)z=Q;if(w===void 0)w=K;if(!gH0(z))z=new Date(z);if(!gH0(w))z=new Date(w);if(z.getTime()===Q.getTime()&&w.getTime()===K.getTime())return Y();_$[J](U,z,w,Y)}h$.prototype._finish=function(){var $=this;if($._finishing)return;$._finishing=!0;var q=0,I=null,U=!1;if($._old)$._old.atime=new Date(0),$._old.mtime=new Date(0),J($._old);else{var Y=$.props.follow?"stat":"lstat";_$[Y]($._path,function(K,z){if(K)if(K.code==="ENOENT"&&($.type==="Link"||$.type==="SymbolicLink")&&process.platform==="win32"){$.ready=!0,$.emit("ready"),$.emit("end"),$.emit("close"),$.end=$._finish=function(){};return}else return $.error(K);J($._old=z)})}return;function J(K){q+=3,vH0($,$.props,K,$._path,Q("chmod")),CH0($,$.props,K,$._path,Q("chown")),_H0($,$.props,K,$._path,Q("utimes"))}function Q(K){return function(z){if(I)return;if(z)return z.fstream_finish_call=K,$.error(I=z);if(--q>0)return;if(U)return;if(U=!0,!$._madeDir)return w();else hH0($,$._path,w);function w(G){if(G)return G.fstream_finish_call="setupMadeDir",$.error(G);$.emit("end"),$.emit("close")}}}};function hH0($,q,I){var U=$._madeDir,Y=tK.dirname(q);L21($,Y,function(J){if(J)return I(J);if(Y===U)return I();hH0($,Y,I)})}function L21($,q,I){var U={};Object.keys($.props).forEach(function(K){if(U[K]=$.props[K],K==="mode"&&$.type!=="Directory")U[K]=U[K]|parseInt("0111",8)});var Y=3,J=null;_$.stat(q,function(K,z){if(K)return I(J=K);vH0($,U,z,q,Q),CH0($,U,z,q,Q),_H0($,U,z,q,Q)});function Q(K){if(J)return;if(K)return I(J=K);if(--Y===0)return I()}}h$.prototype.pipe=function(){this.error("Can't pipe from writable stream")};h$.prototype.add=function(){this.error("Can't add to non-Directory type")};h$.prototype.write=function(){return!0};function O21($){return Object.prototype.toString.call($)}function gH0($){return typeof $==="object"&&O21($)==="[object Date]"}});var uy=O((N21)=>{N21.Abstract=_D();N21.Reader=a3();N21.Writer=XY();N21.File={Reader:Hy(),Writer:By()};N21.Dir={Reader:Gy(),Writer:gy()};N21.Link={Reader:zy(),Writer:jy()};N21.Proxy={Reader:Wy(),Writer:vy()};N21.Reader.Dir=N21.DirReader=N21.Dir.Reader;N21.Reader.File=N21.FileReader=N21.File.Reader;N21.Reader.Link=N21.LinkReader=N21.Link.Reader;N21.Reader.Proxy=N21.ProxyReader=N21.Proxy.Reader;N21.Writer.Dir=N21.DirWriter=N21.Dir.Writer;N21.Writer.File=N21.FileWriter=N21.File.Writer;N21.Writer.Link=N21.LinkWriter=N21.Link.Writer;N21.Writer.Proxy=N21.ProxyWriter=N21.Proxy.Writer;N21.collect=pD()});var uH0=O((pC1,yH0)=>{yH0.exports=j21;var A21=PD(),P21=uy().Writer,xy=o("path"),T21=o("stream"),E21=Jy(),g21=Y7();function j21($){$.path=xy.resolve(xy.normalize($.path));var q=new A21($),I=new T21.Writable({objectMode:!0});I._write=function(Y,J,Q){if(Y.type=="Directory")return Q();var K=xy.join($.path,Y.path);if(K.indexOf($.path)!=0)return Q();let z=$.getWriter?$.getWriter({path:K}):P21({path:K});Y.pipe(z).on("error",Q).on("close",Q)};var U=E21(q,I);return q.once("crx-header",function(Y){U.crxHeader=Y}),q.pipe(I).on("finish",function(){U.emit("close")}),U.promise=function(){return new g21(function(Y,J){U.on("close",Y),U.on("error",J)})},U}});var xH0=O((cC1,lD)=>{var u4=function($){var q=1e7,I=7,U=9007199254740992,Y=V(U),J="0123456789abcdefghijklmnopqrstuvwxyz",Q=typeof BigInt==="function";function K(F,M,R,y){if(typeof F>"u")return K[0];if(typeof M<"u")return+M===10&&!R?P0(F):y$(F,M,R,y);return P0(F)}function z(F,M){this.value=F,this.sign=M,this.isSmall=!1}z.prototype=Object.create(K.prototype);function w(F){this.value=F,this.sign=F<0,this.isSmall=!0}w.prototype=Object.create(K.prototype);function G(F){th Line truncated
* Tmp
*
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
*
* MIT Licensed
*/var u1=o("fs"),sD=o("os"),x4=o("path"),tH0=o("crypto"),i8={fs:u1.constants,os:sD.constants},$V0=/XXXXXX/,qV0=(i8.O_CREAT||i8.fs.O_CREAT)|(i8.O_EXCL||i8.fs.O_EXCL)|(i8.O_RDWR||i8.fs.O_RDWR),a21=sD.platform()==="win32",s21=i8.EBADF||i8.os.errno.EBADF,e21=i8.ENOENT||i8.os.errno.ENOENT,LY=[],IV0=u1.rmdirSync.bind(u1),UV0=!1;function $K1($,q){return u1.rm($,{recursive:!0},q)}function YV0($){return u1.rmSync($,{recursive:!0})}function iy($,q){let I=OY($,q),U=I[0],Y=I[1];GK1(U,function(J,Q){if(J)return Y(J);let K=Q.tries;(function z(){try{let w=QV0(Q);u1.stat(w,function(G){if(!G){if(K-- >0)return z();return Y(Error("Could not get a unique tmp filename, max tries reached "+w))}Y(null,w)})}catch(w){Y(w)}})()})}function py($){let q=OY($),I=q[0],U=HK1(I),Y=U.tries;do{let J=QV0(U);try{u1.statSync(J)}catch(Q){return J}}while(Y-- >0);throw Error("Could not get a unique tmp filename, max tries reached")}function qK1($,q){let I=OY($,q),U=I[0],Y=I[1];iy(U,function(Q,K){if(Q)return Y(Q);u1.open(K,qV0,U.mode||384,function(w,G){if(w)return Y(w);if(U.discardDescriptor)return u1.close(G,function(V){return Y(V,K,void 0,ny(K,-1,U,!1))});else{let H=U.discardDescriptor||U.detachDescriptor;Y(null,K,G,ny(K,H?-1:G,U,!1))}})})}function IK1($){let q=OY($),I=q[0],U=I.discardDescriptor||I.detachDescriptor,Y=py(I),J=u1.openSync(Y,qV0,I.mode||384);if(I.discardDescriptor)u1.closeSync(J),J=void 0;return{name:Y,fd:J,removeCallback:ny(Y,U?-1:J,I,!0)}}function UK1($,q){let I=OY($,q),U=I[0],Y=I[1];iy(U,function(Q,K){if(Q)return Y(Q);u1.mkdir(K,U.mode||448,function(w){if(w)return Y(w);Y(null,K,JV0(K,U,!1))})})}function YK1($){let q=OY($),I=q[0],U=py(I);return u1.mkdirSync(U,I.mode||448),{name:U,removeCallback:JV0(U,I,!0)}}function JK1($,q){let I=function(U){if(U&&!by(U))return q(U);q()};if(0<=$[0])u1.close($[0],function(){u1.unlink($[1],I)});else u1.unlink($[1],I)}function QK1($){let q=null;try{if(0<=$[0])u1.closeSync($[0])}catch(I){if(!VK1(I)&&!by(I))throw I}finally{try{u1.unlinkSync($[1])}catch(I){if(!by(I))q=I}}if(q!==null)throw q}function ny($,q,I,U){let Y=aD(QK1,[q,$],U),J=aD(JK1,[q,$],U,Y);if(!I.keep)LY.unshift(Y);return U?Y:J}function JV0($,q,I){let U=q.unsafeCleanup?$K1:u1.rmdir.bind(u1),Y=q.unsafeCleanup?YV0:IV0,J=aD(Y,$,I),Q=aD(U,$,I,J);if(!q.keep)LY.unshift(J);return I?J:Q}function aD($,q,I,U){let Y=!1;return function J(Q){if(!Y){let K=U||J,z=LY.indexOf(K);if(z>=0)LY.splice(z,1);if(Y=!0,I||$===IV0||$===YV0)return $(q);else return $(q,Q||function(){})}}}function KK1(){if(!UV0)return;while(LY.length)try{LY[0]()}catch($){}}function aH0($){let q=[],I=null;try{I=tH0.randomBytes($)}catch(U){I=tH0.pseudoRandomBytes($)}for(let U=0;U<$;U++)q.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[I[U]%62]);return q.join("")}function t6($){return typeof $>"u"}function OY($,q){if(typeof $==="function")return[{},$];if(t6($))return[{},q];let I={};for(let U of Object.getOwnPropertyNames($))I[U]=$[U];return[I,q]}function zK1($,q,I){let U=x4.isAbsolute($)?$:x4.join(q,$);u1.stat(U,function(Y){if(Y)u1.realpath(x4.dirname(U),function(J,Q){if(J)return I(J);I(null,x4.join(Q,x4.basename(U)))});else u1.realpath(U,I)})}function wK1($,q){let I=x4.isAbsolute($)?$:x4.join(q,$);try{return u1.statSync(I),u1.realpathSync(I)}catch(U){let Y=u1.realpathSync(x4.dirname(I));return x4.join(Y,x4.basename(I))}}function QV0($){let q=$.tmpdir;if(!t6($.name))return x4.join(q,$.dir,$.name);if(!t6($.template))return x4.join(q,$.dir,$.template).replace($V0,aH0(6));let I=[$.prefix?$.prefix:"tmp","-",process.pid,"-",aH0(12),$.postfix?"-"+$.postfix:""].join("");return x4.join(q,$.dir,I)}function fy($,q){if(typeof q!=="string")throw Error(`${$} option must be a string, got "${typeof q}".`);if(q.includes(".."))throw Error("Relative value not allowed");return q}function KV0($){if(!t6($.name)){let q=$.name;if(x4.isAbsolute(q))throw Error(`name option must not contain an absolute path, found "${q}".`);let I=x4.basename(q);if(I===".."||I==="."||I!==q)throw Error(`name option must not contain a path, found "${q}".`)}if(!t6($.template)){if(typeof $.template!=="string")throw Error(`template option must be a string, got "${typeof $.template}".`);if(!$.template.match($V0))throw Error(`Invalid template, found "${$.template}".`)}if(!t6($.tries)&&isNaN($.tries)||$.tries<0)throw Error(`Invalid tries, found "${$.tries}".`);$.tries=t6($.name)?$.tries||3:1,$.keep=!!$.keep,$.detachDescriptor=!!$.detachDescriptor,$.discardDescriptor=!!$.discardDescriptor,$.unsafeCleanup=!!$.unsafeCleanup,$.prefix=t6($.prefix)?"":fy("prefix",$.prefix),$.postfix=t6($.postfix)?"":fy("postfix",$.postfix),$.template=t6($.template)?void 0:fy("template",$.template)}function sH0($,q,I,U){if(t6(q))return U(null);zK1(q,I,function(Y,J){if(Y)return U(Y);let Q=x4.relative(I,J);if(Q.startsWith("..")||x4.isAbsolute(Q))return U(Error(`${$} option must be relative to "${I}", found "${Q}".`));U(null,Q)})}function eH0($,q,I){if(t6(q))return;let U=wK1(q,I),Y=x4.relative(I,U);if(Y.startsWith("..")||x4.isAbsolute(Y))throw ELine truncated
`)}var Wq=($)=>(q,I,U,Y)=>{let J=U?{...U,async:!1}:{async:!1},Q=q._zod.run({value:I,issues:[]},J);if(Q instanceof Promise)throw new Y8;if(Q.issues.length){let K=new(Y?.Err??$)(Q.issues.map((z)=>P6(z,J,W4())));throw cz(K,Y?.callee),K}return Q.value},pY=Wq(u6),Zq=($)=>async(q,I,U,Y)=>{let J=U?{...U,async:!0}:{async:!0},Q=q._zod.run({value:I,issues:[]},J);if(Q instanceof Promise)Q=await Q;if(Q.issues.length){let K=new(Y?.Err??$)(Q.issues.map((z)=>P6(z,J,W4())));throw cz(K,Y?.callee),K}return Q.value},cY=Zq(u6),Xq=($)=>(q,I,U)=>{let Y=U?{...U,async:!1}:{async:!1},J=q._zod.run({value:I,issues:[]},Y);if(J instanceof Promise)throw new Y8;return J.issues.length?{success:!1,error:new($??nY)(J.issues.map((Q)=>P6(Q,Y,W4())))}:{success:!0,data:J.value}},Dq=Xq(u6),Lq=($)=>async(q,I,U)=>{let Y=U?{...U,async:!0}:{async:!0},J=q._zod.run({value:I,issues:[]},Y);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new $(J.issues.map((Q)=>P6(Q,Y,W4())))}:{success:!0,data:J.value}},dY=Lq(u6),dz=($)=>(q,I,U)=>{let Y=U?{...U,direction:"backward"}:{direction:"backward"};return Wq($)(q,I,Y)},Mx=dz(u6),lz=($)=>(q,I,U)=>{return Wq($)(q,I,U)},Ax=lz(u6),mz=($)=>async(q,I,U)=>{let Y=U?{...U,direction:"backward"}:{direction:"backward"};return Zq($)(q,I,Y)},Px=mz(u6),oz=($)=>async(q,I,U)=>{return Zq($)(q,I,U)},Tx=oz(u6),rz=($)=>(q,I,U)=>{let Y=U?{...U,direction:"backward"}:{direction:"backward"};return Xq($)(q,I,Y)},Ex=rz(u6),tz=($)=>(q,I,U)=>{return Xq($)(q,I,U)},gx=tz(u6),az=($)=>async(q,I,U)=>{let Y=U?{...U,direction:"backward"}:{direction:"backward"};return Lq($)(q,I,Y)},jx=az(u6),sz=($)=>async(q,I,U)=>{return Lq($)(q,I,U)},Bx=sz(u6);var $$={};l8($$,{xid:()=>sL,uuid7:()=>iD0,uuid6:()=>bD0,uuid4:()=>nD0,uuid:()=>A7,uppercase:()=>PO,unicodeEmail:()=>Rx,undefined:()=>MO,ulid:()=>aL,time:()=>ZO,string:()=>DO,sha512_hex:()=>wL0,sha512_base64url:()=>HL0,sha512_base64:()=>GL0,sha384_hex:()=>QL0,sha384_base64url:()=>zL0,sha384_base64:()=>KL0,sha256_hex:()=>UL0,sha256_base64url:()=>JL0,sha256_base64:()=>YL0,sha1_hex:()=>$L0,sha1_base64url:()=>IL0,sha1_base64:()=>qL0,rfc5322Email:()=>cD0,number:()=>lY,null:()=>FO,nanoid:()=>$O,md5_hex:()=>aD0,md5_base64url:()=>eD0,md5_base64:()=>sD0,mac:()=>KO,lowercase:()=>AO,ksuid:()=>eL,ipv6:()=>QO,ipv4:()=>JO,integer:()=>OO,idnEmail:()=>dD0,httpProtocol:()=>HO,html5Email:()=>pD0,hostname:()=>oD0,hex:()=>tD0,guid:()=>IO,extendedDuration:()=>fD0,emoji:()=>YO,email:()=>UO,e164:()=>VO,duration:()=>qO,domain:()=>rD0,datetime:()=>XO,date:()=>WO,cuid2:()=>tL,cuid:()=>rL,cidrv6:()=>wO,cidrv4:()=>zO,browserEmail:()=>lD0,boolean:()=>NO,bigint:()=>LO,base64url:()=>ez,base64:()=>GO});var rL=/^[cC][0-9a-z]{6,}$/,tL=/^[0-9a-z]+$/,aL=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,sL=/^[0-9a-vA-V]{20}$/,eL=/^[A-Za-z0-9]{27}$/,$O=/^[a-zA-Z0-9_-]{21}$/,qO=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fD0=/^[-+]?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)?)??$/,IO=/^([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})$/,A7=($)=>{if(!$)return/^([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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},nD0=A7(4),bD0=A7(6),iD0=A7(7),UO=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,pD0=/^[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])?)*$/,cD0=/^(([^<>()\[\]\\.,;:\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,}))$/,Rx=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,dD0=Rx,lD0=/^[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])?)*$/,mD0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function YO(){return new RegExp(mD0,"u")}var JO=/^(?:(?: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])$/,QO=/^(([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}|:))$/,KO=($)=>{let q=X$($??":");return new RegExp(`^(?:[0-9A-F]{2}${q}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${q}){5}[0-9a-f]{2}$`)},zO=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0Line truncated
`).filter((J)=>J),U=Math.min(...I.map((J)=>J.length-J.trimStart().length)),Y=I.map((J)=>J.slice(U)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Y)this.content.push(J)}compile(){let $=Function,q=this?.args,U=[...(this?.content??[""]).map((Y)=>` ${Y}`)];return new $(...q,U.join(`
`))}}var iO={major:4,minor:4,patch:3};var k0=m("$ZodType",($,q)=>{var I;$??($={}),$._zod.def=q,$._zod.bag=$._zod.bag||{},$._zod.version=iO;let U=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))U.unshift($);for(let Y of U)for(let J of Y._zod.onattach)J($);if(U.length===0)(I=$._zod).deferred??(I.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let Y=(Q,K,z)=>{let w=r5(Q),G;for(let H of K){if(H._zod.def.when){if(lL(Q))continue;if(!H._zod.def.when(Q))continue}else if(w)continue;let V=Q.issues.length,W=H._zod.check(Q);if(W instanceof Promise&&z?.async===!1)throw new Y8;if(G||W instanceof Promise)G=(G??Promise.resolve()).then(async()=>{if(await W,Q.issues.length===V)return;if(!w)w=r5(Q,V)});else{if(Q.issues.length===V)continue;if(!w)w=r5(Q,V)}}if(G)return G.then(()=>{return Q});return Q},J=(Q,K,z)=>{if(r5(Q))return Q.aborted=!0,Q;let w=Y(K,U,z);if(w instanceof Promise){if(z.async===!1)throw new Y8;return w.then((G)=>$._zod.parse(G,z))}return $._zod.parse(w,z)};$._zod.run=(Q,K)=>{if(K.skipChecks)return $._zod.parse(Q,K);if(K.direction==="backward"){let w=$._zod.parse({value:Q.value,issues:[]},{...K,skipChecks:!0});if(w instanceof Promise)return w.then((G)=>{return J(G,Q,K)});return J(w,Q,K)}let z=$._zod.parse(Q,K);if(z instanceof Promise){if(K.async===!1)throw new Y8;return z.then((w)=>Y(w,U,K))}return Y(z,U,K)}}o0($,"~standard",()=>({validate:(Y)=>{try{let J=Dq($,Y);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return dY($,Y).then((Q)=>Q.success?{value:Q.data}:{issues:Q.error?.issues})}},vendor:"zod",version:1}))}),P7=m("$ZodString",($,q)=>{k0.init($,q),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??DO($._zod.bag),$._zod.parse=(I,U)=>{if(q.coerce)try{I.value=String(I.value)}catch(Y){}if(typeof I.value==="string")return I;return I.issues.push({expected:"string",code:"invalid_type",input:I.value,inst:$}),I}}),_1=m("$ZodStringFormat",($,q)=>{Oq.init($,q),P7.init($,q)}),cO=m("$ZodGUID",($,q)=>{q.pattern??(q.pattern=IO),_1.init($,q)}),dO=m("$ZodUUID",($,q)=>{if(q.version){let U={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[q.version];if(U===void 0)throw Error(`Invalid UUID version: "${q.version}"`);q.pattern??(q.pattern=A7(U))}else q.pattern??(q.pattern=A7());_1.init($,q)}),lO=m("$ZodEmail",($,q)=>{q.pattern??(q.pattern=UO),_1.init($,q)}),mO=m("$ZodURL",($,q)=>{_1.init($,q),$._zod.check=(I)=>{try{let U=I.value.trim();if(!q.normalize&&q.protocol?.source===HO.source){if(!/^https?:\/\//i.test(U)){I.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:I.value,inst:$,continue:!q.abort});return}}let Y=new URL(U);if(q.hostname){if(q.hostname.lastIndex=0,!q.hostname.test(Y.hostname))I.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:q.hostname.source,input:I.value,inst:$,continue:!q.abort})}if(q.protocol){if(q.protocol.lastIndex=0,!q.protocol.test(Y.protocol.endsWith(":")?Y.protocol.slice(0,-1):Y.protocol))I.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:q.protocol.source,input:I.value,inst:$,continue:!q.abort})}if(q.normalize)I.value=Y.href;else I.value=U;return}catch(U){I.issues.push({code:"invalid_format",format:"url",input:I.value,inst:$,continue:!q.abort})}}}),oO=m("$ZodEmoji",($,q)=>{q.pattern??(q.pattern=YO()),_1.init($,q)}),rO=m("$ZodNanoID",($,q)=>{q.pattern??(q.pattern=$O),_1.init($,q)}),tO=m("$ZodCUID",($,q)=>{q.pattern??(q.pattern=rL),_1.init($,q)}),aO=m("$ZodCUID2",($,q)=>{q.pattern??(q.pattern=tL),_1.init($,q)}),sO=m("$ZodULID",($,q)=>{q.pattern??(q.pattern=aL),_1.init($,q)}),eO=m("$ZodXID",($,q)=>{q.pattern??(q.pattern=sL),_1.init($,q)}),$N=m("$ZodKSUID",($,q)=>{q.pattern??(q.pattern=eL),_1.init($,q)}),qN=m("$ZodISODateTime",($,q)=>{q.pattern??(q.pattern=XO(q)),_1.init($,q)}),IN=m("$ZodISODate",($,q)=>{q.pattern??(q.pattern=WO),_1.init($,q)}),UN=m("$ZodISOTime",($,q)=>{q.pattern??(q.pattern=ZO(q)),_1.init($,q)}),YN=m("$ZodISODuration",($,q)=>{q.pattern??(q.pattern=qO),_1.init($,q)}),JN=m("$ZodIPv4",($,q)=>{q.pattern??(q.pattern=JO),_1.init($,q),$._zod.bag.format="ipv4"}),QN=m("$ZodIPv6",($,q)=>{q.pattern??(q.pattern=QO),_1.init($,q),$._zod.bag.format="ipv6",$._zod.check=(I)=>{try{new URL(`http://[${I.value}]`)}catch{I.issues.push({code:"invalid_format",format:"ipv6",input:I.value,inst:$,continue:!q.abort})}}}),KN=m("$ZodMAC",($,q)=>{q.pattern??(q.pattern=KO(q.delimiter)),_1.init($,q),$._zod.bag.format="mac"}),zN=m("$ZodCIDRv4",($,q)=>{q.pattern??(q.pattern=zO),_1.init($,q)}),wN=m("$ZodCIDRv6",($,q)=>{q.pattern??(q.pattern=wO),_1.init($,q),$._zod.check=(I)=>{let U=I.value.split("/");try{if(U.length!==2)throw Error();let[Y,J]=U;if(!J)throw Error();let Q=Number(J);if(`${Q}`!==J)throw Error();if(Q<0||Q>128)throw Error();new URL(`http://[${Y}]`)}catch{I.issues.push({code:"invalid_format",format:"cidrv6",input:I.value,inst:$,continue:!q.abort})}}});function GN($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}} Line truncated
if (${P}.issues.length) {
if (${B} in input) {
payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
...iss,
path: iss.path ? [${L}, ...iss.path] : [${L}]
path: iss.path ? [${B}, ...iss.path] : [${B}]
})));
}
}
if (${W}.value === undefined) {
if (${L} in input) {
newResult[${L}] = undefined;
if (${P}.value === undefined) {
if (${B} in input) {
newResult[${B}] = undefined;
}
} else {
newResult[${L}] = ${W}.value;
newResult[${B}] = ${P}.value;
}
`);else if(!q)f.write(`
const ${W}_present = ${L} in input;
if (${W}.issues.length) {
payload.issues = payload.issues.concat(${W}.issues.map(iss => ({
`);else if(!h)W.write(`
const ${P}_present = ${B} in input;
if (${P}.issues.length) {
payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
...iss,
path: iss.path ? [${L}, ...iss.path] : [${L}]
path: iss.path ? [${B}, ...iss.path] : [${B}]
})));
}
if (!${W}_present && !${W}.issues.length) {
if (!${P}_present && !${P}.issues.length) {
payload.issues.push({
code: "invalid_type",
expected: "nonoptional",
input: undefined,
path: [${L}]
path: [${B}]
});
}
if (${W}_present) {
if (${W}.value === undefined) {
newResult[${L}] = undefined;
if (${P}_present) {
if (${P}.value === undefined) {
newResult[${B}] = undefined;
} else {
newResult[${L}] = ${W}.value;
newResult[${B}] = ${P}.value;
}
}
`);else f.write(`
if (${W}.issues.length) {
payload.issues = payload.issues.concat(${W}.issues.map(iss => ({
`);else W.write(`
if (${P}.issues.length) {
payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
...iss,
path: iss.path ? [${L}, ...iss.path] : [${L}]
path: iss.path ? [${B}, ...iss.path] : [${B}]
})));
}
if (${W}.value === undefined) {
if (${L} in input) {
newResult[${L}] = undefined;
if (${P}.value === undefined) {
if (${B} in input) {
newResult[${B}] = undefined;
}
} else {
newResult[${L}] = ${W}.value;
newResult[${B}] = ${P}.value;
}
`)}f.write("payload.value = newResult;"),f.write("return payload;");let F=f.compile();return(Q,W)=>F(w,Q,W)},u,e=Gt,l=!Nt.jitless,I=l&&j$.value,g=i.catchall,b;n._zod.parse=(w,f)=>{b??(b=o.value);let c=w.value;if(!e(c))return w.issues.push({expected:"object",code:"invalid_type",input:c,inst:n}),w;if(l&&I&&f?.async===!1&&f.jitless!==!0){if(!u)u=t(i.shape);if(w=u(w,f),!g)return w;return h0([],c,w,f,b,n)}return r(w,f)}});function Y0(n,i,r,o){for(let u of n)if(u.issues.length===0)return i.value=u.value,i;let t=n.filter((u)=>!ai(u));if(t.length===1)return i.value=t[0].value,t[0];return i.issues.push({code:"invalid_union",input:i.value,inst:r,errors:n.map((u)=>u.issues.map((e)=>Zn(e,o,dn())))}),i}var ko=D("$ZodUnion",(n,i)=>{T.init(n,i),h(n._zod,"optin",()=>i.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),h(n._zod,"optout",()=>i.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),h(n._zod,"values",()=>{if(i.options.every((o)=>o._zod.values))return new Set(i.options.flatMap((o)=>Array.from(o._zod.values)));return}),h(n._zod,"pattern",()=>{if(i.options.every((o)=>o._zod.pattern)){let o=i.options.map((t)=>t._zod.pattern);return new RegExp(`^(${o.map((t)=>eo(t.source)).join("|")})$`)}return});let r=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(o,t)=>{if(r)return r(o,t);let u=!1,e=[];for(let l of i.options){let $=l._zod.run({value:o.value,issues:[]},t);if($ instanceof Promise)e.push($),u=!0;else{if($.issues.length===0)return $;e.push($)}}if(!u)return Y0(e,o,n,t);return Promise.all(e).then((l)=>{return Y0(l,o,n,t)})}});function Q0(n,i,r,o){let t=n.filter((u)=>u.issues.length===0);if(t.length===1)return i.value=t[0].value,i;if(t.length===0)i.issues.push({code:"invalid_union",input:i.value,inst:r,errors:n.map((u)=>u.issues.map((e)=>Zn(e,o,dn())))});else i.issues.push({code:"invalid_union",input:i.value,inst:r,errors:[],inclusive:!1});return i}var Ug=D("$ZodXor",(n,i)=>{ko.init(n,i),i.inclusive=!1;let r=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(o,t)=>{if(r)return r(o,t);let u=!1,e=[];for(let l of i.options){let $=l._zod.run({value:o.value,issues:[]},t);if($ instanceof Promise)e.push($),u=!0;else e.push($)}if(!u)return Q0(e,o,n,t);return Promise.all(e).then((l)=>{return Q0(l,o,n,t)})}}),Dg=D("$ZodDiscriminatedUnion",(n,i)=>{i.inclusive=!1,ko.init(n,i);let r=n._zod.parse;h(n._zod,"propValues",()=>{let t={};for(let u of i.options){let e=u._zod.propValues;if(!e||Object.keys(e).length===0)throw Error(`Invalid discriminated union option at index "${i.options.indexOf(u)}"`);for(let[l,$]of Object.entries(e)){if(!t[l])t[l]=new Set;for(let I of $)t[l].add(I)}}return t});let o=Rt(()=>{let t=i.options,u=new Map;for(let e of t){let l=e._zod.propValues?.[i.discriminator];if(!l||l.size===0)throw Error(`Invalid discriminated union option at index "${i.options.indexOf(e)}"`);for(let $ of l){if(u.has($))throw Error(`Duplicate discriminator value "${String($)}"`);u.set($,e)}}return u});n._zod.parse=(t,u)=>{let e=t.value;if(!Gt(e))return t.issues.push({code:"invalid_type",expected:"object",input:e,inst:n}),t;let l=o.value.get(e?.[i.discriminator]);if(l)return l._zod.run(t,u);if(i.unionFallback||u.direction==="backward")return r(t,u);return t.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:i.discriminator,options:Array.from(o.value.keys()),input:e,path:[i.discriminator],inst:n}),t}}),Sg=D("$ZodIntersection",(n,i)=>{T.init(n,i),n._zod.parse=(r,o)=>{let t=r.value,u=i.left._zod.run({value:t,issues:[]},o),e=i.right._zod.run({value:t,issues:[]},o);if(u instanceof Promise||e instanceof Promise)return Promise.all([u,e]).then(([$,I])=>{return F0(r,$,I)});return F0(r,u,e)}});function XI(n,i){if(n===i)return{valid:!0,data:n};if(n instanceof Date&&i instanceof Date&&+n===+i)return{valid:!0,data:n};if(xi(n)&&xi(i)){let r=Object.keys(i),o=Object.keys(n).filter((u)=>r.indexOf(u)!==-1),t={...n,...i};for(let u of o){let e=XI(n[u],i[u]);if(!e.valid)return{valid:!1,mergeErrorPath:[u,...e.mergeErrorPath]};t[u]=e.data}return{valid:!0,data:t}}if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<n.length;o++){let t=n[o],u=i[o],e=XI(t,u);if(!e.valid)return{valid:!1,mergeErrorPath:[o,...e.mergeErrorPath]};r.push(e.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function F0(n,i,r){let o=new Map,t;for(let l of i.issues)if(l.code==="unrecognized_keys"){t??(t=l);for(let $ of l.keys){if(!o.has($))o.set($,{});o.get($).l=!0}}else n.issues.push(l);for(let l of r.issues)if(l.code==="unrecognized_keys")for(let $ of l.keys){if(!o.has($))o.set($,{});o.get($).r=!0}else n.issues.push(l);let u=[...o].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(u.length&&t)n.issues.push({...t,keys:u});if(ai(n))return n;let e=XI(i.value,r.value);if(!e.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(e.mergeErrorPath)}`);return n.value=e.data,n}var ke=D("$ZodTuple",(n,i)=>{T.init(n,i Line truncated
`)}W.write("payload.value = newResult;"),W.write("return payload;");let E=W.compile();return(T,P)=>E(V,T,P)},J,Q=M7,K=!N7.jitless,w=K&&nL.value,G=q.catchall,H;$._zod.parse=(V,W)=>{H??(H=U.value);let X=V.value;if(!Q(X))return V.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),V;if(K&&w&&W?.async===!1&&W.jitless!==!0){if(!J)J=Y(q.shape);if(V=J(V,W),!G)return V;return sx([],X,V,W,H,$)}return I(V,W)}});function ux($,q,I,U){for(let J of $)if(J.issues.length===0)return q.value=J.value,q;let Y=$.filter((J)=>!r5(J));if(Y.length===1)return q.value=Y[0].value,Y[0];return q.issues.push({code:"invalid_union",input:q.value,inst:I,errors:$.map((J)=>J.issues.map((Q)=>P6(Q,U,W4())))}),q}var tY=m("$ZodUnion",($,q)=>{k0.init($,q),o0($._zod,"optin",()=>q.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),o0($._zod,"optout",()=>q.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),o0($._zod,"values",()=>{if(q.options.every((U)=>U._zod.values))return new Set(q.options.flatMap((U)=>Array.from(U._zod.values)));return}),o0($._zod,"pattern",()=>{if(q.options.every((U)=>U._zod.pattern)){let U=q.options.map((Y)=>Y._zod.pattern);return new RegExp(`^(${U.map((Y)=>uY(Y.source)).join("|")})$`)}return});let I=q.options.length===1?q.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(I)return I(U,Y);let J=!1,Q=[];for(let K of q.options){let z=K._zod.run({value:U.value,issues:[]},Y);if(z instanceof Promise)Q.push(z),J=!0;else{if(z.issues.length===0)return z;Q.push(z)}}if(!J)return ux(Q,U,$,Y);return Promise.all(Q).then((K)=>{return ux(K,U,$,Y)})}});function xx($,q,I,U){let Y=$.filter((J)=>J.issues.length===0);if(Y.length===1)return q.value=Y[0].value,q;if(Y.length===0)q.issues.push({code:"invalid_union",input:q.value,inst:I,errors:$.map((J)=>J.issues.map((Q)=>P6(Q,U,W4())))});else q.issues.push({code:"invalid_union",input:q.value,inst:I,errors:[],inclusive:!1});return q}var BN=m("$ZodXor",($,q)=>{tY.init($,q),q.inclusive=!1;let I=q.options.length===1?q.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(I)return I(U,Y);let J=!1,Q=[];for(let K of q.options){let z=K._zod.run({value:U.value,issues:[]},Y);if(z instanceof Promise)Q.push(z),J=!0;else Q.push(z)}if(!J)return xx(Q,U,$,Y);return Promise.all(Q).then((K)=>{return xx(K,U,$,Y)})}}),RN=m("$ZodDiscriminatedUnion",($,q)=>{q.inclusive=!1,tY.init($,q);let I=$._zod.parse;o0($._zod,"propValues",()=>{let Y={};for(let J of q.options){let Q=J._zod.propValues;if(!Q||Object.keys(Q).length===0)throw Error(`Invalid discriminated union option at index "${q.options.indexOf(J)}"`);for(let[K,z]of Object.entries(Q)){if(!Y[K])Y[K]=new Set;for(let w of z)Y[K].add(w)}}return Y});let U=Hq(()=>{let Y=q.options,J=new Map;for(let Q of Y){let K=Q._zod.propValues?.[q.discriminator];if(!K||K.size===0)throw Error(`Invalid discriminated union option at index "${q.options.indexOf(Q)}"`);for(let z of K){if(J.has(z))throw Error(`Duplicate discriminator value "${String(z)}"`);J.set(z,Q)}}return J});$._zod.parse=(Y,J)=>{let Q=Y.value;if(!M7(Q))return Y.issues.push({code:"invalid_type",expected:"object",input:Q,inst:$}),Y;let K=U.value.get(Q?.[q.discriminator]);if(K)return K._zod.run(Y,J);if(q.unionFallback||J.direction==="backward")return I(Y,J);return Y.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:q.discriminator,options:Array.from(U.value.keys()),input:Q,path:[q.discriminator],inst:$}),Y}}),vN=m("$ZodIntersection",($,q)=>{k0.init($,q),$._zod.parse=(I,U)=>{let Y=I.value,J=q.left._zod.run({value:Y,issues:[]},U),Q=q.right._zod.run({value:Y,issues:[]},U);if(J instanceof Promise||Q instanceof Promise)return Promise.all([J,Q]).then(([z,w])=>{return kx(I,z,w)});return kx(I,J,Q)}});function pO($,q){if($===q)return{valid:!0,data:$};if($ instanceof Date&&q instanceof Date&&+$===+q)return{valid:!0,data:$};if(o5($)&&o5(q)){let I=Object.keys(q),U=Object.keys($).filter((J)=>I.indexOf(J)!==-1),Y={...$,...q};for(let J of U){let Q=pO($[J],q[J]);if(!Q.valid)return{valid:!1,mergeErrorPath:[J,...Q.mergeErrorPath]};Y[J]=Q.data}return{valid:!0,data:Y}}if(Array.isArray($)&&Array.isArray(q)){if($.length!==q.length)return{valid:!1,mergeErrorPath:[]};let I=[];for(let U=0;U<$.length;U++){let Y=$[U],J=q[U],Q=pO(Y,J);if(!Q.valid)return{valid:!1,mergeErrorPath:[U,...Q.mergeErrorPath]};I.push(Q.data)}return{valid:!0,data:I}}return{valid:!1,mergeErrorPath:[]}}function kx($,q,I){let U=new Map,Y;for(let K of q.issues)if(K.code==="unrecognized_keys"){Y??(Y=K);for(let z of K.keys){if(!U.has(z))U.set(z,{});U.get(z).l=!0}}else $.issues.push(K);for(let K of I.issues)if(K.code==="unrecognized_keys")for(let z of K.keys){if(!U.has(z))U.set(z,{});U.get(z).r=!0}else $.issues.push(K);let J=[...U].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(J.length&&Y)$.issues.push({...Y,keys:J});if(r5($))return $;let Q=pO(q.value,I.value);if(!Q.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(Q.mergeErrorPath)}`);return $.value=Q.data,$}var ww=m("$ZodTuple",($,q)=>{k0. Line truncated
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let e of n.seen.entries()){let l=e[1];if(i===e[0]){u(e);continue}if(n.external){let I=n.external.registry.get(e[0])?.id;if(i!==e[0]&&I){u(e);continue}}if(n.metadataRegistry.get(e[0])?.id){u(e);continue}if(l.cycle){u(e);continue}if(l.count>1){if(n.reused==="ref"){u(e);continue}}}}function rt(n,i){let r=n.seen.get(i);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(l)=>{let $=n.seen.get(l);if($.ref===null)return;let I=$.def??$.schema,g={...I},b=$.ref;if($.ref=null,b){o(b);let f=n.seen.get(b),c=f.schema;if(c.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"))I.allOf=I.allOf??[],I.allOf.push(c);else Object.assign(I,c);if(Object.assign(I,g),l._zod.parent===b)for(let d in I){if(d==="$ref"||d==="allOf")continue;if(!(d in g))delete I[d]}if(c.$ref&&f.def)for(let d in I){if(d==="$ref"||d==="allOf")continue;if(d in f.def&&JSON.stringify(I[d])===JSON.stringify(f.def[d]))delete I[d]}}let w=l._zod.parent;if(w&&w!==b){o(w);let f=n.seen.get(w);if(f?.schema.$ref){if(I.$ref=f.schema.$ref,f.def)for(let c in I){if(c==="$ref"||c==="allOf")continue;if(c in f.def&&JSON.stringify(I[c])===JSON.stringify(f.def[c]))delete I[c]}}}n.override({zodSchema:l,jsonSchema:I,path:$.path??[]})};for(let l of[...n.seen.entries()].reverse())o(l[0]);let t={};if(n.target==="draft-2020-12")t.$schema="https://json-schema.org/draft/2020-12/schema";else if(n.target==="draft-07")t.$schema="http://json-schema.org/draft-07/schema#";else if(n.target==="draft-04")t.$schema="http://json-schema.org/draft-04/schema#";else if(n.target==="openapi-3.0");if(n.external?.uri){let l=n.external.registry.get(i)?.id;if(!l)throw Error("Schema is missing an `id` property");t.$id=n.external.uri(l)}Object.assign(t,r.def??r.schema);let u=n.metadataRegistry.get(i)?.id;if(u!==void 0&&t.id===u)delete t.id;let e=n.external?.defs??{};for(let l of n.seen.entries()){let $=l[1];if($.def&&$.defId){if($.def.id===$.defId)delete $.def.id;e[$.defId]=$.def}}if(n.external);else if(Object.keys(e).length>0)if(n.target==="draft-2020-12")t.$defs=e;else t.definitions=e;try{let l=JSON.parse(JSON.stringify(t));return Object.defineProperty(l,"~standard",{value:{...i["~standard"],jsonSchema:{input:Ur(i,"input",n.processors),output:Ur(i,"output",n.processors)}},enumerable:!1,writable:!1}),l}catch(l){throw Error("Error converting schema to JSON.")}}function zn(n,i){let r=i??{seen:new Set};if(r.seen.has(n))return!1;r.seen.add(n);let o=n._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return zn(o.element,r);if(o.type==="set")return zn(o.valueType,r);if(o.type==="lazy")return zn(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return zn(o.innerType,r);if(o.type==="intersection")return zn(o.left,r)||zn(o.right,r);if(o.type==="record"||o.type==="map")return zn(o.keyType,r)||zn(o.valueType,r);if(o.type==="pipe"){if(n._zod.traits.has("$ZodCodec"))return!0;return zn(o.in,r)||zn(o.out,r)}if(o.type==="object"){for(let t in o.shape)if(zn(o.shape[t],r))return!0;return!1}if(o.type==="union"){for(let t of o.options)if(zn(t,r))return!0;return!1}if(o.type==="tuple"){for(let t of o.items)if(zn(t,r))return!0;if(o.rest&&zn(o.rest,r))return!0;return!1}return!1}var Nw=(n,i={})=>(r)=>{let o=it({...r,processors:i});return ln(n,o),tt(o,n),rt(o,n)},Ur=(n,i,r={})=>(o)=>{let{libraryOptions:t,target:u}=o??{},e=it({...t??{},target:u,io:i,processors:r});return ln(n,e),tt(e,n),rt(e,n)};var Aj={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yw=(n,i,r,o)=>{let t=r;t.type="string";let{minimum:u,maximum:e,format:l,patterns:$,contentEncoding:I}=n._zod.bag;if(typeof u==="number")t.minLength=u;if(typeof e==="number")t.maxLength=e;if(l){if(t.format=Aj[l]??l,t.format==="")delete t.format;if(l==="time")delete t.format}if(I)t.contentEncoding=I;if($&&$.size>0){let g=[...$];if(g.length===1)t.pattern=g[0].source;else if(g.length>1)t.allOf=[...g.map((b)=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))]}},Gw=(n,i,r,o)=>{let t=r,{minimum:u,maximum:e,format:l,multipleOf:$,exclusiveMaximum:I,exclusiveMinimum:g}=n._zod.bag;if(typeof l==="string"&&l.includes("int"))t.type="integer";else t.type="number";let b=typeof g==="number"&&g>=(u??Number.NEGATIVE_INFINITY),w=typeof I==="number"&&I<=(e??Number.POSITIVE_INFINITY),f=i.target==="draft-04"||i.target==="openapi-3.0";if(b)if(f)t.minimum=g,t.exclusiveMinimum=!0;else t.exclusiveMinimum=g;else if(typeof u==="number")t.minimum=u;if(w)if(f)t.maximum=I,t.exclusiveMaximum=!0;else t.exclusiveMaximum=I;else if(typeof e==="number")t.maximum=e;if(typeof $==="number")t.multipleOf=$},Ww=(n,i,r,o)=>{r.type="boolean"},jw=(n,i,r,o)=>{if(i.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},pw=(n,i,r,o)=>{if(i.unrepresentable==="Line truncated
`);if(n===-1)return null;let i=this._buffer.toString("utf8",0,n).replace(/\r$/,"");return this._buffer=this._buffer.subarray(n+1),VQ(i)}clear(){this._buffer=void 0}}function VQ(n){return GD.parse(JSON.parse(n))}function Od(n){return JSON.stringify(n)+`
`}class _6{constructor(n=Ld.stdin,i=Ld.stdout){this._stdin=n,this._stdout=i,this._readBuffer=new q6,this._started=!1,this._ondata=(r)=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=(r)=>{this.onerror?.(r)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let n=this._readBuffer.readMessage();if(n===null)break;this.onmessage?.(n)}catch(n){this.onerror?.(n)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(n){return new Promise((i)=>{let r=Od(n);if(this._stdout.write(r))i();else this._stdout.once("drain",i)})}}import{dirname as e0,join as IP}from"node:path";import{fileURLToPath as gP}from"node:url";class Zi extends Error{name="KyError";get isKyError(){return!0}}class ri extends Zi{name="HTTPError";response;request;options;data;constructor(n,i,r){let o=n.status||n.status===0?n.status:"",t=n.statusText??"",u=`${o} ${t}`.trim(),e=u?`status code ${u}`:"an unknown error";super(`Request failed with ${e}: ${i.method} ${i.url}`);this.response=n,this.request=i,this.options=r}}class yu extends Zi{name="NetworkError";request;constructor(n,i){super(`Request failed due to a network error: ${n.method} ${n.url}`,i);this.request=n}}class Gu extends Error{name="NonError";value;constructor(n){let i="Non-error value was thrown";try{if(typeof n==="string")i=n;else if(n&&typeof n==="object"&&"message"in n&&typeof n.message==="string")i=n.message}catch{}super(i);this.value=n}}class _r extends Zi{name="ForceRetryError";customDelay;code;customRequest;constructor(n){let i=n?.cause?n.cause instanceof Error?n.cause:new Gu(n.cause):void 0;super(n?.code?`Forced retry: ${n.code}`:"Forced retry",i?{cause:i}:void 0);this.customDelay=n?.delay,this.code=n?.code,this.customRequest=n?.request}}class Z6 extends Error{name="SchemaValidationError";issues;constructor(n){super("Response schema validation failed");this.issues=n}}class ki extends Zi{name="TimeoutError";request;constructor(n){super(`Request timed out: ${n.method} ${n.url}`);this.request=n}}var M6=(()=>{let n=!1,i=!1,r=typeof globalThis.ReadableStream==="function",o=typeof globalThis.Request==="function";if(r&&o)try{i=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type")}catch(t){if(t instanceof Error&&t.message==="unsupported BodyInit type")return!1;throw t}return n&&!i})(),Nd=typeof globalThis.AbortController==="function",Gv=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",yd=typeof globalThis.ReadableStream==="function",Gd=typeof globalThis.FormData==="function",Wv=["get","post","put","patch","head","delete"],qQ=()=>{return};qQ();var Wd={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Zr=2147483647,jd=40,jv=Symbol("stop");class pv{options;constructor(n){this.options=n}}var pd=(n)=>new pv(n),Jd={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},Xd={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var Jv=new TextEncoder,_Q=(n)=>{if(!n)return 0;if(n instanceof FormData){let i=0;for(let[r,o]of n)i+=jd,i+=Jv.encode(`Content-Disposition: form-data; name="${r}"`).byteLength,i+=typeof o==="string"?Jv.encode(o).byteLength:o.size;return i}if(n instanceof Blob)return n.size;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n.byteLength;if(typeof n==="string")return Jv.encode(n).byteLength;if(n instanceof URLSearchParams)return Jv.encode(n.toString()).byteLength;return 0},Hd=(n,i,r)=>{let o,t=0;return n.pipeThrough(new TransformStream({transform(u,e){if(e.enqueue(u),o){t+=o.byteLength;let l=i===0?0:t/i;if(l>=1)l=1-Number.EPSILON;r?.({percent:l,totalBytes:Math.max(i,t),transferredBytes:t},o)}o=u},flush(){if(o)t+=o.byteLength,r?.({percent:1,totalBytes:Math.max(i,t),transferredBytes:t},o)}}))},Yd=(n,i)=>{if(!n.body)return n;let r={status:n.status,statusText:n.statusText,headers:n.headers};if(n.status===204)return new Response(null,r);let o=Math.max(0,Number(n.headers.get("content-length"))||0);return new Response(Hd(n.body,o,i),r)},Qd=(n,i,r)=>{if(!n.body)return n;let o=_Q(r??n.body);return new Request(n,{duplex:"half",body:Hd(n.body,o,i)})};var Xi=(n)=>n!==null&&typeof n==="object";var ZQ=Symbol("replaceOption"),z6=(n)=>Xi(n)&&n[ZQ]===!0?{isReplace:!0,value:n.value}:{isReplace:!1,value:n};var ju=(...n)=>{for(let i of n)if((!Xi(i)| Line truncated
`,{mode:384}),i}function xr(n,i,r=[]){let o=i.corpId?.trim()||void 0,t=i.stateful?i.defaultCorpId?.trim()||void 0:void 0,u=o??t;if(u){let l=n.find(($)=>$.id===u);if(l)return l;throw Error(`No enterprise config found for ${u}`)}if(!i.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-home config mode stateful` to enable a default enterprise.");let e=n[0];if(e)return e;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(r.length?r.join(", "):"the configured enterprise directories"))}import{readFileSync as JK}from"node:fs";import{randomBytes as XK}from"node:crypto";import{randomBytes as CO}from"node:crypto";var TF=v.object({staffId:v.string(),name:v.string().optional(),code:v.string().default(""),bindTime:v.number().optional()}),EF=v.object({id:v.string(),tenantId:v.string(),name:v.string(),isAdmin:v.boolean().default(!1),permissions:v.array(v.string()).default([]),providerUserId:v.string().optional(),hosecloudStaff:TF.optional()}),VF=v.object({apiKey:v.string().optional(),corporationId:v.string().optional(),corporationName:v.string().optional()}),qF=v.object({id:v.string(),name:v.string(),tenantSlug:v.string().optional(),isDemo:v.boolean().default(!1),logoUrl:v.string().nullable().optional(),hoseCorpConfig:VF.optional()}),yO=v.object({user:EF,tenant:qF}),_F=v.object({id:v.string(),name:v.string(),email:v.string().nullable().optional(),emailVerified:v.boolean().optional(),image:v.string().nullable().optional(),tenantId:v.string().optional(),provider:v.string().optional(),providerUserId:v.string().optional(),mobile:v.string().nullable().optional(),status:v.string().optional(),permissions:v.array(v.string()).default([]),isAdmin:v.boolean().default(!1),hosecloudStaff:v.unknown().optional()}).passthrough(),ZF=v.object({id:v.string(),token:v.string().optional(),expiresAt:v.string(),createdAt:v.string().optional(),updatedAt:v.string().optional(),ipAddress:v.string().optional(),userAgent:v.string().optional(),userId:v.string(),delegationId:v.string().nullable().optional()}).passthrough(),GO=v.object({user:_F,session:ZF}),zv=v.object({id:v.string(),tenantId:v.string().optional(),code:v.number().optional(),description:v.string(),scope:v.string(),strictness:v.string(),status:v.string().optional(),createdAt:v.number().optional(),updatedAt:v.number().optional()}),WO=v.object({rules:v.array(zv),hasPendingDeletes:v.boolean().default(!1)}),MF=v.object({code:v.string().optional(),description:v.string(),scope:v.string(),strictness:v.string()}),Cv=v.object({id:v.string(),tenantId:v.string().optional(),versionNumber:v.number(),versionName:v.string().nullable().optional(),publishedBy:v.string().nullable().optional(),publishedByName:v.string().nullable().optional(),rules:v.array(MF).default([]),publishedAt:v.number().optional(),createdAt:v.number().optional()}),jO=v.object({version:Cv,rulesCount:v.number()}),Ku=v.object({id:v.string(),tenantId:v.string().optional(),title:v.string(),purpose:v.string().default(""),contentType:v.string().default("policy"),content:v.string(),status:v.string().default("published"),enabled:v.boolean().default(!0),scenarios:v.array(v.string()).default([]),tags:v.array(v.string()).default([]),category:v.string().nullable().optional(),categoryTags:v.array(v.string()).default([]),createdBy:v.string().nullable().optional(),createdByName:v.string().nullable().optional(),createdAt:v.number().optional(),updatedAt:v.number().optional(),updatedBy:v.string().nullable().optional(),updatedByName:v.string().nullable().optional(),isDeleted:v.boolean().default(!1)}),pO=v.object({articles:v.array(Ku),total:v.number().optional()}),zF=v.object({explicitApprove:v.string().default(""),explicitReject:v.string().default(""),exemptApprove:v.string().default(""),review:v.string().default("")}).passthrough(),CF=v.object({type:v.string(),signKey:v.string().optional(),outboundName:v.string().optional(),mode:v.string().optional(),autoApprovalRate:v.number().optional(),apiKey:v.string().optional(),apiSecret:v.string().optional(),apiOrigin:v.string().optional(),corporationId:v.string().optional(),ebotSignKey:v.string().optional(),completionSignKey:v.string().optional(),outboundMessageId:v.string().optional(),completionMessageId:v.string().optional()}).passthrough(),RF=v.enum(["assisted","semi_automatic","fully_automatic"]),NO=v.object({id:v.string(),url:v.string().url()}).passthrough(),Bu=v.object({type:v.literal("webhook"),id:v.string(),name:v.string(),mode:RF,incomingDocumentWebhook:NO,outgoingResultWebhook:v.string().url(),incomingManualResultWebhook:NO,secret:v.string().min(1),autoApprovalRate:v.number().int().min(0).max(100).optional()}).passthrough(),I4=v.object({id:v.string().optional(),tenantId:v.string().optional(),tone:v.string().optional(),language:v.string().optional(),detailLevel:v.string().optional(),outputFormat:v.string().optional(),examples:v.array(v.string()).default([]),prohibitedPhrases:v.array(v.string()).default([]),cus Line truncated
`);return{recordId:n.id,sourceDocumentSN:n.sourceDocumentSN,sourceDocumentId:n.sourceDocumentId,document:kt({id:i?.id,sn:i?.sn??i?.sourceDocumentSN??n.sourceDocumentSN,title:i?.title??i?.name,template:r$(i,["template.name","templateName","form.name","formName","formTitle"]),amount:i$(r,["金额","报销金额","付款金额","合计","价税合计"])??r$(i,["amount","totalAmount","expenseAmount"]),expenseType:i$(r,["费用类型","费用类别","报销类型"]),costCompany:i$(r,["费用承担公司","承担公司","成本中心","费用归属"]),payee:i$(r,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:r.slice(0,30)}),invoices:hK(n),attachments:tN(n,{summary:!0}).attachments,aiResult:u$(n),manualResult:Zt(n)?.value,hints:kt({amountMentions:ZL(o,["金额","合计","税率"],8),partyMentions:ZL(o,["买方","卖方","甲方","乙方","收款"],8)})}}function tN(n,i={}){let r=[["document",n.document],["result",n.result],["pipelineData",n.pipelineData],["sourceExtendData",n.sourceExtendData]],o=[],t=new Set;for(let[u,e]of r)Y4(e,u,o,t);return{recordId:n.id,sourceDocumentSN:n.sourceDocumentSN,sourceDocumentId:n.sourceDocumentId,count:o.length,attachments:i.summary?o.map((u)=>kt({path:u.path,kind:u.kind,fileName:u.fileName,mimeType:u.mimeType,fileId:u.fileId,sourceField:u.sourceField})):o}}function _K(n){let i=[["result.citedRules",zi(n,"result.citedRules")],["result.matchedRules",zi(n,"result.matchedRules")],["result.ruleResults",zi(n,"result.ruleResults")],["result.rules",zi(n,"result.rules")],["pipelineData.citedRules",zi(n,"pipelineData.citedRules")],["pipelineData.matchedRules",zi(n,"pipelineData.matchedRules")]],r=[],o=new Set;for(let[t,u]of i)(Array.isArray(u)?u:u&&typeof u==="object"?Object.values(u):[]).forEach((l,$)=>{let I=sr(l);if(!I)return;let g=V(I.runtimeRuleId)??V(I.runtimeId)??V(I.id)??V(I.ruleId),b=V(I.ruleCode)??V(I.code)??(g?aK(g):void 0),w=kt({runtimeRuleId:g,ruleCode:b,versionNumber:CK(I.versionNumber)??n.ruleSetVersionNumber,scope:V(I.scope),strictness:V(I.strictness),appliedAnalysis:I.appliedAnalysis??I.analysis??I.reasoning,checkResult:I.checkResult??I.result??I.decision,findings:I.findings??I.riskPoints??I.evidence,sourcePath:`${t}.${$}`}),f=JSON.stringify(w);if(!o.has(f))o.add(f),r.push(w)});return{recordId:n.id,sourceDocumentSN:n.sourceDocumentSN,sourceDocumentId:n.sourceDocumentId,ruleSetVersionNumber:n.ruleSetVersionNumber,count:r.length,rules:r}}function Y4(n,i,r,o){if(Array.isArray(n)){n.forEach((u,e)=>Y4(u,`${i}.${e}`,r,o));return}let t=sr(n);if(!t)return;if(ZK(t,i)){let u=kt({path:i,fieldPath:i,kind:MK(i,t),fileName:V(t.fileName)??V(t.filename)??V(t.name)??V(t.originalName),mimeType:V(t.mimeType)??V(t.mimetype)??V(t.contentType),fileId:V(t.fileId)??V(t.id)??V(t.attachmentId),ossPath:V(t.ossPath)??V(t.ossKey)??V(t.key),url:V(t.url)??V(t.signedUrl)??V(t.downloadUrl)??V(t.previewUrl),invoiceId:V(t.invoiceId),sourceField:V(t.fieldName)??V(t.label)}),e=JSON.stringify(u);if(!o.has(e))o.add(e),r.push(u)}for(let[u,e]of Object.entries(t))Y4(e,`${i}.${u}`,r,o)}function ZK(n,i){let r=Object.keys(n).map((u)=>u.toLowerCase());return/(attachment|attachments|invoice|receipt|file|files|附件|发票)/i.test(i)&&["filename","fileName","mimeType","mimetype","contentType","fileId","ossPath","signedUrl","downloadUrl","previewUrl","attachmentId"].some((u)=>r.includes(u.toLowerCase()))}function MK(n,i){let r=`${n} ${V(i.type)??""}`.toLowerCase();if(r.includes("invoice")||r.includes("发票"))return"invoice";if(r.includes("receipt"))return"receipt";return"attachment"}function r$(n,i){if(!n)return;for(let r of i){let o=zi(n,r);if(o!==void 0)return o}return}function _L(n,i){if(!n)return 0;for(let r of i){let o=zi(n,r);if(Array.isArray(o))return o.length;if(o&&typeof o==="object")return Object.keys(o).length;if(typeof o==="number")return o}return 0}function zi(n,i){return i.split(".").reduce((r,o)=>{if(r===void 0||r===null)return;if(Array.isArray(r)){let t=Number(o);return Number.isInteger(t)?r[t]:void 0}if(typeof r==="object")return r[o];return},n)}function zK(n,i,r){let o=i.split("."),t=n;for(let u of o.slice(0,-1)){let e=t[u];if(!e||typeof e!=="object"||Array.isArray(e))t[u]={};t=t[u]}t[o[o.length-1]??i]=r}function kt(n){return Object.fromEntries(Object.entries(n).filter(([,i])=>i!==void 0))}function sr(n){return n&&typeof n==="object"&&!Array.isArray(n)?n:void 0}function CK(n){return typeof n==="number"&&Number.isFinite(n)?n:void 0}function RK(n){let i=[];return Q4(n,"document",i),i}function Q4(n,i,r){if(Array.isArray(n)){n.forEach((e,l)=>Q4(e,`${i}.${l}`,r));return}let o=sr(n);if(!o)return;let t=V(o.label)??V(o.name)??V(o.title)??V(o.fieldName),u=o.value??o.displayValue??o.text??o.content;if(t&&u!==void 0&&typeof u!=="object")r.push(kt({path:i,label:t,value:u,type:V(o.type)??V(o.fieldType)}));for(let[e,l]of Object.entries(o)){if(e==="attachments")continue;Q4(l,`${i}.${e}`,r)}}function i$(n,i){return n.find((o)=>{let t=V(o.label)??"";return i.some((u)=>t.includes(u)) Line truncated
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let Q of $.seen.entries()){let K=Q[1];if(q===Q[0]){J(Q);continue}if($.external){let w=$.external.registry.get(Q[0])?.id;if(q!==Q[0]&&w){J(Q);continue}}if($.metadataRegistry.get(Q[0])?.id){J(Q);continue}if(K.cycle){J(Q);continue}if(K.count>1){if($.reused==="ref"){J(Q);continue}}}}function $9($,q){let I=$.seen.get(q);if(!I)throw Error("Unprocessed schema. This is a bug in Zod.");let U=(K)=>{let z=$.seen.get(K);if(z.ref===null)return;let w=z.def??z.schema,G={...w},H=z.ref;if(z.ref=null,H){U(H);let W=$.seen.get(H),X=W.schema;if(X.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))w.allOf=w.allOf??[],w.allOf.push(X);else Object.assign(w,X);if(Object.assign(w,G),K._zod.parent===H)for(let L in w){if(L==="$ref"||L==="allOf")continue;if(!(L in G))delete w[L]}if(X.$ref&&W.def)for(let L in w){if(L==="$ref"||L==="allOf")continue;if(L in W.def&&JSON.stringify(w[L])===JSON.stringify(W.def[L]))delete w[L]}}let V=K._zod.parent;if(V&&V!==H){U(V);let W=$.seen.get(V);if(W?.schema.$ref){if(w.$ref=W.schema.$ref,W.def)for(let X in w){if(X==="$ref"||X==="allOf")continue;if(X in W.def&&JSON.stringify(w[X])===JSON.stringify(W.def[X]))delete w[X]}}}$.override({zodSchema:K,jsonSchema:w,path:z.path??[]})};for(let K of[...$.seen.entries()].reverse())U(K[0]);let Y={};if($.target==="draft-2020-12")Y.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")Y.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")Y.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let K=$.external.registry.get(q)?.id;if(!K)throw Error("Schema is missing an `id` property");Y.$id=$.external.uri(K)}Object.assign(Y,I.def??I.schema);let J=$.metadataRegistry.get(q)?.id;if(J!==void 0&&Y.id===J)delete Y.id;let Q=$.external?.defs??{};for(let K of $.seen.entries()){let z=K[1];if(z.def&&z.defId){if(z.def.id===z.defId)delete z.def.id;Q[z.defId]=z.def}}if($.external);else if(Object.keys(Q).length>0)if($.target==="draft-2020-12")Y.$defs=Q;else Y.definitions=Q;try{let K=JSON.parse(JSON.stringify(Y));return Object.defineProperty(K,"~standard",{value:{...q["~standard"],jsonSchema:{input:hq(q,"input",$.processors),output:hq(q,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throw Error("Error converting schema to JSON.")}}function E6($,q){let I=q??{seen:new Set};if(I.seen.has($))return!1;I.seen.add($);let U=$._zod.def;if(U.type==="transform")return!0;if(U.type==="array")return E6(U.element,I);if(U.type==="set")return E6(U.valueType,I);if(U.type==="lazy")return E6(U.getter(),I);if(U.type==="promise"||U.type==="optional"||U.type==="nonoptional"||U.type==="nullable"||U.type==="readonly"||U.type==="default"||U.type==="prefault")return E6(U.innerType,I);if(U.type==="intersection")return E6(U.left,I)||E6(U.right,I);if(U.type==="record"||U.type==="map")return E6(U.keyType,I)||E6(U.valueType,I);if(U.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return E6(U.in,I)||E6(U.out,I)}if(U.type==="object"){for(let Y in U.shape)if(E6(U.shape[Y],I))return!0;return!1}if(U.type==="union"){for(let Y of U.options)if(E6(Y,I))return!0;return!1}if(U.type==="tuple"){for(let Y of U.items)if(E6(Y,I))return!0;if(U.rest&&E6(U.rest,I))return!0;return!1}return!1}var uM=($,q={})=>(I)=>{let U=s5({...I,processors:q});return j1($,U),e5(U,$),$9(U,$)},hq=($,q,I={})=>(U)=>{let{libraryOptions:Y,target:J}=U??{},Q=s5({...Y??{},target:J,io:q,processors:I});return j1($,Q),e5(Q,$),$9(Q,$)};var hO0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},xM=($,q,I,U)=>{let Y=I;Y.type="string";let{minimum:J,maximum:Q,format:K,patterns:z,contentEncoding:w}=$._zod.bag;if(typeof J==="number")Y.minLength=J;if(typeof Q==="number")Y.maxLength=Q;if(K){if(Y.format=hO0[K]??K,Y.format==="")delete Y.format;if(K==="time")delete Y.format}if(w)Y.contentEncoding=w;if(z&&z.size>0){let G=[...z];if(G.length===1)Y.pattern=G[0].source;else if(G.length>1)Y.allOf=[...G.map((H)=>({...q.target==="draft-07"||q.target==="draft-04"||q.target==="openapi-3.0"?{type:"string"}:{},pattern:H.source}))]}},kM=($,q,I,U)=>{let Y=I,{minimum:J,maximum:Q,format:K,multipleOf:z,exclusiveMaximum:w,exclusiveMinimum:G}=$._zod.bag;if(typeof K==="string"&&K.includes("int"))Y.type="integer";else Y.type="number";let H=typeof G==="number"&&G>=(J??Number.NEGATIVE_INFINITY),V=typeof w==="number"&&w<=(Q??Number.POSITIVE_INFINITY),W=q.target==="draft-04"||q.target==="openapi-3.0";if(H)if(W)Y.minimum=G,Y.exclusiveMinimum=!0;else Y.exclusiveMinimum=G;else if(typeof J==="number")Y.minimum=J;if(V)if(W)Y.maximum=w,Y.exclusiveMaximum=!0;else Y.exclusiveMaximum=w;else if(typeof Q==="number")Y.maximum=Q;if(typeof z==="number")Y.multipleOf=z},fM=($,q,I,U)=>{I.type="boolean"},nM=($,q,I,U)=>{if(q.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},bM=($,q,I,U)=>{if(q.unrepresentable==Line truncated
`);if($===-1)return null;let q=this._buffer.toString("utf8",0,$).replace(/\r$/,"");return this._buffer=this._buffer.subarray($+1),qR0(q)}clear(){this._buffer=void 0}}function qR0($){return Rf.parse(JSON.parse($))}function jc($){return JSON.stringify($)+`
`}class $E{constructor($=Bc.stdin,q=Bc.stdout){this._stdin=$,this._stdout=q,this._readBuffer=new eT,this._started=!1,this._ondata=(I)=>{this._readBuffer.append(I),this.processReadBuffer()},this._onerror=(I)=>{this.onerror?.(I)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let $=this._readBuffer.readMessage();if($===null)break;this.onmessage?.($)}catch($){this.onerror?.($)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send($){return new Promise((q)=>{let I=jc($);if(this._stdout.write(I))q();else this._stdout.once("drain",q)})}}import{dirname as Cu,join as xw1}from"node:path";import{fileURLToPath as kw1}from"node:url";class q5 extends Error{name="KyError";get isKyError(){return!0}}class i6 extends q5{name="HTTPError";response;request;options;data;constructor($,q,I){let U=$.status||$.status===0?$.status:"",Y=$.statusText??"",J=`${U} ${Y}`.trim(),Q=J?`status code ${J}`:"an unknown error";super(`Request failed with ${Q}: ${q.method} ${q.url}`);this.response=$,this.request=q,this.options=I}}class $Q extends q5{name="NetworkError";request;constructor($,q){super(`Request failed due to a network error: ${$.method} ${$.url}`,q);this.request=$}}class qQ extends Error{name="NonError";value;constructor($){let q="Non-error value was thrown";try{if(typeof $==="string")q=$;else if($&&typeof $==="object"&&"message"in $&&typeof $.message==="string")q=$.message}catch{}super(q);this.value=$}}class QI extends q5{name="ForceRetryError";customDelay;code;customRequest;constructor($){let q=$?.cause?$.cause instanceof Error?$.cause:new qQ($.cause):void 0;super($?.code?`Forced retry: ${$.code}`:"Forced retry",q?{cause:q}:void 0);this.customDelay=$?.delay,this.code=$?.code,this.customRequest=$?.request}}class qE extends Error{name="SchemaValidationError";issues;constructor($){super("Response schema validation failed");this.issues=$}}class p$ extends q5{name="TimeoutError";request;constructor($){super(`Request timed out: ${$.method} ${$.url}`);this.request=$}}var IE=(()=>{let $=!1,q=!1,I=typeof globalThis.ReadableStream==="function",U=typeof globalThis.Request==="function";if(I&&U)try{q=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type")}catch(Y){if(Y instanceof Error&&Y.message==="unsupported BodyInit type")return!1;throw Y}return $&&!q})(),Rc=typeof globalThis.AbortController==="function",XH=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",vc=typeof globalThis.ReadableStream==="function",Cc=typeof globalThis.FormData==="function",DH=["get","post","put","patch","head","delete"],IR0=()=>{return};IR0();var _c={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},KI=2147483647,hc=40,LH=Symbol("stop");class OH{options;constructor($){this.options=$}}var Sc=($)=>new OH($),yc={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},uc={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var NH=new TextEncoder,UR0=($)=>{if(!$)return 0;if($ instanceof FormData){let q=0;for(let[I,U]of $)q+=hc,q+=NH.encode(`Content-Disposition: form-data; name="${I}"`).byteLength,q+=typeof U==="string"?NH.encode(U).byteLength:U.size;return q}if($ instanceof Blob)return $.size;if($ instanceof ArrayBuffer||ArrayBuffer.isView($))return $.byteLength;if(typeof $==="string")return NH.encode($).byteLength;if($ instanceof URLSearchParams)return NH.encode($.toString()).byteLength;return 0},xc=($,q,I)=>{let U,Y=0;return $.pipeThrough(new TransformStream({transform(J,Q){if(Q.enqueue(J),U){Y+=U.byteLength;let K=q===0?0:Y/q;if(K>=1)K=1-Number.EPSILON;I?.({percent:K,totalBytes:Math.max(q,Y),transferredBytes:Y},U)}U=J},flush(){if(U)Y+=U.byteLength,I?.({percent:1,totalBytes:Math.max(q,Y),transferredBytes:Y},U)}}))},kc=($,q)=>{if(!$.body)return $;let I={status:$.status,statusText:$.statusText,headers:$.headers};if($.status===204)return new Response(null,I);let U=Math.max(0,Number($.headers.get("content-length"))||0);return new Response(xc($.body,U,q),I)},fc=($,q,I)=>{if(!$.body)return $;let U=UR0(I??$.body);return new Request($,{duplex:"half",body:xc($.body,U,q)})};var H8=($)=>$!==null&&typeof $==="object";var YR0=Symbol("replaceOption"),UE=($)=>H8($)&&$[YR0]===!0?{isReplace:!0,value:$.value}:{isReplace:!1,value:$};var UQ=(...$)=>{for(let q of $)if( Line truncated
`,{mode:384}),q}function DI($,q,I=[]){let U=q.corpId?.trim()||void 0,Y=q.stateful?q.defaultCorpId?.trim()||void 0:void 0,J=U??Y;if(J){let K=$.find((z)=>z.id===J);if(K)return K;throw Error(`No enterprise config found for ${J}`)}if(!q.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-home config mode stateful` to enable a default enterprise.");let Q=$[0];if(Q)return Q;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(I.length?I.join(", "):"the configured enterprise directories"))}import{readFileSync as wz1}from"node:fs";import{randomBytes as Gz1}from"node:crypto";var bl=300000,fl=new Map;function Rv0($,q){return $.map((I)=>I.trim()).filter(Boolean).map((I)=>q?I:I.toLowerCase())}function vv0($,q){return q?$:$.toLowerCase()}function Cv0($,q,I,U){let Y=vv0($,U),J=q.filter((Q)=>Y.includes(Q));if(I==="all"&&J.length!==q.length)return[];return J}function _v0($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function hv0($,q){if(q.fields&&!q.fields.has($.field))return[];let I=_v0($.value),U=[];return I.forEach((Y,J)=>{let Q=Cv0(Y,q.keywords,q.matchMode,q.caseSensitive);if(Q.length===0)return;let K=Math.max(0,J-q.contextLines),z=Math.min(I.length,J+q.contextLines+1),w={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:J+1,matchedKeywords:Q,matchedText:dH(Y,q.maxChars),context:{before:q.snippetOnly?[]:I.slice(K,J).map((G)=>dH(G,q.maxChars)),line:dH(Y,q.maxChars),after:q.snippetOnly?[]:I.slice(J+1,z).map((G)=>dH(G,q.maxChars))},metadata:$.metadata};if(q.snippetOnly)w.context={before:[],line:w.context.line,after:[]};U.push(w)}),U}function dH($,q){if(!q||$.length<=q)return $;return`${$.slice(0,Math.max(0,q))}...`}function Sv0($){return[{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"description",value:$.description,metadata:{scope:$.scope,strictness:$.strictness,status:$.status}},{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"scope",value:$.scope,metadata:{strictness:$.strictness,status:$.status}}]}function nl($){return $.rules.flatMap((q,I)=>{let U=`${$.id}:${q.description.slice(0,32)}`,Y={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:q.scope,strictness:q.strictness,code:"code"in q?q.code:void 0,index:I};return[{area:"rules",entityType:"rule",entityId:U,title:`${$.versionName} / ${q.scope}`,field:"history.description",value:q.description,metadata:Y},{area:"rules",entityType:"rule",entityId:U,title:`${$.versionName} / ${q.scope}`,field:"history.scope",value:q.scope,metadata:Y}]})}function yv0($){return[{area:"documents",entityType:"document",entityId:$.id,title:$.title,field:"title",value:$.title,metadata:{status:$.status,scenarios:$.scenarios,tags:$.tags}},{area:"documents",entityType:"document",entityId:$.id,title:$.title,field:"purpose",value:$.purpose,metadata:{status:$.status,scenarios:$.scenarios,tags:$.tags}},{area:"documents",entityType:"document",entityId:$.id,title:$.title,field:"content",value:$.content,metadata:{status:$.status,scenarios:$.scenarios,tags:$.tags}}]}function uv0($){let q=[];if($.decisionPreferences)for(let[I,U]of Object.entries($.decisionPreferences))q.push({area:"preferences",entityType:"preference",field:`decisionPreferences.${I}`,value:U,metadata:{integrationSystem:$.integrationSystem}});return $.integrations.forEach((I,U)=>{q.push({area:"preferences",entityType:"integration",title:I.outboundName,field:`integrations[${U}]`,value:I,metadata:{type:I.type,outboundName:I.outboundName,mode:I.mode,corporationId:I.corporationId}})}),q}async function xv0($,q,I){let U=I.ruleVersionScope??"current",Y=[q.id,`ruleVersionScope=${U}`,`ruleVersionId=${I.ruleVersionId??""}`,`ruleVersionNumber=${I.ruleVersionNumber??""}`,`latestRuleVersion=${I.latestRuleVersion??!1}`,`documentLimit=${I.documentLimit??100}`].join("|"),J=fl.get(Y);if(!I.refresh&&J&&Date.now()<J.expiresAt)return J;let[Q,K,z]=await Promise.all([kv0($,{scope:U,versionId:I.ruleVersionId,versionNumber:I.ruleVersionNumber,latest:I.latestRuleVersion}),WQ($,{limit:I.documentLimit??100}),K4($,q.seal.endpoints.approvalStylePreferences)]),w=Date.now(),G={entries:[...Q,...K.articles.flatMap(yv0),...uv0(z)],fetchedAt:w,expiresAt:w+bl};return fl.set(Y,G),G}async function kv0($,q){if(q.scope==="current")return(await Z8($)).rules.flatMap(Sv0);if(q.scope==="version"){let U=await fv0($,q);return nl(U)}return(await U5($)).flatMap(nl)}async function fv0($,q){if(q.versionId)return VQ($,q.versionId);let I=await U5($),U=q.versionNumber?I.find((Y)=>Y.versionNumber===q.versionNumber):I[0];if(!U)throw Error(q.versionNumber?`Rule version not found: ${q.versionNumber}`:"No rule versions found");return U}async function il($,q,I){let U=I.matchMode??"any",Y=I.caseSensitive??!1,J=I.contextLines??3,Q=new Set(I.areas??["rules","documents","preferences"]),K=I.maxRe Line truncated
`,"utf8"),I}function ol($){return $.map((q,I)=>{let U;if(typeof q.code==="number")U=`#${String(q.code).padStart(4,"0")}`;else if(typeof q.code==="string")U=q.code.startsWith("#")?q.code:`#${q.code}`;else U=`#${String(I+1).padStart(4,"0")}`;return{id:q.id,code:U,name:q.name,description:q.description,scope:q.scope,strictness:q.strictness}})}class b7 extends Error{errors;warnings;constructor($,q=[]){super(`材料包校验失败:${$.length} 个错误`);this.errors=$;this.warnings=q;this.name="MaterialPackValidationError"}}import{createHmac as qC0,randomBytes as IC0}from"node:crypto";function UC0($,q,I,U){return qC0("sha256",U).update(`${$}.${q}.${JSON.stringify(I)}`).digest("hex")}function cE($,q){let I=Math.floor(Date.now()/1000),U=IC0(16).toString("hex");return{Authorization:`Bearer ${q}`,"x-webhook-signature":UC0(I,U,$,q),"x-webhook-timestamp":String(I),"x-webhook-nonce":U}}var Sg=hY(Zm(),1),Uo=hY(Io(),1);var GV={maxEntries:1000,maxTotalSize:524288000,maxCompressionRatio:150};async function Yo($){return new Promise((q,I)=>{Sg.default.fromBuffer(Buffer.from($),{lazyEntries:!0,autoClose:!0},(U,Y)=>{if(U||!Y)return I(U??Error("无法打开 ZIP"));let J=[];Y.readEntry(),Y.on("entry",(Q)=>{let K=Jo(Q);if(!K.endsWith("/")&&!__0(K))J.push({fileName:K,uncompressedSize:Q.uncompressedSize,compressedSize:Q.compressedSize,raw:Q});Y.readEntry()}),Y.on("end",()=>q(J)),Y.on("error",I)})})}function Jo($){if($.fileNameUTF8||$.generalPurposeBitFlag&2048)return $.fileNameUTF8??$.fileName;let q=Buffer.from(String($.fileName),"binary"),I=q.toString("utf8");if(I.includes("�")||/[\u0080-\u00FF]/.test(I)){let U=Uo.default.decode(q,"gbk");if(!U.includes("�"))return U}return I}function __0($){let q=$.split("/").pop()??"";return $.split("/").includes("__MACOSX")||q===".DS_Store"||q.startsWith("._")||q.startsWith(".~")||q.startsWith("~$")}function Qo($){let q=[];if($.length>GV.maxEntries)q.push(`文件数超过 ${GV.maxEntries}`);if($.reduce((Y,J)=>Y+J.uncompressedSize,0)>GV.maxTotalSize)q.push("解压后总大小超过 500MB");for(let Y of $){if(Y.fileName.startsWith("/")||Y.fileName.split("/").includes(".."))q.push(`存在不安全路径: ${Y.fileName}`);if(Y.compressedSize>0&&Y.uncompressedSize/Y.compressedSize>GV.maxCompressionRatio)q.push(`压缩比超过 150: ${Y.fileName}`)}if(!$.find((Y)=>Y.fileName==="信息表.xlsx"))q.push("ZIP 根目录缺少精确名为「信息表.xlsx」的文件");if($.some((Y)=>Y.fileName.toLowerCase().endsWith(".zip")))q.push("不允许嵌套 ZIP");if(q.length)throw new b7(q)}function yg($,q){return new Promise((I,U)=>{Sg.default.fromBuffer(Buffer.from($),{lazyEntries:!0,autoClose:!0},(Y,J)=>{if(Y||!J)return U(Y??Error("无法打开 ZIP"));J.readEntry(),J.on("entry",(Q)=>{if(Jo(Q)!==q.fileName)return J.readEntry();J.openReadStream(Q,(K,z)=>{if(K||!z)return U(K??Error(`无法读取 ${q.fileName}`));let w=[];z.on("data",(G)=>w.push(G)),z.on("end",()=>I(Buffer.concat(w))),z.on("error",U)})}),J.on("error",U)})})}var CV0=hY(RV0(),1);function $L($,q,I,U){return{key:$,label:q,type:I,value:U}}function _V0($,q,I){return $L($,q,"TEXT",I==null?"":String(I))}function hV0($,q,I){return $L($,q,"AMOUNT",typeof I==="number"?{amount:I,currency:"CNY"}:null)}function SV0($){if($ instanceof Date)return $.toISOString();if(typeof $==="string"&&$.trim())return $.trim();return null}function pK1($){if($ instanceof Date)return Math.floor($.getTime()/1000);if(typeof $==="string"&&$.trim()){let q=Date.parse($.trim().replace(" ","T"));if(Number.isFinite(q))return Math.floor(q/1000)}return null}function NY($){let q=new Map;return $.getRow(1).eachCell((I,U)=>q.set(String(I.value??"").trim(),U)),q}function FY($,q,I){let U=q.get(I);return U?$.getCell(U).value:void 0}function cK1($,q){return[["会议编号","meeting_id","TEXT"],["会议名称","meeting_name","TEXT"],["状态","status","TEXT"],["总金额","total_amount","AMOUNT"],["税前劳务总额","pretax_labor_total","AMOUNT"],["报销事由","reimbursement_reason","TEXT"],["po码","po_code","TEXT"],["快递单号","tracking_number","TEXT"],["申请日期","application_date","DATE"],["更新日期","updated_date","DATE"]].flatMap(([U,Y,J])=>{let Q=FY($,q,U);if(Q==null||Q==="")return[];return[J==="TEXT"?_V0(Y,U,Q):J==="AMOUNT"?hV0(Y,U,Q):$L(Y,U,J,SV0(Q))]})}function vV0($,q,I){return I.flatMap(([U,Y,J])=>{let Q=FY($,q,U);if(Q==null||Q==="")return[];return[J==="TEXT"?_V0(Y,U,Q):J==="AMOUNT"?hV0(Y,U,Q):$L(Y,U,J,SV0(Q))]})}var dK1=[["姓名","name","TEXT"],["身份证号码","id_number","TEXT"],["手机号","phone","TEXT"],["劳务费用","labor_fee","AMOUNT"],["税前费用","pretax_fee","AMOUNT"],["开户行","bank","TEXT"],["支行名称","branch_name","TEXT"],["联行号","bank_code","TEXT"],["银行卡号","bank_card_number","TEXT"]],lK1=[["报销金额","reimbursement_amount","AMOUNT"],["费用类型","expense_type","TEXT"],["发生时间","occurrence_time","DATE"],["收款人","payee","TEXT"],["开户行","bank","TEXT"],["支行名称","branch_name","TEXT"],["支行行 Line truncated
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:AY({id:q?.id,sn:q?.sn??q?.sourceDocumentSN??$.sourceDocumentSN,title:q?.title??q?.name,template:GL(q,["template.name","templateName","form.name","formName","formTitle"]),amount:zL(I,["金额","报销金额","付款金额","合计","价税合计"])??GL(q,["amount","totalAmount","expenseAmount"]),expenseType:zL(I,["费用类型","费用类别","报销类型"]),costCompany:zL(I,["费用承担公司","承担公司","成本中心","费用归属"]),payee:zL(I,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:I.slice(0,30)}),invoices:Pz1($),attachments:XI($,{summary:!0}).attachments,aiResult:VL($),manualResult:Uq($)?.value,hints:AY({amountMentions:yW0(U,["金额","合计","税率"],8),partyMentions:yW0(U,["买方","卖方","甲方","乙方","收款"],8)})}}function Nz1($){let q=[["result.citedRules",b5($,"result.citedRules")],["result.matchedRules",b5($,"result.matchedRules")],["result.ruleResults",b5($,"result.ruleResults")],["result.rules",b5($,"result.rules")],["pipelineData.citedRules",b5($,"pipelineData.citedRules")],["pipelineData.matchedRules",b5($,"pipelineData.matchedRules")]],I=[],U=new Set;for(let[Y,J]of q)(Array.isArray(J)?J:J&&typeof J==="object"?Object.values(J):[]).forEach((K,z)=>{let w=Vz(K);if(!w)return;let G=$4(w.runtimeRuleId)??$4(w.runtimeId)??$4(w.id)??$4(w.ruleId),H=$4(w.ruleCode)??$4(w.code)??(G?gz1(G):void 0),V=AY({runtimeRuleId:G,ruleCode:H,versionNumber:Mz1(w.versionNumber)??$.ruleSetVersionNumber,scope:$4(w.scope),strictness:$4(w.strictness),appliedAnalysis:w.appliedAnalysis??w.analysis??w.reasoning,checkResult:w.checkResult??w.result??w.decision,findings:w.findings??w.riskPoints??w.evidence,sourcePath:`${Y}.${z}`}),W=JSON.stringify(V);if(!U.has(W))U.add(W),I.push(V)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:I.length,rules:I}}function GL($,q){if(!$)return;for(let I of q){let U=b5($,I);if(U!==void 0)return U}return}function SW0($,q){if(!$)return 0;for(let I of q){let U=b5($,I);if(Array.isArray(U))return U.length;if(U&&typeof U==="object")return Object.keys(U).length;if(typeof U==="number")return U}return 0}function b5($,q){return q.split(".").reduce((I,U)=>{if(I===void 0||I===null)return;if(Array.isArray(I)){let Y=Number(U);return Number.isInteger(Y)?I[Y]:void 0}if(typeof I==="object")return I[U];return},$)}function Fz1($,q,I){let U=q.split("."),Y=$;for(let J of U.slice(0,-1)){let Q=Y[J];if(!Q||typeof Q!=="object"||Array.isArray(Q))Y[J]={};Y=Y[J]}Y[U[U.length-1]??q]=I}function AY($){return Object.fromEntries(Object.entries($).filter(([,q])=>q!==void 0))}function Vz($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function Mz1($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function Az1($){let q=[];return Iu($,"document",q),q}function Iu($,q,I){if(Array.isArray($)){$.forEach((Q,K)=>Iu(Q,`${q}.${K}`,I));return}let U=Vz($);if(!U)return;let Y=$4(U.label)??$4(U.name)??$4(U.title)??$4(U.fieldName),J=U.value??U.displayValue??U.text??U.content;if(Y&&J!==void 0&&typeof J!=="object")I.push(AY({path:q,label:Y,value:J,type:$4(U.type)??$4(U.fieldType)}));for(let[Q,K]of Object.entries(U)){if(Q==="attachments")continue;Iu(K,`${q}.${Q}`,I)}}function zL($,q){return $.find((U)=>{let Y=$4(U.label)??"";return q.some((J)=>Y.includes(J))})?.value}function Pz1($){let q=[];return HL($.result,"result",q),HL($.document,"document",q),q.slice(0,20)}function HL($,q,I){if(Array.isArray($)){$.forEach((Y,J)=>HL(Y,`${q}.${J}`,I));return}let U=Vz($);if(!U)return;if(/invoice|发票/i.test(q))I.push(AY({path:q,fileName:$4(U.fileName)??$4(U.filename)??$4(U.name),buyer:U.buyer??U.buyerName??U.purchaserName,seller:U.seller??U.sellerName,amount:U.amount??U.totalAmount??U.total,taxRate:U.taxRate,category:U.category??U.type}));for(let[Y,J]of Object.entries(U))HL(J,`${q}.${Y}`,I)}function yW0($,q,I){return $.split(/\r?\n/).filter((U)=>q.some((Y)=>U.includes(Y))).slice(0,I)}function wL($){return $.map((q)=>{let I=Iq(q);return{recordId:I.id,tenantId:I.tenantId,agentId:I.agentId,sourceDocumentSN:I.sourceDocumentSN,sourceDocumentId:I.sourceDocumentId,simulationBatchId:I.simulationBatchId,langfuseTraceId:I.langfuseTraceId,langfuseSessionFallback:I.langfuseSessionFallback,ruleSetVersionNumber:I.ruleSetVersionNumber,ruleSetPublishedAt:I.ruleSetPublishedAt,ruleSetPublishedByName:I.ruleSetPublishedByName,resolution:I.langfuseTraceId?"trace":I.langfuseSessionFallback?"session-fallback":"unresolved"}})}function $u($){return{id:$.id,tenantId:$.tenantId,versionNumber:$.versionNumber,versionName:$.versionName,publishedBy:$.publishedBy,publishedByName:$.publishedByName,rulesCount:$.rules.length,publishedAt:$.publishedAt,createdAt:$.createdAt}}async function Tz1($,q){if(q.recordId&&!q.versionId&&!q.versionNumber&&!q.latest){let I=await W6($,q.recordId);if(!I.ruleSetVersionNumber)throw Er Line truncated
`)}
`}function zu(n){return n.replace(/([?&](?:accessToken|token|returnToken)=)[^&\s]+/gi,"$1<redacted>").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"$1<redacted>")}function P(n,i={}){gB(n,i);let r=`${JSON.stringify(n,null,2)}
`;if(i.outputFile){lB(i.outputFile,r),console.log(JSON.stringify({outputFile:i.outputFile,bytes:Buffer.byteLength(r,"utf-8")},null,2));return}console.log(r.trimEnd())}function gB(n,i={}){if(i.allowFull||i.outputFile)return;let r=Buffer.byteLength(JSON.stringify(n),"utf-8");if(r>IB)throw Error(`Output is large (${r} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function cN(n,i){if(i)return;let r=n&&typeof n==="object"?n:{},o=typeof r.count==="number"?r.count:void 0,t=Array.isArray(r.rules)?r.rules.length:void 0,u=Buffer.byteLength(JSON.stringify(n),"utf-8"),e=o??t??0;if(e>vB||u>$B)throw Error(`Rule list is large (${e} rules, ${u} bytes). Use "seal-use rules list --summary" or "seal-use rules count"; pass --full only when you really need full descriptions.`)}function p(n){return{allowFull:_(n.full)===!0,outputFile:U(n.outputFile)??U(n["output-file"])}}function UN(){console.log(`seal-use CLI
`}function Xz($){return $.replace(/([?&](?:accessToken|token|returnToken)=)[^&\s]+/gi,"$1<redacted>").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"$1<redacted>")}function T0($,q={}){fz1($,q);let I=`${JSON.stringify($,null,2)}
`;if(q.outputFile){yz1(q.outputFile,I),console.log(JSON.stringify({outputFile:q.outputFile,bytes:Buffer.byteLength(I,"utf-8")},null,2));return}console.log(I.trimEnd())}function fz1($,q={}){if(q.allowFull||q.outputFile)return;let I=Buffer.byteLength(JSON.stringify($),"utf-8");if(I>kz1)throw Error(`Output is large (${I} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function UZ0($,q){if(q)return;let I=$&&typeof $==="object"?$:{},U=typeof I.count==="number"?I.count:void 0,Y=Array.isArray(I.rules)?I.rules.length:void 0,J=Buffer.byteLength(JSON.stringify($),"utf-8"),Q=U??Y??0;if(Q>uz1||J>xz1)throw Error(`Rule list is large (${Q} rules, ${J} bytes). Use "seal-use rules list --summary" or "seal-use rules count"; pass --full only when you really need full descriptions.`)}function L0($){return{allowFull:C0($.full)===!0,outputFile:x($.outputFile)??x($["output-file"])}}function YZ0(){console.log(`seal-use CLI
Usage:
seal-use version
@@ -93,6 +330,8 @@ Usage:
seal-use config paths
seal-use config get
seal-use config mode <stateful|stateless> [--corp <corpId>]
seal-use config test-dir [<path>|--clear]
seal-use config lint [status|enable|disable] [--linter <name|path>] [--min-score <score>]
seal-use update [--check] [--force] [--version <v>]
seal-use update check
seal-use update changelog [--limit <n>]
@@ -127,6 +366,8 @@ Usage:
seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--corp <corpId>]
seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--corp <corpId>]
seal-use webhook delete <idOrName> --yes [--corp <corpId>]
seal-use webhook material-pack preview <材料包.zip|信息表.xlsx> [--corp <corpId>]
seal-use webhook material-pack push <材料包.zip|信息表.xlsx> --webhook <idOrName> [--corp <corpId>]
seal-use deploy hosecloud requirements [--corp <corpId>]
seal-use deploy hosecloud list [--corp <corpId>]
seal-use deploy hosecloud get <sign-key> [--corp <corpId>]
@@ -159,6 +400,7 @@ Usage:
seal-use approval-runs cited-rules <recordId> [--corp <corpId>]
seal-use approval-runs document-summary <recordId> [--corp <corpId>]
seal-use approval-runs attachments <recordId> [--summary] [--corp <corpId>]
seal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>] [--corp <corpId>]
seal-use approval-runs result <recordId> [--summary] [--corp <corpId>]
seal-use approval-runs url [--corp <corpId>]
seal-use approval-runs url <recordId> [--corp <corpId>]
@@ -176,12 +418,12 @@ Usage:
seal-use simulation templates [--corp <corpId>]
seal-use simulation integrations [--corp <corpId>]
seal-use simulation package-upload <材料包.zip> [--corp <corpId>]
`)}function Nn(n){let i=Hi(),r=Vn();return xr(i,{stateful:r.stateful,defaultCorpId:r.defaultCorpId,corpId:n},Et())}function Cu(n=Vn()){return{mode:n.stateful?"stateful":"stateless",stateful:n.stateful,...n.stateful&&n.defaultCorpId?{defaultCorpId:n.defaultCorpId}:{},lint:n.lint,configFile:mr()}}async function J(n,i,r,o,t={}){P(await no(n,i,r,o),t)}async function no(n,i,r,o){let t=_u.find((l)=>l.name===n);if(!t)throw Error(`Unknown Seal tool: ${n}`);let u=Object.fromEntries(Object.entries(o).filter(([,l])=>l!==void 0)),e=t.handler;return e(i,u,{corp:r})}async function DN(n,i,r,o,t){if(n==="summary"){let u=await no("seal_approval_runs_summary",r,o,{date:U(t.options.date),timezone:U(t.options.timezone),limit:en(t.options.limit),startDate:U(t.options.startDate),endDate:U(t.options.endDate),status:U(t.options.status),taskMode:U(t.options.taskMode),manualApprovalStatus:U(t.options.manualApprovalStatus),sourceDocumentSN:U(t.options.sourceDocumentSN),sourceDocumentId:U(t.options.sourceDocumentId),humanResult:U(t.options.humanResult),query:U(t.options.query)});if(u?.matched===0&&u?.total>0)console.error(`提示:在 ${u.date} 未匹配到记录(该企业共有 ${u.total} 条历史记录)。可使用 --date YYYY-MM-DD 指定日期,或运行 seal-use approval-runs list --limit 10 查看最近记录。`);P(u,p(t.options));return}if(n==="stats"){await J("seal_approval_runs_stats",r,o,{since:U(t.options.since),dedupeBy:U(t.options.dedupeBy)??U(t.options["dedupe-by"]),status:U(t.options.status),sourceSystem:U(t.options.sourceSystem)??U(t.options["source-system"]),taskMode:U(t.options.taskMode)??U(t.options["task-mode"])},p(t.options));return}if(n==="count"){await J("seal_approval_runs_count",r,o,{status:U(t.options.status),sourceSystem:U(t.options.sourceSystem)??U(t.options["source-system"]),taskMode:U(t.options.taskMode)??U(t.options["task-mode"]),search:U(t.options.search)??U(t.options.query)},p(t.options));return}if(n==="search"||n==="list"){await J("seal_approval_runs_search",r,o,{limit:en(t.options.limit),offset:en(t.options.offset),startDate:U(t.options.startDate),endDate:U(t.options.endDate),status:U(t.options.status),taskMode:U(t.options.taskMode),manualApprovalStatus:U(t.options.manualApprovalStatus),sourceDocumentSN:U(t.options.sourceDocumentSN),sourceDocumentId:U(t.options.sourceDocumentId),humanResult:U(t.options.humanResult),query:U(t.options.query),includeBridge:_(t.options.includeBridge)},p(t.options));return}if(n==="bridge"){await J("seal_approval_run_langfuse_bridge_get",r,o,{recordId:U(t.options.recordId),sourceDocumentSN:U(t.options.sourceDocumentSN),sourceDocumentId:U(t.options.sourceDocumentId),simulationBatchId:U(t.options.simulationBatchId),limit:en(t.options.limit)},p(t.options));return}if(n==="pick"){let u=i??U(t.options.query)??U(t.options.sn);if(!u)throw Error("Usage: seal-use approval-runs pick --sn <documentSN>");await J("seal_approval_run_pick",r,o,{query:u,sn:U(t.options.sn),batchId:U(t.options.batch)??U(t.options.batchId),latest:_(t.options.latest),fields:U(t.options.fields),limit:en(t.options.limit),includeBridge:_(t.options.includeBridge)},p(t.options));return}if(n==="get"){let u=t.command[2];if(!u)throw Error("Missing approval run recordId");await J("seal_approval_run_get",r,o,{recordId:u,fields:U(t.options.fields),summary:_(t.options.summary)},p(t.options));return}if(n==="cited-rules"){let u=t.command[2];if(!u)throw Error("Usage: seal-use approval-runs cited-rules <recordId>");await J("seal_approval_run_cited_rules_get",r,o,{recordId:u},p(t.options));return}if(n==="document-summary"){let u=t.command[2];if(!u)throw Error("Usage: seal-use approval-runs document-summary <recordId>");await J("seal_approval_run_document_summary_get",r,o,{recordId:u},p(t.options));return}if(n==="attachments"){let u=t.command[2];if(!u)throw Error("Usage: seal-use approval-runs attachments <recordId>");await J("seal_approval_run_attachments_get",r,o,{recordId:u,summary:_(t.options.summary)},p(t.options));return}if(n==="result"){let u=t.command[2];if(!u)throw Error("Usage: seal-use approval-runs result <recordId> [--summary]");await J("seal_approval_run_result_get",r,o,{recordId:u,summary:_(t.options.summary)},p(t.options));return}if(n==="url"){await J("seal_approval_run_url_get",r,o,{recordId:i,sourceDocumentSN:U(t.options.sourceDocumentSN),sourceDocumentId:U(t.options.sourceDocumentId)},p(t.options));return}throw Error(`Unknown approval-runs command: ${n??""}. Run 'seal-use help' for available commands.`)}async function kN(n,i,r){if(n==="diagnose"){P(await bB(i));return}if(n==="hose-link"){let o=en(r.options.expire)??7200;P(await vO(i,o));return}throw Error(`Unknown auth command: ${n??""}. Run 'seal-use help' for available commands.`)}async function bB(n){if(n.source.type!=="hose"){let c=await kn(n),S=await Qi(c);return{corp:{id:n.id,name:n.name,sourceType:n.source.type},ok:!0,stages:[{name:"seal.whoami",ok:!0,user:S.user,tenant:S.tenant}]}}Fv(n.id);let i=n.source,r=i.appKey??i.key,o=i.appSecurity??i.p Line truncated
- `);throw Error(`Missing required parameter: staffId. Found ${Wn.length} candidate administrators:
- ${jn}
Please specify 'staffId', 'staffName', or 'staffPhone' to explicitly select an account (or pass force:true to bypass).`)}}}if(!S)if(!g&&u)S=u;else throw Error("Missing required parameter: staffId (or proxyStaffBizId). Run 'seal-use corps hose-staffs' to discover available administrators.");let d=Un(n,"id")??w,O=f??w,F=Un(n,"sealUrl")??`https://${w.toLowerCase()}.sealai.cc`,Q={id:d,name:O,seal:{url:F,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"hose",domain:b,appKey:r,appSecurity:o,corpId:w,staffId:S},auth:{refreshTtl:300}};if(g)Fv(d),await io(Q);let W=$4();WN(W,{recursive:!0,mode:448});let L=pN(W,`${V4(d)}.json`);if(GN(L)&&n.overwrite!==!0)throw Error(`Enterprise config already exists: ${L}. Pass "overwrite": true to replace it.`);jN(L,`${JSON.stringify(Q,null,2)}
`,{mode:384}),P({id:d,name:O,corpId:w,domain:b,staffId:S,verified:g,path:L})}async function SB(n){let i=dt(n,"token"),r=(Un(n,"sealUrl")??Un(n,"url")??"").replace(/\/+$/,"");if(!r)throw Error("Missing required JSON field: sealUrl");let o=$N(n,"expiresIn")??2592000,t=n.force===!0||n.verify===!1?!1:!0,u=t?await kB(r,i):void 0;XN(n,{token:i,sealUrl:r,expiresIn:o,verify:t,remote:u})}async function AB(n,i,r){let o=await Kv(n),t=Yu(o.sealUrl,o.token),u=await Qi(t),e={user:u.user,tenant:u.tenant};Bv(o.corpId,e.tenant),XN({id:o.corpId,corpId:o.corpId,name:i,provider:"hosecloud",overwrite:r},{token:o.token,sealUrl:o.sealUrl,expiresIn:o.expiresIn,verify:!0,remote:e})}function XN(n,i){let{token:r,sealUrl:o,expiresIn:t,verify:u,remote:e}=i,l=e?.user,$=e?.tenant,I=Un(n,"tenantSlug")??Ot($?.tenantSlug),g=Un(n,"tenantId")??Ot($?.id),b=Un(n,"tenantName")??Ot($?.name),w=Un(n,"id")??I??g;if(!w)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let f=Un(n,"staffId")??Ot(l?.providerUserId)??Ot(l?.id)??"seal",c=Un(n,"provider")??Ot(l?.provider)??Ot($?.providerConfig?.provider),S=Un(n,"corpId")??I??g??w,d={id:w,name:Un(n,"name")??b??w,seal:{url:o,tenantSlug:I,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:r,sealUrl:o,expiresIn:t,staffId:f,corpId:S,tenantId:g,tenantSlug:I,tenantName:b,providerUserId:Ot(l?.providerUserId),provider:c},auth:{refreshTtl:300}},O=$4();WN(O,{recursive:!0,mode:448});let F=pN(O,`${V4(w)}.json`);if(GN(F)&&n.overwrite!==!0)throw Error(`Enterprise config already exists: ${F}. Pass "overwrite": true to replace it.`);jN(F,`${JSON.stringify(d,null,2)}
`,{mode:384}),P({id:w,name:d.name,tenantId:g,tenantSlug:I,verified:u,path:F})}async function kB(n,i){let r=await dB(`${n}/api/v1/auth/me`,{authorization:`Bearer ${i}`}),o=l$(r.data);return{user:l$(o.user??r.user),tenant:l$(o.tenant??r.tenant)}}async function dB(n,i={}){let r=await fetch(n,{headers:i}),o=await r.text();if(!r.ok)throw Error(`${r.status} ${o}`);let t=JSON.parse(o);return l$(t)}function l$(n){return n&&typeof n==="object"&&!Array.isArray(n)?n:{}}function Ot(n){return typeof n==="string"&&n?n:void 0}async function HN(n,i){let r=await Kv(n),o=Yu(r.sealUrl,r.token),t=await Qi(o);Bv(r.corpId,t.tenant);let u=await ar(o,{note:i});P({tenant:{id:t.tenant.id,name:t.tenant.name,tenantSlug:t.tenant.tenantSlug,corpId:r.corpId},user:{id:t.user.id,name:t.user.name,providerUserId:t.user.providerUserId,isAdmin:t.user.isAdmin},delegation:u,expiresIn:r.expiresIn})}async function YN(n,i,r,o,t){if(n==="list"){await J("seal_delegation_list",r,o,{},p(t.options));return}if(n==="create"){let u=U(t.options.note)??(i?[i,...t.command.slice(2)].join(" "):void 0);await J("seal_delegation_create",r,o,{note:u},p(t.options));return}if(n==="revoke"){let u=i??U(t.options.tokenId);if(!u)throw Error("Usage: seal-use delegation revoke <tokenId>");await J("seal_delegation_revoke",r,o,{tokenId:u},p(t.options));return}throw Error(`Unknown delegation command: ${n??""}. Run 'seal-use help' for available commands.`)}import{readFileSync as OB}from"node:fs";async function QN(n,i,r,o,t,u){if(!n||n==="help")throw Error(`Usage: seal-use deploy <system> <action> [options]
`)}function L4($){let q=X8(),I=P4();return DI(q,{stateful:I.stateful,defaultCorpId:I.defaultCorpId,corpId:$},x7())}function Yq($=P4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:k7()}}async function O0($,q,I,U,Y={}){T0(await Jq($,q,I,U),Y)}async function Jq($,q,I,U){let Y=Hz.find((K)=>K.name===$);if(!Y)throw Error(`Unknown Seal tool: ${$}`);let J=Object.fromEntries(Object.entries(U).filter(([,K])=>K!==void 0)),Q=Y.handler;return Q(q,J,{corp:I})}async function JZ0($,q,I,U,Y){if($==="summary"){let J=await Jq("seal_approval_runs_summary",I,U,{date:x(Y.options.date),timezone:x(Y.options.timezone),limit:e0(Y.options.limit),startDate:x(Y.options.startDate),endDate:x(Y.options.endDate),status:x(Y.options.status),taskMode:x(Y.options.taskMode),manualApprovalStatus:x(Y.options.manualApprovalStatus),sourceDocumentSN:x(Y.options.sourceDocumentSN),sourceDocumentId:x(Y.options.sourceDocumentId),humanResult:x(Y.options.humanResult),query:x(Y.options.query)});if(J?.matched===0&&J?.total>0)console.error(`提示:在 ${J.date} 未匹配到记录(该企业共有 ${J.total} 条历史记录)。可使用 --date YYYY-MM-DD 指定日期,或运行 seal-use approval-runs list --limit 10 查看最近记录。`);T0(J,L0(Y.options));return}if($==="stats"){await O0("seal_approval_runs_stats",I,U,{since:x(Y.options.since),dedupeBy:x(Y.options.dedupeBy)??x(Y.options["dedupe-by"]),status:x(Y.options.status),sourceSystem:x(Y.options.sourceSystem)??x(Y.options["source-system"]),taskMode:x(Y.options.taskMode)??x(Y.options["task-mode"])},L0(Y.options));return}if($==="count"){await O0("seal_approval_runs_count",I,U,{status:x(Y.options.status),sourceSystem:x(Y.options.sourceSystem)??x(Y.options["source-system"]),taskMode:x(Y.options.taskMode)??x(Y.options["task-mode"]),search:x(Y.options.search)??x(Y.options.query)},L0(Y.options));return}if($==="search"||$==="list"){await O0("seal_approval_runs_search",I,U,{limit:e0(Y.options.limit),offset:e0(Y.options.offset),startDate:x(Y.options.startDate),endDate:x(Y.options.endDate),status:x(Y.options.status),taskMode:x(Y.options.taskMode),manualApprovalStatus:x(Y.options.manualApprovalStatus),sourceDocumentSN:x(Y.options.sourceDocumentSN),sourceDocumentId:x(Y.options.sourceDocumentId),humanResult:x(Y.options.humanResult),query:x(Y.options.query),includeBridge:C0(Y.options.includeBridge)},L0(Y.options));return}if($==="bridge"){await O0("seal_approval_run_langfuse_bridge_get",I,U,{recordId:x(Y.options.recordId),sourceDocumentSN:x(Y.options.sourceDocumentSN),sourceDocumentId:x(Y.options.sourceDocumentId),simulationBatchId:x(Y.options.simulationBatchId),limit:e0(Y.options.limit)},L0(Y.options));return}if($==="pick"){let J=q??x(Y.options.query)??x(Y.options.sn);if(!J)throw Error("Usage: seal-use approval-runs pick --sn <documentSN>");await O0("seal_approval_run_pick",I,U,{query:J,sn:x(Y.options.sn),batchId:x(Y.options.batch)??x(Y.options.batchId),latest:C0(Y.options.latest),fields:x(Y.options.fields),limit:e0(Y.options.limit),includeBridge:C0(Y.options.includeBridge)},L0(Y.options));return}if($==="get"){let J=Y.command[2];if(!J)throw Error("Missing approval run recordId");await O0("seal_approval_run_get",I,U,{recordId:J,fields:x(Y.options.fields),summary:C0(Y.options.summary)},L0(Y.options));return}if($==="cited-rules"){let J=Y.command[2];if(!J)throw Error("Usage: seal-use approval-runs cited-rules <recordId>");await O0("seal_approval_run_cited_rules_get",I,U,{recordId:J},L0(Y.options));return}if($==="document-summary"){let J=Y.command[2];if(!J)throw Error("Usage: seal-use approval-runs document-summary <recordId>");await O0("seal_approval_run_document_summary_get",I,U,{recordId:J},L0(Y.options));return}if($==="attachments"){if(Y.command[2]==="download"){let w=Y.command[3];if(!w)throw Error("Usage: seal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>]");let G=await W6(I,w),H=await bH({record:G,all:C0(Y.options.all),name:x(Y.options.name),outDir:x(Y.options["out-dir"])??x(Y.options.outDir)??x(Y.options.dir)});if(T0(H,L0(Y.options)),H.total>0&&H.downloaded===0)throw Error(`所有 ${H.total} 个附件下载均失败。`);return}let Q=Y.command[2];if(!Q)throw Error("Usage: seal-use approval-runs attachments <recordId> | seal-use approval-runs attachments download <recordId>");if(C0(Y.options.download)){let w=await W6(I,Q),G=await bH({record:w,all:C0(Y.options.all)??!0,name:x(Y.options.name),outDir:x(Y.options["out-dir"])??x(Y.options.outDir)??x(Y.options.dir)});if(T0(G,L0(Y.options)),G.total>0&&G.downloaded===0)throw Error(`所有 ${G.total} 个附件下载均失败。`);return}let K=await W6(I,Q),z=XI(K,{summary:C0(Y.options.summary)});T0(z,L0(Y.options));return}if($==="download"){let J=Y.command[2];if(!J)throw Error("Usage: seal-use approval-runs download <recordId> [--all] [--name <n Line truncated
- `);throw Error(`Missing required parameter: staffId. Found ${S.length} candidate administrators:
- ${t}
Please specify 'staffId', 'staffName', or 'staffPhone' to explicitly select an account (or pass force:true to bypass).`)}}}if(!D)if(!G&&J)D=J;else throw Error("Missing required parameter: staffId (or proxyStaffBizId). Run 'seal-use corps hose-staffs' to discover available administrators.");let L=b1($,"id")??V,N=W??V,E=b1($,"sealUrl")??`https://${V.toLowerCase()}.sealai.cc`,T={id:L,name:N,seal:{url:E,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"hose",domain:H,appKey:I,appSecurity:U,corpId:V,staffId:D},auth:{refreshTtl:300}};if(G)TH(L),await PY(T);let P=xE();XZ0(P,{recursive:!0,mode:448});let B=LZ0(P,`${wu(L)}.json`);if(ZZ0(B)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${B}. Pass "overwrite": true to replace it.`);DZ0(B,`${JSON.stringify(T,null,2)}
`,{mode:384}),T0({id:L,name:N,corpId:V,domain:H,staffId:D,verified:G,path:B})}async function lz1($){let q=Z7($,"token"),I=(b1($,"sealUrl")??b1($,"url")??"").replace(/\/+$/,"");if(!I)throw Error("Missing required JSON field: sealUrl");let U=aW0($,"expiresIn")??2592000,Y=$.force===!0||$.verify===!1?!1:!0,J=Y?await oz1(I,q):void 0;NZ0($,{token:q,sealUrl:I,expiresIn:U,verify:Y,remote:J})}async function mz1($,q,I){let U=await EH($),Y=zQ(U.sealUrl,U.token),J=await W8(Y),Q={user:J.user,tenant:J.tenant};gH(U.corpId,Q.tenant),NZ0({id:U.corpId,corpId:U.corpId,name:q,provider:"hosecloud",overwrite:I},{token:U.token,sealUrl:U.sealUrl,expiresIn:U.expiresIn,verify:!0,remote:Q})}function NZ0($,q){let{token:I,sealUrl:U,expiresIn:Y,verify:J,remote:Q}=q,K=Q?.user,z=Q?.tenant,w=b1($,"tenantSlug")??X7(z?.tenantSlug),G=b1($,"tenantId")??X7(z?.id),H=b1($,"tenantName")??X7(z?.name),V=b1($,"id")??w??G;if(!V)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let W=b1($,"staffId")??X7(K?.providerUserId)??X7(K?.id)??"seal",X=b1($,"provider")??X7(K?.provider)??X7(z?.providerConfig?.provider),D=b1($,"corpId")??w??G??V,L={id:V,name:b1($,"name")??H??V,seal:{url:U,tenantSlug:w,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:I,sealUrl:U,expiresIn:Y,staffId:W,corpId:D,tenantId:G,tenantSlug:w,tenantName:H,providerUserId:X7(K?.providerUserId),provider:X},auth:{refreshTtl:300}},N=xE();XZ0(N,{recursive:!0,mode:448});let E=LZ0(N,`${wu(V)}.json`);if(ZZ0(E)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${E}. Pass "overwrite": true to replace it.`);DZ0(E,`${JSON.stringify(L,null,2)}
`,{mode:384}),T0({id:V,name:L.name,tenantId:G,tenantSlug:w,verified:J,path:E})}async function oz1($,q){let I=await rz1(`${$}/api/v1/auth/me`,{authorization:`Bearer ${q}`}),U=ZL(I.data);return{user:ZL(U.user??I.user),tenant:ZL(U.tenant??I.tenant)}}async function rz1($,q={}){let I=await fetch($,{headers:q}),U=await I.text();if(!I.ok)throw Error(`${I.status} ${U}`);let Y=JSON.parse(U);return ZL(Y)}function ZL($){return $&&typeof $==="object"&&!Array.isArray($)?$:{}}function X7($){return typeof $==="string"&&$?$:void 0}async function FZ0($,q){let I=await EH($),U=zQ(I.sealUrl,I.token),Y=await W8(U);gH(I.corpId,Y.tenant);let J=await VI(U,{note:q});T0({tenant:{id:Y.tenant.id,name:Y.tenant.name,tenantSlug:Y.tenant.tenantSlug,corpId:I.corpId},user:{id:Y.user.id,name:Y.user.name,providerUserId:Y.user.providerUserId,isAdmin:Y.user.isAdmin},delegation:J,expiresIn:I.expiresIn})}async function MZ0($,q,I,U,Y){if($==="list"){await O0("seal_delegation_list",I,U,{},L0(Y.options));return}if($==="create"){let J=x(Y.options.note)??(q?[q,...Y.command.slice(2)].join(" "):void 0);await O0("seal_delegation_create",I,U,{note:J},L0(Y.options));return}if($==="revoke"){let J=q??x(Y.options.tokenId);if(!J)throw Error("Usage: seal-use delegation revoke <tokenId>");await O0("seal_delegation_revoke",I,U,{tokenId:J},L0(Y.options));return}throw Error(`Unknown delegation command: ${$??""}. Run 'seal-use help' for available commands.`)}import{readFileSync as tz1}from"node:fs";async function AZ0($,q,I,U,Y,J){if(!$||$==="help")throw Error(`Usage: seal-use deploy <system> <action> [options]
`+`支持的审批系统与发布目标:
`+` • hosecloud (合思费控): seal-use deploy hosecloud <requirements|list|get|status|configure|sync> --corp <corpId>
@@ -189,18 +431,25 @@ Please specify 'staffId', 'staffName', or 'staffPhone' to explicitly select an a
`+` • feishu (飞书审批): 建议使用 Webhook 模式对接
`+` • weaver (泛微 OA): 建议使用 Webhook 模式对接
`+` • helios (汇联易): 建议使用 Webhook 模式对接
`+" • maycur (每刻报销): 建议使用 Webhook 模式对接");if(n==="webhook"||n==="webhooks")throw Error("Webhook 审批流发布请直接使用专有命令:seal-use webhook <list|get|add|update|delete> --corp <corpId>");if(n==="feishu"||n==="lark")throw Error("飞书审批发布:建议使用 Webhook 通用发布模式对接。命令:seal-use webhook add --name '飞书审批' --result-url <url> --corp <corpId>");if(n==="weaver")throw Error("泛微 OA 发布:建议使用 Webhook 通用发布模式对接。命令:seal-use webhook add --name '泛微OA' --result-url <url> --corp <corpId>");if(n==="maycur"||n==="helios"){let I=n==="maycur"?"每刻报销":"汇联易";throw Error(`${I}发布:目前可通过 Webhook 模式接入。命令:seal-use webhook add --name '${I}' --result-url <url> --corp <corpId>`)}let e=n==="hosecloud",l=n==="hosecloud"?i:n,$=n==="hosecloud"?r:i;if(!e)throw Error(`未知的发布目标系统: ${n}。当前支持: hosecloud (合思费控) 与 webhook (通用回调)。`);if(l==="requirements"){await J("seal_deploy_hosecloud_requirements",o,t,{},p(u.options));return}if(l==="list"){await J("seal_deploy_hosecloud_list",o,t,{},p(u.options));return}if(l==="get"){let I=$??U(u.options.signKey)??U(u.options["sign-key"]);if(!I)throw Error("Usage: seal-use deploy hosecloud get <sign-key>");await J("seal_deploy_hosecloud_get",o,t,{signKey:I},p(u.options));return}if(l==="status"){await J("seal_deploy_hosecloud_status",o,t,{},p(u.options));return}if(l==="configure"){let I=U(u.options.input),g=I?JSON.parse(OB(I,"utf8")):oi(u.json);if(!g||Object.keys(g).length===0)throw Error("Usage: seal-use deploy hosecloud configure --json '{...}' or --input <file>");await J("seal_deploy_hosecloud_configure",o,t,g,p(u.options));return}if(l==="sync"){let I=$??U(u.options.signKey)??U(u.options["sign-key"]);if(!I)throw Error("Usage: seal-use deploy hosecloud sync <sign-key>");await J("seal_deploy_hosecloud_sync",o,t,{signKey:I},p(u.options));return}throw Error(`Unknown deploy hosecloud action: ${l??""}. Available: requirements, list, get, status, configure, sync.`)}import{createServer as WB}from"node:http";import{URL as NB}from"node:url";var FN={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.4",description:`Planned HTTP contract for the seal-use wrapped backend API.
`+" • maycur (每刻报销): 建议使用 Webhook 模式对接");if($==="webhook"||$==="webhooks")throw Error("Webhook 审批流发布请直接使用专有命令:seal-use webhook <list|get|add|update|delete> --corp <corpId>");if($==="feishu"||$==="lark")throw Error("飞书审批发布:建议使用 Webhook 通用发布模式对接。命令:seal-use webhook add --name '飞书审批' --result-url <url> --corp <corpId>");if($==="weaver")throw Error("泛微 OA 发布:建议使用 Webhook 通用发布模式对接。命令:seal-use webhook add --name '泛微OA' --result-url <url> --corp <corpId>");if($==="maycur"||$==="helios"){let w=$==="maycur"?"每刻报销":"汇联易";throw Error(`${w}发布:目前可通过 Webhook 模式接入。命令:seal-use webhook add --name '${w}' --result-url <url> --corp <corpId>`)}let Q=$==="hosecloud",K=$==="hosecloud"?q:$,z=$==="hosecloud"?I:q;if(!Q)throw Error(`未知的发布目标系统: ${$}。当前支持: hosecloud (合思费控) 与 webhook (通用回调)。`);if(K==="requirements"){await O0("seal_deploy_hosecloud_requirements",U,Y,{},L0(J.options));return}if(K==="list"){await O0("seal_deploy_hosecloud_list",U,Y,{},L0(J.options));return}if(K==="get"){let w=z??x(J.options.signKey)??x(J.options["sign-key"]);if(!w){let H=((await K4(U)).integrations??[]).filter((V)=>V.type==="hosecloud");if(H.length===0)throw Error(`当前企业 (${Y.name}) 尚未添加合思发布配置。
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${Y.id}`);console.error(`Usage: seal-use deploy hosecloud get <sign-key> [--corp ${Y.id}]
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of H){let W=V.outboundName??"SealAI 审批",X=V.signKey,D=V.apiOrigin??"production";console.error(` • "${W}" (signKey: ${X}, 环境: ${D})`),console.error(` \uD83D\uDC49 查看命令: seal-use deploy hosecloud get ${X} --corp ${Y.id}
`)}throw Error("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey。")}await O0("seal_deploy_hosecloud_get",U,Y,{signKey:w},L0(J.options));return}if(K==="status"){await O0("seal_deploy_hosecloud_status",U,Y,{},L0(J.options));return}if(K==="configure"){let w=x(J.options.input),G=w?JSON.parse(tz1(w,"utf8")):a6(J.json);if(!G||Object.keys(G).length===0)throw Error("Usage: seal-use deploy hosecloud configure --json '{...}' or --input <file>");await O0("seal_deploy_hosecloud_configure",U,Y,G,L0(J.options));return}if(K==="sync"){let w=z??x(J.options.signKey)??x(J.options["sign-key"]),G=C0(J.options.auto)??C0(J.options.yes);if(!w){let V=((await K4(U)).integrations??[]).filter((X)=>X.type==="hosecloud");if(V.length===0)throw Error(`当前企业 (${Y.name}) 尚未添加合思发布配置。
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${Y.id}`);let W=V[0];if(W&&V.length===1&&G){let X=W.signKey;console.error(`ℹ️ [auto] 检测到企业仅有 1 个合思配置,已自动选择 (signKey: ${X})`),await O0("seal_deploy_hosecloud_sync",U,Y,{signKey:X},L0(J.options));return}console.error(`Usage: seal-use deploy hosecloud sync <sign-key> [--corp ${Y.id}]
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of V){let D=X.outboundName??"SealAI 审批",L=X.signKey,N=X.apiOrigin??"production";console.error(` • "${D}" (signKey: ${L}, 环境: ${N})`),console.error(` \uD83D\uDC49 同步命令: seal-use deploy hosecloud sync ${L} --corp ${Y.id}
`)}if(V.length===1)console.error(`\uD83D\uDCA1 提示:若希望单配置自动同步,可附加 --auto 参数:seal-use deploy hosecloud sync --auto --corp ${Y.id}
`);throw Error("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。")}await O0("seal_deploy_hosecloud_sync",U,Y,{signKey:w},L0(J.options));return}throw Error(`Unknown deploy hosecloud action: ${K??""}. Available: requirements, list, get, status, configure, sync.`)}import{createServer as qw1}from"node:http";import{URL as sz1}from"node:url";var PZ0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.10",description:`Planned HTTP contract for the seal-use wrapped backend API.
These endpoints describe the intended stable API for frontend developers and agents once
the HTTP adapter is implemented.
They are not the raw downstream Seal endpoints. seal-use is responsible for enterprise
selection, source authentication, response compaction, and diagnostics-friendly fields.
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"2 Line truncated
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"2 Line truncated
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Seal Home API Docs (v${x})</title>
<title>Seal Home API Docs (v${t0})</title>
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>\uD83E\uDDAD</text></svg>" />
<style>
body {
@@ -219,20 +468,21 @@ selection, source authentication, response compaction, and diagnostics-friendly
src="https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.101/dist/browser/standalone.js"
></script>
</body>
</html>`}async function Jn(n,i,r,o){let t=n.handler;return t(i,r,{corp:o})}async function BN(n,i){if(i.setHeader("Access-Control-Allow-Origin","*"),i.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS, PATCH"),i.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization, X-Seal-Corp, X-Seal-Home-Session"),n.method==="OPTIONS"){i.writeHead(204),i.end();return}let r=n.headers.host||"localhost",o=n.headers["x-forwarded-proto"]||"http",t=new NB(n.url||"/",`${o}://${r}`),u=t.pathname.replace(/\/+$/,"")||"/",e=(n.method||"GET").toUpperCase();try{if(e==="GET"&&u==="/"){Sn(i,200,{name:"seal-use",version:x,description:"Seal tenant operations and approval automation HTTP API",docs:"/docs",openapi:"/openapi.json",health:"/health",endpoints:{cli:"POST /api/cli",tools:"GET /api/tools",toolInvoke:"POST /api/tool/:name",restV1:"GET/POST /v1/*"}});return}if(e==="GET"&&u==="/docs"){GB(i,200,KN());return}if(e==="GET"&&u==="/openapi.json"){Sn(i,200,v$());return}if(e==="GET"&&u==="/health"){Sn(i,200,{status:"ok",version:x,name:"seal-use",timestamp:new Date().toISOString()});return}if(e==="POST"&&u==="/api/cli"){let l=await I$(n),$=(typeof l?.command==="string"?l.command:"").trim();if(!$){$$(i,400,"Missing 'command' property in request body");return}let I=C4($),g=I[0]==="seal-use"||I[0]==="seal-home"||I[0]?.endsWith("/seal-use")||I[0]?.endsWith("/seal-home")?I.slice(1):I,b=await hu(g),w=void 0;try{if(b.stdout.trim().startsWith("{")||b.stdout.trim().startsWith("["))w=JSON.parse(b.stdout)}catch{}Sn(i,b.isError?400:200,{success:!b.isError,stdout:b.stdout,stderr:b.stderr,exitCode:b.exitCode,data:w});return}if(e==="POST"&&u.startsWith("/api/tool/")){let l=u.slice(10).trim(),$=Gn(l,{includeMcpAliases:!0});if(!$){$$(i,404,`Tool not found: '${l}'`);return}let I=await I$(n)||{},g=hn(n,t,I),b=Nn(g),w=await kn(b),f={...I};delete f.corp;let c=await Jn($,w,f,b);Sn(i,200,c);return}if(u.startsWith("/v1/")){if(await yB(n,i,e,u,t))return}$$(i,404,`Cannot ${e} ${u}. Visit /docs for available endpoints.`)}catch(l){let $=l instanceof Error?l.message:String(l);$$(i,500,$)}}async function yB(n,i,r,o,t){let u=Object.fromEntries(t.searchParams.entries());if(r==="GET"&&o==="/v1/corps"){let e=Hi(),l=Vn();return Sn(i,200,{count:e.length,mode:l.stateful?"stateful":"stateless",defaultCorpId:l.defaultCorpId,corps:e.map(($)=>({id:$.id,name:$.name,sourceType:$.source.type,sealUrl:$.seal?.url}))}),!0}if(r==="GET"&&o==="/v1/whoami"){let e=hn(n,t,u),l=Nn(e),$=await kn(l),I=Gn("seal_whoami"),g=await Jn(I,$,{},l);return Sn(i,200,g),!0}if(r==="GET"&&o==="/v1/session"){let e=hn(n,t,u),l=Nn(e),$=await kn(l),I=Gn("seal_session_get"),g=await Jn(I,$,{},l);return Sn(i,200,g),!0}if(r==="GET"&&o==="/v1/approval-runs/summary"){let e=hn(n,t,u),l=Nn(e),$=await kn(l),I=Gn("seal_approval_runs_summary"),g=await Jn(I,$,u,l);return Sn(i,200,g),!0}if(r==="GET"&&o==="/v1/approval-runs/stats"){let e=hn(n,t,u),l=Nn(e),$=await kn(l),I=Gn("seal_approval_runs_stats"),g=await Jn(I,$,u,l);return Sn(i,200,g),!0}if(r==="GET"&&o==="/v1/approval-runs/pick"){let e=hn(n,t,u),l=Nn(e),$=await kn(l),I=Gn("seal_approval_run_pick"),g=await Jn(I,$,u,l);return Sn(i,200,g),!0}if(r==="GET"&&o==="/v1/approval-runs/url"){let e=hn(n,t,u),l=Nn(e),$=await kn(l),I=Gn("seal_approval_run_url_get"),g=await Jn(I,$,u,l);return Sn(i,200,g),!0}if(o.startsWith("/v1/approval-runs/")){let e=o.slice(18).split("/"),l=e[0],$=e[1];if(l&&!["summary","pick","stats","url","bridge"].includes(l)){let I=hn(n,t,u),g=Nn(I),b=await kn(g);if(!$){let w=Gn("seal_approval_run_get"),f=await Jn(w,b,{recordId:l,...u},g);return Sn(i,200,f),!0}if($==="attachments"){let w=Gn("seal_approval_run_attachments_get"),f=await Jn(w,b,{recordId:l,...u},g);return Sn(i,200,f),!0}if($==="cited-rules"){let w=Gn("seal_approval_run_cited_rules_get"),f=await Jn(w,b,{recordId:l,...u},g);return Sn(i,200,f),!0}if($==="document-summary"){let w=Gn("seal_approval_run_document_summary_get"),f=await Jn(w,b,{recordId:l,...u},g);return Sn(i,200,f),!0}if($==="result"){let w=Gn("seal_approval_run_result_get"),f=await Jn(w,b,{recordId:l,...u},g);return Sn(i,200,f),!0}}}if(r==="GET"&&o==="/v1/approval-runs"){let e=hn(n,t,u),l=Nn(e),$=await kn(l),I=Gn("seal_approval_runs_search"),g=await Jn(I,$,{...u,limit:u.limit?Number(u.limit):void 0,offset:u.offset?Number(u.offset):void 0,includeBridge:u.includeBridge==="true"},l);return Sn(i,200,g),!0}if(r==="GET"&&o==="/v1/approval/rules"){let e=hn(n,t,u),l=Nn(e),$=await kn(l),I=Gn("seal_approval_rules_list"),g=await Jn(I,$,u,l);return Sn(i,200,g),!0}if(r==="GET"&&o==="/v1/simulation/batches"){let e=hn(n,t,u),l=Nn(e),$=await kn(l),I=Gn("seal_simulation_batches_list"),g=await Jn(I,$,u,l);return Sn(i,200,g),!0}if(r==="POST"&&o==="/v1/simulation/create-batch"){let e=await I$(n)||{},l=hn(n,t,e),$=Nn(l),I=await kn($),g=Gn("seal_simulation_batch_create"),b=await Jn(g,I,e,$);return Sn(i,200,b),!0}if(r==="GET"&&o.startsWith("/v1/simulation/batch/")){let l=o.slice(21).split("/")[0];if(l){let $=hn(n,t,u),I=NnLine truncated
\uD83D\uDE80 seal-use HTTP Server (v${x}) started`),console.error(` URL: http://${r}:${i}`),console.error(` Docs: http://${r}:${i}/docs`),console.error(` OpenAPI: http://${r}:${i}/openapi.json`),console.error(` CLI Exec: POST http://${r}:${i}/api/cli`),console.error(` REST API: http://${r}:${i}/v1/...
`);t(o)})})}async function TN(n){let i=en(n.options.port)??en(n.options.p),r=U(n.options.host)??U(n.options.h),o=await PN({port:i,host:r}),t=()=>{o.close(()=>{process.exit(0)})};process.on("SIGINT",t),process.on("SIGTERM",t),await new Promise(()=>{})}async function EN(n,i,r,o){if(n==="config"||n==="get"){await J("seal_llm_config_get",i,r,{},p(o.options));return}if(n==="providers"||n==="list"){await J("seal_llm_providers_list",i,r,{},p(o.options));return}throw Error(`Unknown llm command: ${n??""}. Run 'seal-use help' for available commands.`)}async function VN(n,i){if(n==="config"||n==="json"){R4();return}await h4()}function R4(){P({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function qN(n){let i=v$();P(i,{...p(n.options),allowFull:!0})}async function _N(n,i,r,o){if(n==="available"){await J("seal_permissions_available_list",i,r,{},p(o.options));return}if(n==="configs"||n==="list"){await J("seal_permissions_configs_list",i,r,{},p(o.options));return}throw Error(`Unknown permissions command: ${n??""}. Run 'seal-use help' for available commands.`)}import{readFileSync as ZN}from"node:fs";async function MN(n,i,r,o,t,u,e){if(!n||n==="get"){await J("seal_preference_get",t,u,{},p(e.options));return}if(n==="decision"){if(i==="update"||!i){let l=U(e.options.input),$=l?JSON.parse(ZN(l,"utf8")):oi(e.json);if(!$||Object.keys($).length===0)throw Error(`Usage: seal-use preference decision update --json '{"explicitApprove":"..."}'`);await J("seal_preference_decision_update",t,u,$,p(e.options));return}}if(n==="thinking-depth"||n==="thinkingDepth"){if(i==="set"){let l=U(e.options.default)??U(e.options.level)??o;if(l!=="medium"&&l!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await J("seal_preference_thinking_depth_set",t,u,{defaultLevel:l},p(e.options));return}if(i==="policies"){if(r==="list"||!r){await J("seal_preference_thinking_depth_policies_list",t,u,{},p(e.options));return}if(r==="upsert"){let l=U(e.options.input),$=l?JSON.parse(ZN(l,"utf8")):oi(e.json);if(!$||!$.id||!$.name)throw Error(`Usage: seal-use preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await J("seal_preference_thinking_depth_policies_upsert",t,u,$,p(e.options));return}if(r==="remove"||r==="delete"){let l=o??U(e.options.id)??U(e.options.policyId);if(!l)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await J("seal_preference_thinking_depth_policies_remove",t,u,{policyId:l},p(e.options));return}}}throw Error(`Unknown preference action: ${n??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}async function zN(n={}){let i=Hi(),r=Vn(),o=xr(i,{stateful:r.stateful,defaultCorpId:r.defaultCorpId,corpId:n.corpId},Et());console.log(`[probe] corp=${o.id} source=${o.source.type}`);let t=await io(o);console.log("[probe] seal enterprise"),console.log(JSON.stringify(t,null,2));let u=await kn(o),e=await av(u,{documentLimit:20,stylePreferencesEndpoint:o.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:e.rules.rules.length,hasPendingRuleDeletes:e.rules.hasPendingDeletes,documents:e.documents.articles.length,documentsTotal:e.documents.total,stylePreferences:e.stylePreferences.ok?"ok":`error: ${e.stylePreferences.error}`},null,2))}async function CN(n,i,r){let o=i??U(r.options.corp)??(n&&n!=="--corp"?n:void 0);await zN({corpId:o})}async function RN(n,i,r,o,t){if(n==="count"){await J("seal_approval_rules_list",r,o,{countOnly:!0},p(t.options));return}if(n==="list"){if(_(t.options.count)){await J("seal_approval_rules_list",r,o,{countOnly:!0},p(t.options));return}let u=en(t.options.limit),e=en(t.options.offset);if(_(t.options.summary)){await J("seal_approval_rules_list",r,o,{fields:fN,limit:u,offset:e},p(t.options));return}let l=await no("seal_approval_rules_list",r,o,{limit:u,offset:e});cN(l,_(t.options.full)===!0),P(l);return}if(n==="clear"){let u=_(t.options.yes)===!0,e=_(t.options.dryRun)??_(t.options["dry-run"])??!u;if(!u&&!e)throw Error("Refusing to clear rules without --yes. Use --dry-run to preview.");let l=await no("seal_approval_rules_clear",r,o,{dryRun:e,recode:_(t.options.recode)});if(!u&&e&&l&&typeof l==="object"){P({...l,nextCommand:`seal-use rules clear --corp ${o.id} --yes`},p(t.options));return}P(l,p(t.options));return}if(n==="versions"){await J("seal_approval_rule_versions_list",r,o,{},p(t.options));return}if(n==="version"){let u=i??U(t.options.version);if(!u)throw Error("Usage: seal-use rules version <versionId|versionNumber|latest>");await J("seal_approval_rule_version_get",r,o,Zu(u),p(t.options));return}if(n==="get"){await J("seal_approval_rule_get",r,o,{...wN(U(t.options.version)),code:U(t.options.code),runtimeId:U(t.options.runtimeId)??U(t.options["runtime-id"]),recordId:U(t.options.recordId)??U(t.options["record-id"])},p(t.options));return}if( Line truncated
`,{mode:384}),b$(r,`running pid=${process.pid}`);let o=()=>{if(x4(i)===process.pid)g$(i,{force:!0});b$(r,`stopped pid=${process.pid}`)};await new Promise((t)=>{let u=!1,e=setInterval(()=>{},60000),l=()=>{if(u)return;u=!0,o(),clearInterval(e),process.off("SIGTERM",l),process.off("SIGINT",l),t()};process.once("SIGTERM",l),process.once("SIGINT",l)})}function hN(n){sN(n.stateDir);let i=to(n);if(i.running)return i;let r=n.launcher??{command:process.execPath,args:[n.entryFile]},o=jB(r.command,[...r.args??[],"service","run"],{cwd:n.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});o.unref();let t=w$(n);return m4(t,`${o.pid}
`,{mode:384}),b$(f$(n),`started pid=${o.pid}`),{started:!0,...to(n)}}function mN(n,i={}){let r=w$(n),o=x4(r);if(!o||!aN(o,n.appRoot))return g$(r,{force:!0}),i.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(o,"SIGTERM"),g$(r,{force:!0}),b$(f$(n),`stop requested pid=${o}`),i.quiet?void 0:{stopped:!0,pid:o}}function aN(n,i){if(!QB(n))return!1;try{let r=pB("ps",["-p",String(n),"-o","command="],{encoding:"utf8"});return(r.includes(i)||r.includes("seal-use")||r.includes("src/cli.ts"))&&r.includes("service")&&r.includes("run")}catch{return!1}}function QB(n){try{return process.kill(n,0),!0}catch{return!1}}function w$(n){return xN(n.stateDir,"service.pid")}function f$(n){return xN(n.stateDir,"service.log")}function x4(n){if(!JB(n))return;let i=Number(HB(n,"utf8").trim());return Number.isInteger(i)&&i>0?i:void 0}function sN(n){XB(n,{recursive:!0,mode:448})}function b$(n,i){m4(n,`${new Date().toISOString()} ${i}
`,{flag:"a",mode:384})}var a4=KB(FB(),".config","seal-use");async function ny(n,i){let r=await Mt(n,{appRoot:i.appRoot,entryFile:i.entryFile,stateDir:a4,version:x,launcher:i.launcher});if(r!==void 0)P(r)}import{existsSync as BB,readFileSync as iy}from"node:fs";async function ty(n,i,r,o,t){if(n==="batch-records"||n==="records"){let u=i??U(t.options.batchId)??U(t.options["batch-id"]);if(!u)throw Error("Usage: seal-use simulation batch-records <batchId>");await J("seal_simulation_batch_records_get",r,o,{batchId:u,query:U(t.options.query)},p(t.options));return}if(n==="create"||n==="run"){let u=U(t.options.mode)??U(t.options.sourceSystem)??U(t.options["source-system"])??"hosecloud",e=u==="material-pack"?"material_pack":u,l=U(t.options.schemaConfig)??U(t.options["schema-config"]),$=l?JSON.parse(iy(l,"utf8")):void 0,I=U(t.options.input),g=I?JSON.parse(iy(I,"utf8")):oi(t.json),b=U(t.options.packageId)??U(t.options["package-id"]),w=qn(t.options.packageIds)??qn(t.options["package-ids"])??(b?[b]:void 0),f=qn(t.options.flowIds)??qn(t.options["flow-ids"])??qn(t.options.documentSn)??qn(t.options["document-sn"]),c=U(t.options.signKey)??U(t.options["sign-key"])??U(t.options.integration);await J("seal_simulation_batch_create",r,o,{mode:e,sourceSystem:e,flowIds:f,documentSn:f,rejectNodeName:U(t.options.rejectNode)??U(t.options["reject-node"])??null,thinkingDepthOverride:U(t.options.thinkingDepth)??U(t.options["thinking-depth"]),skipInvoiceGeneration:_(t.options.skipInvoiceGeneration)??_(t.options["skip-invoice-generation"]),skipExpenseExtraction:_(t.options.skipExpenseExtraction)??_(t.options["skip-expense-extraction"]),disableAttachmentCache:_(t.options.disableAttachmentCache)??_(t.options["disable-attachment-cache"]),signKey:c,packageIds:w,packageId:b,templateId:U(t.options.templateId)??U(t.options["template-id"]),schemaConfig:$,requestIds:qn(t.options.requestIds)??qn(t.options["request-ids"]),workflowTypeId:U(t.options.workflowTypeId)??U(t.options["workflow-type-id"]),flowStatusList:qn(t.options.flowStatusList)?.map(Number)??qn(t.options["flow-status-list"])?.map(Number),businessCodes:qn(t.options.businessCodes)??qn(t.options["business-codes"]),documentType:U(t.options.documentType)??U(t.options["document-type"]),startTime:en(t.options.startTime)??en(t.options["start-time"]),endTime:en(t.options.endTime)??en(t.options["end-time"]),status:qn(t.options.status),limit:en(t.options.limit),rawParams:g},p(t.options));return}if(n==="wait"){let u=i??U(t.options.batchId)??U(t.options["batch-id"]);if(!u)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await J("seal_simulation_batch_wait",r,o,{batchId:u,timeout:U(t.options.timeout),pollInterval:U(t.options.pollInterval)??U(t.options["poll-interval"])},p(t.options));return}if(n==="clean"||n==="delete"){let u=i??U(t.options.batchId)??U(t.options["batch-id"]);if(!u)throw Error("Usage: seal-use simulation clean <batchId>");await J("seal_simulation_batch_clean",r,o,{batchId:u},p(t.options));return}if(n==="specifications"){let u=i??U(t.options.integration)??U(t.options.signKey)??U(t.options["sign-key"]);await J("seal_simulation_specifications_list",r,o,{signKey:u},p(t.options));return}if(n==="list"){await J("seal_simulation_batches_list",r,o,{limit:en(t.options.limit)},p(t.options));return}if(n==="get"){let u=i??U(t.options.batchId)??U(t.options["batch-id"]);if(!u)throw Error("Usage: seal-use simulation get <batchId>");await J("seal_simulation_batch_get",r,o,{batchId:u},p(t.options));return}if(n==="templates"){await J("seal_simulation_templates_get",r,o,{},p(t.options));return}if(n==="integrations"){await J("seal_simulation_integrations_get",r,o,{},p(t.options));return}if(n==="package-upload"){let u=i??U(t.options.file);if(!u)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!BB(u))throw Error(`File not found: ${u}`);await J("seal_simulation_material_package_upload",r,o,{filePath:u},p(t.options));return}throw Error(`Unknown simulation command: ${n??""}. Run 'seal-use help' for available commands.`)}import{existsSync as ky}from"node:fs";import{join as c$}from"node:path";import{existsSync as s4,mkdirSync as fy,rmSync as hB,writeFileSync as mB}from"node:fs";import{homedir as cy}from"node:os";import{dirname as xB,join as n0}from"node:path";var ry=`---
</html>`}async function k4($,q,I,U){let Y=$.handler;return Y(q,I,{corp:U})}async function EZ0($,q){if(q.setHeader("Access-Control-Allow-Origin","*"),q.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS, PATCH"),q.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization, X-Seal-Corp, X-Seal-Home-Session"),$.method==="OPTIONS"){q.writeHead(204),q.end();return}let I=$.headers.host||"localhost",U=$.headers["x-forwarded-proto"]||"http",Y=new sz1($.url||"/",`${U}://${I}`),J=Y.pathname.replace(/\/+$/,"")||"/",Q=($.method||"GET").toUpperCase();try{if(Q==="GET"&&J==="/"){d1(q,200,{name:"seal-use",version:t0,description:"Seal tenant operations and approval automation HTTP API",docs:"/docs",openapi:"/openapi.json",health:"/health",endpoints:{cli:"POST /api/cli",tools:"GET /api/tools",toolInvoke:"POST /api/tool/:name",restV1:"GET/POST /v1/*"}});return}if(Q==="GET"&&J==="/docs"){$w1(q,200,TZ0());return}if(Q==="GET"&&J==="/openapi.json"){d1(q,200,XL());return}if(Q==="GET"&&J==="/health"){d1(q,200,{status:"ok",version:t0,name:"seal-use",timestamp:new Date().toISOString()});return}if(Q==="POST"&&(J==="/shutdown"||J==="/api/shutdown")){d1(q,200,{success:!0,message:"Shutting down seal-use background daemon",pid:process.pid}),setTimeout(()=>{process.kill(process.pid,"SIGTERM")},50);return}if(Q==="POST"&&J==="/api/cli"){let K=await LL($),z=(typeof K?.command==="string"?K.command:"").trim();if(!z){DL(q,400,"Missing 'command' property in request body");return}let w=Xu(z),G=w[0]==="seal-use"||w[0]==="seal-home"||w[0]?.endsWith("/seal-use")||w[0]?.endsWith("/seal-home")?w.slice(1):w,H=await Lz(G),V=void 0;try{if(H.stdout.trim().startsWith("{")||H.stdout.trim().startsWith("["))V=JSON.parse(H.stdout)}catch{}d1(q,H.isError?400:200,{success:!H.isError,stdout:H.stdout,stderr:H.stderr,exitCode:H.exitCode,data:V});return}if(Q==="POST"&&J.startsWith("/api/tool/")){let K=J.slice(10).trim(),z=v4(K);if(!z){DL(q,404,`Tool not found: '${K}'`);return}let w=await LL($)||{},G=S6($,Y,w),H=L4(G),V=await I4(H),W={...w};delete W.corp;let X=await k4(z,V,W,H);d1(q,200,X);return}if(J.startsWith("/v1/")){if(await ez1($,q,Q,J,Y))return}DL(q,404,`Cannot ${Q} ${J}. Visit /docs for available endpoints.`)}catch(K){let z=K instanceof Error?K.message:String(K);DL(q,500,z)}}async function ez1($,q,I,U,Y){let J=Object.fromEntries(Y.searchParams.entries());if(I==="GET"&&U==="/v1/corps"){let Q=X8(),K=P4();return d1(q,200,{count:Q.length,mode:K.stateful?"stateful":"stateless",defaultCorpId:K.defaultCorpId,corps:Q.map((z)=>({id:z.id,name:z.name,sourceType:z.source.type,sealUrl:z.seal?.url}))}),!0}if(I==="GET"&&U==="/v1/whoami"){let Q=S6($,Y,J),K=L4(Q),z=await I4(K),w=v4("seal_whoami"),G=await k4(w,z,{},K);return d1(q,200,G),!0}if(I==="GET"&&U==="/v1/session"){let Q=S6($,Y,J),K=L4(Q),z=await I4(K),w=v4("seal_session_get"),G=await k4(w,z,{},K);return d1(q,200,G),!0}if(I==="GET"&&U==="/v1/approval-runs/summary"){let Q=S6($,Y,J),K=L4(Q),z=await I4(K),w=v4("seal_approval_runs_summary"),G=await k4(w,z,J,K);return d1(q,200,G),!0}if(I==="GET"&&U==="/v1/approval-runs/stats"){let Q=S6($,Y,J),K=L4(Q),z=await I4(K),w=v4("seal_approval_runs_stats"),G=await k4(w,z,J,K);return d1(q,200,G),!0}if(I==="GET"&&U==="/v1/approval-runs/pick"){let Q=S6($,Y,J),K=L4(Q),z=await I4(K),w=v4("seal_approval_run_pick"),G=await k4(w,z,J,K);return d1(q,200,G),!0}if(I==="GET"&&U==="/v1/approval-runs/url"){let Q=S6($,Y,J),K=L4(Q),z=await I4(K),w=v4("seal_approval_run_url_get"),G=await k4(w,z,J,K);return d1(q,200,G),!0}if(U.startsWith("/v1/approval-runs/")){let Q=U.slice(18).split("/"),K=Q[0],z=Q[1];if(K&&!["summary","pick","stats","url","bridge"].includes(K)){let w=S6($,Y,J),G=L4(w),H=await I4(G);if(!z){let V=v4("seal_approval_run_get"),W=await k4(V,H,{recordId:K,...J},G);return d1(q,200,W),!0}if(z==="attachments"){let V=v4("seal_approval_run_attachments_get"),W=await k4(V,H,{recordId:K,...J},G);return d1(q,200,W),!0}if(z==="cited-rules"){let V=v4("seal_approval_run_cited_rules_get"),W=await k4(V,H,{recordId:K,...J},G);return d1(q,200,W),!0}if(z==="document-summary"){let V=v4("seal_approval_run_document_summary_get"),W=await k4(V,H,{recordId:K,...J},G);return d1(q,200,W),!0}if(z==="result"){let V=v4("seal_approval_run_result_get"),W=await k4(V,H,{recordId:K,...J},G);return d1(q,200,W),!0}}}if(I==="GET"&&U==="/v1/approval-runs"){let Q=S6($,Y,J),K=L4(Q),z=await I4(K),w=v4("seal_approval_runs_search"),G=await k4(w,z,{...J,limit:J.limit?Number(J.limit):void 0,offset:J.offset?Number(J.offset):void 0,includeBridge:J.includeBridge==="true"},K);return d1(q,200,G),!0}if(I==="GET"&&U==="/v1/approval/rules"){let Q=S6($,Y,J),K=L4(Q),z=await I4(K),w=v4("seal_approval_rules_list"),G=await k4(w,z,J,K);return d1(q,200,G),!0}if(I==="GET"&&U==="/v1/simulation/batches"){let Q=S6($,Y,J),K=L4(Q),z=await I4(K),w=v4("seal_simulation_batches_list"),G=await k4(w,z,J,K);return d1(q,200,G),!0}if(I==="POST"&&U==="/v1/simulation/create-batch"){let Q=await LL($)||{},K=S6($,Y,Q),z=L4(K),w=await I4Line truncated
\uD83D\uDE80 seal-use HTTP Server (v${t0}) started`),console.error(` URL: http://${I}:${q}`),console.error(` Docs: http://${I}:${q}/docs`),console.error(` OpenAPI: http://${I}:${q}/openapi.json`),console.error(` CLI Exec: POST http://${I}:${q}/api/cli`),console.error(` REST API: http://${I}:${q}/v1/...
`);Y(U)})})}async function gZ0($){let q=e0($.options.port)??e0($.options.p),I=x($.options.host)??x($.options.h),U=await FL({port:q,host:I}),Y=()=>{U.close(()=>{process.exit(0)})};process.on("SIGINT",Y),process.on("SIGTERM",Y),await new Promise(()=>{})}async function jZ0($,q,I,U){if($==="config"||$==="get"){await O0("seal_llm_config_get",q,I,{},L0(U.options));return}if($==="providers"||$==="list"){await O0("seal_llm_providers_list",q,I,{},L0(U.options));return}throw Error(`Unknown llm command: ${$??""}. Run 'seal-use help' for available commands.`)}async function BZ0($,q){if($==="config"||$==="json"){Du();return}await Lu()}function Du(){T0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function RZ0($){let q=XL();T0(q,{...L0($.options),allowFull:!0})}async function vZ0($,q,I,U){if($==="available"){await O0("seal_permissions_available_list",q,I,{},L0(U.options));return}if($==="configs"||$==="list"){await O0("seal_permissions_configs_list",q,I,{},L0(U.options));return}throw Error(`Unknown permissions command: ${$??""}. Run 'seal-use help' for available commands.`)}import{readFileSync as CZ0}from"node:fs";async function _Z0($,q,I,U,Y,J,Q){if(!$||$==="get"){await O0("seal_preference_get",Y,J,{},L0(Q.options));return}if($==="decision"){if(q==="update"||!q){let K=x(Q.options.input),z=K?JSON.parse(CZ0(K,"utf8")):a6(Q.json);if(!z||Object.keys(z).length===0)throw Error(`Usage: seal-use preference decision update --json '{"explicitApprove":"..."}'`);await O0("seal_preference_decision_update",Y,J,z,L0(Q.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(q==="set"){let K=x(Q.options.default)??x(Q.options.level)??U;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await O0("seal_preference_thinking_depth_set",Y,J,{defaultLevel:K},L0(Q.options));return}if(q==="policies"){if(I==="list"||!I){await O0("seal_preference_thinking_depth_policies_list",Y,J,{},L0(Q.options));return}if(I==="upsert"){let K=x(Q.options.input),z=K?JSON.parse(CZ0(K,"utf8")):a6(Q.json);if(!z||!z.id||!z.name)throw Error(`Usage: seal-use preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await O0("seal_preference_thinking_depth_policies_upsert",Y,J,z,L0(Q.options));return}if(I==="remove"||I==="delete"){let K=U??x(Q.options.id)??x(Q.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await O0("seal_preference_thinking_depth_policies_remove",Y,J,{policyId:K},L0(Q.options));return}}}throw Error(`Unknown preference action: ${$??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}async function hZ0($={}){let q=X8(),I=P4(),U=DI(q,{stateful:I.stateful,defaultCorpId:I.defaultCorpId,corpId:$.corpId},x7());console.log(`[probe] corp=${U.id} source=${U.source.type}`);let Y=await PY(U);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Y,null,2));let J=await I4(U),Q=await fH(J,{documentLimit:20,stylePreferencesEndpoint:U.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:Q.rules.rules.length,hasPendingRuleDeletes:Q.rules.hasPendingDeletes,documents:Q.documents.articles.length,documentsTotal:Q.documents.total,stylePreferences:Q.stylePreferences.ok?"ok":`error: ${Q.stylePreferences.error}`},null,2))}async function SZ0($,q,I){let U=q??x(I.options.corp)??($&&$!=="--corp"?$:void 0);await hZ0({corpId:U})}async function Ou($,q,I,U,Y){if($==="count"){await O0("seal_approval_rules_list",I,U,{countOnly:!0},L0(Y.options));return}if($==="list"){if(C0(Y.options.count)){await O0("seal_approval_rules_list",I,U,{countOnly:!0},L0(Y.options));return}let J=e0(Y.options.limit),Q=e0(Y.options.offset);if(C0(Y.options.summary)){await O0("seal_approval_rules_list",I,U,{fields:IZ0,limit:J,offset:Q},L0(Y.options));return}let K=await Jq("seal_approval_rules_list",I,U,{limit:J,offset:Q});UZ0(K,C0(Y.options.full)===!0),T0(K);return}if($==="clear"){let J=C0(Y.options.yes)===!0,Q=C0(Y.options.dryRun)??C0(Y.options["dry-run"])??!J;if(!J&&!Q)throw Error("Refusing to clear rules without --yes. Use --dry-run to preview.");let K=await Jq("seal_approval_rules_clear",I,U,{dryRun:Q,recode:C0(Y.options.recode)});if(!J&&Q&&K&&typeof K==="object"){T0({...K,nextCommand:`seal-use rules clear --corp ${U.id} --yes`},L0(Y.options));return}T0(K,L0(Y.options));return}if($==="versions"){await O0("seal_approval_rule_versions_list",I,U,{},L0(Y.options));return}if($==="version"){let J=q??x(Y.options.version);if(!J)throw Error("Usage: seal-use rules version <versionId|versionNumber|latest>");await O0("seal_approval_rule_version_get",I,U,Wz(J),L0(Y.options));return}if($==="get"){await O0("seal_approval_rule_get",I,U,{...qZ0(x(Y.options.version)),code:x(Y.options.code),runtimeId:x(Y.options.runtimeId)??x(Y.options["runtime-id"]),recordId:x(Y.options.r Line truncated
`).filter(Boolean),J=Y.slice(-q);return{logFile:I,lines:J,totalLines:Y.length}}async function Qw1($){let q=TL($),I=Mu($),U=Oz($);kZ0($.stateDir);let Y=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):OL),J=$.host??(process.env.HOST?process.env.HOST:NL);AL(q,`${process.pid}
`,{mode:384}),AL(I,JSON.stringify({pid:process.pid,port:Y,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),TY(U,`service starting on http://${J}:${Y} pid=${process.pid}`);let Q=null;try{Q=await FL({port:Y,host:J,silent:!0}),TY(U,`service listening pid=${process.pid}`)}catch(z){if(TY(U,`service failed to bind port ${Y}: ${z instanceof Error?z.message:String(z)}`),PL(q)===process.pid)p8(q,{force:!0}),p8(I,{force:!0});throw z}let K=()=>{if(Q)Q.close(),Q=null;if(PL(q)===process.pid)p8(q,{force:!0}),p8(I,{force:!0});TY(U,`stopped pid=${process.pid}`)};await new Promise((z)=>{let w=!1,G=()=>{if(w)return;w=!0,K(),process.off("SIGTERM",G),process.off("SIGINT",G),z()};process.once("SIGTERM",G),process.once("SIGINT",G)})}function yZ0($){kZ0($.stateDir);let q=EY($);if(q.running)return q;let I=$.launcher??{command:process.execPath,args:[$.entryFile]},U=[...I.args??[],"service","run"];if($.port)U.push("--port",String($.port));if($.host)U.push("--host",String($.host));let Y=Iw1(I.command,U,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Y.unref();let J=TL($);return AL(J,`${Y.pid}
`,{mode:384}),TY(Oz($),`started pid=${Y.pid}`),{started:!0,...EY($)}}function uZ0($,q={}){let I=TL($),U=Mu($),Y=PL(I);if(!Y||!xZ0(Y,$.appRoot))return p8(I,{force:!0}),p8(U,{force:!0}),q.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(Y,"SIGTERM"),p8(I,{force:!0}),p8(U,{force:!0}),TY(Oz($),`stop requested pid=${Y}`),q.quiet?void 0:{stopped:!0,pid:Y}}function xZ0($,q){if(!Kw1($))return!1;try{let I=Uw1("ps",["-p",String($),"-o","command="],{encoding:"utf8"});return(I.includes(q)||I.includes("seal-use")||I.includes("src/cli.ts"))&&I.includes("service")&&I.includes("run")}catch{return!1}}function Kw1($){try{return process.kill($,0),!0}catch{return!1}}function TL($){return Fu($.stateDir,"service.pid")}function Mu($){return Fu($.stateDir,"service.json")}function Oz($){return Fu($.stateDir,"service.log")}function PL($){if(!ML($))return;let q=Number(Nu($,"utf8").trim());return Number.isInteger(q)&&q>0?q:void 0}function kZ0($){Yw1($,{recursive:!0,mode:448})}function TY($,q){AL($,`${new Date().toISOString()} ${q}
`,{flag:"a",mode:384})}var Au=ww1(zw1(),".config","seal-use");async function Pu($,q,I){let U=I?e0(I.options.port)??e0(I.options.p):void 0,Y=I?x(I.options.host)??x(I.options.h):void 0,J=I?e0(I.options.lines)??e0(I.options.n):void 0,Q=await Qq($,{appRoot:q.appRoot,entryFile:q.entryFile,stateDir:Au,version:t0,launcher:q.launcher,port:U,host:Y},{maxLines:J});if(Q!==void 0)T0(Q)}import{existsSync as Gw1,readFileSync as fZ0}from"node:fs";async function nZ0($,q,I,U,Y){if($==="batch-records"||$==="records"){let J=q??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await O0("seal_simulation_batch_records_get",I,U,{batchId:J,query:x(Y.options.query)},L0(Y.options));return}if($==="create"||$==="run"){let J=x(Y.options.mode)??x(Y.options.sourceSystem)??x(Y.options["source-system"])??"hosecloud",Q=J==="material-pack"?"material_pack":J,K=x(Y.options.schemaConfig)??x(Y.options["schema-config"]),z=K?JSON.parse(fZ0(K,"utf8")):void 0,w=x(Y.options.input),G=w?JSON.parse(fZ0(w,"utf8")):a6(Y.json),H=x(Y.options.packageId)??x(Y.options["package-id"]),V=M6(Y.options.packageIds)??M6(Y.options["package-ids"])??(H?[H]:void 0),W=M6(Y.options.flowIds)??M6(Y.options["flow-ids"])??M6(Y.options.documentSn)??M6(Y.options["document-sn"]),X=x(Y.options.signKey)??x(Y.options["sign-key"])??x(Y.options.integration);await O0("seal_simulation_batch_create",I,U,{mode:Q,sourceSystem:Q,flowIds:W,documentSn:W,rejectNodeName:x(Y.options.rejectNode)??x(Y.options["reject-node"])??null,thinkingDepthOverride:x(Y.options.thinkingDepth)??x(Y.options["thinking-depth"]),skipInvoiceGeneration:C0(Y.options.skipInvoiceGeneration)??C0(Y.options["skip-invoice-generation"]),skipExpenseExtraction:C0(Y.options.skipExpenseExtraction)??C0(Y.options["skip-expense-extraction"]),disableAttachmentCache:C0(Y.options.disableAttachmentCache)??C0(Y.options["disable-attachment-cache"]),signKey:X,packageIds:V,packageId:H,templateId:x(Y.options.templateId)??x(Y.options["template-id"]),schemaConfig:z,requestIds:M6(Y.options.requestIds)??M6(Y.options["request-ids"]),workflowTypeId:x(Y.options.workflowTypeId)??x(Y.options["workflow-type-id"]),flowStatusList:M6(Y.options.flowStatusList)?.map(Number)??M6(Y.options["flow-status-list"])?.map(Number),businessCodes:M6(Y.options.businessCodes)??M6(Y.options["business-codes"]),documentType:x(Y.options.documentType)??x(Y.options["document-type"]),startTime:e0(Y.options.startTime)??e0(Y.options["start-time"]),endTime:e0(Y.options.endTime)??e0(Y.options["end-time"]),status:M6(Y.options.status),limit:e0(Y.options.limit),rawParams:G},L0(Y.options));return}if($==="wait"){let J=q??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await O0("seal_simulation_batch_wait",I,U,{batchId:J,timeout:x(Y.options.timeout),pollInterval:x(Y.options.pollInterval)??x(Y.options["poll-interval"])},L0(Y.options));return}if($==="clean"||$==="delete"){let J=q??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await O0("seal_simulation_batch_clean",I,U,{batchId:J},L0(Y.options));return}if($==="specifications"){let J=q??x(Y.options.integration)??x(Y.options.signKey)??x(Y.options["sign-key"]);await O0("seal_simulation_specifications_list",I,U,{signKey:J},L0(Y.options));return}if($==="list"){await O0("seal_simulation_batches_list",I,U,{limit:e0(Y.options.limit)},L0(Y.options));return}if($==="get"){let J=q??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await O0("seal_simulation_batch_get",I,U,{batchId:J},L0(Y.options));return}if($==="templates"){await O0("seal_simulation_templates_get",I,U,{},L0(Y.options));return}if($==="integrations"){await O0("seal_simulation_integrations_get",I,U,{},L0(Y.options));return}if($==="package-upload"){let J=q??x(Y.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!Gw1(J))throw Error(`File not found: ${J}`);await O0("seal_simulation_material_package_upload",I,U,{filePath:J},L0(Y.options));return}throw Error(`Unknown simulation command: ${$??""}. Run 'seal-use help' for available commands.`)}import{existsSync as YX0}from"node:fs";import{join as EL}from"node:path";import{existsSync as Tu,mkdirSync as sZ0,rmSync as Aw1,writeFileSync as Pw1}from"node:fs";import{homedir as eZ0}from"node:os";import{dirname as Tw1,join as Eu}from"node:path";var bZ0=`---
name: seal-use
description: "v0.10.4: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
description: "v0.10.10: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
metadata:
version: 0.10.4
short-description: Seal tenant and Hose approval automation (v0.10.4)
version: 0.10.10
short-description: Seal tenant and Hose approval automation (v0.10.10)
---
# Seal Use (v0.10.4)
# Seal Use (v0.10.10)
Use the \`seal_cli\` MCP tool when it is available; pass the command string as its \`command\` argument. If MCP is unavailable, fall back to the global \`seal-use\` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
@@ -292,6 +542,7 @@ seal-use corps list
- System Permissions Config: \`seal-use permissions available --corp <corpId>\`, \`seal-use permissions configs --corp <corpId>\`.
- Billing & Feature Quotas: \`seal-use billing status --corp <corpId>\`, \`seal-use billing plans --corp <corpId>\`, \`seal-use billing features --corp <corpId>\`.
- Webhook 审批回调管理: \`seal-use webhook <list|get|add|update|delete> --corp <corpId>\`.
- Webhook 材料包导入: \`seal-use webhook material-pack preview <材料包.zip> --corp <corpId>\` 只做本地校验和解析;\`... push <材料包.zip> --webhook <idOrName> --corp <corpId>\` 上传附件并通过入站 Webhook 触发 AI 审批。它与 \`simulation material_pack\` 的官方服务端导入流程相互独立。
- HTTP REST API & Docs Server: \`seal-use http [--port 8787] [--host 127.0.0.1]\` (提供 \`/docs\` 交互文档、\`/openapi.json\`、\`POST /api/cli\` 与 \`/v1/*\` REST API)。
- 审批规则质量校验 (Linter): \`seal-use rules lint [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary] --corp <corpId>\`; read \`references/rule-lint.md\`. 全局配置默认关闭 (\`config lint <enable|disable>\`)。
- Full CLI inventory: read \`references/cli.md\`.
@@ -351,11 +602,11 @@ seal-use tool seal_approval_search --corp <corpId> --json '{"keywords":["差旅"
## Safety
Rule, document, style preference, and publish actions mutate Seal configuration. Make the target enterprise explicit, show the intended payload, and verify after the write. Never send real \`enterprises/*.json\` files, tokens, signed URLs, or full raw documents to GitHub, tickets, logs, or chat unless the user explicitly requests a safe export.
`;var oy=`interface:
`;var iZ0=`interface:
display_name: "Seal Use"
short_description: "Diagnose approval feedback and publish minimal rule fixes"
default_prompt: "Use $seal-use to resolve a customer feedback package to the correct tenant, diagnose the approval run, propose a minimal rule diff, and publish only after explicit confirmation."
`;var uy=`# Rule Lightweight Queries
`;var pZ0=`# Rule Lightweight Queries
Use this reference when the user wants rule counts, compact rule lists, one rule from a historical version, or approval knowledge search without dumping hundreds of rule descriptions.
@@ -460,7 +711,7 @@ Use current search only when the question is about current draft/current knowled
## Output Discipline
If a rule command would return many descriptions or more than about 20 rules, use \`rules count\`, \`rules list --summary\`, \`fields\`, \`snippetOnly\`, or \`--output-file\`. Use \`--full\` only for deliberate exports.
`;var ey=`# Approval Bad Case Catalog
`;var cZ0=`# Approval Bad Case Catalog
Use this file only as a comparison catalog after inspecting the current trace. Do not treat any case below as a default diagnosis.
@@ -510,7 +761,7 @@ Important nuance:
- This is a bad-case pattern, not a general rule that every amount-total dispute is caused by \`pre_analysis\`.
- Use it when the current trace shows recognized amounts being excluded downstream or duplicate attachments producing inconsistent conclusions.
`;var ly="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use <command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise `./enterprises` and `~/.config/seal-use/enterprises` are merged.\n- User-level configs override same-ID local configs.\n\nEnterprise selection is stateless by default. Commands that access an enterprise require\n`--corp <corpId>` unless stateful mode is explicitly enabled:\n\n```bash\nseal-use config mode stateful --corp <corpId>\nseal-use corps switch <corpId>\nseal-use config mode stateless\n```\n\nThe global mode is stored in `~/.config/seal-use/config.json`; set `SEAL_USE_CONFIG_FILE` to\noverride that path. The legacy `current-corp` file is not read.\n\n## Stream & Exit Code Contract\n\n- **`stdout`**: Pure, deterministic JSON for machine/Agent parsing.\n- **`stderr`**: Diagnostics, probing logs, and **Next-Step Command Suggestions** (e.g. `👉 Next action: ...`).\n- **`Exit Code`**: `0` on success, non-zero (e.g. `1`) on failure to trigger Agent error self-remediation.\n\n## Top-Level Commands\n\n```bash\nseal-use version\nseal-use config paths\nseal-use config get\nseal-use config mode <stateful|stateless> [--corp <corpId>]\nseal-use config lint <enable|disable|status> [--linter <name>] [--min-score <score>]\nseal-use rules lint [--corp <corpId>] [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary]\nseal-use service <start|stop|restart|status>\nseal-use http [--port 8787] [--host 127.0.0.1]\nseal-use serve [--port 8787]\nseal-use update\nseal-use tools list\nseal-use corps list [--corp <corpId>]\nseal-use corps current [--corp <corpId>]\nseal-use corps switch <corpId>\nseal-use corps add-hose --json '{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-use corps add-seal --json '{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]\nseal-use auth diagnose [--corp <corpId>]\nseal-use auth hose-link [--corp <corpId>] [--expire 7200]\nseal-use delegation list [--corp <corpId>]\nseal-use delegation create [--note <note>] [--from-link <url>] [--corp <corpId>]\nseal-use delegation revoke <tokenId> [--corp <corpId>]\nseal-use users create --name <name> --phone <phone> [--dept <deptId>] [--corp <corpId>]\nseal-use users reset-password <userId> [--corp <corpId>]\nseal-use users get <userId> [--corp <corpId>]\nseal-use users delete <userId> [--corp <corpId>]\nseal-use llm config [--corp <corpId>]\nseal-use llm providers [--corp <corpId>]\nseal-use permissions available [--corp <corpId>]\nseal-use permissions configs [--corp <corpId>]\nseal-use billing status [--corp <corpId>]\nseal-use billing plans [--corp <corpId>]\nseal-use billing features [--corp <corpId>]\nseal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]\nseal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]\nseal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--corp <corpId>]\nseal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--corp <corpId>]\nseal-use webhook delete <idOrName> --yes [--corp <corpId>]\nseal-use deploy hosecloud requirements [--corp <corpId>]\nseal-use deploy hosecloud list [--corp <corpId>]\nseal-use deploy hosecloud get <sign-key> [--corp <corpId>]\nseal-use deploy hosecloud status [--corp <corpId>]\nseal-use deploy hosecloud configure --json '{...}' [--corp <corpId>]\nseal-use deploy hosecloud sync <sign-key> [--corp <corpId>]\nseal-use preference get [--corp <corpId>]\nseal-use preference decision update --json '{\"explicitApprove\":\"...\"}' [--corp <corpId>]\nseal-use preference thinking-depth set --default <medium|high> [--corp <corpId>]\nseal-use preference thinking-depth policies list [--corp <corpId>]\nseal-use preference thinking-depth policies upsert --json '{...}' [--corp <corpId>]\nseal-use preference thinking-depth policies remove <policyId> [--corp <corpId>]\nseal-use source config [--corp <corpId>]\nseal-use tool <toolName> [--corp <corpId>] [--json '{\"key\":\"value\"}']\nseal-use approval-runs summary --corp <corpId> [--date YYYY-MM-DD] [--timezone Asia/Shanghai]\nseal-use approval-runs stats --corp <corpId> [--since 3months] [--dedupe-by sourceDocumentSN|sourceDocumentId|id]\nseal-use approval-runs count --corp <corpId> [--status APPROVED]\nseal-use approval-runs search --corp <corpId> [--query text] [--limit 20] [--includeBridge true]\nseal-use approval-runs get <recordId> --corp <corpId> [--fields metadata|document.fields,result.summary] [--outputLine truncated
`;var dZ0="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use <command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise `./enterprises` and `~/.config/seal-use/enterprises` are merged.\n- User-level configs override same-ID local configs.\n\nEnterprise selection is stateless by default. Commands that access an enterprise require\n`--corp <corpId>` unless stateful mode is explicitly enabled:\n\n```bash\nseal-use config mode stateful --corp <corpId>\nseal-use corps switch <corpId>\nseal-use config mode stateless\n```\n\nThe global mode is stored in `~/.config/seal-use/config.json`; set `SEAL_USE_CONFIG_FILE` to\noverride that path. The legacy `current-corp` file is not read.\n\n## Stream & Exit Code Contract\n\n- **`stdout`**: Pure, deterministic JSON for machine/Agent parsing.\n- **`stderr`**: Diagnostics, probing logs, and **Next-Step Command Suggestions** (e.g. `👉 Next action: ...`).\n- **`Exit Code`**: `0` on success, non-zero (e.g. `1`) on failure to trigger Agent error self-remediation.\n\n## Top-Level Commands\n\n```bash\nseal-use version\nseal-use config paths\nseal-use config get\nseal-use config mode <stateful|stateless> [--corp <corpId>]\nseal-use config lint <enable|disable|status> [--linter <name>] [--min-score <score>]\nseal-use rules pull [--corp <corpId>] [--version <id|num|latest>] [--out <file>]\nseal-use rules lint [--file <path>] [--corp <corpId>] [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary]\nseal-use rules push [--file <path>] [--corp <corpId>] [--publish] [--version-name <name>] [--dry-run|--yes]\nseal-use service <start|stop|restart|status|logs> [--port 8787] [--host 127.0.0.1] [--lines 50]\nseal-use http [--port 8787] [--host 127.0.0.1]\nseal-use serve [--port 8787]\nseal-use update\nseal-use tools list\nseal-use corps list [--corp <corpId>]\nseal-use corps current [--corp <corpId>]\nseal-use corps switch <corpId>\nseal-use corps add-hose --json '{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-use corps add-seal --json '{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]\nseal-use auth diagnose [--corp <corpId>]\nseal-use auth hose-link [--corp <corpId>] [--expire 7200]\nseal-use delegation list [--corp <corpId>]\nseal-use delegation create [--note <note>] [--from-link <url>] [--corp <corpId>]\nseal-use delegation revoke <tokenId> [--corp <corpId>]\nseal-use users create --name <name> --phone <phone> [--dept <deptId>] [--corp <corpId>]\nseal-use users reset-password <userId> [--corp <corpId>]\nseal-use users get <userId> [--corp <corpId>]\nseal-use users delete <userId> [--corp <corpId>]\nseal-use llm config [--corp <corpId>]\nseal-use llm providers [--corp <corpId>]\nseal-use permissions available [--corp <corpId>]\nseal-use permissions configs [--corp <corpId>]\nseal-use billing status [--corp <corpId>]\nseal-use billing plans [--corp <corpId>]\nseal-use billing features [--corp <corpId>]\nseal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]\nseal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]\nseal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--corp <corpId>]\nseal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--corp <corpId>]\nseal-use webhook delete <idOrName> --yes [--corp <corpId>]\nseal-use deploy hosecloud requirements [--corp <corpId>]\nseal-use deploy hosecloud list [--corp <corpId>]\nseal-use deploy hosecloud get [<sign-key>] [--corp <corpId>]\nseal-use deploy hosecloud status [--corp <corpId>]\nseal-use deploy hosecloud configure --json '{...}' [--corp <corpId>]\nseal-use deploy hosecloud sync [<sign-key>] [--auto] [--corp <corpId>]\nseal-use preference get [--corp <corpId>]\nseal-use preference decision update --json '{\"explicitApprove\":\"...\"}' [--corp <corpId>]\nseal-use preference thinking-depth set --default <medium|high> [--corp <corpId>]\nseal-use preference thinking-depth policies list [--corp <corpId>]\nseal-use preference thinking-depth policies upsert --json '{...}' [--corp <corpId>]\nseal-use preference thinking-depth policies remove <policyId> [--corp <corpId>]\nseal-use source config [--corp <corpId>]\nseal-use tool <toolName> [--corp <corpId>] [--json '{\"key\":\"value\"}']\nseal-use approval-runs summary --corp <corpId> [--date YYYY-MM-DD] [--timezone Asia/Shanghai]\nseal-use approval-runs stats --corp <corpId> [--since 3months] [--dedupe-by sourceDocumentSN|sourceDocumentId|id]\nseal-uLine truncated
Use this workflow when a customer disputes an AI approval finding about an attachment, invoice, receipt, OCR result, or a UI-highlighted audit result.
@@ -731,7 +982,7 @@ Manual image check:
- The customer's objection that they were receipts rather than invoices was reasonable.
However, the final rejection also had an independent rule-37 reason: payment screenshots totaled 699.48 while reimbursement was 700.00.
`;var Iy=`# Customer Feedback Rule Remediation
`;var oZ0=`# Customer Feedback Rule Remediation
Use this low-freedom workflow when the user provides packaged customer feedback from WeChat, screenshots, rejection notifications, a document number, or expected business behavior and wants diagnosis or an approval-rule change.
@@ -895,7 +1146,7 @@ Return a compact report containing:
- New version number and version name, if published
- Verification result
- Whether a regression rerun was performed
`;var gy="# Enterprise Onboarding\n\nRead this reference for first installation, zero configured enterprises, incoming credentials or assistance links, and browser-copied cURL. The goal is to identify the enterprise with the least user effort while keeping authentication material confidential.\n\n## Start With Discovery\n\nRun this before asking for setup parameters (if `seal-use` is not installed, first run `curl -fsSL https://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash`):\n\n```bash\nseal-use version\nseal-use corps list\n```\n\n- If `seal-use` is not installed on the system, run the curl install script above to install it.\n- If the target enterprise is listed, match the user's human enterprise name to its returned `id` and use that value as `--corp` on every command. Do not ask the user for `corpId`.\n- If multiple configured enterprises plausibly match, show their human names and let the user choose. Keep their IDs as implementation details.\n- If none are configured, ask one plain-language question: “你现在手上有哪一种接入材料:合思开放平台 appKey/appSecurity、合思授权/协助链接、Seal 协助链接,还是从已登录的合思或 Seal 网页复制的 cURL?”\n\nDo not open with a JSON template or a list of internal fields.\n\nAll command examples in this reference are for the Agent to run. Do not hand them to the user as setup instructions. Communicate with the user in natural language and translate their answer into CLI/MCP parameters yourself.\n\n## Keep Two Concepts Separate\n\nClassify both the enterprise identity origin and how the current credential was acquired:\n\n| Enterprise identity origin | Credential material the user may have | Meaning |\n| --- | --- | --- |\n| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | Stable, refreshable standard integration |\n| Hose/合思-sourced Seal tenant | Hose authorization/assistance link | Temporary Hose authorization that can lead into the Seal SSO session |\n| Hose/合思-sourced Seal tenant | cURL copied from an authenticated Hose or Seal page | Snapshot of a signed-in browser session; it may expire |\n| Seal-native tenant | Seal assistance/delegation link | Temporary delegated access to a Seal tenant |\n| Seal-native tenant | cURL copied from an authenticated Seal page | Snapshot containing the Seal host and session authentication |\n\nCredential shape alone does not define identity origin. In particular, a Hose-sourced user eventually receives a Seal Bearer session after SSO. When `whoami` returns provider metadata, preserve it and use it to describe the tenant accurately.\n\n## Parameter Ownership\n\nAsk the user only for information that cannot be discovered safely:\n\n| Field | Owner and behavior |\n| --- | --- |\n| `appKey`, `appSecurity` | User supplies these for standard Hose OpenAPI onboarding. Explain that they come from the enterprise's 合思开放平台 application credentials. Treat both as secrets. |\n| `domain` | Probe the standard Hose SaaS domains automatically. Ask only when probing fails and the enterprise uses a private or dedicated deployment. |\n| Enterprise name and `corpId` | Discover from the credential response or Seal `whoami`. Do not ask the user to invent or locate them first. |\n| Administrator and `staffId` | Discover administrator candidates. If more than one is eligible, present name and masked phone for the user to choose; pass the selected ID internally. |\n| Seal URL, tenant ID, tenant slug | Discover from the assistance link, cURL host, and Seal `whoami`. |\n| Bearer token, cookies, signed query tokens | Extract only from user-supplied authentication material. Never print them back or include them in summaries. |\n\n## Route 1: Standard Hose Credentials\n\nThis is the preferred durable route for a Hose-sourced tenant. Read `hose-enterprise-init.md`, then use:\n\n```bash\nseal-use corps add-hose --json '{\"appKey\":\"...\",\"appSecurity\":\"...\"}'\n```\n\nThe CLI probes the standard domains, discovers the corporation, and discovers administrator candidates. If it returns multiple candidates, show only useful identifying information and ask which person should be used; retry with `staffName`, `staffPhone`, or the selected `staffId` internally. After creation, run:\n\n```bash\nseal-use auth diagnose --corp <discovered-id>\n```\n\nDo not ask for `domain`, `corpId`, or `proxyStaffBizId` up front. For a dedicated/private Hose deployment, add `domain` only after standard probing reports that it cannot find the enterprise.\n\n## Route 2: Incoming Assistance Link\n\nFirst distinguish the link by its host and purpose:\n\n- A Hose authorization/provisional link opens a Hose session and may continue through Seal SSO. It is not a Seal delegation link.\n- A Seal assistance/delegation link grants temporary delegated access on a Seal tenant. It is not a Hose OpenAPI credential.\n- `seal-use auth hose-link` and `seal-use delegation create` generate Line truncated
`;var rZ0="# Enterprise Onboarding\n\nRead this reference for first installation, zero configured enterprises, incoming credentials or assistance links, and browser-copied cURL. The goal is to identify the enterprise with the least user effort while keeping authentication material confidential.\n\n## Start With Discovery\n\nRun this before asking for setup parameters (if `seal-use` is not installed, first run `curl -fsSL https://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash`):\n\n```bash\nseal-use version\nseal-use corps list\n```\n\n- If `seal-use` is not installed on the system, run the curl install script above to install it.\n- If the target enterprise is listed, match the user's human enterprise name to its returned `id` and use that value as `--corp` on every command. Do not ask the user for `corpId`.\n- If multiple configured enterprises plausibly match, show their human names and let the user choose. Keep their IDs as implementation details.\n- If none are configured, ask one plain-language question: “你现在手上有哪一种接入材料:合思开放平台 appKey/appSecurity、合思授权/协助链接、Seal 协助链接,还是从已登录的合思或 Seal 网页复制的 cURL?”\n\nDo not open with a JSON template or a list of internal fields.\n\nAll command examples in this reference are for the Agent to run. Do not hand them to the user as setup instructions. Communicate with the user in natural language and translate their answer into CLI/MCP parameters yourself.\n\n## Keep Two Concepts Separate\n\nClassify both the enterprise identity origin and how the current credential was acquired:\n\n| Enterprise identity origin | Credential material the user may have | Meaning |\n| --- | --- | --- |\n| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | Stable, refreshable standard integration |\n| Hose/合思-sourced Seal tenant | Hose authorization/assistance link | Temporary Hose authorization that can lead into the Seal SSO session |\n| Hose/合思-sourced Seal tenant | cURL copied from an authenticated Hose or Seal page | Snapshot of a signed-in browser session; it may expire |\n| Seal-native tenant | Seal assistance/delegation link | Temporary delegated access to a Seal tenant |\n| Seal-native tenant | cURL copied from an authenticated Seal page | Snapshot containing the Seal host and session authentication |\n\nCredential shape alone does not define identity origin. In particular, a Hose-sourced user eventually receives a Seal Bearer session after SSO. When `whoami` returns provider metadata, preserve it and use it to describe the tenant accurately.\n\n## Parameter Ownership\n\nAsk the user only for information that cannot be discovered safely:\n\n| Field | Owner and behavior |\n| --- | --- |\n| `appKey`, `appSecurity` | User supplies these for standard Hose OpenAPI onboarding. Explain that they come from the enterprise's 合思开放平台 application credentials. Treat both as secrets. |\n| `domain` | Probe the standard Hose SaaS domains automatically. Ask only when probing fails and the enterprise uses a private or dedicated deployment. |\n| Enterprise name and `corpId` | Discover from the credential response or Seal `whoami`. Do not ask the user to invent or locate them first. |\n| Administrator and `staffId` | Discover administrator candidates. If more than one is eligible, present name and masked phone for the user to choose; pass the selected ID internally. |\n| Seal URL, tenant ID, tenant slug | Discover from the assistance link, cURL host, and Seal `whoami`. |\n| Bearer token, cookies, signed query tokens | Extract only from user-supplied authentication material. Never print them back or include them in summaries. |\n\n## Route 1: Standard Hose Credentials\n\nThis is the preferred durable route for a Hose-sourced tenant. Read `hose-enterprise-init.md`, then use:\n\n```bash\nseal-use corps add-hose --json '{\"appKey\":\"...\",\"appSecurity\":\"...\"}'\n```\n\nThe CLI probes the standard domains, discovers the corporation, and discovers administrator candidates. If it returns multiple candidates, show only useful identifying information and ask which person should be used; retry with `staffName`, `staffPhone`, or the selected `staffId` internally. After creation, run:\n\n```bash\nseal-use auth diagnose --corp <discovered-id>\n```\n\nDo not ask for `domain`, `corpId`, or `proxyStaffBizId` up front. For a dedicated/private Hose deployment, add `domain` only after standard probing reports that it cannot find the enterprise.\n\n## Route 2: Incoming Assistance Link\n\nFirst distinguish the link by its host and purpose:\n\n- A Hose authorization/provisional link opens a Hose session and may continue through Seal SSO. It is not a Seal delegation link.\n- A Seal assistance/delegation link grants temporary delegated access on a Seal tenant. It is not a Hose OpenAPI credential.\n- `seal-use auth hose-link` and `seal-use delegation create` generat Line truncated
Use this reference for Hose/合思 enterprise configuration and user-facing Hose authorization links.
@@ -960,7 +1211,7 @@ Important:
- \`seal-use auth diagnose\` proves this stage works but redacts the token, so it is not enough when the user needs the actual clickable Hose link.
- **Formatting Requirement**: When returning a Hose authorization link to the user, ALWAYS provide BOTH a code block (\` \`\`\`text ... \`\`\` \`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
- If the CLI later provides a dedicated command for this, prefer that command.
`;var wy=`# Hose Enterprise Initialization & Automated Discovery
`;var aZ0=`# Hose Enterprise Initialization & Automated Discovery
Use this reference for automated Hose/合思 enterprise onboarding, multi-domain probing (including dedicated private cloud domains like 美年大健康), OpenAPI role and staff discovery, and non-TUI safe administrator selection.
@@ -1066,12 +1317,12 @@ seal-use corps hose-staffs --json '{
}'
\`\`\`
* 直接使用指定 ID 完成接入并进行连通性验证。
`;var Uy={"SKILL.md":ry,"agents/openai.yaml":oy,"references/rule-lightweight.md":uy,"references/approval-bad-cases.md":ey,"references/cli.md":ly,"references/approval-run-lightweight.md":vy,"references/approval-attachment-trace.md":$y,"references/customer-feedback-rule-remediation.md":Iy,"references/enterprise-onboarding.md":gy,"references/hose-enterprise-auth.md":by,"references/hose-enterprise-init.md":wy};function Dy(){return Uy["SKILL.md"]||""}function mu(){return n0(cy(),".agents","skills","seal-use")}function Sy(){return n0(cy(),".agents","skills","seal-home")}function Ay(){let n=Sy();if(s4(n))try{return hB(n,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function i0(n=mu()){Ay(),fy(n,{recursive:!0});let i=[];for(let[r,o]of Object.entries(Uy)){let t=n0(n,r);fy(xB(t),{recursive:!0}),mB(t,o,"utf8"),i.push(r)}return{targetDir:n,files:i}}function t0(){let n=Sy(),i=mu(),r=s4(n),o=s4(i);if(r||o)return Ay(),i0(i),{synced:!0,targetDir:i};return{synced:!1}}function dy(n,i,r){if(n==="dump"||n==="cat"||n==="show"){process.stdout.write(`${Dy()}
`);return}if(n==="install"||n==="init"||n==="sync"){let o=_(r.options.local)||_(r.options.workspace),t=U(r.options.dir)??U(r.options.target)??i,u=t?t:o?c$(process.cwd(),".agents","skills","seal-use"):mu(),e=i0(u);P({installed:!0,targetDir:e.targetDir,fileCount:e.files.length,files:e.files});return}if(n==="status"||n==="get"||!n){let o=mu(),t=c$(process.cwd(),".agents","skills","seal-use");P({global:{dir:o,installed:ky(c$(o,"SKILL.md"))},local:{dir:t,installed:ky(c$(t,"SKILL.md"))}});return}throw Error(`Unknown skill command: ${n}. Run 'seal-use help' for available commands.`)}async function Oy(n,i){if(n==="config"){P(await io(i));return}throw Error(`Unknown source command: ${n??""}. Run 'seal-use help' for available commands.`)}async function Ly(n,i,r,o){if(!n)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await J(n,i,r,oi(o.json),p(o.options))}function Ny(){P(_u.map((n)=>({name:n.name,description:n.description})))}import{chmodSync as aB,mkdirSync as sB,renameSync as r0,rmSync as nP,unlinkSync as py,writeFileSync as yy}from"node:fs";import{dirname as iP,join as Gy}from"node:path";import{spawnSync as zt}from"node:child_process";function U$(n=process.execPath,i=import.meta.url){if(i.includes("/$bunfs/")||i.includes("\\$bunfs\\"))return!0;let r=n.toLowerCase().replace(/\\/g,"/");return!r.endsWith("/bun")&&!r.endsWith("/bun.exe")&&!r.endsWith("/node")&&!r.endsWith("/node.exe")}var Jy="yunyingk/seal-use",au="yunyingk/seal-home";var tP="SEAL_USE_GITHUB_REPO",rP="SEAL_HOME_GITHUB_REPO";async function Xy(n,i={}){let r={appRoot:n.appRoot,entryFile:n.entryFile,stateDir:a4,version:x,launcher:n.launcher},o=i.repo||process.env[tP]?.trim()||process.env[rP]?.trim()||Jy,t=i.targetVersion?.trim(),u=t&&t.toLowerCase()!=="latest"?t:void 0;if(u){let W=u.replace(/^v/,""),L=Hy(W,x);if(L<0){P({updated:!1,currentVersion:x,targetVersion:W,mode:U$()?"binary":"source",message:`Cannot downgrade seal-use from v${x} to older version v${W}. Updates must be forward-only.`});return}if(L===0&&!i.force){P({updated:!1,currentVersion:x,targetVersion:W,mode:U$()?"binary":"source",message:`seal-use is already at version v${x}. Use --force to reinstall.`});return}}if(i.changelogOnly){let W=await o0(o,i.limit??10);P({currentVersion:x,totalQueried:W.length,releases:W.map((L)=>({version:L.version,tagName:L.tagName,publishedAt:L.publishedAt,author:L.author,releaseNotes:L.notes,releaseUrl:L.htmlUrl,isCurrent:L.version===x,isNewer:xu(L.version,x)}))});return}if(!U$()){if(i.checkOnly){let L=await o0(o,30),M=L[0],q=M?.version??x,An=L.find((nn)=>nn.version===x),Wn=xu(q,x),jn=L.filter((nn)=>xu(nn.version,x));P({updated:!1,updateAvailable:Wn,currentVersion:x,currentVersionPublishedAt:An?.publishedAt,latestVersion:q,latestVersionPublishedAt:M?.publishedAt,behindCount:jn.length,pendingReleases:jn.map((nn)=>({version:nn.version,tagName:nn.tagName,publishedAt:nn.publishedAt,author:nn.author,releaseNotes:nn.notes,releaseUrl:nn.htmlUrl})),releaseNotes:M?.notes??"",releaseUrl:M?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let W=to(r).running;if(W)await Mt("stop",r);try{jy("git",["-C",n.appRoot,"pull","--ff-only"])}catch(L){console.error(`git pull skipped: ${L instanceof Error?L.message:String(L)}`)}if(jy("bun",["install"],{cwd:n.appRoot}),W)await Mt("start",r);P({updated:!0,serviceRestarted:W,version:x,mode:"source"});return}let e=oP(),l=uP(),$=await o0(o,30),I=u?$.find((W)=>W.version===u||W.tagName===u||W.tagName===`v${u}`)??await Wy(o,u):$[0]??await Wy(o);if(!I){P({updated:!1,currentVersion:x,mode:"binary",message:`Failed to query releases from repository '${o}'`});return}let g=I.version,b=$.find((W)=>W.version===x),w=xu(g,x),f=w||Boolean(i.force),c=$.filter((W)=>xu(W.version,x));if(i.checkOnly){P({updated:!1,updateAvailable:w,currentVersion:x,currentVersionPublishedAt:b?.publishedAt,latestVersion:g,latestVersionPublishedAt:I.publishedAt,behindCount:c.length,pendingReleases:c.map((W)=>({version:W.version,tagName:W.tagName,publishedAt:W.publishedAt,author:W.author,releaseNotes:W.notes,releaseUrl:W.htmlUrl})),releaseNotes:I.notes,releaseUrl:I.htmlUrl,mode:"binary"});return}if(!f){P({updated:!1,currentVersion:x,currentVersionPublishedAt:b?.publishedAt,latestVersion:g,latestVersionPublishedAt:I.publishedAt,mode:"binary",message:`seal-use is already up to date (v${x})`});return}let S=eP(I.assets,e,l);if(!S)throw Error(`No compatible binary found for ${e}-${l} in release v${g}. Available assets: ${I.assets.map((W)=>W.name).join(", ")}`);let d=to(r).running;if(d)await Mt("stop",r);let O=process.execPath,F=iP(O),Q=Gy(F,`.tmp-update-${Date.now()}`);sB(Q,{recursive:!0});try{let W=Gy(Q,S.name);await lP(S.downloadUrl,W,I.tagName,S.name);let L=W;if(S.name.endsWith(".tar.gz")||S.name.endsWith(".tgz"))L=vP(W,Q,e);else if(S.name.endsWith(".zip"))L=$P(W,Q,e);if(aB(L,493),process.platform==="darwin")try{zt("/usr/bin/codesign",["--remove-signature",L],{stdio:"ignore"}),zt("/usr/ Line truncated
`)}catch{}}async function lP(n,i,r,o){let t=u0(),u=[],e=r?r.startsWith("v")?r:`v${r}`:void 0,l=o||n.split("/").pop()||"";if(t!=="github"){if(e&&l)u.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${e}/${l}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${e}/${l}`);if(n.startsWith("https://git.ying-qing.cn"))u.push(n)}if(t!=="gitea")if(e&&l){let S=`https://github.com/${Jy}/releases/download/${e}/${l}`;if(!process.env.CI)u.push(`https://ghfast.top/${S}`,`https://gh.ddlc.top/${S}`);u.push(S)}else if(n.includes("github.com")){if(!process.env.CI)u.push(`https://ghfast.top/${n}`,`https://gh.ddlc.top/${n}`);u.push(n)}else u.push(n);let $=Array.from(new Set(u)),I,g=6000,b=6000,w=307200,f=1e4,c=180000;for(let S=0;S<$.length;S++){let d=$[S],O=new AbortController,F="",Q=(q)=>{F=q;try{O.abort()}catch{}},W=setTimeout(()=>{Q("Connection timed out (no response headers within 6s)")},g),L,M;try{D$(`==> [${S+1}/${$.length}] Downloading via: ${d}`);let q=await fetch(d,{signal:O.signal});if(W)clearTimeout(W),W=void 0;if(!q.ok)throw Error(`HTTP ${q.status} ${q.statusText}`);L=setTimeout(()=>{Q("Overall download time exceeded 3 minutes")},c);let An=Number(q.headers.get("content-length"))||0,Wn=q.body?.getReader();if(!Wn){let Li=Buffer.from(await q.arrayBuffer());if(Li.length<1000)throw Error(`Downloaded content is suspiciously small (${Li.length} bytes)`);yy(i,Li),D$(`✓ Download succeeded (${(Li.length/1024/1024).toFixed(1)} MB)`);return}let jn=[],nn=0,ro=0;M=setTimeout(()=>{if(nn<w){let Li=(nn/1024).toFixed(1);Q(`Initial transfer too slow (${Li} KB < 300 KB in 6s), switching mirror...`)}},b);while(!0){let Li=Wn.read(),S$,Ty=new Promise((k$,d$)=>{S$=setTimeout(()=>{d$(Error("Data transfer stalled (no chunk received for 10s)"))},f)}),v0;try{v0=await Promise.race([Li,Ty])}finally{if(S$)clearTimeout(S$)}let{done:Ey,value:A$}=v0;if(Ey)break;if(A$){if(jn.push(A$),nn+=A$.length,M&&nn>=w)clearTimeout(M),M=void 0;let k$=Date.now();if(k$-ro>200){ro=k$;let d$=An?Math.round(nn/An*100):0,Vy=(nn/1048576).toFixed(1),qy=An?(An/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${d$}% (${Vy} / ${qy} MB)...`)}catch{}}}}try{process.stderr.write(`
`)}catch{}let Lt=Buffer.concat(jn);if(Lt.length<1000)throw Error(`Downloaded content is suspiciously small (${Lt.length} bytes)`);yy(i,Lt),D$(`✓ Download completed successfully (${(Lt.length/1024/1024).toFixed(1)} MB)`);return}catch(q){if(W)clearTimeout(W);if(M)clearTimeout(M);if(L)clearTimeout(L);let An=F||(q instanceof Error?q.message:String(q));I=Error(An),D$(`
↳ Mirror failed: ${I.message}`)}finally{if(W)clearTimeout(W);if(M)clearTimeout(M);if(L)clearTimeout(L)}}throw Error(`Failed to download asset from all mirrors: ${I?.message}`)}function vP(n,i,r){let o=zt("tar",["-xzf",n,"-C",i],{stdio:"pipe"});if(o.status!==0)throw Error(`Failed to extract tar archive: ${o.stderr.toString()}`);py(n);let t=r==="windows"?"seal-use.exe":"seal-use",u=zt("find",[i,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
`).filter(Boolean),e=u.find((l)=>l.endsWith(`/${t}`)||l.endsWith(t));if(e)return e;return u[0]||n}function $P(n,i,r){let o=zt("unzip",["-q","-o",n,"-d",i],{stdio:"pipe"});if(o.status!==0)throw Error(`Failed to extract zip archive: ${o.stderr.toString()}`);py(n);let t=r==="windows"?"seal-use.exe":"seal-use",u=zt("find",[i,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
`).filter(Boolean),e=u.find((l)=>l.endsWith(`/${t}`)||l.endsWith(t));if(e)return e;return u[0]||n}function Hy(n,i){let r=n.replace(/^v/,"").split(".").map((t)=>Number.parseInt(t,10)||0),o=i.replace(/^v/,"").split(".").map((t)=>Number.parseInt(t,10)||0);for(let t=0;t<Math.max(r.length,o.length);t++){let u=r[t]??0,e=o[t]??0;if(u>e)return 1;if(u<e)return-1}return 0}function xu(n,i){return Hy(n,i)>0}function jy(n,i,r={}){let o=zt(n,i,{cwd:r.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(o.stdout)console.error(o.stdout.trimEnd());if(o.stderr)console.error(o.stderr.trimEnd());if(o.status!==0)throw Error(`${n} ${i.join(" ")} failed with status ${o.status}`)}async function Yy(n,i,r,o,t){if(n==="create"){let u=U(t.options.name)??i,e=U(t.options.phone);if(!u||!e)throw Error("Usage: seal-use users create --name <name> --phone <phone> [--dept <deptId>]");let l=U(t.options.dept)??U(t.options.departmentId);await J("seal_user_create",r,o,{name:u,phone:e,departmentIds:l?[l]:void 0},p(t.options));return}if(n==="reset-password"){let u=i??U(t.options.userId);if(!u)throw Error("Usage: seal-use users reset-password <userId>");await J("seal_user_reset_password",r,o,{userId:u},p(t.options));return}if(n==="search"||n==="list"){let u=i??U(t.options.keyword)??U(t.options.query)??"";await J("seal_user_search",r,o,{keyword:u},p(t.options));return}if(n==="get"){let u=i??U(t.options.userId);if(!u)throw Error("Usage: seal-use users get <userId>");await J("seal_user_get",r,o,{userId:u},p(t.options));return}if(n==="delete"){let u=i??U(t.options.userId);if(!u)throw Error("Usage: seal-use users delete <userId>");await J("seal_user_delete",r,o,{userId:u},p(t.options));return}if(n==="activate"){let u=i??U(t.options.userId);if(!u)throw Error("Usage: seal-use users activate <userId>");await J("seal_user_activate",r,o,{userId:u},p(t.options));return}if(n==="delegation"||n==="impersonate"){let u=i??U(t.options.userId)??U(t.options.phone);if(!u)throw Error("Usage: seal-use users delegation <userIdOrPhone> [--note <note>]");let e=U(t.options.note);await J("seal_user_delegation_create",r,o,{userIdOrPhone:u,note:e},p(t.options));return}throw Error(`Unknown users command: ${n??""}. Run 'seal-use help' for available commands.`)}async function Qy(n,i,r,o,t){if(n==="list"){await J("seal_webhook_list",r,o,{query:U(t.options.query)??U(t.options.keyword),includeSecret:Z4(t.options)},p(t.options));return}if(n==="get"||n==="find"){let u=i??U(t.options.selector)??U(t.options.id);if(!u)throw Error("Usage: seal-use webhook get <idOrName> [--show-secret]");await J("seal_webhook_get",r,o,{selector:u,includeSecret:Z4(t.options)},p(t.options));return}if(n==="add"||n==="create"){let u=U(t.options.name)??i,e=U(t.options.resultUrl)??U(t.options["result-url"])??U(t.options.outgoingResultWebhook)??U(t.options["outgoing-result-webhook"]);if(!u||!e)throw Error("Usage: seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic]");let l=_4(t.options);await J("seal_webhook_add",r,o,{name:u,mode:q4(U(t.options.mode)),outgoingResultWebhook:e,autoApprovalRate:l,secret:U(t.options.secret)},p(t.options));return}if(n==="update"){let u=i??U(t.options.selector)??U(t.options.id);if(!u)throw Error("Usage: seal-use webhook update <idOrName> [options]");let e=U(t.options.secret),l=_(t.options.rotateSecret)??_(t.options["rotate-secret"]);if(e!==void 0&&l)throw Error("Use either --secret or --rotate-secret, not both");let $=U(t.options.name),I=q4(U(t.options.mode)),g=U(t.options.resultUrl)??U(t.options["result-url"])??U(t.options.outgoingResultWebhook)??U(t.options["outgoing-result-webhook"]),b=_4(t.options);if($===void 0&&I===void 0&&g===void 0&&b===void 0&&e===void 0&&!l)throw Error("Webhook update requires at least one field option");await J("seal_webhook_update",r,o,{selector:u,name:$,mode:I,outgoingResultWebhook:g,autoApprovalRate:b,secret:e,rotateSecret:l},p(t.options));return}if(n==="delete"){let u=i??U(t.options.selector)??U(t.options.id);if(!u)throw Error("Usage: seal-use webhook delete <idOrName> --yes");if(_(t.options.yes)!==!0)throw Error("Refusing to delete Webhook integration without --yes");await J("seal_webhook_delete",r,o,{selector:u,confirm:!0},p(t.options));return}throw Error(`Unknown webhook command: ${n??""}. Run 'seal-use help' for available commands.`)}var Fy=e0(e0(e0(gP(import.meta.url)))),bP=new Set(["config","service","http","serve","update","tools","corps","tool","source","auth","delegation","users","llm","permissions","billing","webhook","webhooks","context","rules","approval-runs","simulation","deploy","preference","preferences","mcp","server","mcp-config","skill","openapi","probe","changelog"]),Ky=Promise.resolve();function hu(n,i={}){let r=Ky.then(()=>wP(n,i));return Ky=r.then(()=>{return},()=>{return}),r}async function wP(n,i){let r=[],o=[],t=console.log,u=console.error,e={appRoot:i.appRoot??Fy,entryFile:i.entryFile??IP(i.appRoot??Fy,"src","cli.ts"),launcher:i.launcher};console.log=(...l)=>{r.push(M4(l))},c Line truncated
`;var $X0={"SKILL.md":bZ0,"agents/openai.yaml":iZ0,"references/rule-lightweight.md":pZ0,"references/approval-bad-cases.md":cZ0,"references/cli.md":dZ0,"references/approval-run-lightweight.md":lZ0,"references/approval-attachment-trace.md":mZ0,"references/customer-feedback-rule-remediation.md":oZ0,"references/enterprise-onboarding.md":rZ0,"references/hose-enterprise-auth.md":tZ0,"references/hose-enterprise-init.md":aZ0};function qX0(){return $X0["SKILL.md"]||""}function Nz(){return Eu(eZ0(),".agents","skills","seal-use")}function IX0(){return Eu(eZ0(),".agents","skills","seal-home")}function UX0(){let $=IX0();if(Tu($))try{return Aw1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function gu($=Nz()){UX0(),sZ0($,{recursive:!0});let q=[];for(let[I,U]of Object.entries($X0)){let Y=Eu($,I);sZ0(Tw1(Y),{recursive:!0}),Pw1(Y,U,"utf8"),q.push(I)}return{targetDir:$,files:q}}function ju(){let $=IX0(),q=Nz(),I=Tu($),U=Tu(q);if(I||U)return UX0(),gu(q),{synced:!0,targetDir:q};return{synced:!1}}function JX0($,q,I){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${qX0()}
`);return}if($==="install"||$==="init"||$==="sync"){let U=C0(I.options.local)||C0(I.options.workspace),Y=x(I.options.dir)??x(I.options.target)??q,J=Y?Y:U?EL(process.cwd(),".agents","skills","seal-use"):Nz(),Q=gu(J);T0({installed:!0,targetDir:Q.targetDir,fileCount:Q.files.length,files:Q.files});return}if($==="status"||$==="get"||!$){let U=Nz(),Y=EL(process.cwd(),".agents","skills","seal-use");T0({global:{dir:U,installed:YX0(EL(U,"SKILL.md"))},local:{dir:Y,installed:YX0(EL(Y,"SKILL.md"))}});return}throw Error(`Unknown skill command: ${$}. Run 'seal-use help' for available commands.`)}async function QX0($,q){if($==="config"){T0(await PY(q));return}throw Error(`Unknown source command: ${$??""}. Run 'seal-use help' for available commands.`)}async function KX0($,q,I,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await O0($,q,I,a6(U.json),L0(U.options))}function zX0(){T0(Hz.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as Ew1,mkdirSync as gw1,renameSync as Bu,rmSync as jw1,unlinkSync as WX0,writeFileSync as wX0}from"node:fs";import{dirname as Bw1,join as GX0}from"node:path";import{spawnSync as Kq}from"node:child_process";function gL($=process.execPath,q=import.meta.url){if(q.includes("/$bunfs/")||q.includes("\\$bunfs\\"))return!0;let I=$.toLowerCase().replace(/\\/g,"/");return!I.endsWith("/bun")&&!I.endsWith("/bun.exe")&&!I.endsWith("/node")&&!I.endsWith("/node.exe")}var ZX0="yunyingk/seal-use",Mz="yunyingk/seal-home";var Rw1="SEAL_USE_GITHUB_REPO",vw1="SEAL_HOME_GITHUB_REPO";async function XX0($,q={}){let I={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Au,version:t0,launcher:$.launcher},U=q.repo||process.env[Rw1]?.trim()||process.env[vw1]?.trim()||ZX0,Y=q.targetVersion?.trim(),J=Y&&Y.toLowerCase()!=="latest"?Y:void 0;if(J){let P=J.replace(/^v/,""),B=DX0(P,t0);if(B<0){T0({updated:!1,currentVersion:t0,targetVersion:P,mode:gL()?"binary":"source",message:`Cannot downgrade seal-use from v${t0} to older version v${P}. Updates must be forward-only.`});return}if(B===0&&!q.force){T0({updated:!1,currentVersion:t0,targetVersion:P,mode:gL()?"binary":"source",message:`seal-use is already at version v${t0}. Use --force to reinstall.`});return}}if(q.changelogOnly){let P=await Ru(U,q.limit??10);T0({currentVersion:t0,totalQueried:P.length,releases:P.map((B)=>({version:B.version,tagName:B.tagName,publishedAt:B.publishedAt,author:B.author,releaseNotes:B.notes,releaseUrl:B.htmlUrl,isCurrent:B.version===t0,isNewer:Fz(B.version,t0)}))});return}if(!gL()){if(q.checkOnly){let B=await Ru(U,30),k=B[0],h=k?.version??t0,f=B.find((p)=>p.version===t0),S=Fz(h,t0),t=B.filter((p)=>Fz(p.version,t0));T0({updated:!1,updateAvailable:S,currentVersion:t0,currentVersionPublishedAt:f?.publishedAt,latestVersion:h,latestVersionPublishedAt:k?.publishedAt,behindCount:t.length,pendingReleases:t.map((p)=>({version:p.version,tagName:p.tagName,publishedAt:p.publishedAt,author:p.author,releaseNotes:p.notes,releaseUrl:p.htmlUrl})),releaseNotes:k?.notes??"",releaseUrl:k?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let P=EY(I).running;if(P)await Qq("stop",I);try{VX0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`git pull skipped: ${B instanceof Error?B.message:String(B)}`)}if(VX0("bun",["install"],{cwd:$.appRoot}),P)await Qq("start",I);T0({updated:!0,serviceRestarted:P,version:t0,mode:"source"});return}let Q=Cw1(),K=_w1(),z=await Ru(U,30),w=J?z.find((P)=>P.version===J||P.tagName===J||P.tagName===`v${J}`)??await HX0(U,J):z[0]??await HX0(U);if(!w){T0({updated:!1,currentVersion:t0,mode:"binary",message:`Failed to query releases from repository '${U}'`});return}let G=w.version,H=z.find((P)=>P.version===t0),V=Fz(G,t0),W=V||Boolean(q.force),X=z.filter((P)=>Fz(P.version,t0));if(q.checkOnly){T0({updated:!1,updateAvailable:V,currentVersion:t0,currentVersionPublishedAt:H?.publishedAt,latestVersion:G,latestVersionPublishedAt:w.publishedAt,behindCount:X.length,pendingReleases:X.map((P)=>({version:P.version,tagName:P.tagName,publishedAt:P.publishedAt,author:P.author,releaseNotes:P.notes,releaseUrl:P.htmlUrl})),releaseNotes:w.notes,releaseUrl:w.htmlUrl,mode:"binary"});return}if(!W){T0({updated:!1,currentVersion:t0,currentVersionPublishedAt:H?.publishedAt,latestVersion:G,latestVersionPublishedAt:w.publishedAt,mode:"binary",message:`seal-use is already up to date (v${t0})`});return}let D=hw1(w.assets,Q,K);if(!D)throw Error(`No compatible binary found for ${Q}-${K} in release v${G}. Available assets: ${w.assets.map((P)=>P.name).join(", ")}`);let L=EY(I).running;if(L)await Qq("stop",I);let N=process.execPath,E=Bw1(N),T=GX0(E,`.tmp-update-${Date.now()}`);gw1(T,{recursive:!0});try{let P=GX0(T,D.name);await Sw1(D.downloadUrl,P,w.tagName,D.name);let B=P;if(D.name.endsWith(".tar.gz")||D.name.endsWith(".tgz"))B=yw1(P,T,Q);else if(D.name.endsWith(".zip"))B=uw1(P,T,Q);if(Ew1(B,493),process.platform==="darwin")try{Kq("/usr/bin/codesig Line truncated
`)}catch{}}async function Sw1($,q,I,U){let Y=vu(),J=[],Q=I?I.startsWith("v")?I:`v${I}`:void 0,K=U||$.split("/").pop()||"";if(Y!=="github"){if(Q&&K)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${Q}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${Q}/${K}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Y!=="gitea")if(Q&&K){let D=`https://github.com/${ZX0}/releases/download/${Q}/${K}`;if(!process.env.CI)J.push(`https://ghfast.top/${D}`,`https://gh.ddlc.top/${D}`);J.push(D)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let z=Array.from(new Set(J)),w,G=6000,H=6000,V=307200,W=1e4,X=180000;for(let D=0;D<z.length;D++){let L=z[D],N=new AbortController,E="",T=(h)=>{E=h;try{N.abort()}catch{}},P=setTimeout(()=>{T("Connection timed out (no response headers within 6s)")},G),B,k;try{jL(`==> [${D+1}/${z.length}] Downloading via: ${L}`);let h=await fetch(L,{signal:N.signal});if(P)clearTimeout(P),P=void 0;if(!h.ok)throw Error(`HTTP ${h.status} ${h.statusText}`);B=setTimeout(()=>{T("Overall download time exceeded 3 minutes")},X);let f=Number(h.headers.get("content-length"))||0,S=h.body?.getReader();if(!S){let b=Buffer.from(await h.arrayBuffer());if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);wX0(q,b),jL(`✓ Download succeeded (${(b.length/1024/1024).toFixed(1)} MB)`);return}let t=[],p=0,C=0;k=setTimeout(()=>{if(p<V){let b=(p/1024).toFixed(1);T(`Initial transfer too slow (${b} KB < 300 KB in 6s), switching mirror...`)}},H);while(!0){let b=S.read(),J0,g=new Promise((K0,G0)=>{J0=setTimeout(()=>{G0(Error("Data transfer stalled (no chunk received for 10s)"))},W)}),u;try{u=await Promise.race([b,g])}finally{if(J0)clearTimeout(J0)}let{done:d,value:a}=u;if(d)break;if(a){if(t.push(a),p+=a.length,k&&p>=V)clearTimeout(k),k=void 0;let K0=Date.now();if(K0-C>200){C=K0;let G0=f?Math.round(p/f*100):0,M0=(p/1048576).toFixed(1),v0=f?(f/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${G0}% (${M0} / ${v0} MB)...`)}catch{}}}}try{process.stderr.write(`
`)}catch{}let n=Buffer.concat(t);if(n.length<1000)throw Error(`Downloaded content is suspiciously small (${n.length} bytes)`);wX0(q,n),jL(`✓ Download completed successfully (${(n.length/1024/1024).toFixed(1)} MB)`);return}catch(h){if(P)clearTimeout(P);if(k)clearTimeout(k);if(B)clearTimeout(B);let f=E||(h instanceof Error?h.message:String(h));w=Error(f),jL(`
↳ Mirror failed: ${w.message}`)}finally{if(P)clearTimeout(P);if(k)clearTimeout(k);if(B)clearTimeout(B)}}throw Error(`Failed to download asset from all mirrors: ${w?.message}`)}function yw1($,q,I){let U=Kq("tar",["-xzf",$,"-C",q],{stdio:"pipe"});if(U.status!==0)throw Error(`Failed to extract tar archive: ${U.stderr.toString()}`);WX0($);let Y=I==="windows"?"seal-use.exe":"seal-use",J=Kq("find",[q,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
`).filter(Boolean),Q=J.find((K)=>K.endsWith(`/${Y}`)||K.endsWith(Y));if(Q)return Q;return J[0]||$}function uw1($,q,I){let U=Kq("unzip",["-q","-o",$,"-d",q],{stdio:"pipe"});if(U.status!==0)throw Error(`Failed to extract zip archive: ${U.stderr.toString()}`);WX0($);let Y=I==="windows"?"seal-use.exe":"seal-use",J=Kq("find",[q,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
`).filter(Boolean),Q=J.find((K)=>K.endsWith(`/${Y}`)||K.endsWith(Y));if(Q)return Q;return J[0]||$}function DX0($,q){let I=$.replace(/^v/,"").split(".").map((Y)=>Number.parseInt(Y,10)||0),U=q.replace(/^v/,"").split(".").map((Y)=>Number.parseInt(Y,10)||0);for(let Y=0;Y<Math.max(I.length,U.length);Y++){let J=I[Y]??0,Q=U[Y]??0;if(J>Q)return 1;if(J<Q)return-1}return 0}function Fz($,q){return DX0($,q)>0}function VX0($,q,I={}){let U=Kq($,q,{cwd:I.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(U.stdout)console.error(U.stdout.trimEnd());if(U.stderr)console.error(U.stderr.trimEnd());if(U.status!==0)throw Error(`${$} ${q.join(" ")} failed with status ${U.status}`)}async function LX0($,q,I,U,Y){if($==="create"){let J=x(Y.options.name)??q,Q=x(Y.options.phone);if(!J||!Q)throw Error("Usage: seal-use users create --name <name> --phone <phone> [--dept <deptId>]");let K=x(Y.options.dept)??x(Y.options.departmentId);await O0("seal_user_create",I,U,{name:J,phone:Q,departmentIds:K?[K]:void 0},L0(Y.options));return}if($==="reset-password"){let J=q??x(Y.options.userId);if(!J)throw Error("Usage: seal-use users reset-password <userId>");await O0("seal_user_reset_password",I,U,{userId:J},L0(Y.options));return}if($==="search"||$==="list"){let J=q??x(Y.options.keyword)??x(Y.options.query)??"";await O0("seal_user_search",I,U,{keyword:J},L0(Y.options));return}if($==="get"){let J=q??x(Y.options.userId);if(!J)throw Error("Usage: seal-use users get <userId>");await O0("seal_user_get",I,U,{userId:J},L0(Y.options));return}if($==="delete"){let J=q??x(Y.options.userId);if(!J)throw Error("Usage: seal-use users delete <userId>");await O0("seal_user_delete",I,U,{userId:J},L0(Y.options));return}if($==="activate"){let J=q??x(Y.options.userId);if(!J)throw Error("Usage: seal-use users activate <userId>");await O0("seal_user_activate",I,U,{userId:J},L0(Y.options));return}if($==="delegation"||$==="impersonate"){let J=q??x(Y.options.userId)??x(Y.options.phone);if(!J)throw Error("Usage: seal-use users delegation <userIdOrPhone> [--note <note>]");let Q=x(Y.options.note);await O0("seal_user_delegation_create",I,U,{userIdOrPhone:J,note:Q},L0(Y.options));return}throw Error(`Unknown users command: ${$??""}. Run 'seal-use help' for available commands.`)}import{existsSync as OX0}from"node:fs";async function NX0($){if(!OX0($))throw Error(`File not found: ${$}`);let q=wz($);console.log(JSON.stringify(await zz(q.fileBuffer,q.fileName),null,2))}async function FX0($,q,I,U,Y){if($==="material-pack"||$==="material-pack-push"){let J=$==="material-pack-push"?"push":q,Q=$==="material-pack-push"?x(Y.options.file)??x(Y.options.input):Y.command[3]??x(Y.options.file)??x(Y.options.input);if(!Q)throw Error("Usage: seal-use webhook material-pack <preview|push> <材料包.zip>");if(!OX0(Q))throw Error(`File not found: ${Q}`);let K=wz(Q);if(J==="preview"){console.log(JSON.stringify(await zz(K.fileBuffer,K.fileName),null,2));return}if(J!=="push")throw Error("Usage: seal-use webhook material-pack <preview|push> <材料包.zip>");let z=x(Y.options.webhook)??x(Y.options.selector);if(!z)throw Error("Push requires --webhook <idOrName>");let w=ZI(await WI(I),z),G=await QL(K.fileBuffer,K.fileName,{webhookUrl:w.incomingDocumentWebhook.url,secret:w.secret});console.log(JSON.stringify(G,null,2));return}if($==="list"){await O0("seal_webhook_list",I,U,{query:x(Y.options.query)??x(Y.options.keyword),includeSecret:Vu(Y.options)},L0(Y.options));return}if($==="get"||$==="find"){let J=q??x(Y.options.selector)??x(Y.options.id);if(!J)throw Error("Usage: seal-use webhook get <idOrName> [--show-secret]");await O0("seal_webhook_get",I,U,{selector:J,includeSecret:Vu(Y.options)},L0(Y.options));return}if($==="add"||$==="create"){let J=x(Y.options.name)??q,Q=x(Y.options.resultUrl)??x(Y.options["result-url"])??x(Y.options.outgoingResultWebhook)??x(Y.options["outgoing-result-webhook"]);if(!J||!Q)throw Error("Usage: seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic]");let K=Hu(Y.options);await O0("seal_webhook_add",I,U,{name:J,mode:Gu(x(Y.options.mode)),outgoingResultWebhook:Q,autoApprovalRate:K,secret:x(Y.options.secret)},L0(Y.options));return}if($==="update"){let J=q??x(Y.options.selector)??x(Y.options.id);if(!J)throw Error("Usage: seal-use webhook update <idOrName> [options]");let Q=x(Y.options.secret),K=C0(Y.options.rotateSecret)??C0(Y.options["rotate-secret"]);if(Q!==void 0&&K)throw Error("Use either --secret or --rotate-secret, not both");let z=x(Y.options.name),w=Gu(x(Y.options.mode)),G=x(Y.options.resultUrl)??x(Y.options["result-url"])??x(Y.options.outgoingResultWebhook)??x(Y.options["outgoing-result-webhook"]),H=Hu(Y.options);if(z===void 0&&w===void 0&&G===void 0&&H===void 0&&Q===void 0&&!K)throw Error("Webhook update requires at least one field option");await O0("seal_webhook_update",I,U,{selector:J,name:z,mode:w,outgoingResultWebhook:G,autoApprovalRate:H,secret:Q,rotateSecret:K},L0(Y.options));return}if($==="delete"){let J=q??x(Y.options. Line truncated
`)?"":`
`}`);process.exitCode=n.exitCode}var LP=Boolean(I0.main==I0.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&By(process.argv[1])===By(Ri));if(LP)if(process.argv[2]==="--seal-use-cli"||process.argv[2]==="--seal-home-cli")await OP();else h4().catch((n)=>{console.error(n),process.exitCode=1});export{C4 as tokenizeCommand,h4 as startServer,AP as resolveMcpEnabled,kP as createServer,DP as SEAL_MCP_ENABLED_ENV,UP as SEAL_CLI_TOOL_NAME,SP as LEGACY_SEAL_MCP_ENABLED_ENV};
`}`);process.exitCode=$.exitCode}var aw1=Boolean(o.main==o.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&TX0(process.argv[1])===TX0(p5));if(aw1)if(process.argv[2]==="--seal-use-cli"||process.argv[2]==="--seal-home-cli")await tw1();else Lu().catch(($)=>{console.error($),process.exitCode=1});export{Xu as tokenizeCommand,Lu as startServer,mw1 as resolveMcpEnabled,ow1 as createServer,dw1 as SEAL_MCP_ENABLED_ENV,cw1 as SEAL_CLI_TOOL_NAME,lw1 as LEGACY_SEAL_MCP_ENABLED_ENV};
+1 -1
View File
@@ -2,7 +2,7 @@
"openapi": "3.1.0",
"info": {
"title": "seal-use Wrapped API",
"version": "0.10.4",
"version": "0.10.10",
"description": "Planned HTTP contract for the seal-use wrapped backend API.\n\nThese endpoints describe the intended stable API for frontend developers and agents once\nthe HTTP adapter is implemented.\nThey are not the raw downstream Seal endpoints. seal-use is responsible for enterprise\nselection, source authentication, response compaction, and diagnostics-friendly fields.\n"
},
"servers": [
+1 -1
View File
@@ -1,7 +1,7 @@
openapi: 3.1.0
info:
title: seal-use Wrapped API
version: 0.10.4
version: 0.10.10
description: |
Planned HTTP contract for the seal-use wrapped backend API.
+6 -1
View File
@@ -1,6 +1,6 @@
{
"name": "seal-use",
"version": "0.10.4",
"version": "0.10.10",
"type": "module",
"module": "src/server.ts",
"bin": {
@@ -22,11 +22,16 @@
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.29.0",
"exceljs": "^4.4.0",
"iconv-lite": "^0.7.3",
"ky": "^2.0.2",
"pinyin-pro": "^3.29.3",
"yauzl": "^3.4.0",
"zod": "^4.4.3"
},
"devDependencies": {
"@types/bun": "^1.3.14",
"@types/yauzl": "^3.4.0",
"bun-types": "^1.3.14",
"typescript": "^5.9.3",
"yaml": "^2.9.0"
+5 -4
View File
@@ -1,12 +1,12 @@
---
name: seal-use
description: "v0.10.4: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
description: "v0.10.10: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
metadata:
version: 0.10.4
short-description: Seal tenant and Hose approval automation (v0.10.4)
version: 0.10.10
short-description: Seal tenant and Hose approval automation (v0.10.10)
---
# Seal Use (v0.10.4)
# Seal Use (v0.10.10)
Use the `seal_cli` MCP tool when it is available; pass the command string as its `command` argument. If MCP is unavailable, fall back to the global `seal-use` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
@@ -66,6 +66,7 @@ seal-use corps list
- System Permissions Config: `seal-use permissions available --corp <corpId>`, `seal-use permissions configs --corp <corpId>`.
- Billing & Feature Quotas: `seal-use billing status --corp <corpId>`, `seal-use billing plans --corp <corpId>`, `seal-use billing features --corp <corpId>`.
- Webhook 审批回调管理: `seal-use webhook <list|get|add|update|delete> --corp <corpId>`.
- Webhook 材料包导入: `seal-use webhook material-pack preview <材料包.zip> --corp <corpId>` 只做本地校验和解析;`... push <材料包.zip> --webhook <idOrName> --corp <corpId>` 上传附件并通过入站 Webhook 触发 AI 审批。它与 `simulation material_pack` 的官方服务端导入流程相互独立。
- HTTP REST API & Docs Server: `seal-use http [--port 8787] [--host 127.0.0.1]` (提供 `/docs` 交互文档、`/openapi.json`、`POST /api/cli` 与 `/v1/*` REST API)。
- 审批规则质量校验 (Linter): `seal-use rules lint [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary] --corp <corpId>`; read `references/rule-lint.md`. 全局配置默认关闭 (`config lint <enable|disable>`)。
- Full CLI inventory: read `references/cli.md`.
@@ -62,7 +62,14 @@ If the user then wants the full text of one cited rule, use `rules get --record-
Use:
```bash
# 查看附件列表摘要(包含文件名、类型、大小及直链可用性)
seal-use approval-runs attachments <recordId> --corp <corpId> --summary
# 下载全部附件到本地目录(优先使用 ossSignedUrl 签名直链)
seal-use approval-runs attachments download <recordId> --all --out-dir ./downloads --corp <corpId>
# 按名称或 fileId 过滤下载单个附件
seal-use approval-runs attachments download <recordId> --name 发票 --corp <corpId>
```
This should be enough for file names, file IDs, mime types, positions, invoice/attachment grouping, and links when available. For customer disputes about OCR, receipt/invoice classification, or image content, switch to `approval-attachment-trace.md`.
+30 -52
View File
@@ -37,9 +37,12 @@ seal-use version
seal-use config paths
seal-use config get
seal-use config mode <stateful|stateless> [--corp <corpId>]
seal-use config test-dir [<path>|--clear]
seal-use config lint <enable|disable|status> [--linter <name>] [--min-score <score>]
seal-use rules lint [--corp <corpId>] [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary]
seal-use service <start|stop|restart|status>
seal-use rules pull [--corp <corpId>] [--version <id|num|latest>] [--out <file>]
seal-use rules lint [--file <path>] [--corp <corpId>] [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary]
seal-use rules push [--file <path>] [--corp <corpId>] [--publish] [--version-name <name>] [--dry-run|--yes]
seal-use service <start|stop|restart|status|logs> [--port 8787] [--host 127.0.0.1] [--lines 50]
seal-use http [--port 8787] [--host 127.0.0.1]
seal-use serve [--port 8787]
seal-use update
@@ -73,10 +76,10 @@ seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode
seal-use webhook delete <idOrName> --yes [--corp <corpId>]
seal-use deploy hosecloud requirements [--corp <corpId>]
seal-use deploy hosecloud list [--corp <corpId>]
seal-use deploy hosecloud get <sign-key> [--corp <corpId>]
seal-use deploy hosecloud get [<sign-key>] [--corp <corpId>]
seal-use deploy hosecloud status [--corp <corpId>]
seal-use deploy hosecloud configure --json '{...}' [--corp <corpId>]
seal-use deploy hosecloud sync <sign-key> [--corp <corpId>]
seal-use deploy hosecloud sync [<sign-key>] [--auto] [--corp <corpId>]
seal-use preference get [--corp <corpId>]
seal-use preference decision update --json '{"explicitApprove":"..."}' [--corp <corpId>]
seal-use preference thinking-depth set --default <medium|high> [--corp <corpId>]
@@ -91,6 +94,7 @@ seal-use approval-runs count --corp <corpId> [--status APPROVED]
seal-use approval-runs search --corp <corpId> [--query text] [--limit 20] [--includeBridge true]
seal-use approval-runs get <recordId> --corp <corpId> [--fields metadata|document.fields,result.summary] [--output-file file.json]
seal-use approval-runs attachments <recordId> --corp <corpId>
seal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>] --corp <corpId>
seal-use approval-runs result <recordId> --corp <corpId> [--summary]
seal-use approval-runs url --corp <corpId>
seal-use approval-runs url <recordId> --corp <corpId>
@@ -110,7 +114,7 @@ seal-use simulation integrations --corp <corpId>
seal-use simulation package-upload <材料包.zip> --corp <corpId>
```
## Fine-Grained Tools
## CLI Command Overview
`seal-use version` returns:
@@ -121,30 +125,24 @@ seal-use simulation package-upload <材料包.zip> --corp <corpId>
}
```
`seal-use service status` returns the PID, version, state directory, PID file, and log file for the optional local background process.
`seal-use service <start|stop|restart|status|logs>` manages the persistent background service daemon with embedded HTTP server (serving `/docs`, `/openapi.json`, and `POST /api/cli`). `status` returns the PID, version, host, port, active HTTP URL, state directory, PID file, and log file.
`seal-use update` updates the git checkout, runs `bun install`, and restarts the local service if it was running.
Identity and session:
- `seal-use auth diagnose --corp <corpId>`
- `seal_whoami`
- `seal_session_get`
- `seal-use corps list`
- `seal-use corps current`
Approval rule maintenance:
- `seal-use rules count [--corp <corpId>]`
- `seal-use rules list --summary [--corp <corpId>]`
- `seal-use rules lint [--corp <corpId>] [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary]`
- `seal-use rules pull [--corp <corpId>] [--version <id|num|latest>] [--out <file>]`
- `seal-use rules lint [--file <path>] [--corp <corpId>] [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary]`
- `seal-use rules push [--file <path>] [--corp <corpId>] [--publish] [--version-name <name>] [--dry-run|--yes]`
- `seal-use rules clear [--corp <corpId>] [--dry-run|--yes]`
- `seal_approval_rules_list`
- `seal_approval_rules_lint`
- `seal_approval_rules_clear`
- `seal_approval_rule_create`
- `seal_approval_rule_update`
- `seal_approval_rule_delete`
- `seal_approval_rule_versions_list`
- `seal_approval_rule_version_publish`
Approval run lightweight queries:
@@ -155,33 +153,14 @@ Approval run lightweight queries:
- `seal-use approval-runs cited-rules <recordId> --corp <corpId>`
- `seal-use approval-runs get <recordId> --corp <corpId> --fields document.fields,result.summary`
- `seal-use approval-runs attachments <recordId> --corp <corpId> --summary`
- `seal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>] --corp <corpId>`
- `seal-use approval-runs result <recordId> --corp <corpId> --summary`
- `seal_approval_run_get` with `fields`
- `seal_approval_run_pick`
- `seal_approval_run_cited_rules_get`
- `seal_approval_run_document_summary_get`
- `seal_approval_run_attachments_get`
- `seal_approval_run_result_get` with `{"summary":true}`
Approval knowledge documents:
Approval knowledge documents & style:
- `seal_approval_documents_list`
- `seal_approval_document_get`
- `seal_approval_document_create`
- `seal_approval_document_update`
Approval search and context:
- `seal_approval_search`
- `seal_approval_context_get`
- `seal-use rules get --corp <corpId> --version <number> --code '#0038'`
- `seal-use rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205`
Style preferences:
- `seal_approval_style_preferences_get`
- `seal_approval_style_preferences_update`
Webhook integrations:
- `seal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]`
@@ -189,25 +168,24 @@ Webhook integrations:
- `seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--corp <corpId>]`
- `seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--corp <corpId>]`
- `seal-use webhook delete <idOrName> --yes [--corp <corpId>]`
- `seal_webhook_list`
- `seal_webhook_get`
- `seal_webhook_add`
- `seal_webhook_update`
- `seal_webhook_delete`
- `seal-use webhook material-pack preview <材料包.zip|信息表.xlsx> --corp <corpId>`
- `seal-use webhook material-pack push <材料包.zip|信息表.xlsx> --webhook <idOrName> --corp <corpId>`
Webhook writes read the current AI approval config and POST the merged full config back to `api/v1/agent/ai-approval/config`, preserving non-Webhook integrations. List/get mask `secret` by default; add returns the generated secret once.
Approval runs, simulations, and Langfuse bridge:
- `seal_approval_runs_search`
- `seal_approval_runs_summary`
- `seal_simulation_batch_records_get`
- `seal_simulation_batch_create`
- `seal_simulation_batches_list`
- `seal_simulation_batch_get`
- `seal_simulation_templates_get`
- `seal_simulation_integrations_get`
- `seal_approval_run_langfuse_bridge_get`
- `seal-use approval-runs search --corp <corpId> [--query <text>] [--limit 20]`
- `seal-use approval-runs summary --corp <corpId> [--date YYYY-MM-DD] [--timezone Asia/Shanghai]`
- `seal-use approval-runs bridge --corp <corpId> [--sourceDocumentSN <sn>]`
- `seal-use simulation create --mode hosecloud --flow-ids ... --corp <corpId>`
- `seal-use simulation wait <batchId> --corp <corpId>`
- `seal-use simulation clean <batchId> --corp <corpId>`
- `seal-use simulation list --corp <corpId>`
- `seal-use simulation get <batchId> --corp <corpId>`
- `seal-use simulation batch-records <batchId> --corp <corpId>`
- `seal-use simulation templates --corp <corpId>`
- `seal-use simulation integrations --corp <corpId>`
## Common Examples
@@ -69,8 +69,12 @@ seal-use deploy hosecloud configure --corp <corpId> --json '{
# 5. 一键同步发布到合思审批流
seal-use deploy hosecloud sync <signKey> --corp <corpId>
# 6. 查看单项配置详情
seal-use deploy hosecloud get <signKey> --corp <corpId>
# 5.1 单配置企业一键自动同步 (--auto)
# 若企业内仅存在 1 个合思配置卡片,可直接传入 --auto 自动锁定执行,免去查询复制 signKey:
seal-use deploy hosecloud sync --auto --corp <corpId>
# 6. 查看单项配置详情(未传 signKey 时自动列出当前企业候选列表与查看命令)
seal-use deploy hosecloud get [<signKey>] --corp <corpId>
# 7. 检查发布与多平台集成状态
seal-use deploy hosecloud status --corp <corpId>
+82 -11
View File
@@ -1,5 +1,10 @@
import type { CorpConfig } from "../../core/config/types.js";
import type { createSealClient } from "../../core/http/factory.js";
import * as api from "../../domains/seal/api.js";
import {
downloadApprovalRunAttachments,
extractApprovalRunAttachments
} from "../../domains/seal/attachments.js";
import { runTool, runToolResult } from "../helpers.js";
import { booleanOption, numberOption, stringOption } from "../parser.js";
import { outputOptions, printJson } from "../printer.js";
@@ -168,18 +173,84 @@ export async function handleApprovalRunsCommand(
}
if (action === "attachments") {
const subAction = args.command[2];
if (subAction === "download") {
const recordId = args.command[3];
if (!recordId) {
throw new Error(
"Usage: seal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>]"
);
}
const record = await api.getApprovalRun(client, recordId);
const downloadResult = await downloadApprovalRunAttachments({
record,
all: booleanOption(args.options.all),
name: stringOption(args.options.name),
outDir:
stringOption(args.options["out-dir"]) ??
stringOption(args.options.outDir) ??
stringOption(args.options.dir)
});
printJson(downloadResult, outputOptions(args.options));
if (downloadResult.total > 0 && downloadResult.downloaded === 0) {
throw new Error(`所有 ${downloadResult.total} 个附件下载均失败。`);
}
return;
}
const recordId = args.command[2];
if (!recordId) throw new Error("Usage: seal-use approval-runs attachments <recordId>");
await runTool(
"seal_approval_run_attachments_get",
client,
corp,
{
recordId,
summary: booleanOption(args.options.summary)
},
outputOptions(args.options)
);
if (!recordId) throw new Error("Usage: seal-use approval-runs attachments <recordId> | seal-use approval-runs attachments download <recordId>");
if (booleanOption(args.options.download)) {
const record = await api.getApprovalRun(client, recordId);
const downloadResult = await downloadApprovalRunAttachments({
record,
all: booleanOption(args.options.all) ?? true,
name: stringOption(args.options.name),
outDir:
stringOption(args.options["out-dir"]) ??
stringOption(args.options.outDir) ??
stringOption(args.options.dir)
});
printJson(downloadResult, outputOptions(args.options));
if (downloadResult.total > 0 && downloadResult.downloaded === 0) {
throw new Error(`所有 ${downloadResult.total} 个附件下载均失败。`);
}
return;
}
const record = await api.getApprovalRun(client, recordId);
const result = extractApprovalRunAttachments(record, {
summary: booleanOption(args.options.summary)
});
printJson(result, outputOptions(args.options));
return;
}
if (action === "download") {
const recordId = args.command[2];
if (!recordId) {
throw new Error(
"Usage: seal-use approval-runs download <recordId> [--all] [--name <name>] [--out-dir <dir>]"
);
}
const record = await api.getApprovalRun(client, recordId);
const downloadResult = await downloadApprovalRunAttachments({
record,
all: booleanOption(args.options.all),
name: stringOption(args.options.name),
outDir:
stringOption(args.options["out-dir"]) ??
stringOption(args.options.outDir) ??
stringOption(args.options.dir)
});
printJson(downloadResult, outputOptions(args.options));
if (downloadResult.total > 0 && downloadResult.downloaded === 0) {
throw new Error(`所有 ${downloadResult.total} 个附件下载均失败。`);
}
return;
}
+1 -1
View File
@@ -22,7 +22,7 @@ export async function handleAuthCommand(action: string | undefined, corp: CorpCo
throw new Error(`Unknown auth command: ${action ?? ""}. Run 'seal-use help' for available commands.`);
}
export async function diagnoseAuth(corp: CorpConfig) {
async function diagnoseAuth(corp: CorpConfig) {
if (corp.source.type !== "hose") {
const client = await createSealClient(corp);
const me = await getMe(client);
+34 -1
View File
@@ -90,5 +90,38 @@ export function handleConfigCommand(action: string | undefined, maybeName: strin
return;
}
throw new Error(`Unknown config command: ${action ?? ""}. Available: paths, get, status, mode, lint. Run 'seal-use help' for available commands.`);
if (action === "test-dir" || action === "test-enterprises-dir") {
const isClear = args.options.clear === true || maybeName === "--clear" || maybeName === "clear";
const previousConfig = loadGlobalConfig();
if (isClear) {
const config = saveGlobalConfig({
...previousConfig,
testEnterprisesDir: undefined
});
printJson(globalConfigSummary(config));
return;
}
const newPath = maybeName && !maybeName.startsWith("-")
? maybeName
: stringOption(args.options.path) ?? stringOption(args.options.dir);
if (!newPath) {
printJson({
testEnterprisesDir: previousConfig.testEnterprisesDir ?? null,
configFile: resolveGlobalConfigFile()
});
return;
}
const config = saveGlobalConfig({
...previousConfig,
testEnterprisesDir: newPath
});
printJson(globalConfigSummary(config));
return;
}
throw new Error(`Unknown config command: ${action ?? ""}. Available: paths, get, status, mode, lint, test-dir. Run 'seal-use help' for available commands.`);
}
+60 -3
View File
@@ -2,9 +2,10 @@ import { readFileSync } from "node:fs";
import type { CorpConfig } from "../../core/config/types.js";
import type { createSealClient } from "../../core/http/factory.js";
import { runTool } from "../helpers.js";
import { jsonObject, stringOption } from "../parser.js";
import { booleanOption, jsonObject, stringOption } from "../parser.js";
import { outputOptions } from "../printer.js";
import type { ParsedArgs } from "../types.js";
import * as api from "../../domains/seal/api.js";
export async function handleDeployCommand(
systemOrAction: string | undefined,
@@ -64,7 +65,26 @@ export async function handleDeployCommand(
if (action === "get") {
const signKey = target ?? stringOption(args.options.signKey) ?? stringOption(args.options["sign-key"]);
if (!signKey) throw new Error("Usage: seal-use deploy hosecloud get <sign-key>");
if (!signKey) {
const config = await api.getApprovalStylePreferences(client);
const hoseConfigs = (config.integrations ?? []).filter((i: any) => i.type === "hosecloud");
if (hoseConfigs.length === 0) {
throw new Error(
`当前企业 (${corp.name}) 尚未添加合思发布配置。\n` +
`👉 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${corp.id}`
);
}
console.error(`Usage: seal-use deploy hosecloud get <sign-key> [--corp ${corp.id}]\n`);
console.error(`ℹ️ 当前企业发现以下可用的合思配置卡片:`);
for (const item of hoseConfigs) {
const name = (item as any).outboundName ?? "SealAI 审批";
const key = item.signKey;
const origin = (item as any).apiOrigin ?? "production";
console.error(` • "${name}" (signKey: ${key}, 环境: ${origin})`);
console.error(` 👉 查看命令: seal-use deploy hosecloud get ${key} --corp ${corp.id}\n`);
}
throw new Error("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey。");
}
await runTool("seal_deploy_hosecloud_get", client, corp, { signKey }, outputOptions(args.options));
return;
}
@@ -88,7 +108,44 @@ export async function handleDeployCommand(
if (action === "sync") {
const signKey = target ?? stringOption(args.options.signKey) ?? stringOption(args.options["sign-key"]);
if (!signKey) throw new Error("Usage: seal-use deploy hosecloud sync <sign-key>");
const autoOpt = booleanOption(args.options.auto) ?? booleanOption(args.options.yes);
if (!signKey) {
const config = await api.getApprovalStylePreferences(client);
const hoseConfigs = (config.integrations ?? []).filter((i: any) => i.type === "hosecloud");
if (hoseConfigs.length === 0) {
throw new Error(
`当前企业 (${corp.name}) 尚未添加合思发布配置。\n` +
`👉 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${corp.id}`
);
}
const firstHose = hoseConfigs[0];
if (firstHose && hoseConfigs.length === 1 && autoOpt) {
const singleKey = firstHose.signKey;
console.error(`ℹ️ [auto] 检测到企业仅有 1 个合思配置,已自动选择 (signKey: ${singleKey})`);
await runTool("seal_deploy_hosecloud_sync", client, corp, { signKey: singleKey }, outputOptions(args.options));
return;
}
console.error(`Usage: seal-use deploy hosecloud sync <sign-key> [--corp ${corp.id}]\n`);
console.error(`ℹ️ 当前企业发现以下可用的合思配置卡片:`);
for (const item of hoseConfigs) {
const name = (item as any).outboundName ?? "SealAI 审批";
const key = item.signKey;
const origin = (item as any).apiOrigin ?? "production";
console.error(` • "${name}" (signKey: ${key}, 环境: ${origin})`);
console.error(` 👉 同步命令: seal-use deploy hosecloud sync ${key} --corp ${corp.id}\n`);
}
if (hoseConfigs.length === 1) {
console.error(`💡 提示:若希望单配置自动同步,可附加 --auto 参数:seal-use deploy hosecloud sync --auto --corp ${corp.id}\n`);
}
throw new Error("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。");
}
await runTool("seal_deploy_hosecloud_sync", client, corp, { signKey }, outputOptions(args.options));
return;
}
+52 -1
View File
@@ -140,12 +140,63 @@ export async function handleRulesCommand(
return;
}
if (action === "pull") {
const version = stringOption(args.options.version) ?? maybeName;
const out = stringOption(args.options.out) ?? stringOption(args.options.file) ?? stringOption(args.options.f);
await runTool(
"seal_approval_rules_pull",
client,
corp,
{
version,
out
},
outputOptions(args.options)
);
return;
}
if (action === "push") {
const file = stringOption(args.options.file) ?? stringOption(args.options.f) ?? maybeName;
const confirmed = booleanOption(args.options.yes) === true;
const dryRun = booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"]) ?? !confirmed;
const publish = booleanOption(args.options.publish);
const versionName = stringOption(args.options.versionName) ?? stringOption(args.options["version-name"]);
const result = await runToolResult(
"seal_approval_rules_push",
client,
corp,
{
file,
dryRun,
confirm: confirmed,
publish,
versionName
}
);
if (!confirmed && dryRun && result && typeof result === "object") {
printJson(
{
...result,
nextCommand: `seal-use rules push --file ${file ?? "./rules.local.json"} --corp ${corp.id} --yes${publish ? " --publish" : ""}`
},
outputOptions(args.options)
);
return;
}
printJson(result, outputOptions(args.options));
return;
}
if (action === "lint") {
await runTool(
"seal_approval_rules_lint",
client,
corp,
{
file: stringOption(args.options.file) ?? stringOption(args.options.f),
linter: stringOption(args.options.linter),
version: stringOption(args.options.version),
code: stringOption(args.options.code),
@@ -159,5 +210,5 @@ export async function handleRulesCommand(
return;
}
throw new Error(`Unknown rules command: ${action ?? ""}. Available: count, list, clear, versions, version, get, search, lint. Run 'seal-use help' for available commands.`);
throw new Error(`Unknown rules command: ${action ?? ""}. Available: count, list, clear, versions, version, get, search, lint, pull, push. Run 'seal-use help' for available commands.`);
}
+24 -9
View File
@@ -3,17 +3,32 @@ import { join } from "node:path";
import { VERSION } from "../../version.js";
import { runServiceCommand } from "../service.js";
import { printJson } from "../printer.js";
import type { CliRuntime } from "../types.js";
import { numberOption, stringOption } from "../parser.js";
import type { CliRuntime, ParsedArgs } from "../types.js";
export const STATE_DIR = join(homedir(), ".config", "seal-use");
export async function handleServiceCommand(action: string | undefined, runtime: CliRuntime) {
const result = await runServiceCommand(action, {
appRoot: runtime.appRoot,
entryFile: runtime.entryFile,
stateDir: STATE_DIR,
version: VERSION,
launcher: runtime.launcher
});
export async function handleServiceCommand(
action: string | undefined,
runtime: CliRuntime,
args?: ParsedArgs
) {
const port = args ? numberOption(args.options.port) ?? numberOption(args.options.p) : undefined;
const host = args ? stringOption(args.options.host) ?? stringOption(args.options.h) : undefined;
const maxLines = args ? numberOption(args.options.lines) ?? numberOption(args.options.n) : undefined;
const result = await runServiceCommand(
action,
{
appRoot: runtime.appRoot,
entryFile: runtime.entryFile,
stateDir: STATE_DIR,
version: VERSION,
launcher: runtime.launcher,
port,
host
},
{ maxLines }
);
if (result !== undefined) printJson(result);
}
+33
View File
@@ -1,6 +1,10 @@
import type { CorpConfig } from "../../core/config/types.js";
import type { createSealClient } from "../../core/http/factory.js";
import { existsSync } from "node:fs";
import { runTool } from "../helpers.js";
import * as api from "../../domains/seal/api.js";
import { findWebhookIntegration } from "../../domains/seal/api.js";
import { previewMaterialPack, pushMaterialPack, readMaterialPackFile } from "../../domains/seal/material-pack/index.js";
import {
booleanOption,
parseWebhookMode,
@@ -11,6 +15,12 @@ import {
import { outputOptions } from "../printer.js";
import type { ParsedArgs } from "../types.js";
export async function handleWebhookMaterialPackPreview(filePath: string) {
if (!existsSync(filePath)) throw new Error(`File not found: ${filePath}`);
const input = readMaterialPackFile(filePath);
console.log(JSON.stringify(await previewMaterialPack(input.fileBuffer, input.fileName), null, 2));
}
export async function handleWebhookCommand(
action: string | undefined,
maybeName: string | undefined,
@@ -18,6 +28,29 @@ export async function handleWebhookCommand(
corp: CorpConfig,
args: ParsedArgs
) {
if (action === "material-pack" || action === "material-pack-push") {
const operation = action === "material-pack-push" ? "push" : maybeName;
const filePath = action === "material-pack-push"
? stringOption(args.options.file) ?? stringOption(args.options.input)
: args.command[3] ?? stringOption(args.options.file) ?? stringOption(args.options.input);
if (!filePath) throw new Error("Usage: seal-use webhook material-pack <preview|push> <材料包.zip>");
if (!existsSync(filePath)) throw new Error(`File not found: ${filePath}`);
const input = readMaterialPackFile(filePath);
if (operation === "preview") {
console.log(JSON.stringify(await previewMaterialPack(input.fileBuffer, input.fileName), null, 2));
return;
}
if (operation !== "push") throw new Error("Usage: seal-use webhook material-pack <preview|push> <材料包.zip>");
const selector = stringOption(args.options.webhook) ?? stringOption(args.options.selector);
if (!selector) throw new Error("Push requires --webhook <idOrName>");
const integration = findWebhookIntegration(await api.listWebhookIntegrations(client), selector);
const result = await pushMaterialPack(input.fileBuffer, input.fileName, {
webhookUrl: integration.incomingDocumentWebhook.url,
secret: integration.secret
});
console.log(JSON.stringify(result, null, 2));
return;
}
if (action === "list") {
await runTool(
"seal_webhook_list",
+3
View File
@@ -27,6 +27,9 @@ export function globalConfigSummary(config: GlobalConfig = loadGlobalConfig()) {
...(config.stateful && config.defaultCorpId
? { defaultCorpId: config.defaultCorpId }
: {}),
...(config.testEnterprisesDir
? { testEnterprisesDir: config.testEnterprisesDir }
: {}),
lint: config.lint,
configFile: resolveGlobalConfigFile()
};
+10 -3
View File
@@ -19,12 +19,19 @@ export function parseArgs(argv: string[]): ParsedArgs {
}
if (arg.startsWith("-")) {
const key = arg.replace(/^-+/, "");
const raw = arg.replace(/^-+/, "");
if (raw.includes("=")) {
const eqIdx = raw.indexOf("=");
const key = raw.slice(0, eqIdx);
const val = raw.slice(eqIdx + 1);
options[key] = val;
continue;
}
const next = argv[index + 1];
if (!next || next.startsWith("-")) {
options[key] = true;
options[raw] = true;
} else {
options[key] = next;
options[raw] = next;
index += 1;
}
continue;
+9 -4
View File
@@ -2,10 +2,10 @@ import { writeFileSync } from "node:fs";
import { booleanOption, stringOption } from "./parser.js";
import type { OutputOptions } from "./types.js";
export const RULE_LIST_FULL_COUNT_LIMIT = 100;
export const RULE_LIST_FULL_BYTES_LIMIT = 120_000;
const RULE_LIST_FULL_COUNT_LIMIT = 100;
const RULE_LIST_FULL_BYTES_LIMIT = 120_000;
export const RULE_SUMMARY_FIELDS = ["id", "code", "status", "strictness", "scope", "createdAt", "updatedAt"];
export const DEFAULT_OUTPUT_BYTES_LIMIT = 200_000;
const DEFAULT_OUTPUT_BYTES_LIMIT = 200_000;
export function formatConsoleOutput(values: unknown[]): string {
return values.map((value) => (typeof value === "string" ? value : String(value))).join(" ");
@@ -33,7 +33,7 @@ export function printJson(value: unknown, options: OutputOptions = {}) {
console.log(json.trimEnd());
}
export function protectLargeOutput(result: unknown, options: OutputOptions = {}) {
function protectLargeOutput(result: unknown, options: OutputOptions = {}) {
if (options.allowFull || options.outputFile) return;
const bodyBytes = Buffer.byteLength(JSON.stringify(result), "utf-8");
if (bodyBytes > DEFAULT_OUTPUT_BYTES_LIMIT) {
@@ -87,6 +87,8 @@ Usage:
seal-use config paths
seal-use config get
seal-use config mode <stateful|stateless> [--corp <corpId>]
seal-use config test-dir [<path>|--clear]
seal-use config lint [status|enable|disable] [--linter <name|path>] [--min-score <score>]
seal-use update [--check] [--force] [--version <v>]
seal-use update check
seal-use update changelog [--limit <n>]
@@ -121,6 +123,8 @@ Usage:
seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--corp <corpId>]
seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--corp <corpId>]
seal-use webhook delete <idOrName> --yes [--corp <corpId>]
seal-use webhook material-pack preview <材料包.zip|信息表.xlsx> [--corp <corpId>]
seal-use webhook material-pack push <材料包.zip|信息表.xlsx> --webhook <idOrName> [--corp <corpId>]
seal-use deploy hosecloud requirements [--corp <corpId>]
seal-use deploy hosecloud list [--corp <corpId>]
seal-use deploy hosecloud get <sign-key> [--corp <corpId>]
@@ -153,6 +157,7 @@ Usage:
seal-use approval-runs cited-rules <recordId> [--corp <corpId>]
seal-use approval-runs document-summary <recordId> [--corp <corpId>]
seal-use approval-runs attachments <recordId> [--summary] [--corp <corpId>]
seal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>] [--corp <corpId>]
seal-use approval-runs result <recordId> [--summary] [--corp <corpId>]
seal-use approval-runs url [--corp <corpId>]
seal-use approval-runs url <recordId> [--corp <corpId>]
+45 -2
View File
@@ -3,6 +3,7 @@
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { createSealClient } from "../core/http/factory.js";
import type { CorpConfig } from "../core/config/types.js";
import { VERSION } from "../version.js";
import { handleApprovalRunsCommand } from "./commands/approval-runs.js";
import { handleAuthCommand } from "./commands/auth.js";
@@ -28,7 +29,7 @@ import { handleToolCommand } from "./commands/tool.js";
import { handleToolsListCommand } from "./commands/tools.js";
import { handleUpdateCommand } from "./commands/update.js";
import { handleUsersCommand } from "./commands/users.js";
import { handleWebhookCommand } from "./commands/webhook.js";
import { handleWebhookCommand, handleWebhookMaterialPackPreview } from "./commands/webhook.js";
import { selectCorp } from "./helpers.js";
import { booleanOption, numberOption, parseArgs, stringOption } from "./parser.js";
import {
@@ -44,6 +45,7 @@ const DEFAULT_APP_ROOT = dirname(dirname(dirname(fileURLToPath(import.meta.url))
const KNOWN_AREAS = new Set([
"config",
"service",
"stop",
"http",
"serve",
"update",
@@ -77,9 +79,23 @@ const KNOWN_AREAS = new Set([
export type { CliResult, CliRunOptions } from "./types.js";
const STANDING_COMMANDS = new Set(["http", "server", "web", "mcp"]);
function isStandingCommand(argv: string[]): boolean {
if (!argv.length) return false;
const first = argv[0]?.toLowerCase();
const second = argv[1]?.toLowerCase();
if (first && STANDING_COMMANDS.has(first)) return true;
if ((first === "service" || first === "daemon") && second === "run") return true;
return false;
}
let runQueue = Promise.resolve();
export function runCli(argv: string[], options: CliRunOptions = {}): Promise<CliResult> {
if (isStandingCommand(argv)) {
return runCliOnce(argv, options);
}
const run = runQueue.then(() => runCliOnce(argv, options));
runQueue = run.then(
() => undefined,
@@ -155,6 +171,13 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
throw new Error(`Unknown command: ${args.command.join(" ")}. Run 'seal-use help' for available commands.`);
}
if (area === "webhook" && action === "material-pack" && maybeName === "preview") {
const filePath = args.command[3] ?? stringOption(args.options.file) ?? stringOption(args.options.input);
if (!filePath) throw new Error("Usage: seal-use webhook material-pack preview <材料包.zip>");
await handleWebhookMaterialPackPreview(filePath);
return;
}
if (area === "openapi") {
handleOpenApiCommand(args);
return;
@@ -186,7 +209,12 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
}
if (area === "service") {
await handleServiceCommand(action, runtime);
await handleServiceCommand(action, runtime, args);
return;
}
if (area === "stop") {
await handleServiceCommand("stop", runtime, args);
return;
}
@@ -241,6 +269,21 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
return;
}
if (area === "rules" && action === "lint" && ("file" in args.options || "f" in args.options)) {
let corp: CorpConfig;
try {
corp = selectCorp(stringOption(args.options.corp));
} catch {
corp = {
id: "local",
name: "Local Workspace",
source: { type: "native" }
} as any;
}
await handleRulesCommand(action, maybeName, null as any, corp, args);
return;
}
const corp = selectCorp(stringOption(args.options.corp));
if (area === "source") {
+67 -1
View File
@@ -2,7 +2,7 @@ import { afterEach, describe, expect, test } from "bun:test";
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { serviceStatus } from "./service.js";
import { serviceStatus, readServiceLogs, runServiceCommand } from "./service.js";
const tempDirs: string[] = [];
@@ -27,5 +27,71 @@ describe("service lifecycle state", () => {
expect(status.running).toBe(false);
expect(status.pid).toBeUndefined();
expect(status.port).toBe(8787);
expect(status.host).toBe("127.0.0.1");
expect(status.url).toBeUndefined();
});
test("respects custom port and host configuration", () => {
const stateDir = mkdtempSync(join(tmpdir(), "seal-use-service-"));
tempDirs.push(stateDir);
const status = serviceStatus({
appRoot: "/tmp/seal-use",
entryFile: "/tmp/seal-use/src/cli.ts",
stateDir,
version: "0.10.7",
port: 9090,
host: "0.0.0.0"
});
expect(status.port).toBe(9090);
expect(status.host).toBe("0.0.0.0");
});
test("reads service log file lines safely", () => {
const stateDir = mkdtempSync(join(tmpdir(), "seal-use-service-"));
tempDirs.push(stateDir);
const emptyLogs = readServiceLogs({
appRoot: "/tmp/seal-use",
entryFile: "/tmp/seal-use/src/cli.ts",
stateDir
});
expect(emptyLogs.lines).toEqual([]);
expect(emptyLogs.totalLines).toBe(0);
const logFile = join(stateDir, "service.log");
writeFileSync(logFile, "line 1\nline 2\nline 3\nline 4\nline 5\n");
const logs = readServiceLogs(
{
appRoot: "/tmp/seal-use",
entryFile: "/tmp/seal-use/src/cli.ts",
stateDir
},
3
);
expect(logs.totalLines).toBe(5);
expect(logs.lines).toEqual(["line 3", "line 4", "line 5"]);
});
test("runServiceCommand handles logs and status actions", async () => {
const stateDir = mkdtempSync(join(tmpdir(), "seal-use-service-"));
tempDirs.push(stateDir);
const status = await runServiceCommand("status", {
appRoot: "/tmp/seal-use",
entryFile: "/tmp/seal-use/src/cli.ts",
stateDir
});
expect(status).toHaveProperty("running");
const logs = await runServiceCommand("logs", {
appRoot: "/tmp/seal-use",
entryFile: "/tmp/seal-use/src/cli.ts",
stateDir
});
expect(logs).toHaveProperty("lines");
});
});
+106 -12
View File
@@ -1,6 +1,7 @@
import { spawn, execFileSync } from "node:child_process";
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { startHttpServer, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST } from "../http/server.js";
export type ServiceConfig = {
appRoot: string;
@@ -11,12 +12,14 @@ export type ServiceConfig = {
command: string;
args?: string[];
};
port?: number;
host?: string;
};
export async function runServiceCommand(
action: string | undefined,
config: ServiceConfig,
options: { quiet?: boolean } = {}
options: { quiet?: boolean; maxLines?: number } = {}
) {
switch (action) {
case "run":
@@ -25,31 +28,55 @@ export async function runServiceCommand(
case "start":
return startService(config);
case "stop":
case "kill":
case "down":
case "shutdown":
return stopService(config, options);
case "restart":
stopService(config, { quiet: true });
return startService(config);
case "logs":
case "log":
return readServiceLogs(config, options.maxLines);
case "status":
case undefined:
return serviceStatus(config);
default:
throw new Error("Usage: seal-use service <start|stop|restart|status>");
throw new Error("Usage: seal-use service <start|stop|restart|status|logs>");
}
}
export function serviceStatus(config: ServiceConfig) {
const pidFile = getPidFile(config);
const metaFile = getMetaFile(config);
const pid = readServicePid(pidFile);
const running = pid ? isSealHomeProcess(pid, config.appRoot) : false;
if (pid && !running) {
rmSync(pidFile, { force: true });
if (!running) {
if (pid) rmSync(pidFile, { force: true });
if (existsSync(metaFile)) rmSync(metaFile, { force: true });
}
let storedMeta: { port?: number; host?: string; version?: string } | undefined;
if (running && existsSync(metaFile)) {
try {
storedMeta = JSON.parse(readFileSync(metaFile, "utf8"));
} catch {
// ignore
}
}
const port = config.port ?? storedMeta?.port ?? (process.env.PORT ? Number.parseInt(process.env.PORT, 10) : DEFAULT_HTTP_PORT);
const host = config.host ?? storedMeta?.host ?? (process.env.HOST ? process.env.HOST : DEFAULT_HTTP_HOST);
const version = config.version ?? storedMeta?.version;
return {
running,
pid: running ? pid : undefined,
version: config.version,
version,
port,
host,
url: running ? `http://${host}:${port}` : undefined,
appRoot: config.appRoot,
stateDir: config.stateDir,
pidFile,
@@ -57,28 +84,84 @@ export function serviceStatus(config: ServiceConfig) {
};
}
export function readServiceLogs(config: ServiceConfig, maxLines = 50) {
const logFile = getLogFile(config);
if (!existsSync(logFile)) {
return {
logFile,
lines: [],
totalLines: 0
};
}
const content = readFileSync(logFile, "utf8");
const allLines = content.split("\n").filter(Boolean);
const lines = allLines.slice(-maxLines);
return {
logFile,
lines,
totalLines: allLines.length
};
}
async function runService(config: ServiceConfig) {
const pidFile = getPidFile(config);
const metaFile = getMetaFile(config);
const logFile = getLogFile(config);
ensureStateDir(config.stateDir);
writeFileSync(pidFile, `${process.pid}\n`, { mode: 0o600 });
appendLog(logFile, `running pid=${process.pid}`);
const cleanup = () => {
const port = config.port ?? (process.env.PORT ? Number.parseInt(process.env.PORT, 10) : DEFAULT_HTTP_PORT);
const host = config.host ?? (process.env.HOST ? process.env.HOST : DEFAULT_HTTP_HOST);
writeFileSync(pidFile, `${process.pid}\n`, { mode: 0o600 });
writeFileSync(
metaFile,
JSON.stringify(
{
pid: process.pid,
port,
host,
version: config.version,
startedAt: new Date().toISOString()
},
null,
2
),
{ mode: 0o600 }
);
appendLog(logFile, `service starting on http://${host}:${port} pid=${process.pid}`);
let server: Awaited<ReturnType<typeof startHttpServer>> | null = null;
try {
server = await startHttpServer({ port, host, silent: true });
appendLog(logFile, `service listening pid=${process.pid}`);
} catch (err: unknown) {
appendLog(logFile, `service failed to bind port ${port}: ${err instanceof Error ? err.message : String(err)}`);
if (readServicePid(pidFile) === process.pid) {
rmSync(pidFile, { force: true });
rmSync(metaFile, { force: true });
}
throw err;
}
const cleanup = () => {
if (server) {
server.close();
server = null;
}
if (readServicePid(pidFile) === process.pid) {
rmSync(pidFile, { force: true });
rmSync(metaFile, { force: true });
}
appendLog(logFile, `stopped pid=${process.pid}`);
};
await new Promise<void>((resolve) => {
let stopped = false;
const heartbeat = setInterval(() => {}, 60_000);
const stop = () => {
if (stopped) return;
stopped = true;
cleanup();
clearInterval(heartbeat);
process.off("SIGTERM", stop);
process.off("SIGINT", stop);
resolve();
@@ -96,11 +179,15 @@ function startService(config: ServiceConfig) {
}
const launcher = config.launcher ?? { command: process.execPath, args: [config.entryFile] };
const child = spawn(launcher.command, [
const serviceArgs = [
...(launcher.args ?? []),
"service",
"run"
], {
];
if (config.port) serviceArgs.push("--port", String(config.port));
if (config.host) serviceArgs.push("--host", String(config.host));
const child = spawn(launcher.command, serviceArgs, {
cwd: config.appRoot,
detached: true,
stdio: ["ignore", "ignore", "ignore"],
@@ -116,14 +203,17 @@ function startService(config: ServiceConfig) {
function stopService(config: ServiceConfig, options: { quiet?: boolean } = {}) {
const pidFile = getPidFile(config);
const metaFile = getMetaFile(config);
const pid = readServicePid(pidFile);
if (!pid || !isSealHomeProcess(pid, config.appRoot)) {
rmSync(pidFile, { force: true });
rmSync(metaFile, { force: true });
return options.quiet ? undefined : { stopped: false, reason: "not running" };
}
process.kill(pid, "SIGTERM");
rmSync(pidFile, { force: true });
rmSync(metaFile, { force: true });
appendLog(getLogFile(config), `stop requested pid=${pid}`);
return options.quiet ? undefined : { stopped: true, pid };
}
@@ -156,6 +246,10 @@ function getPidFile(config: ServiceConfig) {
return join(config.stateDir, "service.pid");
}
function getMetaFile(config: ServiceConfig) {
return join(config.stateDir, "service.json");
}
function getLogFile(config: ServiceConfig) {
return join(config.stateDir, "service.log");
}
-4
View File
@@ -39,10 +39,6 @@ export async function getSealSessionForCorp(corp: CorpConfig): Promise<SealSessi
return next;
}
export async function getSealToken(corp: CorpConfig): Promise<string> {
return (await getSealSessionForCorp(corp)).token;
}
export async function resolveSealEnterpriseConfig(
corp: CorpConfig
): Promise<SealEnterpriseConfig> {
+24 -9
View File
@@ -84,21 +84,34 @@ describe("loadCorpConfigs", () => {
expect(loadCorpConfigs()).toEqual([]);
});
test("merges local and user enterprise directories with user configs taking precedence", () => {
test("does not load current directory enterprises by default, only reading user directory", () => {
const workspace = makeTempDir();
const workspaceEnterprises = join(workspace, "enterprises");
const userDir = makeTempDir();
mkdirSync(workspaceEnterprises, { recursive: true });
writeCorpConfig(join(workspaceEnterprises, "shared.json"), "shared", "Workspace");
writeCorpConfig(join(userDir, "shared.json"), "shared", "User");
writeCorpConfig(join(workspaceEnterprises, "cwd-only.json"), "cwd-only", "CWD Enterprise");
writeCorpConfig(join(userDir, "user-only.json"), "user-only", "User Only");
process.chdir(workspace);
process.env.SEAL_USE_USER_ENTERPRISES_DIR = userDir;
expect(loadCorpConfigs().map((corp) => [corp.id, corp.name])).toEqual([
["shared", "User"],
["user-only", "User Only"]
]);
// cwd enterprises/ should NOT be loaded by default
expect(loadCorpConfigs().map((corp) => corp.id)).toEqual(["user-only"]);
});
test("loads testEnterprisesDir from global config when specified", () => {
const testDir = makeTempDir();
const userDir = makeTempDir();
writeCorpConfig(join(testDir, "test-corp.json"), "test-corp", "Test Corp");
writeCorpConfig(join(userDir, "user-corp.json"), "user-corp", "User Corp");
const configFile = join(makeTempDir(), "config.json");
process.env.SEAL_USE_CONFIG_FILE = configFile;
process.env.SEAL_USE_USER_ENTERPRISES_DIR = userDir;
saveGlobalConfig({ testEnterprisesDir: testDir });
const corps = loadCorpConfigs();
expect(corps.map((corp) => corp.id).sort()).toEqual(["test-corp", "user-corp"].sort());
});
test("defaults global config to stateless", () => {
@@ -114,13 +127,14 @@ describe("loadCorpConfigs", () => {
});
});
test("saves and loads the global state mode", () => {
test("saves and loads the global state mode and testEnterprisesDir", () => {
const file = join(makeTempDir(), "nested", "config.json");
process.env.SEAL_USE_CONFIG_FILE = file;
expect(saveGlobalConfig({ stateful: true, defaultCorpId: "corp-a" })).toEqual({
expect(saveGlobalConfig({ stateful: true, defaultCorpId: "corp-a", testEnterprisesDir: "/tmp/test-corps" })).toEqual({
stateful: true,
defaultCorpId: "corp-a",
testEnterprisesDir: "/tmp/test-corps",
lint: {
enabled: false,
activeLinter: "builtin",
@@ -131,6 +145,7 @@ describe("loadCorpConfigs", () => {
expect(loadGlobalConfig()).toEqual({
stateful: true,
defaultCorpId: "corp-a",
testEnterprisesDir: "/tmp/test-corps",
lint: {
enabled: false,
activeLinter: "builtin",
+13 -18
View File
@@ -3,7 +3,6 @@ import { homedir } from "node:os";
import { dirname, join } from "node:path";
import { CorpConfig, CorpConfigSchema, GlobalConfig, GlobalConfigInput, GlobalConfigSchema } from "./types.js";
const ENTERPRISES_DIR = "enterprises";
const CONFIG_ENV = "SEAL_USE_ENTERPRISES_DIR";
const LEGACY_CONFIG_ENV = "SEAL_HOME_ENTERPRISES_DIR";
const USER_DIR_ENV = "SEAL_USE_USER_ENTERPRISES_DIR";
@@ -13,7 +12,6 @@ const LEGACY_GLOBAL_CONFIG_ENV = "SEAL_HOME_CONFIG_FILE";
export const PRIMARY_USER_ENTERPRISES_DIR = join(homedir(), ".config", "seal-use", "enterprises");
export const LEGACY_USER_ENTERPRISES_DIR = join(homedir(), ".config", "seal-home", "enterprises");
export const USER_ENTERPRISES_DIR = PRIMARY_USER_ENTERPRISES_DIR;
const PRIMARY_GLOBAL_CONFIG_FILE = join(homedir(), ".config", "seal-use", "config.json");
const LEGACY_GLOBAL_CONFIG_FILE = join(homedir(), ".config", "seal-home", "config.json");
@@ -39,18 +37,21 @@ export function resolveEnterprisesDir(): string | undefined {
return resolveEnterprisesDirs()[0];
}
export function resolveEnterprisesDirs(): string[] {
function resolveEnterprisesDirs(): string[] {
const configured = (process.env[CONFIG_ENV] ?? process.env[LEGACY_CONFIG_ENV])?.trim();
if (configured) return existsSync(configured) ? [configured] : [];
const configuredUserDir = (process.env[USER_DIR_ENV] ?? process.env[LEGACY_USER_DIR_ENV])?.trim();
if (configuredUserDir) {
return [ENTERPRISES_DIR, configuredUserDir].filter((dir) => existsSync(dir));
}
const userDirs = configuredUserDir
? (existsSync(configuredUserDir) ? [configuredUserDir] : [])
: [PRIMARY_USER_ENTERPRISES_DIR, LEGACY_USER_ENTERPRISES_DIR];
const dirs = [ENTERPRISES_DIR, PRIMARY_USER_ENTERPRISES_DIR, LEGACY_USER_ENTERPRISES_DIR];
const globalConfig = loadGlobalConfig();
const testDir = globalConfig.testEnterprisesDir?.trim();
const candidates = testDir ? [testDir, ...userDirs] : userDirs;
const uniqueExisting: string[] = [];
for (const d of dirs) {
for (const d of candidates) {
if (existsSync(d) && !uniqueExisting.includes(d)) {
uniqueExisting.push(d);
}
@@ -58,27 +59,21 @@ export function resolveEnterprisesDirs(): string[] {
return uniqueExisting;
}
export function resolvePrimaryEnterprisesDir(): string | undefined {
const configured = (process.env[CONFIG_ENV] ?? process.env[LEGACY_CONFIG_ENV])?.trim();
if (configured) return existsSync(configured) ? configured : undefined;
if (existsSync(ENTERPRISES_DIR)) return ENTERPRISES_DIR;
if (existsSync(PRIMARY_USER_ENTERPRISES_DIR)) return PRIMARY_USER_ENTERPRISES_DIR;
if (existsSync(LEGACY_USER_ENTERPRISES_DIR)) return LEGACY_USER_ENTERPRISES_DIR;
return undefined;
}
export function resolveWritableEnterprisesDir(): string {
const configured = (process.env[CONFIG_ENV] ?? process.env[LEGACY_CONFIG_ENV])?.trim();
if (configured) return configured;
const configuredUserDir = (process.env[USER_DIR_ENV] ?? process.env[LEGACY_USER_DIR_ENV])?.trim();
if (configuredUserDir) return configuredUserDir;
const testDir = loadGlobalConfig().testEnterprisesDir?.trim();
if (testDir && existsSync(testDir)) return testDir;
return PRIMARY_USER_ENTERPRISES_DIR;
}
export function getEnterprisesDirCandidates(): string[] {
const testDir = loadGlobalConfig().testEnterprisesDir?.trim();
return [
`${CONFIG_ENV}=<path>`,
ENTERPRISES_DIR,
...(testDir ? [`testEnterprisesDir: ${testDir}`] : []),
PRIMARY_USER_ENTERPRISES_DIR,
LEGACY_USER_ENTERPRISES_DIR
];
+1
View File
@@ -97,6 +97,7 @@ export const GlobalLintConfigSchema = z.object({
export const GlobalConfigSchema = z.object({
stateful: z.boolean().default(false),
defaultCorpId: z.string().min(1).optional(),
testEnterprisesDir: z.string().min(1).optional(),
lint: GlobalLintConfigSchema
});
+2 -2
View File
@@ -36,11 +36,11 @@ export function getDefaultGlobalSkillDir(): string {
return join(homedir(), ".agents", "skills", "seal-use");
}
export function getLegacyGlobalSkillDir(): string {
function getLegacyGlobalSkillDir(): string {
return join(homedir(), ".agents", "skills", "seal-home");
}
export function cleanLegacySkillDir(): boolean {
function cleanLegacySkillDir(): boolean {
const legacyDir = getLegacyGlobalSkillDir();
if (existsSync(legacyDir)) {
try {
+352
View File
@@ -0,0 +1,352 @@
import { describe, test, expect, beforeEach, afterEach } from "bun:test";
import fs from "node:fs";
import path from "node:path";
import os from "node:os";
import {
extractApprovalRunAttachments,
downloadApprovalRunAttachments,
sanitizeUrlForLog,
sanitizeFileName,
type FetchLike
} from "./attachments.js";
import type { ApprovalRun } from "./types.js";
describe("attachments domain", () => {
let tmpDir: string;
beforeEach(async () => {
tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "seal-att-test-"));
});
afterEach(async () => {
try {
await fs.promises.rm(tmpDir, { recursive: true, force: true });
} catch {}
});
test("sanitizeUrlForLog masks query string signatures", () => {
const rawUrl = "https://oss-bucket.aliyuncs.com/tenant/doc1/pic.jpg?X-Amz-Signature=secret123&OSSAccessKeyId=key456";
const masked = sanitizeUrlForLog(rawUrl);
expect(masked).toBe("https://oss-bucket.aliyuncs.com/tenant/doc1/pic.jpg?[MASKED]");
expect(masked).not.toContain("secret123");
expect(masked).not.toContain("key456");
const plainUrl = "https://example.com/files/receipt.pdf";
expect(sanitizeUrlForLog(plainUrl)).toBe("https://example.com/files/receipt.pdf");
});
test("sanitizeFileName strips dangerous characters", () => {
expect(sanitizeFileName("foo/bar:baz?.png")).toBe("foo_bar_baz_.png");
expect(sanitizeFileName("../../evil.exe")).toBe(".._.._evil.exe");
expect(sanitizeFileName("")).toBe("attachment");
});
test("extractApprovalRunAttachments extracts attachments from Issue #35 field structure", () => {
const fixture: ApprovalRun = {
id: "run-hose-1",
status: "completed",
sourceDocumentSN: "BX2026080001",
sourceDocumentId: "doc-hose-1",
document: {
id: "doc-1",
sn: "BX2026080001",
fields: [
{ key: "expense_type", label: "费用类型", value: "差旅" },
{
key: "attachments",
type: "ATTACHMENT",
label: "附件",
value: [
{
url: "https://oss-bucket.aliyuncs.com/tenant/attachments/doc1/receipt1.jpg",
ossSignedUrl: "https://oss-bucket.aliyuncs.com/tenant/attachments/doc1/receipt1.jpg?X-Amz-Signature=sig1",
name: "发票1.jpg",
token: JSON.stringify({ source: "hosecloud", fileId: "file-101", key: "obj-key-101" }),
fileId: "file-101",
ossPath: "tenant/attachments/doc1/obj-key-101",
category: "file",
mimeType: "image/jpeg",
ossFileSize: 1024
},
{
url: "https://oss-bucket.aliyuncs.com/tenant/attachments/doc1/receipt2.jpg",
ossSignedUrl: "https://oss-bucket.aliyuncs.com/tenant/attachments/doc1/receipt2.jpg?X-Amz-Signature=sig2",
name: "水单2.jpg",
token: JSON.stringify({ source: "hosecloud", fileId: "file-102", key: "obj-key-102" }),
fileId: "file-102",
ossPath: "tenant/attachments/doc1/obj-key-102",
category: "file",
mimeType: "image/jpeg",
ossFileSize: 2048
},
{
url: "https://oss-bucket.aliyuncs.com/tenant/attachments/doc1/doc3.pdf",
ossSignedUrl: "https://oss-bucket.aliyuncs.com/tenant/attachments/doc1/doc3.pdf?X-Amz-Signature=sig3",
name: "行程单.pdf",
token: JSON.stringify({ source: "hosecloud", fileId: "file-103", key: "obj-key-103" }),
fileId: "file-103",
category: "file",
mimeType: "application/pdf",
ossFileSize: 4096
},
{
url: "https://oss-bucket.aliyuncs.com/tenant/attachments/doc1/photo4.png",
ossSignedUrl: "https://oss-bucket.aliyuncs.com/tenant/attachments/doc1/photo4.png?X-Amz-Signature=sig4",
name: "现场打卡.png",
token: JSON.stringify({ source: "hosecloud", fileId: "file-104", key: "obj-key-104" }),
fileId: "file-104",
category: "file",
mimeType: "image/png",
ossFileSize: 8192
}
]
}
]
}
};
const fullResult = extractApprovalRunAttachments(fixture);
expect(fullResult.count).toBe(4);
expect(fullResult.recordId).toBe("run-hose-1");
expect(fullResult.sourceDocumentSN).toBe("BX2026080001");
const first = fullResult.attachments[0] as any;
expect(first.fileName).toBe("发票1.jpg");
expect(first.fileId).toBe("file-101");
expect(first.tokenKey).toBe("obj-key-101");
expect(first.ossFileSize).toBe(1024);
expect(first.ossSignedUrl).toContain("X-Amz-Signature=sig1");
expect(first.sourceField).toBe("附件");
expect(first.kind).toBe("invoice"); // "发票" in name triggers invoice kind
const summaryResult = extractApprovalRunAttachments(fixture, { summary: true });
expect(summaryResult.count).toBe(4);
expect((summaryResult.attachments[0] as any).hasSignedUrl).toBe(true);
expect((summaryResult.attachments[0] as any).ossFileSize).toBe(1024);
expect((summaryResult.attachments[0] as any).ossSignedUrl).toBeUndefined(); // summary masks raw url
});
test("extractApprovalRunAttachments extracts attachments from legacy layout", () => {
const fixture: ApprovalRun = {
id: "run-legacy-1",
status: "completed",
document: {
fields: [
{
label: "附件",
attachments: [
{
fileName: "legacy.pdf",
fileId: "file-legacy-1",
mimeType: "application/pdf",
ossPath: "oss://bucket/legacy.pdf"
}
]
}
]
}
};
const result = extractApprovalRunAttachments(fixture);
expect(result.count).toBe(1);
expect((result.attachments[0] as any).fileName).toBe("legacy.pdf");
expect((result.attachments[0] as any).fileId).toBe("file-legacy-1");
});
test("downloadApprovalRunAttachments downloads all files with --all and matches size", async () => {
const content1 = Buffer.from("Invoice mock data 12345");
const content2 = Buffer.from("Receipt mock data 67890");
const fakeFetch: FetchLike = async (url: any) => {
const urlStr = String(url);
if (urlStr.includes("att1.jpg")) {
return new Response(content1, { status: 200 });
}
if (urlStr.includes("att2.jpg")) {
return new Response(content2, { status: 200 });
}
return new Response("Not found", { status: 404 });
};
const record: ApprovalRun = {
id: "run-dl-1",
document: {
fields: [
{
key: "attachments",
type: "ATTACHMENT",
label: "附件",
value: [
{
name: "发票.jpg",
ossSignedUrl: "https://oss.example.com/att1.jpg?sign=abc",
ossFileSize: content1.length
},
{
name: "水单.jpg",
ossSignedUrl: "https://oss.example.com/att2.jpg?sign=def",
ossFileSize: content2.length
}
]
}
]
}
};
const result = await downloadApprovalRunAttachments({
record,
all: true,
outDir: tmpDir,
fetchFn: fakeFetch
});
expect(result.total).toBe(2);
expect(result.downloaded).toBe(2);
expect(result.failed).toBe(0);
const file1Path = path.join(tmpDir, "发票.jpg");
const file2Path = path.join(tmpDir, "水单.jpg");
expect(fs.existsSync(file1Path)).toBe(true);
expect(fs.existsSync(file2Path)).toBe(true);
expect(fs.readFileSync(file1Path)).toEqual(content1);
expect(fs.readFileSync(file2Path)).toEqual(content2);
});
test("downloadApprovalRunAttachments filters by --name", async () => {
const content = Buffer.from("Target attachment data");
const fakeFetch: FetchLike = async () => new Response(content, { status: 200 });
const record: ApprovalRun = {
id: "run-dl-2",
document: {
fields: [
{
key: "attachments",
type: "ATTACHMENT",
value: [
{ name: "test_a.pdf", ossSignedUrl: "https://oss.example.com/a.pdf" },
{ name: "target_b.pdf", ossSignedUrl: "https://oss.example.com/b.pdf" }
]
}
]
}
};
const result = await downloadApprovalRunAttachments({
record,
name: "target_b",
outDir: tmpDir,
fetchFn: fakeFetch
});
expect(result.total).toBe(1);
expect(result.downloaded).toBe(1);
expect(result.files[0]!.name).toBe("target_b.pdf");
expect(fs.existsSync(path.join(tmpDir, "target_b.pdf"))).toBe(true);
expect(fs.existsSync(path.join(tmpDir, "test_a.pdf"))).toBe(false);
});
test("downloadApprovalRunAttachments requires --all when multiple attachments exist without filter", async () => {
const record: ApprovalRun = {
id: "run-dl-3",
document: {
fields: [
{
key: "attachments",
type: "ATTACHMENT",
value: [
{ name: "f1.jpg", ossSignedUrl: "https://oss.example.com/1.jpg" },
{ name: "f2.jpg", ossSignedUrl: "https://oss.example.com/2.jpg" }
]
}
]
}
};
expect(
downloadApprovalRunAttachments({
record,
outDir: tmpDir
})
).rejects.toThrow("请使用 --all 下载全部附件");
});
test("downloadApprovalRunAttachments handles expired URL (HTTP 403) gracefully without aborting others", async () => {
const validContent = Buffer.from("Valid attachment data");
const fakeFetch: FetchLike = async (url: any) => {
const urlStr = String(url);
if (urlStr.includes("expired.jpg")) {
return new Response("Access Denied / Expired", { status: 403, statusText: "Forbidden" });
}
return new Response(validContent, { status: 200 });
};
const record: ApprovalRun = {
id: "run-dl-4",
document: {
fields: [
{
key: "attachments",
type: "ATTACHMENT",
value: [
{ name: "expired.jpg", ossSignedUrl: "https://oss.example.com/expired.jpg?sign=old" },
{ name: "valid.jpg", ossSignedUrl: "https://oss.example.com/valid.jpg?sign=fresh" }
]
}
]
}
};
const result = await downloadApprovalRunAttachments({
record,
all: true,
outDir: tmpDir,
fetchFn: fakeFetch
});
expect(result.total).toBe(2);
expect(result.downloaded).toBe(1);
expect(result.failed).toBe(1);
const failedItem = result.files.find((f) => f.name === "expired.jpg");
expect(failedItem?.status).toBe("failed");
expect(failedItem?.error).toContain("403");
const successItem = result.files.find((f) => f.name === "valid.jpg");
expect(successItem?.status).toBe("success");
expect(fs.existsSync(path.join(tmpDir, "valid.jpg"))).toBe(true);
});
test("downloadApprovalRunAttachments disambiguates duplicate filenames", async () => {
const fakeFetch: FetchLike = async () => new Response("data", { status: 200 });
const record: ApprovalRun = {
id: "run-dl-5",
document: {
fields: [
{
key: "attachments",
type: "ATTACHMENT",
value: [
{ name: "same.jpg", ossSignedUrl: "https://oss.example.com/1.jpg" },
{ name: "same.jpg", ossSignedUrl: "https://oss.example.com/2.jpg" }
]
}
]
}
};
const result = await downloadApprovalRunAttachments({
record,
all: true,
outDir: tmpDir,
fetchFn: fakeFetch
});
expect(result.downloaded).toBe(2);
expect(result.files.map((f) => f.name)).toEqual(["same.jpg", "same_1.jpg"]);
expect(fs.existsSync(path.join(tmpDir, "same.jpg"))).toBe(true);
expect(fs.existsSync(path.join(tmpDir, "same_1.jpg"))).toBe(true);
});
});
+427
View File
@@ -0,0 +1,427 @@
import fs from "node:fs";
import path from "node:path";
import type { ApprovalRun } from "./types.js";
export interface ApprovalRunAttachment {
path: string;
fieldPath: string;
kind: string;
fileName?: string;
mimeType?: string;
fileId?: string;
ossPath?: string;
url?: string;
ossSignedUrl?: string;
token?: unknown;
tokenKey?: string;
category?: string;
ossFileSize?: number;
invoiceId?: string;
sourceField?: string;
}
export interface ApprovalRunAttachmentsResult {
recordId: string;
sourceDocumentSN?: string;
sourceDocumentId?: string;
count: number;
attachments: Array<Record<string, unknown>>;
}
export type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
export interface DownloadAttachmentsOptions {
record: ApprovalRun;
all?: boolean;
name?: string;
outDir?: string;
fetchFn?: FetchLike;
}
export interface DownloadedAttachmentFile {
name: string;
fileId?: string;
path?: string;
size?: number;
expectedSize?: number;
status: "success" | "failed";
error?: string;
sourceField?: string;
tokenKey?: string;
}
export interface DownloadAttachmentsResult {
recordId: string;
outDir: string;
total: number;
downloaded: number;
failed: number;
files: DownloadedAttachmentFile[];
}
interface CollectContext {
fieldLabel?: string;
fieldKey?: string;
fieldType?: string;
}
export function sanitizeUrlForLog(url: string): string {
try {
const parsed = new URL(url);
if (parsed.search) {
return `${parsed.origin}${parsed.pathname}?[MASKED]`;
}
return url;
} catch {
return url.replace(/\?.*$/, "?[MASKED]");
}
}
export function sanitizeFileName(name: string): string {
const cleaned = name.replace(/[/\\?%*:|"<>]/g, "_").trim();
return cleaned || "attachment";
}
function compactObject(object: Record<string, unknown>) {
return Object.fromEntries(Object.entries(object).filter(([, value]) => value !== undefined));
}
function asRecord(value: unknown): Record<string, unknown> | undefined {
return value && typeof value === "object" && !Array.isArray(value)
? value as Record<string, unknown>
: undefined;
}
function stringFromUnknown(value: unknown): string | undefined {
return typeof value === "string" && value.trim() ? value.trim() : undefined;
}
function numberFromUnknown(value: unknown): number | undefined {
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
}
function tryParseToken(token: unknown): Record<string, unknown> | undefined {
if (!token) return undefined;
if (typeof token === "string") {
try {
const parsed = JSON.parse(token);
if (parsed && typeof parsed === "object") return parsed as Record<string, unknown>;
} catch {
return undefined;
}
}
if (typeof token === "object" && !Array.isArray(token)) {
return token as Record<string, unknown>;
}
return undefined;
}
function looksLikeAttachment(object: Record<string, unknown>, path: string, context?: CollectContext): boolean {
// If parent field explicitly declares ATTACHMENT type, any item with file properties is an attachment
if (context?.fieldType?.toUpperCase() === "ATTACHMENT") {
const hasIdentifier = Boolean(
object.fileName ||
object.filename ||
object.name ||
object.originalName ||
object.fileId ||
object.ossPath ||
object.url ||
object.ossSignedUrl ||
object.signedUrl ||
object.token
);
if (hasIdentifier) return true;
}
// Explicit signed URL presence always indicates a download-ready attachment
if (object.ossSignedUrl || object.signedUrl) {
return true;
}
// Check common file identity properties
const fileName = object.fileName ?? object.filename ?? object.name ?? object.originalName;
const fileId = object.fileId ?? object.id ?? object.attachmentId;
const ossPath = object.ossPath ?? object.ossKey;
const url = object.url ?? object.downloadUrl ?? object.previewUrl;
const mimeType = object.mimeType ?? object.mimetype ?? object.contentType;
const ossFileSize = object.ossFileSize ?? object.fileSize ?? object.size;
if (fileName && (url || ossPath || fileId || ossFileSize)) {
return true;
}
if (fileId && (mimeType || ossFileSize || ossPath || url)) {
return true;
}
// Legacy path and keyword based heuristics
const keys = Object.keys(object).map((k) => k.toLowerCase());
const pathHint = /(attachment|attachments|invoice|receipt|file|files|附件|发票)/i.test(path) ||
Boolean(context?.fieldKey && /(attachment|attachments|invoice|receipt|file|files|附件|发票)/i.test(context.fieldKey)) ||
Boolean(context?.fieldLabel && /(attachment|attachments|invoice|receipt|file|files|附件|发票)/i.test(context.fieldLabel));
const fileHints = [
"filename", "filename", "mimetype", "contenttype",
"fileid", "osspath", "signedurl", "downloadurl",
"previewurl", "attachmentid", "ossfilesize", "osssignedurl"
];
return pathHint && fileHints.some((hint) => keys.includes(hint));
}
function inferAttachmentKind(path: string, object: Record<string, unknown>, context?: CollectContext): string {
const normalized = `${path} ${context?.fieldLabel ?? ""} ${context?.fieldKey ?? ""} ${stringFromUnknown(object.type) ?? ""} ${stringFromUnknown(object.category) ?? ""}`.toLowerCase();
if (normalized.includes("invoice") || normalized.includes("发票")) return "invoice";
if (normalized.includes("receipt")) return "receipt";
const name = (stringFromUnknown(object.fileName) ?? stringFromUnknown(object.name) ?? "").toLowerCase();
if (name.includes("发票") || name.includes("invoice")) return "invoice";
return "attachment";
}
function collectAttachments(
value: unknown,
path: string,
output: Array<Record<string, unknown>>,
seen: Set<string>,
context?: CollectContext
) {
if (Array.isArray(value)) {
value.forEach((item, index) => collectAttachments(item, `${path}.${index}`, output, seen, context));
return;
}
const object = asRecord(value);
if (!object) return;
// Determine if this object is a field container (e.g. in document.fields[])
const isFieldContainer = (object.type && typeof object.type === "string") ||
("label" in object && "value" in object) ||
("key" in object && "value" in object);
let nextContext = context;
if (isFieldContainer) {
nextContext = {
fieldLabel: stringFromUnknown(object.label) ?? context?.fieldLabel,
fieldKey: stringFromUnknown(object.key) ?? context?.fieldKey,
fieldType: stringFromUnknown(object.type) ?? context?.fieldType
};
}
// If this object itself qualifies as an attachment file
// (containers that just have array value without url/fileId are not attachment files)
const isContainerOnly = Array.isArray(object.value) && !object.url && !object.ossSignedUrl && !object.fileId;
if (!isContainerOnly && looksLikeAttachment(object, path, context)) {
const parsedToken = tryParseToken(object.token);
const tokenKey = stringFromUnknown(parsedToken?.key);
const tokenFileId = stringFromUnknown(parsedToken?.fileId);
const attachment = compactObject({
path,
fieldPath: path,
kind: inferAttachmentKind(path, object, context),
fileName: stringFromUnknown(object.fileName) ?? stringFromUnknown(object.filename) ?? stringFromUnknown(object.name) ?? stringFromUnknown(object.originalName),
mimeType: stringFromUnknown(object.mimeType) ?? stringFromUnknown(object.mimetype) ?? stringFromUnknown(object.contentType),
fileId: stringFromUnknown(object.fileId) ?? stringFromUnknown(object.id) ?? stringFromUnknown(object.attachmentId) ?? tokenFileId,
ossPath: stringFromUnknown(object.ossPath) ?? stringFromUnknown(object.ossKey) ?? tokenKey,
url: stringFromUnknown(object.url) ?? stringFromUnknown(object.signedUrl) ?? stringFromUnknown(object.downloadUrl) ?? stringFromUnknown(object.previewUrl),
ossSignedUrl: stringFromUnknown(object.ossSignedUrl) ?? stringFromUnknown(object.signedUrl),
token: object.token,
tokenKey,
category: stringFromUnknown(object.category),
ossFileSize: numberFromUnknown(object.ossFileSize) ?? numberFromUnknown(object.fileSize) ?? numberFromUnknown(object.size),
invoiceId: stringFromUnknown(object.invoiceId),
sourceField: stringFromUnknown(object.fieldName) ?? stringFromUnknown(object.label) ?? context?.fieldLabel ?? context?.fieldKey
});
const key = JSON.stringify(attachment);
if (!seen.has(key)) {
seen.add(key);
output.push(attachment);
}
}
for (const [key, child] of Object.entries(object)) {
collectAttachments(child, `${path}.${key}`, output, seen, nextContext);
}
}
export function extractApprovalRunAttachments(
record: ApprovalRun,
options: { summary?: boolean } = {}
): ApprovalRunAttachmentsResult {
const roots: Array<[string, unknown]> = [
["document", record.document],
["result", record.result],
["pipelineData", record.pipelineData],
["sourceExtendData", record.sourceExtendData]
];
const attachments: Array<Record<string, unknown>> = [];
const seen = new Set<string>();
for (const [path, value] of roots) {
collectAttachments(value, path, attachments, seen);
}
return {
recordId: record.id,
sourceDocumentSN: record.sourceDocumentSN,
sourceDocumentId: record.sourceDocumentId,
count: attachments.length,
attachments: options.summary
? attachments.map((attachment) => compactObject({
path: attachment.path,
kind: attachment.kind,
fileName: attachment.fileName,
mimeType: attachment.mimeType,
fileId: attachment.fileId,
sourceField: attachment.sourceField,
ossFileSize: attachment.ossFileSize,
hasSignedUrl: Boolean(attachment.ossSignedUrl)
}))
: attachments
};
}
export async function downloadApprovalRunAttachments(
options: DownloadAttachmentsOptions
): Promise<DownloadAttachmentsResult> {
const { record, fetchFn = globalThis.fetch } = options;
const extraction = extractApprovalRunAttachments(record, { summary: false });
const allAttachments = extraction.attachments as unknown as ApprovalRunAttachment[];
const resolvedOutDir = path.resolve(options.outDir ?? "./attachments");
if (allAttachments.length === 0) {
return {
recordId: record.id,
outDir: resolvedOutDir,
total: 0,
downloaded: 0,
failed: 0,
files: []
};
}
let selected: ApprovalRunAttachment[] = [];
if (options.name) {
const term = options.name.toLowerCase();
selected = allAttachments.filter((att) => {
const fileName = att.fileName?.toLowerCase() ?? "";
const fileId = att.fileId?.toLowerCase() ?? "";
const tokenKey = att.tokenKey?.toLowerCase() ?? "";
return fileName.includes(term) || fileId === term || tokenKey.includes(term);
});
if (selected.length === 0) {
const available = allAttachments.map((a) => a.fileName ?? a.fileId).filter(Boolean).join(", ");
throw new Error(`未找到匹配 "${options.name}" 的附件。可选附件: ${available || "无"}`);
}
} else if (!options.all) {
if (allAttachments.length > 1) {
const available = allAttachments.map((a) => a.fileName ?? a.fileId).filter(Boolean).join(", ");
throw new Error(
`共发现 ${allAttachments.length} 个附件。请使用 --all 下载全部附件,或使用 --name <名称|fileId> 指定下载项。可选附件: ${available}`
);
}
selected = allAttachments;
} else {
selected = allAttachments;
}
await fs.promises.mkdir(resolvedOutDir, { recursive: true });
const files: DownloadedAttachmentFile[] = [];
const usedNames = new Set<string>();
for (const attachment of selected) {
const rawName = attachment.fileName ?? attachment.fileId ?? "attachment";
const safeBase = sanitizeFileName(rawName);
let targetName = safeBase;
const lastDot = safeBase.lastIndexOf(".");
const stem = lastDot > 0 ? safeBase.slice(0, lastDot) : safeBase;
const ext = lastDot > 0 ? safeBase.slice(lastDot) : "";
let counter = 1;
while (usedNames.has(targetName.toLowerCase())) {
targetName = `${stem}_${counter}${ext}`;
counter++;
}
usedNames.add(targetName.toLowerCase());
const downloadUrl = attachment.ossSignedUrl ?? attachment.url;
if (!downloadUrl) {
console.error(`⚠️ [跳过] 附件 "${rawName}": 记录中无下载直链 (ossSignedUrl/url)`);
files.push({
name: targetName,
fileId: attachment.fileId,
status: "failed",
error: "缺少可用的下载直链 (ossSignedUrl/url)。",
sourceField: attachment.sourceField,
tokenKey: attachment.tokenKey
});
continue;
}
const sanitizedUrl = sanitizeUrlForLog(downloadUrl);
try {
const response = await fetchFn(downloadUrl, {
signal: AbortSignal.timeout(60000)
});
if (!response.ok) {
const errorMsg = response.status === 403
? "HTTP 403 Forbidden: 签名直链可能已过期"
: `HTTP ${response.status} ${response.statusText}`;
throw new Error(errorMsg);
}
const arrayBuffer = await response.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
if (attachment.ossFileSize !== undefined && buffer.length !== attachment.ossFileSize) {
console.error(`⚠️ [校验] 附件 "${targetName}" 实际大小 (${buffer.length} 字节) 与 ossFileSize (${attachment.ossFileSize} 字节) 不一致`);
}
const filePath = path.join(resolvedOutDir, targetName);
await fs.promises.writeFile(filePath, buffer);
console.error(`✓ 已下载: ${targetName} (${buffer.length} 字节)`);
files.push({
name: targetName,
fileId: attachment.fileId,
path: filePath,
size: buffer.length,
expectedSize: attachment.ossFileSize,
status: "success",
sourceField: attachment.sourceField,
tokenKey: attachment.tokenKey
});
} catch (err: any) {
const msg = err.message ?? String(err);
console.error(`⚠️ [失败] 附件 "${rawName}" 下载失败: ${msg} [${sanitizedUrl}]`);
files.push({
name: targetName,
fileId: attachment.fileId,
status: "failed",
error: msg,
sourceField: attachment.sourceField,
tokenKey: attachment.tokenKey
});
}
}
const downloaded = files.filter((f) => f.status === "success").length;
const failed = files.filter((f) => f.status === "failed").length;
return {
recordId: record.id,
outDir: resolvedOutDir,
total: selected.length,
downloaded,
failed,
files
};
}
+1 -1
View File
@@ -46,7 +46,7 @@ export function listAvailableLinters(): Array<{ name: string; type: "builtin" |
return list;
}
export function resolveLinterPath(nameOrPath: string): string | undefined {
function resolveLinterPath(nameOrPath: string): string | undefined {
if (!nameOrPath || nameOrPath === "builtin") {
return undefined;
}
@@ -0,0 +1,51 @@
import { pinyin } from "pinyin-pro";
import type { MaterialAttachmentPlan, MaterialDocument, MaterialField } from "./types.js";
import type { ZipEntry } from "./validate.js";
function keyFromLabel(value: string): string {
const label = value.replace(/^\d+[\s.\-_—]*/, "").trim();
const parts = pinyin(label, { toneType: "none", type: "all", nonZh: "consecutive" })
.map((item: any) => item.pinyin ? item.pinyin : String(item.origin).toLowerCase().replace(/[^a-z0-9]+/g, ""))
.filter(Boolean);
return parts.join("") || "attachments";
}
export function buildAttachmentPlans(entries: ZipEntry[], documents: Array<{ document: MaterialDocument; laborNames: string[] }>): MaterialAttachmentPlan[] {
return documents.map(({ document, laborNames }) => {
const plan: MaterialAttachmentPlan = { documentId: document.documentId, categoryFields: [], personAttachments: {} };
for (const entry of entries) {
if (entry.fileName === "信息表.xlsx") continue;
const segments = entry.fileName.split("/");
if (segments[0] !== document.documentId || segments.length < 2) continue;
const add = (list: Array<{ key: string; label: string; entries: any[] }>, label: string) => {
const clean = label.replace(/^\d+[\s.\-_—]*/, "");
const item = list.find((value) => value.label === clean) ?? { key: clean === "附件" ? "attachments" : keyFromLabel(clean), label: clean, entries: [] };
if (!list.includes(item)) list.push(item);
item.entries.push({ fileName: entry.fileName, path: entry.fileName, size: entry.uncompressedSize });
};
if (segments.length === 2) add(plan.categoryFields, "附件");
else if (laborNames.includes(segments[1]!)) {
const list = plan.personAttachments[segments[1]!] ?? (plan.personAttachments[segments[1]!] = []);
add(list, segments.length === 3 ? "附件" : segments[2]!);
} else add(plan.categoryFields, segments[1]!);
}
return plan;
});
}
export function injectAttachmentPlan(document: MaterialDocument, plan: MaterialAttachmentPlan, uploaded: Map<string, unknown[]>): MaterialDocument {
const clone = structuredClone(document);
const lookup = (path: string) => uploaded.get(path) ?? [];
for (const category of plan.categoryFields) {
const value = category.entries.flatMap((entry) => lookup(entry.path));
clone.fields.push({ key: category.key, label: category.label, type: "ATTACHMENT", value });
}
const list = clone.fields.find((item) => item.key === "daoshi_list" && item.type === "LIST");
if (list && Array.isArray(list.value)) {
for (const row of list.value as MaterialField[][]) {
const name = row.find((item) => item.key === "name")?.value;
for (const category of plan.personAttachments[String(name)] ?? []) row.push({ key: category.key, label: category.label, type: "ATTACHMENT", value: category.entries.flatMap((entry) => lookup(entry.path)) });
}
}
return clone;
}
+6
View File
@@ -0,0 +1,6 @@
export * from "./types.js";
export * from "./signature.js";
export * from "./validate.js";
export * from "./parse.js";
export * from "./attachments.js";
export * from "./service.js";
@@ -0,0 +1,29 @@
import ExcelJS from "exceljs";
import { describe, expect, test } from "bun:test";
import { previewMaterialPack } from "./service.js";
import { signWebhookPayload } from "./signature.js";
async function workbookBuffer() {
const workbook = new ExcelJS.Workbook();
const main = workbook.addWorksheet("会议");
main.addRow(["会议编号", "会议名称", "总金额", "申请日期"]);
main.addRow(["DOC-001", "测试单据", 100, "2026-09-03 12:00:00"]);
const labor = workbook.addWorksheet("劳务明细");
labor.addRow(["会议编号", "姓名", "劳务费用"]);
labor.addRow(["DOC-001", "张三", 100]);
return Buffer.from(await workbook.xlsx.writeBuffer());
}
describe("Webhook material pack", () => {
test("previews official workbook shape without network access", async () => {
const result = await previewMaterialPack(await workbookBuffer(), "材料包.xlsx");
expect(result.documents).toHaveLength(1);
expect(result.documents[0]).toMatchObject({ documentId: "DOC-001", documentSN: "DOC-001" });
expect(result.documents[0]?.fields).toContainEqual(expect.objectContaining({ key: "daoshi_list", type: "LIST" }));
});
test("uses the confirmed timestamp.nonce.payload HMAC contract", () => {
expect(signWebhookPayload(1700000000, "nonce", { webhookId: "wh-1", value: 1 }, "secret"))
.toBe("d65d858afb6adc33dc640ebc6b259861c2b73ef0e6f0995ff822b41465fbfdf1");
});
});
+99
View File
@@ -0,0 +1,99 @@
import ExcelJS from "exceljs";
import { MaterialPackValidationError, type MaterialDocument, type MaterialField } from "./types.js";
type Parsed = { document: MaterialDocument; laborNames: string[] };
function field(key: string, label: string, type: string, value: unknown): MaterialField {
return { key, label, type, value };
}
function text(key: string, label: string, value: unknown) {
return field(key, label, "TEXT", value == null ? "" : String(value));
}
function amount(key: string, label: string, value: unknown) {
return field(key, label, "AMOUNT", typeof value === "number" ? { amount: value, currency: "CNY" } : null);
}
function dateValue(value: unknown): string | null {
if (value instanceof Date) return value.toISOString();
if (typeof value === "string" && value.trim()) return value.trim();
return null;
}
function startTimeValue(value: unknown): number | null {
if (value instanceof Date) return Math.floor(value.getTime() / 1000);
if (typeof value === "string" && value.trim()) {
const timestamp = Date.parse(value.trim().replace(" ", "T"));
if (Number.isFinite(timestamp)) return Math.floor(timestamp / 1000);
}
return null;
}
function headerMap(sheet: ExcelJS.Worksheet): Map<string, number> {
const map = new Map<string, number>();
sheet.getRow(1).eachCell((cell, index) => map.set(String(cell.value ?? "").trim(), index));
return map;
}
function cell(row: ExcelJS.Row, map: Map<string, number>, name: string): unknown {
const index = map.get(name);
return index ? row.getCell(index).value : undefined;
}
function buildMainFields(row: ExcelJS.Row, map: Map<string, number>): MaterialField[] {
const specs: Array<[string, string, string]> = [
["会议编号", "meeting_id", "TEXT"], ["会议名称", "meeting_name", "TEXT"], ["状态", "status", "TEXT"],
["总金额", "total_amount", "AMOUNT"], ["税前劳务总额", "pretax_labor_total", "AMOUNT"],
["报销事由", "reimbursement_reason", "TEXT"], ["po码", "po_code", "TEXT"], ["快递单号", "tracking_number", "TEXT"],
["申请日期", "application_date", "DATE"], ["更新日期", "updated_date", "DATE"]
];
return specs.flatMap(([label, key, type]) => {
const value = cell(row, map, label);
if (value == null || value === "") return [];
return [type === "TEXT" ? text(key, label, value) : type === "AMOUNT" ? amount(key, label, value) : field(key, label, type, dateValue(value))];
});
}
function buildDetailFields(row: ExcelJS.Row, map: Map<string, number>, specs: Array<[string, string, string]>): MaterialField[] {
return specs.flatMap(([label, key, type]) => {
const value = cell(row, map, label);
if (value == null || value === "") return [];
return [type === "TEXT" ? text(key, label, value) : type === "AMOUNT" ? amount(key, label, value) : field(key, label, type, dateValue(value))];
});
}
const laborSpecs: Array<[string, string, string]> = [["姓名", "name", "TEXT"], ["身份证号码", "id_number", "TEXT"], ["手机号", "phone", "TEXT"], ["劳务费用", "labor_fee", "AMOUNT"], ["税前费用", "pretax_fee", "AMOUNT"], ["开户行", "bank", "TEXT"], ["支行名称", "branch_name", "TEXT"], ["联行号", "bank_code", "TEXT"], ["银行卡号", "bank_card_number", "TEXT"]];
const expenseSpecs: Array<[string, string, string]> = [["报销金额", "reimbursement_amount", "AMOUNT"], ["费用类型", "expense_type", "TEXT"], ["发生时间", "occurrence_time", "DATE"], ["收款人", "payee", "TEXT"], ["开户行", "bank", "TEXT"], ["支行名称", "branch_name", "TEXT"], ["支行行号", "branch_code", "TEXT"], ["银行卡号", "bank_card_number", "TEXT"], ["费用说明", "expense_description", "TEXT"]];
export async function parseMaterialWorkbook(buffer: Uint8Array): Promise<Parsed[]> {
const workbook = new ExcelJS.Workbook();
await workbook.xlsx.load(Buffer.from(buffer) as any);
if (!workbook.worksheets.length) throw new MaterialPackValidationError(["信息表没有任何 Sheet"]);
const sheets = workbook.worksheets;
const mainSheet = sheets[0]!;
const maps = sheets.map(headerMap);
const mainMap = maps[0]!;
const idColumn = mainMap.get("会议编号") ?? 1;
const mainRows = (mainSheet.getRows(2, mainSheet.rowCount) ?? []).filter((row) => row.getCell(idColumn).value != null && row.getCell(idColumn).value !== "");
const ids = new Set<string>();
const parsed: Parsed[] = mainRows.map((row) => {
const id = String(row.getCell(idColumn).value).trim();
if (!id) throw new MaterialPackValidationError(["主表会议编号不能为空"]);
if (ids.has(id)) throw new MaterialPackValidationError([`主表会议编号重复: ${id}`]);
ids.add(id);
const apply = cell(row, mainMap, "申请日期");
const laborSheet = sheets.find((sheet, index) => index > 0 && headerMap(sheet).has("姓名"));
const expenseSheet = sheets.find((sheet, index) => index > 0 && headerMap(sheet).has("报销金额"));
const laborMap = laborSheet ? headerMap(laborSheet) : undefined;
const expenseMap = expenseSheet ? headerMap(expenseSheet) : undefined;
const laborRows = (laborSheet?.getRows(2, laborSheet.rowCount) ?? []).filter((r) => String(cell(r, laborMap!, "会议编号") ?? "").trim() === id);
const expenseRows = (expenseSheet?.getRows(2, expenseSheet.rowCount) ?? []).filter((r) => String(cell(r, expenseMap!, "会议编号") ?? "").trim() === id);
const laborNames = laborRows.map((r) => String(cell(r, headerMap(laborSheet!), "姓名") ?? "").trim()).filter(Boolean);
const fields = buildMainFields(row, mainMap);
if (laborRows.length) fields.push({ key: "daoshi_list", label: "导师列表", type: "LIST", value: laborRows.map((r) => buildDetailFields(r, laborMap!, laborSpecs)) });
if (expenseRows.length) fields.push({ key: "mingxi_list", label: "明细列表", type: "LIST", value: expenseRows.map((r) => buildDetailFields(r, expenseMap!, expenseSpecs)) });
return { laborNames, document: { type: "document", documentId: id, documentSN: id, startTime: startTimeValue(apply), fields } };
});
return parsed;
}
+71
View File
@@ -0,0 +1,71 @@
import { readFileSync } from "node:fs";
import { webhookHeaders } from "./signature.js";
import { buildAttachmentPlans, injectAttachmentPlan } from "./attachments.js";
import { parseMaterialWorkbook } from "./parse.js";
import { extractZipEntry, readZipEntries, validatePackEntries, type ZipEntry } from "./validate.js";
import type { MaterialPackPreview, MaterialPackPushResult } from "./types.js";
function webhookInfo(url: string): { baseUrl: string; webhookId: string } {
const parsed = new URL(url);
const match = parsed.pathname.match(/\/webhook\/([^/]+)/);
if (!match) throw new Error("Webhook URL 必须包含 /webhook/{webhookId}/document");
return { baseUrl: `${parsed.protocol}//${parsed.host}`, webhookId: match[1]! };
}
function isZip(buffer: Uint8Array, fileName: string): boolean {
return fileName.toLowerCase().endsWith(".zip") || (buffer[0] === 0x50 && buffer[1] === 0x4b && !fileName.toLowerCase().endsWith(".xlsx"));
}
async function prepare(fileBuffer: Uint8Array, fileName: string) {
let entries: ZipEntry[] = [];
let workbook = fileBuffer;
if (isZip(fileBuffer, fileName)) {
entries = await readZipEntries(fileBuffer);
validatePackEntries(entries);
const info = entries.find((entry) => entry.fileName === "信息表.xlsx");
if (!info) throw new Error("ZIP 根目录缺少信息表.xlsx");
workbook = await extractZipEntry(fileBuffer, info);
}
const parsed = await parseMaterialWorkbook(workbook);
const plans = buildAttachmentPlans(entries, parsed);
const documents = parsed.map((item) => item.document);
return { entries, parsed, plans, documents, fileBuffer };
}
export async function previewMaterialPack(fileBuffer: Uint8Array, fileName: string): Promise<MaterialPackPreview> {
const prepared = await prepare(fileBuffer, fileName);
return { warnings: [], documents: prepared.documents, attachmentPlan: prepared.plans };
}
export async function pushMaterialPack(fileBuffer: Uint8Array, fileName: string, config: { webhookUrl: string; secret: string }): Promise<MaterialPackPushResult> {
const prepared = await prepare(fileBuffer, fileName);
const { baseUrl, webhookId } = webhookInfo(config.webhookUrl);
const results: MaterialPackPushResult["results"] = [];
for (let index = 0; index < prepared.parsed.length; index += 1) {
const item = prepared.parsed[index]!;
const plan = prepared.plans[index]!;
const uploaded = new Map<string, unknown[]>();
for (const category of [...plan.categoryFields, ...Object.values(plan.personAttachments).flat()]) {
for (const entry of category.entries) {
const zipEntry = prepared.entries.find((candidate) => candidate.fileName === entry.path);
if (!zipEntry) continue;
const body = new FormData();
const attachment = await extractZipEntry(prepared.fileBuffer, zipEntry);
body.append("files", new File([new Uint8Array(attachment)], entry.fileName));
const response = await fetch(`${baseUrl}/api/v1/integrations/webhook/${encodeURIComponent(webhookId)}/attachments`, { method: "POST", headers: webhookHeaders({}, config.secret), body });
if (!response.ok) throw new Error(`附件上传失败 ${response.status}: ${await response.text()}`);
const json = await response.json() as { data?: unknown; attachments?: Array<{ data: unknown }> };
uploaded.set(entry.path, json.attachments?.map((value) => value.data) ?? (json.data === undefined ? [] : [json.data]));
}
}
const document = injectAttachmentPlan(item.document, plan, uploaded);
const response = await fetch(`${baseUrl}/api/v1/integrations/webhook/${encodeURIComponent(webhookId)}/document`, { method: "POST", headers: { "Content-Type": "application/json", ...webhookHeaders({ webhookId, ...document }, config.secret) }, body: JSON.stringify(document) });
if (!response.ok) throw new Error(`Webhook 单据推送失败 ${response.status}: ${await response.text()}`);
results.push({ documentId: document.documentId, document, pushResult: await response.json() });
}
return { warnings: [], results };
}
export function readMaterialPackFile(filePath: string): { fileBuffer: Buffer; fileName: string } {
return { fileBuffer: readFileSync(filePath), fileName: filePath.split(/[\\/]/).pop() ?? "material-pack.zip" };
}
@@ -0,0 +1,18 @@
import { createHmac, randomBytes } from "node:crypto";
export function signWebhookPayload(timestamp: number, nonce: string, payload: unknown, secret: string): string {
return createHmac("sha256", secret)
.update(`${timestamp}.${nonce}.${JSON.stringify(payload)}`)
.digest("hex");
}
export function webhookHeaders(payload: unknown, secret: string): Record<string, string> {
const timestamp = Math.floor(Date.now() / 1000);
const nonce = randomBytes(16).toString("hex");
return {
Authorization: `Bearer ${secret}`,
"x-webhook-signature": signWebhookPayload(timestamp, nonce, payload, secret),
"x-webhook-timestamp": String(timestamp),
"x-webhook-nonce": nonce
};
}
+44
View File
@@ -0,0 +1,44 @@
export type MaterialField = {
key: string;
label: string;
type: string;
value: unknown;
};
export type MaterialDocument = {
type: "document";
documentId: string;
documentSN: string;
startTime: number | null;
fields: MaterialField[];
};
export type MaterialAttachmentEntry = {
fileName: string;
size: number;
path: string;
};
export type MaterialAttachmentPlan = {
documentId: string;
categoryFields: Array<{ key: string; label: string; entries: MaterialAttachmentEntry[] }>;
personAttachments: Record<string, Array<{ key: string; label: string; entries: MaterialAttachmentEntry[] }>>;
};
export type MaterialPackPreview = {
warnings: string[];
documents: MaterialDocument[];
attachmentPlan: MaterialAttachmentPlan[];
};
export type MaterialPackPushResult = {
warnings: string[];
results: Array<{ documentId: string; document: MaterialDocument; pushResult: unknown }>;
};
export class MaterialPackValidationError extends Error {
constructor(public readonly errors: string[], public readonly warnings: string[] = []) {
super(`材料包校验失败:${errors.length} 个错误`);
this.name = "MaterialPackValidationError";
}
}
@@ -0,0 +1,77 @@
import yauzl from "yauzl";
import iconv from "iconv-lite";
import { MaterialPackValidationError } from "./types.js";
export const MATERIAL_PACK_LIMITS = { maxEntries: 1000, maxTotalSize: 500 * 1024 * 1024, maxCompressionRatio: 150 };
export type ZipEntry = { fileName: string; uncompressedSize: number; compressedSize: number; raw: unknown };
export async function readZipEntries(buffer: Uint8Array): Promise<ZipEntry[]> {
return new Promise((resolve, reject) => {
yauzl.fromBuffer(Buffer.from(buffer), { lazyEntries: true, autoClose: true }, (openError: Error | null, zipFile: any) => {
if (openError || !zipFile) return reject(openError ?? new Error("无法打开 ZIP"));
const entries: ZipEntry[] = [];
zipFile.readEntry();
zipFile.on("entry", (entry: any) => {
const fileName = decodeZipEntryName(entry);
if (!fileName.endsWith("/") && !isJunk(fileName)) {
entries.push({ fileName, uncompressedSize: entry.uncompressedSize, compressedSize: entry.compressedSize, raw: entry });
}
zipFile.readEntry();
});
zipFile.on("end", () => resolve(entries));
zipFile.on("error", reject);
});
});
}
function decodeZipEntryName(entry: any): string {
if (entry.fileNameUTF8 || (entry.generalPurposeBitFlag & 0x800)) return entry.fileNameUTF8 ?? entry.fileName;
const raw = Buffer.from(String(entry.fileName), "binary");
const utf8 = raw.toString("utf8");
if (utf8.includes("\uFFFD") || /[\u0080-\u00FF]/.test(utf8)) {
const gbk = iconv.decode(raw, "gbk");
if (!gbk.includes("\uFFFD")) return gbk;
}
return utf8;
}
function isJunk(name: string): boolean {
const base = name.split("/").pop() ?? "";
return name.split("/").includes("__MACOSX") || base === ".DS_Store" || base.startsWith("._") || base.startsWith(".~") || base.startsWith("~$");
}
export function validatePackEntries(entries: ZipEntry[]): void {
const errors: string[] = [];
if (entries.length > MATERIAL_PACK_LIMITS.maxEntries) errors.push(`文件数超过 ${MATERIAL_PACK_LIMITS.maxEntries}`);
const total = entries.reduce((sum, entry) => sum + entry.uncompressedSize, 0);
if (total > MATERIAL_PACK_LIMITS.maxTotalSize) errors.push("解压后总大小超过 500MB");
for (const entry of entries) {
if (entry.fileName.startsWith("/") || entry.fileName.split("/").includes("..")) errors.push(`存在不安全路径: ${entry.fileName}`);
if (entry.compressedSize > 0 && entry.uncompressedSize / entry.compressedSize > MATERIAL_PACK_LIMITS.maxCompressionRatio) errors.push(`压缩比超过 150: ${entry.fileName}`);
}
const info = entries.find((entry) => entry.fileName === "信息表.xlsx");
if (!info) errors.push("ZIP 根目录缺少精确名为「信息表.xlsx」的文件");
if (entries.some((entry) => entry.fileName.toLowerCase().endsWith(".zip"))) errors.push("不允许嵌套 ZIP");
if (errors.length) throw new MaterialPackValidationError(errors);
}
export function extractZipEntry(buffer: Uint8Array, target: ZipEntry): Promise<Buffer> {
return new Promise((resolve, reject) => {
yauzl.fromBuffer(Buffer.from(buffer), { lazyEntries: true, autoClose: true }, (openError: Error | null, zipFile: any) => {
if (openError || !zipFile) return reject(openError ?? new Error("无法打开 ZIP"));
zipFile.readEntry();
zipFile.on("entry", (entry: any) => {
if (decodeZipEntryName(entry) !== target.fileName) return zipFile.readEntry();
zipFile.openReadStream(entry, (error: Error | null, stream: any) => {
if (error || !stream) return reject(error ?? new Error(`无法读取 ${target.fileName}`));
const chunks: Buffer[] = [];
stream.on("data", (chunk: Buffer) => chunks.push(chunk));
stream.on("end", () => resolve(Buffer.concat(chunks)));
stream.on("error", reject);
});
});
zipFile.on("error", reject);
});
});
}
+163
View File
@@ -0,0 +1,163 @@
import { describe, expect, test, afterEach } from "bun:test";
import { mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import {
parseLocalRulesContent,
loadLocalRulesFile,
saveLocalRulesFile,
localRulesToLintTargets
} from "./rules-local.js";
import { findSealTool } from "./tools.js";
const tempDirs: string[] = [];
afterEach(() => {
for (const dir of tempDirs.splice(0)) {
rmSync(dir, { recursive: true, force: true });
}
});
describe("rules-local workspace", () => {
test("parses wrapped rules object", () => {
const raw = JSON.stringify({
corpId: "corp-1",
source: "draft",
rules: [
{ code: 1, description: "餐饮发票必须提供水单", scope: "MEAL", strictness: "MUST_FOLLOW" },
{ code: 2, description: "单张发票金额不得超标", scope: "ALL" }
]
});
const parsed = parseLocalRulesContent(raw);
expect(parsed.rules.length).toBe(2);
expect(parsed.meta.corpId).toBe("corp-1");
expect(parsed.meta.source).toBe("draft");
expect(parsed.rules[0]!.description).toBe("餐饮发票必须提供水单");
expect(parsed.rules[0]!.strictness).toBe("MUST_FOLLOW");
expect(parsed.rules[1]!.strictness).toBe("MUST_FOLLOW"); // default
});
test("parses raw rules array", () => {
const raw = JSON.stringify([
{ description: "打车必须备注起止地点", scope: "TAXI" }
]);
const parsed = parseLocalRulesContent(raw);
expect(parsed.rules.length).toBe(1);
expect(parsed.rules[0]!.description).toBe("打车必须备注起止地点");
expect(parsed.rules[0]!.code).toBe(1);
});
test("rejects invalid format or empty description", () => {
expect(() => parseLocalRulesContent("not-json")).toThrow("JSON 解析失败");
expect(() => parseLocalRulesContent(JSON.stringify({ other: 123 }))).toThrow("本地规则文件格式错误");
expect(() => parseLocalRulesContent(JSON.stringify([{ code: 1 }]))).toThrow("缺少有效的 'description'");
});
test("saves and loads local rules file accurately", () => {
const dir = mkdtempSync(join(tmpdir(), "seal-rules-test-"));
tempDirs.push(dir);
const filePath = join(dir, "sub", "rules.json");
const savedPath = saveLocalRulesFile(filePath, {
corpId: "test-corp",
source: "version:5",
rules: [
{ code: 10, description: "酒店住宿必须提供明细清单", scope: "HOTEL", strictness: "MUST_FOLLOW" }
]
});
expect(savedPath).toBe(filePath);
const loaded = loadLocalRulesFile(filePath);
expect(loaded.rules.length).toBe(1);
expect(loaded.meta.corpId).toBe("test-corp");
expect(loaded.rules[0]!.code).toBe(10);
expect(loaded.rules[0]!.description).toBe("酒店住宿必须提供明细清单");
});
test("converts local rules to lint targets", () => {
const targets = localRulesToLintTargets([
{ code: 1, description: "规则一", name: "R1" },
{ code: "0002", description: "规则二" },
{ description: "规则三" }
]);
expect(targets[0]!.code).toBe("#0001");
expect(targets[0]!.name).toBe("R1");
expect(targets[1]!.code).toBe("#0002");
expect(targets[2]!.code).toBe("#0003");
});
});
describe("rules-local offline lint tool integration", () => {
test("lints local file directly with 0 network calls and high score", async () => {
const dir = mkdtempSync(join(tmpdir(), "seal-lint-test-"));
tempDirs.push(dir);
const filePath = join(dir, "clean-rules.json");
saveLocalRulesFile(filePath, {
corpId: "test-corp",
rules: [
{
code: 1,
description: "单张发票金额超过500元时,必须提供经办人签字的费用明细水单与消费清单。",
scope: "MEAL",
strictness: "MUST_FOLLOW"
}
]
});
const lintTool = findSealTool("seal_approval_rules_lint")!;
expect(lintTool).toBeDefined();
const result = await lintTool.handler(
null as any,
{ file: filePath } as any,
{ corp: { id: "test-corp" } } as any
) as any;
expect(result.totalRules).toBe(1);
expect(result.passed).toBe(true);
expect(result.overallScore).toBe(100);
});
test("detects vague wording in local rules file and enforces minScore gate", async () => {
const dir = mkdtempSync(join(tmpdir(), "seal-lint-test-"));
tempDirs.push(dir);
const filePath = join(dir, "vague-rules.json");
saveLocalRulesFile(filePath, {
corpId: "test-corp",
rules: [
{
code: 1,
description: "金额适当即可,视情况而定。",
scope: "ALL"
}
]
});
const lintTool = findSealTool("seal_approval_rules_lint")!;
const result = await lintTool.handler(
null as any,
{ file: filePath } as any,
{ corp: { id: "test-corp" } } as any
) as any;
expect(result.totalRules).toBe(1);
expect(result.overallScore).toBeLessThan(100);
expect(result.issues[0].issues.some((i: any) => i.code === "VAGUE_WORD")).toBe(true);
// minScore enforcement
await expect(
lintTool.handler(
null as any,
{ file: filePath, minScore: 95 } as any,
{ corp: { id: "test-corp" } } as any
)
).rejects.toThrow("Linter 质量门禁未通过");
});
});
+153
View File
@@ -0,0 +1,153 @@
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
import { dirname, resolve } from "node:path";
import type { RuleLintTarget } from "./linter/types.js";
export interface LocalRuleItem {
id?: string;
code?: number | string;
name?: string;
description: string;
scope?: string;
strictness?: string;
status?: string;
[key: string]: unknown;
}
export interface LocalRulesPayload {
corpId?: string;
source?: string;
versionNumber?: number;
exportedAt?: string;
rulesCount?: number;
rules: LocalRuleItem[];
}
/**
* Parses raw local rule content (JSON array or object with `rules` array)
* and normalizes them into a consistent structure.
*/
export function parseLocalRulesContent(rawText: string): {
rules: LocalRuleItem[];
meta: Omit<LocalRulesPayload, "rules">;
} {
let parsed: unknown;
try {
parsed = JSON.parse(rawText);
} catch (err) {
throw new Error(`本地规则文件 JSON 解析失败: ${err instanceof Error ? err.message : String(err)}`);
}
if (Array.isArray(parsed)) {
return {
rules: normalizeRuleItems(parsed),
meta: {
rulesCount: parsed.length
}
};
}
if (parsed && typeof parsed === "object") {
const obj = parsed as Record<string, unknown>;
const rawRules = Array.isArray(obj.rules) ? obj.rules : undefined;
if (!rawRules) {
throw new Error("本地规则文件格式错误: 顶层必须为规则数组或包含 'rules' 数组的对象");
}
return {
rules: normalizeRuleItems(rawRules),
meta: {
corpId: typeof obj.corpId === "string" ? obj.corpId : undefined,
source: typeof obj.source === "string" ? obj.source : undefined,
versionNumber: typeof obj.versionNumber === "number" ? obj.versionNumber : undefined,
exportedAt: typeof obj.exportedAt === "string" ? obj.exportedAt : undefined,
rulesCount: rawRules.length
}
};
}
throw new Error("本地规则文件格式错误: 顶层必须为规则数组或包含 'rules' 数组的对象");
}
function normalizeRuleItems(items: unknown[]): LocalRuleItem[] {
return items.map((item, idx) => {
if (!item || typeof item !== "object") {
throw new Error(`第 ${idx + 1} 条规则格式错误: 必须为对象`);
}
const r = item as Record<string, unknown>;
const description = typeof r.description === "string" ? r.description.trim() : "";
if (!description) {
throw new Error(`第 ${idx + 1} 条规则缺少有效的 'description' (规则描述) 字段`);
}
const code =
typeof r.code === "number" || typeof r.code === "string"
? r.code
: idx + 1;
return {
...r,
code,
description,
scope: typeof r.scope === "string" ? r.scope : "ALL",
strictness: typeof r.strictness === "string" ? r.strictness : "MUST_FOLLOW"
};
});
}
/**
* Loads a local rules file from path.
*/
export function loadLocalRulesFile(filePath: string): {
rules: LocalRuleItem[];
meta: Omit<LocalRulesPayload, "rules">;
resolvedPath: string;
} {
const resolved = resolve(filePath);
if (!existsSync(resolved)) {
throw new Error(`未找到本地规则文件: ${filePath} (${resolved})`);
}
const content = readFileSync(resolved, "utf8");
const parsed = parseLocalRulesContent(content);
return {
...parsed,
resolvedPath: resolved
};
}
/**
* Saves rules to a formatted JSON file.
*/
export function saveLocalRulesFile(
filePath: string,
data: LocalRulesPayload
): string {
const resolved = resolve(filePath);
mkdirSync(dirname(resolved), { recursive: true });
writeFileSync(resolved, `${JSON.stringify(data, null, 2)}\n`, "utf8");
return resolved;
}
/**
* Converts local rule items to linter targets.
*/
export function localRulesToLintTargets(rules: LocalRuleItem[]): RuleLintTarget[] {
return rules.map((r, idx) => {
let codeStr: string | undefined;
if (typeof r.code === "number") {
codeStr = `#${String(r.code).padStart(4, "0")}`;
} else if (typeof r.code === "string") {
codeStr = r.code.startsWith("#") ? r.code : `#${r.code}`;
} else {
codeStr = `#${String(idx + 1).padStart(4, "0")}`;
}
return {
id: r.id,
code: codeStr,
name: r.name,
description: r.description,
scope: r.scope,
strictness: r.strictness
};
});
}
+3 -45
View File
@@ -5,7 +5,7 @@ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { CorpConfig } from "../../core/config/types.js";
import { findSealMcpTool, findSealTool, sealMcpTools, sealTools } from "./tools.js";
import { findSealTool, sealTools } from "./tools.js";
type ToolHandler = (
client: KyInstance,
@@ -230,50 +230,9 @@ describe("sealTools", () => {
expect(sealTools.find((item) => item.name === "seal_approval_run_langfuse_bridge_get")).toBeDefined();
});
test("keeps the MCP exposed tool surface narrow", () => {
expect(sealMcpTools.map((tool) => tool.name)).toEqual([
"seal_whoami",
"seal_approval_search",
"seal_approval_context_get",
"seal_runs_search",
"seal_action"
]);
});
test("routes low-frequency management tools through seal_action", async () => {
const tool = sealMcpTools.find((item) => item.name === "seal_action");
expect(tool).toBeDefined();
const handler = tool!.handler as ToolHandler;
const result = await handler(
fakeApprovalRunsClient(),
{ action: "runs.summary", payload: { date: "2026-06-08", timezone: "Asia/Shanghai" } },
fakeContext()
) as { matched: number };
expect(result.matched).toBe(2);
});
test("routes lightweight approval run actions through seal_action", async () => {
const tool = sealMcpTools.find((item) => item.name === "seal_action");
expect(tool).toBeDefined();
const handler = tool!.handler as ToolHandler;
const result = await handler(
fakeApprovalRunsClient(),
{ action: "runs.citedRules", payload: { recordId: "run-1" } },
fakeContext()
) as { count: number };
expect(result.count).toBe(1);
});
test("keeps old fine-grained tools available to compatibility callers but hidden from MCP list", () => {
expect(sealMcpTools.find((item) => item.name === "seal_approval_rule_create")).toBeUndefined();
expect(findSealMcpTool("seal_approval_rule_create")).toBeUndefined();
test("can find tools by name in sealTools", () => {
expect(findSealTool("seal_approval_rule_create")).toBeDefined();
expect(findSealMcpTool("seal_action")).toBeDefined();
expect(findSealMcpTool("seal_runs_search")?.name).toBe("seal_runs_search");
expect(findSealTool("non_existent_tool")).toBeUndefined();
});
test("approval run search omits bridge unless requested", async () => {
@@ -1034,4 +993,3 @@ function fakeDeployClient(): KyInstance {
}
} as unknown as KyInstance;
}
+199 -295
View File
@@ -9,6 +9,16 @@ import { loadGlobalConfig } from "../../core/config/loader.js";
import { createSealClientForToken } from "../../core/http/factory.js";
import { searchApprovalContent } from "./search.js";
import { loadRuleLinter, lintRuleBatch, lintSingleRule, type RuleLintTarget } from "./linter/index.js";
import {
loadLocalRulesFile,
saveLocalRulesFile,
localRulesToLintTargets,
type LocalRuleItem
} from "./rules-local.js";
import { previewMaterialPack, pushMaterialPack, readMaterialPackFile } from "./material-pack/index.js";
import {
extractApprovalRunAttachments
} from "./attachments.js";
import {
ThinkingPolicySchema,
type ApprovalRule,
@@ -439,8 +449,9 @@ export const sealTools = [
},
{
name: "seal_approval_rules_lint",
description: "对 Seal 草稿审批规则或指定发布版本规则进行质量与可执行性检查(模糊词、悬空例外检测)",
description: "对 Seal 本地规则文件、草稿审批规则或指定发布版本规则进行质量与可执行性检查(模糊词、悬空例外检测)",
parameters: z.object({
file: z.string().optional().describe("指定本地规则文件路径进行离线质检(支持 .json),0网络请求、不污染远端草稿"),
linter: z.string().optional().describe("指定使用的校验器名称或脚本路径(如 builtin、strict、./my-linter.ts)"),
version: z.string().optional().describe("指定要质检的历史发布版本号或 ID(如 16 或 latest),不传默认质检当前草稿"),
code: z.string().optional().describe("按规则展示编号过滤(如 #0038)"),
@@ -452,6 +463,7 @@ export const sealTools = [
handler: async (
client: KyInstance,
params: {
file?: string;
linter?: string;
version?: string;
code?: string;
@@ -465,7 +477,11 @@ export const sealTools = [
let targets: RuleLintTarget[] = [];
let versionNumber: number | undefined;
if (params.version) {
if (params.file) {
const local = loadLocalRulesFile(params.file);
targets = localRulesToLintTargets(local.rules);
versionNumber = local.meta.versionNumber;
} else if (params.version) {
const versions = await api.listApprovalRuleVersions(client);
const versionNumberParsed = Number(params.version);
const version = isNaN(versionNumberParsed)
@@ -514,7 +530,7 @@ export const sealTools = [
const batchResult = await lintRuleBatch(
targets,
loadedLinter,
{ corpId: context.corp.id, versionNumber, allRules: targets },
{ corpId: context?.corp?.id, versionNumber, allRules: targets },
{ minScore: params.minScore, level: params.level, summary: params.summary }
);
@@ -527,6 +543,164 @@ export const sealTools = [
return batchResult;
}
},
{
name: "seal_approval_rules_pull",
description: "从 Seal 远端拉取草稿或指定版本规则,保存至本地规则文件(支持离线编辑与本地 Lint,绝不污染远端草稿)",
parameters: z.object({
version: z.string().optional().describe("指定拉取的历史发布版本号或 ID(如 16 或 latest),不传默认拉取当前草稿规则"),
out: z.string().optional().describe("保存的目标本地文件路径,默认为 ./rules.local.json")
}),
handler: async (
client: KyInstance,
params: {
version?: string;
out?: string;
},
context: ToolContext
) => {
const outPath = params.out ?? "./rules.local.json";
let rules: LocalRuleItem[] = [];
let source = "draft";
let versionNumber: number | undefined;
if (params.version) {
const versions = await api.listApprovalRuleVersions(client);
const versionNumberParsed = Number(params.version);
const targetVersion = isNaN(versionNumberParsed)
? params.version === "latest"
? versions[0]
: versions.find((v) => v.id === params.version)
: versions.find((v) => v.versionNumber === versionNumberParsed);
if (!targetVersion) {
throw new Error(`未找到指定的规则版本: ${params.version}`);
}
versionNumber = targetVersion.versionNumber;
source = `version:${versionNumber}`;
rules = (targetVersion.rules ?? []).map((r, idx) => ({
code: (r as any).code ? Number(String((r as any).code).replace(/^#/, "")) || idx + 1 : idx + 1,
name: (r as any).name ?? (r as any).title,
description: r.description ?? "",
scope: (r as any).scope ?? "ALL",
strictness: (r as any).strictness ?? "MUST_FOLLOW"
}));
} else {
const draftData = await api.listApprovalRules(client);
rules = (draftData.rules ?? []).map((r, idx) => ({
id: r.id,
code: r.code ?? idx + 1,
name: (r as any).name ?? (r as any).title,
description: r.description ?? "",
scope: r.scope ?? "ALL",
strictness: r.strictness ?? "MUST_FOLLOW",
status: r.status
}));
}
const savedPath = saveLocalRulesFile(outPath, {
corpId: context.corp.id,
source,
versionNumber,
exportedAt: new Date().toISOString(),
rulesCount: rules.length,
rules
});
return {
saved: true,
path: savedPath,
rulesCount: rules.length,
corpId: context.corp.id,
source,
versionNumber
};
}
},
{
name: "seal_approval_rules_push",
description: "将本地规则文件推送到远端草稿(本地调优通过后一键应用,支持直接发布为正式版本)",
parameters: z.object({
file: z.string().optional().describe("要推送的本地规则文件路径,默认为 ./rules.local.json"),
dryRun: z.boolean().optional().describe("是否仅预览变更而不实际写入远端(默认 true,传 --yes 或 confirm: true 执行写入)"),
confirm: z.boolean().optional().describe("确认覆盖写入远端草稿"),
publish: z.boolean().optional().describe("写入草稿后是否直接发布为一个正式版本"),
versionName: z.string().optional().describe("发布版本的名称(仅在 publish=true 时有效)")
}),
handler: async (
client: KyInstance,
params: {
file?: string;
dryRun?: boolean;
confirm?: boolean;
publish?: boolean;
versionName?: string;
},
context: ToolContext
) => {
const filePath = params.file ?? "./rules.local.json";
const local = loadLocalRulesFile(filePath);
const isConfirmed = params.confirm === true;
const isDryRun = params.dryRun ?? !isConfirmed;
const before = await api.listApprovalRules(client);
if (isDryRun) {
return {
corpId: context.corp.id,
dryRun: true,
localFile: local.resolvedPath,
localRulesCount: local.rules.length,
remoteDraftCount: before.rules.length,
willPublish: Boolean(params.publish),
message: "Preview mode. Use --yes or confirm=true to apply local rules to remote draft."
};
}
// Step 1: Clear existing draft rules
let deleted = 0;
for (const rule of before.rules) {
await api.deleteApprovalRule(client, rule.id);
deleted += 1;
}
// Step 2: Create new rules from local
const created: Array<{ id: string; description: string; code?: number }> = [];
for (const rule of local.rules) {
const strictness = rule.strictness?.toUpperCase()?.includes("SHOULD")
? "SHOULD_FOLLOW"
: rule.strictness?.toUpperCase()?.includes("SUGGEST")
? "SUGGESTION"
: "MUST_FOLLOW";
const newRule = await api.createApprovalRule(client, {
description: rule.description,
scope: rule.scope ?? "ALL",
strictness
});
created.push({ id: newRule.id, description: newRule.description, code: newRule.code });
}
// Step 3: Recode
await api.recodeApprovalRules(client);
// Step 4: Optional publish
let publishedVersion: unknown = undefined;
if (params.publish) {
const dateStr = new Date().toISOString().slice(0, 10).replace(/-/g, "");
const name = params.versionName || `v-local-${dateStr}-${Date.now().toString().slice(-4)}`;
publishedVersion = await api.publishApprovalRuleVersion(client, name);
}
return {
corpId: context.corp.id,
dryRun: false,
localFile: local.resolvedPath,
clearedDraftRules: deleted,
createdRules: created.length,
published: publishedVersion ?? false
};
}
},
{
name: "seal_approval_documents_list",
description: "列出 Seal 审批知识文档",
@@ -1361,6 +1535,25 @@ export const sealTools = [
};
}
},
{
name: "seal_webhook_material_pack",
description: "将官方材料包格式本地校验、解析并通过 Seal 入站 Webhook 触发 AI 审批;preview 模式不联网",
parameters: z.object({
filePath: z.string().describe("材料包 ZIP 或 信息表.xlsx 文件路径"),
mode: z.enum(["preview", "push"]).default("preview"),
webhook: z.string().optional().describe("Webhook ID 或名称,push 模式必填")
}),
handler: async (client: KyInstance, params: { filePath: string; mode?: "preview" | "push"; webhook?: string }) => {
const input = readMaterialPackFile(params.filePath);
if (params.mode !== "push") return previewMaterialPack(input.fileBuffer, input.fileName);
if (!params.webhook) throw new Error("push 模式需要 webhook");
const integration = api.findWebhookIntegration(await api.listWebhookIntegrations(client), params.webhook);
return pushMaterialPack(input.fileBuffer, input.fileName, {
webhookUrl: integration.incomingDocumentWebhook.url,
secret: integration.secret
});
}
},
{
name: "seal_approval_run_langfuse_bridge_get",
description: "从 Seal approval run 中抽取 Langfuse 定位信息;优先返回 _langfuseTraceId,没有时给出 hosecloud-{sourceDocumentSN} session 回退",
@@ -1839,214 +2032,10 @@ const sealToolByName = new Map<string, SealTool>(
sealTools.map((tool) => [tool.name, tool])
);
const mcpDirectToolNames = [
"seal_whoami",
"seal_approval_search",
"seal_approval_context_get"
] as const;
const sealActionNames = [
"seal_session_get",
"seal_approval_rules_list",
"seal_approval_rules_clear",
"seal_approval_rule_create",
"seal_approval_rule_update",
"seal_approval_rule_delete",
"seal_approval_rule_versions_list",
"seal_approval_rule_version_get",
"seal_approval_rule_get",
"seal_approval_rules_lint",
"seal_approval_rule_version_publish",
"seal_approval_documents_list",
"seal_approval_document_get",
"seal_approval_document_create",
"seal_approval_document_update",
"seal_approval_style_preferences_get",
"seal_approval_style_preferences_update",
"seal_webhook_list",
"seal_webhook_get",
"seal_webhook_add",
"seal_webhook_update",
"seal_webhook_delete",
"seal_approval_runs_summary",
"seal_approval_runs_stats",
"seal_approval_runs_count",
"seal_approval_run_get",
"seal_approval_run_cited_rules_get",
"seal_approval_run_document_summary_get",
"seal_approval_run_attachments_get",
"seal_approval_run_result_get",
"seal_approval_run_url_get",
"seal_approval_run_pick",
"seal_simulation_batch_records_get",
"seal_simulation_batch_create",
"seal_simulation_batch_wait",
"seal_simulation_batch_clean",
"seal_simulation_batches_list",
"seal_simulation_batch_get",
"seal_simulation_templates_get",
"seal_simulation_integrations_get",
"seal_simulation_specifications_list",
"seal_simulation_material_package_upload",
"seal_deploy_hosecloud_requirements",
"seal_deploy_hosecloud_list",
"seal_deploy_hosecloud_get",
"seal_deploy_hosecloud_status",
"seal_deploy_hosecloud_configure",
"seal_deploy_hosecloud_sync",
"seal_preference_get",
"seal_preference_decision_update",
"seal_preference_thinking_depth_set",
"seal_preference_thinking_depth_policies_list",
"seal_preference_thinking_depth_policies_upsert",
"seal_preference_thinking_depth_policies_remove",
"seal_approval_run_langfuse_bridge_get"
] as const;
const sealActionAliases: Record<string, (typeof sealActionNames)[number]> = {
"session.get": "seal_session_get",
"rule.list": "seal_approval_rules_list",
"rule.clear": "seal_approval_rules_clear",
"rule.create": "seal_approval_rule_create",
"rule.update": "seal_approval_rule_update",
"rule.delete": "seal_approval_rule_delete",
"rule.versions.list": "seal_approval_rule_versions_list",
"rule.version.get": "seal_approval_rule_version_get",
"rule.get": "seal_approval_rule_get",
"rule.lint": "seal_approval_rules_lint",
"rule.publish": "seal_approval_rule_version_publish",
"doc.list": "seal_approval_documents_list",
"doc.get": "seal_approval_document_get",
"doc.create": "seal_approval_document_create",
"doc.update": "seal_approval_document_update",
"style.get": "seal_approval_style_preferences_get",
"style.update": "seal_approval_style_preferences_update",
"webhook.list": "seal_webhook_list",
"webhook.get": "seal_webhook_get",
"webhook.add": "seal_webhook_add",
"webhook.update": "seal_webhook_update",
"webhook.delete": "seal_webhook_delete",
"runs.summary": "seal_approval_runs_summary",
"runs.stats": "seal_approval_runs_stats",
"runs.count": "seal_approval_runs_count",
"runs.get": "seal_approval_run_get",
"runs.citedRules": "seal_approval_run_cited_rules_get",
"runs.documentSummary": "seal_approval_run_document_summary_get",
"runs.attachments": "seal_approval_run_attachments_get",
"runs.result": "seal_approval_run_result_get",
"runs.url": "seal_approval_run_url_get",
"runs.pick": "seal_approval_run_pick",
"batch.records.get": "seal_simulation_batch_records_get",
"batch.create": "seal_simulation_batch_create",
"batch.wait": "seal_simulation_batch_wait",
"batch.clean": "seal_simulation_batch_clean",
"batch.list": "seal_simulation_batches_list",
"batch.get": "seal_simulation_batch_get",
"batch.templates.list": "seal_simulation_templates_get",
"batch.integrations.get": "seal_simulation_integrations_get",
"batch.specifications.list": "seal_simulation_specifications_list",
"batch.materialPackageUpload": "seal_simulation_material_package_upload",
"deploy.hosecloud.requirements": "seal_deploy_hosecloud_requirements",
"deploy.hosecloud.list": "seal_deploy_hosecloud_list",
"deploy.hosecloud.get": "seal_deploy_hosecloud_get",
"deploy.hosecloud.status": "seal_deploy_hosecloud_status",
"deploy.hosecloud.configure": "seal_deploy_hosecloud_configure",
"deploy.hosecloud.sync": "seal_deploy_hosecloud_sync",
"preference.get": "seal_preference_get",
"preference.decision.update": "seal_preference_decision_update",
"preference.thinkingDepth.set": "seal_preference_thinking_depth_set",
"preference.thinkingDepth.policies.list": "seal_preference_thinking_depth_policies_list",
"preference.thinkingDepth.policies.upsert": "seal_preference_thinking_depth_policies_upsert",
"preference.thinkingDepth.policies.remove": "seal_preference_thinking_depth_policies_remove",
"langfuse.bridge.get": "seal_approval_run_langfuse_bridge_get"
};
export const sealMcpTools: SealToolDefinition[] = [
...mcpDirectToolNames.map((name) => requiredTool(name)),
{
...requiredTool("seal_approval_runs_search"),
name: "seal_runs_search",
description: "查询 Seal 审批/审核运行记录,返回精简记录并按需提供 Langfuse trace/session 关联"
},
{
name: "seal_action",
description: "Seal 低频管理操作统一入口。传 action=help 查看可用动作;支持 rule/doc/style/webhook/runs/batch/langfuse 等管理与诊断操作。",
parameters: z.object({
action: z.string().describe("动作名,如 help、rule.create、doc.update、webhook.list、runs.summary、langfuse.bridge.get;也兼容旧 tool 名"),
payload: z.record(z.string(), z.unknown()).optional().describe("动作参数对象")
}),
handler: async (
client: KyInstance,
params: { action: string; payload?: Record<string, unknown> },
context: ToolContext
) => runSealAction(client, params, context)
}
];
export function findSealTool(name: string, options: { includeMcpAliases?: boolean } = {}) {
if (options.includeMcpAliases && name === "seal_runs_search") {
return requiredTool("seal_approval_runs_search");
}
export function findSealTool(name: string): SealTool | undefined {
return sealToolByName.get(name);
}
export function findSealMcpTool(name: string) {
return sealMcpTools.find((tool) => tool.name === name);
}
async function runSealAction(
client: KyInstance,
params: { action: string; payload?: Record<string, unknown> },
context: ToolContext
) {
const action = params.action?.trim();
if (!action || action === "help") {
return sealActionHelp(params.payload?.topic);
}
const toolName = sealActionAliases[action] ?? action;
if (!isSealActionToolName(toolName)) {
return {
error: `Unsupported seal_action action: ${action}`,
help: sealActionHelp(params.payload?.topic)
};
}
const tool = requiredTool(toolName);
const payload = params.payload ?? {};
return tool.handler(client, payload as never, context);
}
function sealActionHelp(topic: unknown) {
const normalizedTopic = typeof topic === "string" ? topic.trim() : undefined;
const actions = Object.entries(sealActionAliases)
.filter(([action]) => !normalizedTopic || action.startsWith(`${normalizedTopic}.`))
.map(([action, toolName]) => {
const tool = requiredTool(toolName);
return {
action,
toolName,
description: tool.description
};
});
return {
usage: "seal_action({ action, payload })",
topics: ["session", "rule", "doc", "style", "webhook", "runs", "batch", "langfuse"],
actions
};
}
function requiredTool(name: string): SealTool {
const tool = sealToolByName.get(name);
if (!tool) throw new Error(`Missing Seal tool: ${name}`);
return tool;
}
function isSealActionToolName(name: string): name is (typeof sealActionNames)[number] {
return sealActionNames.includes(name as (typeof sealActionNames)[number]);
}
function presentWebhookIntegration(
integration: WebhookIntegration,
includeSecret: boolean
@@ -2167,7 +2156,7 @@ export type SimulationBatchCreateInput = {
rawParams?: Record<string, unknown>;
};
export function parseDurationMs(duration: string): number {
function parseDurationMs(duration: string): number {
const match = duration.match(/^(\d+(?:\.\d+)?)\s*(ms|s|m|h|d)?$/i);
if (!match || !match[1]) return 600000;
const val = parseFloat(match[1]);
@@ -2182,7 +2171,7 @@ export function parseDurationMs(duration: string): number {
}
}
export function redactIntegrationSecrets(integration: Record<string, unknown>) {
function redactIntegrationSecrets(integration: Record<string, unknown>) {
return Object.fromEntries(
Object.entries(integration).map(([key, value]) => [
key,
@@ -2489,38 +2478,6 @@ function summarizeApprovalRunDocument(record: ApprovalRun) {
};
}
function extractApprovalRunAttachments(record: ApprovalRun, options: { summary?: boolean } = {}) {
const roots: Array<[string, unknown]> = [
["document", record.document],
["result", record.result],
["pipelineData", record.pipelineData],
["sourceExtendData", record.sourceExtendData]
];
const attachments: Array<Record<string, unknown>> = [];
const seen = new Set<string>();
for (const [path, value] of roots) {
collectAttachments(value, path, attachments, seen);
}
return {
recordId: record.id,
sourceDocumentSN: record.sourceDocumentSN,
sourceDocumentId: record.sourceDocumentId,
count: attachments.length,
attachments: options.summary
? attachments.map((attachment) => compactObject({
path: attachment.path,
kind: attachment.kind,
fileName: attachment.fileName,
mimeType: attachment.mimeType,
fileId: attachment.fileId,
sourceField: attachment.sourceField
}))
: attachments
};
}
function extractCitedRules(record: ApprovalRun) {
const candidates: Array<[string, unknown]> = [
["result.citedRules", getPath(record, "result.citedRules")],
@@ -2573,59 +2530,6 @@ function extractCitedRules(record: ApprovalRun) {
};
}
function collectAttachments(
value: unknown,
path: string,
output: Array<Record<string, unknown>>,
seen: Set<string>
) {
if (Array.isArray(value)) {
value.forEach((item, index) => collectAttachments(item, `${path}.${index}`, output, seen));
return;
}
const object = asRecord(value);
if (!object) return;
if (looksLikeAttachment(object, path)) {
const attachment = compactObject({
path,
fieldPath: path,
kind: inferAttachmentKind(path, object),
fileName: stringFromUnknown(object.fileName) ?? stringFromUnknown(object.filename) ?? stringFromUnknown(object.name) ?? stringFromUnknown(object.originalName),
mimeType: stringFromUnknown(object.mimeType) ?? stringFromUnknown(object.mimetype) ?? stringFromUnknown(object.contentType),
fileId: stringFromUnknown(object.fileId) ?? stringFromUnknown(object.id) ?? stringFromUnknown(object.attachmentId),
ossPath: stringFromUnknown(object.ossPath) ?? stringFromUnknown(object.ossKey) ?? stringFromUnknown(object.key),
url: stringFromUnknown(object.url) ?? stringFromUnknown(object.signedUrl) ?? stringFromUnknown(object.downloadUrl) ?? stringFromUnknown(object.previewUrl),
invoiceId: stringFromUnknown(object.invoiceId),
sourceField: stringFromUnknown(object.fieldName) ?? stringFromUnknown(object.label)
});
const key = JSON.stringify(attachment);
if (!seen.has(key)) {
seen.add(key);
output.push(attachment);
}
}
for (const [key, child] of Object.entries(object)) {
collectAttachments(child, `${path}.${key}`, output, seen);
}
}
function looksLikeAttachment(object: Record<string, unknown>, path: string) {
const keys = Object.keys(object).map((key) => key.toLowerCase());
const pathHint = /(attachment|attachments|invoice|receipt|file|files|附件|发票)/i.test(path);
const fileHints = ["filename", "fileName", "mimeType", "mimetype", "contentType", "fileId", "ossPath", "signedUrl", "downloadUrl", "previewUrl", "attachmentId"];
return pathHint && fileHints.some((key) => keys.includes(key.toLowerCase()));
}
function inferAttachmentKind(path: string, object: Record<string, unknown>) {
const normalized = `${path} ${stringFromUnknown(object.type) ?? ""}`.toLowerCase();
if (normalized.includes("invoice") || normalized.includes("发票")) return "invoice";
if (normalized.includes("receipt")) return "receipt";
return "attachment";
}
function firstPath(object: Record<string, unknown> | undefined, paths: readonly string[]) {
if (!object) return undefined;
for (const path of paths) {
+26 -23
View File
@@ -75,6 +75,18 @@ export async function handleHttpRequest(req: IncomingMessage, res: ServerRespons
return;
}
if (method === "POST" && (pathname === "/shutdown" || pathname === "/api/shutdown")) {
sendJson(res, 200, {
success: true,
message: "Shutting down seal-use background daemon",
pid: process.pid
});
setTimeout(() => {
process.kill(process.pid, "SIGTERM");
}, 50);
return;
}
// 3. Command Execution Endpoint: POST /api/cli
if (method === "POST" && pathname === "/api/cli") {
const body = await parseJsonBody(req);
@@ -112,7 +124,7 @@ export async function handleHttpRequest(req: IncomingMessage, res: ServerRespons
// 5. Generic Tool Invocation endpoint (POST /api/tool/:name)
if (method === "POST" && pathname.startsWith("/api/tool/")) {
const toolName = pathname.slice("/api/tool/".length).trim();
const tool = findSealTool(toolName, { includeMcpAliases: true });
const tool = findSealTool(toolName);
if (!tool) {
sendError(res, 404, `Tool not found: '${toolName}'`);
return;
@@ -393,28 +405,19 @@ export function extractCorpId(
}
export async function parseJsonBody(req: IncomingMessage): Promise<Record<string, unknown>> {
return new Promise((resolve, reject) => {
let raw = "";
req.on("data", (chunk) => {
raw += chunk;
if (raw.length > 20 * 1024 * 1024) {
// 20MB limit
reject(new Error("Payload too large"));
}
});
req.on("end", () => {
if (!raw.trim()) {
resolve({});
return;
}
try {
resolve(JSON.parse(raw));
} catch (err) {
reject(new Error(`Invalid JSON body: ${err instanceof Error ? err.message : String(err)}`));
}
});
req.on("error", reject);
});
let raw = "";
for await (const chunk of req) {
raw += chunk;
if (raw.length > 20 * 1024 * 1024) {
throw new Error("Payload too large");
}
}
if (!raw.trim()) return {};
try {
return JSON.parse(raw);
} catch (err) {
throw new Error(`Invalid JSON body: ${err instanceof Error ? err.message : String(err)}`);
}
}
export function sendJson(res: ServerResponse, statusCode: number, data: unknown) {
+5 -2
View File
@@ -8,9 +8,12 @@ export type HttpServerOptions = {
silent?: boolean;
};
export const DEFAULT_HTTP_PORT = 8787;
export const DEFAULT_HTTP_HOST = "127.0.0.1";
export async function startHttpServer(options: HttpServerOptions = {}): Promise<Server> {
const port = options.port ?? (process.env.PORT ? Number.parseInt(process.env.PORT, 10) : 8787);
const host = options.host ?? (process.env.HOST ? process.env.HOST : "127.0.0.1");
const port = options.port ?? (process.env.PORT ? Number.parseInt(process.env.PORT, 10) : DEFAULT_HTTP_PORT);
const host = options.host ?? (process.env.HOST ? process.env.HOST : DEFAULT_HTTP_HOST);
const server = createServer(async (req, res) => {
try {